claude-code-zanii 2.8.4

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 (669) hide show
  1. package/README.md +146 -0
  2. package/dist/chunks/AddWorkspaceDirectory-y_rd6sRl.js +1 -0
  3. package/dist/chunks/App-DgWSavG1.js +1 -0
  4. package/dist/chunks/ApproveApiKey-CJKWha-a.js +1 -0
  5. package/dist/chunks/ApproveApiKey-DTs2ExZH.js +1 -0
  6. package/dist/chunks/AssistantSessionChooser-BAhVk4id.js +1 -0
  7. package/dist/chunks/BackgroundTasksDialog-XU_JPh7R.js +2 -0
  8. package/dist/chunks/BypassPermissionsModeDialog-DV0Pi7ys.js +1 -0
  9. package/dist/chunks/ClaudeInChromeOnboarding-6erm_8Fn.js +1 -0
  10. package/dist/chunks/ClaudeMdExternalIncludesDialog-CjBvzB5s.js +1 -0
  11. package/dist/chunks/ClaudeMdExternalIncludesDialog-ts0XnWwl.js +1 -0
  12. package/dist/chunks/ConsoleOAuthFlow-DySPdSqQ.js +1 -0
  13. package/dist/chunks/CustomSelect-DqZxzBZP.js +1 -0
  14. package/dist/chunks/DesktopHandoff-5c90JK88.js +1 -0
  15. package/dist/chunks/DevChannelsDialog-DCMderzu.js +1 -0
  16. package/dist/chunks/Dialog-Dgg8bqcG.js +1 -0
  17. package/dist/chunks/DiffDialog-BU765aqh.js +6 -0
  18. package/dist/chunks/Doctor-B73iDB-d.js +3 -0
  19. package/dist/chunks/Doctor-CLZDdNRo.js +1 -0
  20. package/dist/chunks/ExitFlow-DBqn2mUf.js +2 -0
  21. package/dist/chunks/Feedback-D-JHabwi.js +2 -0
  22. package/dist/chunks/Grove-D-uQNMMo.js +11 -0
  23. package/dist/chunks/HybridTransport-B-G4QJcy.js +4 -0
  24. package/dist/chunks/ITermBackend-KP1vKsRN.js +1 -0
  25. package/dist/chunks/InProcessTransport-ByBEKxrQ.js +1 -0
  26. package/dist/chunks/InvalidConfigDialog-CMqiZ5nG.js +1 -0
  27. package/dist/chunks/InvalidSettingsDialog-CjPCKzVZ.js +1 -0
  28. package/dist/chunks/ListItem-B6MyhHvM.js +1 -0
  29. package/dist/chunks/MCPConnectionManager-BJ8PcYPe.js +1 -0
  30. package/dist/chunks/Message-DNxJ_tMS.js +1 -0
  31. package/dist/chunks/MessageSelector-D79Ug71B.js +3 -0
  32. package/dist/chunks/Messages-CtIbkB2M.js +11 -0
  33. package/dist/chunks/Onboarding-DVrgKrI9.js +1 -0
  34. package/dist/chunks/OverageCreditUpsell-D_td1ss4.js +1 -0
  35. package/dist/chunks/PermissionDialog-BCS22yEO.js +1 -0
  36. package/dist/chunks/PermissionDialog-C5O1fL53.js +1 -0
  37. package/dist/chunks/PermissionRequestTitle-CtlbBU9t.js +1 -0
  38. package/dist/chunks/PluginSettings-OPrg-_3N.js +17 -0
  39. package/dist/chunks/PressEnterToContinue-DmzxIgbZ.js +1 -0
  40. package/dist/chunks/PromptInputFooterSuggestions-CcsKj5DK.js +1 -0
  41. package/dist/chunks/PromptInputHelpMenu-JedFdsxU.js +1 -0
  42. package/dist/chunks/REPL-ByhyIRnf.js +1 -0
  43. package/dist/chunks/REPL-Clve-8zC.js +157 -0
  44. package/dist/chunks/RemoteCallout-BZcabEKb.js +1 -0
  45. package/dist/chunks/RemoteSessionManager-C2PIFDHt.js +1 -0
  46. package/dist/chunks/ResumeConversation-D3ZRTFcF.js +1 -0
  47. package/dist/chunks/SSETransport-DmZWnH0k.js +4 -0
  48. package/dist/chunks/SearchBox-DQg2Ph0V.js +1 -0
  49. package/dist/chunks/SearchExtraToolsTool-CLO4nt6N.js +1 -0
  50. package/dist/chunks/SentryErrorBoundary-BVfBaOOU.js +2 -0
  51. package/dist/chunks/SentryErrorBoundary-DIaVFad-.js +1 -0
  52. package/dist/chunks/Settings-rOCxQdS8.js +2 -0
  53. package/dist/chunks/TeleportProgress-CP8IY6bz.js +1 -0
  54. package/dist/chunks/TeleportRepoMismatchDialog-DMmHgBqo.js +1 -0
  55. package/dist/chunks/TeleportResumeWrapper-D5wEAW1-.js +1 -0
  56. package/dist/chunks/ThemePicker-Bgr7yOQB.js +1 -0
  57. package/dist/chunks/TmuxBackend-BzbtUtP1.js +9 -0
  58. package/dist/chunks/TrustDialog-BI5U3BQ0.js +1 -0
  59. package/dist/chunks/TungstenTool-CiQclNwj.js +1 -0
  60. package/dist/chunks/TungstenTool-kMqy-ifa.js +1 -0
  61. package/dist/chunks/ValidationErrorsList-DprGtB2w.js +2 -0
  62. package/dist/chunks/WelcomeV2-C4vfBnIy.js +1 -0
  63. package/dist/chunks/WindowsTerminalBackend-BSoezOCE.js +2 -0
  64. package/dist/chunks/add-dir-DpOmv6kv.js +1 -0
  65. package/dist/chunks/agentDisplay-DuYEwOwO.js +1 -0
  66. package/dist/chunks/agents-BlurXZrF.js +2 -0
  67. package/dist/chunks/agents-DhZf7ftU.js +103 -0
  68. package/dist/chunks/ajv-CDrSAj3O.js +8 -0
  69. package/dist/chunks/analytics-i6X1et4O.js +1 -0
  70. package/dist/chunks/ant-D9hd_iYy.js +1 -0
  71. package/dist/chunks/api-CoaOHwDQ.js +4 -0
  72. package/dist/chunks/api-DvyGR-L7.js +1 -0
  73. package/dist/chunks/api-YHYC4Zdk.js +1 -0
  74. package/dist/chunks/artifacts-BMAYdaqh.js +1 -0
  75. package/dist/chunks/asciicast-DpHRoebc.js +1 -0
  76. package/dist/chunks/asciicast-HG1EoAQe.js +4 -0
  77. package/dist/chunks/assistant-D4-qcNT1.js +1 -0
  78. package/dist/chunks/assistant-DO2ZmZn1.js +1 -0
  79. package/dist/chunks/assistant-Dd86NmJM.js +1 -0
  80. package/dist/chunks/attributionHooks-BUmHrLhB.js +1 -0
  81. package/dist/chunks/attributionTrailer-r2Pbpu2N.js +1 -0
  82. package/dist/chunks/auth-CF3BGNYT.js +1 -0
  83. package/dist/chunks/auth-DwWwG43F.js +1 -0
  84. package/dist/chunks/auth-V_Xk2iea.js +1 -0
  85. package/dist/chunks/autoMode-DUksX5_i.js +45 -0
  86. package/dist/chunks/autoModeDenials-0CPO-Jbu.js +1 -0
  87. package/dist/chunks/autonomy-C5mNhAdz.js +21 -0
  88. package/dist/chunks/autonomy-CLt1dWaC.js +1 -0
  89. package/dist/chunks/autonomyPanel-rioFnrQO.js +1 -0
  90. package/dist/chunks/axios-DPuSPBlH.js +1 -0
  91. package/dist/chunks/axios-Zh7qGPze.js +12 -0
  92. package/dist/chunks/backgroundHousekeeping-BGtfqu-J.js +1 -0
  93. package/dist/chunks/backgroundHousekeeping-BqKZEvy0.js +17 -0
  94. package/dist/chunks/banner-BGLr3KYQ.js +2 -0
  95. package/dist/chunks/base64-js-B1tFNiG0.js +1 -0
  96. package/dist/chunks/bedrockClient-BFzWuhQK.js +15 -0
  97. package/dist/chunks/bg-B-YgGwLj.js +9 -0
  98. package/dist/chunks/bg-IU4gG3jc.js +1 -0
  99. package/dist/chunks/branch-BWY5W7hf.js +3 -0
  100. package/dist/chunks/break-cache-CY-O23fJ.js +8 -0
  101. package/dist/chunks/bridge-CqWd70vK.js +2 -0
  102. package/dist/chunks/bridgeConfig-CWO8AmCY.js +1 -0
  103. package/dist/chunks/bridgeConfig-D38y9eXn.js +1 -0
  104. package/dist/chunks/bridgeConfig-EwUq__ct.js +1 -0
  105. package/dist/chunks/bridgeConfig-GYR-LUiu.js +1 -0
  106. package/dist/chunks/bridgeEnabled-DKqmLnKO.js +1 -0
  107. package/dist/chunks/bridgeEnabled-DZIGDtfY.js +1 -0
  108. package/dist/chunks/bridgeMain-CXVks2ND.js +1 -0
  109. package/dist/chunks/bridgeMain-D4nsECwJ.js +68 -0
  110. package/dist/chunks/bridgeMessaging-BUOZU_ba.js +1 -0
  111. package/dist/chunks/bridgePointer-BpzIEsD_.js +1 -0
  112. package/dist/chunks/browser-D1vC3BNd.js +1 -0
  113. package/dist/chunks/btw-CVXJwoXo.js +1 -0
  114. package/dist/chunks/buddy-BLcvL8lP.js +3 -0
  115. package/dist/chunks/bundledMode-DQNSSQbt.js +1 -0
  116. package/dist/chunks/caches-BrfvzKn5.js +1 -0
  117. package/dist/chunks/caches-CkSv3MfC.js +3 -0
  118. package/dist/chunks/capacityWake-BWCSatN6.js +1 -0
  119. package/dist/chunks/changeDetector-DEZU6tum.js +1 -0
  120. package/dist/chunks/changeDetector-Df7c6U3d.js +1 -0
  121. package/dist/chunks/channelAllowlist-BApjAS0V.js +1 -0
  122. package/dist/chunks/channelNotification-BjWwF85R.js +1 -0
  123. package/dist/chunks/channelNotification-D01YVwNj.js +1 -0
  124. package/dist/chunks/chokidar-DPwMBcWI.js +1 -0
  125. package/dist/chunks/chokidar-DkDXNCTz.js +1 -0
  126. package/dist/chunks/chrome-D7coxEOI.js +1 -0
  127. package/dist/chunks/chromeNativeHost-CPj9M_4-.js +1 -0
  128. package/dist/chunks/chunk-DR8-3Aex.js +1 -0
  129. package/dist/chunks/classPrivateFieldSet2-DZkxcFPS.js +1 -0
  130. package/dist/chunks/claudeAiLimitsHook-ATshVrOH.js +1 -0
  131. package/dist/chunks/claudeDesktop-PVa9tWsM.js +1 -0
  132. package/dist/chunks/cleanup-C-PGmKpV.js +1 -0
  133. package/dist/chunks/clear-CxGE9Ntr.js +1 -0
  134. package/dist/chunks/cliLaunch-CMXoY_LO.js +1 -0
  135. package/dist/chunks/client-BWED8Tbu.js +35 -0
  136. package/dist/chunks/client-CinDjeSq.js +7 -0
  137. package/dist/chunks/client-CpXGg9e0.js +1 -0
  138. package/dist/chunks/color-B3w_VQTn.js +1 -0
  139. package/dist/chunks/color-convert-BQZnVz_5.js +1 -0
  140. package/dist/chunks/commands-DFp48zwy.js +1 -0
  141. package/dist/chunks/commitAttribution-B0cXmbvv.js +2 -0
  142. package/dist/chunks/commitAttribution-DRSKRoH6.js +1 -0
  143. package/dist/chunks/common-BX7bn3hg.js +1 -0
  144. package/dist/chunks/common-Ce3LanTX.js +1 -0
  145. package/dist/chunks/common-DdLQuE2_.js +1 -0
  146. package/dist/chunks/common-HfKcqOYK.js +1 -0
  147. package/dist/chunks/compact-C8ljGMdo.js +3 -0
  148. package/dist/chunks/companion-mD1jw6xX.js +1 -0
  149. package/dist/chunks/completionCache-BqQXVTa9.js +1 -0
  150. package/dist/chunks/completionCache-BtP4vfAi.js +4 -0
  151. package/dist/chunks/computerUseLock-ADE_PhIK.js +1 -0
  152. package/dist/chunks/config-CmyaIIOY.js +1 -0
  153. package/dist/chunks/config-Rl1Y_Dtq.js +1 -0
  154. package/dist/chunks/connectHeadless-MFABhXpz.js +1 -0
  155. package/dist/chunks/constants-BM62Vf_X.js +1 -0
  156. package/dist/chunks/constants-BfXy-5cI.js +1 -0
  157. package/dist/chunks/context-BeiZkUNq.js +1 -0
  158. package/dist/chunks/context-noninteractive-CRdF3iv8.js +54 -0
  159. package/dist/chunks/controlMessageCompat-591iGHUK.js +1 -0
  160. package/dist/chunks/conversation-BoguXZEI.js +1 -0
  161. package/dist/chunks/conversation-yhs7tT-g.js +1 -0
  162. package/dist/chunks/copy-BpeUcqku.js +7 -0
  163. package/dist/chunks/createSSHSession-B3JOB4TE.js +6 -0
  164. package/dist/chunks/createSession-BJSnFBGt.js +1 -0
  165. package/dist/chunks/createSession-CnRHI3RU.js +1 -0
  166. package/dist/chunks/cron-iqTFGIos.js +1 -0
  167. package/dist/chunks/cronScheduler-zRXhgEEU.js +6 -0
  168. package/dist/chunks/cronTasks-CMJldfoP.js +2 -0
  169. package/dist/chunks/crossProjectResume-DxO6TX30.js +40 -0
  170. package/dist/chunks/cwd-B2guYBbl.js +1 -0
  171. package/dist/chunks/cwd-B5bbyUwz.js +1 -0
  172. package/dist/chunks/cwd-BXiaJzLh.js +1 -0
  173. package/dist/chunks/daemon-B3v4OoOu.js +2 -0
  174. package/dist/chunks/dangerousBackend-OmCzoW35.js +1 -0
  175. package/dist/chunks/datadog-3-Vvz0yz.js +1 -0
  176. package/dist/chunks/datadog-BQlp3bTs.js +1 -0
  177. package/dist/chunks/debug-BDBIipC1.js +2 -0
  178. package/dist/chunks/debug-C7tW7DFW.js +1 -0
  179. package/dist/chunks/debug-CjIaNjpK.js +5 -0
  180. package/dist/chunks/debugUtils-Dsg-UHeg.js +1 -0
  181. package/dist/chunks/defineProperty-CaCI0a5T.js +1 -0
  182. package/dist/chunks/desktop-C_SS0068.js +1 -0
  183. package/dist/chunks/detached-B7RNZeyl.js +5 -0
  184. package/dist/chunks/detect-libc-DFFGDzPC.js +1 -0
  185. package/dist/chunks/detectRepository-BnTCJAXR.js +1 -0
  186. package/dist/chunks/detectRepository-Gobn9eFt.js +1 -0
  187. package/dist/chunks/detection-CN_uLGU2.js +1 -0
  188. package/dist/chunks/detection-DW6grIlc.js +1 -0
  189. package/dist/chunks/diff-B8YmRG5T.js +1 -0
  190. package/dist/chunks/directoryCompletion-J560aATd.js +1 -0
  191. package/dist/chunks/dist-B1wOprSs.js +29 -0
  192. package/dist/chunks/dist-DZQOarNX.js +5 -0
  193. package/dist/chunks/dist-HZfkKiUF.js +20 -0
  194. package/dist/chunks/dist-es-4xyrZoNc2.js +1 -0
  195. package/dist/chunks/dist-es-6kjvVbJd.js +1 -0
  196. package/dist/chunks/dist-es-BJldFHbt.js +3 -0
  197. package/dist/chunks/dist-es-BM013UFT.js +1 -0
  198. package/dist/chunks/dist-es-BPPewn1A.js +1 -0
  199. package/dist/chunks/dist-es-BZGG3Hnm.js +1 -0
  200. package/dist/chunks/dist-es-BZjJL64k2.js +1 -0
  201. package/dist/chunks/dist-es-BctcPxLN.js +1 -0
  202. package/dist/chunks/dist-es-Bf2jR30y.js +1 -0
  203. package/dist/chunks/dist-es-BgLoR-hQ.js +1 -0
  204. package/dist/chunks/dist-es-BismPcTW.js +1 -0
  205. package/dist/chunks/dist-es-BrPzXmSP.js +1 -0
  206. package/dist/chunks/dist-es-Bu21Wvhs.js +1 -0
  207. package/dist/chunks/dist-es-BuWNNAXW.js +1 -0
  208. package/dist/chunks/dist-es-Bz11sFiK2.js +1 -0
  209. package/dist/chunks/dist-es-C5VplyPL2.js +5 -0
  210. package/dist/chunks/dist-es-C66BuLgn.js +1 -0
  211. package/dist/chunks/dist-es-CCIzgNln2.js +1 -0
  212. package/dist/chunks/dist-es-CLyx7Kge2.js +1 -0
  213. package/dist/chunks/dist-es-CUbatGdn.js +1 -0
  214. package/dist/chunks/dist-es-CYe_-TbD.js +1 -0
  215. package/dist/chunks/dist-es-C_IHUdzL.js +1 -0
  216. package/dist/chunks/dist-es-Ci_rKlMr.js +1 -0
  217. package/dist/chunks/dist-es-ClDZBAj7.js +1 -0
  218. package/dist/chunks/dist-es-Cp--qjOi.js +1 -0
  219. package/dist/chunks/dist-es-CzE4kW1L.js +9 -0
  220. package/dist/chunks/dist-es-DUg5w7-v.js +1 -0
  221. package/dist/chunks/dist-es-Dl0ZRczY.js +1 -0
  222. package/dist/chunks/dist-es-Do_155z5.js +1 -0
  223. package/dist/chunks/dist-es-DxIM0jd82.js +1 -0
  224. package/dist/chunks/dist-es-Fav2oBDs.js +1 -0
  225. package/dist/chunks/dist-es-TZjwPaGn.js +1 -0
  226. package/dist/chunks/dist-es-W22ud2el2.js +1 -0
  227. package/dist/chunks/dist-es-aU8-02YH.js +1 -0
  228. package/dist/chunks/dist-es-b3yZSGx82.js +1 -0
  229. package/dist/chunks/dist-es-dIP5JtXz.js +5 -0
  230. package/dist/chunks/dist-es-mQ4HvnYs2.js +1 -0
  231. package/dist/chunks/distRoot-CJaacAHy.js +1 -0
  232. package/dist/chunks/doctor-DLZPF4iY.js +1 -0
  233. package/dist/chunks/earlyInput-BTI1CSNt.js +2 -0
  234. package/dist/chunks/earlyInput-BwGtzhhP.js +1 -0
  235. package/dist/chunks/effort-BaHvpBWr.js +9 -0
  236. package/dist/chunks/entry-_e-lyRwv.js +14 -0
  237. package/dist/chunks/env-CesrOJJq.js +1 -0
  238. package/dist/chunks/envLessBridgeConfig-4oys0_9A.js +1 -0
  239. package/dist/chunks/envLessBridgeConfig-DJ1Sts3F.js +1 -0
  240. package/dist/chunks/envUtils-CFG7IQID.js +1 -0
  241. package/dist/chunks/errorLogSink-Ti4Suoz6.js +2 -0
  242. package/dist/chunks/escHotkey-CVn_80xM.js +259 -0
  243. package/dist/chunks/esm-BFnjHW38.js +1 -0
  244. package/dist/chunks/esm-BQg_LX3V.js +1 -0
  245. package/dist/chunks/esm-BtC6CMmM.js +1 -0
  246. package/dist/chunks/esm-BwzC0MQp.js +1 -0
  247. package/dist/chunks/esm-CFybeQ_Q.js +1 -0
  248. package/dist/chunks/esm-CK-5CT5X.js +1 -0
  249. package/dist/chunks/esm-CL1OwlZB.js +1 -0
  250. package/dist/chunks/esm-CMzgSTAl.js +1 -0
  251. package/dist/chunks/esm-CPE_H2Lx.js +1 -0
  252. package/dist/chunks/esm-CcWquv5a.js +10 -0
  253. package/dist/chunks/esm-CeNEpRZt.js +1 -0
  254. package/dist/chunks/esm-D7hykoRB.js +1 -0
  255. package/dist/chunks/esm-DUtcefEV.js +1 -0
  256. package/dist/chunks/esm-DhrUwJBp.js +1 -0
  257. package/dist/chunks/esm-Duu1fRQ8.js +1 -0
  258. package/dist/chunks/esm-Ght2BaU2.js +1 -0
  259. package/dist/chunks/esm-Q6Yz2GMx.js +56 -0
  260. package/dist/chunks/esm-WONEiurY.js +13 -0
  261. package/dist/chunks/event-streams-BumpU1aB.js +1 -0
  262. package/dist/chunks/eventLoopStallDetector-DxyFdg1h.js +1 -0
  263. package/dist/chunks/execAsync-ChKxDZ8C.js +1 -0
  264. package/dist/chunks/execFileNoThrow-DdmR1mBS.js +1 -0
  265. package/dist/chunks/execSyncWrapper-Ch4TNj8u.js +1 -0
  266. package/dist/chunks/execa-BMaINL7N.js +34 -0
  267. package/dist/chunks/executor-C7INr19-.js +1 -0
  268. package/dist/chunks/executor-Dnf3YYma.js +1604 -0
  269. package/dist/chunks/exit-BakzsOD0.js +1 -0
  270. package/dist/chunks/exit-CiDn2tN9.js +2 -0
  271. package/dist/chunks/export-b-6pqMqz.js +2 -0
  272. package/dist/chunks/exportRenderer-RxtEIyTm.js +1 -0
  273. package/dist/chunks/extra-usage-7EPJNjNW.js +1 -0
  274. package/dist/chunks/extra-usage-ChvuewCq.js +1 -0
  275. package/dist/chunks/extra-usage-core-BVhLtoDF.js +1 -0
  276. package/dist/chunks/extra-usage-noninteractive-_Njh6q-q.js +1 -0
  277. package/dist/chunks/extraUsage-qOBMQB6g.js +1 -0
  278. package/dist/chunks/extractMemories-CRBVNiG1.js +1 -0
  279. package/dist/chunks/fast-C4uw_g7o.js +1 -0
  280. package/dist/chunks/fast-CEaIzaPl.js +1 -0
  281. package/dist/chunks/featureCheck-B1GSTyhh.js +1 -0
  282. package/dist/chunks/featureCheck-DKigAPal.js +1 -0
  283. package/dist/chunks/feedback-Bf3TjjuD.js +1 -0
  284. package/dist/chunks/figures-fES5sASd.js +1 -0
  285. package/dist/chunks/fileStateCache-DAsLEZau.js +1 -0
  286. package/dist/chunks/files-B-m_4X8b.js +2 -0
  287. package/dist/chunks/findExecutable-D8vJrFnO.js +1 -0
  288. package/dist/chunks/firstPartyEventLogger-BtrGagNa.js +1 -0
  289. package/dist/chunks/flushGate-2zqab-Pp.js +1 -0
  290. package/dist/chunks/foundry-sdk-CtX8C0x3.js +1 -0
  291. package/dist/chunks/fpsMetrics-ts_jaF3g.js +1 -0
  292. package/dist/chunks/fuse-ivQ_eRwF.js +1 -0
  293. package/dist/chunks/gates-CmKoQ0O-.js +1 -0
  294. package/dist/chunks/gates-_wbPDQ3M.js +1 -0
  295. package/dist/chunks/gemini-DRx495gn.js +3 -0
  296. package/dist/chunks/generateRecap-Cv8gd_QF.js +1 -0
  297. package/dist/chunks/generateSessionName-Dpjg-u_x.js +1 -0
  298. package/dist/chunks/genericProcessUtils-BFJMxLqn.js +23 -0
  299. package/dist/chunks/getMachineId-bsd-C9pL9Ajr.js +1 -0
  300. package/dist/chunks/getMachineId-darwin-Ma4F9rJg.js +2 -0
  301. package/dist/chunks/getMachineId-linux-C0lXMqsj.js +1 -0
  302. package/dist/chunks/getMachineId-unsupported-ByHQTXat.js +1 -0
  303. package/dist/chunks/getMachineId-win-DZsXZmTz.js +1 -0
  304. package/dist/chunks/git-Bj8Ow4pJ.js +6 -0
  305. package/dist/chunks/git-Q_b4oZ17.js +1 -0
  306. package/dist/chunks/githubRepoPathMapping-DGivBX9h.js +1 -0
  307. package/dist/chunks/goal-BrHEJv8o.js +3 -0
  308. package/dist/chunks/goalStorage-CsuPOQbk.js +1 -0
  309. package/dist/chunks/graceful-fs-BuPWC-vB.js +2 -0
  310. package/dist/chunks/grok-CDkDDaY_.js +1 -0
  311. package/dist/chunks/growthbook-D3_Cr9n-.js +1 -0
  312. package/dist/chunks/growthbook-p4aJ_UMv.js +32 -0
  313. package/dist/chunks/hash-KW-tVnPp.js +1 -0
  314. package/dist/chunks/heapdump-CloylIZ9.js +5 -0
  315. package/dist/chunks/help-DpSJlHIc.js +1 -0
  316. package/dist/chunks/hooks-2pogt8nv.js +79 -0
  317. package/dist/chunks/hooks-BBODdwnE.js +1 -0
  318. package/dist/chunks/hostAdapter-B5KTUqhv.js +1 -0
  319. package/dist/chunks/hostGuard-DyWr2TwE.js +1 -0
  320. package/dist/chunks/httpAuthSchemes-CgPbtGos.js +13 -0
  321. package/dist/chunks/ide-CJEcfBZq.js +2 -0
  322. package/dist/chunks/inboundAttachments-RNpYpRTO.js +1 -0
  323. package/dist/chunks/index.min-DCDiLq-j.js +1 -0
  324. package/dist/chunks/initReplBridge-D2E6IM2B.js +1 -0
  325. package/dist/chunks/initReplBridge-p2uwDBPx.js +1 -0
  326. package/dist/chunks/insights-DnpZScKs.js +822 -0
  327. package/dist/chunks/install-D_vTxUlG.js +1 -0
  328. package/dist/chunks/install-github-app-BK8A7g3i.js +147 -0
  329. package/dist/chunks/install-slack-app-C47R9VoI.js +1 -0
  330. package/dist/chunks/instinctParser-DxKdI3JC.js +1 -0
  331. package/dist/chunks/instrumentation-DkdAJFrZ.js +12 -0
  332. package/dist/chunks/intl-Pse97ORk.js +1 -0
  333. package/dist/chunks/isObject-DaxDnPKm.js +1 -0
  334. package/dist/chunks/isSymbol-D7QeUnS5.js +1 -0
  335. package/dist/chunks/job-opl00C4l.js +2 -0
  336. package/dist/chunks/json-bigint-BRRVs1dv.js +8 -0
  337. package/dist/chunks/jsx-runtime-BTgGEFjL.js +1 -0
  338. package/dist/chunks/jws-B_ieuaZg.js +3 -0
  339. package/dist/chunks/jwtUtils-D-tJzoJY.js +1 -0
  340. package/dist/chunks/keybindings-mRf9VSe8.js +2 -0
  341. package/dist/chunks/lang-eH4EJErj.js +1 -0
  342. package/dist/chunks/language-DD9ar6RA.js +1 -0
  343. package/dist/chunks/language-EZLNdETg.js +1 -0
  344. package/dist/chunks/launchAgentsPlatform-Cq0_7-IM.js +1 -0
  345. package/dist/chunks/launchAutofixPr-Bw7aUHUs.js +18 -0
  346. package/dist/chunks/launchCommand-Bk1Fn-qZ.js +1 -0
  347. package/dist/chunks/launchLocalMemory-CLBCUgwd.js +3 -0
  348. package/dist/chunks/launchLocalVault-BfWJWrBg.js +3 -0
  349. package/dist/chunks/launchMemoryStores-DdnSVSDZ.js +1 -0
  350. package/dist/chunks/launchOnboarding-ziCEX3GI.js +8 -0
  351. package/dist/chunks/launchSchedule-G_c7sgmy.js +1 -0
  352. package/dist/chunks/launchSkillStore-Z1Kd7nCg.js +1 -0
  353. package/dist/chunks/launchTeleport-Dp9AFbPx.js +3 -0
  354. package/dist/chunks/launchVault-hwK-Ljek.js +1 -0
  355. package/dist/chunks/lazySchema-2sOku3cX.js +1 -0
  356. package/dist/chunks/lib-BHRYgENJ.js +8 -0
  357. package/dist/chunks/lib-DRyNc7xD.js +2 -0
  358. package/dist/chunks/lib-Ddq71jM5.js +14 -0
  359. package/dist/chunks/loadAgentsDir-Bz0FfcVt.js +5620 -0
  360. package/dist/chunks/loadAgentsDir-CLM0ws7u.js +1 -0
  361. package/dist/chunks/loadPluginHooks-B5SIS2uo.js +1 -0
  362. package/dist/chunks/loadSso-RY87rrJO.js +1 -0
  363. package/dist/chunks/localSearch-BLF6PSv2.js +1 -0
  364. package/dist/chunks/localSearch-CTycGe3E.js +1 -0
  365. package/dist/chunks/localSearch-inDahM8I.js +1 -0
  366. package/dist/chunks/lockfile--gk1HDM6.js +1 -0
  367. package/dist/chunks/log-B-Nj3Yed.js +1 -0
  368. package/dist/chunks/log-DVv8YiNo.js +1 -0
  369. package/dist/chunks/login-BeLvLowc.js +1 -0
  370. package/dist/chunks/login-DUUOeNoz.js +1 -0
  371. package/dist/chunks/logoV2Utils-D5SpeZ3C.js +1 -0
  372. package/dist/chunks/logout-C2QuTBdS.js +1 -0
  373. package/dist/chunks/magicDocs-CUXKi-Wv.js +57 -0
  374. package/dist/chunks/main-CFhpWtpC.js +1420 -0
  375. package/dist/chunks/main-sboa5RKc.js +31 -0
  376. package/dist/chunks/mappers-DLkk0PZz.js +1 -0
  377. package/dist/chunks/mcp-C2f6IgAp.js +2 -0
  378. package/dist/chunks/mcp-Djui9m3_.js +6 -0
  379. package/dist/chunks/mcp-DvTSxrJ4.js +1 -0
  380. package/dist/chunks/mcpServer-DMA0bdFC.js +1 -0
  381. package/dist/chunks/mcpServer-DxEHfW2v.js +1 -0
  382. package/dist/chunks/memoize-Bg2dXTzV.js +1 -0
  383. package/dist/chunks/memoize-DNnuA2aU.js +1 -0
  384. package/dist/chunks/memory-B9io9Zcv.js +1 -0
  385. package/dist/chunks/mobile-CPnnvkQV.js +2 -0
  386. package/dist/chunks/modalContext-B1b0Gsro.js +1 -0
  387. package/dist/chunks/mode-BDgwh_Xb.js +2 -0
  388. package/dist/chunks/model-B6cpEh-s.js +1 -0
  389. package/dist/chunks/model-BcunOCC9.js +1 -0
  390. package/dist/chunks/modelOptions-CHUHQ9WG.js +1 -0
  391. package/dist/chunks/normalization-cjPqid31.js +1 -0
  392. package/dist/chunks/oauth-CnBLewrU.js +1 -0
  393. package/dist/chunks/oauth-DMPGYAoZ.js +1 -0
  394. package/dist/chunks/observationStore-DVBxrSdI.js +4 -0
  395. package/dist/chunks/onChangeAppState-M61XDN6V.js +1 -0
  396. package/dist/chunks/open-CsUNPSNx.js +1 -0
  397. package/dist/chunks/openai-BHvlYW3m.js +2 -0
  398. package/dist/chunks/output-style-BtKuBrs4.js +1 -0
  399. package/dist/chunks/outputStyles-hHuIBkRB.js +84 -0
  400. package/dist/chunks/overageCreditGrant-BLFT-rF3.js +1 -0
  401. package/dist/chunks/p-map-C-WNcN6g.js +1 -0
  402. package/dist/chunks/p-map-CQ2NythB.js +1 -0
  403. package/dist/chunks/package-9IAs5Qf0.js +1 -0
  404. package/dist/chunks/panel-27xLZI7c.js +1 -0
  405. package/dist/chunks/panel-NoDfShEZ.js +1 -0
  406. package/dist/chunks/panelCall-CEOWVNCM.js +1 -0
  407. package/dist/chunks/parseConnectUrl-CxU4IX9o.js +1 -0
  408. package/dist/chunks/parser-DGlAnaNj.js +1 -0
  409. package/dist/chunks/parser-DGoLe2RS.js +1 -0
  410. package/dist/chunks/passes-CExcqu66.js +1 -0
  411. package/dist/chunks/path-uaxlnhva.js +1 -0
  412. package/dist/chunks/permissions-B3PceQul.js +1 -0
  413. package/dist/chunks/permissions-DezIL2xF.js +3 -0
  414. package/dist/chunks/permissions-DnpI8Whh.js +1 -0
  415. package/dist/chunks/pipeTransport-CB_Wq_Kx.js +1 -0
  416. package/dist/chunks/plan-cfZBclh9.js +1 -0
  417. package/dist/chunks/platform-BXz_rgpy.js +2 -0
  418. package/dist/chunks/plist-DLGDWBD6.js +6 -0
  419. package/dist/chunks/plugin-CuhENLRs.js +1 -0
  420. package/dist/chunks/pluginAutoupdate-wTeOXfQe.js +1 -0
  421. package/dist/chunks/pluginBlocklist-D6pkKfXr.js +1 -0
  422. package/dist/chunks/pluginCliCommands-DqxdCwsq.js +1 -0
  423. package/dist/chunks/pluginFlagging-CjH48f-K.js +1 -0
  424. package/dist/chunks/pluginOperations-DMFYB3pK.js +2 -0
  425. package/dist/chunks/pluginStartupCheck-BW3_KfZz.js +1 -0
  426. package/dist/chunks/pluginStartupCheck-Cj2BMjVw.js +1 -0
  427. package/dist/chunks/plugins-CarsG2v8.js +4 -0
  428. package/dist/chunks/policyLimits-DFn1vHkN.js +1 -0
  429. package/dist/chunks/pollConfig-C8nODJY1.js +1 -0
  430. package/dist/chunks/poller-DXZJ-dUP.js +1 -0
  431. package/dist/chunks/poor-C7GQ4a5X.js +1 -0
  432. package/dist/chunks/poorMode-CBe0rfxB.js +1 -0
  433. package/dist/chunks/poorMode-CbZTudtw.js +1 -0
  434. package/dist/chunks/postCommitAttribution--vvAWIqD.js +1 -0
  435. package/dist/chunks/print-CwwtGSbK.js +114 -0
  436. package/dist/chunks/privacy-settings-Bz8cAVp5.js +11 -0
  437. package/dist/chunks/privacyLevel-CRCHhztk.js +1 -0
  438. package/dist/chunks/process-CnhUplBr.js +1 -0
  439. package/dist/chunks/process-X4vCP9x0.js +1 -0
  440. package/dist/chunks/processBashCommand-NL0YEUqW.js +3 -0
  441. package/dist/chunks/processSlashCommand-FPMWElsI.js +6 -0
  442. package/dist/chunks/processSlashCommand-_oJs6_w8.js +6 -0
  443. package/dist/chunks/processUserInput-QAJK0XSn.js +1 -0
  444. package/dist/chunks/projectContext-B21hXj9q.js +1 -0
  445. package/dist/chunks/projectContext-DbTQHQS3.js +1 -0
  446. package/dist/chunks/prompt-C6eleu4x.js +1 -0
  447. package/dist/chunks/prompt-CUdoQXyN.js +1 -0
  448. package/dist/chunks/prompt-CsBCtw4l.js +228 -0
  449. package/dist/chunks/prompt-hnIDYhP4.js +54 -0
  450. package/dist/chunks/promptEditor-CrlVcc17.js +4 -0
  451. package/dist/chunks/protectedNamespace-Cn4901XG.js +1 -0
  452. package/dist/chunks/protocolHandler-DM_w7sJ5.js +13 -0
  453. package/dist/chunks/protocols-CpoQzjyI.js +7 -0
  454. package/dist/chunks/proxy-9WvtUy8E.js +99 -0
  455. package/dist/chunks/rate-limit-options-BehQ3MoX.js +1 -0
  456. package/dist/chunks/rcDebugLog-BbHlIxCm.js +11 -0
  457. package/dist/chunks/referral-BfAZEIZL.js +1 -0
  458. package/dist/chunks/refresh-Bl3Miver.js +1 -0
  459. package/dist/chunks/registerProtocol-BHZ3vZED.js +36 -0
  460. package/dist/chunks/registerSkillHooks-BR7v5qDA.js +1 -0
  461. package/dist/chunks/registry-C2igpRd-.js +1 -0
  462. package/dist/chunks/release-notes-C_Cou6ye.js +4 -0
  463. package/dist/chunks/releaseNotes-DveQShyB.js +2 -0
  464. package/dist/chunks/reload-plugins-D-pAUoB5.js +1 -0
  465. package/dist/chunks/remote-env-C_dBgbgo.js +1 -0
  466. package/dist/chunks/remoteBridgeCore-BxWhTy1u.js +1 -0
  467. package/dist/chunks/remoteControlServer-D3OjUlB-.js +3 -0
  468. package/dist/chunks/rename-f3m0ETSt.js +1 -0
  469. package/dist/chunks/renderOptions-QZLxGnh_.js +1 -0
  470. package/dist/chunks/replBridge-qeVmCJOb.js +1 -0
  471. package/dist/chunks/resume-CM_8p9Iu.js +2 -0
  472. package/dist/chunks/rewind-0cB7o6fx.js +1 -0
  473. package/dist/chunks/ripgrep-BEWqxrpl.js +5 -0
  474. package/dist/chunks/ripgrep-G82m12Ng.js +1 -0
  475. package/dist/chunks/rollback-CVo2gqgR.js +11 -0
  476. package/dist/chunks/runtimeObserver-1EdvvoYw.js +1 -0
  477. package/dist/chunks/runtimeObserver-CX6vepq9.js +10 -0
  478. package/dist/chunks/sandbox-adapter-DzHfW2tH.js +1 -0
  479. package/dist/chunks/sandbox-toggle-N6KgmH2T.js +1 -0
  480. package/dist/chunks/sanitization-CIBpY9KT.js +1 -0
  481. package/dist/chunks/satisfies-B7ZvBUQP.js +1 -0
  482. package/dist/chunks/schemas-Bwt-7U5W.js +40 -0
  483. package/dist/chunks/sdk-Drp69kIx.js +1 -0
  484. package/dist/chunks/sdkHeapDumpMonitor-B9GVkISU.js +1 -0
  485. package/dist/chunks/searchExtraTools-BphNJsl8.js +1 -0
  486. package/dist/chunks/semver-BsItM2Z4.js +1 -0
  487. package/dist/chunks/semver-D3lOjiBN.js +1 -0
  488. package/dist/chunks/sentry-ySzRCXGd.js +1 -0
  489. package/dist/chunks/server-C8nMDji6.js +1 -0
  490. package/dist/chunks/server-XZG51Slr.js +1 -0
  491. package/dist/chunks/serverBanner-D68EBGzH.js +1 -0
  492. package/dist/chunks/serverLog-hv2hc5US.js +1 -0
  493. package/dist/chunks/session-CVoGFb8a.js +2 -0
  494. package/dist/chunks/sessionDataUploader-BaD1Q7v3.js +1 -0
  495. package/dist/chunks/sessionDiscovery-D7g66TX6.js +1 -0
  496. package/dist/chunks/sessionFileAccessHooks-9lPjspRX.js +1 -0
  497. package/dist/chunks/sessionManager-BhOjMNAP.js +1 -0
  498. package/dist/chunks/sessionMemory-BA6cdxqP.js +1 -0
  499. package/dist/chunks/sessionMemory-CtEhIRGF.js +1 -0
  500. package/dist/chunks/sessionMemoryUtils-D_B92ypa.js +1 -0
  501. package/dist/chunks/sessionObserver-CESI-uVZ.js +1 -0
  502. package/dist/chunks/sessionObserver-SpE_eglb.js +20 -0
  503. package/dist/chunks/sessionRestore-DqsqYK4K.js +1 -0
  504. package/dist/chunks/sessionState-Dgky34M4.js +1 -0
  505. package/dist/chunks/sessionStorage-DJb5HKhQ.js +1 -0
  506. package/dist/chunks/sessionStorage-DSMfHTcg.js +1 -0
  507. package/dist/chunks/sessionStoragePortable-DyM_hZnp.js +3 -0
  508. package/dist/chunks/sessionTitle-Bzxk_EW9.js +14 -0
  509. package/dist/chunks/sessionTracing-DR8O0686.js +12 -0
  510. package/dist/chunks/setup-BHNS9sBS.js +9 -0
  511. package/dist/chunks/setup-BafJxZ0F.js +4 -0
  512. package/dist/chunks/setup-MLNNYLi6.js +1 -0
  513. package/dist/chunks/shadowedRuleDetection-Ch9gTxfD.js +1 -0
  514. package/dist/chunks/shellQuote-3s6tV-hK.js +1 -0
  515. package/dist/chunks/sideQuestion-BBn6XIOD.js +20 -0
  516. package/dist/chunks/signal-BTxmab6r.js +1 -0
  517. package/dist/chunks/signin-ChbUAEGq.js +1 -0
  518. package/dist/chunks/sink-B1qICbRh.js +1 -0
  519. package/dist/chunks/sink-yBIcxQf1.js +1 -0
  520. package/dist/chunks/sinks-C7weduDR.js +1 -0
  521. package/dist/chunks/skill-learning-08nEdOJ2.js +5 -0
  522. package/dist/chunks/skillGapStore-CuvWGqFb.js +5 -0
  523. package/dist/chunks/skillGapStore-DmMuDXKO.js +1 -0
  524. package/dist/chunks/skillGenerator-mEMjcmmm.js +8 -0
  525. package/dist/chunks/skillLearning-B3a-8Ys3.js +1 -0
  526. package/dist/chunks/skillLearning-q5T6o0mH.js +1 -0
  527. package/dist/chunks/skillPanel-BuUMhONI.js +28 -0
  528. package/dist/chunks/skillSearchPanel-BUEv7Sm9.js +21 -0
  529. package/dist/chunks/skillUsageTracking-BBTiWOKB.js +1 -0
  530. package/dist/chunks/skills-DvQuQfDW.js +1 -0
  531. package/dist/chunks/slashCommandParsing-BkTC3GRb.js +1 -0
  532. package/dist/chunks/sleep-CC8jykQd.js +1 -0
  533. package/dist/chunks/slowOperations-niPqC54V.js +1 -0
  534. package/dist/chunks/sprites-C5X62Vyh.js +1 -0
  535. package/dist/chunks/src-58uAJYF_.js +6 -0
  536. package/dist/chunks/src-7Y8fx6gl.js +2 -0
  537. package/dist/chunks/src-BuserDTl.js +1 -0
  538. package/dist/chunks/src-CMY4XoRy.js +1 -0
  539. package/dist/chunks/src-CfeAM1FB.js +1 -0
  540. package/dist/chunks/src-CxT2FDXy.js +1 -0
  541. package/dist/chunks/src-CyQf7rVu.js +26 -0
  542. package/dist/chunks/src-DJLbU8sT.js +1 -0
  543. package/dist/chunks/src-DJQlyVK6.js +5 -0
  544. package/dist/chunks/src-DNHWYkls.js +53 -0
  545. package/dist/chunks/src-DU_g0n_Q.js +1 -0
  546. package/dist/chunks/src-DhqzQjMg.js +19 -0
  547. package/dist/chunks/src-Duzv1Znh.js +1 -0
  548. package/dist/chunks/src-OBx6GAig.js +1 -0
  549. package/dist/chunks/src-WjnK2Dbo.js +1 -0
  550. package/dist/chunks/src-hjAMxWFj.js +7 -0
  551. package/dist/chunks/src-lLwoqdC0.js +9 -0
  552. package/dist/chunks/src-yRsWbJp_.js +2 -0
  553. package/dist/chunks/sso-oidc-yfC-A2A2.js +1 -0
  554. package/dist/chunks/startupProfiler-4P7GdVw6.js +3 -0
  555. package/dist/chunks/startupProfiler-CipS0otN.js +1 -0
  556. package/dist/chunks/state-9wSimHaL.js +1 -0
  557. package/dist/chunks/state-BQkyHx88.js +1 -0
  558. package/dist/chunks/state-CEAUTY3A.js +1 -0
  559. package/dist/chunks/state-CUZTq6r0.js +1 -0
  560. package/dist/chunks/state-U0HNbTx8.js +1 -0
  561. package/dist/chunks/staticRender-BB3CisKd.js +1 -0
  562. package/dist/chunks/stats-Dyi2U_mq.js +1 -0
  563. package/dist/chunks/status-CSL-GMou.js +1 -0
  564. package/dist/chunks/statusNoticeHelpers-BaXE951d.js +1 -0
  565. package/dist/chunks/stdio-BuUJYJFs.js +3 -0
  566. package/dist/chunks/stdio-iX0TTmbp.js +1 -0
  567. package/dist/chunks/stickers-2CRSckfH.js +1 -0
  568. package/dist/chunks/store-DdfsZvtr.js +1 -0
  569. package/dist/chunks/stringUtils-U7kMYMJq.js +4 -0
  570. package/dist/chunks/sts-CJmdeT7s.js +1 -0
  571. package/dist/chunks/subprocessEnv-DKTILev5.js +1 -0
  572. package/dist/chunks/subprocessEnv-WjRguKWf.js +1 -0
  573. package/dist/chunks/supports-color-DaytqqjM.js +1 -0
  574. package/dist/chunks/systemPromptSections-BnrxBWdc.js +1 -0
  575. package/dist/chunks/systemPromptSections-Dk6azdAb.js +1 -0
  576. package/dist/chunks/systemTheme-C1GNqIfy.js +1 -0
  577. package/dist/chunks/tag-C4cH016L.js +11 -0
  578. package/dist/chunks/tasks-CEdUW3RQ.js +1 -0
  579. package/dist/chunks/teamHelpers-CTA_CtTT.js +1 -0
  580. package/dist/chunks/teamHelpers-D65qZInv.js +1 -0
  581. package/dist/chunks/teammate-C-FiRloZ.js +1 -0
  582. package/dist/chunks/teammateModeSnapshot-DWRG5-Us.js +1 -0
  583. package/dist/chunks/teammateModeSnapshot-DtgsNj1G.js +1 -0
  584. package/dist/chunks/teleport-C_UgMy0V.js +1 -0
  585. package/dist/chunks/templateJobs-CMbS0tuk.js +12 -0
  586. package/dist/chunks/terminalSetup--jwGVap8.js +33 -0
  587. package/dist/chunks/terminalSetup-zID-wokH.js +1 -0
  588. package/dist/chunks/theme-C6XwTpVy.js +1 -0
  589. package/dist/chunks/thinkback-CVLnmLAT.js +1 -0
  590. package/dist/chunks/thinkback-MeOOO7gf.js +1 -0
  591. package/dist/chunks/thinkback-play-D7G260F4.js +1 -0
  592. package/dist/chunks/tmux-DtYJuTWh.js +1 -0
  593. package/dist/chunks/toolEventObserver-BtC9xDYY.js +1 -0
  594. package/dist/chunks/toolEventObserver-MfsHAt8h.js +1 -0
  595. package/dist/chunks/toolPool-CEi_2xIH.js +1 -0
  596. package/dist/chunks/toolPool-CdYJcCnc.js +1 -0
  597. package/dist/chunks/trustedDevice-CjQTGAa4.js +1 -0
  598. package/dist/chunks/trustedDevice-DADcxAAs.js +1 -0
  599. package/dist/chunks/tui-B8Ijq4Pk.js +6 -0
  600. package/dist/chunks/turndown.es-T-Xe93nc.js +69 -0
  601. package/dist/chunks/types-BVelRhgb.js +17 -0
  602. package/dist/chunks/types-Bqp3meR4.js +1 -0
  603. package/dist/chunks/types-CNmINIu3.js +1 -0
  604. package/dist/chunks/types-DgzOOCDl.js +3 -0
  605. package/dist/chunks/udsClient-ClY_0CKr.js +1 -0
  606. package/dist/chunks/ultrareviewCommand-CqvHj9Io.js +3 -0
  607. package/dist/chunks/undercover-CVCVOSrs.js +1 -0
  608. package/dist/chunks/undercover-CbxiJO2b.js +31 -0
  609. package/dist/chunks/up-CBJhVVbd.js +12 -0
  610. package/dist/chunks/updateCCB-DPPpquAw.js +11 -0
  611. package/dist/chunks/upgrade-DaaHOvft.js +1 -0
  612. package/dist/chunks/upgrade-k7ZvAWZ0.js +1 -0
  613. package/dist/chunks/upload-CEDxwMa1.js +1 -0
  614. package/dist/chunks/upstreamproxy-BtGJ2LRi.js +11 -0
  615. package/dist/chunks/usage-CsUSu4fb.js +1 -0
  616. package/dist/chunks/usage-oABvixCs.js +1 -0
  617. package/dist/chunks/useExitOnCtrlCDWithKeybindings-CBce_-hb.js +1 -0
  618. package/dist/chunks/useExitOnCtrlCDWithKeybindings-CLYjTZXb.js +1 -0
  619. package/dist/chunks/useKeybinding-DAQL_dB_.js +1 -0
  620. package/dist/chunks/useMainLoopModel-QC_H3esG.js +1 -0
  621. package/dist/chunks/useManageMCPConnections-bf-VfJGD.js +1 -0
  622. package/dist/chunks/useManagePlugins-CXdYUpit.js +1 -0
  623. package/dist/chunks/useMergedTools-DERzhQOJ.js +1 -0
  624. package/dist/chunks/useSearchInput-nqhdILI2.js +1 -0
  625. package/dist/chunks/useTerminalSize-DzV4aaTi.js +1 -0
  626. package/dist/chunks/useVoice-CO69xtWC.js +1 -0
  627. package/dist/chunks/util-C8wqPqv0.js +1 -0
  628. package/dist/chunks/utils-CDFsSXHr.js +1 -0
  629. package/dist/chunks/utils-ZO5TryVH.js +1 -0
  630. package/dist/chunks/v4-DLhvDPkt.js +1 -0
  631. package/dist/chunks/validatePlugin-C4cd71Yz.js +1 -0
  632. package/dist/chunks/vertex-sdk-CC3U26o7.js +9 -0
  633. package/dist/chunks/vim-BNiQx5Vf.js +1 -0
  634. package/dist/chunks/voice-BCbnJzYL.js +8 -0
  635. package/dist/chunks/voice-BJyz9KZO.js +8 -0
  636. package/dist/chunks/voice-CP2ULpju.js +2 -0
  637. package/dist/chunks/voiceModeEnabled-C-pa8B3Q.js +1 -0
  638. package/dist/chunks/voiceModeEnabled-CMtRN2pa.js +1 -0
  639. package/dist/chunks/voiceStreamSTT-31b2u0rj.js +1 -0
  640. package/dist/chunks/voiceStreamSTT-Fkhm6Ftg.js +1 -0
  641. package/dist/chunks/voiceStreamSTT-sI-hg-aP.js +1 -0
  642. package/dist/chunks/web-tools-CLmlPgLk.js +1 -0
  643. package/dist/chunks/which-C0ex-06E.js +1 -0
  644. package/dist/chunks/windowsPaths-C5TNvKYu.js +1 -0
  645. package/dist/chunks/windowsPaths-Kue_7s52.js +1 -0
  646. package/dist/chunks/workSecret-Dh5Ayceu.js +1 -0
  647. package/dist/chunks/workerRegistry-B5iWYqpK.js +1 -0
  648. package/dist/chunks/worktree-BypJA0GB.js +1 -0
  649. package/dist/chunks/worktreeModeEnabled-DPTdK3JV.js +1 -0
  650. package/dist/chunks/worktreeModeEnabled-Dtrcn7eD.js +1 -0
  651. package/dist/chunks/wrapper-BDPb4PTV.js +6 -0
  652. package/dist/chunks/wrapper-DRTs77RK.js +1 -0
  653. package/dist/chunks/xdg-BaVL-FHd.js +1 -0
  654. package/dist/chunks/xml-E8VMPwdJ.js +1 -0
  655. package/dist/chunks/zod-B_P2Eo_D.js +1 -0
  656. package/dist/cli-bun.js +2 -0
  657. package/dist/cli-node.js +2 -0
  658. package/dist/cli.js +2 -0
  659. package/dist/vendor/audio-capture/arm64-darwin/audio-capture.node +0 -0
  660. package/dist/vendor/audio-capture/arm64-linux/audio-capture.node +0 -0
  661. package/dist/vendor/audio-capture/arm64-win32/audio-capture.node +0 -0
  662. package/dist/vendor/audio-capture/x64-darwin/audio-capture.node +0 -0
  663. package/dist/vendor/audio-capture/x64-linux/audio-capture.node +0 -0
  664. package/dist/vendor/audio-capture/x64-win32/audio-capture.node +0 -0
  665. package/dist/vendor/ripgrep/x64-win32/rg.exe +0 -0
  666. package/package.json +233 -0
  667. package/scripts/postinstall.cjs +389 -0
  668. package/scripts/run-parallel.mjs +10 -0
  669. package/scripts/setup-chrome-mcp.mjs +70 -0
@@ -0,0 +1,32 @@
1
+ import{a as e,n as t,o as n,r}from"./chunk-DR8-3Aex.js";import{a as i,i as a,n as o,o as s,r as c,t as l}from"./isObject-DaxDnPKm.js";import{g as u,h as d,l as f,n as p,t as m,u as ee}from"./memoize-DNnuA2aU.js";import{a as te,c as ne,f as re,l as ie,n as h,s as g,t as ae,u as _}from"./envUtils-CFG7IQID.js";import{t as oe}from"./client-BWED8Tbu.js";import{n as se,t as v}from"./defineProperty-CaCI0a5T.js";import{_ as ce,d as le,h as ue,n as de,o as fe,r as pe,s as me}from"./esm-BwzC0MQp.js";import{B as he,D as ge,Q as _e,Tt as ve,V as ye,Z as be,_ as xe,a as Se,c as Ce,d as we,j as Te,jt as Ee,o as De,t as Oe,u as ke,x as Ae,z as je}from"./esm-BtC6CMmM.js";import{i as Me,r as Ne,t as Pe}from"./esm-BFnjHW38.js";import{n as Fe,t as Ie}from"./axios-Zh7qGPze.js";import{Cn as y,En as Le,In as Re,Ln as b,Mn as x,Mr as ze,St as Be,Tt as S,Xn as Ve,Yn as C,kn as He,kt as w,ln as Ue,un as T,vt as E,wn as D,zt as We}from"./schemas-Bwt-7U5W.js";import{a as Ge,n as Ke,o as qe,t as Je}from"./v4-DLhvDPkt.js";import{Bn as Ye,In as Xe,Ln as Ze,zn as Qe}from"./src-DNHWYkls.js";import{i as $e,r as et}from"./isSymbol-D7QeUnS5.js";import{C as tt,D as nt,H as rt,J as it,M as at,N as ot,O as st,P as ct,Q as lt,S as ut,V as dt,X as ft,Y as pt,Z as mt,_ as ht,_t as gt,b as _t,bt as vt,ct as yt,d as bt,dt as xt,f as St,ft as Ct,g as wt,gt as Tt,h as Et,ht as Dt,it as Ot,j as kt,l as At,lt as jt,m as Mt,p as Nt,q as Pt,rt as Ft,st as It,u as Lt,ut as Rt,v as zt,vt as Bt,w as Vt,x as Ht,y as Ut,yt as Wt}from"./signal-BTxmab6r.js";import{D as Gt,E as Kt,G as qt,H as Jt,Ht as O,I as Yt,K as Xt,M as Zt,N as k,Pt as Qt,Y as $t,at as en,b as tn,ct as nn,et as rn,g as an,h as on,in as sn,jn as cn,mn as ln,q as un,qt as dn}from"./state-CUZTq6r0.js";import{$ as fn,A as pn,B as mn,Ct as hn,D as gn,Dt as _n,E as vn,Et as yn,G as bn,J as xn,K as Sn,N as Cn,O as A,Ot as wn,Q as Tn,St as En,T as Dn,Tt as On,U as kn,_ as An,_t as jn,at as Mn,bt as Nn,ct as Pn,d as Fn,dt as In,f as Ln,ft as Rn,gt as zn,h as j,ht as Bn,it as Vn,l as M,lt as Hn,mt as Un,ot as Wn,p as N,pt as Gn,st as Kn,ut as qn,vt as Jn,wt as Yn,x as Xn,xt as Zn,yt as Qn,z as $n}from"./debug-CjIaNjpK.js";import{n as er,t as tr}from"./cwd-B2guYBbl.js";import{L as nr,tt as rr,x as ir}from"./state-BQkyHx88.js";import{t as ar}from"./sdk-Drp69kIx.js";import{M as or,h as sr,j as cr,n as lr,t as ur,v as dr}from"./git-Bj8Ow4pJ.js";import{n as fr,r as pr,t as mr}from"./execa-BMaINL7N.js";import{i as hr,n as gr,r as _r,t as vr}from"./privacyLevel-CRCHhztk.js";import{o as yr,s as P}from"./log-DVv8YiNo.js";import{a as br,i as xr,n as Sr,r as Cr,t as wr}from"./execFileNoThrow-DdmR1mBS.js";import{r as Tr,t as Er}from"./memoize-Bg2dXTzV.js";import{a as Dr,i as Or,n as kr,o as Ar,r as jr}from"./platform-BXz_rgpy.js";import{m as Mr}from"./sessionStoragePortable-DyM_hZnp.js";import{a as Nr,i as Pr,n as Fr}from"./path-uaxlnhva.js";import{a as Ir,l as Lr,m as Rr,p as zr,r as Br,s as Vr,u as Hr}from"./types-BVelRhgb.js";import{A as Ur,C as Wr,D as Gr,O as Kr,T as qr,a as Jr,b as Yr,f as Xr,i as Zr,l as Qr,t as $r,w as ei,x as ti}from"./teammate-C-FiRloZ.js";import{a as ni,c as ri,d as ii,f as F,t as ai}from"./stringUtils-U7kMYMJq.js";import{a as oi,n as si,r as I}from"./analytics-i6X1et4O.js";import{n as ci,r as li}from"./startupProfiler-4P7GdVw6.js";import{n as L,t as ui}from"./lazySchema-2sOku3cX.js";import{f as di,l as fi,m as pi,n as mi,r as hi,s as gi,t as _i,u as vi}from"./oauth-DMPGYAoZ.js";import{n as yi,t as bi}from"./bundledMode-DQNSSQbt.js";import{a as xi,i as Si,n as Ci,r as R,t as wi}from"./env-CesrOJJq.js";import{i as Ti,r as Ei,t as Di}from"./permissions-DnpI8Whh.js";import{n as Oi,t as ki}from"./normalization-cjPqid31.js";import{C as Ai,_ as ji,a as Mi,b as Ni,h as Pi,m as Fi,u as Ii,v as Li,x as Ri}from"./proxy-9WvtUy8E.js";import{n as zi,t as Bi}from"./sleep-CC8jykQd.js";import{i as Vi,t as Hi}from"./genericProcessUtils-BFJMxLqn.js";import{i as Ui,o as Wi}from"./common-HfKcqOYK.js";import{n as Gi,r as Ki}from"./log-B-Nj3Yed.js";import{homedir as qi,userInfo as Ji}from"os";import*as Yi from"path";import{basename as Xi,dirname as Zi,isAbsolute as Qi,join as z,normalize as $i,relative as ea,resolve as ta,sep as na}from"path";import{chmodSync as ra,existsSync as ia,mkdirSync as aa,readFileSync as oa,unwatchFile as sa,watchFile as ca,writeFileSync as la}from"fs";import{createHash as ua,randomBytes as da,randomUUID as fa}from"crypto";import{appendFile as pa,mkdir as ma,readFile as ha,readdir as ga,stat as _a,unlink as va,writeFile as ya}from"fs/promises";import{exec as ba,execFile as xa}from"child_process";import{AsyncLocalStorage as Sa}from"async_hooks";function Ca(){return Ka}function wa(e){let t=2166136261,n=e.length;for(let r=0;r<n;r++)t^=e.charCodeAt(r),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return t>>>0}function Ta(e,t,n){return n===2?wa(wa(e+t)+``)%1e4/1e4:n===1?wa(t+e)%1e3/1e3:null}function Ea(e){return e<=0?[]:Array(e).fill(1/e)}function Da(e,t){return e>=t[0]&&e<t[1]}function Oa(e,t){let n=Ta(`__`+t[0],e,1);return n===null?!1:n>=t[1]&&n<t[2]}function ka(e,t){for(let n=0;n<t.length;n++)if(Da(e,t[n]))return n;return-1}function Aa(e){try{let t=e.replace(/([^\\])\//g,`$1\\/`);return new RegExp(t)}catch(e){console.error(e);return}}function ja(e,t){if(!t.length)return!1;let n=!1,r=!1;for(let i=0;i<t.length;i++){let a=Pa(e,t[i].type,t[i].pattern);if(t[i].include===!1){if(a)return!1}else n=!0,a&&(r=!0)}return r||!n}function Ma(e,t,n){try{let r=t.replace(/[*.+?^${}()|[\]\\]/g,`\\$&`).replace(/_____/g,`.*`);return n&&(r=`\\/?`+r.replace(/(^\/|\/$)/g,``)+`\\/?`),RegExp(`^`+r+`$`,`i`).test(e)}catch{return!1}}function Na(e,t){try{let n=new URL(t.replace(/^([^:/?]*)\./i,`https://$1.`).replace(/\*/g,`_____`),`https://_____`),r=[[e.host,n.host,!1],[e.pathname,n.pathname,!0]];return n.hash&&r.push([e.hash,n.hash,!1]),n.searchParams.forEach((t,n)=>{r.push([e.searchParams.get(n)||``,t,!1])}),!r.some(e=>!Ma(e[0],e[1],e[2]))}catch{return!1}}function Pa(e,t,n){try{let r=new URL(e,`https://_`);if(t===`regex`){let e=Aa(n);return e?e.test(r.href)||e.test(r.href.substring(r.origin.length)):!1}else if(t===`simple`)return Na(r,n);return!1}catch{return!1}}function Fa(e,t,n){t=t===void 0?1:t,t<0?t=0:t>1&&(t=1);let r=Ea(e);n=n||r,n.length!==e&&(n=r);let i=n.reduce((e,t)=>t+e,0);(i<.99||i>1.01)&&(n=r);let a=0;return n.map(e=>{let n=a;return a+=e,[n,n+t*e]})}function Ia(e,t,n){if(!t)return null;let r=t.split(`?`)[1];if(!r)return null;let i=r.replace(/#.*/,``).split(`&`).map(e=>e.split(`=`,2)).filter(([t])=>t===e).map(([,e])=>parseInt(e));return i.length>0&&i[0]>=0&&i[0]<n?i[0]:null}function La(e){try{return e()}catch(e){return console.error(e),!1}}async function Ra(e,t,n){if(t=t||``,n=n||globalThis.crypto&&globalThis.crypto.subtle||Ka.SubtleCrypto,!n)throw Error(`No SubtleCrypto implementation found`);try{let r=await n.importKey(`raw`,qa(t),{name:`AES-CBC`,length:128},!0,[`encrypt`,`decrypt`]),[i,a]=e.split(`.`),o=await n.decrypt({name:`AES-CBC`,iv:qa(i)},r,qa(a));return new TextDecoder().decode(o)}catch{throw Error(`Failed to decrypt`)}}function za(e){return typeof e==`string`?e:JSON.stringify(e)}function Ba(e){typeof e==`number`&&(e+=``),(!e||typeof e!=`string`)&&(e=`0`);let t=e.replace(/(^v|\+.*$)/g,``).split(/[-.]/);return t.length===3&&t.push(`~`),t.map(e=>e.match(/^[0-9]+$/)?e.padStart(5,` `):e).join(`-`)}function Va(){let e;try{e=`1.6.5`}catch{e=``}return e}function Ha(e,t){let n,r;try{n=new URL(e),r=new URL(t)}catch(e){return console.error(`Unable to merge query strings: ${e}`),t}return n.searchParams.forEach((e,t)=>{r.searchParams.has(t)||r.searchParams.set(t,e)}),r.toString()}function Ua(e){return typeof e==`object`&&!!e}function Wa(e){return e.urlPatterns&&e.variations.some(e=>Ua(e)&&`urlRedirect`in e)?`redirect`:e.variations.some(e=>Ua(e)&&(e.domMutations||`js`in e||`css`in e))?`visual`:`unknown`}async function Ga(e,t){return new Promise(n=>{let r=!1,i,a=e=>{r||(r=!0,i&&clearTimeout(i),n(e||null))};t&&(i=setTimeout(()=>a(),t)),e.then(e=>a(e)).catch(()=>a())})}var Ka,qa,Ja=t((()=>{Ka={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource},qa=e=>Uint8Array.from(atob(e),e=>e.charCodeAt(0))}));function Ya(e){Object.assign(B,e),B.backgroundSync||go()}async function Xa({instance:e,timeout:t,skipCache:n,allowStale:r,backgroundSync:i}){return i||(B.backgroundSync=!1),no({instance:e,allowStale:r,timeout:t,skipCache:n})}function Za(e){let t=ro(e),n=bo.get(t)||new Set;n.add(e),bo.set(t,n)}function Qa(e){bo.forEach(t=>t.delete(e))}function $a(){wo.forEach(e=>{e&&(e.state=`idle`,po(e))})}function eo(){wo.forEach(e=>{e&&e.state===`idle`&&mo(e)})}async function to(){try{if(!vo.localStorage)return;await vo.localStorage.setItem(B.cacheKey,JSON.stringify(Array.from(So.entries())))}catch{}}async function no({instance:e,allowStale:t,timeout:n,skipCache:r}){let i=ro(e),a=io(e),o=new Date,s=new Date(o.getTime()-B.maxAge+B.staleTTL);await ao();let c=!B.disableCache&&!r?So.get(a):void 0;return c&&(t||c.staleAt>o)&&c.staleAt>s?(c.sse&&To.add(i),c.staleAt<o?lo(e):uo(e),{data:c.data,success:!0,source:`cache`}):await Ga(lo(e),n)||{data:null,success:!1,source:`timeout`,error:Error(`Timeout`)}}function ro(e){let[t,n]=e.getApiInfo();return`${t}||${n}`}function io(e){let t=ro(e);if(!(`isRemoteEval`in e)||!e.isRemoteEval())return t;let n=e.getAttributes(),r=e.getCacheKeyAttributes()||Object.keys(e.getAttributes()),i={};r.forEach(e=>{i[e]=n[e]});let a=e.getForcedVariations(),o=e.getUrl();return`${t}||${JSON.stringify({ca:i,fv:a,url:o})}`}async function ao(){if(!xo){xo=!0;try{if(vo.localStorage){let e=await vo.localStorage.getItem(B.cacheKey);if(!B.disableCache&&e){let t=JSON.parse(e);t&&Array.isArray(t)&&t.forEach(([e,t])=>{So.set(e,{...t,staleAt:new Date(t.staleAt)})}),oo()}}}catch{}if(!B.disableIdleStreams){let e=yo.startIdleListener();e&&(yo.stopIdleListener=e)}}}function oo(){let e=Array.from(So.entries()).map(([e,t])=>({key:e,staleAt:t.staleAt.getTime()})).sort((e,t)=>e.staleAt-t.staleAt),t=Math.min(Math.max(0,So.size-B.maxEntries),So.size);for(let n=0;n<t;n++)So.delete(e[n].key)}function so(e,t,n){let r=n.dateUpdated||``,i=new Date(Date.now()+B.staleTTL),a=B.disableCache?void 0:So.get(t);if(a&&r&&a.version===r){a.staleAt=i,to();return}B.disableCache||(So.set(t,{data:n,version:r,staleAt:i,sse:To.has(e)}),oo()),to();let o=bo.get(e);o&&o.forEach(e=>co(e,n))}async function co(e,t){await e.setPayload(t||e.getPayload())}async function lo(e){let{apiHost:t,apiRequestHeaders:n}=e.getApiHosts(),r=e.getClientKey(),i=`isRemoteEval`in e&&e.isRemoteEval(),a=ro(e),o=io(e),s=Co.get(o);return s||(s=(i?yo.fetchRemoteEvalCall({host:t,clientKey:r,payload:{attributes:e.getAttributes(),forcedVariations:e.getForcedVariations(),forcedFeatures:Array.from(e.getForcedFeatures().entries()),url:e.getUrl()},headers:n}):yo.fetchFeaturesCall({host:t,clientKey:r,headers:n})).then(e=>{if(!e.ok)throw Error(`HTTP error: ${e.status}`);return e.headers.get(`x-sse-support`)===`enabled`&&To.add(a),e.json()}).then(t=>(so(a,o,t),uo(e),Co.delete(o),{data:t,success:!0,source:`network`})).catch(e=>(Co.delete(o),{data:null,source:`error`,success:!1,error:e})),Co.set(o,s)),s}function uo(e,t=!1){let n=ro(e),r=io(e),{streamingHost:i,streamingHostRequestHeaders:a}=e.getApiHosts(),o=e.getClientKey();if(t&&To.add(n),B.backgroundSync&&To.has(n)&&vo.EventSource){if(wo.has(n))return;let e={src:null,host:i,clientKey:o,headers:a,cb:t=>{try{if(t.type===`features-updated`){let e=bo.get(n);e&&e.forEach(e=>{lo(e)})}else t.type===`features`&&so(n,r,JSON.parse(t.data));e.errors=0}catch{fo(e)}},errors:0,state:`active`};wo.set(n,e),mo(e)}}function fo(e){if(e.state!==`idle`&&(e.errors++,e.errors>3||e.src&&e.src.readyState===2)){let t=3**(e.errors-3)*(1e3+Math.random()*1e3);po(e),setTimeout(()=>{[`idle`,`active`].includes(e.state)||mo(e)},Math.min(t,3e5))}}function po(e){e.src&&(e.src.onopen=null,e.src.onerror=null,e.src.close(),e.src=null,e.state===`active`&&(e.state=`disabled`))}function mo(e){e.src=yo.eventSourceCall({host:e.host,clientKey:e.clientKey,headers:e.headers}),e.state=`active`,e.src.addEventListener(`features`,e.cb),e.src.addEventListener(`features-updated`,e.cb),e.src.onerror=()=>fo(e),e.src.onopen=()=>{e.errors=0}}function ho(e,t){po(e),wo.delete(t)}function go(){To.clear(),wo.forEach(ho),bo.clear(),yo.stopIdleListener()}function _o(e,t){if(t.streaming){if(!e.getClientKey())throw Error(`Must specify clientKey to enable streaming`);t.payload&&uo(e,!0),Za(e)}}var B,vo,yo,bo,xo,So,Co,wo,To,Eo=t((()=>{Ja(),B={staleTTL:1e3*60,maxAge:1e3*60*60*4,cacheKey:`gbFeaturesCache`,backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},vo=Ca(),yo={fetchFeaturesCall:({host:e,clientKey:t,headers:n})=>vo.fetch(`${e}/api/features/${t}`,{headers:n}),fetchRemoteEvalCall:({host:e,clientKey:t,payload:n,headers:r})=>{let i={method:`POST`,headers:{"Content-Type":`application/json`,...r},body:JSON.stringify(n)};return vo.fetch(`${e}/api/eval/${t}`,i)},eventSourceCall:({host:e,clientKey:t,headers:n})=>n?new vo.EventSource(`${e}/sub/${t}`,{headers:n}):new vo.EventSource(`${e}/sub/${t}`),startIdleListener:()=>{let e;if(!(typeof window<`u`&&typeof document<`u`))return;let t=()=>{document.visibilityState===`visible`?(window.clearTimeout(e),eo()):document.visibilityState===`hidden`&&(e=window.setTimeout($a,B.idleStreamInterval))};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(vo.localStorage=globalThis.localStorage)}catch{}bo=new Map,xo=!1,So=new Map,Co=new Map,wo=new Map,To=new Set}));function Do(e){return e===`html`?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[e]}}function Oo(e){var t=as.get(e);return t||(t={element:e,attributes:{}},as.set(e,t)),t}function ko(e,t,n,r,i){var a=n(e),o={isDirty:!1,originalValue:a,virtualValue:a,mutations:[],el:e,_positionTimeout:null,observer:new MutationObserver(function(){if(!(t===`position`&&o._positionTimeout)){t===`position`&&(o._positionTimeout=setTimeout(function(){o._positionTimeout=null},1e3));var r=n(e);t===`position`&&r.parentNode===o.virtualValue.parentNode&&r.insertBeforeNode===o.virtualValue.insertBeforeNode||r!==o.virtualValue&&(o.originalValue=r,i(o))}}),mutationRunner:i,setValue:r,getCurrentValue:n};return t===`position`&&e.parentNode?o.observer.observe(e.parentNode,{childList:!0,subtree:!0,attributes:!1,characterData:!1}):o.observer.observe(e,Do(t)),o}function Ao(e,t){var n=t.getCurrentValue(t.el);t.virtualValue=e,e&&typeof e!=`string`?(!n||e.parentNode!==n.parentNode||e.insertBeforeNode!==n.insertBeforeNode)&&(t.isDirty=!0,Wo()):e!==n&&(t.isDirty=!0,Wo())}function jo(e){var t=e.originalValue;e.mutations.forEach(function(e){return t=e.mutate(t)}),Ao(Vo(t),e)}function Mo(e){var t=new Set(e.originalValue.split(/\s+/).filter(Boolean));e.mutations.forEach(function(e){return e.mutate(t)}),Ao(Array.from(t).filter(Boolean).join(` `),e)}function No(e){var t=e.originalValue;e.mutations.forEach(function(e){return t=e.mutate(t)}),Ao(t,e)}function Po(e){var t=e.parentSelector,n=e.insertBeforeSelector,r=document.querySelector(t);if(!r)return null;var i=n?document.querySelector(n):null;return n&&!i?null:{parentNode:r,insertBeforeNode:i}}function Fo(e){var t=e.originalValue;e.mutations.forEach(function(e){t=Po(e.mutate())||t}),Ao(t,e)}function Io(e){var t=Oo(e);return t.html||(t.html=ko(e,`html`,ss,cs,jo)),t.html}function Lo(e){var t=Oo(e);return t.position||(t.position=ko(e,`position`,ls,us,Fo)),t.position}function Ro(e){var t=Oo(e);return t.classes||(t.classes=ko(e,`class`,fs,ds,Mo)),t.classes}function zo(e,t){var n=Oo(e);return n.attributes[t]||(n.attributes[t]=ko(e,t,ps(t),ms(t),No)),n.attributes[t]}function Bo(e,t){var n=as.get(e);if(n)if(t===`html`){var r,i;(r=n.html)==null||(i=r.observer)==null||i.disconnect(),delete n.html}else if(t===`class`){var a,o;(a=n.classes)==null||(o=a.observer)==null||o.disconnect(),delete n.classes}else if(t===`position`){var s,c;(s=n.position)==null||(c=s.observer)==null||c.disconnect(),delete n.position}else{var l,u,d;(l=n.attributes)==null||(u=l[t])==null||(d=u.observer)==null||d.disconnect(),delete n.attributes[t]}}function Vo(e){return hs||(hs=document.createElement(`div`)),hs.innerHTML=e,hs.innerHTML}function Ho(e,t,n){if(n.isDirty){n.isDirty=!1;var r=n.virtualValue;n.mutations.length||Bo(e,t),n.setValue(e,r)}}function Uo(e,t){e.html&&Ho(t,`html`,e.html),e.classes&&Ho(t,`class`,e.classes),e.position&&Ho(t,`position`,e.position),Object.keys(e.attributes).forEach(function(n){Ho(t,n,e.attributes[n])})}function Wo(){as.forEach(Uo)}function Go(e,t){var n=null;e.kind===`html`?n=Io(t):e.kind===`class`?n=Ro(t):e.kind===`attribute`?n=zo(t,e.attribute):e.kind===`position`&&(n=Lo(t)),n&&(n.mutations.push(e),n.mutationRunner(n))}function Ko(e,t){var n=null;if(e.kind===`html`?n=Io(t):e.kind===`class`?n=Ro(t):e.kind===`attribute`?n=zo(t,e.attribute):e.kind===`position`&&(n=Lo(t)),n){var r=n.mutations.indexOf(e);r!==-1&&n.mutations.splice(r,1),n.mutationRunner(n)}}function qo(e){if(!(e.kind===`position`&&e.elements.size===1)){var t=new Set(e.elements);document.querySelectorAll(e.selector).forEach(function(n){t.has(n)||(e.elements.add(n),Go(e,n))})}}function Jo(e){e.elements.forEach(function(t){return Ko(e,t)}),e.elements.clear(),os.delete(e)}function Yo(){os.forEach(qo)}function Xo(){typeof document>`u`||(gs||(gs=new MutationObserver(function(){Yo()})),Yo(),gs.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))}function Zo(e){return typeof document>`u`?is:(os.add(e),qo(e),{revert:function(){Jo(e)}})}function Qo(e,t){return Zo({kind:`html`,elements:new Set,mutate:t,selector:e})}function $o(e,t){return Zo({kind:`position`,elements:new Set,mutate:t,selector:e})}function es(e,t){return Zo({kind:`class`,elements:new Set,mutate:t,selector:e})}function ts(e,t,n){return rs.test(t)?t===`class`||t===`className`?es(e,function(e){var t=n(Array.from(e).join(` `));e.clear(),t&&t.split(/\s+/g).filter(Boolean).forEach(function(t){return e.add(t)})}):Zo({kind:`attribute`,attribute:t,elements:new Set,mutate:n,selector:e}):is}function ns(e){var t=e.selector,n=e.action,r=e.value,i=e.attribute,a=e.parentSelector,o=e.insertBeforeSelector;if(i===`html`){if(n===`append`)return Qo(t,function(e){return e+(r??``)});if(n===`set`)return Qo(t,function(){return r??``})}else if(i===`class`){if(n===`append`)return es(t,function(e){r&&e.add(r)});if(n===`remove`)return es(t,function(e){r&&e.delete(r)});if(n===`set`)return es(t,function(e){e.clear(),r&&e.add(r)})}else if(i===`position`){if(n===`set`&&a)return $o(t,function(){return{insertBeforeSelector:o,parentSelector:a}})}else if(n===`append`)return ts(t,i,function(e){return e===null?r??``:e+(r??``)});else if(n===`set`)return ts(t,i,function(){return r??``});else if(n===`remove`)return ts(t,i,function(){return null});return is}var rs,is,as,os,ss,cs,ls,us,ds,fs,ps,ms,hs,gs,_s,vs=t((()=>{rs=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,is={revert:function(){}},as=new Map,os=new Set,ss=function(e){return e.innerHTML},cs=function(e,t){return e.innerHTML=t},ls=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},us=function(e,t){t.insertBeforeNode&&!t.parentNode.contains(t.insertBeforeNode)||t.parentNode.insertBefore(e,t.insertBeforeNode)},ds=function(e,t){return t?e.className=t:e.removeAttribute(`class`)},fs=function(e){return e.className},ps=function(e){return function(t){return t.getAttribute(e)??null}},ms=function(e){return function(t,n){return n===null?t.removeAttribute(e):t.setAttribute(e,n)}},Xo(),_s={html:Qo,classes:es,attribute:ts,position:$o,declarative:ns}}));function ys(e,t,n){n=n||{};for(let[r,i]of Object.entries(t))switch(r){case`$or`:if(!ks(e,i,n))return!1;break;case`$nor`:if(ks(e,i,n))return!1;break;case`$and`:if(!As(e,i,n))return!1;break;case`$not`:if(ys(e,i,n))return!1;break;default:if(!Ss(i,bs(e,r),n))return!1}return!0}function bs(e,t){let n=t.split(`.`),r=e;for(let e=0;e<n.length;e++)if(r&&typeof r==`object`&&n[e]in r)r=r[n[e]];else return null;return r}function xs(e,t=!1){let n=`${e}${t?`/i`:``}`;return js[n]||(js[n]=new RegExp(e.replace(/([^\\])\//g,`$1\\/`),t?`i`:void 0)),js[n]}function Ss(e,t,n,r=!1){if(typeof e==`string`)return r?String(t).toLowerCase()===e.toLowerCase():t+``===e;if(typeof e==`number`)return t*1===e;if(typeof e==`boolean`)return t!==null&&!!t===e;if(e===null)return t===null;if(Array.isArray(e)||!Cs(e))return JSON.stringify(t)===JSON.stringify(e);for(let r in e)if(!Os(r,t,e[r],n))return!1;return!0}function Cs(e){let t=Object.keys(e);return t.length>0&&t.filter(e=>e[0]===`$`).length===t.length}function ws(e){if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=typeof e;return[`string`,`number`,`boolean`,`object`,`undefined`].includes(t)?t:`unknown`}function Ts(e,t,n){if(!Array.isArray(e))return!1;let r=Cs(t)?e=>Ss(t,e,n):e=>ys(e,t,n);for(let t=0;t<e.length;t++)if(e[t]&&r(e[t]))return!0;return!1}function Es(e,t,n=!1){if(n){let n=e=>typeof e==`string`?e.toLowerCase():e;return Array.isArray(e)?e.some(e=>t.some(t=>n(e)===n(t))):t.some(t=>n(e)===n(t))}return Array.isArray(e)?e.some(e=>t.includes(e)):t.includes(e)}function Ds(e,t,n,r=!1){if(!Array.isArray(e))return!1;for(let i=0;i<t.length;i++){let a=!1;for(let o=0;o<e.length;o++)if(Ss(t[i],e[o],n,r)){a=!0;break}if(!a)return!1}return!0}function Os(e,t,n,r){switch(e){case`$veq`:return Ba(t)===Ba(n);case`$vne`:return Ba(t)!==Ba(n);case`$vgt`:return Ba(t)>Ba(n);case`$vgte`:return Ba(t)>=Ba(n);case`$vlt`:return Ba(t)<Ba(n);case`$vlte`:return Ba(t)<=Ba(n);case`$eq`:return t===n;case`$ne`:return t!==n;case`$lt`:return t<n;case`$lte`:return t<=n;case`$gt`:return t>n;case`$gte`:return t>=n;case`$exists`:return n?t!=null:t==null;case`$in`:return Array.isArray(n)?Es(t,n):!1;case`$ini`:return Array.isArray(n)?Es(t,n,!0):!1;case`$inGroup`:return Es(t,r[n]||[]);case`$notInGroup`:return!Es(t,r[n]||[]);case`$nin`:return Array.isArray(n)?!Es(t,n):!1;case`$nini`:return Array.isArray(n)?!Es(t,n,!0):!1;case`$not`:return!Ss(n,t,r);case`$size`:return Array.isArray(t)?Ss(n,t.length,r):!1;case`$elemMatch`:return Ts(t,n,r);case`$all`:return Array.isArray(n)?Ds(t,n,r):!1;case`$alli`:return Array.isArray(n)?Ds(t,n,r,!0):!1;case`$regex`:try{return xs(n).test(t)}catch{return!1}case`$regexi`:try{return xs(n,!0).test(t)}catch{return!1}case`$type`:return ws(t)===n;default:return console.error(`Unknown operator: `+e),!1}}function ks(e,t,n){if(!t.length)return!0;for(let r=0;r<t.length;r++)if(ys(e,t[r],n))return!0;return!1}function As(e,t,n){for(let r=0;r<t.length;r++)if(!ys(e,t[r],n))return!1;return!0}var js,Ms=t((()=>{Ja(),js={}}));function Ns(e){let t=new Map;return e.global.forcedFeatureValues&&e.global.forcedFeatureValues.forEach((e,n)=>t.set(n,e)),e.user.forcedFeatureValues&&e.user.forcedFeatureValues.forEach((e,n)=>t.set(n,e)),t}function Ps(e){return e.global.forcedVariations&&e.user.forcedVariations?{...e.global.forcedVariations,...e.user.forcedVariations}:e.global.forcedVariations?e.global.forcedVariations:e.user.forcedVariations?e.user.forcedVariations:{}}async function Fs(e){try{await e()}catch{}}function Is(e,t,n){if(e.user.trackedExperiments){let r=ac(t,n);if(e.user.trackedExperiments.has(r))return[];e.user.trackedExperiments.add(r)}e.user.enableDevMode&&e.user.devLogs&&e.user.devLogs.push({experiment:t,result:n,timestamp:Date.now().toString(),logType:`experiment`});let r=[];if(e.global.trackingCallback){let i=e.global.trackingCallback;r.push(Fs(()=>i(t,n,e.user)))}if(e.user.trackingCallback){let i=e.user.trackingCallback;r.push(Fs(()=>i(t,n)))}if(e.global.eventLogger){let i=e.global.eventLogger;r.push(Fs(()=>i(sc,{experimentId:t.key,variationId:n.key,hashAttribute:n.hashAttribute,hashValue:n.hashValue},e.user)))}return r}function Ls(e,t,n){if(e.user.trackedFeatureUsage){let r=JSON.stringify(n.value);if(e.user.trackedFeatureUsage[t]===r)return;e.user.trackedFeatureUsage[t]=r,e.user.enableDevMode&&e.user.devLogs&&e.user.devLogs.push({featureKey:t,result:n,timestamp:Date.now().toString(),logType:`feature`})}if(e.global.onFeatureUsage){let r=e.global.onFeatureUsage;Fs(()=>r(t,n,e.user))}if(e.user.onFeatureUsage){let r=e.user.onFeatureUsage;Fs(()=>r(t,n))}if(e.global.eventLogger){let r=e.global.eventLogger;Fs(()=>r(oc,{feature:t,source:n.source,value:n.value,ruleId:n.source===`defaultValue`?`$default`:n.ruleId||``,variationId:n.experimentResult?n.experimentResult.key:``},e.user))}}function Rs(e,t){if(t.stack.evaluatedFeatures.has(e))return Bs(t,e,null,`cyclicPrerequisite`);t.stack.evaluatedFeatures.add(e),t.stack.id=e;let n=Ns(t);if(n.has(e))return Bs(t,e,n.get(e),`override`);if(!t.global.features||!t.global.features[e])return Bs(t,e,null,`unknownFeature`);let r=t.global.features[e];if(r.rules){let n=new Set(t.stack.evaluatedFeatures);rules:for(let i of r.rules){if(i.parentConditions)for(let r of i.parentConditions){t.stack.evaluatedFeatures=new Set(n);let i=Rs(r.id,t);if(i.source===`cyclicPrerequisite`)return Bs(t,e,null,`cyclicPrerequisite`);if(!ys({value:i.value},r.condition||{})){if(r.gate)return Bs(t,e,null,`prerequisite`);continue rules}}if(i.filters&&Us(i.filters,t))continue;if(`force`in i){if(i.condition&&!Hs(i.condition,t)||!Ws(t,i.seed||e,i.hashAttribute,t.user.saveStickyBucketAssignmentDoc&&!i.disableStickyBucketing?i.fallbackAttribute:void 0,i.range,i.coverage,i.hashVersion))continue;return i.tracks&&i.tracks.forEach(e=>{!Is(t,e.experiment,e.result).length&&t.global.saveDeferredTrack&&t.global.saveDeferredTrack({experiment:e.experiment,result:e.result})}),Bs(t,e,i.force,`force`,i.id)}if(!i.variations)continue;let r={variations:i.variations,key:i.key||e};`coverage`in i&&(r.coverage=i.coverage),i.weights&&(r.weights=i.weights),i.hashAttribute&&(r.hashAttribute=i.hashAttribute),i.fallbackAttribute&&(r.fallbackAttribute=i.fallbackAttribute),i.disableStickyBucketing&&(r.disableStickyBucketing=i.disableStickyBucketing),i.bucketVersion!==void 0&&(r.bucketVersion=i.bucketVersion),i.minBucketVersion!==void 0&&(r.minBucketVersion=i.minBucketVersion),i.namespace&&(r.namespace=i.namespace),i.meta&&(r.meta=i.meta),i.ranges&&(r.ranges=i.ranges),i.name&&(r.name=i.name),i.phase&&(r.phase=i.phase),i.seed&&(r.seed=i.seed),i.hashVersion&&(r.hashVersion=i.hashVersion),i.filters&&(r.filters=i.filters),i.condition&&(r.condition=i.condition);let{result:a}=zs(r,e,t);if(t.global.onExperimentEval&&t.global.onExperimentEval(r,a),a.inExperiment&&!a.passthrough)return Bs(t,e,a.value,`experiment`,i.id,r,a)}}return Bs(t,e,r.defaultValue===void 0?null:r.defaultValue,`defaultValue`)}function zs(e,t,n){let r=e.key,i=e.variations.length;if(i<2||n.global.enabled===!1||n.user.enabled===!1||(e=Gs(e,n),e.urlPatterns&&!ja(n.user.url||``,e.urlPatterns)))return{result:V(n,e,-1,!1,t)};let a=Ia(r,n.user.url||``,i);if(a!==null)return{result:V(n,e,a,!1,t)};let o=Ps(n);if(r in o){let i=o[r];return{result:V(n,e,i,!1,t)}}if(e.status===`draft`||e.active===!1)return{result:V(n,e,-1,!1,t)};let{hashAttribute:s,hashValue:c}=Ks(n,e.hashAttribute,n.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0);if(!c)return{result:V(n,e,-1,!1,t)};let l=-1,u=!1,d=!1;if(n.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){let{variation:t,versionIsBlocked:r}=Ys({ctx:n,expKey:e.key,expBucketVersion:e.bucketVersion,expHashAttribute:e.hashAttribute,expFallbackAttribute:e.fallbackAttribute,expMinBucketVersion:e.minBucketVersion,expMeta:e.meta});u=t>=0,l=t,d=!!r}if(!u){if(e.filters){if(Us(e.filters,n))return{result:V(n,e,-1,!1,t)}}else if(e.namespace&&!Oa(c,e.namespace))return{result:V(n,e,-1,!1,t)};if(e.include&&!La(e.include)||e.condition&&!Hs(e.condition,n))return{result:V(n,e,-1,!1,t)};if(e.parentConditions){let r=new Set(n.stack.evaluatedFeatures);for(let i of e.parentConditions){n.stack.evaluatedFeatures=new Set(r);let a=Rs(i.id,n);if(a.source===`cyclicPrerequisite`||!ys({value:a.value},i.condition||{}))return{result:V(n,e,-1,!1,t)}}}if(e.groups&&!Js(e.groups,n))return{result:V(n,e,-1,!1,t)}}if(e.url&&!qs(e.url,n))return{result:V(n,e,-1,!1,t)};let f=Ta(e.seed||r,c,e.hashVersion||1);if(f===null)return{result:V(n,e,-1,!1,t)};if(u||(l=ka(f,e.ranges||Fa(i,e.coverage===void 0?1:e.coverage,e.weights))),d)return{result:V(n,e,-1,!1,t,void 0,!0)};if(l<0)return{result:V(n,e,-1,!1,t)};if(`force`in e)return{result:V(n,e,e.force===void 0?-1:e.force,!1,t)};if(n.global.qaMode||n.user.qaMode||e.status===`stopped`)return{result:V(n,e,-1,!1,t)};let p=V(n,e,l,!0,t,f,u);if(n.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){let{changed:t,key:r,doc:i}=$s(n,s,za(c),{[Xs(e.key,e.bucketVersion)]:p.key});t&&(n.user.stickyBucketAssignmentDocs=n.user.stickyBucketAssignmentDocs||{},n.user.stickyBucketAssignmentDocs[r]=i,n.user.saveStickyBucketAssignmentDoc(i))}let m=Is(n,e,p);m.length===0&&n.global.saveDeferredTrack&&n.global.saveDeferredTrack({experiment:e,result:p});let ee=m.length?m.length===1?m[0]:Promise.all(m).then(()=>{}):void 0;return`changeId`in e&&e.changeId&&n.global.recordChangeId&&n.global.recordChangeId(e.changeId),{result:p,trackingCall:ee}}function Bs(e,t,n,r,i,a,o){let s={value:n,on:!!n,off:!n,source:r,ruleId:i||``};return a&&(s.experiment=a),o&&(s.experimentResult=o),r!==`override`&&Ls(e,t,s),s}function Vs(e){return{...e.user.attributes,...e.user.attributeOverrides}}function Hs(e,t){return ys(Vs(t),e,t.global.savedGroups||{})}function Us(e,t){return e.some(e=>{let{hashValue:n}=Ks(t,e.attribute);if(!n)return!0;let r=Ta(e.seed,n,e.hashVersion||2);return r===null?!0:!e.ranges.some(e=>Da(r,e))})}function Ws(e,t,n,r,i,a,o){if(!i&&a===void 0)return!0;if(!i&&a===0)return!1;let{hashValue:s}=Ks(e,n,r);if(!s)return!1;let c=Ta(t,s,o||1);return c===null?!1:i?Da(c,i):a===void 0?!0:c<=a}function V(e,t,n,r,i,a,o){let s=!0;(n<0||n>=t.variations.length)&&(n=0,s=!1);let{hashAttribute:c,hashValue:l}=Ks(e,t.hashAttribute,e.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing?t.fallbackAttribute:void 0),u=t.meta?t.meta[n]:{},d={key:u.key||``+n,featureId:i,inExperiment:s,hashUsed:r,variationId:n,value:t.variations[n],hashAttribute:c,hashValue:l,stickyBucketUsed:!!o};return u.name&&(d.name=u.name),a!==void 0&&(d.bucket=a),u.passthrough&&(d.passthrough=u.passthrough),d}function Gs(e,t){let n=e.key,r=t.global.overrides;return r&&r[n]&&(e=Object.assign({},e,r[n]),typeof e.url==`string`&&(e.url=Aa(e.url))),e}function Ks(e,t,n){let r=t||`id`,i=``,a=Vs(e);return a[r]&&(i=a[r]),!i&&n&&(a[n]&&(i=a[n]),i&&(r=n)),{hashAttribute:r,hashValue:i}}function qs(e,t){let n=t.user.url;if(!n)return!1;let r=n.replace(/^https?:\/\//,``).replace(/^[^/]*\//,`/`);return!!(e.test(n)||e.test(r))}function Js(e,t){let n=t.global.groups||{};for(let t=0;t<e.length;t++)if(n[e[t]])return!0;return!1}function Ys({ctx:e,expKey:t,expBucketVersion:n,expHashAttribute:r,expFallbackAttribute:i,expMinBucketVersion:a,expMeta:o}){n=n||0,a=a||0,r=r||`id`,o=o||[];let s=Xs(t,n),c=Qs(e,r,i);if(a>0){for(let e=0;e<a;e++)if(c[Xs(t,e)]!==void 0)return{variation:-1,versionIsBlocked:!0}}let l=c[s];if(l===void 0)return{variation:-1};let u=o.findIndex(e=>e.key===l);return u<0?{variation:-1}:{variation:u}}function Xs(e,t){return t=t||0,`${e}__${t}`}function Zs(e,t){return`${e}||${t}`}function Qs(e,t,n){if(!e.user.stickyBucketAssignmentDocs)return{};let{hashAttribute:r,hashValue:i}=Ks(e,t),a=Zs(r,za(i)),{hashAttribute:o,hashValue:s}=Ks(e,n),c=s?Zs(o,za(s)):null,l={};return c&&e.user.stickyBucketAssignmentDocs[c]&&Object.assign(l,e.user.stickyBucketAssignmentDocs[c].assignments||{}),e.user.stickyBucketAssignmentDocs[a]&&Object.assign(l,e.user.stickyBucketAssignmentDocs[a].assignments||{}),l}function $s(e,t,n,r){let i=Zs(t,n),a=e.user.stickyBucketAssignmentDocs&&e.user.stickyBucketAssignmentDocs[i]&&e.user.stickyBucketAssignmentDocs[i].assignments||{},o={...a,...r},s=JSON.stringify(a)!==JSON.stringify(o);return{key:i,doc:{attributeName:t,attributeValue:n,assignments:o},changed:s}}function ec(e,t){let n=new Set,r=t&&t.features?t.features:e.global.features||{},i=t&&t.experiments?t.experiments:e.global.experiments||[];return Object.keys(r).forEach(e=>{let t=r[e];if(t.rules)for(let e of t.rules)e.variations&&(n.add(e.hashAttribute||`id`),e.fallbackAttribute&&n.add(e.fallbackAttribute))}),i.map(e=>{n.add(e.hashAttribute||`id`),e.fallbackAttribute&&n.add(e.fallbackAttribute)}),Array.from(n)}async function tc(e,t,n){let r=nc(e,n);return t.getAllAssignments(r)}function nc(e,t){let n={};return ec(e,t).forEach(t=>{let{hashValue:r}=Ks(e,t);n[t]=za(r)}),n}async function rc(e,t,n){if(e={...e},e.encryptedFeatures){try{e.features=JSON.parse(await Ra(e.encryptedFeatures,t,n))}catch(e){console.error(e)}delete e.encryptedFeatures}if(e.encryptedExperiments){try{e.experiments=JSON.parse(await Ra(e.encryptedExperiments,t,n))}catch(e){console.error(e)}delete e.encryptedExperiments}if(e.encryptedSavedGroups){try{e.savedGroups=JSON.parse(await Ra(e.encryptedSavedGroups,t,n))}catch(e){console.error(e)}delete e.encryptedSavedGroups}return e}function ic(e){let t=e.apiHost||`https://cdn.growthbook.io`;return{apiHost:t.replace(/\/*$/,``),streamingHost:(e.streamingHost||t).replace(/\/*$/,``),apiRequestHeaders:e.apiHostRequestHeaders,streamingHostRequestHeaders:e.streamingHostRequestHeaders}}function ac(e,t){return t.hashAttribute+t.hashValue+e.key+t.variationId}var oc,sc,cc=t((()=>{Ms(),Ja(),oc=`Feature Evaluated`,sc=`Experiment Viewed`})),lc,uc,dc,fc=t((()=>{vs(),Ja(),Eo(),cc(),lc=typeof window<`u`&&typeof document<`u`,uc=Va(),dc=class{constructor(e){if(e=e||{},this.version=uc,this._options=this.context=e,this._renderer=e.renderer||null,this._trackedExperiments=new Set,this._completedChangeIds=new Set,this._trackedFeatures={},this.debug=!!e.debug,this._subscriptions=new Set,this.ready=!1,this._assigned=new Map,this._activeAutoExperiments=new Map,this._triggeredExpKeys=new Set,this._initialized=!1,this._redirectedUrl=``,this._deferredTrackingCalls=new Map,this._autoExperimentsAllowed=!e.disableExperimentsOnLoad,this._destroyCallbacks=[],this.logs=[],this.log=this.log.bind(this),this._saveDeferredTrack=this._saveDeferredTrack.bind(this),this._onExperimentEval=this._onExperimentEval.bind(this),this._fireSubscriptions=this._fireSubscriptions.bind(this),this._recordChangedId=this._recordChangedId.bind(this),e.remoteEval){if(e.decryptionKey)throw Error(`Encryption is not available for remoteEval`);if(!e.clientKey)throw Error(`Missing clientKey`);let t=!1;try{t=!!new URL(e.apiHost||``).hostname.match(/growthbook\.io$/i)}catch{}if(t)throw Error(`Cannot use remoteEval on GrowthBook Cloud`)}else if(e.cacheKeyAttributes)throw Error(`cacheKeyAttributes are only used for remoteEval`);if(e.stickyBucketService){let t=e.stickyBucketService;this._saveStickyBucketAssignmentDoc=e=>t.saveAssignments(e)}if(e.plugins)for(let t of e.plugins)t(this);if(e.features&&(this.ready=!0),lc&&e.enableDevMode&&(window._growthbook=this,document.dispatchEvent(new Event(`gbloaded`))),e.experiments&&(this.ready=!0,this._updateAllAutoExperiments()),this._options.stickyBucketService&&this._options.stickyBucketAssignmentDocs)for(let e in this._options.stickyBucketAssignmentDocs){let t=this._options.stickyBucketAssignmentDocs[e];t&&this._options.stickyBucketService.saveAssignments(t).catch(()=>{})}this.ready&&this.refreshStickyBuckets(this.getPayload())}async setPayload(e){this._payload=e;let t=await rc(e,this._options.decryptionKey);this._decryptedPayload=t,await this.refreshStickyBuckets(t),t.features&&(this._options.features=t.features),t.savedGroups&&(this._options.savedGroups=t.savedGroups),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,this._render()}initSync(e){this._initialized=!0;let t=e.payload;if(t.encryptedExperiments||t.encryptedFeatures)throw Error(`initSync does not support encrypted payloads`);return this._options.stickyBucketService&&!this._options.stickyBucketAssignmentDocs&&(this._options.stickyBucketAssignmentDocs=this.generateStickyBucketAssignmentDocsSync(this._options.stickyBucketService,t)),this._payload=t,this._decryptedPayload=t,t.features&&(this._options.features=t.features),t.experiments&&(this._options.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,_o(this,e),this}async init(e){if(this._initialized=!0,e=e||{},e.cacheSettings&&Ya(e.cacheSettings),e.payload)return await this.setPayload(e.payload),_o(this,e),{success:!0,source:`init`};{let{data:t,...n}=await this._refresh({...e,allowStale:!0});return _o(this,e),await this.setPayload(t||{}),n}}async loadFeatures(e){e=e||{},await this.init({skipCache:e.skipCache,timeout:e.timeout,streaming:(this._options.backgroundSync??!0)&&(e.autoRefresh||this._options.subscribeToChanges)})}async refreshFeatures(e){let t=await this._refresh({...e||{},allowStale:!1});t.data&&await this.setPayload(t.data)}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){return ic(this._options)}getClientKey(){return this._options.clientKey||``}getPayload(){return this._payload||{features:this.getFeatures(),experiments:this.getExperiments()}}getDecryptedPayload(){return this._decryptedPayload||this.getPayload()}isRemoteEval(){return this._options.remoteEval||!1}getCacheKeyAttributes(){return this._options.cacheKeyAttributes}async _refresh({timeout:e,skipCache:t,allowStale:n,streaming:r}){if(!this._options.clientKey)throw Error(`Missing clientKey`);return Xa({instance:this,timeout:e,skipCache:t||this._options.disableCache,allowStale:n,backgroundSync:r??this._options.backgroundSync??!0})}_render(){if(this._renderer)try{this._renderer()}catch(e){console.error(`Failed to render`,e)}}setFeatures(e){this._options.features=e,this.ready=!0,this._render()}async setEncryptedFeatures(e,t,n){let r=await Ra(e,t||this._options.decryptionKey,n);this.setFeatures(JSON.parse(r))}setExperiments(e){this._options.experiments=e,this.ready=!0,this._updateAllAutoExperiments()}async setEncryptedExperiments(e,t,n){let r=await Ra(e,t||this._options.decryptionKey,n);this.setExperiments(JSON.parse(r))}async setAttributes(e){if(this._options.attributes=e,this._options.stickyBucketService&&await this.refreshStickyBuckets(),this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}async updateAttributes(e){return this.setAttributes({...this._options.attributes,...e})}async setAttributeOverrides(e){if(this._options.attributeOverrides=e,this._options.stickyBucketService&&await this.refreshStickyBuckets(),this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}async setForcedVariations(e){if(this._options.forcedVariations=e||{},this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}setForcedFeatures(e){this._options.forcedFeatureValues=e,this._render()}async setURL(e){if(e!==this._options.url){if(this._options.url=e,this._redirectedUrl=``,this._options.remoteEval){await this._refreshForRemoteEval(),this._updateAllAutoExperiments(!0);return}this._updateAllAutoExperiments(!0)}}getAttributes(){return{...this._options.attributes,...this._options.attributeOverrides}}getForcedVariations(){return this._options.forcedVariations||{}}getForcedFeatures(){return this._options.forcedFeatureValues||new Map}getStickyBucketAssignmentDocs(){return this._options.stickyBucketAssignmentDocs||{}}getUrl(){return this._options.url||``}getFeatures(){return this._options.features||{}}getExperiments(){return this._options.experiments||[]}getCompletedChangeIds(){return Array.from(this._completedChangeIds)}subscribe(e){return this._subscriptions.add(e),()=>{this._subscriptions.delete(e)}}async _refreshForRemoteEval(){if(!this._options.remoteEval||!this._initialized)return;let e=await this._refresh({allowStale:!1});e.data&&await this.setPayload(e.data)}getAllResults(){return new Map(this._assigned)}onDestroy(e){this._destroyCallbacks.push(e)}isDestroyed(){return!!this._destroyed}destroy(e){e=e||{},this._destroyed=!0,this._destroyCallbacks.forEach(e=>{try{e()}catch(e){console.error(e)}}),this._subscriptions.clear(),this._assigned.clear(),this._trackedExperiments.clear(),this._completedChangeIds.clear(),this._deferredTrackingCalls.clear(),this._trackedFeatures={},this._destroyCallbacks=[],this._payload=void 0,this._saveStickyBucketAssignmentDoc=void 0,Qa(this),e.destroyAllStreams&&go(),this.logs=[],lc&&window._growthbook===this&&delete window._growthbook,this._activeAutoExperiments.forEach(e=>{e.undo()}),this._activeAutoExperiments.clear(),this._triggeredExpKeys.clear()}setRenderer(e){this._renderer=e}forceVariation(e,t){if(this._options.forcedVariations=this._options.forcedVariations||{},this._options.forcedVariations[e]=t,this._options.remoteEval){this._refreshForRemoteEval();return}this._updateAllAutoExperiments(),this._render()}run(e){let{result:t}=zs(e,null,this._getEvalContext());return this._onExperimentEval(e,t),t}triggerExperiment(e){return this._triggeredExpKeys.add(e),this._options.experiments?this._options.experiments.filter(t=>t.key===e).map(e=>this._runAutoExperiment(e)).filter(e=>e!==null):null}triggerAutoExperiments(){this._autoExperimentsAllowed=!0,this._updateAllAutoExperiments(!0)}_getEvalContext(){return{user:this._getUserContext(),global:this._getGlobalContext(),stack:{evaluatedFeatures:new Set}}}_getUserContext(){return{attributes:this._options.user?{...this._options.user,...this._options.attributes}:this._options.attributes,enableDevMode:this._options.enableDevMode,blockedChangeIds:this._options.blockedChangeIds,stickyBucketAssignmentDocs:this._options.stickyBucketAssignmentDocs,url:this._getContextUrl(),forcedVariations:this._options.forcedVariations,forcedFeatureValues:this._options.forcedFeatureValues,attributeOverrides:this._options.attributeOverrides,saveStickyBucketAssignmentDoc:this._saveStickyBucketAssignmentDoc,trackingCallback:this._options.trackingCallback,onFeatureUsage:this._options.onFeatureUsage,devLogs:this.logs,trackedExperiments:this._trackedExperiments,trackedFeatureUsage:this._trackedFeatures}}_getGlobalContext(){return{features:this._options.features,experiments:this._options.experiments,log:this.log,enabled:this._options.enabled,qaMode:this._options.qaMode,savedGroups:this._options.savedGroups,groups:this._options.groups,overrides:this._options.overrides,onExperimentEval:this._onExperimentEval,recordChangeId:this._recordChangedId,saveDeferredTrack:this._saveDeferredTrack,eventLogger:this._options.eventLogger}}_runAutoExperiment(e,t){let n=this._activeAutoExperiments.get(e);if(e.manual&&!this._triggeredExpKeys.has(e.key)&&!n)return null;let r=this._isAutoExperimentBlockedByContext(e),i,a;r?i=V(this._getEvalContext(),e,-1,!1,``):({result:i,trackingCall:a}=zs(e,null,this._getEvalContext()),this._onExperimentEval(e,i));let o=JSON.stringify(i.value);if(!t&&i.inExperiment&&n&&n.valueHash===o)return i;if(n&&this._undoActiveAutoExperiment(e),i.inExperiment){let t=Wa(e);if(t===`redirect`&&i.value.urlRedirect&&e.urlPatterns){let t=e.persistQueryString?Ha(this._getContextUrl(),i.value.urlRedirect):i.value.urlRedirect;if(ja(t,e.urlPatterns))return this.log(`Skipping redirect because original URL matches redirect URL`,{id:e.key}),i;this._redirectedUrl=t;let{navigate:n,delay:r}=this._getNavigateFunction();if(n)if(lc)Promise.all([...a?[Ga(a,this._options.maxNavigateDelay??1e3)]:[],new Promise(e=>window.setTimeout(e,this._options.navigateDelay??r))]).then(()=>{try{n(t)}catch(e){console.error(e)}});else try{n(t)}catch(e){console.error(e)}}else if(t===`visual`){let t=this._options.applyDomChangesCallback?this._options.applyDomChangesCallback(i.value):this._applyDOMChanges(i.value);t&&this._activeAutoExperiments.set(e,{undo:t,valueHash:o})}}return i}_undoActiveAutoExperiment(e){let t=this._activeAutoExperiments.get(e);t&&(t.undo(),this._activeAutoExperiments.delete(e))}_updateAllAutoExperiments(e){if(!this._autoExperimentsAllowed)return;let t=this._options.experiments||[],n=new Set(t);this._activeAutoExperiments.forEach((e,t)=>{n.has(t)||(e.undo(),this._activeAutoExperiments.delete(t))});for(let n of t){let t=this._runAutoExperiment(n,e);if(t&&t.inExperiment&&Wa(n)===`redirect`)break}}_onExperimentEval(e,t){let n=this._assigned.get(e.key);this._assigned.set(e.key,{experiment:e,result:t}),this._subscriptions.size>0&&this._fireSubscriptions(e,t,n)}_fireSubscriptions(e,t,n){(!n||n.result.inExperiment!==t.inExperiment||n.result.variationId!==t.variationId)&&this._subscriptions.forEach(n=>{try{n(e,t)}catch(e){console.error(e)}})}_recordChangedId(e){this._completedChangeIds.add(e)}isOn(e){return this.evalFeature(e).on}isOff(e){return this.evalFeature(e).off}getFeatureValue(e,t){let n=this.evalFeature(e).value;return n===null?t:n}feature(e){return this.evalFeature(e)}evalFeature(e){return Rs(e,this._getEvalContext())}log(e,t){this.debug&&(this._options.log?this._options.log(e,t):console.log(e,t))}getDeferredTrackingCalls(){return Array.from(this._deferredTrackingCalls.values())}setDeferredTrackingCalls(e){this._deferredTrackingCalls=new Map(e.filter(e=>e&&e.experiment&&e.result).map(e=>[ac(e.experiment,e.result),e]))}async fireDeferredTrackingCalls(){if(!this._options.trackingCallback)return;let e=[];this._deferredTrackingCalls.forEach(t=>{!t||!t.experiment||!t.result?console.error(`Invalid deferred tracking call`,{call:t}):e.push(this._options.trackingCallback(t.experiment,t.result))}),this._deferredTrackingCalls.clear(),await Promise.all(e)}setTrackingCallback(e){this._options.trackingCallback=e,this.fireDeferredTrackingCalls()}setFeatureUsageCallback(e){this._options.onFeatureUsage=e}setEventLogger(e){this._options.eventLogger=e}async logEvent(e,t){if(this._destroyed){console.error(`Cannot log event to destroyed GrowthBook instance`);return}if(this._options.enableDevMode&&this.logs.push({eventName:e,properties:t,timestamp:Date.now().toString(),logType:`event`}),this._options.eventLogger)try{await this._options.eventLogger(e,t||{},this._getUserContext())}catch(e){console.error(e)}else console.error(`No event logger configured`)}_saveDeferredTrack(e){this._deferredTrackingCalls.set(ac(e.experiment,e.result),e)}_getContextUrl(){return this._options.url||(lc?window.location.href:``)}_isAutoExperimentBlockedByContext(e){let t=Wa(e);if(t===`visual`){if(this._options.disableVisualExperiments||this._options.disableJsInjection&&e.variations.some(e=>e.js))return!0}else if(t===`redirect`){if(this._options.disableUrlRedirectExperiments)return!0;try{let t=new URL(this._getContextUrl());for(let n of e.variations){if(!n||!n.urlRedirect)continue;let e=new URL(n.urlRedirect);if(this._options.disableCrossOriginUrlRedirectExperiments&&(e.protocol!==t.protocol||e.host!==t.host))return!0}}catch(t){return this.log(`Error parsing current or redirect URL`,{id:e.key,error:t}),!0}}else return!0;return!!(e.changeId&&(this._options.blockedChangeIds||[]).includes(e.changeId))}getRedirectUrl(){return this._redirectedUrl}_getNavigateFunction(){return this._options.navigate?{navigate:this._options.navigate,delay:0}:lc?{navigate:e=>{window.location.replace(e)},delay:100}:{navigate:null,delay:0}}_applyDOMChanges(e){if(!lc)return;let t=[];if(e.css){let n=document.createElement(`style`);n.innerHTML=e.css,document.head.appendChild(n),t.push(()=>n.remove())}if(e.js){let n=document.createElement(`script`);n.innerHTML=e.js,this._options.jsInjectionNonce&&(n.nonce=this._options.jsInjectionNonce),document.head.appendChild(n),t.push(()=>n.remove())}return e.domMutations&&e.domMutations.forEach(e=>{t.push(_s.declarative(e).revert)}),()=>{t.forEach(e=>e())}}async refreshStickyBuckets(e){if(this._options.stickyBucketService){let t=await tc(this._getEvalContext(),this._options.stickyBucketService,e);this._options.stickyBucketAssignmentDocs=t}}generateStickyBucketAssignmentDocsSync(e,t){if(!(`getAllAssignmentsSync`in e)){console.error(`generating StickyBucketAssignmentDocs docs requires StickyBucketServiceSync`);return}let n=nc(this._getEvalContext(),t);return e.getAllAssignmentsSync(n)}inDevMode(){return!!this._options.enableDevMode}}})),pc=t((()=>{Eo(),fc(),Ja(),cc(),Ms()}));function mc(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var hc=t((()=>{}));function gc(e){var t=0,n=0;return function(){var r=yc(),i=vc-(r-n);if(n=r,i>0){if(++t>=_c)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var _c,vc,yc,bc=t((()=>{_c=800,vc=16,yc=Date.now}));function xc(e){return function(){return e}}var Sc=t((()=>{})),Cc,wc=t((()=>{Sc(),yn(),St(),Cc=On?function(e,t){return On(e,`toString`,{configurable:!0,enumerable:!1,value:xc(t),writable:!0})}:bt})),Tc,Ec=t((()=>{wc(),bc(),Tc=gc(Cc)}));function Dc(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}var Oc=t((()=>{}));function kc(e){return e!==e}var Ac=t((()=>{}));function jc(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}var Mc=t((()=>{}));function Nc(e,t,n){return t===t?jc(e,t,n):Dc(e,kc,n)}var Pc=t((()=>{Oc(),Ac(),Mc()}));function Fc(e,t){return!!(e!=null&&e.length)&&Nc(e,t,0)>-1}var Ic=t((()=>{Pc()}));function Lc(e,t,n){return t=Rc(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=Rc(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),mc(e,this,s)}}var Rc,zc=t((()=>{hc(),Rc=Math.max}));function Bc(e,t){return Tc(Lc(e,t,bt),e+``)}var Vc=t((()=>{St(),zc(),Ec()}));function Hc(e,t,n){if(!o(n))return!1;var r=typeof t;return(r==`number`?ct(n)&&it(t,n.length):r==`string`&&t in n)?f(n[t],e):!1}var Uc=t((()=>{ee(),ot(),Pt(),l()}));function Wc(e){return Bc(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&Hc(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}var Gc=t((()=>{Vc(),Uc()}));function Kc(e){return yt(e)||lt(e)||!!(qc&&e&&e[qc])}var qc,Jc=t((()=>{s(),mt(),It(),qc=i?i.isConcatSpreadable:void 0}));function Yc(e,t,n,r,i){var a=-1,o=e.length;for(n||(n=Kc),i||(i=[]);++a<o;){var s=e[a];t>0&&n(s)?t>1?Yc(s,t-1,n,r,i):jt(i,s):r||(i[i.length]=s)}return i}var Xc=t((()=>{Rt(),Jc()}));function Zc(e){return e!=null&&e.length?Yc(e,1):[]}var Qc=t((()=>{Xc()}));function $c(e){return Tc(Lc(e,void 0,Zc),e+``)}var el=t((()=>{Qc(),zc(),Ec()}));function tl(e){if(!$e(e)||c(e)!=nl)return!1;var t=Bn(e);if(t===null)return!0;var n=ol.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&al.call(n)==sl}var nl,rl,il,al,ol,sl,cl=t((()=>{a(),zn(),et(),nl=`[object Object]`,rl=Function.prototype,il=Object.prototype,al=rl.toString,ol=il.hasOwnProperty,sl=al.call(Object)}));function ll(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r<i;)a[r]=e[r+t];return a}var ul=t((()=>{}));function dl(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:ll(e,t,n)}var fl=t((()=>{ul()}));function pl(e){return ml.test(e)}var ml,hl=t((()=>{ml=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`)}));function gl(e){return e.split(``)}var _l=t((()=>{}));function vl(e){return e.match(Fl)||[]}var yl,bl,xl,Sl,Cl,wl,Tl,El,Dl,Ol,kl,Al,jl,Ml,Nl,Pl,Fl,Il=t((()=>{yl=`\\ud800-\\udfff`,bl=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,xl=`\\ufe0e\\ufe0f`,Sl=`[`+yl+`]`,Cl=`[`+bl+`]`,wl=`\\ud83c[\\udffb-\\udfff]`,Tl=`(?:`+Cl+`|`+wl+`)`,El=`[^`+yl+`]`,Dl=`(?:\\ud83c[\\udde6-\\uddff]){2}`,Ol=`[\\ud800-\\udbff][\\udc00-\\udfff]`,kl=`\\u200d`,Al=Tl+`?`,jl=`[`+xl+`]?`,Ml=`(?:`+kl+`(?:`+[El,Dl,Ol].join(`|`)+`)`+jl+Al+`)*`,Nl=jl+Al+Ml,Pl=`(?:`+[El+Cl+`?`,Cl,Dl,Ol,Sl].join(`|`)+`)`,Fl=RegExp(wl+`(?=`+wl+`)|`+Pl+Nl,`g`)}));function Ll(e){return pl(e)?vl(e):gl(e)}var Rl=t((()=>{_l(),hl(),Il()}));function zl(e){return function(t){t=_t(t);var n=pl(t)?Ll(t):void 0,r=n?n[0]:t.charAt(0),i=n?dl(n,1).join(``):t.slice(1);return r[e]()+i}}var Bl=t((()=>{fl(),hl(),Rl(),Ut()})),Vl,Hl=t((()=>{Bl(),Vl=zl(`toUpperCase`)}));function Ul(e){return Vl(_t(e).toLowerCase())}var Wl=t((()=>{Ut(),Hl()}));function Gl(e,t,n,r){for(var i=-1,a=e==null?0:e.length;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}var Kl=t((()=>{}));function ql(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}var Jl=t((()=>{})),Yl,Xl=t((()=>{Jl(),Yl=ql()}));function Zl(e,t){return e&&Yl(e,t,at)}var Ql=t((()=>{Xl(),kt()}));function $l(e,t){return function(n,r){if(n==null)return n;if(!ct(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=Object(n);(t?a--:++a<i)&&r(o[a],a,o)!==!1;);return n}}var eu=t((()=>{ot()})),tu,nu=t((()=>{Ql(),eu(),tu=$l(Zl)}));function ru(e,t,n,r){return tu(e,function(e,i,a){t(r,e,n(e),a)}),r}var iu=t((()=>{nu()}));function au(e,t){return function(n,r){var i=yt(n)?Gl:ru,a=t?t():{};return i(n,e,At(r,2),a)}}var ou=t((()=>{Kl(),iu(),Lt(),It()}));function su(e,t,n){(n!==void 0&&!f(e[t],n)||n===void 0&&!(t in e))&&hn(e,t,n)}var cu=t((()=>{Yn(),ee()}));function lu(e){return $e(e)&&ct(e)}var uu=t((()=>{ot(),et()}));function du(e,t){if(!(t===`constructor`&&typeof e[t]==`function`)&&t!=`__proto__`)return e[t]}var fu=t((()=>{}));function pu(e){return Qn(e,Jn(e))}var mu=t((()=>{Nn(),jn()}));function hu(e,t,n,r,i,a,s){var c=du(e,n),l=du(t,n),d=s.get(l);if(d){su(e,n,d);return}var f=a?a(c,l,n+``,e,t,s):void 0,p=f===void 0;if(p){var m=yt(l),ee=!m&&ft(l),te=!m&&!ee&&rt(l);f=l,m||ee||te?yt(c)?f=c:lu(c)?f=_n(c):ee?(p=!1,f=Gn(l,!0)):te?(p=!1,f=Hn(l,!0)):f=[]:tl(l)||lt(l)?(f=c,lt(c)?f=pu(c):(!o(c)||u(c))&&(f=Kn(l))):p=!1}p&&(s.set(l,f),i(f,l,r,a,s),s.delete(l)),su(e,n,f)}var gu=t((()=>{cu(),Un(),qn(),wn(),Pn(),mt(),It(),uu(),pt(),d(),l(),cl(),dt(),fu(),mu()}));function _u(e,t,n,r,i){e!==t&&Yl(t,function(a,s){if(i||(i=new Wt),o(a))hu(e,t,s,n,_u,r,i);else{var c=r?r(du(e,s),a,s+``,e,t,i):void 0;c===void 0&&(c=a),su(e,s,c)}},Jn)}var vu=t((()=>{vt(),cu(),Xl(),gu(),l(),jn(),fu()})),yu,bu=t((()=>{vu(),Gc(),yu=Wc(function(e,t,n,r){_u(e,t,n,r)})}));function xu(e,t,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}var Su=t((()=>{}));function Cu(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var wu=t((()=>{}));function Tu(e,t){var n=[];return tu(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}var Eu=t((()=>{nu()}));function Du(e,t){return Ht(t,function(t){return e[t]})}var Ou=t((()=>{ut()}));function ku(e){return e==null?[]:Du(e,at(e))}var Au=t((()=>{Ou(),kt()}));function ju(e,t){return t.length<2?e:Nt(e,ll(t,0,-1))}var Mu=t((()=>{Mt(),ul()}));function Nu(e,t){return tt(e,t)}var Pu=t((()=>{Vt()}));function Fu(e,t){var n={};return t=At(t,3),Zl(e,function(e,r,i){hn(n,r,t(e,r,i))}),n}var Iu=t((()=>{Yn(),Ql(),Lt()}));function Lu(e){if(typeof e!=`function`)throw TypeError(Ru);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}var Ru,zu=t((()=>{Ru=`Expected a function`}));function Bu(e,t){t=ht(t,e);var n=-1,r=t.length;if(!r)return!0;for(;++n<r;){var i=wt(t[n]);if(i===`__proto__`&&!Vu.call(e,`__proto__`)||(i===`constructor`||i===`prototype`)&&n<r-1)return!1}var a=ju(e,t);return a==null||delete a[wt(Cu(t))]}var Vu,Hu=t((()=>{zt(),wu(),Mu(),Et(),Vu=Object.prototype.hasOwnProperty}));function Uu(e){return tl(e)?void 0:e}var Wu=t((()=>{cl()})),Gu,Ku,qu,Ju,Yu=t((()=>{ut(),Wn(),Hu(),zt(),Nn(),Wu(),el(),Rn(),Gu=1,Ku=2,qu=4,Ju=$c(function(e,t){var n={};if(e==null)return n;var r=!1;t=Ht(t,function(t){return t=ht(t,e),r||(r=t.length>1),t}),Qn(e,In(e),n),r&&(n=Mn(n,Gu|Ku|qu,Uu));for(var i=t.length;i--;)Bu(n,t[i]);return n})}));function Xu(e,t,n,r){if(!o(e))return e;t=ht(t,e);for(var i=-1,a=t.length,s=a-1,c=e;c!=null&&++i<a;){var l=wt(t[i]),u=n;if(l===`__proto__`||l===`constructor`||l===`prototype`)return e;if(i!=s){var d=c[l];u=r?r(d,l,c):void 0,u===void 0&&(u=o(d)?d:it(t[i+1])?[]:{})}Zn(c,l,u),c=c[l]}return e}var Zu=t((()=>{En(),zt(),Pt(),l(),Et()}));function Qu(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=Nt(e,o);n(s,o)&&Xu(a,ht(o,e),s)}return a}var $u=t((()=>{Mt(),Zu(),zt()}));function ed(e,t){if(e==null)return{};var n=Ht(In(e),function(e){return[e]});return t=At(t),Qu(e,n,function(e,n){return t(e,n[0])})}var td=t((()=>{ut(),Lt(),$u(),Rn()})),nd,rd=t((()=>{ou(),nd=au(function(e,t,n){e[+!n].push(t)},function(){return[[],[]]})}));function id(e,t){return e+ad(od()*(t-e+1))}var ad,od,sd=t((()=>{ad=Math.floor,od=Math.random}));function cd(e,t){return(yt(e)?Ft:Tu)(e,Lu(At(t,3)))}var ld=t((()=>{Ot(),Eu(),Lt(),It(),zu()}));function ud(e){var t=e.length;return t?e[id(0,t-1)]:void 0}var dd=t((()=>{sd()}));function fd(e){return ud(ku(e))}var pd=t((()=>{dd(),Au()}));function md(e){return(yt(e)?ud:fd)(e)}var hd=t((()=>{dd(),pd(),It()}));function gd(e,t,n,r){return r=typeof r==`function`?r:void 0,e==null?e:Xu(e,t,n,r)}var _d=t((()=>{Zu()})),vd,yd=t((()=>{st(),Qe(),xt(),vd=nt&&1/Ct(new nt([,-0]))[1]==1/0?function(e){return new nt(e)}:Ye}));function bd(e,t,n){var r=-1,i=Fc,a=e.length,o=!0,s=[],c=s;if(n)o=!1,i=xu;else if(a>=xd){var l=t?null:vd(e);if(l)return Ct(l);o=!1,i=Dt,c=new gt}else c=t?[]:s;outer:for(;++r<a;){var u=e[r],d=t?t(u):u;if(u=n||u!==0?u:0,o&&d===d){for(var f=c.length;f--;)if(c[f]===d)continue outer;t&&c.push(d),s.push(u)}else i(c,d,n)||(c!==s&&c.push(d),s.push(u))}return s}var xd,Sd=t((()=>{Bt(),Ic(),Su(),Tt(),yd(),xt(),xd=200}));function Cd(e,t){return e&&e.length?bd(e,At(t,2)):[]}var wd=t((()=>{Lt(),Sd()}));function Td(e,t,n){for(var r=-1,i=e.length,a=t.length,o={};++r<i;){var s=r<a?t[r]:void 0;n(o,e[r],s)}return o}var Ed=t((()=>{}));function Dd(e,t){return Td(e||[],t||[],Zn)}var Od=t((()=>{En(),Ed()})),kd=t((()=>{hc(),bc(),Ec(),Ic(),Gc(),el(),Vc(),cl(),Wl(),ul(),Uc(),Vn(),Xc(),Sc(),ou(),vu(),bu(),Su(),uu(),wu(),nu(),Jl(),eu(),Eu(),Oc(),Ql(),Qc(),Xl(),Pc(),Au(),Mu(),Pu(),Ac(),Bl(),Iu(),zu(),Rl(),Yu(),td(),fl(),hl(),rd(),$u(),Hu(),sd(),ld(),hd(),Zu(),_d(),Hl(),Ou(),mu(),Sd(),wd(),Od(),Ed()}));function Ad(){return process.env.CLAUDE_GB_ADAPTER_KEY||(process.env.USER_TYPE===`ant`?_(process.env.ENABLE_GROWTHBOOK_DEV)?`sdk-yZQvlplybuXjYh6L`:`sdk-xRVcrliHIlrg4og4`:`sdk-zAZezfDKGoZuXXKe`)}var jd=t((()=>{g()}));function Md(e){let{buffer:t,bytesRead:n}=j().readSync(e,{length:4096});return n===0?`utf8`:n>=2&&t[0]===255&&t[1]===254?`utf16le`:(n>=3&&t[0]===239&&t[1]===187&&t[2],`utf8`)}function Nd(e){let t=0,n=0;for(let r=0;r<e.length;r++)e[r]===`
2
+ `&&(r>0&&e[r-1]===`\r`?t++:n++);return t>n?`CRLF`:`LF`}function Pd(e){let t=j(),{resolvedPath:n,isSymlink:r}=Xn(t,e);r&&N(`Reading through symlink: ${e} -> ${n}`);let i=Md(n),a=t.readFileSync(n,{encoding:i}),o=Nd(a.slice(0,4096));return{content:a.replaceAll(`\r
3
+ `,`
4
+ `),encoding:i,lineEndings:o}}function Fd(e){return Pd(e).content}var Id=t((()=>{M(),An()}));function Ld(){return qd}function Rd(e){qd=e}function zd(e){return Jd.has(e)?Jd.get(e):void 0}function Bd(e,t){Jd.set(e,t)}function Vd(e){return Yd.get(e)}function Hd(e,t){Yd.set(e,t)}function Ud(){qd=null,Jd.clear(),Yd.clear()}function Wd(){return Xd}function Gd(e){Xd=e}function Kd(){Xd=void 0}var qd,Jd,Yd,Xd,Zd=t((()=>{qd=null,Jd=new Map,Yd=new Map}));function Qd(e){of=e}function $d(){of=null,sf=void 0}function ef(e){return sf=e,e}function tf(){return z(h(),af)}function nf(){try{let e=gn(Rr(Fd(tf())));return!e||typeof e!=`object`||Array.isArray(e)?null:e}catch{return null}}function rf(){if(sf!==!0)return null;if(of)return of;let e=nf();return e?(of=e,Ud(),e):null}var af,of,sf,cf=t((()=>{g(),Id(),zr(),Zd(),vn(),af=`remote-settings.json`,of=null})),lf,uf,df=t((()=>{Of(),An(),se(),lf=class{constructor(){v(this,`cache`,new Map),v(this,`maxCacheSize`,1e3)}readFile(e){let t=j(),n;try{n=t.statSync(e)}catch(t){throw this.cache.delete(e),t}let r=e,i=this.cache.get(r);if(i&&i.mtime===n.mtimeMs)return{content:i.content,encoding:i.encoding};let a=gf(e),o=t.readFileSync(e,{encoding:a}).replaceAll(`\r
5
+ `,`
6
+ `);if(this.cache.set(r,{content:o,encoding:a,mtime:n.mtimeMs}),this.cache.size>this.maxCacheSize){let e=this.cache.keys().next().value;e&&this.cache.delete(e)}return{content:o,encoding:a}}clear(){this.cache.clear()}invalidate(e){this.cache.delete(e)}getStats(){return{size:this.cache.size,entries:Array.from(this.cache.keys())}}},uf=new lf}));async function ff(e){try{return await _a(e),!0}catch{return!1}}function pf(e){try{return j().readFileSync(e,{encoding:`utf8`})}catch(e){return P(e),null}}function mf(e){let t=j();return Math.floor(t.statSync(e).mtimeMs)}async function hf(e){let t=await j().stat(e);return Math.floor(t.mtimeMs)}function gf(e){try{let{resolvedPath:t}=Xn(j(),e);return Md(t)}catch(e){return Sn(e)?N(`detectFileEncoding failed for expected reason: ${e.code}`,{level:`debug`}):P(e),`utf8`}}function _f(e){return e.includes(` `)?e.replace(/^\t+/gm,e=>` `.repeat(e.length)):e}function vf(e){let t=e?Fr(e):void 0;return{absolutePath:t,relativePath:t?ea(tr(),t):void 0}}function yf(e){let{relativePath:t}=vf(e);if(t&&!t.startsWith(`..`))return t;let n=qi();return e.startsWith(n+na)?`~`+e.slice(n.length):e}function bf(e){return e.match(/^\s*\d+[\u2192\t](.*)$/)?.[1]??e}function xf(e){try{return j().isDirEmptySync(e)}catch(e){return bn(e)}}function Sf(e,t,n={encoding:`utf-8`}){let r=j(),i=e;try{let t=r.readlinkSync(e);i=Qi(t)?t:ta(Zi(e),t),N(`Writing through symlink: ${e} -> ${i}`)}catch{}let a=`${i}.tmp.${process.pid}.${Date.now()}`,o,s=!1;try{o=r.statSync(i).mode,s=!0,N(`Preserving file permissions: ${o.toString(8)}`)}catch(e){if(!bn(e))throw e;n.mode!==void 0&&(o=n.mode,N(`Setting permissions for new file: ${o.toString(8)}`))}try{N(`Writing to temp file: ${a}`);let e={encoding:n.encoding,flush:!0};!s&&n.mode!==void 0&&(e.mode=n.mode),la(a,t,e),N(`Temp file written successfully, size: ${t.length} bytes`),s&&o!==void 0&&(ra(a,o),N(`Applied original permissions to temp file`)),N(`Renaming ${a} to ${i}`),r.renameSync(a,i),N(`File ${i} written atomically`)}catch(e){N(`Failed to write file atomically: ${e}`,{level:`error`}),F(`tengu_atomic_write_error`,{});try{N(`Cleaning up temp file: ${a}`),r.unlinkSync(a)}catch(e){N(`Failed to clean up temp file: ${e}`)}N(`Falling back to non-atomic write for ${i}`);try{let e={encoding:n.encoding,flush:!0};!s&&n.mode!==void 0&&(e.mode=n.mode),la(i,t,e),N(`File ${i} written successfully with non-atomic fallback`)}catch(e){throw N(`Non-atomic write also failed: ${e}`),e}}}function Cf(){let e=Or(),t=qi();if(e===`macos`)return z(t,`Desktop`);if(e===`windows`){let e=process.env.USERPROFILE?process.env.USERPROFILE.replace(/\\/g,`/`):null;if(e){let t=`/mnt/c${e.replace(/^[A-Z]:/,``)}/Desktop`;if(j().existsSync(t))return t}try{let e=`/mnt/c/Users`,t=j().readdirSync(e);for(let n of t){if(n.name===`Public`||n.name===`Default`||n.name===`Default User`||n.name===`All Users`)continue;let t=z(e,n.name,`Desktop`);if(j().existsSync(t))return t}}catch(e){P(e)}}let n=z(t,`Desktop`);return j().existsSync(n)?n:t}function wf(e,t=Df){try{return j().statSync(e).size<=t}catch{return!1}}function Tf(e){let t=$i(e);return t=t.replace(/\\/g,`/`),Or()===`windows`&&(t=t.toLowerCase()),t}function Ef(e,t){return Tf(e)===Tf(t)}var Df,Of=t((()=>{ii(),CM(),er(),M(),kn(),Id(),df(),An(),yr(),Pr(),Ar(),Df=.25*1024*1024}));async function kf(e,t){let{code:n}=await Sr(`git`,[`check-ignore`,e],{preserveOutputOnError:!1,cwd:t});return n===0}function Af(){return z(qi(),`.config`,`git`,`ignore`)}async function jf(e,t=tr()){try{if(!await ur(t))return;let n=`**/${e}`;if(await kf(e.endsWith(`/`)?`${e}sample-file.txt`:e,t))return;let r=Af();await ma(Zi(r),{recursive:!0});try{if((await ha(r,{encoding:`utf-8`})).includes(n))return;await pa(r,`\n${n}\n`)}catch(e){if(mn(e)===`ENOENT`)await ya(r,`${n}\n`,`utf-8`);else throw e}}catch(e){P(e)}}var Mf=t((()=>{er(),kn(),Cr(),dr(),yr()}));function Nf(e){switch(e){case`userSettings`:return`user`;case`projectSettings`:return`project`;case`localSettings`:return`project, gitignored`;case`flagSettings`:return`cli flag`;case`policySettings`:return`managed`}}function Pf(e){switch(e){case`userSettings`:return`User`;case`projectSettings`:return`Project`;case`localSettings`:return`Local`;case`flagSettings`:return`Flag`;case`policySettings`:return`Managed`;case`plugin`:return`Plugin`;case`built-in`:return`Built-in`}}function Ff(e){switch(e){case`userSettings`:return`user settings`;case`projectSettings`:return`shared project settings`;case`localSettings`:return`project local settings`;case`flagSettings`:return`command line arguments`;case`policySettings`:return`enterprise managed settings`;case`cliArg`:return`CLI argument`;case`command`:return`command configuration`;case`session`:return`current session`}}function If(e){switch(e){case`userSettings`:return`User settings`;case`projectSettings`:return`Shared project settings`;case`localSettings`:return`Project local settings`;case`flagSettings`:return`Command line arguments`;case`policySettings`:return`Enterprise managed settings`;case`cliArg`:return`CLI argument`;case`command`:return`Command configuration`;case`session`:return`Current session`}}function Lf(){let e=on(),t=new Set(e);return t.add(`policySettings`),t.add(`flagSettings`),Array.from(t)}function Rf(e){return Lf().includes(e)}var zf,Bf,Vf,Hf=t((()=>{O(),zf=[`userSettings`,`projectSettings`,`localSettings`,`flagSettings`,`policySettings`],Bf=[`localSettings`,`projectSettings`,`userSettings`],Vf=`https://json.schemastore.org/claude-code-settings.json`}));function Uf(e){Kf.set(e,Date.now())}function Wf(e,t){let n=Kf.get(e);return n!==void 0&&Date.now()-n<t?(Kf.delete(e),!0):!1}function Gf(){Kf.clear()}var Kf,qf=t((()=>{Kf=new Map})),Jf,Yf,Xf=t((()=>{m(),Ar(),Jf=p(function(){if(process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_MANAGED_SETTINGS_PATH)return process.env.CLAUDE_CODE_MANAGED_SETTINGS_PATH;switch(Or()){case`macos`:return`/Library/Application Support/ClaudeCode`;case`windows`:return`C:\\Program Files\\ClaudeCode`;default:return`/etc/claude-code`}}),Yf=p(function(){return z(Jf(),`managed-settings.d`)})})),Zf,Qf,$f,ep=t((()=>{Je(),ui(),Zf=L(()=>D({allowedDomains:S(b()).optional(),allowManagedDomainsOnly:w().optional().describe(`When true (and set in managed settings), only allowedDomains and WebFetch(domain:...) allow rules from managed settings are respected. User, project, local, and flag settings domains are ignored. Denied domains are still respected from all sources.`),allowUnixSockets:S(b()).optional().describe(`macOS only: Unix socket paths to allow. Ignored on Linux (seccomp cannot filter by path).`),allowAllUnixSockets:w().optional().describe(`If true, allow all Unix sockets (disables blocking on both platforms).`),allowLocalBinding:w().optional(),httpProxyPort:y().optional(),socksProxyPort:y().optional()}).optional()),Qf=L(()=>D({allowWrite:S(b()).optional().describe(`Additional paths to allow writing within the sandbox. Merged with paths from Edit(...) allow permission rules.`),denyWrite:S(b()).optional().describe(`Additional paths to deny writing within the sandbox. Merged with paths from Edit(...) deny permission rules.`),denyRead:S(b()).optional().describe(`Additional paths to deny reading within the sandbox. Merged with paths from Read(...) deny permission rules.`),allowRead:S(b()).optional().describe(`Paths to re-allow reading within denyRead regions. Takes precedence over denyRead for matching paths.`),allowManagedReadPathsOnly:w().optional().describe(`When true (set in managed settings), only allowRead paths from policySettings are used.`)}).optional()),$f=L(()=>D({enabled:w().optional(),failIfUnavailable:w().optional().describe(`Exit with an error at startup if sandbox.enabled is true but the sandbox cannot start (missing dependencies, unsupported platform, or platform not in enabledPlatforms). When false (default), a warning is shown and commands run unsandboxed. Intended for managed-settings deployments that require sandboxing as a hard gate.`),autoAllowBashIfSandboxed:w().optional(),allowUnsandboxedCommands:w().optional().describe(`Allow commands to run outside the sandbox via the dangerouslyDisableSandbox parameter. When false, the dangerouslyDisableSandbox parameter is completely ignored and all commands must run sandboxed. Default: true.`),network:Zf(),filesystem:Qf(),ignoreViolations:x(b(),S(b())).optional(),enableWeakerNestedSandbox:w().optional(),enableWeakerNetworkIsolation:w().optional().describe(`macOS only: Allow access to com.apple.trustd.agent in the sandbox. Needed for Go-based CLI tools (gh, gcloud, terraform, etc.) to verify TLS certificates when using httpProxyPort with a MITM proxy and custom CA. **Reduces security** — opens a potential data exfiltration vector through the trustd service. Default: false`),excludedCommands:S(b()).optional(),ripgrep:D({command:b(),args:S(b()).optional()}).optional().describe(`Custom ripgrep configuration for bundled ripgrep support`)}).passthrough())})),tp,np,rp,ip=t((()=>{xi(),tp=Ci.platform===`darwin`?`⏺`:`●`,np=[`·|·`,`·/·`,`·—·`,`·\\·`],rp=`·✔︎·`}));function ap(e){return process.env.USER_TYPE===`ant`?e!==`auto`&&e!==`bubble`:!0}function op(e){return hp[e]??hp.default}function sp(e){return op(e).external}function cp(e){return Ei.includes(e)?e:`default`}function lp(e){return op(e).title}function up(e){return e===`default`||e===void 0}function dp(e){return op(e).shortTitle}function fp(e){return op(e).symbol}function pp(e){return op(e).color}var mp,hp,gp=t((()=>{Je(),ip(),Ti(),ui(),L(()=>Ke.enum(Ei)),mp=L(()=>Ke.enum(Di)),hp={default:{title:`Default`,shortTitle:`Default`,symbol:``,color:`text`,external:`default`},plan:{title:`Plan Mode`,shortTitle:`Plan`,symbol:`⏸`,color:`planMode`,external:`plan`},acceptEdits:{title:`Accept edits`,shortTitle:`Accept`,symbol:`⏵⏵`,color:`autoAccept`,external:`acceptEdits`},bypassPermissions:{title:`Bypass`,shortTitle:`Bypass`,symbol:`⏵⏵`,color:`error`,external:`bypassPermissions`},dontAsk:{title:`Don't Ask`,shortTitle:`DontAsk`,symbol:`⏵⏵`,color:`error`,external:`dontAsk`},auto:{title:`Auto`,shortTitle:`Auto`,symbol:`⏵⏵`,color:`warning`,external:`default`}}})),_p,vp=t((()=>{_p=`PreToolUse.PostToolUse.PostToolUseFailure.Notification.UserPromptSubmit.SessionStart.SessionEnd.Stop.StopFailure.SubagentStart.SubagentStop.PreCompact.PostCompact.PermissionRequest.PermissionDenied.Setup.TeammateIdle.TaskCreated.TaskCompleted.Elicitation.ElicitationResult.ConfigChange.WorktreeCreate.WorktreeRemove.InstructionsLoaded.CwdChanged.FileChanged`.split(`.`)})),yp,bp,xp=t((()=>{yp=[`bash`,`powershell`],bp=`bash`}));function Sp(){return{BashCommandHookSchema:D({type:T(`command`).describe(`Shell command hook type`),command:b().describe(`Shell command to execute`),if:Cp(),shell:E(yp).optional().describe(`Shell interpreter. 'bash' uses your $SHELL (bash/zsh/sh); 'powershell' uses pwsh. Defaults to bash.`),timeout:y().positive().optional().describe(`Timeout in seconds for this specific command`),statusMessage:b().optional().describe(`Custom status message to display in spinner while hook runs`),once:w().optional().describe(`If true, hook runs once and is removed after execution`),async:w().optional().describe(`If true, hook runs in background without blocking`),asyncRewake:w().optional().describe(`If true, hook runs in background and wakes the model on exit code 2 (blocking error). Implies async.`)}),PromptHookSchema:D({type:T(`prompt`).describe(`LLM prompt hook type`),prompt:b().describe(`Prompt to evaluate with LLM. Use $ARGUMENTS placeholder for hook input JSON.`),if:Cp(),timeout:y().positive().optional().describe(`Timeout in seconds for this specific prompt evaluation`),model:b().optional().describe(`Model to use for this prompt hook (e.g., "claude-sonnet-4-6"). If not specified, uses the default small fast model.`),statusMessage:b().optional().describe(`Custom status message to display in spinner while hook runs`),once:w().optional().describe(`If true, hook runs once and is removed after execution`)}),HttpHookSchema:D({type:T(`http`).describe(`HTTP hook type`),url:b().url().describe(`URL to POST the hook input JSON to`),if:Cp(),timeout:y().positive().optional().describe(`Timeout in seconds for this specific request`),headers:x(b(),b()).optional().describe('Additional headers to include in the request. Values may reference environment variables using $VAR_NAME or ${VAR_NAME} syntax (e.g., "Authorization": "Bearer $MY_TOKEN"). Only variables listed in allowedEnvVars will be interpolated.'),allowedEnvVars:S(b()).optional().describe(`Explicit list of environment variable names that may be interpolated in header values. Only variables listed here will be resolved; all other $VAR references are left as empty strings. Required for env var interpolation to work.`),statusMessage:b().optional().describe(`Custom status message to display in spinner while hook runs`),once:w().optional().describe(`If true, hook runs once and is removed after execution`)}),AgentHookSchema:D({type:T(`agent`).describe(`Agentic verifier hook type`),prompt:b().describe(`Prompt describing what to verify (e.g. "Verify that unit tests ran and passed."). Use $ARGUMENTS placeholder for hook input JSON.`),if:Cp(),timeout:y().positive().optional().describe(`Timeout in seconds for agent execution (default 60)`),model:b().optional().describe(`Model to use for this agent hook (e.g., "claude-sonnet-4-6"). If not specified, uses Haiku.`),statusMessage:b().optional().describe(`Custom status message to display in spinner while hook runs`),once:w().optional().describe(`If true, hook runs once and is removed after execution`)})}}var Cp,wp,Tp,Ep,Dp=t((()=>{vp(),Je(),ui(),xp(),Cp=L(()=>b().optional().describe(`Permission rule syntax to filter when this hook runs (e.g., "Bash(git *)"). Only runs if the tool call matches the pattern. Avoids spawning hooks for non-matching commands.`)),wp=L(()=>{let{BashCommandHookSchema:e,PromptHookSchema:t,AgentHookSchema:n,HttpHookSchema:r}=Sp();return We(`type`,[e,t,n,r])}),Tp=L(()=>D({matcher:b().optional().describe(`String pattern to match (e.g. tool names like "Write")`),hooks:S(wp()).describe(`List of hooks to execute when the matcher matches`)})),Ep=L(()=>Le(E(_p),S(Tp())))}));function Op(e,t){let n=e.toLowerCase();return t.autoUpdate??(Np.has(n)&&!Pp.has(n))}function kp(e){return Np.has(e.toLowerCase())?!1:Ip.test(e)?!0:Fp.test(e)}function Ap(e,t){let n=e.toLowerCase();if(!Np.has(n))return null;if(t.source===`github`)return(t.repo||``).toLowerCase().startsWith(`anthropics/`)?null:`The name '${e}' is reserved for official Anthropic marketplaces. Only repositories from 'github.com/${Lp}/' can use this name.`;if(t.source===`git`&&t.url){let n=t.url.toLowerCase(),r=n.includes(`github.com/anthropics/`),i=n.includes(`git@github.com:anthropics/`);return r||i?null:`The name '${e}' is reserved for official Anthropic marketplaces. Only repositories from 'github.com/${Lp}/' can use this name.`}return`The name '${e}' is reserved for official Anthropic marketplaces and can only be used with GitHub sources from the '${Lp}' organization.`}function jp(e){return typeof e==`string`&&e.startsWith(`./`)}function Mp(e){return e.source===`file`||e.source===`directory`}var Np,Pp,Fp,Ip,Lp,Rp,zp,Bp,Vp,Hp,Up,Wp,Gp,Kp,qp,Jp,Yp,Xp,Zp,Qp,$p,em,tm,nm,rm,im,am,om,sm,cm,lm,um,dm,fm,pm,mm,hm,gm,_m,vm,ym,bm,xm,Sm,Cm,wm,Tm,Em=t((()=>{Je(),Dp(),Ir(),ui(),Np=new Set([`claude-code-marketplace`,`claude-code-plugins`,`claude-plugins-official`,`anthropic-marketplace`,`anthropic-plugins`,`agent-skills`,`life-sciences`,`knowledge-work-plugins`]),Pp=new Set([`knowledge-work-plugins`]),Fp=/(?:official[^a-z0-9]*(anthropic|claude)|(?:anthropic|claude)[^a-z0-9]*official|^(?:anthropic|claude)[^a-z0-9]*(marketplace|plugins|official))/i,Ip=/[^\u0020-\u007E]/,Lp=`anthropics`,Rp=L(()=>b().startsWith(`./`)),zp=L(()=>Rp().endsWith(`.json`)),Bp=L(()=>C([Rp().refine(e=>e.endsWith(`.mcpb`)||e.endsWith(`.dxt`),{message:`MCPB file path must end with .mcpb or .dxt`}).describe(`Path to MCPB file relative to plugin root`),b().url().refine(e=>e.endsWith(`.mcpb`)||e.endsWith(`.dxt`),{message:`MCPB URL must end with .mcpb or .dxt`}).describe(`URL to MCPB file`)])),Vp=L(()=>Rp().endsWith(`.md`)),Hp=L(()=>C([Vp(),Rp()])),Up=L(()=>b().min(1,`Marketplace must have a name`).refine(e=>!e.includes(` `),{message:`Marketplace name cannot contain spaces. Use kebab-case (e.g., "my-marketplace")`}).refine(e=>!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`..`)&&e!==`.`,{message:`Marketplace name cannot contain path separators (/ or \\), ".." sequences, or be "."`}).refine(e=>!kp(e),{message:`Marketplace name impersonates an official Anthropic/Claude marketplace`}).refine(e=>e.toLowerCase()!==`inline`,{message:`Marketplace name "inline" is reserved for --plugin-dir session plugins`}).refine(e=>e.toLowerCase()!==`builtin`,{message:`Marketplace name "builtin" is reserved for built-in plugins`})),Wp=L(()=>D({name:b().min(1,`Author name cannot be empty`).describe(`Display name of the plugin author or organization`),email:b().optional().describe(`Contact email for support or feedback`),url:b().optional().describe(`Website, GitHub profile, or organization URL`)})),Gp=L(()=>D({name:b().min(1,`Plugin name cannot be empty`).refine(e=>!e.includes(` `),{message:`Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")`}).describe(`Unique identifier for the plugin, used for namespacing (prefer kebab-case)`),version:b().optional().describe(`Semantic version (e.g., 1.2.3) following semver.org specification`),description:b().optional().describe(`Brief, user-facing explanation of what the plugin provides`),author:Wp().optional().describe(`Information about the plugin creator or maintainer`),homepage:b().url().optional().describe(`Plugin homepage or documentation URL`),repository:b().optional().describe(`Source code repository URL`),license:b().optional().describe(`SPDX license identifier (e.g., MIT, Apache-2.0)`),keywords:S(b()).optional().describe(`Tags for plugin discovery and categorization`),dependencies:S(vm()).optional().describe(`Plugins that must be enabled for this plugin to function. Bare names (no "@marketplace") are resolved against the declaring plugin's own marketplace.`)})),Kp=L(()=>D({description:b().optional().describe(`Brief, user-facing explanation of what these hooks provide`),hooks:Ue(()=>Ep()).describe(`The hooks provided by the plugin, in the same format as the one used for settings`)})),qp=L(()=>D({hooks:C([zp().describe(`Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root`),Ue(()=>Ep()).describe(`Additional hooks (in addition to those in hooks/hooks.json, if it exists)`),S(C([zp().describe(`Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root`),Ue(()=>Ep()).describe(`Additional hooks (in addition to those in hooks/hooks.json, if it exists)`)]))])})),Jp=L(()=>D({source:Hp().optional().describe(`Path to command markdown file, relative to plugin root`),content:b().optional().describe(`Inline markdown content for the command`),description:b().optional().describe(`Command description override`),argumentHint:b().optional().describe(`Hint for command arguments (e.g., "[file]")`),model:b().optional().describe(`Default model for this command`),allowedTools:S(b()).optional().describe(`Tools allowed when command runs`)}).refine(e=>e.source&&!e.content||!e.source&&e.content,{message:`Command must have either "source" (file path) or "content" (inline markdown), but not both`})),Yp=L(()=>D({commands:C([Hp().describe(`Path to additional command file or skill directory (in addition to those in the commands/ directory, if it exists), relative to the plugin root`),S(Hp().describe(`Path to additional command file or skill directory (in addition to those in the commands/ directory, if it exists), relative to the plugin root`)).describe(`List of paths to additional command files or skill directories`),x(b(),Jp()).describe(`Object mapping of command names to their metadata and source files. Command name becomes the slash command name (e.g., "about" → "/plugin:about")`)])})),Xp=L(()=>D({agents:C([Vp().describe(`Path to additional agent file (in addition to those in the agents/ directory, if it exists), relative to the plugin root`),S(Vp().describe(`Path to additional agent file (in addition to those in the agents/ directory, if it exists), relative to the plugin root`)).describe(`List of paths to additional agent files`)])})),Zp=L(()=>D({skills:C([Rp().describe(`Path to additional skill directory (in addition to those in the skills/ directory, if it exists), relative to the plugin root`),S(Rp().describe(`Path to additional skill directory (in addition to those in the skills/ directory, if it exists), relative to the plugin root`)).describe(`List of paths to additional skill directories`)])})),Qp=L(()=>D({outputStyles:C([Rp().describe(`Path to additional output styles directory or file (in addition to those in the output-styles/ directory, if it exists), relative to the plugin root`),S(Rp().describe(`Path to additional output styles directory or file (in addition to those in the output-styles/ directory, if it exists), relative to the plugin root`)).describe(`List of paths to additional output styles directories or files`)])})),$p=L(()=>b().min(1)),em=L(()=>b().min(2).refine(e=>e.startsWith(`.`),{message:`File extensions must start with dot (e.g., ".ts", not "ts")`})),tm=L(()=>D({mcpServers:C([zp().describe(`MCP servers to include in the plugin (in addition to those in the .mcp.json file, if it exists)`),Bp().describe(`Path or URL to MCPB file containing MCP server configuration`),x(b(),Br()).describe(`MCP server configurations keyed by server name`),S(C([zp().describe(`Path to MCP servers configuration file`),Bp().describe(`Path or URL to MCPB file`),x(b(),Br()).describe(`Inline MCP server configurations`)])).describe(`Array of MCP server configurations (paths, MCPB files, or inline definitions)`)])})),nm=L(()=>D({type:E([`string`,`number`,`boolean`,`directory`,`file`]).describe(`Type of the configuration value`),title:b().describe(`Human-readable label shown in the config dialog`),description:b().describe(`Help text shown beneath the field in the config dialog`),required:w().optional().describe(`If true, validation fails when this field is empty`),default:C([b(),y(),w(),S(b())]).optional().describe(`Default value used when the user provides nothing`),multiple:w().optional().describe(`For string type: allow an array of strings`),sensitive:w().optional().describe(`If true, masks dialog input and stores value in secure storage (keychain/credentials file) instead of settings.json`),min:y().optional().describe(`Minimum value (number type only)`),max:y().optional().describe(`Maximum value (number type only)`)}).strict()),rm=L(()=>D({userConfig:x(b().regex(/^[A-Za-z_]\w*$/,`Option keys must be valid identifiers (letters, digits, underscore; no leading digit) — they become CLAUDE_PLUGIN_OPTION_<KEY> env vars in hooks`),nm()).optional().describe("User-configurable values this plugin needs. Prompted at enable time. Non-sensitive values saved to settings.json; sensitive values to secure storage (macOS keychain or .credentials.json). Available as ${user_config.KEY} in MCP/LSP server config, hook commands, and (non-sensitive only) skill/agent content. Note: sensitive values share a single keychain entry with OAuth tokens — keep secret counts small to stay under the ~2KB stdin-safe limit (see INC-3028).")})),im=L(()=>D({channels:S(D({server:b().min(1).describe(`Name of the MCP server this channel binds to. Must match a key in this plugin's mcpServers.`),displayName:b().optional().describe(`Human-readable name shown in the config dialog title (e.g., "Telegram"). Defaults to the server name.`),userConfig:x(b(),nm()).optional().describe("Fields to prompt the user for when enabling this plugin in assistant mode. Saved values are substituted into ${user_config.KEY} references in the mcpServers env.")}).strict()).describe(`Channels this plugin provides. Each entry declares an MCP server as a message channel and optionally specifies user configuration to prompt for at enable time.`)})),am=L(()=>Re({command:b().min(1).refine(e=>!(e.includes(` `)&&!e.startsWith(`/`)),{message:`Command should not contain spaces. Use args array for arguments.`}).describe(`Command to execute the LSP server (e.g., "typescript-language-server")`),args:S($p()).optional().describe(`Command-line arguments to pass to the server`),extensionToLanguage:x(em(),$p()).refine(e=>Object.keys(e).length>0,{message:`extensionToLanguage must have at least one mapping`}).describe(`Mapping from file extension to LSP language ID. File extensions and languages are derived from this mapping.`),transport:E([`stdio`,`socket`]).default(`stdio`).describe(`Communication transport mechanism`),env:x(b(),b()).optional().describe(`Environment variables to set when starting the server`),initializationOptions:Ve().optional().describe(`Initialization options passed to the server during initialization`),settings:Ve().optional().describe(`Settings passed to the server via workspace/didChangeConfiguration`),workspaceFolder:b().optional().describe(`Workspace folder path to use for the server`),startupTimeout:y().int().positive().optional().describe(`Maximum time to wait for server startup (milliseconds)`),shutdownTimeout:y().int().positive().optional().describe(`Maximum time to wait for graceful shutdown (milliseconds)`),restartOnCrash:w().optional().describe(`Whether to restart the server if it crashes`),maxRestarts:y().int().nonnegative().optional().describe(`Maximum number of restart attempts before giving up`)})),om=L(()=>D({lspServers:C([zp().describe(`Path to .lsp.json configuration file relative to plugin root`),x(b(),am()).describe(`LSP server configurations keyed by server name`),S(C([zp().describe(`Path to LSP configuration file`),x(b(),am()).describe(`Inline LSP server configurations`)])).describe(`Array of LSP server configurations (paths or inline definitions)`)])})),sm=L(()=>b().refine(e=>!e.includes(`..`)&&!e.includes(`//`),`Package name cannot contain path traversal patterns`).refine(e=>/^@[a-z0-9][a-z0-9-._]*\/[a-z0-9][a-z0-9-._]*$/.test(e)||/^[a-z0-9][a-z0-9-._]*$/.test(e),`Invalid npm package name format`)),cm=L(()=>D({settings:x(b(),Ve()).optional().describe(`Settings to merge when plugin is enabled. Only allowlisted keys are kept (currently: agent)`)})),lm=L(()=>D({...Gp().shape,...qp().partial().shape,...Yp().partial().shape,...Xp().partial().shape,...Zp().partial().shape,...Qp().partial().shape,...im().partial().shape,...tm().partial().shape,...om().partial().shape,...cm().partial().shape,...rm().partial().shape})),um=L(()=>We(`source`,[D({source:T(`url`),url:b().url().describe(`Direct URL to marketplace.json file`),headers:x(b(),b()).optional().describe(`Custom HTTP headers (e.g., for authentication)`)}),D({source:T(`github`),repo:b().describe(`GitHub repository in owner/repo format`),ref:b().optional().describe(`Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.`),path:b().optional().describe(`Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)`),sparsePaths:S(b()).optional().describe(`Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.`)}),D({source:T(`git`),url:b().describe(`Full git repository URL`),ref:b().optional().describe(`Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.`),path:b().optional().describe(`Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)`),sparsePaths:S(b()).optional().describe(`Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.`)}),D({source:T(`npm`),package:sm().describe(`NPM package containing marketplace.json`)}),D({source:T(`file`),path:b().describe(`Local file path to marketplace.json`)}),D({source:T(`directory`),path:b().describe(`Local directory containing .claude-plugin/marketplace.json`)}),D({source:T(`hostPattern`),hostPattern:b().describe(`Regex pattern to match the host/domain extracted from any marketplace source type. For github sources, matches against "github.com". For git sources (SSH or HTTPS), extracts the hostname from the URL. Use in strictKnownMarketplaces to allow all marketplaces from a specific host (e.g., "^github\\.mycompany\\.com$").`)}),D({source:T(`pathPattern`),pathPattern:b().describe(`Regex pattern matched against the .path field of file and directory sources. Use in strictKnownMarketplaces to allow filesystem-based marketplaces alongside hostPattern restrictions for network sources. Use ".*" to allow all filesystem paths, or a narrower pattern (e.g., "^/opt/approved/") to restrict to specific directories.`)}),D({source:T(`settings`),name:Up().refine(e=>!Np.has(e.toLowerCase()),{message:`Reserved official marketplace names cannot be used with settings sources. validateOfficialNameSource only accepts github/git sources from anthropics/* for these names; a settings source would be rejected after loadAndCacheMarketplace has already written to disk with cleanupNeeded=false.`}).describe(`Marketplace name. Must match the extraKnownMarketplaces key (enforced); the synthetic manifest is written under this name. Same validation as PluginMarketplaceSchema plus reserved-name rejection — validateOfficialNameSource runs after the disk write, too late to clean up.`),plugins:S(pm()).describe(`Plugin entries declared inline in settings.json`),owner:Wp().optional()}).describe(`Inline marketplace manifest defined directly in settings.json. The reconciler writes a synthetic marketplace.json to the cache; diffMarketplaces detects edits via isEqual on the stored source (the plugins array is inside this object, so edits surface as sourceChanged).`)])),dm=L(()=>b().length(40).regex(/^[a-f0-9]{40}$/,`Must be a full 40-character lowercase git commit SHA`)),fm=L(()=>C([Rp().describe(`Path to the plugin root, relative to the marketplace root (the directory containing .claude-plugin/, not .claude-plugin/ itself)`),D({source:T(`npm`),package:sm().or(b()).describe("Package name (or url, or local path, or anything else that can be passed to `npm` as a package)"),version:b().optional().describe(`Specific version or version range (e.g., ^1.0.0, ~2.1.0)`),registry:b().url().optional().describe(`Custom NPM registry URL (defaults to using system default, likely npmjs.org)`)}).describe(`NPM package as plugin source`),D({source:T(`pip`),package:b().describe(`Python package name as it appears on PyPI`),version:b().optional().describe(`Version specifier (e.g., ==1.0.0, >=2.0.0, <3.0.0)`),registry:b().url().optional().describe(`Custom PyPI registry URL (defaults to using system default, likely pypi.org)`)}).describe(`Python package as plugin source`),D({source:T(`url`),url:b().describe(`Full git repository URL (https:// or git@)`),ref:b().optional().describe(`Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.`),sha:dm().optional().describe(`Specific commit SHA to use`)}),D({source:T(`github`),repo:b().describe(`GitHub repository in owner/repo format`),ref:b().optional().describe(`Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.`),sha:dm().optional().describe(`Specific commit SHA to use`)}),D({source:T(`git-subdir`),url:b().describe(`Git repository: GitHub owner/repo shorthand, https://, or git@ URL`),path:b().min(1).describe(`Subdirectory within the repo containing the plugin (e.g., "tools/claude-plugin"). Cloned sparsely using partial clone (--filter=tree:0) to minimize bandwidth for monorepos.`),ref:b().optional().describe(`Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.`),sha:dm().optional().describe(`Specific commit SHA to use`)}).describe(`Plugin located in a subdirectory of a larger repository (monorepo). Only the specified subdirectory is materialized; the rest of the repo is not downloaded.`)])),pm=L(()=>D({name:b().min(1,`Plugin name cannot be empty`).refine(e=>!e.includes(` `),{message:`Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")`}).describe(`Plugin name as it appears in the target repository`),source:fm().describe(`Where to fetch the plugin from. Must be a remote source — relative paths have no marketplace repository to resolve against.`),description:b().optional(),version:b().optional(),strict:w().optional()}).refine(e=>typeof e.source!=`string`,{message:`Plugins in a settings-sourced marketplace must use remote sources (github, git-subdir, npm, url, pip). Relative-path sources like "./foo" have no marketplace repository to resolve against.`})),mm=L(()=>lm().partial().extend({name:b().min(1,`Plugin name cannot be empty`).refine(e=>!e.includes(` `),{message:`Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")`}).describe(`Unique identifier matching the plugin name`),source:fm().describe(`Where to fetch the plugin from`),category:b().optional().describe(`Category for organizing plugins (e.g., "productivity", "development")`),tags:S(b()).optional().describe(`Tags for searchability and discovery`),strict:w().optional().default(!0).describe(`Require the plugin manifest to be present in the plugin folder. If false, the marketplace entry provides the manifest.`)})),hm=L(()=>D({name:Up(),owner:Wp().describe(`Marketplace maintainer or curator information`),plugins:S(mm()).describe(`Collection of available plugins in this marketplace`),forceRemoveDeletedPlugins:w().optional().describe(`When true, plugins removed from this marketplace will be automatically uninstalled and flagged for users`),metadata:D({pluginRoot:b().optional().describe(`Base path for relative plugin sources`),version:b().optional().describe(`Marketplace version`),description:b().optional().describe(`Marketplace description`)}).optional().describe(`Optional marketplace metadata`),allowCrossMarketplaceDependenciesOn:S(b()).optional().describe(`Marketplace names whose plugins may be auto-installed as dependencies. Only the root marketplace's allowlist applies — no transitive trust.`)})),gm=L(()=>b().regex(/^[a-z0-9][-a-z0-9._]*@[a-z0-9][-a-z0-9._]*$/i,`Plugin ID must be in format: plugin@marketplace`)),_m=/^[a-z0-9][-a-z0-9._]*(@[a-z0-9][-a-z0-9._]*)?(@\^[^@]*)?$/i,vm=L(()=>C([b().regex(_m,`Dependency must be a plugin name, optionally qualified with @marketplace`).transform(e=>e.replace(/@\^[^@]*$/,``)),D({name:b().min(1).regex(/^[a-z0-9][-a-z0-9._]*$/i),marketplace:b().min(1).regex(/^[a-z0-9][-a-z0-9._]*$/i).optional()}).loose().transform(e=>e.marketplace?`${e.name}@${e.marketplace}`:e.name)])),L(()=>C([gm(),D({id:gm().describe(`Plugin identifier (e.g., "formatter@tools")`),version:b().optional().describe(`Version constraint (e.g., "^2.0.0")`),required:w().optional().describe(`If true, cannot be disabled`),config:x(b(),Ve()).optional().describe(`Plugin-specific configuration`)})])),ym=L(()=>D({version:b().describe(`Currently installed version`),installedAt:b().describe(`ISO 8601 timestamp of installation`),lastUpdated:b().optional().describe(`ISO 8601 timestamp of last update`),installPath:b().describe(`Absolute path to the installed plugin directory`),gitCommitSha:b().optional().describe(`Git commit SHA for git-based plugins (for version tracking)`)})),bm=L(()=>D({version:T(1).describe(`Schema version 1`),plugins:x(gm(),ym()).describe(`Map of plugin IDs to their installation metadata`)})),xm=L(()=>E([`managed`,`user`,`project`,`local`])),Sm=L(()=>D({scope:xm().describe(`Installation scope`),projectPath:b().optional().describe(`Project path (required for project/local scopes)`),installPath:b().describe(`Absolute path to the versioned plugin directory`),version:b().optional().describe(`Currently installed version`),installedAt:b().optional().describe(`ISO 8601 timestamp of installation`),lastUpdated:b().optional().describe(`ISO 8601 timestamp of last update`),gitCommitSha:b().optional().describe(`Git commit SHA for git-based plugins`)})),Cm=L(()=>D({version:T(2).describe(`Schema version 2`),plugins:x(gm(),S(Sm())).describe(`Map of plugin IDs to arrays of installation entries`)})),L(()=>C([bm(),Cm()])),wm=L(()=>D({source:um().describe(`Where to fetch the marketplace from`),installLocation:b().describe(`Local cache path where marketplace manifest is stored`),lastUpdated:b().describe(`ISO 8601 timestamp of last marketplace refresh`),autoUpdate:w().optional().describe(`Whether to automatically update this marketplace and its installed plugins on startup`)})),Tm=L(()=>x(b(),wm()))}));function Dm(e){let[t,n,...r]=e.split(`__`);return t!==`mcp`||!n?null:{serverName:n,toolName:r.length>0?r.join(`__`):void 0}}function Om(e){return`mcp__${Oi(e)}__`}function km(e,t){return`${Om(e)}${Oi(t)}`}function Am(e){return e.mcpInfo?km(e.mcpInfo.serverName,e.mcpInfo.toolName):e.name}function jm(e,t){let n=`mcp__${Oi(t)}__`;return e.replace(n,``)}function Mm(e){let t=e.replace(/\s*\(MCP\)\s*$/,``);t=t.trim();let n=t.indexOf(` - `);return n===-1?t:t.substring(n+3).trim()}var Nm=t((()=>{ki()})),Pm,Fm,Im,Lm,Rm=t((()=>{Pm=`Agent`,Fm=`Task`,Im=`verification`,Lm=new Set([`Explore`,`Plan`])})),zm,Bm=t((()=>{zm=`TaskOutput`})),Vm,Hm,Um=t((()=>{Vm=`TaskStop`,Hm=`
7
+ - Stops a running background task by its ID
8
+ - Takes a task_id parameter identifying the task to stop
9
+ - Returns a success or failure status
10
+ - Use this tool when you need to terminate a long-running task
11
+ `})),Wm=r({BRIEF_PROACTIVE_SECTION:()=>Ym,BRIEF_TOOL_NAME:()=>Gm,BRIEF_TOOL_PROMPT:()=>Jm,DESCRIPTION:()=>qm,LEGACY_BRIEF_TOOL_NAME:()=>Km}),Gm,Km,qm,Jm,Ym,Xm=t((()=>{Gm=`SendUserMessage`,Km=`Brief`,qm=`Send a message to the user`,Jm="Send a message the user will read. Text outside this tool is visible in the detail view, but most won't open it — the answer lives here.\n\n`message` supports markdown. `attachments` takes file paths (absolute or cwd-relative) for images, diffs, logs.\n\n`status` labels intent: 'normal' when replying to what they just asked; 'proactive' when you're initiating — a scheduled task finished, a blocker surfaced during background work, you need input on something they haven't asked about. Set it honestly; downstream routing uses it.",Ym=`## Talking to the user
12
+
13
+ ${Gm} is where your replies go. Text outside it is visible if the user expands the detail view, but most won't — assume unread. Anything you want them to actually see goes through ${Gm}. The failure mode: the real answer lives in plain text while ${Gm} just says "done!" — they see "done!" and miss everything.
14
+
15
+ So: every time the user says something, the reply they actually read comes through ${Gm}. Even for "hi". Even for "thanks".
16
+
17
+ If you can answer right away, send the answer. If you need to go look — run a command, read files, check something — ack first in one line ("On it — checking the test output"), then work, then send the result. Without the ack they're staring at a spinner.
18
+
19
+ For longer work: ack → work → result. Between those, send a checkpoint when something useful happened — a decision you made, a surprise you hit, a phase boundary. Skip the filler ("running tests...") — a checkpoint earns its place by carrying information.
20
+
21
+ Keep messages tight — the decision, the file:line, the PR number. Second person always ("your config"), never third.`}));function Zm(e){return oh[e]??e}function Qm(e){let t=[];for(let[n,r]of Object.entries(oh))r===e&&t.push(n);return t}function $m(e){return e.replace(/\\/g,`\\\\`).replace(/\(/g,`\\(`).replace(/\)/g,`\\)`)}function eh(e){return e.replace(/\\\(/g,`(`).replace(/\\\)/g,`)`).replace(/\\\\/g,`\\`)}function th(e){let t=rh(e,`(`);if(t===-1)return{toolName:Zm(e)};let n=ih(e,`)`);if(n===-1||n<=t||n!==e.length-1)return{toolName:Zm(e)};let r=e.substring(0,t),i=e.substring(t+1,n);if(!r)return{toolName:Zm(e)};if(i===``||i===`*`)return{toolName:Zm(r)};let a=eh(i);return{toolName:Zm(r),ruleContent:a}}function nh(e){if(!e.ruleContent)return e.toolName;let t=$m(e.ruleContent);return`${e.toolName}(${t})`}function rh(e,t){for(let n=0;n<e.length;n++)if(e[n]===t){let t=0,r=n-1;for(;r>=0&&e[r]===`\\`;)t++,r--;if(t%2==0)return n}return-1}function ih(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]===t){let t=0,r=n-1;for(;r>=0&&e[r]===`\\`;)t++,r--;if(t%2==0)return n}return-1}var ah,oh,sh=t((()=>{Rm(),Bm(),Um(),ah=(Xm(),e(Wm)).BRIEF_TOOL_NAME,oh={Task:Pm,KillShell:Vm,AgentOutputTool:zm,BashOutputTool:zm,...ah?{Brief:ah}:{}}}));function ch(e){return dh.filePatternTools.includes(e)}function lh(e){return dh.bashPrefixTools.includes(e)}function uh(e){return dh.customValidation[e]}var dh,fh=t((()=>{dh={filePatternTools:[`Read`,`Write`,`Edit`,`Glob`,`NotebookRead`,`NotebookEdit`],bashPrefixTools:[`Bash`],customValidation:{WebSearch:e=>e.includes(`*`)||e.includes(`?`)?{valid:!1,error:`WebSearch does not support wildcards`,suggestion:`Use exact search terms without * or ?`,examples:[`WebSearch(claude ai)`,`WebSearch(typescript tutorial)`]}:{valid:!0},WebFetch:e=>e.includes(`://`)||e.startsWith(`http`)?{valid:!1,error:`WebFetch permissions use domain format, not URLs`,suggestion:`Use "domain:hostname" format`,examples:[`WebFetch(domain:example.com)`,`WebFetch(domain:github.com)`]}:e.startsWith(`domain:`)?{valid:!0}:{valid:!1,error:`WebFetch permissions must use "domain:" prefix`,suggestion:`Use "domain:hostname" format`,examples:[`WebFetch(domain:example.com)`,`WebFetch(domain:*.google.com)`]}}}}));function ph(e,t){let n=0,r=t-1;for(;r>=0&&e[r]===`\\`;)n++,r--;return n%2!=0}function mh(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&!ph(e,r)&&n++;return n}function hh(e){for(let t=0;t<e.length-1;t++)if(e[t]===`(`&&e[t+1]===`)`&&!ph(e,t))return!0;return!1}function gh(e,t){if(!e||e.trim()===``)return{valid:!1,error:`Permission rule cannot be empty`};if(mh(e,`(`)!==mh(e,`)`))return{valid:!1,error:`Mismatched parentheses`,suggestion:`Ensure all opening parentheses have matching closing parentheses`};if(hh(e)){let t=e.substring(0,e.indexOf(`(`));return t?{valid:!1,error:`Empty parentheses`,suggestion:`Either specify a pattern or use just "${t}" without parentheses`,examples:[`${t}`,`${t}(some-pattern)`]}:{valid:!1,error:`Empty parentheses with no tool name`,suggestion:`Specify a tool name before the parentheses`}}let n=th(e),r=Dm(n.toolName);if(r)return n.ruleContent!==void 0||mh(e,`(`)>0?{valid:!1,error:`MCP rules do not support patterns in parentheses`,suggestion:`Use "${n.toolName}" without parentheses, or use "mcp__${r.serverName}__*" for all tools`,examples:[`mcp__${r.serverName}`,`mcp__${r.serverName}__*`,r.toolName&&r.toolName!==`*`?`mcp__${r.serverName}__${r.toolName}`:void 0].filter(Boolean)}:{valid:!0};if(!n.toolName||n.toolName.length===0)return{valid:!1,error:`Tool name cannot be empty`};if(n.toolName[0]!==n.toolName[0]?.toUpperCase())return{valid:!1,error:`Tool names must start with uppercase`,suggestion:`Use "${ai(String(n.toolName))}"`};let i=uh(n.toolName);if(i&&n.ruleContent!==void 0){let e=i(n.ruleContent);if(!e.valid)return e}if(lh(n.toolName)&&n.ruleContent!==void 0){let e=n.ruleContent;if(e.includes(`:*`)&&!e.endsWith(`:*`))return{valid:!1,error:`The :* pattern must be at the end`,suggestion:`Move :* to the end for prefix matching, or use * for wildcard matching`,examples:[`Bash(npm run:*) - prefix matching (legacy)`,`Bash(npm run *) - wildcard matching`]};if(e===`:*`)return{valid:!1,error:`Prefix cannot be empty before :*`,suggestion:`Specify a command prefix before :*`,examples:[`Bash(npm:*)`,`Bash(git:*)`]}}if(ch(n.toolName)&&n.ruleContent!==void 0){let e=n.ruleContent;if(e.includes(`:*`))return{valid:!1,error:`The ":*" syntax is only for Bash prefix rules`,suggestion:`Use glob patterns like "*" or "**" for file matching`,examples:[`${n.toolName}(*.ts) - matches .ts files`,`${n.toolName}(src/**) - matches all files in src`,`${n.toolName}(**/*.test.ts) - matches test files`]};if(e.includes(`*`)&&!e.match(/^\*|\*$|\*\*|\/\*|\*\.|\*\)/)&&!e.includes(`**`))return{valid:!1,error:`Wildcard placement might be incorrect`,suggestion:`Wildcards are typically used at path boundaries`,examples:[`${n.toolName}(*.js) - all .js files`,`${n.toolName}(src/*) - all files directly in src`,`${n.toolName}(src/**) - all files recursively in src`]}}if(n&&n.toolName===`VaultHttpFetch`&&n.ruleContent!==void 0){let e=n.ruleContent;if(e.length>384)return{valid:!1,error:`VaultHttpFetch rule content is too long (${e.length} chars; max 384)`,suggestion:`Use a shorter key name and host, or use the wildcard form <key>@*`};if(/[\x00-\x1F\x7F]/.test(e))return{valid:!1,error:`VaultHttpFetch rule content contains control characters (only printable ASCII allowed in key@host)`,suggestion:`Remove control characters from the rule content`}}if(n&&n.toolName===`VaultHttpFetch`&&t===`deny`&&n.ruleContent!==void 0&&!/^[A-Za-z0-9._-]{1,128}@(?:\*|(?:\[[A-Fa-f0-9:]+\]|[A-Za-z0-9.-]{1,253})(?::(?:[1-9]\d{0,3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5]))?)$/.test(n.ruleContent))return{valid:!1,error:`VaultHttpFetch deny rule content must be '<key>@<host>' or '<key>@*' (or whole-tool deny without parentheses for kill switch)`,suggestion:`Found '${n.ruleContent}'. Use 'VaultHttpFetch' (no parens) for kill switch, or 'VaultHttpFetch(${n.ruleContent}@*)' for any-host.`,examples:[`VaultHttpFetch — whole-tool kill switch`,`VaultHttpFetch(${n.ruleContent}@api.github.com)`,`VaultHttpFetch(${n.ruleContent}@*)`]};if(t===`allow`&&n){if(n.ruleContent===void 0&&_h.has(n.toolName))return{valid:!1,error:`Whole-tool allow forbidden for vault tool '${n.toolName}'`,suggestion:`Use per-key + per-host allow: '${n.toolName}(your-key-name@host)'`,examples:[`${n.toolName}(github-token@api.github.com)`,`${n.toolName}(my-api@*) - allow any host (advanced)`]};if(n.toolName===`VaultHttpFetch`&&n.ruleContent!==void 0&&!/^[A-Za-z0-9._-]{1,128}@(?:\*|(?:\[[A-Fa-f0-9:]+\]|[A-Za-z0-9.-]{1,253})(?::(?:[1-9]\d{0,3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5]))?)$/.test(n.ruleContent))return{valid:!1,error:`VaultHttpFetch rule content must be '<key>@<host>' or '<key>@*'`,suggestion:`Found '${n.ruleContent}'. Use e.g. 'github-token@api.github.com' or 'admin-key@127.0.0.1:8443' to bind a key to a host.`,examples:[`VaultHttpFetch(github-token@api.github.com)`,`VaultHttpFetch(local-admin@localhost:8443)`,`VaultHttpFetch(stripe-key@*) - any host (advanced)`]}}return{valid:!0}}var _h,vh,yh=t((()=>{Je(),Nm(),ui(),sh(),ni(),fh(),_h=new Set([`LocalVaultFetch`,`VaultHttpFetch`]),vh=L(()=>b().superRefine((e,t)=>{let n=gh(e);if(!n.valid){let r=n.error;n.suggestion&&(r+=`. ${n.suggestion}`),n.examples&&n.examples.length>0&&(r+=`. Examples: ${n.examples.join(`, `)}`),t.addIssue({code:qe.custom,message:r,params:{received:e}})}}))}));function bh(e){return`serverName`in e&&e.serverName!==void 0}function xh(e){return`serverCommand`in e&&e.serverCommand!==void 0}function Sh(e){return`serverUrl`in e&&e.serverUrl!==void 0}var Ch,wh,Th,Eh,Dh,Oh,kh,Ah=t((()=>{Je(),ep(),g(),ui(),gp(),Em(),Hf(),yh(),Dp(),Kr(),Ch=L(()=>x(b(),Ge())),wh=L(()=>D({allow:S(vh()).optional().describe(`List of permission rules for allowed operations`),deny:S(vh()).optional().describe(`List of permission rules for denied operations`),ask:S(vh()).optional().describe(`List of permission rules that should always prompt for confirmation`),defaultMode:E(Ei).optional().describe(`Default permission mode when Claude Code needs access`),disableBypassPermissionsMode:E([`disable`]).optional().describe(`Disable the ability to bypass permission prompts`),disableAutoMode:E([`disable`]).optional().describe(`Disable auto mode`),additionalDirectories:S(b()).optional().describe(`Additional directories to include in the permission scope`)}).passthrough()),Th=L(()=>D({source:um().describe(`Where to fetch the marketplace from`),installLocation:b().optional().describe(`Local cache path where marketplace manifest is stored (auto-generated if not provided)`),autoUpdate:w().optional().describe(`Whether to automatically update this marketplace and its installed plugins on startup`)})),Eh=L(()=>D({serverName:b().regex(/^[a-zA-Z0-9_-]+$/,`Server name can only contain letters, numbers, hyphens, and underscores`).optional().describe(`Name of the MCP server that users are allowed to configure`),serverCommand:S(b()).min(1,`Server command must have at least one element (the command)`).optional().describe(`Command array [command, ...args] to match exactly for allowed stdio servers`),serverUrl:b().optional().describe(`URL pattern with wildcard support (e.g., "https://*.example.com/*") for allowed remote MCP servers`)}).refine(e=>Gr([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:`Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"`})),Dh=L(()=>D({serverName:b().regex(/^[a-zA-Z0-9_-]+$/,`Server name can only contain letters, numbers, hyphens, and underscores`).optional().describe(`Name of the MCP server that is explicitly blocked`),serverCommand:S(b()).min(1,`Server command must have at least one element (the command)`).optional().describe(`Command array [command, ...args] to match exactly for blocked stdio servers`),serverUrl:b().optional().describe(`URL pattern with wildcard support (e.g., "https://*.example.com/*") for blocked remote MCP servers`)}).refine(e=>Gr([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:`Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"`})),Oh=[`skills`,`agents`,`hooks`,`mcp`],kh=L(()=>D({$schema:T(Vf).optional().describe(`JSON Schema reference for Claude Code settings`),apiKeyHelper:b().optional().describe(`Path to a script that outputs authentication values`),awsCredentialExport:b().optional().describe(`Path to a script that exports AWS credentials`),awsAuthRefresh:b().optional().describe(`Path to a script that refreshes AWS authentication`),gcpAuthRefresh:b().optional().describe(`Command to refresh GCP authentication (e.g., gcloud auth application-default login)`),..._(process.env.CLAUDE_CODE_ENABLE_XAA)?{xaaIdp:D({issuer:b().url().describe(`IdP issuer URL for OIDC discovery`),clientId:b().describe(`Claude Code's client_id registered at the IdP`),callbackPort:y().int().positive().optional().describe(`Fixed loopback callback port for the IdP OIDC login. Only needed if the IdP does not honor RFC 8252 port-any matching.`)}).optional().describe(`XAA (SEP-990) IdP connection. Configure once; all XAA-enabled MCP servers reuse this.`)}:{},fileSuggestion:D({type:T(`command`),command:b()}).optional().describe(`Custom file suggestion configuration for @ mentions`),respectGitignore:w().optional().describe(`Whether file picker should respect .gitignore files (default: true). Note: .ignore files are always respected.`),cleanupPeriodDays:y().nonnegative().int().optional().describe(`Number of days to retain chat transcripts (default: 30). Setting to 0 disables session persistence entirely: no transcripts are written and existing transcripts are deleted at startup.`),env:Ch().optional().describe(`Environment variables to set for Claude Code sessions`),attribution:D({commit:b().optional().describe(`Attribution text for git commits, including any trailers. Empty string hides attribution.`),pr:b().optional().describe(`Attribution text for pull request descriptions. Empty string hides attribution.`)}).optional().describe(`Customize attribution text for commits and PRs. Each field defaults to the standard Claude Code attribution if not set.`),includeCoAuthoredBy:w().optional().describe(`Deprecated: Use attribution instead. Whether to include Claude's co-authored by attribution in commits and PRs (defaults to true)`),includeGitInstructions:w().optional().describe(`Include built-in commit and PR workflow instructions in Claude's system prompt (default: true)`),permissions:wh().optional().describe(`Tool usage permissions configuration`),modelType:E([`anthropic`,`openai`,`gemini`,`grok`]).optional().describe(`API provider type. "anthropic" uses the Anthropic API (default), "openai" uses the OpenAI Chat Completions API, "gemini" uses the Gemini API, and "grok" uses the xAI Grok API (OpenAI-compatible). When set to "openai", configure OPENAI_API_KEY, OPENAI_BASE_URL, and OPENAI_MODEL. When set to "gemini", configure GEMINI_API_KEY and optional GEMINI_BASE_URL. When set to "grok", configure GROK_API_KEY (or XAI_API_KEY), optional GROK_BASE_URL, GROK_MODEL, and GROK_MODEL_MAP.`),model:b().optional().describe(`Override the default model used by Claude Code`),availableModels:S(b()).optional().describe(`Allowlist of models that users can select. Accepts family aliases ("opus" allows any opus version), version prefixes ("opus-4-5" allows only that version), and full model IDs. If undefined, all models are available. If empty array, only the default model is available. Typically set in managed settings by enterprise administrators.`),modelOverrides:x(b(),b()).optional().describe(`Override mapping from Anthropic model ID (e.g. "claude-opus-4-6") to provider-specific model ID (e.g. a Bedrock inference profile ARN). Typically set in managed settings by enterprise administrators.`),enableAllProjectMcpServers:w().optional().describe(`Whether to automatically approve all MCP servers in the project`),enabledMcpjsonServers:S(b()).optional().describe(`List of approved MCP servers from .mcp.json`),disabledMcpjsonServers:S(b()).optional().describe(`List of rejected MCP servers from .mcp.json`),allowedMcpServers:S(Eh()).optional().describe(`Enterprise allowlist of MCP servers that can be used. Applies to all scopes including enterprise servers from managed-mcp.json. If undefined, all servers are allowed. If empty array, no servers are allowed. Denylist takes precedence - if a server is on both lists, it is denied.`),deniedMcpServers:S(Dh()).optional().describe(`Enterprise denylist of MCP servers that are explicitly blocked. If a server is on the denylist, it will be blocked across all scopes including enterprise. Denylist takes precedence over allowlist - if a server is on both lists, it is denied.`),hooks:Ep().optional().describe(`Custom commands to run before/after tool executions`),worktree:D({symlinkDirectories:S(b()).optional().describe(`Directories to symlink from main repository to worktrees to avoid disk bloat. Must be explicitly configured - no directories are symlinked by default. Common examples: "node_modules", ".cache", ".bin"`),sparsePaths:S(b()).optional().describe(`Directories to include when creating worktrees, via git sparse-checkout (cone mode). Dramatically faster in large monorepos — only the listed paths are written to disk.`)}).optional().describe(`Git worktree configuration for --worktree flag.`),disableAllHooks:w().optional().describe(`Disable all hooks and statusLine execution`),defaultShell:E([`bash`,`powershell`]).optional().describe(`Default shell for input-box ! commands. Defaults to 'powershell' on Windows when the PowerShell tool is enabled, otherwise 'bash'. Set explicitly to override.`),allowManagedHooksOnly:w().optional().describe(`When true (and set in managed settings), only hooks from managed settings run. User, project, and local hooks are ignored.`),allowedHttpHookUrls:S(b()).optional().describe(`Allowlist of URL patterns that HTTP hooks may target. Supports * as a wildcard (e.g. "https://hooks.example.com/*"). When set, HTTP hooks with non-matching URLs are blocked. If undefined, all URLs are allowed. If empty array, no HTTP hooks are allowed. Arrays merge across settings sources (same semantics as allowedMcpServers).`),httpHookAllowedEnvVars:S(b()).optional().describe(`Allowlist of environment variable names HTTP hooks may interpolate into headers. When set, each hook's effective allowedEnvVars is the intersection with this list. If undefined, no restriction is applied. Arrays merge across settings sources (same semantics as allowedMcpServers).`),allowManagedPermissionRulesOnly:w().optional().describe(`When true (and set in managed settings), only permission rules (allow/deny/ask) from managed settings are respected. User, project, local, and CLI argument permission rules are ignored.`),allowManagedMcpServersOnly:w().optional().describe(`When true (and set in managed settings), allowedMcpServers is only read from managed settings. deniedMcpServers still merges from all sources, so users can deny servers for themselves. Users can still add their own MCP servers, but only the admin-defined allowlist applies.`),strictPluginOnlyCustomization:He(e=>Array.isArray(e)?e.filter(e=>Oh.includes(e)):e,C([w(),S(E(Oh))])).optional().catch(void 0).describe('When set in managed settings, blocks non-plugin customization sources for the listed surfaces. Array form locks specific surfaces (e.g. ["skills", "hooks"]); `true` locks all four; `false` is an explicit no-op. Blocked: ~/.claude/{surface}/, .claude/{surface}/ (project), settings.json hooks, .mcp.json. NOT blocked: managed (policySettings) sources, plugin-provided customizations. Composes with strictKnownMarketplaces for end-to-end admin control — plugins gated by marketplace allowlist, everything else blocked here.'),statusLine:D({type:T(`command`),command:b(),padding:y().optional(),refreshInterval:y().optional()}).optional().describe(`Custom status line display configuration`),statusLineEnabled:w().optional().describe(`Whether to render the fork built-in status line (model + ctx + 5h/7d limits + cost + cache pill). Toggled with /statusline.`),enabledPlugins:x(b(),C([S(b()),w(),Be()])).optional().describe(`Enabled plugins using plugin-id@marketplace-id format. Example: { "formatter@anthropic-tools": true }. Also supports extended format with version constraints.`),extraKnownMarketplaces:x(b(),Th()).check(e=>{for(let[t,n]of Object.entries(e.value))n.source.source===`settings`&&n.source.name!==t&&e.issues.push({code:`custom`,input:n.source.name,path:[t,`source`,`name`],message:`Settings-sourced marketplace name must match its extraKnownMarketplaces key (got key "${t}" but source.name "${n.source.name}")`})}).optional().describe(`Additional marketplaces to make available for this repository. Typically used in repository .claude/settings.json to ensure team members have required plugin sources.`),strictKnownMarketplaces:S(um()).optional().describe(`Enterprise strict list of allowed marketplace sources. When set in managed settings, ONLY these exact sources can be added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem. Note: this is a policy gate only — it does NOT register marketplaces. To pre-register allowed marketplaces for users, also set extraKnownMarketplaces.`),blockedMarketplaces:S(um()).optional().describe(`Enterprise blocklist of marketplace sources. When set in managed settings, these exact sources are blocked from being added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem.`),forceLoginMethod:E([`claudeai`,`console`]).optional().describe(`Force a specific login method: "claudeai" for Claude Pro/Max, "console" for Console billing`),forceLoginOrgUUID:b().optional().describe(`Organization UUID to use for OAuth login`),otelHeadersHelper:b().optional().describe(`Path to a script that outputs OpenTelemetry headers`),outputStyle:b().optional().describe(`Controls the output style for assistant responses`),language:b().optional().describe(`Preferred language for Claude responses and voice dictation (e.g., "japanese", "spanish")`),skipWebFetchPreflight:w().optional().describe(`Skip the WebFetch blocklist check for enterprise environments with restrictive security policies`),webSearchAdapter:E([`api`,`bing`,`brave`,`exa`,`tavily`]).optional().describe(`Web search backend adapter. "tavily" uses Tavily Search API (default), "api" uses Anthropic server-side search, "bing" scrapes Bing HTML, "brave" uses Brave Search API, "exa" uses Exa AI.`),webFetchAdapter:E([`tavily`,`http`]).optional().describe(`Web fetch backend. "tavily" uses Tavily Extract API which returns Markdown directly (default), "http" fetches the URL directly via HTTP.`),tavilyEndpointUrl:b().optional().describe(`Custom Tavily API endpoint URL. Defaults to https://tavily.claude-code-best.win. Used by both WebSearch and WebFetch when tavily adapter is selected.`),braveApiKey:b().optional().describe(`Brave Search API key. Required when using the brave web search adapter.`),webFetchHttpTimeoutMs:y().int().positive().optional().describe(`HTTP timeout in milliseconds for the HTTP direct web fetch backend. Defaults to 60000 (60s).`),exaApiKey:b().optional().describe(`Exa AI API key. Required when using the exa web search adapter.`),exaEndpointUrl:b().optional().describe(`Custom Exa AI MCP endpoint URL. Defaults to https://mcp.exa.ai/mcp.`),sandbox:$f().optional(),feedbackSurveyRate:y().min(0).max(1).optional().describe(`Probability (0–1) that the session quality survey appears when eligible. 0.05 is a reasonable starting point.`),spinnerTipsEnabled:w().optional().describe(`Whether to show tips in the spinner`),spinnerVerbs:D({mode:E([`append`,`replace`]),verbs:S(b())}).optional().describe(`Customize spinner verbs. mode: "append" adds verbs to defaults, "replace" uses only your verbs.`),spinnerTipsOverride:D({excludeDefault:w().optional(),tips:S(b())}).optional().describe(`Override spinner tips. tips: array of tip strings. excludeDefault: if true, only show custom tips (default: false).`),syntaxHighlightingDisabled:w().optional().describe(`Whether to disable syntax highlighting in diffs`),terminalTitleFromRename:w().optional().describe(`Whether /rename updates the terminal tab title (defaults to true). Set to false to keep auto-generated topic titles.`),alwaysThinkingEnabled:w().optional().describe(`When false, thinking is disabled. When absent or true, thinking is enabled automatically for supported models.`),effortLevel:E(process.env.USER_TYPE===`ant`?[`low`,`medium`,`high`,`xhigh`,`max`]:[`low`,`medium`,`high`,`xhigh`]).optional().catch(void 0).describe(`Persisted effort level for supported models.`),advisorModel:b().optional().describe(`Advisor model for the server-side advisor tool.`),fastMode:w().optional().describe(`When true, fast mode is enabled. When absent or false, fast mode is off.`),fastModePerSessionOptIn:w().optional().describe(`When true, fast mode does not persist across sessions. Each session starts with fast mode off.`),promptSuggestionEnabled:w().optional().describe(`When false, prompt suggestions are disabled. When absent or true, prompt suggestions are enabled.`),poorMode:w().optional().describe(`When true, poor mode is active — extract_memories and prompt_suggestion are disabled to save tokens.`),showClearContextOnPlanAccept:w().optional().describe(`When true, the plan-approval dialog offers a "clear context" option. Defaults to false.`),agent:b().optional().describe(`Name of an agent (built-in or custom) to use for the main thread. Applies the agent's system prompt, tool restrictions, and model.`),companyAnnouncements:S(b()).optional().describe(`Company announcements to display at startup (one will be randomly selected if multiple are provided)`),pluginConfigs:x(b(),D({mcpServers:x(b(),x(b(),C([b(),y(),w(),S(b())]))).optional().describe(`User configuration values for MCP servers keyed by server name`),options:x(b(),C([b(),y(),w(),S(b())])).optional().describe(`Non-sensitive option values from plugin manifest userConfig, keyed by option name. Sensitive values go to secure storage instead.`)})).optional().describe(`Per-plugin configuration including MCP server user configs, keyed by plugin ID (plugin@marketplace format)`),remote:D({defaultEnvironmentId:b().optional().describe(`Default environment ID to use for remote sessions`)}).optional().describe(`Remote session configuration`),autoUpdatesChannel:E([`latest`,`stable`]).optional().describe(`Release channel for auto-updates (latest or stable)`),disableDeepLinkRegistration:E([`disable`]).optional().describe(`Prevent claude-cli:// protocol handler registration with the OS`),minimumVersion:b().optional().describe(`Minimum version to stay on - prevents downgrades when switching to stable channel`),plansDirectory:b().optional().describe(`Custom directory for plan files, relative to project root. If not set, defaults to ~/.claude/plans/`),...process.env.USER_TYPE===`ant`?{classifierPermissionsEnabled:w().optional().describe(`Enable AI-based classification for Bash(prompt:...) permission rules`)}:{},minSleepDurationMs:y().nonnegative().int().optional().describe(`Minimum duration in milliseconds that the Sleep tool must sleep for. Useful for throttling proactive tick frequency.`),maxSleepDurationMs:y().int().min(-1).optional().describe(`Maximum duration in milliseconds that the Sleep tool can sleep for. Set to -1 for indefinite sleep (waits for user input). Useful for limiting idle time in remote/managed environments.`),voiceEnabled:w().optional().describe(`Enable voice mode (hold-to-talk dictation)`),voiceProvider:E([`anthropic`,`doubao`]).optional().describe(`Voice STT backend: "anthropic" (default) or "doubao" (Doubao ASR)`),assistant:w().optional().describe(`Start Claude in assistant mode (custom system prompt, brief view, scheduled check-in skills)`),assistantName:b().optional().describe(`Display name for the assistant, shown in the claude.ai session list`),channelsEnabled:w().optional().describe(`Teams/Enterprise opt-in for channel notifications (MCP servers with the claude/channel capability pushing inbound messages). Default off. Set true to allow; users then select servers via --channels.`),allowedChannelPlugins:S(D({marketplace:b(),plugin:b()})).optional().describe(`Teams/Enterprise allowlist of channel plugins. When set, replaces the default Anthropic allowlist — admins decide which plugins may push inbound messages. Undefined falls back to the default. Requires channelsEnabled: true.`),defaultView:E([`chat`,`transcript`]).optional().describe(`Default transcript view: chat (SendUserMessage checkpoints only) or transcript (full)`),prefersReducedMotion:w().optional().describe(`Reduce or disable animations for accessibility (spinner shimmer, flash effects, etc.)`),autoMemoryEnabled:w().optional().describe(`Enable auto-memory for this project. When false, Claude will not read from or write to the auto-memory directory.`),autoMemoryDirectory:b().optional().describe(`Custom directory path for auto-memory storage. Supports ~/ prefix for home directory expansion. Ignored if set in projectSettings (checked-in .claude/settings.json) for security. When unset, defaults to ~/.claude/projects/<sanitized-cwd>/memory/.`),autoDreamEnabled:w().optional().describe(`Enable background memory consolidation (auto-dream). When set, overrides the server-side default.`),showThinkingSummaries:w().optional().describe(`Show thinking summaries in the transcript view (ctrl+o). Default: false.`),skipDangerousModePermissionPrompt:w().optional().describe(`Whether the user has accepted the bypass permissions mode dialog`),skipAutoPermissionPrompt:w().optional().describe(`Whether the user has accepted the auto mode opt-in dialog`),useAutoModeDuringPlan:w().optional().describe(`Whether plan mode uses auto mode semantics when auto mode is available (default: true)`),autoMode:D({allow:S(b()).optional().describe(`Rules for the auto mode classifier allow section`),soft_deny:S(b()).optional().describe(`Rules for the auto mode classifier deny section`),...process.env.USER_TYPE===`ant`?{deny:S(b()).optional()}:{},environment:S(b()).optional().describe(`Entries for the auto mode classifier environment section`)}).optional().describe(`Auto mode classifier prompt customization`),disableAutoMode:E([`disable`]).optional().describe(`Disable auto mode`),sshConfigs:S(D({id:b().describe(`Unique identifier for this SSH config. Used to match configs across settings sources.`),name:b().describe(`Display name for the SSH connection`),sshHost:b().describe(`SSH host in format "user@hostname" or "hostname", or a host alias from ~/.ssh/config`),sshPort:y().int().optional().describe(`SSH port (default: 22)`),sshIdentityFile:b().optional().describe(`Path to SSH identity file (private key)`),startDirectory:b().optional().describe("Default working directory on the remote host. Supports tilde expansion (e.g. ~/projects). If not specified, defaults to the remote user home directory. Can be overridden by the [dir] positional argument in `claude ssh <config> [dir]`.")})).optional().describe(`SSH connection configurations for remote environments. Typically set in managed settings by enterprise administrators to pre-configure SSH connections for team members.`),claudeMdExcludes:S(b()).optional().describe(`Glob patterns or absolute paths of CLAUDE.md files to exclude from loading. Patterns are matched against absolute file paths using picomatch. Only applies to User, Project, and Local memory types (Managed/policy files cannot be excluded). Examples: "/home/user/monorepo/CLAUDE.md", "**/code/CLAUDE.md", "**/some-dir/.claude/rules/**"`),cacheThreshold:y().int().min(0).max(100).optional().describe(`Prompt cache hit rate threshold (0-100). Warnings shown when cache hit rate falls below this percentage. Default: 70.`),cacheWarningEnabled:w().optional().describe(`Whether to show cache hit rate warnings in the message flow when the rate falls below cacheThreshold. Default: true.`),pluginTrustMessage:b().optional().describe(`Custom message to append to the plugin trust warning shown before installation. Only read from policy settings (managed-settings.json / MDM). Useful for enterprise administrators to add organization-specific context (e.g., "All plugins from our internal marketplace are vetted and approved.").`),workspaceApiKey:b().optional().describe(`Workspace API key (sk-ant-api03-*) saved via /login UI. Stored in plaintext — keep this file gitignored and restrict its permissions. ANTHROPIC_API_KEY environment variable takes precedence when both are set.`)}).passthrough())}));function jh(){return A(ze(kh(),{unrepresentable:`any`}),null,2)}var Mh=t((()=>{Je(),vn(),Ah()}));function Nh(e){let t=Fh.find(t=>t.matches(e));if(!t)return null;let n={...t.tip};if(e.code===`invalid_value`&&e.enumValues&&!n.suggestion&&(n.suggestion=`Valid values: ${e.enumValues.map(e=>`"${e}"`).join(`, `)}`),!n.docLink&&e.path){let t=e.path.split(`.`)[0];t&&(n.docLink=Ih[t])}return n}var Ph,Fh,Ih,Lh=t((()=>{Ph=`https://code.claude.com/docs/en`,Fh=[{matches:e=>e.path===`permissions.defaultMode`&&e.code===`invalid_value`,tip:{suggestion:`Valid modes: "acceptEdits" (ask before file changes), "plan" (analysis only), "bypassPermissions" (auto-accept all), or "default" (standard behavior)`,docLink:`${Ph}/iam#permission-modes`}},{matches:e=>e.path===`apiKeyHelper`&&e.code===`invalid_type`,tip:{suggestion:`Provide a shell command that outputs your API key to stdout. The script should output only the API key. Example: "/bin/generate_temp_api_key.sh"`}},{matches:e=>e.path===`cleanupPeriodDays`&&e.code===`too_small`&&e.expected===`0`,tip:{suggestion:`Must be 0 or greater. Set a positive number for days to retain transcripts (default is 30). Setting 0 disables session persistence entirely: no transcripts are written and existing transcripts are deleted at startup.`}},{matches:e=>e.path.startsWith(`env.`)&&e.code===`invalid_type`,tip:{suggestion:`Environment variables must be strings. Wrap numbers and booleans in quotes. Example: "DEBUG": "true", "PORT": "3000"`,docLink:`${Ph}/settings#environment-variables`}},{matches:e=>(e.path===`permissions.allow`||e.path===`permissions.deny`)&&e.code===`invalid_type`&&e.expected===`array`,tip:{suggestion:`Permission rules must be in an array. Format: ["Tool(specifier)"]. Examples: ["Bash(npm run build)", "Edit(docs/**)", "Read(~/.zshrc)"]. Use * for wildcards.`}},{matches:e=>e.path.includes(`hooks`)&&e.code===`invalid_type`,tip:{suggestion:`Hooks use a matcher + hooks array. The matcher is a string: a tool name ("Bash"), pipe-separated list ("Edit|Write"), or empty to match all. Example: {"PostToolUse": [{"matcher": "Edit|Write", "hooks": [{"type": "command", "command": "echo Done"}]}]}`}},{matches:e=>e.code===`invalid_type`&&e.expected===`boolean`,tip:{suggestion:`Use true or false without quotes. Example: "includeCoAuthoredBy": true`}},{matches:e=>e.code===`unrecognized_keys`,tip:{suggestion:`Check for typos or refer to the documentation for valid fields`,docLink:`${Ph}/settings`}},{matches:e=>e.code===`invalid_value`&&e.enumValues!==void 0,tip:{suggestion:void 0}},{matches:e=>e.code===`invalid_type`&&e.expected===`object`&&e.received===null&&e.path===``,tip:{suggestion:`Check for missing commas, unmatched brackets, or trailing commas. Use a JSON validator to identify the exact syntax error.`}},{matches:e=>e.path===`permissions.additionalDirectories`&&e.code===`invalid_type`,tip:{suggestion:`Must be an array of directory paths. Example: ["~/projects", "/tmp/workspace"]. You can also use --add-dir flag or /add-dir command`,docLink:`${Ph}/iam#working-directories`}}],Ih={permissions:`${Ph}/iam#configuring-permissions`,env:`${Ph}/settings#environment-variables`,hooks:`${Ph}/hooks`}}));function Rh(e){return e.code===`invalid_type`}function zh(e){return e.code===`invalid_value`}function Bh(e){return e.code===`unrecognized_keys`}function Vh(e){return e.code===`too_small`}function Hh(e){return e===null?`null`:e===void 0?`undefined`:Array.isArray(e)?`array`:typeof e}function Uh(e){let t=e.match(/received (\w+)/);return t?t[1]:void 0}function Wh(e,t){return e.issues.map(e=>{let n=e.path.map(String).join(`.`),r=e.message,i,a,o,s,c;if(zh(e))a=e.values.map(e=>String(e)),o=a.join(` | `),s=void 0,c=void 0;else if(Rh(e)){o=e.expected;let t=Uh(e.message);s=t??Hh(e.input),c=t??Hh(e.input)}else Vh(e)?o=String(e.minimum):e.code===`custom`&&`params`in e&&(s=e.params.received,c=s);let l=Nh({path:n,code:e.code,expected:o,received:s,enumValues:a,message:e.message,value:s});if(zh(e))i=a?.map(e=>`"${e}"`).join(`, `),r=`Invalid value. Expected one of: ${i}`;else if(Rh(e)){let t=Uh(e.message)??Hh(e.input);r=e.expected===`object`&&t===`null`&&n===``?`Invalid or malformed JSON`:`Expected ${e.expected}, but received ${t}`}else if(Bh(e)){let t=e.keys.join(`, `);r=`Unrecognized ${ri(e.keys.length,`field`)}: ${t}`}else Vh(e)&&(r=`Number must be greater than or equal to ${e.minimum}`,i=String(e.minimum));return{file:t,path:n,message:r,expected:i,invalidValue:c,suggestion:l?.suggestion,docLink:l?.docLink}})}function Gh(e){try{let t=gn(e),n=kh().strict().safeParse(t);return n.success?{isValid:!0}:{isValid:!1,error:`Settings validation failed:
22
+ `+Wh(n.error,`settings`).map(e=>`- ${e.path}: ${e.message}`).join(`
23
+ `),fullSchema:jh()}}catch(e){return{isValid:!1,error:`Invalid JSON: ${e instanceof Error?e.message:`Unknown parsing error`}`,fullSchema:jh()}}}function Kh(e,t){if(!e||typeof e!=`object`)return[];let n=e;if(!n.permissions||typeof n.permissions!=`object`)return[];let r=n.permissions,i=[];for(let e of[`allow`,`deny`,`ask`]){let n=r[e];Array.isArray(n)&&(r[e]=n.filter(n=>{if(typeof n!=`string`)return i.push({file:t,path:`permissions.${e}`,message:`Non-string value in ${e} array was removed`,invalidValue:n}),!1;let r=gh(n,e);if(!r.valid){let a=`Invalid permission rule "${n}" was skipped`;return r.error&&(a+=`: ${r.error}`),r.suggestion&&(a+=`. ${r.suggestion}`),i.push({file:t,path:`permissions.${e}`,message:a,invalidValue:n}),!1}return!0}))}return i}var qh=t((()=>{vn(),ni(),yh(),Mh(),Ah(),Lh()}));function Jh(){let e=``;try{e=Ji().username}catch{}let t=[];return e&&t.push({path:`/Library/Managed Preferences/${e}/${Yh}.plist`,label:`per-user managed preferences`}),t.push({path:`/Library/Managed Preferences/${Yh}.plist`,label:`device-level managed preferences`}),process.env.USER_TYPE===`ant`&&t.push({path:z(qi(),`Library`,`Preferences`,`${Yh}.plist`),label:`user preferences (ant-only)`}),t}var Yh,Xh,Zh,Qh,$h,eg,tg,ng=t((()=>{Yh=`com.anthropic.claudecode`,Xh=`HKLM\\SOFTWARE\\Policies\\ClaudeCode`,Zh=`HKCU\\SOFTWARE\\Policies\\ClaudeCode`,Qh=`Settings`,$h=`/usr/bin/plutil`,eg=[`-convert`,`json`,`-o`,`-`,`--`],tg=5e3}));function rg(e,t){return new Promise(n=>{xa(e,t,{encoding:`utf-8`,timeout:tg},(e,t)=>{n({stdout:t??``,code:+!!e})})})}function ig(){return(async()=>{if(process.platform===`darwin`){let e=Jh(),t=(await Promise.all(e.map(async({path:e,label:t})=>{if(!ia(e))return{stdout:``,label:t,ok:!1};let{stdout:n,code:r}=await rg($h,[...eg,e]);return{stdout:n,label:t,ok:r===0&&!!n}}))).find(e=>e.ok);return{plistStdouts:t?[{stdout:t.stdout,label:t.label}]:[],hklmStdout:null,hkcuStdout:null}}if(process.platform===`win32`){let[e,t]=await Promise.all([rg(`reg`,[`query`,Xh,`/v`,Qh]),rg(`reg`,[`query`,Zh,`/v`,Qh])]);return{plistStdouts:null,hklmStdout:e.code===0?e.stdout:null,hkcuStdout:t.code===0?t.stdout:null}}return{plistStdouts:null,hklmStdout:null,hkcuStdout:null}})()}function ag(){sg||(sg=ig())}function og(){return sg}var sg,cg=t((()=>{ng(),sg=null}));function lg(){Sg||(Sg=(async()=>{li(`mdm_load_start`);let e=Date.now(),{mdm:t,hkcu:n}=_g(await(og()??ig()));bg=t,xg=n,li(`mdm_load_end`);let r=Date.now()-e;if(N(`MDM settings load completed in ${r}ms`),Object.keys(t.settings).length>0){N(`MDM settings found: ${Object.keys(t.settings).join(`, `)}`);try{or(`info`,`mdm_settings_loaded`,{duration_ms:r,key_count:Object.keys(t.settings).length,error_count:t.errors.length})}catch{}}})())}async function ug(){Sg||lg(),await Sg}function dg(){return bg??yg}function fg(){return xg??yg}function pg(e,t){bg=e,xg=t}async function mg(){return _g(await ig())}function hg(e,t){let n=Hr(e,!1);if(!n||typeof n!=`object`)return{settings:{},errors:[]};let r=Kh(n,t),i=kh().safeParse(n);if(!i.success){let e=Wh(i.error,t);return{settings:{},errors:[...r,...e]}}return{settings:i.data,errors:r}}function gg(e,t=`Settings`){let n=e.split(/\r?\n/),r=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),i=RegExp(`^\\s+${r}\\s+REG_(?:EXPAND_)?SZ\\s+(.*)$`,`i`);for(let e of n){let t=e.match(i);if(t&&t[1])return t[1].trimEnd()}return null}function _g(e){if(e.plistStdouts&&e.plistStdouts.length>0){let{stdout:t,label:n}=e.plistStdouts[0],r=hg(t,n);if(Object.keys(r.settings).length>0)return{mdm:r,hkcu:yg}}if(e.hklmStdout){let t=gg(e.hklmStdout);if(t){let e=hg(t,`Registry: ${Xh}\\${Qh}`);if(Object.keys(e.settings).length>0)return{mdm:e,hkcu:yg}}}if(vg())return{mdm:yg,hkcu:yg};if(e.hkcuStdout){let t=gg(e.hkcuStdout);if(t)return{mdm:yg,hkcu:hg(t,`Registry: ${Zh}\\${Qh}`)}}return{mdm:yg,hkcu:yg}}function vg(){try{let e=Hr(Fd(z(Jf(),`managed-settings.json`)),!1);if(e&&typeof e==`object`&&Object.keys(e).length>0)return!0}catch{}try{let e=Yf(),t=j().readdirSync(e);for(let n of t)if(!(!(n.isFile()||n.isSymbolicLink())||!n.name.endsWith(`.json`)||n.name.startsWith(`.`)))try{let t=Hr(Fd(z(e,n.name)),!1);if(t&&typeof t==`object`&&Object.keys(t).length>0)return!0}catch{}}catch{}return!1}var yg,bg,xg,Sg,Cg=t((()=>{M(),cr(),Id(),An(),Vr(),ci(),Xf(),Ah(),qh(),ng(),cg(),yg=Object.freeze({settings:{},errors:[]}),bg=null,xg=null,Sg=null}));function wg(){return z(Jf(),`managed-settings.json`)}function Tg(){let e=[],t={},n=!1,{settings:r,errors:i}=Og(wg());e.push(...i),r&&Object.keys(r).length>0&&(t=yu(t,r,Rg),n=!0);let a=Yf();try{let r=j().readdirSync(a).filter(e=>(e.isFile()||e.isSymbolicLink())&&e.name.endsWith(`.json`)&&!e.name.startsWith(`.`)).map(e=>e.name).sort();for(let i of r){let{settings:r,errors:o}=Og(z(a,i));e.push(...o),r&&Object.keys(r).length>0&&(t=yu(t,r,Rg),n=!0)}}catch(e){let t=mn(e);t!==`ENOENT`&&t!==`ENOTDIR`&&P(e)}return{settings:n?t:null,errors:e}}function Eg(){let{settings:e}=Og(wg()),t=!!e&&Object.keys(e).length>0,n=!1,r=Yf();try{n=j().readdirSync(r).some(e=>(e.isFile()||e.isSymbolicLink())&&e.name.endsWith(`.json`)&&!e.name.startsWith(`.`))}catch{}return{hasBase:t,hasDropIns:n}}function Dg(e,t){typeof e==`object`&&e&&`code`in e&&e.code===`ENOENT`?N(`Broken symlink or missing file encountered for settings.json at path: ${t}`):P(e)}function Og(e){let t=Vd(e);if(t)return{settings:t.settings?Dn(t.settings):null,errors:t.errors};let n=kg(e);return Hd(e,n),{settings:n.settings?Dn(n.settings):null,errors:n.errors}}function kg(e){try{let{resolvedPath:t}=Xn(j(),e),n=Fd(t);if(n.trim()===``)return{settings:{},errors:[]};let r=Hr(n,!1),i=Kh(r,e),a=kh().safeParse(r);if(!a.success){let t=Wh(a.error,e);return{settings:null,errors:[...i,...t]}}return{settings:a.data,errors:i}}catch(t){return Dg(t,e),{settings:null,errors:[]}}}function Ag(e){switch(e){case`userSettings`:return ta(h());case`policySettings`:case`projectSettings`:case`localSettings`:return ta(Xt());case`flagSettings`:{let e=Gt();return e?Zi(ta(e)):ta(Xt())}}}function jg(){return Qt()||_(process.env.CLAUDE_CODE_USE_COWORK_PLUGINS)?`cowork_settings.json`:`settings.json`}function Mg(e){switch(e){case`userSettings`:return z(Ag(e),jg());case`projectSettings`:case`localSettings`:return z(Ag(e),Ng(e));case`policySettings`:return wg();case`flagSettings`:return Gt()}}function Ng(e){switch(e){case`projectSettings`:return z(`.claude`,`settings.json`);case`localSettings`:return z(`.claude`,`settings.local.json`)}}function H(e){let t=zd(e);if(t!==void 0)return t;let n=Pg(e);return Bd(e,n),n}function Pg(e){if(e===`policySettings`){let e=rf();if(e&&Object.keys(e).length>0)return e;let t=dg();if(Object.keys(t.settings).length>0)return t.settings;let{settings:n}=Tg();if(n)return n;let r=fg();return Object.keys(r.settings).length>0?r.settings:null}let t=Mg(e),{settings:n}=t?Og(t):{settings:null};if(e===`flagSettings`){let e=Kt();if(e){let t=kh().safeParse(e);if(t.success)return yu(n||{},t.data,Rg)}}return n}function Fg(){let e=rf();if(e&&Object.keys(e).length>0)return`remote`;let t=dg();if(Object.keys(t.settings).length>0)return Or()===`macos`?`plist`:`hklm`;let{settings:n}=Tg();if(n)return`file`;let r=fg();return Object.keys(r.settings).length>0?`hkcu`:null}function Ig(e,t){if(e===`policySettings`||e===`flagSettings`)return{error:null};let n=Mg(e);if(!n)return{error:null};try{j().mkdirSync(Zi(n));let r=Pg(e);if(!r){let e=null;try{e=Fd(n)}catch(e){if(!bn(e))throw e}if(e!==null){let t=Hr(e);if(t===null)return{error:Error(`Invalid JSON syntax in settings file at ${n}`)};t&&typeof t==`object`&&(r=t,N(`Using raw settings from ${n} due to validation failure`))}}let i=yu(r||{},t,(e,t,n,r)=>{if(t===void 0&&r&&typeof n==`string`){delete r[n];return}if(Array.isArray(t))return t});Uf(n),Sf(n,A(i,null,2)+`
24
+ `),Ud(),e===`localSettings`&&jf(Ng(`localSettings`),Xt())}catch(e){let t=Error(`Failed to read raw settings from ${n}: ${e}`);return P(t),{error:t}}return{error:null}}function Lg(e,t){return Ur([...e,...t])}function Rg(e,t){if(Array.isArray(e)&&Array.isArray(t))return Lg(e,t)}function zg(e){let t=kh().strip().parse(e),n=[`permissions`,`sandbox`,`hooks`],r=[],i={permissions:new Set([`allow`,`deny`,`ask`,`defaultMode`,`disableBypassPermissionsMode`,...[`disableAutoMode`],`additionalDirectories`]),sandbox:new Set([`enabled`,`failIfUnavailable`,`allowUnsandboxedCommands`,`network`,`filesystem`,`ignoreViolations`,`excludedCommands`,`autoAllowBashIfSandboxed`,`enableWeakerNestedSandbox`,`enableWeakerNetworkIsolation`,`ripgrep`]),hooks:new Set([`PreToolUse`,`PostToolUse`,`Notification`,`UserPromptSubmit`,`SessionStart`,`SessionEnd`,`Stop`,`SubagentStop`,`PreCompact`,`PostCompact`,`TeammateIdle`,`TaskCreated`,`TaskCompleted`])};for(let e of Object.keys(t))if(n.includes(e)&&t[e]&&typeof t[e]==`object`){let n=t[e],a=i[e];if(a)for(let t of Object.keys(n))a.has(t)&&r.push(`${e}.${t}`)}else r.push(e);return r.sort()}function Bg(){if(Jg)return{settings:{},errors:[]};let e=Date.now();li(`loadSettingsFromDisk_start`),or(`info`,`settings_load_started`),Jg=!0;try{let t=Wd(),n={};t&&(n=yu(n,t,Rg));let r=[],i=new Set,a=new Set;for(let e of Lf()){if(e===`policySettings`){let e=null,t=[],a=rf();if(a&&Object.keys(a).length>0){let n=kh().safeParse(a);n.success?e=n.data:t.push(...Wh(n.error,`remote managed settings`))}if(!e){let n=dg();Object.keys(n.settings).length>0&&(e=n.settings),t.push(...n.errors)}if(!e){let{settings:n,errors:r}=Tg();n&&(e=n),t.push(...r)}if(!e){let n=fg();Object.keys(n.settings).length>0&&(e=n.settings),t.push(...n.errors)}e&&(n=yu(n,e,Rg));for(let e of t){let t=`${e.file}:${e.path}:${e.message}`;i.has(t)||(i.add(t),r.push(e))}continue}let t=Mg(e);if(t){let e=ta(t);if(!a.has(e)){a.add(e);let{settings:o,errors:s}=Og(t);for(let e of s){let t=`${e.file}:${e.path}:${e.message}`;i.has(t)||(i.add(t),r.push(e))}o&&(n=yu(n,o,Rg))}}if(e===`flagSettings`){let e=Kt();if(e){let t=kh().safeParse(e);t.success&&(n=yu(n,t.data,Rg))}}}return or(`info`,`settings_load_completed`,{duration_ms:Date.now()-e,source_count:a.size,error_count:r.length}),{settings:n,errors:r}}finally{Jg=!1}}function Vg(){let{settings:e}=Hg();return e||{}}function Hg(){let e=Ld();if(e!==null)return e;let t=Bg();return li(`loadSettingsFromDisk_end`),Rd(t),t}function Ug(){return!!(H(`userSettings`)?.skipDangerousModePermissionPrompt||H(`localSettings`)?.skipDangerousModePermissionPrompt||H(`flagSettings`)?.skipDangerousModePermissionPrompt||H(`policySettings`)?.skipDangerousModePermissionPrompt)}function Wg(){return!0}function Gg(){return H(`policySettings`)?.useAutoModeDuringPlan!==!1&&H(`flagSettings`)?.useAutoModeDuringPlan!==!1&&H(`userSettings`)?.useAutoModeDuringPlan!==!1&&H(`localSettings`)?.useAutoModeDuringPlan!==!1}function Kg(){{let e=D({allow:S(b()).optional(),soft_deny:S(b()).optional(),deny:S(b()).optional(),environment:S(b()).optional()}),t=[],n=[],r=[];for(let i of[`userSettings`,`localSettings`,`flagSettings`,`policySettings`]){let a=H(i);if(!a)continue;let o=e.safeParse(a.autoMode);o.success&&(o.data.allow&&t.push(...o.data.allow),o.data.soft_deny&&n.push(...o.data.soft_deny),process.env.USER_TYPE===`ant`&&o.data.deny&&n.push(...o.data.deny),o.data.environment&&r.push(...o.data.environment))}if(t.length>0||n.length>0||r.length>0)return{...t.length>0&&{allow:t},...n.length>0&&{soft_deny:n},...r.length>0&&{environment:r}}}}function qg(e){for(let t of Lf()){if(t===`policySettings`)continue;let n=Mg(t);if(n)try{let{resolvedPath:t}=Xn(j(),n),r=Fd(t);if(!r.trim())continue;let i=Hr(r,!1);if(i&&typeof i==`object`&&e in i)return!0}catch(e){Dg(e,n)}}return!1}var Jg,U,Yg=t((()=>{bu(),Je(),O(),cf(),Kr(),M(),cr(),g(),kn(),Of(),Id(),An(),Mf(),Vr(),yr(),Ar(),vn(),ci(),Hf(),qf(),Xf(),Cg(),Zd(),Ah(),qh(),Jg=!1,U=Vg}));function Xg(){let e=process.env.CLAUDE_CODE_DISABLE_AUTO_MEMORY;if(_(e))return!1;if(ie(e))return!0;if(_(process.env.CLAUDE_CODE_SIMPLE)||_(process.env.CLAUDE_CODE_REMOTE)&&!process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR)return!1;let t=Vg();return t.autoMemoryEnabled===void 0?!0:t.autoMemoryEnabled}function Zg(){return qj(`tengu_passport_quail`,!1)?!k()||qj(`tengu_slate_thimble`,!1):!1}function Qg(){return process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR?process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR:h()}function $g(e,t){if(!e)return;let n=e;if(t&&(n.startsWith(`~/`)||n.startsWith(`~\\`))){let e=n.slice(2),t=$i(e||`.`);if(t===`.`||t===`..`)return;n=z(qi(),e)}let r=$i(n).replace(/[/\\]+$/,``);if(!(!Qi(r)||r.length<3||/^[A-Za-z]:$/.test(r)||r.startsWith(`\\\\`)||r.startsWith(`//`)||r.includes(`\0`)))return(r+na).normalize(`NFC`)}function e_(){return $g(process.env.CLAUDE_COWORK_MEMORY_PATH_OVERRIDE,!1)}function t_(){return $g(H(`policySettings`)?.autoMemoryDirectory??H(`flagSettings`)?.autoMemoryDirectory??H(`localSettings`)?.autoMemoryDirectory??H(`userSettings`)?.autoMemoryDirectory,!0)}function n_(){return e_()!==void 0}function r_(){return lr($t())??$t()}function i_(){return z(c_(),s_)}function a_(e){return $i(e).startsWith(c_())}var o_,s_,c_,l_=t((()=>{m(),O(),CM(),g(),dr(),Pr(),Yg(),o_=`memory`,s_=`MEMORY.md`,c_=p(()=>(e_()??t_())||(z(z(Qg(),`projects`),Mr(r_()),o_)+na).normalize(`NFC`),()=>$t())}));function u_(){return{numStartups:0,installMethod:void 0,autoUpdates:void 0,theme:`dark`,preferredNotifChannel:`auto`,verbose:!1,editorMode:`normal`,autoCompactEnabled:!0,showTurnDuration:!0,hasSeenTasksHint:!1,hasUsedStash:!1,hasUsedBackgroundTask:!1,queuedCommandUpHintCount:0,diffTool:`auto`,customApiKeyResponses:{approved:[],rejected:[]},env:{},tipsHistory:{},memoryUsageCount:0,promptQueueUseCount:0,btwUseCount:0,todoFeatureEnabled:!0,showExpandedTodos:!1,messageIdleNotifThresholdMs:6e4,autoConnectIde:!1,autoInstallIdeExtension:!0,fileCheckpointingEnabled:!0,terminalProgressBarEnabled:!0,cachedStatsigGates:{},cachedDynamicConfigs:{},cachedGrowthBookFeatures:{},respectGitignore:!0,copyFullResponse:!1}}function W(){return H_||(H_=d_())}function d_(){if(nn())return!0;let e=G(),t=Z_();if(e.projects?.[t]?.hasTrustDialogAccepted)return!0;let n=Nr(tr());for(;;){if(e.projects?.[n]?.hasTrustDialogAccepted)return!0;let t=Nr(ta(n,`..`));if(t===n)break;n=t}return!1}function f_(e){let t=U_.config;if(!t)return!1;let n=t.oauthAccount!==void 0&&e.oauthAccount===void 0,r=t.hasCompletedOnboarding===!0&&e.hasCompletedOnboarding!==!0;return n||r}function p_(e){let t=null;try{C_(R(),u_,n=>{let r=e(n);return r===n?n:(t={...r,projects:__(n.projects)},t)})&&t&&y_(t)}catch(n){N(`Failed to save config with lock: ${n}`,{level:`error`});let r=D_(R(),u_);if(f_(r)){N(`saveGlobalConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`}),I(`tengu_config_auth_loss_prevented`,{});return}let i=e(r);if(i===r)return;t={...i,projects:__(r.projects)},S_(R(),t,V_),y_(t)}}function m_(){return q_}function h_(){let e=G_+K_;e>0&&I(`tengu_config_cache_stats`,{cache_hits:G_,cache_misses:K_,hit_rate:G_/e}),G_=0,K_=0}function g_(e){if(e.installMethod!==void 0)return e;let t=e,n=`unknown`,r=e.autoUpdates??!0;switch(t.autoUpdaterStatus){case`migrated`:n=`local`;break;case`installed`:n=`native`;break;case`disabled`:r=!1;break;case`enabled`:case`no_permissions`:case`not_configured`:n=`global`;break;case void 0:break}return{...e,installMethod:n,autoUpdates:r}}function __(e){if(!e)return e;let t={},n=!1;for(let[r,i]of Object.entries(e)){let e=i;if(e.history!==void 0){n=!0;let{history:i,...a}=e;t[r]=a}else t[r]=i}return n?t:e}function v_(){if(Y_)return;Y_=!0;let e=R();ca(e,{interval:J_,persistent:!1},t=>{t.mtimeMs<=U_.mtime||j().readFile(e,{encoding:`utf-8`}).then(e=>{if(t.mtimeMs<=U_.mtime)return;let n=Hr(Rr(e));typeof n!=`object`||!n||(U_={config:g_({...u_(),...n}),mtime:t.mtimeMs},W_={mtime:t.mtimeMs,size:t.size})}).catch(()=>{})}),fn(async()=>{sa(e),Y_=!1})}function y_(e){U_={config:e,mtime:Date.now()},W_=null}function G(){if(U_.config)return G_++,U_.config;K_++;try{let e=null;try{e=j().statSync(R())}catch{}let t=g_(D_(R(),u_));return U_={config:t,mtime:e?.mtimeMs??Date.now()},W_=e?{mtime:e.mtimeMs,size:e.size}:null,v_(),t}catch{return g_(D_(R(),u_))}}function b_(){let e=G().remoteControlAtStartup;return e===void 0?!1:e}function x_(e){let t=G();return t.customApiKeyResponses?.approved?.includes(e)?`approved`:t.customApiKeyResponses?.rejected?.includes(e)?`rejected`:`new`}function S_(e,t,n){let r=Zi(e);j().mkdirSync(r),Sf(e,A(ed(t,(e,t)=>A(e)!==A(n[t])),null,2),{encoding:`utf-8`,mode:384}),e===R()&&q_++}function C_(e,t,n){let r=t(),i=Zi(e),a=j();a.mkdirSync(i);let o;try{let i=`${e}.lock`,s=Date.now();o=qr(e,{lockfilePath:i,onCompromised:e=>{N(`Config lock compromised: ${e}`,{level:`error`})}});let c=Date.now()-s;if(c>100&&(N(`Lock acquisition took longer than expected - another Claude instance may be running`),I(`tengu_config_lock_contention`,{lock_time_ms:c})),W_&&e===R())try{let t=a.statSync(e);(t.mtimeMs!==W_.mtime||t.size!==W_.size)&&I(`tengu_config_stale_write`,{read_mtime:W_.mtime,write_mtime:t.mtimeMs,read_size:W_.size,write_size:t.size})}catch(e){if(mn(e)!==`ENOENT`)throw e}let l=D_(e,t);if(e===R()&&f_(l))return N(`saveConfigWithLock: re-read config is missing auth that cache has; refusing to write to avoid wiping ~/.claude.json. See GH #3117.`,{level:`error`}),I(`tengu_config_auth_loss_prevented`,{}),!1;let u=n(l);if(u===l)return!1;let d=ed(u,(e,t)=>A(e)!==A(r[t]));try{let t=Xi(e),n=T_();try{a.mkdirSync(n)}catch(e){if(mn(e)!==`EEXIST`)throw e}let r=a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse(),i=r[0],o=i?Number(i.split(`.backup.`).pop()):0,s=Number.isNaN(o)||Date.now()-o>=6e4;if(s){let r=z(n,`${t}.backup.${Date.now()}`);a.copyFileSync(e,r)}let c=s?a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse():r;for(let e of c.slice(5))try{a.unlinkSync(z(n,e))}catch{}}catch(e){mn(e)!==`ENOENT`&&N(`Failed to backup config: ${e}`,{level:`error`})}return Sf(e,A(d,null,2),{encoding:`utf-8`,mode:384}),e===R()&&q_++,!0}finally{o&&o()}}function w_(){if(X_)return;let e=Date.now();or(`info`,`enable_configs_started`),X_=!0,D_(R(),u_,!0),or(`info`,`enable_configs_completed`,{duration_ms:Date.now()-e})}function T_(){return z(h(),`backups`)}function E_(e){let t=j(),n=Xi(e),r=T_();try{let e=t.readdirStringSync(r).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(e)return z(r,e)}catch{}let i=Zi(e);try{let r=t.readdirStringSync(i).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(r)return z(i,r);let a=`${e}.backup`;try{return t.statSync(a),a}catch{}}catch{}return null}function D_(e,t,n){if(!X_)throw Error(`Config accessed before allowed.`);let r=j();try{let n=r.readFileSync(e,{encoding:`utf-8`});try{let e=gn(Rr(n));return{...t(),...e}}catch(n){throw new Cn(n instanceof Error?n.message:String(n),e,t())}}catch(i){if(mn(i)===`ENOENT`){let n=E_(e);return n&&process.stderr.write(`\nClaude configuration file not found at: ${e}\nA backup file exists at: ${n}\nYou can manually restore it by running: cp "${n}" "${e}"\n\n`),t()}if(i instanceof Cn&&n)throw i;if(i instanceof Cn){if(N(`Config file corrupted, resetting to defaults: ${i.message}`,{level:`error`}),!z_){z_=!0;try{P(i);let t=!1;try{r.statSync(`${e}.backup`),t=!0}catch{}I(`tengu_config_parse_error`,{has_backup:t})}finally{z_=!1}}process.stderr.write(`\nClaude configuration file at ${e} is corrupted: ${i.message}\n`);let t=Xi(e),n=T_();try{r.mkdirSync(n)}catch(e){if(mn(e)!==`EEXIST`)throw e}let a=r.readdirStringSync(n).filter(e=>e.startsWith(`${t}.corrupted.`)),o,s=!1,c=r.readFileSync(e,{encoding:`utf-8`});for(let e of a)try{if(c===r.readFileSync(z(n,e),{encoding:`utf-8`})){s=!0;break}}catch{}if(!s){o=z(n,`${t}.corrupted.${Date.now()}`);try{r.copyFileSync(e,o),N(`Corrupted config backed up to: ${o}`,{level:`error`})}catch{}}let l=E_(e);o?process.stderr.write(`The corrupted file has been backed up to: ${o}\n`):s&&process.stderr.write(`The corrupted file has already been backed up.
25
+ `),l?process.stderr.write(`A backup file exists at: ${l}\nYou can manually restore it by running: cp "${l}" "${e}"\n\n`):process.stderr.write(`
26
+ `)}return t()}}function O_(){let e=Z_(),t=G();if(!t.projects)return B_;let n=t.projects[e]??B_;return typeof n.allowedTools==`string`&&(n.allowedTools=Hr(n.allowedTools)??[]),n}function k_(e){let t=Z_(),n=null;try{C_(R(),u_,r=>{let i=r.projects?.[t]??B_,a=e(i);return a===i?r:(n={...r,projects:{...r.projects,[t]:a}},n)})&&n&&y_(n)}catch(r){N(`Failed to save config with lock: ${r}`,{level:`error`});let i=D_(R(),u_);if(f_(i)){N(`saveCurrentProjectConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`}),I(`tengu_config_auth_loss_prevented`,{});return}let a=i.projects?.[t]??B_,o=e(a);if(o===a)return;n={...i,projects:{...i.projects,[t]:o}},S_(R(),n,V_),y_(n)}}function A_(){return N_()!==null}function j_(){return A_()&&!_(process.env.FORCE_AUTOUPDATE_PLUGINS)}function M_(e){switch(e.type){case`development`:return`development build`;case`env`:return`${e.envVar} set`;case`config`:return`config`}}function N_(){if(!_(process.env.ENABLE_AUTOUPDATER))return{type:`config`};if(_(process.env.DISABLE_AUTOUPDATER))return{type:`env`,envVar:`DISABLE_AUTOUPDATER`};let e=vr();if(e)return{type:`env`,envVar:e};let t=G();return t.autoUpdates===!1&&(t.installMethod!==`native`||t.autoUpdatesProtectedForNative!==!0)?{type:`config`}:null}function P_(){let e=G();if(e.userID)return e.userID;let t=da(32).toString(`hex`);return p_(e=>({...e,userID:t})),t}function F_(){if(!G().firstStartTime){let e=new Date().toISOString();p_(t=>({...t,firstStartTime:t.firstStartTime??e}))}}function I_(e){let t=Xt();switch(e){case`User`:return z(h(),`CLAUDE.md`);case`Local`:return z(t,`CLAUDE.local.md`);case`Project`:return z(t,`CLAUDE.md`);case`Managed`:return z(Jf(),`CLAUDE.md`);case`AutoMem`:return i_()}return``}function L_(){return z(Jf(),`.claude`,`rules`)}function R_(){return z(h(),`rules`)}var z_,B_,V_,H_,U_,W_,G_,K_,q_,J_,Y_,X_,Z_,Q_=t((()=>{m(),td(),O(),l_(),si(),er(),Tn(),M(),cr(),xi(),g(),kn(),Of(),An(),dr(),Vr(),zr(),Wr(),yr(),Pr(),gr(),Xf(),vn(),z_=!1,B_={allowedTools:[],mcpContextUris:[],mcpServers:{},enabledMcpjsonServers:[],disabledMcpjsonServers:[],hasTrustDialogAccepted:!1,projectOnboardingSeenCount:0,hasClaudeMdExternalIncludesApproved:!1,hasClaudeMdExternalIncludesWarningShown:!1},V_=u_(),H_=!1,{...V_},{...B_},U_={config:null,mtime:0},W_=null,G_=0,K_=0,q_=0,fn(async()=>{h_()}),J_=1e3,Y_=!1,X_=!1,Z_=p(()=>{let e=Xt();return Nr(lr(e)||ta(e))})}));function $_(){if(process.env.USER_TYPE===`ant`){if(pi(process.env.USE_LOCAL_OAUTH))return`local`;if(pi(process.env.USE_STAGING_OAUTH))return`staging`}return`prod`}function ev(){let e=process.env.CLAUDE_LOCAL_OAUTH_API_BASE?.replace(/\/$/,``)??`http://localhost:8000`,t=process.env.CLAUDE_LOCAL_OAUTH_APPS_BASE?.replace(/\/$/,``)??`http://localhost:4000`,n=process.env.CLAUDE_LOCAL_OAUTH_CONSOLE_BASE?.replace(/\/$/,``)??`http://localhost:3000`;return{BASE_API_URL:e,CONSOLE_AUTHORIZE_URL:`${n}/oauth/authorize`,CLAUDE_AI_AUTHORIZE_URL:`${t}/oauth/authorize`,CLAUDE_AI_ORIGIN:t,TOKEN_URL:`${e}/v1/oauth/token`,API_KEY_URL:`${e}/api/oauth/claude_cli/create_api_key`,ROLES_URL:`${e}/api/oauth/claude_cli/roles`,CONSOLE_SUCCESS_URL:`${n}/buy_credits?returnUrl=/oauth/code/success%3Fapp%3Dclaude-code`,CLAUDEAI_SUCCESS_URL:`${n}/oauth/code/success?app=claude-code`,MANUAL_REDIRECT_URL:`${n}/oauth/code/callback`,CLIENT_ID:`22422756-60c9-4084-8eb7-27705fd5cf9a`,OAUTH_FILE_SUFFIX:`-local-oauth`,MCP_PROXY_URL:`http://localhost:8205`,MCP_PROXY_PATH:`/v1/toolbox/shttp/mcp/{server_id}`}}function tv(){let e=(()=>{switch($_()){case`local`:return ev();case`staging`:return lv??cv;case`prod`:return cv}})(),t=process.env.CLAUDE_CODE_CUSTOM_OAUTH_URL;if(t){let n=t.replace(/\/$/,``);if(!uv.includes(n))throw Error(`CLAUDE_CODE_CUSTOM_OAUTH_URL is not an approved endpoint.`);e={...e,BASE_API_URL:n,CONSOLE_AUTHORIZE_URL:`${n}/oauth/authorize`,CLAUDE_AI_AUTHORIZE_URL:`${n}/oauth/authorize`,CLAUDE_AI_ORIGIN:n,TOKEN_URL:`${n}/v1/oauth/token`,API_KEY_URL:`${n}/api/oauth/claude_cli/create_api_key`,ROLES_URL:`${n}/api/oauth/claude_cli/roles`,CONSOLE_SUCCESS_URL:`${n}/oauth/code/success?app=claude-code`,CLAUDEAI_SUCCESS_URL:`${n}/oauth/code/success?app=claude-code`,MANUAL_REDIRECT_URL:`${n}/oauth/code/callback`,OAUTH_FILE_SUFFIX:`-custom-oauth`}}let n=process.env.CLAUDE_CODE_OAUTH_CLIENT_ID;return n&&(e={...e,CLIENT_ID:n}),e}var nv,rv,iv,av,ov,sv,cv,lv,uv,dv=t((()=>{di(),nv=`user:inference`,rv=`user:profile`,iv=`org:create_api_key`,av=`oauth-2025-04-20`,ov=[iv,rv],sv=[rv,nv,`user:sessions:claude_code`,`user:mcp_servers`,`user:file_upload`],Array.from(new Set([...ov,...sv])),cv={BASE_API_URL:`https://api.anthropic.com`,CONSOLE_AUTHORIZE_URL:`https://platform.claude.com/oauth/authorize`,CLAUDE_AI_AUTHORIZE_URL:`https://claude.com/cai/oauth/authorize`,CLAUDE_AI_ORIGIN:`https://claude.ai`,TOKEN_URL:`https://platform.claude.com/v1/oauth/token`,API_KEY_URL:`https://api.anthropic.com/api/oauth/claude_cli/create_api_key`,ROLES_URL:`https://api.anthropic.com/api/oauth/claude_cli/roles`,CONSOLE_SUCCESS_URL:`https://platform.claude.com/buy_credits?returnUrl=/oauth/code/success%3Fapp%3Dclaude-code`,CLAUDEAI_SUCCESS_URL:`https://platform.claude.com/oauth/code/success?app=claude-code`,MANUAL_REDIRECT_URL:`https://platform.claude.com/oauth/code/callback`,CLIENT_ID:`9d1c250a-e61b-44d9-88ed-5944d1962f5e`,OAUTH_FILE_SUFFIX:``,MCP_PROXY_URL:`https://mcp-proxy.anthropic.com`,MCP_PROXY_PATH:`/v1/mcp/{server_id}`},lv=process.env.USER_TYPE===`ant`?{BASE_API_URL:`https://api-staging.anthropic.com`,CONSOLE_AUTHORIZE_URL:`https://platform.staging.ant.dev/oauth/authorize`,CLAUDE_AI_AUTHORIZE_URL:`https://claude-ai.staging.ant.dev/oauth/authorize`,CLAUDE_AI_ORIGIN:`https://claude-ai.staging.ant.dev`,TOKEN_URL:`https://platform.staging.ant.dev/v1/oauth/token`,API_KEY_URL:`https://api-staging.anthropic.com/api/oauth/claude_cli/create_api_key`,ROLES_URL:`https://api-staging.anthropic.com/api/oauth/claude_cli/roles`,CONSOLE_SUCCESS_URL:`https://platform.staging.ant.dev/buy_credits?returnUrl=/oauth/code/success%3Fapp%3Dclaude-code`,CLAUDEAI_SUCCESS_URL:`https://platform.staging.ant.dev/oauth/code/success?app=claude-code`,MANUAL_REDIRECT_URL:`https://platform.staging.ant.dev/oauth/code/callback`,CLIENT_ID:`22422756-60c9-4084-8eb7-27705fd5cf9a`,OAUTH_FILE_SUFFIX:`-staging-oauth`,MCP_PROXY_URL:`https://mcp-proxy-staging.anthropic.com`,MCP_PROXY_PATH:`/v1/mcp/{server_id}`}:void 0,uv=[`https://beacon.claude-ai.staging.ant.dev`,`https://claude.fedstart.com`,`https://claude-staging.fedstart.com`]}));function fv(e){let t=[],n=!1;async function r(){if(!n&&t.length!==0){for(n=!0;t.length>0;){let{args:n,resolve:r,reject:i,context:a}=t.shift();try{r(await e.apply(a,n))}catch(e){i(e)}}n=!1,t.length>0&&r()}}return function(...e){return new Promise((n,i)=>{t.push({args:e,resolve:n,reject:i,context:this}),r()})}}var pv=t((()=>{}));function mv(e,t){return e.find(e=>e.includes(t))??null}async function hv(){let{BedrockClient:e}=await import(`./dist-es-Dl0ZRczY.js`),t=ae(),n=_(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH),r={region:t,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await Mi(),...n&&{requestHandler:new(await(import(`./dist-es-BJldFHbt.js`))).NodeHttpHandler,httpAuthSchemes:[{schemeId:`smithy.api#noAuth`,identityProvider:()=>async()=>({}),signer:new(await(import(`./dist-es-CYe_-TbD.js`))).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:`smithy.api#noAuth`}]}};if(!n&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let e=await uj();e&&(r.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken})}return new e(r)}async function gv(){let{BedrockRuntimeClient:e}=await import(`./dist-es-DUg5w7-v.js`),t=ae(),n=_(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH),r={region:t,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await Mi(),...n&&{requestHandler:new(await(import(`./dist-es-BJldFHbt.js`))).NodeHttpHandler,httpAuthSchemes:[{schemeId:`smithy.api#noAuth`,identityProvider:()=>async()=>({}),signer:new(await(import(`./dist-es-CYe_-TbD.js`))).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:`smithy.api#noAuth`}]}};if(!n&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let e=await uj();e&&(r.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken})}return new e(r)}function _v(e){return e.startsWith(`anthropic.`)}function vv(e){if(!e.startsWith(`arn:`))return e;let t=e.lastIndexOf(`/`);return t===-1?e:e.substring(t+1)}function yv(e){let t=vv(e);for(let e of Cv)if(t.startsWith(`${e}.anthropic.`))return e}function bv(e,t){let n=yv(e);return n?e.replace(`${n}.`,`${t}.`):_v(e)?`${t}.${e}`:e}var xv,Sv,Cv,wv=t((()=>{m(),Cj(),g(),yr(),Ii(),xv=p(async function(){let[e,{ListInferenceProfilesCommand:t}]=await Promise.all([hv(),import(`./dist-es-Dl0ZRczY.js`)]),n=[],r;try{do{let i=new t({...r&&{nextToken:r},typeEquals:`SYSTEM_DEFINED`}),a=await e.send(i);a.inferenceProfileSummaries&&n.push(...a.inferenceProfileSummaries),r=a.nextToken}while(r);return n.filter(e=>e.inferenceProfileId?.includes(`anthropic`)).map(e=>e.inferenceProfileId).filter(Boolean)}catch(e){throw P(e),e}}),Sv=p(async function(e){try{let[t,{GetInferenceProfileCommand:n}]=await Promise.all([hv(),import(`./dist-es-Dl0ZRczY.js`)]),r=new n({inferenceProfileIdentifier:e}),i=await t.send(r);if(!i.models||i.models.length===0)return null;let a=i.models[0];if(!a?.modelArn)return null;let o=a.modelArn.lastIndexOf(`/`);return o>=0?a.modelArn.substring(o+1):a.modelArn}catch(e){return P(e),null}}),Cv=[`us`,`eu`,`apac`,`global`]})),Tv,Ev,Dv,Ov,kv,Av,jv,Mv,Nv,Pv,Fv,Iv,Lv,Rv,zv=t((()=>{Tv={firstParty:`claude-3-7-sonnet-20250219`,bedrock:`us.anthropic.claude-3-7-sonnet-20250219-v1:0`,vertex:`claude-3-7-sonnet@20250219`,foundry:`claude-3-7-sonnet`,openai:`claude-3-7-sonnet-20250219`,gemini:`claude-3-7-sonnet-20250219`,grok:`claude-3-7-sonnet-20250219`},Ev={firstParty:`claude-3-5-sonnet-20241022`,bedrock:`anthropic.claude-3-5-sonnet-20241022-v2:0`,vertex:`claude-3-5-sonnet-v2@20241022`,foundry:`claude-3-5-sonnet`,openai:`claude-3-5-sonnet-20241022`,gemini:`claude-3-5-sonnet-20241022`,grok:`claude-3-5-sonnet-20241022`},Dv={firstParty:`claude-3-5-haiku-20241022`,bedrock:`us.anthropic.claude-3-5-haiku-20241022-v1:0`,vertex:`claude-3-5-haiku@20241022`,foundry:`claude-3-5-haiku`,openai:`claude-3-5-haiku-20241022`,gemini:`claude-3-5-haiku-20241022`,grok:`claude-3-5-haiku-20241022`},Ov={firstParty:`claude-haiku-4-5-20251001`,bedrock:`us.anthropic.claude-haiku-4-5-20251001-v1:0`,vertex:`claude-haiku-4-5@20251001`,foundry:`claude-haiku-4-5`,openai:`claude-haiku-4-5-20251001`,gemini:`claude-haiku-4-5-20251001`,grok:`claude-haiku-4-5-20251001`},kv={firstParty:`claude-sonnet-4-20250514`,bedrock:`us.anthropic.claude-sonnet-4-20250514-v1:0`,vertex:`claude-sonnet-4@20250514`,foundry:`claude-sonnet-4`,openai:`claude-sonnet-4-20250514`,gemini:`claude-sonnet-4-20250514`,grok:`claude-sonnet-4-20250514`},Av={firstParty:`claude-sonnet-4-5-20250929`,bedrock:`us.anthropic.claude-sonnet-4-5-20250929-v1:0`,vertex:`claude-sonnet-4-5@20250929`,foundry:`claude-sonnet-4-5`,openai:`claude-sonnet-4-5-20250929`,gemini:`claude-sonnet-4-5-20250929`,grok:`claude-sonnet-4-5-20250929`},jv={firstParty:`claude-opus-4-20250514`,bedrock:`us.anthropic.claude-opus-4-20250514-v1:0`,vertex:`claude-opus-4@20250514`,foundry:`claude-opus-4`,openai:`claude-opus-4-20250514`,gemini:`claude-opus-4-20250514`,grok:`claude-opus-4-20250514`},Mv={firstParty:`claude-opus-4-1-20250805`,bedrock:`us.anthropic.claude-opus-4-1-20250805-v1:0`,vertex:`claude-opus-4-1@20250805`,foundry:`claude-opus-4-1`,openai:`claude-opus-4-1-20250805`,gemini:`claude-opus-4-1-20250805`,grok:`claude-opus-4-1-20250805`},Nv={firstParty:`claude-opus-4-5-20251101`,bedrock:`us.anthropic.claude-opus-4-5-20251101-v1:0`,vertex:`claude-opus-4-5@20251101`,foundry:`claude-opus-4-5`,openai:`claude-opus-4-5-20251101`,gemini:`claude-opus-4-5-20251101`,grok:`claude-opus-4-5-20251101`},Pv={firstParty:`claude-opus-4-6`,bedrock:`us.anthropic.claude-opus-4-6-v1`,vertex:`claude-opus-4-6`,foundry:`claude-opus-4-6`,openai:`claude-opus-4-6`,gemini:`claude-opus-4-6`,grok:`claude-opus-4-6`},Fv={firstParty:`claude-opus-4-7`,bedrock:`us.anthropic.claude-opus-4-7-v1`,vertex:`claude-opus-4-7`,foundry:`claude-opus-4-7`,openai:`claude-opus-4-7`,gemini:`claude-opus-4-7`,grok:`claude-opus-4-7`},Iv={firstParty:`claude-sonnet-4-6`,bedrock:`us.anthropic.claude-sonnet-4-6`,vertex:`claude-sonnet-4-6`,foundry:`claude-sonnet-4-6`,openai:`claude-sonnet-4-6`,gemini:`claude-sonnet-4-6`,grok:`claude-sonnet-4-6`},Lv={haiku35:Dv,haiku45:Ov,sonnet35:Ev,sonnet37:Tv,sonnet40:kv,sonnet45:Av,sonnet46:Iv,opus40:jv,opus41:Mv,opus45:Nv,opus46:Pv,opus47:Fv},Object.values(Lv).map(e=>e.firstParty),Rv=Object.fromEntries(Object.entries(Lv).map(([e,t])=>[t.firstParty,e]))}));function Bv(e){return e!==`firstParty`}var Vv=t((()=>{}));function K(e=Vg()){let t=e.modelType;return t===`openai`?`openai`:t===`gemini`?`gemini`:t===`grok`?`grok`:_(process.env.CLAUDE_CODE_USE_BEDROCK)?`bedrock`:_(process.env.CLAUDE_CODE_USE_VERTEX)?`vertex`:_(process.env.CLAUDE_CODE_USE_FOUNDRY)?`foundry`:_(process.env.CLAUDE_CODE_USE_OPENAI)?`openai`:_(process.env.CLAUDE_CODE_USE_GEMINI)?`gemini`:_(process.env.CLAUDE_CODE_USE_GROK)?`grok`:`firstParty`}function Hv(){let e=process.env.ANTHROPIC_BASE_URL;if(!e)return!0;try{let t=new URL(e).host,n=[`api.anthropic.com`];return process.env.USER_TYPE===`ant`&&n.push(`api-staging.anthropic.com`),n.includes(t)}catch{return!1}}var Uv=t((()=>{Yg(),g(),Vv()}));function Wv(e){let t={};for(let n of Xv)t[n]=Lv[n][e];return t}async function Gv(){let e=Wv(`bedrock`),t;try{t=await xv()}catch(t){return P(t),e}if(!t?.length)return e;let n={};for(let r of Xv){let i=Lv[r].firstParty;n[r]=mv(t,i)||e[r]}return n}function Kv(e){let t=Vg().modelOverrides;if(!t)return e;let n={...e};for(let[e,r]of Object.entries(t)){let t=Rv[e];t&&r&&(n[t]=r)}return n}function qv(){if(ir()===null){if(K()!==`bedrock`){rr(Wv(K()));return}Zv()}}function Jv(){let e=ir();return e===null?(qv(),Kv(Wv(K()))):Kv(e)}async function Yv(){if(ir()===null){if(K()!==`bedrock`){rr(Wv(K()));return}await Zv()}}var Xv,Zv,Qv=t((()=>{nr(),yr(),pv(),Yg(),wv(),zv(),Uv(),Xv=Object.keys(Lv),Zv=fv(async()=>{if(ir()===null)try{rr(await Gv())}catch(e){P(e)}})}));function $v(e=Vg()){let t=e.modelType;return t===`openai`?`openai`:t===`gemini`?`gemini`:t===`grok`?`grok`:_(process.env.CLAUDE_CODE_USE_BEDROCK)?`bedrock`:_(process.env.CLAUDE_CODE_USE_VERTEX)?`vertex`:_(process.env.CLAUDE_CODE_USE_FOUNDRY)?`foundry`:_(process.env.CLAUDE_CODE_USE_OPENAI)?`openai`:_(process.env.CLAUDE_CODE_USE_GEMINI)?`gemini`:_(process.env.CLAUDE_CODE_USE_GROK)?`grok`:`firstParty`}function ey(){return $v()}function ty(){let e=process.env.ANTHROPIC_BASE_URL;if(!e)return!0;try{let t=new URL(e).host,n=[`api.anthropic.com`];return process.env.USER_TYPE===`ant`&&n.push(`api-staging.anthropic.com`),n.includes(t)}catch{return!1}}var ny=t((()=>{Yg(),g(),Vv()}));function ry(){if(_(process.env.DISABLE_COST_WARNINGS)||Z())return!1;let e=Yk(),t=Xk()!==null;if(!e.hasToken&&!t)return!1;let n=G(),r=n.oauthAccount?.organizationRole,i=n.oauthAccount?.workspaceRole;return!r||!i?!1:[`admin`,`billing`].includes(r)||[`workspace_admin`,`workspace_billing`].includes(i)}function iy(e){oy=e}function ay(){if(oy!==null)return oy;if(!Z())return!1;let e=Q();if(e===`max`||e===`pro`)return!0;let t=G().oauthAccount?.organizationRole;return!!t&&[`admin`,`billing`,`owner`,`primary_owner`].includes(t)}var oy,sy=t((()=>{Cj(),Q_(),g(),oy=null}));function cy(){return process.env.USER_TYPE===`ant`?process.env.CLAUDE_MOCK_HEADERLESS_429?process.env.CLAUDE_MOCK_HEADERLESS_429:vy?yy:null:null}function ly(){return!vy||process.env.USER_TYPE!==`ant`||Object.keys(_y).length===0?null:_y}function uy(){_y={},wy=[],by=null,xy=null,Sy=null,yy=null,iy(null),vy=!1}function dy(e){let t=ly();if(!t)return e;let n=new globalThis.Headers(e);return Object.entries(t).forEach(([e,t])=>{t!==void 0&&n.set(e,t)}),n}function fy(){return process.env.USER_TYPE===`ant`?vy||!!process.env.CLAUDE_MOCK_HEADERLESS_429:!1}function py(){return!vy||process.env.USER_TYPE!==`ant`?null:by||Cy}function my(){return vy&&by!==null&&process.env.USER_TYPE===`ant`}function hy(){return xy!==null}function gy(e){if(xy===null||!e)return null;if(Sy!==null&&Date.now()>=Sy)return uy(),null;Sy===null&&(Sy=Date.now()+xy);let t=Sy-Date.now(),n={..._y};return n[`retry-after`]=String(Math.max(1,Math.ceil(t/1e3))),n}var _y,vy,yy,by,xy,Sy,Cy,wy,Ty=t((()=>{sy(),_y={},vy=!1,yy=null,by=null,xy=null,Sy=null,Cy=`max`}));function Ey(e,t,n){if(_(process.env.CLAUDE_CODE_REMOTE))try{aa(jy,{recursive:!0,mode:448}),la(e,t,{encoding:`utf8`,mode:384}),N(`Persisted ${n} to ${e} for subprocess access`)}catch(e){N(`Failed to persist ${n} to disk (non-fatal): ${$n(e)}`,{level:`error`})}}function Dy(e,t){try{let n=j().readFileSync(e,{encoding:`utf8`}).trim();return n?(N(`Read ${t} from well-known file ${e}`),n):null}catch(n){return bn(n)||N(`Failed to read ${t} from ${e}: ${$n(n)}`,{level:`debug`}),null}}function Oy({envVar:e,wellKnownPath:t,label:n,getCached:r,setCached:i}){let a=r();if(a!==void 0)return a;let o=process.env[e];if(!o){let e=Dy(t,n);return i(e),e}let s=parseInt(o,10);if(Number.isNaN(s))return N(`${e} must be a valid file descriptor number, got: ${o}`,{level:`error`}),i(null),null;try{let e=j(),r=process.platform===`darwin`||process.platform===`freebsd`?`/dev/fd/${s}`:`/proc/self/fd/${s}`,a=e.readFileSync(r,{encoding:`utf8`}).trim();return a?(N(`Successfully read ${n} from file descriptor ${s}`),i(a),Ey(t,a,n),a):(N(`File descriptor contained empty ${n}`,{level:`error`}),i(null),null)}catch(e){N(`Failed to read ${n} from file descriptor ${s}: ${$n(e)}`,{level:`error`});let r=Dy(t,n);return i(r),r}}function ky(){return Oy({envVar:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,wellKnownPath:My,label:`OAuth token`,getCached:qt,setCached:cn})}function Ay(){return Oy({envVar:`CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR`,wellKnownPath:Ny,label:`API key`,getCached:an,setCached:sn})}var jy,My,Ny,Py,Fy=t((()=>{O(),M(),g(),kn(),An(),jy=`/home/claude/.claude/remote`,My=`${jy}/.oauth_token`,Ny=`${jy}/.api_key`,Py=`${jy}/.session_ingress_token`}));function Iy(e=``){let t=h(),n=process.env.CLAUDE_CONFIG_DIR?`-${ua(`sha256`).update(t).digest(`hex`).substring(0,8)}`:``;return`Zanii Code${tv().OAUTH_FILE_SUFFIX}${e}${n}`}var Ly=t((()=>{dv(),g()}));async function Ry(){if(process.platform===`darwin`&&(await mr(`security delete-generic-password -a $USER -s "${Iy()}"`,{shell:!0,reject:!1})).exitCode!==0)throw Error(`Failed to delete keychain entry`)}function zy(e){return e.slice(-20)}var By=t((()=>{pr(),Ly()}));function Vy(e){if(!e||typeof e!=`object`)return!1;let t=e;if(!t.Credentials||typeof t.Credentials!=`object`)return!1;let n=t.Credentials;return typeof n.AccessKeyId==`string`&&typeof n.SecretAccessKey==`string`&&typeof n.SessionToken==`string`&&n.AccessKeyId.length>0&&n.SecretAccessKey.length>0&&n.SessionToken.length>0}async function Hy(){let{STSClient:e,GetCallerIdentityCommand:t}=await import(`./dist-es-Fav2oBDs.js`);await new e().send(new t({}))}async function Uy(){try{N(`Clearing AWS credential provider cache`);let{fromIni:e}=await import(`./dist-es-b3yZSGx82.js`);await e({ignoreCache:!0})(),N(`AWS credential provider cache refreshed`)}catch{N(`Failed to clear AWS credential cache (this is expected if no credentials are configured)`)}}var Wy=t((()=>{M()})),Gy,Ky=t((()=>{ti(),se(),Gy=class e{constructor(){v(this,`status`,{isAuthenticating:!1,output:[]}),v(this,`changed`,Yr()),v(this,`subscribe`,this.changed.subscribe)}static getInstance(){return e.instance||(e.instance=new e),e.instance}getStatus(){return{...this.status,output:[...this.status.output]}}startAuthentication(){this.status={isAuthenticating:!0,output:[]},this.changed.emit(this.getStatus())}addOutput(e){this.status.output.push(e),this.changed.emit(this.getStatus())}setError(e){this.status.error=e,this.changed.emit(this.getStatus())}endAuthentication(e){e?this.status={isAuthenticating:!1,output:[]}:this.status.isAuthenticating=!1,this.changed.emit(this.getStatus())}static reset(){e.instance&&(e.instance.changed.clear(),e.instance=null)}},v(Gy,`instance`,null)}));async function qy(){Qy===null&&!$y&&($y=Zy(),Qy=await $y,$y=null,eb.cache.clear?.())}function Jy(){Qy=null,$y=null,eb.cache.clear?.(),tb.cache.clear?.()}function Yy(){return eb(!0)}function Xy(){if(Qy!==null)return Qy;let e=BA();if(e?.emailAddress)return e.emailAddress;if(process.env.USER_TYPE===`ant`&&process.env.COO_CREATOR)return`${process.env.COO_CREATOR}@anthropic.com`}async function Zy(){let e=BA();if(e?.emailAddress)return e.emailAddress;if(process.env.USER_TYPE===`ant`)return process.env.COO_CREATOR?`${process.env.COO_CREATOR}@anthropic.com`:tb()}var Qy,$y,eb,tb,nb=t((()=>{pr(),m(),O(),Cj(),Q_(),er(),xi(),g(),Qy=null,$y=null,eb=p(e=>{let t=P_(),n=G(),r,i,a;if(e&&(r=Q()??void 0,i=JA()??void 0,r&&n.claudeCodeFirstTokenDate)){let e=new Date(n.claudeCodeFirstTokenDate).getTime();isNaN(e)||(a=e)}let o=BA(),s=o?.organizationUuid,c=o?.accountUuid;return{deviceId:t,sessionId:en(),email:Xy(),appVersion:`2.8.4`,platform:Si(),organizationUuid:s,accountUuid:c,userType:process.env.USER_TYPE,subscriptionType:r,rateLimitTier:i,firstTokenTime:a,..._(process.env.GITHUB_ACTIONS)&&{githubActionsMetadata:{actor:process.env.GITHUB_ACTOR,actorId:process.env.GITHUB_ACTOR_ID,repository:process.env.GITHUB_REPOSITORY,repositoryId:process.env.GITHUB_REPOSITORY_ID,repositoryOwner:process.env.GITHUB_REPOSITORY_OWNER,repositoryOwnerId:process.env.GITHUB_REPOSITORY_OWNER_ID}}}}),tb=p(async()=>{let e=await mr(`git config --get user.email`,{shell:!0,reject:!1,cwd:tr()});return e.exitCode===0&&e.stdout?e.stdout.trim():void 0})}));function rb(e){return ib(e,new WeakSet)}function ib(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>ib(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>ib(e,t))}return!1}var ab=t((()=>{})),ob,sb=t((()=>{de(),Ce(),Te(),ab(),se(),ob=class{set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){v(this,`hrTime`,void 0),v(this,`hrTimeObserved`,void 0),v(this,`spanContext`,void 0),v(this,`resource`,void 0),v(this,`instrumentationScope`,void 0),v(this,`attributes`,{}),v(this,`_severityText`,void 0),v(this,`_severityNumber`,void 0),v(this,`_body`,void 0),v(this,`_eventName`,void 0),v(this,`_attributesCount`,0),v(this,`_droppedAttributesCount`,0),v(this,`_isReadonly`,!1),v(this,`_logRecordLimits`,void 0);let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:o,severityText:s,body:c,attributes:l={},exception:u,context:d}=n,f=Date.now();if(this.hrTime=ge(r??f),this.hrTimeObserved=ge(i??f),d){let e=pe.getSpanContext(d);e&&le(e)&&(this.spanContext=e)}this.severityNumber=o,this.severityText=s,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(l),u!=null&&this._setException(u)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return fe.warn(`Invalid attribute key: ${e}`),this;if(!rb(t))return fe.warn(`Invalid attribute value set for key: ${e}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&fe.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return fe.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(je,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(ye,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(ye,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(je,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(he,n.stack),t=!0)}t||fe.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&fe.warn(`Can not execute the operation on emitted log record`),this._isReadonly}}})),cb,lb=t((()=>{Pe(),de(),sb(),se(),cb=class{constructor(e,t){v(this,`instrumentationScope`,void 0),v(this,`_sharedState`,void 0),v(this,`_loggerConfig`,void 0),this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){let t=this._loggerConfig,n=e.context||me.active(),r=e.severityNumber??Me.UNSPECIFIED;if(r!==Me.UNSPECIFIED&&r<t.minimumSeverity)return;if(t.traceBased){let e=pe.getSpanContext(n);if(e&&le(e)&&(e.traceFlags&ue.SAMPLED)!==ue.SAMPLED)return}let i=new ob(this._sharedState,this.instrumentationScope,{context:n,...e});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(i,n),i._makeReadonly()}enabled(e){let t=this._loggerConfig;if(t.disabled)return!1;let n=e?.severityNumber;if(typeof n==`number`&&n!==Me.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=e?.context||me.active();if(t.traceBased){let e=pe.getSpanContext(r);if(e&&le(e)&&(e.traceFlags&ue.SAMPLED)!==ue.SAMPLED)return!1}let i={context:r,instrumentationScope:this.instrumentationScope,severityNumber:e?.severityNumber,eventName:e?.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}}})),ub,db=t((()=>{ub=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}}})),fb,pb=t((()=>{Ce(),se(),fb=class{constructor(e,t){v(this,`processors`,void 0),v(this,`forceFlushTimeoutMillis`,void 0),this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(t=>we(t.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}}}));function mb(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var hb=t((()=>{})),gb,_b=t((()=>{gb=`otel.sdk.log.created`})),vb,yb=t((()=>{_b(),se(),vb=class{constructor(e){v(this,`createdLogs`,void 0),this.createdLogs=e.createCounter(gb,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}}})),bb,xb=t((()=>{bb=`0.215.0`})),Sb,Cb,wb,Tb=t((()=>{de(),Pe(),db(),pb(),hb(),yb(),xb(),se(),Sb={disabled:!1,minimumSeverity:Me.UNSPECIFIED,traceBased:!1},Cb=()=>({...Sb}),wb=class{constructor(e,t,n,r,i,a){v(this,`loggers`,new Map),v(this,`activeProcessor`,void 0),v(this,`registeredLogRecordProcessors`,[]),v(this,`resource`,void 0),v(this,`forceFlushTimeoutMillis`,void 0),v(this,`logRecordLimits`,void 0),v(this,`processors`,void 0),v(this,`loggerMetrics`,void 0),v(this,`_loggerConfigurator`,void 0),v(this,`_loggerConfigs`,new Map),this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new fb(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new ub,this._loggerConfigurator=i??Cb,this.loggerMetrics=new vb(a?a.getMeter(`@opentelemetry/sdk-logs`,bb):ce())}getLoggerConfig(e){let t=mb(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}}})),Eb,Db=t((()=>{de(),Pe(),Oe(),Ce(),lb(),Tb(),se(),Eb=class{constructor(e={}){v(this,`_shutdownOnce`,void 0),v(this,`_sharedState`,void 0);let t={resource:e.resource??Se(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??Cb,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new wb(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new ke(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return fe.warn(`A shutdown LoggerProvider cannot provide a Logger`),Ne;e||fe.warn(`Logger requested without instrumentation scope name.`);let r=e||`unknown`,i=`${r}@${t||``}:${n?.schemaUrl||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new cb({name:r,version:t,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(fe.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(fe.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}}})),Ob,kb=t((()=>{Ce(),Ob=class{export(e,t){this._sendLogRecords(e,t)}async forceFlush(){}async shutdown(){}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:Ae(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,eventName:e.eventName,body:e.body,attributes:e.attributes}}_sendLogRecords(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});t?.({code:xe.SUCCESS})}}}));async function Ab(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&await Promise.all(t)}var jb,Mb,Nb=t((()=>{de(),Ce(),se(),jb=class{constructor(e,t,n){v(this,`_exportCompleted`,void 0),v(this,`_exportScheduledPromise`,void 0),v(this,`_exportScheduledResolve`,void 0),this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(e,t,n){try{await Ab(t),await me.with(Ee(me.active()),async()=>this._exportWithTimeout(e,t,n))}catch(e){ve(e),this._exportScheduledResolve()}}async _exportWithTimeout(e,t,n){return new Promise((r,i)=>{let a=setTimeout(()=>{i(Error(`Timeout`))},n);e.export(t,e=>{clearTimeout(a),e.code===xe.SUCCESS?r():i(e.error??Error(`BatchLogRecordProcessor: log record export failed`))}),this._exportScheduledResolve()})}},Mb=class{constructor(e,t){v(this,`_maxExportBatchSize`,void 0),v(this,`_maxQueueSize`,void 0),v(this,`_scheduledDelayMillis`,void 0),v(this,`_exportTimeoutMillis`,void 0),v(this,`_exporter`,void 0),v(this,`_currentExport`,null),v(this,`_finishedLogRecords`,[]),v(this,`_timer`,void 0),v(this,`_shutdownOnce`,void 0),v(this,`_flushing`,!1),this._exporter=e,this._maxExportBatchSize=t?.maxExportBatchSize??512,this._maxQueueSize=t?.maxQueueSize??2048,this._scheduledDelayMillis=t?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=t?.exportTimeoutMillis??3e4,this._shutdownOnce=new ke(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(fe.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}async _flushAll(){if(this._flushing)return;this._flushing=!0;let e=this._finishedLogRecords;for(this._finishedLogRecords=[],this._clearTimer(),this._currentExport!==null&&(await this._exporter.forceFlush(),await this._currentExport.exportCompleted,this._currentExport=null);e.length>0;){let t;e.length<=this._maxExportBatchSize?(t=e,e=[]):t=e.splice(0,this._maxExportBatchSize);let n=new jb(this._exporter,t,this._exportTimeoutMillis);this._currentExport=n;try{await n.exportScheduled,await this._exporter.forceFlush(),await n.exportCompleted}catch(e){ve(e)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new jb(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,ve(e),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}})),Pb,Fb=t((()=>{Nb(),Pb=class extends Mb{onShutdown(){}}})),Ib=t((()=>{Fb()})),Lb=t((()=>{Ib()})),Rb=t((()=>{Db(),kb(),Lb()}));function zb(){return _(process.env.CLAUDE_CODE_USE_BEDROCK)||_(process.env.CLAUDE_CODE_USE_VERTEX)||_(process.env.CLAUDE_CODE_USE_FOUNDRY)||hr()}var Bb=t((()=>{g(),gr()}));function Vb(){return{seconds:0,nanos:0}}function Hb(e){return e!=null}var Ub,Wb=t((()=>{Ub={fromJSON(e){return{seconds:Hb(e.seconds)?globalThis.Number(e.seconds):0,nanos:Hb(e.nanos)?globalThis.Number(e.nanos):0}},toJSON(e){let t={};return e.seconds!==void 0&&(t.seconds=Math.round(e.seconds)),e.nanos!==void 0&&(t.nanos=Math.round(e.nanos)),t},create(e){return Ub.fromPartial(e??{})},fromPartial(e){let t=Vb();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}}}));function Gb(){return{account_id:0,organization_uuid:``,account_uuid:``}}function Kb(e){return e!=null}var qb,Jb=t((()=>{qb={fromJSON(e){return{account_id:Kb(e.account_id)?globalThis.Number(e.account_id):0,organization_uuid:Kb(e.organization_uuid)?globalThis.String(e.organization_uuid):``,account_uuid:Kb(e.account_uuid)?globalThis.String(e.account_uuid):``}},toJSON(e){let t={};return e.account_id!==void 0&&(t.account_id=Math.round(e.account_id)),e.organization_uuid!==void 0&&(t.organization_uuid=e.organization_uuid),e.account_uuid!==void 0&&(t.account_uuid=e.account_uuid),t},create(e){return qb.fromPartial(e??{})},fromPartial(e){let t=Gb();return t.account_id=e.account_id??0,t.organization_uuid=e.organization_uuid??``,t.account_uuid=e.account_uuid??``,t}}}));function Yb(){return{actor_id:``,repository_id:``,repository_owner_id:``}}function Xb(){return{platform:``,node_version:``,terminal:``,package_managers:``,runtimes:``,is_running_with_bun:!1,is_ci:!1,is_claubbit:!1,is_github_action:!1,is_claude_code_action:!1,is_claude_ai_auth:!1,version:``,github_event_name:``,github_actions_runner_environment:``,github_actions_runner_os:``,github_action_ref:``,wsl_version:``,github_actions_metadata:void 0,arch:``,is_claude_code_remote:!1,remote_environment_type:``,claude_code_container_id:``,claude_code_remote_session_id:``,tags:[],deployment_environment:``,is_conductor:!1,version_base:``,coworker_type:``,build_time:``,is_local_agent_mode:!1,linux_distro_id:``,linux_distro_version:``,linux_kernel:``,vcs:``,platform_raw:``}}function Zb(){return{slack_team_id:``,is_enterprise_install:!1,trigger:``,creation_method:``}}function Qb(){return{event_name:``,client_timestamp:void 0,model:``,session_id:``,user_type:``,betas:``,env:void 0,entrypoint:``,agent_sdk_version:``,is_interactive:!1,client_type:``,process:``,additional_metadata:``,auth:void 0,server_timestamp:void 0,event_id:``,device_id:``,swe_bench_run_id:``,swe_bench_instance_id:``,swe_bench_task_id:``,email:``,agent_id:``,parent_session_id:``,agent_type:``,slack:void 0,team_name:``,skill_name:``,plugin_name:``,marketplace_name:``}}function $b(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function ex(e){return e instanceof globalThis.Date?e:typeof e==`string`?new globalThis.Date(e):$b(Ub.fromJSON(e))}function q(e){return e!=null}var tx,nx,rx,ix,ax=t((()=>{Wb(),Jb(),tx={fromJSON(e){return{actor_id:q(e.actor_id)?globalThis.String(e.actor_id):``,repository_id:q(e.repository_id)?globalThis.String(e.repository_id):``,repository_owner_id:q(e.repository_owner_id)?globalThis.String(e.repository_owner_id):``}},toJSON(e){let t={};return e.actor_id!==void 0&&(t.actor_id=e.actor_id),e.repository_id!==void 0&&(t.repository_id=e.repository_id),e.repository_owner_id!==void 0&&(t.repository_owner_id=e.repository_owner_id),t},create(e){return tx.fromPartial(e??{})},fromPartial(e){let t=Yb();return t.actor_id=e.actor_id??``,t.repository_id=e.repository_id??``,t.repository_owner_id=e.repository_owner_id??``,t}},nx={fromJSON(e){return{platform:q(e.platform)?globalThis.String(e.platform):``,node_version:q(e.node_version)?globalThis.String(e.node_version):``,terminal:q(e.terminal)?globalThis.String(e.terminal):``,package_managers:q(e.package_managers)?globalThis.String(e.package_managers):``,runtimes:q(e.runtimes)?globalThis.String(e.runtimes):``,is_running_with_bun:q(e.is_running_with_bun)?globalThis.Boolean(e.is_running_with_bun):!1,is_ci:q(e.is_ci)?globalThis.Boolean(e.is_ci):!1,is_claubbit:q(e.is_claubbit)?globalThis.Boolean(e.is_claubbit):!1,is_github_action:q(e.is_github_action)?globalThis.Boolean(e.is_github_action):!1,is_claude_code_action:q(e.is_claude_code_action)?globalThis.Boolean(e.is_claude_code_action):!1,is_claude_ai_auth:q(e.is_claude_ai_auth)?globalThis.Boolean(e.is_claude_ai_auth):!1,version:q(e.version)?globalThis.String(e.version):``,github_event_name:q(e.github_event_name)?globalThis.String(e.github_event_name):``,github_actions_runner_environment:q(e.github_actions_runner_environment)?globalThis.String(e.github_actions_runner_environment):``,github_actions_runner_os:q(e.github_actions_runner_os)?globalThis.String(e.github_actions_runner_os):``,github_action_ref:q(e.github_action_ref)?globalThis.String(e.github_action_ref):``,wsl_version:q(e.wsl_version)?globalThis.String(e.wsl_version):``,github_actions_metadata:q(e.github_actions_metadata)?tx.fromJSON(e.github_actions_metadata):void 0,arch:q(e.arch)?globalThis.String(e.arch):``,is_claude_code_remote:q(e.is_claude_code_remote)?globalThis.Boolean(e.is_claude_code_remote):!1,remote_environment_type:q(e.remote_environment_type)?globalThis.String(e.remote_environment_type):``,claude_code_container_id:q(e.claude_code_container_id)?globalThis.String(e.claude_code_container_id):``,claude_code_remote_session_id:q(e.claude_code_remote_session_id)?globalThis.String(e.claude_code_remote_session_id):``,tags:globalThis.Array.isArray(e?.tags)?e.tags.map(e=>globalThis.String(e)):[],deployment_environment:q(e.deployment_environment)?globalThis.String(e.deployment_environment):``,is_conductor:q(e.is_conductor)?globalThis.Boolean(e.is_conductor):!1,version_base:q(e.version_base)?globalThis.String(e.version_base):``,coworker_type:q(e.coworker_type)?globalThis.String(e.coworker_type):``,build_time:q(e.build_time)?globalThis.String(e.build_time):``,is_local_agent_mode:q(e.is_local_agent_mode)?globalThis.Boolean(e.is_local_agent_mode):!1,linux_distro_id:q(e.linux_distro_id)?globalThis.String(e.linux_distro_id):``,linux_distro_version:q(e.linux_distro_version)?globalThis.String(e.linux_distro_version):``,linux_kernel:q(e.linux_kernel)?globalThis.String(e.linux_kernel):``,vcs:q(e.vcs)?globalThis.String(e.vcs):``,platform_raw:q(e.platform_raw)?globalThis.String(e.platform_raw):``}},toJSON(e){let t={};return e.platform!==void 0&&(t.platform=e.platform),e.node_version!==void 0&&(t.node_version=e.node_version),e.terminal!==void 0&&(t.terminal=e.terminal),e.package_managers!==void 0&&(t.package_managers=e.package_managers),e.runtimes!==void 0&&(t.runtimes=e.runtimes),e.is_running_with_bun!==void 0&&(t.is_running_with_bun=e.is_running_with_bun),e.is_ci!==void 0&&(t.is_ci=e.is_ci),e.is_claubbit!==void 0&&(t.is_claubbit=e.is_claubbit),e.is_github_action!==void 0&&(t.is_github_action=e.is_github_action),e.is_claude_code_action!==void 0&&(t.is_claude_code_action=e.is_claude_code_action),e.is_claude_ai_auth!==void 0&&(t.is_claude_ai_auth=e.is_claude_ai_auth),e.version!==void 0&&(t.version=e.version),e.github_event_name!==void 0&&(t.github_event_name=e.github_event_name),e.github_actions_runner_environment!==void 0&&(t.github_actions_runner_environment=e.github_actions_runner_environment),e.github_actions_runner_os!==void 0&&(t.github_actions_runner_os=e.github_actions_runner_os),e.github_action_ref!==void 0&&(t.github_action_ref=e.github_action_ref),e.wsl_version!==void 0&&(t.wsl_version=e.wsl_version),e.github_actions_metadata!==void 0&&(t.github_actions_metadata=tx.toJSON(e.github_actions_metadata)),e.arch!==void 0&&(t.arch=e.arch),e.is_claude_code_remote!==void 0&&(t.is_claude_code_remote=e.is_claude_code_remote),e.remote_environment_type!==void 0&&(t.remote_environment_type=e.remote_environment_type),e.claude_code_container_id!==void 0&&(t.claude_code_container_id=e.claude_code_container_id),e.claude_code_remote_session_id!==void 0&&(t.claude_code_remote_session_id=e.claude_code_remote_session_id),e.tags?.length&&(t.tags=e.tags),e.deployment_environment!==void 0&&(t.deployment_environment=e.deployment_environment),e.is_conductor!==void 0&&(t.is_conductor=e.is_conductor),e.version_base!==void 0&&(t.version_base=e.version_base),e.coworker_type!==void 0&&(t.coworker_type=e.coworker_type),e.build_time!==void 0&&(t.build_time=e.build_time),e.is_local_agent_mode!==void 0&&(t.is_local_agent_mode=e.is_local_agent_mode),e.linux_distro_id!==void 0&&(t.linux_distro_id=e.linux_distro_id),e.linux_distro_version!==void 0&&(t.linux_distro_version=e.linux_distro_version),e.linux_kernel!==void 0&&(t.linux_kernel=e.linux_kernel),e.vcs!==void 0&&(t.vcs=e.vcs),e.platform_raw!==void 0&&(t.platform_raw=e.platform_raw),t},create(e){return nx.fromPartial(e??{})},fromPartial(e){let t=Xb();return t.platform=e.platform??``,t.node_version=e.node_version??``,t.terminal=e.terminal??``,t.package_managers=e.package_managers??``,t.runtimes=e.runtimes??``,t.is_running_with_bun=e.is_running_with_bun??!1,t.is_ci=e.is_ci??!1,t.is_claubbit=e.is_claubbit??!1,t.is_github_action=e.is_github_action??!1,t.is_claude_code_action=e.is_claude_code_action??!1,t.is_claude_ai_auth=e.is_claude_ai_auth??!1,t.version=e.version??``,t.github_event_name=e.github_event_name??``,t.github_actions_runner_environment=e.github_actions_runner_environment??``,t.github_actions_runner_os=e.github_actions_runner_os??``,t.github_action_ref=e.github_action_ref??``,t.wsl_version=e.wsl_version??``,t.github_actions_metadata=e.github_actions_metadata!==void 0&&e.github_actions_metadata!==null?tx.fromPartial(e.github_actions_metadata):void 0,t.arch=e.arch??``,t.is_claude_code_remote=e.is_claude_code_remote??!1,t.remote_environment_type=e.remote_environment_type??``,t.claude_code_container_id=e.claude_code_container_id??``,t.claude_code_remote_session_id=e.claude_code_remote_session_id??``,t.tags=e.tags?.map(e=>e)||[],t.deployment_environment=e.deployment_environment??``,t.is_conductor=e.is_conductor??!1,t.version_base=e.version_base??``,t.coworker_type=e.coworker_type??``,t.build_time=e.build_time??``,t.is_local_agent_mode=e.is_local_agent_mode??!1,t.linux_distro_id=e.linux_distro_id??``,t.linux_distro_version=e.linux_distro_version??``,t.linux_kernel=e.linux_kernel??``,t.vcs=e.vcs??``,t.platform_raw=e.platform_raw??``,t}},rx={fromJSON(e){return{slack_team_id:q(e.slack_team_id)?globalThis.String(e.slack_team_id):``,is_enterprise_install:q(e.is_enterprise_install)?globalThis.Boolean(e.is_enterprise_install):!1,trigger:q(e.trigger)?globalThis.String(e.trigger):``,creation_method:q(e.creation_method)?globalThis.String(e.creation_method):``}},toJSON(e){let t={};return e.slack_team_id!==void 0&&(t.slack_team_id=e.slack_team_id),e.is_enterprise_install!==void 0&&(t.is_enterprise_install=e.is_enterprise_install),e.trigger!==void 0&&(t.trigger=e.trigger),e.creation_method!==void 0&&(t.creation_method=e.creation_method),t},create(e){return rx.fromPartial(e??{})},fromPartial(e){let t=Zb();return t.slack_team_id=e.slack_team_id??``,t.is_enterprise_install=e.is_enterprise_install??!1,t.trigger=e.trigger??``,t.creation_method=e.creation_method??``,t}},ix={fromJSON(e){return{event_name:q(e.event_name)?globalThis.String(e.event_name):``,client_timestamp:q(e.client_timestamp)?ex(e.client_timestamp):void 0,model:q(e.model)?globalThis.String(e.model):``,session_id:q(e.session_id)?globalThis.String(e.session_id):``,user_type:q(e.user_type)?globalThis.String(e.user_type):``,betas:q(e.betas)?globalThis.String(e.betas):``,env:q(e.env)?nx.fromJSON(e.env):void 0,entrypoint:q(e.entrypoint)?globalThis.String(e.entrypoint):``,agent_sdk_version:q(e.agent_sdk_version)?globalThis.String(e.agent_sdk_version):``,is_interactive:q(e.is_interactive)?globalThis.Boolean(e.is_interactive):!1,client_type:q(e.client_type)?globalThis.String(e.client_type):``,process:q(e.process)?globalThis.String(e.process):``,additional_metadata:q(e.additional_metadata)?globalThis.String(e.additional_metadata):``,auth:q(e.auth)?qb.fromJSON(e.auth):void 0,server_timestamp:q(e.server_timestamp)?ex(e.server_timestamp):void 0,event_id:q(e.event_id)?globalThis.String(e.event_id):``,device_id:q(e.device_id)?globalThis.String(e.device_id):``,swe_bench_run_id:q(e.swe_bench_run_id)?globalThis.String(e.swe_bench_run_id):``,swe_bench_instance_id:q(e.swe_bench_instance_id)?globalThis.String(e.swe_bench_instance_id):``,swe_bench_task_id:q(e.swe_bench_task_id)?globalThis.String(e.swe_bench_task_id):``,email:q(e.email)?globalThis.String(e.email):``,agent_id:q(e.agent_id)?globalThis.String(e.agent_id):``,parent_session_id:q(e.parent_session_id)?globalThis.String(e.parent_session_id):``,agent_type:q(e.agent_type)?globalThis.String(e.agent_type):``,slack:q(e.slack)?rx.fromJSON(e.slack):void 0,team_name:q(e.team_name)?globalThis.String(e.team_name):``,skill_name:q(e.skill_name)?globalThis.String(e.skill_name):``,plugin_name:q(e.plugin_name)?globalThis.String(e.plugin_name):``,marketplace_name:q(e.marketplace_name)?globalThis.String(e.marketplace_name):``}},toJSON(e){let t={};return e.event_name!==void 0&&(t.event_name=e.event_name),e.client_timestamp!==void 0&&(t.client_timestamp=e.client_timestamp.toISOString()),e.model!==void 0&&(t.model=e.model),e.session_id!==void 0&&(t.session_id=e.session_id),e.user_type!==void 0&&(t.user_type=e.user_type),e.betas!==void 0&&(t.betas=e.betas),e.env!==void 0&&(t.env=nx.toJSON(e.env)),e.entrypoint!==void 0&&(t.entrypoint=e.entrypoint),e.agent_sdk_version!==void 0&&(t.agent_sdk_version=e.agent_sdk_version),e.is_interactive!==void 0&&(t.is_interactive=e.is_interactive),e.client_type!==void 0&&(t.client_type=e.client_type),e.process!==void 0&&(t.process=e.process),e.additional_metadata!==void 0&&(t.additional_metadata=e.additional_metadata),e.auth!==void 0&&(t.auth=qb.toJSON(e.auth)),e.server_timestamp!==void 0&&(t.server_timestamp=e.server_timestamp.toISOString()),e.event_id!==void 0&&(t.event_id=e.event_id),e.device_id!==void 0&&(t.device_id=e.device_id),e.swe_bench_run_id!==void 0&&(t.swe_bench_run_id=e.swe_bench_run_id),e.swe_bench_instance_id!==void 0&&(t.swe_bench_instance_id=e.swe_bench_instance_id),e.swe_bench_task_id!==void 0&&(t.swe_bench_task_id=e.swe_bench_task_id),e.email!==void 0&&(t.email=e.email),e.agent_id!==void 0&&(t.agent_id=e.agent_id),e.parent_session_id!==void 0&&(t.parent_session_id=e.parent_session_id),e.agent_type!==void 0&&(t.agent_type=e.agent_type),e.slack!==void 0&&(t.slack=rx.toJSON(e.slack)),e.team_name!==void 0&&(t.team_name=e.team_name),e.skill_name!==void 0&&(t.skill_name=e.skill_name),e.plugin_name!==void 0&&(t.plugin_name=e.plugin_name),e.marketplace_name!==void 0&&(t.marketplace_name=e.marketplace_name),t},create(e){return ix.fromPartial(e??{})},fromPartial(e){let t=Qb();return t.event_name=e.event_name??``,t.client_timestamp=e.client_timestamp??void 0,t.model=e.model??``,t.session_id=e.session_id??``,t.user_type=e.user_type??``,t.betas=e.betas??``,t.env=e.env!==void 0&&e.env!==null?nx.fromPartial(e.env):void 0,t.entrypoint=e.entrypoint??``,t.agent_sdk_version=e.agent_sdk_version??``,t.is_interactive=e.is_interactive??!1,t.client_type=e.client_type??``,t.process=e.process??``,t.additional_metadata=e.additional_metadata??``,t.auth=e.auth!==void 0&&e.auth!==null?qb.fromPartial(e.auth):void 0,t.server_timestamp=e.server_timestamp??void 0,t.event_id=e.event_id??``,t.device_id=e.device_id??``,t.swe_bench_run_id=e.swe_bench_run_id??``,t.swe_bench_instance_id=e.swe_bench_instance_id??``,t.swe_bench_task_id=e.swe_bench_task_id??``,t.email=e.email??``,t.agent_id=e.agent_id??``,t.parent_session_id=e.parent_session_id??``,t.agent_type=e.agent_type??``,t.slack=e.slack!==void 0&&e.slack!==null?rx.fromPartial(e.slack):void 0,t.team_name=e.team_name??``,t.skill_name=e.skill_name??``,t.plugin_name=e.plugin_name??``,t.marketplace_name=e.marketplace_name??``,t}}}));function ox(){return{event_id:``,timestamp:void 0,experiment_id:``,variation_id:0,environment:``,user_attributes:``,experiment_metadata:``,device_id:``,auth:void 0,session_id:``,anonymous_id:``,event_metadata_vars:``}}function sx(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function cx(e){return e instanceof globalThis.Date?e:typeof e==`string`?new globalThis.Date(e):sx(Ub.fromJSON(e))}function lx(e){return e!=null}var ux,dx=t((()=>{Wb(),Jb(),ux={fromJSON(e){return{event_id:lx(e.event_id)?globalThis.String(e.event_id):``,timestamp:lx(e.timestamp)?cx(e.timestamp):void 0,experiment_id:lx(e.experiment_id)?globalThis.String(e.experiment_id):``,variation_id:lx(e.variation_id)?globalThis.Number(e.variation_id):0,environment:lx(e.environment)?globalThis.String(e.environment):``,user_attributes:lx(e.user_attributes)?globalThis.String(e.user_attributes):``,experiment_metadata:lx(e.experiment_metadata)?globalThis.String(e.experiment_metadata):``,device_id:lx(e.device_id)?globalThis.String(e.device_id):``,auth:lx(e.auth)?qb.fromJSON(e.auth):void 0,session_id:lx(e.session_id)?globalThis.String(e.session_id):``,anonymous_id:lx(e.anonymous_id)?globalThis.String(e.anonymous_id):``,event_metadata_vars:lx(e.event_metadata_vars)?globalThis.String(e.event_metadata_vars):``}},toJSON(e){let t={};return e.event_id!==void 0&&(t.event_id=e.event_id),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),e.experiment_id!==void 0&&(t.experiment_id=e.experiment_id),e.variation_id!==void 0&&(t.variation_id=Math.round(e.variation_id)),e.environment!==void 0&&(t.environment=e.environment),e.user_attributes!==void 0&&(t.user_attributes=e.user_attributes),e.experiment_metadata!==void 0&&(t.experiment_metadata=e.experiment_metadata),e.device_id!==void 0&&(t.device_id=e.device_id),e.auth!==void 0&&(t.auth=qb.toJSON(e.auth)),e.session_id!==void 0&&(t.session_id=e.session_id),e.anonymous_id!==void 0&&(t.anonymous_id=e.anonymous_id),e.event_metadata_vars!==void 0&&(t.event_metadata_vars=e.event_metadata_vars),t},create(e){return ux.fromPartial(e??{})},fromPartial(e){let t=ox();return t.event_id=e.event_id??``,t.timestamp=e.timestamp??void 0,t.experiment_id=e.experiment_id??``,t.variation_id=e.variation_id??0,t.environment=e.environment??``,t.user_attributes=e.user_attributes??``,t.experiment_metadata=e.experiment_metadata??``,t.device_id=e.device_id??``,t.auth=e.auth!==void 0&&e.auth!==null?qb.fromPartial(e.auth):void 0,t.session_id=e.session_id??``,t.anonymous_id=e.anonymous_id??``,t.event_metadata_vars=e.event_metadata_vars??``,t}}}));function fx(){return`claude-code/2.8.4`}var px=t((()=>{}));function mx(){return process.platform===`linux`&&_(process.env.CLAUDE_CODE_BUBBLEWRAP)}function hx(){return process.platform===`linux`?xx??!1:!1}async function gx(){if(Sx!==void 0)return Sx;if(process.platform===`darwin`)return Sx=null,null;try{let e=await Hi(process.pid,10);for(let t of e){let e=t.toLowerCase();for(let t of wi)if(e.includes(t))return Sx=t,t}}catch{}return Sx=null,null}async function _x(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&Ci.platform!==`darwin`?await gx()||`pycharm`:Ci.terminal}function vx(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&Ci.platform!==`darwin`?Sx===void 0?`pycharm`:Sx||`pycharm`:Ci.terminal}async function yx(){process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&await gx()}var bx,xx,Sx,Cx,wx=t((()=>{m(),xi(),g(),Cr(),Vi(),bx=p(async()=>{if(process.platform!==`linux`)return!1;let{code:e}=await wr(`test`,[`-f`,`/.dockerenv`]);return e===0}),xx=null,process.platform===`linux`&&_a(`/lib/libc.musl-${process.arch===`x64`?`x86_64`:`aarch64`}.so.1`).then(()=>{xx=!0},()=>{xx=!1}),Cx={...Ci,terminal:vx(),getIsDocker:bx,getIsBubblewrapSandbox:mx,isMuslEnvironment:hx,getTerminalWithJetBrainsDetectionAsync:_x,initJetBrainsDetection:yx}}));function Tx(){return process.env.USER_TYPE===`ant`?xE(`tengu_ant_model_override`,null):null}function Ex(){return process.env.USER_TYPE===`ant`?Tx()?.antModels??[]:[]}function Dx(e){if(process.env.USER_TYPE!==`ant`||e===void 0)return;let t=e.toLowerCase();return Ex().find(n=>n.alias===e||t.includes(n.model.toLowerCase()))}var Ox=t((()=>{XE()})),kx,Ax,jx,Mx,Nx,Px,Fx,Ix,Lx,Rx,zx,Bx,Vx,Hx,Ux=t((()=>{kx=`claude-code-20250219`,Ax=`interleaved-thinking-2025-05-14`,jx=`context-1m-2025-08-07`,Mx=`context-management-2025-06-27`,Nx=`structured-outputs-2025-12-15`,Px=`web-search-2025-03-05`,Fx=`tool-search-tool-2025-10-19`,Ix=`prompt-caching-scope-2026-01-05`,Lx=`redact-thinking-2026-02-12`,Rx=`token-efficient-tools-2026-03-28`,zx=process.env.USER_TYPE===`ant`?`cli-internal-2026-02-09`:``,Bx=`advisor-tool-2026-03-01`,Vx=new Set([Ax,jx,Fx]),Hx=new Set([kx,Ax,Mx])}));function Wx(e){return e.taskOverride??e.tierOverride??(e.isChatGPTAuth?$x[e.tier]:void 0)}function Gx(){return process.env.OPENAI_AUTH_MODE===`chatgpt`}function Kx(e){return e.toLowerCase().replace(/\[1m\]$/i,``)}function qx(e){let t=Kx(e);return t===`gpt-5.6`||t.startsWith(`gpt-5.6-`)}function Jx(e){let t=Kx(e);return qx(e)||rS.some(e=>e.value.toLowerCase()===t)}function Yx(e){if(qx(e))return Gx()?eS:tS}var Xx,Zx,Qx,$x,eS,tS,nS,rS,iS=t((()=>{Xx=`gpt-5.6-sol`,Zx=`gpt-5.6-terra`,Qx=`gpt-5.6-luna`,$x={opus:Xx,sonnet:Zx,haiku:Qx},eS=272e3,tS=105e4,nS=128e3,rS=[{value:`gpt-5.6-sol`,label:`gpt-5.6-sol`,description:`Frontier model for complex coding, research, and real-world work`},{value:`gpt-5.6-terra`,label:`gpt-5.6-terra`,description:`Strong model for everyday coding`},{value:`gpt-5.6-luna`,label:`gpt-5.6-luna`,description:`Small, fast, and cost-efficient model for simpler coding tasks`},{value:`gpt-5.5`,label:`GPT-5.5`,description:`Frontier model for complex coding, research, and real-world work`},{value:`gpt-5.4`,label:`GPT-5.4`,description:`Strong model for everyday coding`},{value:`gpt-5.4-mini`,label:`GPT-5.4-Mini`,description:`Small, fast, and cost-efficient model for simpler coding tasks`},{value:`gpt-5.3-codex`,label:`GPT-5.3-Codex`,description:`Coding-optimized model`},{value:`gpt-5.3-codex-spark`,label:`GPT-5.3-Codex-Spark`,description:`Ultra-fast coding model`},{value:`gpt-5.2`,label:`GPT-5.2`,description:`Optimized for professional work and long-running agents`}]}));function aS(){return cS.getStore()?.workload}function oS(e,t){return cS.run({workload:e},t)}var sS,cS,lS=t((()=>{sS=`cron`,cS=new Sa}));function uS(){let e=process.env.CLAUDE_AGENT_SDK_VERSION?`, agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`:``,t=process.env.CLAUDE_AGENT_SDK_CLIENT_APP?`, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`:``,n=aS(),r=n?`, workload/${n}`:``;return`claude-cli/2.8.4 (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT??`cli`}${e}${t}${r})`}function dS(){return`Claude-User (${fx()}; +https://support.anthropic.com/)`}var fS=t((()=>{vi(),Cj(),px(),lS()}));function pS(e){let t={};for(let n of yS)t[n]=Lv[n][e];return t}async function mS(){let e=pS(`bedrock`),t;try{t=await xv()}catch(t){return P(t),e}if(!t?.length)return e;let n={};for(let r of yS){let i=Lv[r].firstParty;n[r]=mv(t,i)||e[r]}return n}function hS(e){let t=Vg().modelOverrides;if(!t)return e;let n={...e};for(let[e,r]of Object.entries(t)){let t=Rv[e];t&&r&&(n[t]=r)}return n}function gS(e){let t;try{t=Vg().modelOverrides}catch{return e}if(!t)return e;for(let[n,r]of Object.entries(t))if(r===e)return n;return e}function _S(){if(ir()===null){if(K()!==`bedrock`){rr(pS(K()));return}bS()}}function J(){let e=ir();return e===null?(_S(),hS(pS(K()))):hS(e)}async function vS(){if(ir()===null){if(K()!==`bedrock`){rr(pS(K()));return}await bS()}}var yS,bS,xS=t((()=>{nr(),yr(),pv(),Yg(),wv(),zv(),Uv(),yS=Object.keys(Lv),bS=fv(async()=>{if(ir()===null)try{rr(await mS())}catch(e){P(e)}})}));function SS(){return!_(process.env.CLAUDE_CODE_DISABLE_FAST_MODE)}function CS(){return SS()?TS()===null:!1}function wS(e,t){switch(e){case`free`:return t===`oauth`?`Fast mode requires a paid subscription`:`Fast mode unavailable during evaluation. Please purchase credits.`;case`preference`:return`Fast mode has been disabled by your organization`;case`extra_usage_disabled`:return`Fast mode requires extra usage billing · /extra-usage to enable`;case`network_error`:return`Fast mode unavailable due to network connectivity issues`;case`unknown`:return`Fast mode is currently unavailable`}}function TS(){if(!SS())return`Fast mode is not available`;let e=xE(`tengu_penguins_off`,null);if(e!==null)return N(`Fast mode unavailable: ${e}`),e;if(!yi()&&xE(`tengu_marble_sandcastle`,!1))return`Fast mode requires the native binary · Install from: https://claude.com/product/claude-code`;if(k()&&dn()&&!Yt()&&!H(`flagSettings`)?.fastMode){let e=`Fast mode is not available in the Agent SDK`;return N(`Fast mode unavailable: ${e}`),e}if(K()!==`firstParty`){let e=`Fast mode is not available on Bedrock, Vertex, or Foundry`;return N(`Fast mode unavailable: ${e}`),e}if(qS.status===`disabled`){if((qS.reason===`network_error`||qS.reason===`unknown`)&&_(process.env.CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS))return null;let e=$()===null?`api-key`:`oauth`,t=wS(qS.reason,e);return N(`Fast mode unavailable: ${t}`),t}return null}function ES(){return`opus`+(Qw()?`[1m]`:``)}function DS(e){if(!SS()||!CS()||!OS(e))return!1;let t=Vg();return t.fastModePerSessionOptIn?!1:t.fastMode===!0}function OS(e){if(!SS())return!1;let t=rT(e??Gw());return t.toLowerCase().includes(`opus-4-7`)||t.toLowerCase().includes(`opus-4-6`)}function kS(){return HS.status===`cooldown`&&Date.now()>=HS.resetAt&&(SS()&&!US&&(N(`Fast mode cooldown expired, re-enabling fast mode`),US=!0,GS.emit()),HS={status:`active`}),HS}function AS(e,t){if(!SS())return;HS={status:`cooldown`,resetAt:e,reason:t},US=!1;let n=e-Date.now();N(`Fast mode cooldown triggered (${t}), duration ${Math.round(n/1e3)}s`),I(`tengu_fast_mode_fallback_triggered`,{cooldown_duration_ms:n,cooldown_reason:t}),WS.emit(e,t)}function jS(){HS={status:`active`}}function MS(){qS.status!==`disabled`&&(qS={status:`disabled`,reason:`preference`},Ig(`userSettings`,{fastMode:void 0}),p_(e=>({...e,penguinModeOrgEnabled:!1})),JS.emit(!1))}function NS(e){switch(e){case`out_of_credits`:return`Fast mode disabled · extra usage credits exhausted`;case`org_level_disabled`:case`org_service_level_disabled`:return`Fast mode disabled · extra usage disabled by your organization`;case`org_level_disabled_until`:return`Fast mode disabled · extra usage spending cap reached`;case`member_level_disabled`:return`Fast mode disabled · extra usage disabled for your account`;case`seat_tier_level_disabled`:case`seat_tier_zero_credit_limit`:case`member_zero_credit_limit`:return`Fast mode disabled · extra usage not available for your plan`;case`overage_not_provisioned`:case`no_limits_configured`:return`Fast mode requires extra usage billing · /extra-usage to enable`;default:return`Fast mode disabled · extra usage not available`}}function PS(e){return e===`org_level_disabled_until`||e===`out_of_credits`}function FS(e){let t=NS(e);N(`Fast mode overage rejection: ${e??`unknown`} — ${t}`),I(`tengu_fast_mode_overage_rejected`,{overage_disabled_reason:e??`unknown`}),PS(e)||(Ig(`userSettings`,{fastMode:void 0}),p_(e=>({...e,penguinModeOrgEnabled:!1}))),KS.emit(t)}function IS(){return kS().status===`cooldown`}function LS(e,t){let n=SS()&&CS()&&!!t&&OS(e);return n&&IS()?`cooldown`:n?`on`:`off`}async function RS(e){let t=`${tv().BASE_API_URL}/api/claude_code_penguin_mode`,n=`accessToken`in e?{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":av}:{"x-api-key":e.apiKey};return(await Fe.get(t,{headers:n})).data}function zS(){if(!SS()||qS.status!==`pending`)return;let e=process.env.USER_TYPE===`ant`,t=G().penguinModeOrgEnabled===!0;qS=e||t?{status:`enabled`}:{status:`disabled`,reason:`unknown`}}async function BS(){if(_r()||!SS())return;if(ZS)return N(`Fast mode prefetch in progress, returning in-flight promise`),ZS;let e=Xk();if(!($()?.accessToken&&RA())&&!e){let e=process.env.USER_TYPE===`ant`,t=G().penguinModeOrgEnabled===!0;qS=e||t?{status:`enabled`}:{status:`disabled`,reason:`preference`};return}let t=Date.now();if(t-XS<YS){N(`Skipping fast mode prefetch, fetched recently`);return}XS=t;let n=async()=>{let t=$(),n=t?.accessToken&&RA()?{accessToken:t.accessToken}:e?{apiKey:e}:null;if(!n)throw Error(`No auth available`);return RS(n)};async function r(){try{let e;try{e=await n()}catch(t){if(Fe.isAxiosError(t)&&(t.response?.status===401||t.response?.status===403&&typeof t.response?.data==`string`&&t.response.data.includes(`OAuth token has been revoked`))){let r=$()?.accessToken;if(r)await NA(r),e=await n();else throw t}else throw t}let t=qS.status===`pending`?G().penguinModeOrgEnabled:qS.status===`enabled`;qS=e.enabled?{status:`enabled`}:{status:`disabled`,reason:e.disabled_reason??`preference`},t!==e.enabled&&(e.enabled||Ig(`userSettings`,{fastMode:void 0}),p_(t=>({...t,penguinModeOrgEnabled:e.enabled})),JS.emit(e.enabled)),N(`Org fast mode: ${e.enabled?`enabled`:`disabled (${e.disabled_reason??`preference`})`}`)}catch(e){let t=process.env.USER_TYPE===`ant`,n=G().penguinModeOrgEnabled===!0;qS=t||n?{status:`enabled`}:{status:`disabled`,reason:`network_error`},N(`Failed to fetch org fast mode status, defaulting to ${qS.status===`enabled`?`enabled (cached)`:`disabled (network_error)`}: ${e}`,{level:`error`}),I(`tengu_org_penguin_mode_fetch_failed`,{})}finally{ZS=null}}return ZS=r(),ZS}var VS,HS,US,WS,GS,KS,qS,JS,YS,XS,ZS,QS=t((()=>{Ie(),dv(),XE(),O(),si(),Cj(),bi(),Q_(),M(),g(),fT(),Uv(),gr(),Yg(),ti(),VS=`Opus 4.7`,HS={status:`active`},US=!1,WS=Yr(),GS=Yr(),WS.subscribe,GS.subscribe,KS=Yr(),KS.subscribe,qS={status:`pending`},JS=Yr(),JS.subscribe,YS=3e4,XS=0,ZS=null}));function $S(e){return SS()&&e?uC:lC}function eC(e,t){return t.input_tokens/1e6*e.inputTokens+t.output_tokens/1e6*e.outputTokens+(t.cache_read_input_tokens??0)/1e6*e.promptCacheReadTokens+(t.cache_creation_input_tokens??0)/1e6*e.promptCacheWriteTokens+(t.server_tool_use?.web_search_requests??0)*e.webSearchRequests}function tC(e,t){let n=Jw(e);return n===qw(Pv.firstParty)?$S(t.speed===`fast`):mC[n]||(nC(e,n),mC[Jw(Gw())]??pC)}function nC(e,t){F(`tengu_unknown_model_cost`,{model:e,shortName:t}),ln()}function rC(e,t){return eC(tC(e,t),t)}function iC(e,t){return rC(e,{input_tokens:t.inputTokens,output_tokens:t.outputTokens,cache_read_input_tokens:t.cacheReadInputTokens,cache_creation_input_tokens:t.cacheCreationInputTokens})}function aC(e){return Number.isInteger(e)?`$${e}`:`$${e.toFixed(2)}`}function oC(e){return`${aC(e.inputTokens)}/${aC(e.outputTokens)} per Mtok`}var sC,cC,lC,uC,dC,fC,pC,mC,hC=t((()=>{ii(),O(),QS(),zv(),fT(),sC={inputTokens:3,outputTokens:15,promptCacheWriteTokens:3.75,promptCacheReadTokens:.3,webSearchRequests:.01},cC={inputTokens:15,outputTokens:75,promptCacheWriteTokens:18.75,promptCacheReadTokens:1.5,webSearchRequests:.01},lC={inputTokens:5,outputTokens:25,promptCacheWriteTokens:6.25,promptCacheReadTokens:.5,webSearchRequests:.01},uC={inputTokens:30,outputTokens:150,promptCacheWriteTokens:37.5,promptCacheReadTokens:3,webSearchRequests:.01},dC={inputTokens:.8,outputTokens:4,promptCacheWriteTokens:1,promptCacheReadTokens:.08,webSearchRequests:.01},fC={inputTokens:1,outputTokens:5,promptCacheWriteTokens:1.25,promptCacheReadTokens:.1,webSearchRequests:.01},pC=lC,mC={[qw(Dv.firstParty)]:dC,[qw(Ov.firstParty)]:fC,[qw(Ev.firstParty)]:sC,[qw(Tv.firstParty)]:sC,[qw(kv.firstParty)]:sC,[qw(Av.firstParty)]:sC,[qw(Iv.firstParty)]:sC,[qw(jv.firstParty)]:cC,[qw(Mv.firstParty)]:cC,[qw(Nv.firstParty)]:lC,[qw(Pv.firstParty)]:lC}}));function gC(e){return vC.includes(e)}function _C(e){return yC.includes(e)}var vC,yC,bC=t((()=>{vC=[`sonnet`,`opus`,`haiku`,`best`,`sonnet[1m]`,`opus[1m]`,`opusplan`],yC=[`sonnet`,`opus`,`haiku`]}));function xC(e,t){return e.includes(t)?!0:gC(e)?rT(e).toLowerCase().includes(t):!1}function SC(e,t){return e.startsWith(t)?e.length===t.length||e[t.length]===`-`:!1}function CC(e,t){let n=gC(e)?rT(e).toLowerCase():e;return!!(SC(n,t)||!t.startsWith(`claude-`)&&SC(n,`claude-${t}`))}function wC(e,t){for(let n of t){if(_C(n))continue;let t=n.indexOf(e);if(t===-1)continue;let r=t+e.length;if(r===n.length||n[r]===`-`)return!0}return!1}function TC(e){let{availableModels:t}=U()||{};if(!t)return!0;if(t.length===0)return!1;let n=gS(e).trim().toLowerCase(),r=t.map(e=>e.trim().toLowerCase());if(r.includes(n)&&(!_C(n)||!wC(n,r)))return!0;for(let e of r)if(_C(e)&&!wC(e,r)&&xC(n,e))return!0;if(gC(n)){let e=rT(n).toLowerCase();if(r.includes(e))return!0}for(let e of r)if(!_C(e)&&gC(e)&&rT(e).toLowerCase()===n)return!0;for(let e of r)if(!_C(e)&&!gC(e)&&CC(n,e))return!0;return!1}var EC=t((()=>{Yg(),bC(),fT(),xS()}));function DC(e,t){if(e===`openai`)return Wx({tier:t,isChatGPTAuth:Gx(),tierOverride:process.env[ZC[t]]})}function OC(){let e=K();if(e===`openai`&&Gx()){let e=Wx({tier:`haiku`,isChatGPTAuth:!0,tierOverride:process.env.OPENAI_DEFAULT_HAIKU_MODEL,taskOverride:process.env.OPENAI_SMALL_FAST_MODEL});if(e)return e}return e===`openai`&&process.env.OPENAI_SMALL_FAST_MODEL?process.env.OPENAI_SMALL_FAST_MODEL:e===`gemini`&&process.env.GEMINI_SMALL_FAST_MODEL?process.env.GEMINI_SMALL_FAST_MODEL:process.env.ANTHROPIC_SMALL_FAST_MODEL||IC()}function kC(e){return e===J().opus40||e===J().opus41||e===J().opus45||e===J().opus46||e===J().opus47}function AC(){let e,t=Jt();if(t!==void 0)e=t;else{let t=U()||{};e=process.env.ANTHROPIC_MODEL||t.model||void 0}if(!(e&&!TC(e)))return e}function jC(){let e=AC();return e==null?RC():KC(e)}function MC(){return PC()}function NC(){let e=K();if(e===`openai`)return process.env.OPENAI_MODEL;if(e===`gemini`)return process.env.GEMINI_MODEL;if(e===`grok`)return process.env.GROK_MODEL}function PC(){let e=K();return DC(e,`opus`)||(e===`gemini`&&process.env.GEMINI_DEFAULT_OPUS_MODEL?process.env.GEMINI_DEFAULT_OPUS_MODEL:process.env.ANTHROPIC_DEFAULT_OPUS_MODEL?process.env.ANTHROPIC_DEFAULT_OPUS_MODEL:NC()||J().opus47)}function FC(){let e=K();return DC(e,`sonnet`)||(e===`gemini`&&process.env.GEMINI_DEFAULT_SONNET_MODEL?process.env.GEMINI_DEFAULT_SONNET_MODEL:process.env.ANTHROPIC_DEFAULT_SONNET_MODEL?process.env.ANTHROPIC_DEFAULT_SONNET_MODEL:NC()||(e===`firstParty`?J().sonnet46:J().sonnet45))}function IC(){let e=K();return DC(e,`haiku`)||(e===`gemini`&&process.env.GEMINI_DEFAULT_HAIKU_MODEL?process.env.GEMINI_DEFAULT_HAIKU_MODEL:process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL?process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL:NC()||J().haiku45)}function LC(){return process.env.USER_TYPE===`ant`?Tx()?.defaultModel??PC()+`[1m]`:UA()||GA()?PC()+(HC()?`[1m]`:``):FC()}function RC(){return KC(LC())}function zC(e=!1){return UA()||GA()?HC()?`Opus 4.7 with 1M context · Most capable for complex work${e?VC(!0):``}`:`Opus 4.7 · Most capable for complex work${e?VC(!0):``}`:`Sonnet 4.6 · Best for everyday tasks`}function BC(e){return e===`opusplan`?`Opus 4.7 in plan mode, else Sonnet 4.6`:GC(KC(e))}function VC(e){if(K()!==`firstParty`)return``;let t=oC($S(e));return` ·${e?` (↯)`:``} ${t}`}function HC(){return!(bw()||qA()||K()!==`firstParty`||!Hv()||Z()&&Q()===null)}function UC(e){switch(e){case J().opus47:return`Opus 4.7`;case J().opus47+`[1m]`:return`Opus 4.7 (1M context)`;case J().opus46:return`Opus 4.6`;case J().opus46+`[1m]`:return`Opus 4.6 (1M context)`;case J().opus45:return`Opus 4.5`;case J().opus41:return`Opus 4.1`;case J().opus40:return`Opus 4`;case J().sonnet46+`[1m]`:return`Sonnet 4.6 (1M context)`;case J().sonnet46:return`Sonnet 4.6`;case J().sonnet45+`[1m]`:return`Sonnet 4.5 (1M context)`;case J().sonnet45:return`Sonnet 4.5`;case J().sonnet40:return`Sonnet 4`;case J().sonnet40+`[1m]`:return`Sonnet 4 (1M context)`;case J().sonnet37:return`Sonnet 3.7`;case J().sonnet35:return`Sonnet 3.5`;case J().haiku45:return`Haiku 4.5`;case J().haiku35:return`Haiku 3.5`;default:return null}}function WC(e){let[t=``,...n]=e.split(`-`);return[t.slice(0,3)+`*`.repeat(Math.max(0,t.length-3)),...n].join(`-`)}function GC(e){let t=UC(e);if(t)return t;if(process.env.USER_TYPE===`ant`){let t=KC(e),n=Dx(e);return n?WC(n.model.replace(/\[1m\]$/i,``))+(xw(t)?`[1m]`:``):t===e?t:`${e} (${t})`}return e}function KC(e){let t=e.trim(),n=t.toLowerCase(),r=xw(n),i=r?n.replace(/\[1m]$/i,``).trim():n;if(gC(i))switch(i){case`opusplan`:return FC()+(r?`[1m]`:``);case`sonnet`:return FC()+(r?`[1m]`:``);case`haiku`:return IC()+(r?`[1m]`:``);case`opus`:return PC()+(r?`[1m]`:``);case`best`:return MC();default:}if(K()===`firstParty`&&JC(i)&&YC())return PC()+(r?`[1m]`:``);if(process.env.USER_TYPE===`ant`){let e=xw(n),t=Dx(n.replace(/\[1m]$/i,``).trim());if(t){let n=e?`[1m]`:``;return t.model+n}}return r?t.replace(/\[1m\]$/i,``).trim()+`[1m]`:t}function qC(e,t){return xw(e)||!xw(t)?e:Sw(KC(e))?e+`[1m]`:e}function JC(e){return QC.includes(e)}function YC(){return!_(process.env.CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP)}function XC(e){if(e===null)return process.env.USER_TYPE===`ant`?`Default for Ants (${BC(LC())})`:Z()?`Default (${zC()})`:`Default (${RC()})`;let t=KC(e);return e===t?t:`${e} (${t})`}var ZC,QC,$C=t((()=>{O(),Ox(),Cj(),Nw(),g(),xS(),hC(),Yg(),Uv(),ip(),EC(),bC(),iS(),ZC={opus:`OPENAI_DEFAULT_OPUS_MODEL`,sonnet:`OPENAI_DEFAULT_SONNET_MODEL`,haiku:`OPENAI_DEFAULT_HAIKU_MODEL`},QC=[`claude-opus-4-20250514`,`claude-opus-4-1-20250805`,`claude-opus-4-0`,`claude-opus-4-1`]}));function ew(e=process.env){return e.https_proxy||e.HTTPS_PROXY||e.http_proxy||e.HTTP_PROXY}function tw(e){let t=nw?{keepalive:!1}:{};if(e?.forAnthropicAPI){let e=process.env.ANTHROPIC_UNIX_SOCKET;if(e&&typeof Bun<`u`)return{...t,unix:e}}let n=ew();return n?typeof Bun<`u`?{...t,proxy:n,...Pi()}:{...t,dispatcher:rw(n)}:{...t,...Pi()}}var nw,rw,iw=t((()=>{Ai(),m(),Ri(),M(),g(),ji(),nw=!1,rw=p(e=>{let t=Li(),n=Fi(),r=Ni(),i={httpProxy:e,httpsProxy:e,noProxy:process.env.NO_PROXY||process.env.no_proxy};if(n||r){let e={...n&&{cert:n.cert,key:n.key,passphrase:n.passphrase},...r&&{ca:r}};i.connect=e,i.requestTls=e}return new t.EnvHttpProxyAgent(i)})}));function aw(){return{error:(e,...t)=>console.error(`[Anthropic SDK ERROR]`,e,...t),warn:(e,...t)=>console.error(`[Anthropic SDK WARN]`,e,...t),info:(e,...t)=>console.error(`[Anthropic SDK INFO]`,e,...t),debug:(e,...t)=>console.error(`[Anthropic SDK DEBUG]`,e,...t)}}async function ow({apiKey:e,maxRetries:t,model:r,fetchOverride:i,source:a}){let o=process.env.CLAUDE_CODE_CONTAINER_ID,s=process.env.CLAUDE_CODE_REMOTE_SESSION_ID,c=process.env.CLAUDE_AGENT_SDK_CLIENT_APP,l=cw(),u={"x-app":`cli`,"User-Agent":uS(),"X-Claude-Code-Session-Id":en(),...l,...o?{"x-claude-remote-container-id":o}:{},...s?{"x-claude-remote-session-id":s}:{},...c?{"x-client-app":c}:{},...process.env.ANTHROPIC_AUTH_NONCE?{"x-auth-nonce":process.env.ANTHROPIC_AUTH_NONCE}:{}};N(`[API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: ${!!process.env.ANTHROPIC_CUSTOM_HEADERS}, has Authorization header: ${!!l.Authorization}`),_(process.env.CLAUDE_CODE_ADDITIONAL_PROTECTION)&&(u[`x-anthropic-additional-protection`]=`true`),N(`[API:auth] OAuth token check starting`),await CO(),N(`[API:auth] OAuth token check complete`),TO()||await sw(u,k());let d=lw(i,a),f={defaultHeaders:u,maxRetries:t,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,fetchOptions:tw({forAnthropicAPI:!0}),...d&&{fetch:d}};if(_(process.env.CLAUDE_CODE_USE_BEDROCK)){let{BedrockClient:e}=await import(`./bedrockClient-BFzWuhQK.js`),t=r===OC()&&process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION?process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION:ae(),n={...f,awsRegion:t,..._(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)&&{skipAuth:!0},...Fn()&&{logger:aw()}};if(process.env.AWS_BEARER_TOKEN_BEDROCK)n.skipAuth=!0,n.defaultHeaders={...n.defaultHeaders,Authorization:`Bearer ${process.env.AWS_BEARER_TOKEN_BEDROCK}`};else if(!_(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)){let e=await GO();e&&(n.awsAccessKey=e.accessKeyId,n.awsSecretKey=e.secretAccessKey,n.awsSessionToken=e.sessionToken)}return new e(n)}if(_(process.env.CLAUDE_CODE_USE_FOUNDRY)){let{AnthropicFoundry:e}=await import(`./foundry-sdk-CtX8C0x3.js`),t;if(!process.env.ANTHROPIC_FOUNDRY_API_KEY)if(_(process.env.CLAUDE_CODE_SKIP_FOUNDRY_AUTH))t=()=>Promise.resolve(``);else{let{DefaultAzureCredential:e,getBearerTokenProvider:n}=await import(`./esm-Q6Yz2GMx.js`);t=n(new e,`https://cognitiveservices.azure.com/.default`)}return new e({...f,...t&&{azureADTokenProvider:t},...Fn()&&{logger:aw()}})}if(_(process.env.CLAUDE_CODE_USE_VERTEX)){_(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)||await YO();let[{AnthropicVertex:e},{GoogleAuth:t}]=await Promise.all([import(`./vertex-sdk-CC3U26o7.js`),import(`./src-lLwoqdC0.js`).then(e=>n(e.default,1))]),i=process.env.GCLOUD_PROJECT||process.env.GOOGLE_CLOUD_PROJECT||process.env.gcloud_project||process.env.google_cloud_project,a=process.env.GOOGLE_APPLICATION_CREDENTIALS||process.env.google_application_credentials,o=_(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)?{getClient:()=>({getRequestHeaders:()=>({})})}:new t({scopes:[`https://www.googleapis.com/auth/cloud-platform`],...i||a?{}:{projectId:process.env.ANTHROPIC_VERTEX_PROJECT_ID}});return new e({...f,region:te(r),googleAuth:o,...Fn()&&{logger:aw()}})}return new oe({apiKey:TO()?null:e||QD(),authToken:TO()?X()?.accessToken:void 0,...process.env.USER_TYPE===`ant`&&_(process.env.USE_STAGING_OAUTH)?{baseURL:fi().BASE_API_URL}:{},...f,...Fn()&&{logger:aw()}})}async function sw(e,t){let n=process.env.ANTHROPIC_AUTH_TOKEN||await sO(t);n&&(e.Authorization=`Bearer ${n}`)}function cw(){let e={},t=process.env.ANTHROPIC_CUSTOM_HEADERS;if(!t)return e;let n=t.split(/\n|\r\n/);for(let t of n){if(!t.trim())continue;let n=t.indexOf(`:`);if(n===-1)continue;let r=t.slice(0,n).trim(),i=t.slice(n+1).trim();r&&(e[r]=i)}return e}function lw(e,t){let n=e??globalThis.fetch,r=$v()===`firstParty`&&ty();return(e,i)=>{let a=new Headers(i?.headers);r&&!a.has(`x-client-request-id`)&&a.set(uw,fa());try{let n=e instanceof Request?e.url:String(e),r=a.get(uw);N(`[API REQUEST] ${new URL(n).pathname}${r?` ${uw}=${r}`:``} source=${t??`unknown`}`)}catch{}return n(e,{...i,headers:a})}}var uw,dw=t((()=>{ar(),rk(),fS(),$C(),ny(),iw(),O(),vi(),M(),g(),uw=`x-client-request-id`}));function fw(){return z(h(),`cache`)}function pw(){return z(fw(),`model-capabilities.json`)}function mw(){return!(K()!==`firstParty`||!Hv())}function hw(e){if(!mw())return;let t=vw(pw());if(!t||t.length===0)return;let n=e.toLowerCase();return t.find(e=>e.id.toLowerCase()===n)||t.find(e=>n.includes(e.id.toLowerCase()))}var gw,_w,vw,yw=t((()=>{m(),Je(),vi(),dw(),Cj(),M(),g(),Vr(),ui(),vn(),Uv(),gw=L(()=>D({id:b(),max_input_tokens:y().optional(),max_tokens:y().optional()}).strip()),_w=L(()=>D({models:S(gw()),timestamp:y()})),vw=p(e=>{try{let t=oa(e,`utf-8`),n=_w().safeParse(Hr(t,!1));return n.success?n.data.models:null}catch{return null}},e=>e)}));function bw(){return _(process.env.CLAUDE_CODE_DISABLE_1M_CONTEXT)}function xw(e){return bw()?!1:/\[1m\]/i.test(e)}function Sw(e){if(bw())return!1;let t=Jw(e);return t.includes(`claude-sonnet-4`)||t.includes(`opus-4-6`)||t.includes(`opus-4-7`)}function Cw(e,t){if(process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_MAX_CONTEXT_TOKENS){let e=parseInt(process.env.CLAUDE_CODE_MAX_CONTEXT_TOKENS,10);if(!isNaN(e)&&e>0)return e}if(xw(e))return 1e6;let n=Yx(e);if(n!==void 0)return bw()&&n>2e5?Dw:n;let r=hw(e);if(r?.max_input_tokens&&r.max_input_tokens>=1e5)return r.max_input_tokens>2e5&&bw()?Dw:r.max_input_tokens;if(t?.includes(`context-1m-2025-08-07`)&&Sw(e)||ww(e))return 1e6;if(process.env.USER_TYPE===`ant`){let t=Dx(e);if(t?.contextWindow)return t.contextWindow}return Dw}function ww(e){return bw()||xw(e)||!Jw(e).includes(`sonnet-4-6`)?!1:G().clientDataCache?.coral_reef_sonnet===`true`}function Tw(e,t){if(!e)return{used:null,remaining:null};let n=e.input_tokens+e.cache_creation_input_tokens+e.cache_read_input_tokens;if(n===0)return{used:null,remaining:null};let r=Math.round(n/t*100),i=Math.min(100,Math.max(0,r));return{used:i,remaining:100-i}}function Ew(e){let t,n;if(process.env.USER_TYPE===`ant`){let r=Dx(e.toLowerCase());if(r)return t=r.defaultMaxTokens??kw,n=r.upperMaxTokensLimit??Aw,{default:t,upperLimit:n}}let r=Jw(e);Yx(e)===void 0?r.includes(`opus-4-7`)||r.includes(`opus-4-6`)?(t=64e3,n=128e3):r.includes(`sonnet-4-6`)?(t=32e3,n=128e3):r.includes(`opus-4-5`)||r.includes(`sonnet-4`)||r.includes(`haiku-4`)?(t=32e3,n=64e3):r.includes(`opus-4-1`)||r.includes(`opus-4`)?(t=32e3,n=32e3):r.includes(`claude-3-opus`)?(t=4096,n=4096):r.includes(`claude-3-sonnet`)?(t=8192,n=8192):r.includes(`claude-3-haiku`)?(t=4096,n=4096):r.includes(`3-5-sonnet`)||r.includes(`3-5-haiku`)?(t=8192,n=8192):r.includes(`3-7-sonnet`)?(t=32e3,n=64e3):(t=kw,n=Aw):(t=32e3,n=nS);let i=hw(e);return i?.max_tokens&&i.max_tokens>=4096&&(n=i.max_tokens,t=Math.min(t,n)),{default:t,upperLimit:n}}var Dw,Ow,kw,Aw,jw,Mw,Nw=t((()=>{Ux(),Q_(),g(),fT(),Ox(),iS(),yw(),Dw=2e5,Ow=2e4,kw=32e3,Aw=64e3,jw=8e3,Mw=64e3}));function Pw(e,t){if(e===`openai`)return Wx({tier:t,isChatGPTAuth:Gx(),tierOverride:process.env[uT[t]]})}function Fw(){let e=K();if(e===`openai`&&Gx()){let e=Wx({tier:`haiku`,isChatGPTAuth:!0,tierOverride:process.env.OPENAI_DEFAULT_HAIKU_MODEL,taskOverride:process.env.OPENAI_SMALL_FAST_MODEL});if(e)return e}return e===`openai`&&process.env.OPENAI_SMALL_FAST_MODEL?process.env.OPENAI_SMALL_FAST_MODEL:e===`gemini`&&process.env.GEMINI_SMALL_FAST_MODEL?process.env.GEMINI_SMALL_FAST_MODEL:process.env.ANTHROPIC_SMALL_FAST_MODEL||Uw()}function Iw(e){return e===J().opus40||e===J().opus41||e===J().opus45||e===J().opus46||e===J().opus47}function Lw(){let e,t=Jt();if(t!==void 0)e=t;else{let t=U()||{};e=process.env.ANTHROPIC_MODEL||t.model||void 0}if(!(e&&!TC(e)))return e}function Rw(){let e=Lw();return e==null?Kw():rT(e)}function zw(){return Vw()}function Bw(){let e=K();if(e===`openai`)return process.env.OPENAI_MODEL;if(e===`gemini`)return process.env.GEMINI_MODEL;if(e===`grok`)return process.env.GROK_MODEL}function Vw(){let e=K();return Pw(e,`opus`)||(e===`gemini`&&process.env.GEMINI_DEFAULT_OPUS_MODEL?process.env.GEMINI_DEFAULT_OPUS_MODEL:process.env.ANTHROPIC_DEFAULT_OPUS_MODEL?process.env.ANTHROPIC_DEFAULT_OPUS_MODEL:Bw()||J().opus47)}function Hw(){let e=K();return Pw(e,`sonnet`)||(e===`gemini`&&process.env.GEMINI_DEFAULT_SONNET_MODEL?process.env.GEMINI_DEFAULT_SONNET_MODEL:process.env.ANTHROPIC_DEFAULT_SONNET_MODEL?process.env.ANTHROPIC_DEFAULT_SONNET_MODEL:Bw()||(e===`firstParty`?J().sonnet46:J().sonnet45))}function Uw(){let e=K();return Pw(e,`haiku`)||(e===`gemini`&&process.env.GEMINI_DEFAULT_HAIKU_MODEL?process.env.GEMINI_DEFAULT_HAIKU_MODEL:process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL?process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL:Bw()||J().haiku45)}function Ww(e){let{permissionMode:t,mainLoopModel:n,exceeds200kTokens:r=!1}=e;return Lw()===`opusplan`&&t===`plan`&&!r?Vw():Lw()===`haiku`&&t===`plan`?Hw():n}function Gw(){return process.env.USER_TYPE===`ant`?Tx()?.defaultModel??Vw()+`[1m]`:UA()||GA()?Vw()+(Qw()?`[1m]`:``):Hw()}function Kw(){return rT(Gw())}function qw(e){if(e=e.toLowerCase(),e.includes(`claude-opus-4-7`))return`claude-opus-4-7`;if(e.includes(`claude-opus-4-6`))return`claude-opus-4-6`;if(e.includes(`claude-opus-4-5`))return`claude-opus-4-5`;if(e.includes(`claude-opus-4-1`))return`claude-opus-4-1`;if(e.includes(`claude-opus-4`))return`claude-opus-4`;if(e.includes(`claude-sonnet-4-6`))return`claude-sonnet-4-6`;if(e.includes(`claude-sonnet-4-5`))return`claude-sonnet-4-5`;if(e.includes(`claude-sonnet-4`))return`claude-sonnet-4`;if(e.includes(`claude-haiku-4-5`))return`claude-haiku-4-5`;if(e.includes(`claude-3-7-sonnet`))return`claude-3-7-sonnet`;if(e.includes(`claude-3-5-sonnet`))return`claude-3-5-sonnet`;if(e.includes(`claude-3-5-haiku`))return`claude-3-5-haiku`;if(e.includes(`claude-3-opus`))return`claude-3-opus`;if(e.includes(`claude-3-sonnet`))return`claude-3-sonnet`;if(e.includes(`claude-3-haiku`))return`claude-3-haiku`;let t=e.match(/(claude-(\d+-\d+-)?\w+)/);return t&&t[1]?t[1]:e}function Jw(e){return qw(gS(e))}function Yw(e=!1){return UA()||GA()?Qw()?`Opus 4.7 with 1M context · Most capable for complex work${e?Zw(!0):``}`:`Opus 4.7 · Most capable for complex work${e?Zw(!0):``}`:`Sonnet 4.6 · Best for everyday tasks`}function Xw(e){return e===`opusplan`?`Opus 4.7 in plan mode, else Sonnet 4.6`:nT(rT(e))}function Zw(e){if(K()!==`firstParty`)return``;let t=oC($S(e));return` ·${e?` (↯)`:``} ${t}`}function Qw(){return!(bw()||qA()||K()!==`firstParty`||!Hv()||Z()&&Q()===null)}function $w(e){return e===`opusplan`?`Opus Plan`:gC(e)?ai(e):nT(e)}function eT(e){switch(e){case J().opus47:return`Opus 4.7`;case J().opus47+`[1m]`:return`Opus 4.7 (1M context)`;case J().opus46:return`Opus 4.6`;case J().opus46+`[1m]`:return`Opus 4.6 (1M context)`;case J().opus45:return`Opus 4.5`;case J().opus41:return`Opus 4.1`;case J().opus40:return`Opus 4`;case J().sonnet46+`[1m]`:return`Sonnet 4.6 (1M context)`;case J().sonnet46:return`Sonnet 4.6`;case J().sonnet45+`[1m]`:return`Sonnet 4.5 (1M context)`;case J().sonnet45:return`Sonnet 4.5`;case J().sonnet40:return`Sonnet 4`;case J().sonnet40+`[1m]`:return`Sonnet 4 (1M context)`;case J().sonnet37:return`Sonnet 3.7`;case J().sonnet35:return`Sonnet 3.5`;case J().haiku45:return`Haiku 4.5`;case J().haiku35:return`Haiku 3.5`;default:return null}}function tT(e){let[t=``,...n]=e.split(`-`);return[t.slice(0,3)+`*`.repeat(Math.max(0,t.length-3)),...n].join(`-`)}function nT(e){let t=eT(e);if(t)return t;if(process.env.USER_TYPE===`ant`){let t=rT(e),n=Dx(e);return n?tT(n.model.replace(/\[1m\]$/i,``))+(xw(t)?`[1m]`:``):t===e?t:`${e} (${t})`}return e}function rT(e){let t=e.trim(),n=t.toLowerCase(),r=xw(n),i=r?n.replace(/\[1m]$/i,``).trim():n;if(gC(i))switch(i){case`opusplan`:return Hw()+(r?`[1m]`:``);case`sonnet`:return Hw()+(r?`[1m]`:``);case`haiku`:return Uw()+(r?`[1m]`:``);case`opus`:return Vw()+(r?`[1m]`:``);case`best`:return zw();default:}if(K()===`firstParty`&&aT(i)&&oT())return Vw()+(r?`[1m]`:``);if(process.env.USER_TYPE===`ant`){let e=xw(n),t=Dx(n.replace(/\[1m]$/i,``).trim());if(t){let n=e?`[1m]`:``;return t.model+n}}return r?t.replace(/\[1m\]$/i,``).trim()+`[1m]`:t}function iT(e,t){return xw(e)||!xw(t)?e:Sw(rT(e))?e+`[1m]`:e}function aT(e){return dT.includes(e)}function oT(){return!_(process.env.CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP)}function sT(e){if(e===null)return process.env.USER_TYPE===`ant`?`Default for Ants (${Xw(Gw())})`:Z()?`Default (${Yw()})`:`Default (${Kw()})`;let t=rT(e);return e===t?t:`${e} (${t})`}function cT(e){if(K()===`foundry`)return;let t=e.toLowerCase().includes(`[1m]`),n=Jw(e);if(n.includes(`claude-opus-4-7`))return t?`Opus 4.7 (with 1M context)`:`Opus 4.7`;if(n.includes(`claude-opus-4-6`))return t?`Opus 4.6 (with 1M context)`:`Opus 4.6`;if(n.includes(`claude-opus-4-5`))return`Opus 4.5`;if(n.includes(`claude-opus-4-1`))return`Opus 4.1`;if(n.includes(`claude-opus-4`))return`Opus 4`;if(n.includes(`claude-sonnet-4-6`))return t?`Sonnet 4.6 (with 1M context)`:`Sonnet 4.6`;if(n.includes(`claude-sonnet-4-5`))return t?`Sonnet 4.5 (with 1M context)`:`Sonnet 4.5`;if(n.includes(`claude-sonnet-4`))return t?`Sonnet 4 (with 1M context)`:`Sonnet 4`;if(n.includes(`claude-3-7-sonnet`))return`Claude 3.7 Sonnet`;if(n.includes(`claude-3-5-sonnet`))return`Claude 3.5 Sonnet`;if(n.includes(`claude-haiku-4-5`))return`Haiku 4.5`;if(n.includes(`claude-3-5-haiku`))return`Claude 3.5 Haiku`}function lT(e){return e.replace(/\[(1|2)m\]/gi,``)}var uT,dT,fT=t((()=>{O(),Ox(),Cj(),Nw(),g(),xS(),hC(),Yg(),Uv(),ip(),EC(),bC(),ni(),iS(),uT={opus:`OPENAI_DEFAULT_OPUS_MODEL`,sonnet:`OPENAI_DEFAULT_SONNET_MODEL`,haiku:`OPENAI_DEFAULT_HAIKU_MODEL`},dT=[`claude-opus-4-20250514`,`claude-opus-4-1-20250805`,`claude-opus-4-0`,`claude-opus-4-1`]}));function pT(e){return mT?.has(e)??!1}var mT,hT=t((()=>{M(),kn()}));function gT(){return!_(process.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS_DISABLED)}var _T=t((()=>{g()}));function vT(){return CT.getStore()}function yT(e,t){return CT.run(e,t)}function bT(e){return e?.agentType===`subagent`}function xT(){let e=vT();if(!(!bT(e)||!e.subagentName))return e.isBuiltIn?e.subagentName:`user-defined`}function ST(){let e=vT();if(!(!e?.invokingRequestId||e.invocationEmitted))return e.invocationEmitted=!0,{invokingRequestId:e.invokingRequestId,invocationKind:e.invocationKind}}var CT,wT=t((()=>{_T(),CT=new Sa}));function TT(e){return e.startsWith(`mcp__`)?`mcp_tool`:e}function ET(){let e=vT();if(e){let t={agentId:e.agentId,parentSessionId:e.parentSessionId,agentType:e.agentType};return e.agentType===`teammate`&&(t.teamName=e.teamName),t}let t=$r(),n=Zr(),r=Jr(),i=Xr()?`teammate`:t?`standalone`:void 0;if(t||i||n||r)return{...t?{agentId:t}:{},...i?{agentType:i}:{},...n?{parentSessionId:n}:{},...r?{teamName:r}:{}};let a=un();return a?{parentSessionId:a}:{}}function DT(){try{let e=process.memoryUsage(),t=process.cpuUsage(),n=Date.now(),r;if(MT&&NT){let e=n-NT;e>0&&(r=(t.user-MT.user+(t.system-MT.system))/(e*1e3)*100)}return MT=t,NT=n,{uptime:process.uptime(),rss:e.rss,heapTotal:e.heapTotal,heapUsed:e.heapUsed,external:e.external,arrayBuffers:e.arrayBuffers,constrainedMemory:process.constrainedMemory(),cpuUsage:t,cpuPercent:r}}catch{return}}async function OT(e={}){let t=e.model?String(e.model):Rw(),n=typeof e.betas==`string`?e.betas:mD(t).join(`,`),[r,i]=await Promise.all([jT(),sr()]),a=DT();return{model:t,sessionId:en(),userType:process.env.USER_TYPE||``,...n.length>0?{betas:n}:{},envContext:r,...process.env.CLAUDE_CODE_ENTRYPOINT&&{entrypoint:process.env.CLAUDE_CODE_ENTRYPOINT},...process.env.CLAUDE_AGENT_SDK_VERSION&&{agentSdkVersion:process.env.CLAUDE_AGENT_SDK_VERSION},isInteractive:String(Zt()),clientType:tn(),...a&&{processMetrics:a},sweBenchRunId:process.env.SWE_BENCH_RUN_ID||``,sweBenchInstanceId:process.env.SWE_BENCH_INSTANCE_ID||``,sweBenchTaskId:process.env.SWE_BENCH_TASK_ID||``,...ET(),...Q()&&{subscriptionType:Q()},...Yt()?{kairosActive:!0}:{},...i&&{rh:i}}}function kT(e,t,n={}){let{envContext:r,processMetrics:i,rh:a,kairosActive:o,skillMode:s,observerMode:c,...l}=e,u={platform:r.platform,platform_raw:r.platformRaw,arch:r.arch,node_version:r.nodeVersion,terminal:r.terminal||`unknown`,package_managers:r.packageManagers,runtimes:r.runtimes,is_running_with_bun:r.isRunningWithBun,is_ci:r.isCi,is_claubbit:r.isClaubbit,is_claude_code_remote:r.isClaudeCodeRemote,is_local_agent_mode:r.isLocalAgentMode,is_conductor:r.isConductor,is_github_action:r.isGithubAction,is_claude_code_action:r.isClaudeCodeAction,is_claude_ai_auth:r.isClaudeAiAuth,version:r.version,build_time:r.buildTime,deployment_environment:r.deploymentEnvironment};r.remoteEnvironmentType&&(u.remote_environment_type=r.remoteEnvironmentType),r.claudeCodeContainerId&&(u.claude_code_container_id=r.claudeCodeContainerId),r.claudeCodeRemoteSessionId&&(u.claude_code_remote_session_id=r.claudeCodeRemoteSessionId),r.tags&&(u.tags=r.tags.split(`,`).map(e=>e.trim()).filter(Boolean)),r.githubEventName&&(u.github_event_name=r.githubEventName),r.githubActionsRunnerEnvironment&&(u.github_actions_runner_environment=r.githubActionsRunnerEnvironment),r.githubActionsRunnerOs&&(u.github_actions_runner_os=r.githubActionsRunnerOs),r.githubActionRef&&(u.github_action_ref=r.githubActionRef),r.wslVersion&&(u.wsl_version=r.wslVersion),r.linuxDistroId&&(u.linux_distro_id=r.linuxDistroId),r.linuxDistroVersion&&(u.linux_distro_version=r.linuxDistroVersion),r.linuxKernel&&(u.linux_kernel=r.linuxKernel),r.vcs&&(u.vcs=r.vcs),r.versionBase&&(u.version_base=r.versionBase);let d={session_id:l.sessionId,model:l.model,user_type:l.userType,is_interactive:l.isInteractive===`true`,client_type:l.clientType};if(l.betas&&(d.betas=l.betas),l.entrypoint&&(d.entrypoint=l.entrypoint),l.agentSdkVersion&&(d.agent_sdk_version=l.agentSdkVersion),l.sweBenchRunId&&(d.swe_bench_run_id=l.sweBenchRunId),l.sweBenchInstanceId&&(d.swe_bench_instance_id=l.sweBenchInstanceId),l.sweBenchTaskId&&(d.swe_bench_task_id=l.sweBenchTaskId),l.agentId&&(d.agent_id=l.agentId),l.parentSessionId&&(d.parent_session_id=l.parentSessionId),l.agentType&&(d.agent_type=l.agentType),l.teamName&&(d.team_name=l.teamName),t.githubActionsMetadata){let e=t.githubActionsMetadata;u.github_actions_metadata={actor_id:e.actorId,repository_id:e.repositoryId,repository_owner_id:e.repositoryOwnerId}}let f;return(t.accountUuid||t.organizationUuid)&&(f={account_uuid:t.accountUuid,organization_uuid:t.organizationUuid}),{env:u,...i&&{process:Buffer.from(A(i)).toString(`base64`)},...f&&{auth:f},core:d,additional:{...a&&{rh:a},...o&&{is_assistant_mode:!0},...s&&{skill_mode:s},...c&&{observer_mode:c},...n}}}var AT,jT,MT,NT,PT=t((()=>{m(),xi(),wx(),gD(),fT(),O(),g(),hT(),Cj(),dr(),Ar(),wT(),vn(),Qr(),new Set([(Wi(),e(Ui)).COMPUTER_USE_MCP_SERVER_NAME]),AT=p(()=>{let e=`2.8.4`.match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);return e?e[0]:void 0}),jT=p(async()=>{let[e,t,n,r]=await Promise.all([Ci.getPackageManagers(),Ci.getRuntimes(),jr(),kr()]);return{platform:Si(),platformRaw:process.env.CLAUDE_CODE_HOST_PLATFORM||process.platform,arch:Ci.arch,nodeVersion:Ci.nodeVersion,terminal:Cx.terminal,packageManagers:e.join(`,`),runtimes:t.join(`,`),isRunningWithBun:Ci.isRunningWithBun(),isCi:_(process.env.CI),isClaubbit:_(process.env.CLAUBBIT),isClaudeCodeRemote:_(process.env.CLAUDE_CODE_REMOTE),isLocalAgentMode:process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`,isConductor:Ci.isConductor(),...process.env.CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE&&{remoteEnvironmentType:process.env.CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE},...process.env.CLAUDE_CODE_CONTAINER_ID&&{claudeCodeContainerId:process.env.CLAUDE_CODE_CONTAINER_ID},...process.env.CLAUDE_CODE_REMOTE_SESSION_ID&&{claudeCodeRemoteSessionId:process.env.CLAUDE_CODE_REMOTE_SESSION_ID},...process.env.CLAUDE_CODE_TAGS&&{tags:process.env.CLAUDE_CODE_TAGS},isGithubAction:_(process.env.GITHUB_ACTIONS),isClaudeCodeAction:_(process.env.CLAUDE_CODE_ACTION),isClaudeAiAuth:Z(),version:`2.8.4`,versionBase:AT(),buildTime:`2026-08-25T19:16:47.143Z`,deploymentEnvironment:Ci.detectDeploymentEnvironment(),..._(process.env.GITHUB_ACTIONS)&&{githubEventName:process.env.GITHUB_EVENT_NAME,githubActionsRunnerEnvironment:process.env.RUNNER_ENVIRONMENT,githubActionsRunnerOs:process.env.RUNNER_OS,githubActionRef:process.env.GITHUB_ACTION_PATH?.includes(`claude-code-action/`)?process.env.GITHUB_ACTION_PATH.split(`claude-code-action/`)[1]:void 0},...Dr()&&{wslVersion:Dr()},...n??{},...r.length>0?{vcs:r.join(`,`)}:{}}}),MT=null,NT=null}));function FT(){return Yi.join(h(),`telemetry`)}function IT(e){if(!Fe.isAxiosError(e))return $n(e);let t=[],n=e.response?.headers?.[`request-id`];return n&&t.push(`request-id=${n}`),e.response?.status&&t.push(`status=${e.response.status}`),e.code&&t.push(`code=${e.code}`),e.message&&t.push(e.message),t.join(`, `)}var LT,RT,zT,BT=t((()=>{Ce(),Ie(),O(),ax(),dx(),Cj(),Q_(),M(),g(),kn(),Oj(),Vr(),yr(),Bi(),vn(),px(),Gk(),si(),PT(),se(),LT=fa(),RT=`1p_failed_events.`,zT=class{constructor(e={}){v(this,`endpoint`,void 0),v(this,`timeout`,void 0),v(this,`maxBatchSize`,void 0),v(this,`skipAuth`,void 0),v(this,`batchDelayMs`,void 0),v(this,`baseBackoffDelayMs`,void 0),v(this,`maxBackoffDelayMs`,void 0),v(this,`maxAttempts`,void 0),v(this,`isKilled`,void 0),v(this,`pendingExports`,[]),v(this,`isShutdown`,!1),v(this,`schedule`,void 0),v(this,`cancelBackoff`,null),v(this,`attempts`,0),v(this,`isRetrying`,!1),v(this,`lastExportErrorContext`,void 0),this.endpoint=`${e.baseUrl||(process.env.ANTHROPIC_BASE_URL===`https://api-staging.anthropic.com`?`https://api-staging.anthropic.com`:`https://api.anthropic.com`)}${e.path||`/api/event_logging/batch`}`,this.timeout=e.timeout||1e4,this.maxBatchSize=e.maxBatchSize||200,this.skipAuth=e.skipAuth??!1,this.batchDelayMs=e.batchDelayMs||100,this.baseBackoffDelayMs=e.baseBackoffDelayMs||500,this.maxBackoffDelayMs=e.maxBackoffDelayMs||3e4,this.maxAttempts=e.maxAttempts??8,this.isKilled=e.isKilled??(()=>!1),this.schedule=e.schedule??((e,t)=>{let n=setTimeout(e,t);return()=>clearTimeout(n)}),this.retryPreviousBatches()}async getQueuedEventCount(){return(await this.loadEventsFromCurrentBatch()).length}getCurrentBatchFilePath(){return Yi.join(FT(),`${RT}${en()}.${LT}.json`)}async loadEventsFromFile(e){try{return await Lr(e)}catch{return[]}}async loadEventsFromCurrentBatch(){return this.loadEventsFromFile(this.getCurrentBatchFilePath())}async saveEventsToFile(e,t){try{if(t.length===0)try{await va(e)}catch{}else await ma(FT(),{recursive:!0}),await ya(e,t.map(e=>A(e)).join(`
27
+ `)+`
28
+ `,`utf8`)}catch(e){P(e)}}async appendEventsToFile(e,t){if(t.length!==0)try{await ma(FT(),{recursive:!0}),await pa(e,t.map(e=>A(e)).join(`
29
+ `)+`
30
+ `,`utf8`)}catch(e){P(e)}}async deleteFile(e){try{await va(e)}catch{}}async retryPreviousBatches(){try{let e=`${RT}${en()}.`,t;try{t=(await ga(FT())).filter(t=>t.startsWith(e)&&t.endsWith(`.json`)).filter(e=>!e.includes(LT))}catch(e){if(Sn(e))return;throw e}for(let e of t){let t=Yi.join(FT(),e);this.retryFileInBackground(t)}}catch(e){P(e)}}async retryFileInBackground(e){if(this.attempts>=this.maxAttempts){await this.deleteFile(e);return}let t=await this.loadEventsFromFile(e);if(t.length===0){await this.deleteFile(e);return}process.env.USER_TYPE===`ant`&&N(`1P event logging: retrying ${t.length} events from previous batch`);let n=await this.sendEventsInBatches(t);n.length===0?(await this.deleteFile(e),process.env.USER_TYPE===`ant`&&N(`1P event logging: previous batch retry succeeded`)):(await this.saveEventsToFile(e,n),process.env.USER_TYPE===`ant`&&N(`1P event logging: previous batch retry failed, ${n.length} events remain`))}async export(e,t){if(this.isShutdown){process.env.USER_TYPE===`ant`&&N(`1P event logging export failed: Exporter has been shutdown`),t({code:xe.FAILED,error:Error(`Exporter has been shutdown`)});return}let n=this.doExport(e,t);this.pendingExports.push(n),n.finally(()=>{let e=this.pendingExports.indexOf(n);e>-1&&this.pendingExports.splice(e,1)})}async doExport(e,t){try{let n=e.filter(e=>e.instrumentationScope?.name===`com.anthropic.claude_code.events`);if(n.length===0){t({code:xe.SUCCESS});return}let r=this.transformLogsToEvents(n).events;if(r.length===0){t({code:xe.SUCCESS});return}if(this.attempts>=this.maxAttempts){t({code:xe.FAILED,error:Error(`Dropped ${r.length} events: max attempts (${this.maxAttempts}) reached`)});return}let i=await this.sendEventsInBatches(r);if(this.attempts++,i.length>0){await this.queueFailedEvents(i),this.scheduleBackoffRetry();let e=this.lastExportErrorContext?` (${this.lastExportErrorContext})`:``;t({code:xe.FAILED,error:Error(`Failed to export ${i.length} events${e}`)});return}this.resetBackoff(),await this.getQueuedEventCount()>0&&!this.isRetrying&&this.retryFailedEvents(),t({code:xe.SUCCESS})}catch(e){process.env.USER_TYPE===`ant`&&N(`1P event logging export failed: ${$n(e)}`),P(e),t({code:xe.FAILED,error:xn(e)})}}async sendEventsInBatches(e){let t=[];for(let n=0;n<e.length;n+=this.maxBatchSize)t.push(e.slice(n,n+this.maxBatchSize));process.env.USER_TYPE===`ant`&&N(`1P event logging: exporting ${e.length} events in ${t.length} batch(es)`);let n=[],r;for(let e=0;e<t.length;e++){let i=t[e];try{await this.sendBatchWithRetry({events:i})}catch(i){r=IT(i);for(let r=e;r<t.length;r++)n.push(...t[r]);if(process.env.USER_TYPE===`ant`){let n=t.length-1-e;N(`1P event logging: batch ${e+1}/${t.length} failed (${r}); short-circuiting ${n} remaining batch(es)`)}break}e<t.length-1&&this.batchDelayMs>0&&await zi(this.batchDelayMs)}return n.length>0&&r&&(this.lastExportErrorContext=r),n}async queueFailedEvents(e){let t=this.getCurrentBatchFilePath();await this.appendEventsToFile(t,e);let n=this.lastExportErrorContext?` (${this.lastExportErrorContext})`:``,r=`1P event logging: ${e.length} events failed to export${n}`;P(Error(r))}scheduleBackoffRetry(){if(this.cancelBackoff||this.isRetrying||this.isShutdown)return;let e=Math.min(this.baseBackoffDelayMs*this.attempts*this.attempts,this.maxBackoffDelayMs);process.env.USER_TYPE===`ant`&&N(`1P event logging: scheduling backoff retry in ${e}ms (attempt ${this.attempts})`),this.cancelBackoff=this.schedule(async()=>{this.cancelBackoff=null,await this.retryFailedEvents()},e)}async retryFailedEvents(){let e=this.getCurrentBatchFilePath();for(;!this.isShutdown;){let t=await this.loadEventsFromFile(e);if(t.length===0)break;if(this.attempts>=this.maxAttempts){process.env.USER_TYPE===`ant`&&N(`1P event logging: max attempts (${this.maxAttempts}) reached, dropping ${t.length} events`),await this.deleteFile(e),this.resetBackoff();return}this.isRetrying=!0,await this.deleteFile(e),process.env.USER_TYPE===`ant`&&N(`1P event logging: retrying ${t.length} failed events (attempt ${this.attempts+1})`);let n=await this.sendEventsInBatches(t);if(this.attempts++,this.isRetrying=!1,n.length>0){await this.saveEventsToFile(e,n),this.scheduleBackoffRetry();return}this.resetBackoff(),process.env.USER_TYPE===`ant`&&N(`1P event logging: backoff retry succeeded`)}}resetBackoff(){this.attempts=0,this.cancelBackoff&&(this.cancelBackoff(),this.cancelBackoff=null)}async sendBatchWithRetry(e){if(this.isKilled())throw Error(`firstParty sink killswitch active`);let t={"Content-Type":`application/json`,"User-Agent":fx(),"x-service-name":`claude-code`},n=W()||k();process.env.USER_TYPE===`ant`&&!n&&N(`1P event logging: Trust not accepted`);let r=this.skipAuth||!n;if(!r&&Z()){let e=$();RA()?e&&Bk(e.expiresAt)&&(r=!0,process.env.USER_TYPE===`ant`&&N(`1P event logging: OAuth token expired, skipping auth to avoid 401`)):r=!0}let i=r?{headers:{},error:`trust not established or Oauth token expired`}:Ej(),a=!i.error;!a&&process.env.USER_TYPE===`ant`&&N(`1P event logging: auth not available, sending without auth`);let o=a?{...t,...i.headers}:t;try{let t=await Fe.post(this.endpoint,e,{timeout:this.timeout,headers:o});this.logSuccess(e.events.length,a,t.data);return}catch(n){if(a&&Fe.isAxiosError(n)&&n.response?.status===401){process.env.USER_TYPE===`ant`&&N(`1P event logging: 401 auth error, retrying without auth`);let n=await Fe.post(this.endpoint,e,{timeout:this.timeout,headers:t});this.logSuccess(e.events.length,!1,n.data);return}throw n}}logSuccess(e,t,n){process.env.USER_TYPE===`ant`&&(N(`1P event logging: ${e} events exported successfully${t?` (with auth)`:` (without auth)`}`),N(`API Response: ${A(n,null,2)}`))}hrTimeToDate(e){let[t,n]=e;return new Date(t*1e3+n/1e6)}transformLogsToEvents(e){let t=[];for(let n of e){let e=n.attributes||{};if(e.event_type===`GrowthbookExperimentEvent`){let r=this.hrTimeToDate(n.hrTime),i=e.account_uuid,a=e.organization_uuid;t.push({event_type:`GrowthbookExperimentEvent`,event_data:ux.toJSON({event_id:e.event_id,timestamp:r,experiment_id:e.experiment_id,variation_id:e.variation_id,environment:e.environment,user_attributes:e.user_attributes,experiment_metadata:e.experiment_metadata,device_id:e.device_id,session_id:e.session_id,auth:i||a?{account_uuid:i,organization_uuid:a}:void 0})});continue}let r=e.event_name||n.body||`unknown`,i=e.core_metadata,a=e.user_metadata,o=e.event_metadata||{};if(!i){process.env.USER_TYPE===`ant`&&N(`1P event logging: core_metadata missing for event ${r}`),t.push({event_type:`ClaudeCodeInternalEvent`,event_data:ix.toJSON({event_id:e.event_id,event_name:r,client_timestamp:this.hrTimeToDate(n.hrTime),session_id:en(),additional_metadata:Buffer.from(A({transform_error:`core_metadata attribute is missing`})).toString(`base64`)})});continue}let s=kT(i,a,o),{_PROTO_skill_name:c,_PROTO_plugin_name:l,_PROTO_marketplace_name:u,...d}=s.additional,f=oi(d);t.push({event_type:`ClaudeCodeInternalEvent`,event_data:ix.toJSON({event_id:e.event_id,event_name:r,client_timestamp:this.hrTimeToDate(n.hrTime),device_id:e.user_id,email:a?.email,auth:s.auth,...s.core,env:s.env,process:s.process,skill_name:typeof c==`string`?c:void 0,plugin_name:typeof l==`string`?l:void 0,marketplace_name:typeof u==`string`?u:void 0,additional_metadata:Object.keys(f).length>0?Buffer.from(A(f)).toString(`base64`):void 0})})}return{events:t}}async shutdown(){this.isShutdown=!0,this.resetBackoff(),await this.forceFlush(),process.env.USER_TYPE===`ant`&&N(`1P event logging exporter shutdown complete`)}async forceFlush(){await Promise.all(this.pendingExports),process.env.USER_TYPE===`ant`&&N(`1P event logging exporter flush complete`)}}}));function VT(e){return iM(HT,{})?.[e]===!0}var HT,UT=t((()=>{CM(),HT=`tengu_frond_boric`}));function WT(){return iM(tE,{})}function GT(e){let t=WT()[e];if(!t)return null;let n=t.sample_rate;return typeof n!=`number`||n<0||n>1||n>=1?null:n<=0?0:Math.random()<n?n:0}function KT(){return iM(nE,{})}async function qT(){if(iE)try{await iE.shutdown(),process.env.USER_TYPE===`ant`&&N(`1P event logging: final shutdown complete`)}catch{}}function JT(){return!zb()}async function YT(e,t,n={}){try{let r=await OT({model:n.model,betas:n.betas}),i={event_name:t,event_id:fa(),core_metadata:r,user_metadata:eb(!0),event_metadata:n},a=P_();a&&(i.user_id=a),process.env.USER_TYPE===`ant`&&N(`[ANT-ONLY] 1P event: ${t} ${A(n,null,0)}`),e.emit({body:t,attributes:i})}catch(e){process.env.USER_TYPE===`ant`&&P(e)}}function XT(e,t={}){JT()&&(!rE||VT(`firstParty`)||YT(rE,e,t))}function ZT(){return`production`}function QT(e){if(!JT()||!rE||VT(`firstParty`))return;let t=P_(),{accountUuid:n,organizationUuid:r}=eb(!0),i={event_type:`GrowthbookExperimentEvent`,event_id:fa(),experiment_id:e.experimentId,variation_id:e.variationId,...t&&{device_id:t},...n&&{account_uuid:n},...r&&{organization_uuid:r},...e.userAttributes&&{session_id:e.userAttributes.sessionId,user_attributes:A(e.userAttributes)},...e.experimentMetadata&&{experiment_metadata:A(e.experimentMetadata)},environment:ZT()};process.env.USER_TYPE===`ant`&&N(`[ANT-ONLY] 1P GrowthBook experiment: ${e.experimentId} variation=${e.variationId}`),rE.emit({body:`growthbook_experiment`,attributes:i})}function $T(){if(li(`1p_event_logging_start`),!JT()){process.env.USER_TYPE===`ant`&&N(`1P event logging not enabled`);return}let e=KT();aE=e,li(`1p_event_after_growthbook_config`);let t=e.scheduledDelayMillis||parseInt(process.env.OTEL_LOGS_EXPORT_INTERVAL||oE.toString(),10),n=e.maxExportBatchSize||sE,r=e.maxQueueSize||cE,i=Or(),a={[be]:`claude-code`,[_e]:`2.8.4`};if(i===`wsl`){let e=Dr();e&&(a[`wsl.version`]=e)}iE=new Eb({resource:De(a),processors:[new Pb(new zT({maxBatchSize:n,skipAuth:e.skipAuth,maxAttempts:e.maxAttempts,path:e.path,baseUrl:e.baseUrl,isKilled:()=>VT(`firstParty`)}),{scheduledDelayMillis:t,maxExportBatchSize:n,maxQueueSize:r})]}),rE=iE.getLogger(`com.anthropic.claude_code.events`,`2.8.4`)}async function eE(){if(!JT()||!iE||Nu(KT(),aE))return;process.env.USER_TYPE===`ant`&&N(`1P event logging: ${nE} changed, reinitializing`);let e=iE,t=rE;rE=null;try{await e.forceFlush()}catch{}iE=null;try{$T()}catch(n){iE=e,rE=t,P(n);return}e.shutdown().catch(()=>{})}var tE,nE,rE,iE,aE,oE,sE,cE,lE=t((()=>{Oe(),Rb(),Te(),kd(),Q_(),M(),yr(),Ar(),vn(),ci(),nb(),Bb(),BT(),CM(),PT(),UT(),tE=`tengu_event_sampling_config`,nE=`tengu_1p_event_batch_config`,rE=null,iE=null,aE=null,oE=1e4,sE=200,cE=8192}));function uE(){if(!UE&&(UE=!0,process.env.USER_TYPE===`ant`)){let e=process.env.CLAUDE_INTERNAL_FC_OVERRIDES;if(e)try{HE=JSON.parse(e),N(`GrowthBook: Using env var overrides for ${Object.keys(HE).length} features: ${Object.keys(HE).join(`, `)}`)}catch{P(Error(`GrowthBook: Failed to parse CLAUDE_INTERNAL_FC_OVERRIDES: ${e}`))}}return HE}function dE(){if(process.env.USER_TYPE===`ant`)try{return G().growthBookOverrides}catch{return}}function fE(e){if(zE.has(e))return;let t=IE.get(e);t&&(zE.add(e),QT({experimentId:t.experimentId,variationId:t.variationId,userAttributes:vE(),experimentMetadata:{feature_id:e}}))}async function pE(e){let t=e.getPayload();if(!t?.features||Object.keys(t.features).length===0)return!1;IE.clear();let n={};for(let[e,r]of Object.entries(t.features)){let t=r;if(`value`in t&&!(`defaultValue`in t)?n[e]={...t,defaultValue:t.value}:n[e]=t,t.source===`experiment`&&t.experimentResult){let n=t.experimentResult,r=t.experiment;r?.key&&n.variationId!==void 0&&IE.set(e,{experimentId:r.key,variationId:n.variationId})}}await e.setPayload({...t,features:n}),LE.clear();for(let[e,t]of Object.entries(n)){let n=`value`in t?t.value:t.defaultValue;n!==void 0&&LE.set(e,n)}return!0}function mE(){let e=Object.fromEntries(LE);Nu(G().cachedGrowthBookFeatures,e)||p_(t=>({...t,cachedGrowthBookFeatures:e}))}function hE(e){if(!process.env.CLAUDE_CODE_DISABLE_LOCAL_GATES)return WE[e]}function gE(){return process.env.CLAUDE_GB_ADAPTER_URL&&process.env.CLAUDE_GB_ADAPTER_KEY?!0:JT()}function _E(){let e=process.env.ANTHROPIC_BASE_URL;if(e)try{let t=new URL(e).host;return t===`api.anthropic.com`?void 0:t}catch{return}}function vE(){let e=Yy(),t=e.email;!t&&process.env.USER_TYPE===`ant`&&(t=G().oauthAccount?.emailAddress);let n=_E();return{id:e.deviceId,sessionId:e.sessionId,deviceID:e.deviceId,platform:e.platform,...n&&{apiBaseUrlHost:n},...e.organizationUuid&&{organizationUUID:e.organizationUuid},...e.accountUuid&&{accountUUID:e.accountUuid},...e.userType&&{userType:e.userType},...e.subscriptionType&&{subscriptionType:e.subscriptionType},...e.rateLimitTier&&{rateLimitTier:e.rateLimitTier},...e.firstTokenTime&&{firstTokenTime:e.firstTokenTime},...t&&{email:t},...e.appVersion&&{appVersion:e.appVersion},...e.githubActionsMetadata&&{githubActionsMetadata:e.githubActionsMetadata}}}async function yE(e,t,n){let r=uE();if(r&&e in r)return r[e];let i=dE();if(i&&e in i)return i[e];if(!gE()){let n=hE(e);return n===void 0?t:n}let a=await KE();if(!a){let n=hE(e);return n===void 0?t:n}let o;return o=LE.has(e)?LE.get(e):a.getFeatureValue(e,t),n&&fE(e),process.env.USER_TYPE===`ant`&&N(`GrowthBook: getFeatureValue("${e}") = ${A(o)}`),o}async function bE(e,t){return yE(e,t,!0)}function xE(e,t){let n=uE();if(n&&e in n)return n[e];let r=dE();if(r&&e in r)return r[e];if(!gE()){let n=hE(e);return n===void 0?t:n}let i=hE(e);if(i!==void 0)return i;if(IE.has(e)?fE(e):RE.add(e),LE.has(e))return LE.get(e);try{let t=G().cachedGrowthBookFeatures?.[e];if(t!==void 0)return t}catch{}return t}function SE(e,t,n){return xE(e,t)}function CE(e){let t=uE();if(t&&e in t)return!!t[e];let n=dE();if(n&&e in n)return!!n[e];if(!gE()){let t=hE(e);return t===void 0?!1:!!t}IE.has(e)?fE(e):RE.add(e);try{let t=G(),n=t.cachedGrowthBookFeatures?.[e];if(n!==void 0)return!!n;let r=t.cachedStatsigGates?.[e];if(r!==void 0)return r}catch{}let r=hE(e);return r===void 0?!1:!!r}async function wE(e){let t=uE();if(t&&e in t)return!!t[e];let n=dE();if(n&&e in n)return!!n[e];if(!gE())return!1;BE&&await BE;let r=G(),i=r.cachedStatsigGates?.[e];if(i!==void 0)return!!i;let a=r.cachedGrowthBookFeatures?.[e];return a===void 0?!1:!!a}async function TE(e){let t=uE();if(t&&e in t)return!!t[e];let n=dE();if(n&&e in n)return!!n[e];if(!gE()){let t=hE(e);return t===void 0?!1:!!t}return G().cachedGrowthBookFeatures?.[e]===!0?(IE.has(e)?fE(e):RE.add(e),!0):yE(e,!1,!0)}function EE(){kE(),NE&&(process.off(`beforeExit`,NE),NE=null),PE&&(process.off(`exit`,PE),PE=null),ME?.destroy(),ME=null,FE=!1,BE=null,IE.clear(),RE.clear(),zE.clear(),LE.clear(),GE.cache?.clear?.(),KE.cache?.clear?.(),HE=null,UE=!1}async function DE(){if(gE())try{let e=await KE();if(!e)return;if(await e.refreshFeatures(),e!==ME){process.env.USER_TYPE===`ant`&&N(`GrowthBook: Skipping refresh processing for replaced client`);return}let t=await pE(e);if(e!==ME)return;process.env.USER_TYPE===`ant`&&N(`GrowthBook: Light refresh completed`),t&&(mE(),VE.emit())}catch(e){P(xn(e))}}function OE(){gE()&&(JE&&clearInterval(JE),JE=setInterval(()=>{DE()},qE),JE.unref?.(),YE||(YE=()=>{kE()},process.once(`beforeExit`,YE)))}function kE(){JE&&(clearInterval(JE),JE=null),YE&&(process.removeListener(`beforeExit`,YE),YE=null)}async function AE(e,t){return bE(e,t)}function jE(e,t){return xE(e,t)}var ME,NE,PE,FE,IE,LE,RE,zE,BE,VE,HE,UE,WE,GE,KE,qE,JE,YE,XE=t((()=>{pc(),kd(),O(),jd(),Q_(),M(),kn(),Oj(),yr(),ti(),vn(),nb(),lE(),ME=null,NE=null,PE=null,FE=!1,IE=new Map,LE=new Map,RE=new Set,zE=new Set,BE=null,VE=Yr(),HE=null,UE=!1,WE={tengu_keybinding_customization_release:!0,tengu_streaming_tool_execution2:!0,tengu_kairos_cron:!0,tengu_amber_json_tools:!0,tengu_immediate_model_command:!0,tengu_basalt_3kr:!0,tengu_pebble_leaf_prune:!0,tengu_chair_sermon:!0,tengu_lodestone_enabled:!0,tengu_auto_background_agents:!0,tengu_fgts:!0,tengu_session_memory:!0,tengu_passport_quail:!0,tengu_moth_copse:!0,tengu_coral_fern:!0,tengu_chomp_inflection:!0,tengu_hive_evidence:!0,tengu_kairos_brief:!0,tengu_kairos_brief_config:{enable_slash_command:!0},tengu_sedge_lantern:!0,tengu_onyx_plover:{enabled:!0},tengu_willow_mode:`dialog`,tengu_turtle_carbon:!0,tengu_amber_stoat:!0,tengu_amber_flint:!0,tengu_slim_subagent_claudemd:!0,tengu_birch_trellis:!0,tengu_collage_kaleidoscope:!0,tengu_compact_cache_prefix:!0,tengu_kairos_assistant:!0,tengu_kairos_cron_durable:!0,tengu_attribution_header:!0,tengu_slate_prism:!0,tengu_review_bughunter_config:{enabled:!0},tengu_ccr_bundle_seed_enabled:!0},GE=p(()=>{if(!gE())return null;let e=vE(),t=Ad(),n=process.env.CLAUDE_GB_ADAPTER_URL||process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_GB_BASE_URL||`https://api.anthropic.com/`,r=!!(process.env.CLAUDE_GB_ADAPTER_URL&&process.env.CLAUDE_GB_ADAPTER_KEY);process.env.USER_TYPE===`ant`&&N(`GrowthBook: Creating client with clientKey=${t}, attributes: ${A(e)}`);let i=W()||nn()||k()?Ej():{headers:{},error:`trust not established`},a=r||!i.error;FE=a;let o=new dc({apiHost:n,clientKey:t,attributes:e,remoteEval:!r,...r?{}:{cacheKeyAttributes:[`id`,`organizationUUID`]},...i.error?{}:{apiHostRequestHeaders:i.headers},...process.env.USER_TYPE===`ant`?{log:(e,t)=>{N(`GrowthBook: ${e} ${A(t)}`)}}:{}});if(ME=o,!a)return{client:o,initialized:Promise.resolve()};let s=o.init({timeout:5e3}).then(async e=>{if(ME!==o){process.env.USER_TYPE===`ant`&&N(`GrowthBook: Skipping init callback for replaced client`);return}process.env.USER_TYPE===`ant`&&N(`GrowthBook initialized, source: ${e.source}, success: ${e.success}`);let t=await pE(o);if(ME===o){if(t){for(let e of RE)fE(e);RE.clear(),mE(),VE.emit()}if(process.env.USER_TYPE===`ant`){let e=o.getFeatures();if(e){let t=Object.keys(e);N(`GrowthBook loaded ${t.length} features: ${t.slice(0,10).join(`, `)}${t.length>10?`...`:``}`)}}}}).catch(e=>{process.env.USER_TYPE===`ant`&&P(xn(e))});return NE=()=>ME?.destroy(),PE=()=>ME?.destroy(),process.on(`beforeExit`,NE),process.on(`exit`,PE),{client:o,initialized:s}}),KE=p(async()=>{let e=GE();return!e||!FE&&(W()||nn()||k())&&!Ej().error&&(process.env.USER_TYPE===`ant`&&N(`GrowthBook: Auth became available after client creation, reinitializing`),EE(),e=GE(),!e)?null:(await e.initialized,OE(),e.client)}),qE=process.env.USER_TYPE===`ant`?1200*1e3:360*60*1e3,JE=null,YE=null})),ZE,QE,$E,eD=t((()=>{m(),Uv(),ZE=[{modelEnvVar:`ANTHROPIC_DEFAULT_OPUS_MODEL`,capabilitiesEnvVar:`ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`ANTHROPIC_DEFAULT_SONNET_MODEL`,capabilitiesEnvVar:`ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`ANTHROPIC_DEFAULT_HAIKU_MODEL`,capabilitiesEnvVar:`ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES`}],QE=[{modelEnvVar:`OPENAI_DEFAULT_OPUS_MODEL`,capabilitiesEnvVar:`OPENAI_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`OPENAI_DEFAULT_SONNET_MODEL`,capabilitiesEnvVar:`OPENAI_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`OPENAI_DEFAULT_HAIKU_MODEL`,capabilitiesEnvVar:`OPENAI_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES`}],$E=p((e,t)=>{if(K()===`firstParty`)return;let n=e.toLowerCase(),r=K()===`openai`?QE:ZE;for(let e of r){let r=process.env[e.modelEnvVar],i=process.env[e.capabilitiesEnvVar];if(!(!r||i===void 0)&&n===r.toLowerCase())return i.toLowerCase().split(`,`).map(e=>e.trim()).includes(t)}},(e,t)=>`${e.toLowerCase()}:${t}`)}));function tD(e){let t=[],n=[];for(let r of e)fD.includes(r)?t.push(r):n.push(r);return{allowed:t,disallowed:n}}function nD(e){if(!e||e.length===0)return;if(Z()){console.warn(`Warning: Custom betas are only available for API key users. Ignoring provided betas.`);return}let{allowed:t,disallowed:n}=tD(e);for(let e of n)console.warn(`Warning: Beta header '${e}' is not allowed. Only the following betas are supported: ${fD.join(`, `)}`);return t.length>0?t:void 0}function rD(e){let t=$E(e,`interleaved_thinking`);if(t!==void 0)return t;let n=Jw(e),r=K();return r===`foundry`?!0:r===`firstParty`?!n.includes(`claude-3-`):n.includes(`claude-opus-4`)||n.includes(`claude-sonnet-4`)}function iD(e){let t=Jw(e);return t.includes(`claude-opus-4`)||t.includes(`claude-sonnet-4`)||t.includes(`claude-haiku-4`)}function aD(e){let t=Jw(e),n=K();return n===`foundry`?!0:n===`firstParty`?!t.includes(`claude-3-`):t.includes(`claude-opus-4`)||t.includes(`claude-sonnet-4`)||t.includes(`claude-haiku-4`)}function oD(e){let t=Jw(e),n=K();return n!==`firstParty`&&n!==`foundry`?!1:t.includes(`claude-sonnet-4-6`)||t.includes(`claude-sonnet-4-5`)||t.includes(`claude-opus-4-1`)||t.includes(`claude-opus-4-5`)||t.includes(`claude-opus-4-6`)||t.includes(`claude-opus-4-7`)||t.includes(`claude-haiku-4-5`)}function sD(e){return!0}function cD(){return(K()===`firstParty`||K()===`foundry`)&&!_(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)&&Hv()}function lD(){return K()===`firstParty`&&!_(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)}function uD(e,t){let n=[...mD(e)];t?.isAgenticQuery&&(n.includes(`claude-code-20250219`)||n.push(kx),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_ENTRYPOINT===`cli`&&zx&&!n.includes(zx)&&n.push(zx));let r=rn();return!r||r.length===0?n:[...n,...r.filter(e=>!n.includes(e))]}function dD(){pD.cache?.clear?.(),mD.cache?.clear?.(),hD.cache?.clear?.()}var fD,pD,mD,hD,gD=t((()=>{m(),XE(),O(),Ux(),vi(),Cj(),Nw(),g(),fT(),eD(),Uv(),Yg(),fD=[jx],pD=p(e=>{let t=[],n=Jw(e).includes(`haiku`),r=K(),i=cD();n||(t.push(kx),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_ENTRYPOINT===`cli`&&zx&&t.push(zx)),Z()&&t.push(gi),xw(e)&&t.push(jx),!_(process.env.DISABLE_INTERLEAVED_THINKING)&&rD(e)&&t.push(Ax),i&&rD(e)&&!k()&&Vg().showThinkingSummaries!==!0&&t.push(Lx);let a=_(process.env.USE_API_CONTEXT_MANAGEMENT)||aD(e),o=aD(e);cD()&&(a||o)&&t.push(Mx);let s=CE(`tengu_tool_pear`),c=!s&&xE(`tengu_amber_json_tools`,!1);return i&&oD(e)&&s&&t.push(Nx),process.env.USER_TYPE===`ant`&&i&&c&&t.push(Rx),r===`vertex`&&iD(e)&&t.push(Px),r===`foundry`&&t.push(Px),i&&t.push(Ix),process.env.ANTHROPIC_BETAS&&t.push(...process.env.ANTHROPIC_BETAS.split(`,`).map(e=>e.trim()).filter(Boolean)),t}),mD=p(e=>{let t=pD(e);return K()===`bedrock`?t.filter(e=>!Vx.has(e)):t}),hD=p(e=>pD(e).filter(e=>Vx.has(e)))}));function _D(e,t){return{name:`${e.name}-with-${t.name}-fallback`,read(){return e.read()??(t.read()||{})},async readAsync(){return await e.readAsync()??(await t.readAsync()||{})},update(n){let r=e.read(),i=e.update(n);if(i.success)return r===null&&t.delete(),i;let a=t.update(n);return a.success?(r!==null&&e.delete(),{success:!0,warning:a.warning}):{success:!1}},delete(){let n=e.delete(),r=t.delete();return n||r}}}var vD=t((()=>{}));function yD(e=``){let t=h(),n=process.env.CLAUDE_CONFIG_DIR?`-${ua(`sha256`).update(t).digest(`hex`).substring(0,8)}`:``;return`Zanii Code${tv().OAUTH_FILE_SUFFIX}${e}${n}`}function bD(){try{return process.env.USER||Ji().username}catch{return`claude-code-user`}}function xD(){Y.cache={data:null,cachedAt:0},Y.generation++,Y.readInFlight=null}function SD(e){if(Y.cache.cachedAt!==0)return;let t=null;if(e)try{t=JSON.parse(e)}catch{return}Y.cache={data:t,cachedAt:Date.now()}}var CD,Y,wD=t((()=>{dv(),g(),CD=`-credentials`,Y={cache:{data:null,cachedAt:0},generation:0,readInFlight:null}}));async function TD(){try{let e=yD(CD),{stdout:t,code:n}=await wr(`security`,[`find-generic-password`,`-a`,bD(),`-w`,`-s`,e],{useCwd:!1,preserveOutputOnError:!1});if(n===0&&t)return gn(t.trim())}catch{}return null}function ED(){if(kD!==void 0)return kD;if(process.platform!==`darwin`)return kD=!1,!1;try{kD=fr(`security`,[`show-keychain-info`],{reject:!1,stdio:[`ignore`,`pipe`,`pipe`]}).exitCode===36}catch{kD=!1}return kD}var DD,OD,kD,AD=t((()=>{pr(),M(),Cr(),br(),vn(),wD(),DD=4032,OD={name:`keychain`,read(){let e=Y.cache;if(Date.now()-e.cachedAt<3e4)return e.data;try{let e=yD(CD),t=xr(`security find-generic-password -a "${bD()}" -w -s "${e}"`);if(t){let e=gn(t);return Y.cache={data:e,cachedAt:Date.now()},e}}catch{}return e.data===null?(Y.cache={data:null,cachedAt:Date.now()},null):(N(`[keychain] read failed; serving stale cache`,{level:`warn`}),Y.cache={data:e.data,cachedAt:Date.now()},e.data)},async readAsync(){let e=Y.cache;if(Date.now()-e.cachedAt<3e4)return e.data;if(Y.readInFlight)return Y.readInFlight;let t=Y.generation,n=TD().then(n=>{if(t===Y.generation){n===null&&e.data!==null&&N(`[keychain] readAsync failed; serving stale cache`,{level:`warn`});let t=n??e.data;return Y.cache={data:t,cachedAt:Date.now()},Y.readInFlight=null,t}return n});return Y.readInFlight=n,n},update(e){xD();try{let t=yD(CD),n=bD(),r=A(e),i=Buffer.from(r,`utf-8`).toString(`hex`),a=`add-generic-password -U -a "${n}" -s "${t}" -X "${i}"\n`,o;return a.length<=DD?o=fr(`security`,[`-i`],{input:a,stdio:[`pipe`,`pipe`,`pipe`],reject:!1}):(N(`Keychain payload (${r.length}B JSON) exceeds security -i stdin limit; using argv`,{level:`warn`}),o=fr(`security`,[`add-generic-password`,`-U`,`-a`,n,`-s`,t,`-X`,i],{stdio:[`ignore`,`pipe`,`pipe`],reject:!1})),o.exitCode===0?(Y.cache={data:e,cachedAt:Date.now()},{success:!0}):{success:!1}}catch{return{success:!1}}},delete(){xD();try{let e=yD(CD);return xr(`security delete-generic-password -a "${bD()}" -s "${e}"`),!0}catch{return!1}}}}));function jD(){let e=h();return{storageDir:e,storagePath:z(e,`.credentials.json`)}}var MD,ND=t((()=>{g(),kn(),An(),vn(),MD={name:`plaintext`,read(){let{storagePath:e}=jD();try{return gn(j().readFileSync(e,{encoding:`utf8`}))}catch{return null}},async readAsync(){let{storagePath:e}=jD();try{return gn(await j().readFile(e,{encoding:`utf8`}))}catch{return null}},update(e){try{let{storageDir:t,storagePath:n}=jD();try{j().mkdirSync(t)}catch(e){if(mn(e)!==`EEXIST`)throw e}return pn(n,A(e),{encoding:`utf8`,flush:!1}),ra(n,384),{success:!0,warning:`Warning: Storing credentials in plaintext.`}}catch{return{success:!1}}},delete(){let{storagePath:e}=jD();try{return j().unlinkSync(e),!0}catch(e){return mn(e)===`ENOENT`}}}}));function PD(){return process.platform===`darwin`?_D(OD,MD):MD}var FD=t((()=>{vD(),AD(),ND()}));function ID(e){return new Promise(t=>{xa(`security`,[`find-generic-password`,`-a`,bD(),`-w`,`-s`,e],{encoding:`utf-8`,timeout:VD},(e,n)=>{t({stdout:e?null:n?.trim()||null,timedOut:!!(e&&`killed`in e&&e.killed)})})})}function LD(){if(process.platform!==`darwin`||UD||ne())return;let e=ID(yD(CD)),t=ID(yD());UD=Promise.all([e,t]).then(([e,t])=>{e.timedOut||SD(e.stdout),t.timedOut||(HD={stdout:t.stdout})})}async function RD(){UD&&await UD}function zD(){return HD}function BD(){HD=null}var VD,HD,UD,WD=t((()=>{g(),wD(),VD=1e4,HD=null,UD=null}));function GD(){return qD}function KD(){qD.clear()}var qD,JD=t((()=>{qD=new Map}));function YD(){return _(process.env.CLAUDE_CODE_REMOTE)||process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`}function XD(){if(ne())return!1;if(process.env.ANTHROPIC_UNIX_SOCKET)return!!process.env.CLAUDE_CODE_OAUTH_TOKEN;let e=U()||{};if(Bv($v(e))||process.env.OPENAI_BASE_URL||process.env.GEMINI_BASE_URL)return!1;let t=e.apiKeyHelper,n=process.env.ANTHROPIC_AUTH_TOKEN||t||process.env.CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR,{source:r}=$D({skipRetrievingKeyFromApiKeyHelper:!0}),i=r===`ANTHROPIC_API_KEY`||r===`apiKeyHelper`;return!(n&&!YD()||i&&!YD())}function ZD(){if(ne())return eO()?{source:`apiKeyHelper`,hasToken:!0}:{source:`none`,hasToken:!1};if(process.env.ANTHROPIC_AUTH_TOKEN&&!YD())return{source:`ANTHROPIC_AUTH_TOKEN`,hasToken:!0};if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{source:`CLAUDE_CODE_OAUTH_TOKEN`,hasToken:!0};if(ky())return process.env.CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR?{source:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,hasToken:!0}:{source:`CCR_OAUTH_TOKEN_FILE`,hasToken:!0};if(eO()&&!YD())return{source:`apiKeyHelper`,hasToken:!0};let e=X();return Nk(e?.scopes)&&e?.accessToken?{source:`claude.ai`,hasToken:!0}:{source:`none`,hasToken:!1}}function QD(){let{key:e}=$D();return e}function $D(e={}){if(ne())return process.env.ANTHROPIC_API_KEY?{key:process.env.ANTHROPIC_API_KEY,source:`ANTHROPIC_API_KEY`}:eO()?{key:e.skipRetrievingKeyFromApiKeyHelper?null:uO(),source:`apiKeyHelper`}:{key:null,source:`none`};let t=re()?void 0:process.env.ANTHROPIC_API_KEY;if(dn()&&t)return{key:t,source:`ANTHROPIC_API_KEY`};if(_(process.env.CI)){let e=Ay();if(e)return{key:e,source:`ANTHROPIC_API_KEY`};if(!t&&!process.env.CLAUDE_CODE_OAUTH_TOKEN&&!process.env.CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR)throw Error(`ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN env var is required`);return t?{key:t,source:`ANTHROPIC_API_KEY`}:{key:null,source:`none`}}if(t&&G().customApiKeyResponses?.approved?.includes(zy(t)))return{key:t,source:`ANTHROPIC_API_KEY`};let n=Ay();return n?{key:n,source:`ANTHROPIC_API_KEY`}:eO()?e.skipRetrievingKeyFromApiKeyHelper?{key:null,source:`apiKeyHelper`}:{key:uO(),source:`apiKeyHelper`}:XO()||{key:null,source:`none`}}function eO(){return ne()?H(`flagSettings`)?.apiKeyHelper:(U()||{}).apiKeyHelper}function tO(){let e=eO();if(!e)return!1;let t=H(`projectSettings`),n=H(`localSettings`);return t?.apiKeyHelper===e||n?.apiKeyHelper===e}function nO(){return(U()||{}).awsAuthRefresh}function rO(){let e=nO();if(!e)return!1;let t=H(`projectSettings`),n=H(`localSettings`);return t?.awsAuthRefresh===e||n?.awsAuthRefresh===e}function iO(){return(U()||{}).awsCredentialExport}function aO(){let e=iO();if(!e)return!1;let t=H(`projectSettings`),n=H(`localSettings`);return t?.awsCredentialExport===e||n?.awsCredentialExport===e}function oO(){let e=process.env.CLAUDE_CODE_API_KEY_HELPER_TTL_MS;if(e){let t=parseInt(e,10);if(!Number.isNaN(t)&&t>=0)return t;N(`Found CLAUDE_CODE_API_KEY_HELPER_TTL_MS env var, but it was not a valid number. Got ${e}`,{level:`error`})}return zO}async function sO(e){if(!eO())return null;let t=oO();return BO?(Date.now()-BO.timestamp<t||VO||(VO={promise:cO(e,!1,HO),startedAt:null}),BO.value):(VO||(VO={promise:cO(e,!0,HO),startedAt:Date.now()}),VO.promise)}async function cO(e,t,n){try{let t=await lO(e);return n===HO&&t!==null&&(BO={value:t,timestamp:Date.now()}),t}catch(e){if(n!==HO)return` `;let r=e instanceof Error?e.message:String(e);return console.error(Xe.red(`apiKeyHelper failed: ${r}`)),N(`Error getting API key from apiKeyHelper: ${r}`,{level:`error`}),!t&&BO&&BO.value!==` `?(BO={...BO,timestamp:Date.now()},BO.value):(BO={value:` `,timestamp:Date.now()},` `)}finally{n===HO&&(VO=null)}}async function lO(e){let t=eO();if(!t)return null;if(tO()&&!W()&&!e)return Ln(`apiKeyHelper invoked before trust check`,Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in .`)),F(`tengu_apiKeyHelper_missing_trust11`,{}),null;let n=await mr(t,{shell:!0,timeout:600*1e3,reject:!1});if(n.failed){let e=n.timedOut?`timed out`:`exited ${n.exitCode}`,t=n.stderr?.trim();throw Error(t?`${e}: ${t}`:e)}let r=n.stdout?.trim();if(!r)throw Error(`did not return a value`);return r}function uO(){return BO?.value??null}async function dO(){let e=nO();if(!e)return!1;if(rO()&&!W()&&!k())return Ln(`awsAuthRefresh invoked before trust check`,Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),F(`tengu_awsAuthRefresh_missing_trust`,{}),!1;try{return N(`Fetching AWS caller identity for AWS auth refresh command`),await Hy(),N(`Fetched AWS caller identity, skipping AWS auth refresh command`),!1}catch{return fO(e)}}function fO(e){N(`Running AWS auth refresh command`);let t=Gy.getInstance();return t.startAuthentication(),new Promise(n=>{let r=ba(e,{timeout:WO});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),N(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),N(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)N(`AWS auth refresh completed successfully`),t.endAuthentication(!0),n(!0);else{let e=r===`SIGTERM`?Xe.red(`AWS auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.`):Xe.red(`Error running awsAuthRefresh (in settings or ~/.claude.json):`);console.error(e),t.endAuthentication(!1),n(!1)}})})}async function pO(){let e=iO();if(!e)return null;if(aO()&&!W()&&!k())return Ln(`awsCredentialExport invoked before trust check`,Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in .`)),F(`tengu_awsCredentialExport_missing_trust`,{}),null;try{return N(`Fetching AWS caller identity for credential export command`),await Hy(),N(`Fetched AWS caller identity, skipping AWS credential export command`),null}catch{try{N(`Running AWS credential export command`);let t=await mr(e,{shell:!0,reject:!1});if(t.exitCode!==0||!t.stdout)throw Error(`awsCredentialExport did not return a valid value`);let n=gn(t.stdout.trim());if(!Vy(n))throw Error(`awsCredentialExport did not return valid AWS STS output structure`);return N(`AWS credentials retrieved from awsCredentialExport`),{accessKeyId:n.Credentials.AccessKeyId,secretAccessKey:n.Credentials.SecretAccessKey,sessionToken:n.Credentials.SessionToken}}catch(e){let t=Xe.red(`Error getting AWS credentials from awsCredentialExport (in settings or ~/.claude.json):`);return e instanceof Error?console.error(t,e.message):console.error(t,e),null}}}function mO(){return(U()||{}).gcpAuthRefresh}function hO(){let e=mO();if(!e)return!1;let t=H(`projectSettings`),n=H(`localSettings`);return t?.gcpAuthRefresh===e||n?.gcpAuthRefresh===e}async function gO(){try{let{GoogleAuth:e}=await import(`./src-lLwoqdC0.js`).then(e=>n(e.default,1)),t=new e({scopes:[`https://www.googleapis.com/auth/cloud-platform`]}),r=(async()=>{await(await t.getClient()).getAccessToken()})(),i=zi(KO).then(()=>{throw new nk(`GCP credentials check timed out`)});return await Promise.race([r,i]),!0}catch{return!1}}async function _O(){let e=mO();if(!e)return!1;if(hO()&&!W()&&!k())return Ln(`gcpAuthRefresh invoked before trust check`,Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),F(`tengu_gcpAuthRefresh_missing_trust`,{}),!1;try{if(N(`Checking GCP credentials validity for auth refresh`),await gO())return N(`GCP credentials are valid, skipping auth refresh command`),!1}catch{}return vO(e)}function vO(e){N(`Running GCP auth refresh command`);let t=Gy.getInstance();return t.startAuthentication(),new Promise(n=>{let r=ba(e,{timeout:JO});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),N(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),N(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)N(`GCP auth refresh completed successfully`),t.endAuthentication(!0),n(!0);else{let e=r===`SIGTERM`?Xe.red(`GCP auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.`):Xe.red(`Error running gcpAuthRefresh (in settings or ~/.claude.json):`);console.error(e),t.endAuthentication(!1),n(!1)}})})}function yO(e){if(!Nk(e.scopes))return F(`tengu_oauth_tokens_not_claude_ai`,{}),{success:!0};if(!e.refreshToken||!e.expiresAt)return F(`tengu_oauth_tokens_inference_only`,{}),{success:!0};let t=PD(),n=t.name;try{let r=t.read()||{},i=r.claudeAiOauth;r.claudeAiOauth={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresAt:e.expiresAt,scopes:e.scopes,subscriptionType:e.subscriptionType??i?.subscriptionType??null,rateLimitTier:e.rateLimitTier??i?.rateLimitTier??null};let a=t.update(r);return a.success?F(`tengu_oauth_tokens_saved`,{storageBackend:n}):F(`tengu_oauth_tokens_save_failed`,{storageBackend:n}),X.cache?.clear?.(),dD(),KD(),a}catch(e){return P(e),F(`tengu_oauth_tokens_save_exception`,{storageBackend:n,error:$n(e)}),{success:!1,warning:`Failed to save OAuth tokens`}}}function bO(){X.cache?.clear?.(),xD()}async function xO(){try{let{mtimeMs:e}=await _a(z(h(),`.credentials.json`));e!==ZO&&(ZO=e,bO())}catch{X.cache?.clear?.()}}async function SO(){if(ne())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN||ky())return X();try{let e=(await PD().readAsync())?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return P(e),null}}function CO(e=0,t=!1){return e===0&&!t?QO||(QO=wO(e,t).finally(()=>{QO=null}),QO):wO(e,t)}async function wO(e,t){await xO();let n=X();if(!t&&(!n?.refreshToken||!Bk(n.expiresAt))||!n?.refreshToken||!Nk(n.scopes))return!1;X.cache?.clear?.(),xD();let r=await SO();if(!r?.refreshToken||!Bk(r.expiresAt))return!1;let i=h();await ma(i,{recursive:!0});let a;try{F(`tengu_oauth_token_refresh_lock_acquiring`,{}),a=await ei(i),F(`tengu_oauth_token_refresh_lock_acquired`,{})}catch(n){return n.code===`ELOCKED`?e<5?(F(`tengu_oauth_token_refresh_lock_retry`,{retryCount:e+1}),await zi(1e3+Math.random()*1e3),wO(e+1,t)):(F(`tengu_oauth_token_refresh_lock_retry_limit_reached`,{maxRetries:5}),!1):(P(n),F(`tengu_oauth_token_refresh_lock_error`,{error:$n(n)}),!1)}try{X.cache?.clear?.(),xD();let e=await SO();return!e?.refreshToken||!Bk(e.expiresAt)?(F(`tengu_oauth_token_refresh_race_resolved`,{}),!1):(F(`tengu_oauth_token_refresh_starting`,{}),yO(await Lk(e.refreshToken,{scopes:Nk(e.scopes)?void 0:e.scopes})),X.cache?.clear?.(),xD(),!0)}catch(e){P(e),X.cache?.clear?.(),xD();let t=await SO();return t&&!Bk(t.expiresAt)?(F(`tengu_oauth_token_refresh_race_recovered`,{}),!0):!1}finally{F(`tengu_oauth_token_refresh_lock_releasing`,{}),await a(),F(`tengu_oauth_token_refresh_lock_released`,{})}}function TO(){return XD()?Nk(X()?.scopes):!1}function EO(){return X()?.scopes?.includes(`user:profile`)??!1}function DO(){return!(_(process.env.CLAUDE_CODE_USE_BEDROCK)||_(process.env.CLAUDE_CODE_USE_VERTEX)||_(process.env.CLAUDE_CODE_USE_FOUNDRY)||TO())}function OO(){return XD()?G().oauthAccount:void 0}function kO(){if(my())return py();if(!XD())return null;let e=X();return e?e.subscriptionType??null:null}function AO(){if(!XD())return null;let e=X();return e?e.rateLimitTier??null:null}function jO(){switch(kO()){case`enterprise`:return`Claude Enterprise`;case`team`:return`Claude Team`;case`max`:return`Claude Max`;case`pro`:return`Claude Pro`;default:return`Claude API`}}function MO(){return!!(_(process.env.CLAUDE_CODE_USE_BEDROCK)||_(process.env.CLAUDE_CODE_USE_VERTEX)||_(process.env.CLAUDE_CODE_USE_FOUNDRY)||_(process.env.CLAUDE_CODE_USE_OPENAI)||_(process.env.CLAUDE_CODE_USE_GEMINI)||_(process.env.CLAUDE_CODE_USE_GROK))}function NO(){return(U()||{}).otelHeadersHelper}function PO(){let e=NO();if(!e)return!1;let t=H(`projectSettings`),n=H(`localSettings`);return t?.otelHeadersHelper===e||n?.otelHeadersHelper===e}function FO(){let e=NO();if(!e)return{};let t=parseInt(process.env.CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS||tk.toString(),10);if($O&&Date.now()-ek<t)return $O;if(PO()&&!W())return{};try{let t=xr(e,{timeout:3e4})?.toString().trim();if(!t)throw Error(`otelHeadersHelper did not return a valid value`);let n=gn(t);if(typeof n!=`object`||!n||Array.isArray(n))throw Error(`otelHeadersHelper must return a JSON object with string key-value pairs`);for(let[e,t]of Object.entries(n))if(typeof t!=`string`)throw Error(`otelHeadersHelper returned non-string value for key "${e}": ${typeof t}`);return $O=n,ek=Date.now(),$O}catch(e){throw P(Error(`Error getting OpenTelemetry headers from otelHeadersHelper (in settings): ${$n(e)}`)),e}}function IO(e){return e===`max`||e===`pro`}function LO(){let e=kO();return TO()&&e!==null&&IO(e)}function RO(){if($v()!==`firstParty`)return;let{source:e}=ZD(),t={};e===`CLAUDE_CODE_OAUTH_TOKEN`||e===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`?t.tokenSource=e:TO()?t.subscription=jO():t.tokenSource=e;let{key:n,source:r}=$D();if(n&&(t.apiKeySource=r),e===`claude.ai`||r===`/login managed key`){let e=OO()?.organizationName;e&&(t.organization=e)}let i=OO()?.emailAddress;return(e===`claude.ai`||r===`/login managed key`)&&i&&(t.email=i),t}var zO,BO,VO,HO,UO,WO,GO,KO,qO,JO,YO,XO,X,ZO,QO,$O,ek,tk,nk,rk=t((()=>{Ze(),pr(),m(),dv(),ii(),Qv(),ny(),O(),Ty(),Gk(),Mk(),Fy(),By(),Wy(),Ky(),gD(),Q_(),M(),g(),kn(),Cr(),Wr(),yr(),Er(),FD(),WD(),wD(),Yg(),Bi(),vn(),JD(),zO=300*1e3,BO=null,VO=null,HO=0,UO=3600*1e3,WO=180*1e3,GO=Tr(async()=>{let e=await dO(),t=await pO();return(e||t)&&await Uy(),t},UO),KO=5e3,qO=3600*1e3,JO=180*1e3,YO=Tr(async()=>await _O(),qO),XO=p(()=>{if(ne())return null;if(process.platform===`darwin`){let e=zD();if(e){if(e.stdout)return{key:e.stdout,source:`/login managed key`}}else{let e=yD();try{let t=xr(`security find-generic-password -a $USER -w -s "${e}"`);if(t)return{key:t,source:`/login managed key`}}catch(e){P(e)}}}let e=G();return e.primaryApiKey?{key:e.primaryApiKey,source:`/login managed key`}:null}),X=p(()=>{if(ne())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{accessToken:process.env.CLAUDE_CODE_OAUTH_TOKEN,refreshToken:null,expiresAt:null,scopes:[`user:inference`],subscriptionType:null,rateLimitTier:null};let e=ky();if(e)return{accessToken:e,refreshToken:null,expiresAt:null,scopes:[`user:inference`],subscriptionType:null,rateLimitTier:null};try{let e=PD().read()?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return P(e),null}}),ZO=0,QO=null,$O=null,ek=0,tk=1740*1e3,nk=class extends Error{}}));function ik(){return{numStartups:0,installMethod:void 0,autoUpdates:void 0,theme:`dark`,preferredNotifChannel:`auto`,verbose:!1,editorMode:`normal`,autoCompactEnabled:!0,showTurnDuration:!0,hasSeenTasksHint:!1,hasUsedStash:!1,hasUsedBackgroundTask:!1,queuedCommandUpHintCount:0,diffTool:`auto`,customApiKeyResponses:{approved:[],rejected:[]},env:{},tipsHistory:{},memoryUsageCount:0,promptQueueUseCount:0,btwUseCount:0,todoFeatureEnabled:!0,showExpandedTodos:!1,messageIdleNotifThresholdMs:6e4,autoConnectIde:!1,autoInstallIdeExtension:!0,fileCheckpointingEnabled:!0,terminalProgressBarEnabled:!0,cachedStatsigGates:{},cachedDynamicConfigs:{},cachedGrowthBookFeatures:{},respectGitignore:!0,copyFullResponse:!1}}function ak(e){let t=Sk.config;if(!t)return!1;let n=t.oauthAccount!==void 0&&e.oauthAccount===void 0,r=t.hasCompletedOnboarding===!0&&e.hasCompletedOnboarding!==!0;return n||r}function ok(e){let t=null;try{hk(R(),ik,n=>{let r=e(n);return r===n?n:(t={...r,projects:lk(n.projects)},t)})&&t&&dk(t)}catch(n){N(`Failed to save config with lock: ${n}`,{level:`error`});let r=vk(R(),ik);if(ak(r)){N(`saveGlobalConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`}),I(`tengu_config_auth_loss_prevented`,{});return}let i=e(r);if(i===r)return;t={...i,projects:lk(r.projects)},mk(R(),t,xk),dk(t)}}function sk(){let e=wk+Tk;e>0&&I(`tengu_config_cache_stats`,{cache_hits:wk,cache_misses:Tk,hit_rate:wk/e}),wk=0,Tk=0}function ck(e){if(e.installMethod!==void 0)return e;let t=e,n=`unknown`,r=e.autoUpdates??!0;switch(t.autoUpdaterStatus){case`migrated`:n=`local`;break;case`installed`:n=`native`;break;case`disabled`:r=!1;break;case`enabled`:case`no_permissions`:case`not_configured`:n=`global`;break;case void 0:break}return{...e,installMethod:n,autoUpdates:r}}function lk(e){if(!e)return e;let t={},n=!1;for(let[r,i]of Object.entries(e)){let e=i;if(e.history!==void 0){n=!0;let{history:i,...a}=e;t[r]=a}else t[r]=i}return n?t:e}function uk(){if(Ok)return;Ok=!0;let e=R();ca(e,{interval:Dk,persistent:!1},t=>{t.mtimeMs<=Sk.mtime||j().readFile(e,{encoding:`utf-8`}).then(e=>{if(t.mtimeMs<=Sk.mtime)return;let n=Hr(Rr(e));typeof n!=`object`||!n||(Sk={config:ck({...ik(),...n}),mtime:t.mtimeMs},Ck={mtime:t.mtimeMs,size:t.size})}).catch(()=>{})}),fn(async()=>{sa(e),Ok=!1})}function dk(e){Sk={config:e,mtime:Date.now()},Ck=null}function fk(){if(Sk.config)return wk++,Sk.config;Tk++;try{let e=null;try{e=j().statSync(R())}catch{}let t=ck(vk(R(),ik));return Sk={config:t,mtime:e?.mtimeMs??Date.now()},Ck=e?{mtime:e.mtimeMs,size:e.size}:null,uk(),t}catch{return ck(vk(R(),ik))}}function pk(){let e=fk().remoteControlAtStartup;return e===void 0?!1:e}function mk(e,t,n){let r=Zi(e);j().mkdirSync(r),Sf(e,A(ed(t,(e,t)=>A(e)!==A(n[t])),null,2),{encoding:`utf-8`,mode:384}),e===R()&&Ek++}function hk(e,t,n){let r=t(),i=Zi(e),a=j();a.mkdirSync(i);let o;try{let i=`${e}.lock`,s=Date.now();o=qr(e,{lockfilePath:i,onCompromised:e=>{N(`Config lock compromised: ${e}`,{level:`error`})}});let c=Date.now()-s;if(c>100&&(N(`Lock acquisition took longer than expected - another Claude instance may be running`),I(`tengu_config_lock_contention`,{lock_time_ms:c})),Ck&&e===R())try{let t=a.statSync(e);(t.mtimeMs!==Ck.mtime||t.size!==Ck.size)&&I(`tengu_config_stale_write`,{read_mtime:Ck.mtime,write_mtime:t.mtimeMs,read_size:Ck.size,write_size:t.size})}catch(e){if(mn(e)!==`ENOENT`)throw e}let l=vk(e,t);if(e===R()&&ak(l))return N(`saveConfigWithLock: re-read config is missing auth that cache has; refusing to write to avoid wiping ~/.claude.json. See GH #3117.`,{level:`error`}),I(`tengu_config_auth_loss_prevented`,{}),!1;let u=n(l);if(u===l)return!1;let d=ed(u,(e,t)=>A(e)!==A(r[t]));try{let t=Xi(e),n=gk();try{a.mkdirSync(n)}catch(e){if(mn(e)!==`EEXIST`)throw e}let r=a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse(),i=r[0],o=i?Number(i.split(`.backup.`).pop()):0,s=Number.isNaN(o)||Date.now()-o>=6e4;if(s){let r=z(n,`${t}.backup.${Date.now()}`);a.copyFileSync(e,r)}let c=s?a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse():r;for(let e of c.slice(5))try{a.unlinkSync(z(n,e))}catch{}}catch(e){mn(e)!==`ENOENT`&&N(`Failed to backup config: ${e}`,{level:`error`})}return Sf(e,A(d,null,2),{encoding:`utf-8`,mode:384}),e===R()&&Ek++,!0}finally{o&&o()}}function gk(){return z(h(),`backups`)}function _k(e){let t=j(),n=Xi(e),r=gk();try{let e=t.readdirStringSync(r).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(e)return z(r,e)}catch{}let i=Zi(e);try{let r=t.readdirStringSync(i).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(r)return z(i,r);let a=`${e}.backup`;try{return t.statSync(a),a}catch{}}catch{}return null}function vk(e,t,n){if(!kk)throw Error(`Config accessed before allowed.`);let r=j();try{let n=r.readFileSync(e,{encoding:`utf-8`});try{let e=gn(Rr(n));return{...t(),...e}}catch(n){throw new Cn(n instanceof Error?n.message:String(n),e,t())}}catch(i){if(mn(i)===`ENOENT`){let n=_k(e);return n&&process.stderr.write(`\nClaude configuration file not found at: ${e}\nA backup file exists at: ${n}\nYou can manually restore it by running: cp "${n}" "${e}"\n\n`),t()}if(i instanceof Cn&&n)throw i;if(i instanceof Cn){if(N(`Config file corrupted, resetting to defaults: ${i.message}`,{level:`error`}),!yk){yk=!0;try{P(i);let t=!1;try{r.statSync(`${e}.backup`),t=!0}catch{}I(`tengu_config_parse_error`,{has_backup:t})}finally{yk=!1}}process.stderr.write(`\nClaude configuration file at ${e} is corrupted: ${i.message}\n`);let t=Xi(e),n=gk();try{r.mkdirSync(n)}catch(e){if(mn(e)!==`EEXIST`)throw e}let a=r.readdirStringSync(n).filter(e=>e.startsWith(`${t}.corrupted.`)),o,s=!1,c=r.readFileSync(e,{encoding:`utf-8`});for(let e of a)try{if(c===r.readFileSync(z(n,e),{encoding:`utf-8`})){s=!0;break}}catch{}if(!s){o=z(n,`${t}.corrupted.${Date.now()}`);try{r.copyFileSync(e,o),N(`Corrupted config backed up to: ${o}`,{level:`error`})}catch{}}let l=_k(e);o?process.stderr.write(`The corrupted file has been backed up to: ${o}\n`):s&&process.stderr.write(`The corrupted file has already been backed up.
31
+ `),l?process.stderr.write(`A backup file exists at: ${l}\nYou can manually restore it by running: cp "${l}" "${e}"\n\n`):process.stderr.write(`
32
+ `)}return t()}}var yk,bk,xk,Sk,Ck,wk,Tk,Ek,Dk,Ok,kk,Ak=t((()=>{m(),td(),O(),l_(),si(),er(),Tn(),M(),cr(),xi(),g(),kn(),Of(),An(),dr(),Vr(),zr(),Wr(),yr(),Pr(),Xf(),vn(),yk=!1,bk={allowedTools:[],mcpContextUris:[],mcpServers:{},enabledMcpjsonServers:[],disabledMcpjsonServers:[],hasTrustDialogAccepted:!1,projectOnboardingSeenCount:0,hasClaudeMdExternalIncludesApproved:!1,hasClaudeMdExternalIncludesWarningShown:!1},xk=ik(),{...xk},{...bk},Sk={config:null,mtime:0},Ck=null,wk=0,Tk=0,Ek=0,fn(async()=>{sk()}),Dk=1e3,Ok=!1,kk=!1,p(()=>{let e=Xt();return Nr(lr(e)||ta(e))})}));async function jk(e){let t=`${tv().BASE_API_URL}/api/oauth/profile`;try{return(await Fe.get(t,{headers:{Authorization:`Bearer ${e}`,"Content-Type":`application/json`},timeout:1e4})).data}catch(e){Ki(e)}}var Mk=t((()=>{Ie(),dv(),rk(),Ak(),Gi()}));function Nk(e){return!!e?.includes(mi)}function Pk(e){return e?.split(` `).filter(Boolean)??[]}function Fk({codeChallenge:e,state:t,port:n,isManual:r,loginWithClaudeAi:i,inferenceOnly:a,orgUUID:o,loginHint:s,loginMethod:c}){let l=i?fi().CLAUDE_AI_AUTHORIZE_URL:fi().CONSOLE_AUTHORIZE_URL,u=new URL(l);u.searchParams.append(`code`,`true`),u.searchParams.append(`client_id`,fi().CLIENT_ID),u.searchParams.append(`response_type`,`code`),u.searchParams.append(`redirect_uri`,r?fi().MANUAL_REDIRECT_URL:`http://localhost:${n}/callback`);let d=a?[mi]:_i;return u.searchParams.append(`scope`,d.join(` `)),u.searchParams.append(`code_challenge`,e),u.searchParams.append(`code_challenge_method`,`S256`),u.searchParams.append(`state`,t),o&&u.searchParams.append(`orgUUID`,o),s&&u.searchParams.append(`login_hint`,s),c&&u.searchParams.append(`login_method`,c),u.toString()}async function Ik(e,t,n,r,i=!1,a){let o={grant_type:`authorization_code`,code:e,redirect_uri:i?fi().MANUAL_REDIRECT_URL:`http://localhost:${r}/callback`,client_id:fi().CLIENT_ID,code_verifier:n,state:t};a!==void 0&&(o.expires_in=a);let s=await Fe.post(fi().TOKEN_URL,o,{headers:{"Content-Type":`application/json`},timeout:15e3});if(s.status!==200)throw Error(s.status===401?`Authentication failed: Invalid authorization code`:`Token exchange failed (${s.status}): ${s.statusText}`);return F(`tengu_oauth_token_exchange_success`,{}),s.data}async function Lk(e,{scopes:t}={}){let n={grant_type:`refresh_token`,refresh_token:e,client_id:fi().CLIENT_ID,scope:(t?.length?t:hi).join(` `)};try{let t=await Fe.post(fi().TOKEN_URL,n,{headers:{"Content-Type":`application/json`},timeout:15e3});if(t.status!==200)throw Error(`Token refresh failed: ${t.statusText}`);let r=t.data,{access_token:i,refresh_token:a=e,expires_in:o}=r,s=Date.now()+o*1e3,c=Pk(r.scope);F(`tengu_oauth_token_refresh_success`,{});let l=G(),u=$(),d=l.oauthAccount?.billingType!==void 0&&l.oauthAccount?.accountCreatedAt!==void 0&&l.oauthAccount?.subscriptionCreatedAt!==void 0&&u?.subscriptionType!=null&&u?.rateLimitTier!=null?null:await Vk(i);if(d&&l.oauthAccount){let e={};d.displayName!==void 0&&(e.displayName=d.displayName),typeof d.hasExtraUsageEnabled==`boolean`&&(e.hasExtraUsageEnabled=d.hasExtraUsageEnabled),d.billingType!==null&&(e.billingType=d.billingType),d.accountCreatedAt!==void 0&&(e.accountCreatedAt=d.accountCreatedAt),d.subscriptionCreatedAt!==void 0&&(e.subscriptionCreatedAt=d.subscriptionCreatedAt),Object.keys(e).length>0&&p_(t=>({...t,oauthAccount:t.oauthAccount?{...t.oauthAccount,...e}:t.oauthAccount}))}return{accessToken:i,refreshToken:a,expiresAt:s,scopes:c,subscriptionType:d?.subscriptionType??u?.subscriptionType??null,rateLimitTier:d?.rateLimitTier??u?.rateLimitTier??null,profile:d?.rawProfile,tokenAccount:r.account?{uuid:r.account.uuid,emailAddress:r.account.email_address,organizationUuid:r.organization?.uuid}:void 0}}catch(e){let t=Fe.isAxiosError(e)&&e.response?.data?JSON.stringify(e.response.data):void 0;throw F(`tengu_oauth_token_refresh_failure`,{error:e.message,...t&&{responseBody:t}}),e}}async function Rk(e){let t=await Fe.get(fi().ROLES_URL,{headers:{Authorization:`Bearer ${e}`}});if(t.status!==200)throw Error(`Failed to fetch user roles: ${t.statusText}`);let n=t.data;if(!G().oauthAccount)throw Error(`OAuth account information not found in config`);p_(e=>({...e,oauthAccount:e.oauthAccount?{...e.oauthAccount,organizationRole:n.organization_role,workspaceRole:n.workspace_role,organizationName:n.organization_name}:e.oauthAccount})),F(`tengu_oauth_roles_stored`,{org_role:n.organization_role})}async function zk(e){try{let t=await Fe.post(fi().API_KEY_URL,null,{headers:{Authorization:`Bearer ${e}`}}),n=t.data?.raw_key;return n?(await EA(n),F(`tengu_oauth_api_key`,{status:`success`,statusCode:t.status}),n):null}catch(e){throw F(`tengu_oauth_api_key`,{status:`failure`,error:e instanceof Error?e.message:String(e)}),e}}function Bk(e){return e===null?!1:Date.now()+300*1e3>=e}async function Vk(e){let t=await jk(e),n=t?.organization?.organization_type,r=null;switch(n){case`claude_max`:r=`max`;break;case`claude_pro`:r=`pro`;break;case`claude_enterprise`:r=`enterprise`;break;case`claude_team`:r=`team`;break;default:r=null;break}let i={subscriptionType:r,rateLimitTier:t?.organization?.rate_limit_tier??null,hasExtraUsageEnabled:t?.organization?.has_extra_usage_enabled??null,billingType:t?.organization?.billing_type??null};return t?.account?.display_name&&(i.displayName=t.account.display_name),t?.account?.created_at&&(i.accountCreatedAt=t.account.created_at),t?.organization?.subscription_created_at&&(i.subscriptionCreatedAt=t.organization.subscription_created_at),F(`tengu_oauth_profile_fetch_success`,{}),{...i,rawProfile:t}}async function Hk(){let e=G().oauthAccount?.organizationUuid;if(e)return e;let t=$()?.accessToken;return t===void 0||!RA()?null:(await jk(t))?.organization?.uuid||null}async function Uk(){let e=process.env.CLAUDE_CODE_ACCOUNT_UUID,t=process.env.CLAUDE_CODE_USER_EMAIL,n=process.env.CLAUDE_CODE_ORGANIZATION_UUID,r=!!(e&&t&&n);e&&t&&n&&(G().oauthAccount||Wk({accountUuid:e,emailAddress:t,organizationUuid:n})),await IA();let i=G();if(i.oauthAccount&&i.oauthAccount.billingType!==void 0&&i.oauthAccount.accountCreatedAt!==void 0&&i.oauthAccount.subscriptionCreatedAt!==void 0||!Z()||!RA())return!1;let a=$();if(a?.accessToken){let e=await jk(a.accessToken);if(e)return r&&N(`OAuth profile fetch succeeded, overriding env var account info`,{level:`info`}),Wk({accountUuid:e.account.uuid,emailAddress:e.account.email,organizationUuid:e.organization.uuid,displayName:e.account.display_name||void 0,hasExtraUsageEnabled:e.organization.has_extra_usage_enabled??!1,billingType:e.organization.billing_type??void 0,accountCreatedAt:e.account.created_at,subscriptionCreatedAt:e.organization.subscription_created_at??void 0}),!0}return!1}function Wk({accountUuid:e,emailAddress:t,organizationUuid:n,displayName:r,hasExtraUsageEnabled:i,billingType:a,accountCreatedAt:o,subscriptionCreatedAt:s}){let c={accountUuid:e,emailAddress:t,organizationUuid:n,hasExtraUsageEnabled:i,billingType:a,accountCreatedAt:o,subscriptionCreatedAt:s};r&&(c.displayName=r),p_(e=>e.oauthAccount?.accountUuid===c.accountUuid&&e.oauthAccount?.emailAddress===c.emailAddress&&e.oauthAccount?.organizationUuid===c.organizationUuid&&e.oauthAccount?.displayName===c.displayName&&e.oauthAccount?.hasExtraUsageEnabled===c.hasExtraUsageEnabled&&e.oauthAccount?.billingType===c.billingType&&e.oauthAccount?.accountCreatedAt===c.accountCreatedAt&&e.oauthAccount?.subscriptionCreatedAt===c.subscriptionCreatedAt?e:{...e,oauthAccount:c})}var Gk=t((()=>{Ie(),ii(),vi(),Cj(),Q_(),M(),Mk()})),Kk=r({calculateApiKeyHelperTTL:()=>aA,checkAndRefreshOAuthTokenIfNeeded:()=>IA,checkGcpCredentialsValid:()=>yA,clearApiKeyHelperCache:()=>dA,clearAwsCredentialsCache:()=>gA,clearGcpCredentialsCache:()=>SA,clearOAuthTokenCache:()=>jA,getAccountInformation:()=>nj,getAnthropicApiKey:()=>Xk,getAnthropicApiKeyWithSource:()=>Qk,getApiKeyFromApiKeyHelper:()=>sA,getApiKeyFromApiKeyHelperCached:()=>uA,getApiKeyFromConfigOrMacOSKeychain:()=>hj,getApiKeyHelperElapsedMs:()=>oA,getAuthTokenSource:()=>Yk,getClaudeAIOAuthTokens:()=>$,getClaudeAIOAuthTokensAsync:()=>FA,getConfiguredApiKeyHelper:()=>$k,getOauthAccountInfo:()=>BA,getOtelHeadersFromHelper:()=>$A,getRateLimitTier:()=>JA,getSubscriptionName:()=>YA,getSubscriptionType:()=>Q,handleOAuth401Error:()=>NA,hasAnthropicApiKeyAuth:()=>Zk,hasOpusAccess:()=>HA,hasProfileScope:()=>RA,is1PApiCustomer:()=>zA,isAnthropicAuthEnabled:()=>Jk,isAwsAuthRefreshFromProjectSettings:()=>nA,isAwsCredentialExportFromProjectSettings:()=>iA,isClaudeAISubscriber:()=>Z,isConsumerSubscriber:()=>tj,isCustomApiKeyApproved:()=>DA,isEnterpriseSubscriber:()=>KA,isGcpAuthRefreshFromProjectSettings:()=>vA,isMaxSubscriber:()=>UA,isOtelHeadersHelperFromProjectOrLocalSettings:()=>QA,isOverageProvisioningAllowed:()=>VA,isProSubscriber:()=>qA,isTeamPremiumSubscriber:()=>GA,isTeamSubscriber:()=>WA,isUsing3PServices:()=>XA,prefetchApiKeyFromApiKeyHelperIfSafe:()=>fA,prefetchAwsCredentialsAndBedRockInfoIfSafe:()=>wA,prefetchGcpCredentialsIfSafe:()=>CA,refreshAndGetAwsCredentials:()=>uj,refreshAwsAuth:()=>mA,refreshGcpAuth:()=>xA,refreshGcpCredentialsIfNeeded:()=>mj,removeApiKey:()=>OA,saveApiKey:()=>EA,saveOAuthTokensIfNeeded:()=>AA,validateForceLoginOrg:()=>rj});function qk(){return _(process.env.CLAUDE_CODE_REMOTE)||process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`}function Jk(){if(ne())return!1;if(process.env.ANTHROPIC_UNIX_SOCKET)return!!process.env.CLAUDE_CODE_OAUTH_TOKEN;let e=U()||{};if(Bv($v(e))||process.env.OPENAI_BASE_URL||process.env.GEMINI_BASE_URL)return!1;let t=e.apiKeyHelper,n=process.env.ANTHROPIC_AUTH_TOKEN||t||process.env.CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR,{source:r}=Qk({skipRetrievingKeyFromApiKeyHelper:!0}),i=r===`ANTHROPIC_API_KEY`||r===`apiKeyHelper`;return!(n&&!qk()||i&&!qk())}function Yk(){if(ne())return $k()?{source:`apiKeyHelper`,hasToken:!0}:{source:`none`,hasToken:!1};if(process.env.ANTHROPIC_AUTH_TOKEN&&!qk())return{source:`ANTHROPIC_AUTH_TOKEN`,hasToken:!0};if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{source:`CLAUDE_CODE_OAUTH_TOKEN`,hasToken:!0};if(ky())return process.env.CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR?{source:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,hasToken:!0}:{source:`CCR_OAUTH_TOKEN_FILE`,hasToken:!0};if($k()&&!qk())return{source:`apiKeyHelper`,hasToken:!0};let e=$();return Nk(e?.scopes)&&e?.accessToken?{source:`claude.ai`,hasToken:!0}:{source:`none`,hasToken:!1}}function Xk(){let{key:e}=Qk();return e}function Zk(){let{key:e,source:t}=Qk({skipRetrievingKeyFromApiKeyHelper:!0});return e!==null&&t!==`none`}function Qk(e={}){if(ne())return process.env.ANTHROPIC_API_KEY?{key:process.env.ANTHROPIC_API_KEY,source:`ANTHROPIC_API_KEY`}:$k()?{key:e.skipRetrievingKeyFromApiKeyHelper?null:uA(),source:`apiKeyHelper`}:{key:null,source:`none`};let t=re()?void 0:process.env.ANTHROPIC_API_KEY;if(dn()&&t)return{key:t,source:`ANTHROPIC_API_KEY`};if(_(process.env.CI)){let e=Ay();if(e)return{key:e,source:`ANTHROPIC_API_KEY`};if(!t&&!process.env.CLAUDE_CODE_OAUTH_TOKEN&&!process.env.CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR)throw Error(`ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN env var is required`);return t?{key:t,source:`ANTHROPIC_API_KEY`}:{key:null,source:`none`}}if(t&&G().customApiKeyResponses?.approved?.includes(zy(t)))return{key:t,source:`ANTHROPIC_API_KEY`};let n=Ay();return n?{key:n,source:`ANTHROPIC_API_KEY`}:$k()?e.skipRetrievingKeyFromApiKeyHelper?{key:null,source:`apiKeyHelper`}:{key:uA(),source:`apiKeyHelper`}:hj()||{key:null,source:`none`}}function $k(){return ne()?H(`flagSettings`)?.apiKeyHelper:(U()||{}).apiKeyHelper}function eA(){let e=$k();if(!e)return!1;let t=H(`projectSettings`),n=H(`localSettings`);return t?.apiKeyHelper===e||n?.apiKeyHelper===e}function tA(){return(U()||{}).awsAuthRefresh}function nA(){let e=tA();if(!e)return!1;let t=H(`projectSettings`),n=H(`localSettings`);return t?.awsAuthRefresh===e||n?.awsAuthRefresh===e}function rA(){return(U()||{}).awsCredentialExport}function iA(){let e=rA();if(!e)return!1;let t=H(`projectSettings`),n=H(`localSettings`);return t?.awsCredentialExport===e||n?.awsCredentialExport===e}function aA(){let e=process.env.CLAUDE_CODE_API_KEY_HELPER_TTL_MS;if(e){let t=parseInt(e,10);if(!Number.isNaN(t)&&t>=0)return t;N(`Found CLAUDE_CODE_API_KEY_HELPER_TTL_MS env var, but it was not a valid number. Got ${e}`,{level:`error`})}return ij}function oA(){let e=oj?.startedAt;return e?Date.now()-e:0}async function sA(e){if(!$k())return null;let t=aA();return aj?(Date.now()-aj.timestamp<t||oj||(oj={promise:cA(e,!1,sj),startedAt:null}),aj.value):(oj||(oj={promise:cA(e,!0,sj),startedAt:Date.now()}),oj.promise)}async function cA(e,t,n){try{let t=await lA(e);return n===sj&&t!==null&&(aj={value:t,timestamp:Date.now()}),t}catch(e){if(n!==sj)return` `;let r=e instanceof Error?e.message:String(e);return console.error(Xe.red(`apiKeyHelper failed: ${r}`)),N(`Error getting API key from apiKeyHelper: ${r}`,{level:`error`}),!t&&aj&&aj.value!==` `?(aj={...aj,timestamp:Date.now()},aj.value):(aj={value:` `,timestamp:Date.now()},` `)}finally{n===sj&&(oj=null)}}async function lA(e){let t=$k();if(!t)return null;if(eA()&&!W()&&!e)return Ln(`apiKeyHelper invoked before trust check`,Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in .`)),F(`tengu_apiKeyHelper_missing_trust11`,{}),null;let n=await mr(t,{shell:!0,timeout:600*1e3,reject:!1});if(n.failed){let e=n.timedOut?`timed out`:`exited ${n.exitCode}`,t=n.stderr?.trim();throw Error(t?`${e}: ${t}`:e)}let r=n.stdout?.trim();if(!r)throw Error(`did not return a value`);return r}function uA(){return aj?.value??null}function dA(){sj++,aj=null,oj=null}function fA(e){eA()&&!W()||sA(e)}async function pA(){let e=tA();if(!e)return!1;if(nA()&&!W()&&!k())return Ln(`awsAuthRefresh invoked before trust check`,Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),F(`tengu_awsAuthRefresh_missing_trust`,{}),!1;try{return N(`Fetching AWS caller identity for AWS auth refresh command`),await Hy(),N(`Fetched AWS caller identity, skipping AWS auth refresh command`),!1}catch{return mA(e)}}function mA(e){N(`Running AWS auth refresh command`);let t=Gy.getInstance();return t.startAuthentication(),new Promise(n=>{let r=ba(e,{timeout:lj});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),N(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),N(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)N(`AWS auth refresh completed successfully`),t.endAuthentication(!0),n(!0);else{let e=r===`SIGTERM`?Xe.red(`AWS auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.`):Xe.red(`Error running awsAuthRefresh (in settings or ~/.claude.json):`);console.error(e),t.endAuthentication(!1),n(!1)}})})}async function hA(){let e=rA();if(!e)return null;if(iA()&&!W()&&!k())return Ln(`awsCredentialExport invoked before trust check`,Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in .`)),F(`tengu_awsCredentialExport_missing_trust`,{}),null;try{return N(`Fetching AWS caller identity for credential export command`),await Hy(),N(`Fetched AWS caller identity, skipping AWS credential export command`),null}catch{try{N(`Running AWS credential export command`);let t=await mr(e,{shell:!0,reject:!1});if(t.exitCode!==0||!t.stdout)throw Error(`awsCredentialExport did not return a valid value`);let n=gn(t.stdout.trim());if(!Vy(n))throw Error(`awsCredentialExport did not return valid AWS STS output structure`);return N(`AWS credentials retrieved from awsCredentialExport`),{accessKeyId:n.Credentials.AccessKeyId,secretAccessKey:n.Credentials.SecretAccessKey,sessionToken:n.Credentials.SessionToken}}catch(e){let t=Xe.red(`Error getting AWS credentials from awsCredentialExport (in settings or ~/.claude.json):`);return e instanceof Error?console.error(t,e.message):console.error(t,e),null}}}function gA(){uj.cache.clear()}function _A(){return(U()||{}).gcpAuthRefresh}function vA(){let e=_A();if(!e)return!1;let t=H(`projectSettings`),n=H(`localSettings`);return t?.gcpAuthRefresh===e||n?.gcpAuthRefresh===e}async function yA(){try{let{GoogleAuth:e}=await import(`./src-lLwoqdC0.js`).then(e=>n(e.default,1)),t=new e({scopes:[`https://www.googleapis.com/auth/cloud-platform`]}),r=(async()=>{await(await t.getClient()).getAccessToken()})(),i=zi(dj).then(()=>{throw new Sj(`GCP credentials check timed out`)});return await Promise.race([r,i]),!0}catch{return!1}}async function bA(){let e=_A();if(!e)return!1;if(vA()&&!W()&&!k())return Ln(`gcpAuthRefresh invoked before trust check`,Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),F(`tengu_gcpAuthRefresh_missing_trust`,{}),!1;try{if(N(`Checking GCP credentials validity for auth refresh`),await yA())return N(`GCP credentials are valid, skipping auth refresh command`),!1}catch{}return xA(e)}function xA(e){N(`Running GCP auth refresh command`);let t=Gy.getInstance();return t.startAuthentication(),new Promise(n=>{let r=ba(e,{timeout:pj});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),N(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),N(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)N(`GCP auth refresh completed successfully`),t.endAuthentication(!0),n(!0);else{let e=r===`SIGTERM`?Xe.red(`GCP auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.`):Xe.red(`Error running gcpAuthRefresh (in settings or ~/.claude.json):`);console.error(e),t.endAuthentication(!1),n(!1)}})})}function SA(){mj.cache.clear()}function CA(){_A()&&(vA()&&!W()&&!k()||mj())}function wA(){let e=tA(),t=rA();!e&&!t||(nA()||iA())&&!W()&&!k()||(uj(),Jv())}function TA(e){return/^[a-zA-Z0-9-_]+$/.test(e)}async function EA(e){if(!TA(e))throw Error(`Invalid API key format. API key must contain only alphanumeric characters, dashes, and underscores.`);await kA();let t=!1;if(process.platform===`darwin`)try{let n=yD();await mr(`security`,[`-i`],{input:`add-generic-password -U -a "${bD()}" -s "${n}" -X "${Buffer.from(e,`utf-8`).toString(`hex`)}"\n`,reject:!1}),F(`tengu_api_key_saved_to_keychain`,{}),t=!0}catch(e){P(e),F(`tengu_api_key_keychain_error`,{error:$n(e)}),F(`tengu_api_key_saved_to_config`,{})}else F(`tengu_api_key_saved_to_config`,{});let n=zy(e);p_(r=>{let i=r.customApiKeyResponses?.approved??[];return{...r,primaryApiKey:t?r.primaryApiKey:e,customApiKeyResponses:{...r.customApiKeyResponses,approved:i.includes(n)?i:[...i,n],rejected:r.customApiKeyResponses?.rejected??[]}}}),hj.cache.clear?.(),BD()}function DA(e){let t=G(),n=zy(e);return t.customApiKeyResponses?.approved?.includes(n)??!1}async function OA(){await kA(),p_(e=>({...e,primaryApiKey:void 0})),hj.cache.clear?.(),BD()}async function kA(){try{await Ry()}catch(e){P(e)}}function AA(e){if(!Nk(e.scopes))return F(`tengu_oauth_tokens_not_claude_ai`,{}),{success:!0};if(!e.refreshToken||!e.expiresAt)return F(`tengu_oauth_tokens_inference_only`,{}),{success:!0};let t=PD(),n=t.name;try{let r=t.read()||{},i=r.claudeAiOauth;r.claudeAiOauth={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresAt:e.expiresAt,scopes:e.scopes,subscriptionType:e.subscriptionType??i?.subscriptionType??null,rateLimitTier:e.rateLimitTier??i?.rateLimitTier??null};let a=t.update(r);return a.success?F(`tengu_oauth_tokens_saved`,{storageBackend:n}):F(`tengu_oauth_tokens_save_failed`,{storageBackend:n}),$.cache?.clear?.(),dD(),KD(),a}catch(e){return P(e),F(`tengu_oauth_tokens_save_exception`,{storageBackend:n,error:$n(e)}),{success:!1,warning:`Failed to save OAuth tokens`}}}function jA(){$.cache?.clear?.(),xD()}async function MA(){try{let{mtimeMs:e}=await _a(z(h(),`.credentials.json`));e!==gj&&(gj=e,jA())}catch{$.cache?.clear?.()}}function NA(e){let t=_j.get(e);if(t)return t;let n=PA(e).finally(()=>{_j.delete(e)});return _j.set(e,n),n}async function PA(e){jA();let t=await FA();return t?.refreshToken?t.accessToken===e?IA(0,!0):(F(`tengu_oauth_401_recovered_from_keychain`,{}),!0):!1}async function FA(){if(ne())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN||ky())return $();try{let e=(await PD().readAsync())?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return P(e),null}}function IA(e=0,t=!1){return e===0&&!t?vj||(vj=LA(e,t).finally(()=>{vj=null}),vj):LA(e,t)}async function LA(e,t){await MA();let n=$();if(!t&&(!n?.refreshToken||!Bk(n.expiresAt))||!n?.refreshToken||!Nk(n.scopes))return!1;$.cache?.clear?.(),xD();let r=await FA();if(!r?.refreshToken||!Bk(r.expiresAt))return!1;let i=h();await ma(i,{recursive:!0});let a;try{F(`tengu_oauth_token_refresh_lock_acquiring`,{}),a=await ei(i),F(`tengu_oauth_token_refresh_lock_acquired`,{})}catch(n){return n.code===`ELOCKED`?e<5?(F(`tengu_oauth_token_refresh_lock_retry`,{retryCount:e+1}),await zi(1e3+Math.random()*1e3),LA(e+1,t)):(F(`tengu_oauth_token_refresh_lock_retry_limit_reached`,{maxRetries:5}),!1):(P(n),F(`tengu_oauth_token_refresh_lock_error`,{error:$n(n)}),!1)}try{$.cache?.clear?.(),xD();let e=await FA();return!e?.refreshToken||!Bk(e.expiresAt)?(F(`tengu_oauth_token_refresh_race_resolved`,{}),!1):(F(`tengu_oauth_token_refresh_starting`,{}),AA(await Lk(e.refreshToken,{scopes:Nk(e.scopes)?void 0:e.scopes})),$.cache?.clear?.(),xD(),!0)}catch(e){P(e),$.cache?.clear?.(),xD();let t=await FA();return t&&!Bk(t.expiresAt)?(F(`tengu_oauth_token_refresh_race_recovered`,{}),!0):!1}finally{F(`tengu_oauth_token_refresh_lock_releasing`,{}),await a(),F(`tengu_oauth_token_refresh_lock_released`,{})}}function Z(){return Jk()?Nk($()?.scopes):!1}function RA(){return $()?.scopes?.includes(`user:profile`)??!1}function zA(){return!(_(process.env.CLAUDE_CODE_USE_BEDROCK)||_(process.env.CLAUDE_CODE_USE_VERTEX)||_(process.env.CLAUDE_CODE_USE_FOUNDRY)||Z())}function BA(){return Jk()?G().oauthAccount:void 0}function VA(){let e=BA()?.billingType;return!(!Z()||!e||e!==`stripe_subscription`&&e!==`stripe_subscription_contracted`&&e!==`apple_subscription`&&e!==`google_play_subscription`)}function HA(){let e=Q();return e===`max`||e===`enterprise`||e===`team`||e===`pro`||e===null}function Q(){if(my())return py();if(!Jk())return null;let e=$();return e?e.subscriptionType??null:null}function UA(){return Q()===`max`}function WA(){return Q()===`team`}function GA(){return Q()===`team`&&JA()===`default_claude_max_5x`}function KA(){return Q()===`enterprise`}function qA(){return Q()===`pro`}function JA(){if(!Jk())return null;let e=$();return e?e.rateLimitTier??null:null}function YA(){switch(Q()){case`enterprise`:return`Claude Enterprise`;case`team`:return`Claude Team`;case`max`:return`Claude Max`;case`pro`:return`Claude Pro`;default:return`Claude API`}}function XA(){return!!(_(process.env.CLAUDE_CODE_USE_BEDROCK)||_(process.env.CLAUDE_CODE_USE_VERTEX)||_(process.env.CLAUDE_CODE_USE_FOUNDRY)||_(process.env.CLAUDE_CODE_USE_OPENAI)||_(process.env.CLAUDE_CODE_USE_GEMINI)||_(process.env.CLAUDE_CODE_USE_GROK))}function ZA(){return(U()||{}).otelHeadersHelper}function QA(){let e=ZA();if(!e)return!1;let t=H(`projectSettings`),n=H(`localSettings`);return t?.otelHeadersHelper===e||n?.otelHeadersHelper===e}function $A(){let e=ZA();if(!e)return{};let t=parseInt(process.env.CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS||xj.toString(),10);if(yj&&Date.now()-bj<t)return yj;if(QA()&&!W())return{};try{let t=xr(e,{timeout:3e4})?.toString().trim();if(!t)throw Error(`otelHeadersHelper did not return a valid value`);let n=gn(t);if(typeof n!=`object`||!n||Array.isArray(n))throw Error(`otelHeadersHelper must return a JSON object with string key-value pairs`);for(let[e,t]of Object.entries(n))if(typeof t!=`string`)throw Error(`otelHeadersHelper returned non-string value for key "${e}": ${typeof t}`);return yj=n,bj=Date.now(),yj}catch(e){throw P(Error(`Error getting OpenTelemetry headers from otelHeadersHelper (in settings): ${$n(e)}`)),e}}function ej(e){return e===`max`||e===`pro`}function tj(){let e=Q();return Z()&&e!==null&&ej(e)}function nj(){if($v()!==`firstParty`)return;let{source:e}=Yk(),t={};e===`CLAUDE_CODE_OAUTH_TOKEN`||e===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`?t.tokenSource=e:Z()?t.subscription=YA():t.tokenSource=e;let{key:n,source:r}=Qk();if(n&&(t.apiKeySource=r),e===`claude.ai`||r===`/login managed key`){let e=BA()?.organizationName;e&&(t.organization=e)}let i=BA()?.emailAddress;return(e===`claude.ai`||r===`/login managed key`)&&i&&(t.email=i),t}async function rj(){if(process.env.ANTHROPIC_UNIX_SOCKET||!Jk())return{valid:!0};let e=H(`policySettings`)?.forceLoginOrgUUID;if(!e)return{valid:!0};await IA();let t=$();if(!t)return{valid:!0};let{source:n}=Yk(),r=n===`CLAUDE_CODE_OAUTH_TOKEN`||n===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,i=await jk(t.accessToken);if(!i)return{valid:!1,message:`Unable to verify organization for the current authentication token.\nThis machine requires organization ${e} but the profile could not be fetched.\nThis may be a network error, or the token may lack the user:profile scope required for\nverification (tokens from 'claude setup-token' do not include this scope).\nTry again, or obtain a full-scope token via 'claude auth login'.`};let a=i.organization.uuid;return a===e?{valid:!0}:r?{valid:!1,message:`The ${n===`CLAUDE_CODE_OAUTH_TOKEN`?`CLAUDE_CODE_OAUTH_TOKEN`:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`} environment variable provides a token for a\ndifferent organization than required by this machine's managed settings.\n\nRequired organization: ${e}\nToken organization: ${a}\n\nRemove the environment variable or obtain a token for the correct organization.`}:{valid:!1,message:`Your authentication token belongs to organization ${a},\nbut this machine requires organization ${e}.\n\nPlease log in with the correct organization: claude auth login`}}var ij,aj,oj,sj,cj,lj,uj,dj,fj,pj,mj,hj,$,gj,_j,vj,yj,bj,xj,Sj,Cj=t((()=>{Ze(),pr(),m(),dv(),ii(),Qv(),ny(),O(),Ty(),Gk(),Mk(),Fy(),By(),Wy(),Ky(),gD(),Q_(),M(),g(),kn(),Cr(),Wr(),yr(),Er(),FD(),WD(),wD(),Yg(),Bi(),vn(),JD(),ij=300*1e3,aj=null,oj=null,sj=0,cj=3600*1e3,lj=180*1e3,uj=Tr(async()=>{let e=await pA(),t=await hA();return(e||t)&&await Uy(),t},cj),dj=5e3,fj=3600*1e3,pj=180*1e3,mj=Tr(async()=>await bA(),fj),hj=p(()=>{if(ne())return null;if(process.platform===`darwin`){let e=zD();if(e){if(e.stdout)return{key:e.stdout,source:`/login managed key`}}else{let e=yD();try{let t=xr(`security find-generic-password -a $USER -w -s "${e}"`);if(t)return{key:t,source:`/login managed key`}}catch(e){P(e)}}}let e=G();return e.primaryApiKey?{key:e.primaryApiKey,source:`/login managed key`}:null}),$=p(()=>{if(ne())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{accessToken:process.env.CLAUDE_CODE_OAUTH_TOKEN,refreshToken:null,expiresAt:null,scopes:[`user:inference`],subscriptionType:null,rateLimitTier:null};let e=ky();if(e)return{accessToken:e,refreshToken:null,expiresAt:null,scopes:[`user:inference`],subscriptionType:null,rateLimitTier:null};try{let e=PD().read()?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return P(e),null}}),gj=0,_j=new Map,vj=null,yj=null,bj=0,xj=1740*1e3,Sj=class extends Error{}}));function wj(){let e=process.env.CLAUDE_AGENT_SDK_VERSION?`, agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`:``,t=process.env.CLAUDE_AGENT_SDK_CLIENT_APP?`, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`:``,n=aS(),r=n?`, workload/${n}`:``;return`claude-cli/2.8.4 (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT??`cli`}${e}${t}${r})`}function Tj(){let e=[];return process.env.CLAUDE_CODE_ENTRYPOINT&&e.push(process.env.CLAUDE_CODE_ENTRYPOINT),process.env.CLAUDE_AGENT_SDK_VERSION&&e.push(`agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`),process.env.CLAUDE_AGENT_SDK_CLIENT_APP&&e.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`),`claude-code/2.8.4${e.length>0?` (${e.join(`, `)})`:``}`}function Ej(){if(Z()){let e=$();return e?.accessToken?{headers:{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":gi}}:{headers:{},error:`No OAuth token available`}}let e=Xk();return e?{headers:{"x-api-key":e}}:{headers:{},error:`No API key available`}}async function Dj(e,t){try{return await e()}catch(n){if(!Fe.isAxiosError(n))throw n;let r=n.response?.status;if(!(r===401||t?.also403Revoked&&r===403&&typeof n.response?.data==`string`&&n.response.data.includes(`OAuth token has been revoked`)))throw n;let i=$()?.accessToken;if(!i)throw n;return await NA(i),await e()}}var Oj=t((()=>{Ie(),vi(),Cj(),lS()}));function kj(e){try{Promise.resolve(e()).catch(e=>{P(e)})}catch(e){P(e)}}function Aj(e){let t=!0,n=mM.subscribe(()=>kj(e));return uM.size>0&&queueMicrotask(()=>{t&&uM.size>0&&kj(e)}),()=>{t=!1,n()}}function jj(){if(!gM&&(gM=!0,process.env.USER_TYPE===`ant`)){let e=process.env.CLAUDE_INTERNAL_FC_OVERRIDES;if(e)try{hM=JSON.parse(e),N(`GrowthBook: Using env var overrides for ${Object.keys(hM).length} features: ${Object.keys(hM).join(`, `)}`)}catch{P(Error(`GrowthBook: Failed to parse CLAUDE_INTERNAL_FC_OVERRIDES: ${e}`))}}return hM}function Mj(e){let t=jj();return t!==null&&e in t}function Nj(){if(process.env.USER_TYPE===`ant`)try{return G().growthBookOverrides}catch{return}}function Pj(){return uM.size>0?Object.fromEntries(uM):G().cachedGrowthBookFeatures??{}}function Fj(){return Nj()??{}}function Ij(e,t){if(process.env.USER_TYPE===`ant`)try{p_(n=>{let r=n.growthBookOverrides??{};if(t===void 0){if(!(e in r))return n;let{[e]:t,...i}=r;if(Object.keys(i).length===0){let{growthBookOverrides:e,...t}=n;return t}return{...n,growthBookOverrides:i}}return Nu(r[e],t)?n:{...n,growthBookOverrides:{...r,[e]:t}}}),mM.emit()}catch(e){P(e)}}function Lj(){if(process.env.USER_TYPE===`ant`)try{p_(e=>{if(!e.growthBookOverrides||Object.keys(e.growthBookOverrides).length===0)return e;let{growthBookOverrides:t,...n}=e;return n}),mM.emit()}catch(e){P(e)}}function Rj(e){if(fM.has(e))return;let t=lM.get(e);t&&(fM.add(e),QT({experimentId:t.experimentId,variationId:t.variationId,userAttributes:Wj(),experimentMetadata:{feature_id:e}}))}async function zj(e){let t=e.getPayload();if(!t?.features||Object.keys(t.features).length===0)return!1;lM.clear();let n={};for(let[e,r]of Object.entries(t.features)){let t=r;if(`value`in t&&!(`defaultValue`in t)?n[e]={...t,defaultValue:t.value}:n[e]=t,t.source===`experiment`&&t.experimentResult){let n=t.experimentResult,r=t.experiment;r?.key&&n.variationId!==void 0&&lM.set(e,{experimentId:r.key,variationId:n.variationId})}}await e.setPayload({...t,features:n}),uM.clear();for(let[e,t]of Object.entries(n)){let n=`value`in t?t.value:t.defaultValue;n!==void 0&&uM.set(e,n)}return!0}function Bj(){let e=Object.fromEntries(uM);Nu(G().cachedGrowthBookFeatures,e)||p_(t=>({...t,cachedGrowthBookFeatures:e}))}function Vj(e){if(!process.env.CLAUDE_CODE_DISABLE_LOCAL_GATES)return _M[e]}function Hj(){return process.env.CLAUDE_GB_ADAPTER_URL&&process.env.CLAUDE_GB_ADAPTER_KEY?!0:JT()}function Uj(){let e=process.env.ANTHROPIC_BASE_URL;if(e)try{let t=new URL(e).host;return t===`api.anthropic.com`?void 0:t}catch{return}}function Wj(){let e=Yy(),t=e.email;!t&&process.env.USER_TYPE===`ant`&&(t=G().oauthAccount?.emailAddress);let n=Uj();return{id:e.deviceId,sessionId:e.sessionId,deviceID:e.deviceId,platform:e.platform,...n&&{apiBaseUrlHost:n},...e.organizationUuid&&{organizationUUID:e.organizationUuid},...e.accountUuid&&{accountUUID:e.accountUuid},...e.userType&&{userType:e.userType},...e.subscriptionType&&{subscriptionType:e.subscriptionType},...e.rateLimitTier&&{rateLimitTier:e.rateLimitTier},...e.firstTokenTime&&{firstTokenTime:e.firstTokenTime},...t&&{email:t},...e.appVersion&&{appVersion:e.appVersion},...e.githubActionsMetadata&&{githubActionsMetadata:e.githubActionsMetadata}}}async function Gj(e,t,n){let r=jj();if(r&&e in r)return r[e];let i=Nj();if(i&&e in i)return i[e];if(!Hj()){let n=Vj(e);return n===void 0?t:n}let a=await yM();if(!a){let n=Vj(e);return n===void 0?t:n}let o;return o=uM.has(e)?uM.get(e):a.getFeatureValue(e,t),n&&Rj(e),process.env.USER_TYPE===`ant`&&N(`GrowthBook: getFeatureValue("${e}") = ${A(o)}`),o}async function Kj(e,t){return Gj(e,t,!0)}function qj(e,t){let n=jj();if(n&&e in n)return n[e];let r=Nj();if(r&&e in r)return r[e];if(!Hj()){let n=Vj(e);return n===void 0?t:n}let i=Vj(e);if(i!==void 0)return i;if(lM.has(e)?Rj(e):dM.add(e),uM.has(e))return uM.get(e);try{let t=G().cachedGrowthBookFeatures?.[e];if(t!==void 0)return t}catch{}return t}function Jj(e,t,n){return qj(e,t)}function Yj(e){let t=jj();if(t&&e in t)return!!t[e];let n=Nj();if(n&&e in n)return!!n[e];if(!Hj()){let t=Vj(e);return t===void 0?!1:!!t}lM.has(e)?Rj(e):dM.add(e);try{let t=G(),n=t.cachedGrowthBookFeatures?.[e];if(n!==void 0)return!!n;let r=t.cachedStatsigGates?.[e];if(r!==void 0)return r}catch{}let r=Vj(e);return r===void 0?!1:!!r}async function Xj(e){let t=jj();if(t&&e in t)return!!t[e];let n=Nj();if(n&&e in n)return!!n[e];if(!Hj())return!1;pM&&await pM;let r=G(),i=r.cachedStatsigGates?.[e];if(i!==void 0)return!!i;let a=r.cachedGrowthBookFeatures?.[e];return a===void 0?!1:!!a}async function Zj(e){let t=jj();if(t&&e in t)return!!t[e];let n=Nj();if(n&&e in n)return!!n[e];if(!Hj()){let t=Vj(e);return t===void 0?!1:!!t}return G().cachedGrowthBookFeatures?.[e]===!0?(lM.has(e)?Rj(e):dM.add(e),!0):Gj(e,!1,!0)}function Qj(){if(Hj())try{$j(),mM.emit(),pM=yM().catch(e=>(P(xn(e)),null)).finally(()=>{pM=null})}catch(e){P(xn(e))}}function $j(){nM(),oM&&(process.off(`beforeExit`,oM),oM=null),sM&&(process.off(`exit`,sM),sM=null),aM?.destroy(),aM=null,cM=!1,pM=null,lM.clear(),dM.clear(),fM.clear(),uM.clear(),vM.cache?.clear?.(),yM.cache?.clear?.(),hM=null,gM=!1}async function eM(){if(Hj())try{let e=await yM();if(!e)return;if(await e.refreshFeatures(),e!==aM){process.env.USER_TYPE===`ant`&&N(`GrowthBook: Skipping refresh processing for replaced client`);return}let t=await zj(e);if(e!==aM)return;process.env.USER_TYPE===`ant`&&N(`GrowthBook: Light refresh completed`),t&&(Bj(),mM.emit())}catch(e){P(xn(e))}}function tM(){Hj()&&(xM&&clearInterval(xM),xM=setInterval(()=>{eM()},bM),xM.unref?.(),SM||(SM=()=>{nM()},process.once(`beforeExit`,SM)))}function nM(){xM&&(clearInterval(xM),xM=null),SM&&(process.removeListener(`beforeExit`,SM),SM=null)}async function rM(e,t){return Kj(e,t)}function iM(e,t){return qj(e,t)}var aM,oM,sM,cM,lM,uM,dM,fM,pM,mM,hM,gM,_M,vM,yM,bM,xM,SM,CM=t((()=>{pc(),kd(),O(),jd(),Q_(),M(),kn(),Oj(),yr(),ti(),vn(),nb(),lE(),aM=null,oM=null,sM=null,cM=!1,lM=new Map,uM=new Map,dM=new Set,fM=new Set,pM=null,mM=Yr(),hM=null,gM=!1,_M={tengu_keybinding_customization_release:!0,tengu_streaming_tool_execution2:!0,tengu_kairos_cron:!0,tengu_amber_json_tools:!0,tengu_immediate_model_command:!0,tengu_basalt_3kr:!0,tengu_pebble_leaf_prune:!0,tengu_chair_sermon:!0,tengu_lodestone_enabled:!0,tengu_auto_background_agents:!0,tengu_fgts:!0,tengu_session_memory:!0,tengu_passport_quail:!0,tengu_moth_copse:!0,tengu_coral_fern:!0,tengu_chomp_inflection:!0,tengu_hive_evidence:!0,tengu_kairos_brief:!0,tengu_kairos_brief_config:{enable_slash_command:!0},tengu_sedge_lantern:!0,tengu_onyx_plover:{enabled:!0},tengu_willow_mode:`dialog`,tengu_turtle_carbon:!0,tengu_amber_stoat:!0,tengu_amber_flint:!0,tengu_slim_subagent_claudemd:!0,tengu_birch_trellis:!0,tengu_collage_kaleidoscope:!0,tengu_compact_cache_prefix:!0,tengu_kairos_assistant:!0,tengu_kairos_cron_durable:!0,tengu_attribution_header:!0,tengu_slate_prism:!0,tengu_review_bughunter_config:{enabled:!0},tengu_ccr_bundle_seed_enabled:!0},vM=p(()=>{if(!Hj())return null;let e=Wj(),t=Ad(),n=process.env.CLAUDE_GB_ADAPTER_URL||process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_GB_BASE_URL||`https://api.anthropic.com/`,r=!!(process.env.CLAUDE_GB_ADAPTER_URL&&process.env.CLAUDE_GB_ADAPTER_KEY);process.env.USER_TYPE===`ant`&&N(`GrowthBook: Creating client with clientKey=${t}, attributes: ${A(e)}`);let i=W()||nn()||k()?Ej():{headers:{},error:`trust not established`},a=r||!i.error;cM=a;let o=new dc({apiHost:n,clientKey:t,attributes:e,remoteEval:!r,...r?{}:{cacheKeyAttributes:[`id`,`organizationUUID`]},...i.error?{}:{apiHostRequestHeaders:i.headers},...process.env.USER_TYPE===`ant`?{log:(e,t)=>{N(`GrowthBook: ${e} ${A(t)}`)}}:{}});if(aM=o,!a)return{client:o,initialized:Promise.resolve()};let s=o.init({timeout:5e3}).then(async e=>{if(aM!==o){process.env.USER_TYPE===`ant`&&N(`GrowthBook: Skipping init callback for replaced client`);return}process.env.USER_TYPE===`ant`&&N(`GrowthBook initialized, source: ${e.source}, success: ${e.success}`);let t=await zj(o);if(aM===o){if(t){for(let e of dM)Rj(e);dM.clear(),Bj(),mM.emit()}if(process.env.USER_TYPE===`ant`){let e=o.getFeatures();if(e){let t=Object.keys(e);N(`GrowthBook loaded ${t.length} features: ${t.slice(0,10).join(`, `)}${t.length>10?`...`:``}`)}}}}).catch(e=>{process.env.USER_TYPE===`ant`&&P(xn(e))});return oM=()=>aM?.destroy(),sM=()=>aM?.destroy(),process.on(`beforeExit`,oM),process.on(`exit`,sM),{client:o,initialized:s}}),yM=p(async()=>{let e=vM();return!e||!cM&&(W()||nn()||k())&&!Ej().error&&(process.env.USER_TYPE===`ant`&&N(`GrowthBook: Auth became available after client creation, reinitializing`),$j(),e=vM(),!e)?null:(await e.initialized,tM(),e.client)}),bM=process.env.USER_TYPE===`ant`?1200*1e3:360*60*1e3,xM=null,SM=null}));export{Zk as $,eb as $a,hm as $c,MS as $i,xf as $l,eD as $n,av as $o,lT as $r,mg as $s,RO as $t,Cu as $u,IA as A,Ax as Aa,Bm as Ac,GC as Ai,Gf as Al,KD as An,Uv as Ao,hT as Ar,Zg as As,Fk as At,Pd as Au,uA as B,Ox as Ba,Am as Bc,iC as Bi,Nf as Bl,xD as Bn,jv as Bo,Hw as Br,Hg as Bs,Lk as Bt,ld as Bu,Ej as C,Jx as Ca,Km as Cc,LC as Ci,np as Cl,PO as Cn,ey as Co,ST as Cr,i_ as Cs,mA as Ct,Bd as Cu,Dj as D,zx as Da,Vm as Dc,kC as Di,Jf as Dl,vO as Dn,Jv as Do,yT as Dr,l_ as Ds,EA as Dt,Nd as Du,Oj as E,kx as Ea,Hm as Ec,$C as Ei,ep as El,fO as En,Yv as Eo,wT as Er,n_ as Es,OA as Et,Md as Eu,jA as F,Hx as Fa,Rm as Fc,bC as Fi,zf as Fl,LD as Fn,Tv as Fo,Yw as Fr,Fg as Fs,Hk as Ft,Cd as Fu,FA as G,fx as Ga,Cm as Gc,VS as Gi,Mf as Gl,uD as Gn,bv as Go,Ww as Gr,Yg as Gs,fk as Gt,ed as Gu,oA as H,Cx as Ha,Dm as Hc,oC as Hi,Hf as Hl,dD as Hn,Iv as Ho,cT as Hr,Gg as Hs,Wk as Ht,rd as Hu,nj as I,Px as Ia,km as Ic,dC as Ii,Bf as Il,PD as In,Ov as Io,Uw as Ir,Ng as Is,Gk as It,_d as Iu,$A as J,zb as Ja,um as Jc,kS as Ji,Cf as Jl,sD as Jn,Sv as Jo,fT as Jr,Ig as Js,ok as Jt,Iu as Ju,$k as K,px as Ka,Tm as Kc,jS as Ki,kf as Kl,mD as Kn,gv as Ko,Fw as Kr,Og as Ks,pk as Kt,Yu as Ku,Xk as L,Ux as La,Mm as Lc,fC as Li,Lf as Ll,FD as Ln,Mv as Lo,Kw as Lr,Mg as Ls,Bk as Lt,gd as Lu,dA as M,Lx as Ma,Fm as Mc,EC as Mi,qf as Ml,JD as Mn,Bv as Mo,qw as Mr,Vg as Ms,Ik as Mt,Od as Mu,gA as N,Nx as Na,Lm as Nc,TC as Ni,Uf as Nl,RD as Nn,Dv as No,zw as Nr,Eg as Ns,Rk as Nt,Dd as Nu,Kk as O,jx as Oa,Um as Oc,XC as Oi,Yf as Ol,YO as On,Qv as Oo,_T as Or,a_ as Os,AA as Ot,Id as Ou,SA as P,Rx as Pa,Im as Pc,vC as Pi,Vf as Pl,WD as Pn,Ev as Po,Jw as Pr,zg as Ps,Vk as Pt,wd as Pu,NA as Q,Eb as Qa,mm as Qc,FS as Qi,Of as Ql,$E as Qn,fv as Qo,sT as Qr,Cg as Qs,bO as Qt,wu as Qu,Qk as R,Tx as Ra,jm as Rc,sC as Ri,If as Rl,AD as Rn,Nv as Ro,Gw as Rr,H as Rs,Pk as Rt,hd as Ru,nM as S,Gx as Sa,qm as Sc,RC as Si,rp as Sl,hO as Sn,$v as So,TT as Sr,j_ as Ss,uj as St,Hd as Su,wj as T,Vx as Ta,Wm as Tc,OC as Ti,$f as Tl,GO as Tn,ty as To,xT as Tr,Qg as Ts,mj as Tt,Rd as Tu,Yk as U,yx as Ua,Np as Uc,$S as Ui,Rf as Ul,nD as Un,kv as Uo,Zw as Ur,Wg as Us,jk as Ut,nd as Uu,hj as V,Dx as Va,Nm as Vc,rC as Vi,Pf as Vl,wD as Vn,Av as Vo,Rw as Vr,U as Vs,Nk as Vt,cd as Vu,$ as W,wx as Wa,bm as Wc,hC as Wi,jf as Wl,hD as Wn,zv as Wo,eT as Wr,Ug as Ws,Mk as Wt,td as Wu,YA as X,Pb as Xa,gm as Xc,TS as Xi,mf as Xl,cD as Xn,_v as Xo,Iw as Xr,fg as Xs,CO as Xt,Pu as Xu,JA as Y,Rb as Ya,Kp as Yc,LS as Yi,yf as Yl,oD as Yn,wv as Yo,oT as Yr,ug as Ys,oO as Yt,Fu as Yu,Q as Z,Ob as Za,lm as Zc,DS as Zi,hf as Zl,lD as Zn,pv as Zo,Qw as Zr,dg as Zs,gO as Zt,Nu as Zu,Qj as _,Xx as _a,Zm as _c,uw as _i,dp as _l,XD as _n,hy as _o,UT as _r,Q_ as _s,WA as _t,zd as _u,Pj as a,BS as aa,qh as ac,tl as ad,jw as ai,Ep as al,ZD as an,Ky as ao,xE as ar,M_ as as,nA as at,bf as au,Ij as b,Yx as ba,Gm as bc,tw as bi,sp as bl,TO as bn,ry as bo,OT as br,k_ as bs,wA as bt,Zd as bu,iM as c,vS as ca,kh as cc,Tw as ci,xp as cl,eO as cn,Py as co,WT as cr,x_ as cs,tj as ct,df as cu,Kj as d,dS as da,bh as dc,ww as di,mp as dl,AO as dn,Dy as do,JT as dr,L_ as ds,vA as dt,cf as du,QS as ea,pg as ec,bu as ed,rT as ei,Em as el,QD as en,tb as eo,TE as er,tv as es,HA as et,wf as eu,Fj as f,fS as fa,Sh as fc,xw as fi,pp as fl,jO as fn,dy as fo,XT as fr,I_ as fs,UA as ft,$d as fu,Aj as g,oS as ga,sh as gc,yw as gi,cp as gl,DO as gn,Ty as go,qT as gr,R_ as gs,GA as gt,Vd as gu,yM as h,lS as ha,Qm as hc,hw as hi,ap as hl,rk as hn,ly as ho,GT as hr,b_ as hs,qA as ht,Kd as hu,Lj as i,OS as ia,Wh as ic,cl as id,iT as ii,Ap as il,XO as in,Gy as io,jE as ir,w_ as is,Jk as it,pf as iu,yA as j,Ix as ja,Pm as jc,qC as ji,Wf as jl,GD as jn,Hv as jo,pT as jr,Kg as js,zk as jt,kd as ju,aA as k,Mx as ka,zm as kc,KC as ki,Xf as kl,yO as kn,K as ko,gT as kr,Xg as ks,rj as kt,Fd as ku,qj as l,J as la,Ah as lc,Cw as li,_p as ll,OO as ln,Fy as lo,lE as lr,G as ls,DA as lt,rf as lu,CM as m,aS as ma,yh as mc,bw as mi,up as ml,EO as mn,cy as mo,eE as mr,Z_ as ms,VA as mt,Qd as mu,Xj as n,IS as na,ag as nc,Ul as nd,nT as ni,jp as nl,sO as nn,nb as no,CE as nr,V_ as ns,Cj as nt,ff as nu,Uj as o,zS as oa,Gh as oc,Ow as oi,Dp as ol,X as on,By as oo,SE as or,N_ as os,iA as ot,Sf as ou,Mj as p,sS as pa,vh as pc,Nw as pi,gp as pl,kO as pn,gy as po,QT as pr,P_ as ps,QA as pt,ef as pu,BA as q,Bb as qa,am as qc,ES as qi,_f as ql,gD as qn,yv as qo,Lw as qr,qg as qs,Ak as qt,Ju as qu,Yj as r,SS as ra,Kh as rc,Wl as rd,$w as ri,Op as rl,uO as rn,Jy as ro,AE as rr,W as rs,zA as rt,Ef as ru,rM as s,AS as sa,Oh as sc,Mw as si,bp as sl,SO as sn,zy as so,XE as sr,O_ as ss,Z as st,uf as su,Zj as t,CS as ta,cg as tc,yu as td,Xw as ti,Mp as tl,$D as tn,qy as to,wE as tr,dv as ts,RA as tt,Tf as tu,Jj as u,xS as ua,xh as uc,Ew as ui,vp as ul,FO as un,Ey as uo,$T as ur,m_ as us,KA as ut,tf as uu,eM as v,nS as va,th as vc,ow as vi,fp as vl,rO as vn,fy as vo,VT as vr,A_ as vs,XA as vt,Wd as vu,Tj as w,Bx as wa,Xm as wc,jC as wi,ip as wl,MO as wn,ny as wo,vT as wr,c_ as ws,xA as wt,Gd as wu,tM as x,iS as xa,Jm as xc,iw as xi,tp as xl,LO as xn,sy as xo,PT as xr,p_ as xs,CA as xt,Ud as xu,$j as y,rS as ya,nh as yc,dw as yi,lp as yl,aO as yn,ay as yo,BT as yr,F_ as ys,fA as yt,Ld as yu,sA as z,Ex as za,Om as zc,mC as zi,Ff as zl,ED as zn,Pv as zo,Vw as zr,Ag as zs,Uk as zt,md as zu};