claude-code-best 2.5.0 → 2.6.5

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 (614) hide show
  1. package/dist/chunks/AddWorkspaceDirectory-BYyM_V0q.js +1 -0
  2. package/dist/chunks/App-BboadKdn.js +1 -0
  3. package/dist/chunks/ApproveApiKey-BLp4742y.js +1 -0
  4. package/dist/chunks/ApproveApiKey-DiEe4eui.js +1 -0
  5. package/dist/chunks/AssistantSessionChooser-B88DM0Oq.js +1 -0
  6. package/dist/chunks/BackgroundTasksDialog-ByraVuXh.js +2 -0
  7. package/dist/chunks/BypassPermissionsModeDialog-BDvmz12S.js +1 -0
  8. package/dist/chunks/ClaudeInChromeOnboarding-B6XNhFqq.js +1 -0
  9. package/dist/chunks/ClaudeMdExternalIncludesDialog-B4ocUjev.js +1 -0
  10. package/dist/chunks/ClaudeMdExternalIncludesDialog-BNhlq7_K.js +1 -0
  11. package/dist/chunks/ConsoleOAuthFlow-BvaB9b0y.js +1 -0
  12. package/dist/chunks/DesktopHandoff-S-w4bs5T.js +1 -0
  13. package/dist/chunks/DevChannelsDialog-BljR0X9X.js +1 -0
  14. package/dist/chunks/Dialog-DYFGqyDs.js +1 -0
  15. package/dist/chunks/DiffDialog-BhQ2QaLW.js +3 -0
  16. package/dist/chunks/Doctor-BXb0qv6n.js +3 -0
  17. package/dist/chunks/Doctor-C5DYPEGl.js +1 -0
  18. package/dist/chunks/ExitFlow-CSBDxw9H.js +2 -0
  19. package/dist/chunks/Feedback-DwHzc4UT.js +2 -0
  20. package/dist/chunks/Grove-DSXRnXKv.js +11 -0
  21. package/dist/chunks/Grove-DnTo982-.js +1 -0
  22. package/dist/chunks/HybridTransport-CuT3KI5e.js +4 -0
  23. package/dist/chunks/ITermBackend-mokGZVH_.js +1 -0
  24. package/dist/chunks/InProcessTransport-DB52dh4f.js +1 -0
  25. package/dist/chunks/InvalidConfigDialog-Bi4RKYlk.js +1 -0
  26. package/dist/chunks/InvalidSettingsDialog-0zKo4-so.js +1 -0
  27. package/dist/chunks/ListItem-OFARanN7.js +1 -0
  28. package/dist/chunks/MCPConnectionManager-DYGoS1Ht.js +1 -0
  29. package/dist/chunks/McpParsingWarnings-EzgsOoHw.js +1 -0
  30. package/dist/chunks/MessageSelector-DTmUuEKJ.js +3 -0
  31. package/dist/chunks/Messages-DWiKTx5o.js +11 -0
  32. package/dist/chunks/Onboarding-odmthwzz.js +1 -0
  33. package/dist/chunks/OverageCreditUpsell-Cpk_5Lv0.js +1 -0
  34. package/dist/chunks/PermissionDialog-5MlJf7ew.js +1 -0
  35. package/dist/chunks/PluginSettings-eYcWehI8.js +17 -0
  36. package/dist/chunks/PressEnterToContinue-BdA9zDGs.js +1 -0
  37. package/dist/chunks/PromptInputFooterSuggestions-DrrkNOuS.js +1 -0
  38. package/dist/chunks/PromptInputHelpMenu-DMsF4D6d.js +1 -0
  39. package/dist/chunks/QueryEngine-C_KZts4y.js +1 -0
  40. package/dist/chunks/REPL-C6YR0VKU.js +1 -0
  41. package/dist/chunks/REPL-DzHz-LOY.js +97 -0
  42. package/dist/chunks/RemoteCallout-CnpCWRPk.js +1 -0
  43. package/dist/chunks/RemoteSessionManager-OWg_Yccq.js +2 -0
  44. package/dist/chunks/ResumeConversation-BktSnsCm.js +1 -0
  45. package/dist/chunks/SSETransport-BpnapvlK.js +4 -0
  46. package/dist/chunks/SearchBox-DfOmUoaI.js +1 -0
  47. package/dist/chunks/SearchExtraToolsTool-CqFD8vVS.js +1 -0
  48. package/dist/chunks/SentryErrorBoundary-BUirJRWU.js +1 -0
  49. package/dist/chunks/SentryErrorBoundary-C-NlfQZw.js +2 -0
  50. package/dist/chunks/Settings-vfFvcweR.js +2 -0
  51. package/dist/chunks/TeleportProgress-CYXay2ZL.js +1 -0
  52. package/dist/chunks/TeleportRepoMismatchDialog-_zbZTvcJ.js +1 -0
  53. package/dist/chunks/TeleportResumeWrapper-DiHQeZIM.js +1 -0
  54. package/dist/chunks/ThemePicker-BRh027fA.js +1 -0
  55. package/dist/chunks/TmuxBackend-BaX2U7iZ.js +9 -0
  56. package/dist/chunks/TrustDialog-CVbzrv6g.js +1 -0
  57. package/dist/chunks/TungstenTool-C5IqKVr0.js +1 -0
  58. package/dist/chunks/TungstenTool-V-Bwqlx3.js +1 -0
  59. package/dist/chunks/ValidationErrorsList-CdCUgfIl.js +2 -0
  60. package/dist/chunks/WelcomeV2-DCXcYd2x.js +1 -0
  61. package/dist/chunks/WindowsTerminalBackend-BE9NX5IH.js +2 -0
  62. package/dist/chunks/add-dir-ldGd3Ppz.js +1 -0
  63. package/dist/chunks/agentDisplay-CVnAeURF.js +1 -0
  64. package/dist/chunks/agents-C08NzRZx.js +2 -0
  65. package/dist/chunks/agents-DH5fmbVw.js +103 -0
  66. package/dist/chunks/ajv-B_OpU_Uh.js +8 -0
  67. package/dist/chunks/analytics-DqMQntaB.js +1 -0
  68. package/dist/chunks/ant-DJren1Aa.js +1 -0
  69. package/dist/chunks/api-6tcwJlf_.js +1 -0
  70. package/dist/chunks/api-CGOR_Xfl.js +1 -0
  71. package/dist/chunks/asciicast-aoKFhc7C.js +1 -0
  72. package/dist/chunks/asciicast-o5Zg4dJt.js +4 -0
  73. package/dist/chunks/assistant-BlzrMSkM.js +1 -0
  74. package/dist/chunks/assistant-CwbhlCM-.js +1 -0
  75. package/dist/chunks/assistant-aWkDcurV.js +1 -0
  76. package/dist/chunks/attributionHooks-PygdohOh.js +1 -0
  77. package/dist/chunks/attributionTrailer-BpvhXgRP.js +1 -0
  78. package/dist/chunks/auth-CSB2RDKF.js +1 -0
  79. package/dist/chunks/auth-GxZhOvQ1.js +1 -0
  80. package/dist/chunks/autoMode-CWvZs1jO.js +45 -0
  81. package/dist/chunks/autoModeDenials-Cp6VFdsm.js +1 -0
  82. package/dist/chunks/autonomy-BkVcSMCZ.js +19 -0
  83. package/dist/chunks/autonomy-DK42aJYt.js +1 -0
  84. package/dist/chunks/autonomyPanel-Cn4IhXgE.js +1 -0
  85. package/dist/chunks/axios-DLnc2dVy.js +1 -0
  86. package/dist/chunks/axios-DhfaybwJ.js +12 -0
  87. package/dist/chunks/backgroundHousekeeping-BIZTAYho.js +17 -0
  88. package/dist/chunks/backgroundHousekeeping-Csh58CxV.js +1 -0
  89. package/dist/chunks/banner-CVXH2xts.js +2 -0
  90. package/dist/chunks/base64-js-DIVSFswY.js +1 -0
  91. package/dist/chunks/bedrockClient-qi1-JCOK.js +15 -0
  92. package/dist/chunks/bg-DK0E4ZtW.js +9 -0
  93. package/dist/chunks/bg-Dbh5z3Y8.js +1 -0
  94. package/dist/chunks/branch-juox_fko.js +3 -0
  95. package/dist/chunks/break-cache-ByJ7U2Ts.js +8 -0
  96. package/dist/chunks/bridge-DudsCZkh.js +2 -0
  97. package/dist/chunks/bridgeConfig-D4tpc568.js +1 -0
  98. package/dist/chunks/bridgeConfig-lRZfQqmA.js +1 -0
  99. package/dist/chunks/bridgeEnabled-B8_c_Ppq.js +1 -0
  100. package/dist/chunks/bridgeEnabled-D2IykaHE.js +1 -0
  101. package/dist/chunks/bridgeMain-C5RDihlX.js +68 -0
  102. package/dist/chunks/bridgeMain-D7_lg2iJ.js +1 -0
  103. package/dist/chunks/bridgeMessaging-CqNURC4-.js +1 -0
  104. package/dist/chunks/bridgePointer-FvAMj3re.js +1 -0
  105. package/dist/chunks/browser-fLRXxIsQ.js +1 -0
  106. package/dist/chunks/btw-DKlE3Dea.js +1 -0
  107. package/dist/chunks/buddy-DQYgHR63.js +3 -0
  108. package/dist/chunks/bundledMode-kSQejuY4.js +1 -0
  109. package/dist/chunks/bypassPermissionsKillswitch-Bof-UtM-.js +1 -0
  110. package/dist/chunks/caches-B5QZDncQ.js +3 -0
  111. package/dist/chunks/caches-dGk7xsDu.js +1 -0
  112. package/dist/chunks/capacityWake-BXlUpptF.js +1 -0
  113. package/dist/chunks/ccrClient-BaWg4E9-.js +1 -0
  114. package/dist/chunks/ccshareResume-DWLjTF22.js +1 -0
  115. package/dist/chunks/changeDetector-DoLfg8a6.js +1 -0
  116. package/dist/chunks/channelNotification-B7A-9DIl.js +1 -0
  117. package/dist/chunks/channelNotification-DDErroWn.js +1 -0
  118. package/dist/chunks/chokidar-BcI3rIKm.js +1 -0
  119. package/dist/chunks/chokidar-SzksMqYp.js +1 -0
  120. package/dist/chunks/chrome-jMAks7-w.js +1 -0
  121. package/dist/chunks/chromeNativeHost-4U39yLtd.js +1 -0
  122. package/dist/chunks/chunk-DR8-3Aex.js +1 -0
  123. package/dist/chunks/classPrivateFieldSet2-EAQNhHs8.js +1 -0
  124. package/dist/chunks/claudeDesktop-D0S1eq1F.js +1 -0
  125. package/dist/chunks/cleanup-Bg_gFgcj.js +1 -0
  126. package/dist/chunks/clear-OudnCGa7.js +1 -0
  127. package/dist/chunks/cliLaunch-BQa48gsr.js +1 -0
  128. package/dist/chunks/client-CPn1wQyc.js +7 -0
  129. package/dist/chunks/client-DxDmXXTh.js +1 -0
  130. package/dist/chunks/client-_sjL0I7A.js +35 -0
  131. package/dist/chunks/color-DG_R5-hl.js +1 -0
  132. package/dist/chunks/color-convert-ULbeSgNC.js +1 -0
  133. package/dist/chunks/commands-BWIOEBPs.js +1 -0
  134. package/dist/chunks/commitAttribution-BA4fcbHf.js +1 -0
  135. package/dist/chunks/commitAttribution-C22a3OCi.js +2 -0
  136. package/dist/chunks/common-B379wT22.js +1 -0
  137. package/dist/chunks/common-B_BC3eMY.js +1 -0
  138. package/dist/chunks/common-CMCv4N_v.js +1 -0
  139. package/dist/chunks/compact-BWvnb4or.js +3 -0
  140. package/dist/chunks/companion-Bkn2lSLj.js +1 -0
  141. package/dist/chunks/completionCache-DHfUBBMH.js +1 -0
  142. package/dist/chunks/completionCache-DORrtxkS.js +4 -0
  143. package/dist/chunks/computerUseLock-BjoDJH2h.js +1 -0
  144. package/dist/chunks/config-BvpTbJ5p.js +1 -0
  145. package/dist/chunks/config-D-dzD6n-.js +1 -0
  146. package/dist/chunks/connectHeadless-CwsFt-Mh.js +1 -0
  147. package/dist/chunks/constants-41VpZw2G.js +1 -0
  148. package/dist/chunks/context-DzNahdyP.js +1 -0
  149. package/dist/chunks/context-noninteractive-CM1-lUSe.js +1 -0
  150. package/dist/chunks/context-noninteractive-yiyJriiw.js +54 -0
  151. package/dist/chunks/controlMessageCompat-BJhFiS7u.js +1 -0
  152. package/dist/chunks/conversation-DKlz47xf.js +1 -0
  153. package/dist/chunks/conversation-cUxdb8MN.js +1 -0
  154. package/dist/chunks/copy-9k9JPRqW.js +7 -0
  155. package/dist/chunks/createSSHSession-BZf-Loo5.js +6 -0
  156. package/dist/chunks/createSession-BuJcoBAj.js +1 -0
  157. package/dist/chunks/createSession-kiTHYXSL.js +1 -0
  158. package/dist/chunks/cron-DiW7eIPP.js +1 -0
  159. package/dist/chunks/cronJitterConfig-CYP7yrQu.js +6 -0
  160. package/dist/chunks/crossProjectResume-BJisir9Z.js +40 -0
  161. package/dist/chunks/cwd--iizewsn.js +1 -0
  162. package/dist/chunks/cwd-BgpSJxd7.js +1 -0
  163. package/dist/chunks/daemon-VYRit6Aq.js +2 -0
  164. package/dist/chunks/dangerousBackend-BU_PHGR2.js +1 -0
  165. package/dist/chunks/datadog-Bg-zL-i7.js +1 -0
  166. package/dist/chunks/datadog-CVeFkaQu.js +1 -0
  167. package/dist/chunks/debug-DM5ezCBS.js +1 -0
  168. package/dist/chunks/debug-UI3T040K.js +5 -0
  169. package/dist/chunks/debugUtils-BBMFODKH.js +1 -0
  170. package/dist/chunks/defineProperty-80gRi2ZW.js +1 -0
  171. package/dist/chunks/desktop-DpaStjc-.js +1 -0
  172. package/dist/chunks/detached-D300jlhj.js +5 -0
  173. package/dist/chunks/detect-libc-DNuQfUvI.js +1 -0
  174. package/dist/chunks/detectRepository-CBk3S2zv.js +1 -0
  175. package/dist/chunks/detectRepository-DCTvg4p0.js +1 -0
  176. package/dist/chunks/detection-CQsNad64.js +1 -0
  177. package/dist/chunks/detection-DJ-vTbBf.js +1 -0
  178. package/dist/chunks/diff-N_VSBo3Z.js +1 -0
  179. package/dist/chunks/directoryCompletion-DP_4B1GL.js +1 -0
  180. package/dist/chunks/dist-CanSxOZ1.js +5 -0
  181. package/dist/chunks/dist-Cg1a1Exw.js +29 -0
  182. package/dist/chunks/dist-Q7YNoZ0H.js +20 -0
  183. package/dist/chunks/dist-es-4z5T3Jzm.js +1 -0
  184. package/dist/chunks/dist-es-B2jg52tM2.js +1 -0
  185. package/dist/chunks/dist-es-B6OXHQ1S.js +1 -0
  186. package/dist/chunks/dist-es-B8NEy5hc.js +1 -0
  187. package/dist/chunks/dist-es-BVGppqE4.js +1 -0
  188. package/dist/chunks/dist-es-Bcw5GZko.js +1 -0
  189. package/dist/chunks/dist-es-BoIJpncb.js +9 -0
  190. package/dist/chunks/dist-es-Bu_Fshi1.js +1 -0
  191. package/dist/chunks/dist-es-C-1vn4OP2.js +1 -0
  192. package/dist/chunks/dist-es-C41b_0B5.js +1 -0
  193. package/dist/chunks/dist-es-CCZYybbG2.js +1 -0
  194. package/dist/chunks/dist-es-CLK1mey-.js +1 -0
  195. package/dist/chunks/dist-es-CQz2aNf72.js +1 -0
  196. package/dist/chunks/dist-es-CSfI8B8l.js +1 -0
  197. package/dist/chunks/dist-es-CUZBYppo.js +1 -0
  198. package/dist/chunks/dist-es-CZkzHpjF.js +1 -0
  199. package/dist/chunks/dist-es-Cbf0_D8d.js +5 -0
  200. package/dist/chunks/dist-es-ChHe-SVL.js +1 -0
  201. package/dist/chunks/dist-es-ClYOf0My.js +1 -0
  202. package/dist/chunks/dist-es-D-kJbj4A2.js +1 -0
  203. package/dist/chunks/dist-es-D1LN6CJd.js +1 -0
  204. package/dist/chunks/dist-es-DC1sC3ph.js +1 -0
  205. package/dist/chunks/dist-es-DGn8uOwQ2.js +1 -0
  206. package/dist/chunks/dist-es-DK5fTeKM2.js +1 -0
  207. package/dist/chunks/dist-es-DN7otr6F.js +1 -0
  208. package/dist/chunks/dist-es-DPM0mPK5.js +1 -0
  209. package/dist/chunks/dist-es-DqZAh3nG.js +1 -0
  210. package/dist/chunks/dist-es-DuAZyxJ02.js +5 -0
  211. package/dist/chunks/dist-es-HVQrM0oE.js +1 -0
  212. package/dist/chunks/dist-es-OVleIB54.js +1 -0
  213. package/dist/chunks/dist-es-UAs0rdXg.js +1 -0
  214. package/dist/chunks/dist-es-WvMMuHmx2.js +1 -0
  215. package/dist/chunks/dist-es-fjXft-jH.js +1 -0
  216. package/dist/chunks/dist-es-hdN_ShpZ.js +3 -0
  217. package/dist/chunks/dist-es-neiUvMJb.js +1 -0
  218. package/dist/chunks/dist-es-yMYpDtui2.js +1 -0
  219. package/dist/chunks/dist-es-zjcbuB72.js +1 -0
  220. package/dist/chunks/distRoot-CcxmnzqQ.js +1 -0
  221. package/dist/chunks/doctor-CUWjbh1X.js +1 -0
  222. package/dist/chunks/earlyInput-JGJo1zcC.js +1 -0
  223. package/dist/chunks/earlyInput-tRkbxFv2.js +2 -0
  224. package/dist/chunks/effort-loH1TUvE.js +9 -0
  225. package/dist/chunks/entry-D58E-E6Y.js +14 -0
  226. package/dist/chunks/env-chR0gV31.js +1 -0
  227. package/dist/chunks/envLessBridgeConfig-CT8sdmFu.js +1 -0
  228. package/dist/chunks/envLessBridgeConfig-SPEr9oqO.js +1 -0
  229. package/dist/chunks/envUtils-BWeoiL4Y.js +1 -0
  230. package/dist/chunks/escHotkey-Cyz0yyh1.js +259 -0
  231. package/dist/chunks/esm--xjzB1hI.js +1 -0
  232. package/dist/chunks/esm-B2HIF0XY.js +1 -0
  233. package/dist/chunks/esm-BGQPWnJy.js +1 -0
  234. package/dist/chunks/esm-C-1qL9Mn.js +1 -0
  235. package/dist/chunks/esm-C3jcs1DH.js +1 -0
  236. package/dist/chunks/esm-C97WL9nC.js +1 -0
  237. package/dist/chunks/esm-CIL-SKM8.js +1 -0
  238. package/dist/chunks/esm-CJlBxjtx.js +1 -0
  239. package/dist/chunks/esm-CsGLyWmS.js +56 -0
  240. package/dist/chunks/esm-DQHmDm-H.js +1 -0
  241. package/dist/chunks/esm-DcdOXSzi.js +1 -0
  242. package/dist/chunks/esm-DhNYgGTV.js +1 -0
  243. package/dist/chunks/esm-DxPW7qPs.js +1 -0
  244. package/dist/chunks/esm-FBUWr3vI.js +1 -0
  245. package/dist/chunks/esm-QgL6y---.js +10 -0
  246. package/dist/chunks/esm-v0kPjgVS.js +1 -0
  247. package/dist/chunks/esm-vIn-YV_h.js +1 -0
  248. package/dist/chunks/event-streams-BV7ngMXu.js +1 -0
  249. package/dist/chunks/eventLoopStallDetector-Dnh1fc31.js +1 -0
  250. package/dist/chunks/execAsync-BkA6ogic.js +1 -0
  251. package/dist/chunks/execFileNoThrow-CuQN1sz8.js +1 -0
  252. package/dist/chunks/execSyncWrapper-C2XQnFVo.js +1 -0
  253. package/dist/chunks/execa-CGue6Z3n.js +34 -0
  254. package/dist/chunks/executor-4EeD8GNm.js +1561 -0
  255. package/dist/chunks/executor-BHEuNh5F.js +1 -0
  256. package/dist/chunks/exit-D-tuPpbx.js +1 -0
  257. package/dist/chunks/exit-_obETqBv.js +2 -0
  258. package/dist/chunks/export-BIZ_SPXJ.js +2 -0
  259. package/dist/chunks/exportRenderer-CWPSMaqM.js +1 -0
  260. package/dist/chunks/extra-usage-CCMwIa85.js +1 -0
  261. package/dist/chunks/extra-usage-core-BNW4VT7o.js +1 -0
  262. package/dist/chunks/extra-usage-noninteractive-B_WjXO1E.js +1 -0
  263. package/dist/chunks/extra-usage-rdJ7ecEb.js +1 -0
  264. package/dist/chunks/extraUsage-CNMMTNJi.js +1 -0
  265. package/dist/chunks/extractMemories-BrvZVsmM.js +1 -0
  266. package/dist/chunks/fast-CG1v3fRr.js +1 -0
  267. package/dist/chunks/fast-CLKKsx2H.js +1 -0
  268. package/dist/chunks/featureCheck-Cm0YNDXO.js +1 -0
  269. package/dist/chunks/featureCheck-p7OeCYzj.js +1 -0
  270. package/dist/chunks/feedback-CG4mS_-B.js +1 -0
  271. package/dist/chunks/figures-gfT9mM8P.js +1 -0
  272. package/dist/chunks/fileStateCache-C7-TxF8G.js +1 -0
  273. package/dist/chunks/files-DYvAZGxp.js +2 -0
  274. package/dist/chunks/firstPartyEventLogger-Y_jAnHoR.js +1 -0
  275. package/dist/chunks/flushGate-COPcye5f.js +1 -0
  276. package/dist/chunks/foundry-sdk-BFN5VDFQ.js +1 -0
  277. package/dist/chunks/fpsMetrics-DeezdcwV.js +1 -0
  278. package/dist/chunks/fuse-Ch_OAlm3.js +1 -0
  279. package/dist/chunks/gates-CSHuXnUx.js +1 -0
  280. package/dist/chunks/gates-CSKxLmMJ.js +1 -0
  281. package/dist/chunks/gemini-B3uSLiNp.js +1 -0
  282. package/dist/chunks/generateRecap-D7rG3jIm.js +1 -0
  283. package/dist/chunks/generateSessionName-zbqanivg.js +1 -0
  284. package/dist/chunks/genericProcessUtils-BGvcwuPt.js +23 -0
  285. package/dist/chunks/getMachineId-bsd-BMtYGBUL.js +1 -0
  286. package/dist/chunks/getMachineId-darwin-CiLdFH7z.js +2 -0
  287. package/dist/chunks/getMachineId-linux-Cr27rIeY.js +1 -0
  288. package/dist/chunks/getMachineId-unsupported-ceiBLwAN.js +1 -0
  289. package/dist/chunks/getMachineId-win-DFTmsQHq.js +1 -0
  290. package/dist/chunks/git-CN3qtTb_.js +6 -0
  291. package/dist/chunks/git-D23Mzu_K.js +1 -0
  292. package/dist/chunks/githubRepoPathMapping-B04nEUDG.js +1 -0
  293. package/dist/chunks/graceful-fs-Cgc0rjGF.js +2 -0
  294. package/dist/chunks/grok-CDOpos8E.js +1 -0
  295. package/dist/chunks/growthbook-C_EY78Sn.js +1 -0
  296. package/dist/chunks/hash-BRmOQc3c.js +1 -0
  297. package/dist/chunks/heapdump-CpmhJ55b.js +5 -0
  298. package/dist/chunks/help-EHn2neTv.js +1 -0
  299. package/dist/chunks/hooks-BFdX17Za.js +1 -0
  300. package/dist/chunks/hooks-BV6HqbU4.js +79 -0
  301. package/dist/chunks/hostAdapter-_SmFAVNf.js +1 -0
  302. package/dist/chunks/hostGuard-zim_4F9V.js +1 -0
  303. package/dist/chunks/httpAuthSchemes-Wq4XWeLL.js +13 -0
  304. package/dist/chunks/ide-DkN0KdTR.js +2 -0
  305. package/dist/chunks/inboundAttachments-BVUunfAX.js +1 -0
  306. package/dist/chunks/inboundAttachments-DnGQw7Pf.js +1 -0
  307. package/dist/chunks/index.min-BJnb9GQI.js +1 -0
  308. package/dist/chunks/initReplBridge-tPRGPBq7.js +1 -0
  309. package/dist/chunks/insights-Bs9kJDG6.js +822 -0
  310. package/dist/chunks/install-CFX_ph9z.js +1 -0
  311. package/dist/chunks/install-github-app-CvRjY1Wi.js +147 -0
  312. package/dist/chunks/install-slack-app-DjhnVSe0.js +1 -0
  313. package/dist/chunks/instinctParser-DHMa8xa0.js +1 -0
  314. package/dist/chunks/instrumentation-c5zlOWom.js +12 -0
  315. package/dist/chunks/intl-Pse97ORk.js +1 -0
  316. package/dist/chunks/isObject-DaxDnPKm.js +1 -0
  317. package/dist/chunks/isSymbol-Dp3irZaY.js +1 -0
  318. package/dist/chunks/job-3QwLq609.js +2 -0
  319. package/dist/chunks/json-bigint-OxRwRvup.js +8 -0
  320. package/dist/chunks/jsx-runtime-D-D469L8.js +1 -0
  321. package/dist/chunks/jws-2vqRyZtR.js +3 -0
  322. package/dist/chunks/jwtUtils-CpXwh_du.js +1 -0
  323. package/dist/chunks/keybindings-7mDm3UKD.js +2 -0
  324. package/dist/chunks/lang-DyyjY20G.js +1 -0
  325. package/dist/chunks/language-CPRGmY8Q.js +1 -0
  326. package/dist/chunks/language-Cf6bMI4N.js +1 -0
  327. package/dist/chunks/launchAgentsPlatform-CpsMsTqQ.js +1 -0
  328. package/dist/chunks/launchAutofixPr-D9h6YAZY.js +2 -0
  329. package/dist/chunks/launchCommand-Du91jxMC.js +1 -0
  330. package/dist/chunks/launchLocalMemory-DlYQcEQJ.js +3 -0
  331. package/dist/chunks/launchLocalVault-CP0AyPjj.js +3 -0
  332. package/dist/chunks/launchMemoryStores-BHoDFkJ5.js +1 -0
  333. package/dist/chunks/launchOnboarding-CFTNXcnc.js +8 -0
  334. package/dist/chunks/launchSchedule-5KQr6x_A.js +1 -0
  335. package/dist/chunks/launchSkillStore-D0yGuE68.js +1 -0
  336. package/dist/chunks/launchTeleport-DRKnXOwY.js +3 -0
  337. package/dist/chunks/launchVault-XA-zAswX.js +1 -0
  338. package/dist/chunks/lazySchema-2sOku3cX.js +1 -0
  339. package/dist/chunks/lib-B4Q0Nrpb.js +14 -0
  340. package/dist/chunks/lib-Ca3QWJjN.js +2 -0
  341. package/dist/chunks/lib-inCisXen.js +8 -0
  342. package/dist/chunks/loadAgentsDir-DCyiY0MN.js +1 -0
  343. package/dist/chunks/loadAgentsDir-DI1a76pd.js +4601 -0
  344. package/dist/chunks/loadPluginHooks-C0Ei-0E2.js +1 -0
  345. package/dist/chunks/loadSso-sDs471GC.js +1 -0
  346. package/dist/chunks/localSearch-CDOJNc_E.js +1 -0
  347. package/dist/chunks/localSearch-MBx7KzC2.js +1 -0
  348. package/dist/chunks/lockfile-DBwdlC3K.js +1 -0
  349. package/dist/chunks/log-CzsijfHZ.js +1 -0
  350. package/dist/chunks/login-D8UKKaud.js +1 -0
  351. package/dist/chunks/login-nwTOoyxv.js +1 -0
  352. package/dist/chunks/logoV2Utils-DDUoPClc.js +1 -0
  353. package/dist/chunks/logout-B0BjqlGi.js +1 -0
  354. package/dist/chunks/magicDocs-CmUlOWjI.js +57 -0
  355. package/dist/chunks/main-C6be1KFk.js +31 -0
  356. package/dist/chunks/main-CeG_nUsC.js +1108 -0
  357. package/dist/chunks/mappers-CJ8IO1o1.js +1 -0
  358. package/dist/chunks/mcp-CanCqnch.js +2 -0
  359. package/dist/chunks/mcp-Dq0kxZFx.js +6 -0
  360. package/dist/chunks/mcp-zbxZM9BP.js +1 -0
  361. package/dist/chunks/mcpServer-DPHQVYdC.js +1 -0
  362. package/dist/chunks/mcpServer-lIneUZ5p.js +1 -0
  363. package/dist/chunks/memoize-DNnuA2aU.js +1 -0
  364. package/dist/chunks/memoize-DxwLawI2.js +1 -0
  365. package/dist/chunks/memory-BcWBkKV8.js +1 -0
  366. package/dist/chunks/mobile-umu5P0cM.js +2 -0
  367. package/dist/chunks/modalContext-CmSKRyea.js +1 -0
  368. package/dist/chunks/model-DJLzVvcF.js +1 -0
  369. package/dist/chunks/model-H3rtl6eR.js +1 -0
  370. package/dist/chunks/normalization-Cox8C0dP.js +1 -0
  371. package/dist/chunks/oauth-CdZEzMww.js +1 -0
  372. package/dist/chunks/oauth-CmensepG.js +1 -0
  373. package/dist/chunks/observationStore-tvkldXUo.js +4 -0
  374. package/dist/chunks/onChangeAppState-Dxbl8fvk.js +1 -0
  375. package/dist/chunks/open-CDditBQ-.js +1 -0
  376. package/dist/chunks/openai-DkYK4THc.js +10 -0
  377. package/dist/chunks/openaiShared-D5lOejS1.js +16 -0
  378. package/dist/chunks/output-style-XDb9-2Kk.js +1 -0
  379. package/dist/chunks/overageCreditGrant-DLKadMYU.js +1 -0
  380. package/dist/chunks/p-map-9Ud1LOrJ.js +1 -0
  381. package/dist/chunks/p-map-D7WEmnBE.js +1 -0
  382. package/dist/chunks/package-BhL7chzt.js +1 -0
  383. package/dist/chunks/panel-ByW1omJn.js +1 -0
  384. package/dist/chunks/panel-Bz_8td5D.js +1 -0
  385. package/dist/chunks/parseConnectUrl-BS6i9JPo.js +1 -0
  386. package/dist/chunks/parser-CmngCwjB.js +1 -0
  387. package/dist/chunks/parser-SWIZo39J.js +1 -0
  388. package/dist/chunks/passes-BIfuerjL.js +1 -0
  389. package/dist/chunks/path-C4kbwvSH.js +1 -0
  390. package/dist/chunks/paths-BBvuDQl9.js +39 -0
  391. package/dist/chunks/permissions-DXLfdE7b.js +1 -0
  392. package/dist/chunks/permissions-Ps_D01ZB.js +1 -0
  393. package/dist/chunks/permissions-S2EvIRKj.js +3 -0
  394. package/dist/chunks/pipeTransport-DVoIA1uN.js +1 -0
  395. package/dist/chunks/plan--lnWxB3Q.js +1 -0
  396. package/dist/chunks/platform-CuyedWpe.js +2 -0
  397. package/dist/chunks/plist-BO4ZqMZc.js +6 -0
  398. package/dist/chunks/plugin-DWLyrLw4.js +1 -0
  399. package/dist/chunks/pluginAutoupdate-CGXIWBrb.js +1 -0
  400. package/dist/chunks/pluginBlocklist-DJrMdzT0.js +1 -0
  401. package/dist/chunks/pluginCliCommands-C08q9dHk.js +1 -0
  402. package/dist/chunks/pluginFlagging-Dggxke70.js +1 -0
  403. package/dist/chunks/pluginOperations-CNCImIe8.js +2 -0
  404. package/dist/chunks/pluginStartupCheck-BW2fjg2P.js +1 -0
  405. package/dist/chunks/pluginStartupCheck-DpxQPXJE.js +1 -0
  406. package/dist/chunks/plugins-DQ3CRWWO.js +4 -0
  407. package/dist/chunks/policyLimits-BotYrS-v.js +1 -0
  408. package/dist/chunks/pollConfig-DAQ-ives.js +1 -0
  409. package/dist/chunks/poller-Ds0Y6Cir.js +1 -0
  410. package/dist/chunks/poor-DqfrQT61.js +1 -0
  411. package/dist/chunks/poorMode-DEAe3hiK.js +1 -0
  412. package/dist/chunks/poorMode-DzYT47KW.js +1 -0
  413. package/dist/chunks/postCommitAttribution-Ehmwzzuq.js +1 -0
  414. package/dist/chunks/print-GGVp62vj.js +39 -0
  415. package/dist/chunks/privacy-settings-agwqjYJo.js +1 -0
  416. package/dist/chunks/process-CWupreF6.js +1 -0
  417. package/dist/chunks/process-DMKLUQIO.js +1 -0
  418. package/dist/chunks/processBashCommand-DHHN8Ca4.js +1 -0
  419. package/dist/chunks/processSlashCommand-COtIO6Jy.js +6 -0
  420. package/dist/chunks/projectContext-0fpRKUeH.js +1 -0
  421. package/dist/chunks/projectContext-eXMSfgdZ.js +1 -0
  422. package/dist/chunks/prompt-4tea6NJQ.js +54 -0
  423. package/dist/chunks/prompt-CO160cIr.js +1 -0
  424. package/dist/chunks/prompt-CjFAtm3w.js +222 -0
  425. package/dist/chunks/prompt-GY9hlRvI.js +1 -0
  426. package/dist/chunks/promptEditor-EgosPsy-.js +4 -0
  427. package/dist/chunks/protocolHandler-mtPUT9U0.js +13 -0
  428. package/dist/chunks/protocols-CAyQOlkr.js +7 -0
  429. package/dist/chunks/proxy-CfZp-wce.js +99 -0
  430. package/dist/chunks/rate-limit-options-C6SFOHue.js +1 -0
  431. package/dist/chunks/rcDebugLog-CPKZCtR8.js +11 -0
  432. package/dist/chunks/referral-DeDr9zAE.js +1 -0
  433. package/dist/chunks/refresh-D7pdoY_X.js +1 -0
  434. package/dist/chunks/registerProtocol-BZBH8Zgl.js +36 -0
  435. package/dist/chunks/registry-Dz6AbiYP.js +1 -0
  436. package/dist/chunks/release-notes-DiUNOrg9.js +4 -0
  437. package/dist/chunks/releaseNotes-CnhQit0y.js +2 -0
  438. package/dist/chunks/reload-plugins-Dx52GcaG.js +1 -0
  439. package/dist/chunks/remote-env-B67Oo3sI.js +1 -0
  440. package/dist/chunks/remoteBridgeCore-BzSUgPbt.js +1 -0
  441. package/dist/chunks/remoteControlServer-L8smP7Zu.js +3 -0
  442. package/dist/chunks/rename-C4PauyTZ.js +1 -0
  443. package/dist/chunks/renderOptions-BiyC2rj1.js +1 -0
  444. package/dist/chunks/resume-CrSn26xq.js +2 -0
  445. package/dist/chunks/rewind-CXplHgh_.js +1 -0
  446. package/dist/chunks/rollback-DbSpxmJE.js +11 -0
  447. package/dist/chunks/runtimeObserver-YNy3mIb7.js +1 -0
  448. package/dist/chunks/runtimeObserver-nAhH4Wca.js +10 -0
  449. package/dist/chunks/sandbox-adapter-CzwHes1i.js +1 -0
  450. package/dist/chunks/sandbox-toggle-BYqbcI5d.js +1 -0
  451. package/dist/chunks/sanitization-CYp-9DbE.js +1 -0
  452. package/dist/chunks/satisfies-BaHgd_ie.js +1 -0
  453. package/dist/chunks/schemas-BGAvj1T4.js +40 -0
  454. package/dist/chunks/sdk-DEtgRZvI.js +1 -0
  455. package/dist/chunks/sdkHeapDumpMonitor--fevrC5z.js +1 -0
  456. package/dist/chunks/searchExtraTools-CcpdCO6l.js +1 -0
  457. package/dist/chunks/semver-Cq33BYay.js +1 -0
  458. package/dist/chunks/semver-Tw0AFar5.js +1 -0
  459. package/dist/chunks/sentry-BNVxoVLS.js +13 -0
  460. package/dist/chunks/server-C5XZSlto.js +1 -0
  461. package/dist/chunks/server-DzOdtq8A.js +1 -0
  462. package/dist/chunks/serverBanner-WlSYP-f8.js +1 -0
  463. package/dist/chunks/serverLog-DtsUvDiY.js +1 -0
  464. package/dist/chunks/session-BuEmHrqM.js +2 -0
  465. package/dist/chunks/sessionDataUploader-Ctjo1bgR.js +1 -0
  466. package/dist/chunks/sessionDiscovery-Mcsfa0g-.js +1 -0
  467. package/dist/chunks/sessionFileAccessHooks-qnNiGMnE.js +1 -0
  468. package/dist/chunks/sessionManager-Dw72ZUTg.js +1 -0
  469. package/dist/chunks/sessionMemory-CMahwDdW.js +1 -0
  470. package/dist/chunks/sessionMemory-pFSn4HSN.js +1 -0
  471. package/dist/chunks/sessionMemoryUtils-Du5jUl7M.js +1 -0
  472. package/dist/chunks/sessionObserver-DG2zQgfi.js +20 -0
  473. package/dist/chunks/sessionObserver-Je868MC9.js +1 -0
  474. package/dist/chunks/sessionStorage-D3FhAADV.js +1 -0
  475. package/dist/chunks/sessionStoragePortable-BI9q2WcJ.js +3 -0
  476. package/dist/chunks/sessionTitle-zUVSAHO7.js +14 -0
  477. package/dist/chunks/sessionTracing-DoRJ4nSa.js +11 -0
  478. package/dist/chunks/settingsSync-B9bz77E1.js +1 -0
  479. package/dist/chunks/setup-B1JbPepL.js +9 -0
  480. package/dist/chunks/setup-CCOLlRtP.js +1 -0
  481. package/dist/chunks/setup-DWkSjA49.js +2 -0
  482. package/dist/chunks/shadowedRuleDetection-BBR3uEgx.js +1 -0
  483. package/dist/chunks/shellQuote-DgjT8KBA.js +1 -0
  484. package/dist/chunks/sideQuestion-DHW5rgKz.js +20 -0
  485. package/dist/chunks/signin-QEeYpJZw.js +1 -0
  486. package/dist/chunks/sink-DxDOsLa2.js +1 -0
  487. package/dist/chunks/sink-cQOgsnw3.js +1 -0
  488. package/dist/chunks/sinks-BrrTUxkC.js +2 -0
  489. package/dist/chunks/sinks-Djiz_5-Z.js +1 -0
  490. package/dist/chunks/skill-learning-C0nOKZfg.js +5 -0
  491. package/dist/chunks/skillChangeDetector-D8C-uQSQ.js +1 -0
  492. package/dist/chunks/skillGapStore-Czi5jKjJ.js +1 -0
  493. package/dist/chunks/skillGapStore-_YuJP5KI.js +5 -0
  494. package/dist/chunks/skillGenerator-kbaRbpqJ.js +8 -0
  495. package/dist/chunks/skillLearning-3KWrBczS.js +1 -0
  496. package/dist/chunks/skillLearning-DBbdGbk-.js +1 -0
  497. package/dist/chunks/skillPanel-BxDvlPzd.js +28 -0
  498. package/dist/chunks/skillSearchPanel-D-MX6Qgt.js +21 -0
  499. package/dist/chunks/skills-NpEgFkFZ.js +1 -0
  500. package/dist/chunks/slashCommandParsing-Cari0pNg.js +1 -0
  501. package/dist/chunks/sleep-8Eb9j_Ly.js +1 -0
  502. package/dist/chunks/sprites-DD4eIkN7.js +1 -0
  503. package/dist/chunks/src-BIPP3_mo.js +26 -0
  504. package/dist/chunks/src-BJz1KAd_.js +6 -0
  505. package/dist/chunks/src-BRAdBA8A.js +1 -0
  506. package/dist/chunks/src-BRC_BuUP.js +1 -0
  507. package/dist/chunks/src-BaB-bpCj.js +5 -0
  508. package/dist/chunks/src-BlLavFUS.js +7 -0
  509. package/dist/chunks/src-C5yhFG0C.js +19 -0
  510. package/dist/chunks/src-CI_jaaBj.js +2 -0
  511. package/dist/chunks/src-CRsA-Z4y.js +1 -0
  512. package/dist/chunks/src-CYLfL70h.js +1 -0
  513. package/dist/chunks/src-DJXCzwyJ.js +1 -0
  514. package/dist/chunks/src-DJXKJavk.js +1 -0
  515. package/dist/chunks/src-Di342QoJ.js +53 -0
  516. package/dist/chunks/src-DsMd9Q9e.js +2 -0
  517. package/dist/chunks/src-DzH9IdOo.js +1 -0
  518. package/dist/chunks/src-hdbPEvzO.js +9 -0
  519. package/dist/chunks/src-poaoYkuc.js +1 -0
  520. package/dist/chunks/src-x7u_sB6m.js +1 -0
  521. package/dist/chunks/sso-oidc-BX1MlBX0.js +1 -0
  522. package/dist/chunks/startupProfiler-DnXZaX4A.js +3 -0
  523. package/dist/chunks/startupProfiler-SOE--nM9.js +1 -0
  524. package/dist/chunks/state-B2GIOsTB.js +1 -0
  525. package/dist/chunks/state-Ce1HlR-H.js +1 -0
  526. package/dist/chunks/state-sIHsFpDu.js +1 -0
  527. package/dist/chunks/staticRender-Br64h1E1.js +1 -0
  528. package/dist/chunks/stats-xL3NHwhp.js +1 -0
  529. package/dist/chunks/status-B5E70xRv.js +1 -0
  530. package/dist/chunks/statusNoticeHelpers-DcssRhLw.js +1 -0
  531. package/dist/chunks/stdio-BEEzuxaZ.js +1 -0
  532. package/dist/chunks/stdio-D4cT86R0.js +3 -0
  533. package/dist/chunks/stickers-2K05wjSp.js +1 -0
  534. package/dist/chunks/store-DhI7Lcan.js +1 -0
  535. package/dist/chunks/sts-BDFJ-6QE.js +1 -0
  536. package/dist/chunks/subprocessEnv-CggQWZCx.js +1 -0
  537. package/dist/chunks/subprocessEnv-DV6q6o6w.js +1 -0
  538. package/dist/chunks/supports-color-lkzOMQ6u.js +1 -0
  539. package/dist/chunks/systemPromptSections-BcN_XBTx.js +1 -0
  540. package/dist/chunks/systemPromptSections-DB93ZNWP.js +1 -0
  541. package/dist/chunks/systemTheme-dDbitcxB.js +1 -0
  542. package/dist/chunks/tag-BELr-qIa.js +11 -0
  543. package/dist/chunks/tasks-CrdWcSt-.js +1 -0
  544. package/dist/chunks/teamHelpers--3ZyNDlv.js +1 -0
  545. package/dist/chunks/teamHelpers-CUAiXng3.js +1 -0
  546. package/dist/chunks/teammate-DMYOtLTK.js +1 -0
  547. package/dist/chunks/teammateModeSnapshot-C6EWhR0X.js +1 -0
  548. package/dist/chunks/teammateModeSnapshot-DOQMTKbQ.js +1 -0
  549. package/dist/chunks/teleport-LXFOan9C.js +1 -0
  550. package/dist/chunks/templateJobs-8IY2Cgig.js +12 -0
  551. package/dist/chunks/terminalSetup-C4psrmpb.js +1 -0
  552. package/dist/chunks/terminalSetup-Lyg4NbGA.js +33 -0
  553. package/dist/chunks/theme-B8GNnJ_q.js +1 -0
  554. package/dist/chunks/thinkback-DPXwEK3B.js +1 -0
  555. package/dist/chunks/thinkback-DZW3Mcx_.js +1 -0
  556. package/dist/chunks/thinkback-play-BMOE-ceh.js +1 -0
  557. package/dist/chunks/tmux-CvbhsfwG.js +1 -0
  558. package/dist/chunks/toolEventObserver-D0TSHm01.js +1 -0
  559. package/dist/chunks/toolEventObserver-DzLd0MSn.js +1 -0
  560. package/dist/chunks/toolPool-DVOfpjDz.js +1 -0
  561. package/dist/chunks/toolPool-Dq-Vtvrj.js +1 -0
  562. package/dist/chunks/trustedDevice-1iTu4LEm.js +1 -0
  563. package/dist/chunks/trustedDevice-BvYYXfd8.js +1 -0
  564. package/dist/chunks/tui-BVc2q4Xv.js +6 -0
  565. package/dist/chunks/turndown.es-Bv06VjMb.js +69 -0
  566. package/dist/chunks/types-CQ1wrnQ0.js +1 -0
  567. package/dist/chunks/types-Csi32ZXh.js +17 -0
  568. package/dist/chunks/types-RJTEOuIt.js +3 -0
  569. package/dist/chunks/udsClient-BvG_Jip0.js +1 -0
  570. package/dist/chunks/ultrareviewCommand-BTXAN2wP.js +3 -0
  571. package/dist/chunks/undercover-C_44e3oN.js +1 -0
  572. package/dist/chunks/undercover-DvvnEmsX.js +31 -0
  573. package/dist/chunks/up-D-U4wUCe.js +12 -0
  574. package/dist/chunks/updateCCB-C-qfLi0j.js +11 -0
  575. package/dist/chunks/upgrade-CGXa5Dwy.js +1 -0
  576. package/dist/chunks/upgrade-DTBZSxwv.js +1 -0
  577. package/dist/chunks/upload-BF8tf_Eo.js +1 -0
  578. package/dist/chunks/upstreamproxy-DcLeL2XX.js +11 -0
  579. package/dist/chunks/usage-BRYRRgNt.js +1 -0
  580. package/dist/chunks/usage-DvSTXEYY.js +1 -0
  581. package/dist/chunks/useKeybinding-FsOnjW6T.js +1 -0
  582. package/dist/chunks/useMainLoopModel-CwvuTRXn.js +1 -0
  583. package/dist/chunks/useManagePlugins-GmnI9K53.js +1 -0
  584. package/dist/chunks/useMergedTools-Dah5KDMi.js +1 -0
  585. package/dist/chunks/useSearchInput-BV_azHiA.js +1 -0
  586. package/dist/chunks/useSettingsErrors-C-j_Zt7g.js +1 -0
  587. package/dist/chunks/useVoice-DR69NLxp.js +1 -0
  588. package/dist/chunks/util-BpyJ4Bom.js +1 -0
  589. package/dist/chunks/utils-CrZcpypC.js +1 -0
  590. package/dist/chunks/v4-f1i_CNUT.js +1 -0
  591. package/dist/chunks/validatePlugin-vptAYuYu.js +1 -0
  592. package/dist/chunks/vertex-sdk-CSGw3fvU.js +9 -0
  593. package/dist/chunks/vim-DvOw8dfR.js +1 -0
  594. package/dist/chunks/voice-B3BZs53f.js +2 -0
  595. package/dist/chunks/voice-DXiiy8HX.js +8 -0
  596. package/dist/chunks/voiceModeEnabled-DA76xN1Q.js +1 -0
  597. package/dist/chunks/voiceModeEnabled-DIveLYGb.js +1 -0
  598. package/dist/chunks/voiceStreamSTT-_w1VjIOs.js +1 -0
  599. package/dist/chunks/voiceStreamSTT-hpzWd_zl.js +1 -0
  600. package/dist/chunks/which-DqSAIvp2.js +1 -0
  601. package/dist/chunks/windowsPaths-C9CigqoF.js +1 -0
  602. package/dist/chunks/windowsPaths-swxCp7bX.js +2 -0
  603. package/dist/chunks/workSecret-mS2OrpxF.js +1 -0
  604. package/dist/chunks/workerRegistry-2_MZVih1.js +1 -0
  605. package/dist/chunks/worktree-CCuDwRmS.js +1 -0
  606. package/dist/chunks/worktreeModeEnabled-Db6b_Iy_.js +1 -0
  607. package/dist/chunks/worktreeModeEnabled-THQb19xR.js +1 -0
  608. package/dist/chunks/wrapper-BSK0MCQH.js +1 -0
  609. package/dist/chunks/wrapper-D5qL1aQL.js +6 -0
  610. package/dist/chunks/xdg-CBxMmQux.js +1 -0
  611. package/dist/chunks/xml-Dx--sNE1.js +1 -0
  612. package/dist/chunks/zod-DT6hytkp.js +1 -0
  613. package/dist/cli.js +1 -10978
  614. package/package.json +1 -1
