claude-code-best 2.8.2 → 2.8.3

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 (443) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/{AddWorkspaceDirectory-BCCbaWoh.js → AddWorkspaceDirectory-CM5PYqoF.js} +1 -1
  3. package/dist/chunks/{App-BIAYUFvT.js → App-BLLQEMkd.js} +1 -1
  4. package/dist/chunks/ApproveApiKey-AMXQPmfE.js +1 -0
  5. package/dist/chunks/{ApproveApiKey-DRARgWX3.js → ApproveApiKey-DrflOSA-.js} +1 -1
  6. package/dist/chunks/{AssistantSessionChooser-eUrEGDlX.js → AssistantSessionChooser-SlRne98s.js} +1 -1
  7. package/dist/chunks/BackgroundTasksDialog-Cciww_FF.js +2 -0
  8. package/dist/chunks/{BypassPermissionsModeDialog-8z7R5EpU.js → BypassPermissionsModeDialog-HaciDdx0.js} +1 -1
  9. package/dist/chunks/{ClaudeInChromeOnboarding-B7mDm5Hb.js → ClaudeInChromeOnboarding-EA3k_q2M.js} +1 -1
  10. package/dist/chunks/ClaudeMdExternalIncludesDialog-C-T8G8O7.js +1 -0
  11. package/dist/chunks/{ClaudeMdExternalIncludesDialog-DE9dpWtg.js → ClaudeMdExternalIncludesDialog-xBclyqKk.js} +1 -1
  12. package/dist/chunks/ConsoleOAuthFlow-BTN62PKj.js +1 -0
  13. package/dist/chunks/{DesktopHandoff-Ce0nE7D6.js → DesktopHandoff-BhY_F3Ob.js} +1 -1
  14. package/dist/chunks/{DevChannelsDialog-mt0lA5wR.js → DevChannelsDialog-DU5komVT.js} +1 -1
  15. package/dist/chunks/DiffDialog-D_-znREV.js +3 -0
  16. package/dist/chunks/Doctor-BhrEYzPO.js +3 -0
  17. package/dist/chunks/Doctor-CjnUU1CY.js +1 -0
  18. package/dist/chunks/{ExitFlow-C3BGvwv-.js → ExitFlow-cRfxceuS.js} +2 -2
  19. package/dist/chunks/{Feedback-BtZb1A8b.js → Feedback-BMv8Kt05.js} +2 -2
  20. package/dist/chunks/Grove-CRAZGlvf.js +1 -0
  21. package/dist/chunks/{Grove-HpMLktXp.js → Grove-CjfR7Acp.js} +1 -1
  22. package/dist/chunks/{HybridTransport-COk7jAC7.js → HybridTransport-D32dn9xc.js} +1 -1
  23. package/dist/chunks/{ITermBackend-BlwyeN8U.js → ITermBackend-BxjzkptA.js} +1 -1
  24. package/dist/chunks/{InvalidConfigDialog-QVIRDXwA.js → InvalidConfigDialog-CnCOCqMT.js} +1 -1
  25. package/dist/chunks/{InvalidSettingsDialog-CZRZm0oa.js → InvalidSettingsDialog-CLOgpfR2.js} +1 -1
  26. package/dist/chunks/MCPConnectionManager-BhbT4Sah.js +1 -0
  27. package/dist/chunks/{McpParsingWarnings-DWMO0bV6.js → McpParsingWarnings-B5X5HVnQ.js} +1 -1
  28. package/dist/chunks/MessageSelector-DLofsxam.js +3 -0
  29. package/dist/chunks/Messages-D1-i4MMT.js +11 -0
  30. package/dist/chunks/{Onboarding-CHcND5Tt.js → Onboarding-Co5P3gZs.js} +1 -1
  31. package/dist/chunks/{OverageCreditUpsell-CMBqZrnz.js → OverageCreditUpsell-DjgcfVt2.js} +1 -1
  32. package/dist/chunks/PluginSettings-NB-Wod-9.js +17 -0
  33. package/dist/chunks/{PromptInputHelpMenu-CAwbW7z2.js → PromptInputHelpMenu-BDI5IF1s.js} +1 -1
  34. package/dist/chunks/QueryEngine-B217mLel.js +1 -0
  35. package/dist/chunks/REPL-BfprHNDt.js +1 -0
  36. package/dist/chunks/{REPL-Dx3SPe95.js → REPL-DCm_BFr_.js} +36 -36
  37. package/dist/chunks/{RemoteCallout-CwI1mLQ9.js → RemoteCallout-dGnKRIDB.js} +1 -1
  38. package/dist/chunks/{RemoteSessionManager-BXMBhfQD.js → RemoteSessionManager-BidAIOqZ.js} +2 -2
  39. package/dist/chunks/ResumeConversation-SDRT6hO3.js +1 -0
  40. package/dist/chunks/{SSETransport-Co-0nMlR.js → SSETransport-BM2xz03M.js} +1 -1
  41. package/dist/chunks/SearchExtraToolsTool-DCSReOsq.js +1 -0
  42. package/dist/chunks/{SentryErrorBoundary-kEgE7qeH.js → SentryErrorBoundary-D5niZGEU.js} +1 -1
  43. package/dist/chunks/SentryErrorBoundary-DzwCuftg.js +1 -0
  44. package/dist/chunks/Settings-D3ds_WCz.js +2 -0
  45. package/dist/chunks/{TeleportProgress--n-u7MYY.js → TeleportProgress-Dg6HcEO9.js} +1 -1
  46. package/dist/chunks/{TeleportRepoMismatchDialog-CzQzdYb2.js → TeleportRepoMismatchDialog-BUKNU2jx.js} +1 -1
  47. package/dist/chunks/{TeleportResumeWrapper-CtANoO1Z.js → TeleportResumeWrapper-5FTzA9R_.js} +1 -1
  48. package/dist/chunks/{ThemePicker-kBt6obJb.js → ThemePicker-Bdm12PmJ.js} +1 -1
  49. package/dist/chunks/{TmuxBackend-Q5xdOkW4.js → TmuxBackend-CYx3Hdf1.js} +2 -2
  50. package/dist/chunks/{TrustDialog-CoCFqyRD.js → TrustDialog-DGKf4iwh.js} +1 -1
  51. package/dist/chunks/{ValidationErrorsList-CL42YlaS.js → ValidationErrorsList-BP7vG1uX.js} +1 -1
  52. package/dist/chunks/{WelcomeV2-B0d9sH1c.js → WelcomeV2-k_969SnB.js} +1 -1
  53. package/dist/chunks/{WindowsTerminalBackend-CLSeqqHh.js → WindowsTerminalBackend-K_zVZBSP.js} +2 -2
  54. package/dist/chunks/{add-dir-IrADCHV-.js → add-dir-DnfUkb1n.js} +1 -1
  55. package/dist/chunks/{agentDisplay-BUXpQhYh.js → agentDisplay-DT04Kqdm.js} +1 -1
  56. package/dist/chunks/{agents-Cx0f6suK.js → agents-ELZyUElQ.js} +7 -7
  57. package/dist/chunks/{agents-BqQtaTaM.js → agents-hh7Zcqm6.js} +1 -1
  58. package/dist/chunks/{ant-BUkS8Em4.js → ant-CuQC6xHS.js} +1 -1
  59. package/dist/chunks/api-BY3NFL4L.js +1 -0
  60. package/dist/chunks/{api-Cy1N7XAQ.js → api-C-KY7A3r.js} +1 -1
  61. package/dist/chunks/asciicast-BeEmDIKr.js +1 -0
  62. package/dist/chunks/{asciicast-C_1Pi99k.js → asciicast-C0fPsv7_.js} +1 -1
  63. package/dist/chunks/assistant-C669PK45.js +1 -0
  64. package/dist/chunks/{assistant-C3dP-BSJ.js → assistant-DbtrknMt.js} +1 -1
  65. package/dist/chunks/{assistant-BGzd9a5x.js → assistant-Z-xFHPiY.js} +1 -1
  66. package/dist/chunks/{auth-DVtMm7Hj.js → auth-Bo_eeRO9.js} +1 -1
  67. package/dist/chunks/auth-C-rD91K7.js +1 -0
  68. package/dist/chunks/{autoMode-ThlM20qr.js → autoMode-BhsFtU8_.js} +6 -6
  69. package/dist/chunks/{autonomy-B637YdCF.js → autonomy-B-d3Xamr.js} +1 -1
  70. package/dist/chunks/{autonomy-B_vxYZbV.js → autonomy-C5wE-5B8.js} +12 -12
  71. package/dist/chunks/{autonomyPanel-BM2VhTsn.js → autonomyPanel-CMy4Zs1a.js} +1 -1
  72. package/dist/chunks/backgroundHousekeeping-YAOGWoo4.js +17 -0
  73. package/dist/chunks/backgroundHousekeeping-xFmPDL7y.js +1 -0
  74. package/dist/chunks/{branch-BlH5WYNu.js → branch-DoV3sEJf.js} +2 -2
  75. package/dist/chunks/{bridge-QRFJRzVG.js → bridge-8RYx23zW.js} +2 -2
  76. package/dist/chunks/{bridgeConfig-Di9LziJ3.js → bridgeConfig-C8tQXEsd.js} +1 -1
  77. package/dist/chunks/bridgeConfig-D5awYlvd.js +1 -0
  78. package/dist/chunks/bridgeEnabled-0tZw2TlM.js +1 -0
  79. package/dist/chunks/{bridgeEnabled-z1fPRzzV.js → bridgeEnabled-B3KTIVe4.js} +1 -1
  80. package/dist/chunks/bridgeMain-DKkE8RYG.js +1 -0
  81. package/dist/chunks/bridgeMain-Ssp8HRcV.js +68 -0
  82. package/dist/chunks/{bridgeMessaging-BG8fNZac.js → bridgeMessaging-DGTm_wDk.js} +1 -1
  83. package/dist/chunks/{btw-DpeWZQbf.js → btw-Du0mHeiD.js} +1 -1
  84. package/dist/chunks/{buddy-Bni2g0Km.js → buddy-D04AYSW6.js} +1 -1
  85. package/dist/chunks/{bypassPermissionsKillswitch-7e56Rquc.js → bypassPermissionsKillswitch-CRYkShwu.js} +1 -1
  86. package/dist/chunks/caches-Byd8SjTZ.js +1 -0
  87. package/dist/chunks/{caches-CzEBsMvP.js → caches-DYf69-N9.js} +2 -2
  88. package/dist/chunks/{ccrClient-iR6zwGb1.js → ccrClient-CDrBxSox.js} +1 -1
  89. package/dist/chunks/changeDetector-CGzGs92S.js +1 -0
  90. package/dist/chunks/{channelNotification-CSmLgwtO.js → channelNotification-CtA9HHFW.js} +1 -1
  91. package/dist/chunks/channelNotification-DOvTvOGt.js +1 -0
  92. package/dist/chunks/{chrome-BO1vbvZ0.js → chrome-BHbT4cc4.js} +1 -1
  93. package/dist/chunks/clear-BGLxPs_B.js +1 -0
  94. package/dist/chunks/client-CtOmoNuQ.js +1 -0
  95. package/dist/chunks/color-MOZYZ1cM.js +1 -0
  96. package/dist/chunks/commands-B3XpQmEm.js +1 -0
  97. package/dist/chunks/{commitAttribution-Djh1ZpYH.js → commitAttribution-BTtCTr8c.js} +1 -1
  98. package/dist/chunks/commitAttribution-CXNK79GW.js +1 -0
  99. package/dist/chunks/compact-CMqxm2yG.js +3 -0
  100. package/dist/chunks/{companion-C-jfFhlz.js → companion-ChxkOPHB.js} +1 -1
  101. package/dist/chunks/{config-DwsIX0hc.js → config-cRyRIPI7.js} +1 -1
  102. package/dist/chunks/{config-CloXpblh.js → config-wvQYYbwU.js} +1 -1
  103. package/dist/chunks/{context-DdwMoH4j.js → context-7ds9guuJ.js} +1 -1
  104. package/dist/chunks/{context-noninteractive-BWbEqad6.js → context-noninteractive-CISZymIU.js} +2 -2
  105. package/dist/chunks/context-noninteractive-CwJBBF8h.js +1 -0
  106. package/dist/chunks/conversation-Bgsdn99n.js +1 -0
  107. package/dist/chunks/conversation-D30CU_jS.js +1 -0
  108. package/dist/chunks/{copy-tl-41wwU.js → copy-Dvz2Mge4.js} +2 -2
  109. package/dist/chunks/{createSSHSession-B_IyqOll.js → createSSHSession-Befx8LiM.js} +1 -1
  110. package/dist/chunks/createSession-Cp0KTjPL.js +1 -0
  111. package/dist/chunks/{createSession-Csaqw8kb.js → createSession-CsZGoika.js} +1 -1
  112. package/dist/chunks/{cronJitterConfig-2sHTXBLu.js → cronJitterConfig-Dfl7iZqE.js} +3 -3
  113. package/dist/chunks/{crossProjectResume-C1I0X__e.js → crossProjectResume-DK8nt_cn.js} +3 -3
  114. package/dist/chunks/{datadog-BzkFYNcv.js → datadog-2vPhbh6g.js} +1 -1
  115. package/dist/chunks/datadog-DLTYg-S2.js +1 -0
  116. package/dist/chunks/{desktop-oTXppB2O.js → desktop-DY9Nw2Fi.js} +1 -1
  117. package/dist/chunks/{diff-B23DUoT8.js → diff-Ci6rs6S6.js} +1 -1
  118. package/dist/chunks/{directoryCompletion-DqtWZsoW.js → directoryCompletion-DLxCFk_m.js} +1 -1
  119. package/dist/chunks/{doctor-o2MJvjAE.js → doctor-DBYGgS-y.js} +1 -1
  120. package/dist/chunks/{effort-B1X_S_oa.js → effort-Bi_t4J_o.js} +2 -2
  121. package/dist/chunks/{entry-BAXMpXJ0.js → entry-p_5l64_p.js} +4 -4
  122. package/dist/chunks/{envLessBridgeConfig-YNTOVEqU.js → envLessBridgeConfig-C_sqoGX6.js} +1 -1
  123. package/dist/chunks/envLessBridgeConfig-Cfbqwjew.js +1 -0
  124. package/dist/chunks/exit-Bc8L5oQT.js +1 -0
  125. package/dist/chunks/{export-CqbYdFmJ.js → export-kvnEu9Iw.js} +1 -1
  126. package/dist/chunks/{exportRenderer-DP_z8YD1.js → exportRenderer-DmpMgUiv.js} +1 -1
  127. package/dist/chunks/extra-usage-BnO6knuC.js +1 -0
  128. package/dist/chunks/{extra-usage-BQ5Z1wJb.js → extra-usage-CmP6V7HX.js} +1 -1
  129. package/dist/chunks/{extra-usage-core-B1oJoxYa.js → extra-usage-core-BqJClmf4.js} +1 -1
  130. package/dist/chunks/{extra-usage-noninteractive-BV_6cpdd.js → extra-usage-noninteractive-BWyPFx53.js} +1 -1
  131. package/dist/chunks/extraUsage-DgMspmL4.js +1 -0
  132. package/dist/chunks/extractMemories-uQJS_i6E.js +1 -0
  133. package/dist/chunks/fast-Bunl4ivM.js +1 -0
  134. package/dist/chunks/{fast-BJMGfO_S.js → fast-Dd2jZVF-.js} +1 -1
  135. package/dist/chunks/{feedback-O0Gushxg.js → feedback-8UeDx3Yc.js} +1 -1
  136. package/dist/chunks/{firstPartyEventLogger-0s2WJ6SR.js → firstPartyEventLogger-cKEuzfyR.js} +1 -1
  137. package/dist/chunks/{flushGate-CLjpgnG6.js → flushGate-B3upNVdV.js} +1 -1
  138. package/dist/chunks/{gates-C5y8P5t9.js → gates-lWoKqpJ1.js} +1 -1
  139. package/dist/chunks/gates-uo2owWkc.js +1 -0
  140. package/dist/chunks/{gemini-D6lfJRGH.js → gemini-DDSP4ArG.js} +1 -1
  141. package/dist/chunks/{generateRecap-AYujRzfu.js → generateRecap-DCBzHqag.js} +1 -1
  142. package/dist/chunks/{generateSessionName-CXg1uVLN.js → generateSessionName-Db5pZ3cL.js} +1 -1
  143. package/dist/chunks/{githubRepoPathMapping-CdjkMIX3.js → githubRepoPathMapping-v_U9b0Fe.js} +1 -1
  144. package/dist/chunks/{goal-BGr-SlcA.js → goal-EZCOCHZa.js} +3 -3
  145. package/dist/chunks/{grok-DxyRt4Jq.js → grok-H8K_fDKF.js} +1 -1
  146. package/dist/chunks/{growthbook-D93ZmHUL.js → growthbook-mMD0jkbu.js} +1 -1
  147. package/dist/chunks/{heapdump-DZz5qnZg.js → heapdump-CbVvtQuH.js} +1 -1
  148. package/dist/chunks/{help-C8HhaC70.js → help-Bq4jxCSJ.js} +1 -1
  149. package/dist/chunks/hooks-CVlFJfV0.js +1 -0
  150. package/dist/chunks/{hooks-De2yBPig.js → hooks-DbKUS0fN.js} +2 -2
  151. package/dist/chunks/{hostAdapter-CZdJUeS1.js → hostAdapter-BhVpIn1Y.js} +1 -1
  152. package/dist/chunks/{ide-GnSLasRI.js → ide-DZJheXyl.js} +2 -2
  153. package/dist/chunks/{inboundAttachments-C8y3D5mp.js → inboundAttachments-B9NxWIDx.js} +1 -1
  154. package/dist/chunks/inboundAttachments-_vhgWPEL.js +1 -0
  155. package/dist/chunks/initReplBridge-BCIaWf78.js +1 -0
  156. package/dist/chunks/{insights-23tyPxXV.js → insights-D1BFvhw_.js} +68 -68
  157. package/dist/chunks/{install-BXi4d63r.js → install-D_xm-9s1.js} +1 -1
  158. package/dist/chunks/{install-github-app-D2X7BgzJ.js → install-github-app-CUEACXdr.js} +2 -2
  159. package/dist/chunks/{install-slack-app-_J1t0kSP.js → install-slack-app-DGV6l9wy.js} +1 -1
  160. package/dist/chunks/{instrumentation-C9WDRy-K.js → instrumentation-CEfWNakt.js} +3 -3
  161. package/dist/chunks/{job-DXX7dNN_.js → job-BeeAFieV.js} +1 -1
  162. package/dist/chunks/{keybindings-CChhkkE0.js → keybindings-CeYhuE5G.js} +2 -2
  163. package/dist/chunks/{lang-COIVItM_.js → lang-BmwAsgo1.js} +1 -1
  164. package/dist/chunks/{language-DzWvcLCu.js → language-BcWiv2lr.js} +1 -1
  165. package/dist/chunks/language-BnQye2Mx.js +1 -0
  166. package/dist/chunks/{launchAgentsPlatform-Du_WvKeU.js → launchAgentsPlatform-DqQzwcqV.js} +1 -1
  167. package/dist/chunks/{launchAutofixPr-CypNniKH.js → launchAutofixPr-XltBpICW.js} +3 -3
  168. package/dist/chunks/{launchLocalMemory-GkqB_Gcr.js → launchLocalMemory-CHSU4_or.js} +2 -2
  169. package/dist/chunks/{launchLocalVault-CBihJDzq.js → launchLocalVault-CnvCdQ1M.js} +3 -3
  170. package/dist/chunks/{launchMemoryStores-BkK0wwq0.js → launchMemoryStores-DD2duIDU.js} +1 -1
  171. package/dist/chunks/{launchOnboarding-BubTG5vY.js → launchOnboarding-JTKef_jU.js} +1 -1
  172. package/dist/chunks/{launchSchedule-CkV6Ai-0.js → launchSchedule-BVtfNQtS.js} +1 -1
  173. package/dist/chunks/{launchSkillStore-DIrFg_WZ.js → launchSkillStore-TisTmZ3O.js} +1 -1
  174. package/dist/chunks/{launchTeleport-DFrgN9sU.js → launchTeleport-BO_V6ggj.js} +3 -3
  175. package/dist/chunks/{launchVault-CIiNsg91.js → launchVault-Civro2KB.js} +1 -1
  176. package/dist/chunks/{loadAgentsDir-DC4jN6-f.js → loadAgentsDir-BfEZacjM.js} +740 -690
  177. package/dist/chunks/loadAgentsDir-rYxb2igq.js +1 -0
  178. package/dist/chunks/loadPluginHooks-Cniyh-tZ.js +1 -0
  179. package/dist/chunks/localSearch-C0J7ETJQ.js +1 -0
  180. package/dist/chunks/{localSearch-But4wyLg.js → localSearch-COJcqOWl.js} +1 -1
  181. package/dist/chunks/login-B4wjtpEU.js +1 -0
  182. package/dist/chunks/{login-ajsn1Sg7.js → login-SuUxFLIY.js} +1 -1
  183. package/dist/chunks/{logoV2Utils-CpeUvaOM.js → logoV2Utils-DvjpZkyF.js} +1 -1
  184. package/dist/chunks/logout-o16yNWNB.js +1 -0
  185. package/dist/chunks/{magicDocs-TF6U6QoB.js → magicDocs-BZBrH9zB.js} +2 -2
  186. package/dist/chunks/{main-bjQRqaUr.js → main-p9Tke3lb.js} +90 -63
  187. package/dist/chunks/{mappers-Bg-xtimK.js → mappers-BcXg_fI3.js} +1 -1
  188. package/dist/chunks/mcp-BFxLEf3X.js +1 -0
  189. package/dist/chunks/{mcp-i8lqdWTr.js → mcp-CIJL0PTq.js} +2 -2
  190. package/dist/chunks/mcp-DfuQ1MJu.js +6 -0
  191. package/dist/chunks/{mcpServer-CuqaXxiJ.js → mcpServer-D2kI_m2H.js} +1 -1
  192. package/dist/chunks/{mcpServer-Dr9UfcEd.js → mcpServer-DPk-oJOU.js} +1 -1
  193. package/dist/chunks/{memory-DVJxsbcO.js → memory-CJOtY_Uv.js} +1 -1
  194. package/dist/chunks/{mode-C9yWWppB.js → mode-DkpKiyTE.js} +1 -1
  195. package/dist/chunks/{model-Dq-13vaB.js → model-DZyzd39E.js} +1 -1
  196. package/dist/chunks/model-De0AGQ3F.js +1 -0
  197. package/dist/chunks/{onChangeAppState-Cc4zOnqx.js → onChangeAppState-CvtxqUDG.js} +1 -1
  198. package/dist/chunks/{openai-DMCGGZts.js → openai-B888nVou.js} +3 -3
  199. package/dist/chunks/{overageCreditGrant-CzkWDmsQ.js → overageCreditGrant-BOSyVk3U.js} +1 -1
  200. package/dist/chunks/{panelCall-D36EWzwF.js → panelCall-BVdu8oii.js} +1 -1
  201. package/dist/chunks/{passes-CPAwB9_F.js → passes-DeSsjipz.js} +1 -1
  202. package/dist/chunks/{path-BE28AJwZ.js → path-Cit7LKW-.js} +1 -1
  203. package/dist/chunks/{paths-CEAy4QCs.js → paths-nIHVpTn2.js} +3 -3
  204. package/dist/chunks/permissions-DGdr-wOj.js +3 -0
  205. package/dist/chunks/{pipeTransport-7auNUakO.js → pipeTransport-ClZYq1sd.js} +1 -1
  206. package/dist/chunks/{plan-pCEs76NM.js → plan-D9bnkDwv.js} +1 -1
  207. package/dist/chunks/{plugin-BSC-7wQh.js → plugin-BE0r1g1g.js} +1 -1
  208. package/dist/chunks/{pluginAutoupdate-Cre72Rtf.js → pluginAutoupdate-xyXksEJv.js} +1 -1
  209. package/dist/chunks/pluginBlocklist-Dd7XBe8U.js +1 -0
  210. package/dist/chunks/{pluginCliCommands-CTxmCPph.js → pluginCliCommands-8MJCk1nq.js} +1 -1
  211. package/dist/chunks/{pluginFlagging-C5EGcjZe.js → pluginFlagging-7zuXXBD5.js} +1 -1
  212. package/dist/chunks/pluginOperations-DFzbASMD.js +2 -0
  213. package/dist/chunks/{pluginStartupCheck-B3QqfRt6.js → pluginStartupCheck-BC5npqdw.js} +1 -1
  214. package/dist/chunks/pluginStartupCheck-C6IH0haF.js +1 -0
  215. package/dist/chunks/plugins-Bhc2pbAj.js +4 -0
  216. package/dist/chunks/policyLimits-CfrU0rIR.js +1 -0
  217. package/dist/chunks/{pollConfig-CyO4Ycwc.js → pollConfig-B3hNYQ_n.js} +1 -1
  218. package/dist/chunks/{poor-eRoBwI0Z.js → poor-BjTGCuqc.js} +1 -1
  219. package/dist/chunks/{poorMode-BdNsLBQ-.js → poorMode-CGVMMLlz.js} +1 -1
  220. package/dist/chunks/poorMode-DWLhTldO.js +1 -0
  221. package/dist/chunks/{print-Ogibzjap.js → print-BJkyuCzw.js} +11 -11
  222. package/dist/chunks/{privacy-settings-Dd7PtKbY.js → privacy-settings-BDVjqVcX.js} +1 -1
  223. package/dist/chunks/processBashCommand-DnzyTwtS.js +1 -0
  224. package/dist/chunks/processSlashCommand-BGBRvSCA.js +6 -0
  225. package/dist/chunks/prompt-BXrvaHyx.js +1 -0
  226. package/dist/chunks/{prompt-BHI7PZe4.js → prompt-DgIuTC6Q.js} +1 -1
  227. package/dist/chunks/prompt-Fax-fxAf.js +1 -0
  228. package/dist/chunks/{promptEditor-DoJ-xPi4.js → promptEditor-BkHY_Vzb.js} +2 -2
  229. package/dist/chunks/{protocolHandler-Dgzu5UWb.js → protocolHandler-CrXWRkxh.js} +1 -1
  230. package/dist/chunks/rate-limit-options-skMSi19l.js +1 -0
  231. package/dist/chunks/{rcDebugLog-C0Bam8V9.js → rcDebugLog-Bv_x5w_B.js} +1 -1
  232. package/dist/chunks/{referral-B10JtHMk.js → referral-DfKWr4Jf.js} +1 -1
  233. package/dist/chunks/refresh-zosTlttX.js +1 -0
  234. package/dist/chunks/{registerProtocol-CQjmvg7a.js → registerProtocol-De6y1iOi.js} +1 -1
  235. package/dist/chunks/registry-C8JbYbJI.js +1 -0
  236. package/dist/chunks/{release-notes-dxng0ob_.js → release-notes-Su1UPyE4.js} +1 -1
  237. package/dist/chunks/{releaseNotes-CS5L5W0H.js → releaseNotes-C7-JnhrH.js} +2 -2
  238. package/dist/chunks/{reload-plugins-CgzAjBDp.js → reload-plugins-C8lWCq8M.js} +1 -1
  239. package/dist/chunks/{remote-env-BasfU8Ra.js → remote-env-tQuvJmrt.js} +1 -1
  240. package/dist/chunks/{remoteBridgeCore-IJI5koHz.js → remoteBridgeCore-CwOTDmNP.js} +1 -1
  241. package/dist/chunks/{remoteControlServer-BBCt7ySV.js → remoteControlServer-DIKi-0lr.js} +2 -2
  242. package/dist/chunks/rename-Trg9EHjT.js +1 -0
  243. package/dist/chunks/{resume-DjnfattK.js → resume-Nt_EbjKh.js} +2 -2
  244. package/dist/chunks/{runtimeObserver-ByTBtmBf.js → runtimeObserver-CyWhTJpz.js} +4 -4
  245. package/dist/chunks/{runtimeObserver-COpkJmg-.js → runtimeObserver-T9QERJ_O.js} +1 -1
  246. package/dist/chunks/sandbox-adapter-BDGhDrPl.js +1 -0
  247. package/dist/chunks/{sandbox-toggle-CQohaYND.js → sandbox-toggle-C6v31S7-.js} +1 -1
  248. package/dist/chunks/searchExtraTools-C8ehknh0.js +1 -0
  249. package/dist/chunks/{sentry-C0bQlih_.js → sentry-CK_GHX79.js} +1 -1
  250. package/dist/chunks/{session-Dx_ODOHl.js → session-Ys3KvmQ0.js} +1 -1
  251. package/dist/chunks/{sessionDiscovery-DAqs0Ra6.js → sessionDiscovery-Cg3X2fKe.js} +1 -1
  252. package/dist/chunks/sessionFileAccessHooks-vthxapHk.js +1 -0
  253. package/dist/chunks/sessionMemory-ek1SfYG_.js +1 -0
  254. package/dist/chunks/sessionMemory-l-S0jpuk.js +1 -0
  255. package/dist/chunks/sessionMemoryUtils-BGJeJyKn.js +1 -0
  256. package/dist/chunks/sessionObserver-COTvvM3Z.js +1 -0
  257. package/dist/chunks/{sessionObserver-rd6RRTzc.js → sessionObserver-DvAdG6vQ.js} +2 -2
  258. package/dist/chunks/sessionStorage-GKe4ALVr.js +1 -0
  259. package/dist/chunks/{sessionTitle-1k_2BhFL.js → sessionTitle-DJMmUKBJ.js} +2 -2
  260. package/dist/chunks/{sessionTracing-DNSDPYdR.js → sessionTracing-DuQ3kbq6.js} +1 -1
  261. package/dist/chunks/{settingsSync-3xG2A_wN.js → settingsSync-1mhDakFG.js} +1 -1
  262. package/dist/chunks/{setup-Hlga8GJ_.js → setup-CAy0HkI3.js} +1 -1
  263. package/dist/chunks/setup-CGxUKG8x.js +3 -0
  264. package/dist/chunks/{setup-CY808VaY.js → setup-D5ioKRsS.js} +1 -1
  265. package/dist/chunks/{shadowedRuleDetection-BdBNo5eP.js → shadowedRuleDetection-Cq0y9pLR.js} +1 -1
  266. package/dist/chunks/{sideQuestion-DWOCUKMh.js → sideQuestion-ZII6LMSM.js} +3 -3
  267. package/dist/chunks/{sink-DCh0VJ4g.js → sink-Cd5g6Qqh.js} +1 -1
  268. package/dist/chunks/sink-Df9tds-b.js +1 -0
  269. package/dist/chunks/sinks-C4DwU8Xs.js +1 -0
  270. package/dist/chunks/{sinks-_9T2oPB_.js → sinks-DZlIEjLZ.js} +2 -2
  271. package/dist/chunks/{skill-learning-CzZFGFZO.js → skill-learning-DO21PjpF.js} +1 -1
  272. package/dist/chunks/skillChangeDetector-B6tL2yC9.js +1 -0
  273. package/dist/chunks/{skillGapStore-DJm3SULe.js → skillGapStore-B_xv3GUy.js} +1 -1
  274. package/dist/chunks/{skillGapStore-Bz_qbwI1.js → skillGapStore-CTD8MYTx.js} +2 -2
  275. package/dist/chunks/{skillGenerator-BcNv-VZ5.js → skillGenerator-CO9r-gft.js} +2 -2
  276. package/dist/chunks/skillLearning-BJS4lsNk.js +1 -0
  277. package/dist/chunks/skillLearning-C2NmdcYQ.js +1 -0
  278. package/dist/chunks/{skillPanel-Q85P-Gg4.js → skillPanel-DSumFGKN.js} +3 -3
  279. package/dist/chunks/{skillSearchPanel-CMCQDAcX.js → skillSearchPanel-SqkfYBjV.js} +4 -4
  280. package/dist/chunks/{skills-D3eUg3HG.js → skills-Bj3g5apl.js} +1 -1
  281. package/dist/chunks/{sprites-ChoMSqpa.js → sprites-CxMz3tIE.js} +1 -1
  282. package/dist/chunks/{stats-DdhEa_6-.js → stats-D1wYx84O.js} +1 -1
  283. package/dist/chunks/{status-CX7Kgn21.js → status-BWCqbeJ3.js} +1 -1
  284. package/dist/chunks/statusNoticeHelpers-DY0Cblkd.js +1 -0
  285. package/dist/chunks/{tag-BJ_u3aJm.js → tag-Hc7nOYm5.js} +2 -2
  286. package/dist/chunks/{tasks-DeEWOchP.js → tasks-BSqecqVm.js} +1 -1
  287. package/dist/chunks/{teamHelpers-WmWa_h3B.js → teamHelpers-BOmVFTLS.js} +1 -1
  288. package/dist/chunks/teamHelpers-BueGmQcw.js +1 -0
  289. package/dist/chunks/{teammateModeSnapshot-DZ6ulELC.js → teammateModeSnapshot-DhXjREuo.js} +1 -1
  290. package/dist/chunks/teammateModeSnapshot-_MCm6NGJ.js +1 -0
  291. package/dist/chunks/teleport-W2iPwivh.js +1 -0
  292. package/dist/chunks/{templateJobs-nFBp68za.js → templateJobs-1oMC9yLQ.js} +1 -1
  293. package/dist/chunks/{terminalSetup-DULcnnWe.js → terminalSetup-Bkml3uSP.js} +1 -1
  294. package/dist/chunks/{terminalSetup-BORjK3qH.js → terminalSetup-DJX1hqKs.js} +1 -1
  295. package/dist/chunks/{theme-Bf2QD0ja.js → theme-ia4cIc4d.js} +1 -1
  296. package/dist/chunks/thinkback-1NYskewu.js +1 -0
  297. package/dist/chunks/{thinkback-DZEhr3Ii.js → thinkback-DWLUXUQC.js} +1 -1
  298. package/dist/chunks/thinkback-play-DZmXMRtq.js +1 -0
  299. package/dist/chunks/{toolEventObserver-DMdrez6V.js → toolEventObserver-Ci0BECRu.js} +1 -1
  300. package/dist/chunks/{toolEventObserver-CNZy5TpN.js → toolEventObserver-nPwMQ5Vf.js} +1 -1
  301. package/dist/chunks/toolPool-ByCdlOak.js +1 -0
  302. package/dist/chunks/toolPool-IkNWjuk2.js +1 -0
  303. package/dist/chunks/{trustedDevice-Dw2crViN.js → trustedDevice-BynTLVs4.js} +1 -1
  304. package/dist/chunks/{trustedDevice-DWb5CPB_.js → trustedDevice-CtL2IGDX.js} +1 -1
  305. package/dist/chunks/{ultrareviewCommand-BfN25zni.js → ultrareviewCommand-DN-QhQ-f.js} +2 -2
  306. package/dist/chunks/undercover-CqJzV_Ar.js +1 -0
  307. package/dist/chunks/{undercover-rcR56jZx.js → undercover-DLr5xI3K.js} +1 -1
  308. package/dist/chunks/{updateCCB-DlTAqQJq.js → updateCCB-C6Ov8SNx.js} +4 -4
  309. package/dist/chunks/{upgrade-ClLcX7zy.js → upgrade-CVM1ffhq.js} +1 -1
  310. package/dist/chunks/upgrade-d40dVpDc.js +1 -0
  311. package/dist/chunks/{upload-BqEzK59v.js → upload-DSNwGLNd.js} +1 -1
  312. package/dist/chunks/{usage-BgKDh8pQ.js → usage-BRv8mBDf.js} +1 -1
  313. package/dist/chunks/{usage-DW-akzSR.js → usage-GMw8NiO_.js} +1 -1
  314. package/dist/chunks/{useMainLoopModel-BTpZ8k3k.js → useMainLoopModel-CEM_50a0.js} +1 -1
  315. package/dist/chunks/{useManagePlugins-z0qezP5r.js → useManagePlugins-hCqb5F5n.js} +1 -1
  316. package/dist/chunks/{useMergedTools-B78rAreW.js → useMergedTools-DxvRmxVF.js} +1 -1
  317. package/dist/chunks/{useSearchInput-CwxF3CHN.js → useSearchInput-BCErnYur.js} +1 -1
  318. package/dist/chunks/useSettingsErrors-BwNeCSA6.js +1 -0
  319. package/dist/chunks/{useVoice-X5WSnyed.js → useVoice-Cu39ifSa.js} +1 -1
  320. package/dist/chunks/{util-CP-_gsEO.js → util-DYuasrIE.js} +1 -1
  321. package/dist/chunks/utils-DSGFJaZ_.js +1 -0
  322. package/dist/chunks/{validatePlugin-DUuaprqR.js → validatePlugin-b1ec7M7n.js} +1 -1
  323. package/dist/chunks/{vim-BfmsdxOa.js → vim-CrAzv4cM.js} +1 -1
  324. package/dist/chunks/{voice-B3GIfFlB.js → voice-DKG3SYqi.js} +2 -2
  325. package/dist/chunks/{voiceModeEnabled-C1Q9j5q6.js → voiceModeEnabled-By2qa3A2.js} +1 -1
  326. package/dist/chunks/voiceModeEnabled-DwYcj-FH.js +1 -0
  327. package/dist/chunks/voiceStreamSTT-DD8ulbg1.js +1 -0
  328. package/dist/chunks/{voiceStreamSTT-BguyxdrW.js → voiceStreamSTT-DEV82xnN.js} +1 -1
  329. package/dist/chunks/{web-tools-qf_VwWRn.js → web-tools-8QRyE7va.js} +1 -1
  330. package/dist/chunks/windowsPaths-CRq9Bt5c.js +1 -0
  331. package/dist/chunks/windowsPaths-jbJ-skB_.js +1 -0
  332. package/dist/chunks/{workerRegistry-SbiLJIsG.js → workerRegistry-S7pO5khK.js} +1 -1
  333. package/dist/chunks/worktree-CfXrXsQ2.js +1 -0
  334. package/dist/chunks/{xml-D7-jJqSA.js → xml-CPJXOUFt.js} +1 -1
  335. package/dist/cli.js +1 -1
  336. package/package.json +1 -1
  337. package/dist/chunks/ApproveApiKey-Do-Qth0X.js +0 -1
  338. package/dist/chunks/BackgroundTasksDialog-DSeAqhMC.js +0 -2
  339. package/dist/chunks/ClaudeMdExternalIncludesDialog-DTZS-dek.js +0 -1
  340. package/dist/chunks/ConsoleOAuthFlow-UcQCmIWd.js +0 -1
  341. package/dist/chunks/DiffDialog-BfSnz8L-.js +0 -3
  342. package/dist/chunks/Doctor-BOVjkAKn.js +0 -3
  343. package/dist/chunks/Doctor-osWC5WVY.js +0 -1
  344. package/dist/chunks/Grove-DyC_Wrfx.js +0 -1
  345. package/dist/chunks/MCPConnectionManager-2Fulnp8q.js +0 -1
  346. package/dist/chunks/MessageSelector-B4jJQ-KQ.js +0 -3
  347. package/dist/chunks/Messages-ltcn1Qkf.js +0 -11
  348. package/dist/chunks/PluginSettings-DIS_qrVA.js +0 -17
  349. package/dist/chunks/QueryEngine-BQs519Rb.js +0 -1
  350. package/dist/chunks/REPL-DJh_wVWI.js +0 -1
  351. package/dist/chunks/ResumeConversation-BK7L_YBI.js +0 -1
  352. package/dist/chunks/SearchExtraToolsTool-DVi-ggud.js +0 -1
  353. package/dist/chunks/SentryErrorBoundary-DLML64E_.js +0 -1
  354. package/dist/chunks/Settings-DOve7mW1.js +0 -2
  355. package/dist/chunks/api-CoBZPEi-.js +0 -1
  356. package/dist/chunks/asciicast-DA6TudSH.js +0 -1
  357. package/dist/chunks/assistant-B2_c5C4T.js +0 -1
  358. package/dist/chunks/auth-CRVuUNwf.js +0 -1
  359. package/dist/chunks/backgroundHousekeeping-BWAfdRVf.js +0 -1
  360. package/dist/chunks/backgroundHousekeeping-Cll7XHG1.js +0 -17
  361. package/dist/chunks/bridgeConfig-pVTHa_ED.js +0 -1
  362. package/dist/chunks/bridgeEnabled-c_BeJX3S.js +0 -1
  363. package/dist/chunks/bridgeMain-CHk_DCxy.js +0 -1
  364. package/dist/chunks/bridgeMain-DVoobI7G.js +0 -68
  365. package/dist/chunks/caches-3byHT6VF.js +0 -1
  366. package/dist/chunks/changeDetector-Cg75mKOu.js +0 -1
  367. package/dist/chunks/channelNotification-BSmZprUZ.js +0 -1
  368. package/dist/chunks/clear-CTOCrXv_.js +0 -1
  369. package/dist/chunks/client-BgdjJNnC.js +0 -1
  370. package/dist/chunks/color-BP4FmcMn.js +0 -1
  371. package/dist/chunks/commands-CkfOhzGE.js +0 -1
  372. package/dist/chunks/commitAttribution-DKvggTZx.js +0 -1
  373. package/dist/chunks/compact-BtAvCkY0.js +0 -3
  374. package/dist/chunks/context-noninteractive-DNOyQYnM.js +0 -1
  375. package/dist/chunks/conversation-DR4MFYYi.js +0 -1
  376. package/dist/chunks/conversation-DVhyJA1O.js +0 -1
  377. package/dist/chunks/createSession-CIM50iEU.js +0 -1
  378. package/dist/chunks/datadog-vQKKqB6Z.js +0 -1
  379. package/dist/chunks/envLessBridgeConfig-Dj0umjOo.js +0 -1
  380. package/dist/chunks/exit-CwGJifQF.js +0 -1
  381. package/dist/chunks/extra-usage-1FUBiJOE.js +0 -1
  382. package/dist/chunks/extraUsage-Ca_6qcke.js +0 -1
  383. package/dist/chunks/extractMemories-B-yrLjpP.js +0 -1
  384. package/dist/chunks/fast-CFtN26up.js +0 -1
  385. package/dist/chunks/gates-4fq2Ws2D.js +0 -1
  386. package/dist/chunks/hooks-CmW7bdtz.js +0 -1
  387. package/dist/chunks/inboundAttachments-DZiITyN8.js +0 -1
  388. package/dist/chunks/initReplBridge-YGXqLbNZ.js +0 -1
  389. package/dist/chunks/language-CiMwEWO-.js +0 -1
  390. package/dist/chunks/loadAgentsDir-CjhNkoq0.js +0 -1
  391. package/dist/chunks/loadPluginHooks-DukITDP2.js +0 -1
  392. package/dist/chunks/localSearch-D8FFon8N.js +0 -1
  393. package/dist/chunks/login-B3TV33p4.js +0 -1
  394. package/dist/chunks/logout-BqbTEPv9.js +0 -1
  395. package/dist/chunks/mcp-DtHGTZUo.js +0 -1
  396. package/dist/chunks/mcp-Vj0ijoSq.js +0 -6
  397. package/dist/chunks/model-BYSyXf9-.js +0 -1
  398. package/dist/chunks/permissions-B39hfy0O.js +0 -3
  399. package/dist/chunks/pluginBlocklist-D2Cj4TR2.js +0 -1
  400. package/dist/chunks/pluginOperations-DDI1CG0K.js +0 -2
  401. package/dist/chunks/pluginStartupCheck-DYC8CWxw.js +0 -1
  402. package/dist/chunks/plugins-Bz7JxD43.js +0 -4
  403. package/dist/chunks/policyLimits-C-oHygGe.js +0 -1
  404. package/dist/chunks/poorMode-D2-4vRxb.js +0 -1
  405. package/dist/chunks/processBashCommand-BjdUo_Na.js +0 -1
  406. package/dist/chunks/processSlashCommand-tetvMLMl.js +0 -6
  407. package/dist/chunks/prompt-DZ1EAUlC.js +0 -1
  408. package/dist/chunks/prompt-DeRHlPn1.js +0 -1
  409. package/dist/chunks/rate-limit-options-B6QH2-xn.js +0 -1
  410. package/dist/chunks/refresh-DmEsCaJ0.js +0 -1
  411. package/dist/chunks/registry-CLaXh4Gk.js +0 -1
  412. package/dist/chunks/rename-eEdSZsJ2.js +0 -1
  413. package/dist/chunks/sandbox-adapter-DagBhoTC.js +0 -1
  414. package/dist/chunks/searchExtraTools-kk-wV-cC.js +0 -1
  415. package/dist/chunks/sessionFileAccessHooks-C-Ic-0Ry.js +0 -1
  416. package/dist/chunks/sessionMemory-BMtFup-Y.js +0 -1
  417. package/dist/chunks/sessionMemory-Bq3ECr1S.js +0 -1
  418. package/dist/chunks/sessionMemoryUtils-BU7N_IQG.js +0 -1
  419. package/dist/chunks/sessionObserver-BwAfzGUg.js +0 -1
  420. package/dist/chunks/sessionStorage-X2u45U9z.js +0 -1
  421. package/dist/chunks/setup-C2V4elOv.js +0 -3
  422. package/dist/chunks/sink-nZmawD5W.js +0 -1
  423. package/dist/chunks/sinks-BTZnXPr_.js +0 -1
  424. package/dist/chunks/skillChangeDetector-345QNWDp.js +0 -1
  425. package/dist/chunks/skillLearning-BJAfTX2G.js +0 -1
  426. package/dist/chunks/skillLearning-DPhuKS4j.js +0 -1
  427. package/dist/chunks/statusNoticeHelpers-AibXOONm.js +0 -1
  428. package/dist/chunks/teamHelpers-CxoQp7OY.js +0 -1
  429. package/dist/chunks/teammateModeSnapshot-KWxn1jxl.js +0 -1
  430. package/dist/chunks/teleport-CuDXJj_f.js +0 -1
  431. package/dist/chunks/thinkback-C1nnGg5r.js +0 -1
  432. package/dist/chunks/thinkback-play-BtEBESXM.js +0 -1
  433. package/dist/chunks/toolPool-DDj2TbY6.js +0 -1
  434. package/dist/chunks/toolPool-DHQyHmDY.js +0 -1
  435. package/dist/chunks/undercover-DSp7SB7e.js +0 -1
  436. package/dist/chunks/upgrade-kf1QWUo7.js +0 -1
  437. package/dist/chunks/useSettingsErrors-CjDaon07.js +0 -1
  438. package/dist/chunks/utils-CULcnflj.js +0 -1
  439. package/dist/chunks/voiceModeEnabled-BrA5ZhH4.js +0 -1
  440. package/dist/chunks/voiceStreamSTT-Dmp7Vm1S.js +0 -1
  441. package/dist/chunks/windowsPaths-BeDSnJ23.js +0 -2
  442. package/dist/chunks/windowsPaths-ttHiMKpR.js +0 -1
  443. package/dist/chunks/worktree-Djga1wtm.js +0 -1
@@ -1 +1 @@
1
- import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Q as n,Rn as r,b as i,t as a,x as o}from"./src-Di342QoJ.js";import{t as s}from"./jsx-runtime-D-D469L8.js";import{Dw as c,Ow as l,Vw as u,gw as d,zw as f}from"./loadAgentsDir-DC4jN6-f.js";function p({scope:e,parsingErrors:t,warnings:n}){let r=t.length>0,a=n.length>0;return!r&&!a?null:(0,_.jsxs)(o,{flexDirection:`column`,marginTop:1,children:[(0,_.jsxs)(o,{children:[(r||a)&&(0,_.jsxs)(i,{color:r?`error`:`warning`,children:[`[`,r?`Failed to parse`:`Contains warnings`,`] `]}),(0,_.jsx)(i,{children:c(e)})]}),(0,_.jsxs)(o,{children:[(0,_.jsx)(i,{dimColor:!0,children:`Location: `}),(0,_.jsx)(i,{dimColor:!0,children:d(e)})]}),(0,_.jsxs)(o,{marginLeft:1,flexDirection:`column`,children:[t.map((e,t)=>{let n=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(o,{children:(0,_.jsxs)(i,{children:[(0,_.jsx)(i,{dimColor:!0,children:`└ `}),(0,_.jsx)(i,{color:`error`,children:`[Error]`}),(0,_.jsxs)(i,{dimColor:!0,children:[` `,n&&`[${n}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`error-${t}`)}),n.map((e,t)=>{let n=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(o,{children:(0,_.jsxs)(i,{children:[(0,_.jsx)(i,{dimColor:!0,children:`└ `}),(0,_.jsx)(i,{color:`warning`,children:`[Warning]`}),(0,_.jsxs)(i,{dimColor:!0,children:[` `,n&&`[${n}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`warning-${t}`)})]})]})}function m(){let e=(0,g.useMemo)(()=>[{scope:`user`,config:f(`user`)},{scope:`project`,config:f(`project`)},{scope:`local`,config:f(`local`)},{scope:`enterprise`,config:f(`enterprise`)}],[]),t=e.some(({config:e})=>h(e.errors,`fatal`).length>0),r=e.some(({config:e})=>h(e.errors,`warning`).length>0);return!t&&!r?null:(0,_.jsxs)(o,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,_.jsx)(i,{bold:!0,children:`MCP Config Diagnostics`}),(0,_.jsx)(o,{marginTop:1,children:(0,_.jsxs)(i,{dimColor:!0,children:[`For help configuring MCP servers, see:`,` `,(0,_.jsx)(n,{url:`https://code.claude.com/docs/en/mcp`,children:`https://code.claude.com/docs/en/mcp`})]})}),e.map(({scope:e,config:t})=>(0,_.jsx)(p,{scope:e,parsingErrors:h(t.errors,`fatal`),warnings:h(t.errors,`warning`)},e))]})}function h(e,t){return e.filter(e=>e.mcpErrorMetadata?.severity===t)}var g,_,v=e((()=>{g=t(r()),u(),l(),a(),_=s()}));export{v as n,m as t};
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Q as n,Rn as r,b as i,t as a,x as o}from"./src-Di342QoJ.js";import{t as s}from"./jsx-runtime-D-D469L8.js";import{Aw as c,Uw as l,Vw as u,kw as d,vw as f}from"./loadAgentsDir-BfEZacjM.js";function p({scope:e,parsingErrors:t,warnings:n}){let r=t.length>0,a=n.length>0;return!r&&!a?null:(0,_.jsxs)(o,{flexDirection:`column`,marginTop:1,children:[(0,_.jsxs)(o,{children:[(r||a)&&(0,_.jsxs)(i,{color:r?`error`:`warning`,children:[`[`,r?`Failed to parse`:`Contains warnings`,`] `]}),(0,_.jsx)(i,{children:d(e)})]}),(0,_.jsxs)(o,{children:[(0,_.jsx)(i,{dimColor:!0,children:`Location: `}),(0,_.jsx)(i,{dimColor:!0,children:f(e)})]}),(0,_.jsxs)(o,{marginLeft:1,flexDirection:`column`,children:[t.map((e,t)=>{let n=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(o,{children:(0,_.jsxs)(i,{children:[(0,_.jsx)(i,{dimColor:!0,children:`└ `}),(0,_.jsx)(i,{color:`error`,children:`[Error]`}),(0,_.jsxs)(i,{dimColor:!0,children:[` `,n&&`[${n}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`error-${t}`)}),n.map((e,t)=>{let n=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(o,{children:(0,_.jsxs)(i,{children:[(0,_.jsx)(i,{dimColor:!0,children:`└ `}),(0,_.jsx)(i,{color:`warning`,children:`[Warning]`}),(0,_.jsxs)(i,{dimColor:!0,children:[` `,n&&`[${n}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`warning-${t}`)})]})]})}function m(){let e=(0,g.useMemo)(()=>[{scope:`user`,config:u(`user`)},{scope:`project`,config:u(`project`)},{scope:`local`,config:u(`local`)},{scope:`enterprise`,config:u(`enterprise`)}],[]),t=e.some(({config:e})=>h(e.errors,`fatal`).length>0),r=e.some(({config:e})=>h(e.errors,`warning`).length>0);return!t&&!r?null:(0,_.jsxs)(o,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,_.jsx)(i,{bold:!0,children:`MCP Config Diagnostics`}),(0,_.jsx)(o,{marginTop:1,children:(0,_.jsxs)(i,{dimColor:!0,children:[`For help configuring MCP servers, see:`,` `,(0,_.jsx)(n,{url:`https://code.claude.com/docs/en/mcp`,children:`https://code.claude.com/docs/en/mcp`})]})}),e.map(({scope:e,config:t})=>(0,_.jsx)(p,{scope:e,parsingErrors:h(t.errors,`fatal`),warnings:h(t.errors,`warning`)},e))]})}function h(e,t){return e.filter(e=>e.mcpErrorMetadata?.severity===t)}var g,_,v=e((()=>{g=t(r()),l(),c(),a(),_=s()}));export{v as n,m as t};
@@ -0,0 +1,3 @@
1
+ import{n as e,o as t,r as n}from"./chunk-DR8-3Aex.js";import{n as r,t as i}from"./figures-gfT9mM8P.js";import{F as a,Rn as o,b as s,m as c,nt as l,t as u,tt as d,x as f}from"./src-Di342QoJ.js";import{t as p}from"./jsx-runtime-D-D469L8.js";import{Ct as m,cn as h,mr as g,vt as _}from"./state-sIHsFpDu.js";import{Ht as v,Ko as y,Uo as b,no as x,on as S,oo as C,pi as w,vi as T}from"./paths-nIHVpTn2.js";import{n as E,r as D}from"./analytics-DqMQntaB.js";import{n as O,t as k}from"./cwd--iizewsn.js";import{O as A,et as j,h as ee,m as te,o as ne,s as M}from"./log-DSV4Ht5l.js";import{b as N,x as re}from"./teammate-CbskW5G9.js";import{S as ie,b as ae,h as oe}from"./startupProfiler-CBcN1Chw.js";import{Ao as P,Cn as F,Dy as se,Ey as ce,FC as le,Fc as I,Go as L,Jy as ue,Kc as de,Ky as fe,Lc as pe,NC as me,Ny as he,Oo as R,Oy as ge,Pc as z,Po as _e,To as B,Yi as ve,Yo as V,Zi as ye,Zo as be,_a as xe,bo as Se,cS as Ce,dC as we,dk as H,fC as Te,fu as U,ia as Ee,ln as De,mk as Oe,ms as ke,pk as Ae,qc as je,qo as Me,sS as Ne,uu as Pe,vD as Fe,yD as Ie,yn as Le}from"./loadAgentsDir-BfEZacjM.js";import{E as Re,T as ze,c as Be,d as Ve,w as He}from"./sessionTracing-DuQ3kbq6.js";import{t as Ue}from"./useKeybinding-DPOUuymz.js";import{t as We}from"./useTerminalSize-Du-EamDN.js";import{n as Ge,t as Ke}from"./useExitOnCtrlCDWithKeybindings-BHi41Ku_.js";import{n as qe,t as Je}from"./slashCommandParsing-BfanVchF.js";import*as W from"path";import{randomUUID as G}from"crypto";o();var K=p();r(),u(),h(),E(),O(),j(),te(),ne(),re(),ae(),y(),C(),S(),Ae(),He(),Fe(),me(),Be(),Pe(),de(),pe(),ke(),L(),Ee(),F(),Je();var Ye={"`":"`",'"':`"`,"<":`>`,"{":`}`,"[":`]`,"(":`)`,"'":`'`};function Xe(e,t){if(!new RegExp(t,`i`).test(e)||e.startsWith(`/`))return[];let n=[],r=null,i=0,a=e=>!!e&&/[\p{L}\p{N}_]/u.test(e);for(let t=0;t<e.length;t++){let o=e[t];if(r){if(r===`[`&&o===`[`){i=t;continue}if(o!==Ye[r]||r===`'`&&a(e[t+1]))continue;n.push({start:i,end:t+1}),r=null}else (o===`<`&&t+1<e.length&&/[a-zA-Z/]/.test(e[t+1])||o===`'`&&!a(e[t-1])||o!==`<`&&o!==`'`&&o in Ye)&&(r=o,i=t)}let o=[],s=RegExp(`\\b${t}\\b`,`gi`),c=e.matchAll(s);for(let t of c){if(t.index===void 0)continue;let r=t.index,i=r+t[0].length;if(n.some(e=>r>=e.start&&r<e.end))continue;let s=e[r-1],c=e[i];s===`/`||s===`\\`||s===`-`||c===`/`||c===`\\`||c===`-`||c===`?`||c===`.`&&a(e[i+1])||o.push({word:t[0],start:r,end:i})}return o}function q(e){return Xe(e,`ultraplan`)}function Ze(e){return Xe(e,`ultrareview`)}function Qe(e){return q(e).length>0}function $e(e){let[t]=q(e);if(!t)return e;let n=e.slice(0,t.start),r=e.slice(t.end);return(n+r).trim()?n+t.word.slice(5)+r:``}function et(e){let t=e.toLowerCase();return/\b(wtf|wth|ffs|omfg|shit(ty|tiest)?|dumbass|horrible|awful|piss(ed|ing)? off|piece of (shit|crap|junk)|what the (fuck|hell)|fucking? (broken|useless|terrible|awful|horrible)|fuck you|screw (this|you)|so frustrating|this sucks|damn it)\b/.test(t)}function tt(e){let t=e.toLowerCase().trim();return t===`continue`?!0:/\b(keep going|go on)\b/.test(t)}function nt(e,t,n,r,i,a,o){let s=G();g(s);let c=typeof e==`string`?e:e.find(e=>e.type===`text`)?.text||``;Ve(c);let l=typeof e==`string`?e:e.findLast(e=>e.type===`text`)?.text||``;return l&&ze(`user_prompt`,{prompt_length:String(l.length),prompt:Re(l),"prompt.id":s}),D(`tengu_input_prompt`,{is_negative:et(c),is_keep_going:tt(c)}),t.length>0?{messages:[R({content:[...typeof e==`string`?e.trim()?[{type:`text`,text:e}]:[]:e,...t],uuid:i,imagePasteIds:n.length>0?n:void 0,permissionMode:a,isMeta:o||void 0}),...r],shouldQuery:!0}:{messages:[R({content:e,uuid:i,permissionMode:a,isMeta:o||void 0}),...r],shouldQuery:!0}}E(),L();async function rt({input:e,preExpansionInput:t,mode:n,setToolJSX:r,context:i,pastedContents:a,ideSelection:o,messages:s,setUserInputOnProcessing:c,uuid:l,isAlreadyProcessing:u,querySource:d,canUseTool:f,skipSlashCommands:p,bridgeOrigin:m,isMeta:h,skipAttachments:g,autonomy:_}){let v=typeof e==`string`?e:null,y=v?.startsWith(`/`)&&!p;n===`prompt`&&v!==null&&!h&&!y&&c?.(v),U(`query_process_user_input_base_start`);let b=i.getAppState(),x=await at(e,n,r,i,a,o,s,l,u,d,f,b.toolPermissionContext.mode,p,m,h,g,t,_);if(U(`query_process_user_input_base_end`),!x.shouldQuery)return x;U(`query_hooks_start`);let S=_e(e)||``;for await(let t of De(S,b.toolPermissionContext.mode,i,i.requestPrompt))if(t.message?.type!==`progress`){if(t.blockingError)return{messages:[B(`${Le(t.blockingError)}\n\nOriginal prompt: ${e}`,`warning`)],shouldQuery:!1,allowedTools:x.allowedTools};if(t.preventContinuation){let e=t.stopReason?`Operation stopped by hook: ${t.stopReason}`:`Operation stopped by hook`;return x.messages.push(R({content:e})),x.shouldQuery=!1,x}if(t.additionalContexts&&t.additionalContexts.length>0&&x.messages.push(z({type:`hook_additional_context`,content:t.additionalContexts.map(it),hookName:`UserPromptSubmit`,toolUseID:`hook-${G()}`,hookEvent:`UserPromptSubmit`})),t.message)switch(t.message.attachment.type){case`hook_success`:if(!t.message.attachment.content)break;x.messages.push({...t.message,attachment:{...t.message.attachment,content:it(t.message.attachment.content)}});break;default:x.messages.push(t.message);break}}return U(`query_hooks_end`),x}var J=1e4;function it(e){return e.length>J?`${e.substring(0,J)}… [output truncated - exceeded ${J} characters]`:e}async function at(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_){let v=null,y=[],b=[],x=e;if(typeof e==`string`)v=e;else if(e.length>0){U(`query_image_processing_start`);let t=[];for(let n of e)if(n.type===`image`){let e=await Oe(n);if(e.dimensions){let t=H(e.dimensions);t&&b.push(t)}t.push(e.block)}else t.push(n);x=t,U(`query_image_processing_end`);let n=t[t.length-1];n?.type===`text`?(v=n.text,y=t.slice(0,-1)):y=t}if(v===null&&t!==`prompt`)throw Error(`Mode: ${t} requires a string input.`);let S=i?Object.values(i).filter(je):[],C=S.map(e=>e.id),w=i?await le(i):new Map;U(`query_pasted_image_processing_start`);let T=await Promise.all(S.map(async e=>{let t={type:`image`,source:{type:`base64`,media_type:e.mediaType||`image/png`,data:e.content}};return D(`tengu_pasted_image_resize_attempt`,{original_size_bytes:e.content.length}),{resized:await Oe(t),originalDimensions:e.dimensions,sourcePath:e.sourcePath??w.get(e.id)}})),E=[];for(let{resized:e,originalDimensions:t,sourcePath:n}of T){if(e.dimensions){let t=H(e.dimensions,n);t&&b.push(t)}else if(t){let e=H(t,n);e&&b.push(e)}else n&&b.push(`[Image source: ${n}]`);E.push(e.block)}U(`query_pasted_image_processing_end`);let O=f;if(p&&v!==null&&v.startsWith(`/`)){let e=qe(v),t=e?ve(e.commandName,r.options.commands):void 0;if(t){let n=ye(t,e?.args??``);if(n.ok)O=!1;else{let e=n.reason??`/${xe(t)} isn't available over Remote Control.`;return{messages:[R({content:v,uuid:s}),Se(`<local-command-stdout>${e}</local-command-stdout>`)],shouldQuery:!1,resultText:e}}}}if(t===`prompt`&&!r.options.isNonInteractiveSession&&v!==null&&!O&&!v.startsWith(`/`)&&!r.getAppState().ultraplanSessionUrl&&!r.getAppState().ultraplanLaunching&&Qe(g??v)){D(`tengu_ultraplan_keyword`,{});let e=$e(v).trim(),{processSlashCommand:t}=await import(`./processSlashCommand-BGBRvSCA.js`);return Y(await t(`/ultraplan ${e}`,y,E,[],r,n,s,c,u,_),b)}let k=!h&&v!==null&&(t!==`prompt`||O||!v.startsWith(`/`));U(`query_attachment_loading_start`);let A=k?await Ie(I(v,r,a??null,[],o,l)):[];if(U(`query_attachment_loading_end`),v!==null&&t===`bash`){let{processBashCommand:e}=await import(`./processBashCommand-DnzyTwtS.js`);return Y(await e(v,y,A,r,n),b)}if(v!==null&&!O&&v.startsWith(`/`)){let{processSlashCommand:e}=await import(`./processSlashCommand-BGBRvSCA.js`);return Y(await e(v,y,E,A,r,n,s,c,u,_),b)}if(v!==null&&t===`prompt`){let e=v.trim(),t=A.find(e=>e.attachment.type===`agent_mention`);if(t){let n=`@agent-${t.attachment.agentType}`,r=e===n;D(`tengu_subagent_at_mention`,{is_subagent_only:r,is_prefix:e.startsWith(n)&&!r})}}return Y(nt(x,E,C,A,s,d,m),b)}function Y(e,t){return t.length>0&&e.messages.push(R({content:t.map(e=>({type:`text`,text:e})),isMeta:!0})),e}h(),T();function ot(e){return e===`Agent`?b:e}function st(e){let t=x()?.outputStyle??`default`,n={type:`system`,subtype:`init`,cwd:k(),session_id:m(),tools:e.tools.map(e=>ot(e.name)),mcp_servers:e.mcpClients.map(e=>({name:e.name,status:e.type})),model:e.model,permissionMode:e.permissionMode,slash_commands:e.commands.filter(e=>e.userInvocable!==!1).map(e=>e.name),apiKeySource:v().source,betas:_(),claude_code_version:`2.8.3`,output_style:t,agents:e.agents.map(e=>e.agentType),skills:e.skills.filter(e=>e.userInvocable!==!1).map(e=>e.name),plugins:e.plugins.map(e=>({name:e.name,path:e.path,source:e.source})),uuid:G()};return n.fast_mode_state=w(e.model,e.fastMode),n}var ct=n({MessageSelector:()=>ut,messagesAfterAreOnlySynthetic:()=>_t,selectableUserMessagesFilter:()=>Z});function lt(e){return e.type===`text`}function X(e){return e===`summarize`||e===`summarize_up_to`}function ut({messages:e,onPreRestore:t,onRestoreMessage:n,onRestoreCode:r,onSummarize:a,onClose:o,preselectedMessage:u}){let p=Te(e=>e.fileHistory),[m,h]=(0,Q.useState)(void 0),g=se(),_=(0,Q.useMemo)(G,[]),v=(0,Q.useMemo)(()=>[...e.filter(Z),{...R({content:``}),uuid:_}],[e,_]),[y,b]=(0,Q.useState)(v.length-1),x=Math.max(0,Math.min(y-Math.floor($/2),v.length-$)),S=v.length>1,[C,w]=(0,Q.useState)(u),[T,E]=(0,Q.useState)(void 0);(0,Q.useEffect)(()=>{if(!u||!g)return;let e=!1;return ge(p,u.uuid).then(t=>{e||E(t)}),()=>{e=!0}},[u,g,p]);let[O,k]=(0,Q.useState)(!1),[A,j]=(0,Q.useState)(null),[ee,te]=(0,Q.useState)(`both`),[ne,N]=(0,Q.useState)(``),[re,ie]=(0,Q.useState)(``);function ae(e){let t=e?[{value:`both`,label:`Restore code and conversation`},{value:`conversation`,label:`Restore conversation`},{value:`code`,label:`Restore code`}]:[{value:`conversation`,label:`Restore conversation`}],n={type:`input`,placeholder:`add context (optional)`,initialValue:``,allowEmptySubmitToCancel:!0,showLabelWithValue:!0,labelValueSeparator:`: `};return t.push({value:`summarize`,label:`Summarize from here`,...n,onChange:N}),process.env.USER_TYPE===`ant`&&t.push({value:`summarize_up_to`,label:`Summarize up to here`,...n,onChange:ie}),t.push({value:`nevermind`,label:`Never mind`}),t}(0,Q.useEffect)(()=>{D(`tengu_message_selector_opened`,{})},[]);async function P(e){t(),k(!0);try{await n(e),k(!1),o()}catch(e){M(e),k(!1),h(`Failed to restore the conversation:\n${e}`)}}async function F(t){let n=e.indexOf(t);if(D(`tengu_message_selector_selected`,{index_from_end:e.length-1-n,message_type:t.type,is_current_prompt:!1}),!e.includes(t)){o();return}if(!g){await P(t);return}let r=await ge(p,t.uuid);w(t),E(r)}async function le(e){if(D(`tengu_message_selector_restore_option_selected`,{option:e}),!C){h(`Message not found.`);return}if(e===`nevermind`){u?o():w(void 0);return}if(X(e)){t(),k(!0),j(e),h(void 0);try{let t=e===`summarize_up_to`?`up_to`:`from`;await a(C,(t===`up_to`?re:ne).trim()||void 0,t),k(!1),j(null),w(void 0),o()}catch(e){M(e),k(!1),j(null),w(void 0),h(`Failed to summarize:\n${e}`)}return}t(),k(!0),h(void 0);let i=null,s=null;if(e===`code`||e===`both`)try{await r(C)}catch(e){i=e,M(i)}if(e===`conversation`||e===`both`)try{await n(C)}catch(e){s=e,M(s)}k(!1),w(void 0),s&&i?h(`Failed to restore the conversation and code:\n${s}\n${i}`):s?h(`Failed to restore the conversation:\n${s}`):i?h(`Failed to restore the code:\n${i}`):o()}let I=Ge(),L=(0,Q.useCallback)(()=>{if(C&&!u){w(void 0);return}D(`tengu_message_selector_cancelled`,{}),o()},[o,C,u]),ue=(0,Q.useCallback)(()=>b(e=>Math.max(0,e-1)),[]),de=(0,Q.useCallback)(()=>b(e=>Math.min(v.length-1,e+1)),[v.length]),pe=(0,Q.useCallback)(()=>b(0),[]),me=(0,Q.useCallback)(()=>b(v.length-1),[v.length]),he=(0,Q.useCallback)(()=>{let e=v[y];e&&F(e)},[v,y,F]);d(`confirm:no`,L,{context:`Confirmation`,isActive:!C}),l({"messageSelector:up":ue,"messageSelector:down":de,"messageSelector:top":pe,"messageSelector:bottom":me,"messageSelector:select":he},{context:`MessageSelector`,isActive:!O&&!m&&!C&&S});let[z,_e]=(0,Q.useState)({});(0,Q.useEffect)(()=>{async function t(){g&&Promise.all(v.map(async(t,n)=>{if(t.uuid!==_){let r=ce(p,t.uuid),i=v.at(n+1),a=r?gt(e,t.uuid,i?.uuid===_?void 0:i?.uuid):void 0;_e(a===void 0?e=>({...e,[n]:void 0}):e=>({...e,[n]:a}))}}))}t()},[v,e,_,p,g]);let B=g&&T?.filesChanged&&T.filesChanged.length>0,ve=!m&&!C&&!u&&S;return(0,K.jsxs)(f,{flexDirection:`column`,width:`100%`,children:[(0,K.jsx)(c,{color:`suggestion`}),(0,K.jsxs)(f,{flexDirection:`column`,marginX:1,gap:1,children:[(0,K.jsx)(s,{bold:!0,color:`suggestion`,children:`Rewind`}),m&&(0,K.jsx)(K.Fragment,{children:(0,K.jsxs)(s,{color:`error`,children:[`Error: `,m]})}),!S&&(0,K.jsx)(K.Fragment,{children:(0,K.jsx)(s,{children:`Nothing to rewind to yet.`})}),!m&&C&&S&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(s,{children:[`Confirm you want to restore `,!T&&`the conversation `,`to the point before you sent this message:`]}),(0,K.jsxs)(f,{flexDirection:`column`,paddingLeft:1,borderStyle:`single`,borderRight:!1,borderTop:!1,borderBottom:!1,borderLeft:!0,borderLeftDimColor:!0,children:[(0,K.jsx)(ht,{userMessage:C,color:`text`,isCurrent:!1}),(0,K.jsxs)(s,{dimColor:!0,children:[`(`,oe(new Date(C.timestamp)),`)`]})]}),(0,K.jsx)(ft,{selectedRestoreOption:ee,canRestoreCode:!!B,diffStatsForRestore:T}),O&&X(A)?(0,K.jsxs)(f,{flexDirection:`row`,gap:1,children:[(0,K.jsx)(fe,{}),(0,K.jsx)(s,{children:`Summarizing…`})]}):(0,K.jsx)(Ne,{isDisabled:O,options:ae(!!B),defaultFocusValue:B?`both`:`conversation`,onFocus:e=>te(e),onChange:e=>le(e),onCancel:()=>u?o():w(void 0)}),B&&(0,K.jsx)(f,{marginBottom:1,children:(0,K.jsxs)(s,{dimColor:!0,children:[i.warning,` Rewinding does not affect files edited manually or via bash.`]})})]}),ve&&(0,K.jsxs)(K.Fragment,{children:[g?(0,K.jsx)(s,{children:`Restore the code and/or conversation to the point before…`}):(0,K.jsx)(s,{children:`Restore and fork the conversation to the point before…`}),(0,K.jsx)(f,{width:`100%`,flexDirection:`column`,children:v.slice(x,x+$).map((e,t)=>{let n=x+t,r=n===y,a=e.uuid===_,o=n in z,c=z[n],l=c?.filesChanged&&c.filesChanged.length;return(0,K.jsxs)(f,{height:g?3:2,overflow:`hidden`,width:`100%`,flexDirection:`row`,children:[(0,K.jsx)(f,{width:2,minWidth:2,children:r?(0,K.jsxs)(s,{color:`permission`,bold:!0,children:[i.pointer,` `]}):(0,K.jsx)(s,{children:` `})}),(0,K.jsxs)(f,{flexDirection:`column`,children:[(0,K.jsx)(f,{flexShrink:1,height:1,overflow:`hidden`,children:(0,K.jsx)(ht,{userMessage:e,color:r?`suggestion`:void 0,isCurrent:a,paddingRight:10})}),g&&o&&(0,K.jsx)(f,{height:1,flexDirection:`row`,children:c?(0,K.jsx)(K.Fragment,{children:(0,K.jsx)(s,{dimColor:!r,color:`inactive`,children:l?(0,K.jsxs)(K.Fragment,{children:[l===1&&c.filesChanged[0]?`${W.basename(c.filesChanged[0])} `:`${l} files changed `,(0,K.jsx)(mt,{diffStats:c})]}):(0,K.jsx)(K.Fragment,{children:`No code changes`})})}):(0,K.jsxs)(s,{dimColor:!0,color:`warning`,children:[i.warning,` No code restore`]})})]})]},e.uuid)})})]}),!C&&(0,K.jsx)(s,{dimColor:!0,italic:!0,children:I.pending?(0,K.jsxs)(K.Fragment,{children:[`Press `,I.keyName,` again to exit`]}):(0,K.jsxs)(K.Fragment,{children:[!m&&S&&`Enter to continue · `,`Esc to exit`]})})]})]})}function dt(e){switch(e){case`summarize`:return`Messages after this point will be summarized.`;case`summarize_up_to`:return`Preceding messages will be summarized. This and subsequent messages will remain unchanged — you will stay at the end of the conversation.`;case`both`:case`conversation`:return`The conversation will be forked.`;case`code`:case`nevermind`:return`The conversation will be unchanged.`}}function ft({selectedRestoreOption:e,canRestoreCode:t,diffStatsForRestore:n}){let r=t&&(e===`both`||e===`code`);return(0,K.jsxs)(f,{flexDirection:`column`,children:[(0,K.jsx)(s,{dimColor:!0,children:dt(e)}),!X(e)&&(r?(0,K.jsx)(pt,{diffStatsForRestore:n}):(0,K.jsx)(s,{dimColor:!0,children:`The code will be unchanged.`}))]})}function pt({diffStatsForRestore:e}){if(e===void 0)return;if(!e.filesChanged||!e.filesChanged[0])return(0,K.jsx)(s,{dimColor:!0,children:`The code has not changed (nothing will be restored).`});let t=e.filesChanged.length,n=``;return n=t===1?W.basename(e.filesChanged[0]||``):t===2?`${W.basename(e.filesChanged[0]||``)} and ${W.basename(e.filesChanged[1]||``)}`:`${W.basename(e.filesChanged[0]||``)} and ${e.filesChanged.length-1} other files`,(0,K.jsx)(K.Fragment,{children:(0,K.jsxs)(s,{dimColor:!0,children:[`The code will be restored `,(0,K.jsx)(mt,{diffStats:e}),` in `,n,`.`]})})}function mt({diffStats:e}){if(!(!e||!e.filesChanged))return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(s,{color:`diffAddedWord`,children:[`+`,e.insertions,` `]}),(0,K.jsxs)(s,{color:`diffRemovedWord`,children:[`-`,e.deletions]})]})}function ht({userMessage:e,color:t,dimColor:n,isCurrent:r,paddingRight:i}){let{columns:o}=a();if(r)return(0,K.jsx)(f,{width:`100%`,children:(0,K.jsx)(s,{italic:!0,color:t,dimColor:n,children:`(current)`})});let c=e.message.content,l=typeof c==`string`?null:c[c.length-1],u=ee(typeof c==`string`?c.trim():l&&lt(l)?l.text.trim():`(no prompt)`);if(Me(u))return(0,K.jsx)(f,{flexDirection:`row`,width:`100%`,children:(0,K.jsx)(s,{italic:!0,color:t,dimColor:n,children:`((empty message))`})});if(u.includes(`<bash-input>`)){let e=P(u,`bash-input`);if(e)return(0,K.jsxs)(f,{flexDirection:`row`,width:`100%`,children:[(0,K.jsx)(s,{color:`bashBorder`,children:`!`}),(0,K.jsxs)(s,{color:t,dimColor:n,children:[` `,e]})]})}if(u.includes(`<command-message>`)){let e=P(u,A),r=P(u,`command-args`),i=P(u,`skill-format`)===`true`;if(e)return i?(0,K.jsx)(f,{flexDirection:`row`,width:`100%`,children:(0,K.jsxs)(s,{color:t,dimColor:n,children:[`Skill(`,e,`)`]})}):(0,K.jsx)(f,{flexDirection:`row`,width:`100%`,children:(0,K.jsxs)(s,{color:t,dimColor:n,children:[`/`,e,` `,r]})})}return(0,K.jsx)(f,{flexDirection:`row`,width:`100%`,children:(0,K.jsx)(s,{color:t,dimColor:n,children:i?ie(u,o-i,!0):u.slice(0,500).split(`
2
+ `).slice(0,4).join(`
3
+ `)})})}function gt(e,t,n){let r=e.findIndex(e=>e.uuid===t);if(r===-1)return;let i=n?e.findIndex(e=>e.uuid===n):e.length;i===-1&&(i=e.length);let a=[],o=0,s=0;for(let t=r+1;t<i;t++){let n=e[t];if(!n||!be(n))continue;let r=n.toolUseResult;if(!(!r||!r.filePath||!r.structuredPatch)){a.includes(r.filePath)||a.push(r.filePath);try{if(`type`in r&&r.type===`create`)o+=r.content.split(/\r?\n/).length;else for(let e of r.structuredPatch){let t=N(e.lines,e=>e.startsWith(`+`)),n=N(e.lines,e=>e.startsWith(`-`));o+=t,s+=n}}catch{}}}return{filesChanged:a,insertions:o,deletions:s}}function Z(e){if(e.type!==`user`||Array.isArray(e.message.content)&&e.message.content[0]?.type===`tool_result`||V(e)||e.isMeta||e.isCompactSummary||e.isVisibleInTranscriptOnly)return!1;let t=e.message.content,n=typeof t==`string`?null:t[t.length-1],r=typeof t==`string`?t.trim():n&&lt(n)?n.text.trim():``;return!(r.indexOf(`<local-command-stdout>`)!==-1||r.indexOf(`<local-command-stderr>`)!==-1||r.indexOf(`<bash-stdout>`)!==-1||r.indexOf(`<bash-stderr>`)!==-1||r.indexOf(`<task-notification>`)!==-1||r.indexOf(`<tick>`)!==-1||r.indexOf(`<teammate-message`)!==-1)}function _t(e,t){for(let n=t+1;n<e.length;n++){let t=e[n];if(t&&!V(t)&&!be(t)&&t.type!==`progress`&&t.type!==`system`&&t.type!==`attachment`&&!(t.type===`user`&&t.isMeta)){if(t.type===`assistant`){let e=t.message.content;if(Array.isArray(e)&&e.some(e=>e.type===`text`&&e.text.trim()||e.type===`tool_use`))return!1;continue}if(t.type===`user`)return!1}}return!0}var Q,$,vt=e((()=>{Q=t(o()),E(),we(),he(),Ke(),Ue(),L(),Ce(),ue(),We(),$=7}));export{Z as a,rt as c,_t as i,q as l,ct as n,st as o,vt as r,ot as s,ut as t,Ze as u};
@@ -0,0 +1,11 @@
1
+ import{a as e,n as t,o as n,r}from"./chunk-DR8-3Aex.js";import{s as i,u as a}from"./envUtils-BWeoiL4Y.js";import{n as o,t as s}from"./figures-gfT9mM8P.js";import{B as c,Cn as l,F as u,Ft as d,In as f,Ln as p,Lt as m,Rn as h,W as g,b as _,m as v,t as y,v as b,x,y as S}from"./src-Di342QoJ.js";import{t as C}from"./jsx-runtime-D-D469L8.js";import{L as w,W as ee,cn as T,y as E}from"./state-sIHsFpDu.js";import{Bc as D,Cc as O,Fo as k,Gt as te,Ht as A,Io as ne,Ka as re,Lr as j,Pr as M,Ps as N,S as P,Uc as F,Ur as ie,dc as I,dn as ae,g as L,js as oe,on as se,oo as ce,qt as le,yc as R}from"./paths-nIHVpTn2.js";import{d as ue,l as de,o as z,p as fe,u as pe}from"./debug-otxXY3j-.js";import{n as me,r as he}from"./analytics-DqMQntaB.js";import{n as B,t as ge}from"./cwd--iizewsn.js";import{a as _e,n as ve}from"./env-C2A9gV_G.js";import{H as ye,V,W as be,et as xe}from"./log-DSV4Ht5l.js";import{S as Se,b as Ce,h as we,n as Te,p as Ee,r as De,t as Oe}from"./startupProfiler-CBcN1Chw.js";import{l as ke,o as Ae}from"./stringUtils-KZoO4GUd.js";import{n as je,t as Me}from"./sleep-C6koP5Ka.js";import{$o as Ne,$v as Pe,AT as Fe,Ao as Ie,Ax as Le,Bo as Re,Bs as ze,Bu as Be,CT as Ve,Cj as He,DS as Ue,DT as We,Dj as Ge,ET as Ke,E_ as qe,Go as Je,Hu as Ye,Io as Xe,Ix as Ze,Jk as Qe,Jo as $e,Kx as et,LA as tt,Lo as nt,Mx as rt,PA as it,Ps as at,Qk as ot,Qv as st,Ro as ct,Ru as lt,TS as ut,TT as dt,T_ as ft,Uu as pt,Uw as mt,Vu as ht,Vw as gt,Vx as _t,Wo as vt,Zk as yt,_o as bt,aO as xt,ao as St,c_ as Ct,dC as wt,do as Tt,eA as Et,eg as Dt,fC as Ot,fo as kt,gS as At,hS as jt,h_ as Mt,iO as Nt,ig as Pt,io as Ft,kT as It,ko as Lt,ku as Rt,m_ as zt,ng as Bt,ns as Vt,qx as Ht,rg as Ut,ro as Wt,rs as Gt,s_ as Kt,ss as qt,tg as Jt,vS as Yt,wT as Xt,wb as Zt,xT as Qt,zo as $t,zu as en}from"./loadAgentsDir-BfEZacjM.js";import{Qn as tn,Xn as nn}from"./prompt-DgIuTC6Q.js";import{f as rn,p as an}from"./xml-CPJXOUFt.js";import{C as on,y as sn}from"./rcDebugLog-Bv_x5w_B.js";import{n as cn,r as ln,t as un}from"./browser-Bt-ckCaU.js";import{t as dn}from"./useTerminalSize-Du-EamDN.js";import{d as fn,f as pn,h as mn,p as hn}from"./terminalSetup-Bkml3uSP.js";import{n as gn,t as _n}from"./SentryErrorBoundary-D5niZGEU.js";import{a as vn,n as yn}from"./voiceModeEnabled-By2qa3A2.js";import{a as bn,o as xn,r as Sn,s as Cn,t as wn}from"./referral-DfKWr4Jf.js";import{c as Tn,r as En}from"./releaseNotes-C7-JnhrH.js";import{a as Dn,c as On,d as kn,i as An,l as jn,n as Mn,o as Nn,r as Pn,t as Fn,u as In}from"./logoV2Utils-DvjpZkyF.js";import{n as Ln,t as Rn}from"./systemTheme-eRWGHYSL.js";import{n as zn,r as Bn}from"./PromptInputFooterSuggestions-DAFZfAT0.js";import{n as Vn,t as Hn}from"./useMainLoopModel-CEM_50a0.js";import{n as Un,t as Wn}from"./modalContext-CuTwi_eD.js";import{i as Gn,n as Kn,r as qn,s as Jn,t as Yn}from"./OverageCreditUpsell-DjgcfVt2.js";import{n as Xn,r as Zn,t as Qn}from"./statusNoticeHelpers-DY0Cblkd.js";import{homedir as $n}from"os";import{relative as er}from"path";import{fileURLToPath as tr}from"url";function nr(e,t){for(let n of e)if(!t.has(n))return!1;return!0}var rr=t((()=>{}));function ir(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`)||Ie(t.text,`status`)!==`completed`?!1:Ie(t.text,`summary`)?.startsWith(`Background command `)??!1}function ar(e,t){if(!Ue()||t)return e;let n=[],r=0;for(;r<e.length;){let t=e[r];if(ir(t)){let i=0;for(;r<e.length&&ir(e[r]);)i++,r++;i===1?n.push(t):n.push({...t,message:{role:`user`,content:[{type:`text`,text:`<${be}><${V}>completed</${V}><${ye}>${i} background commands completed</${ye}></${be}>`}]}})}else n.push(t),r++}return n}var or=t((()=>{xe(),Rt(),ut(),Je()}));function sr(e){return e.type===`system`&&e.subtype===`stop_hook_summary`&&e.hookLabel!==void 0}function cr(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(sr(r)){let i=r.hookLabel,a=[];for(;n<e.length;){let t=e[n];if(!sr(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 lr=t((()=>{}));function ur(e){return e.type===`attachment`&&e.attachment.type===`task_status`&&e.attachment.taskType===`in_process_teammate`&&e.attachment.status===`completed`}function dr(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(ur(r)){let i=0;for(;n<e.length&&ur(e[n]);)i++,n++;i===1?t.push(r):t.push({type:`attachment`,uuid:r.uuid,timestamp:r.timestamp,attachment:{type:`teammate_shutdown_batch`,count:i}})}else t.push(r),n++}return t}var fr=t((()=>{}));function pr(e){let t=gr.get(e);return t||(t=new Set(e.filter(e=>e.renderGroupedToolUse).map(e=>e.name)),gr.set(e,t)),t}function mr(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 hr(e,t,n=!1){if(n)return{messages:e};let r=pr(t),i=new Map;for(let t of e){let e=mr(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=mr(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=mr(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 gr,_r=t((()=>{gr=new WeakMap}));function vr(e){let t=wr.get(e);if(t!==void 0)return t;let n=yr(e).toLowerCase();return wr.set(e,n),n}function yr(e){let t=``;switch(e.type){case`user`:{let n=e.message.content;if(typeof n==`string`)t=Cr.has(n)?``:n;else{let r=[];for(let t of n??[])t.type===`text`?Cr.has(t.text)||r.push(t.text):t.type===`tool_result`&&r.push(xr(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`?[br(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(Sr,r);if(e<0)break;n=n.slice(0,r)+n.slice(e+18),r=n.indexOf(`<system-reminder>`)}return n}function br(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 xr(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 Sr,Cr,wr,Tr=t((()=>{Je(),Sr=`</system-reminder>`,Cr=new Set([Ft,St]),wr=new WeakMap}));function Er({pose:e=`default`}={}){if(ve.terminal===`Apple_Terminal`)return(0,H.jsx)(Dr,{pose:e});let t=Or[e];return(0,H.jsxs)(x,{flexDirection:`column`,children:[(0,H.jsxs)(_,{children:[(0,H.jsx)(_,{color:`clawd_body`,children:t.r1L}),(0,H.jsx)(_,{color:`clawd_body`,backgroundColor:`clawd_background`,children:t.r1E}),(0,H.jsx)(_,{color:`clawd_body`,children:t.r1R})]}),(0,H.jsxs)(_,{children:[(0,H.jsx)(_,{color:`clawd_body`,children:t.r2L}),(0,H.jsx)(_,{color:`clawd_body`,backgroundColor:`clawd_background`,children:`█████`}),(0,H.jsx)(_,{color:`clawd_body`,children:t.r2R})]}),(0,H.jsxs)(_,{color:`clawd_body`,children:[` `,`▘▘ ▝▝`,` `]})]})}function Dr({pose:e}){return(0,H.jsxs)(x,{flexDirection:`column`,alignItems:`center`,children:[(0,H.jsxs)(_,{children:[(0,H.jsx)(_,{color:`clawd_body`,children:`▗`}),(0,H.jsx)(_,{color:`clawd_background`,backgroundColor:`clawd_body`,children:kr[e]}),(0,H.jsx)(_,{color:`clawd_body`,children:`▖`})]}),(0,H.jsx)(_,{backgroundColor:`clawd_body`,children:` `.repeat(7)}),(0,H.jsx)(_,{color:`clawd_body`,children:`▘▘ ▝▝`})]})}var H,Or,kr,Ar=t((()=>{h(),y(),_e(),H=C(),Or={default:{r1L:` ▐`,r1E:`▛███▜`,r1R:`▌`,r2L:`▝▜`,r2R:`▛▘`},"look-left":{r1L:` ▐`,r1E:`▟███▟`,r1R:`▌`,r2L:`▝▜`,r2R:`▛▘`},"look-right":{r1L:` ▐`,r1E:`▙███▙`,r1R:`▌`,r2L:`▝▜`,r2R:`▛▘`},"arms-up":{r1L:`▗▟`,r1E:`▛███▜`,r1R:`▙▖`,r2L:` ▜`,r2R:`▛ `}},kr={default:` ▗ ▖ `,"look-left":` ▘ ▘ `,"look-right":` ▝ ▝ `,"arms-up":` ▗ ▖ `}}));function jr(e){let{title:t,lines:n,footer:r,emptyMessage:i,customContent:a}=e,o=l(t);if(a!==void 0)o=Math.max(o,a.width);else if(n.length===0&&i)o=Math.max(o,l(i));else{let e=Math.max(0,...n.map(e=>e.timestamp?l(e.timestamp):0));for(let t of n){let n=e>0?e:0,r=l(t.text)+(n>0?n+2:0);o=Math.max(o,r)}}return r&&(o=Math.max(o,l(r))),o}function Mr({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?l(e.timestamp):0));return(0,U.jsxs)(x,{flexDirection:`column`,width:t,children:[(0,U.jsx)(_,{bold:!0,color:`claude`,children:n}),o?(0,U.jsxs)(U.Fragment,{children:[o.content,i&&(0,U.jsx)(_,{dimColor:!0,italic:!0,children:Se(i,t)})]}):r.length===0&&a?(0,U.jsx)(_,{dimColor:!0,children:Se(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)(_,{children:[s>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(_,{dimColor:!0,children:(e.timestamp||``).padEnd(s)}),` `]}),(0,U.jsx)(_,{children:Se(e.text,r)})]},n)}),i&&(0,U.jsx)(_,{dimColor:!0,italic:!0,children:Se(i,t)})]})]})}var U,Nr=t((()=>{h(),y(),Ce(),U=C()}));function Pr({feeds:e,maxWidth:t}){let n=e.map(e=>jr(e)),r=Math.max(...n),i=Math.min(r,t);return(0,Ir.jsx)(x,{flexDirection:`column`,children:e.map((t,n)=>(0,Ir.jsxs)(Fr.Fragment,{children:[(0,Ir.jsx)(Mr,{config:t,actualWidth:i}),n<e.length-1&&(0,Ir.jsx)(v,{color:`claude`,width:i})]},n))})}var Fr,Ir,Lr=t((()=>{Fr=n(h(),1),y(),Nr(),Ir=C()}));function Rr(e){let t=e.map(e=>{let t=we(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 zr(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 Br(e){let t=e.filter(({isEnabled:e})=>e).sort((e,t)=>Number(e.isComplete)-Number(t.isComplete)).map(({text:e,isComplete:t})=>({text:`${t?`${s.tick} `:``}${e}`})),n=ge()===$n()?`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 Vr(){let e=bn(),t=e?`Share Claude Code and earn ${Sn(e)} of extra usage`:`Share Claude Code with friends`;return{title:`3 guest passes`,lines:[],customContent:{content:(0,Hr.jsxs)(Hr.Fragment,{children:[(0,Hr.jsx)(x,{marginY:1,children:(0,Hr.jsx)(_,{color:`claude`,children:`[✻] [✻] [✻]`})}),(0,Hr.jsx)(_,{dimColor:!0,children:t})]}),width:48},footer:`/passes`}}var Hr,Ur=t((()=>{o(),y(),Cn(),B(),Ce(),Hr=C()}));function Wr(e,t,n){return Array.from({length:n},()=>({pose:e,offset:t}))}function Gr(){let{pose:e,bounceOffset:t,onClick:n}=Kr();return(0,Jr.jsx)(x,{height:ei,flexDirection:`column`,onClick:n,children:(0,Jr.jsx)(x,{marginTop:t,flexShrink:0,children:(0,Jr.jsx)(Er,{pose:e})})})}function Kr(){let[e]=(0,qr.useState)(()=>re().prefersReducedMotion??!1),[t,n]=(0,qr.useState)(-1),r=(0,qr.useRef)(Yr),i=()=>{e||t!==-1||(r.current=Xr[Math.floor(Math.random()*Xr.length)],n(0))};(0,qr.useEffect)(()=>{if(t===-1)return;if(t>=r.current.length){n(-1);return}let e=setTimeout(n,Qr,$r);return()=>clearTimeout(e)},[t]);let a=r.current,o=t>=0&&t<a.length?a[t]:Zr;return{pose:o.pose,bounceOffset:o.offset,onClick:i}}var qr,Jr,Yr,Xr,Zr,Qr,$r,ei,ti=t((()=>{h(),qr=n(h(),1),y(),ce(),Ar(),Jr=C(),Yr=[...Wr(`default`,1,2),...Wr(`arms-up`,0,3),...Wr(`default`,0,1),...Wr(`default`,1,2),...Wr(`arms-up`,0,3),...Wr(`default`,0,1)],Xr=[Yr,[...Wr(`look-right`,0,5),...Wr(`look-left`,0,5),...Wr(`default`,0,1)]],Zr={pose:`default`,offset:0},Qr=60,$r=e=>e+1,ei=3}));function ni(){let e=xn();e==null||e<=0||e>(I().passesLastSeenRemaining??0)&&O(t=>({...t,passesUpsellSeenCount:0,hasVisitedPasses:!1,passesLastSeenRemaining:e}))}function ri(){let{eligible:e,hasCache:t}=wn();if(!e||!t)return!1;ni();let n=I();return!((n.passesUpsellSeenCount??0)>=3||n.hasVisitedPasses)}function ii(){let[e]=(0,si.useState)(()=>ri());return e}function ai(){let e=0;O(t=>(e=(t.passesUpsellSeenCount??0)+1,{...t,passesUpsellSeenCount:e})),he(`tengu_guest_passes_upsell_shown`,{seen_count:e})}function oi(){let e=bn();return(0,ci.jsxs)(_,{dimColor:!0,children:[(0,ci.jsx)(_,{color:`claude`,children:`[✻]`}),` `,(0,ci.jsx)(_,{color:`claude`,children:`[✻]`}),` `,(0,ci.jsx)(_,{color:`claude`,children:`[✻]`}),` ·`,` `,e?`Share Claude Code and earn ${Sn(e)} of extra usage · /passes`:`3 guest passes at /passes`]})}var si,ci,li=t((()=>{h(),si=n(h(),1),y(),me(),Cn(),R(),ci=C()}));function ui(){let{columns:e}=u(),t=Ot(e=>e.agent),n=Ot(e=>e.effortValue),r=Vn(),i=ie(r),{version:a,cwd:o,billingType:s,agentName:c}=Nn(),d=t??c,f=ii(),p=Jn();(0,di.useEffect)(()=>{f&&ai()},[f]),(0,di.useEffect)(()=>{p&&!f&&qn()},[p,f]);let m=Math.max(e-15,20),h=Se(a,Math.max(m-13,6)),{shouldSplit:g,truncatedModel:v,truncatedBilling:y}=Pn(i+He(r,n),s,m),b=d?m-1-l(d)-3:m,S=kn(o,Math.max(b,10));return(0,W.jsx)(Ut,{children:(0,W.jsxs)(x,{flexDirection:`row`,gap:2,alignItems:`center`,children:[Ue()?(0,W.jsx)(Gr,{}):(0,W.jsx)(Er,{}),(0,W.jsxs)(x,{flexDirection:`column`,children:[(0,W.jsxs)(_,{children:[(0,W.jsx)(_,{bold:!0,children:`Claude Code`}),` `,(0,W.jsxs)(_,{dimColor:!0,children:[`v`,h]})]}),g?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(_,{dimColor:!0,children:v}),(0,W.jsx)(_,{dimColor:!0,children:y})]}):(0,W.jsxs)(_,{dimColor:!0,children:[v,` · `,y]}),(0,W.jsx)(_,{dimColor:!0,children:d?`@${d} · ${S}`:S}),f&&(0,W.jsx)(oi,{}),!f&&p&&(0,W.jsx)(Yn,{maxWidth:m,twoLine:!0})]})]})})}var di,W,fi=t((()=>{di=n(h(),1),Hn(),dn(),y(),wt(),Ge(),Ce(),ut(),In(),M(),Pt(),ti(),Ar(),li(),Gn(),W=C()}));function pi(){let e=(0,hi.useMemo)(mi,[]),t=(0,hi.useMemo)(()=>I().lastShownEmergencyTip,[]),n=e.tip&&e.tip!==t;return(0,hi.useEffect)(()=>{n&&O(t=>t.lastShownEmergencyTip===e.tip?t:{...t,lastShownEmergencyTip:e.tip})},[n,e.tip]),n?(0,gi.jsx)(x,{paddingLeft:2,flexDirection:`column`,children:(0,gi.jsx)(_,{...e.color===`warning`?{color:`warning`}:e.color===`error`?{color:`error`}:{dimColor:!0},children:e.tip})}):null}function mi(){return L(_i,vi)}var hi,gi,_i,vi,yi=t((()=>{h(),hi=n(h(),1),y(),P(),R(),gi=C(),_i=`tengu-top-of-feed-tip`,vi={tip:``,color:`dim`}}));function bi({char:e=`✻`}){let[t]=(0,xi.useState)(()=>re().prefersReducedMotion??!1),[n,r]=(0,xi.useState)(t),i=(0,xi.useRef)(null),[a,o]=c(n?null:50);return(0,xi.useEffect)(()=>{if(n)return;let e=setTimeout(r,wi,!0);return()=>clearTimeout(e)},[n]),n?(0,Si.jsx)(x,{ref:a,children:(0,Si.jsx)(_,{color:Ti,children:e})}):(i.current===null&&(i.current=o),(0,Si.jsx)(x,{ref:a,children:(0,Si.jsx)(_,{color:Yt(jt((o-i.current)/Ci*360%360)),children:e})}))}var xi,Si,Ci,wi,Ti,Ei=t((()=>{h(),xi=n(h(),1),N(),y(),ce(),At(),Si=C(),Ci=1500,wi=Ci*2,Ti=Yt({r:153,g:153,b:153})}));function Di(){return j()&&(I().opus1mMergeNoticeSeenCount??0)<ji}function Oi(){let[e]=(0,ki.useState)(Di);return(0,ki.useEffect)(()=>{if(!e)return;let t=(I().opus1mMergeNoticeSeenCount??0)+1;O(e=>(e.opus1mMergeNoticeSeenCount??0)>=t?e:{...e,opus1mMergeNoticeSeenCount:t})},[e]),e?(0,Ai.jsxs)(x,{paddingLeft:2,children:[(0,Ai.jsx)(bi,{char:`↑`}),(0,Ai.jsx)(_,{dimColor:!0,children:` Opus now defaults to 1M context · 5x more room, same pricing`})]}):null}var ki,Ai,ji,Mi=t((()=>{h(),ki=n(h(),1),N(),y(),R(),M(),Ei(),Ai=C(),ji=6}));function Ni(){return(0,Ii.jsx)(Pi,{})}function Pi(){let[e]=(0,Fi.useState)(()=>vn()&&re().voiceEnabled!==!0&&(I().voiceNoticeSeenCount??0)<Li&&!Di());return(0,Fi.useEffect)(()=>{if(!e)return;let t=(I().voiceNoticeSeenCount??0)+1;O(e=>(e.voiceNoticeSeenCount??0)>=t?e:{...e,voiceNoticeSeenCount:t})},[e]),e?(0,Ii.jsxs)(x,{paddingLeft:2,children:[(0,Ii.jsx)(bi,{}),(0,Ii.jsx)(_,{dimColor:!0,children:` Voice mode is now available · /voice to enable`})]}):null}var Fi,Ii,Li,Ri=t((()=>{h(),Fi=n(h(),1),y(),R(),ce(),yn(),Ei(),Mi(),Ii=C(),Li=3}));function zi(){return null}var Bi=t((()=>{}));function Vi(){return null}var Hi=t((()=>{})),Ui=r({ChannelsNotice:()=>Wi,findUnmatched:()=>Ki});function Wi(){let[{channels:e,list:t,unmatched:n}]=(0,qi.useState)(()=>{let e=E();return e.length===0?{channels:e,list:``,unmatched:[]}:{channels:e,list:e.map(Gi).join(`, `),unmatched:Ki(e)}});if(e.length===0)return null;let r=e.some(e=>!e.dev),i=w()&&r?`Channels`:w()?`--dangerously-load-development-channels`:`--channels`;return(0,Ji.jsxs)(x,{paddingLeft:2,flexDirection:`column`,children:[(0,Ji.jsxs)(_,{color:`error`,children:[`Listening for channel messages from: `,t]}),(0,Ji.jsxs)(_,{dimColor:!0,children:[`Experimental · inbound messages will be pushed into this session, this carries prompt injection risks. Restart Claude Code without `,i,` to disable.`]}),n.map(e=>(0,Ji.jsxs)(_,{color:`warning`,children:[Gi(e.entry),` · `,e.why]},`${Gi(e.entry)}:${e.why}`))]})}function Gi(e){return e.kind===`plugin`?`plugin:${e.name}@${e.marketplace}`:`server:${e.name}`}function Ki(e,t){let n=t?.configuredServerNames??(()=>{let e=[`enterprise`,`user`,`project`,`local`],t=new Set;for(let n of e)for(let e of Object.keys(gt(n).servers))t.add(e);return t})(),r=t?.installedPluginIds??(()=>{let e=new Set(Object.keys(ze().plugins)),t=rn();for(let n of[...t.enabled,...t.disabled])e.add(n.source);return e})(),i=[];for(let t of e){if(t.kind===`server`){n.has(t.name)||i.push({entry:t,why:`no MCP server configured with that name`});continue}r.has(`${t.name}@${t.marketplace}`)||i.push({entry:t,why:`plugin not installed`})}return i}var qi,Ji,Yi=t((()=>{h(),qi=n(h(),1),T(),an(),y(),mt(),at(),Ji=C()}));function Xi(){let e=On(),t=I().oauthAccount?.displayName??``,{columns:n}=u(),r=mn(),i=it.isSandboxingEnabled(),o=ii(),s=Jn(),c=Ot(e=>e.agent),d=Ot(e=>e.effortValue),f=I(),p;try{p=jn(3)}catch{p=[]}let[m]=(0,Zi.useState)(()=>{let e=re().companyAnnouncements;if(!(!e||e.length===0))return f.numStartups===1?e[0]:e[Math.floor(Math.random()*e.length)]}),{hasReleaseNotes:h}=En(f.lastReleaseNotesSeen);(0,Zi.useEffect)(()=>{I().lastReleaseNotesSeen!==`2.8.3`&&(O(e=>e.lastReleaseNotesSeen===`2.8.3`?e:{...e,lastReleaseNotesSeen:`2.8.3`}),r&&pn())},[f,r]);let g=!h&&!r&&!a(process.env.CLAUDE_CODE_FORCE_FULL_LOGO);(0,Zi.useEffect)(()=>{o&&!r&&!g&&ai()},[o,r,g]),(0,Zi.useEffect)(()=>{s&&!r&&!o&&!g&&qn()},[s,r,o,g]);let v=Vn(),y=ie(v),{version:S,cwd:C,billingType:w,agentName:ee}=Nn(),T=c??ee,E=Se(y+He(v,d),$i-20);if(!h&&!r&&!a(process.env.CLAUDE_CODE_FORCE_FULL_LOGO))return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ui,{}),(0,G.jsx)(Ni,{}),(0,G.jsx)(Oi,{}),Qi&&(0,G.jsx)(Qi.ChannelsNotice,{}),pe()&&(0,G.jsxs)(x,{paddingLeft:2,flexDirection:`column`,children:[(0,G.jsx)(_,{color:`warning`,children:`Debug mode enabled`}),(0,G.jsxs)(_,{dimColor:!0,children:[`Logging to: `,ue()?`stderr`:z()]})]}),(0,G.jsx)(pi,{}),process.env.CLAUDE_CODE_TMUX_SESSION&&(0,G.jsxs)(x,{paddingLeft:2,flexDirection:`column`,children:[(0,G.jsxs)(_,{dimColor:!0,children:[`tmux session: `,process.env.CLAUDE_CODE_TMUX_SESSION]}),(0,G.jsx)(_,{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)(x,{paddingLeft:2,flexDirection:`column`,children:[!process.env.IS_DEMO&&f.oauthAccount?.organizationName&&(0,G.jsxs)(_,{dimColor:!0,children:[`Message from `,f.oauthAccount.organizationName,`:`]}),(0,G.jsx)(_,{children:m})]}),process.env.USER_TYPE===`ant`&&!process.env.DEMO_VERSION&&(0,G.jsx)(x,{paddingLeft:2,flexDirection:`column`,children:(0,G.jsx)(_,{dimColor:!0,children:`Use /issue to report model behavior issues`})}),process.env.USER_TYPE===`ant`&&!process.env.DEMO_VERSION&&(0,G.jsxs)(x,{paddingLeft:2,flexDirection:`column`,children:[(0,G.jsx)(_,{color:`warning`,children:`[ANT-ONLY] Logs:`}),(0,G.jsxs)(_,{dimColor:!0,children:[`API calls: `,D(Nt())]}),(0,G.jsxs)(_,{dimColor:!0,children:[`Debug logs: `,D(z())]}),De()&&(0,G.jsxs)(_,{dimColor:!0,children:[`Startup Perf: `,D(Oe())]})]}),process.env.USER_TYPE===`ant`&&(0,G.jsx)(zi,{}),process.env.USER_TYPE===`ant`&&(0,G.jsx)(Vi,{})]});let k=Dn(n),te=Ln(I().theme),A=` ${b(`claude`,te)(`Claude Code`)} ${b(`inactive`,te)(`v${S}`)} `,ne=b(`claude`,te)(` Claude Code `);if(k===`compact`){let e=An(t);l(e)>n-4&&(e=An(null));let r=T?n-4-1-l(T)-3:n-4,a=kn(C,Math.max(r,10));return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ut,{children:(0,G.jsxs)(x,{flexDirection:`column`,borderStyle:`round`,borderColor:`claude`,borderText:{content:ne,position:`top`,align:`start`,offset:1},paddingX:1,paddingY:1,alignItems:`center`,width:n,children:[(0,G.jsx)(_,{bold:!0,children:e}),(0,G.jsx)(x,{marginY:1,children:(0,G.jsx)(Er,{})}),(0,G.jsx)(_,{dimColor:!0,children:E}),(0,G.jsx)(_,{dimColor:!0,children:w}),(0,G.jsx)(_,{dimColor:!0,children:T?`@${T} · ${a}`:a})]})}),(0,G.jsx)(Ni,{}),(0,G.jsx)(Oi,{}),Qi&&(0,G.jsx)(Qi.ChannelsNotice,{}),i&&(0,G.jsx)(x,{marginTop:1,flexDirection:`column`,children:(0,G.jsx)(_,{color:`warning`,children:`Your bash commands will be sandboxed. Disable with /sandbox.`})}),process.env.USER_TYPE===`ant`&&(0,G.jsx)(zi,{}),process.env.USER_TYPE===`ant`&&(0,G.jsx)(Vi,{})]})}let j=An(t),M=!process.env.IS_DEMO&&f.oauthAccount?.organizationName?`${E} · ${w} · ${f.oauthAccount.organizationName}`:`${E} · ${w}`,N=T?$i-1-l(T)-3:$i,P=kn(C,Math.max(N,10)),F=T?`@${T} · ${P}`:P,{leftWidth:ae,rightWidth:L}=Fn(n,k,Mn(j,F,M));return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ut,{children:(0,G.jsx)(x,{flexDirection:`column`,borderStyle:`round`,borderColor:`claude`,borderText:{content:A,position:`top`,align:`start`,offset:3},children:(0,G.jsxs)(x,{flexDirection:k===`horizontal`?`row`:`column`,paddingX:1,gap:1,children:[(0,G.jsxs)(x,{flexDirection:`column`,width:ae,justifyContent:`space-between`,alignItems:`center`,minHeight:9,children:[(0,G.jsx)(x,{marginTop:1,children:(0,G.jsx)(_,{bold:!0,children:j})}),(0,G.jsx)(Er,{}),(0,G.jsxs)(x,{flexDirection:`column`,alignItems:`center`,children:[(0,G.jsx)(_,{dimColor:!0,children:M}),(0,G.jsx)(_,{dimColor:!0,children:F})]})]}),k===`horizontal`&&(0,G.jsx)(x,{height:`100%`,borderStyle:`single`,borderColor:`claude`,borderDimColor:!0,borderTop:!1,borderBottom:!1,borderLeft:!1}),k===`horizontal`&&(0,G.jsx)(Pr,{feeds:r?[Br(fn()),Rr(e)]:o?[Rr(e),Vr()]:s?[Rr(e),Kn()]:[Rr(e),zr(p)],maxWidth:L})]})})}),(0,G.jsx)(Ni,{}),(0,G.jsx)(Oi,{}),Qi&&(0,G.jsx)(Qi.ChannelsNotice,{}),pe()&&(0,G.jsxs)(x,{paddingLeft:2,flexDirection:`column`,children:[(0,G.jsx)(_,{color:`warning`,children:`Debug mode enabled`}),(0,G.jsxs)(_,{dimColor:!0,children:[`Logging to: `,ue()?`stderr`:z()]})]}),(0,G.jsx)(pi,{}),process.env.CLAUDE_CODE_TMUX_SESSION&&(0,G.jsxs)(x,{paddingLeft:2,flexDirection:`column`,children:[(0,G.jsxs)(_,{dimColor:!0,children:[`tmux session: `,process.env.CLAUDE_CODE_TMUX_SESSION]}),(0,G.jsx)(_,{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)(x,{paddingLeft:2,flexDirection:`column`,children:[!process.env.IS_DEMO&&f.oauthAccount?.organizationName&&(0,G.jsxs)(_,{dimColor:!0,children:[`Message from `,f.oauthAccount.organizationName,`:`]}),(0,G.jsx)(_,{children:m})]}),i&&(0,G.jsx)(x,{paddingLeft:2,flexDirection:`column`,children:(0,G.jsx)(_,{color:`warning`,children:`Your bash commands will be sandboxed. Disable with /sandbox.`})}),process.env.USER_TYPE===`ant`&&!process.env.DEMO_VERSION&&(0,G.jsx)(x,{paddingLeft:2,flexDirection:`column`,children:(0,G.jsx)(_,{dimColor:!0,children:`Use /issue to report model behavior issues`})}),process.env.USER_TYPE===`ant`&&!process.env.DEMO_VERSION&&(0,G.jsxs)(x,{paddingLeft:2,flexDirection:`column`,children:[(0,G.jsx)(_,{color:`warning`,children:`[ANT-ONLY] Logs:`}),(0,G.jsxs)(_,{dimColor:!0,children:[`API calls: `,D(Nt())]}),(0,G.jsxs)(_,{dimColor:!0,children:[`Debug logs: `,D(z())]}),De()&&(0,G.jsxs)(_,{dimColor:!0,children:[`Startup Perf: `,D(Oe())]})]}),process.env.USER_TYPE===`ant`&&(0,G.jsx)(zi,{}),process.env.USER_TYPE===`ant`&&(0,G.jsx)(Vi,{})]})}var Zi,G,Qi,$i,ea=t((()=>{h(),y(),dn(),In(),Ce(),F(),Ar(),Lr(),Ur(),R(),Rn(),ce(),de(),Zi=n(h(),1),hn(),fi(),Pt(),Tn(),xt(),i(),Te(),yi(),Ri(),Mi(),Bi(),Hi(),G=C(),tt(),li(),Gn(),wt(),Ge(),Hn(),M(),Qi=(Yi(),e(Ui)),$i=50}));function ta({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,na.jsx)(x,{minWidth:l(i)+8,children:(0,na.jsx)(_,{dimColor:!0,children:i})})}var na,ra=t((()=>{h(),y(),na=C()}));function ia({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,aa.jsx)(x,{minWidth:l(n),children:(0,aa.jsx)(_,{dimColor:!0,children:n})})}var aa,oa=t((()=>{h(),y(),aa=C()}));function sa(e,t,n,r){for(let i=t+1;i<e.length;i++){let t=e[i];if(t?.type===`assistant`){let e=ma(t.message.content);if(e?.type===`thinking`||e?.type===`redacted_thinking`||e?.type===`tool_use`&&(Be(e.name,e.input,n).isCollapsible||r.has(e.id)))continue;return!0}if(!(t?.type===`system`||t?.type===`attachment`)&&!(t?.type===`user`&&ma(t.message.content)?.type===`tool_result`)){if(t?.type===`grouped_tool_use`){let e=ma(t.messages[0]?.message.content)?.input;if(Be(t.toolName,e,n).isCollapsible)continue}return!0}}return!1}function ca({message:e,isUserContinuation:t,hasContentAfter:n,tools:r,commands:i,verbose:a,inProgressToolUseIDs:o,streamingToolUseIDs:s,screen:c,canAnimate:l,onOpenRateLimitOptions:u,lastThinkingBlockId:d,latestBashOutputUUID:f,columns:p,isLoading:m,lookups:h,shouldCollapseDiffs:g}){let _=c===`transcript`,v=e.type===`grouped_tool_use`,y=e.type===`collapsed_read_search`,b=y&&(Ye(e,o)||m&&!n),S=v?e.displayMessage:y?en(e):e,C=v||y?[]:nt(e,h),w=Mo(e,s,o,v||y?Wt:ct(e,h),c,h),ee=!1;if(l)if(v)ee=e.messages.some(e=>{let t=ma(e.message.content);return t?.type===`tool_use`&&o.has(t.id)});else if(y)ee=Ye(e,o);else{let t=$t(e);ee=!t||o.has(t)}let T=_&&S.type===`assistant`&&Array.isArray(S.message.content)&&S.message.content.some(e=>e.type===`text`)&&(S.timestamp||S.message.model),E=(0,pa.jsx)(Dt,{message:e,lookups:h,addMargin:!T,containerWidth:T?void 0:p,tools:r,commands:i,verbose:a,inProgressToolUseIDs:o,progressMessagesForMessage:C,shouldAnimate:ee,shouldShowDot:!0,isTranscriptMode:_,isStatic:w,onOpenRateLimitOptions:u,isActiveCollapsedGroup:b,isUserContinuation:t,lastThinkingBlockId:d,latestBashOutputUUID:f,shouldCollapseDiffs:g});return T?(0,pa.jsx)(Ut,{children:(0,pa.jsxs)(x,{width:p,flexDirection:`column`,children:[(0,pa.jsxs)(x,{flexDirection:`row`,justifyContent:`flex-end`,gap:1,marginTop:1,children:[(0,pa.jsx)(ia,{message:S,isTranscriptMode:_}),(0,pa.jsx)(ta,{message:S,isTranscriptMode:_})]}),E]})}):(0,pa.jsx)(Ut,{children:E})}function la(e,t){if(e.type===`grouped_tool_use`)return e.messages.some(e=>{let n=ma(e.message.content);return n?.type===`tool_use`&&t.has(n.id)});if(e.type===`collapsed_read_search`)return ht(e).some(e=>t.has(e));let n=$t(e);return!!n&&t.has(n)}function ua(e,t){if(e.type===`grouped_tool_use`)return e.messages.every(e=>{let n=ma(e.message.content);return n?.type===`tool_use`&&t.has(n.id)});if(e.type===`collapsed_read_search`)return ht(e).every(e=>t.has(e));if(e.type===`assistant`){let n=ma(e.message.content);if(n?.type===`server_tool_use`)return t.has(n.id)}let n=$t(e);return!n||t.has(n)}function da(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&&Jt(t.message))return!1;let n=la(e.message,e.streamingToolUseIDs),r=ua(e.message,e.lookups.resolvedToolUseIDs);return!(n||!r)}var fa,pa,ma,ha,ga=t((()=>{fa=n(h(),1),y(),pt(),Je(),Bt(),pa=C(),ra(),Uo(),oa(),Pt(),ma=e=>{if(!Array.isArray(e))return;let t=e[0];if(!(t==null||typeof t==`string`))return t},ha=fa.memo(ca,da)}));function _a(e){return e.type===`attachment`&&va.has(e.attachment.type)}var va,ya=t((()=>{va=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.team_context.todo_reminder.context_efficiency.deferred_tools_delta.mcp_instructions_delta.companion_intro.token_usage.ultrathink_effort.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 ba(e){return Da.filter(t=>t.isActive(e))}var K,xa,Sa,Ca,wa,Ta,Ea,Da,Oa=t((()=>{y(),h(),Et(),o(),B(),Ce(),se(),Zn(),rt(),et(),K=C(),xa={id:`large-memory-files`,type:`warning`,isActive:e=>yt(e.memoryFiles).length>0,render:e=>(0,K.jsx)(K.Fragment,{children:yt(e.memoryFiles).map(e=>{let t=e.path.startsWith(ge())?er(ge(),e.path):e.path;return(0,K.jsxs)(x,{flexDirection:`row`,children:[(0,K.jsx)(_,{color:`warning`,children:s.warning}),(0,K.jsxs)(_,{color:`warning`,children:[`Large `,(0,K.jsx)(_,{bold:!0,children:t}),` will impact performance (`,Ee(e.content.length),` chars > `,Ee(Qe),`)`,(0,K.jsx)(_,{dimColor:!0,children:` · /memory to edit`})]})]},e.path)})})},Sa={id:`claude-ai-external-token`,type:`warning`,isActive:()=>{let e=le();return ae()&&(e.source===`ANTHROPIC_AUTH_TOKEN`||e.source===`apiKeyHelper`)},render:()=>{let e=le();return(0,K.jsxs)(x,{flexDirection:`row`,marginTop:1,children:[(0,K.jsx)(_,{color:`warning`,children:s.warning}),(0,K.jsxs)(_,{color:`warning`,children:[`Auth conflict: Using `,e.source,` instead of Claude account subscription token. Either unset`,` `,e.source,", or run `claude /logout`."]})]})}},Ca={id:`api-key-conflict`,type:`warning`,isActive:()=>{let{source:e}=A({skipRetrievingKeyFromApiKeyHelper:!0});return!!te()&&(e===`ANTHROPIC_API_KEY`||e===`apiKeyHelper`)},render:()=>{let{source:e}=A({skipRetrievingKeyFromApiKeyHelper:!0});return(0,K.jsxs)(x,{flexDirection:`row`,marginTop:1,children:[(0,K.jsx)(_,{color:`warning`,children:s.warning}),(0,K.jsxs)(_,{color:`warning`,children:[`Auth conflict: Using `,e,` instead of Anthropic Console key. Either unset `,e,", or run `claude /logout`."]})]})}},wa={id:`both-auth-methods`,type:`warning`,isActive:()=>{let{source:e}=A({skipRetrievingKeyFromApiKeyHelper:!0}),t=le();return e!==`none`&&t.source!==`none`&&!(e===`apiKeyHelper`&&t.source===`apiKeyHelper`)},render:()=>{let{source:e}=A({skipRetrievingKeyFromApiKeyHelper:!0}),t=le();return(0,K.jsxs)(x,{flexDirection:`column`,marginTop:1,children:[(0,K.jsxs)(x,{flexDirection:`row`,children:[(0,K.jsx)(_,{color:`warning`,children:s.warning}),(0,K.jsxs)(_,{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)(x,{flexDirection:`column`,marginLeft:3,children:[(0,K.jsxs)(_,{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)(_,{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.`]})]})]})}},Ta={id:`large-agent-descriptions`,type:`warning`,isActive:e=>Xn(e.agentDefinitions)>Qn,render:e=>{let t=Xn(e.agentDefinitions);return(0,K.jsxs)(x,{flexDirection:`row`,children:[(0,K.jsx)(_,{color:`warning`,children:s.warning}),(0,K.jsxs)(_,{color:`warning`,children:[`Large cumulative agent descriptions will impact performance (~`,Ee(t),` tokens > `,Ee(Qn),`)`,(0,K.jsx)(_,{dimColor:!0,children:` · /agents to manage`})]})]})}},Ea={id:`jetbrains-plugin-install`,type:`info`,isActive:e=>{if(!Ze()||!(e.config.autoInstallIdeExtension??!0))return!1;let t=Le();return t!==null&&!Ht(t)},render:()=>{let e=_t(Le());return(0,K.jsxs)(x,{flexDirection:`row`,gap:1,marginLeft:1,children:[(0,K.jsx)(_,{color:`ide`,children:s.arrowUp}),(0,K.jsxs)(_,{children:[`Install the `,(0,K.jsx)(_,{color:`ide`,children:e}),` plugin from the JetBrains Marketplace:`,` `,(0,K.jsx)(_,{bold:!0,children:`https://docs.claude.com/s/claude-code-jetbrains`})]})]})}},Da=[xa,Ta,Sa,Ca,wa,Ea]}));function ka({agentDefinitions:e}={}){let t={config:I(),agentDefinitions:e,memoryFiles:(0,ja.use)(ot())},n=ba(t);return n.length===0?null:(0,Ma.jsx)(x,{flexDirection:`column`,paddingLeft:1,children:n.map(e=>(0,Ma.jsx)(Aa.Fragment,{children:e.render(t)},e.id))})}var Aa,ja,Ma,Na=t((()=>{Aa=n(h(),1),ja=n(h(),1),y(),Et(),R(),Oa(),Ma=C()}));function Pa(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)??Ha,[e]),()=>{let t=e.current;if(!t)return NaN;let n=t.getScrollTop()+t.getPendingDelta(),r=Math.floor(n/Ra);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])??Fa);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-La),w=b;else{if(y){let e=v+Ia;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-Ia;{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*Ia,y=Math.min(b,C+Ba),S=0;for(w=C;w<y&&(S<h||x[w]<f+v+Ia);)S+=r.current.get(t[w])??za,w++}let e=v+2*Ia,n=Math.max(0,w-Ba),i=0;for(let e=C;e<w;e++)i+=r.current.get(t[e])??za;for(;C>n&&i<e;)C--,i+=r.current.get(t[C])??za;let o=d.current,c=Math.abs(g-a.current)+Math.abs(_);if(o&&c>v*2){let[e,t]=o;C<e-Va&&(C=e-Va),w>t+Va&&(w=t+Va),C>w&&(w=Math.min(C+Va,b))}a.current=g}f.current>0?f.current--:d.current=[C,w];let ee=(0,q.useDeferredValue)(C),T=(0,q.useDeferredValue)(w),E=C<ee?ee:C,D=w>T?T:w;if((E>D||y)&&(E=C,D=w),_>0&&(D=w),D-E>Ba){let e=(x[E]+x[D])/2;g-m.current<e?D=E+Ba:E=D-Ba}let O=m.current,k=x[E],te=E===0?0:k+O,A=D===b?1/0:Math.max(k,x[D]-v)+O;(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 ne=(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},[]),re=(0,q.useCallback)(e=>{let n=s.current.get(t[e])?.yogaNode;return!n||n.getComputedWidth()===0?-1:n.getComputedTop()},[t]),j=(0,q.useCallback)(e=>s.current.get(t[e])??null,[t]),M=(0,q.useCallback)(e=>r.current.get(t[e]),[t]),N=(0,q.useCallback)(t=>{let n=o.current;t<0||t>=n.n||e.current?.scrollTo(n.arr[t]+m.current)},[e]),P=S-x[D];return{range:[E,D],topSpacer:k,bottomSpacer:P,measureRef:ne,spacerRef:h,offsets:x,getItemTop:re,getItemElement:j,getItemHeight:M,scrollToIndex:N}}var q,Fa,Ia,La,Ra,za,Ba,Va,Ha,Ua=t((()=>{q=n(h(),1),Fa=3,Ia=40,La=30,Ra=Ia>>1,za=1,Ba=200,Va=25,Ha=()=>{}}));function Wa({children:e}){let[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(null);return(0,Ya.jsx)(Za.Provider,{value:n,children:(0,Ya.jsx)($a.Provider,{value:i,children:(0,Ya.jsx)(Xa.Provider,{value:t,children:(0,Ya.jsx)(Qa.Provider,{value:r,children:e})})})})}function Ga(){return(0,J.useContext)(Xa)}function Ka(){return(0,J.useContext)(Qa)}function qa(e){let t=(0,J.useContext)(Za);(0,J.useEffect)(()=>{if(t)return t(e),()=>t(null)},[t,e])}function Ja(e){let t=(0,J.useContext)($a);(0,J.useEffect)(()=>{if(t)return t(e),()=>t(null)},[t,e])}var J,Ya,Xa,Za,Qa,$a,eo=t((()=>{J=n(h(),1),Ya=C(),Xa=(0,J.createContext)(null),Za=(0,J.createContext)(null),Qa=(0,J.createContext)(null),$a=(0,J.createContext)(null)}));function to(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 no(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 io(e,t){if(t===null)return;let n=t;for(;n<e.length&&(e[n]?.type===`progress`||_a(e[n]));)n++;let r=e[n]?.uuid;if(!r)return;let i=no(e,t);return{firstUnseenUuid:r,count:Math.max(1,i)}}function ao({scrollable:e,bottom:t,overlay:n,bottomFloat:r,modal:i,modalScrollRef:a,scrollRef:o,dividerYRef:s,hidePill:c=!1,hideSticky:l=!1,newMessageCount:d=0,onPillClick:f}){let{rows:p,columns:h}=u(),[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(!Ue())return;let e=m.get(process.stdout);if(e)return e.onHyperlinkClick=e=>{if(e.startsWith(`file:`))try{ln(tr(e))}catch{}else cn(e)},()=>{e.onHyperlinkClick=void 0}},[]),Ue()){let s=l?null:v,u=s!=null&&s!==`clicked`&&n==null?s:null,m=s!=null&&n==null;return(0,X.jsxs)(Wa,{children:[(0,X.jsx)(x,{flexDirection:`row`,flexGrow:1,overflow:`hidden`,width:`100%`,children:(0,X.jsxs)(x,{flexDirection:`column`,flexGrow:1,width:h,overflow:`hidden`,children:[(0,X.jsxs)(x,{flexGrow:1,flexDirection:`column`,overflow:`hidden`,children:[u&&(0,X.jsx)(so,{text:u.text,onClick:u.scrollTo}),(0,X.jsxs)(g,{ref:o,flexGrow:1,flexDirection:`column`,paddingTop:+!m,stickyScroll:!0,children:[(0,X.jsx)(fo,{value:b,children:e}),n]}),!c&&S&&n==null&&(0,X.jsx)(oo,{count:d,onClick:f}),r!=null&&(0,X.jsx)(x,{position:`absolute`,bottom:0,right:0,opaque:!0,children:r})]}),(0,X.jsxs)(x,{flexDirection:`column`,flexShrink:0,width:`100%`,maxHeight:`50%`,children:[(0,X.jsx)(co,{}),(0,X.jsx)(lo,{}),(0,X.jsx)(x,{flexDirection:`column`,width:`100%`,flexGrow:1,overflowY:`hidden`,children:t})]})]})}),i!=null&&(0,X.jsx)(Wn,{value:{rows:p-uo-1,columns:h-4,scrollRef:a??null},children:(0,X.jsxs)(x,{position:`absolute`,bottom:0,left:0,right:0,maxHeight:p-uo,flexDirection:`column`,overflow:`hidden`,opaque:!0,children:[(0,X.jsx)(x,{flexShrink:0,children:(0,X.jsx)(_,{color:`permission`,children:`▔`.repeat(h)})}),(0,X.jsx)(x,{flexDirection:`column`,paddingX:2,flexShrink:0,overflow:`hidden`,children:i})]})})]})}return(0,X.jsxs)(X.Fragment,{children:[e,t,n,i]})}function oo({count:e,onClick:t}){let[n,r]=(0,Y.useState)(!1);return(0,X.jsx)(x,{position:`absolute`,bottom:0,left:0,right:0,justifyContent:`center`,children:(0,X.jsx)(x,{onClick:t,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:(0,X.jsxs)(_,{backgroundColor:n?`userMessageBackgroundHover`:`userMessageBackground`,dimColor:!0,children:[` `,e>0?`${e} new ${ke(e,`message`)}`:`Jump to bottom`,` `,s.arrowDown,` `]})})})}function so({text:e,onClick:t}){let[n,r]=(0,Y.useState)(!1);return(0,X.jsx)(x,{flexShrink:0,width:`100%`,height:1,paddingRight:1,backgroundColor:n?`userMessageBackgroundHover`:`userMessageBackground`,onClick:t,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:(0,X.jsxs)(_,{color:`subtle`,wrap:`truncate-end`,children:[s.pointer,` `,e]})})}function co(){let e=Ga();return!e||e.suggestions.length===0?null:(0,X.jsx)(x,{position:`absolute`,bottom:`100%`,left:0,right:0,paddingX:2,paddingTop:1,flexDirection:`column`,opaque:!0,children:(0,X.jsx)(zn,{suggestions:e.suggestions,selectedSuggestion:e.selectedSuggestion,maxColumnWidth:e.maxColumnWidth,overlay:!0})})}function lo(){let e=Ka();return e?(0,X.jsx)(x,{position:`absolute`,bottom:`100%`,left:0,right:0,opaque:!0,children:e}):null}var Y,X,uo,fo,po=t((()=>{o(),Y=n(h(),1),Un(),eo(),dn(),y(),un(),ut(),Ae(),ya(),Bn(),X=C(),uo=2,fo=(0,Y.createContext)({setStickyPrompt:()=>{}})}));function mo(e){let t=So.get(e);if(t!==void 0)return t;let n=vr(e);return So.set(e,n),n}function ho(e){let t=wo.get(e);if(t!==void 0)return t;let n=go(e);return wo.set(e,n),n}function go(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 _o({itemKey:e,msg:t,idx:n,measureRef:r,expanded:i,hovered:a,clickable:o,onClickK:s,onEnterK:c,onLeaveK:l,renderItem:u}){return(0,bo.jsx)(x,{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?()=>l(e):void 0,children:(0,bo.jsx)(S.Provider,{value:a&&!i?`text`:void 0,children:u(t,n)})})}function vo({messages:e,scrollRef:t,columns:n,itemKey:r,renderItem:i,onItemClick:a,isItemClickable:o,isItemExpanded:s,extractSearchText:c=mo,trackStickyPrompt:l,selectedIndex:u,cursorNavRef:d,setCursor:f,jumpRef:p,onSearchMatchesChange:m,scanElement:h,setPositions:g}){let _=(0,Z.useRef)([]),v=(0,Z.useRef)(e),y=(0,Z.useRef)(r);if(y.current!==r||e.length<_.current.length||e[0]!==v.current[0])_.current=e.map(e=>r(e));else for(let t=_.current.length;t<e.length;t++)_.current.push(r(e[t]));v.current=e,y.current=r;let b=_.current,{range:S,topSpacer:C,bottomSpacer:w,measureRef:ee,spacerRef:T,offsets:E,getItemTop:D,getItemElement:O,getItemHeight:k,scrollToIndex:te}=Pa(t,b,n),[A,ne]=S,re=(0,Z.useCallback)(t=>k(t)===0?!1:dt(e[t]),[k,e]);(0,Z.useImperativeHandle)(d,()=>{let n=e=>f?.({uuid:e.uuid,msgType:e.type,expanded:!1,toolName:We(e)?.name}),r=u??-1,i=(t,r,i=re)=>{for(let a=t;a>=0&&a<e.length;a+=r)if(i(a))return n(e[a]),!0;return!1},a=t=>re(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(),f?.(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,u,f,re]);let j=(0,Z.useRef)({offsets:E,start:A,getItemElement:O,getItemTop:D,messages:e,scrollToIndex:te});j.current={offsets:E,start:A,getItemElement:O,getItemTop:D,messages:e,scrollToIndex:te},(0,Z.useEffect)(()=>{if(u===void 0)return;let e=j.current,n=e.getItemElement(u);n?t.current?.scrollToElement(n,1):e.scrollToIndex(u)},[u,t]);let M=(0,Z.useRef)(null),N=(0,Z.useRef)({msgIdx:-1,positions:[]}),P=(0,Z.useRef)(-1),F=(0,Z.useRef)(0),ie=(0,Z.useRef)(0),I=(0,Z.useRef)(()=>{}),ae=(0,Z.useRef)(()=>{}),L=(0,Z.useRef)({matches:[],ptr:0,screenOrd:0,prefixSum:[]}),oe=(0,Z.useRef)(-1),se=(0,Z.useRef)(!1);function ce(e){let t=j.current.getItemTop(e);return Math.max(0,t-xo)}function le(e){let n=t.current,{msgIdx:r,positions:i}=N.current;if(!n||i.length===0||r<0){g?.(null);return}let a=Math.max(0,Math.min(e,i.length-1)),o=i[a],s=j.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-xo)),l=s-n.getScrollTop(),d=c+l+o.row),g?.({positions:i,rowOffset:c+l,currentIdx:a});let f=L.current,p=f.prefixSum.at(-1)??0,h=(f.prefixSum[f.ptr]??0)+a+1;m?.(p,h),fe(`highlight(i=${r}, ord=${a}/${i.length}): pos={row:${o.row},col:${o.col}} lo=${l} screenRow=${d} badge=${h}/${p}`)}ae.current=le;let[R,ue]=(0,Z.useState)(0),de=(0,Z.useCallback)(()=>ue(e=>e+1),[]);(0,Z.useEffect)(()=>{let e=M.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}=j.current,l=o(n),u=l?.yogaNode?.getComputedHeight()??0;if(!l||u===0){if(i>1){M.current=null,fe(`seek(i=${n}): no mount after scrollToIndex, skip`),I.current(r?-1:1);return}M.current={idx:n,wantLast:r,tries:i+1},c(n),de();return}M.current=null,a.scrollTo(Math.max(0,s(n)-xo));let d=h?.(l)??[];if(N.current={msgIdx:n,positions:d},fe(`seek(i=${n} t=${i}): ${d.length} positions`),d.length===0){if(++F.current>20){F.current=0;return}I.current(r?-1:1);return}F.current=0;let f=r?d.length-1:0;L.current.screenOrd=f,P.current=-1,ae.current(f);let p=ie.current;p&&(ie.current=0,I.current(p))},[R]);function z(e,n){let r=t.current;if(!r)return;let i=j.current,{getItemElement:a,scrollToIndex:o}=i;if(e<0||e>=i.messages.length)return;g?.(null),N.current={msgIdx:-1,positions:[]},M.current={idx:e,wantLast:n,tries:0};let s=a(e),c=s?.yogaNode?.getComputedHeight()??0;s&&c>0?r.scrollTo(ce(e)):o(e),de()}function pe(e){let t=L.current,{matches:n,prefixSum:r}=t,i=r.at(-1)??0;if(n.length===0)return;if(M.current){ie.current=e;return}P.current<0&&(P.current=t.ptr);let{positions:a}=N.current,o=t.screenOrd+e;if(o>=0&&o<a.length){t.screenOrd=o,le(o),P.current=-1;return}let s=(t.ptr+e+n.length)%n.length;if(s===P.current){g?.(null),P.current=-1,fe(`step: wraparound at ptr=${s}, all ${n.length} msgs phantoms`);return}t.ptr=s,t.screenOrd=0,z(n[s],e<0);let c=e<0?r[s+1]??i:r[s]+1;m?.(i,c)}I.current=pe,(0,Z.useImperativeHandle)(p,()=>({jumpToIndex:e=>{let n=t.current;n&&n.scrollTo(ce(e))},setSearchQuery:e=>{M.current=null,N.current={msgIdx:-1,positions:[]},P.current=-1,g?.(null);let n=e.toLowerCase(),r=[],i=[0];if(n){let e=j.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}=j.current,f=d(u),p=f>=0?f-l[u]:0;if(r.length>0&&s){let t=oe.current>=0?oe.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)}fe(`setSearchQuery('${e}'): ${r.length} msgs · ptr=${o} msgIdx=${r[o]} curTop=${t} origin=${p}`)}L.current={matches:r,ptr:o,screenOrd:0,prefixSum:i},r.length>0?z(r[o],!0):oe.current>=0&&s&&s.scrollTo(oe.current),m?.(a,r.length>0?i[o+1]??a:0)},nextMatch:()=>pe(1),prevMatch:()=>pe(-1),setAnchor:()=>{let e=t.current;e&&(oe.current=e.getScrollTop())},disarmSearch:()=>{g?.(null),M.current=null,N.current={msgIdx:-1,positions:[]},P.current=-1},warmSearchIndex:async()=>{if(se.current)return 0;let e=j.current.messages,t=0,n=performance.now();for(let n=0;n<e.length;n+=500){await je(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 fe(`warmSearchIndex: ${e.length} msgs · work=${Math.round(t)}ms wall=${r}ms chunks=${Math.ceil(e.length/500)}`),se.current=!0,Math.round(t)}}),[t]);let[me,he]=(0,Z.useState)(null),B=(0,Z.useRef)({onItemClick:a,setHoveredKey:he});B.current={onItemClick:a,setHoveredKey:he};let ge=(0,Z.useCallback)((e,t)=>{let n=B.current;!t&&n.onItemClick&&n.onItemClick(e)},[]),_e=(0,Z.useCallback)(e=>{B.current.setHoveredKey(e)},[]),ve=(0,Z.useCallback)(e=>{B.current.setHoveredKey(t=>t===e?null:t)},[]);return(0,bo.jsxs)(bo.Fragment,{children:[(0,bo.jsx)(x,{ref:T,height:C,flexShrink:0}),e.slice(A,ne).map((e,t)=>{let n=A+t,r=b[n],c=!!a&&(o?.(e)??!0),l=c&&me===r,u=s?.(e);return(0,bo.jsx)(_o,{itemKey:r,msg:e,idx:n,measureRef:ee,expanded:u,hovered:l,clickable:c,onClickK:ge,onEnterK:_e,onLeaveK:ve,renderItem:i},r)}),w>0&&(0,bo.jsx)(x,{height:w,flexShrink:0}),l&&(0,bo.jsx)(yo,{messages:e,start:A,end:ne,offsets:E,getItemTop:D,getItemElement:O,scrollRef:t})]})}function yo({messages:e,start:t,end:n,offsets:r,getItemTop:i,getItemElement:a,scrollRef:o}){let{setStickyPrompt:s}=(0,Z.useContext)(fo);(0,Z.useSyncExternalStore)((0,Z.useCallback)(e=>o.current?.subscribe(e)??To,[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=ho(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,Co).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,bo,xo,So,Co,wo,To,Eo=t((()=>{h(),Z=n(h(),1),Ua(),y(),Zt(),po(),bo=C(),de(),Me(),Tr(),Xt(),xo=3,So=new WeakMap,Co=500,wo=new WeakMap,To=()=>{}}));function Do(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 Oo(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 ko(e,t,n=zo,r=Bo){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 Ao(e){return(e.type===`assistant`||e.type===`user`?$t(e):null)??e.uuid}function jo(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Mo(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=$t(e);return i?t.has(i)||n.has(i)||vt(i,`PostToolUse`,a)?!1:nr(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 No,Q,$,Po,Fo,Io,Lo,Ro,zo,Bo,Vo,Ho,Uo=t((()=>{p(),gn(),No=n(h(),1),Q=n(h(),1),rr(),T(),N(),dn(),y(),It(),tn(),ft(),or(),lr(),pt(),fr(),R(),i(),ut(),_r(),Je(),Ae(),Tr(),ea(),Mt(),ga(),Xt(),Ct(),ya(),Pt(),Na(),$=C(),Eo(),Po=No.memo(function({agentDefinitions:e}){return(0,$.jsx)(Ut,{children:(0,$.jsxs)(x,{flexDirection:`column`,gap:1,children:[(0,$.jsx)(Xi,{}),(0,$.jsx)(No.Suspense,{fallback:null,children:(0,$.jsx)(ka,{agentDefinitions:e})})]})})}),Fo=(sn(),e(on)),Io=(k(),e(ne)).BRIEF_TOOL_NAME,Lo=(st(),e(Pe)).SEND_USER_FILE_TOOL_NAME,Ro=30,zo=200,Bo=50,Vo=({messages:e,tools:t,commands:n,verbose:r,toolJSX:i,toolUseConfirmQueue:o,inProgressToolUseIDs:s,isMessageSelectorVisible:c,conversationId:l,screen:p,streamingToolUses:m,showAllInTranscript:h=!1,agentDefinitions:g,onOpenRateLimitOptions:y,hideLogo:b=!1,isLoading:S,hidePastThinking:C=!1,streamingThinking:w,streamingText:T,isBriefOnly:E=!1,unseenDivider:D,scrollRef:O,trackStickyPrompt:k,jumpRef:te,onSearchMatchesChange:A,scanElement:ne,setPositions:re,disableRenderCap:j=!1,cursor:M=null,setCursor:N,cursorNavRef:P,renderRange:F})=>{let{columns:ie}=u(),ae=Fe(`transcript:toggleShowAll`,`Transcript`,`Ctrl+E`),L=(0,Q.useMemo)(()=>Ne(e).filter($e),[e]),se=(0,Q.useMemo)(()=>w?w.isStreaming?!0:w.streamingEndedAt?Date.now()-w.streamingEndedAt<3e4:!1:!1,[w]),{lastThinkingBlockId:ce,latestBashOutputUUID:le}=(0,Q.useMemo)(()=>{let e=null,t=null,n=C&&!se;C&&se&&(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 C||(e=null),{lastThinkingBlockId:e,latestBashOutputUUID:t}},[L,C,se]),R=(0,Q.useMemo)(()=>Re(L),[L]),ue=(0,Q.useMemo)(()=>m.filter(e=>!s.has(e.contentBlock.id)&&!R.has(e.contentBlock.id)),[m,s,R]),de=(0,Q.useMemo)(()=>ue.flatMap(e=>{let t=bt({content:[e.contentBlock]});return t.uuid=Lt(e.contentBlock.id,0),Ne([t])}),[ue]),z=p===`transcript`,fe=(0,Q.useMemo)(()=>a(process.env.CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL),[]),pe=O!=null&&!fe,me=z&&!h&&!pe,he=(0,Q.useRef)(null),B=(0,Q.useRef)(null),{collapsed:ge,lookups:_e,hasTruncatedMessages:ve,hiddenMessageCount:ye}=(0,Q.useMemo)(()=>{let e=Vt((r||Ue()?L:Xe(L,{includeSnipped:!0})).filter(e=>e.type!==`progress`&&!_a(e)&&Gt(e,z)),de),n=[Io,Lo].filter(e=>e!==null),i=[Io].filter(e=>e!==null),a=n.length>0&&!z?E?Do(e,n):i.length>0?Oo(e,i):e:e,o=me?a.slice(-Ro):a,s=me&&a.length>Ro,{messages:c}=hr(o,t,r),l=ar(cr(dr(lt(c,t))),r),u=kt(L,o),d=(()=>{let e=o.at(-1);return e?.type===`assistant`?e.message?.id:void 0})(),f;if(B.current&&B.current.key===u)f=B.current.lookups;else if(B.current&&L.length>=B.current.normalizedCount&&o.length>=B.current.messageCount&&B.current.lastAssistantMsgId===d){let e=qt(B.current.lookups,B.current.normalizedCount,B.current.messageCount,L,o);e?(f=e,B.current={key:u,lookups:f,normalizedCount:L.length,messageCount:o.length,lastAssistantMsgId:d}):(f=Tt(L,o),B.current={key:u,lookups:f,normalizedCount:L.length,messageCount:o.length,lastAssistantMsgId:d})}else f=Tt(L,o),B.current={key:u,lookups:f,normalizedCount:L.length,messageCount:o.length,lastAssistantMsgId:d};let p=e.length-Ro;return{collapsed:l,lookups:f,hasTruncatedMessages:s,hiddenMessageCount:p}},[r,L,z,de,me,t,E]),V=(0,Q.useMemo)(()=>{let e=!pe&&!j?ko(ge,he):0;return F?ge.slice(F[0],F[1]):e>0?ge.slice(e):ge},[ge,F,pe,j]),be=(0,Q.useMemo)(()=>new Set(m.map(e=>e.contentBlock.id)),[m]),{dividerBeforeIndex:xe,selectedIdx:Se}=(0,Q.useMemo)(()=>{if(!D&&!M)return{dividerBeforeIndex:-1,selectedIdx:-1};let e=-1,t=-1,n=D?.firstUnseenUuid.slice(0,24);for(let r=0;r<V.length;r++){let i=V[r];if(e===-1&&n&&i.uuid.slice(0,24)===n&&(e=r),t===-1&&M&&i.uuid===M.uuid&&(t=r),e!==-1&&t!==-1)break}return{dividerBeforeIndex:e,selectedIdx:t}},[D,M,V]),[Ce,we]=(0,Q.useState)(()=>new Set),Te=(0,Q.useCallback)(e=>{let t=Ao(e);we(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),Ee=(0,Q.useCallback)(e=>Ce.size>0&&Ce.has(Ao(e)),[Ce]),De=(0,Q.useRef)(_e);De.current=_e;let Oe=(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&&qe(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=De.current.toolUseByToolUseID.get(n.tool_use_id??``)?.name;return(r?nn(t,r):void 0)?.isResultTruncated?.(e.toolUseResult)??!1},[t]),Ae=(!i||!!i.shouldContinueAnimation)&&!o.length&&!c,je=s.size>0,{progress:Me}=d(),Pe=(0,Q.useRef)(null),Ie=I().terminalProgressBarEnabled&&!ee()&&!(Fo?.isProactiveActive()??!1);(0,Q.useEffect)(()=>{let e=Ie?je?`indeterminate`:`completed`:null;Pe.current!==e&&(Pe.current=e,Me(e))},[Me,Ie,je]),(0,Q.useEffect)(()=>()=>Me(null),[Me]);let Le=(0,Q.useCallback)(e=>`${e.uuid}-${l}`,[l]),ze=(e,i)=>{let a=i>0?V[i-1]?.type:void 0,o=e.type===`user`&&a===`user`,c=e.type===`collapsed_read_search`&&(!!T||sa(V,i,t,be)),l=V.length-1-i>0,u=Le(e),d=(0,$.jsx)(ha,{message:e,isUserContinuation:o,hasContentAfter:c,tools:t,commands:n,verbose:r||Ee(e)||M?.expanded===!0&&i===Se,inProgressToolUseIDs:s,streamingToolUseIDs:be,screen:p,canAnimate:Ae,onOpenRateLimitOptions:y,lastThinkingBlockId:ce,latestBashOutputUUID:le,columns:ie,isLoading:S,lookups:_e,shouldCollapseDiffs:l},u),f=(0,$.jsx)(Ve.Provider,{value:i===Se,children:d},u);return D&&i===xe?[(0,$.jsx)(x,{marginTop:1,children:(0,$.jsx)(v,{title:`${D.count} new ${ke(D.count,`message`)}`,width:ie,color:`inactive`})},`unseen-divider`),f]:f},Be=(0,Q.useRef)(new WeakMap),He=(0,Q.useCallback)(e=>{let n=Be.current.get(e);if(n!==void 0)return n;let r=vr(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=_e.toolUseByToolUseID.get(n.tool_use_id),a=(i&&nn(t,i.name))?.extractSearchText?.(e.toolUseResult);a!==void 0&&(r=a)}}let i=r.toLowerCase();return Be.current.set(e,i),i},[t,_e]);return(0,$.jsxs)(_n,{name:`MessagesBoundary`,children:[!b&&!(F&&F[0]>0)&&(0,$.jsx)(Po,{agentDefinitions:g}),ve&&(0,$.jsx)(v,{title:`${ae} to show ${f.bold(ye)} previous messages`,width:ie}),z&&h&&ye>0&&!j&&(0,$.jsx)(v,{title:`${ae} to hide ${f.bold(ye)} previous messages`,width:ie}),pe?(0,$.jsx)(Qt.Provider,{value:!0,children:(0,$.jsx)(vo,{messages:V,scrollRef:O,columns:ie,itemKey:Le,renderItem:ze,onItemClick:Te,isItemClickable:Oe,isItemExpanded:Ee,trackStickyPrompt:k,selectedIndex:Se>=0?Se:void 0,cursorNavRef:P,setCursor:N,jumpRef:te,onSearchMatchesChange:A,scanElement:ne,setPositions:re,extractSearchText:He})}):V.flatMap(ze),T&&!E&&(0,$.jsx)(x,{alignItems:`flex-start`,flexDirection:`row`,marginTop:1,width:`100%`,children:(0,$.jsxs)(x,{flexDirection:`row`,children:[(0,$.jsx)(x,{minWidth:2,children:(0,$.jsx)(_,{color:`text`,children:oe})}),(0,$.jsx)(x,{flexDirection:`column`,children:(0,$.jsx)(zt,{children:T})})]})}),se&&w&&!E&&(0,$.jsx)(x,{marginTop:1,children:(0,$.jsx)(Kt,{param:{type:`thinking`,thinking:w.thinking},addMargin:!1,isTranscriptMode:!0,verbose:r,hideInTranscript:!1})})]})},Ho=No.memo(Vo,(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`&&jo(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{po as a,qa as c,io as i,Ja as l,Uo as n,to as o,ao as r,eo as s,Ho as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-DR8-3Aex.js";import{f as t,s as n}from"./envUtils-BWeoiL4Y.js";import{J as r,Q as i,Rn as a,T as o,b as s,nt as c,t as l,x as u}from"./src-Di342QoJ.js";import{t as d}from"./jsx-runtime-D-D469L8.js";import{Xi as f,Zi as p,cn as m,on as h,uc as g,yc as _}from"./paths-CEAy4QCs.js";import{n as v,r as y}from"./analytics-DqMQntaB.js";import{a as b,n as x}from"./env-C2A9gV_G.js";import{Hy as S,Ky as C,Vy as w,aS as T,oS as E}from"./loadAgentsDir-DC4jN6-f.js";import{t as D}from"./useKeybinding-DPOUuymz.js";import{c as O,i as k,s as A}from"./terminalSetup-DULcnnWe.js";import{n as j,t as M}from"./useExitOnCtrlCDWithKeybindings-BHi41Ku_.js";import{t as N}from"./WelcomeV2-B0d9sH1c.js";import{n as P,t as F}from"./ThemePicker-kBt6obJb.js";import{n as I,t as L}from"./PressEnterToContinue-BYdiZwYD.js";import{t as R}from"./ApproveApiKey-DRARgWX3.js";n();var z=e(a(),1),B=d();v(),b(),_(),f(),h(),D(),k(),M(),l(),l(),C(),E(),S(),P(),I(),l();var V=(0,z.createContext)({marker:``});function H({children:e}){let{marker:t}=(0,z.useContext)(V);return(0,B.jsxs)(u,{gap:1,children:[(0,B.jsx)(s,{dimColor:!0,children:t}),(0,B.jsx)(u,{flexDirection:`column`,children:e})]})}l();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)(u,{flexDirection:`column`,children:z.Children.map(e,(e,n)=>{if(!(0,z.isValidElement)(e)||e.type!==H)return e;let i=`${t}${`${String(n+1).padStart(r)}.`}`;return(0,B.jsx)(U.Provider,{value:{marker:i},children:(0,B.jsx)(V.Provider,{value:{marker:i},children:e})})})})}W.Item=H;var G=W;l();function K({onDone:e}){let[n,a]=(0,z.useState)(0),[l,d]=(0,z.useState)(!1),[f]=(0,z.useState)(()=>m()),[h,_]=o();(0,z.useEffect)(()=>{y(`tengu_began_setup`,{oauthEnabled:f})},[f]);function v(){if(n<M.length-1){let e=n+1;a(e),y(`tengu_onboarding_step`,{oauthEnabled:f,stepId:M[e]?.id})}else e()}function b(e){_(e),v()}let S=j(),C=(0,B.jsx)(u,{marginX:1,children:(0,B.jsx)(F,{onThemeSelect:b,showIntroText:!0,helpText:`To change this later, run /theme`,hideEscToCancel:!0,skipExitHandling:!0})}),E=(0,B.jsxs)(u,{flexDirection:`column`,gap:1,paddingLeft:1,children:[(0,B.jsx)(s,{bold:!0,children:`Before you start, keep in mind:`}),(0,B.jsx)(u,{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)(r,{}),`or editing files. You stay in control of every action.`,(0,B.jsx)(r,{})]})]}),(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)(r,{}),(0,B.jsx)(i,{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=p(process.env.ANTHROPIC_API_KEY);if(g(e)===`new`)return e},[]);function k(e){e&&d(!0),v()}let M=[];M.push({id:`theme`,component:C}),D&&M.push({id:`api-key`,component:(0,B.jsx)(R,{customApiKeyTruncated:D,onDone:k})}),f&&M.push({id:`oauth`,component:(0,B.jsx)(q,{skip:l,onSkip:v,children:(0,B.jsx)(w,{onDone:v})})}),M.push({id:`security`,component:E}),O()&&M.push({id:`terminal-setup`,component:(0,B.jsxs)(u,{flexDirection:`column`,gap:1,paddingLeft:1,children:[(0,B.jsx)(s,{bold:!0,children:`Use Claude Code's terminal setup?`}),(0,B.jsxs)(u,{flexDirection:`column`,width:70,gap:1,children:[(0,B.jsxs)(s,{children:[`For the optimal coding experience, enable the recommended settings`,(0,B.jsx)(r,{}),`for your terminal:`,` `,x.terminal===`Apple_Terminal`?`Option+Enter for newlines and visual bell`:`Shift+Enter for newlines`]}),(0,B.jsx)(T,{options:[{label:`Yes, use recommended settings`,value:`install`},{label:`No, maybe later with /terminal-setup`,value:`no`}],onChange:e=>{e===`install`?A(h).catch(()=>{}).finally(v):v()},onCancel:()=>v()}),(0,B.jsx)(s,{dimColor:!0,children:S.pending?(0,B.jsxs)(B.Fragment,{children:[`Press `,S.keyName,` again to exit`]}):(0,B.jsx)(B.Fragment,{children:`Enter to confirm · Esc to skip`})})]})]})});let P=M[n],I=(0,z.useCallback)(()=>{n===M.length-1?e():v()},[n,M.length,f,e]),V=(0,z.useCallback)(()=>{v()},[n,M.length,f,e]);return c({"confirm:yes":I},{context:`Confirmation`,isActive:P?.id===`security`}),c({"confirm:no":V},{context:`Confirmation`,isActive:P?.id===`terminal-setup`}),(0,B.jsxs)(u,{flexDirection:`column`,children:[(0,B.jsx)(N,{}),(0,B.jsxs)(u,{flexDirection:`column`,marginTop:1,children:[P?.component,S.pending&&(0,B.jsx)(u,{padding:1,children:(0,B.jsxs)(s,{dimColor:!0,children:[`Press `,S.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"./chunk-DR8-3Aex.js";import{f as t,s as n}from"./envUtils-BWeoiL4Y.js";import{J as r,Q as i,Rn as a,T as o,b as s,nt as c,t as l,x as u}from"./src-Di342QoJ.js";import{t as d}from"./jsx-runtime-D-D469L8.js";import{Xi as f,Zi as p,cn as m,on as h,uc as g,yc as _}from"./paths-nIHVpTn2.js";import{n as v,r as y}from"./analytics-DqMQntaB.js";import{a as b,n as x}from"./env-C2A9gV_G.js";import{Jy as S,Uy as C,Wy as w,cS as T,sS as E}from"./loadAgentsDir-BfEZacjM.js";import{t as D}from"./useKeybinding-DPOUuymz.js";import{c as O,i as k,s as A}from"./terminalSetup-Bkml3uSP.js";import{n as j,t as M}from"./useExitOnCtrlCDWithKeybindings-BHi41Ku_.js";import{t as N}from"./WelcomeV2-k_969SnB.js";import{n as P,t as F}from"./ThemePicker-Bdm12PmJ.js";import{n as I,t as L}from"./PressEnterToContinue-BYdiZwYD.js";import{t as R}from"./ApproveApiKey-DrflOSA-.js";n();var z=e(a(),1),B=d();v(),b(),_(),f(),h(),D(),k(),M(),l(),l(),S(),T(),w(),P(),I(),l();var V=(0,z.createContext)({marker:``});function H({children:e}){let{marker:t}=(0,z.useContext)(V);return(0,B.jsxs)(u,{gap:1,children:[(0,B.jsx)(s,{dimColor:!0,children:t}),(0,B.jsx)(u,{flexDirection:`column`,children:e})]})}l();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)(u,{flexDirection:`column`,children:z.Children.map(e,(e,n)=>{if(!(0,z.isValidElement)(e)||e.type!==H)return e;let i=`${t}${`${String(n+1).padStart(r)}.`}`;return(0,B.jsx)(U.Provider,{value:{marker:i},children:(0,B.jsx)(V.Provider,{value:{marker:i},children:e})})})})}W.Item=H;var G=W;l();function K({onDone:e}){let[n,a]=(0,z.useState)(0),[l,d]=(0,z.useState)(!1),[f]=(0,z.useState)(()=>m()),[h,_]=o();(0,z.useEffect)(()=>{y(`tengu_began_setup`,{oauthEnabled:f})},[f]);function v(){if(n<M.length-1){let e=n+1;a(e),y(`tengu_onboarding_step`,{oauthEnabled:f,stepId:M[e]?.id})}else e()}function b(e){_(e),v()}let S=j(),w=(0,B.jsx)(u,{marginX:1,children:(0,B.jsx)(F,{onThemeSelect:b,showIntroText:!0,helpText:`To change this later, run /theme`,hideEscToCancel:!0,skipExitHandling:!0})}),T=(0,B.jsxs)(u,{flexDirection:`column`,gap:1,paddingLeft:1,children:[(0,B.jsx)(s,{bold:!0,children:`Before you start, keep in mind:`}),(0,B.jsx)(u,{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)(r,{}),`or editing files. You stay in control of every action.`,(0,B.jsx)(r,{})]})]}),(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)(r,{}),(0,B.jsx)(i,{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=p(process.env.ANTHROPIC_API_KEY);if(g(e)===`new`)return e},[]);function k(e){e&&d(!0),v()}let M=[];M.push({id:`theme`,component:w}),D&&M.push({id:`api-key`,component:(0,B.jsx)(R,{customApiKeyTruncated:D,onDone:k})}),f&&M.push({id:`oauth`,component:(0,B.jsx)(q,{skip:l,onSkip:v,children:(0,B.jsx)(C,{onDone:v})})}),M.push({id:`security`,component:T}),O()&&M.push({id:`terminal-setup`,component:(0,B.jsxs)(u,{flexDirection:`column`,gap:1,paddingLeft:1,children:[(0,B.jsx)(s,{bold:!0,children:`Use Claude Code's terminal setup?`}),(0,B.jsxs)(u,{flexDirection:`column`,width:70,gap:1,children:[(0,B.jsxs)(s,{children:[`For the optimal coding experience, enable the recommended settings`,(0,B.jsx)(r,{}),`for your terminal:`,` `,x.terminal===`Apple_Terminal`?`Option+Enter for newlines and visual bell`:`Shift+Enter for newlines`]}),(0,B.jsx)(E,{options:[{label:`Yes, use recommended settings`,value:`install`},{label:`No, maybe later with /terminal-setup`,value:`no`}],onChange:e=>{e===`install`?A(h).catch(()=>{}).finally(v):v()},onCancel:()=>v()}),(0,B.jsx)(s,{dimColor:!0,children:S.pending?(0,B.jsxs)(B.Fragment,{children:[`Press `,S.keyName,` again to exit`]}):(0,B.jsx)(B.Fragment,{children:`Enter to confirm · Esc to skip`})})]})]})});let P=M[n],I=(0,z.useCallback)(()=>{n===M.length-1?e():v()},[n,M.length,f,e]),V=(0,z.useCallback)(()=>{v()},[n,M.length,f,e]);return c({"confirm:yes":I},{context:`Confirmation`,isActive:P?.id===`security`}),c({"confirm:no":V},{context:`Confirmation`,isActive:P?.id===`terminal-setup`}),(0,B.jsxs)(u,{flexDirection:`column`,children:[(0,B.jsx)(N,{}),(0,B.jsxs)(u,{flexDirection:`column`,marginTop:1,children:[P?.component,S.pending&&(0,B.jsx)(u,{padding:1,children:(0,B.jsxs)(s,{dimColor:!0,children:[`Press `,S.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"./chunk-DR8-3Aex.js";import{Rn as n,b as r,t as i}from"./src-Di342QoJ.js";import{t as a}from"./jsx-runtime-D-D469L8.js";import{Cc as o,dc as s,yc as c}from"./paths-CEAy4QCs.js";import{n as l,r as u}from"./analytics-DqMQntaB.js";import{S as d,b as f}from"./startupProfiler-CBcN1Chw.js";import{a as p,n as m,r as h,t as g}from"./overageCreditGrant-CzkWDmsQ.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 n=m();if(!n)return null;let i=g(n);if(!i)return null;if(t){let t=C(i);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(r,{color:`claude`,children:e?d(t,e):t}),(0,D.jsx)(r,{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)(r,{dimColor:!0,children:[(0,D.jsx)(r,{color:`claude`,children:o.slice(0,s)}),o.slice(s)]})}function T(){let e=m(),t=e?g(e):null,n=t?C(t):`extra usage credit`;return{title:n,lines:[],customContent:{content:(0,D.jsx)(r,{dimColor:!0,children:k}),width:Math.max(n.length,47)}}}var E,D,O,k,A=e((()=>{n(),E=t(n(),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"./chunk-DR8-3Aex.js";import{Rn as n,b as r,t as i}from"./src-Di342QoJ.js";import{t as a}from"./jsx-runtime-D-D469L8.js";import{Cc as o,dc as s,yc as c}from"./paths-nIHVpTn2.js";import{n as l,r as u}from"./analytics-DqMQntaB.js";import{S as d,b as f}from"./startupProfiler-CBcN1Chw.js";import{a as p,n as m,r as h,t as g}from"./overageCreditGrant-BOSyVk3U.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 n=m();if(!n)return null;let i=g(n);if(!i)return null;if(t){let t=C(i);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(r,{color:`claude`,children:e?d(t,e):t}),(0,D.jsx)(r,{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)(r,{dimColor:!0,children:[(0,D.jsx)(r,{color:`claude`,children:o.slice(0,s)}),o.slice(s)]})}function T(){let e=m(),t=e?g(e):null,n=t?C(t):`extra usage credit`;return{title:n,lines:[],customContent:{content:(0,D.jsx)(r,{dimColor:!0,children:k}),width:Math.max(n.length,47)}}}var E,D,O,k,A=e((()=>{n(),E=t(n(),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"./chunk-DR8-3Aex.js";import{s as n,u as r}from"./envUtils-BWeoiL4Y.js";import{n as i,t as a}from"./figures-gfT9mM8P.js";import{Cn as o,F as s,Q as c,Rn as l,T as u,Ut as d,_ as f,b as p,f as m,g as h,h as g,n as _,nt as v,p as y,r as b,t as x,tn as ee,tt as te,v as S,x as C,xt as ne}from"./src-Di342QoJ.js";import{t as w}from"./jsx-runtime-D-D469L8.js";import{Jo as T,Qa as re,Qo as E,Yo as D,Zt as O,lo as ie,no as k,on as A,oo as j,ps as M,us as ae,wc as oe,yc as se}from"./paths-nIHVpTn2.js";import{D as ce,E as le,J as N,U as P,l as ue,p as de,z as fe}from"./debug-otxXY3j-.js";import{n as pe,r as F}from"./analytics-DqMQntaB.js";import{l as me,u as he}from"./oauth-CdZEzMww.js";import{c as ge,o as _e,s as ve}from"./log-DSV4Ht5l.js";import{b as ye,x as be}from"./teammate-CbskW5G9.js";import{T as I,x as xe}from"./startupProfiler-CBcN1Chw.js";import{l as Se,n as Ce,o as L}from"./stringUtils-KZoO4GUd.js";import{$s as we,Ah as Te,Aw as Ee,Bs as De,Bw as Oe,By as R,Ds as ke,Dw as Ae,Es as je,Ew as Me,Jy as Ne,Ks as Pe,Ky as Fe,Ls as Ie,MA as Le,NA as Re,OC as z,Ps as ze,Rs as Be,Sw as Ve,Us as He,Uw as Ue,XC as We,Xs as Ge,Xx as Ke,Ys as qe,_c as Je,bs as Ye,cT as Xe,cc as Ze,dC as Qe,dT as $e,dc as et,fC as tt,fT as nt,fc as rt,hc as it,ic as at,iw as ot,jh as st,kA as ct,kC as lt,lT as ut,lc as dt,lj as ft,mC as pt,mS as mt,mT as ht,nT as gt,nw as _t,oT as vt,pS as yt,pT as bt,pc as xt,rS as St,rT as Ct,rc as wt,rj as Tt,sS as Et,sT as Dt,sc as Ot,tc as kt,tw as At,uT as jt,uc as Mt,uj as Nt,vc as Pt,vw as Ft,ww as It,xs as Lt,xw as Rt}from"./loadAgentsDir-BfEZacjM.js";import{i as zt,o as Bt,p as Vt,u as Ht}from"./xml-CPJXOUFt.js";import{n as Ut,t as Wt}from"./browser-Bt-ckCaU.js";import{t as Gt}from"./useKeybinding-DPOUuymz.js";import{t as Kt}from"./useTerminalSize-Du-EamDN.js";import{n as qt,t as Jt}from"./useExitOnCtrlCDWithKeybindings-BHi41Ku_.js";import{n as Yt,t as Xt}from"./pluginStartupCheck-BC5npqdw.js";import{a as Zt,d as Qt,f as $t,i as en,l as tn,o as nn,s as rn,u as an}from"./pluginOperations-DFzbASMD.js";import{a as on,c as sn,i as cn,n as ln,o as un,s as dn,t as fn}from"./validatePlugin-b1ec7M7n.js";import{a as pn,n as mn,o as hn,r as gn}from"./pluginFlagging-7zuXXBD5.js";import{i as _n,n as vn,r as yn}from"./MCPConnectionManager-BhbT4Sah.js";import{t as bn}from"./SearchBox-Bu4gYF0J.js";import{n as xn,t as Sn}from"./useSearchInput-BCErnYur.js";import{i as Cn,n as wn}from"./pluginAutoupdate-xyXksEJv.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)(C,{children:[(0,On.jsx)(p,{bold:!0,children:`Capabilities: `}),(0,On.jsx)(p,{color:`text`,children:r.length>0?(0,On.jsx)(g,{children:r}):`none`})]})}var On,kn=e((()=>{l(),x(),On=w()}));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:o=!1}){let[l]=u(),d=qt(),{columns:f}=s(),[m,_]=B.useState(!1),[v,y]=B.useState(null),b=tt(e=>e.mcp),x=pt(),[w,T]=B.useState(null),[re,E]=(0,B.useState)(!1),D=(0,B.useRef)(null),[ie,k]=(0,B.useState)(!1),[A,j]=(0,B.useState)(null),[M,ae]=(0,B.useState)(!1),[oe,se]=(0,B.useState)(null),[ce,le]=(0,B.useState)(!1),[N,P]=(0,B.useState)(!1),ue=(0,B.useRef)(void 0),de=(0,B.useRef)(!1),[pe,he]=(0,B.useState)(``),[_e,ve]=(0,B.useState)(0),[ye,be]=(0,B.useState)(null);(0,B.useEffect)(()=>()=>{de.current=!0,D.current?.abort(),ue.current!==void 0&&clearTimeout(ue.current)},[]);let I=e.isAuthenticated||e.client.type===`connected`&&t>0,xe=yn(),Se=B.useCallback(async()=>{k(!1),j(null),E(!0);try{let t=await xe(e.name),n=t.client.type===`connected`;F(`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){F(`tengu_claudeai_mcp_auth_completed`,{success:!1}),i?.(jn(t,e.name))}finally{E(!1)}},[xe,e.name,i]),L=B.useCallback(async()=>{await Ke(e.name,{...e.config,scope:e.scope}),x(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`needs-auth`}:t),r=It(t.mcp.tools,e.name),i=Rt(t.mcp.commands,e.name),a=Ve(t.mcp.resources,e.name);return{...t,mcp:{...t.mcp,clients:n,tools:r,commands:i,resources:a}}}),F(`tengu_claudeai_mcp_clear_auth_completed`,{}),i?.(`Disconnected from ${e.name}.`),ae(!1),se(null),le(!1)},[e.name,e.config,e.scope,x,i]);te(`confirm:no`,()=>{D.current?.abort(),D.current=null,_(!1),T(null)},{context:`Confirmation`,isActive:m}),te(`confirm:no`,()=>{k(!1),j(null)},{context:`Confirmation`,isActive:ie}),te(`confirm:no`,()=>{ae(!1),se(null),le(!1)},{context:`Confirmation`,isActive:M}),ne((e,t)=>{if(t.return&&ie&&Se(),t.return&&M)if(ce)L();else{let e=`${me().CLAUDE_AI_ORIGIN}/settings/connectors`;se(e),le(!0),Ut(e)}if(e===`c`&&!N){let e=w||A||oe;e&&ee(e).then(e=>{de.current||(e&&process.stdout.write(e),P(!0),ue.current!==void 0&&clearTimeout(ue.current),ue.current=setTimeout(P,2e3,!1))})}});let we=Ce(String(e.name)),Te=Me(b.commands,e.name).length,Ee=_n(),De=B.useCallback(async()=>{let t=me().CLAUDE_AI_ORIGIN,n=O()?.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),k(!0),F(`tengu_claudeai_mcp_auth_started`,{}),await Ut(r)},[e.config]),Oe=B.useCallback(()=>{ae(!0),F(`tengu_claudeai_mcp_clear_auth_started`,{})},[]),R=B.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await Ee(e.name),e.config.type===`claudeai-proxy`&&F(`tengu_claudeai_mcp_toggle`,{new_state:t?`disabled`:`enabled`}),r()}catch(n){i?.(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${fe(n)}`)}},[e.client.type,e.config.type,e.name,Ee,r,i]),ke=B.useCallback(async()=>{if(e.config.type===`claudeai-proxy`)return;_(!0),y(null);let t=new AbortController;D.current=t;try{if(e.isAuthenticated&&e.config&&await ot(e.name,e.config,{preserveStepUpState:!0}),e.config){await _t(e.name,e.config,T,t.signal,{onWaitingForCallback:e=>{be(()=>e)}}),F(`tengu_mcp_auth_config_authenticate`,{wasAuthenticated:e.isAuthenticated});let n=await xe(e.name);if(n.client.type===`connected`){let t=I?`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.`):(ge(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 We)&&y(e.message)}finally{_(!1),D.current=null,be(null),he(``)}},[e.isAuthenticated,e.config,e.name,i,xe,I]),Ae=async()=>{e.config.type!==`claudeai-proxy`&&e.config&&(await ot(e.name,e.config),F(`tengu_mcp_auth_config_clear`,{}),await Ke(e.name,{...e.config,scope:e.scope}),x(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`failed`}:t),r=It(t.mcp.tools,e.name),i=Rt(t.mcp.commands,e.name),a=Ve(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(m){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)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,V.jsxs)(p,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,V.jsxs)(C,{children:[(0,V.jsx)(Fe,{}),(0,V.jsx)(p,{children:t})]}),w&&(0,V.jsxs)(C,{flexDirection:`column`,children:[(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually `}),N?(0,V.jsx)(p,{color:`success`,children:`(Copied!)`}):(0,V.jsx)(p,{dimColor:!0,children:(0,V.jsx)(h,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,V.jsx)(c,{url:w})]}),m&&w&&ye&&(0,V.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,V.jsx)(p,{dimColor:!0,children:`If the redirect page shows a connection error, paste the URL from your browser's address bar:`}),(0,V.jsxs)(C,{children:[(0,V.jsxs)(p,{dimColor:!0,children:[`URL `,`>`,` `]}),(0,V.jsx)(yt,{value:pe,onChange:he,onSubmit:e=>{ye(e.trim()),he(``)},cursorOffset:_e,onChangeCursorOffset:ve,columns:f-8})]})]}),(0,V.jsx)(C,{marginLeft:3,children:(0,V.jsx)(p,{dimColor:!0,children:`Return here after authenticating in your browser. Press Esc to go back.`})})]})}if(ie)return(0,V.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,V.jsxs)(p,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,V.jsxs)(C,{children:[(0,V.jsx)(Fe,{}),(0,V.jsx)(p,{children:` A browser window will open for authentication`})]}),A&&(0,V.jsxs)(C,{flexDirection:`column`,children:[(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually `}),N?(0,V.jsx)(p,{color:`success`,children:`(Copied!)`}):(0,V.jsx)(p,{dimColor:!0,children:(0,V.jsx)(h,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,V.jsx)(c,{url:A})]}),(0,V.jsxs)(C,{marginLeft:3,flexDirection:`column`,children:[(0,V.jsxs)(p,{color:`permission`,children:[`Press `,(0,V.jsx)(p,{bold:!0,children:`Enter`}),` after authenticating in your browser.`]}),(0,V.jsx)(p,{dimColor:!0,italic:!0,children:(0,V.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]});if(M)return(0,V.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,V.jsxs)(p,{color:`claude`,children:[`Clear authentication for `,e.name]}),ce?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(p,{children:`Find the MCP server in the browser and click "Disconnect".`}),oe&&(0,V.jsxs)(C,{flexDirection:`column`,children:[(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{dimColor:!0,children:`If your browser didn't open automatically, copy this URL manually `}),N?(0,V.jsx)(p,{color:`success`,children:`(Copied!)`}):(0,V.jsx)(p,{dimColor:!0,children:(0,V.jsx)(h,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,V.jsx)(c,{url:oe})]}),(0,V.jsxs)(C,{marginLeft:3,flexDirection:`column`,children:[(0,V.jsxs)(p,{color:`permission`,children:[`Press `,(0,V.jsx)(p,{bold:!0,children:`Enter`}),` when done.`]}),(0,V.jsx)(p,{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)(p,{children:`This will open claude.ai in the browser. Find the MCP server in the list and click "Disconnect".`}),(0,V.jsxs)(C,{marginLeft:3,flexDirection:`column`,children:[(0,V.jsxs)(p,{color:`permission`,children:[`Press `,(0,V.jsx)(p,{bold:!0,children:`Enter`}),` to open the browser.`]}),(0,V.jsx)(p,{dimColor:!0,italic:!0,children:(0,V.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]})]});if(re)return(0,V.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,V.jsxs)(p,{color:`text`,children:[`Connecting to `,(0,V.jsx)(p,{bold:!0,children:e.name}),`…`]}),(0,V.jsxs)(C,{children:[(0,V.jsx)(Fe,{}),(0,V.jsx)(p,{children:` Establishing connection to MCP server`})]}),(0,V.jsx)(p,{dimColor:!0,children:`This may take a few moments.`})]});let je=[];return e.client.type===`disabled`&&je.push({label:`Enable`,value:`toggle-enabled`}),e.client.type===`connected`&&t>0&&je.push({label:`View tools`,value:`tools`}),e.config.type===`claudeai-proxy`?e.client.type===`connected`?je.push({label:`Clear authentication`,value:`claudeai-clear-auth`}):e.client.type!==`disabled`&&je.push({label:`Authenticate`,value:`claudeai-auth`}):(I&&(je.push({label:`Re-authenticate`,value:`reauth`}),je.push({label:`Clear authentication`,value:`clear-auth`})),I||je.push({label:`Authenticate`,value:`auth`})),e.client.type!==`disabled`&&(e.client.type!==`needs-auth`&&je.push({label:`Reconnect`,value:`reconnectMcpServer`}),je.push({label:`Disable`,value:`toggle-enabled`})),je.length===0&&je.push({label:`Back`,value:`back`}),(0,V.jsxs)(C,{flexDirection:`column`,children:[(0,V.jsxs)(C,{flexDirection:`column`,paddingX:1,borderStyle:o?void 0:`round`,children:[(0,V.jsx)(C,{marginBottom:1,children:(0,V.jsxs)(p,{bold:!0,children:[we,` MCP Server`]})}),(0,V.jsxs)(C,{flexDirection:`column`,gap:0,children:[(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,V.jsxs)(p,{children:[S(`inactive`,l)(a.radioOff),` disabled`]}):e.client.type===`connected`?(0,V.jsxs)(p,{children:[S(`success`,l)(a.tick),` connected`]}):e.client.type===`pending`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(p,{dimColor:!0,children:a.radioOff}),(0,V.jsx)(p,{children:` connecting…`})]}):e.client.type===`needs-auth`?(0,V.jsxs)(p,{children:[S(`warning`,l)(a.triangleUpOutline),` needs authentication`]}):(0,V.jsxs)(p,{children:[S(`error`,l)(a.cross),` failed`]})]}),e.transport!==`claudeai-proxy`&&(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{bold:!0,children:`Auth: `}),I?(0,V.jsxs)(p,{children:[S(`success`,l)(a.tick),` authenticated`]}):(0,V.jsxs)(p,{children:[S(`error`,l)(a.cross),` not authenticated`]})]}),(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{bold:!0,children:`URL: `}),(0,V.jsx)(p,{dimColor:!0,children:e.config.url})]}),(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{bold:!0,children:`Config location: `}),(0,V.jsx)(p,{dimColor:!0,children:Ft(e.scope)})]}),e.client.type===`connected`&&(0,V.jsx)(Dn,{serverToolsCount:t,serverPromptsCount:Te,serverResourcesCount:b.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{bold:!0,children:`Tools: `}),(0,V.jsxs)(p,{dimColor:!0,children:[t,` tools`]})]})]}),v&&(0,V.jsx)(C,{marginTop:1,children:(0,V.jsxs)(p,{color:`error`,children:[`Error: `,v]})}),je.length>0&&(0,V.jsx)(C,{marginTop:1,children:(0,V.jsx)(Et,{options:je,onChange:async t=>{switch(t){case`tools`:n();break;case`auth`:case`reauth`:await ke();break;case`clear-auth`:await Ae();break;case`claudeai-auth`:await De();break;case`claudeai-clear-auth`:Oe();break;case`reconnectMcpServer`:E(!0);try{let t=await xe(e.name);e.config.type===`claudeai-proxy`&&F(`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`&&F(`tengu_claudeai_mcp_reconnect`,{success:!1}),i?.(jn(t,e.name))}finally{E(!1)}break;case`toggle-enabled`:await R();break;case`back`:r();break}},onCancel:r})})]}),(0,V.jsx)(C,{marginTop:1,children:(0,V.jsx)(p,{dimColor:!0,italic:!0,children:d.pending?(0,V.jsxs)(V.Fragment,{children:[`Press `,d.keyName,` again to exit`]}):(0,V.jsxs)(g,{children:[(0,V.jsx)(h,{shortcut:`↑↓`,action:`navigate`}),(0,V.jsx)(h,{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(l(),1),pe(),he(),Jt(),Kt(),x(),Gt(),At(),St(),vn(),Ee(),Qe(),A(),Wt(),P(),_e(),L(),lt(),R(),Ne(),mt(),kn(),Mn(),V=w()}));function Fn({server:e,serverToolsCount:t,onViewTools:n,onCancel:r,onComplete:i,borderless:o=!1}){let[s]=u(),c=qt(),l=tt(e=>e.mcp),d=yn(),f=_n(),[m,_]=(0,In.useState)(!1),v=In.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await f(e.name),r()}catch(n){i(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${fe(n)}`)}},[e.client.type,e.name,f,r,i]),y=Ce(String(e.name)),b=Me(l.commands,e.name).length,x=[];return e.client.type!==`disabled`&&t>0&&x.push({label:`View tools`,value:`tools`}),e.client.type!==`disabled`&&x.push({label:`Reconnect`,value:`reconnectMcpServer`}),x.push({label:e.client.type===`disabled`?`Enable`:`Disable`,value:`toggle-enabled`}),x.length===0&&x.push({label:`Back`,value:`back`}),m?(0,H.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,H.jsxs)(p,{color:`text`,children:[`Reconnecting to `,(0,H.jsx)(p,{bold:!0,children:e.name})]}),(0,H.jsxs)(C,{children:[(0,H.jsx)(Fe,{}),(0,H.jsx)(p,{children:` Restarting MCP server process`})]}),(0,H.jsx)(p,{dimColor:!0,children:`This may take a few moments.`})]}):(0,H.jsxs)(C,{flexDirection:`column`,children:[(0,H.jsxs)(C,{flexDirection:`column`,paddingX:1,borderStyle:o?void 0:`round`,children:[(0,H.jsx)(C,{marginBottom:1,children:(0,H.jsxs)(p,{bold:!0,children:[y,` MCP Server`]})}),(0,H.jsxs)(C,{flexDirection:`column`,gap:0,children:[(0,H.jsxs)(C,{children:[(0,H.jsx)(p,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,H.jsxs)(p,{children:[S(`inactive`,s)(a.radioOff),` disabled`]}):e.client.type===`connected`?(0,H.jsxs)(p,{children:[S(`success`,s)(a.tick),` connected`]}):e.client.type===`pending`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(p,{dimColor:!0,children:a.radioOff}),(0,H.jsx)(p,{children:` connecting…`})]}):(0,H.jsxs)(p,{children:[S(`error`,s)(a.cross),` failed`]})]}),(0,H.jsxs)(C,{children:[(0,H.jsx)(p,{bold:!0,children:`Command: `}),(0,H.jsx)(p,{dimColor:!0,children:e.config.command})]}),e.config.args&&e.config.args.length>0&&(0,H.jsxs)(C,{children:[(0,H.jsx)(p,{bold:!0,children:`Args: `}),(0,H.jsx)(p,{dimColor:!0,children:e.config.args.join(` `)})]}),(0,H.jsxs)(C,{children:[(0,H.jsx)(p,{bold:!0,children:`Config location: `}),(0,H.jsx)(p,{dimColor:!0,children:Ft(Oe(e.name)?.scope??`dynamic`)})]}),e.client.type===`connected`&&(0,H.jsx)(Dn,{serverToolsCount:t,serverPromptsCount:b,serverResourcesCount:l.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,H.jsxs)(C,{children:[(0,H.jsx)(p,{bold:!0,children:`Tools: `}),(0,H.jsxs)(p,{dimColor:!0,children:[t,` tools`]})]})]}),x.length>0&&(0,H.jsx)(C,{marginTop:1,children:(0,H.jsx)(Et,{options:x,onChange:async t=>{if(t===`tools`)n();else if(t===`reconnectMcpServer`){_(!0);try{let{message:t}=An(await d(e.name),e.name);i?.(t)}catch(t){i?.(jn(t,e.name))}finally{_(!1)}}else t===`toggle-enabled`?await v():t===`back`&&r()},onCancel:r})})]}),(0,H.jsx)(C,{marginTop:1,children:(0,H.jsx)(p,{dimColor:!0,italic:!0,children:c.pending?(0,H.jsxs)(H.Fragment,{children:[`Press `,c.keyName,` again to exit`]}):(0,H.jsxs)(g,{children:[(0,H.jsx)(h,{shortcut:`↑↓`,action:`navigate`}),(0,H.jsx)(h,{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(l(),1),Jt(),x(),Ue(),vn(),Ee(),Qe(),P(),L(),lt(),R(),Ne(),kn(),Mn(),H=w()}));function Rn({tool:e,server:t,onBack:n}){let[r,i]=zn.useState(``),a=D(e.name,t.name),o=T(e.userFacingName?e.userFacingName({}):a),s=e.isReadOnly?.({})??!1,c=e.isDestructive?.({})??!1,l=e.isOpenWorld?.({})??!1;return zn.useEffect(()=>{async function t(){try{i(await e.description({},{isNonInteractiveSession:!1,toolPermissionContext:{mode:`default`,additionalWorkingDirectories:new Map,alwaysAllowRules:{},alwaysDenyRules:{},alwaysAskRules:{},isBypassPermissionsModeAvailable:!1},tools:[]}))}catch{i(`Failed to load description`)}}t()},[e]),(0,U.jsx)(m,{title:(0,U.jsxs)(U.Fragment,{children:[o,s&&(0,U.jsx)(p,{color:`success`,children:` [read-only]`}),c&&(0,U.jsx)(p,{color:`error`,children:` [destructive]`}),l&&(0,U.jsx)(p,{dimColor:!0,children:` [open-world]`})]}),subtitle:t.name,onCancel:n,inputGuide:e=>e.pending?(0,U.jsxs)(p,{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)(C,{flexDirection:`column`,children:[(0,U.jsxs)(C,{children:[(0,U.jsx)(p,{bold:!0,children:`Tool name: `}),(0,U.jsx)(p,{dimColor:!0,children:a})]}),(0,U.jsxs)(C,{children:[(0,U.jsx)(p,{bold:!0,children:`Full name: `}),(0,U.jsx)(p,{dimColor:!0,children:e.name})]}),r&&(0,U.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(p,{bold:!0,children:`Description:`}),(0,U.jsx)(p,{wrap:`wrap`,children:r})]}),e.inputJSONSchema&&e.inputJSONSchema.properties&&Object.keys(e.inputJSONSchema.properties).length>0&&(0,U.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(p,{bold:!0,children:`Parameters:`}),(0,U.jsx)(C,{marginLeft:2,flexDirection:`column`,children:Object.entries(e.inputJSONSchema.properties).map(([t,n])=>{let r=(e.inputJSONSchema?.required)?.includes(t);return(0,U.jsxs)(p,{children:[`• `,t,r&&(0,U.jsx)(p,{dimColor:!0,children:` (required)`}),`:`,` `,(0,U.jsx)(p,{dimColor:!0,children:typeof n==`object`&&n&&`type`in n?String(n.type):`unknown`}),typeof n==`object`&&n&&`description`in n&&(0,U.jsxs)(p,{dimColor:!0,children:[` - `,String(n.description)]})]},t)})})]})]})})}var zn,U,Bn=e((()=>{zn=t(l(),1),x(),E(),lt(),U=w()}));function Vn({server:e,onSelectTool:t,onBack:n}){let r=tt(e=>e.mcp.tools),i=Hn.useMemo(()=>e.client.type===`connected`?Ae(r,e.name):[],[e,r]),a=i.map((t,n)=>{let r=D(t.name,e.name),i=T(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)(m,{title:`Tools for ${e.name}`,subtitle:`${i.length} ${Se(i.length,`tool`)}`,onCancel:n,inputGuide:e=>e.pending?(0,Un.jsxs)(p,{children:[`Press `,e.keyName,` again to exit`]}):(0,Un.jsxs)(g,{children:[(0,Un.jsx)(h,{shortcut:`↑↓`,action:`navigate`}),(0,Un.jsx)(h,{shortcut:`Enter`,action:`select`}),(0,Un.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]}),children:i.length===0?(0,Un.jsx)(p,{dimColor:!0,children:`No tools available`}):(0,Un.jsx)(Et,{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(l(),1),x(),E(),Ee(),Qe(),L(),lt(),R(),Un=w()}));function Gn({inputValue:e,setInputValue:t,cursorOffset:n,setCursorOffset:r,error:i,setError:a,result:o,setResult:s,setViewState:c,onAddComplete:l,cliMode:u=!1}){let d=(0,Kn.useRef)(!1),[f,m]=(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 on(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{m(!0),v(``);let{name:e,resolvedSource:t}=await He(n,e=>{v(e)});wt(e,{source:t}),Je();let r=n.source;n.source===`github`&&(r=n.repo),F(`tengu_marketplace_added`,{source_type:r}),l&&await l(),v(``),m(!1),u?s(`Successfully added marketplace: ${e}`):c({type:`browse-marketplace`,targetMarketplace:e})}catch(e){let t=N(e);ve(t),a(t.message),v(``),m(!1),s(u?`Error: ${t.message}`:null)}};return(0,Kn.useEffect)(()=>{e&&!d.current&&!i&&!o&&(d.current=!0,y())},[]),(0,W.jsxs)(C,{flexDirection:`column`,children:[(0,W.jsxs)(C,{flexDirection:`column`,paddingX:1,borderStyle:`round`,children:[(0,W.jsx)(C,{marginBottom:1,children:(0,W.jsx)(p,{bold:!0,children:`Add Marketplace`})}),(0,W.jsxs)(C,{flexDirection:`column`,children:[(0,W.jsx)(p,{children:`Enter marketplace source:`}),(0,W.jsx)(p,{dimColor:!0,children:`Examples:`}),(0,W.jsx)(p,{dimColor:!0,children:` · owner/repo (GitHub)`}),(0,W.jsx)(p,{dimColor:!0,children:` · git@github.com:owner/repo.git (SSH)`}),(0,W.jsx)(p,{dimColor:!0,children:` · https://example.com/marketplace.json`}),(0,W.jsx)(p,{dimColor:!0,children:` · ./path/to/marketplace`}),(0,W.jsx)(C,{marginTop:1,children:(0,W.jsx)(yt,{value:e,onChange:t,onSubmit:y,columns:80,cursorOffset:n,onChangeCursorOffset:r,focus:!0,showCursor:!0})})]}),f&&(0,W.jsxs)(C,{marginTop:1,children:[(0,W.jsx)(Fe,{}),(0,W.jsx)(p,{children:_||`Adding marketplace to configuration…`})]}),i&&(0,W.jsx)(C,{marginTop:1,children:(0,W.jsx)(p,{color:`error`,children:i})}),o&&(0,W.jsx)(C,{marginTop:1,children:(0,W.jsx)(p,{children:o})})]}),(0,W.jsx)(C,{marginLeft:3,children:(0,W.jsx)(p,{dimColor:!0,italic:!0,children:(0,W.jsxs)(g,{children:[(0,W.jsx)(h,{shortcut:`Enter`,action:`add`}),(0,W.jsx)(z,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})})]})}var Kn,W,qn=e((()=>{l(),Kn=t(l(),1),pe(),lt(),x(),Ne(),mt(),P(),_e(),Pt(),qe(),cn(),W=w()}));function Jn(e,t,n,i){let a={};for(let o of e){let e=n[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]=r(s):a[o]=s}return a}function Yn({title:e,subtitle:t,configSchema:n,initialValues:r,onSave:i,onCancel:s}){let c=Object.keys(n),l=(0,Xn.useCallback)(e=>{if(n[e]?.sensitive===!0)return``;let t=r?.[e];return t===void 0?``:String(t)},[n,r]),[u,d]=(0,Xn.useState)(0),[f,h]=(0,Xn.useState)({}),[g,_]=(0,Xn.useState)(()=>c[0]?l(c[0]):``),y=c[u],b=y?n[y]:null;if(te(`confirm:no`,s,{context:`Settings`}),v({"confirm:nextField":(0,Xn.useCallback)(()=>{if(u<c.length-1&&y){h(e=>({...e,[y]:g})),d(e=>e+1);let e=c[u+1];_(e?l(e):``)}},[u,c,y,g,l]),"confirm:yes":(0,Xn.useCallback)(()=>{if(!y)return;let e={...f,[y]:g};if(u===c.length-1)i(Jn(c,e,n,r));else{h(e),d(e=>e+1);let t=c[u+1];_(t?l(t):``)}},[y,f,g,u,c,n,i,l,r])},{context:`Confirmation`}),ne((e,t)=>{if(t.backspace||t.delete){_(e=>e.slice(0,-1));return}e&&!t.ctrl&&!t.meta&&!t.tab&&!t.return&&_(t=>t+e)}),!b||!y)return null;let x=b.sensitive===!0,ee=b.required===!0,S=x?`*`.repeat(o(g)):g;return(0,Zn.jsxs)(m,{title:e,subtitle:t,onCancel:s,isCancelActive:!1,children:[(0,Zn.jsxs)(C,{flexDirection:`column`,children:[(0,Zn.jsxs)(p,{bold:!0,children:[b.title||y,ee&&(0,Zn.jsx)(p,{color:`error`,children:` *`})]}),b.description&&(0,Zn.jsx)(p,{dimColor:!0,children:b.description}),(0,Zn.jsxs)(C,{marginTop:1,children:[(0,Zn.jsxs)(p,{children:[a.pointerSmall,` `]}),(0,Zn.jsx)(p,{children:S}),(0,Zn.jsx)(p,{children:`█`})]})]}),(0,Zn.jsxs)(C,{flexDirection:`column`,children:[(0,Zn.jsxs)(p,{dimColor:!0,children:[`Field `,u+1,` of `,c.length]}),u<c.length-1&&(0,Zn.jsx)(p,{dimColor:!0,children:`Tab: Next field · Enter: Save and continue`}),u===c.length-1&&(0,Zn.jsx)(p,{dimColor:!0,children:`Enter: Save configuration`})]})]})}var Xn,Zn,Qn=e((()=>{i(),Xn=t(l(),1),x(),Gt(),n(),Zn=w()}));async function $n(e){let{enabled:t,disabled:n}=await Lt();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=vt(e);Object.keys(r).length>0&&n.push({key:`top-level`,title:`Configure ${e.name}`,subtitle:`Plugin options`,schema:r,load:()=>Xe(t),save:n=>ut(t,n,e.manifest.userConfig)});let i=gt(e);for(let r of i)n.push({key:`channel:${r.server}`,title:`Configure ${r.displayName}`,subtitle:`Plugin: ${e.name}`,schema:r.configSchema,load:()=>nt(t,r.server)??void 0,save:e=>ht(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`,fe(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(l(),1),P(),jt(),Ct(),Ye(),Dt(),Qn(),nr=w()}));function ir(){let e=rt();return(0,ar.jsxs)(C,{marginBottom:1,children:[(0,ar.jsxs)(p,{color:`claude`,children:[a.warning,` `]}),(0,ar.jsxs)(p,{dimColor:!0,italic:!0,children:[`Make sure you trust a plugin before installing, updating, or using it. Anthropic does 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(),l(),x(),xt(),ar=w()}));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)(C,{marginTop:1,children:(0,ur.jsx)(p,{dimColor:!0,italic:!0,children:(0,ur.jsxs)(g,{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((()=>{l(),lt(),x(),ur=w()}));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)(()=>{},[]),m=(0,pr.useCallback)((t,n)=>{n(Math.max(0,Math.min(t,e-1)))},[e]),h=(0,pr.useCallback)((e,t)=>!1,[]),g=Math.max(1,Math.ceil(e/t));return{currentPage:Math.floor(a/t),totalPages:g,startIndex:o,endIndex:s,needsPagination:r,pageSize:t,getVisibleItems:c,toActualIndex:l,isOnCurrentPage:u,goToPage:d,nextPage:f,prevPage:p,handleSelectionChange:m,handlePageNavigation:h,scrollPosition:{current:n+1,total:e,canScrollUp:a>0,canScrollDown:a+t<e}}}var pr,mr,hr=e((()=>{pr=t(l(),1),mr=5}));function gr({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,targetMarketplace:s,targetPlugin:c}){let[l,u]=(0,vr.useState)(`marketplace-list`),[d,f]=(0,vr.useState)(null),[m,h]=(0,vr.useState)(null),[_,y]=(0,vr.useState)([]),[b,x]=(0,vr.useState)([]),[ee,S]=(0,vr.useState)(!0),[ne,w]=(0,vr.useState)(null),[T,re]=(0,vr.useState)(0),[E,D]=(0,vr.useState)(new Set),[O,ie]=(0,vr.useState)(new Set),k=fr({totalItems:b.length,selectedIndex:T}),[A,j]=(0,vr.useState)(0),[M,ae]=(0,vr.useState)(!1),[oe,se]=(0,vr.useState)(null),[ce,le]=(0,vr.useState)(null);te(`confirm:no`,_r.useCallback(()=>{l===`plugin-list`?s?i({type:`manage-marketplaces`,targetMarketplace:s}):_.length===1?i({type:`menu`}):(u(`marketplace-list`),f(null),D(new Set)):l===`plugin-details`?(u(`plugin-list`),h(null)):i({type:`menu`})},[l,s,i,_.length]),{context:`Confirmation`}),(0,vr.useEffect)(()=>{async function e(){try{let e=await Ge(),{marketplaces:n,failures:r}=await it(e),i=[];for(let{name:e,config:t,data:r}of n)if(r){let n=ye(r.plugins,t=>Be(Ot(t.name,e)));i.push({name:e,totalPlugins:r.plugins.length,installedCount:n,source:et(t.source)})}i.sort((e,t)=>e.name===`claude-plugin-directory`?-1:+(t.name===`claude-plugin-directory`)),y(i);let a=Mt(r,ye(n,e=>e.data!==null));if(a)if(a.type===`warning`)le(a.message+`. Showing available marketplaces.`);else throw Error(a.message);if(i.length===1&&!s&&!c){let e=i[0];e&&(f(e.name),u(`plugin-list`))}if(c){let n=null,r=null;for(let[t]of Object.entries(e)){let e=await Pe(t);if(e){let i=e.plugins.find(e=>e.name===c);if(i){let e=Ot(i.name,t);n={entry:i,marketplaceName:t,pluginId:e,isInstalled:Ie(e)},r=t;break}}}if(n&&r){let e=n.pluginId;Ie(e)?t(`Plugin '${e}' is already installed globally. Use '/plugin' to manage existing plugins.`):(f(r),h(n),u(`plugin-details`))}else t(`Plugin "${c}" not found in any marketplace`)}else s&&(i.some(e=>e.name===s)?(f(s),u(`plugin-list`)):t(`Marketplace "${s}" not found`))}catch(e){t(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{S(!1)}}e()},[t,s,c]),(0,vr.useEffect)(()=>{if(!d)return;let e=!1;async function n(n){S(!0);try{let t=await Pe(n);if(e)return;if(!t)throw Error(`Failed to load marketplace: ${n}`);let r=[];for(let e of t.plugins){let t=Ot(e.name,n);st(t)||r.push({entry:e,marketplaceName:n,pluginId:t,isInstalled:Ie(t)})}try{let t=await dn();if(e)return;w(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;de(`Failed to fetch install counts: ${fe(t)}`),r.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}x(r),re(0),D(new Set)}catch(n){if(e)return;t(n instanceof Error?n.message:`Failed to load plugins`)}finally{S(!1)}}return n(d),()=>{e=!0}},[d,t]);let N=async()=>{if(E.size===0)return;let e=b.filter(e=>E.has(e.pluginId));ie(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await ke({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}ie(new Set),D(new Set),Je(),a===0?r(`✓ Installed ${n} ${Se(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${dt(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${dt(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},P=async(e,t=`user`)=>{ae(!0),se(null);let n=await ke({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await $n(e.pluginId);if(t){ae(!1),u({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else ae(!1),se(n.error)};(0,vr.useEffect)(()=>{e&&r(e)},[e,r]),v({"select:previous":()=>{T>0&&re(T-1)},"select:next":()=>{T<_.length-1&&re(T+1)},"select:accept":()=>{let e=_[T];e&&(f(e.name),u(`plugin-list`))}},{context:`Select`,isActive:l===`marketplace-list`}),v({"select:previous":()=>{T>0&&k.handleSelectionChange(T-1,re)},"select:next":()=>{T<b.length-1&&k.handleSelectionChange(T+1,re)},"select:accept":()=>{if(T===b.length&&E.size>0)N();else if(T<b.length){let e=b[T];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(h(e),u(`plugin-details`),j(0),se(null)))}}},{context:`Select`,isActive:l===`plugin-list`}),v({"plugin:toggle":()=>{if(T<b.length){let e=b[T];if(e&&!e.isInstalled){let t=new Set(E);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),D(t)}}},"plugin:install":()=>{E.size>0&&N()}},{context:`Plugin`,isActive:l===`plugin-list`});let ue=_r.useMemo(()=>{if(!m)return[];let e=m.entry.homepage;return cr(e,sr(m))},[m]);if(v({"select:previous":()=>{A>0&&j(A-1)},"select:next":()=>{A<ue.length-1&&j(A+1)},"select:accept":()=>{if(!m)return;let e=ue[A]?.action,t=m.entry.homepage,n=sr(m);e===`install-user`?P(m,`user`):e===`install-project`?P(m,`project`):e===`install-local`?P(m,`local`):e===`homepage`&&t?Ut(t):e===`github`&&n?Ut(`https://github.com/${n}`):e===`back`&&(u(`plugin-list`),h(null))}},{context:`Select`,isActive:l===`plugin-details`&&!!m}),typeof l==`object`&&l.type===`plugin-options`){let{plugin:e,pluginId:t}=l;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(ee)return(0,G.jsx)(p,{children:`Loading…`});if(e)return(0,G.jsx)(p,{color:`error`,children:e});if(l===`marketplace-list`)return _.length===0?(0,G.jsxs)(C,{flexDirection:`column`,children:[(0,G.jsx)(C,{marginBottom:1,children:(0,G.jsx)(p,{bold:!0,children:`Select marketplace`})}),(0,G.jsx)(p,{children:`No marketplaces configured.`}),(0,G.jsxs)(p,{dimColor:!0,children:[`Add a marketplace first using `,`'Add marketplace'`,`.`]}),(0,G.jsx)(C,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(p,{dimColor:!0,children:(0,G.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]}):(0,G.jsxs)(C,{flexDirection:`column`,children:[(0,G.jsx)(C,{marginBottom:1,children:(0,G.jsx)(p,{bold:!0,children:`Select marketplace`})}),ce&&(0,G.jsx)(C,{marginBottom:1,flexDirection:`column`,children:(0,G.jsxs)(p,{color:`warning`,children:[a.warning,` `,ce]})}),_.map((e,t)=>(0,G.jsxs)(C,{flexDirection:`column`,marginBottom:+(t<_.length-1),children:[(0,G.jsx)(C,{children:(0,G.jsxs)(p,{color:T===t?`suggestion`:void 0,children:[T===t?a.pointer:` `,` `,e.name]})}),(0,G.jsx)(C,{marginLeft:2,children:(0,G.jsxs)(p,{dimColor:!0,children:[e.totalPlugins,` `,Se(e.totalPlugins,`plugin`),` available`,e.installedCount>0&&` · ${e.installedCount} already installed`,e.source&&` · ${e.source}`]})})]},e.name)),(0,G.jsx)(C,{marginTop:1,children:(0,G.jsx)(p,{dimColor:!0,italic:!0,children:(0,G.jsxs)(g,{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(l===`plugin-details`&&m){let e=m.entry.homepage,t=cr(e,sr(m));return(0,G.jsxs)(C,{flexDirection:`column`,children:[(0,G.jsx)(C,{marginBottom:1,children:(0,G.jsx)(p,{bold:!0,children:`Plugin Details`})}),(0,G.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(p,{bold:!0,children:m.entry.name}),m.entry.version&&(0,G.jsxs)(p,{dimColor:!0,children:[`Version: `,m.entry.version]}),m.entry.description&&(0,G.jsx)(C,{marginTop:1,children:(0,G.jsx)(p,{children:m.entry.description})}),m.entry.author&&(0,G.jsx)(C,{marginTop:1,children:(0,G.jsxs)(p,{dimColor:!0,children:[`By:`,` `,typeof m.entry.author==`string`?m.entry.author:m.entry.author.name]})})]}),(0,G.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(p,{bold:!0,children:`Will install:`}),m.entry.commands&&(0,G.jsxs)(p,{dimColor:!0,children:[`· Commands:`,` `,Array.isArray(m.entry.commands)?m.entry.commands.join(`, `):Object.keys(m.entry.commands).join(`, `)]}),m.entry.agents&&(0,G.jsxs)(p,{dimColor:!0,children:[`· Agents:`,` `,Array.isArray(m.entry.agents)?m.entry.agents.join(`, `):Object.keys(m.entry.agents).join(`, `)]}),m.entry.hooks&&(0,G.jsxs)(p,{dimColor:!0,children:[`· Hooks: `,Object.keys(m.entry.hooks).join(`, `)]}),m.entry.mcpServers&&(0,G.jsxs)(p,{dimColor:!0,children:[`· MCP Servers:`,` `,Array.isArray(m.entry.mcpServers)?m.entry.mcpServers.join(`, `):typeof m.entry.mcpServers==`object`?Object.keys(m.entry.mcpServers).join(`, `):`configured`]}),!m.entry.commands&&!m.entry.agents&&!m.entry.hooks&&!m.entry.mcpServers&&(0,G.jsx)(G.Fragment,{children:typeof m.entry.source==`object`&&`source`in m.entry.source&&(m.entry.source.source===`github`||m.entry.source.source===`url`||m.entry.source.source===`npm`||m.entry.source.source===`pip`)?(0,G.jsx)(p,{dimColor:!0,children:`· Component summary not available for remote plugin`}):(0,G.jsx)(p,{dimColor:!0,children:`· Components will be discovered at installation`})})]}),(0,G.jsx)(ir,{}),oe&&(0,G.jsx)(C,{marginBottom:1,children:(0,G.jsxs)(p,{color:`error`,children:[`Error: `,oe]})}),(0,G.jsx)(C,{flexDirection:`column`,children:t.map((e,t)=>(0,G.jsxs)(C,{children:[A===t&&(0,G.jsx)(p,{children:`> `}),A!==t&&(0,G.jsx)(p,{children:` `}),(0,G.jsx)(p,{bold:A===t,children:M&&e.action===`install`?`Installing…`:e.label})]},e.action))}),(0,G.jsx)(C,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(p,{dimColor:!0,children:(0,G.jsxs)(g,{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(b.length===0)return(0,G.jsxs)(C,{flexDirection:`column`,children:[(0,G.jsx)(C,{marginBottom:1,children:(0,G.jsx)(p,{bold:!0,children:`Install plugins`})}),(0,G.jsx)(p,{dimColor:!0,children:`No new plugins available to install.`}),(0,G.jsx)(p,{dimColor:!0,children:`All plugins from this marketplace are already installed.`}),(0,G.jsx)(C,{marginLeft:3,children:(0,G.jsx)(p,{dimColor:!0,italic:!0,children:(0,G.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]});let pe=k.getVisibleItems(b);return(0,G.jsxs)(C,{flexDirection:`column`,children:[(0,G.jsx)(C,{marginBottom:1,children:(0,G.jsx)(p,{bold:!0,children:`Install Plugins`})}),k.scrollPosition.canScrollUp&&(0,G.jsx)(C,{children:(0,G.jsxs)(p,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),pe.map((t,n)=>{let r=T===k.toActualIndex(n),i=E.has(t.pluginId),o=O.has(t.pluginId);return(0,G.jsxs)(C,{flexDirection:`column`,marginBottom:n===pe.length-1&&!e?0:1,children:[(0,G.jsxs)(C,{children:[(0,G.jsxs)(p,{color:r?`suggestion`:void 0,children:[r?a.pointer:` `,` `]}),(0,G.jsxs)(p,{color:t.isInstalled?`success`:void 0,children:[t.isInstalled?a.tick:o?a.ellipsis:i?a.radioOn:a.radioOff,` `,t.entry.name,t.entry.category&&(0,G.jsxs)(p,{dimColor:!0,children:[` [`,t.entry.category,`]`]}),t.entry.tags?.includes(`community-managed`)&&(0,G.jsx)(p,{dimColor:!0,children:` [Community Managed]`}),t.isInstalled&&(0,G.jsx)(p,{dimColor:!0,children:` (installed)`}),ne&&d===`claude-plugins-official`&&(0,G.jsxs)(p,{dimColor:!0,children:[` · `,un(ne.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,G.jsxs)(C,{marginLeft:4,children:[(0,G.jsx)(p,{dimColor:!0,children:I(t.entry.description,60)}),t.entry.version&&(0,G.jsxs)(p,{dimColor:!0,children:[` · v`,t.entry.version]})]})]},t.pluginId)}),k.scrollPosition.canScrollDown&&(0,G.jsx)(C,{children:(0,G.jsxs)(p,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,G.jsx)(C,{marginTop:1,children:(0,G.jsxs)(p,{color:`error`,children:[a.cross,` `,e]})}),(0,G.jsx)(lr,{hasSelection:E.size>0})]})}var _r,vr,G,yr=e((()=>{i(),_r=t(l(),1),vr=t(l(),1),lt(),x(),Gt(),be(),Wt(),ue(),P(),Pt(),sn(),ze(),xt(),qe(),Tt(),je(),Te(),L(),xe(),rr(),or(),dr(),hr(),G=w()}));function br({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,onSearchModeChange:c,targetPlugin:l}){let[u,m]=(0,K.useState)(`plugin-list`),[h,_]=(0,K.useState)(null),[y,b]=(0,K.useState)([]),[x,ee]=(0,K.useState)(!0),[S,w]=(0,K.useState)(null),[T,re]=(0,K.useState)(!1),E=(0,K.useCallback)(e=>{re(e),c?.(e)},[c]),{query:D,setQuery:O,cursorOffset:ie}=xn({isActive:u===`plugin-list`&&T&&!x,onExit:()=>{E(!1)}}),k=d(),{columns:A}=s(),j=(0,K.useMemo)(()=>{if(!D)return y;let e=D.toLowerCase();return y.filter(t=>t.entry.name.toLowerCase().includes(e)||t.entry.description?.toLowerCase().includes(e)||t.marketplaceName.toLowerCase().includes(e))},[y,D]),[M,ae]=(0,K.useState)(0),[oe,se]=(0,K.useState)(new Set),[ce,le]=(0,K.useState)(new Set),N=fr({totalItems:j.length,selectedIndex:M});(0,K.useEffect)(()=>{ae(0)},[D]);let[P,ue]=(0,K.useState)(0),[pe,F]=(0,K.useState)(!1),[me,he]=(0,K.useState)(null),[ge,_e]=(0,K.useState)(null),[ve,be]=(0,K.useState)(null);(0,K.useEffect)(()=>{async function e(){try{let e=await Ge(),{marketplaces:n,failures:r}=await it(e),i=[];for(let{name:e,data:t}of n)if(t)for(let n of t.plugins){let t=Ot(n.name,e);i.push({entry:n,marketplaceName:e,pluginId:t,isInstalled:Ie(t)})}let a=i.filter(e=>!e.isInstalled&&!st(e.pluginId));try{let e=await dn();w(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){de(`Failed to fetch install counts: ${fe(e)}`),a.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}b(a);let o=Object.keys(e).length;a.length===0&&be(await Ze({configuredMarketplaceCount:o,failedMarketplaceCount:r.length}));let s=Mt(r,ye(n,e=>e.data!==null));if(s)if(s.type===`warning`)_e(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.`):(_(e),m(`plugin-details`)):t(`Plugin "${l}" not found in any marketplace`)}}catch(e){t(e instanceof Error?e.message:`Failed to load plugins`)}finally{ee(!1)}}e()},[t,l]);let xe=async()=>{if(oe.size===0)return;let e=y.filter(e=>oe.has(e.pluginId));le(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await ke({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}le(new Set),se(new Set),Je(),a===0?r(`✓ Installed ${n} ${Se(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${dt(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${dt(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},Ce=async(e,t=`user`)=>{F(!0),he(null);let n=await ke({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await $n(e.pluginId);if(t){F(!1),m({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else F(!1),he(n.error)};(0,K.useEffect)(()=>{e&&r(e)},[e,r]),te(`confirm:no`,()=>{m(`plugin-list`),_(null)},{context:`Confirmation`,isActive:u===`plugin-details`}),te(`confirm:no`,()=>{i({type:`menu`})},{context:`Confirmation`,isActive:u===`plugin-list`&&!T}),ne((e,t)=>{let n=!t.ctrl&&!t.meta;T||(e===`/`&&n?(E(!0),O(``)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==`i`&&(E(!0),O(e)))},{isActive:u===`plugin-list`&&!x}),v({"select:previous":()=>{M===0?E(!0):N.handleSelectionChange(M-1,ae)},"select:next":()=>{M<j.length-1&&N.handleSelectionChange(M+1,ae)},"select:accept":()=>{if(M===j.length&&oe.size>0)xe();else if(M<j.length){let e=j[M];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(_(e),m(`plugin-details`),ue(0),he(null)))}}},{context:`Select`,isActive:u===`plugin-list`&&!T}),v({"plugin:toggle":()=>{if(M<j.length){let e=j[M];if(e&&!e.isInstalled){let t=new Set(oe);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),se(t)}}},"plugin:install":()=>{oe.size>0&&xe()}},{context:`Plugin`,isActive:u===`plugin-list`&&!T});let L=Cr.useMemo(()=>{if(!h)return[];let e=h.entry.homepage;return cr(e,sr(h))},[h]);if(v({"select:previous":()=>{P>0&&ue(P-1)},"select:next":()=>{P<L.length-1&&ue(P+1)},"select:accept":()=>{if(!h)return;let e=L[P]?.action,t=h.entry.homepage,n=sr(h);e===`install-user`?Ce(h,`user`):e===`install-project`?Ce(h,`project`):e===`install-local`?Ce(h,`local`):e===`homepage`&&t?Ut(t):e===`github`&&n?Ut(`https://github.com/${n}`):e===`back`&&(m(`plugin-list`),_(null))}},{context:`Select`,isActive:u===`plugin-details`&&!!h}),typeof u==`object`&&u.type===`plugin-options`){let{plugin:e,pluginId:t}=u;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(x)return(0,q.jsx)(p,{children:`Loading…`});if(e)return(0,q.jsx)(p,{color:`error`,children:e});if(u===`plugin-details`&&h){let e=h.entry.homepage,t=cr(e,sr(h));return(0,q.jsxs)(C,{flexDirection:`column`,children:[(0,q.jsx)(C,{marginBottom:1,children:(0,q.jsx)(p,{bold:!0,children:`Plugin details`})}),(0,q.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(p,{bold:!0,children:h.entry.name}),(0,q.jsxs)(p,{dimColor:!0,children:[`from `,h.marketplaceName]}),h.entry.version&&(0,q.jsxs)(p,{dimColor:!0,children:[`Version: `,h.entry.version]}),h.entry.description&&(0,q.jsx)(C,{marginTop:1,children:(0,q.jsx)(p,{children:h.entry.description})}),h.entry.author&&(0,q.jsx)(C,{marginTop:1,children:(0,q.jsxs)(p,{dimColor:!0,children:[`By:`,` `,typeof h.entry.author==`string`?h.entry.author:h.entry.author.name]})})]}),(0,q.jsx)(ir,{}),me&&(0,q.jsx)(C,{marginBottom:1,children:(0,q.jsxs)(p,{color:`error`,children:[`Error: `,me]})}),(0,q.jsx)(C,{flexDirection:`column`,children:t.map((e,t)=>(0,q.jsxs)(C,{children:[P===t&&(0,q.jsx)(p,{children:`> `}),P!==t&&(0,q.jsx)(p,{children:` `}),(0,q.jsx)(p,{bold:P===t,children:pe&&e.action.startsWith(`install-`)?`Installing…`:e.label})]},e.action))}),(0,q.jsx)(C,{marginTop:1,children:(0,q.jsx)(p,{dimColor:!0,children:(0,q.jsxs)(g,{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(y.length===0)return(0,q.jsxs)(C,{flexDirection:`column`,children:[(0,q.jsx)(C,{marginBottom:1,children:(0,q.jsx)(p,{bold:!0,children:`Discover plugins`})}),(0,q.jsx)(Sr,{reason:ve}),(0,q.jsx)(C,{marginTop:1,children:(0,q.jsx)(p,{dimColor:!0,italic:!0,children:`Esc to go back`})})]});let we=N.getVisibleItems(j);return(0,q.jsxs)(C,{flexDirection:`column`,children:[(0,q.jsxs)(C,{children:[(0,q.jsx)(p,{bold:!0,children:`Discover plugins`}),N.needsPagination&&(0,q.jsxs)(p,{dimColor:!0,children:[` `,`(`,N.scrollPosition.current,`/`,N.scrollPosition.total,`)`]})]}),(0,q.jsx)(C,{marginBottom:1,children:(0,q.jsx)(f,{query:D,isFocused:T,isTerminalFocused:k,width:A-4,cursorOffset:ie})}),ge&&(0,q.jsx)(C,{marginBottom:1,children:(0,q.jsxs)(p,{color:`warning`,children:[a.warning,` `,ge]})}),j.length===0&&D&&(0,q.jsx)(C,{marginBottom:1,children:(0,q.jsxs)(p,{dimColor:!0,children:[`No plugins match "`,D,`"`]})}),N.scrollPosition.canScrollUp&&(0,q.jsx)(C,{children:(0,q.jsxs)(p,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),we.map((t,n)=>{let r=M===N.toActualIndex(n),i=oe.has(t.pluginId),o=ce.has(t.pluginId);return(0,q.jsxs)(C,{flexDirection:`column`,marginBottom:n===we.length-1&&!e?0:1,children:[(0,q.jsxs)(C,{children:[(0,q.jsxs)(p,{color:r&&!T?`suggestion`:void 0,children:[r&&!T?a.pointer:` `,` `]}),(0,q.jsxs)(p,{children:[o?a.ellipsis:i?a.radioOn:a.radioOff,` `,t.entry.name,(0,q.jsxs)(p,{dimColor:!0,children:[` · `,t.marketplaceName]}),t.entry.tags?.includes(`community-managed`)&&(0,q.jsx)(p,{dimColor:!0,children:` [Community Managed]`}),S&&t.marketplaceName===`claude-plugins-official`&&(0,q.jsxs)(p,{dimColor:!0,children:[` · `,un(S.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,q.jsx)(C,{marginLeft:4,children:(0,q.jsx)(p,{dimColor:!0,children:I(t.entry.description,60)})})]},`${N.startIndex}-${t.pluginId}`)}),N.scrollPosition.canScrollDown&&(0,q.jsx)(C,{children:(0,q.jsxs)(p,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,q.jsx)(C,{marginTop:1,children:(0,q.jsxs)(p,{color:`error`,children:[a.cross,` `,e]})}),(0,q.jsx)(xr,{hasSelection:oe.size>0,canToggle:M<j.length&&!j[M]?.isInstalled})]})}function xr({hasSelection:e,canToggle:t}){return(0,q.jsx)(C,{marginTop:1,children:(0,q.jsx)(p,{dimColor:!0,italic:!0,children:(0,q.jsxs)(g,{children:[e&&(0,q.jsx)(z,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,q.jsx)(p,{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)(p,{dimColor:!0,children:`Git is required to install marketplaces.`}),(0,q.jsx)(p,{dimColor:!0,children:`Please install git and restart Claude Code.`})]});case`all-blocked-by-policy`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(p,{dimColor:!0,children:`Your organization policy does not allow any external marketplaces.`}),(0,q.jsx)(p,{dimColor:!0,children:`Contact your administrator.`})]});case`policy-restricts-sources`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(p,{dimColor:!0,children:`Your organization restricts which marketplaces can be added.`}),(0,q.jsx)(p,{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)(p,{dimColor:!0,children:`Failed to load marketplace data.`}),(0,q.jsx)(p,{dimColor:!0,children:`Check your network connection.`})]});case`all-plugins-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(p,{dimColor:!0,children:`All available plugins are already installed.`}),(0,q.jsx)(p,{dimColor:!0,children:`Check for new plugins later or add more marketplaces.`})]});default:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(p,{dimColor:!0,children:`No plugins available.`}),(0,q.jsx)(p,{dimColor:!0,children:`Add a marketplace first using the Marketplaces tab.`})]})}}var Cr,K,q,wr=e((()=>{i(),Cr=t(l(),1),K=t(l(),1),lt(),bn(),x(),Sn(),Kt(),Gt(),be(),Wt(),ue(),P(),Pt(),sn(),ze(),xt(),qe(),Tt(),je(),Te(),L(),xe(),rr(),or(),dr(),hr(),q=w()}));function Tr({setViewState:e,error:t,setError:n,setResult:r,exitState:i,onManageComplete:o,targetMarketplace:s,action:c}){let[l,u]=(0,Dr.useState)([]),[d,f]=(0,Dr.useState)(!0),[m,h]=(0,Dr.useState)(0),[_,y]=(0,Dr.useState)(!1),[b,x]=(0,Dr.useState)(null),[ee,S]=(0,Dr.useState)(null),[w,T]=(0,Dr.useState)(null),[E,D]=(0,Dr.useState)(`list`),[O,k]=(0,Dr.useState)(null),[A,j]=(0,Dr.useState)(0),ae=(0,Dr.useRef)(!1);(0,Dr.useEffect)(()=>{async function e(){try{let e=await Ge(),{enabled:r,disabled:i}=await Lt(),a=[...r,...i],{marketplaces:o,failures:l}=await it(e),d=[];for(let{name:e,config:t,data:n}of o){let r=a.filter(t=>t.source.endsWith(`@${e}`));d.push({name:e,source:et(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:M(e,t)})}d.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),u(d);let f=Mt(l,ye(o,e=>e.data!==null));if(f)if(f.type===`warning`)x(f.message);else throw Error(f.message);if(s&&!ae.current&&!t){ae.current=!0;let e=d.findIndex(e=>e.name===s);if(e>=0){let t=d[e];if(c){h(e+1);let t=[...d];c===`update`?t[e].pendingUpdate=!0:c===`remove`&&(t[e].pendingRemove=!0),u(t),setTimeout(le,100,t)}else t&&(h(e+1),k(t),D(`details`))}else n&&n(`Marketplace not found: ${s}`)}}catch(e){n&&n(e instanceof Error?e.message:`Failed to load marketplaces`),x(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{f(!1)}}e()},[s,c,t]);let se=()=>l.some(e=>e.pendingUpdate||e.pendingRemove),ce=()=>({updateCount:ye(l,e=>e.pendingUpdate),removeCount:ye(l,e=>e.pendingRemove)}),le=async t=>{let i=t||l,s=E===`details`;y(!0),x(null),S(null),T(null);try{let t=re(`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=Ot(t.name,e.name);n[r]=!1}ie(`userSettings`,{enabledPlugins:n})}await kt(e.name),c++,F(`tengu_marketplace_removed`,{marketplace_name:e.name,plugins_uninstalled:e.installedPlugins?.length||0});continue}e.pendingUpdate&&(await we(e.name,e=>{T(e)}),n++,l.add(e.name.toLowerCase()),F(`tengu_marketplace_updated`,{marketplace_name:e.name}))}let d=0;l.size>0&&(d=(await Cn(l)).length),Je(),o&&await o();let f=await Ge(),{enabled:p,disabled:m}=await Lt(),h=[...p,...m],{marketplaces:g}=await it(f),_=[];for(let{name:e,config:t,data:n}of g){let r=h.filter(t=>t.source.endsWith(`@${e}`));_.push({name:e,source:et(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:M(e,t)})}if(_.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),u(_),s&&O){let e=_.find(e=>e.name===O.name);e&&k(e)}let v=[];if(n>0){let e=d>0?` (${d} ${Se(d,`plugin`)} bumped)`:``;v.push(`Updated ${n} ${Se(n,`marketplace`)}${e}`)}if(c>0&&v.push(`Removed ${c} ${Se(c,`marketplace`)}`),v.length>0){let t=`${a.tick} ${v.join(`, `)}`;s?S(t):(r(t),setTimeout(e,2e3,{type:`menu`}))}else s||e({type:`menu`})}catch(e){let t=fe(e);x(t),n&&n(t)}finally{y(!1),T(null)}},N=async()=>{if(!O)return;let e=l.map(e=>e.name===O.name?{...e,pendingRemove:!0}:e);u(e),await le(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 oe()||t.push({label:e.autoUpdate?`Disable auto-update`:`Enable auto-update`,value:`toggle-auto-update`}),t.push({label:`Remove marketplace`,value:`remove`}),t},ue=async e=>{let t=!e.autoUpdate;try{await at(e.name,t),u(n=>n.map(n=>n.name===e.name?{...n,autoUpdate:t}:n)),k(e=>e&&{...e,autoUpdate:t})}catch(e){x(e instanceof Error?e.message:`Failed to update setting`)}};if(te(`confirm:no`,()=>{D(`list`),j(0)},{context:`Confirmation`,isActive:!_&&(E===`details`||E===`confirm-remove`)}),te(`confirm:no`,()=>{u(e=>e.map(e=>({...e,pendingUpdate:!1,pendingRemove:!1}))),h(0)},{context:`Confirmation`,isActive:!_&&E===`list`&&se()}),te(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`,isActive:!_&&E===`list`&&!se()}),v({"select:previous":()=>h(e=>Math.max(0,e-1)),"select:next":()=>{let e=l.length+1;h(t=>Math.min(e-1,t+1))},"select:accept":()=>{let t=m-1;if(m===0)e({type:`add-marketplace`});else if(se())le();else{let e=l[t];e&&(k(e),D(`details`),j(0))}}},{context:`Select`,isActive:!_&&E===`list`}),ne(e=>{let t=m-1;if((e===`u`||e===`U`)&&t>=0)u(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=l[t];e&&(k(e),D(`confirm-remove`))}},{isActive:!_&&E===`list`}),v({"select:previous":()=>j(e=>Math.max(0,e-1)),"select:next":()=>{let e=P(O);j(t=>Math.min(e.length-1,t+1))},"select:accept":()=>{if(!O)return;let t=P(O)[A];if(t?.value===`browse`)e({type:`browse-marketplace`,targetMarketplace:O.name});else if(t?.value===`update`){let e=l.map(e=>e.name===O.name?{...e,pendingUpdate:!0}:e);u(e),le(e)}else t?.value===`toggle-auto-update`?ue(O):t?.value===`remove`&&D(`confirm-remove`)}},{context:`Select`,isActive:!_&&E===`details`}),ne(e=>{e===`y`||e===`Y`?N():(e===`n`||e===`N`)&&(D(`list`),k(null))},{isActive:!_&&E===`confirm-remove`}),d)return(0,J.jsx)(p,{children:`Loading marketplaces…`});if(l.length===0)return(0,J.jsxs)(C,{flexDirection:`column`,children:[(0,J.jsx)(C,{marginBottom:1,children:(0,J.jsx)(p,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(C,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(p,{color:`suggestion`,children:[a.pointer,` +`]}),(0,J.jsx)(p,{bold:!0,color:`suggestion`,children:`Add Marketplace`})]}),(0,J.jsx)(C,{marginLeft:3,children:(0,J.jsx)(p,{dimColor:!0,italic:!0,children:i.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,i.keyName,` again to go back`]}):(0,J.jsxs)(g,{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(E===`confirm-remove`&&O){let e=O.installedPlugins?.length||0;return(0,J.jsxs)(C,{flexDirection:`column`,children:[(0,J.jsxs)(p,{bold:!0,color:`warning`,children:[`Remove marketplace `,(0,J.jsx)(p,{italic:!0,children:O.name}),`?`]}),(0,J.jsxs)(C,{flexDirection:`column`,children:[e>0&&(0,J.jsx)(C,{marginTop:1,children:(0,J.jsxs)(p,{color:`warning`,children:[`This will also uninstall `,e,` `,Se(e,`plugin`),` from this marketplace:`]})}),O.installedPlugins&&O.installedPlugins.length>0&&(0,J.jsx)(C,{flexDirection:`column`,marginTop:1,marginLeft:2,children:O.installedPlugins.map(e=>(0,J.jsxs)(p,{dimColor:!0,children:[`• `,e.name]},e.name))}),(0,J.jsx)(C,{marginTop:1,children:(0,J.jsxs)(p,{children:[`Press `,(0,J.jsx)(p,{bold:!0,children:`y`}),` to confirm or `,(0,J.jsx)(p,{bold:!0,children:`n`}),` to cancel`]})})]})]})}if(E===`details`&&O){let e=O.pendingUpdate||_,t=P(O);return(0,J.jsxs)(C,{flexDirection:`column`,children:[(0,J.jsx)(p,{bold:!0,children:O.name}),(0,J.jsx)(p,{dimColor:!0,children:O.source}),(0,J.jsx)(C,{marginTop:1,children:(0,J.jsxs)(p,{children:[O.pluginCount||0,` available `,Se(O.pluginCount||0,`plugin`)]})}),O.installedPlugins&&O.installedPlugins.length>0&&(0,J.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(p,{bold:!0,children:[`Installed plugins (`,O.installedPlugins.length,`):`]}),(0,J.jsx)(C,{flexDirection:`column`,marginLeft:1,children:O.installedPlugins.map(e=>(0,J.jsxs)(C,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(p,{children:a.bullet}),(0,J.jsxs)(C,{flexDirection:`column`,children:[(0,J.jsx)(p,{children:e.name}),(0,J.jsx)(p,{dimColor:!0,children:e.manifest.description})]})]},e.name))})]}),e&&(0,J.jsxs)(C,{marginTop:1,flexDirection:`column`,children:[(0,J.jsx)(p,{color:`claude`,children:`Updating marketplace…`}),w&&(0,J.jsx)(p,{dimColor:!0,children:w})]}),!e&&ee&&(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(p,{color:`claude`,children:ee})}),!e&&b&&(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(p,{color:`error`,children:b})}),!e&&(0,J.jsx)(C,{flexDirection:`column`,marginTop:1,children:t.map((e,t)=>{if(!e)return null;let n=t===A;return(0,J.jsxs)(C,{children:[(0,J.jsxs)(p,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.label]}),e.secondaryLabel&&(0,J.jsxs)(p,{dimColor:!0,children:[` `,e.secondaryLabel]})]},e.value)})}),!e&&!oe()&&O.autoUpdate&&(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(p,{dimColor:!0,children:`Auto-update enabled. Claude Code will automatically update this marketplace and its installed plugins.`})}),(0,J.jsx)(C,{marginLeft:3,children:(0,J.jsx)(p,{dimColor:!0,italic:!0,children:e?(0,J.jsx)(J.Fragment,{children:`Please wait…`}):(0,J.jsxs)(g,{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:de,removeCount:pe}=ce();return(0,J.jsxs)(C,{flexDirection:`column`,children:[(0,J.jsx)(C,{marginBottom:1,children:(0,J.jsx)(p,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(C,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(p,{color:m===0?`suggestion`:void 0,children:[m===0?a.pointer:` `,` +`]}),(0,J.jsx)(p,{bold:!0,color:m===0?`suggestion`:void 0,children:`Add Marketplace`})]}),(0,J.jsx)(C,{flexDirection:`column`,children:l.map((e,t)=>{let n=t+1===m,r=[];return e.pendingUpdate&&r.push(`UPDATE`),e.pendingRemove&&r.push(`REMOVE`),(0,J.jsxs)(C,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(p,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.pendingRemove?a.cross:a.bullet]}),(0,J.jsxs)(C,{flexDirection:`column`,flexGrow:1,children:[(0,J.jsxs)(C,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(p,{bold:!0,strikethrough:e.pendingRemove,dimColor:e.pendingRemove,children:[e.name===`claude-plugins-official`&&(0,J.jsx)(p,{color:`claude`,children:`✻ `}),e.name,e.name===`claude-plugins-official`&&(0,J.jsx)(p,{color:`claude`,children:` ✻`})]}),r.length>0&&(0,J.jsxs)(p,{color:`warning`,children:[`[`,r.join(`, `),`]`]})]}),(0,J.jsx)(p,{dimColor:!0,children:e.source}),(0,J.jsxs)(p,{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)})}),se()&&(0,J.jsxs)(C,{marginTop:1,flexDirection:`column`,children:[(0,J.jsxs)(p,{children:[(0,J.jsx)(p,{bold:!0,children:`Pending changes:`}),` `,(0,J.jsx)(p,{dimColor:!0,children:`Enter to apply`})]}),de>0&&(0,J.jsxs)(p,{children:[`• Update `,de,` `,Se(de,`marketplace`)]}),pe>0&&(0,J.jsxs)(p,{color:`warning`,children:[`• Remove `,pe,` `,Se(pe,`marketplace`)]})]}),_&&(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(p,{color:`claude`,children:`Processing changes…`})}),b&&(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(p,{color:`error`,children:b})}),(0,J.jsx)(Er,{exitState:i,hasPendingActions:se()})]})}function Er({exitState:e,hasPendingActions:t}){return e.pending?(0,J.jsx)(C,{marginTop:1,children:(0,J.jsxs)(p,{dimColor:!0,italic:!0,children:[`Press `,e.keyName,` again to go back`]})}):(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(p,{dimColor:!0,italic:!0,children:(0,J.jsxs)(g,{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)(h,{shortcut:`u`,action:`update`}),!t&&(0,J.jsx)(h,{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(),l(),Dr=t(l(),1),pe(),lt(),x(),Gt(),be(),se(),P(),Pt(),xt(),qe(),wn(),Ye(),ae(),j(),L(),J=w()}));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 ft(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((()=>{Nt()}));function Mr({item:e,isSelected:t}){let[n]=u();if(e.type===`plugin`){let r,i;return e.pendingToggle?(r=S(`suggestion`,n)(a.arrowRight),i=e.pendingToggle===`will-enable`?`will enable`:`will disable`):e.errorCount>0?(r=S(`error`,n)(a.cross),i=`${e.errorCount} ${Se(e.errorCount,`error`)}`):e.isEnabled?(r=S(`success`,n)(a.tick),i=`enabled`):(r=S(`inactive`,n)(a.radioOff),i=`disabled`),(0,Y.jsxs)(C,{children:[(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(p,{dimColor:!t,children:[` `,(0,Y.jsx)(p,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(p,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(p,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(p,{dimColor:!t,children:i})]})}if(e.type===`flagged-plugin`){let r=S(`warning`,n)(a.warning);return(0,Y.jsxs)(C,{children:[(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(p,{dimColor:!t,children:[` `,(0,Y.jsx)(p,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(p,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(p,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(p,{dimColor:!t,children:`removed`})]})}if(e.type===`failed-plugin`){let r=S(`error`,n)(a.cross),i=`failed to load · ${e.errorCount} ${Se(e.errorCount,`error`)}`;return(0,Y.jsxs)(C,{children:[(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(p,{dimColor:!t,children:[` `,(0,Y.jsx)(p,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(p,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(p,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(p,{dimColor:!t,children:i})]})}let r,i;return e.status===`connected`?(r=S(`success`,n)(a.tick),i=`connected`):e.status===`disabled`?(r=S(`inactive`,n)(a.radioOff),i=`disabled`):e.status===`pending`?(r=S(`inactive`,n)(a.radioOff),i=`connecting…`):e.status===`needs-auth`?(r=S(`warning`,n)(a.triangleUpOutline),i=`Enter to auth`):(r=S(`error`,n)(a.cross),i=`failed`),e.indented?(0,Y.jsxs)(C,{children:[(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(p,{dimColor:!t,children:`└ `}),(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(p,{dimColor:!t,children:[` `,(0,Y.jsx)(p,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(p,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(p,{dimColor:!t,children:i})]}):(0,Y.jsxs)(C,{children:[(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(p,{dimColor:!t,children:[` `,(0,Y.jsx)(p,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(p,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(p,{dimColor:!t,children:i})]})}var Y,Nr=e((()=>{i(),l(),x(),L(),Y=w()}));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 de(`Failed to read plugin components from ${e}: ${fe(t)}`,{level:`error`}),ve(N(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 de(`Failed to read skill directories from ${e}: ${fe(t)}`,{level:`error`}),ve(N(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=Ht(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 Pe(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)(C,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(p,{bold:!0,children:`Components:`}),(0,Z.jsxs)(p,{dimColor:!0,children:[`Error: `,o]})]}):!n||!(n.commands||n.agents||n.skills||n.hooks||n.mcpServers)?null:(0,Z.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(p,{bold:!0,children:`Installed components:`}),n.commands?(0,Z.jsxs)(p,{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)(p,{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)(p,{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)(p,{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)(p,{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 Pe(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!st(`${e.name}@${t}`)})}function zr({setViewState:e,setResult:t,onManageComplete:n,onSearchModeChange:r,targetPlugin:i,targetMarketplace:o,action:c}){let l=tt(e=>e.mcp.clients),u=tt(e=>e.mcp.tools),m=tt(e=>e.plugins.errors),h=mn(),[_,y]=(0,X.useState)(!1),b=(0,X.useCallback)(e=>{y(e),r?.(e)},[r]),x=d(),{columns:ee}=s(),[S,w]=(0,X.useState)(`plugin-list`),{query:T,setQuery:E,cursorOffset:D}=xn({isActive:S===`plugin-list`&&_,onExit:()=>{b(!1)}}),[O,A]=(0,X.useState)(null),[j,M]=(0,X.useState)([]),[ae,oe]=(0,X.useState)([]),[se,le]=(0,X.useState)(!0),[P,ue]=(0,X.useState)(new Map),pe=(0,X.useRef)(!1),F=(0,X.useRef)(void 0),me=_n();te(`confirm:no`,Br.useCallback(()=>{if(S===`plugin-details`)w(`plugin-list`),A(null),R(null);else if(typeof S==`object`&&S.type===`failed-plugin-details`)w(`plugin-list`),R(null);else if(S===`configuring`)w(`plugin-details`),je(null);else if(typeof S==`object`&&(S.type===`plugin-options`||S.type===`configuring-options`))w(`plugin-list`),A(null),t(`Plugin enabled. Configuration skipped — run /reload-plugins to apply.`),n&&n();else if(typeof S==`object`&&S.type===`flagged-detail`)w(`plugin-list`),R(null);else if(typeof S==`object`&&S.type===`mcp-detail`)w(`plugin-list`),R(null);else if(typeof S==`object`&&S.type===`mcp-tools`)w({type:`mcp-detail`,client:S.client});else if(typeof S==`object`&&S.type===`mcp-tool-detail`)w({type:`mcp-tools`,client:S.client});else{if(P.size>0){t(`Run /reload-plugins to apply plugin changes.`);return}e({type:`menu`})}},[S,e,P,t]),{context:`Confirmation`,isActive:(S!==`plugin-list`||!_)&&S!==`confirm-project-uninstall`&&!(typeof S==`object`&&S.type===`confirm-data-cleanup`)});let he=e=>e.type===`connected`?`connected`:e.type===`disabled`?`disabled`:e.type===`pending`?`pending`:e.type===`needs-auth`?`needs-auth`:`failed`,ge=(0,X.useMemo)(()=>{let e=k(),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 ae){let i=`${r.plugin.name}@${r.marketplace}`,a=e?.enabledPlugins?.[i]!==!1,o=m.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 m){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=Xt(),s=[];for(let[e,t]of a){if(e in h)continue;let n=Bt(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:he(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:he(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(h)){let n=Bt(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},[ae,l,m,P,h]),_e=(0,X.useMemo)(()=>ge.filter(e=>e.type===`flagged-plugin`).map(e=>e.id),[ge]);(0,X.useEffect)(()=>{_e.length>0&&pn(_e)},[_e]);let be=(0,X.useMemo)(()=>{if(!T)return ge;let e=T.toLowerCase();return ge.filter(t=>t.name.toLowerCase().includes(e)||`description`in t&&t.description?.toLowerCase().includes(e))},[ge,T]),[I,xe]=(0,X.useState)(0),Ce=fr({totalItems:be.length,selectedIndex:I,maxVisible:8}),[L,we]=(0,X.useState)(0),[Te,Ee]=(0,X.useState)(!1),[Oe,R]=(0,X.useState)(null),[ke,je]=(0,X.useState)(null),[Me,Ne]=(0,X.useState)(!1),[Pe,Fe]=(0,X.useState)(!1);(0,X.useEffect)(()=>{if(!O){Fe(!1);return}async function e(){let e=O.plugin.manifest.mcpServers,t=!1;if(e&&(t=typeof e==`string`&&$e(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&$e(e))),!t)try{let e=Tn.join(O.plugin.path,`..`),n=Tn.join(e,`.claude-plugin`,`marketplace.json`),r=ce(await En.readFile(n,`utf-8`)).plugins?.find(e=>e.name===O.plugin.name);if(r?.mcpServers){let e=r.mcpServers;t=typeof e==`string`&&$e(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&$e(e))}}catch(e){de(`Failed to read raw marketplace.json: ${e}`)}Fe(t)}e()},[O]),(0,X.useEffect)(()=>{async function e(){le(!0);try{let{enabled:e,disabled:t}=await Lt(),n=k(),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=ye(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)),M(a);let o=[];for(let e of a)for(let t of e.installedPlugins){let n=`${t.name}@${e.name}`,r=t.isBuiltin?`builtin`:nn(n).scope;o.push({plugin:t,marketplace:e.name,scope:r,pendingEnable:void 0,pendingUpdate:!1})}oe(o),xe(0)}finally{le(!1)}}e()},[]),(0,X.useEffect)(()=>{if(!pe.current&&i&&j.length>0&&!se){let{name:e,marketplace:n}=Bt(i),r=o??n,a=r?j.filter(e=>e.name===r):j;for(let t of a){let n=t.installedPlugins.find(t=>t.name===e);if(n){let{scope:e}=nn(`${n.name}@${t.name}`);A({plugin:n,marketplace:t.name,scope:e,pendingEnable:void 0,pendingUpdate:!1}),w(`plugin-details`),F.current=c,pe.current=!0;return}}let s=ge.find(t=>t.type===`failed-plugin`&&t.name===e);s&&s.type===`failed-plugin`&&(w({type:`failed-plugin-details`,plugin:{id:s.id,name:s.name,marketplace:s.marketplace,errors:s.errors,scope:s.scope}}),pe.current=!0),!pe.current&&c&&(pe.current=!0,t(`Plugin "${i}" is not installed in this project`))}},[i,o,j,se,ge,c,t]);let Ie=async r=>{if(!O)return;let i=O.scope||`user`,a=i===`builtin`;if(a&&(r===`update`||r===`uninstall`)){R(`Built-in plugins cannot be updated or uninstalled.`);return}if(!a&&!tn(i)&&r!==`update`){R(`This plugin is managed by your organization. Contact your admin to disable it.`);return}Ee(!0),R(null);try{let o=`${O.plugin.name}@${O.marketplace}`,s;switch(r){case`enable`:{let e=await Zt(o);if(!e.success)throw Error(e.message);break}case`disable`:{let e=await en(o);if(!e.success)throw Error(e.message);s=e.reverseDependents;break}case`uninstall`:{if(a||!tn(i))break;if(an(o)){Ee(!1),w(`confirm-project-uninstall`);return}let e=De().plugins[o],t=!e||e.length<=1?await ct(o):null;if(t){Ee(!1),w({type:`confirm-data-cleanup`,size:t});return}let n=await Qt(o,i);if(!n.success)throw Error(n.message);s=n.reverseDependents;break}case`update`:{if(a)break;let r=await $t(o,i);if(!r.success)throw Error(r.message);if(r.alreadyUpToDate){t(`${O.plugin.name} is already at the latest version (${r.newVersion}).`),n&&await n(),e({type:`menu`});return}break}}Je();let c=`${O.plugin.name}@${O.marketplace}`;if(k()?.enabledPlugins?.[c]!==!1){Ee(!1),w({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} ${O.plugin.name}${u}. Run /reload-plugins to apply.`),n&&await n(),e({type:`menu`})}catch(e){Ee(!1),R(`Failed to ${r}: ${e instanceof Error?e.message:String(e)}`),ve(N(e))}},Le=(0,X.useRef)(Ie);Le.current=Ie,(0,X.useEffect)(()=>{if(S===`plugin-details`&&O&&F.current){let e=F.current;F.current=void 0,Le.current(e)}},[S,O]);let ze=Br.useCallback(()=>{if(I>=be.length)return;let e=be[I];if(e?.type!==`flagged-plugin`)if(e?.type===`plugin`){let t=`${e.plugin.name}@${e.marketplace}`,n=k(),r=P.get(t),i=n?.enabledPlugins?.[t]!==!1,a=e.scope;if(a===`builtin`||tn(a)){let e=new Map(P);r?(e.delete(t),(async()=>{try{r===`will-disable`?await Zt(t):await en(t),Je()}catch(e){ve(e)}})()):(e.set(t,i?`will-disable`:`will-enable`),(async()=>{try{i?await en(t):await Zt(t),Je()}catch(e){ve(e)}})()),ue(e)}}else e?.type===`mcp`&&me(e.client.name)},[I,be,P,ae,me]);v({"select:previous":()=>{I===0?b(!0):Ce.handleSelectionChange(I-1,xe)},"select:next":()=>{I<be.length-1&&Ce.handleSelectionChange(I+1,xe)},"select:accept":Br.useCallback(()=>{if(I>=be.length)return;let e=be[I];if(e?.type===`plugin`){let t=ae.find(t=>t.plugin.name===e.plugin.name&&t.marketplace===e.marketplace);t&&(A(t),w(`plugin-details`),we(0),R(null))}else e?.type===`flagged-plugin`?(w({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`?(w({type:`failed-plugin-details`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,errors:e.errors,scope:e.scope}}),we(0),R(null)):e?.type===`mcp`&&(w({type:`mcp-detail`,client:e.client}),R(null))},[I,be,ae])},{context:`Select`,isActive:S===`plugin-list`&&!_}),v({"plugin:toggle":ze},{context:`Plugin`,isActive:S===`plugin-list`&&!_}),v({"select:accept":Br.useCallback(()=>{typeof S!=`object`||S.type!==`flagged-detail`||(hn(S.plugin.id),w(`plugin-list`))},[S])},{context:`Select`,isActive:typeof S==`object`&&S.type===`flagged-detail`});let Be=Br.useMemo(()=>{if(S!==`plugin-details`||!O)return[];let e=k(),t=`${O.plugin.name}@${O.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=O.marketplace===`builtin`,i=[];return i.push({label:n?`Disable plugin`:`Enable plugin`,action:()=>void Ie(n?`disable`:`enable`)}),r||(i.push({label:O.pendingUpdate?`Unmark for update`:`Mark for update`,action:async()=>{try{let e=await Lr(O.plugin.name,O.marketplace);if(e){R(e);return}let t=[...ae],n=t.findIndex(e=>e.plugin.name===O.plugin.name&&e.marketplace===O.marketplace);n!==-1&&(t[n].pendingUpdate=!O.pendingUpdate,oe(t),A({...O,pendingUpdate:!O.pendingUpdate}))}catch(e){R(e instanceof Error?e.message:`Failed to check plugin update availability`)}}}),Pe&&i.push({label:`Configure`,action:async()=>{Ne(!0);try{let e=O.plugin.manifest.mcpServers,t=null;if(typeof e==`string`&&$e(e))t=e;else if(Array.isArray(e)){for(let n of e)if(typeof n==`string`&&$e(n)){t=n;break}}if(!t){R(`No MCPB file found in plugin`),Ne(!1);return}let n=`${O.plugin.name}@${O.marketplace}`,r=await bt(t,O.plugin.path,n,void 0,void 0,!0);`status`in r&&r.status===`needs-config`?(je(r),w(`configuring`)):R(`Failed to load MCPB for configuration`)}catch(e){R(`Failed to load configuration: ${fe(e)}`)}finally{Ne(!1)}}}),O.plugin.manifest.userConfig&&Object.keys(O.plugin.manifest.userConfig).length>0&&i.push({label:`Configure options`,action:()=>{w({type:`configuring-options`,schema:O.plugin.manifest.userConfig})}}),i.push({label:`Update now`,action:()=>void Ie(`update`)}),i.push({label:`Uninstall`,action:()=>void Ie(`uninstall`)})),O.plugin.manifest.homepage&&i.push({label:`Open homepage`,action:()=>void Ut(O.plugin.manifest.homepage)}),O.plugin.manifest.repository&&i.push({label:`View repository`,action:()=>void Ut(O.plugin.manifest.repository)}),i.push({label:`Back to plugin list`,action:()=>{w(`plugin-list`),A(null),R(null)}}),i},[S,O,Pe,ae]);if(v({"select:previous":()=>{L>0&&we(L-1)},"select:next":()=>{L<Be.length-1&&we(L+1)},"select:accept":()=>{Be[L]&&Be[L].action()}},{context:`Select`,isActive:S===`plugin-details`&&!!O}),v({"select:accept":()=>{typeof S==`object`&&S.type===`failed-plugin-details`&&(async()=>{Ee(!0),R(null);let e=S.plugin.id,t=S.plugin.scope,r=tn(t)?await Qt(e,t,!1):await Qt(e,`user`,!1),i=r.success;if(!i){for(let t of[`userSettings`,`projectSettings`,`localSettings`]){let n=re(t);n?.enabledPlugins?.[e]!==void 0&&(ie(t,{enabledPlugins:{...n.enabledPlugins,[e]:void 0}}),i=!0)}Je()}i?(n&&await n(),Ee(!1),w(`plugin-list`)):(Ee(!1),R(r.message))})()}},{context:`Select`,isActive:typeof S==`object`&&S.type===`failed-plugin-details`&&S.plugin.scope!==`managed`}),v({"confirm:yes":()=>{if(!O)return;Ee(!0),R(null);let r=`${O.plugin.name}@${O.marketplace}`,{error:i}=ie(`localSettings`,{enabledPlugins:{...re(`localSettings`)?.enabledPlugins,[r]:!1}});if(i){Ee(!1),R(`Failed to write settings: ${i.message}`);return}Je(),t(`✓ Disabled ${O.plugin.name} in .claude/settings.local.json. Run /reload-plugins to apply.`),n&&n(),e({type:`menu`})},"confirm:no":()=>{w(`plugin-details`),R(null)}},{context:`Confirmation`,isActive:S===`confirm-project-uninstall`&&!!O&&!Te}),ne((r,i)=>{if(!O)return;let o=`${O.plugin.name}@${O.marketplace}`,s=O.scope;if(!s||s===`builtin`||!tn(s))return;let c=async r=>{Ee(!0),R(null);try{let i=await Qt(o,s,r);if(!i.success)throw Error(i.message);Je();let c=r?``:` · data preserved`;t(`${a.tick} ${i.message}${c}`),n&&n(),e({type:`menu`})}catch(e){Ee(!1),R(e instanceof Error?e.message:String(e))}};r===`y`||r===`Y`?c(!0):r===`n`||r===`N`?c(!1):i.escape&&(w(`plugin-details`),R(null))},{isActive:typeof S==`object`&&S.type===`confirm-data-cleanup`&&!!O&&!Te}),Br.useEffect(()=>{xe(0)},[T]),ne((e,t)=>{let n=!t.ctrl&&!t.meta;_||(e===`/`&&n?(b(!0),E(``),xe(0)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==` `&&(b(!0),E(e),xe(0)))},{isActive:S===`plugin-list`}),se)return(0,Z.jsx)(p,{children:`Loading installed plugins…`});if(ge.length===0)return(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsx)(C,{marginBottom:1,children:(0,Z.jsx)(p,{bold:!0,children:`Manage plugins`})}),(0,Z.jsx)(p,{children:`No plugins or MCP servers installed.`}),(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{dimColor:!0,children:`Esc to go back`})})]});if(typeof S==`object`&&S.type===`plugin-options`&&O){let r=`${O.plugin.name}@${O.marketplace}`;function i(r){t(r),n&&n(),e({type:`menu`})}return(0,Z.jsx)(er,{plugin:O.plugin,pluginId:r,onDone:(e,t)=>{switch(e){case`configured`:i(`✓ Enabled and configured ${O.plugin.name}. Run /reload-plugins to apply.`);break;case`skipped`:i(`✓ Enabled ${O.plugin.name}. Run /reload-plugins to apply.`);break;case`error`:i(`Failed to save configuration: ${t}`);break}}})}if(typeof S==`object`&&S.type===`configuring-options`&&O){let e=`${O.plugin.name}@${O.marketplace}`;return(0,Z.jsx)(Yn,{title:`Configure ${O.plugin.name}`,subtitle:`Plugin options`,configSchema:S.schema,initialValues:Xe(e),onSave:n=>{try{ut(e,n,S.schema),Je(),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){R(`Failed to save configuration: ${fe(e)}`)}w(`plugin-details`)},onCancel:()=>w(`plugin-details`)})}if(S===`configuring`&&ke&&O){let e=`${O.plugin.name}@${O.marketplace}`;async function n(n){if(!(!ke||!O))try{let r=O.plugin.manifest.mcpServers,i=null;if(typeof r==`string`&&$e(r))i=r;else if(Array.isArray(r)){for(let e of r)if(typeof e==`string`&&$e(e)){i=e;break}}if(!i){R(`No MCPB file found`),w(`plugin-details`);return}await bt(i,O.plugin.path,e,void 0,n),R(null),je(null),w(`plugin-details`),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){R(`Failed to save configuration: ${fe(e)}`),w(`plugin-details`)}}function r(){je(null),w(`plugin-details`)}return(0,Z.jsx)(Yn,{title:`Configure ${ke.manifest.name}`,subtitle:`Plugin: ${O.plugin.name}`,configSchema:ke.configSchema,initialValues:ke.existingConfig,onSave:n,onCancel:r})}if(typeof S==`object`&&S.type===`flagged-detail`){let e=S.plugin;return(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsx)(C,{children:(0,Z.jsxs)(p,{bold:!0,children:[e.name,` @ `,e.marketplace]})}),(0,Z.jsxs)(C,{marginBottom:1,children:[(0,Z.jsx)(p,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(p,{color:`error`,children:`Removed`})]}),(0,Z.jsxs)(C,{marginBottom:1,flexDirection:`column`,children:[(0,Z.jsxs)(p,{color:`error`,children:[`Removed from marketplace · reason: `,e.reason]}),(0,Z.jsx)(p,{children:e.text}),(0,Z.jsxs)(p,{dimColor:!0,children:[`Flagged on `,new Date(e.flaggedAt).toLocaleDateString()]})]}),(0,Z.jsx)(C,{marginTop:1,flexDirection:`column`,children:(0,Z.jsxs)(C,{children:[(0,Z.jsxs)(p,{children:[a.pointer,` `]}),(0,Z.jsx)(p,{color:`suggestion`,children:`Dismiss`})]})}),(0,Z.jsxs)(g,{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(S===`confirm-project-uninstall`&&O)return(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsxs)(p,{bold:!0,color:`warning`,children:[O.plugin.name,` is enabled in .claude/settings.json (shared with your team)`]}),(0,Z.jsxs)(C,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(p,{children:`Disable it just for you in .claude/settings.local.json?`}),(0,Z.jsx)(p,{dimColor:!0,children:`This has the same effect as uninstalling, without affecting other contributors.`})]}),Oe&&(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{color:`error`,children:Oe})}),(0,Z.jsx)(C,{marginTop:1,children:Te?(0,Z.jsx)(p,{dimColor:!0,children:`Disabling…`}):(0,Z.jsxs)(g,{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 S==`object`&&S.type===`confirm-data-cleanup`&&O)return(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsxs)(p,{bold:!0,children:[O.plugin.name,` has `,S.size.human,` of persistent data`]}),(0,Z.jsxs)(C,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(p,{children:`Delete it along with the plugin?`}),(0,Z.jsx)(p,{dimColor:!0,children:Re(`${O.plugin.name}@${O.marketplace}`)})]}),Oe&&(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{color:`error`,children:Oe})}),(0,Z.jsx)(C,{marginTop:1,children:Te?(0,Z.jsx)(p,{dimColor:!0,children:`Uninstalling…`}):(0,Z.jsxs)(p,{children:[(0,Z.jsx)(p,{bold:!0,children:`y`}),` to delete · `,(0,Z.jsx)(p,{bold:!0,children:`n`}),` to keep · `,(0,Z.jsx)(p,{bold:!0,children:`esc`}),` to cancel`]})})]});if(S===`plugin-details`&&O){let e=k(),t=`${O.plugin.name}@${O.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=m.filter(e=>`plugin`in e&&e.plugin===O.plugin.name||e.source===t||e.source.startsWith(`${O.plugin.name}@`)),i=r.length===0?null:(0,Z.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(p,{bold:!0,color:`error`,children:[r.length,` `,Se(r.length,`error`),`:`]}),r.map((e,t)=>{let n=Ar(e);return(0,Z.jsxs)(C,{flexDirection:`column`,marginLeft:2,children:[(0,Z.jsx)(p,{color:`error`,children:kr(e)}),n&&(0,Z.jsxs)(p,{dimColor:!0,italic:!0,children:[a.arrowRight,` `,n]})]},t)})]});return(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsx)(C,{children:(0,Z.jsxs)(p,{bold:!0,children:[O.plugin.name,` @ `,O.marketplace]})}),(0,Z.jsxs)(C,{children:[(0,Z.jsx)(p,{dimColor:!0,children:`Scope: `}),(0,Z.jsx)(p,{children:O.scope||`user`})]}),O.plugin.manifest.version&&(0,Z.jsxs)(C,{children:[(0,Z.jsx)(p,{dimColor:!0,children:`Version: `}),(0,Z.jsx)(p,{children:O.plugin.manifest.version})]}),O.plugin.manifest.description&&(0,Z.jsx)(C,{marginBottom:1,children:(0,Z.jsx)(p,{children:O.plugin.manifest.description})}),O.plugin.manifest.author&&(0,Z.jsxs)(C,{children:[(0,Z.jsx)(p,{dimColor:!0,children:`Author: `}),(0,Z.jsx)(p,{children:O.plugin.manifest.author.name})]}),(0,Z.jsxs)(C,{marginBottom:1,children:[(0,Z.jsx)(p,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(p,{color:n?`success`:`warning`,children:n?`Enabled`:`Disabled`}),O.pendingUpdate&&(0,Z.jsx)(p,{color:`suggestion`,children:` · Marked for update`})]}),(0,Z.jsx)(Ir,{plugin:O.plugin,marketplace:O.marketplace}),i,(0,Z.jsx)(C,{marginTop:1,flexDirection:`column`,children:Be.map((e,t)=>{let n=t===L;return(0,Z.jsxs)(C,{children:[n&&(0,Z.jsxs)(p,{children:[a.pointer,` `]}),!n&&(0,Z.jsx)(p,{children:` `}),(0,Z.jsx)(p,{bold:n,color:e.label.includes(`Uninstall`)?`error`:e.label.includes(`Update`)?`suggestion`:void 0,children:e.label})]},t)})}),Te&&(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{children:`Processing…`})}),Oe&&(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{color:`error`,children:Oe})}),(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(g,{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 S==`object`&&S.type===`failed-plugin-details`){let e=S.plugin,t=e.errors[0],n=t?kr(t):`Failed to load`;return(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsxs)(p,{children:[(0,Z.jsx)(p,{bold:!0,children:e.name}),(0,Z.jsxs)(p,{dimColor:!0,children:[` @ `,e.marketplace]}),(0,Z.jsxs)(p,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,Z.jsx)(p,{color:`error`,children:n}),e.scope===`managed`?(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{dimColor:!0,children:`Managed by your organization — contact your admin`})}):(0,Z.jsxs)(C,{marginTop:1,children:[(0,Z.jsxs)(p,{color:`suggestion`,children:[a.pointer,` `]}),(0,Z.jsx)(p,{bold:!0,children:`Remove`})]}),Te&&(0,Z.jsx)(p,{children:`Processing…`}),Oe&&(0,Z.jsx)(p,{color:`error`,children:Oe}),(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(g,{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 S==`object`&&S.type===`mcp-detail`){let e=S.client,n=Ae(u,e.name).length,r=()=>{w({type:`mcp-tools`,client:e})},i=()=>{w(`plugin-list`)},a=e=>{e&&t(e),w(`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}):(w(`plugin-list`),null)}if(typeof S==`object`&&S.type===`mcp-tools`){let e=S.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=>{w({type:`mcp-tool-detail`,client:e,tool:t})},onBack:()=>w({type:`mcp-detail`,client:e})})}if(typeof S==`object`&&S.type===`mcp-tool-detail`){let{client:e,tool:t}=S,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:()=>w({type:`mcp-tools`,client:e})})}let Ve=Ce.getVisibleItems(be);return(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsx)(C,{marginBottom:1,children:(0,Z.jsx)(f,{query:T,isFocused:_,isTerminalFocused:x,width:ee-4,cursorOffset:D})}),be.length===0&&T&&(0,Z.jsx)(C,{marginBottom:1,children:(0,Z.jsxs)(p,{dimColor:!0,children:[`No items match "`,T,`"`]})}),Ce.scrollPosition.canScrollUp&&(0,Z.jsx)(C,{children:(0,Z.jsxs)(p,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),Ve.map((e,t)=>{let n=Ce.toActualIndex(t)===I&&!_,r=t>0?Ve[t-1]:null,i=!r||r.scope!==e.scope;return(0,Z.jsxs)(Br.Fragment,{children:[i&&(0,Z.jsx)(C,{marginTop:+(t>0),paddingLeft:2,children:(0,Z.jsx)(p,{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)}),Ce.scrollPosition.canScrollDown&&(0,Z.jsx)(C,{children:(0,Z.jsxs)(p,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),(0,Z.jsx)(C,{marginTop:1,marginLeft:1,children:(0,Z.jsx)(p,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(g,{children:[(0,Z.jsx)(p,{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)(C,{marginLeft:1,children:(0,Z.jsx)(p,{dimColor:!0,italic:!0,children:`Run /reload-plugins to apply changes`})})]})}var Br,X,Z,Vr=e((()=>{i(),Br=t(l(),1),X=t(l(),1),lt(),x(),Pn(),Ln(),Bn(),Wn(),bn(),Sn(),Kt(),Gt(),Vt(),vn(),Ee(),rn(),Qe(),be(),Wt(),ue(),P(),_e(),Pt(),ze(),qe(),jt(),Le(),gn(),zt(),Ye(),Dt(),Te(),Yt(),j(),le(),L(),jr(),Qn(),rr(),Nr(),hr(),Z=w()}));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 ln(t),r=``;r+=`Validating ${n.fileType} manifest: ${n.filePath}\n\n`,n.errors.length>0&&(r+=`${a.cross} Found ${n.errors.length} ${Se(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} ${Se(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,ve(t),e(`${a.cross} Unexpected error during validation: ${fe(t)}`)}}n()},[e,t]),(0,Kr.jsx)(C,{flexDirection:`column`,children:(0,Kr.jsx)(p,{children:`Running validation...`})})}var Gr,Kr,qr=e((()=>{i(),l(),Gr=t(l(),1),x(),P(),_e(),fn(),L(),Kr=w()}));function Jr({onComplete:e}){return(0,Q.useEffect)(()=>{async function t(){try{let t=await Ge(),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: ${fe(t)}`)}}t()},[e]),(0,$.jsx)(p,{children:`Loading marketplaces...`})}function Yr(){return process.env.USER_TYPE===`ant`?(0,$.jsxs)(C,{flexDirection:`row`,alignItems:`flex-start`,paddingLeft:1,marginTop:1,borderLeft:!0,borderRight:!1,borderTop:!1,borderBottom:!1,borderColor:`permission`,borderStyle:`single`,children:[(0,$.jsx)(C,{flexShrink:0,children:(0,$.jsxs)(p,{bold:!0,italic:!0,color:`permission`,children:[`i`,` `]})}),(0,$.jsx)(p,{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`}])re(n)?.extraKnownMarketplaces?.[e]&&t.push({source:n,scope:r});return{editableSources:t,isInPolicy:!!re(`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=re(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&&ie(n,r)}}function ri({setViewState:e,setActiveTab:t,markPluginsChanged:n}){let r=tt(e=>e.plugins.errors),i=tt(e=>e.plugins.installationStatus),o=pt(),[s,c]=(0,Q.useState)(0),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)([]);(0,Q.useEffect)(()=>{(async()=>{try{let{failures:e}=await it(await Ge());f(e)}catch{}})()},[]);let m=i.marketplaces.filter(e=>e.status===`failed`),h=new Set(m.map(e=>e.name)),_=r.filter($r),y=ti(m,r.filter(e=>(e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`)&&!h.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),d,_,Xt());te(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`}),v({"select:previous":()=>c(e=>Math.max(0,e-1)),"select:next":()=>c(e=>Math.min(y.length-1,e+1)),"select:accept":()=>{let r=y[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),Je(),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)}}})),u(`${a.tick} Removed "${i.name}" from ${e} settings`),n();break}case`remove-installed-marketplace`:(async()=>{try{await kt(i.name),Je(),f(e=>e.filter(e=>e.name!==i.name)),u(`${a.tick} Removed marketplace "${i.name}"`),n()}catch(e){u(`Failed to remove "${i.name}": ${e instanceof Error?e.message:String(e)}`)}})();break;case`managed-only`:break;case`none`:break}}},{context:`Select`,isActive:y.length>0});let b=Math.min(s,Math.max(0,y.length-1));b!==s&&c(b);let x=y[b]?.action,ee=x&&x.kind!==`none`&&x.kind!==`managed-only`;return y.length===0?(0,$.jsxs)(C,{flexDirection:`column`,children:[(0,$.jsx)(C,{marginLeft:1,children:(0,$.jsx)(p,{dimColor:!0,children:`No plugin errors`})}),(0,$.jsx)(C,{marginTop:1,children:(0,$.jsx)(p,{dimColor:!0,italic:!0,children:(0,$.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})})]}):(0,$.jsxs)(C,{flexDirection:`column`,children:[y.map((e,t)=>{let n=t===b;return(0,$.jsxs)(C,{marginLeft:1,flexDirection:`column`,marginBottom:1,children:[(0,$.jsxs)(p,{children:[(0,$.jsxs)(p,{color:n?`suggestion`:`error`,children:[n?a.pointer:a.cross,` `]}),(0,$.jsx)(p,{bold:n,children:e.label}),e.scope&&(0,$.jsxs)(p,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,$.jsx)(C,{marginLeft:3,children:(0,$.jsx)(p,{color:`error`,children:e.message})}),e.guidance&&(0,$.jsx)(C,{marginLeft:3,children:(0,$.jsx)(p,{dimColor:!0,italic:!0,children:e.guidance})})]},t)}),l&&(0,$.jsx)(C,{marginTop:1,marginLeft:1,children:(0,$.jsx)(p,{color:`claude`,children:l})}),(0,$.jsx)(C,{marginTop:1,children:(0,$.jsx)(p,{dimColor:!0,italic:!0,children:(0,$.jsxs)(g,{children:[(0,$.jsx)(z,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),ee&&(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,u]=(0,Q.useState)(a.type===`add-marketplace`&&a.initialValue||``),[d,f]=(0,Q.useState)(0),[m,h]=(0,Q.useState)(null),[g,v]=(0,Q.useState)(null),[x,ee]=(0,Q.useState)(!1),S=pt(),ne=tt(e=>{let t=e.plugins.errors.length;for(let n of e.plugins.installationStatus.marketplaces)n.status===`failed`&&t++;return t}),w=ne>0?`Errors (${ne})`:`Errors`,T=qt(),re=r.type===`marketplace`&&r.action===`add`&&r.target!==void 0,E=(0,Q.useCallback)(()=>{S(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}})},[S]),D=(0,Q.useCallback)(e=>{let t=e;switch(c(t),h(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`&&!g&&e()},[a.type,g,e]),(0,Q.useEffect)(()=>{a.type===`browse-marketplace`&&s!==`discover`&&c(`discover`)},[a.type,s]),te(`confirm:no`,(0,Q.useCallback)(()=>{c(`marketplaces`),o({type:`manage-marketplaces`}),u(``),h(null)},[]),{context:`Settings`,isActive:a.type===`add-marketplace`}),(0,Q.useEffect)(()=>{g&&e(g)},[g,e]),(0,Q.useEffect)(()=>{a.type===`help`&&e()},[a.type,e]),a.type===`help`?(0,$.jsxs)(C,{flexDirection:`column`,children:[(0,$.jsx)(p,{bold:!0,children:`Plugin Command Usage:`}),(0,$.jsx)(p,{children:` `}),(0,$.jsx)(p,{dimColor:!0,children:`Installation:`}),(0,$.jsx)(p,{children:` /plugin install - Browse and install plugins`}),(0,$.jsx)(p,{children:` /plugin install <marketplace> - Install from specific marketplace`}),(0,$.jsx)(p,{children:` /plugin install <plugin> - Install specific plugin`}),(0,$.jsx)(p,{children:` /plugin install <plugin>@<market> - Install plugin from marketplace`}),(0,$.jsx)(p,{children:` `}),(0,$.jsx)(p,{dimColor:!0,children:`Management:`}),(0,$.jsx)(p,{children:` /plugin manage - Manage installed plugins`}),(0,$.jsx)(p,{children:` /plugin enable <plugin> - Enable a plugin`}),(0,$.jsx)(p,{children:` /plugin disable <plugin> - Disable a plugin`}),(0,$.jsx)(p,{children:` /plugin uninstall <plugin> - Uninstall a plugin`}),(0,$.jsx)(p,{children:` `}),(0,$.jsx)(p,{dimColor:!0,children:`Marketplaces:`}),(0,$.jsx)(p,{children:` /plugin marketplace - Marketplace management menu`}),(0,$.jsx)(p,{children:` /plugin marketplace add - Add a marketplace`}),(0,$.jsx)(p,{children:` /plugin marketplace add <path/url> - Add marketplace directly`}),(0,$.jsx)(p,{children:` /plugin marketplace update - Update marketplaces`}),(0,$.jsx)(p,{children:` /plugin marketplace update <name> - Update specific marketplace`}),(0,$.jsx)(p,{children:` /plugin marketplace remove - Remove a marketplace`}),(0,$.jsx)(p,{children:` /plugin marketplace remove <name> - Remove specific marketplace`}),(0,$.jsx)(p,{children:` /plugin marketplace list - List all marketplaces`}),(0,$.jsx)(p,{children:` `}),(0,$.jsx)(p,{dimColor:!0,children:`Validation:`}),(0,$.jsx)(p,{children:` /plugin validate <path> - Validate a manifest file or directory`}),(0,$.jsx)(p,{children:` `}),(0,$.jsx)(p,{dimColor:!0,children:`Other:`}),(0,$.jsx)(p,{children:` /plugin - Main plugin menu`}),(0,$.jsx)(p,{children:` /plugin help - Show this help`}),(0,$.jsx)(p,{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:u,cursorOffset:d,setCursorOffset:f,error:m,setError:h,result:g,setResult:v,setViewState:o,onAddComplete:E,cliMode:re}):(0,$.jsx)(y,{color:`suggestion`,children:(0,$.jsxs)(b,{title:`Plugins`,selectedTab:s,onTabChange:D,color:`suggestion`,disableNavigation:x,banner:n&&s===`installed`?(0,$.jsx)(Yr,{}):void 0,children:[(0,$.jsx)(_,{id:`discover`,title:`Discover`,children:a.type===`browse-marketplace`?(0,$.jsx)(gr,{error:m,setError:h,result:g,setResult:v,setViewState:o,onInstallComplete:E,targetMarketplace:a.targetMarketplace,targetPlugin:a.targetPlugin}):(0,$.jsx)(br,{error:m,setError:h,result:g,setResult:v,setViewState:o,onInstallComplete:E,onSearchModeChange:ee,targetPlugin:a.type===`discover-plugins`?a.targetPlugin:void 0})}),(0,$.jsx)(_,{id:`installed`,title:`Installed`,children:(0,$.jsx)(zr,{setViewState:o,setResult:v,onManageComplete:E,onSearchModeChange:ee,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)(_,{id:`marketplaces`,title:`Marketplaces`,children:(0,$.jsx)(Tr,{setViewState:o,error:m,setError:h,setResult:v,exitState:T,onManageComplete:E,targetMarketplace:a.type===`manage-marketplaces`?a.targetMarketplace:void 0,action:a.type===`manage-marketplaces`?a.action:void 0})}),(0,$.jsx)(_,{id:`errors`,title:w,children:(0,$.jsx)(ri,{setViewState:o,setActiveTab:c,markPluginsChanged:E})})]})})}var Q,$,si,ci=e((()=>{i(),l(),Q=t(l(),1),lt(),x(),Jt(),Gt(),Qe(),P(),Pt(),xt(),qe(),Yt(),j(),qn(),yr(),wr(),Or(),Vr(),jr(),Ur(),qr(),$=w(),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};