@@ -0,0 +1,39 @@
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 ae,s as h,t as oe,u as g}from"./envUtils-BWeoiL4Y.js";import{t as se}from"./client-_sjL0I7A.js";import{n as ce,t as _}from"./defineProperty-80gRi2ZW.js";import{_ as le,d as ue,h as de,n as fe,o as pe,r as me,s as he}from"./esm-CJlBxjtx.js";import{B as ge,D as _e,Q as ve,Tt as ye,V as be,Z as xe,_ as Se,a as Ce,c as we,d as Te,j as Ee,jt as De,o as Oe,t as ke,u as Ae,x as je,z as Me}from"./esm-DcdOXSzi.js";import{i as Ne,r as Pe,t as Fe}from"./esm-BGQPWnJy.js";import{n as v,t as Ie}from"./axios-DhfaybwJ.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-BGAvj1T4.js";import{a as Ge,n as Ke,o as qe,t as Je}from"./v4-f1i_CNUT.js";import{Bn as Ye,In as Xe,Ln as Ze,zn as Qe}from"./src-Di342QoJ.js";import{i as $e,r as et}from"./isSymbol-Dp3irZaY.js";import{$i as tt,$r as nt,Bn as rt,Br as it,Ct as at,Dn as ot,E as st,Ei as ct,Et as lt,F as ut,Fi as dt,Fr as ft,Gi as pt,H as mt,Hi as ht,Hr as gt,I as _t,Ii as vt,Ji as yt,Jr as bt,K as xt,Ki as St,Kr as Ct,Lr as wt,Mi as Tt,Ni as Et,Pi as Dt,Pr as Ot,Qr as kt,Rr as At,Ti as jt,U as Mt,Ur as Nt,Vi as Pt,Vr as Ft,Wr as It,Xi as Lt,Xr as Rt,Yi as zt,Yr as Bt,Zr as Vt,_i as Ht,ai as Ut,ar as Wt,at as Gt,b as Kt,ci as qt,cn as O,cr as Jt,di as Yt,ea as Xt,ei as Zt,en as Qt,et as $t,fi as en,gi as tn,hi as nn,hn as rn,ia as an,ii as on,ji as sn,na as cn,ni as ln,oi as un,ot as dn,qi as fn,qr as pn,ra as mn,ri as hn,rt as gn,si as _n,st as vn,ta as yn,ti as bn,ut as xn,vi as Sn,vt as Cn,x as wn,zr as Tn}from"./state-sIHsFpDu.js";import{$ as En,C as Dn,Ct as On,E as k,K as kn,L as An,O as jn,R as Mn,St as Nn,T as Pn,U as Fn,V as In,W as Ln,X as Rn,Y as zn,_t as Bn,at as Vn,bt as Hn,ct as Un,d as A,dt as Wn,et as Gn,ft as Kn,gt as qn,h as Jn,ht as Yn,it as Xn,j as Zn,l as Qn,lt as $n,mt as er,nt as tr,ot as nr,p as j,pt as rr,rt as ir,s as M,st as ar,tt as or,u as sr,ut as cr,vt as lr,w as ur,xt as dr,y as fr,yt as pr}from"./debug-UI3T040K.js";import{a as mr,n as hr,r as N}from"./analytics-DqMQntaB.js";import{n as gr,t as _r}from"./cwd--iizewsn.js";import{t as vr}from"./sdk-DEtgRZvI.js";import{F as yr,P as br,h as xr,n as Sr,t as Cr,v as wr}from"./git-CN3qtTb_.js";import{l as P,n as Tr,r as Er,s as Dr,t as Or,u as kr}from"./oauth-CdZEzMww.js";import{n as Ar,t as jr}from"./bundledMode-kSQejuY4.js";import{n as Mr,r as Nr,t as Pr}from"./execa-CGue6Z3n.js";import{a as Fr,i as Ir,n as Lr,r as F,t as Rr}from"./env-chR0gV31.js";import{d as zr,f as Br,o as Vr,p as Hr,s as I,u as Ur}from"./log-CzsijfHZ.js";import{a as Wr,i as Gr,n as Kr,o as qr,r as Jr}from"./platform-CuyedWpe.js";import{r as Yr,t as Xr}from"./memoize-DxwLawI2.js";import{p as Zr}from"./sessionStoragePortable-BI9q2WcJ.js";import{a as Qr,i as $r,n as ei}from"./path-C4kbwvSH.js";import{a as ti,i as ni,n as ri,r as ii,t as ai}from"./execFileNoThrow-CuQN1sz8.js";import{a as oi,f as si,l as ci,p as li,r as ui,s as di,u as fi}from"./types-Csi32ZXh.js";import{C as pi,D as mi,E as hi,T as gi,a as _i,b as vi,f as yi,i as bi,l as xi,t as Si,x as Ci}from"./teammate-DMYOtLTK.js";import{a as wi,n as Ti}from"./startupProfiler-DnXZaX4A.js";import{n as L,t as Ei}from"./lazySchema-2sOku3cX.js";import{i as Di,r as Oi,t as ki}from"./permissions-DXLfdE7b.js";import{n as Ai,t as ji}from"./normalization-Cox8C0dP.js";import{a as Mi,o as Ni,u as Pi}from"./proxy-CfZp-wce.js";import{n as Fi,t as Ii}from"./sleep-8Eb9j_Ly.js";import{i as Li,t as Ri}from"./genericProcessUtils-BGvcwuPt.js";import{i as zi,o as Bi}from"./common-B379wT22.js";import{homedir as Vi,userInfo as Hi}from"os";import*as Ui from"path";import{basename as Wi,dirname as Gi,extname as Ki,isAbsolute as qi,join as R,normalize as Ji,relative as Yi,resolve as Xi,sep as Zi}from"path";import{chmodSync as Qi,existsSync as $i,mkdirSync as ea,readFileSync as ta,unwatchFile as na,watchFile as ra,writeFileSync as ia}from"fs";import{createHash as aa,randomBytes as oa,randomUUID as sa}from"crypto";import{appendFile as ca,mkdir as la,readFile as ua,readdir as da,realpath as fa,stat as pa,unlink as ma,writeFile as ha}from"fs/promises";import{exec as ga,execFile as _a}from"child_process";import{AsyncLocalStorage as va}from"async_hooks";function ya(){return Ha}function ba(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 xa(e,t,n){return n===2?ba(ba(e+t)+``)%1e4/1e4:n===1?ba(t+e)%1e3/1e3:null}function Sa(e){return e<=0?[]:Array(e).fill(1/e)}function Ca(e,t){return e>=t[0]&&e<t[1]}function wa(e,t){let n=xa(`__`+t[0],e,1);return n===null?!1:n>=t[1]&&n<t[2]}function Ta(e,t){for(let n=0;n<t.length;n++)if(Ca(e,t[n]))return n;return-1}function Ea(e){try{let t=e.replace(/([^\\])\//g,`$1\\/`);return new RegExp(t)}catch(e){console.error(e);return}}function Da(e,t){if(!t.length)return!1;let n=!1,r=!1;for(let i=0;i<t.length;i++){let a=Aa(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 Oa(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 ka(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=>!Oa(e[0],e[1],e[2]))}catch{return!1}}function Aa(e,t,n){try{let r=new URL(e,`https://_`);if(t===`regex`){let e=Ea(n);return e?e.test(r.href)||e.test(r.href.substring(r.origin.length)):!1}else if(t===`simple`)return ka(r,n);return!1}catch{return!1}}function ja(e,t,n){t=t===void 0?1:t,t<0?t=0:t>1&&(t=1);let r=Sa(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 Ma(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 Na(e){try{return e()}catch(e){return console.error(e),!1}}async function Pa(e,t,n){if(t=t||``,n=n||globalThis.crypto&&globalThis.crypto.subtle||Ha.SubtleCrypto,!n)throw Error(`No SubtleCrypto implementation found`);try{let r=await n.importKey(`raw`,Ua(t),{name:`AES-CBC`,length:128},!0,[`encrypt`,`decrypt`]),[i,a]=e.split(`.`),o=await n.decrypt({name:`AES-CBC`,iv:Ua(i)},r,Ua(a));return new TextDecoder().decode(o)}catch{throw Error(`Failed to decrypt`)}}function Fa(e){return typeof e==`string`?e:JSON.stringify(e)}function Ia(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 La(){let e;try{e=`1.6.5`}catch{e=``}return e}function Ra(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 za(e){return typeof e==`object`&&!!e}function Ba(e){return e.urlPatterns&&e.variations.some(e=>za(e)&&`urlRedirect`in e)?`redirect`:e.variations.some(e=>za(e)&&(e.domMutations||`js`in e||`css`in e))?`visual`:`unknown`}async function Va(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 Ha,Ua,Wa=t((()=>{Ha={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource},Ua=e=>Uint8Array.from(atob(e),e=>e.charCodeAt(0))}));function Ga(e){Object.assign(z,e),z.backgroundSync||fo()}async function Ka({instance:e,timeout:t,skipCache:n,allowStale:r,backgroundSync:i}){return i||(z.backgroundSync=!1),Qa({instance:e,allowStale:r,timeout:t,skipCache:n})}function qa(e){let t=$a(e),n=go.get(t)||new Set;n.add(e),go.set(t,n)}function Ja(e){go.forEach(t=>t.delete(e))}function Ya(){bo.forEach(e=>{e&&(e.state=`idle`,co(e))})}function Xa(){bo.forEach(e=>{e&&e.state===`idle`&&lo(e)})}async function Za(){try{if(!mo.localStorage)return;await mo.localStorage.setItem(z.cacheKey,JSON.stringify(Array.from(vo.entries())))}catch{}}async function Qa({instance:e,allowStale:t,timeout:n,skipCache:r}){let i=$a(e),a=eo(e),o=new Date,s=new Date(o.getTime()-z.maxAge+z.staleTTL);await to();let c=!z.disableCache&&!r?vo.get(a):void 0;return c&&(t||c.staleAt>o)&&c.staleAt>s?(c.sse&&xo.add(i),c.staleAt<o?ao(e):oo(e),{data:c.data,success:!0,source:`cache`}):await Va(ao(e),n)||{data:null,success:!1,source:`timeout`,error:Error(`Timeout`)}}function $a(e){let[t,n]=e.getApiInfo();return`${t}||${n}`}function eo(e){let t=$a(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 to(){if(!_o){_o=!0;try{if(mo.localStorage){let e=await mo.localStorage.getItem(z.cacheKey);if(!z.disableCache&&e){let t=JSON.parse(e);t&&Array.isArray(t)&&t.forEach(([e,t])=>{vo.set(e,{...t,staleAt:new Date(t.staleAt)})}),no()}}}catch{}if(!z.disableIdleStreams){let e=ho.startIdleListener();e&&(ho.stopIdleListener=e)}}}function no(){let e=Array.from(vo.entries()).map(([e,t])=>({key:e,staleAt:t.staleAt.getTime()})).sort((e,t)=>e.staleAt-t.staleAt),t=Math.min(Math.max(0,vo.size-z.maxEntries),vo.size);for(let n=0;n<t;n++)vo.delete(e[n].key)}function ro(e,t,n){let r=n.dateUpdated||``,i=new Date(Date.now()+z.staleTTL),a=z.disableCache?void 0:vo.get(t);if(a&&r&&a.version===r){a.staleAt=i,Za();return}z.disableCache||(vo.set(t,{data:n,version:r,staleAt:i,sse:xo.has(e)}),no()),Za();let o=go.get(e);o&&o.forEach(e=>io(e,n))}async function io(e,t){await e.setPayload(t||e.getPayload())}async function ao(e){let{apiHost:t,apiRequestHeaders:n}=e.getApiHosts(),r=e.getClientKey(),i=`isRemoteEval`in e&&e.isRemoteEval(),a=$a(e),o=eo(e),s=yo.get(o);return s||(s=(i?ho.fetchRemoteEvalCall({host:t,clientKey:r,payload:{attributes:e.getAttributes(),forcedVariations:e.getForcedVariations(),forcedFeatures:Array.from(e.getForcedFeatures().entries()),url:e.getUrl()},headers:n}):ho.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`&&xo.add(a),e.json()}).then(t=>(ro(a,o,t),oo(e),yo.delete(o),{data:t,success:!0,source:`network`})).catch(e=>(yo.delete(o),{data:null,source:`error`,success:!1,error:e})),yo.set(o,s)),s}function oo(e,t=!1){let n=$a(e),r=eo(e),{streamingHost:i,streamingHostRequestHeaders:a}=e.getApiHosts(),o=e.getClientKey();if(t&&xo.add(n),z.backgroundSync&&xo.has(n)&&mo.EventSource){if(bo.has(n))return;let e={src:null,host:i,clientKey:o,headers:a,cb:t=>{try{if(t.type===`features-updated`){let e=go.get(n);e&&e.forEach(e=>{ao(e)})}else t.type===`features`&&ro(n,r,JSON.parse(t.data));e.errors=0}catch{so(e)}},errors:0,state:`active`};bo.set(n,e),lo(e)}}function so(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);co(e),setTimeout(()=>{[`idle`,`active`].includes(e.state)||lo(e)},Math.min(t,3e5))}}function co(e){e.src&&(e.src.onopen=null,e.src.onerror=null,e.src.close(),e.src=null,e.state===`active`&&(e.state=`disabled`))}function lo(e){e.src=ho.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=()=>so(e),e.src.onopen=()=>{e.errors=0}}function uo(e,t){co(e),bo.delete(t)}function fo(){xo.clear(),bo.forEach(uo),go.clear(),ho.stopIdleListener()}function po(e,t){if(t.streaming){if(!e.getClientKey())throw Error(`Must specify clientKey to enable streaming`);t.payload&&oo(e,!0),qa(e)}}var z,mo,ho,go,_o,vo,yo,bo,xo,So=t((()=>{Wa(),z={staleTTL:1e3*60,maxAge:1e3*60*60*4,cacheKey:`gbFeaturesCache`,backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},mo=ya(),ho={fetchFeaturesCall:({host:e,clientKey:t,headers:n})=>mo.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 mo.fetch(`${e}/api/eval/${t}`,i)},eventSourceCall:({host:e,clientKey:t,headers:n})=>n?new mo.EventSource(`${e}/sub/${t}`,{headers:n}):new mo.EventSource(`${e}/sub/${t}`),startIdleListener:()=>{let e;if(!(typeof window<`u`&&typeof document<`u`))return;let t=()=>{document.visibilityState===`visible`?(window.clearTimeout(e),Xa()):document.visibilityState===`hidden`&&(e=window.setTimeout(Ya,z.idleStreamInterval))};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(mo.localStorage=globalThis.localStorage)}catch{}go=new Map,_o=!1,vo=new Map,yo=new Map,bo=new Map,xo=new Set}));function Co(e){return e===`html`?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[e]}}function wo(e){var t=ts.get(e);return t||(t={element:e,attributes:{}},ts.set(e,t)),t}function To(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,Co(t)),o}function Eo(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,Bo()):e!==n&&(t.isDirty=!0,Bo())}function Do(e){var t=e.originalValue;e.mutations.forEach(function(e){return t=e.mutate(t)}),Eo(Lo(t),e)}function Oo(e){var t=new Set(e.originalValue.split(/\s+/).filter(Boolean));e.mutations.forEach(function(e){return e.mutate(t)}),Eo(Array.from(t).filter(Boolean).join(` `),e)}function ko(e){var t=e.originalValue;e.mutations.forEach(function(e){return t=e.mutate(t)}),Eo(t,e)}function Ao(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 jo(e){var t=e.originalValue;e.mutations.forEach(function(e){t=Ao(e.mutate())||t}),Eo(t,e)}function Mo(e){var t=wo(e);return t.html||(t.html=To(e,`html`,rs,is,Do)),t.html}function No(e){var t=wo(e);return t.position||(t.position=To(e,`position`,as,os,jo)),t.position}function Po(e){var t=wo(e);return t.classes||(t.classes=To(e,`class`,cs,ss,Oo)),t.classes}function Fo(e,t){var n=wo(e);return n.attributes[t]||(n.attributes[t]=To(e,t,ls(t),us(t),ko)),n.attributes[t]}function Io(e,t){var n=ts.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 Lo(e){return ds||(ds=document.createElement(`div`)),ds.innerHTML=e,ds.innerHTML}function Ro(e,t,n){if(n.isDirty){n.isDirty=!1;var r=n.virtualValue;n.mutations.length||Io(e,t),n.setValue(e,r)}}function zo(e,t){e.html&&Ro(t,`html`,e.html),e.classes&&Ro(t,`class`,e.classes),e.position&&Ro(t,`position`,e.position),Object.keys(e.attributes).forEach(function(n){Ro(t,n,e.attributes[n])})}function Bo(){ts.forEach(zo)}function Vo(e,t){var n=null;e.kind===`html`?n=Mo(t):e.kind===`class`?n=Po(t):e.kind===`attribute`?n=Fo(t,e.attribute):e.kind===`position`&&(n=No(t)),n&&(n.mutations.push(e),n.mutationRunner(n))}function Ho(e,t){var n=null;if(e.kind===`html`?n=Mo(t):e.kind===`class`?n=Po(t):e.kind===`attribute`?n=Fo(t,e.attribute):e.kind===`position`&&(n=No(t)),n){var r=n.mutations.indexOf(e);r!==-1&&n.mutations.splice(r,1),n.mutationRunner(n)}}function Uo(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),Vo(e,n))})}}function Wo(e){e.elements.forEach(function(t){return Ho(e,t)}),e.elements.clear(),ns.delete(e)}function Go(){ns.forEach(Uo)}function Ko(){typeof document>`u`||(fs||(fs=new MutationObserver(function(){Go()})),Go(),fs.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))}function qo(e){return typeof document>`u`?es:(ns.add(e),Uo(e),{revert:function(){Wo(e)}})}function Jo(e,t){return qo({kind:`html`,elements:new Set,mutate:t,selector:e})}function Yo(e,t){return qo({kind:`position`,elements:new Set,mutate:t,selector:e})}function Xo(e,t){return qo({kind:`class`,elements:new Set,mutate:t,selector:e})}function Zo(e,t,n){return $o.test(t)?t===`class`||t===`className`?Xo(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)})}):qo({kind:`attribute`,attribute:t,elements:new Set,mutate:n,selector:e}):es}function Qo(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 Jo(t,function(e){return e+(r??``)});if(n===`set`)return Jo(t,function(){return r??``})}else if(i===`class`){if(n===`append`)return Xo(t,function(e){r&&e.add(r)});if(n===`remove`)return Xo(t,function(e){r&&e.delete(r)});if(n===`set`)return Xo(t,function(e){e.clear(),r&&e.add(r)})}else if(i===`position`){if(n===`set`&&a)return Yo(t,function(){return{insertBeforeSelector:o,parentSelector:a}})}else if(n===`append`)return Zo(t,i,function(e){return e===null?r??``:e+(r??``)});else if(n===`set`)return Zo(t,i,function(){return r??``});else if(n===`remove`)return Zo(t,i,function(){return null});return es}var $o,es,ts,ns,rs,is,as,os,ss,cs,ls,us,ds,fs,ps,ms=t((()=>{$o=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,es={revert:function(){}},ts=new Map,ns=new Set,rs=function(e){return e.innerHTML},is=function(e,t){return e.innerHTML=t},as=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},os=function(e,t){t.insertBeforeNode&&!t.parentNode.contains(t.insertBeforeNode)||t.parentNode.insertBefore(e,t.insertBeforeNode)},ss=function(e,t){return t?e.className=t:e.removeAttribute(`class`)},cs=function(e){return e.className},ls=function(e){return function(t){return t.getAttribute(e)??null}},us=function(e){return function(t,n){return n===null?t.removeAttribute(e):t.setAttribute(e,n)}},Ko(),ps={html:Jo,classes:Xo,attribute:Zo,position:Yo,declarative:Qo}}));function hs(e,t,n){n=n||{};for(let[r,i]of Object.entries(t))switch(r){case`$or`:if(!Ts(e,i,n))return!1;break;case`$nor`:if(Ts(e,i,n))return!1;break;case`$and`:if(!Es(e,i,n))return!1;break;case`$not`:if(hs(e,i,n))return!1;break;default:if(!vs(i,gs(e,r),n))return!1}return!0}function gs(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 _s(e,t=!1){let n=`${e}${t?`/i`:``}`;return Ds[n]||(Ds[n]=new RegExp(e.replace(/([^\\])\//g,`$1\\/`),t?`i`:void 0)),Ds[n]}function vs(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)||!ys(e))return JSON.stringify(t)===JSON.stringify(e);for(let r in e)if(!ws(r,t,e[r],n))return!1;return!0}function ys(e){let t=Object.keys(e);return t.length>0&&t.filter(e=>e[0]===`$`).length===t.length}function bs(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 xs(e,t,n){if(!Array.isArray(e))return!1;let r=ys(t)?e=>vs(t,e,n):e=>hs(e,t,n);for(let t=0;t<e.length;t++)if(e[t]&&r(e[t]))return!0;return!1}function Ss(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 Cs(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(vs(t[i],e[o],n,r)){a=!0;break}if(!a)return!1}return!0}function ws(e,t,n,r){switch(e){case`$veq`:return Ia(t)===Ia(n);case`$vne`:return Ia(t)!==Ia(n);case`$vgt`:return Ia(t)>Ia(n);case`$vgte`:return Ia(t)>=Ia(n);case`$vlt`:return Ia(t)<Ia(n);case`$vlte`:return Ia(t)<=Ia(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)?Ss(t,n):!1;case`$ini`:return Array.isArray(n)?Ss(t,n,!0):!1;case`$inGroup`:return Ss(t,r[n]||[]);case`$notInGroup`:return!Ss(t,r[n]||[]);case`$nin`:return Array.isArray(n)?!Ss(t,n):!1;case`$nini`:return Array.isArray(n)?!Ss(t,n,!0):!1;case`$not`:return!vs(n,t,r);case`$size`:return Array.isArray(t)?vs(n,t.length,r):!1;case`$elemMatch`:return xs(t,n,r);case`$all`:return Array.isArray(n)?Cs(t,n,r):!1;case`$alli`:return Array.isArray(n)?Cs(t,n,r,!0):!1;case`$regex`:try{return _s(n).test(t)}catch{return!1}case`$regexi`:try{return _s(n,!0).test(t)}catch{return!1}case`$type`:return bs(t)===n;default:return console.error(`Unknown operator: `+e),!1}}function Ts(e,t,n){if(!t.length)return!0;for(let r=0;r<t.length;r++)if(hs(e,t[r],n))return!0;return!1}function Es(e,t,n){for(let r=0;r<t.length;r++)if(!hs(e,t[r],n))return!1;return!0}var Ds,Os=t((()=>{Wa(),Ds={}}));function ks(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 As(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 js(e){try{await e()}catch{}}function Ms(e,t,n){if(e.user.trackedExperiments){let r=tc(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(js(()=>i(t,n,e.user)))}if(e.user.trackingCallback){let i=e.user.trackingCallback;r.push(js(()=>i(t,n)))}if(e.global.eventLogger){let i=e.global.eventLogger;r.push(js(()=>i(rc,{experimentId:t.key,variationId:n.key,hashAttribute:n.hashAttribute,hashValue:n.hashValue},e.user)))}return r}function Ns(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;js(()=>r(t,n,e.user))}if(e.user.onFeatureUsage){let r=e.user.onFeatureUsage;js(()=>r(t,n))}if(e.global.eventLogger){let r=e.global.eventLogger;js(()=>r(nc,{feature:t,source:n.source,value:n.value,ruleId:n.source===`defaultValue`?`$default`:n.ruleId||``,variationId:n.experimentResult?n.experimentResult.key:``},e.user))}}function Ps(e,t){if(t.stack.evaluatedFeatures.has(e))return Is(t,e,null,`cyclicPrerequisite`);t.stack.evaluatedFeatures.add(e),t.stack.id=e;let n=ks(t);if(n.has(e))return Is(t,e,n.get(e),`override`);if(!t.global.features||!t.global.features[e])return Is(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=Ps(r.id,t);if(i.source===`cyclicPrerequisite`)return Is(t,e,null,`cyclicPrerequisite`);if(!hs({value:i.value},r.condition||{})){if(r.gate)return Is(t,e,null,`prerequisite`);continue rules}}if(i.filters&&zs(i.filters,t))continue;if(`force`in i){if(i.condition&&!Rs(i.condition,t)||!Bs(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=>{!Ms(t,e.experiment,e.result).length&&t.global.saveDeferredTrack&&t.global.saveDeferredTrack({experiment:e.experiment,result:e.result})}),Is(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}=Fs(r,e,t);if(t.global.onExperimentEval&&t.global.onExperimentEval(r,a),a.inExperiment&&!a.passthrough)return Is(t,e,a.value,`experiment`,i.id,r,a)}}return Is(t,e,r.defaultValue===void 0?null:r.defaultValue,`defaultValue`)}function Fs(e,t,n){let r=e.key,i=e.variations.length;if(i<2||n.global.enabled===!1||n.user.enabled===!1||(e=Vs(e,n),e.urlPatterns&&!Da(n.user.url||``,e.urlPatterns)))return{result:B(n,e,-1,!1,t)};let a=Ma(r,n.user.url||``,i);if(a!==null)return{result:B(n,e,a,!1,t)};let o=As(n);if(r in o){let i=o[r];return{result:B(n,e,i,!1,t)}}if(e.status===`draft`||e.active===!1)return{result:B(n,e,-1,!1,t)};let{hashAttribute:s,hashValue:c}=Hs(n,e.hashAttribute,n.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0);if(!c)return{result:B(n,e,-1,!1,t)};let l=-1,u=!1,d=!1;if(n.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){let{variation:t,versionIsBlocked:r}=Gs({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(zs(e.filters,n))return{result:B(n,e,-1,!1,t)}}else if(e.namespace&&!wa(c,e.namespace))return{result:B(n,e,-1,!1,t)};if(e.include&&!Na(e.include)||e.condition&&!Rs(e.condition,n))return{result:B(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=Ps(i.id,n);if(a.source===`cyclicPrerequisite`||!hs({value:a.value},i.condition||{}))return{result:B(n,e,-1,!1,t)}}}if(e.groups&&!Ws(e.groups,n))return{result:B(n,e,-1,!1,t)}}if(e.url&&!Us(e.url,n))return{result:B(n,e,-1,!1,t)};let f=xa(e.seed||r,c,e.hashVersion||1);if(f===null)return{result:B(n,e,-1,!1,t)};if(u||(l=Ta(f,e.ranges||ja(i,e.coverage===void 0?1:e.coverage,e.weights))),d)return{result:B(n,e,-1,!1,t,void 0,!0)};if(l<0)return{result:B(n,e,-1,!1,t)};if(`force`in e)return{result:B(n,e,e.force===void 0?-1:e.force,!1,t)};if(n.global.qaMode||n.user.qaMode||e.status===`stopped`)return{result:B(n,e,-1,!1,t)};let p=B(n,e,l,!0,t,f,u);if(n.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){let{changed:t,key:r,doc:i}=Ys(n,s,Fa(c),{[Ks(e.key,e.bucketVersion)]:p.key});t&&(n.user.stickyBucketAssignmentDocs=n.user.stickyBucketAssignmentDocs||{},n.user.stickyBucketAssignmentDocs[r]=i,n.user.saveStickyBucketAssignmentDoc(i))}let m=Ms(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 Is(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`&&Ns(e,t,s),s}function Ls(e){return{...e.user.attributes,...e.user.attributeOverrides}}function Rs(e,t){return hs(Ls(t),e,t.global.savedGroups||{})}function zs(e,t){return e.some(e=>{let{hashValue:n}=Hs(t,e.attribute);if(!n)return!0;let r=xa(e.seed,n,e.hashVersion||2);return r===null?!0:!e.ranges.some(e=>Ca(r,e))})}function Bs(e,t,n,r,i,a,o){if(!i&&a===void 0)return!0;if(!i&&a===0)return!1;let{hashValue:s}=Hs(e,n,r);if(!s)return!1;let c=xa(t,s,o||1);return c===null?!1:i?Ca(c,i):a===void 0?!0:c<=a}function B(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}=Hs(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 Vs(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=Ea(e.url))),e}function Hs(e,t,n){let r=t||`id`,i=``,a=Ls(e);return a[r]&&(i=a[r]),!i&&n&&(a[n]&&(i=a[n]),i&&(r=n)),{hashAttribute:r,hashValue:i}}function Us(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 Ws(e,t){let n=t.global.groups||{};for(let t=0;t<e.length;t++)if(n[e[t]])return!0;return!1}function Gs({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=Ks(t,n),c=Js(e,r,i);if(a>0){for(let e=0;e<a;e++)if(c[Ks(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 Ks(e,t){return t=t||0,`${e}__${t}`}function qs(e,t){return`${e}||${t}`}function Js(e,t,n){if(!e.user.stickyBucketAssignmentDocs)return{};let{hashAttribute:r,hashValue:i}=Hs(e,t),a=qs(r,Fa(i)),{hashAttribute:o,hashValue:s}=Hs(e,n),c=s?qs(o,Fa(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 Ys(e,t,n,r){let i=qs(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 Xs(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 Zs(e,t,n){let r=Qs(e,n);return t.getAllAssignments(r)}function Qs(e,t){let n={};return Xs(e,t).forEach(t=>{let{hashValue:r}=Hs(e,t);n[t]=Fa(r)}),n}async function $s(e,t,n){if(e={...e},e.encryptedFeatures){try{e.features=JSON.parse(await Pa(e.encryptedFeatures,t,n))}catch(e){console.error(e)}delete e.encryptedFeatures}if(e.encryptedExperiments){try{e.experiments=JSON.parse(await Pa(e.encryptedExperiments,t,n))}catch(e){console.error(e)}delete e.encryptedExperiments}if(e.encryptedSavedGroups){try{e.savedGroups=JSON.parse(await Pa(e.encryptedSavedGroups,t,n))}catch(e){console.error(e)}delete e.encryptedSavedGroups}return e}function ec(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 tc(e,t){return t.hashAttribute+t.hashValue+e.key+t.variationId}var nc,rc,ic=t((()=>{Os(),Wa(),nc=`Feature Evaluated`,rc=`Experiment Viewed`})),ac,oc,sc,cc=t((()=>{ms(),Wa(),So(),ic(),ac=typeof window<`u`&&typeof document<`u`,oc=La(),sc=class{constructor(e){if(e=e||{},this.version=oc,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),ac&&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 $s(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,po(this,e),this}async init(e){if(this._initialized=!0,e=e||{},e.cacheSettings&&Ga(e.cacheSettings),e.payload)return await this.setPayload(e.payload),po(this,e),{success:!0,source:`init`};{let{data:t,...n}=await this._refresh({...e,allowStale:!0});return po(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 ec(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 Ka({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 Pa(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 Pa(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,Ja(this),e.destroyAllStreams&&fo(),this.logs=[],ac&&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}=Fs(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=B(this._getEvalContext(),e,-1,!1,``):({result:i,trackingCall:a}=Fs(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=Ba(e);if(t===`redirect`&&i.value.urlRedirect&&e.urlPatterns){let t=e.persistQueryString?Ra(this._getContextUrl(),i.value.urlRedirect):i.value.urlRedirect;if(Da(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(ac)Promise.all([...a?[Va(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&&Ba(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 Ps(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=>[tc(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(tc(e.experiment,e.result),e)}_getContextUrl(){return this._options.url||(ac?window.location.href:``)}_isAutoExperimentBlockedByContext(e){let t=Ba(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}:ac?{navigate:e=>{window.location.replace(e)},delay:100}:{navigate:null,delay:0}}_applyDOMChanges(e){if(!ac)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(ps.declarative(e).revert)}),()=>{t.forEach(e=>e())}}async refreshStickyBuckets(e){if(this._options.stickyBucketService){let t=await Zs(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=Qs(this._getEvalContext(),t);return e.getAllAssignmentsSync(n)}inDevMode(){return!!this._options.enableDevMode}}})),lc=t((()=>{So(),cc(),Wa(),ic(),Os()}));function uc(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 dc=t((()=>{}));function fc(e){var t=0,n=0;return function(){var r=hc(),i=mc-(r-n);if(n=r,i>0){if(++t>=pc)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var pc,mc,hc,gc=t((()=>{pc=800,mc=16,hc=Date.now}));function _c(e){return function(){return e}}var vc=t((()=>{})),yc,bc=t((()=>{vc(),dr(),Rt(),yc=Hn?function(e,t){return Hn(e,`toString`,{configurable:!0,enumerable:!1,value:_c(t),writable:!0})}:Bt})),xc,Sc=t((()=>{bc(),gc(),xc=fc(yc)}));function Cc(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 wc=t((()=>{}));function Tc(e){return e!==e}var Ec=t((()=>{}));function Dc(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}var Oc=t((()=>{}));function kc(e,t,n){return t===t?Dc(e,t,n):Cc(e,Tc,n)}var Ac=t((()=>{wc(),Ec(),Oc()}));function jc(e,t){return!!(e!=null&&e.length)&&kc(e,t,0)>-1}var Mc=t((()=>{Ac()}));function Nc(e,t,n){return t=Pc(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=Pc(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),uc(e,this,s)}}var Pc,Fc=t((()=>{dc(),Pc=Math.max}));function Ic(e,t){return xc(Nc(e,t,Bt),e+``)}var Lc=t((()=>{Rt(),Fc(),Sc()}));function Rc(e,t,n){if(!o(n))return!1;var r=typeof t;return(r==`number`?Sn(n)&&Tt(t,n.length):r==`string`&&t in n)?f(n[t],e):!1}var zc=t((()=>{ee(),Ht(),sn(),l()}));function Bc(e){return Ic(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&&Rc(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 Vc=t((()=>{Lc(),zc()}));function Hc(e){return St(e)||vt(e)||!!(Uc&&e&&e[Uc])}var Uc,Wc=t((()=>{s(),dt(),pt(),Uc=i?i.isConcatSpreadable:void 0}));function Gc(e,t,n,r,i){var a=-1,o=e.length;for(n||(n=Hc),i||(i=[]);++a<o;){var s=e[a];t>0&&n(s)?t>1?Gc(s,t-1,n,r,i):fn(i,s):r||(i[i.length]=s)}return i}var Kc=t((()=>{yt(),Wc()}));function qc(e){return e!=null&&e.length?Gc(e,1):[]}var Jc=t((()=>{Kc()}));function Yc(e){return xc(Nc(e,void 0,qc),e+``)}var Xc=t((()=>{Jc(),Fc(),Sc()}));function Zc(e){if(!$e(e)||c(e)!=Qc)return!1;var t=cr(e);if(t===null)return!0;var n=nl.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&tl.call(n)==rl}var Qc,$c,el,tl,nl,rl,il=t((()=>{a(),Wn(),et(),Qc=`[object Object]`,$c=Function.prototype,el=Object.prototype,tl=$c.toString,nl=el.hasOwnProperty,rl=tl.call(Object)}));function al(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 ol=t((()=>{}));function sl(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:al(e,t,n)}var cl=t((()=>{ol()}));function ll(e){return ul.test(e)}var ul,dl=t((()=>{ul=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`)}));function fl(e){return e.split(``)}var pl=t((()=>{}));function ml(e){return e.match(jl)||[]}var hl,gl,_l,vl,yl,bl,xl,Sl,Cl,wl,Tl,El,Dl,Ol,kl,Al,jl,Ml=t((()=>{hl=`\\ud800-\\udfff`,gl=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,_l=`\\ufe0e\\ufe0f`,vl=`[`+hl+`]`,yl=`[`+gl+`]`,bl=`\\ud83c[\\udffb-\\udfff]`,xl=`(?:`+yl+`|`+bl+`)`,Sl=`[^`+hl+`]`,Cl=`(?:\\ud83c[\\udde6-\\uddff]){2}`,wl=`[\\ud800-\\udbff][\\udc00-\\udfff]`,Tl=`\\u200d`,El=xl+`?`,Dl=`[`+_l+`]?`,Ol=`(?:`+Tl+`(?:`+[Sl,Cl,wl].join(`|`)+`)`+Dl+El+`)*`,kl=Dl+El+Ol,Al=`(?:`+[Sl+yl+`?`,yl,Cl,wl,vl].join(`|`)+`)`,jl=RegExp(bl+`(?=`+bl+`)|`+Al+kl,`g`)}));function Nl(e){return ll(e)?ml(e):fl(e)}var Pl=t((()=>{pl(),dl(),Ml()}));function Fl(e){return function(t){t=on(t);var n=ll(t)?Nl(t):void 0,r=n?n[0]:t.charAt(0),i=n?sl(n,1).join(``):t.slice(1);return r[e]()+i}}var Il=t((()=>{cl(),dl(),Pl(),hn()})),Ll,Rl=t((()=>{Il(),Ll=Fl(`toUpperCase`)}));function zl(e){return Ll(on(e).toLowerCase())}var Bl=t((()=>{hn(),Rl()}));function Vl(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 Hl=t((()=>{}));function Ul(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 Wl=t((()=>{})),Gl,Kl=t((()=>{Wl(),Gl=Ul()}));function ql(e,t){return e&&Gl(e,t,tn)}var Jl=t((()=>{Kl(),nn()}));function Yl(e,t){return function(n,r){if(n==null)return n;if(!Sn(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 Xl=t((()=>{Ht()})),Zl,Ql=t((()=>{Jl(),Xl(),Zl=Yl(ql)}));function $l(e,t,n,r){return Zl(e,function(e,i,a){t(r,e,n(e),a)}),r}var eu=t((()=>{Ql()}));function tu(e,t){return function(n,r){var i=St(n)?Vl:$l,a=t?t():{};return i(n,e,pn(r,2),a)}}var nu=t((()=>{Hl(),eu(),bt(),pt()}));function ru(e,t,n){(n!==void 0&&!f(e[t],n)||n===void 0&&!(t in e))&&lr(e,t,n)}var iu=t((()=>{pr(),ee()}));function au(e){return $e(e)&&Sn(e)}var ou=t((()=>{Ht(),et()}));function su(e,t){if(!(t===`constructor`&&typeof e[t]==`function`)&&t!=`__proto__`)return e[t]}var cu=t((()=>{}));function lu(e){return er(e,rr(e))}var uu=t((()=>{Yn(),Kn()}));function du(e,t,n,r,i,a,s){var c=su(e,n),l=su(t,n),d=s.get(l);if(d){ru(e,n,d);return}var f=a?a(c,l,n+``,e,t,s):void 0,p=f===void 0;if(p){var m=St(l),ee=!m&&Dt(l),te=!m&&!ee&&ct(l);f=l,m||ee||te?St(c)?f=c:au(c)?f=Nn(c):ee?(p=!1,f=Un(l,!0)):te?(p=!1,f=Xn(l,!0)):f=[]:Zc(l)||vt(l)?(f=c,vt(c)?f=lu(c):(!o(c)||u(c))&&(f=tr(l))):p=!1}p&&(s.set(l,f),i(f,l,r,a,s),s.delete(l)),ru(e,n,f)}var fu=t((()=>{iu(),$n(),Vn(),On(),ir(),dt(),pt(),ou(),Et(),d(),l(),il(),jt(),cu(),uu()}));function pu(e,t,n,r,i){e!==t&&Gl(t,function(a,s){if(i||(i=new mn),o(a))du(e,t,s,n,pu,r,i);else{var c=r?r(su(e,s),a,s+``,e,t,i):void 0;c===void 0&&(c=a),ru(e,s,c)}},rr)}var mu=t((()=>{an(),iu(),Kl(),fu(),l(),Kn(),cu()})),hu,gu=t((()=>{mu(),Vc(),hu=Bc(function(e,t,n,r){pu(e,t,n,r)})}));function _u(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 vu=t((()=>{}));function yu(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var bu=t((()=>{}));function xu(e,t){var n=[];return Zl(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}var Su=t((()=>{Ql()}));function Cu(e,t){return Ut(t,function(t){return e[t]})}var wu=t((()=>{un()}));function Tu(e){return e==null?[]:Cu(e,tn(e))}var Eu=t((()=>{wu(),nn()}));function Du(e,t){return t.length<2?e:Vt(e,al(t,0,-1))}var Ou=t((()=>{kt(),ol()}));function ku(e,t){return _n(e,t)}var Au=t((()=>{qt()}));function ju(e,t){var n={};return t=pn(t,3),ql(e,function(e,r,i){lr(n,r,t(e,r,i))}),n}var Mu=t((()=>{pr(),Jl(),bt()}));function Nu(e){if(typeof e!=`function`)throw TypeError(Pu);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 Pu,Fu=t((()=>{Pu=`Expected a function`}));function Iu(e,t){t=bn(t,e);var n=-1,r=t.length;if(!r)return!0;for(;++n<r;){var i=Zt(t[n]);if(i===`__proto__`&&!Lu.call(e,`__proto__`)||(i===`constructor`||i===`prototype`)&&n<r-1)return!1}var a=Du(e,t);return a==null||delete a[Zt(yu(t))]}var Lu,Ru=t((()=>{ln(),bu(),Ou(),nt(),Lu=Object.prototype.hasOwnProperty}));function zu(e){return Zc(e)?void 0:e}var Bu=t((()=>{il()})),Vu,Hu,Uu,Wu,Gu=t((()=>{un(),or(),Ru(),ln(),Yn(),Bu(),Xc(),ar(),Vu=1,Hu=2,Uu=4,Wu=Yc(function(e,t){var n={};if(e==null)return n;var r=!1;t=Ut(t,function(t){return t=bn(t,e),r||(r=t.length>1),t}),er(e,nr(e),n),r&&(n=Gn(n,Vu|Hu|Uu,zu));for(var i=t.length;i--;)Iu(n,t[i]);return n})}));function Ku(e,t,n,r){if(!o(e))return e;t=bn(t,e);for(var i=-1,a=t.length,s=a-1,c=e;c!=null&&++i<a;){var l=Zt(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:Tt(t[i+1])?[]:{})}qn(c,l,u),c=c[l]}return e}var qu=t((()=>{Bn(),ln(),sn(),l(),nt()}));function Ju(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=Vt(e,o);n(s,o)&&Ku(a,bn(o,e),s)}return a}var Yu=t((()=>{kt(),qu(),ln()}));function Xu(e,t){if(e==null)return{};var n=Ut(nr(e),function(e){return[e]});return t=pn(t),Ju(e,n,function(e,n){return t(e,n[0])})}var Zu=t((()=>{un(),bt(),Yu(),ar()})),Qu,$u=t((()=>{nu(),Qu=tu(function(e,t,n){e[+!n].push(t)},function(){return[[],[]]})}));function ed(e,t){return e+td(nd()*(t-e+1))}var td,nd,rd=t((()=>{td=Math.floor,nd=Math.random}));function id(e,t){return(St(e)?Pt:xu)(e,Nu(pn(t,3)))}var ad=t((()=>{ht(),Su(),bt(),pt(),Fu()}));function od(e){var t=e.length;return t?e[ed(0,t-1)]:void 0}var sd=t((()=>{rd()}));function cd(e){return od(Tu(e))}var ld=t((()=>{sd(),Eu()}));function ud(e){return(St(e)?od:cd)(e)}var dd=t((()=>{sd(),ld(),pt()}));function fd(e,t,n,r){return r=typeof r==`function`?r:void 0,e==null?e:Ku(e,t,n,r)}var pd=t((()=>{qu()})),md,hd=t((()=>{en(),Qe(),zt(),md=Yt&&1/Lt(new Yt([,-0]))[1]==1/0?function(e){return new Yt(e)}:Ye}));function gd(e,t,n){var r=-1,i=jc,a=e.length,o=!0,s=[],c=s;if(n)o=!1,i=_u;else if(a>=_d){var l=t?null:md(e);if(l)return Lt(l);o=!1,i=tt,c=new yn}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 _d,vd=t((()=>{cn(),Mc(),vu(),Xt(),hd(),zt(),_d=200}));function yd(e,t){return e&&e.length?gd(e,pn(t,2)):[]}var bd=t((()=>{bt(),vd()}));function xd(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 Sd=t((()=>{}));function Cd(e,t){return xd(e||[],t||[],qn)}var wd=t((()=>{Bn(),Sd()})),Td=t((()=>{dc(),gc(),Sc(),Mc(),Vc(),Xc(),Lc(),il(),Bl(),ol(),zc(),En(),Kc(),vc(),nu(),mu(),gu(),vu(),ou(),bu(),Ql(),Wl(),Xl(),Su(),wc(),Jl(),Jc(),Kl(),Ac(),Eu(),Ou(),Au(),Ec(),Il(),Mu(),Fu(),Pl(),Gu(),Zu(),cl(),dl(),$u(),Yu(),Ru(),rd(),ad(),dd(),qu(),pd(),Rl(),wu(),uu(),vd(),bd(),wd(),Sd()}));function Ed(){return process.env.CLAUDE_GB_ADAPTER_KEY||(process.env.USER_TYPE===`ant`?g(process.env.ENABLE_GROWTHBOOK_DEV)?`sdk-yZQvlplybuXjYh6L`:`sdk-xRVcrliHIlrg4og4`:`sdk-zAZezfDKGoZuXXKe`)}var Dd=t((()=>{h()}));function Od(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 kd(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 Ad(e){let t=j(),{resolvedPath:n,isSymlink:r}=fr(t,e);r&&A(`Reading through symlink: ${e} -> ${n}`);let i=Od(n),a=t.readFileSync(n,{encoding:i}),o=kd(a.slice(0,4096));return{content:a.replaceAll(`\r
3
+ `,`
4
+ `),encoding:i,lineEndings:o}}function jd(e){return Ad(e).content}var Md=t((()=>{M(),Jn()})),Nd,Pd,Fd=t((()=>{sf(),Jn(),ce(),Nd=class{constructor(){_(this,`cache`,new Map),_(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=Vd(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())}}},Pd=new Nd}));async function Id(e){try{return await pa(e),!0}catch{return!1}}function Ld(e){try{return j().readFileSync(e,{encoding:`utf8`})}catch(e){return I(e),null}}function Rd(e){let t=j();return Math.floor(t.statSync(e).mtimeMs)}async function zd(e){let t=await j().stat(e);return Math.floor(t.mtimeMs)}function Bd(e,t,n,r){let i=t;r===`CRLF`&&(i=t.replaceAll(`\r
7
+ `,`
8
+ `).split(`
9
+ `).join(`\r
10
+ `)),$d(e,i,{encoding:n})}function Vd(e){try{let{resolvedPath:t}=fr(j(),e);return Od(t)}catch(e){return Ln(e)?A(`detectFileEncoding failed for expected reason: ${e.code}`,{level:`debug`}):I(e),`utf8`}}function Hd(e,t=`utf8`){try{let n=j(),{resolvedPath:r}=fr(n,e),{buffer:i,bytesRead:a}=n.readSync(r,{length:4096});return kd(i.toString(t,0,a))}catch(e){return I(e),`LF`}}function Ud(e){return e.includes(` `)?e.replace(/^\t+/gm,e=>` `.repeat(e.length)):e}function Wd(e){let t=e?ei(e):void 0;return{absolutePath:t,relativePath:t?Yi(_r(),t):void 0}}function Gd(e){let{relativePath:t}=Wd(e);if(t&&!t.startsWith(`..`))return t;let n=Vi();return e.startsWith(n+Zi)?`~`+e.slice(n.length):e}function Kd(e){let t=j();try{let n=Gi(e),r=Wi(e,Ki(e)),i=t.readdirSync(n).filter(t=>Wi(t.name,Ki(t.name))===r&&R(n,t.name)!==e)[0];return i?i.name:void 0}catch(e){Fn(e)||I(e);return}}async function qd(e){let t=_r(),n=Gi(t),r=e;try{r=R(await fa(Gi(e)),Wi(e))}catch{}let i=n===Zi?Zi:n+Zi;if(!r.startsWith(i)||r.startsWith(t+Zi)||r===t)return;let a=R(t,Yi(n,r));try{return await pa(a),a}catch{return}}function Jd(){return!OO(`tengu_compact_line_prefix_killswitch`,!1)}function Yd({content:e,startLine:t}){if(!e)return``;let n=e.split(/\r?\n/);return Jd()?n.map((e,n)=>`${n+t}\t${e}`).join(`
11
+ `):n.map((e,n)=>{let r=String(n+t);return r.length>=6?`${r}→${e}`:`${r.padStart(6,` `)}→${e}`}).join(`
12
+ `)}function Xd(e){return e.match(/^\s*\d+[\u2192\t](.*)$/)?.[1]??e}function Zd(e){try{return j().isDirEmptySync(e)}catch(e){return Fn(e)}}function Qd(e){let{content:t}=Pd.readFile(e);return t}function $d(e,t,n={encoding:`utf-8`}){let r=j(),i=e;try{let t=r.readlinkSync(e);i=qi(t)?t:Xi(Gi(e),t),A(`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,A(`Preserving file permissions: ${o.toString(8)}`)}catch(e){if(!Fn(e))throw e;n.mode!==void 0&&(o=n.mode,A(`Setting permissions for new file: ${o.toString(8)}`))}try{A(`Writing to temp file: ${a}`);let e={encoding:n.encoding,flush:!0};!s&&n.mode!==void 0&&(e.mode=n.mode),ia(a,t,e),A(`Temp file written successfully, size: ${t.length} bytes`),s&&o!==void 0&&(Qi(a,o),A(`Applied original permissions to temp file`)),A(`Renaming ${a} to ${i}`),r.renameSync(a,i),A(`File ${i} written atomically`)}catch(e){A(`Failed to write file atomically: ${e}`,{level:`error`}),N(`tengu_atomic_write_error`,{});try{A(`Cleaning up temp file: ${a}`),r.unlinkSync(a)}catch(e){A(`Failed to clean up temp file: ${e}`)}A(`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),ia(i,t,e),A(`File ${i} written successfully with non-atomic fallback`)}catch(e){throw A(`Non-atomic write also failed: ${e}`),e}}}function ef(){let e=Gr(),t=Vi();if(e===`macos`)return R(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=R(e,n.name,`Desktop`);if(j().existsSync(t))return t}}catch(e){I(e)}}let n=R(t,`Desktop`);return j().existsSync(n)?n:t}function tf(e,t=af){try{return j().statSync(e).size<=t}catch{return!1}}function nf(e){let t=Ji(e);return t=t.replace(/\\/g,`/`),Gr()===`windows`&&(t=t.toLowerCase()),t}function rf(e,t){return nf(e)===nf(t)}var af,of,sf=t((()=>{hr(),ik(),gr(),M(),In(),Md(),Fd(),Jn(),Vr(),$r(),qr(),af=.25*1024*1024,of=`Note: your current working directory is`})),cf,lf,uf=t((()=>{m(),qr(),cf=p(function(){if(process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_MANAGED_SETTINGS_PATH)return process.env.CLAUDE_CODE_MANAGED_SETTINGS_PATH;switch(Gr()){case`macos`:return`/Library/Application Support/ClaudeCode`;case`windows`:return`C:\\Program Files\\ClaudeCode`;default:return`/etc/claude-code`}}),lf=p(function(){return R(cf(),`managed-settings.d`)})})),df,ff,pf,mf=t((()=>{df=[`auto`,`iterm2`,`iterm2_with_bell`,`terminal_bell`,`kitty`,`ghostty`,`notifications_disabled`],ff=[`normal`,`vim`],pf=[`auto`,`tmux`,`in-process`]}));function hf(){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 gf(){return qf||(qf=_f())}function _f(){if(lt())return!0;let e=H(),t=np();if(e.projects?.[t]?.hasTrustDialogAccepted)return!0;let n=Qr(_r());for(;;){if(e.projects?.[n]?.hasTrustDialogAccepted)return!0;let t=Qr(Xi(n,`..`));if(t===n)break;n=t}return!1}function vf(e){let t=Jf.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 V(e){let t=null;try{Of(F(),hf,n=>{let r=e(n);return r===n?n:(t={...r,projects:Sf(n.projects)},t)})&&t&&wf(t)}catch(n){A(`Failed to save config with lock: ${n}`,{level:`error`});let r=Mf(F(),hf);if(vf(r)){A(`saveGlobalConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`}),N(`tengu_config_auth_loss_prevented`,{});return}let i=e(r);if(i===r)return;t={...i,projects:Sf(r.projects)},Df(F(),t,Kf),wf(t)}}function yf(){return Qf}function bf(){let e=Xf+Zf;e>0&&N(`tengu_config_cache_stats`,{cache_hits:Xf,cache_misses:Zf,hit_rate:Xf/e}),Xf=0,Zf=0}function xf(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 Sf(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 Cf(){if(ep)return;ep=!0;let e=F();ra(e,{interval:$f,persistent:!1},t=>{t.mtimeMs<=Jf.mtime||j().readFile(e,{encoding:`utf-8`}).then(e=>{if(t.mtimeMs<=Jf.mtime)return;let n=fi(li(e));typeof n!=`object`||!n||(Jf={config:xf({...hf(),...n}),mtime:t.mtimeMs},Yf={mtime:t.mtimeMs,size:t.size})}).catch(()=>{})}),Rn(async()=>{na(e),ep=!1})}function wf(e){Jf={config:e,mtime:Date.now()},Yf=null}function H(){if(Jf.config)return Xf++,Jf.config;Zf++;try{let e=null;try{e=j().statSync(F())}catch{}let t=xf(Mf(F(),hf));return Jf={config:t,mtime:e?.mtimeMs??Date.now()},Yf=e?{mtime:e.mtimeMs,size:e.size}:null,Cf(),t}catch{return xf(Mf(F(),hf))}}function Tf(){let e=H().remoteControlAtStartup;return e===void 0?!1:e}function Ef(e){let t=H();return t.customApiKeyResponses?.approved?.includes(e)?`approved`:t.customApiKeyResponses?.rejected?.includes(e)?`rejected`:`new`}function Df(e,t,n){let r=Gi(e);j().mkdirSync(r),$d(e,k(Xu(t,(e,t)=>k(e)!==k(n[t])),null,2),{encoding:`utf-8`,mode:384}),e===F()&&Qf++}function Of(e,t,n){let r=t(),i=Gi(e),a=j();a.mkdirSync(i);let o;try{let i=`${e}.lock`,s=Date.now();o=mi(e,{lockfilePath:i,onCompromised:e=>{A(`Config lock compromised: ${e}`,{level:`error`})}});let c=Date.now()-s;if(c>100&&(A(`Lock acquisition took longer than expected - another Claude instance may be running`),N(`tengu_config_lock_contention`,{lock_time_ms:c})),Yf&&e===F())try{let t=a.statSync(e);(t.mtimeMs!==Yf.mtime||t.size!==Yf.size)&&N(`tengu_config_stale_write`,{read_mtime:Yf.mtime,write_mtime:t.mtimeMs,read_size:Yf.size,write_size:t.size})}catch(e){if(Mn(e)!==`ENOENT`)throw e}let l=Mf(e,t);if(e===F()&&vf(l))return A(`saveConfigWithLock: re-read config is missing auth that cache has; refusing to write to avoid wiping ~/.claude.json. See GH #3117.`,{level:`error`}),N(`tengu_config_auth_loss_prevented`,{}),!1;let u=n(l);if(u===l)return!1;let d=Xu(u,(e,t)=>k(e)!==k(r[t]));try{let t=Wi(e),n=Af();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=R(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(R(n,e))}catch{}}catch(e){Mn(e)!==`ENOENT`&&A(`Failed to backup config: ${e}`,{level:`error`})}return $d(e,k(d,null,2),{encoding:`utf-8`,mode:384}),e===F()&&Qf++,!0}finally{o&&o()}}function kf(){if(tp)return;let e=Date.now();yr(`info`,`enable_configs_started`),tp=!0,Mf(F(),hf,!0),yr(`info`,`enable_configs_completed`,{duration_ms:Date.now()-e})}function Af(){return R(ae(),`backups`)}function jf(e){let t=j(),n=Wi(e),r=Af();try{let e=t.readdirStringSync(r).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(e)return R(r,e)}catch{}let i=Gi(e);try{let r=t.readdirStringSync(i).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(r)return R(i,r);let a=`${e}.backup`;try{return t.statSync(a),a}catch{}}catch{}return null}function Mf(e,t,n){if(!tp)throw Error(`Config accessed before allowed.`);let r=j();try{let n=r.readFileSync(e,{encoding:`utf-8`});try{let e=Pn(li(n));return{...t(),...e}}catch(n){throw new Zn(n instanceof Error?n.message:String(n),e,t())}}catch(i){if(Mn(i)===`ENOENT`){let n=jf(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 Zn&&n)throw i;if(i instanceof Zn){if(A(`Config file corrupted, resetting to defaults: ${i.message}`,{level:`error`}),!Wf){Wf=!0;try{I(i);let t=!1;try{r.statSync(`${e}.backup`),t=!0}catch{}N(`tengu_config_parse_error`,{has_backup:t})}finally{Wf=!1}}process.stderr.write(`\nClaude configuration file at ${e} is corrupted: ${i.message}\n`);let t=Wi(e),n=Af();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(R(n,e),{encoding:`utf-8`})){s=!0;break}}catch{}if(!s){o=R(n,`${t}.corrupted.${Date.now()}`);try{r.copyFileSync(e,o),A(`Corrupted config backed up to: ${o}`,{level:`error`})}catch{}}let l=jf(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.
13
+ `),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(`
14
+ `)}return t()}}function Nf(){let e=np(),t=H();if(!t.projects)return Gf;let n=t.projects[e]??Gf;return typeof n.allowedTools==`string`&&(n.allowedTools=fi(n.allowedTools)??[]),n}function Pf(e){let t=np(),n=null;try{Of(F(),hf,r=>{let i=r.projects?.[t]??Gf,a=e(i);return a===i?r:(n={...r,projects:{...r.projects,[t]:a}},n)})&&n&&wf(n)}catch(r){A(`Failed to save config with lock: ${r}`,{level:`error`});let i=Mf(F(),hf);if(vf(i)){A(`saveCurrentProjectConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`}),N(`tengu_config_auth_loss_prevented`,{});return}let a=i.projects?.[t]??Gf,o=e(a);if(o===a)return;n={...i,projects:{...i.projects,[t]:o}},Df(F(),n,Kf),wf(n)}}function Ff(){return Rf()!==null}function If(){return Ff()&&!g(process.env.FORCE_AUTOUPDATE_PLUGINS)}function Lf(e){switch(e.type){case`development`:return`development build`;case`env`:return`${e.envVar} set`;case`config`:return`config`}}function Rf(){if(!g(process.env.ENABLE_AUTOUPDATER))return{type:`config`};if(g(process.env.DISABLE_AUTOUPDATER))return{type:`env`,envVar:`DISABLE_AUTOUPDATER`};let e=Ur();if(e)return{type:`env`,envVar:e};let t=H();return t.autoUpdates===!1&&(t.installMethod!==`native`||t.autoUpdatesProtectedForNative!==!0)?{type:`config`}:null}function zf(){let e=H();if(e.userID)return e.userID;let t=oa(32).toString(`hex`);return V(e=>({...e,userID:t})),t}function Bf(){if(!H().firstStartTime){let e=new Date().toISOString();V(t=>({...t,firstStartTime:t.firstStartTime??e}))}}function Vf(e){let t=dn();switch(e){case`User`:return R(ae(),`CLAUDE.md`);case`Local`:return R(t,`CLAUDE.local.md`);case`Project`:return R(t,`CLAUDE.md`);case`Managed`:return R(cf(),`CLAUDE.md`);case`AutoMem`:return pk()}return``}function Hf(){return R(cf(),`.claude`,`rules`)}function Uf(){return R(ae(),`rules`)}var Wf,Gf,Kf,qf,Jf,Yf,Xf,Zf,Qf,$f,ep,tp,np,rp=t((()=>{m(),Zu(),O(),vk(),hr(),gr(),zn(),M(),br(),Fr(),h(),In(),sf(),Jn(),wr(),di(),si(),gi(),Vr(),$r(),zr(),uf(),ur(),mf(),Wf=!1,Gf={allowedTools:[],mcpContextUris:[],mcpServers:{},enabledMcpjsonServers:[],disabledMcpjsonServers:[],hasTrustDialogAccepted:!1,projectOnboardingSeenCount:0,hasClaudeMdExternalIncludesApproved:!1,hasClaudeMdExternalIncludesWarningShown:!1},Kf=hf(),qf=!1,{...Kf},{...Gf},Jf={config:null,mtime:0},Yf=null,Xf=0,Zf=0,Qf=0,Rn(async()=>{bf()}),$f=1e3,ep=!1,tp=!1,np=p(()=>{let e=dn();return Qr(Sr(e)||Xi(e))})}));function ip(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 ap=t((()=>{}));function op(e){pp=e}function sp(){pp=null,mp=void 0}function cp(e){return mp=e,e}function lp(){return R(ae(),fp)}function up(){try{let e=Pn(li(jd(lp())));return!e||typeof e!=`object`||Array.isArray(e)?null:e}catch{return null}}function dp(){if(mp!==!0)return null;if(pp)return pp;let e=up();return e?(pp=e,gt(),e):null}var fp,pp,mp,hp=t((()=>{h(),Md(),si(),Ft(),ur(),fp=`remote-settings.json`,pp=null}));async function gp(e,t){let{code:n}=await ri(`git`,[`check-ignore`,e],{preserveOutputOnError:!1,cwd:t});return n===0}function _p(){return R(Vi(),`.config`,`git`,`ignore`)}async function vp(e,t=_r()){try{if(!await Cr(t))return;let n=`**/${e}`;if(await gp(e.endsWith(`/`)?`${e}sample-file.txt`:e,t))return;let r=_p();await la(Gi(r),{recursive:!0});try{if((await ua(r,{encoding:`utf-8`})).includes(n))return;await ca(r,`\n${n}\n`)}catch(e){if(Mn(e)===`ENOENT`)await ha(r,`${n}\n`,`utf-8`);else throw e}}catch(e){I(e)}}var yp=t((()=>{gr(),In(),ii(),wr(),Vr()}));function bp(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 xp(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 Sp(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 Cp(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 wp(e){if(e===``)return[];let t=e.split(`,`).map(e=>e.trim()),n=[];for(let e of t)switch(e){case`user`:n.push(`userSettings`);break;case`project`:n.push(`projectSettings`);break;case`local`:n.push(`localSettings`);break;default:throw Error(`Invalid setting source: ${e}. Valid options are: user, project, local`)}return n}function Tp(){let e=Kt(),t=new Set(e);return t.add(`policySettings`),t.add(`flagSettings`),Array.from(t)}function Ep(e){return Tp().includes(e)}var Dp,Op,kp,Ap=t((()=>{O(),Dp=[`userSettings`,`projectSettings`,`localSettings`,`flagSettings`,`policySettings`],Op=[`localSettings`,`projectSettings`,`userSettings`],kp=`https://json.schemastore.org/claude-code-settings.json`}));function jp(e){Pp.set(e,Date.now())}function Mp(e,t){let n=Pp.get(e);return n!==void 0&&Date.now()-n<t?(Pp.delete(e),!0):!1}function Np(){Pp.clear()}var Pp,Fp=t((()=>{Pp=new Map})),Ip,Lp,Rp,zp=t((()=>{Je(),Ei(),Ip=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()),Lp=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()),Rp=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:Ip(),filesystem:Lp(),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())})),Bp,Vp,Hp,Up=t((()=>{Fr(),Bp=Lr.platform===`darwin`?`⏺`:`●`,Vp=[`·|·`,`·/·`,`·—·`,`·\\·`],Hp=`·✔︎·`}));function Wp(e){return process.env.USER_TYPE===`ant`?e!==`auto`&&e!==`bubble`:!0}function Gp(e){return tm[e]??tm.default}function Kp(e){return Gp(e).external}function qp(e){return Oi.includes(e)?e:`default`}function Jp(e){return Gp(e).title}function Yp(e){return e===`default`||e===void 0}function Xp(e){return Gp(e).shortTitle}function Zp(e){return Gp(e).symbol}function Qp(e){return Gp(e).color}var $p,em,tm,nm=t((()=>{Je(),Up(),Di(),Ei(),$p=L(()=>Ke.enum(Oi)),em=L(()=>Ke.enum(ki)),tm={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`}}})),rm,im=t((()=>{rm=`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(`.`)})),am,om,sm=t((()=>{am=[`bash`,`powershell`],om=`bash`}));function cm(){return{BashCommandHookSchema:D({type:T(`command`).describe(`Shell command hook type`),command:b().describe(`Shell command to execute`),if:lm(),shell:E(am).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:lm(),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:lm(),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:lm(),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 lm,um,dm,fm,pm=t((()=>{im(),Je(),Ei(),sm(),lm=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.`)),um=L(()=>{let{BashCommandHookSchema:e,PromptHookSchema:t,AgentHookSchema:n,HttpHookSchema:r}=cm();return We(`type`,[e,t,n,r])}),dm=L(()=>D({matcher:b().optional().describe(`String pattern to match (e.g. tool names like "Write")`),hooks:S(um()).describe(`List of hooks to execute when the matcher matches`)})),fm=L(()=>Le(E(rm),S(dm())))}));function mm(e,t){let n=e.toLowerCase();return t.autoUpdate??(ym.has(n)&&!bm.has(n))}function hm(e){return ym.has(e.toLowerCase())?!1:Sm.test(e)?!0:xm.test(e)}function gm(e,t){let n=e.toLowerCase();if(!ym.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/${Cm}/' 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/${Cm}/' can use this name.`}return`The name '${e}' is reserved for official Anthropic marketplaces and can only be used with GitHub sources from the '${Cm}' organization.`}function _m(e){return typeof e==`string`&&e.startsWith(`./`)}function vm(e){return e.source===`file`||e.source===`directory`}var ym,bm,xm,Sm,Cm,wm,Tm,Em,Dm,Om,km,Am,jm,Mm,Nm,Pm,Fm,Im,Lm,Rm,zm,Bm,Vm,Hm,Um,Wm,Gm,Km,qm,Jm,Ym,Xm,Zm,Qm,$m,eh,th,nh,rh,ih,ah,oh,sh,ch,lh,uh,dh,fh=t((()=>{Je(),pm(),oi(),Ei(),ym=new Set([`claude-code-marketplace`,`claude-code-plugins`,`claude-plugins-official`,`anthropic-marketplace`,`anthropic-plugins`,`agent-skills`,`life-sciences`,`knowledge-work-plugins`]),bm=new Set([`knowledge-work-plugins`]),xm=/(?:official[^a-z0-9]*(anthropic|claude)|(?:anthropic|claude)[^a-z0-9]*official|^(?:anthropic|claude)[^a-z0-9]*(marketplace|plugins|official))/i,Sm=/[^\u0020-\u007E]/,Cm=`anthropics`,wm=L(()=>b().startsWith(`./`)),Tm=L(()=>wm().endsWith(`.json`)),Em=L(()=>C([wm().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`)])),Dm=L(()=>wm().endsWith(`.md`)),Om=L(()=>C([Dm(),wm()])),km=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=>!hm(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`})),Am=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`)})),jm=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:Am().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(ih()).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.`)})),Mm=L(()=>D({description:b().optional().describe(`Brief, user-facing explanation of what these hooks provide`),hooks:Ue(()=>fm()).describe(`The hooks provided by the plugin, in the same format as the one used for settings`)})),Nm=L(()=>D({hooks:C([Tm().describe(`Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root`),Ue(()=>fm()).describe(`Additional hooks (in addition to those in hooks/hooks.json, if it exists)`),S(C([Tm().describe(`Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root`),Ue(()=>fm()).describe(`Additional hooks (in addition to those in hooks/hooks.json, if it exists)`)]))])})),Pm=L(()=>D({source:Om().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`})),Fm=L(()=>D({commands:C([Om().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(Om().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(),Pm()).describe(`Object mapping of command names to their metadata and source files. Command name becomes the slash command name (e.g., "about" → "/plugin:about")`)])})),Im=L(()=>D({agents:C([Dm().describe(`Path to additional agent file (in addition to those in the agents/ directory, if it exists), relative to the plugin root`),S(Dm().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`)])})),Lm=L(()=>D({skills:C([wm().describe(`Path to additional skill directory (in addition to those in the skills/ directory, if it exists), relative to the plugin root`),S(wm().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`)])})),Rm=L(()=>D({outputStyles:C([wm().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(wm().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`)])})),zm=L(()=>b().min(1)),Bm=L(()=>b().min(2).refine(e=>e.startsWith(`.`),{message:`File extensions must start with dot (e.g., ".ts", not "ts")`})),Vm=L(()=>D({mcpServers:C([Tm().describe(`MCP servers to include in the plugin (in addition to those in the .mcp.json file, if it exists)`),Em().describe(`Path or URL to MCPB file containing MCP server configuration`),x(b(),ui()).describe(`MCP server configurations keyed by server name`),S(C([Tm().describe(`Path to MCP servers configuration file`),Em().describe(`Path or URL to MCPB file`),x(b(),ui()).describe(`Inline MCP server configurations`)])).describe(`Array of MCP server configurations (paths, MCPB files, or inline definitions)`)])})),Hm=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()),Um=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`),Hm()).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).")})),Wm=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(),Hm()).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.`)})),Gm=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(zm()).optional().describe(`Command-line arguments to pass to the server`),extensionToLanguage:x(Bm(),zm()).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`)})),Km=L(()=>D({lspServers:C([Tm().describe(`Path to .lsp.json configuration file relative to plugin root`),x(b(),Gm()).describe(`LSP server configurations keyed by server name`),S(C([Tm().describe(`Path to LSP configuration file`),x(b(),Gm()).describe(`Inline LSP server configurations`)])).describe(`Array of LSP server configurations (paths or inline definitions)`)])})),qm=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`)),Jm=L(()=>D({settings:x(b(),Ve()).optional().describe(`Settings to merge when plugin is enabled. Only allowlisted keys are kept (currently: agent)`)})),Ym=L(()=>D({...jm().shape,...Nm().partial().shape,...Fm().partial().shape,...Im().partial().shape,...Lm().partial().shape,...Rm().partial().shape,...Wm().partial().shape,...Vm().partial().shape,...Km().partial().shape,...Jm().partial().shape,...Um().partial().shape})),Xm=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:qm().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:km().refine(e=>!ym.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($m()).describe(`Plugin entries declared inline in settings.json`),owner:Am().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).`)])),Zm=L(()=>b().length(40).regex(/^[a-f0-9]{40}$/,`Must be a full 40-character lowercase git commit SHA`)),Qm=L(()=>C([wm().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:qm().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:Zm().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:Zm().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:Zm().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.`)])),$m=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:Qm().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.`})),eh=L(()=>Ym().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:Qm().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.`)})),th=L(()=>D({name:km(),owner:Am().describe(`Marketplace maintainer or curator information`),plugins:S(eh()).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.`)})),nh=L(()=>b().regex(/^[a-z0-9][-a-z0-9._]*@[a-z0-9][-a-z0-9._]*$/i,`Plugin ID must be in format: plugin@marketplace`)),rh=/^[a-z0-9][-a-z0-9._]*(@[a-z0-9][-a-z0-9._]*)?(@\^[^@]*)?$/i,ih=L(()=>C([b().regex(rh,`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([nh(),D({id:nh().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`)})])),ah=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)`)})),oh=L(()=>D({version:T(1).describe(`Schema version 1`),plugins:x(nh(),ah()).describe(`Map of plugin IDs to their installation metadata`)})),sh=L(()=>E([`managed`,`user`,`project`,`local`])),ch=L(()=>D({scope:sh().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`)})),lh=L(()=>D({version:T(2).describe(`Schema version 2`),plugins:x(nh(),S(ch())).describe(`Map of plugin IDs to arrays of installation entries`)})),L(()=>C([oh(),lh()])),uh=L(()=>D({source:Xm().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`)})),dh=L(()=>x(b(),uh()))}));function ph(e){let[t,n,...r]=e.split(`__`);return t!==`mcp`||!n?null:{serverName:n,toolName:r.length>0?r.join(`__`):void 0}}function mh(e){return`mcp__${Ai(e)}__`}function hh(e,t){return`${mh(e)}${Ai(t)}`}function gh(e){return e.mcpInfo?hh(e.mcpInfo.serverName,e.mcpInfo.toolName):e.name}function _h(e,t){let n=`mcp__${Ai(t)}__`;return e.replace(n,``)}function vh(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 yh=t((()=>{ji()})),bh,xh,Sh,Ch,wh=t((()=>{bh=`Agent`,xh=`Task`,Sh=`verification`,Ch=new Set([`Explore`,`Plan`])})),Th,Eh=t((()=>{Th=`TaskOutput`})),Dh,Oh,kh=t((()=>{Dh=`TaskStop`,Oh=`
15
+ - Stops a running background task by its ID
16
+ - Takes a task_id parameter identifying the task to stop
17
+ - Returns a success or failure status
18
+ - Use this tool when you need to terminate a long-running task
19
+ `})),Ah=r({BRIEF_PROACTIVE_SECTION:()=>Fh,BRIEF_TOOL_NAME:()=>jh,BRIEF_TOOL_PROMPT:()=>Ph,DESCRIPTION:()=>Nh,LEGACY_BRIEF_TOOL_NAME:()=>Mh}),jh,Mh,Nh,Ph,Fh,Ih=t((()=>{jh=`SendUserMessage`,Mh=`Brief`,Nh=`Send a message to the user`,Ph="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.",Fh=`## Talking to the user
20
+
21
+ ${jh} 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 ${jh}. The failure mode: the real answer lives in plain text while ${jh} just says "done!" — they see "done!" and miss everything.
22
+
23
+ So: every time the user says something, the reply they actually read comes through ${jh}. Even for "hi". Even for "thanks".
24
+
25
+ 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.
26
+
27
+ 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.
28
+
29
+ Keep messages tight — the decision, the file:line, the PR number. Second person always ("your config"), never third.`}));function Lh(e){return Kh[e]??e}function Rh(e){let t=[];for(let[n,r]of Object.entries(Kh))r===e&&t.push(n);return t}function zh(e){return e.replace(/\\/g,`\\\\`).replace(/\(/g,`\\(`).replace(/\)/g,`\\)`)}function Bh(e){return e.replace(/\\\(/g,`(`).replace(/\\\)/g,`)`).replace(/\\\\/g,`\\`)}function Vh(e){let t=Uh(e,`(`);if(t===-1)return{toolName:Lh(e)};let n=Wh(e,`)`);if(n===-1||n<=t||n!==e.length-1)return{toolName:Lh(e)};let r=e.substring(0,t),i=e.substring(t+1,n);if(!r)return{toolName:Lh(e)};if(i===``||i===`*`)return{toolName:Lh(r)};let a=Bh(i);return{toolName:Lh(r),ruleContent:a}}function Hh(e){if(!e.ruleContent)return e.toolName;let t=zh(e.ruleContent);return`${e.toolName}(${t})`}function Uh(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 Wh(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 Gh,Kh,qh=t((()=>{wh(),Eh(),kh(),Gh=(Ih(),e(Ah)).BRIEF_TOOL_NAME,Kh={Task:bh,KillShell:Dh,AgentOutputTool:Th,BashOutputTool:Th,...Gh?{Brief:Gh}:{}}}));function Jh(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Yh(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Xh(e,t,n=t+`s`){return e===1?t:n}function Zh(e){let t=e.indexOf(`
30
+ `);return t===-1?e:e.slice(0,t)}function Qh(e,t,n=0){let r=0,i=e.indexOf(t,n);for(;i!==-1;)r++,i=e.indexOf(t,i+1);return r}function $h(e){return e.replace(/[0-9]/g,e=>String.fromCharCode(e.charCodeAt(0)-65248))}function eg(e){return e.replace(/\u3000/g,` `)}function tg(e,t=`,`,n=rg){let r=`...[truncated]`,i=``;for(let a of e){let e=i?t:``,o=e+a;if(i.length+o.length<=n)i+=o;else{let t=n-i.length-e.length-14;return t>0?i+=e+a.slice(0,t)+r:i+=r,i}}return i}function ng(e,t){let n=e.split(`
31
+ `);return n.length<=t?e:n.slice(0,t).join(`
32
+ `)+`…`}var rg,ig,ag=t((()=>{ce(),rg=2**21,ig=class{constructor(e=rg){_(this,`content`,``),_(this,`isTruncated`,!1),_(this,`totalBytesReceived`,0),this.maxSize=e}append(e){let t=typeof e==`string`?e:e.toString();if(this.totalBytesReceived+=t.length,!(this.isTruncated&&this.content.length>=this.maxSize))if(this.content.length+t.length>this.maxSize){let e=this.maxSize-this.content.length;e>0&&(this.content+=t.slice(0,e)),this.isTruncated=!0}else this.content+=t}toString(){if(!this.isTruncated)return this.content;let e=this.totalBytesReceived-this.maxSize,t=Math.round(e/1024);return this.content+`\n... [output truncated - ${t}KB removed]`}clear(){this.content=``,this.isTruncated=!1,this.totalBytesReceived=0}get length(){return this.content.length}get truncated(){return this.isTruncated}get totalBytes(){return this.totalBytesReceived}}}));function og(e){return lg.filePatternTools.includes(e)}function sg(e){return lg.bashPrefixTools.includes(e)}function cg(e){return lg.customValidation[e]}var lg,ug=t((()=>{lg={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 dg(e,t){let n=0,r=t-1;for(;r>=0&&e[r]===`\\`;)n++,r--;return n%2!=0}function fg(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&!dg(e,r)&&n++;return n}function pg(e){for(let t=0;t<e.length-1;t++)if(e[t]===`(`&&e[t+1]===`)`&&!dg(e,t))return!0;return!1}function mg(e,t){if(!e||e.trim()===``)return{valid:!1,error:`Permission rule cannot be empty`};if(fg(e,`(`)!==fg(e,`)`))return{valid:!1,error:`Mismatched parentheses`,suggestion:`Ensure all opening parentheses have matching closing parentheses`};if(pg(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=Vh(e),r=ph(n.toolName);if(r)return n.ruleContent!==void 0||fg(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 "${Yh(String(n.toolName))}"`};let i=cg(n.toolName);if(i&&n.ruleContent!==void 0){let e=i(n.ruleContent);if(!e.valid)return e}if(sg(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(og(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&&hg.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 hg,gg,_g=t((()=>{Je(),yh(),Ei(),qh(),ag(),ug(),hg=new Set([`LocalVaultFetch`,`VaultHttpFetch`]),gg=L(()=>b().superRefine((e,t)=>{let n=mg(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 vg(e){return`serverName`in e&&e.serverName!==void 0}function yg(e){return`serverCommand`in e&&e.serverCommand!==void 0}function bg(e){return`serverUrl`in e&&e.serverUrl!==void 0}var xg,Sg,Cg,wg,Tg,Eg,Dg,Og=t((()=>{Je(),zp(),h(),Ei(),nm(),fh(),Ap(),_g(),pm(),Ci(),xg=L(()=>x(b(),Ge())),Sg=L(()=>D({allow:S(gg()).optional().describe(`List of permission rules for allowed operations`),deny:S(gg()).optional().describe(`List of permission rules for denied operations`),ask:S(gg()).optional().describe(`List of permission rules that should always prompt for confirmation`),defaultMode:E(Oi).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()),Cg=L(()=>D({source:Xm().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`)})),wg=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=>vi([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"`})),Tg=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=>vi([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"`})),Eg=[`skills`,`agents`,`hooks`,`mcp`],Dg=L(()=>D({$schema:T(kp).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)`),...g(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:xg().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:Sg().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(wg()).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(Tg()).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:fm().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 'bash' on all platforms (no Windows auto-flip).`),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=>Eg.includes(e)):e,C([w(),S(E(Eg))])).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(),Cg()).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(Xm()).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(Xm()).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`),sandbox:Rp().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: 80.`),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 kg(){return k(ze(Dg(),{unrepresentable:`any`}),null,2)}var Ag=t((()=>{Je(),ur(),Og()}));function jg(e){let t=Ng.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=Pg[t])}return n}var Mg,Ng,Pg,Fg=t((()=>{Mg=`https://code.claude.com/docs/en`,Ng=[{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:`${Mg}/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:`${Mg}/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:`${Mg}/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:`${Mg}/iam#working-directories`}}],Pg={permissions:`${Mg}/iam#configuring-permissions`,env:`${Mg}/settings#environment-variables`,hooks:`${Mg}/hooks`}}));function Ig(e){return e.code===`invalid_type`}function Lg(e){return e.code===`invalid_value`}function Rg(e){return e.code===`unrecognized_keys`}function zg(e){return e.code===`too_small`}function Bg(e){return e===null?`null`:e===void 0?`undefined`:Array.isArray(e)?`array`:typeof e}function Vg(e){let t=e.match(/received (\w+)/);return t?t[1]:void 0}function Hg(e,t){return e.issues.map(e=>{let n=e.path.map(String).join(`.`),r=e.message,i,a,o,s,c;if(Lg(e))a=e.values.map(e=>String(e)),o=a.join(` | `),s=void 0,c=void 0;else if(Ig(e)){o=e.expected;let t=Vg(e.message);s=t??Bg(e.input),c=t??Bg(e.input)}else zg(e)?o=String(e.minimum):e.code===`custom`&&`params`in e&&(s=e.params.received,c=s);let l=jg({path:n,code:e.code,expected:o,received:s,enumValues:a,message:e.message,value:s});if(Lg(e))i=a?.map(e=>`"${e}"`).join(`, `),r=`Invalid value. Expected one of: ${i}`;else if(Ig(e)){let t=Vg(e.message)??Bg(e.input);r=e.expected===`object`&&t===`null`&&n===``?`Invalid or malformed JSON`:`Expected ${e.expected}, but received ${t}`}else if(Rg(e)){let t=e.keys.join(`, `);r=`Unrecognized ${Xh(e.keys.length,`field`)}: ${t}`}else zg(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 Ug(e){try{let t=Pn(e),n=Dg().strict().safeParse(t);return n.success?{isValid:!0}:{isValid:!1,error:`Settings validation failed:
33
+ `+Hg(n.error,`settings`).map(e=>`- ${e.path}: ${e.message}`).join(`
34
+ `),fullSchema:kg()}}catch(e){return{isValid:!1,error:`Invalid JSON: ${e instanceof Error?e.message:`Unknown parsing error`}`,fullSchema:kg()}}}function Wg(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=mg(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 Gg=t((()=>{ur(),ag(),_g(),Ag(),Og(),Fg()}));function Kg(){let e=``;try{e=Hi().username}catch{}let t=[];return e&&t.push({path:`/Library/Managed Preferences/${e}/${qg}.plist`,label:`per-user managed preferences`}),t.push({path:`/Library/Managed Preferences/${qg}.plist`,label:`device-level managed preferences`}),process.env.USER_TYPE===`ant`&&t.push({path:R(Vi(),`Library`,`Preferences`,`${qg}.plist`),label:`user preferences (ant-only)`}),t}var qg,Jg,Yg,Xg,Zg,Qg,$g,e_=t((()=>{qg=`com.anthropic.claudecode`,Jg=`HKLM\\SOFTWARE\\Policies\\ClaudeCode`,Yg=`HKCU\\SOFTWARE\\Policies\\ClaudeCode`,Xg=`Settings`,Zg=`/usr/bin/plutil`,Qg=[`-convert`,`json`,`-o`,`-`,`--`],$g=5e3}));function t_(e,t){return new Promise(n=>{_a(e,t,{encoding:`utf-8`,timeout:$g},(e,t)=>{n({stdout:t??``,code:+!!e})})})}function n_(){return(async()=>{if(process.platform===`darwin`){let e=Kg(),t=(await Promise.all(e.map(async({path:e,label:t})=>{if(!$i(e))return{stdout:``,label:t,ok:!1};let{stdout:n,code:r}=await t_(Zg,[...Qg,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([t_(`reg`,[`query`,Jg,`/v`,Xg]),t_(`reg`,[`query`,Yg,`/v`,Xg])]);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 r_(){a_||(a_=n_())}function i_(){return a_}var a_,o_=t((()=>{e_(),a_=null}));function s_(){b_||(b_=(async()=>{wi(`mdm_load_start`);let e=Date.now(),{mdm:t,hkcu:n}=h_(await(i_()??n_()));v_=t,y_=n,wi(`mdm_load_end`);let r=Date.now()-e;if(A(`MDM settings load completed in ${r}ms`),Object.keys(t.settings).length>0){A(`MDM settings found: ${Object.keys(t.settings).join(`, `)}`);try{yr(`info`,`mdm_settings_loaded`,{duration_ms:r,key_count:Object.keys(t.settings).length,error_count:t.errors.length})}catch{}}})())}async function c_(){b_||s_(),await b_}function l_(){return v_??__}function u_(){return y_??__}function d_(e,t){v_=e,y_=t}async function f_(){return h_(await n_())}function p_(e,t){let n=fi(e,!1);if(!n||typeof n!=`object`)return{settings:{},errors:[]};let r=Wg(n,t),i=Dg().safeParse(n);if(!i.success){let e=Hg(i.error,t);return{settings:{},errors:[...r,...e]}}return{settings:i.data,errors:r}}function m_(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 h_(e){if(e.plistStdouts&&e.plistStdouts.length>0){let{stdout:t,label:n}=e.plistStdouts[0],r=p_(t,n);if(Object.keys(r.settings).length>0)return{mdm:r,hkcu:__}}if(e.hklmStdout){let t=m_(e.hklmStdout);if(t){let e=p_(t,`Registry: ${Jg}\\${Xg}`);if(Object.keys(e.settings).length>0)return{mdm:e,hkcu:__}}}if(g_())return{mdm:__,hkcu:__};if(e.hkcuStdout){let t=m_(e.hkcuStdout);if(t)return{mdm:__,hkcu:p_(t,`Registry: ${Yg}\\${Xg}`)}}return{mdm:__,hkcu:__}}function g_(){try{let e=fi(jd(R(cf(),`managed-settings.json`)),!1);if(e&&typeof e==`object`&&Object.keys(e).length>0)return!0}catch{}try{let e=lf(),t=j().readdirSync(e);for(let n of t)if(!(!(n.isFile()||n.isSymbolicLink())||!n.name.endsWith(`.json`)||n.name.startsWith(`.`)))try{let t=fi(jd(R(e,n.name)),!1);if(t&&typeof t==`object`&&Object.keys(t).length>0)return!0}catch{}}catch{}return!1}var __,v_,y_,b_,x_=t((()=>{M(),br(),Md(),Jn(),di(),Ti(),uf(),Og(),Gg(),e_(),o_(),__=Object.freeze({settings:{},errors:[]}),v_=null,y_=null,b_=null}));function S_(){return R(cf(),`managed-settings.json`)}function C_(){let e=[],t={},n=!1,{settings:r,errors:i}=E_(S_());e.push(...i),r&&Object.keys(r).length>0&&(t=hu(t,r,I_),n=!0);let a=lf();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}=E_(R(a,i));e.push(...o),r&&Object.keys(r).length>0&&(t=hu(t,r,I_),n=!0)}}catch(e){let t=Mn(e);t!==`ENOENT`&&t!==`ENOTDIR`&&I(e)}return{settings:n?t:null,errors:e}}function w_(){let{settings:e}=E_(S_()),t=!!e&&Object.keys(e).length>0,n=!1,r=lf();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 T_(e,t){typeof e==`object`&&e&&`code`in e&&e.code===`ENOENT`?A(`Broken symlink or missing file encountered for settings.json at path: ${t}`):I(e)}function E_(e){let t=wt(e);if(t)return{settings:t.settings?Dn(t.settings):null,errors:t.errors};let n=D_(e);return Nt(e,n),{settings:n.settings?Dn(n.settings):null,errors:n.errors}}function D_(e){try{let{resolvedPath:t}=fr(j(),e),n=jd(t);if(n.trim()===``)return{settings:{},errors:[]};let r=fi(n,!1),i=Wg(r,e),a=Dg().safeParse(r);if(!a.success){let t=Hg(a.error,e);return{settings:null,errors:[...i,...t]}}return{settings:a.data,errors:i}}catch(t){return T_(t,e),{settings:null,errors:[]}}}function O_(e){switch(e){case`userSettings`:return Xi(ae());case`policySettings`:case`projectSettings`:case`localSettings`:return Xi(dn());case`flagSettings`:{let e=_t();return e?Gi(Xi(e)):Xi(dn())}}}function k_(){return Qt()||g(process.env.CLAUDE_CODE_USE_COWORK_PLUGINS)?`cowork_settings.json`:`settings.json`}function A_(e){switch(e){case`userSettings`:return R(O_(e),k_());case`projectSettings`:case`localSettings`:return R(O_(e),j_(e));case`policySettings`:return S_();case`flagSettings`:return _t()}}function j_(e){switch(e){case`projectSettings`:return R(`.claude`,`settings.json`);case`localSettings`:return R(`.claude`,`settings.local.json`)}}function U(e){let t=At(e);if(t!==void 0)return t;let n=M_(e);return It(e,n),n}function M_(e){if(e===`policySettings`){let e=dp();if(e&&Object.keys(e).length>0)return e;let t=l_();if(Object.keys(t.settings).length>0)return t.settings;let{settings:n}=C_();if(n)return n;let r=u_();return Object.keys(r.settings).length>0?r.settings:null}let t=A_(e),{settings:n}=t?E_(t):{settings:null};if(e===`flagSettings`){let e=ut();if(e){let t=Dg().safeParse(e);if(t.success)return hu(n||{},t.data,I_)}}return n}function N_(){let e=dp();if(e&&Object.keys(e).length>0)return`remote`;let t=l_();if(Object.keys(t.settings).length>0)return Gr()===`macos`?`plist`:`hklm`;let{settings:n}=C_();if(n)return`file`;let r=u_();return Object.keys(r.settings).length>0?`hkcu`:null}function P_(e,t){if(e===`policySettings`||e===`flagSettings`)return{error:null};let n=A_(e);if(!n)return{error:null};try{j().mkdirSync(Gi(n));let r=M_(e);if(!r){let e=null;try{e=jd(n)}catch(e){if(!Fn(e))throw e}if(e!==null){let t=fi(e);if(t===null)return{error:Error(`Invalid JSON syntax in settings file at ${n}`)};t&&typeof t==`object`&&(r=t,A(`Using raw settings from ${n} due to validation failure`))}}let i=hu(r||{},t,(e,t,n,r)=>{if(t===void 0&&r&&typeof n==`string`){delete r[n];return}if(Array.isArray(t))return t});jp(n),$d(n,k(i,null,2)+`
35
+ `),gt(),e===`localSettings`&&vp(j_(`localSettings`),dn())}catch(e){let t=Error(`Failed to read raw settings from ${n}: ${e}`);return I(t),{error:t}}return{error:null}}function F_(e,t){return pi([...e,...t])}function I_(e,t){if(Array.isArray(e)&&Array.isArray(t))return F_(e,t)}function L_(e){let t=Dg().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 R_(){if(q_)return{settings:{},errors:[]};let e=Date.now();wi(`loadSettingsFromDisk_start`),yr(`info`,`settings_load_started`),q_=!0;try{let t=Tn(),n={};t&&(n=hu(n,t,I_));let r=[],i=new Set,a=new Set;for(let e of Tp()){if(e===`policySettings`){let e=null,t=[],a=dp();if(a&&Object.keys(a).length>0){let n=Dg().safeParse(a);n.success?e=n.data:t.push(...Hg(n.error,`remote managed settings`))}if(!e){let n=l_();Object.keys(n.settings).length>0&&(e=n.settings),t.push(...n.errors)}if(!e){let{settings:n,errors:r}=C_();n&&(e=n),t.push(...r)}if(!e){let n=u_();Object.keys(n.settings).length>0&&(e=n.settings),t.push(...n.errors)}e&&(n=hu(n,e,I_));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=A_(e);if(t){let e=Xi(t);if(!a.has(e)){a.add(e);let{settings:o,errors:s}=E_(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=hu(n,o,I_))}}if(e===`flagSettings`){let e=ut();if(e){let t=Dg().safeParse(e);t.success&&(n=hu(n,t.data,I_))}}}return yr(`info`,`settings_load_completed`,{duration_ms:Date.now()-e,source_count:a.size,error_count:r.length}),{settings:n,errors:r}}finally{q_=!1}}function z_(){let{settings:e}=V_();return e||{}}function B_(){gt();let e=[];for(let t of Tp()){let n=U(t);n&&Object.keys(n).length>0&&e.push({source:t,settings:n})}return{effective:z_(),sources:e}}function V_(){let e=it();if(e!==null)return e;let t=R_();return wi(`loadSettingsFromDisk_end`),Ct(t),t}function H_(){return!!(U(`userSettings`)?.skipDangerousModePermissionPrompt||U(`localSettings`)?.skipDangerousModePermissionPrompt||U(`flagSettings`)?.skipDangerousModePermissionPrompt||U(`policySettings`)?.skipDangerousModePermissionPrompt)}function U_(){return!0}function W_(){return U(`policySettings`)?.useAutoModeDuringPlan!==!1&&U(`flagSettings`)?.useAutoModeDuringPlan!==!1&&U(`userSettings`)?.useAutoModeDuringPlan!==!1&&U(`localSettings`)?.useAutoModeDuringPlan!==!1}function G_(){{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=U(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 K_(e){for(let t of Tp()){if(t===`policySettings`)continue;let n=A_(t);if(n)try{let{resolvedPath:t}=fr(j(),n),r=jd(t);if(!r.trim())continue;let i=fi(r,!1);if(i&&typeof i==`object`&&e in i)return!0}catch(e){T_(e,n)}}return!1}var q_,J_,Y_=t((()=>{gu(),Je(),O(),hp(),Ci(),M(),br(),h(),In(),sf(),Md(),Jn(),yp(),di(),Vr(),qr(),ur(),Ti(),Ap(),Fp(),uf(),x_(),Ft(),Og(),Gg(),q_=!1,J_=z_}));function X_(e,t){return e.find(e=>e.includes(t))??null}async function Z_(){let{BedrockClient:e}=await import(`./dist-es-4z5T3Jzm.js`),t=oe(),n=g(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-hdN_ShpZ.js`))).NodeHttpHandler,httpAuthSchemes:[{schemeId:`smithy.api#noAuth`,identityProvider:()=>async()=>({}),signer:new(await(import(`./dist-es-CZkzHpjF.js`))).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:`smithy.api#noAuth`}]}};if(!n&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let e=await Gw();e&&(r.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken})}return new e(r)}async function Q_(){let{BedrockRuntimeClient:e}=await import(`./dist-es-DN7otr6F.js`),t=oe(),n=g(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-hdN_ShpZ.js`))).NodeHttpHandler,httpAuthSchemes:[{schemeId:`smithy.api#noAuth`,identityProvider:()=>async()=>({}),signer:new(await(import(`./dist-es-CZkzHpjF.js`))).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:`smithy.api#noAuth`}]}};if(!n&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let e=await Gw();e&&(r.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken})}return new e(r)}function $_(e){return e.startsWith(`anthropic.`)}function ev(e){if(!e.startsWith(`arn:`))return e;let t=e.lastIndexOf(`/`);return t===-1?e:e.substring(t+1)}function tv(e){let t=ev(e);for(let e of av)if(t.startsWith(`${e}.anthropic.`))return e}function nv(e,t){let n=tv(e);return n?e.replace(`${n}.`,`${t}.`):$_(e)?`${t}.${e}`:e}var rv,iv,av,ov=t((()=>{m(),Q(),h(),Vr(),Pi(),rv=p(async function(){let[e,{ListInferenceProfilesCommand:t}]=await Promise.all([Z_(),import(`./dist-es-4z5T3Jzm.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 I(e),e}}),iv=p(async function(e){try{let[t,{GetInferenceProfileCommand:n}]=await Promise.all([Z_(),import(`./dist-es-4z5T3Jzm.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 I(e),null}}),av=[`us`,`eu`,`apac`,`global`]})),sv,cv,lv,uv,dv,fv,pv,mv,hv,gv,_v,vv,yv,bv,xv=t((()=>{sv={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`},cv={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`},lv={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`},uv={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`},dv={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`},fv={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`},pv={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`},hv={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`},gv={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`},_v={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`},vv={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`},yv={haiku35:lv,haiku45:uv,sonnet35:cv,sonnet37:sv,sonnet40:dv,sonnet45:fv,sonnet46:vv,opus40:pv,opus41:mv,opus45:hv,opus46:gv,opus47:_v},Object.values(yv).map(e=>e.firstParty),bv=Object.fromEntries(Object.entries(yv).map(([e,t])=>[t.firstParty,e]))}));function W(e=z_()){let t=e.modelType;return t===`openai`?`openai`:t===`gemini`?`gemini`:t===`grok`?`grok`:g(process.env.CLAUDE_CODE_USE_BEDROCK)?`bedrock`:g(process.env.CLAUDE_CODE_USE_VERTEX)?`vertex`:g(process.env.CLAUDE_CODE_USE_FOUNDRY)?`foundry`:g(process.env.CLAUDE_CODE_USE_OPENAI)?`openai`:g(process.env.CLAUDE_CODE_USE_GEMINI)?`gemini`:g(process.env.CLAUDE_CODE_USE_GROK)?`grok`:`firstParty`}function Sv(){return W()}function Cv(){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 wv=t((()=>{Y_(),h()}));function Tv(e){let t={};for(let n of jv)t[n]=yv[n][e];return t}async function Ev(){let e=Tv(`bedrock`),t;try{t=await rv()}catch(t){return I(t),e}if(!t?.length)return e;let n={};for(let r of jv){let i=yv[r].firstParty;n[r]=X_(t,i)||e[r]}return n}function Dv(e){let t=z_().modelOverrides;if(!t)return e;let n={...e};for(let[e,r]of Object.entries(t)){let t=bv[e];t&&r&&(n[t]=r)}return n}function Ov(e){let t;try{t=z_().modelOverrides}catch{return e}if(!t)return e;for(let[n,r]of Object.entries(t))if(r===e)return n;return e}function kv(){if(gn()===null){if(W()!==`bedrock`){Wt(Tv(W()));return}Mv()}}function G(){let e=gn();return e===null?(kv(),Dv(Tv(W()))):Dv(e)}async function Av(){if(gn()===null){if(W()!==`bedrock`){Wt(Tv(W()));return}await Mv()}}var jv,Mv,Nv=t((()=>{O(),Vr(),ap(),Y_(),ov(),xv(),wv(),jv=Object.keys(yv),Mv=ip(async()=>{if(gn()===null)try{Wt(await Ev())}catch(e){I(e)}})}));function Pv(){if(g(process.env.DISABLE_COST_WARNINGS)||Y())return!1;let e=AC(),t=jC()!==null;if(!e.hasToken&&!t)return!1;let n=H(),r=n.oauthAccount?.organizationRole,i=n.oauthAccount?.workspaceRole;return!r||!i?!1:[`admin`,`billing`].includes(r)||[`workspace_admin`,`workspace_billing`].includes(i)}function Fv(e){Lv=e}function Iv(){if(Lv!==null)return Lv;if(!Y())return!1;let e=X();if(e===`max`||e===`pro`)return!0;let t=H().oauthAccount?.organizationRole;return!!t&&[`admin`,`billing`,`owner`,`primary_owner`].includes(t)}var Lv,Rv=t((()=>{Q(),rp(),h(),Lv=null}));function zv(){return process.env.USER_TYPE===`ant`?process.env.CLAUDE_MOCK_HEADERLESS_429?process.env.CLAUDE_MOCK_HEADERLESS_429:Yv?Xv:null:null}function Bv(){return!Yv||process.env.USER_TYPE!==`ant`||Object.keys(Jv).length===0?null:Jv}function Vv(){Jv={},ty=[],Zv=null,Qv=null,$v=null,Xv=null,Fv(null),Yv=!1}function Hv(e){let t=Bv();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 Uv(){return process.env.USER_TYPE===`ant`?Yv||!!process.env.CLAUDE_MOCK_HEADERLESS_429:!1}function Wv(){return!Yv||process.env.USER_TYPE!==`ant`?null:Zv||ey}function Gv(){return Yv&&Zv!==null&&process.env.USER_TYPE===`ant`}function Kv(){return Qv!==null}function qv(e){if(Qv===null||!e)return null;if($v!==null&&Date.now()>=$v)return Vv(),null;$v===null&&($v=Date.now()+Qv);let t=$v-Date.now(),n={...Jv};return n[`retry-after`]=String(Math.max(1,Math.ceil(t/1e3))),n}var Jv,Yv,Xv,Zv,Qv,$v,ey,ty,ny=t((()=>{Rv(),Jv={},Yv=!1,Xv=null,Zv=null,Qv=null,$v=null,ey=`max`}));async function ry(){let e=H().oauthAccount?.accountUuid,t=jC();if(!e||!t)return;let n=`${P().BASE_API_URL}/api/claude_cli_profile`;try{return(await v.get(n,{headers:{"x-api-key":t,"anthropic-beta":Dr},params:{account_uuid:e},timeout:1e4})).data}catch(e){I(e)}}async function iy(e){let t=`${P().BASE_API_URL}/api/oauth/profile`;try{return(await v.get(t,{headers:{Authorization:`Bearer ${e}`,"Content-Type":`application/json`},timeout:1e4})).data}catch(e){I(e)}}var ay=t((()=>{Ie(),kr(),Q(),rp(),Vr()}));function oy(e){return!!e?.includes(Tr)}function sy(e){return e?.split(` `).filter(Boolean)??[]}function cy({codeChallenge:e,state:t,port:n,isManual:r,loginWithClaudeAi:i,inferenceOnly:a,orgUUID:o,loginHint:s,loginMethod:c}){let l=i?P().CLAUDE_AI_AUTHORIZE_URL:P().CONSOLE_AUTHORIZE_URL,u=new URL(l);u.searchParams.append(`code`,`true`),u.searchParams.append(`client_id`,P().CLIENT_ID),u.searchParams.append(`response_type`,`code`),u.searchParams.append(`redirect_uri`,r?P().MANUAL_REDIRECT_URL:`http://localhost:${n}/callback`);let d=a?[Tr]:Or;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 ly(e,t,n,r,i=!1,a){let o={grant_type:`authorization_code`,code:e,redirect_uri:i?P().MANUAL_REDIRECT_URL:`http://localhost:${r}/callback`,client_id:P().CLIENT_ID,code_verifier:n,state:t};a!==void 0&&(o.expires_in=a);let s=await v.post(P().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 N(`tengu_oauth_token_exchange_success`,{}),s.data}async function uy(e,{scopes:t}={}){let n={grant_type:`refresh_token`,refresh_token:e,client_id:P().CLIENT_ID,scope:(t?.length?t:Er).join(` `)};try{let t=await v.post(P().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=sy(r.scope);N(`tengu_oauth_token_refresh_success`,{});let l=H(),u=Z(),d=l.oauthAccount?.billingType!==void 0&&l.oauthAccount?.accountCreatedAt!==void 0&&l.oauthAccount?.subscriptionCreatedAt!==void 0&&u?.subscriptionType!=null&&u?.rateLimitTier!=null?null:await my(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&&V(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=v.isAxiosError(e)&&e.response?.data?JSON.stringify(e.response.data):void 0;throw N(`tengu_oauth_token_refresh_failure`,{error:e.message,...t&&{responseBody:t}}),e}}async function dy(e){let t=await v.get(P().ROLES_URL,{headers:{Authorization:`Bearer ${e}`}});if(t.status!==200)throw Error(`Failed to fetch user roles: ${t.statusText}`);let n=t.data;if(!H().oauthAccount)throw Error(`OAuth account information not found in config`);V(e=>({...e,oauthAccount:e.oauthAccount?{...e.oauthAccount,organizationRole:n.organization_role,workspaceRole:n.workspace_role,organizationName:n.organization_name}:e.oauthAccount})),N(`tengu_oauth_roles_stored`,{org_role:n.organization_role})}async function fy(e){try{let t=await v.post(P().API_KEY_URL,null,{headers:{Authorization:`Bearer ${e}`}}),n=t.data?.raw_key;return n?(await sw(n),N(`tengu_oauth_api_key`,{status:`success`,statusCode:t.status}),n):null}catch(e){throw N(`tengu_oauth_api_key`,{status:`failure`,error:e instanceof Error?e.message:String(e)}),e}}function py(e){return e===null?!1:Date.now()+300*1e3>=e}async function my(e){let t=await iy(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),N(`tengu_oauth_profile_fetch_success`,{}),{...i,rawProfile:t}}async function hy(){let e=H().oauthAccount?.organizationUuid;if(e)return e;let t=Z()?.accessToken;return t===void 0||!yw()?null:(await iy(t))?.organization?.uuid||null}async function gy(){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&&(H().oauthAccount||_y({accountUuid:e,emailAddress:t,organizationUuid:n})),await _w();let i=H();if(i.oauthAccount&&i.oauthAccount.billingType!==void 0&&i.oauthAccount.accountCreatedAt!==void 0&&i.oauthAccount.subscriptionCreatedAt!==void 0||!Y()||!yw())return!1;let a=Z();if(a?.accessToken){let e=await iy(a.accessToken);if(e)return r&&A(`OAuth profile fetch succeeded, overriding env var account info`,{level:`info`}),_y({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 _y({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),V(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 vy=t((()=>{Ie(),hr(),kr(),Q(),rp(),M(),ay()}));function yy(e,t,n){if(g(process.env.CLAUDE_CODE_REMOTE))try{ea(wy,{recursive:!0,mode:448}),ia(e,t,{encoding:`utf8`,mode:384}),A(`Persisted ${n} to ${e} for subprocess access`)}catch(e){A(`Failed to persist ${n} to disk (non-fatal): ${An(e)}`,{level:`error`})}}function by(e,t){try{let n=j().readFileSync(e,{encoding:`utf8`}).trim();return n?(A(`Read ${t} from well-known file ${e}`),n):null}catch(n){return Fn(n)||A(`Failed to read ${t} from ${e}: ${An(n)}`,{level:`debug`}),null}}function xy({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=by(t,n);return i(e),e}let s=parseInt(o,10);if(Number.isNaN(s))return A(`${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?(A(`Successfully read ${n} from file descriptor ${s}`),i(a),yy(t,a,n),a):(A(`File descriptor contained empty ${n}`,{level:`error`}),i(null),null)}catch(e){A(`Failed to read ${n} from file descriptor ${s}: ${An(e)}`,{level:`error`});let r=by(t,n);return i(r),r}}function Sy(){return xy({envVar:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,wellKnownPath:Ty,label:`OAuth token`,getCached:Gt,setCached:Jt})}function Cy(){return xy({envVar:`CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR`,wellKnownPath:Ey,label:`API key`,getCached:wn,setCached:ot})}var wy,Ty,Ey,Dy,Oy=t((()=>{O(),M(),h(),In(),Jn(),wy=`/home/claude/.claude/remote`,Ty=`${wy}/.oauth_token`,Ey=`${wy}/.api_key`,Dy=`${wy}/.session_ingress_token`}));function ky(e=``){let t=ae(),n=process.env.CLAUDE_CONFIG_DIR?`-${aa(`sha256`).update(t).digest(`hex`).substring(0,8)}`:``;return`Claude Code${P().OAUTH_FILE_SUFFIX}${e}${n}`}function Ay(){try{return process.env.USER||Hi().username}catch{return`claude-code-user`}}function jy(){K.cache={data:null,cachedAt:0},K.generation++,K.readInFlight=null}function My(e){if(K.cache.cachedAt!==0)return;let t=null;if(e)try{t=JSON.parse(e)}catch{return}K.cache={data:t,cachedAt:Date.now()}}var Ny,K,Py=t((()=>{kr(),h(),Ny=`-credentials`,K={cache:{data:null,cachedAt:0},generation:0,readInFlight:null}}));async function Fy(){if(process.platform===`darwin`&&(await Pr(`security delete-generic-password -a $USER -s "${ky()}"`,{shell:!0,reject:!1})).exitCode!==0)throw Error(`Failed to delete keychain entry`)}function Iy(e){return e.slice(-20)}var Ly=t((()=>{Nr(),Py()}));function Ry(e){return e?.name===`CredentialsProviderError`}function zy(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 By(){let{STSClient:e,GetCallerIdentityCommand:t}=await import(`./dist-es-D1LN6CJd.js`);await new e().send(new t({}))}async function Vy(){try{A(`Clearing AWS credential provider cache`);let{fromIni:e}=await import(`./dist-es-DGn8uOwQ2.js`);await e({ignoreCache:!0})(),A(`AWS credential provider cache refreshed`)}catch{A(`Failed to clear AWS credential cache (this is expected if no credentials are configured)`)}}var Hy=t((()=>{M()})),Uy,Wy=t((()=>{ft(),ce(),Uy=class e{constructor(){_(this,`status`,{isAuthenticating:!1,output:[]}),_(this,`changed`,Ot()),_(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)}},_(Uy,`instance`,null)})),Gy,Ky,qy,Jy,Yy,Xy,Zy,Qy,$y,eb,tb,nb,rb,ib,ab,ob,sb,cb,lb=t((()=>{Gy=`claude-code-20250219`,Ky=`interleaved-thinking-2025-05-14`,qy=`context-1m-2025-08-07`,Jy=`context-management-2025-06-27`,Yy=`structured-outputs-2025-12-15`,Xy=`web-search-2025-03-05`,Zy=`tool-search-tool-2025-10-19`,Qy=`effort-2025-11-24`,$y=`task-budgets-2026-03-13`,eb=`prompt-caching-scope-2026-01-05`,tb=`fast-mode-2026-02-01`,nb=`redact-thinking-2026-02-12`,rb=`token-efficient-tools-2026-03-28`,ib=`afk-mode-2026-01-31`,ab=process.env.USER_TYPE===`ant`?`cli-internal-2026-02-09`:``,ob=`advisor-tool-2026-03-01`,sb=new Set([Ky,qy,Zy]),cb=new Set([Gy,Ky,Jy])}));function ub(){return process.env.USER_TYPE===`ant`?OO(`tengu_ant_model_override`,null):null}function db(){return process.env.USER_TYPE===`ant`?ub()?.antModels??[]:[]}function fb(e){if(process.env.USER_TYPE!==`ant`||e===void 0)return;let t=e.toLowerCase();return db().find(n=>n.alias===e||t.includes(n.model.toLowerCase()))}var pb=t((()=>{ik()}));function mb(){return!g(process.env.CLAUDE_CODE_DISABLE_FAST_MODE)}function hb(){return mb()?_b()===null:!1}function gb(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 _b(){if(!mb())return`Fast mode is not available`;let e=OO(`tengu_penguins_off`,null);if(e!==null)return A(`Fast mode unavailable: ${e}`),e;if(!Ar()&&OO(`tengu_marble_sandcastle`,!1))return`Fast mode requires the native binary · Install from: https://claude.com/product/claude-code`;if(Mt()&&rn()&&!xt()&&!U(`flagSettings`)?.fastMode){let e=`Fast mode is not available in the Agent SDK`;return A(`Fast mode unavailable: ${e}`),e}if(W()!==`firstParty`){let e=`Fast mode is not available on Bedrock, Vertex, or Foundry`;return A(`Fast mode unavailable: ${e}`),e}if(q.status===`disabled`){if((q.reason===`network_error`||q.reason===`unknown`)&&g(process.env.CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS))return null;let e=Z()===null?`api-key`:`oauth`,t=gb(q.reason,e);return A(`Fast mode unavailable: ${t}`),t}return null}function vb(){return`opus`+(Ux()?`[1m]`:``)}function yb(e){if(!mb()||!hb()||!bb(e))return!1;let t=z_();return t.fastModePerSessionOptIn?!1:t.fastMode===!0}function bb(e){if(!mb())return!1;let t=Jx(e??Lx());return t.toLowerCase().includes(`opus-4-7`)||t.toLowerCase().includes(`opus-4-6`)}function xb(){return Pb.status===`cooldown`&&Date.now()>=Pb.resetAt&&(mb()&&!Fb&&(A(`Fast mode cooldown expired, re-enabling fast mode`),Fb=!0,Lb.emit()),Pb={status:`active`}),Pb}function Sb(e,t){if(!mb())return;Pb={status:`cooldown`,resetAt:e,reason:t},Fb=!1;let n=e-Date.now();A(`Fast mode cooldown triggered (${t}), duration ${Math.round(n/1e3)}s`),N(`tengu_fast_mode_fallback_triggered`,{cooldown_duration_ms:n,cooldown_reason:t}),Ib.emit(e,t)}function Cb(){Pb={status:`active`}}function wb(){q.status!==`disabled`&&(q={status:`disabled`,reason:`preference`},P_(`userSettings`,{fastMode:void 0}),V(e=>({...e,penguinModeOrgEnabled:!1})),Hb.emit(!1))}function Tb(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 Eb(e){return e===`org_level_disabled_until`||e===`out_of_credits`}function Db(e){let t=Tb(e);A(`Fast mode overage rejection: ${e??`unknown`} — ${t}`),N(`tengu_fast_mode_overage_rejected`,{overage_disabled_reason:e??`unknown`}),Eb(e)||(P_(`userSettings`,{fastMode:void 0}),V(e=>({...e,penguinModeOrgEnabled:!1}))),Bb.emit(t)}function Ob(){return xb().status===`cooldown`}function kb(e,t){let n=mb()&&hb()&&!!t&&bb(e);return n&&Ob()?`cooldown`:n?`on`:`off`}async function Ab(e){let t=`${P().BASE_API_URL}/api/claude_code_penguin_mode`,n=`accessToken`in e?{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":Dr}:{"x-api-key":e.apiKey};return(await v.get(t,{headers:n})).data}function jb(){if(!mb()||q.status!==`pending`)return;let e=process.env.USER_TYPE===`ant`,t=H().penguinModeOrgEnabled===!0;q=e||t?{status:`enabled`}:{status:`disabled`,reason:`unknown`}}async function Mb(){if(Br()||!mb())return;if(Kb)return A(`Fast mode prefetch in progress, returning in-flight promise`),Kb;let e=jC();if(!(Z()?.accessToken&&yw())&&!e){let e=process.env.USER_TYPE===`ant`,t=H().penguinModeOrgEnabled===!0;q=e||t?{status:`enabled`}:{status:`disabled`,reason:`preference`};return}let t=Date.now();if(t-Gb<Wb){A(`Skipping fast mode prefetch, fetched recently`);return}Gb=t;let n=async()=>{let t=Z(),n=t?.accessToken&&yw()?{accessToken:t.accessToken}:e?{apiKey:e}:null;if(!n)throw Error(`No auth available`);return Ab(n)};async function r(){try{let e;try{e=await n()}catch(t){if(v.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=Z()?.accessToken;if(r)await mw(r),e=await n();else throw t}else throw t}let t=q.status===`pending`?H().penguinModeOrgEnabled:q.status===`enabled`;q=e.enabled?{status:`enabled`}:{status:`disabled`,reason:e.disabled_reason??`preference`},t!==e.enabled&&(e.enabled||P_(`userSettings`,{fastMode:void 0}),V(t=>({...t,penguinModeOrgEnabled:e.enabled})),Hb.emit(e.enabled)),A(`Org fast mode: ${e.enabled?`enabled`:`disabled (${e.disabled_reason??`preference`})`}`)}catch(e){let t=process.env.USER_TYPE===`ant`,n=H().penguinModeOrgEnabled===!0;q=t||n?{status:`enabled`}:{status:`disabled`,reason:`network_error`},A(`Failed to fetch org fast mode status, defaulting to ${q.status===`enabled`?`enabled (cached)`:`disabled (network_error)`}: ${e}`,{level:`error`}),N(`tengu_org_penguin_mode_fetch_failed`,{})}finally{Kb=null}}return Kb=r(),Kb}var Nb,Pb,Fb,Ib,Lb,Rb,zb,Bb,Vb,q,Hb,Ub,Wb,Gb,Kb,qb=t((()=>{Ie(),kr(),ik(),O(),hr(),Q(),jr(),rp(),M(),h(),nS(),wv(),zr(),Y_(),ft(),Nb=`Opus 4.7`,Pb={status:`active`},Fb=!1,Ib=Ot(),Lb=Ot(),Rb=Ib.subscribe,zb=Lb.subscribe,Bb=Ot(),Vb=Bb.subscribe,q={status:`pending`},Hb=Ot(),Ub=Hb.subscribe,Wb=3e4,Gb=0,Kb=null}));function Jb(e){return mb()&&e?ax:ix}function Yb(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 Xb(e,t){let n=zx(e);return n===J(gv.firstParty)?Jb(t.speed===`fast`):lx[n]||(Zb(e,n),lx[zx(Lx())]??cx)}function Zb(e,t){N(`tengu_unknown_model_cost`,{model:e,shortName:t}),rt()}function Qb(e,t){return Yb(Xb(e,t),t)}function $b(e,t){return Qb(e,{input_tokens:t.inputTokens,output_tokens:t.outputTokens,cache_read_input_tokens:t.cacheReadInputTokens,cache_creation_input_tokens:t.cacheCreationInputTokens})}function ex(e){return Number.isInteger(e)?`$${e}`:`$${e.toFixed(2)}`}function tx(e){return`${ex(e.inputTokens)}/${ex(e.outputTokens)} per Mtok`}var nx,rx,ix,ax,ox,sx,cx,lx,ux=t((()=>{hr(),O(),qb(),xv(),nS(),nx={inputTokens:3,outputTokens:15,promptCacheWriteTokens:3.75,promptCacheReadTokens:.3,webSearchRequests:.01},rx={inputTokens:15,outputTokens:75,promptCacheWriteTokens:18.75,promptCacheReadTokens:1.5,webSearchRequests:.01},ix={inputTokens:5,outputTokens:25,promptCacheWriteTokens:6.25,promptCacheReadTokens:.5,webSearchRequests:.01},ax={inputTokens:30,outputTokens:150,promptCacheWriteTokens:37.5,promptCacheReadTokens:3,webSearchRequests:.01},ox={inputTokens:.8,outputTokens:4,promptCacheWriteTokens:1,promptCacheReadTokens:.08,webSearchRequests:.01},sx={inputTokens:1,outputTokens:5,promptCacheWriteTokens:1.25,promptCacheReadTokens:.1,webSearchRequests:.01},cx=ix,lx={[J(lv.firstParty)]:ox,[J(uv.firstParty)]:sx,[J(cv.firstParty)]:nx,[J(sv.firstParty)]:nx,[J(dv.firstParty)]:nx,[J(fv.firstParty)]:nx,[J(vv.firstParty)]:nx,[J(pv.firstParty)]:rx,[J(mv.firstParty)]:rx,[J(hv.firstParty)]:ix,[J(gv.firstParty)]:ix}}));function dx(e){return px.includes(e)}function fx(e){return mx.includes(e)}var px,mx,hx=t((()=>{px=[`sonnet`,`opus`,`haiku`,`best`,`sonnet[1m]`,`opus[1m]`,`opusplan`],mx=[`sonnet`,`opus`,`haiku`]}));function gx(e,t){return e.includes(t)?!0:dx(e)?Jx(e).toLowerCase().includes(t):!1}function _x(e,t){return e.startsWith(t)?e.length===t.length||e[t.length]===`-`:!1}function vx(e,t){let n=dx(e)?Jx(e).toLowerCase():e;return!!(_x(n,t)||!t.startsWith(`claude-`)&&_x(n,`claude-${t}`))}function yx(e,t){for(let n of t){if(fx(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 bx(e){let{availableModels:t}=J_()||{};if(!t)return!0;if(t.length===0)return!1;let n=Ov(e).trim().toLowerCase(),r=t.map(e=>e.trim().toLowerCase());if(r.includes(n)&&(!fx(n)||!yx(n,r)))return!0;for(let e of r)if(fx(e)&&!yx(e,r)&&gx(n,e))return!0;if(dx(n)){let e=Jx(n).toLowerCase();if(r.includes(e))return!0}for(let e of r)if(!fx(e)&&dx(e)&&Jx(e).toLowerCase()===n)return!0;for(let e of r)if(!fx(e)&&!dx(e)&&vx(n,e))return!0;return!1}var xx=t((()=>{Y_(),hx(),nS(),Nv()}));function Sx(){return process.env.OPENAI_AUTH_MODE===`chatgpt`}function Cx(e){let t=e.toLowerCase().replace(/\[1m\]$/,``);return Ex.some(e=>e.value.toLowerCase()===t)}var wx,Tx,Ex,Dx=t((()=>{wx=`gpt-5.5`,Tx=`gpt-5.4-mini`,Ex=[{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 Ox(){let e=W();return e===`openai`&&Sx()?process.env.OPENAI_SMALL_FAST_MODEL??`gpt-5.4-mini`: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||Fx()}function kx(e){return e===G().opus40||e===G().opus41||e===G().opus45||e===G().opus46||e===G().opus47}function Ax(){let e,t=$t();if(t!==void 0)e=t;else{let t=J_()||{};e=process.env.ANTHROPIC_MODEL||t.model||void 0}if(!(e&&!bx(e)))return e}function jx(){let e=Ax();return e==null?Rx():Jx(e)}function Mx(){return Nx()}function Nx(){let e=W();return e===`openai`&&Sx()?wx:e===`openai`&&process.env.OPENAI_DEFAULT_OPUS_MODEL?process.env.OPENAI_DEFAULT_OPUS_MODEL: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:G().opus47}function Px(){let e=W();return e===`openai`&&Sx()?wx:e===`openai`&&process.env.OPENAI_DEFAULT_SONNET_MODEL?process.env.OPENAI_DEFAULT_SONNET_MODEL: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:e===`firstParty`?G().sonnet46:G().sonnet45}function Fx(){let e=W();return e===`openai`&&Sx()?Tx:e===`openai`&&process.env.OPENAI_DEFAULT_HAIKU_MODEL?process.env.OPENAI_DEFAULT_HAIKU_MODEL: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:G().haiku45}function Ix(e){let{permissionMode:t,mainLoopModel:n,exceeds200kTokens:r=!1}=e;return Ax()===`opusplan`&&t===`plan`&&!r?Nx():Ax()===`haiku`&&t===`plan`?Px():n}function Lx(){return process.env.USER_TYPE===`ant`?ub()?.defaultModel??Nx()+`[1m]`:ww()||Ew()?Nx()+(Ux()?`[1m]`:``):Px()}function Rx(){return Jx(Lx())}function J(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 zx(e){return J(Ov(e))}function Bx(e=!1){return ww()||Ew()?Ux()?`Opus 4.7 with 1M context · Most capable for complex work${e?Hx(!0):``}`:`Opus 4.7 · Most capable for complex work${e?Hx(!0):``}`:`Sonnet 4.6 · Best for everyday tasks`}function Vx(e){return e===`opusplan`?`Opus 4.7 in plan mode, else Sonnet 4.6`:qx(Jx(e))}function Hx(e){if(W()!==`firstParty`)return``;let t=tx(Jb(e));return` ·${e?` (↯)`:``} ${t}`}function Ux(){return!(bS()||Ow()||W()!==`firstParty`||!Cv()||Y()&&X()===null)}function Wx(e){return e===`opusplan`?`Opus Plan`:dx(e)?Yh(e):qx(e)}function Gx(e){switch(e){case G().opus47:return`Opus 4.7`;case G().opus47+`[1m]`:return`Opus 4.7 (1M context)`;case G().opus46:return`Opus 4.6`;case G().opus46+`[1m]`:return`Opus 4.6 (1M context)`;case G().opus45:return`Opus 4.5`;case G().opus41:return`Opus 4.1`;case G().opus40:return`Opus 4`;case G().sonnet46+`[1m]`:return`Sonnet 4.6 (1M context)`;case G().sonnet46:return`Sonnet 4.6`;case G().sonnet45+`[1m]`:return`Sonnet 4.5 (1M context)`;case G().sonnet45:return`Sonnet 4.5`;case G().sonnet40:return`Sonnet 4`;case G().sonnet40+`[1m]`:return`Sonnet 4 (1M context)`;case G().sonnet37:return`Sonnet 3.7`;case G().sonnet35:return`Sonnet 3.5`;case G().haiku45:return`Haiku 4.5`;case G().haiku35:return`Haiku 3.5`;default:return null}}function Kx(e){let[t=``,...n]=e.split(`-`);return[t.slice(0,3)+`*`.repeat(Math.max(0,t.length-3)),...n].join(`-`)}function qx(e){let t=Gx(e);if(t)return t;if(process.env.USER_TYPE===`ant`){let t=Jx(e),n=fb(e);return n?Kx(n.model.replace(/\[1m\]$/i,``))+(xS(t)?`[1m]`:``):t===e?t:`${e} (${t})`}return e}function Jx(e){let t=e.trim(),n=t.toLowerCase(),r=xS(n),i=r?n.replace(/\[1m]$/i,``).trim():n;if(dx(i))switch(i){case`opusplan`:return Px()+(r?`[1m]`:``);case`sonnet`:return Px()+(r?`[1m]`:``);case`haiku`:return Fx()+(r?`[1m]`:``);case`opus`:return Nx()+(r?`[1m]`:``);case`best`:return Mx();default:}if(W()===`firstParty`&&Xx(i)&&Zx())return Nx()+(r?`[1m]`:``);if(process.env.USER_TYPE===`ant`){let e=xS(n),t=fb(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 Yx(e,t){return xS(e)||!xS(t)?e:SS(Jx(e))?e+`[1m]`:e}function Xx(e){return tS.includes(e)}function Zx(){return!g(process.env.CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP)}function Qx(e){if(e===null)return process.env.USER_TYPE===`ant`?`Default for Ants (${Vx(Lx())})`:Y()?`Default (${Bx()})`:`Default (${Rx()})`;let t=Jx(e);return e===t?t:`${e} (${t})`}function $x(e){if(W()===`foundry`)return;let t=e.toLowerCase().includes(`[1m]`),n=zx(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 eS(e){return e.replace(/\[(1|2)m\]/gi,``)}var tS,nS=t((()=>{O(),pb(),Q(),PS(),h(),Nv(),ux(),Y_(),wv(),Up(),xx(),hx(),ag(),Dx(),tS=[`claude-opus-4-20250514`,`claude-opus-4-1-20250805`,`claude-opus-4-0`,`claude-opus-4-1`]}));function rS(){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 iS({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=oS(),u={"x-app":`cli`,"User-Agent":dT(),"X-Claude-Code-Session-Id":at(),...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}:{}};A(`[API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: ${!!process.env.ANTHROPIC_CUSTOM_HEADERS}, has Authorization header: ${!!l.Authorization}`),g(process.env.CLAUDE_CODE_ADDITIONAL_PROTECTION)&&(u[`x-anthropic-additional-protection`]=`true`),A(`[API:auth] OAuth token check starting`),await _w(),A(`[API:auth] OAuth token check complete`),Y()||await aS(u,Mt());let d=sS(i,a),f={defaultHeaders:u,maxRetries:t,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,fetchOptions:Ni({forAnthropicAPI:!0}),...d&&{fetch:d}};if(g(process.env.CLAUDE_CODE_USE_BEDROCK)){let{BedrockClient:e}=await import(`./bedrockClient-qi1-JCOK.js`),t=r===Ox()&&process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION?process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION:oe(),n={...f,awsRegion:t,...g(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)&&{skipAuth:!0},...Qn()&&{logger:rS()}};if(process.env.AWS_BEARER_TOKEN_BEDROCK)n.skipAuth=!0,n.defaultHeaders={...n.defaultHeaders,Authorization:`Bearer ${process.env.AWS_BEARER_TOKEN_BEDROCK}`};else if(!g(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)){let e=await Gw();e&&(n.awsAccessKey=e.accessKeyId,n.awsSecretKey=e.secretAccessKey,n.awsSessionToken=e.sessionToken)}return new e(n)}if(g(process.env.CLAUDE_CODE_USE_FOUNDRY)){let{AnthropicFoundry:e}=await import(`./foundry-sdk-BFN5VDFQ.js`),t;if(!process.env.ANTHROPIC_FOUNDRY_API_KEY)if(g(process.env.CLAUDE_CODE_SKIP_FOUNDRY_AUTH))t=()=>Promise.resolve(``);else{let{DefaultAzureCredential:e,getBearerTokenProvider:n}=await import(`./esm-CsGLyWmS.js`);t=n(new e,`https://cognitiveservices.azure.com/.default`)}return new e({...f,...t&&{azureADTokenProvider:t},...Qn()&&{logger:rS()}})}if(g(process.env.CLAUDE_CODE_USE_VERTEX)){g(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)||await Yw();let[{AnthropicVertex:e},{GoogleAuth:t}]=await Promise.all([import(`./vertex-sdk-CSGw3fvU.js`),import(`./src-hdbPEvzO.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=g(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,...Qn()&&{logger:rS()}})}return new se({apiKey:Y()?null:e||jC(),authToken:Y()?Z()?.accessToken:void 0,...process.env.USER_TYPE===`ant`&&g(process.env.USE_STAGING_OAUTH)?{baseURL:P().BASE_API_URL}:{},...f,...Qn()&&{logger:rS()}})}async function aS(e,t){let n=process.env.ANTHROPIC_AUTH_TOKEN||await HC(t);n&&(e.Authorization=`Bearer ${n}`)}function oS(){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 sS(e,t){let n=e??globalThis.fetch,r=W()===`firstParty`&&Cv();return(e,i)=>{let a=new Headers(i?.headers);r&&!a.has(`x-client-request-id`)&&a.set(cS,sa());try{let n=e instanceof Request?e.url:String(e),r=a.get(cS);A(`[API REQUEST] ${new URL(n).pathname}${r?` ${cS}=${r}`:``} source=${t??`unknown`}`)}catch{}return n(e,{...i,headers:a})}}var cS,lS=t((()=>{vr(),Q(),gT(),nS(),wv(),Pi(),O(),kr(),M(),h(),cS=`x-client-request-id`}));function uS(){return R(ae(),`cache`)}function dS(){return R(uS(),`model-capabilities.json`)}function fS(){return!(W()!==`firstParty`||!Cv())}function pS(e){return[...e].sort((e,t)=>t.id.length-e.id.length||e.id.localeCompare(t.id))}function mS(e){if(!fS())return;let t=vS(dS());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()))}async function hS(){if(fS()&&!Br())try{let e=await iS({maxRetries:1}),t=Y()?[Dr]:void 0,n=[];for await(let r of e.models.list({betas:t})){let e=gS().safeParse(r);e.success&&n.push(e.data)}if(n.length===0)return;let r=dS(),i=pS(n);if(ku(vS(r),i)){A(`[modelCapabilities] cache unchanged, skipping write`);return}await la(uS(),{recursive:!0}),await ha(r,k({models:i,timestamp:Date.now()}),{encoding:`utf-8`,mode:384}),vS.cache.delete(r),A(`[modelCapabilities] cached ${i.length} models`)}catch(e){A(`[modelCapabilities] fetch failed: ${e instanceof Error?e.message:`unknown`}`)}}var gS,_S,vS,yS=t((()=>{Au(),m(),Je(),kr(),lS(),Q(),M(),h(),di(),Ei(),zr(),ur(),wv(),gS=L(()=>D({id:b(),max_input_tokens:y().optional(),max_tokens:y().optional()}).strip()),_S=L(()=>D({models:S(gS()),timestamp:y()})),vS=p(e=>{try{let t=ta(e,`utf-8`),n=_S().safeParse(fi(t,!1));return n.success?n.data.models:null}catch{return null}},e=>e)}));function bS(){return g(process.env.CLAUDE_CODE_DISABLE_1M_CONTEXT)}function xS(e){return bS()?!1:/\[1m\]/i.test(e)}function SS(e){if(bS())return!1;let t=zx(e);return t.includes(`claude-sonnet-4`)||t.includes(`opus-4-6`)||t.includes(`opus-4-7`)}function CS(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(xS(e))return 1e6;let n=mS(e);if(n?.max_input_tokens&&n.max_input_tokens>=1e5)return n.max_input_tokens>2e5&&bS()?OS:n.max_input_tokens;if(t?.includes(`context-1m-2025-08-07`)&&SS(e)||wS(e))return 1e6;if(process.env.USER_TYPE===`ant`){let t=fb(e);if(t?.contextWindow)return t.contextWindow}return OS}function wS(e){return bS()||xS(e)||!zx(e).includes(`sonnet-4-6`)?!1:H().clientDataCache?.coral_reef_sonnet===`true`}function TS(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 ES(e){let t,n;if(process.env.USER_TYPE===`ant`){let r=fb(e.toLowerCase());if(r)return t=r.defaultMaxTokens??AS,n=r.upperMaxTokensLimit??jS,{default:t,upperLimit:n}}let r=zx(e);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=AS,n=jS);let i=mS(e);return i?.max_tokens&&i.max_tokens>=4096&&(n=i.max_tokens,t=Math.min(t,n)),{default:t,upperLimit:n}}function DS(e){return ES(e).upperLimit-1}var OS,kS,AS,jS,MS,NS,PS=t((()=>{lb(),rp(),h(),nS(),pb(),yS(),OS=2e5,kS=2e4,AS=32e3,jS=64e3,MS=8e3,NS=64e3})),FS,IS,LS,RS=t((()=>{m(),wv(),FS=[{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`}],IS=[{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`}],LS=p((e,t)=>{if(W()===`firstParty`)return;let n=e.toLowerCase(),r=W()===`openai`?IS:FS;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 zS(e){let t=[],n=[];for(let r of e)XS.includes(r)?t.push(r):n.push(r);return{allowed:t,disallowed:n}}function BS(e){if(!e||e.length===0)return;if(Y()){console.warn(`Warning: Custom betas are only available for API key users. Ignoring provided betas.`);return}let{allowed:t,disallowed:n}=zS(e);for(let e of n)console.warn(`Warning: Beta header '${e}' is not allowed. Only the following betas are supported: ${XS.join(`, `)}`);return t.length>0?t:void 0}function VS(e){let t=LS(e,`interleaved_thinking`);if(t!==void 0)return t;let n=zx(e),r=W();return r===`foundry`?!0:r===`firstParty`?!n.includes(`claude-3-`):n.includes(`claude-opus-4`)||n.includes(`claude-sonnet-4`)}function HS(e){let t=zx(e);return t.includes(`claude-opus-4`)||t.includes(`claude-sonnet-4`)||t.includes(`claude-haiku-4`)}function US(e){let t=zx(e),n=W();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 WS(e){let t=zx(e),n=W();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 GS(e){return!0}function KS(){return(W()===`firstParty`||W()===`foundry`)&&!g(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)&&Cv()}function qS(){return W()===`firstParty`&&!g(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)}function JS(e,t){let n=[...QS(e)];t?.isAgenticQuery&&(n.includes(`claude-code-20250219`)||n.push(Gy),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_ENTRYPOINT===`cli`&&ab&&!n.includes(ab)&&n.push(ab));let r=Cn();return!r||r.length===0?n:[...n,...r.filter(e=>!n.includes(e))]}function YS(){ZS.cache?.clear?.(),QS.cache?.clear?.(),$S.cache?.clear?.()}var XS,ZS,QS,$S,eC=t((()=>{m(),ik(),O(),lb(),kr(),Q(),PS(),h(),nS(),RS(),wv(),Y_(),XS=[qy],ZS=p(e=>{let t=[],n=zx(e).includes(`haiku`),r=W(),i=KS();n||(t.push(Gy),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_ENTRYPOINT===`cli`&&ab&&t.push(ab)),Y()&&t.push(Dr),xS(e)&&t.push(qy),!g(process.env.DISABLE_INTERLEAVED_THINKING)&&VS(e)&&t.push(Ky),i&&VS(e)&&!Mt()&&z_().showThinkingSummaries!==!0&&t.push(nb);let a=g(process.env.USE_API_CONTEXT_MANAGEMENT)||US(e),o=US(e);KS()&&(a||o)&&t.push(Jy);let s=AO(`tengu_tool_pear`),c=!s&&OO(`tengu_amber_json_tools`,!1);return i&&WS(e)&&s&&t.push(Yy),process.env.USER_TYPE===`ant`&&i&&c&&t.push(rb),r===`vertex`&&HS(e)&&t.push(Xy),r===`foundry`&&t.push(Xy),i&&t.push(eb),process.env.ANTHROPIC_BETAS&&t.push(...process.env.ANTHROPIC_BETAS.split(`,`).map(e=>e.trim()).filter(Boolean)),t}),QS=p(e=>{let t=ZS(e);return W()===`bedrock`?t.filter(e=>!sb.has(e)):t}),$S=p(e=>ZS(e).filter(e=>sb.has(e)))}));function tC(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 nC=t((()=>{}));async function rC(){try{let e=ky(Ny),{stdout:t,code:n}=await ai(`security`,[`find-generic-password`,`-a`,Ay(),`-w`,`-s`,e],{useCwd:!1,preserveOutputOnError:!1});if(n===0&&t)return Pn(t.trim())}catch{}return null}function iC(){if(sC!==void 0)return sC;if(process.platform!==`darwin`)return sC=!1,!1;try{sC=Mr(`security`,[`show-keychain-info`],{reject:!1,stdio:[`ignore`,`pipe`,`pipe`]}).exitCode===36}catch{sC=!1}return sC}var aC,oC,sC,cC=t((()=>{Nr(),M(),ii(),ti(),ur(),Py(),aC=4032,oC={name:`keychain`,read(){let e=K.cache;if(Date.now()-e.cachedAt<3e4)return e.data;try{let e=ky(Ny),t=ni(`security find-generic-password -a "${Ay()}" -w -s "${e}"`);if(t){let e=Pn(t);return K.cache={data:e,cachedAt:Date.now()},e}}catch{}return e.data===null?(K.cache={data:null,cachedAt:Date.now()},null):(A(`[keychain] read failed; serving stale cache`,{level:`warn`}),K.cache={data:e.data,cachedAt:Date.now()},e.data)},async readAsync(){let e=K.cache;if(Date.now()-e.cachedAt<3e4)return e.data;if(K.readInFlight)return K.readInFlight;let t=K.generation,n=rC().then(n=>{if(t===K.generation){n===null&&e.data!==null&&A(`[keychain] readAsync failed; serving stale cache`,{level:`warn`});let t=n??e.data;return K.cache={data:t,cachedAt:Date.now()},K.readInFlight=null,t}return n});return K.readInFlight=n,n},update(e){jy();try{let t=ky(Ny),n=Ay(),r=k(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<=aC?o=Mr(`security`,[`-i`],{input:a,stdio:[`pipe`,`pipe`,`pipe`],reject:!1}):(A(`Keychain payload (${r.length}B JSON) exceeds security -i stdin limit; using argv`,{level:`warn`}),o=Mr(`security`,[`add-generic-password`,`-U`,`-a`,n,`-s`,t,`-X`,i],{stdio:[`ignore`,`pipe`,`pipe`],reject:!1})),o.exitCode===0?(K.cache={data:e,cachedAt:Date.now()},{success:!0}):{success:!1}}catch{return{success:!1}}},delete(){jy();try{let e=ky(Ny);return ni(`security delete-generic-password -a "${Ay()}" -s "${e}"`),!0}catch{return!1}}}}));function lC(){let e=ae();return{storageDir:e,storagePath:R(e,`.credentials.json`)}}var uC,dC=t((()=>{h(),In(),Jn(),ur(),uC={name:`plaintext`,read(){let{storagePath:e}=lC();try{return Pn(j().readFileSync(e,{encoding:`utf8`}))}catch{return null}},async readAsync(){let{storagePath:e}=lC();try{return Pn(await j().readFile(e,{encoding:`utf8`}))}catch{return null}},update(e){try{let{storageDir:t,storagePath:n}=lC();try{j().mkdirSync(t)}catch(e){if(Mn(e)!==`EEXIST`)throw e}return jn(n,k(e),{encoding:`utf8`,flush:!1}),Qi(n,384),{success:!0,warning:`Warning: Storing credentials in plaintext.`}}catch{return{success:!1}}},delete(){let{storagePath:e}=lC();try{return j().unlinkSync(e),!0}catch(e){return Mn(e)===`ENOENT`}}}}));function fC(){return process.platform===`darwin`?tC(oC,uC):uC}var pC=t((()=>{nC(),cC(),dC()}));function mC(e){return new Promise(t=>{_a(`security`,[`find-generic-password`,`-a`,Ay(),`-w`,`-s`,e],{encoding:`utf-8`,timeout:yC},(e,n)=>{t({stdout:e?null:n?.trim()||null,timedOut:!!(e&&`killed`in e&&e.killed)})})})}function hC(){if(process.platform!==`darwin`||xC||ne())return;let e=mC(ky(Ny)),t=mC(ky());xC=Promise.all([e,t]).then(([e,t])=>{e.timedOut||My(e.stdout),t.timedOut||(bC={stdout:t.stdout})})}async function gC(){xC&&await xC}function _C(){return bC}function vC(){bC=null}var yC,bC,xC,SC=t((()=>{h(),Py(),yC=1e4,bC=null,xC=null}));function CC(){return TC}function wC(){TC.clear()}var TC,EC=t((()=>{TC=new Map})),DC=r({calculateApiKeyHelperTTL:()=>BC,checkAndRefreshOAuthTokenIfNeeded:()=>_w,checkGcpCredentialsValid:()=>ew,clearApiKeyHelperCache:()=>KC,clearAwsCredentialsCache:()=>ZC,clearGcpCredentialsCache:()=>rw,clearOAuthTokenCache:()=>fw,getAccountInformation:()=>Lw,getAnthropicApiKey:()=>jC,getAnthropicApiKeyWithSource:()=>NC,getApiKeyFromApiKeyHelper:()=>HC,getApiKeyFromApiKeyHelperCached:()=>GC,getApiKeyFromConfigOrMacOSKeychain:()=>Xw,getApiKeyHelperElapsedMs:()=>VC,getAuthTokenSource:()=>AC,getClaudeAIOAuthTokens:()=>Z,getClaudeAIOAuthTokensAsync:()=>gw,getConfiguredApiKeyHelper:()=>PC,getOauthAccountInfo:()=>xw,getOtelHeadersFromHelper:()=>Pw,getRateLimitTier:()=>kw,getSubscriptionName:()=>Aw,getSubscriptionType:()=>X,handleOAuth401Error:()=>mw,hasAnthropicApiKeyAuth:()=>MC,hasOpusAccess:()=>Cw,hasProfileScope:()=>yw,is1PApiCustomer:()=>bw,isAnthropicAuthEnabled:()=>kC,isAwsAuthRefreshFromProjectSettings:()=>LC,isAwsCredentialExportFromProjectSettings:()=>zC,isClaudeAISubscriber:()=>Y,isConsumerSubscriber:()=>Iw,isCustomApiKeyApproved:()=>cw,isEnterpriseSubscriber:()=>Dw,isGcpAuthRefreshFromProjectSettings:()=>$C,isMaxSubscriber:()=>ww,isOtelHeadersHelperFromProjectOrLocalSettings:()=>Nw,isOverageProvisioningAllowed:()=>Sw,isProSubscriber:()=>Ow,isTeamPremiumSubscriber:()=>Ew,isTeamSubscriber:()=>Tw,isUsing3PServices:()=>jw,prefetchApiKeyFromApiKeyHelperIfSafe:()=>qC,prefetchAwsCredentialsAndBedRockInfoIfSafe:()=>aw,prefetchGcpCredentialsIfSafe:()=>iw,refreshAndGetAwsCredentials:()=>Gw,refreshAwsAuth:()=>YC,refreshGcpAuth:()=>nw,refreshGcpCredentialsIfNeeded:()=>Yw,removeApiKey:()=>lw,saveApiKey:()=>sw,saveOAuthTokensIfNeeded:()=>dw,validateForceLoginOrg:()=>Rw});function OC(){return g(process.env.CLAUDE_CODE_REMOTE)||process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`}function kC(){if(ne())return!1;if(process.env.ANTHROPIC_UNIX_SOCKET)return!!process.env.CLAUDE_CODE_OAUTH_TOKEN;let e=J_()||{},t=g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(process.env.CLAUDE_CODE_USE_FOUNDRY)||e.modelType===`openai`||e.modelType===`gemini`||!!process.env.OPENAI_BASE_URL||!!process.env.GEMINI_BASE_URL,n=e.apiKeyHelper,r=process.env.ANTHROPIC_AUTH_TOKEN||n||process.env.CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR,{source:i}=NC({skipRetrievingKeyFromApiKeyHelper:!0}),a=i===`ANTHROPIC_API_KEY`||i===`apiKeyHelper`;return!(t||r&&!OC()||a&&!OC())}function AC(){if(ne())return PC()?{source:`apiKeyHelper`,hasToken:!0}:{source:`none`,hasToken:!1};if(process.env.ANTHROPIC_AUTH_TOKEN&&!OC())return{source:`ANTHROPIC_AUTH_TOKEN`,hasToken:!0};if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{source:`CLAUDE_CODE_OAUTH_TOKEN`,hasToken:!0};if(Sy())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(PC()&&!OC())return{source:`apiKeyHelper`,hasToken:!0};let e=Z();return oy(e?.scopes)&&e?.accessToken?{source:`claude.ai`,hasToken:!0}:{source:`none`,hasToken:!1}}function jC(){let{key:e}=NC();return e}function MC(){let{key:e,source:t}=NC({skipRetrievingKeyFromApiKeyHelper:!0});return e!==null&&t!==`none`}function NC(e={}){if(ne())return process.env.ANTHROPIC_API_KEY?{key:process.env.ANTHROPIC_API_KEY,source:`ANTHROPIC_API_KEY`}:PC()?{key:e.skipRetrievingKeyFromApiKeyHelper?null:GC(),source:`apiKeyHelper`}:{key:null,source:`none`};let t=re()?void 0:process.env.ANTHROPIC_API_KEY;if(rn()&&t)return{key:t,source:`ANTHROPIC_API_KEY`};if(g(process.env.CI)){let e=Cy();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&&H().customApiKeyResponses?.approved?.includes(Iy(t)))return{key:t,source:`ANTHROPIC_API_KEY`};let n=Cy();return n?{key:n,source:`ANTHROPIC_API_KEY`}:PC()?e.skipRetrievingKeyFromApiKeyHelper?{key:null,source:`apiKeyHelper`}:{key:GC(),source:`apiKeyHelper`}:Xw()||{key:null,source:`none`}}function PC(){return ne()?U(`flagSettings`)?.apiKeyHelper:(J_()||{}).apiKeyHelper}function FC(){let e=PC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.apiKeyHelper===e||n?.apiKeyHelper===e}function IC(){return(J_()||{}).awsAuthRefresh}function LC(){let e=IC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.awsAuthRefresh===e||n?.awsAuthRefresh===e}function RC(){return(J_()||{}).awsCredentialExport}function zC(){let e=RC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.awsCredentialExport===e||n?.awsCredentialExport===e}function BC(){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;A(`Found CLAUDE_CODE_API_KEY_HELPER_TTL_MS env var, but it was not a valid number. Got ${e}`,{level:`error`})}return zw}function VC(){let e=Vw?.startedAt;return e?Date.now()-e:0}async function HC(e){if(!PC())return null;let t=BC();return Bw?(Date.now()-Bw.timestamp<t||Vw||(Vw={promise:UC(e,!1,Hw),startedAt:null}),Bw.value):(Vw||(Vw={promise:UC(e,!0,Hw),startedAt:Date.now()}),Vw.promise)}async function UC(e,t,n){try{let t=await WC(e);return n===Hw&&t!==null&&(Bw={value:t,timestamp:Date.now()}),t}catch(e){if(n!==Hw)return` `;let r=e instanceof Error?e.message:String(e);return console.error(Xe.red(`apiKeyHelper failed: ${r}`)),A(`Error getting API key from apiKeyHelper: ${r}`,{level:`error`}),!t&&Bw&&Bw.value!==` `?(Bw={...Bw,timestamp:Date.now()},Bw.value):(Bw={value:` `,timestamp:Date.now()},` `)}finally{n===Hw&&(Vw=null)}}async function WC(e){let t=PC();if(!t)return null;if(FC()&&!gf()&&!e)return sr(`apiKeyHelper invoked before trust check`,Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in .`)),N(`tengu_apiKeyHelper_missing_trust11`,{}),null;let n=await Pr(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 GC(){return Bw?.value??null}function KC(){Hw++,Bw=null,Vw=null}function qC(e){FC()&&!gf()||HC(e)}async function JC(){let e=IC();if(!e)return!1;if(LC()&&!gf()&&!Mt())return sr(`awsAuthRefresh invoked before trust check`,Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),N(`tengu_awsAuthRefresh_missing_trust`,{}),!1;try{return A(`Fetching AWS caller identity for AWS auth refresh command`),await By(),A(`Fetched AWS caller identity, skipping AWS auth refresh command`),!1}catch{return YC(e)}}function YC(e){A(`Running AWS auth refresh command`);let t=Uy.getInstance();return t.startAuthentication(),new Promise(n=>{let r=ga(e,{timeout:Ww});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),A(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),A(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)A(`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 XC(){let e=RC();if(!e)return null;if(zC()&&!gf()&&!Mt())return sr(`awsCredentialExport invoked before trust check`,Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in .`)),N(`tengu_awsCredentialExport_missing_trust`,{}),null;try{return A(`Fetching AWS caller identity for credential export command`),await By(),A(`Fetched AWS caller identity, skipping AWS credential export command`),null}catch{try{A(`Running AWS credential export command`);let t=await Pr(e,{shell:!0,reject:!1});if(t.exitCode!==0||!t.stdout)throw Error(`awsCredentialExport did not return a valid value`);let n=Pn(t.stdout.trim());if(!zy(n))throw Error(`awsCredentialExport did not return valid AWS STS output structure`);return A(`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 ZC(){Gw.cache.clear()}function QC(){return(J_()||{}).gcpAuthRefresh}function $C(){let e=QC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.gcpAuthRefresh===e||n?.gcpAuthRefresh===e}async function ew(){try{let{GoogleAuth:e}=await import(`./src-hdbPEvzO.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=Fi(Kw).then(()=>{throw new rT(`GCP credentials check timed out`)});return await Promise.race([r,i]),!0}catch{return!1}}async function tw(){let e=QC();if(!e)return!1;if($C()&&!gf()&&!Mt())return sr(`gcpAuthRefresh invoked before trust check`,Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),N(`tengu_gcpAuthRefresh_missing_trust`,{}),!1;try{if(A(`Checking GCP credentials validity for auth refresh`),await ew())return A(`GCP credentials are valid, skipping auth refresh command`),!1}catch{}return nw(e)}function nw(e){A(`Running GCP auth refresh command`);let t=Uy.getInstance();return t.startAuthentication(),new Promise(n=>{let r=ga(e,{timeout:Jw});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),A(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),A(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)A(`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 rw(){Yw.cache.clear()}function iw(){QC()&&($C()&&!gf()&&!Mt()||Yw())}function aw(){let e=IC(),t=RC();!e&&!t||(LC()||zC())&&!gf()&&!Mt()||(Gw(),G())}function ow(e){return/^[a-zA-Z0-9-_]+$/.test(e)}async function sw(e){if(!ow(e))throw Error(`Invalid API key format. API key must contain only alphanumeric characters, dashes, and underscores.`);await uw();let t=!1;if(process.platform===`darwin`)try{let n=ky();await Pr(`security`,[`-i`],{input:`add-generic-password -U -a "${Ay()}" -s "${n}" -X "${Buffer.from(e,`utf-8`).toString(`hex`)}"\n`,reject:!1}),N(`tengu_api_key_saved_to_keychain`,{}),t=!0}catch(e){I(e),N(`tengu_api_key_keychain_error`,{error:An(e)}),N(`tengu_api_key_saved_to_config`,{})}else N(`tengu_api_key_saved_to_config`,{});let n=Iy(e);V(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??[]}}}),Xw.cache.clear?.(),vC()}function cw(e){let t=H(),n=Iy(e);return t.customApiKeyResponses?.approved?.includes(n)??!1}async function lw(){await uw(),V(e=>({...e,primaryApiKey:void 0})),Xw.cache.clear?.(),vC()}async function uw(){try{await Fy()}catch(e){I(e)}}function dw(e){if(!oy(e.scopes))return N(`tengu_oauth_tokens_not_claude_ai`,{}),{success:!0};if(!e.refreshToken||!e.expiresAt)return N(`tengu_oauth_tokens_inference_only`,{}),{success:!0};let t=fC(),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?N(`tengu_oauth_tokens_saved`,{storageBackend:n}):N(`tengu_oauth_tokens_save_failed`,{storageBackend:n}),Z.cache?.clear?.(),YS(),wC(),a}catch(e){return I(e),N(`tengu_oauth_tokens_save_exception`,{storageBackend:n,error:An(e)}),{success:!1,warning:`Failed to save OAuth tokens`}}}function fw(){Z.cache?.clear?.(),jy()}async function pw(){try{let{mtimeMs:e}=await pa(R(ae(),`.credentials.json`));e!==Zw&&(Zw=e,fw())}catch{Z.cache?.clear?.()}}function mw(e){let t=Qw.get(e);if(t)return t;let n=hw(e).finally(()=>{Qw.delete(e)});return Qw.set(e,n),n}async function hw(e){fw();let t=await gw();return t?.refreshToken?t.accessToken===e?_w(0,!0):(N(`tengu_oauth_401_recovered_from_keychain`,{}),!0):!1}async function gw(){if(ne())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN||Sy())return Z();try{let e=(await fC().readAsync())?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return I(e),null}}function _w(e=0,t=!1){return e===0&&!t?$w||($w=vw(e,t).finally(()=>{$w=null}),$w):vw(e,t)}async function vw(e,t){await pw();let n=Z();if(!t&&(!n?.refreshToken||!py(n.expiresAt))||!n?.refreshToken||!oy(n.scopes))return!1;Z.cache?.clear?.(),jy();let r=await gw();if(!r?.refreshToken||!py(r.expiresAt))return!1;let i=ae();await la(i,{recursive:!0});let a;try{N(`tengu_oauth_token_refresh_lock_acquiring`,{}),a=await hi(i),N(`tengu_oauth_token_refresh_lock_acquired`,{})}catch(n){return n.code===`ELOCKED`?e<5?(N(`tengu_oauth_token_refresh_lock_retry`,{retryCount:e+1}),await Fi(1e3+Math.random()*1e3),vw(e+1,t)):(N(`tengu_oauth_token_refresh_lock_retry_limit_reached`,{maxRetries:5}),!1):(I(n),N(`tengu_oauth_token_refresh_lock_error`,{error:An(n)}),!1)}try{Z.cache?.clear?.(),jy();let e=await gw();return!e?.refreshToken||!py(e.expiresAt)?(N(`tengu_oauth_token_refresh_race_resolved`,{}),!1):(N(`tengu_oauth_token_refresh_starting`,{}),dw(await uy(e.refreshToken,{scopes:oy(e.scopes)?void 0:e.scopes})),Z.cache?.clear?.(),jy(),!0)}catch(e){I(e),Z.cache?.clear?.(),jy();let t=await gw();return t&&!py(t.expiresAt)?(N(`tengu_oauth_token_refresh_race_recovered`,{}),!0):!1}finally{N(`tengu_oauth_token_refresh_lock_releasing`,{}),await a(),N(`tengu_oauth_token_refresh_lock_released`,{})}}function Y(){return kC()?oy(Z()?.scopes):!1}function yw(){return Z()?.scopes?.includes(`user:profile`)??!1}function bw(){return!(g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(process.env.CLAUDE_CODE_USE_FOUNDRY)||Y())}function xw(){return kC()?H().oauthAccount:void 0}function Sw(){let e=xw()?.billingType;return!(!Y()||!e||e!==`stripe_subscription`&&e!==`stripe_subscription_contracted`&&e!==`apple_subscription`&&e!==`google_play_subscription`)}function Cw(){let e=X();return e===`max`||e===`enterprise`||e===`team`||e===`pro`||e===null}function X(){if(Gv())return Wv();if(!kC())return null;let e=Z();return e?e.subscriptionType??null:null}function ww(){return X()===`max`}function Tw(){return X()===`team`}function Ew(){return X()===`team`&&kw()===`default_claude_max_5x`}function Dw(){return X()===`enterprise`}function Ow(){return X()===`pro`}function kw(){if(!kC())return null;let e=Z();return e?e.rateLimitTier??null:null}function Aw(){switch(X()){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 jw(){return!!(g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(process.env.CLAUDE_CODE_USE_FOUNDRY)||g(process.env.CLAUDE_CODE_USE_OPENAI)||g(process.env.CLAUDE_CODE_USE_GEMINI)||g(process.env.CLAUDE_CODE_USE_GROK))}function Mw(){return(J_()||{}).otelHeadersHelper}function Nw(){let e=Mw();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.otelHeadersHelper===e||n?.otelHeadersHelper===e}function Pw(){let e=Mw();if(!e)return{};let t=parseInt(process.env.CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS||nT.toString(),10);if(eT&&Date.now()-tT<t)return eT;if(Nw()&&!gf())return{};try{let t=ni(e,{timeout:3e4})?.toString().trim();if(!t)throw Error(`otelHeadersHelper did not return a valid value`);let n=Pn(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 eT=n,tT=Date.now(),eT}catch(e){throw I(Error(`Error getting OpenTelemetry headers from otelHeadersHelper (in settings): ${An(e)}`)),e}}function Fw(e){return e===`max`||e===`pro`}function Iw(){let e=X();return Y()&&e!==null&&Fw(e)}function Lw(){if(W()!==`firstParty`)return;let{source:e}=AC(),t={};e===`CLAUDE_CODE_OAUTH_TOKEN`||e===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`?t.tokenSource=e:Y()?t.subscription=Aw():t.tokenSource=e;let{key:n,source:r}=NC();if(n&&(t.apiKeySource=r),e===`claude.ai`||r===`/login managed key`){let e=xw()?.organizationName;e&&(t.organization=e)}let i=xw()?.emailAddress;return(e===`claude.ai`||r===`/login managed key`)&&i&&(t.email=i),t}async function Rw(){if(process.env.ANTHROPIC_UNIX_SOCKET||!kC())return{valid:!0};let e=U(`policySettings`)?.forceLoginOrgUUID;if(!e)return{valid:!0};await _w();let t=Z();if(!t)return{valid:!0};let{source:n}=AC(),r=n===`CLAUDE_CODE_OAUTH_TOKEN`||n===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,i=await iy(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 zw,Bw,Vw,Hw,Uw,Ww,Gw,Kw,qw,Jw,Yw,Xw,Z,Zw,Qw,$w,eT,tT,nT,rT,Q=t((()=>{Ze(),Nr(),m(),kr(),hr(),Nv(),wv(),O(),ny(),vy(),ay(),Oy(),Ly(),Hy(),Wy(),eC(),rp(),M(),h(),In(),ii(),gi(),Vr(),Xr(),pC(),SC(),Py(),Y_(),Ii(),ur(),EC(),zw=300*1e3,Bw=null,Vw=null,Hw=0,Uw=3600*1e3,Ww=180*1e3,Gw=Yr(async()=>{let e=await JC(),t=await XC();return(e||t)&&await Vy(),t},Uw),Kw=5e3,qw=3600*1e3,Jw=180*1e3,Yw=Yr(async()=>await tw(),qw),Xw=p(()=>{if(ne())return null;if(process.platform===`darwin`){let e=_C();if(e){if(e.stdout)return{key:e.stdout,source:`/login managed key`}}else{let e=ky();try{let t=ni(`security find-generic-password -a $USER -w -s "${e}"`);if(t)return{key:t,source:`/login managed key`}}catch(e){I(e)}}}let e=H();return e.primaryApiKey?{key:e.primaryApiKey,source:`/login managed key`}:null}),Z=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=Sy();if(e)return{accessToken:e,refreshToken:null,expiresAt:null,scopes:[`user:inference`],subscriptionType:null,rateLimitTier:null};try{let e=fC().read()?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return I(e),null}}),Zw=0,Qw=new Map,$w=null,eT=null,tT=0,nT=1740*1e3,rT=class extends Error{}}));function iT(){return`claude-code/2.6.5`}var aT=t((()=>{}));function oT(){return lT.getStore()?.workload}function sT(e,t){return lT.run({workload:e},t)}var cT,lT,uT=t((()=>{cT=`cron`,lT=new va}));function dT(){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=oT(),r=n?`, workload/${n}`:``;return`claude-cli/2.6.5 (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT??`cli`}${e}${t}${r})`}function fT(){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.6.5${e.length>0?` (${e.join(`, `)})`:``}`}function pT(){return`Claude-User (${iT()}; +https://support.anthropic.com/)`}function mT(){if(Y()){let e=Z();return e?.accessToken?{headers:{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":Dr}}:{headers:{},error:`No OAuth token available`}}let e=jC();return e?{headers:{"x-api-key":e}}:{headers:{},error:`No API key available`}}async function hT(e,t){try{return await e()}catch(n){if(!v.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=Z()?.accessToken;if(!i)throw n;return await mw(i),await e()}}var gT=t((()=>{Ie(),kr(),Q(),aT(),uT()}));async function _T(){ST===null&&!CT&&(CT=xT(),ST=await CT,CT=null,wT.cache.clear?.())}function vT(){ST=null,CT=null,wT.cache.clear?.(),TT.cache.clear?.()}function yT(){return wT(!0)}function bT(){if(ST!==null)return ST;let e=xw();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 xT(){let e=xw();if(e?.emailAddress)return e.emailAddress;if(process.env.USER_TYPE===`ant`)return process.env.COO_CREATOR?`${process.env.COO_CREATOR}@anthropic.com`:TT()}var ST,CT,wT,TT,ET=t((()=>{Nr(),m(),O(),Q(),rp(),gr(),Fr(),h(),ST=null,CT=null,wT=p(e=>{let t=zf(),n=H(),r,i,a;if(e&&(r=X()??void 0,i=kw()??void 0,r&&n.claudeCodeFirstTokenDate)){let e=new Date(n.claudeCodeFirstTokenDate).getTime();isNaN(e)||(a=e)}let o=xw(),s=o?.organizationUuid,c=o?.accountUuid;return{deviceId:t,sessionId:at(),email:bT(),appVersion:`2.6.5`,platform:Ir(),organizationUuid:s,accountUuid:c,userType:process.env.USER_TYPE,subscriptionType:r,rateLimitTier:i,firstTokenTime:a,...g(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}}}}),TT=p(async()=>{let e=await Pr(`git config --get user.email`,{shell:!0,reject:!1,cwd:_r()});return e.exitCode===0&&e.stdout?e.stdout.trim():void 0})}));function DT(e){return OT(e,new WeakSet)}function OT(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=>OT(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>OT(e,t))}return!1}var kT=t((()=>{})),AT,jT=t((()=>{fe(),we(),Ee(),kT(),ce(),AT=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){_(this,`hrTime`,void 0),_(this,`hrTimeObserved`,void 0),_(this,`spanContext`,void 0),_(this,`resource`,void 0),_(this,`instrumentationScope`,void 0),_(this,`attributes`,{}),_(this,`_severityText`,void 0),_(this,`_severityNumber`,void 0),_(this,`_body`,void 0),_(this,`_eventName`,void 0),_(this,`_attributesCount`,0),_(this,`_droppedAttributesCount`,0),_(this,`_isReadonly`,!1),_(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=_e(r??f),this.hrTimeObserved=_e(i??f),d){let e=me.getSpanContext(d);e&&ue(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 pe.warn(`Invalid attribute key: ${e}`),this;if(!DT(t))return pe.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&&pe.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 pe.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(Me,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(be,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(be,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(Me,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(ge,n.stack),t=!0)}t||pe.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&pe.warn(`Can not execute the operation on emitted log record`),this._isReadonly}}})),MT,NT=t((()=>{Fe(),fe(),jT(),ce(),MT=class{constructor(e,t){_(this,`instrumentationScope`,void 0),_(this,`_sharedState`,void 0),_(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||he.active(),r=e.severityNumber??Ne.UNSPECIFIED;if(r!==Ne.UNSPECIFIED&&r<t.minimumSeverity)return;if(t.traceBased){let e=me.getSpanContext(n);if(e&&ue(e)&&(e.traceFlags&de.SAMPLED)!==de.SAMPLED)return}let i=new AT(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!==Ne.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=e?.context||he.active();if(t.traceBased){let e=me.getSpanContext(r);if(e&&ue(e)&&(e.traceFlags&de.SAMPLED)!==de.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}}})),PT,FT=t((()=>{PT=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}}})),IT,LT=t((()=>{we(),ce(),IT=class{constructor(e,t){_(this,`processors`,void 0),_(this,`forceFlushTimeoutMillis`,void 0),this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(t=>Te(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 RT(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var zT=t((()=>{})),BT,VT=t((()=>{BT=`otel.sdk.log.created`})),HT,UT=t((()=>{VT(),ce(),HT=class{constructor(e){_(this,`createdLogs`,void 0),this.createdLogs=e.createCounter(BT,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}}})),WT,GT=t((()=>{WT=`0.215.0`})),KT,qT,JT,YT=t((()=>{fe(),Fe(),FT(),LT(),zT(),UT(),GT(),ce(),KT={disabled:!1,minimumSeverity:Ne.UNSPECIFIED,traceBased:!1},qT=()=>({...KT}),JT=class{constructor(e,t,n,r,i,a){_(this,`loggers`,new Map),_(this,`activeProcessor`,void 0),_(this,`registeredLogRecordProcessors`,[]),_(this,`resource`,void 0),_(this,`forceFlushTimeoutMillis`,void 0),_(this,`logRecordLimits`,void 0),_(this,`processors`,void 0),_(this,`loggerMetrics`,void 0),_(this,`_loggerConfigurator`,void 0),_(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 IT(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new PT,this._loggerConfigurator=i??qT,this.loggerMetrics=new HT(a?a.getMeter(`@opentelemetry/sdk-logs`,WT):le())}getLoggerConfig(e){let t=RT(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}}})),XT,ZT=t((()=>{fe(),Fe(),ke(),we(),NT(),YT(),ce(),XT=class{constructor(e={}){_(this,`_shutdownOnce`,void 0),_(this,`_sharedState`,void 0);let t={resource:e.resource??Ce(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??qT,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new JT(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new Ae(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return pe.warn(`A shutdown LoggerProvider cannot provide a Logger`),Pe;e||pe.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 MT({name:r,version:t,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(pe.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(pe.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}}})),QT,$T=t((()=>{we(),QT=class{export(e,t){this._sendLogRecords(e,t)}async forceFlush(){}async shutdown(){}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:je(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:Se.SUCCESS})}}}));async function eE(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 tE,nE,rE=t((()=>{fe(),we(),ce(),tE=class{constructor(e,t,n){_(this,`_exportCompleted`,void 0),_(this,`_exportScheduledPromise`,void 0),_(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 eE(t),await he.with(De(he.active()),async()=>this._exportWithTimeout(e,t,n))}catch(e){ye(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===Se.SUCCESS?r():i(e.error??Error(`BatchLogRecordProcessor: log record export failed`))}),this._exportScheduledResolve()})}},nE=class{constructor(e,t){_(this,`_maxExportBatchSize`,void 0),_(this,`_maxQueueSize`,void 0),_(this,`_scheduledDelayMillis`,void 0),_(this,`_exportTimeoutMillis`,void 0),_(this,`_exporter`,void 0),_(this,`_currentExport`,null),_(this,`_finishedLogRecords`,[]),_(this,`_timer`,void 0),_(this,`_shutdownOnce`,void 0),_(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 Ae(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(pe.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 tE(this._exporter,t,this._exportTimeoutMillis);this._currentExport=n;try{await n.exportScheduled,await this._exporter.forceFlush(),await n.exportCompleted}catch(e){ye(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 tE(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,ye(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)}}})),iE,aE=t((()=>{rE(),iE=class extends nE{onShutdown(){}}})),oE=t((()=>{aE()})),sE=t((()=>{oE()})),cE=t((()=>{ZT(),$T(),sE()}));function lE(){return g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(process.env.CLAUDE_CODE_USE_FOUNDRY)||Hr()}function uE(){return Hr()}var dE=t((()=>{h(),zr()}));function fE(){return{seconds:0,nanos:0}}function pE(e){return e!=null}var mE,hE=t((()=>{mE={fromJSON(e){return{seconds:pE(e.seconds)?globalThis.Number(e.seconds):0,nanos:pE(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 mE.fromPartial(e??{})},fromPartial(e){let t=fE();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}}}));function gE(){return{account_id:0,organization_uuid:``,account_uuid:``}}function _E(e){return e!=null}var vE,yE=t((()=>{vE={fromJSON(e){return{account_id:_E(e.account_id)?globalThis.Number(e.account_id):0,organization_uuid:_E(e.organization_uuid)?globalThis.String(e.organization_uuid):``,account_uuid:_E(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 vE.fromPartial(e??{})},fromPartial(e){let t=gE();return t.account_id=e.account_id??0,t.organization_uuid=e.organization_uuid??``,t.account_uuid=e.account_uuid??``,t}}}));function bE(){return{actor_id:``,repository_id:``,repository_owner_id:``}}function xE(){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 SE(){return{slack_team_id:``,is_enterprise_install:!1,trigger:``,creation_method:``}}function CE(){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 wE(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function TE(e){return e instanceof globalThis.Date?e:typeof e==`string`?new globalThis.Date(e):wE(mE.fromJSON(e))}function $(e){return e!=null}var EE,DE,OE,kE,AE=t((()=>{hE(),yE(),EE={fromJSON(e){return{actor_id:$(e.actor_id)?globalThis.String(e.actor_id):``,repository_id:$(e.repository_id)?globalThis.String(e.repository_id):``,repository_owner_id:$(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 EE.fromPartial(e??{})},fromPartial(e){let t=bE();return t.actor_id=e.actor_id??``,t.repository_id=e.repository_id??``,t.repository_owner_id=e.repository_owner_id??``,t}},DE={fromJSON(e){return{platform:$(e.platform)?globalThis.String(e.platform):``,node_version:$(e.node_version)?globalThis.String(e.node_version):``,terminal:$(e.terminal)?globalThis.String(e.terminal):``,package_managers:$(e.package_managers)?globalThis.String(e.package_managers):``,runtimes:$(e.runtimes)?globalThis.String(e.runtimes):``,is_running_with_bun:$(e.is_running_with_bun)?globalThis.Boolean(e.is_running_with_bun):!1,is_ci:$(e.is_ci)?globalThis.Boolean(e.is_ci):!1,is_claubbit:$(e.is_claubbit)?globalThis.Boolean(e.is_claubbit):!1,is_github_action:$(e.is_github_action)?globalThis.Boolean(e.is_github_action):!1,is_claude_code_action:$(e.is_claude_code_action)?globalThis.Boolean(e.is_claude_code_action):!1,is_claude_ai_auth:$(e.is_claude_ai_auth)?globalThis.Boolean(e.is_claude_ai_auth):!1,version:$(e.version)?globalThis.String(e.version):``,github_event_name:$(e.github_event_name)?globalThis.String(e.github_event_name):``,github_actions_runner_environment:$(e.github_actions_runner_environment)?globalThis.String(e.github_actions_runner_environment):``,github_actions_runner_os:$(e.github_actions_runner_os)?globalThis.String(e.github_actions_runner_os):``,github_action_ref:$(e.github_action_ref)?globalThis.String(e.github_action_ref):``,wsl_version:$(e.wsl_version)?globalThis.String(e.wsl_version):``,github_actions_metadata:$(e.github_actions_metadata)?EE.fromJSON(e.github_actions_metadata):void 0,arch:$(e.arch)?globalThis.String(e.arch):``,is_claude_code_remote:$(e.is_claude_code_remote)?globalThis.Boolean(e.is_claude_code_remote):!1,remote_environment_type:$(e.remote_environment_type)?globalThis.String(e.remote_environment_type):``,claude_code_container_id:$(e.claude_code_container_id)?globalThis.String(e.claude_code_container_id):``,claude_code_remote_session_id:$(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:$(e.deployment_environment)?globalThis.String(e.deployment_environment):``,is_conductor:$(e.is_conductor)?globalThis.Boolean(e.is_conductor):!1,version_base:$(e.version_base)?globalThis.String(e.version_base):``,coworker_type:$(e.coworker_type)?globalThis.String(e.coworker_type):``,build_time:$(e.build_time)?globalThis.String(e.build_time):``,is_local_agent_mode:$(e.is_local_agent_mode)?globalThis.Boolean(e.is_local_agent_mode):!1,linux_distro_id:$(e.linux_distro_id)?globalThis.String(e.linux_distro_id):``,linux_distro_version:$(e.linux_distro_version)?globalThis.String(e.linux_distro_version):``,linux_kernel:$(e.linux_kernel)?globalThis.String(e.linux_kernel):``,vcs:$(e.vcs)?globalThis.String(e.vcs):``,platform_raw:$(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=EE.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 DE.fromPartial(e??{})},fromPartial(e){let t=xE();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?EE.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}},OE={fromJSON(e){return{slack_team_id:$(e.slack_team_id)?globalThis.String(e.slack_team_id):``,is_enterprise_install:$(e.is_enterprise_install)?globalThis.Boolean(e.is_enterprise_install):!1,trigger:$(e.trigger)?globalThis.String(e.trigger):``,creation_method:$(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 OE.fromPartial(e??{})},fromPartial(e){let t=SE();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}},kE={fromJSON(e){return{event_name:$(e.event_name)?globalThis.String(e.event_name):``,client_timestamp:$(e.client_timestamp)?TE(e.client_timestamp):void 0,model:$(e.model)?globalThis.String(e.model):``,session_id:$(e.session_id)?globalThis.String(e.session_id):``,user_type:$(e.user_type)?globalThis.String(e.user_type):``,betas:$(e.betas)?globalThis.String(e.betas):``,env:$(e.env)?DE.fromJSON(e.env):void 0,entrypoint:$(e.entrypoint)?globalThis.String(e.entrypoint):``,agent_sdk_version:$(e.agent_sdk_version)?globalThis.String(e.agent_sdk_version):``,is_interactive:$(e.is_interactive)?globalThis.Boolean(e.is_interactive):!1,client_type:$(e.client_type)?globalThis.String(e.client_type):``,process:$(e.process)?globalThis.String(e.process):``,additional_metadata:$(e.additional_metadata)?globalThis.String(e.additional_metadata):``,auth:$(e.auth)?vE.fromJSON(e.auth):void 0,server_timestamp:$(e.server_timestamp)?TE(e.server_timestamp):void 0,event_id:$(e.event_id)?globalThis.String(e.event_id):``,device_id:$(e.device_id)?globalThis.String(e.device_id):``,swe_bench_run_id:$(e.swe_bench_run_id)?globalThis.String(e.swe_bench_run_id):``,swe_bench_instance_id:$(e.swe_bench_instance_id)?globalThis.String(e.swe_bench_instance_id):``,swe_bench_task_id:$(e.swe_bench_task_id)?globalThis.String(e.swe_bench_task_id):``,email:$(e.email)?globalThis.String(e.email):``,agent_id:$(e.agent_id)?globalThis.String(e.agent_id):``,parent_session_id:$(e.parent_session_id)?globalThis.String(e.parent_session_id):``,agent_type:$(e.agent_type)?globalThis.String(e.agent_type):``,slack:$(e.slack)?OE.fromJSON(e.slack):void 0,team_name:$(e.team_name)?globalThis.String(e.team_name):``,skill_name:$(e.skill_name)?globalThis.String(e.skill_name):``,plugin_name:$(e.plugin_name)?globalThis.String(e.plugin_name):``,marketplace_name:$(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=DE.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=vE.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=OE.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 kE.fromPartial(e??{})},fromPartial(e){let t=CE();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?DE.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?vE.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?OE.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 jE(){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 ME(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function NE(e){return e instanceof globalThis.Date?e:typeof e==`string`?new globalThis.Date(e):ME(mE.fromJSON(e))}function PE(e){return e!=null}var FE,IE=t((()=>{hE(),yE(),FE={fromJSON(e){return{event_id:PE(e.event_id)?globalThis.String(e.event_id):``,timestamp:PE(e.timestamp)?NE(e.timestamp):void 0,experiment_id:PE(e.experiment_id)?globalThis.String(e.experiment_id):``,variation_id:PE(e.variation_id)?globalThis.Number(e.variation_id):0,environment:PE(e.environment)?globalThis.String(e.environment):``,user_attributes:PE(e.user_attributes)?globalThis.String(e.user_attributes):``,experiment_metadata:PE(e.experiment_metadata)?globalThis.String(e.experiment_metadata):``,device_id:PE(e.device_id)?globalThis.String(e.device_id):``,auth:PE(e.auth)?vE.fromJSON(e.auth):void 0,session_id:PE(e.session_id)?globalThis.String(e.session_id):``,anonymous_id:PE(e.anonymous_id)?globalThis.String(e.anonymous_id):``,event_metadata_vars:PE(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=vE.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 FE.fromPartial(e??{})},fromPartial(e){let t=jE();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?vE.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 LE(){return process.platform===`linux`&&g(process.env.CLAUDE_CODE_BUBBLEWRAP)}function RE(){return process.platform===`linux`?WE??!1:!1}async function zE(){if(GE!==void 0)return GE;if(process.platform===`darwin`)return GE=null,null;try{let e=await Ri(process.pid,10);for(let t of e){let e=t.toLowerCase();for(let t of Rr)if(e.includes(t))return GE=t,t}}catch{}return GE=null,null}async function BE(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&Lr.platform!==`darwin`?await zE()||`pycharm`:Lr.terminal}function VE(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&Lr.platform!==`darwin`?GE===void 0?`pycharm`:GE||`pycharm`:Lr.terminal}async function HE(){process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&await zE()}var UE,WE,GE,KE,qE=t((()=>{m(),Fr(),h(),ii(),Li(),UE=p(async()=>{if(process.platform!==`linux`)return!1;let{code:e}=await ai(`test`,[`-f`,`/.dockerenv`]);return e===0}),WE=null,process.platform===`linux`&&pa(`/lib/libc.musl-${process.arch===`x64`?`x86_64`:`aarch64`}.so.1`).then(()=>{WE=!0},()=>{WE=!1}),KE={...Lr,terminal:VE(),getIsDocker:UE,getIsBubblewrapSandbox:LE,isMuslEnvironment:RE,getTerminalWithJetBrainsDetectionAsync:BE,initJetBrainsDetection:HE}}));function JE(e){return YE?.has(e)??!1}var YE,XE=t((()=>{M(),In()}));function ZE(){return!g(process.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS_DISABLED)}var QE=t((()=>{h()}));function $E(){return iD.getStore()}function eD(e,t){return iD.run(e,t)}function tD(e){return e?.agentType===`subagent`}function nD(){let e=$E();if(!(!tD(e)||!e.subagentName))return e.isBuiltIn?e.subagentName:`user-defined`}function rD(){let e=$E();if(!(!e?.invokingRequestId||e.invocationEmitted))return e.invocationEmitted=!0,{invokingRequestId:e.invokingRequestId,invocationKind:e.invocationKind}}var iD,aD=t((()=>{QE(),iD=new va}));function oD(e){return e.startsWith(`mcp__`)?`mcp_tool`:e}function sD(){return g(process.env.OTEL_LOG_TOOL_DETAILS)}function cD(e,t){return!!(process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`||e===`claudeai-proxy`||t&&JE(t))}function lD(e,t,n){let r=uD(e);return!r||!bD.has(r.serverName)&&!cD(t,n)?{}:{mcpServerName:r.serverName,mcpToolName:r.mcpToolName}}function uD(e){if(!e.startsWith(`mcp__`))return;let t=e.split(`__`);if(t.length<3)return;let n=t[1],r=t.slice(2).join(`__`);if(!(!n||!r))return{serverName:n,mcpToolName:r}}function dD(e,t){if(e===`Skill`&&typeof t==`object`&&t&&`skill`in t&&typeof t.skill==`string`)return t.skill}function fD(e,t=0){if(typeof e==`string`)return e.length>xD?`${e.slice(0,SD)}…[${e.length} chars]`:e;if(typeof e==`number`||typeof e==`boolean`||e==null)return e;if(t>=TD)return`<nested>`;if(Array.isArray(e)){let n=e.slice(0,wD).map(e=>fD(e,t+1));return e.length>wD&&n.push(`…[${e.length} items]`),n}if(typeof e==`object`){let n=Object.entries(e).filter(([e])=>!e.startsWith(`_`)),r=n.slice(0,wD).map(([e,n])=>[e,fD(n,t+1)]);return n.length>wD&&r.push([`…`,`${n.length} keys`]),Object.fromEntries(r)}return String(e)}function pD(e){if(!sD())return;let t=k(fD(e));return t.length>CD&&(t=t.slice(0,CD)+`…[truncated]`),t}function mD(e){let t=Ki(e).toLowerCase();if(!t||t===`.`)return;let n=t.slice(1);return n.length>ED?`other`:n}function hD(e,t){if(!e.includes(`.`)&&!t)return;let n,r=new Set;if(t){let e=mD(t);e&&(r.add(e),n=e)}for(let t of e.split(OD)){if(!t)continue;let e=t.split(kD);if(e.length<2)continue;let i=e[0],a=i.lastIndexOf(`/`),o=a>=0?i.slice(a+1):i;if(DD.has(o))for(let t=1;t<e.length;t++){let i=e[t];if(i.charCodeAt(0)===45)continue;let a=mD(i);a&&!r.has(a)&&(r.add(a),n=n?n+`,`+a:a)}}if(n)return n}function gD(){let e=$E();if(e){let t={agentId:e.agentId,parentSessionId:e.parentSessionId,agentType:e.agentType};return e.agentType===`teammate`&&(t.teamName=e.teamName),t}let t=Si(),n=bi(),r=_i(),i=yi()?`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=vn();return a?{parentSessionId:a}:{}}function _D(){try{let e=process.memoryUsage(),t=process.cpuUsage(),n=Date.now(),r;if(MD&&ND){let e=n-ND;e>0&&(r=(t.user-MD.user+(t.system-MD.system))/(e*1e3)*100)}return MD=t,ND=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 vD(e={}){let t=e.model?String(e.model):jx(),n=typeof e.betas==`string`?e.betas:QS(t).join(`,`),[r,i]=await Promise.all([jD(),xr()]),a=_D();return{model:t,sessionId:at(),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(mt()),clientType:st(),...a&&{processMetrics:a},sweBenchRunId:process.env.SWE_BENCH_RUN_ID||``,sweBenchInstanceId:process.env.SWE_BENCH_INSTANCE_ID||``,sweBenchTaskId:process.env.SWE_BENCH_TASK_ID||``,...gD(),...X()&&{subscriptionType:X()},...xt()?{kairosActive:!0}:{},...i&&{rh:i}}}function yD(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(k(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 bD,xD,SD,CD,wD,TD,ED,DD,OD,kD,AD,jD,MD,ND,PD=t((()=>{m(),Fr(),qE(),eC(),nS(),O(),h(),XE(),Q(),wr(),qr(),aD(),ur(),xi(),bD=new Set([(Bi(),e(zi)).COMPUTER_USE_MCP_SERVER_NAME]),xD=512,SD=128,CD=4*1024,wD=20,TD=2,ED=10,DD=new Set([`rm`,`mv`,`cp`,`touch`,`mkdir`,`chmod`,`chown`,`cat`,`head`,`tail`,`sort`,`stat`,`diff`,`wc`,`grep`,`rg`,`sed`]),OD=/\s*(?:&&|\|\||[;|])\s*/,kD=/\s+/,AD=p(()=>{let e=`2.6.5`.match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);return e?e[0]:void 0}),jD=p(async()=>{let[e,t,n,r]=await Promise.all([Lr.getPackageManagers(),Lr.getRuntimes(),Jr(),Kr()]);return{platform:Ir(),platformRaw:process.env.CLAUDE_CODE_HOST_PLATFORM||process.platform,arch:Lr.arch,nodeVersion:Lr.nodeVersion,terminal:KE.terminal,packageManagers:e.join(`,`),runtimes:t.join(`,`),isRunningWithBun:Lr.isRunningWithBun(),isCi:g(process.env.CI),isClaubbit:g(process.env.CLAUBBIT),isClaudeCodeRemote:g(process.env.CLAUDE_CODE_REMOTE),isLocalAgentMode:process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`,isConductor:Lr.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:g(process.env.GITHUB_ACTIONS),isClaudeCodeAction:g(process.env.CLAUDE_CODE_ACTION),isClaudeAiAuth:Y(),version:`2.6.5`,versionBase:AD(),buildTime:`2026-05-22T13:07:48.152Z`,deploymentEnvironment:Lr.detectDeploymentEnvironment(),...g(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},...Wr()&&{wslVersion:Wr()},...n??{},...r.length>0?{vcs:r.join(`,`)}:{}}}),MD=null,ND=null}));function FD(){return Ui.join(ae(),`telemetry`)}function ID(e){if(!v.isAxiosError(e))return An(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 LD,RD,zD,BD=t((()=>{we(),Ie(),O(),AE(),IE(),Q(),rp(),M(),h(),In(),gT(),di(),Vr(),Ii(),ur(),aT(),vy(),hr(),PD(),ce(),LD=sa(),RD=`1p_failed_events.`,zD=class{constructor(e={}){_(this,`endpoint`,void 0),_(this,`timeout`,void 0),_(this,`maxBatchSize`,void 0),_(this,`skipAuth`,void 0),_(this,`batchDelayMs`,void 0),_(this,`baseBackoffDelayMs`,void 0),_(this,`maxBackoffDelayMs`,void 0),_(this,`maxAttempts`,void 0),_(this,`isKilled`,void 0),_(this,`pendingExports`,[]),_(this,`isShutdown`,!1),_(this,`schedule`,void 0),_(this,`cancelBackoff`,null),_(this,`attempts`,0),_(this,`isRetrying`,!1),_(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 Ui.join(FD(),`${RD}${at()}.${LD}.json`)}async loadEventsFromFile(e){try{return await ci(e)}catch{return[]}}async loadEventsFromCurrentBatch(){return this.loadEventsFromFile(this.getCurrentBatchFilePath())}async saveEventsToFile(e,t){try{if(t.length===0)try{await ma(e)}catch{}else await la(FD(),{recursive:!0}),await ha(e,t.map(e=>k(e)).join(`
36
+ `)+`
37
+ `,`utf8`)}catch(e){I(e)}}async appendEventsToFile(e,t){if(t.length!==0)try{await la(FD(),{recursive:!0}),await ca(e,t.map(e=>k(e)).join(`
38
+ `)+`
39
+ `,`utf8`)}catch(e){I(e)}}async deleteFile(e){try{await ma(e)}catch{}}async retryPreviousBatches(){try{let e=`${RD}${at()}.`,t;try{t=(await da(FD())).filter(t=>t.startsWith(e)&&t.endsWith(`.json`)).filter(e=>!e.includes(LD))}catch(e){if(Ln(e))return;throw e}for(let e of t){let t=Ui.join(FD(),e);this.retryFileInBackground(t)}}catch(e){I(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`&&A(`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`&&A(`1P event logging: previous batch retry succeeded`)):(await this.saveEventsToFile(e,n),process.env.USER_TYPE===`ant`&&A(`1P event logging: previous batch retry failed, ${n.length} events remain`))}async export(e,t){if(this.isShutdown){process.env.USER_TYPE===`ant`&&A(`1P event logging export failed: Exporter has been shutdown`),t({code:Se.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:Se.SUCCESS});return}let r=this.transformLogsToEvents(n).events;if(r.length===0){t({code:Se.SUCCESS});return}if(this.attempts>=this.maxAttempts){t({code:Se.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:Se.FAILED,error:Error(`Failed to export ${i.length} events${e}`)});return}this.resetBackoff(),await this.getQueuedEventCount()>0&&!this.isRetrying&&this.retryFailedEvents(),t({code:Se.SUCCESS})}catch(e){process.env.USER_TYPE===`ant`&&A(`1P event logging export failed: ${An(e)}`),I(e),t({code:Se.FAILED,error:kn(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`&&A(`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=ID(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;A(`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 Fi(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}`;I(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`&&A(`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`&&A(`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`&&A(`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`&&A(`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":iT(),"x-service-name":`claude-code`},n=gf()||Mt();process.env.USER_TYPE===`ant`&&!n&&A(`1P event logging: Trust not accepted`);let r=this.skipAuth||!n;if(!r&&Y()){let e=Z();yw()?e&&py(e.expiresAt)&&(r=!0,process.env.USER_TYPE===`ant`&&A(`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`}:mT(),a=!i.error;!a&&process.env.USER_TYPE===`ant`&&A(`1P event logging: auth not available, sending without auth`);let o=a?{...t,...i.headers}:t;try{let t=await v.post(this.endpoint,e,{timeout:this.timeout,headers:o});this.logSuccess(e.events.length,a,t.data);return}catch(n){if(a&&v.isAxiosError(n)&&n.response?.status===401){process.env.USER_TYPE===`ant`&&A(`1P event logging: 401 auth error, retrying without auth`);let n=await v.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`&&(A(`1P event logging: ${e} events exported successfully${t?` (with auth)`:` (without auth)`}`),A(`API Response: ${k(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:FE.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`&&A(`1P event logging: core_metadata missing for event ${r}`),t.push({event_type:`ClaudeCodeInternalEvent`,event_data:kE.toJSON({event_id:e.event_id,event_name:r,client_timestamp:this.hrTimeToDate(n.hrTime),session_id:at(),additional_metadata:Buffer.from(k({transform_error:`core_metadata attribute is missing`})).toString(`base64`)})});continue}let s=yD(i,a,o),{_PROTO_skill_name:c,_PROTO_plugin_name:l,_PROTO_marketplace_name:u,...d}=s.additional,f=mr(d);t.push({event_type:`ClaudeCodeInternalEvent`,event_data:kE.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(k(f)).toString(`base64`):void 0})})}return{events:t}}async shutdown(){this.isShutdown=!0,this.resetBackoff(),await this.forceFlush(),process.env.USER_TYPE===`ant`&&A(`1P event logging exporter shutdown complete`)}async forceFlush(){await Promise.all(this.pendingExports),process.env.USER_TYPE===`ant`&&A(`1P event logging exporter flush complete`)}}}));function VD(e){return zO(HD,{})?.[e]===!0}var HD,UD=t((()=>{ik(),HD=`tengu_frond_boric`}));function WD(){return zO(tO,{})}function GD(e){let t=WD()[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 KD(){return zO(nO,{})}async function qD(){if(iO)try{await iO.shutdown(),process.env.USER_TYPE===`ant`&&A(`1P event logging: final shutdown complete`)}catch{}}function JD(){return!lE()}async function YD(e,t,n={}){try{let r=await vD({model:n.model,betas:n.betas}),i={event_name:t,event_id:sa(),core_metadata:r,user_metadata:wT(!0),event_metadata:n},a=zf();a&&(i.user_id=a),process.env.USER_TYPE===`ant`&&A(`[ANT-ONLY] 1P event: ${t} ${k(n,null,0)}`),e.emit({body:t,attributes:i})}catch(e){process.env.USER_TYPE===`ant`&&I(e)}}function XD(e,t={}){JD()&&(!rO||VD(`firstParty`)||YD(rO,e,t))}function ZD(){return`production`}function QD(e){if(!JD()||!rO||VD(`firstParty`))return;let t=zf(),{accountUuid:n,organizationUuid:r}=wT(!0),i={event_type:`GrowthbookExperimentEvent`,event_id:sa(),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:k(e.userAttributes)},...e.experimentMetadata&&{experiment_metadata:k(e.experimentMetadata)},environment:ZD()};process.env.USER_TYPE===`ant`&&A(`[ANT-ONLY] 1P GrowthBook experiment: ${e.experimentId} variation=${e.variationId}`),rO.emit({body:`growthbook_experiment`,attributes:i})}function $D(){if(wi(`1p_event_logging_start`),!JD()){process.env.USER_TYPE===`ant`&&A(`1P event logging not enabled`);return}let e=KD();aO=e,wi(`1p_event_after_growthbook_config`);let t=e.scheduledDelayMillis||parseInt(process.env.OTEL_LOGS_EXPORT_INTERVAL||oO.toString(),10),n=e.maxExportBatchSize||sO,r=e.maxQueueSize||cO,i=Gr(),a={[xe]:`claude-code`,[ve]:`2.6.5`};if(i===`wsl`){let e=Wr();e&&(a[`wsl.version`]=e)}iO=new XT({resource:Oe(a),processors:[new iE(new zD({maxBatchSize:n,skipAuth:e.skipAuth,maxAttempts:e.maxAttempts,path:e.path,baseUrl:e.baseUrl,isKilled:()=>VD(`firstParty`)}),{scheduledDelayMillis:t,maxExportBatchSize:n,maxQueueSize:r})]}),rO=iO.getLogger(`com.anthropic.claude_code.events`,`2.6.5`)}async function eO(){if(!JD()||!iO||ku(KD(),aO))return;process.env.USER_TYPE===`ant`&&A(`1P event logging: ${nO} changed, reinitializing`);let e=iO,t=rO;rO=null;try{await e.forceFlush()}catch{}iO=null;try{$D()}catch(n){iO=e,rO=t,I(n);return}e.shutdown().catch(()=>{})}var tO,nO,rO,iO,aO,oO,sO,cO,lO=t((()=>{ke(),cE(),Ee(),Td(),rp(),M(),Vr(),qr(),ur(),Ti(),ET(),dE(),BD(),ik(),PD(),UD(),tO=`tengu_event_sampling_config`,nO=`tengu_1p_event_batch_config`,rO=null,iO=null,aO=null,oO=1e4,sO=200,cO=8192}));function uO(e){try{Promise.resolve(e()).catch(e=>{I(e)})}catch(e){I(e)}}function dO(e){let t=!0,n=YO.subscribe(()=>uO(e));return GO.size>0&&queueMicrotask(()=>{t&&GO.size>0&&uO(e)}),()=>{t=!1,n()}}function fO(){if(!ZO&&(ZO=!0,process.env.USER_TYPE===`ant`)){let e=process.env.CLAUDE_INTERNAL_FC_OVERRIDES;if(e)try{XO=JSON.parse(e),A(`GrowthBook: Using env var overrides for ${Object.keys(XO).length} features: ${Object.keys(XO).join(`, `)}`)}catch{I(Error(`GrowthBook: Failed to parse CLAUDE_INTERNAL_FC_OVERRIDES: ${e}`))}}return XO}function pO(e){let t=fO();return t!==null&&e in t}function mO(){if(process.env.USER_TYPE===`ant`)try{return H().growthBookOverrides}catch{return}}function hO(){return GO.size>0?Object.fromEntries(GO):H().cachedGrowthBookFeatures??{}}function gO(){return mO()??{}}function _O(e,t){if(process.env.USER_TYPE===`ant`)try{V(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 ku(r[e],t)?n:{...n,growthBookOverrides:{...r,[e]:t}}}),YO.emit()}catch(e){I(e)}}function vO(){if(process.env.USER_TYPE===`ant`)try{V(e=>{if(!e.growthBookOverrides||Object.keys(e.growthBookOverrides).length===0)return e;let{growthBookOverrides:t,...n}=e;return n}),YO.emit()}catch(e){I(e)}}function yO(e){if(qO.has(e))return;let t=WO.get(e);t&&(qO.add(e),QD({experimentId:t.experimentId,variationId:t.variationId,userAttributes:TO(),experimentMetadata:{feature_id:e}}))}async function bO(e){let t=e.getPayload();if(!t?.features||Object.keys(t.features).length===0)return!1;WO.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&&WO.set(e,{experimentId:r.key,variationId:n.variationId})}}await e.setPayload({...t,features:n}),GO.clear();for(let[e,t]of Object.entries(n)){let n=`value`in t?t.value:t.defaultValue;n!==void 0&&GO.set(e,n)}return!0}function xO(){let e=Object.fromEntries(GO);ku(H().cachedGrowthBookFeatures,e)||V(t=>({...t,cachedGrowthBookFeatures:e}))}function SO(e){if(!process.env.CLAUDE_CODE_DISABLE_LOCAL_GATES)return QO[e]}function CO(){return process.env.CLAUDE_GB_ADAPTER_URL&&process.env.CLAUDE_GB_ADAPTER_KEY?!0:JD()}function wO(){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 TO(){let e=yT(),t=e.email;!t&&process.env.USER_TYPE===`ant`&&(t=H().oauthAccount?.emailAddress);let n=wO();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 EO(e,t,n){let r=fO();if(r&&e in r)return r[e];let i=mO();if(i&&e in i)return i[e];if(!CO()){let n=SO(e);return n===void 0?t:n}let a=await ek();if(!a){let n=SO(e);return n===void 0?t:n}let o;return o=GO.has(e)?GO.get(e):a.getFeatureValue(e,t),n&&yO(e),process.env.USER_TYPE===`ant`&&A(`GrowthBook: getFeatureValue("${e}") = ${k(o)}`),o}async function DO(e,t){return EO(e,t,!0)}function OO(e,t){let n=fO();if(n&&e in n)return n[e];let r=mO();if(r&&e in r)return r[e];if(!CO()){let n=SO(e);return n===void 0?t:n}let i=SO(e);if(i!==void 0)return i;if(WO.has(e)?yO(e):KO.add(e),GO.has(e))return GO.get(e);try{let t=H().cachedGrowthBookFeatures?.[e];if(t!==void 0)return t}catch{}return t}function kO(e,t,n){return OO(e,t)}function AO(e){let t=fO();if(t&&e in t)return!!t[e];let n=mO();if(n&&e in n)return!!n[e];if(!CO()){let t=SO(e);return t===void 0?!1:!!t}WO.has(e)?yO(e):KO.add(e);try{let t=H(),n=t.cachedGrowthBookFeatures?.[e];if(n!==void 0)return!!n;let r=t.cachedStatsigGates?.[e];if(r!==void 0)return r}catch{}let r=SO(e);return r===void 0?!1:!!r}async function jO(e){let t=fO();if(t&&e in t)return!!t[e];let n=mO();if(n&&e in n)return!!n[e];if(!CO())return!1;JO&&await JO;let r=H(),i=r.cachedStatsigGates?.[e];if(i!==void 0)return!!i;let a=r.cachedGrowthBookFeatures?.[e];return a===void 0?!1:!!a}async function MO(e){let t=fO();if(t&&e in t)return!!t[e];let n=mO();if(n&&e in n)return!!n[e];if(!CO()){let t=SO(e);return t===void 0?!1:!!t}return H().cachedGrowthBookFeatures?.[e]===!0?(WO.has(e)?yO(e):KO.add(e),!0):EO(e,!1,!0)}function NO(){if(CO())try{PO(),YO.emit(),JO=ek().catch(e=>(I(kn(e)),null)).finally(()=>{JO=null})}catch(e){I(kn(e))}}function PO(){LO(),VO&&(process.off(`beforeExit`,VO),VO=null),HO&&(process.off(`exit`,HO),HO=null),BO?.destroy(),BO=null,UO=!1,JO=null,WO.clear(),KO.clear(),qO.clear(),GO.clear(),$O.cache?.clear?.(),ek.cache?.clear?.(),XO=null,ZO=!1}async function FO(){if(CO())try{let e=await ek();if(!e)return;if(await e.refreshFeatures(),e!==BO){process.env.USER_TYPE===`ant`&&A(`GrowthBook: Skipping refresh processing for replaced client`);return}let t=await bO(e);if(e!==BO)return;process.env.USER_TYPE===`ant`&&A(`GrowthBook: Light refresh completed`),t&&(xO(),YO.emit())}catch(e){I(kn(e))}}function IO(){CO()&&(nk&&clearInterval(nk),nk=setInterval(()=>{FO()},tk),nk.unref?.(),rk||(rk=()=>{LO()},process.once(`beforeExit`,rk)))}function LO(){nk&&(clearInterval(nk),nk=null),rk&&(process.removeListener(`beforeExit`,rk),rk=null)}async function RO(e,t){return DO(e,t)}function zO(e,t){return OO(e,t)}var BO,VO,HO,UO,WO,GO,KO,qO,JO,YO,XO,ZO,QO,$O,ek,tk,nk,rk,ik=t((()=>{lc(),Td(),O(),Dd(),rp(),M(),In(),gT(),Vr(),ft(),ur(),ET(),lO(),BO=null,VO=null,HO=null,UO=!1,WO=new Map,GO=new Map,KO=new Set,qO=new Set,JO=null,YO=Ot(),XO=null,ZO=!1,QO={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},$O=p(()=>{if(!CO())return null;let e=TO(),t=Ed(),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`&&A(`GrowthBook: Creating client with clientKey=${t}, attributes: ${k(e)}`);let i=gf()||lt()||Mt()?mT():{headers:{},error:`trust not established`},a=r||!i.error;UO=a;let o=new sc({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)=>{A(`GrowthBook: ${e} ${k(t)}`)}}:{}});if(BO=o,!a)return{client:o,initialized:Promise.resolve()};let s=o.init({timeout:5e3}).then(async e=>{if(BO!==o){process.env.USER_TYPE===`ant`&&A(`GrowthBook: Skipping init callback for replaced client`);return}process.env.USER_TYPE===`ant`&&A(`GrowthBook initialized, source: ${e.source}, success: ${e.success}`);let t=await bO(o);if(BO===o){if(t){for(let e of KO)yO(e);KO.clear(),xO(),YO.emit()}if(process.env.USER_TYPE===`ant`){let e=o.getFeatures();if(e){let t=Object.keys(e);A(`GrowthBook loaded ${t.length} features: ${t.slice(0,10).join(`, `)}${t.length>10?`...`:``}`)}}}}).catch(e=>{process.env.USER_TYPE===`ant`&&I(kn(e))});return VO=()=>BO?.destroy(),HO=()=>BO?.destroy(),process.on(`beforeExit`,VO),process.on(`exit`,HO),{client:o,initialized:s}}),ek=p(async()=>{let e=$O();return!e||!UO&&(gf()||lt()||Mt())&&!mT().error&&(process.env.USER_TYPE===`ant`&&A(`GrowthBook: Auth became available after client creation, reinitializing`),PO(),e=$O(),!e)?null:(await e.initialized,IO(),e.client)}),tk=process.env.USER_TYPE===`ant`?1200*1e3:360*60*1e3,nk=null,rk=null}));function ak(){let e=process.env.CLAUDE_CODE_DISABLE_AUTO_MEMORY;if(g(e))return!1;if(ie(e))return!0;if(g(process.env.CLAUDE_CODE_SIMPLE)||g(process.env.CLAUDE_CODE_REMOTE)&&!process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR)return!1;let t=z_();return t.autoMemoryEnabled===void 0?!0:t.autoMemoryEnabled}function ok(){return OO(`tengu_passport_quail`,!1)?!Mt()||OO(`tengu_slate_thimble`,!1):!1}function sk(){return process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR?process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR:ae()}function ck(e,t){if(!e)return;let n=e;if(t&&(n.startsWith(`~/`)||n.startsWith(`~\\`))){let e=n.slice(2),t=Ji(e||`.`);if(t===`.`||t===`..`)return;n=R(Vi(),e)}let r=Ji(n).replace(/[/\\]+$/,``);if(!(!qi(r)||r.length<3||/^[A-Za-z]:$/.test(r)||r.startsWith(`\\\\`)||r.startsWith(`//`)||r.includes(`\0`)))return(r+Zi).normalize(`NFC`)}function lk(){return ck(process.env.CLAUDE_COWORK_MEMORY_PATH_OVERRIDE,!1)}function uk(){return ck(U(`policySettings`)?.autoMemoryDirectory??U(`flagSettings`)?.autoMemoryDirectory??U(`localSettings`)?.autoMemoryDirectory??U(`userSettings`)?.autoMemoryDirectory,!0)}function dk(){return lk()!==void 0}function fk(){return Sr(xn())??xn()}function pk(){return R(_k(),gk)}function mk(e){return Ji(e).startsWith(_k())}var hk,gk,_k,vk=t((()=>{m(),O(),ik(),h(),wr(),$r(),Y_(),hk=`memory`,gk=`MEMORY.md`,_k=p(()=>(lk()??uk())||(R(R(sk(),`projects`),Zr(fk()),hk)+Zi).normalize(`NFC`),()=>xn())}));export{$E as $,O_ as $a,zd as $c,Py as $i,qS as $n,bh as $o,hx as $r,Sp as $s,kw as $t,LO as A,Av as Aa,rp as Ac,ub as Ai,Xu as Al,lw as An,Zh as Ao,Gx as Ar,im as As,iT as At,UD as B,Q_ as Ba,cf as Bc,eb as Bi,Bl,fC as Bn,Vh as Bo,Jx as Br,Jp as Bs,Lw as Bt,ek as C,Bv as Ca,yf as Cc,zb as Ci,dd as Cl,qC as Cn,yg as Co,Rx as Cr,_m as Cs,pT as Ct,PO as D,Iv as Da,np as Dc,Mb as Di,$u as Dl,YC as Dn,Yh as Do,jx as Dr,om as Ds,oT as Dt,FO as E,Uv as Ea,zf as Ec,Ub as Ei,id as El,Gw as En,ig as Eo,Px as Er,fm as Es,cT as Et,XD as F,wv as Fa,If as Fc,ib as Fi,Au as Fl,CC as Fn,tg as Fo,Zx as Fr,Wp as Fs,ew as Ft,vD as G,G_ as Ga,Yd as Gc,lb as Gi,BS as Gn,Mh as Go,wx as Gr,Up as Gs,Xw as Gt,uD as H,iv as Ha,uf as Hc,Yy as Hi,Zc as Hl,cC as Hn,jh as Ho,qx as Hr,Bp as Hs,NC as Ht,QD as I,Cv as Ia,ff as Ic,qy as Ii,ku as Il,EC as In,ng as Io,kx as Ir,qp as Is,KC as It,PD as J,L_ as Ja,Hd as Jc,Hy as Ji,QS as Jn,Oh as Jo,Sx as Jr,Fp as Js,Z as Jt,mD as K,z_ as Ka,Ud as Kc,Uy as Ki,$S as Kn,Ih as Ko,Ex as Kr,Np as Ks,VC as Kt,eO as L,gv as La,df as Lc,Jy as Li,bu as Ll,gC as Ln,Rh as Lo,Ux as Lr,$p as Ls,ZC as Lt,lO as M,Nv as Ma,Bf as Mc,pb as Mi,Wu as Ml,dw as Mn,$h as Mo,Ox as Mr,Qp as Ms,DC as Mt,$D as N,W as Na,Pf as Nc,fb as Ni,Mu as Nl,Rw as Nn,eg as No,Ax as Nr,nm as Ns,BC as Nt,_O as O,Pv as Oa,Tf as Oc,jb as Oi,Qu as Ol,nw as On,Qh as Oo,$x as Or,sm as Os,uT as Ot,JD as P,Sv as Pa,V as Pc,ob as Pi,ju as Pl,wC as Pn,Xh as Po,nS as Pr,Yp as Ps,_w as Pt,rD as Q,U as Qa,Rd as Qc,jy as Qi,KS as Qn,Eh as Qo,px as Qr,Cp as Qs,Pw as Qt,GD as R,xv as Ra,pf as Rc,Qy as Ri,yu as Rl,SC as Rn,qh as Ro,Qx as Rr,Xp as Rs,rw as Rt,ik as S,zv as Sa,H as Sc,bb as Si,fd as Sl,jw as Sn,Og as So,Fx as Sr,vm as Ss,dT as St,NO as T,Kv as Ta,Vf as Tc,Vb as Ti,ad as Tl,iw as Tn,bg as To,Nx as Tr,gm as Ts,hT as Tt,dD as U,ov as Ua,of as Uc,$y as Ui,iC as Un,Ph as Uo,Wx as Ur,Hp as Us,HC as Ut,VD as V,tv as Va,lf as Vc,nb as Vi,il as Vl,pC as Vn,Hh as Vo,Vx as Vr,Kp as Vs,jC as Vt,pD as W,$_ as Wa,af as Wc,cb as Wi,YS as Wn,Nh as Wo,Yx as Wr,Vp as Ws,GC as Wt,lD as X,j_ as Xa,ef as Xc,Ly as Xi,GS as Xn,kh as Xo,xx as Xr,Op as Xs,PC as Xt,sD as Y,N_ as Ya,Kd as Yc,Ry as Yi,eC as Yn,Dh as Yo,Cx as Yr,Dp as Ys,gw as Yt,oD as Z,A_ as Za,Gd as Zc,Iy as Zi,WS as Zn,Th as Zo,bx as Zr,Tp as Zs,xw as Zt,OO as _,ry as _a,kf as _c,wb as _i,wd as _l,Nw as _n,r_ as _o,lS as _r,nh as _s,_T as _t,vk as a,fy as aa,yp as ac,Qb as ai,Id as al,yw as an,H_ as ao,TS as ar,vh as as,KE as at,gO as b,Hv as ba,Nf as bc,Ob as bi,yd as bl,Ew as bn,Eg as bo,zx as br,th as bs,mT as bt,ok as c,my as ca,lp as cc,ux as ci,Qd as cl,kC as cn,K_ as co,ES as cr,gh as cs,dE as ct,AO as d,py as da,cp as dc,vb as di,Bd as dl,Y as dn,u_ as do,PS as dr,ym as ds,cE as dt,Dy as ea,bp as ec,ox as ei,sf as el,Aw as en,V_ as eo,LS as er,xh as es,nD as et,vO as f,sy as fa,op as fc,xb as fi,Od as fl,Iw as fn,l_ as fo,bS as fr,oh as fs,iE as ft,zO as g,_y as ga,gf as gc,Db as gi,Td as gl,ww as gn,o_ as go,iS as gr,Mm as gs,TT as gt,RO as h,oy as ha,Kf as hc,yb as hi,Ad as hl,$C as hn,d_ as ho,cS as hr,Gm as hs,wT as ht,dk as i,cy as ia,wp as ic,$b as ii,nf as il,Cw as in,U_ as io,NS as ir,hh as is,ZE as it,WD as j,G as ja,Ff as jc,db as ji,Gu as jl,sw as jn,ag as jo,Ix as jr,em as js,aT as jt,IO as k,Rv as ka,Uf as kc,Sb as ki,Zu as kl,Yw as kn,Jh as ko,Hx as kr,rm as ks,sT as kt,MO as l,hy as la,hp as lc,Nb as li,Xd as ll,LC as ln,P_ as lo,wS as lr,yh as ls,lE as lt,wO as m,uy as ma,ip as mc,_b as mi,jd as ml,Dw as mn,f_ as mo,hS as mr,dh as ms,XT as mt,_k as n,yy as na,Ap as nc,nx as ni,Zd as nl,mw as nn,J_ as no,MS as nr,Sh as ns,eD as nt,mk as o,ly as oa,gp as oc,tx as oi,rf as ol,Q as on,Y_ as oo,CS as or,_h as os,HE as ot,hO as p,gy as pa,ap as pc,kb as pi,Md as pl,cw as pn,x_ as po,yS as pr,lh as ps,QT as pt,hD as q,w_ as qa,Vd as qc,Wy as qi,JS as qn,Ah as qo,Dx as qr,Mp as qs,AC as qt,sk as r,by as ra,Ep as rc,lx as ri,tf as rl,MC as rn,W_ as ro,kS as rr,wh as rs,QE as rt,ak as s,dy as sa,dp as sc,Jb as si,Ld as sl,bw as sn,E_ as so,DS as sr,mh as ss,qE as st,pk as t,Oy as ta,xp as tc,sx as ti,Jd as tl,X as tn,B_ as to,RS as tr,Ch as ts,aD as tt,jO as u,vy as ua,sp as uc,Cb as ui,qd as ul,zC as un,c_ as uo,xS as ur,ph as us,uE as ut,kO as v,iy as va,Lf as vc,qb as vi,Cd as vl,Sw as vn,Gg as vo,J as vr,Ym as vs,ET as vt,dO as w,ny as wa,Hf as wc,Rb as wi,ud as wl,aw as wn,vg as wo,Lx as wr,mm as ws,gT as wt,pO as x,qv as xa,Ef as xc,mb as xi,pd as xl,Tw as xn,Dg as xo,Bx as xr,fh as xs,fT as xt,DO as y,ay as ya,Rf as yc,hb as yi,bd as yl,Ow as yn,Ug as yo,Mx as yr,eh as ys,vT as yt,qD as z,nv as za,mf as zc,tb as zi,zl,hC as zn,Lh as zo,eS as zr,Zp as zs,fw as zt};