@bkm016/basalt 0.1.33 → 0.1.34

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 (853) hide show
  1. package/README.md +23 -0
  2. package/chunk-0tr0cc6f.js +3 -0
  3. package/chunk-1f0mnggp.js +3 -0
  4. package/chunk-1ntcq7ed.js +2 -0
  5. package/chunk-1xkxfddg.js +286 -0
  6. package/chunk-1zz6akcm.js +3 -0
  7. package/chunk-2cd3qzny.js +3 -0
  8. package/chunk-2sbmy31t.js +2 -0
  9. package/chunk-32s6agaj.js +2 -0
  10. package/chunk-37n62c4c.js +3 -0
  11. package/chunk-3w2902kg.js +9 -0
  12. package/chunk-43q7hq53.js +2 -0
  13. package/chunk-4ewh67qf.js +25 -0
  14. package/chunk-5277mfp2.js +44 -0
  15. package/chunk-6f1zc4g6.js +2 -0
  16. package/chunk-6r4kw9x9.js +60 -0
  17. package/chunk-7qaavsga.js +2 -0
  18. package/chunk-88s6d1bz.js +3 -0
  19. package/chunk-9jw0km9r.js +13 -0
  20. package/chunk-a3h0mng1.js +8 -0
  21. package/chunk-acmtkg1q.js +20 -0
  22. package/chunk-adn9jbzj.js +2 -0
  23. package/chunk-anfhjdgv.js +2 -0
  24. package/chunk-apn5amfe.js +498 -0
  25. package/chunk-bsp6e8cv.js +2 -0
  26. package/chunk-bw2h35jd.js +2 -0
  27. package/chunk-bwx9m3ex.js +51 -0
  28. package/chunk-cezgvpja.js +3 -0
  29. package/chunk-cfhtmr6g.js +31 -0
  30. package/chunk-d5w3ntc3.js +7 -0
  31. package/chunk-dtks8c7v.js +2 -0
  32. package/chunk-e01g2yf9.js +3 -0
  33. package/chunk-e1rfd7jn.js +3 -0
  34. package/chunk-e8ehznx7.js +2 -0
  35. package/chunk-edp0svhf.js +3 -0
  36. package/chunk-evaew46c.js +2 -0
  37. package/chunk-ewhpfrgj.js +3 -0
  38. package/chunk-f7q6p7tp.js +7 -0
  39. package/chunk-fm482h25.js +3 -0
  40. package/chunk-g3j6jdht.js +39 -0
  41. package/chunk-gejre6z5.js +7 -0
  42. package/chunk-gz5ssvjh.js +3 -0
  43. package/chunk-h32ca6cs.js +11 -0
  44. package/chunk-hab25nd9.js +3 -0
  45. package/chunk-jbfkv490.js +8 -0
  46. package/chunk-jem2kqdt.js +3 -0
  47. package/chunk-jrwezx0r.js +16 -0
  48. package/chunk-ka5dtn3w.js +3 -0
  49. package/chunk-kxmws6zx.js +4068 -0
  50. package/chunk-m0gk2b1f.js +3 -0
  51. package/chunk-mekgrca0.js +25 -0
  52. package/chunk-mkp20bwr.js +2 -0
  53. package/chunk-n4qxf40m.js +2 -0
  54. package/chunk-n9r9zzr4.js +59 -0
  55. package/chunk-ndca35jt.js +5 -0
  56. package/chunk-ng9vq9hy.js +2 -0
  57. package/chunk-nx1997s8.js +2 -0
  58. package/chunk-p99dt6kf.js +12 -0
  59. package/chunk-pnctvz58.js +3 -0
  60. package/chunk-ppgn9exm.js +2 -0
  61. package/chunk-pqq5znyp.js +2 -0
  62. package/chunk-q2429jd1.js +3 -0
  63. package/chunk-q3nmdtk4.js +3 -0
  64. package/chunk-q4r4nger.js +3 -0
  65. package/chunk-q6gq7g7m.js +4 -0
  66. package/chunk-qnejy3qp.js +2 -0
  67. package/chunk-sj0fqgjf.js +10 -0
  68. package/chunk-t5y3dqv3.js +3 -0
  69. package/chunk-t6vw73nv.js +2 -0
  70. package/chunk-t9zpdekw.js +5 -0
  71. package/chunk-v0xs5sy0.js +2 -0
  72. package/chunk-v8v2exqg.js +2 -0
  73. package/chunk-wgff8n0r.js +2 -0
  74. package/chunk-wpv679r1.js +3 -0
  75. package/chunk-wrw806wb.js +3 -0
  76. package/chunk-wsby70ce.js +12 -0
  77. package/chunk-xdbgpht7.js +2 -0
  78. package/chunk-y1b98tfk.js +5 -0
  79. package/chunk-y3m3w19s.js +3 -0
  80. package/chunk-y5p5jq48.js +63 -0
  81. package/chunk-ynf5sz68.js +10 -0
  82. package/chunk-zfk9az7y.js +5 -0
  83. package/chunk-zwse6b6t.js +18 -0
  84. package/compiled.js +9 -9
  85. package/package.json +1 -1
  86. package/ui-test-worker.js +24 -24
  87. package/web/chunk-016nkjwe.js +2 -0
  88. package/web/chunk-016nkjwe.js.br +0 -0
  89. package/web/chunk-016nkjwe.js.gz +0 -0
  90. package/web/chunk-0er8vdaw.js +2 -0
  91. package/web/chunk-0er8vdaw.js.br +0 -0
  92. package/web/chunk-0er8vdaw.js.gz +0 -0
  93. package/web/chunk-0sq0ed2h.js +12 -0
  94. package/web/chunk-0sq0ed2h.js.br +0 -0
  95. package/web/chunk-0sq0ed2h.js.gz +0 -0
  96. package/web/chunk-0w8swe64.js +2 -0
  97. package/web/chunk-0w8swe64.js.br +0 -0
  98. package/web/chunk-0w8swe64.js.gz +0 -0
  99. package/web/chunk-15pxdcz7.js +1 -0
  100. package/web/chunk-15pxdcz7.js.br +0 -0
  101. package/web/chunk-15pxdcz7.js.gz +0 -0
  102. package/web/chunk-1a1w9rth.js +4 -0
  103. package/web/chunk-1a1w9rth.js.br +0 -0
  104. package/web/chunk-1a1w9rth.js.gz +0 -0
  105. package/web/chunk-1e8tsn4c.js +1 -0
  106. package/web/chunk-1e8tsn4c.js.br +0 -0
  107. package/web/chunk-1e8tsn4c.js.gz +0 -0
  108. package/web/chunk-1jwp193e.js +78 -0
  109. package/web/chunk-1jwp193e.js.br +0 -0
  110. package/web/chunk-1jwp193e.js.gz +0 -0
  111. package/web/chunk-1wz0tepc.js +106 -0
  112. package/web/chunk-1wz0tepc.js.br +0 -0
  113. package/web/chunk-1wz0tepc.js.gz +0 -0
  114. package/web/chunk-213m58wn.js +1 -0
  115. package/web/chunk-213m58wn.js.br +0 -0
  116. package/web/chunk-213m58wn.js.gz +0 -0
  117. package/web/chunk-2hat8cth.js +1 -0
  118. package/web/chunk-2hat8cth.js.br +0 -0
  119. package/web/chunk-2hat8cth.js.gz +0 -0
  120. package/web/chunk-3dj31vfh.js +292 -0
  121. package/web/chunk-3dj31vfh.js.br +0 -0
  122. package/web/chunk-3dj31vfh.js.gz +0 -0
  123. package/web/chunk-3g7waf75.js +70 -0
  124. package/web/chunk-3g7waf75.js.br +0 -0
  125. package/web/chunk-3g7waf75.js.gz +0 -0
  126. package/web/chunk-3x1zg1hk.js +1 -0
  127. package/web/chunk-3x1zg1hk.js.br +0 -0
  128. package/web/chunk-3x1zg1hk.js.gz +0 -0
  129. package/web/chunk-416ts17x.js +2 -0
  130. package/web/chunk-416ts17x.js.br +0 -0
  131. package/web/chunk-416ts17x.js.gz +0 -0
  132. package/web/chunk-47qwqp4f.js +7 -0
  133. package/web/chunk-47qwqp4f.js.br +0 -0
  134. package/web/chunk-47qwqp4f.js.gz +0 -0
  135. package/web/chunk-4k4c2se1.js +2 -0
  136. package/web/chunk-4k4c2se1.js.br +0 -0
  137. package/web/chunk-4k4c2se1.js.gz +0 -0
  138. package/web/chunk-4vsg8d4c.js +4 -0
  139. package/web/chunk-4vsg8d4c.js.br +0 -0
  140. package/web/chunk-4vsg8d4c.js.gz +0 -0
  141. package/web/chunk-53ag9hyw.js +40 -0
  142. package/web/chunk-53ag9hyw.js.br +0 -0
  143. package/web/chunk-53ag9hyw.js.gz +0 -0
  144. package/web/chunk-55phnzd7.js +1 -0
  145. package/web/chunk-55phnzd7.js.br +0 -0
  146. package/web/chunk-55phnzd7.js.gz +0 -0
  147. package/web/chunk-56a6njsk.js +1 -0
  148. package/web/chunk-56a6njsk.js.br +0 -0
  149. package/web/chunk-56a6njsk.js.gz +0 -0
  150. package/web/chunk-5hvs5kyx.js +1 -0
  151. package/web/chunk-5hvs5kyx.js.br +0 -0
  152. package/web/chunk-5hvs5kyx.js.gz +0 -0
  153. package/web/chunk-5nbyvd4t.js +1 -0
  154. package/web/chunk-5nbyvd4t.js.br +0 -0
  155. package/web/chunk-5nbyvd4t.js.gz +0 -0
  156. package/web/chunk-6dr6eazd.js +2 -0
  157. package/web/chunk-6dr6eazd.js.br +0 -0
  158. package/web/chunk-6dr6eazd.js.gz +0 -0
  159. package/web/chunk-6nkegqxk.js +139 -0
  160. package/web/chunk-6nkegqxk.js.br +0 -0
  161. package/web/chunk-6nkegqxk.js.gz +0 -0
  162. package/web/chunk-6ypf5nq6.js +140 -0
  163. package/web/chunk-6ypf5nq6.js.br +0 -0
  164. package/web/chunk-6ypf5nq6.js.gz +0 -0
  165. package/web/chunk-70kws32b.js +2 -0
  166. package/web/chunk-70kws32b.js.br +0 -0
  167. package/web/chunk-70kws32b.js.gz +0 -0
  168. package/web/chunk-71tshjjr.js +16 -0
  169. package/web/chunk-71tshjjr.js.br +0 -0
  170. package/web/chunk-71tshjjr.js.gz +0 -0
  171. package/web/chunk-7fh9k75p.js +1 -0
  172. package/web/chunk-7fh9k75p.js.br +0 -0
  173. package/web/chunk-7fh9k75p.js.gz +0 -0
  174. package/web/chunk-7k8azd8z.js +1 -0
  175. package/web/chunk-7k8azd8z.js.br +0 -0
  176. package/web/chunk-7k8azd8z.js.gz +0 -0
  177. package/web/chunk-7mmebce4.js +1 -0
  178. package/web/chunk-7mmebce4.js.br +0 -0
  179. package/web/chunk-7mmebce4.js.gz +0 -0
  180. package/web/chunk-7mwghj09.js +89 -0
  181. package/web/chunk-7mwghj09.js.br +0 -0
  182. package/web/chunk-7mwghj09.js.gz +0 -0
  183. package/web/chunk-7y5kr56m.js +1 -0
  184. package/web/chunk-7y5kr56m.js.br +0 -0
  185. package/web/chunk-7y5kr56m.js.gz +0 -0
  186. package/web/chunk-8esqhp64.js +1 -0
  187. package/web/chunk-8esqhp64.js.br +0 -0
  188. package/web/chunk-8esqhp64.js.gz +0 -0
  189. package/web/chunk-8gxgpr3n.js +214 -0
  190. package/web/chunk-8gxgpr3n.js.br +0 -0
  191. package/web/chunk-8gxgpr3n.js.gz +0 -0
  192. package/web/chunk-8vnmk3y7.js +1 -0
  193. package/web/chunk-8vnmk3y7.js.br +0 -0
  194. package/web/chunk-8vnmk3y7.js.gz +0 -0
  195. package/web/chunk-99r862t8.js +30 -0
  196. package/web/chunk-99r862t8.js.br +0 -0
  197. package/web/chunk-99r862t8.js.gz +0 -0
  198. package/web/chunk-9cznsyf4.js +7 -0
  199. package/web/chunk-9cznsyf4.js.br +0 -0
  200. package/web/chunk-9cznsyf4.js.gz +0 -0
  201. package/web/chunk-9hmw91e9.js +1 -0
  202. package/web/chunk-9hmw91e9.js.br +0 -0
  203. package/web/chunk-9hmw91e9.js.gz +0 -0
  204. package/web/chunk-9pyad3tv.js +1 -0
  205. package/web/chunk-9pyad3tv.js.br +0 -0
  206. package/web/chunk-9pyad3tv.js.gz +0 -0
  207. package/web/chunk-9rf2smk2.js +1142 -0
  208. package/web/chunk-9rf2smk2.js.br +0 -0
  209. package/web/chunk-9rf2smk2.js.gz +0 -0
  210. package/web/chunk-aaz4msca.js +89 -0
  211. package/web/chunk-aaz4msca.js.br +0 -0
  212. package/web/chunk-aaz4msca.js.gz +0 -0
  213. package/web/chunk-ag0ng2nt.js +24 -0
  214. package/web/chunk-ag0ng2nt.js.br +0 -0
  215. package/web/chunk-ag0ng2nt.js.gz +0 -0
  216. package/web/chunk-an9b0mhe.js +55 -0
  217. package/web/chunk-an9b0mhe.js.br +0 -0
  218. package/web/chunk-an9b0mhe.js.gz +0 -0
  219. package/web/chunk-apgvrfc2.js +41 -0
  220. package/web/chunk-apgvrfc2.js.br +0 -0
  221. package/web/chunk-apgvrfc2.js.gz +0 -0
  222. package/web/chunk-aq09zt1h.js +332 -0
  223. package/web/chunk-aq09zt1h.js.br +0 -0
  224. package/web/chunk-aq09zt1h.js.gz +0 -0
  225. package/web/chunk-ayy6rwm5.js +1 -0
  226. package/web/chunk-ayy6rwm5.js.br +0 -0
  227. package/web/chunk-ayy6rwm5.js.gz +0 -0
  228. package/web/chunk-azhw80d1.js +1 -0
  229. package/web/chunk-azhw80d1.js.br +0 -0
  230. package/web/chunk-azhw80d1.js.gz +0 -0
  231. package/web/chunk-b4bty1ns.js +8 -0
  232. package/web/chunk-b4bty1ns.js.br +1 -0
  233. package/web/chunk-b4bty1ns.js.gz +0 -0
  234. package/web/chunk-bs9934z7.js +200 -0
  235. package/web/chunk-bs9934z7.js.br +0 -0
  236. package/web/chunk-bs9934z7.js.gz +0 -0
  237. package/web/chunk-c9nwfxrp.js +1 -0
  238. package/web/chunk-c9nwfxrp.js.br +0 -0
  239. package/web/chunk-c9nwfxrp.js.gz +0 -0
  240. package/web/chunk-capfyqch.js +1 -0
  241. package/web/chunk-capfyqch.js.br +0 -0
  242. package/web/chunk-capfyqch.js.gz +0 -0
  243. package/web/chunk-ckev38zc.js +36 -0
  244. package/web/chunk-ckev38zc.js.br +0 -0
  245. package/web/chunk-ckev38zc.js.gz +0 -0
  246. package/web/chunk-cnkerjp4.js +370 -0
  247. package/web/chunk-cnkerjp4.js.br +0 -0
  248. package/web/chunk-cnkerjp4.js.gz +0 -0
  249. package/web/chunk-d3bgcz6q.js +1 -0
  250. package/web/chunk-d3bgcz6q.js.br +0 -0
  251. package/web/chunk-d3bgcz6q.js.gz +0 -0
  252. package/web/chunk-d5xqtvb1.js +2 -0
  253. package/web/chunk-d5xqtvb1.js.br +0 -0
  254. package/web/chunk-d5xqtvb1.js.gz +0 -0
  255. package/web/chunk-daqfnvaw.js +1 -0
  256. package/web/chunk-daqfnvaw.js.br +0 -0
  257. package/web/chunk-daqfnvaw.js.gz +0 -0
  258. package/web/chunk-dqz580pg.js +1 -0
  259. package/web/chunk-dqz580pg.js.br +0 -0
  260. package/web/chunk-dqz580pg.js.gz +0 -0
  261. package/web/chunk-e54b48p5.js +2 -0
  262. package/web/chunk-e54b48p5.js.br +0 -0
  263. package/web/chunk-e54b48p5.js.gz +0 -0
  264. package/web/chunk-e8bgrjps.js +2 -0
  265. package/web/chunk-e8bgrjps.js.br +0 -0
  266. package/web/chunk-e8bgrjps.js.gz +0 -0
  267. package/web/chunk-efdg5mjf.js +217 -0
  268. package/web/chunk-efdg5mjf.js.br +0 -0
  269. package/web/chunk-efdg5mjf.js.gz +0 -0
  270. package/web/chunk-efhyygba.js +7 -0
  271. package/web/chunk-efhyygba.js.br +0 -0
  272. package/web/chunk-efhyygba.js.gz +0 -0
  273. package/web/chunk-eq0vm9vw.js +2 -0
  274. package/web/chunk-eq0vm9vw.js.br +0 -0
  275. package/web/chunk-eq0vm9vw.js.gz +0 -0
  276. package/web/chunk-eznkbqms.js +1 -0
  277. package/web/chunk-eznkbqms.js.br +0 -0
  278. package/web/chunk-eznkbqms.js.gz +0 -0
  279. package/web/chunk-f9rv8b13.js +1 -0
  280. package/web/chunk-f9rv8b13.js.br +0 -0
  281. package/web/chunk-f9rv8b13.js.gz +0 -0
  282. package/web/chunk-fnzyprme.js +142 -0
  283. package/web/chunk-fnzyprme.js.br +0 -0
  284. package/web/chunk-fnzyprme.js.gz +0 -0
  285. package/web/chunk-g63m3g5y.js +1 -0
  286. package/web/chunk-g63m3g5y.js.br +2 -0
  287. package/web/chunk-g63m3g5y.js.gz +0 -0
  288. package/web/chunk-g6gb3wz7.js +1 -0
  289. package/web/chunk-g6gb3wz7.js.br +2 -0
  290. package/web/chunk-g6gb3wz7.js.gz +0 -0
  291. package/web/chunk-g7ec62te.js +2 -0
  292. package/web/chunk-g7ec62te.js.br +0 -0
  293. package/web/chunk-g7ec62te.js.gz +0 -0
  294. package/web/chunk-gkj2bbdx.js +1 -0
  295. package/web/chunk-gkj2bbdx.js.br +0 -0
  296. package/web/chunk-gkj2bbdx.js.gz +0 -0
  297. package/web/chunk-gnx30bed.css +1 -0
  298. package/web/chunk-gnx30bed.css.br +0 -0
  299. package/web/chunk-gnx30bed.css.gz +0 -0
  300. package/web/chunk-h391pq6j.js +1 -0
  301. package/web/chunk-h391pq6j.js.br +0 -0
  302. package/web/chunk-h391pq6j.js.gz +0 -0
  303. package/web/chunk-h3kdr5mz.js +21 -0
  304. package/web/chunk-h3kdr5mz.js.br +0 -0
  305. package/web/chunk-h3kdr5mz.js.gz +0 -0
  306. package/web/chunk-hjs5pyye.js +1 -0
  307. package/web/chunk-hjs5pyye.js.br +0 -0
  308. package/web/chunk-hjs5pyye.js.gz +0 -0
  309. package/web/chunk-hxgtek0e.js +2 -0
  310. package/web/chunk-hxgtek0e.js.br +0 -0
  311. package/web/chunk-hxgtek0e.js.gz +0 -0
  312. package/web/chunk-j5a3jhp0.js +120 -0
  313. package/web/chunk-j5a3jhp0.js.br +0 -0
  314. package/web/chunk-j5a3jhp0.js.gz +0 -0
  315. package/web/chunk-jgdways6.js +39 -0
  316. package/web/chunk-jgdways6.js.br +0 -0
  317. package/web/chunk-jgdways6.js.gz +0 -0
  318. package/web/chunk-jybmjakj.js +1 -0
  319. package/web/chunk-jybmjakj.js.br +2 -0
  320. package/web/chunk-jybmjakj.js.gz +0 -0
  321. package/web/chunk-kasv56qe.js +303 -0
  322. package/web/chunk-kasv56qe.js.br +0 -0
  323. package/web/chunk-kasv56qe.js.gz +0 -0
  324. package/web/chunk-kmhbkjqx.js +2 -0
  325. package/web/chunk-kmhbkjqx.js.br +0 -0
  326. package/web/chunk-kmhbkjqx.js.gz +0 -0
  327. package/web/chunk-m06zdhdz.js +1 -0
  328. package/web/chunk-m06zdhdz.js.br +0 -0
  329. package/web/chunk-m06zdhdz.js.gz +0 -0
  330. package/web/chunk-mrnnq8dv.js +1 -0
  331. package/web/chunk-mrnnq8dv.js.br +0 -0
  332. package/web/chunk-mrnnq8dv.js.gz +0 -0
  333. package/web/chunk-mx1e3jgh.js +1 -0
  334. package/web/chunk-mx1e3jgh.js.br +0 -0
  335. package/web/chunk-mx1e3jgh.js.gz +0 -0
  336. package/web/chunk-n0tehchs.js +3 -0
  337. package/web/chunk-n0tehchs.js.br +0 -0
  338. package/web/chunk-n0tehchs.js.gz +0 -0
  339. package/web/chunk-n449ebhn.js +38 -0
  340. package/web/chunk-n449ebhn.js.br +0 -0
  341. package/web/chunk-n449ebhn.js.gz +0 -0
  342. package/web/chunk-ngy730n0.js +1 -0
  343. package/web/chunk-ngy730n0.js.br +0 -0
  344. package/web/chunk-ngy730n0.js.gz +0 -0
  345. package/web/chunk-nj9dtqyd.js +2 -0
  346. package/web/chunk-nj9dtqyd.js.br +0 -0
  347. package/web/chunk-nj9dtqyd.js.gz +0 -0
  348. package/web/chunk-nzaq0yae.js +2 -0
  349. package/web/chunk-nzaq0yae.js.br +0 -0
  350. package/web/chunk-nzaq0yae.js.gz +0 -0
  351. package/web/chunk-pgnfj8ea.js +2 -0
  352. package/web/chunk-pgnfj8ea.js.br +0 -0
  353. package/web/chunk-pgnfj8ea.js.gz +0 -0
  354. package/web/chunk-qtgen5c5.js +24 -0
  355. package/web/chunk-qtgen5c5.js.br +0 -0
  356. package/web/chunk-qtgen5c5.js.gz +0 -0
  357. package/web/chunk-qzn05afn.js +169 -0
  358. package/web/chunk-qzn05afn.js.br +0 -0
  359. package/web/chunk-qzn05afn.js.gz +0 -0
  360. package/web/chunk-sgy3c5m7.js +62 -0
  361. package/web/chunk-sgy3c5m7.js.br +0 -0
  362. package/web/chunk-sgy3c5m7.js.gz +0 -0
  363. package/web/chunk-t7s9xrxt.js +34 -0
  364. package/web/chunk-t7s9xrxt.js.br +0 -0
  365. package/web/chunk-t7s9xrxt.js.gz +0 -0
  366. package/web/chunk-tmf1jnqz.js +2 -0
  367. package/web/chunk-tmf1jnqz.js.br +0 -0
  368. package/web/chunk-tmf1jnqz.js.gz +0 -0
  369. package/web/chunk-v95eqx92.js +84 -0
  370. package/web/chunk-v95eqx92.js.br +0 -0
  371. package/web/chunk-v95eqx92.js.gz +0 -0
  372. package/web/chunk-vcj5m1xb.js +1 -0
  373. package/web/chunk-vcj5m1xb.js.br +0 -0
  374. package/web/chunk-vcj5m1xb.js.gz +0 -0
  375. package/web/chunk-vq0zf16h.js +1 -0
  376. package/web/chunk-vq0zf16h.js.br +0 -0
  377. package/web/chunk-vq0zf16h.js.gz +0 -0
  378. package/web/chunk-vqhtph6r.js +1 -0
  379. package/web/chunk-vqhtph6r.js.br +0 -0
  380. package/web/chunk-vqhtph6r.js.gz +0 -0
  381. package/web/chunk-vz2mgxs7.js +1 -0
  382. package/web/chunk-vz2mgxs7.js.br +0 -0
  383. package/web/chunk-vz2mgxs7.js.gz +0 -0
  384. package/web/chunk-wry3q68j.js +1 -0
  385. package/web/chunk-wry3q68j.js.br +2 -0
  386. package/web/chunk-wry3q68j.js.gz +0 -0
  387. package/web/chunk-wrz0gqnv.js +1 -0
  388. package/web/chunk-wrz0gqnv.js.br +0 -0
  389. package/web/chunk-wrz0gqnv.js.gz +0 -0
  390. package/web/chunk-wvapb3r6.js +98 -0
  391. package/web/chunk-wvapb3r6.js.br +0 -0
  392. package/web/chunk-wvapb3r6.js.gz +0 -0
  393. package/web/chunk-x6qva9zc.js +324 -0
  394. package/web/chunk-x6qva9zc.js.br +0 -0
  395. package/web/chunk-x6qva9zc.js.gz +0 -0
  396. package/web/chunk-xa2ngtyg.js +2 -0
  397. package/web/chunk-xa2ngtyg.js.br +0 -0
  398. package/web/chunk-xa2ngtyg.js.gz +0 -0
  399. package/web/chunk-xhjf5ye0.js +1 -0
  400. package/web/chunk-xhjf5ye0.js.br +0 -0
  401. package/web/chunk-xhjf5ye0.js.gz +0 -0
  402. package/web/chunk-xkqekh81.js +2 -0
  403. package/web/chunk-xkqekh81.js.br +0 -0
  404. package/web/chunk-xkqekh81.js.gz +0 -0
  405. package/web/chunk-xsjvamcy.js +1 -0
  406. package/web/chunk-xsjvamcy.js.br +0 -0
  407. package/web/chunk-xsjvamcy.js.gz +0 -0
  408. package/web/chunk-xyfnr395.js +1 -0
  409. package/web/chunk-xyfnr395.js.br +0 -0
  410. package/web/chunk-xyfnr395.js.gz +0 -0
  411. package/web/chunk-y4x1g94q.js +1 -0
  412. package/web/chunk-y4x1g94q.js.br +0 -0
  413. package/web/chunk-y4x1g94q.js.gz +0 -0
  414. package/web/chunk-yzbp4vpe.js +1 -0
  415. package/web/chunk-yzbp4vpe.js.br +0 -0
  416. package/web/chunk-yzbp4vpe.js.gz +0 -0
  417. package/web/chunk-z601k790.js +291 -0
  418. package/web/chunk-z601k790.js.br +0 -0
  419. package/web/chunk-z601k790.js.gz +0 -0
  420. package/web/chunk-zc9mxd01.js +99 -0
  421. package/web/chunk-zc9mxd01.js.br +0 -0
  422. package/web/chunk-zc9mxd01.js.gz +0 -0
  423. package/web/chunk-zm1jfkcz.js +2 -0
  424. package/web/chunk-zm1jfkcz.js.br +0 -0
  425. package/web/chunk-zm1jfkcz.js.gz +0 -0
  426. package/web/chunk-zz0d7377.js +2 -0
  427. package/web/chunk-zz0d7377.js.br +0 -0
  428. package/web/chunk-zz0d7377.js.gz +0 -0
  429. package/web/index.html +1 -1
  430. package/web/index.html.br +0 -0
  431. package/web/index.html.gz +0 -0
  432. package/worker.js +1 -1
  433. package/chunk-04326385.js +0 -39
  434. package/chunk-11zc1b2w.js +0 -3
  435. package/chunk-12203fgm.js +0 -2
  436. package/chunk-194d4z7x.js +0 -7
  437. package/chunk-1apm7p2e.js +0 -2
  438. package/chunk-2csz31nh.js +0 -2
  439. package/chunk-2rqpfv4h.js +0 -3
  440. package/chunk-39cfcar4.js +0 -3
  441. package/chunk-3j26jsy0.js +0 -51
  442. package/chunk-4a5xttdp.js +0 -3
  443. package/chunk-4st5xeee.js +0 -2
  444. package/chunk-5ggyf53b.js +0 -50
  445. package/chunk-5h17n6g1.js +0 -3
  446. package/chunk-5rn18vrq.js +0 -5
  447. package/chunk-5tdnvdmz.js +0 -2
  448. package/chunk-6qavr39k.js +0 -2
  449. package/chunk-6xn0r0dd.js +0 -3
  450. package/chunk-7h76jrss.js +0 -7
  451. package/chunk-7hss4hs3.js +0 -7
  452. package/chunk-7vdq0wye.js +0 -2
  453. package/chunk-7w187ycz.js +0 -10
  454. package/chunk-81s7mvf2.js +0 -16
  455. package/chunk-8j8acxde.js +0 -2
  456. package/chunk-9nfz04yr.js +0 -2
  457. package/chunk-9vth0w8q.js +0 -2
  458. package/chunk-9zcfam20.js +0 -2
  459. package/chunk-a6zvmsbh.js +0 -12
  460. package/chunk-anr8aghq.js +0 -59
  461. package/chunk-av8zh9yp.js +0 -2
  462. package/chunk-bwv97dtf.js +0 -2
  463. package/chunk-cjy4rssa.js +0 -10
  464. package/chunk-dmdyqq1k.js +0 -2
  465. package/chunk-dzvq7vt6.js +0 -2
  466. package/chunk-ejrksf6g.js +0 -3
  467. package/chunk-erxka5vh.js +0 -18
  468. package/chunk-fb2ydc2s.js +0 -8
  469. package/chunk-fc41dvhp.js +0 -12
  470. package/chunk-fdgrayj5.js +0 -3
  471. package/chunk-fwcqcecb.js +0 -8
  472. package/chunk-hhwnmhbb.js +0 -2
  473. package/chunk-hvxc1wyv.js +0 -3
  474. package/chunk-jm2bn5mq.js +0 -3
  475. package/chunk-jm5j5jfy.js +0 -3
  476. package/chunk-jqtdf0ym.js +0 -63
  477. package/chunk-jsvr3s4q.js +0 -5
  478. package/chunk-jwk5a5tk.js +0 -25
  479. package/chunk-mwc59w50.js +0 -31
  480. package/chunk-mypbpphn.js +0 -3
  481. package/chunk-n3hfhbe4.js +0 -498
  482. package/chunk-ng5ncy65.js +0 -2
  483. package/chunk-nkmvqcge.js +0 -4073
  484. package/chunk-nmvayfq3.js +0 -3
  485. package/chunk-nw4h0wm9.js +0 -2
  486. package/chunk-p23eqet9.js +0 -2
  487. package/chunk-pxsgm6ff.js +0 -2
  488. package/chunk-qqs9fqsy.js +0 -4
  489. package/chunk-r0gsb1qs.js +0 -3
  490. package/chunk-r49sxmnc.js +0 -3
  491. package/chunk-rbfpa63e.js +0 -3
  492. package/chunk-rsrh5dgx.js +0 -2
  493. package/chunk-s2pm97nk.js +0 -286
  494. package/chunk-s6tnmg6x.js +0 -3
  495. package/chunk-se548edt.js +0 -20
  496. package/chunk-tsdeeqb8.js +0 -3
  497. package/chunk-vnv3a6t2.js +0 -3
  498. package/chunk-vrsh8cx1.js +0 -3
  499. package/chunk-w3v8zahw.js +0 -2
  500. package/chunk-w6m8c4vf.js +0 -11
  501. package/chunk-wd7sj5cv.js +0 -2
  502. package/chunk-we8v9wkw.js +0 -9
  503. package/chunk-x055cas0.js +0 -5
  504. package/chunk-x5vrtxkj.js +0 -3
  505. package/chunk-x83syrhw.js +0 -44
  506. package/chunk-xedzsj31.js +0 -5
  507. package/chunk-xp83v3zm.js +0 -2
  508. package/chunk-ykzm5g1b.js +0 -25
  509. package/chunk-yq2bwebb.js +0 -3
  510. package/chunk-yygcpnwc.js +0 -3
  511. package/chunk-zjf34acb.js +0 -2
  512. package/web/chunk-07kt1zpn.js +0 -1
  513. package/web/chunk-07kt1zpn.js.br +0 -0
  514. package/web/chunk-07kt1zpn.js.gz +0 -0
  515. package/web/chunk-0d068bmj.js +0 -1
  516. package/web/chunk-0d068bmj.js.br +0 -0
  517. package/web/chunk-0d068bmj.js.gz +0 -0
  518. package/web/chunk-0m15ghn0.js +0 -2
  519. package/web/chunk-0m15ghn0.js.br +0 -0
  520. package/web/chunk-0m15ghn0.js.gz +0 -0
  521. package/web/chunk-0swykhgr.js +0 -2
  522. package/web/chunk-0swykhgr.js.br +0 -0
  523. package/web/chunk-0swykhgr.js.gz +0 -0
  524. package/web/chunk-100a4th6.js +0 -4
  525. package/web/chunk-100a4th6.js.br +0 -0
  526. package/web/chunk-100a4th6.js.gz +0 -0
  527. package/web/chunk-1mdvm20t.js +0 -140
  528. package/web/chunk-1mdvm20t.js.br +0 -0
  529. package/web/chunk-1mdvm20t.js.gz +0 -0
  530. package/web/chunk-1mkzfr1m.js +0 -2
  531. package/web/chunk-1mkzfr1m.js.br +0 -0
  532. package/web/chunk-1mkzfr1m.js.gz +0 -0
  533. package/web/chunk-1p7wa1rq.js +0 -1
  534. package/web/chunk-1p7wa1rq.js.br +0 -0
  535. package/web/chunk-1p7wa1rq.js.gz +0 -0
  536. package/web/chunk-2grspw9t.js +0 -1
  537. package/web/chunk-2grspw9t.js.br +0 -0
  538. package/web/chunk-2grspw9t.js.gz +0 -0
  539. package/web/chunk-2zz8t49r.js +0 -1
  540. package/web/chunk-2zz8t49r.js.br +0 -0
  541. package/web/chunk-2zz8t49r.js.gz +0 -0
  542. package/web/chunk-34g2xrgq.js +0 -120
  543. package/web/chunk-34g2xrgq.js.br +0 -0
  544. package/web/chunk-34g2xrgq.js.gz +0 -0
  545. package/web/chunk-34q3az4b.js +0 -1
  546. package/web/chunk-34q3az4b.js.br +0 -0
  547. package/web/chunk-34q3az4b.js.gz +0 -0
  548. package/web/chunk-39jqdq4r.js +0 -1
  549. package/web/chunk-39jqdq4r.js.br +0 -0
  550. package/web/chunk-39jqdq4r.js.gz +0 -0
  551. package/web/chunk-3d2fm4qc.js +0 -1
  552. package/web/chunk-3d2fm4qc.js.br +0 -0
  553. package/web/chunk-3d2fm4qc.js.gz +0 -0
  554. package/web/chunk-3s16fbrf.js +0 -40
  555. package/web/chunk-3s16fbrf.js.br +0 -0
  556. package/web/chunk-3s16fbrf.js.gz +0 -0
  557. package/web/chunk-3vsey6mw.js +0 -1
  558. package/web/chunk-3vsey6mw.js.br +0 -0
  559. package/web/chunk-3vsey6mw.js.gz +0 -0
  560. package/web/chunk-3y29sc9c.js +0 -7
  561. package/web/chunk-3y29sc9c.js.br +0 -0
  562. package/web/chunk-3y29sc9c.js.gz +0 -0
  563. package/web/chunk-40f59ze9.js +0 -39
  564. package/web/chunk-40f59ze9.js.br +0 -0
  565. package/web/chunk-40f59ze9.js.gz +0 -0
  566. package/web/chunk-495sjpc6.js +0 -2
  567. package/web/chunk-495sjpc6.js.br +0 -0
  568. package/web/chunk-495sjpc6.js.gz +0 -0
  569. package/web/chunk-4ab1dv3g.js +0 -142
  570. package/web/chunk-4ab1dv3g.js.br +0 -0
  571. package/web/chunk-4ab1dv3g.js.gz +0 -0
  572. package/web/chunk-58xhn7ry.js +0 -2
  573. package/web/chunk-58xhn7ry.js.br +0 -0
  574. package/web/chunk-58xhn7ry.js.gz +0 -0
  575. package/web/chunk-67pa4950.js +0 -1
  576. package/web/chunk-67pa4950.js.br +0 -0
  577. package/web/chunk-67pa4950.js.gz +0 -0
  578. package/web/chunk-6ana63fs.js +0 -21
  579. package/web/chunk-6ana63fs.js.br +0 -0
  580. package/web/chunk-6ana63fs.js.gz +0 -0
  581. package/web/chunk-6ew54553.js +0 -2
  582. package/web/chunk-6ew54553.js.br +0 -0
  583. package/web/chunk-6ew54553.js.gz +0 -0
  584. package/web/chunk-6f1q0tjv.js +0 -1142
  585. package/web/chunk-6f1q0tjv.js.br +0 -0
  586. package/web/chunk-6f1q0tjv.js.gz +0 -0
  587. package/web/chunk-6gpzz5wm.js +0 -1
  588. package/web/chunk-6gpzz5wm.js.br +0 -0
  589. package/web/chunk-6gpzz5wm.js.gz +0 -0
  590. package/web/chunk-71g6vrx9.js +0 -62
  591. package/web/chunk-71g6vrx9.js.br +0 -0
  592. package/web/chunk-71g6vrx9.js.gz +0 -0
  593. package/web/chunk-77dnqrb6.js +0 -2
  594. package/web/chunk-77dnqrb6.js.br +0 -0
  595. package/web/chunk-77dnqrb6.js.gz +0 -0
  596. package/web/chunk-7fdrwy21.js +0 -1
  597. package/web/chunk-7fdrwy21.js.br +0 -0
  598. package/web/chunk-7fdrwy21.js.gz +0 -0
  599. package/web/chunk-84s7821x.js +0 -2
  600. package/web/chunk-84s7821x.js.br +0 -0
  601. package/web/chunk-84s7821x.js.gz +0 -0
  602. package/web/chunk-8e5qd73v.js +0 -7
  603. package/web/chunk-8e5qd73v.js.br +0 -0
  604. package/web/chunk-8e5qd73v.js.gz +0 -0
  605. package/web/chunk-8kyj945c.js +0 -2
  606. package/web/chunk-8kyj945c.js.br +0 -0
  607. package/web/chunk-8kyj945c.js.gz +0 -0
  608. package/web/chunk-9b0evht1.js +0 -292
  609. package/web/chunk-9b0evht1.js.br +0 -0
  610. package/web/chunk-9b0evht1.js.gz +0 -0
  611. package/web/chunk-9jb5xwya.js +0 -36
  612. package/web/chunk-9jb5xwya.js.br +0 -0
  613. package/web/chunk-9jb5xwya.js.gz +0 -0
  614. package/web/chunk-9kf8arqg.js +0 -1
  615. package/web/chunk-9kf8arqg.js.br +0 -0
  616. package/web/chunk-9kf8arqg.js.gz +0 -0
  617. package/web/chunk-9msmea44.js +0 -70
  618. package/web/chunk-9msmea44.js.br +0 -0
  619. package/web/chunk-9msmea44.js.gz +0 -0
  620. package/web/chunk-a7q85665.js +0 -3
  621. package/web/chunk-a7q85665.js.br +0 -0
  622. package/web/chunk-a7q85665.js.gz +0 -0
  623. package/web/chunk-b9cjgxr1.js +0 -98
  624. package/web/chunk-b9cjgxr1.js.br +0 -0
  625. package/web/chunk-b9cjgxr1.js.gz +0 -0
  626. package/web/chunk-baaattjv.js +0 -2
  627. package/web/chunk-baaattjv.js.br +0 -0
  628. package/web/chunk-baaattjv.js.gz +0 -0
  629. package/web/chunk-bj9m08f9.js +0 -1
  630. package/web/chunk-bj9m08f9.js.br +0 -0
  631. package/web/chunk-bj9m08f9.js.gz +0 -0
  632. package/web/chunk-bm4fvq6q.js +0 -89
  633. package/web/chunk-bm4fvq6q.js.br +0 -0
  634. package/web/chunk-bm4fvq6q.js.gz +0 -0
  635. package/web/chunk-c4g2k9wp.js +0 -1
  636. package/web/chunk-c4g2k9wp.js.br +0 -0
  637. package/web/chunk-c4g2k9wp.js.gz +0 -0
  638. package/web/chunk-cnptxet3.js +0 -2
  639. package/web/chunk-cnptxet3.js.br +0 -0
  640. package/web/chunk-cnptxet3.js.gz +0 -0
  641. package/web/chunk-db2jge7w.js +0 -291
  642. package/web/chunk-db2jge7w.js.br +0 -0
  643. package/web/chunk-db2jge7w.js.gz +0 -0
  644. package/web/chunk-dfv95z6w.js +0 -1
  645. package/web/chunk-dfv95z6w.js.br +0 -0
  646. package/web/chunk-dfv95z6w.js.gz +0 -0
  647. package/web/chunk-dsxjv5an.js +0 -1
  648. package/web/chunk-dsxjv5an.js.br +0 -0
  649. package/web/chunk-dsxjv5an.js.gz +0 -0
  650. package/web/chunk-e362x35y.js +0 -1
  651. package/web/chunk-e362x35y.js.br +0 -0
  652. package/web/chunk-e362x35y.js.gz +0 -0
  653. package/web/chunk-e6jfnajp.js +0 -55
  654. package/web/chunk-e6jfnajp.js.br +0 -0
  655. package/web/chunk-e6jfnajp.js.gz +0 -0
  656. package/web/chunk-ex34kdxk.js +0 -217
  657. package/web/chunk-ex34kdxk.js.br +0 -0
  658. package/web/chunk-ex34kdxk.js.gz +0 -0
  659. package/web/chunk-exa2z1b4.js +0 -1
  660. package/web/chunk-exa2z1b4.js.br +0 -0
  661. package/web/chunk-exa2z1b4.js.gz +0 -0
  662. package/web/chunk-fjvd2dx2.js +0 -2
  663. package/web/chunk-fjvd2dx2.js.br +0 -0
  664. package/web/chunk-fjvd2dx2.js.gz +0 -0
  665. package/web/chunk-fs39pqet.js +0 -2
  666. package/web/chunk-fs39pqet.js.br +0 -0
  667. package/web/chunk-fs39pqet.js.gz +0 -0
  668. package/web/chunk-h3618s7t.js +0 -4
  669. package/web/chunk-h3618s7t.js.br +0 -0
  670. package/web/chunk-h3618s7t.js.gz +0 -0
  671. package/web/chunk-hks91ztk.js +0 -8
  672. package/web/chunk-hks91ztk.js.br +0 -0
  673. package/web/chunk-hks91ztk.js.gz +0 -0
  674. package/web/chunk-hqd97ez8.js +0 -200
  675. package/web/chunk-hqd97ez8.js.br +0 -0
  676. package/web/chunk-hqd97ez8.js.gz +0 -0
  677. package/web/chunk-hta68vm8.js +0 -2
  678. package/web/chunk-hta68vm8.js.br +0 -0
  679. package/web/chunk-hta68vm8.js.gz +0 -0
  680. package/web/chunk-jcbvhp3h.js +0 -1
  681. package/web/chunk-jcbvhp3h.js.br +0 -0
  682. package/web/chunk-jcbvhp3h.js.gz +0 -0
  683. package/web/chunk-jw6e38cy.js +0 -1
  684. package/web/chunk-jw6e38cy.js.br +0 -0
  685. package/web/chunk-jw6e38cy.js.gz +0 -0
  686. package/web/chunk-jzp1qd92.js +0 -1
  687. package/web/chunk-jzp1qd92.js.br +0 -0
  688. package/web/chunk-jzp1qd92.js.gz +0 -0
  689. package/web/chunk-kg39a24q.js +0 -16
  690. package/web/chunk-kg39a24q.js.br +0 -0
  691. package/web/chunk-kg39a24q.js.gz +0 -0
  692. package/web/chunk-kj75rme3.js +0 -1
  693. package/web/chunk-kj75rme3.js.br +0 -0
  694. package/web/chunk-kj75rme3.js.gz +0 -0
  695. package/web/chunk-kvxmwmen.js +0 -1
  696. package/web/chunk-kvxmwmen.js.br +0 -0
  697. package/web/chunk-kvxmwmen.js.gz +0 -0
  698. package/web/chunk-kzdmsaet.js +0 -1
  699. package/web/chunk-kzdmsaet.js.br +0 -0
  700. package/web/chunk-kzdmsaet.js.gz +0 -0
  701. package/web/chunk-m203pzza.js +0 -89
  702. package/web/chunk-m203pzza.js.br +0 -0
  703. package/web/chunk-m203pzza.js.gz +0 -0
  704. package/web/chunk-m3xw41vq.js +0 -1
  705. package/web/chunk-m3xw41vq.js.br +0 -0
  706. package/web/chunk-m3xw41vq.js.gz +0 -0
  707. package/web/chunk-m8jcx13t.js +0 -30
  708. package/web/chunk-m8jcx13t.js.br +0 -0
  709. package/web/chunk-m8jcx13t.js.gz +0 -0
  710. package/web/chunk-mpgz1bj6.js +0 -1
  711. package/web/chunk-mpgz1bj6.js.br +0 -0
  712. package/web/chunk-mpgz1bj6.js.gz +0 -0
  713. package/web/chunk-mzagmpq5.js +0 -1
  714. package/web/chunk-mzagmpq5.js.br +0 -0
  715. package/web/chunk-mzagmpq5.js.gz +0 -0
  716. package/web/chunk-n51q6d6e.js +0 -1
  717. package/web/chunk-n51q6d6e.js.br +0 -0
  718. package/web/chunk-n51q6d6e.js.gz +0 -0
  719. package/web/chunk-nbf2zaaj.js +0 -1
  720. package/web/chunk-nbf2zaaj.js.br +0 -0
  721. package/web/chunk-nbf2zaaj.js.gz +0 -0
  722. package/web/chunk-nxd7dn08.js +0 -1
  723. package/web/chunk-nxd7dn08.js.br +0 -0
  724. package/web/chunk-nxd7dn08.js.gz +0 -0
  725. package/web/chunk-p44ezwgh.js +0 -1
  726. package/web/chunk-p44ezwgh.js.br +0 -0
  727. package/web/chunk-p44ezwgh.js.gz +0 -0
  728. package/web/chunk-pdg3bxc0.js +0 -2
  729. package/web/chunk-pdg3bxc0.js.br +0 -0
  730. package/web/chunk-pdg3bxc0.js.gz +0 -0
  731. package/web/chunk-pjbp0xwn.css +0 -1
  732. package/web/chunk-pjbp0xwn.css.br +0 -0
  733. package/web/chunk-pjbp0xwn.css.gz +0 -0
  734. package/web/chunk-pkbyh261.js +0 -1
  735. package/web/chunk-pkbyh261.js.br +0 -0
  736. package/web/chunk-pkbyh261.js.gz +0 -0
  737. package/web/chunk-q3q25jr9.js +0 -324
  738. package/web/chunk-q3q25jr9.js.br +0 -0
  739. package/web/chunk-q3q25jr9.js.gz +0 -0
  740. package/web/chunk-q5nr5wjn.js +0 -169
  741. package/web/chunk-q5nr5wjn.js.br +0 -0
  742. package/web/chunk-q5nr5wjn.js.gz +0 -0
  743. package/web/chunk-qd9y8r3g.js +0 -84
  744. package/web/chunk-qd9y8r3g.js.br +0 -0
  745. package/web/chunk-qd9y8r3g.js.gz +0 -0
  746. package/web/chunk-qm039dan.js +0 -24
  747. package/web/chunk-qm039dan.js.br +0 -0
  748. package/web/chunk-qm039dan.js.gz +0 -0
  749. package/web/chunk-qqp31fyy.js +0 -1
  750. package/web/chunk-qqp31fyy.js.br +0 -0
  751. package/web/chunk-qqp31fyy.js.gz +0 -0
  752. package/web/chunk-rc3sv7v4.js +0 -1
  753. package/web/chunk-rc3sv7v4.js.br +0 -0
  754. package/web/chunk-rc3sv7v4.js.gz +0 -0
  755. package/web/chunk-rtk95qme.js +0 -1
  756. package/web/chunk-rtk95qme.js.br +0 -0
  757. package/web/chunk-rtk95qme.js.gz +0 -0
  758. package/web/chunk-s4rfkyqn.js +0 -12
  759. package/web/chunk-s4rfkyqn.js.br +0 -0
  760. package/web/chunk-s4rfkyqn.js.gz +0 -0
  761. package/web/chunk-s6a0gfv3.js +0 -34
  762. package/web/chunk-s6a0gfv3.js.br +0 -0
  763. package/web/chunk-s6a0gfv3.js.gz +0 -0
  764. package/web/chunk-s7rwbxr5.js +0 -2
  765. package/web/chunk-s7rwbxr5.js.br +0 -0
  766. package/web/chunk-s7rwbxr5.js.gz +0 -0
  767. package/web/chunk-s8f6v2nn.js +0 -1
  768. package/web/chunk-s8f6v2nn.js.br +0 -0
  769. package/web/chunk-s8f6v2nn.js.gz +0 -0
  770. package/web/chunk-sawc81kc.js +0 -303
  771. package/web/chunk-sawc81kc.js.br +0 -0
  772. package/web/chunk-sawc81kc.js.gz +0 -0
  773. package/web/chunk-sex2gevj.js +0 -2
  774. package/web/chunk-sex2gevj.js.br +0 -0
  775. package/web/chunk-sex2gevj.js.gz +0 -0
  776. package/web/chunk-smmdqmcy.js +0 -1
  777. package/web/chunk-smmdqmcy.js.br +0 -0
  778. package/web/chunk-smmdqmcy.js.gz +0 -0
  779. package/web/chunk-txhvq81f.js +0 -106
  780. package/web/chunk-txhvq81f.js.br +0 -0
  781. package/web/chunk-txhvq81f.js.gz +0 -0
  782. package/web/chunk-txtm71rz.js +0 -41
  783. package/web/chunk-txtm71rz.js.br +0 -0
  784. package/web/chunk-txtm71rz.js.gz +0 -0
  785. package/web/chunk-tykcqm6v.js +0 -2
  786. package/web/chunk-tykcqm6v.js.br +0 -0
  787. package/web/chunk-tykcqm6v.js.gz +0 -0
  788. package/web/chunk-tyrmd7j6.js +0 -1
  789. package/web/chunk-tyrmd7j6.js.br +0 -0
  790. package/web/chunk-tyrmd7j6.js.gz +0 -0
  791. package/web/chunk-v6ebn3sf.js +0 -38
  792. package/web/chunk-v6ebn3sf.js.br +0 -0
  793. package/web/chunk-v6ebn3sf.js.gz +0 -0
  794. package/web/chunk-vbx7t0h5.js +0 -214
  795. package/web/chunk-vbx7t0h5.js.br +0 -0
  796. package/web/chunk-vbx7t0h5.js.gz +0 -0
  797. package/web/chunk-vj3wz0a2.js +0 -1
  798. package/web/chunk-vj3wz0a2.js.br +0 -0
  799. package/web/chunk-vj3wz0a2.js.gz +0 -0
  800. package/web/chunk-vqgkd7q8.js +0 -1
  801. package/web/chunk-vqgkd7q8.js.br +0 -0
  802. package/web/chunk-vqgkd7q8.js.gz +0 -0
  803. package/web/chunk-w0k63gap.js +0 -2
  804. package/web/chunk-w0k63gap.js.br +0 -0
  805. package/web/chunk-w0k63gap.js.gz +0 -0
  806. package/web/chunk-wafwgky9.js +0 -1
  807. package/web/chunk-wafwgky9.js.br +0 -0
  808. package/web/chunk-wafwgky9.js.gz +0 -0
  809. package/web/chunk-wk89vrvf.js +0 -78
  810. package/web/chunk-wk89vrvf.js.br +0 -0
  811. package/web/chunk-wk89vrvf.js.gz +0 -0
  812. package/web/chunk-wqjn3yz1.js +0 -370
  813. package/web/chunk-wqjn3yz1.js.br +0 -0
  814. package/web/chunk-wqjn3yz1.js.gz +0 -0
  815. package/web/chunk-wrej9qt0.js +0 -2
  816. package/web/chunk-wrej9qt0.js.br +0 -0
  817. package/web/chunk-wrej9qt0.js.gz +0 -0
  818. package/web/chunk-xbjv549c.js +0 -2
  819. package/web/chunk-xbjv549c.js.br +0 -0
  820. package/web/chunk-xbjv549c.js.gz +0 -0
  821. package/web/chunk-xmp1ag6z.js +0 -2
  822. package/web/chunk-xmp1ag6z.js.br +0 -0
  823. package/web/chunk-xmp1ag6z.js.gz +0 -0
  824. package/web/chunk-xsqd38a2.js +0 -332
  825. package/web/chunk-xsqd38a2.js.br +0 -0
  826. package/web/chunk-xsqd38a2.js.gz +0 -0
  827. package/web/chunk-y2fbz356.js +0 -1
  828. package/web/chunk-y2fbz356.js.br +0 -0
  829. package/web/chunk-y2fbz356.js.gz +0 -0
  830. package/web/chunk-yebmbyrj.js +0 -1
  831. package/web/chunk-yebmbyrj.js.br +0 -2
  832. package/web/chunk-yebmbyrj.js.gz +0 -0
  833. package/web/chunk-ypytxmn6.js +0 -24
  834. package/web/chunk-ypytxmn6.js.br +0 -0
  835. package/web/chunk-ypytxmn6.js.gz +0 -0
  836. package/web/chunk-z6jy8edk.js +0 -99
  837. package/web/chunk-z6jy8edk.js.br +0 -0
  838. package/web/chunk-z6jy8edk.js.gz +0 -0
  839. package/web/chunk-zg5n1hx4.js +0 -1
  840. package/web/chunk-zg5n1hx4.js.br +0 -0
  841. package/web/chunk-zg5n1hx4.js.gz +0 -0
  842. package/web/chunk-zmrd0bnc.js +0 -139
  843. package/web/chunk-zmrd0bnc.js.br +0 -0
  844. package/web/chunk-zmrd0bnc.js.gz +0 -0
  845. package/web/chunk-zqm6n89p.js +0 -7
  846. package/web/chunk-zqm6n89p.js.br +0 -0
  847. package/web/chunk-zqm6n89p.js.gz +0 -0
  848. package/web/chunk-zvat895r.js +0 -1
  849. package/web/chunk-zvat895r.js.br +0 -0
  850. package/web/chunk-zvat895r.js.gz +0 -0
  851. package/web/chunk-zxt17pcp.js +0 -1
  852. package/web/chunk-zxt17pcp.js.br +0 -0
  853. package/web/chunk-zxt17pcp.js.gz +0 -0
@@ -0,0 +1,25 @@
1
+ // @bun
2
+ import{E}from"./chunk-wpv679r1.js";import{io,V}from"./chunk-y1b98tfk.js";import{o,e,ht,dr,p,le,Be,Gt,Uo,os,Fo,Bo,$o,jo,Wo,Ho,zo,qo,na,De,is,Ln,ss,as,Go,Vo,Vt,N,oa,mr,Kt,Dn,Ko,D,ia,Et,Se,hr,Qo,sa,Yo,I,Nn,fr}from"./chunk-2cd3qzny.js";import{Qt,Yt}from"./chunk-hab25nd9.js";import{ce}from"./chunk-54zpktrq.js";import{ge}from"./chunk-2h2mvrw2.js";import{Ae,xe,Hr,te,jn,Te}from"./chunk-gz5ssvjh.js";import{v}from"./chunk-fsekbhqb.js";import{J}from"./chunk-9nkb5q43.js";import{G,Ke,ve,me,ue,ne}from"./chunk-wsby70ce.js";import{W,He}from"./chunk-e1rfd7jn.js";import{a,r}from"./chunk-37n62c4c.js";var ya=r(function(he){var tl=he&&he.__extends||function(){var s=function(n,t){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,c){i.__proto__=c}||function(i,c){for(var l in c)if(c.hasOwnProperty(l))i[l]=c[l]},s(n,t)};return function(n,t){s(n,t);function i(){this.constructor=n}n.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(he,"__esModule",{value:!0});var Y=256,fi=function(){function s(n){if(n===void 0)n="=";this._paddingCharacter=n}return s.prototype.encodedLength=function(n){if(!this._paddingCharacter)return(n*8+5)/6|0;return(n+2)/3*4|0},s.prototype.encode=function(n){var t="",i=0;for(;i<n.length-2;i+=3){var c=n[i]<<16|n[i+1]<<8|n[i+2];t+=this._encodeByte(c>>>18&63),t+=this._encodeByte(c>>>12&63),t+=this._encodeByte(c>>>6&63),t+=this._encodeByte(c>>>0&63)}var l=n.length-i;if(l>0){var c=n[i]<<16|(l===2?n[i+1]<<8:0);if(t+=this._encodeByte(c>>>18&63),t+=this._encodeByte(c>>>12&63),l===2)t+=this._encodeByte(c>>>6&63);else t+=this._paddingCharacter||"";t+=this._paddingCharacter||""}return t},s.prototype.maxDecodedLength=function(n){if(!this._paddingCharacter)return(n*6+7)/8|0;return n/4*3|0},s.prototype.decodedLength=function(n){return this.maxDecodedLength(n.length-this._getPaddingLength(n))},s.prototype.decode=function(n){if(n.length===0)return new Uint8Array(0);var t=this._getPaddingLength(n),i=n.length-t,c=new Uint8Array(this.maxDecodedLength(i)),l=0,u=0,d=0,h=0,g=0,x=0,_=0;for(;u<i-4;u+=4)h=this._decodeChar(n.charCodeAt(u+0)),g=this._decodeChar(n.charCodeAt(u+1)),x=this._decodeChar(n.charCodeAt(u+2)),_=this._decodeChar(n.charCodeAt(u+3)),c[l++]=h<<2|g>>>4,c[l++]=g<<4|x>>>2,c[l++]=x<<6|_,d|=h&Y,d|=g&Y,d|=x&Y,d|=_&Y;if(u<i-1)h=this._decodeChar(n.charCodeAt(u)),g=this._decodeChar(n.charCodeAt(u+1)),c[l++]=h<<2|g>>>4,d|=h&Y,d|=g&Y;if(u<i-2)x=this._decodeChar(n.charCodeAt(u+2)),c[l++]=g<<4|x>>>2,d|=x&Y;if(u<i-3)_=this._decodeChar(n.charCodeAt(u+3)),c[l++]=x<<6|_,d|=_&Y;if(d!==0)throw Error("Base64Coder: incorrect characters for decoding");return c},s.prototype._encodeByte=function(n){var t=n;return t+=65,t+=25-n>>>8&6,t+=51-n>>>8&-75,t+=61-n>>>8&-15,t+=62-n>>>8&3,String.fromCharCode(t)},s.prototype._decodeChar=function(n){var t=Y;return t+=(42-n&n-44)>>>8&-Y+n-43+62,t+=(46-n&n-48)>>>8&-Y+n-47+63,t+=(47-n&n-58)>>>8&-Y+n-48+52,t+=(64-n&n-91)>>>8&-Y+n-65+0,t+=(96-n&n-123)>>>8&-Y+n-97+26,t},s.prototype._getPaddingLength=function(n){var t=0;if(this._paddingCharacter){for(var i=n.length-1;i>=0;i--){if(n[i]!==this._paddingCharacter)break;t++}if(n.length<4||t>2)throw Error("Base64Coder: incorrect padding")}return t},s}();he.Coder=fi;var er=new fi;function rl(s){return er.encode(s)}he.encode=rl;function nl(s){return er.decode(s)}he.decode=nl;var ga=function(s){tl(n,s);function n(){return s!==null&&s.apply(this,arguments)||this}return n.prototype._encodeByte=function(t){var i=t;return i+=65,i+=25-t>>>8&6,i+=51-t>>>8&-75,i+=61-t>>>8&-13,i+=62-t>>>8&49,String.fromCharCode(i)},n.prototype._decodeChar=function(t){var i=Y;return i+=(44-t&t-46)>>>8&-Y+t-45+62,i+=(94-t&t-96)>>>8&-Y+t-95+63,i+=(47-t&t-58)>>>8&-Y+t-48+52,i+=(64-t&t-91)>>>8&-Y+t-65+0,i+=(96-t&t-123)>>>8&-Y+t-97+26,i},n}(fi);he.URLSafeCoder=ga;var wa=new ga;function sl(s){return wa.encode(s)}he.encodeURLSafe=sl;function il(s){return wa.decode(s)}he.decodeURLSafe=il;he.encodedLength=function(s){return er.encodedLength(s)};he.maxDecodedLength=function(s){return er.maxDecodedLength(s)};he.decodedLength=function(s){return er.decodedLength(s)}});var ka=r(function(ba,Rn){(function(s,n){var t={};n(t);var i=t.default;for(var c in t)i[c]=t[c];if(typeof Rn==="object"&&typeof Rn.exports==="object")Rn.exports=i;else if(typeof define==="function"&&define.amd)define(function(){return i});else s.sha256=i})(ba,function(s){s.__esModule=!0,s.digestLength=32,s.blockSize=64;var n=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function t(_,b,w,S,P){var k,R,y,C,O,M,q,L,K,H,B,_e,Ze;while(P>=64){k=b[0],R=b[1],y=b[2],C=b[3],O=b[4],M=b[5],q=b[6],L=b[7];for(H=0;H<16;H++)B=S+H*4,_[H]=(w[B]&255)<<24|(w[B+1]&255)<<16|(w[B+2]&255)<<8|w[B+3]&255;for(H=16;H<64;H++)K=_[H-2],_e=(K>>>17|K<<15)^(K>>>19|K<<13)^K>>>10,K=_[H-15],Ze=(K>>>7|K<<25)^(K>>>18|K<<14)^K>>>3,_[H]=(_e+_[H-7]|0)+(Ze+_[H-16]|0);for(H=0;H<64;H++)_e=(((O>>>6|O<<26)^(O>>>11|O<<21)^(O>>>25|O<<7))+(O&M^~O&q)|0)+(L+(n[H]+_[H]|0)|0)|0,Ze=((k>>>2|k<<30)^(k>>>13|k<<19)^(k>>>22|k<<10))+(k&R^k&y^R&y)|0,L=q,q=M,M=O,O=C+_e|0,C=y,y=R,R=k,k=_e+Ze|0;b[0]+=k,b[1]+=R,b[2]+=y,b[3]+=C,b[4]+=O,b[5]+=M,b[6]+=q,b[7]+=L,S+=64,P-=64}return S}var i=function(){function _(){this.digestLength=s.digestLength,this.blockSize=s.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return _.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},_.prototype.clean=function(){for(var b=0;b<this.buffer.length;b++)this.buffer[b]=0;for(var b=0;b<this.temp.length;b++)this.temp[b]=0;this.reset()},_.prototype.update=function(b,w){if(w===void 0)w=b.length;if(this.finished)throw Error("SHA256: can't update because hash was finished.");var S=0;if(this.bytesHashed+=w,this.bufferLength>0){while(this.bufferLength<64&&w>0)this.buffer[this.bufferLength++]=b[S++],w--;if(this.bufferLength===64)t(this.temp,this.state,this.buffer,0,64),this.bufferLength=0}if(w>=64)S=t(this.temp,this.state,b,S,w),w%=64;while(w>0)this.buffer[this.bufferLength++]=b[S++],w--;return this},_.prototype.finish=function(b){if(!this.finished){var w=this.bytesHashed,S=this.bufferLength,P=w/536870912|0,k=w<<3,R=w%64<56?64:128;this.buffer[S]=128;for(var y=S+1;y<R-8;y++)this.buffer[y]=0;this.buffer[R-8]=P>>>24&255,this.buffer[R-7]=P>>>16&255,this.buffer[R-6]=P>>>8&255,this.buffer[R-5]=P>>>0&255,this.buffer[R-4]=k>>>24&255,this.buffer[R-3]=k>>>16&255,this.buffer[R-2]=k>>>8&255,this.buffer[R-1]=k>>>0&255,t(this.temp,this.state,this.buffer,0,R),this.finished=!0}for(var y=0;y<8;y++)b[y*4+0]=this.state[y]>>>24&255,b[y*4+1]=this.state[y]>>>16&255,b[y*4+2]=this.state[y]>>>8&255,b[y*4+3]=this.state[y]>>>0&255;return this},_.prototype.digest=function(){var b=new Uint8Array(this.digestLength);return this.finish(b),b},_.prototype._saveState=function(b){for(var w=0;w<this.state.length;w++)b[w]=this.state[w]},_.prototype._restoreState=function(b,w){for(var S=0;S<this.state.length;S++)this.state[S]=b[S];this.bytesHashed=w,this.finished=!1,this.bufferLength=0},_}();s.Hash=i;var c=function(){function _(b){this.inner=new i,this.outer=new i,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var w=new Uint8Array(this.blockSize);if(b.length>this.blockSize)new i().update(b).finish(w).clean();else for(var S=0;S<b.length;S++)w[S]=b[S];for(var S=0;S<w.length;S++)w[S]^=54;this.inner.update(w);for(var S=0;S<w.length;S++)w[S]^=106;this.outer.update(w),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var S=0;S<w.length;S++)w[S]=0}return _.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},_.prototype.clean=function(){for(var b=0;b<this.istate.length;b++)this.ostate[b]=this.istate[b]=0;this.inner.clean(),this.outer.clean()},_.prototype.update=function(b){return this.inner.update(b),this},_.prototype.finish=function(b){if(this.outer.finished)this.outer.finish(b);else this.inner.finish(b),this.outer.update(b,this.digestLength).finish(b);return this},_.prototype.digest=function(){var b=new Uint8Array(this.digestLength);return this.finish(b),b},_}();s.HMAC=c;function l(_){var b=new i().update(_),w=b.digest();return b.clean(),w}s.hash=l,s.default=l;function u(_,b){var w=new c(_).update(b),S=w.digest();return w.clean(),S}s.hmac=u;function d(_,b,w,S){var P=S[0];if(P===0)throw Error("hkdf: cannot expand more");if(b.reset(),P>1)b.update(_);if(w)b.update(w);b.update(S),b.finish(_),S[0]++}var h=new Uint8Array(s.digestLength);function g(_,b,w,S){if(b===void 0)b=h;if(S===void 0)S=32;var P=new Uint8Array([1]),k=u(b,_),R=new c(k),y=new Uint8Array(R.digestLength),C=y.length,O=new Uint8Array(S);for(var M=0;M<S;M++){if(C===y.length)d(y,R,w,P),C=0;O[M]=y[C++]}return R.clean(),y.fill(0),P.fill(0),O}s.hkdf=g;function x(_,b,w,S){var P=new c(_),k=P.digestLength,R=new Uint8Array(4),y=new Uint8Array(k),C=new Uint8Array(k),O=new Uint8Array(S);for(var M=0;M*k<S;M++){var q=M+1;R[0]=q>>>24&255,R[1]=q>>>16&255,R[2]=q>>>8&255,R[3]=q>>>0&255,P.reset(),P.update(b),P.update(R),P.finish(C);for(var L=0;L<k;L++)y[L]=C[L];for(var L=2;L<=w;L++){P.reset(),P.update(C).finish(C);for(var K=0;K<k;K++)y[K]^=C[K]}for(var L=0;L<k&&M*k+L<S;L++)O[M*k+L]=y[L]}for(var M=0;M<k;M++)y[M]=C[M]=0;for(var M=0;M<4;M++)R[M]=0;return P.clean(),O}s.pbkdf2=x})});var xa=r(function(va){Object.defineProperty(va,"__esModule",{value:!0});va.timingSafeEqual=ol;function Sa(s,n=""){if(!s)throw Error(n)}function ol(s,n){if(s.byteLength!==n.byteLength)return!1;if(!(s instanceof DataView))s=new DataView(ArrayBuffer.isView(s)?s.buffer:s);if(!(n instanceof DataView))n=new DataView(ArrayBuffer.isView(n)?n.buffer:n);Sa(s instanceof DataView),Sa(n instanceof DataView);let t=s.byteLength,i=0,c=-1;while(++c<t)i|=s.getUint8(c)^n.getUint8(c);return i===0}});var Pa=r(function(Ia){Object.defineProperty(Ia,"__esModule",{value:!0});Ia.Webhook=Ia.WebhookVerificationError=void 0;var In=ya(),Aa=ka(),Ra=xa(),Ea=300;class pi extends Error{constructor(s){super(s);Object.setPrototypeOf(this,pi.prototype),this.name="ExtendableError",this.stack=Error(s).stack}}class je extends pi{constructor(s){super(s);Object.setPrototypeOf(this,je.prototype),this.name="WebhookVerificationError"}}Ia.WebhookVerificationError=je;class tr{constructor(s,n){if((n===null||n===void 0?void 0:n.format)==="raw")if(s instanceof Uint8Array)this.key=s;else this.key=Uint8Array.from(s,(t)=>t.charCodeAt(0));else{if(typeof s!=="string")throw Error("Expected secret to be of type string");if(s.startsWith(tr.prefix))s=s.substring(tr.prefix.length);this.key=In.decode(s)}if(this.key.length===0)throw Error("Secret can't be empty.")}verify(s,n,t){var i;let c=(i=t===null||t===void 0?void 0:t.jsonParse)!==null&&i!==void 0?i:!0,l={};for(let S of Object.keys(n))l[S.toLowerCase()]=n[S];let u=l["webhook-id"],d=l["webhook-signature"],h=l["webhook-timestamp"];if(!d||!u||!h)throw new je("Missing required headers");let g=this.verifyTimestamp(h),_=this.sign(u,g,s).split(",")[1],b=d.split(" "),w=new globalThis.TextEncoder;for(let S of b){let[P,k]=S.split(",");if(P!=="v1")continue;if(Ra.timingSafeEqual(w.encode(k),w.encode(_))){let R=s.toString();if(R==="")return;if(c)return JSON.parse(R);else return}}throw new je("No matching signature found")}sign(s,n,t){if(typeof t==="string");else if(t.constructor.name==="Buffer")t=t.toString();else throw Error("Expected payload to be of type string or Buffer.");let i=new TextEncoder,c=Math.floor(n.getTime()/1000),l=i.encode(`${s}.${c}.${t}`);return`v1,${In.encode(Aa.hmac(this.key,l))}`}verifyTimestamp(s){let n=Math.floor(Date.now()/1000),t=parseInt(s,10);if(Number.isNaN(t))throw new je("Invalid Signature Headers");if(n-t>Ea)throw new je("Message timestamp too old");if(t>n+Ea)throw new je("Message timestamp too new");return new Date(t*1000)}}Ia.Webhook=tr;tr.prefix="whsec_"});var Re=(s,n)=>new Promise((t)=>{if(n?.aborted)return t();let i=()=>{clearTimeout(c),t()},c=setTimeout(()=>{n?.removeEventListener("abort",i),t()},s);n?.addEventListener("abort",i,{once:!0})});var we="0.129.0";var ro=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function wc(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}var yc=()=>{let s=wc();if(s==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":we,"X-Stainless-OS":eo(Deno.build.os),"X-Stainless-Arch":Zi(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":we,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process?.version??"unknown"};if(s==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":we,"X-Stainless-OS":eo(globalThis.process.platform??"unknown"),"X-Stainless-Arch":Zi(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let n=bc();if(n)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":we,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${n.browser}`,"X-Stainless-Runtime-Version":n.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":we,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function bc(){if(typeof navigator>"u"||!navigator)return null;let s=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:n,pattern:t}of s){let i=t.exec(navigator.userAgent);if(i){let c=i[1]||0,l=i[2]||0,u=i[3]||0;return{browser:n,version:`${c}.${l}.${u}`}}}return null}var Zi=(s)=>{if(s==="x32")return"x32";if(s==="x86_64"||s==="x64")return"x64";if(s==="arm")return"arm";if(s==="aarch64"||s==="arm64")return"arm64";if(s)return`other:${s}`;return"unknown"},eo=(s)=>{if(s=s.toLowerCase(),s.includes("ios"))return"iOS";if(s==="android")return"Android";if(s==="darwin")return"MacOS";if(s==="win32")return"Windows";if(s==="freebsd")return"FreeBSD";if(s==="openbsd")return"OpenBSD";if(s==="linux")return"Linux";if(s)return`Other:${s}`;return"Unknown"},to,Lt=()=>to??(to=yc());var ln=new WeakMap,no=typeof globalThis.FinalizationRegistry==="function"?new globalThis.FinalizationRegistry((s)=>Ce(s)):null;function kc(s,n){return()=>s.removeEventListener("abort",n)}function so(s,n,t){ln.set(s,kc(n,t))}function oo(s,n){if(ln.has(n))no?.register(s,n,n)}function Ce(s){let n=ln.get(s);if(n)ln.delete(s),no?.unregister(s),n()}function ao(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function Ks(...s){let n=globalThis.ReadableStream;if(typeof n>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new n(...s)}function un(s){let n=Symbol.asyncIterator in s?s[Symbol.asyncIterator]():s[Symbol.iterator]();return Ks({start(){},async pull(t){let{done:i,value:c}=await n.next();if(i)t.close();else t.enqueue(c)},async cancel(){await n.return?.()}})}function $t(s){if(s[Symbol.asyncIterator])return s;let n=s.getReader();return{async next(){try{let t=await n.read();if(t?.done)n.releaseLock();return t}catch(t){throw n.releaseLock(),t}},async return(){let t=n.cancel();return n.releaseLock(),await t,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function co(s){if(s===null||typeof s!=="object")return;if(s[Symbol.asyncIterator]){await s[Symbol.asyncIterator]().return?.();return}let n=s.getReader(),t=n.cancel();n.releaseLock(),await t}var lo=({headers:s,body:n})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(n)});var zs="RFC3986",Vs=(s)=>String(s),Ys={RFC1738:(s)=>String(s).replace(/%20/g,"+"),RFC3986:Vs},uo="RFC1738";var dn=(s,n)=>(dn=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),dn(s,n)),Oe=(()=>{let s=[];for(let n=0;n<256;++n)s.push("%"+((n<16?"0":"")+n.toString(16)).toUpperCase());return s})();var Js=1024,ho=(s,n,t,i,c)=>{if(s.length===0)return s;let l=s;if(typeof s==="symbol")l=Symbol.prototype.toString.call(s);else if(typeof s!=="string")l=String(s);if(t==="iso-8859-1")return escape(l).replace(/%u[0-9a-f]{4}/gi,function(d){return"%26%23"+parseInt(d.slice(2),16)+"%3B"});let u="";for(let d=0;d<l.length;d+=Js){let h=l.length>=Js?l.slice(d,d+Js):l,g=[];for(let x=0;x<h.length;++x){let _=h.charCodeAt(x);if(_===45||_===46||_===95||_===126||_>=48&&_<=57||_>=65&&_<=90||_>=97&&_<=122||c===uo&&(_===40||_===41)){g[g.length]=h.charAt(x);continue}if(_<128){g[g.length]=Oe[_];continue}if(_<2048){g[g.length]=Oe[192|_>>6]+Oe[128|_&63];continue}if(_<55296||_>=57344){g[g.length]=Oe[224|_>>12]+Oe[128|_>>6&63]+Oe[128|_&63];continue}x+=1,_=65536+((_&1023)<<10|h.charCodeAt(x)&1023),g[g.length]=Oe[240|_>>18]+Oe[128|_>>12&63]+Oe[128|_>>6&63]+Oe[128|_&63]}u+=g.join("")}return u};function fo(s){if(!s||typeof s!=="object")return!1;return!!(s.constructor&&s.constructor.isBuffer&&s.constructor.isBuffer(s))}function Gs(s,n){if(De(s)){let t=[];for(let i=0;i<s.length;i+=1)t.push(n(s[i]));return t}return n(s)}var mo={brackets(s){return String(s)+"[]"},comma:"comma",indices(s,n){return String(s)+"["+n+"]"},repeat(s){return String(s)}},_o=function(s,n){Array.prototype.push.apply(s,De(n)?n:[n])},po,Q={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:ho,encodeValuesOnly:!1,format:zs,formatter:Vs,indices:!1,serializeDate(s){return(po??(po=Function.prototype.call.bind(Date.prototype.toISOString)))(s)},skipNulls:!1,strictNullHandling:!1};function xc(s){return typeof s==="string"||typeof s==="number"||typeof s==="boolean"||typeof s==="symbol"||typeof s==="bigint"}var Xs={};function go(s,n,t,i,c,l,u,d,h,g,x,_,b,w,S,P,k,R){let y=s,C=R,O=0,M=!1;while((C=C.get(Xs))!==void 0&&!M){let B=C.get(s);if(O+=1,typeof B<"u")if(B===O)throw RangeError("Cyclic object value");else M=!0;if(typeof C.get(Xs)>"u")O=0}if(typeof g==="function")y=g(n,y);else if(y instanceof Date)y=b?.(y);else if(t==="comma"&&De(y))y=Gs(y,function(B){if(B instanceof Date)return b?.(B);return B});if(y===null){if(l)return h&&!P?h(n,Q.encoder,k,"key",w):n;y=""}if(xc(y)||fo(y)){if(h){let B=P?n:h(n,Q.encoder,k,"key",w);return[S?.(B)+"="+S?.(h(y,Q.encoder,k,"value",w))]}return[S?.(n)+"="+S?.(String(y))]}let q=[];if(typeof y>"u")return q;let L;if(t==="comma"&&De(y)){if(P&&h)y=Gs(y,h);L=[{value:y.length>0?y.join(",")||null:void 0}]}else if(De(g))L=g;else{let B=Object.keys(y);L=x?B.sort(x):B}let K=d?String(n).replace(/\./g,"%2E"):String(n),H=i&&De(y)&&y.length===1?K+"[]":K;if(c&&De(y)&&y.length===0)return H+"[]";for(let B=0;B<L.length;++B){let _e=L[B],Ze=typeof _e==="object"&&typeof _e.value<"u"?_e.value:y[_e];if(u&&Ze===null)continue;let qs=_&&d?_e.replace(/\./g,"%2E"):_e,gc=De(y)?typeof t==="function"?t(H,qs):H:H+(_?"."+qs:"["+qs+"]");R.set(s,O);let Qi=new WeakMap;Qi.set(Xs,R),_o(q,go(Ze,gc,t,i,c,l,u,d,t==="comma"&&P&&De(y)?null:h,g,x,_,b,w,S,P,k,Qi))}return q}function Ec(s=Q){if(typeof s.allowEmptyArrays<"u"&&typeof s.allowEmptyArrays!=="boolean")throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof s.encodeDotInKeys<"u"&&typeof s.encodeDotInKeys!=="boolean")throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(s.encoder!==null&&typeof s.encoder<"u"&&typeof s.encoder!=="function")throw TypeError("Encoder has to be a function.");let n=s.charset||Q.charset;if(typeof s.charset<"u"&&s.charset!=="utf-8"&&s.charset!=="iso-8859-1")throw TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let t=zs;if(typeof s.format<"u"){if(!dn(Ys,s.format))throw TypeError("Unknown format option provided.");t=s.format}let i=Ys[t],c=Q.filter;if(typeof s.filter==="function"||De(s.filter))c=s.filter;let l;if(s.arrayFormat&&s.arrayFormat in mo)l=s.arrayFormat;else if("indices"in s)l=s.indices?"indices":"repeat";else l=Q.arrayFormat;if("commaRoundTrip"in s&&typeof s.commaRoundTrip!=="boolean")throw TypeError("`commaRoundTrip` must be a boolean, or absent");let u=typeof s.allowDots>"u"?!!s.encodeDotInKeys===!0?!0:Q.allowDots:!!s.allowDots;return{addQueryPrefix:typeof s.addQueryPrefix==="boolean"?s.addQueryPrefix:Q.addQueryPrefix,allowDots:u,allowEmptyArrays:typeof s.allowEmptyArrays==="boolean"?!!s.allowEmptyArrays:Q.allowEmptyArrays,arrayFormat:l,charset:n,charsetSentinel:typeof s.charsetSentinel==="boolean"?s.charsetSentinel:Q.charsetSentinel,commaRoundTrip:!!s.commaRoundTrip,delimiter:typeof s.delimiter>"u"?Q.delimiter:s.delimiter,encode:typeof s.encode==="boolean"?s.encode:Q.encode,encodeDotInKeys:typeof s.encodeDotInKeys==="boolean"?s.encodeDotInKeys:Q.encodeDotInKeys,encoder:typeof s.encoder==="function"?s.encoder:Q.encoder,encodeValuesOnly:typeof s.encodeValuesOnly==="boolean"?s.encodeValuesOnly:Q.encodeValuesOnly,filter:c,format:t,formatter:i,serializeDate:typeof s.serializeDate==="function"?s.serializeDate:Q.serializeDate,skipNulls:typeof s.skipNulls==="boolean"?s.skipNulls:Q.skipNulls,sort:typeof s.sort==="function"?s.sort:null,strictNullHandling:typeof s.strictNullHandling==="boolean"?s.strictNullHandling:Q.strictNullHandling}}function wo(s,n={}){let t=s,i=Ec(n),c,l;if(typeof i.filter==="function")l=i.filter,t=l("",t);else if(De(i.filter))l=i.filter,c=l;let u=[];if(typeof t!=="object"||t===null)return"";let d=mo[i.arrayFormat],h=d==="comma"&&i.commaRoundTrip;if(!c)c=Object.keys(t);if(i.sort)c.sort(i.sort);let g=new WeakMap;for(let b=0;b<c.length;++b){let w=c[b];if(i.skipNulls&&t[w]===null)continue;_o(u,go(t[w],w,d,h,i.allowEmptyArrays,i.strictNullHandling,i.skipNulls,i.encodeDotInKeys,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,g))}let x=u.join(i.delimiter),_=i.addQueryPrefix===!0?"?":"";if(i.charsetSentinel)if(i.charset==="iso-8859-1")_+="utf8=%26%2310003%3B&";else _+="utf8=%E2%9C%93&";return x.length>0?_+x:""}function yo(s){return wo(s,{arrayFormat:"brackets"})}var ko="urn:ietf:params:oauth:grant-type:jwt-bearer",So="refresh_token",hn="/v1/oauth/token",et="oauth-2025-04-20",vo="oidc-federation-2026-04-01",xo=120,lt=30,Eo=5,bo=1048576;function fn(s){if(!s)return;let n;try{n=new URL(s)}catch(i){throw new F(`Invalid token endpoint base URL "${s}": ${i}`)}if(n.protocol==="https:")return;let t=n.hostname.toLowerCase().replace(/^\[|\]$/g,"");if(n.protocol==="http:"&&(t==="localhost"||t==="127.0.0.1"||t==="::1"))return;throw new F(`Refusing to send credential over non-https token endpoint "${s}"`)}async function pn(s,n){let t=await Ic(s),i;try{i=JSON.parse(t)}catch{throw new F(`Token endpoint returned non-JSON response (status ${s.status})`,s.status,re(t),n)}if(!i.access_token)throw new F(`Token endpoint response missing access_token: ${JSON.stringify(re(i))}`,s.status,re(i),n);if(i.token_type&&i.token_type.toLowerCase()!=="bearer")throw new F(`Token endpoint response: unsupported token_type "${i.token_type}" (want Bearer)`,s.status,re(i),n);return i}var Qs=2000,Rc=new Set(["error","error_description","error_uri"]);function re(s){if(s==null)return s;if(typeof s==="string"){let n;try{n=JSON.parse(s)}catch{if(s.length<=Qs)return s;return s.slice(0,Qs)+`... <${s.length-Qs} more chars>`}return JSON.stringify(re(n))}if(typeof s==="object"&&!Array.isArray(s)){let n={};for(let[t,i]of Object.entries(s))if(Rc.has(t))n[t]=i;return n}return null}async function mn(s,n=(t)=>console.warn(`anthropic-sdk: ${t}`)){if(typeof process>"u"||process.platform==="win32")return;let{fs:t}=await import("./chunk-2sbmy31t.js"),i=s,c;try{i=await t.promises.realpath(s),c=await t.promises.stat(i)}catch{return}let l=c.mode&511;if(l&18)throw new F(`Credentials file at ${i} is group/world-writable (mode 0o${l.toString(8)}); this allows other local users to plant tokens. Run \`chmod 600 ${i}\`.`);if(l&36)throw new F(`Credentials file at ${i} is group/world-readable (mode 0o${l.toString(8)}); run \`chmod 600 ${i}\` before retrying.`);if(typeof process.getuid==="function"&&c.uid!==process.getuid())n(`credentials file at ${i} is owned by uid ${c.uid} (current process uid ${process.getuid()}); verify this is intentional.`)}async function _n(s,n){let{fs:t,path:i}=await import("./chunk-2sbmy31t.js"),c=i.dirname(s);await t.promises.mkdir(c,{recursive:!0,mode:448});let l=`${s}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;try{let u=await t.promises.open(l,"w",384);try{await u.writeFile(JSON.stringify(n,null,2)),await u.sync()}finally{await u.close()}await t.promises.rename(l,s)}catch(u){throw await t.promises.unlink(l).catch(()=>{}),u}try{let u=await t.promises.open(c,"r");try{await u.sync()}finally{await u.close()}}catch{}}async function Ic(s){if(!s.body)return"";let n=s.body.getReader(),t=[],i=0;for(;;){let{done:l,value:u}=await n.read();if(l)break;if(i+u.length>bo){let d=bo-i;if(d>0)t.push(u.subarray(0,d));await n.cancel();break}t.push(u),i+=u.length}let c;if(t.length===1)c=t[0];else{c=new Uint8Array(t.reduce((u,d)=>u+d.length,0));let l=0;for(let u of t)c.set(u,l),l+=u.length}return new TextDecoder("utf-8").decode(c)}class F extends p{constructor(s,n=null,t=null,i=null){super(s);this.statusCode=n,this.body=t,this.requestId=i}}function Ie(){return Math.floor(Date.now()/1000)}class Zs{constructor(s,n){this.cached=null,this.pendingRefresh=null,this.nextForce=!1,this.lastAdvisoryError=0,this.provider=s,this.onAdvisoryRefreshError=n}async getToken(){let s=this.nextForce;this.nextForce=!1;let n=this.cached;if(s||n==null)return(await this.refresh(s)).token;if(n.expiresAt==null)return n.token;let t=n.expiresAt-Ie();if(t>xo)return n.token;if(t>lt)return this.backgroundRefresh(),n.token;return(await this.refresh()).token}invalidate(){this.cached=null,this.nextForce=!0}refresh(s=!1){if(this.pendingRefresh&&!s)return this.pendingRefresh;return this.doRefresh(s)}backgroundRefresh(){if(this.pendingRefresh)return;if(Ie()-this.lastAdvisoryError<Eo)return;this.doRefresh().catch((s)=>{this.lastAdvisoryError=Ie(),this.onAdvisoryRefreshError?.(s)})}doRefresh(s=!1){return this.pendingRefresh=this.provider(s?{forceRefresh:!0}:void 0).then((n)=>(this.cached=n,this.pendingRefresh=null,n),(n)=>{throw this.pendingRefresh=null,n}),this.pendingRefresh}}var Ao=(s)=>{if(typeof globalThis.Buffer<"u"){let n=globalThis.Buffer.from(s,"base64");return new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}if(typeof atob<"u"){let n=atob(s),t=new Uint8Array(n.length);for(let i=0;i<n.length;i++)t[i]=n.charCodeAt(i);return t}throw new p("Cannot decode base64 string; Expected `Buffer` or `atob` to be defined")};var gn=function(){let{crypto:s}=globalThis;if(s?.randomUUID)return gn=s.randomUUID.bind(s),s.randomUUID();let n=new Uint8Array(1),t=s?()=>s.getRandomValues(n)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(i)=>(+i^t()&15>>+i/4).toString(16))};var wn="1.0",Tc=/^[A-Za-z0-9_.-]+$/;function Ro(s){if(!s)throw Error("profile name is empty");if(s==="."||s==="..")throw Error(`profile name "${s}" is not allowed`);if(s.includes("/")||s.includes("\\"))throw Error(`profile name "${s}" must not contain path separators`);if(!Tc.test(s))throw Error(`profile name "${s}" contains disallowed characters (allowed: letters, digits, '_', '.', '-')`)}var Io=async(s)=>{var n,t;let i=await ei();if(i===null)return null;let c=s??await Po();if(c===null)return null;Ro(c);let{fs:l,path:u}=await import("./chunk-2sbmy31t.js"),d=u.join(i,"configs",`${c}.json`),h;try{h=await l.promises.readFile(d,"utf-8")}catch(_){if(_?.code!=="ENOENT")throw Error(`failed to read config file ${d}: ${_}`);h=null}if(h===null){let _=N("ANTHROPIC_ORGANIZATION_ID"),b=N("ANTHROPIC_IDENTITY_TOKEN_FILE"),w=N("ANTHROPIC_FEDERATION_RULE_ID");if(w&&_)return{fromFile:!1,config:{organization_id:_,workspace_id:N("ANTHROPIC_WORKSPACE_ID"),base_url:N("ANTHROPIC_BASE_URL"),authentication:{type:"oidc_federation",federation_rule_id:w,service_account_id:N("ANTHROPIC_SERVICE_ACCOUNT_ID"),identity_token:b?{source:"file",path:b}:void 0,scope:N("ANTHROPIC_SCOPE")}}};return null}let g;try{g=JSON.parse(h)}catch(_){throw Error(`failed to parse config file ${d}: ${_}`)}if(!g.authentication)throw Error(`config file ${d} is missing "authentication"`);let x=g.authentication.type;if(x!=="oidc_federation"&&x!=="user_oauth")throw Error(`authentication.type "${x}" is not a known authentication type`);if(g.organization_id??(g.organization_id=N("ANTHROPIC_ORGANIZATION_ID")),g.workspace_id??(g.workspace_id=N("ANTHROPIC_WORKSPACE_ID")),g.base_url??(g.base_url=N("ANTHROPIC_BASE_URL")),(n=g.authentication).scope??(n.scope=N("ANTHROPIC_SCOPE")),g.authentication.type==="oidc_federation"){if(!g.authentication.identity_token){let _=N("ANTHROPIC_IDENTITY_TOKEN_FILE");if(_)g.authentication.identity_token={source:"file",path:_}}if(!g.authentication.federation_rule_id)g.authentication.federation_rule_id=N("ANTHROPIC_FEDERATION_RULE_ID")??"";(t=g.authentication).service_account_id??(t.service_account_id=N("ANTHROPIC_SERVICE_ACCOUNT_ID"))}return{config:g,fromFile:!0}};var To=async(s,n)=>{if(s?.authentication.credentials_path)return s.authentication.credentials_path;let t=await ei();if(!t)return null;let i=n??await Po();if(!i)return null;Ro(i);let{path:c}=await import("./chunk-2sbmy31t.js");return c.join(t,"credentials",`${i}.json`)},ei=async()=>{if(!Pc())return null;let{path:s}=await import("./chunk-2sbmy31t.js"),n=N("ANTHROPIC_CONFIG_DIR");if(n)return n;if(Lt()["X-Stainless-OS"]==="Windows"){let l=N("APPDATA");if(l)return s.join(l,"Anthropic");let u=N("USERPROFILE");if(u)return s.join(u,"AppData","Roaming","Anthropic");return null}let i=N("XDG_CONFIG_HOME");if(i)return s.join(i,"anthropic");let c=N("HOME");if(c)return s.join(c,".config","anthropic");return null},Pc=()=>{let s=Lt()["X-Stainless-Runtime"];return s==="node"||s==="deno"},Po=async()=>{let s=await ei();if(!s)return null;let n=N("ANTHROPIC_PROFILE");if(n)return n;let{fs:t,path:i}=await import("./chunk-2sbmy31t.js"),c=i.join(s,"active_config");try{return(await t.promises.readFile(c,"utf-8")).trim()||"default"}catch(l){if(l?.code!=="ENOENT")throw Error(`failed to read ${c}: ${l}`);return"default"}};function ti(s){if(!s)throw new p("Identity token file path is empty");return async()=>{let{fs:n}=await import("./chunk-2sbmy31t.js"),t;try{t=await n.promises.readFile(s,"utf-8")}catch(c){throw new p(`Failed to read identity token file at ${s}: ${c}`)}let i=t.trim();if(!i)throw new p(`Identity token file at ${s} is empty`);return i}}function Co(s){if(!s)throw new p("Identity token value is empty");return()=>s}function Jo(s){return async()=>{fn(s.baseURL);let n=await s.identityTokenProvider();if(n.length>16384)throw new F(`Identity token is ${Math.ceil(n.length/1024)} KiB, exceeds the 16 KiB assertion limit`);let t={grant_type:ko,assertion:n,federation_rule_id:s.federationRuleId,organization_id:s.organizationId};if(s.serviceAccountId)t.service_account_id=s.serviceAccountId;if(s.workspaceId)t.workspace_id=s.workspaceId;let i=`${s.baseURL}${hn}`,c;try{c=await s.fetch(i,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":`${et},${vo}`,"User-Agent":s.userAgent||`anthropic-sdk-typescript/${we} oidcFederationProvider`},body:JSON.stringify(t)})}catch(h){throw new F(`Failed to reach token endpoint ${i}: ${h}`)}let l=c.headers.get("Request-Id");if(!c.ok){let h=await c.text().catch(()=>""),g=re(h),x="";if(c.status===401)x=` Ensure your federation rule matches your identity token. ${s.workspaceId?"":"If your federation rule is scoped to multiple workspaces, set the ANTHROPIC_WORKSPACE_ID environment variable, the 'workspace_id' config key, or the `workspaceId` option. "}View your authentication events in the Workload identity page of Claude Console for more details.`;throw new F(`Token exchange failed with status ${c.status}${l?` (request-id ${l})`:""}: ${g}${x}`,c.status,g,l)}let u=await pn(c,l),d=Number(u.expires_in);if(!Number.isFinite(d))throw new F(`Token endpoint response missing required fields: ${JSON.stringify(re(u))}`,c.status,re(u),l);return{token:u.access_token,expiresAt:Ie()+d}}}function Xo(s){return async(n)=>{let{fs:t}=await import("./chunk-2sbmy31t.js");await mn(s.credentialsPath,s.onSafetyWarning);let i;try{i=await t.promises.readFile(s.credentialsPath,"utf-8")}catch(k){throw new F(`Credentials file not found at ${s.credentialsPath}: ${k}`)}let c;try{c=JSON.parse(i)}catch(k){throw new F(`Credentials file at ${s.credentialsPath} is not valid JSON: ${k}`)}let l=c.access_token;if(!l)throw new F(`Credentials file at ${s.credentialsPath} must include 'access_token'`);let u=c.expires_at;if(!n?.forceRefresh&&(u==null||Ie()<u-lt))return{token:l,expiresAt:u??null};let d=c.refresh_token;if(!s.clientId||!d)throw new F(`Access token at ${s.credentialsPath} has expired and no refresh is available (client_id ${s.clientId?"set":"empty"}, refresh_token ${d?"set":"empty"})`);fn(s.baseURL);let h={grant_type:So,refresh_token:d,client_id:s.clientId},g=`${s.baseURL}${hn}`,x;try{x=await s.fetch(g,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":et,"User-Agent":s.userAgent||`anthropic-sdk-typescript/${we} userOAuthProvider`},body:JSON.stringify(h)})}catch(k){throw new F(`User OAuth refresh failed to reach token endpoint: ${k}`)}let _=x.headers.get("Request-Id");if(!x.ok){let k=await x.text().catch(()=>"");throw new F(`User OAuth refresh failed (HTTP ${x.status}): ${re(k)}`,x.status,re(k),_)}let b=await pn(x,_),w=Number(b.expires_in);if(!Number.isFinite(w))throw new F(`User OAuth refresh response missing or invalid expires_in: ${JSON.stringify(re(b))}`,x.status,re(b),_);let S=Ie()+w,P=b.refresh_token||d;return await _n(s.credentialsPath,{...c,version:wn,type:"oauth_token",access_token:b.access_token,expires_at:S,refresh_token:P}),{token:b.access_token,expiresAt:S}}}function ri(s,n){let t=s.authentication.credentials_path??null,i=(s.base_url||n.baseURL).replace(/\/+$/,""),c=Cc(s,t,i,n),l={};if(s.workspace_id&&s.authentication.type==="user_oauth")l["anthropic-workspace-id"]=s.workspace_id;return{provider:c,extraHeaders:l,baseURL:s.base_url||void 0}}async function Zo(s,n){let t=await Io(n);if(!t)return null;let{config:i,fromFile:c}=t,l=i.authentication.credentials_path||!c?i:{...i,authentication:{...i.authentication,credentials_path:await To(i,n)??void 0}};return ri(l,s)}function Cc(s,n,t,i){switch(s.authentication.type){case"oidc_federation":{let c=s.authentication,l=Oc(c);if(!l)throw new F("oidc_federation config requires an identity token (set authentication.identity_token, ANTHROPIC_IDENTITY_TOKEN_FILE, or ANTHROPIC_IDENTITY_TOKEN)");if(!c.federation_rule_id)throw new F("oidc_federation config requires 'federation_rule_id'. Set it in authentication.federation_rule_id in your profile, or via ANTHROPIC_FEDERATION_RULE_ID (profile takes precedence).");if(!s.organization_id)throw new F("oidc_federation config requires organization_id (set ANTHROPIC_ORGANIZATION_ID or config.organization_id)");let u=Jo({identityTokenProvider:l,federationRuleId:c.federation_rule_id,organizationId:s.organization_id,serviceAccountId:c.service_account_id,workspaceId:s.workspace_id,baseURL:t,fetch:i.fetch,userAgent:i.userAgent});if(n)return Mc(u,n,i.onCacheWriteError,i.onSafetyWarning);return u}case"user_oauth":{if(!n)throw new F("user_oauth config requires authentication.credentials_path (or load via a profile so it defaults to <config_dir>/credentials/<profile>.json)");return Xo({credentialsPath:n,clientId:s.authentication.client_id,baseURL:t,fetch:i.fetch,userAgent:i.userAgent,onSafetyWarning:i.onSafetyWarning})}default:{let c=s.authentication.type;throw new F(`authentication.type "${c}" is not a known authentication type`)}}}function Oc(s){if(s.identity_token){let i=s.identity_token.source;if(i!=="file")throw new F(`identity_token.source "${i}" is not supported by this SDK version (only "file")`);if(!s.identity_token.path)throw new F('identity_token.source "file" requires a non-empty path');return ti(s.identity_token.path)}let n=N("ANTHROPIC_IDENTITY_TOKEN_FILE");if(n)return ti(n);let t=N("ANTHROPIC_IDENTITY_TOKEN");if(t)return Co(t);return null}function Mc(s,n,t,i){return async(c)=>{let{fs:l}=await import("./chunk-2sbmy31t.js");await mn(n,i);let u;try{let h=await l.promises.readFile(n,"utf-8");u=JSON.parse(h);let g=u?.access_token;if(g&&!c?.forceRefresh){let x=u?.expires_at;if(x==null||Ie()<x-lt)return{token:g,expiresAt:x??null}}}catch(h){if(h?.code!=="ENOENT"&&!(h instanceof SyntaxError))t?.(h)}let d=await s(c);try{await _n(n,{...u??{},version:wn,type:"oauth_token",access_token:d.token,expires_at:d.expiresAt})}catch(h){t?.(h)}return d}}var ae,de,Ft=(()=>{class s{constructor(){ae.set(this,void 0),de.set(this,void 0),o(this,ae,new Uint8Array,"f"),o(this,de,null,"f")}decode(n){if(n==null)return[];let t=n instanceof ArrayBuffer?new Uint8Array(n):typeof n==="string"?mr(n):n;o(this,ae,oa([e(this,ae,"f"),t]),"f");let i=[],c;while((c=Nc(e(this,ae,"f"),e(this,de,"f")))!=null){if(c.carriage&&e(this,de,"f")==null){o(this,de,c.index,"f");continue}if(e(this,de,"f")!=null&&(c.index!==e(this,de,"f")+1||c.carriage)){i.push(Kt(e(this,ae,"f").subarray(0,e(this,de,"f")-1))),o(this,ae,e(this,ae,"f").subarray(e(this,de,"f")),"f"),o(this,de,null,"f");continue}let l=e(this,de,"f")!==null?c.preceding-1:c.preceding,u=Kt(e(this,ae,"f").subarray(0,l));i.push(u),o(this,ae,e(this,ae,"f").subarray(c.index),"f"),o(this,de,null,"f")}return i}flush(){if(!e(this,ae,"f").length)return[];return this.decode(`
3
+ `)}}return ae=new WeakMap,de=new WeakMap,s.NEWLINE_CHARS=new Set([`
4
+ `,"\r"]),s.NEWLINE_REGEXP=/\r\n|[\n\r]/g,s})();function Nc(s,n){for(let c=n??0;c<s.length;c++){if(s[c]===10)return{preceding:c,index:c+1,carriage:!1};if(s[c]===13)return{preceding:c,index:c+1,carriage:!0}}return null}var Ht,Me=(()=>{class s{constructor(n,t,i){this.iterator=n,Ht.set(this,void 0),this.controller=t,o(this,Ht,i,"f")}static rawEvents(n,t=new AbortController){return ea(n,t)}static fromSSEResponse(n,t,i){let c=!1,l=i?D(i):console;async function*u(){if(c)throw new p("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");c=!0;let d=!1;try{for await(let h of ea(n,t)){if(h.event==="completion")try{yield JSON.parse(h.data)}catch(g){throw l.error("Could not parse message into JSON:",h.data),l.error("From chunk:",h.raw),g}if(h.event==="message_start"||h.event==="message_delta"||h.event==="message_stop"||h.event==="content_block_start"||h.event==="content_block_delta"||h.event==="content_block_stop"||h.event==="message"||h.event==="user.message"||h.event==="user.interrupt"||h.event==="user.tool_confirmation"||h.event==="user.custom_tool_result"||h.event==="user.tool_result"||h.event==="agent.message"||h.event==="agent.thinking"||h.event==="agent.tool_use"||h.event==="agent.tool_result"||h.event==="agent.mcp_tool_use"||h.event==="agent.mcp_tool_result"||h.event==="agent.custom_tool_use"||h.event==="agent.thread_context_compacted"||h.event==="session.status_running"||h.event==="session.status_idle"||h.event==="session.status_rescheduled"||h.event==="session.status_terminated"||h.event==="session.error"||h.event==="session.deleted"||h.event==="session.updated"||h.event==="span.model_request_start"||h.event==="span.model_request_end"||h.event==="span.outcome_evaluation_start"||h.event==="span.outcome_evaluation_ongoing"||h.event==="span.outcome_evaluation_end"||h.event==="user.define_outcome"||h.event==="agent.thread_message_received"||h.event==="agent.thread_message_sent"||h.event==="agent.session_thread_message_received"||h.event==="agent.session_thread_message_sent"||h.event==="session.thread_created"||h.event==="session.thread_status_created"||h.event==="session.thread_status_running"||h.event==="session.thread_status_idle"||h.event==="session.thread_status_rescheduled"||h.event==="session.thread_status_terminated"||h.event==="event_start"||h.event==="event_delta"||h.event==="system.message")try{yield JSON.parse(h.data)}catch(g){throw l.error("Could not parse message into JSON:",h.data),l.error("From chunk:",h.raw),g}if(h.event==="ping")continue;if(h.event==="error"){let g=Vo(h.data)??h.data,x=g?.error?.type;throw new le(void 0,g,void 0,n.headers,x)}}d=!0}catch(h){if(ht(h))return;throw h}finally{if(!d)t.abort();Ce(t)}}return new s(u,t,i)}static fromReadableStream(n,t,i){let c=!1;async function*l(){let d=new Ft,h=$t(n);for await(let g of h)for(let x of d.decode(g))yield x;for(let g of d.flush())yield g}async function*u(){if(c)throw new p("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");c=!0;let d=!1;try{for await(let h of l()){if(d)continue;if(h)yield JSON.parse(h)}d=!0}catch(h){if(ht(h))return;throw h}finally{if(!d)t.abort();Ce(t)}}return new s(u,t,i)}[(Ht=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let n=[],t=[],i=this.iterator(),c=(l)=>({next:()=>{if(l.length===0){let u=i.next();n.push(u),t.push(u)}return l.shift()}});return[new s(()=>c(n),this.controller,e(this,Ht,"f")),new s(()=>c(t),this.controller,e(this,Ht,"f"))]}toReadableStream(){let n=this,t;return Ks({async start(){t=n[Symbol.asyncIterator]()},async pull(i){try{let{value:c,done:l}=await t.next();if(l)return i.close();let u=mr(JSON.stringify(c)+`
5
+ `);i.enqueue(u)}catch(c){i.error(c)}},async cancel(){await t.return?.()}})}}return s})();async function*ea(s,n){if(!s.body){if(n.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new p("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new p("Attempted to iterate over a response with no body")}let t=new aa,i=new Ft,c=$t(s.body);for await(let l of c)for(let u of i.decode(l)){let d=t.decode(u);if(d)yield d}for(let l of i.flush()){let u=t.decode(l);if(u)yield u}}class aa{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(s){if(s.endsWith("\r"))s=s.substring(0,s.length-1);if(!s){if(!this.event&&!this.data.length)return null;let c={event:this.event,data:this.data.join(`
6
+ `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],c}if(this.chunks.push(s),s.startsWith(":"))return null;let[n,t,i]=Lc(s,":");if(i.startsWith(" "))i=i.substring(1);if(n==="event")this.event=i;else if(n==="data")this.data.push(i);return null}}function Lc(s,n){let t=s.indexOf(n);if(t!==-1)return[s.substring(0,t),n,s.substring(t+n.length)];return[s,"",""]}async function yn(s,n){let{response:t,requestLogID:i,retryOfRequestLogID:c,startTime:l}=n,u=await(async()=>{if(n.options.stream)return D(s).debug("response",t.status,t.url,t.headers,t.body),Me.fromSSEResponse(t,n.controller,s);if(t.status===204)return null;if(n.options.__binaryResponse)return t;let h=t.headers.get("content-type")?.split(";")[0]?.trim();if(h?.includes("application/json")||h?.endsWith("+json")){if(t.headers.get("content-length")==="0")return;let b=await t.json();return Dt(b,t)}return await t.text()})().finally(()=>{if(!n.options.stream&&!n.options.__binaryResponse)Ce(n.controller)});return Et(D(s),`[${i}] response parsed`,{retryOfRequestLogID:c,url:t.url,status:t.status,body:u,durationMs:Date.now()-l}),u}function Dt(s,n){if(!s||typeof s!=="object"||Array.isArray(s))return s;return Object.defineProperties(s,{_request_id:{value:n.headers.get("request-id"),enumerable:!1},_workspace_id:{value:n.headers.get("anthropic-workspace-id"),enumerable:!1}})}var la=new WeakSet;function ni(s){return typeof s==="object"&&s!==null&&la.has(s)}function ua(s){let n=new Set;while(typeof s==="object"&&s!==null&&!n.has(s)){if(n.add(s),ni(s)||ht(s)||s instanceof Gt||s instanceof os)return!0;s=s.cause}return!1}function si(s,n,t,i){return async(c,l={})=>{if(n.length===0)return s.call(void 0,c,l);let u=l.headers instanceof Headers?l.headers:new Headers(l.headers),d=await Fc(s,n,t,i)({...l,headers:u,url:typeof c==="string"?c:c instanceof URL?c.href:c.url});if(d.bodyUsed||d.body?.locked)throw new p("middleware consumed the response body; use response.clone() to inspect it, or return new Response(body, response) to consume and replace it");return d}}function $c(s,n){let t=new WeakMap;return{options:s,logger:n?D(n):ia(),parse(i){if(s?.stream&&i.ok)return ca(i,s,n);let c=t.get(i);if(!c)c=ca(i,s,n),t.set(i,c);return c}}}async function ca(s,n,t){if(s.bodyUsed||s.body?.locked)throw new p("cannot ctx.parse() a response whose body was already consumed; call ctx.parse() instead of reading the body, or read via response.clone()");if(n?.stream&&s.ok)return Me.fromSSEResponse(s.clone(),new AbortController,t);if(s.status===204)return null;if(n?.__binaryResponse)return s;let c=s.headers.get("content-type")?.split(";")[0]?.trim();if(c?.includes("application/json")||c?.endsWith("+json")){if(s.headers.get("content-length")==="0")return;return Dt(await s.clone().json(),s)}return await s.clone().text()}function Fc(s,n,t,i){let c=async({url:u,...d})=>{try{return await s.call(void 0,u,d)}catch(h){let g=dr(h);throw la.add(g),g}},l=$c(t,i);for(let u=n.length-1;u>=0;u--){let d=n[u],h=c;c=async(g)=>d(g,h,l)}return c}var Bt,bn=(()=>{class s extends Promise{constructor(n,t,i=yn){super((c)=>{c(null)});this.responsePromise=t,this.parseResponse=i,Bt.set(this,void 0),o(this,Bt,n,"f")}_thenUnwrap(n){return new s(e(this,Bt,"f"),this.responsePromise,async(t,i)=>Dt(n(await this.parseResponse(t,i),i),i.response))}asResponse(){return this.responsePromise.then((n)=>n.response)}async withResponse(){let[n,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:n,response:t,request_id:t.headers.get("request-id"),workspace_id:t.headers.get("anthropic-workspace-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then((n)=>this.parseResponse(e(this,Bt,"f"),n));return this.parsedPromise}then(n,t){return this.parse().then(n,t)}catch(n){return this.parse().catch(n)}finally(n){return this.parse().finally(n)}}return Bt=new WeakMap,s})();var kn,ii=(()=>{class s{constructor(n,t,i,c){kn.set(this,void 0),o(this,kn,n,"f"),this.options=c,this.response=t,this.body=i}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let n=this.nextPageRequestOptions();if(!n)throw new p("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await e(this,kn,"f").requestAPIList(this.constructor,n)}async*iterPages(){let n=this;yield n;while(n.hasNextPage())n=await n.getNextPage(),yield n}async*[(kn=new WeakMap,Symbol.asyncIterator)](){for await(let n of this.iterPages())for(let t of n.getPaginatedItems())yield t}}return s})(),da=(()=>{class s extends bn{constructor(n,t,i){super(n,t,async(c,l)=>new i(c,l.response,await yn(c,l),l.options))}async*[Symbol.asyncIterator](){let n=await this;for await(let t of n)yield t}}return s})();class Z extends ii{constructor(s,n,t,i){super(s,n,t,i);this.data=t.data||[],this.has_more=t.has_more||!1,this.first_id=t.first_id||null,this.last_id=t.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){if(this.options.query?.before_id){let n=this.first_id;if(!n)return null;return{...this.options,query:{...Ln(this.options.query),before_id:n}}}let s=this.last_id;if(!s)return null;return{...this.options,query:{...Ln(this.options.query),after_id:s}}}}class T extends ii{constructor(s,n,t,i){super(s,n,t,i);this.data=t.data||[],this.next_page=t.next_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let s=this.next_page;if(!s)return null;return{...this.options,query:{...Ln(this.options.query),page:s}}}}class oi extends ii{constructor(s,n,t,i){super(s,n,t,i);this.data=t.data||[],this.next_page=t.next_page||null,this.prev_page=t.prev_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let s=this.next_page;if(!s)return null;return{...this.options,query:{...Ln(this.options.query),page:s}}}}var ci=()=>{if(typeof File>"u"){let{process:s}=globalThis,n=typeof s?.versions?.node==="string"&&parseInt(s.versions.node.split("."))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(n?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function tt(s,n,t){return ci(),new File(s,n??"",t)}function Wt(s,n){let t=typeof s==="object"&&s!==null&&(("name"in s)&&s.name&&String(s.name)||("url"in s)&&s.url&&String(s.url)||("filename"in s)&&s.filename&&String(s.filename)||("path"in s)&&s.path&&String(s.path))||"";return n?t.split(/[\\/]/).pop()||void 0:t}var li=(s)=>s!=null&&typeof s==="object"&&typeof s[Symbol.asyncIterator]==="function";var ye=async(s,n,t=!0)=>({...s,body:await Bc(s.body,n,t)}),ha=new WeakMap;function Dc(s){let n=typeof s==="function"?s:s.fetch,t=ha.get(n);if(t)return t;let i=(async()=>{try{let c="Response"in n?n.Response:(await n("data:,")).constructor,l=new FormData;if(l.toString()===await new c(l).text())return!1;return!0}catch{return!0}})();return ha.set(n,i),i}var Bc=async(s,n,t=!0)=>{if(!await Dc(n))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let i=new FormData;return await Promise.all(Object.entries(s||{}).map(([c,l])=>ai(i,c,l,t))),i};var ai=async(s,n,t,i)=>{if(t===void 0)return;if(t==null)throw TypeError(`Received null for "${n}"; to pass null in FormData, you must use the string 'null'`);if(typeof t==="string"||typeof t==="number"||typeof t==="boolean")s.append(n,String(t));else if(t instanceof Response){let c={},l=t.headers.get("Content-Type");if(l)c={type:l};s.append(n,tt([await t.blob()],Wt(t,i),c))}else if(li(t))s.append(n,tt([await new Response(un(t)).blob()],Wt(t,i)));else if(t instanceof Blob){let l=typeof File<"u"&&t instanceof File?t.name:Wt(t,i);s.append(n,tt([t],l,{type:t.type}))}else if(Array.isArray(t))await Promise.all(t.map((c)=>ai(s,n+"[]",c,i)));else if(typeof t.then==="function")throw TypeError(`Received a Promise for "${n}"; await it first, e.g. \`await toFile(...)\``);else if(t instanceof ArrayBuffer||ArrayBuffer.isView(t))throw TypeError(`Received ${t.constructor.name} for "${n}"; to upload raw bytes, wrap them with \`await toFile(bytes, 'filename')\``);else if(typeof t==="object")await Promise.all(Object.entries(t).map(([c,l])=>ai(s,`${n}[${c}]`,l,i)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${t} instead`)};var fa=(s)=>s!=null&&typeof s==="object"&&typeof s.size==="number"&&typeof s.type==="string"&&typeof s.text==="function"&&typeof s.slice==="function"&&typeof s.arrayBuffer==="function",Wc=(s)=>s!=null&&typeof s==="object"&&typeof s.name==="string"&&typeof s.lastModified==="number"&&fa(s),Uc=(s)=>s!=null&&typeof s==="object"&&typeof s.url==="string"&&typeof s.blob==="function";async function di(s,n,t){if(ci(),s=await s,n||(n=s instanceof File?s.name:Wt(s,!0)),Wc(s)){if(s instanceof File&&n==null&&t==null)return s;return tt([await s.arrayBuffer()],n??s.name,{type:s.type,lastModified:s.lastModified,...t})}if(Uc(s)){let c=await s.blob();return n||(n=new URL(s.url).pathname.split(/[\\/]/).pop()),tt(await ui(c),n,t)}let i=await ui(s);if(!t?.type){let c=i.find((l)=>typeof l==="object"&&("type"in l)&&l.type);if(typeof c==="string")t={...t,type:c}}return tt(i,n,t)}async function ui(s){let n=[];if(typeof s==="string"||ArrayBuffer.isView(s)||s instanceof ArrayBuffer)n.push(s);else if(fa(s))n.push(s instanceof Blob?s:await s.arrayBuffer());else if(li(s))for await(let t of s)n.push(...await ui(t));else{let t=s?.constructor?.name;throw Error(`Unexpected data type: ${typeof s}${t?`; constructor: ${t}`:""}${jc(s)}`)}return n}function jc(s){if(typeof s!=="object"||s===null)return"";return`; props: [${Object.getOwnPropertyNames(s).map((t)=>`"${t}"`).join(", ")}]`}class A{constructor(s){this._client=s}}var pa=Symbol.for("brand.privateNullableHeaders");function*Kc(s){if(!s)return;if(pa in s){let{values:i,nulls:c}=s;yield*i.entries();for(let l of c)yield[l,null];return}let n=!1,t;if(s instanceof Headers)t=s.entries();else if(is(s))t=s;else n=!0,t=Object.entries(s??{});for(let i of t){let c=i[0];if(typeof c!=="string")throw TypeError("expected header name to be a string");let l=is(i[1])?i[1]:[i[1]],u=!1;for(let d of l){if(d===void 0)continue;if(n&&!u)u=!0,yield[c,Sn];yield[c,d]}}}var Sn=Symbol("clear"),zc=new Set(["x-stainless-helper"]),Vc=(s,n)=>{let t=s?s.split(",").map((i)=>i.trim()).filter(Boolean):[];for(let i of n.split(",").map((c)=>c.trim()))if(i&&!t.includes(i))t.push(i);return t.join(", ")},f=(s)=>{let n=new Headers,t=new Set;for(let i of s){let c=new Set;for(let[l,u]of Kc(i)){let d=l.toLowerCase();if(zc.has(d)){if(u===Sn)continue;if(u===null)n.delete(l),t.add(d);else n.set(l,Vc(n.get(l),u)),t.delete(d);continue}if(u===Sn||!c.has(d)){if(n.delete(l),c.add(d),u===Sn)continue}if(u===null)n.delete(l),t.add(d);else n.append(l,u),t.delete(d)}}return{[pa]:!0,values:n,nulls:t}};function _a(s){return s.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var ma=Object.freeze(Object.create(null)),Yc=(s=_a)=>function(t,...i){if(t.length===1)return t[0];let c=!1,l=[],u=t.reduce((x,_,b)=>{if(/[?#]/.test(_))c=!0;let w=i[b],S=(c?encodeURIComponent:s)(""+w);if(b!==i.length&&(w==null||typeof w==="object"&&w.toString===Object.getPrototypeOf(Object.getPrototypeOf(w.hasOwnProperty??ma)??ma)?.toString))S=w+"",l.push({start:x.length+_.length,length:S.length,error:`Value of type ${Object.prototype.toString.call(w).slice(8,-1)} is not a valid path parameter`});return x+_+(b===i.length?"":S)},""),d=u.split(/[?#]/,1)[0],h=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,g;while((g=h.exec(d))!==null)l.push({start:g.index,length:g[0].length,error:`Value "${g[0]}" can't be safely passed as a path parameter`});if(l.sort((x,_)=>x.start-_.start),l.length>0){let x=0,_=l.reduce((b,w)=>{let S=" ".repeat(w.start-x),P="^".repeat(w.length);return x=w.start+w.length,b+S+P},"");throw new p(`Path parameters result in path with invalid segments:
7
+ ${l.map((b)=>b.error).join(`
8
+ `)}
9
+ ${u}
10
+ ${_}`)}return u},m=Yc(_a);class Ut extends A{retrieve(s,n={},t){let{betas:i,workspace_id:c}=n??{};return this._client.get(m`/v1/deployment_runs/${s}?beta=true`,{...t,headers:f([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}list(s={},n){let{betas:t,workspace_id:i,...c}=s??{};return this._client.getAPIList("/v1/deployment_runs?beta=true",T,{query:c,...n,headers:f([{"anthropic-beta":[...t??[],"managed-agents-2026-04-01"].toString(),...i!=null?{"anthropic-workspace-id":i}:void 0},n?.headers])})}}class jt extends A{create(s,n){let{betas:t,workspace_id:i,...c}=s;return this._client.post("/v1/deployments?beta=true",{body:c,...n,headers:f([{"anthropic-beta":[...t??[],"managed-agents-2026-04-01"].toString(),...i!=null?{"anthropic-workspace-id":i}:void 0},n?.headers])})}retrieve(s,n={},t){let{betas:i,workspace_id:c}=n??{};return this._client.get(m`/v1/deployments/${s}?beta=true`,{...t,headers:f([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}update(s,n,t){let{betas:i,workspace_id:c,...l}=n;return this._client.post(m`/v1/deployments/${s}?beta=true`,{body:l,...t,headers:f([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}list(s={},n){let{betas:t,workspace_id:i,...c}=s??{};return this._client.getAPIList("/v1/deployments?beta=true",T,{query:c,...n,headers:f([{"anthropic-beta":[...t??[],"managed-agents-2026-04-01"].toString(),...i!=null?{"anthropic-workspace-id":i}:void 0},n?.headers])})}archive(s,n={},t){let{betas:i,workspace_id:c}=n??{};return this._client.post(m`/v1/deployments/${s}/archive?beta=true`,{...t,headers:f([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}pause(s,n={},t){let{betas:i,workspace_id:c}=n??{};return this._client.post(m`/v1/deployments/${s}/pause?beta=true`,{...t,headers:f([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}run(s,n={},t){let{betas:i,workspace_id:c}=n??{};return this._client.post(m`/v1/deployments/${s}/run?beta=true`,{...t,headers:f([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}unpause(s,n={},t){let{betas:i,workspace_id:c}=n??{};return this._client.post(m`/v1/deployments/${s}/unpause?beta=true`,{...t,headers:f([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}}class qt extends A{create(s,n){let{betas:t,workspace_id:i,...c}=s;return this._client.post("/v1/dreams?beta=true",{body:c,...n,headers:f([{"anthropic-beta":[...t??[],"dreaming-2026-04-21"].toString(),...i!=null?{"anthropic-workspace-id":i}:void 0},n?.headers])})}retrieve(s,n={},t){let{betas:i,workspace_id:c}=n??{};return this._client.get(m`/v1/dreams/${s}?beta=true`,{...t,headers:f([{"anthropic-beta":[...i??[],"dreaming-2026-04-21"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}list(s={},n){let{betas:t,workspace_id:i,...c}=s??{};return this._client.getAPIList("/v1/dreams?beta=true",T,{query:c,...n,headers:f([{"anthropic-beta":[...t??[],"dreaming-2026-04-21"].toString(),...i!=null?{"anthropic-workspace-id":i}:void 0},n?.headers])})}archive(s,n={},t){let{betas:i,workspace_id:c}=n??{};return this._client.post(m`/v1/dreams/${s}/archive?beta=true`,{...t,headers:f([{"anthropic-beta":[...i??[],"dreaming-2026-04-21"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}cancel(s,n={},t){let{betas:i,workspace_id:c}=n??{};return this._client.post(m`/v1/dreams/${s}/cancel?beta=true`,{...t,headers:f([{"anthropic-beta":[...i??[],"dreaming-2026-04-21"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}}var vn="x-stainless-helper",dt="x-stainless-helper-method";function xn(s){return{["x-stainless-helper"]:s}}var ut=Symbol("anthropic.sdk.stainlessHelper");function zt(s){return typeof s==="object"&&s!==null&&ut in s}function hi(s,n){let t=new Set;if(s){for(let i of s)if(zt(i))t.add(i[ut])}if(n)for(let i of n){if(zt(i))t.add(i[ut]);let c=i.content;if(Array.isArray(c))for(let l of c){if(zt(l))t.add(l[ut]);let u=l?.tool?.definition;if(zt(u))t.add(u[ut])}}return Array.from(t)}function En(s,n){let t=hi(s,n);if(t.length===0)return{};return{["x-stainless-helper"]:t.join(", ")}}function An(s){if(zt(s))return{["x-stainless-helper"]:s[ut]};return{}}class Jt extends A{list(s={},n){let{betas:t,workspace_id:i,...c}=s??{};return this._client.getAPIList("/v1/files?beta=true",T,{query:c,...n,headers:f([{...t?.toString()!=null?{"anthropic-beta":t?.toString()}:void 0,...i!=null?{"anthropic-workspace-id":i}:void 0},n?.headers])})}delete(s,n={},t){let{betas:i,workspace_id:c}=n??{};return this._client.delete(m`/v1/files/${s}?beta=true`,{...t,headers:f([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}download(s,n={},t){let{betas:i,workspace_id:c}=n??{};return this._client.get(m`/v1/files/${s}/content?beta=true`,{...t,headers:f([{Accept:"application/binary",...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers]),__binaryResponse:!0})}retrieveMetadata(s,n={},t){let{betas:i,workspace_id:c}=n??{};return this._client.get(m`/v1/files/${s}?beta=true`,{...t,headers:f([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}upload(s,n){let{betas:t,workspace_id:i,...c}=s;return this._client.post("/v1/files?beta=true",ye({body:c,...n,headers:f([{...t?.toString()!=null?{"anthropic-beta":t?.toString()}:void 0,...i!=null?{"anthropic-workspace-id":i}:void 0},An(c.file),n?.headers])},this._client))}}class Xt extends A{retrieve(s,n={},t){let{betas:i,workspace_id:c}=n??{};return this._client.get(m`/v1/models/${s}?beta=true`,{...t,headers:f([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}list(s={},n){let{betas:t,workspace_id:i,...c}=s??{};return this._client.getAPIList("/v1/models?beta=true",Z,{query:c,...n,headers:f([{...t?.toString()!=null?{"anthropic-beta":t?.toString()}:void 0,...i!=null?{"anthropic-workspace-id":i}:void 0},n?.headers])})}}class Zt extends A{create(s,n){let{betas:t,workspace_id:i,...c}=s;return this._client.post("/v1/user_profiles?beta=true",{body:c,...n,headers:f([{"anthropic-beta":[...t??[],"user-profiles-2026-08-18"].toString(),...i!=null?{"anthropic-workspace-id":i}:void 0},n?.headers])})}retrieve(s,n={},t){let{betas:i,workspace_id:c}=n??{};return this._client.get(m`/v1/user_profiles/${s}?beta=true`,{...t,headers:f([{"anthropic-beta":[...i??[],"user-profiles-2026-08-18"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}update(s,n,t){let{betas:i,workspace_id:c,...l}=n;return this._client.post(m`/v1/user_profiles/${s}?beta=true`,{body:l,...t,headers:f([{"anthropic-beta":[...i??[],"user-profiles-2026-08-18"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}list(s={},n){let{betas:t,workspace_id:i,...c}=s??{};return this._client.getAPIList("/v1/user_profiles?beta=true",T,{query:c,...n,headers:f([{"anthropic-beta":[...t??[],"user-profiles-2026-08-18"].toString(),...i!=null?{"anthropic-workspace-id":i}:void 0},n?.headers])})}createEnrollmentURL(s,n={},t){let{betas:i,workspace_id:c}=n??{};return this._client.post(m`/v1/user_profiles/${s}/enrollment_url?beta=true`,{...t,headers:f([{"anthropic-beta":[...i??[],"user-profiles-2026-08-18"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}}var Ca=a(Pa(),1);class rr extends A{parseUnverified(s){return JSON.parse(s)}unwrap(s,n){let t=n?.headers;if(t==null)throw Error("Webhook headers are required in order to verify the signature");let i=n.key===void 0?this._client.webhookKey:n.key;if(!i)throw Error("Webhook key must not be null or empty in order to unwrap");return new Ca.Webhook(i).verify(s,t),JSON.parse(s)}}class nr extends A{list(s,n={},t){let{betas:i,workspace_id:c,...l}=n??{};return this._client.getAPIList(m`/v1/agents/${s}/versions?beta=true`,T,{query:l,...t,headers:f([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}}var Tn=(()=>{class s extends A{constructor(){super(...arguments);this.versions=new nr(this._client)}create(n,t){let{betas:i,workspace_id:c,...l}=n;return this._client.post("/v1/agents?beta=true",{body:l,...t,headers:f([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}retrieve(n,t={},i){let{betas:c,workspace_id:l,...u}=t??{};return this._client.get(m`/v1/agents/${n}?beta=true`,{query:u,...i,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}update(n,t,i){let{betas:c,workspace_id:l,...u}=t;return this._client.post(m`/v1/agents/${n}?beta=true`,{body:u,...i,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}list(n={},t){let{betas:i,workspace_id:c,...l}=n??{};return this._client.getAPIList("/v1/agents?beta=true",T,{query:l,...t,headers:f([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}archive(n,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.post(m`/v1/agents/${n}/archive?beta=true`,{...i,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}}return s.Versions=nr,s})();function qe(s,n){if(!s)return()=>{};if(s.aborted)return n.abort(),()=>{};let t=()=>n.abort();return s.addEventListener("abort",t),()=>s.removeEventListener("abort",t)}function Pn(s,{authToken:n,helper:t}){if(!n)throw new p(`copyClientForHelper: expected a non-empty authToken but received ${JSON.stringify(n)}`);let i=s,c=i._options.defaultHeaders,l=i._authState?.extraHeaders,u=l?Object.fromEntries(Object.entries(l).filter(([h])=>{let g=h.toLowerCase();return g!=="authorization"&&g!=="x-api-key"})):void 0,d=f([u,c,{[vn]:t}]);return s.withOptions({apiKey:null,authToken:n,baseURL:s.baseURL,credentials:void 0,defaultHeaders:d})}var ft,Cn,be,On,Mn,$n,sr,ir,pt,mt,Fn,_t,or,hl=999,fl=1000,pl=60000,ml=300000,ar=(()=>{class s{constructor(n){ft.set(this,void 0),Cn.set(this,!1),be.set(this,void 0),On.set(this,void 0),Mn.set(this,void 0),$n.set(this,void 0),sr.set(this,void 0),ir.set(this,void 0),pt.set(this,void 0),this.client=n.client,this.environmentId=n.environmentId,this.environmentKey=n.environmentKey,this.workerId=n.workerId??wl(),o(this,ft,Pn(n.client,{authToken:n.environmentKey,helper:"environments-work-poller"}),"f"),o(this,Mn,n.autoStop??!0,"f"),o(this,$n,n.drain??!1,"f"),o(this,sr,n.blockMs===void 0?hl:n.blockMs,"f"),o(this,ir,n.reclaimOlderThanMs??null,"f"),o(this,pt,n.requestOptions,"f"),o(this,be,new AbortController,"f"),o(this,On,qe(n.signal,e(this,be,"f")),"f")}get signal(){return e(this,be,"f").signal}abort(){e(this,be,"f").abort()}async*[(ft=new WeakMap,Cn=new WeakMap,be=new WeakMap,On=new WeakMap,Mn=new WeakMap,$n=new WeakMap,sr=new WeakMap,ir=new WeakMap,pt=new WeakMap,Symbol.asyncIterator)](){if(e(this,Cn,"f"))throw new p("Cannot iterate over a consumed WorkPoller");o(this,Cn,!0,"f");let n=D(this.client);n.info("poller starting",{component:"work-poller",environment_id:this.environmentId});let t=new gl(n,this.environmentId);try{let i=0;while(!e(this,be,"f").signal.aborted){let c;try{c=await e(this,ft,"f").beta.environments.work.poll(this.environmentId,{"Anthropic-Worker-ID":this.workerId,...e(this,sr,"f")!==null?{block_ms:e(this,sr,"f")}:{},...e(this,ir,"f")!==null?{reclaim_older_than_ms:e(this,ir,"f")}:{}},{headers:f([e(this,pt,"f")?.headers]),signal:e(this,be,"f").signal})}catch(l){if(e(this,be,"f").signal.aborted)return;if(hr(l))throw n.error("poll failed permanently, stopping poller",{error:String(l)}),l;let u=Yo(_l(i));n.warn("poll failed, backing off",{error:String(l),backoff_ms:u}),i++,await Re(u,e(this,be,"f").signal);continue}if(i=0,c==null){if(e(this,$n,"f"))return;t.onEmptyPoll(),await Re(sa(1000,3000),e(this,be,"f").signal);continue}t.onClaim(),n.info("claimed work",{component:"work-poller",environment_id:this.environmentId,work_id:c.id,work_type:c.data.type});try{await e(this,ft,"f").beta.environments.work.ack(c.id,{environment_id:c.environment_id},{headers:f([e(this,pt,"f")?.headers]),signal:e(this,be,"f").signal})}catch(l){n.error("ack failed",{work_id:c.id,error:String(l)});continue}try{yield c}finally{if(e(this,Mn,"f"))try{await e(this,ft,"f").beta.environments.work.stop(c.id,{environment_id:c.environment_id},{headers:f([e(this,pt,"f")?.headers])})}catch(l){if(!Se(l,409))n.warn("stop failed",{work_id:c.id,error:String(l)})}}}}finally{e(this,On,"f").call(this)}}}return s})();function _l(s){return Qo(s,fl,pl)}var gl=(()=>{class s{constructor(n,t){mt.set(this,void 0),Fn.set(this,void 0),_t.set(this,void 0),or.set(this,0),o(this,mt,n,"f"),o(this,Fn,t,"f")}onEmptyPoll(){let n=Date.now(),t={component:"work-poller",environment_id:e(this,Fn,"f")};if(e(this,_t,"f")===void 0)o(this,_t,o(this,or,n,"f"),"f"),e(this,mt,"f").info("idle; polling for work",t);else if(n-e(this,or,"f")>=ml)o(this,or,n,"f"),e(this,mt,"f").info(`still polling; idle for ${Math.round((n-e(this,_t,"f"))/1000)}s`,t);else e(this,mt,"f").debug("poll returned no work",t)}onClaim(){o(this,_t,void 0,"f")}}return mt=new WeakMap,Fn=new WeakMap,_t=new WeakMap,or=new WeakMap,s})();function wl(){let n=globalThis.process?.env?.HOSTNAME;return n?`${n}-${gn()}`:gn()}var gt,ze,wt,Oa=(()=>{class s{constructor(){gt.set(this,[]),ze.set(this,[]),wt.set(this,!1)}push(n){if(e(this,wt,"f"))return!1;let t=e(this,ze,"f").shift();if(t)t({done:!1,value:n});else e(this,gt,"f").push(n);return!0}close(){if(e(this,wt,"f"))return;o(this,wt,!0,"f");while(e(this,ze,"f").length>0)e(this,ze,"f").shift()({done:!0,value:void 0})}next(n){if(e(this,gt,"f").length>0)return Promise.resolve({done:!1,value:e(this,gt,"f").shift()});if(e(this,wt,"f")||n?.aborted)return Promise.resolve({done:!0,value:void 0});return new Promise((t)=>{let i=(l)=>{n?.removeEventListener("abort",c),t(l)},c=()=>{let l=e(this,ze,"f").indexOf(i);if(l>=0)e(this,ze,"f").splice(l,1);t({done:!0,value:void 0})};e(this,ze,"f").push(i),n?.addEventListener("abort",c,{once:!0})})}tryShift(){return e(this,gt,"f").shift()}}return gt=new WeakMap,ze=new WeakMap,wt=new WeakMap,s})();function mi(s){return"name"in s?s.name:("mcp_server_name"in s)?s.mcp_server_name:s.type}function yl(s){return s instanceof I?s.content:`Error: ${s instanceof Error?s.message:String(s)}`}async function Ma(s,n,t){try{let i=s.parse?s.parse(n):n;return{content:await s.run(i,t),isError:!1}}catch(i){return{content:yl(i),isError:!0}}}var cr,Hn,yt,rt,Pe,z,Bn,ee,Wn,lr,Un,X,bt,fe,kt,Ve,St,We,qn,ur,ke,Kn,Na,La,$a,Fa,_i,Ha,zn,Vn,gi,Da,Ba;var Wa=500,bl=1e4,kl=120000,Sl=30000,vl=1000,xl=30000,El=300000,Al=60000;function Ua(s){return s.type==="session.status_idle"&&s.stop_reason?.type==="end_turn"}var Rl=(()=>{class s{constructor(n,t){cr.set(this,void 0),Hn.set(this,void 0),yt.set(this,new Set),rt.set(this,!1),Pe.set(this,void 0),o(this,cr,n,"f"),o(this,Hn,t,"f")}noteEvent(n){if(n.type==="user.tool_confirmation")return;if(Ua(n))this.arm();else this.disarm()}block(n){if(e(this,yt,"f").add(n),e(this,Pe,"f")!==void 0)o(this,rt,!0,"f"),clearTimeout(e(this,Pe,"f")),o(this,Pe,void 0,"f")}unblock(n){if(e(this,yt,"f").delete(n),e(this,yt,"f").size===0&&e(this,rt,"f"))this.arm()}arm(){if(e(this,cr,"f")<=0)return;if(e(this,yt,"f").size>0){o(this,rt,!0,"f");return}if(o(this,rt,!1,"f"),e(this,Pe,"f")!==void 0)clearTimeout(e(this,Pe,"f"));o(this,Pe,setTimeout(e(this,Hn,"f"),e(this,cr,"f")),"f")}disarm(){if(o(this,rt,!1,"f"),e(this,Pe,"f")!==void 0)clearTimeout(e(this,Pe,"f")),o(this,Pe,void 0,"f")}}return cr=new WeakMap,Hn=new WeakMap,yt=new WeakMap,rt=new WeakMap,Pe=new WeakMap,s})(),pr=(()=>{class s{constructor(n,t){z.add(this),Bn.set(this,!1),ee.set(this,void 0),Wn.set(this,void 0),lr.set(this,void 0),Un.set(this,void 0),X.set(this,void 0),bt.set(this,new Set),fe.set(this,new Set),kt.set(this,new Map),Ve.set(this,new Map),St.set(this,new Oa),We.set(this,0),qn.set(this,El),ur.set(this,null),ke.set(this,void 0),this.client=t.client,this.sessionId=n,this.tools=t.tools,this.maxIdleMs=t.maxIdleMs??Al,o(this,X,D(t.client),"f"),o(this,Un,new Map(t.tools.map((i)=>[mi(i),i])),"f"),o(this,ee,new AbortController,"f"),o(this,Wn,qe(t.signal,e(this,ee,"f")),"f"),o(this,lr,t.requestOptions,"f"),o(this,ke,new Rl(this.maxIdleMs,()=>{e(this,X,"f").info("session idle after end_turn; stopping",{component:"session-tool-runner",session_id:this.sessionId,max_idle_ms:this.maxIdleMs}),e(this,ee,"f").abort()}),"f")}get signal(){return e(this,ee,"f").signal}abort(){e(this,ee,"f").abort()}_setSendRetryWindow(n){o(this,qn,n,"f")}async*[(Bn=new WeakMap,ee=new WeakMap,Wn=new WeakMap,lr=new WeakMap,Un=new WeakMap,X=new WeakMap,bt=new WeakMap,fe=new WeakMap,kt=new WeakMap,Ve=new WeakMap,St=new WeakMap,We=new WeakMap,qn=new WeakMap,ur=new WeakMap,ke=new WeakMap,z=new WeakSet,Symbol.asyncIterator)](){if(e(this,Bn,"f"))throw new p("Cannot iterate over a consumed SessionToolRunner");o(this,Bn,!0,"f"),e(this,X,"f").info("session tool runner starting",{component:"session-tool-runner",session_id:this.sessionId});let n=e(this,z,"m",Na).call(this).catch((t)=>{if(!e(this,ee,"f").signal.aborted)e(this,X,"f").error("stream loop failed",{error:String(t)});e(this,ee,"f").abort()});try{while(!0){let i=await e(this,St,"f").next(e(this,ee,"f").signal);if(i.done)break;yield i.value}await n;let t;while((t=e(this,St,"f").tryShift())!==void 0)yield t}finally{e(this,ee,"f").abort(),e(this,ke,"f").disarm(),await n;try{await e(this,z,"m",Ba).call(this)}catch(t){e(this,X,"f").warn("drain failed",{error:String(t)})}e(this,St,"f").close();for(let t of this.tools)try{await t.close?.()}catch(i){e(this,X,"f").warn("tool.close failed",{tool:mi(t),error:String(i)})}e(this,Wn,"f").call(this)}}}return Kn=function(){return{...e(this,lr,"f"),headers:f([xn("session-tool-runner"),e(this,lr,"f")?.headers]),signal:e(this,ee,"f").signal}},Na=async function(){let t=e(this,ee,"f"),i=Wa;while(!t.signal.aborted){try{let c=await this.client.beta.sessions.events.stream(this.sessionId,{},e(this,z,"m",Kn).call(this));await e(this,z,"m",La).call(this);for await(let l of c)if(i=Wa,await e(this,z,"m",Fa).call(this,l))return}catch(c){if(t.signal.throwIfAborted(),hr(c))throw e(this,X,"f").error("permanent stream failure, shutting down",{error:String(c)}),t.abort(),c;e(this,X,"f").warn("stream disconnected, reconnecting",{error:String(c),backoff_ms:i})}t.signal.throwIfAborted(),await Re(i,t.signal),i=Math.min(i*2,bl)}},La=async function(){let t=e(this,ee,"f"),i=[],c=!1;try{for await(let d of this.client.beta.sessions.events.list(this.sessionId,{limit:1000},e(this,z,"m",Kn).call(this)))e(this,z,"m",$a).call(this,d,i),c=Ua(d)}catch(d){t.signal.throwIfAborted(),e(this,X,"f").warn("reconcile list failed",{error:String(d)});for(let h of i)e(this,bt,"f").delete(h.id);return}let l=i.filter((d)=>!e(this,fe,"f").has(d.id));e(this,ke,"f").disarm();for(let d of l)await e(this,z,"m",_i).call(this,d);for(let d of[...e(this,Ve,"f").values()]){let h=e(this,kt,"f").get(d.id);if(h!==void 0)await e(this,z,"m",zn).call(this,d,h)}let u=l.filter((d)=>!e(this,fe,"f").has(d.id)&&!e(this,Ve,"f").has(d.id));if(c&&u.length===0)e(this,ke,"f").arm();else e(this,ke,"f").disarm()},$a=function(t,i){if(t.type==="agent.tool_use"||t.type==="agent.custom_tool_use"){if(e(this,bt,"f").add(t.id),!e(this,fe,"f").has(t.id))i.push(t)}else if(t.type==="user.tool_result")e(this,fe,"f").add(t.tool_use_id);else if(t.type==="user.custom_tool_result")e(this,fe,"f").add(t.custom_tool_use_id);else if(t.type==="user.tool_confirmation"){if(!e(this,fe,"f").has(t.tool_use_id))e(this,kt,"f").set(t.tool_use_id,t.result)}},Fa=async function(t){switch(e(this,ke,"f").noteEvent(t),t.type){case"agent.tool_use":case"agent.custom_tool_use":if(!e(this,bt,"f").has(t.id))e(this,bt,"f").add(t.id),await e(this,z,"m",_i).call(this,t);return!1;case"user.tool_confirmation":return await e(this,z,"m",Ha).call(this,t),!1;case"user.tool_result":return e(this,fe,"f").add(t.tool_use_id),!1;case"user.custom_tool_result":return e(this,fe,"f").add(t.custom_tool_use_id),!1;case"session.status_terminated":case"session.deleted":return e(this,X,"f").info("session terminated",{component:"session-tool-runner",session_id:this.sessionId}),e(this,ee,"f").abort(),!0;default:return!1}},_i=async function(t){let i=t.evaluated_permission,c=i==="deny"?"deny":e(this,kt,"f").get(t.id);if(c===void 0){if(i===void 0||i==="allow")await e(this,z,"m",gi).call(this,t,void 0);else if(!e(this,Ve,"f").has(t.id))e(this,X,"f").info("tool call awaiting confirmation; holding",{component:"session-tool-runner",session_id:this.sessionId,tool:t.name,tool_use_id:t.id}),e(this,Ve,"f").set(t.id,t),e(this,ke,"f").block(t.id);return}await e(this,z,"m",zn).call(this,t,c)},Ha=async function(t){e(this,kt,"f").set(t.tool_use_id,t.result);let i=e(this,Ve,"f").get(t.tool_use_id);if(i===void 0)return;await e(this,z,"m",zn).call(this,i,t.result)},zn=async function(t,i){let c=e(this,Ve,"f").delete(t.id);if(i==="allow"){if(e(this,X,"f").info("tool call confirmed",{component:"session-tool-runner",session_id:this.sessionId,tool:t.name,tool_use_id:t.id}),!c)e(this,ke,"f").block(t.id);try{await e(this,z,"m",gi).call(this,t,"allow")}finally{e(this,ke,"f").unblock(t.id)}return}if(c)e(this,ke,"f").unblock(t.id);e(this,fe,"f").add(t.id),e(this,X,"f").info("tool call denied; not executing",{component:"session-tool-runner",session_id:this.sessionId,tool:t.name,tool_use_id:t.id}),e(this,z,"m",Vn).call(this,{event:t,toolUseId:t.id,name:t.name,isError:!1,posted:!1,confirmation:"deny"})},Vn=function(t){e(this,St,"f").push(t)},gi=async function(t,i){var c,l;if(e(this,fe,"f").has(t.id))return;e(this,X,"f").info("executing tool",{component:"session-tool-runner",session_id:this.sessionId,tool:t.name,tool_use_id:t.id}),o(this,We,(c=e(this,We,"f"),c++,c),"f");try{let u=e(this,Un,"f").get(t.name);if(!u){e(this,X,"f").info("tool not owned by this runner; leaving the tool_use_id pending for its owner",{component:"session-tool-runner",session_id:this.sessionId,tool:t.name,tool_use_id:t.id}),e(this,z,"m",Vn).call(this,{event:t,toolUseId:t.id,name:t.name,isError:!1,posted:!1,confirmation:i});return}let d,h,g=new AbortController,x=qe(e(this,ee,"f").signal,g),_=setTimeout(()=>g.abort(),kl);try{let S=await Ma(u,t.input,{toolUse:t,toolUseBlock:t,signal:g.signal});d=S.content,h=S.isError}finally{clearTimeout(_),x()}let b=Il(t,h,Tl(d)),w=await e(this,z,"m",Da).call(this,b,t.id);e(this,z,"m",Vn).call(this,{event:t,result:b,toolUseId:t.id,name:t.name,isError:h,posted:w,confirmation:i})}finally{if(o(this,We,(l=e(this,We,"f"),l--,l),"f"),e(this,We,"f")===0)e(this,ur,"f")?.call(this)}},Da=async function(t,i){let c=e(this,ee,"f"),l=Date.now(),u,d=0;while(!0){d++,c.signal.throwIfAborted();try{return await this.client.beta.sessions.events.send(this.sessionId,{events:[t]},e(this,z,"m",Kn).call(this)),e(this,fe,"f").add(i),!0}catch(h){if(u=h,hr(h))break;let g=e(this,qn,"f")-(Date.now()-l);if(g<=0)break;let x=Math.min(Yo(Qo(d-1,vl,xl)),g);e(this,X,"f").warn("tool result send failed; retrying",{tool_use_id:i,attempt:d,backoff_ms:x,error:String(h)}),await Re(x,c.signal)}}return e(this,X,"f").error("failed to send tool result",{tool_use_id:i,attempts:d,error:String(u)}),!1},Ba=async function(){if(e(this,We,"f")===0)return;if(await Promise.race([new Promise((t)=>o(this,ur,t,"f")),Re(Sl)]),o(this,ur,null,"f"),e(this,We,"f")>0)e(this,X,"f").warn("drain timeout exceeded")},s})();function Il(s,n,t){if(s.type==="agent.custom_tool_use")return{type:"user.custom_tool_result",custom_tool_use_id:s.id,is_error:n,content:t};return{type:"user.tool_result",tool_use_id:s.id,is_error:n,content:t}}function Tl(s){if(typeof s==="string")return[{type:"text",text:s||"(no output)"}];let n=s.map((t)=>{if(t.type==="text")return{type:"text",text:t.text||"(no output)"};if(t.type==="image"||t.type==="document")return t;if(t.type==="search_result")return{type:"search_result",source:t.source,title:t.title,content:t.content.map((i)=>({type:"text",text:i.text})),citations:{enabled:t.citations?.enabled??!1}};return{type:"text",text:JSON.stringify(t)}});return n.length>0?n:[{type:"text",text:"(no output)"}]}var Yn,_r,wi,gr,vt,ja=30000,Pl=90000,Cl="NO_HEARTBEAT";function Ol(s){return s.resources.some((n)=>n.type==="memory_store")}function Ml(s){if(!s)return null;let n;try{let i=s.replace(/-/g,"+").replace(/_/g,"/"),c=i.padEnd(Math.ceil(i.length/4)*4,"=");n=JSON.parse(Kt(Ao(c)))}catch{return null}if(n===null||typeof n!=="object"||Array.isArray(n))return null;let t=n.sessions_token;return typeof t==="string"&&t!==""?t:null}var yi=(()=>{class s{constructor(n){if(Yn.add(this),_r.set(this,void 0),n.unrestrictedPaths!==void 0)throw new p("The `unrestrictedPaths` option you passed to EnvironmentWorker (or client.beta.environments.work.worker()) is no longer supported. The worker's file tools (read, write, edit, glob, grep) are now always confined to `workdir` plus the session's memory folders. Remove `unrestrictedPaths` from your options; to let the file tools reach any other directory, add it to `AgentToolContext.allowedRoots` from a `tools` factory.");if(this.client=n.client,this.environmentId=n.environmentId,this.environmentKey=n.environmentKey,this.tools=n.tools,this.workdir=n.workdir??process.cwd(),this.maxFileBytes=n.maxFileBytes,this.maxIdleMs=n.maxIdleMs,n.memorySyncIntervalMs!=null)Nn(n.memorySyncIntervalMs,"memorySyncIntervalMs");this.memorySyncIntervalMs=n.memorySyncIntervalMs,this.memorySyncDeletions=n.memorySyncDeletions??"enabled",this.workerId=n.workerId,this.requestOptions=n.requestOptions,o(this,_r,n.signal,"f")}async run(n){let{environmentId:t,environmentKey:i}=this;if(t===void 0||i===void 0)throw new p("EnvironmentWorker.run: environmentId and environmentKey are required to poll for work");let c=n??e(this,_r,"f"),l=new ar({client:this.client,environmentId:t,environmentKey:i,...this.workerId!==void 0?{workerId:this.workerId}:{},...c?{signal:c}:{},...this.requestOptions!==void 0?{requestOptions:this.requestOptions}:{},autoStop:!1});for await(let u of l)try{await e(this,Yn,"m",wi).call(this,u,i,l.signal)}catch(d){if(l.signal?.aborted)throw d;D(this.client).error("work item failed",{work_id:u.id,error:String(d)})}}async handleItem(n){let t=n?.workId??N("ANTHROPIC_WORK_ID"),i=n?.environmentId??N("ANTHROPIC_ENVIRONMENT_ID"),c=n?.sessionId??N("ANTHROPIC_SESSION_ID"),l=(n?.environmentKey??this.environmentKey??N("ANTHROPIC_ENVIRONMENT_KEY"))||void 0,u=n?.workSecret||N("ANTHROPIC_WORK_SECRET")||null;if(!t)throw new p("handleItem: workId is required \u2014 pass it or set ANTHROPIC_WORK_ID");if(!i)throw new p("handleItem: environmentId is required \u2014 pass it or set ANTHROPIC_ENVIRONMENT_ID");if(!c)throw new p("handleItem: sessionId is required \u2014 pass it or set ANTHROPIC_SESSION_ID");if(!l&&!u)throw new p("handleItem: environmentKey is required when there is no work secret \u2014 pass it, construct the worker with it, or set ANTHROPIC_ENVIRONMENT_KEY");let d={id:t,environment_id:i,secret:u,data:{type:"session",id:c}};await e(this,Yn,"m",wi).call(this,d,l,n?.signal??e(this,_r,"f"))}}return _r=new WeakMap,Yn=new WeakSet,wi=async function(t,i,c){let l=D(this.client),u=Ml(t.secret),d=u??i;if(d===void 0)throw new p("handleItem: the work item carried a secret payload but no sessions token could be extracted, and there is no environment key to fall back to; the poller must issue a secret whose payload carries `sessions_token`, or provide the environment key (pass it, construct the worker with it, or set ANTHROPIC_ENVIRONMENT_KEY)");if(t.secret&&u===null)l.warn("work item carried a secret payload but no sessions token could be extracted; falling back to the environment key",{work_id:t.id});let h=Pn(this.client,{authToken:d,helper:"environments-worker"}),g=t.data.id,x=new AbortController,_=qe(c,x),b=new Ll(x),w=await import("./chunk-jrwezx0r.js"),S,P,k=Fl(h,t,b,l,this.requestOptions,(O)=>{S=O,P?._setSendRetryWindow(O)}).catch((O)=>{if(!x.signal.aborted)l.error("heartbeat loop failed",{work_id:t.id,error:String(O)});x.abort()}),R=async()=>{},y,C=!1;try{if(t.data.type!=="session"){l.debug("skipping non-session work item",{work_id:t.id,type:t.data.type});return}let O=await h.beta.sessions.retrieve(g);if(u===null&&this.memorySyncIntervalMs!==null&&Ol(O))throw new w.SessionMemoryError(`cannot mount the session's memories: the work item carried no sessions token (work_id=${t.id}, session_id=${g}); the memory endpoints reject the environment key, so the poller must issue a per-item \`secret\` carrying \`sessions_token\`, or set \`memorySyncIntervalMs: null\` to run without memory`);let M={workdir:this.workdir,client:h,session:O,...this.maxFileBytes!==void 0?{maxFileBytes:this.maxFileBytes}:{}};try{R=await w.setupSkills(M)}catch(L){l.warn("skill setup failed",{session_id:g,work_id:t.id,error:String(L)})}if(u!==null&&this.memorySyncIntervalMs!==null)y=new w.SessionMemoryStores(h,{workdir:this.workdir,...this.memorySyncIntervalMs!==void 0?{syncIntervalMs:this.memorySyncIntervalMs}:{},syncDeletions:this.memorySyncDeletions}),await y.download(O),M.allowedRoots=y.roots,M.readOnlyRoots=y.readOnlyRoots;else l.debug("memory stores disabled for this item",{work_id:t.id});let q=typeof this.tools==="function"?this.tools(M):this.tools??w.betaAgentToolset20260401(M);if(P=new pr(g,{client:h,tools:q,...this.maxIdleMs!==void 0?{maxIdleMs:this.maxIdleMs}:{},...this.requestOptions!==void 0?{requestOptions:this.requestOptions}:{},signal:x.signal}),S!==void 0)P._setSendRetryWindow(S);for await(let L of P)if(y)await y.syncIfDue();C=!x.signal.aborted}finally{try{await R().catch((O)=>{l.warn("skill cleanup failed",{session_id:g,work_id:t.id,error:String(O)})})}finally{if(y){let O=w.MEMORY_FLUSH_TIMEOUT_MS;if(C){if(await qa(y.finish(),O))l.warn(`final memory sync cut off after ${O}ms; the flush that follows still uploads changed files`,{session_id:g,work_id:t.id})}let M=new AbortController;if(await qa(y.flushWrites(M.signal),O))M.abort(),l.warn(`memory flush cut off after ${O}ms; changed files it had not uploaded yet are not saved`,{session_id:g,work_id:t.id});await y.dispose().catch((L)=>{l.warn("memory store cleanup failed",{session_id:g,work_id:t.id,error:String(L)})})}}if(b.finish("runner_done"),_(),await k,b.lost)l.info("lease lost; released without stopping it",{session_id:g,work_id:t.id});else await Nl(h,t,l,this.requestOptions)}},s})();async function qa(s,n){let t;try{return await Promise.race([s.then(()=>!1,()=>!1),new Promise((i)=>{t=setTimeout(()=>i(!0),n)})])}finally{if(t!==void 0)clearTimeout(t)}}async function Nl(s,n,t,i){try{await s.beta.environments.work.stop(n.id,{environment_id:n.environment_id,force:!0},{...i,headers:f([i?.headers])})}catch(c){if(!Se(c,409))t.error("force-stop on exit failed",{work_id:n.id,error:String(c)})}}var Ll=(()=>{class s{constructor(n){gr.set(this,void 0),vt.set(this,void 0),o(this,gr,n,"f")}get signal(){return e(this,gr,"f").signal}finish(n){o(this,vt,e(this,vt,"f")??n,"f"),e(this,gr,"f").abort()}get lost(){return e(this,vt,"f")==="lease_lost"||e(this,vt,"f")==="assumed_lost"}}return gr=new WeakMap,vt=new WeakMap,s})();function $l(s){let n=s instanceof le?s.error:void 0;for(let t of["error","details","current_state"]){if(!as(n))return{};n=n[t]}return as(n)?n:{}}async function Fl(s,n,t,i,c,l){let u=ja,d=Pl,h=Date.now(),g=Cl,x=async()=>{let _=new AbortController,b=qe(t.signal,_),w=setTimeout(()=>_.abort(),u);try{let S=await s.beta.environments.work.heartbeat(n.id,{environment_id:n.environment_id,expected_last_heartbeat:g},{...c,headers:f([c?.headers]),signal:_.signal});if(h=Date.now(),g=S.last_heartbeat,S.ttl_seconds>0)d=S.ttl_seconds*1000,u=Math.max(1000,Math.min(d/2,ja)),l?.(d);if(S.state==="stopping"||S.state==="stopped")i.info("heartbeat signals shutdown",{work_id:n.id,state:S.state}),t.finish("control_plane_stop");if(!S.lease_extended)i.warn("lease not extended, shutting down",{work_id:n.id}),t.finish("control_plane_stop")}catch(S){if(t.signal.throwIfAborted(),Se(S,412)){let P=$l(S);i.error("lease lost: heartbeat precondition failed",{work_id:n.id,server_state:P.state,server_ttl_seconds:P.ttl_seconds,server_last_heartbeat:P.last_heartbeat}),t.finish("lease_lost");return}if(hr(S))throw i.error("permanent heartbeat failure",{work_id:n.id,error:String(S)}),t.finish("heartbeat_rejected"),S;if(Date.now()-h>d){i.error("lease assumed lost: no successful heartbeat in ttl",{work_id:n.id,ttl_ms:d,error:String(S)}),t.finish("assumed_lost");return}i.warn("transient heartbeat failure",{work_id:n.id,error:String(S)})}finally{clearTimeout(w),b()}};await x();while(!t.signal.aborted)await Re(u,t.signal),t.signal.throwIfAborted(),await x()}var Jn=(()=>{class s extends A{retrieve(n,t,i){let{environment_id:c,betas:l,workspace_id:u}=t;return this._client.get(m`/v1/environments/${c}/work/${n}?beta=true`,{...i,headers:f([{"anthropic-beta":[...l??[],"managed-agents-2026-04-01"].toString(),...u!=null?{"anthropic-workspace-id":u}:void 0},i?.headers])})}update(n,t,i){let{environment_id:c,betas:l,workspace_id:u,...d}=t;return this._client.post(m`/v1/environments/${c}/work/${n}?beta=true`,{body:d,...i,headers:f([{"anthropic-beta":[...l??[],"managed-agents-2026-04-01"].toString(),...u!=null?{"anthropic-workspace-id":u}:void 0},i?.headers])})}list(n,t={},i){let{betas:c,...l}=t??{};return this._client.getAPIList(m`/v1/environments/${n}/work?beta=true`,T,{query:l,...i,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}ack(n,t,i){let{environment_id:c,betas:l}=t;return this._client.post(m`/v1/environments/${c}/work/${n}/ack?beta=true`,{...i,headers:f([{"anthropic-beta":[...l??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}heartbeat(n,t,i){let{environment_id:c,desired_ttl_seconds:l,expected_last_heartbeat:u,betas:d}=t;return this._client.post(m`/v1/environments/${c}/work/${n}/heartbeat?beta=true`,{query:{desired_ttl_seconds:l,expected_last_heartbeat:u},...i,headers:f([{"anthropic-beta":[...d??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}poll(n,t={},i){let{betas:c,"Anthropic-Worker-ID":l,...u}=t??{};return this._client.get(m`/v1/environments/${n}/work/poll?beta=true`,{query:u,...i,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"Anthropic-Worker-ID":l}:void 0},i?.headers])})}stats(n,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.get(m`/v1/environments/${n}/work/stats?beta=true`,{...i,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}stop(n,t,i){let{environment_id:c,betas:l,workspace_id:u,...d}=t;return this._client.post(m`/v1/environments/${c}/work/${n}/stop?beta=true`,{body:d,...i,headers:f([{"anthropic-beta":[...l??[],"managed-agents-2026-04-01"].toString(),...u!=null?{"anthropic-workspace-id":u}:void 0},i?.headers])})}poller(n){return new ar({...n,client:this._client})}worker(n){return new yi({...n,client:this._client})}}return s.WorkPoller=ar,s.EnvironmentWorker=yi,s})();var Gn=(()=>{class s extends A{constructor(){super(...arguments);this.work=new Jn(this._client)}create(n,t){let{betas:i,workspace_id:c,...l}=n;return this._client.post("/v1/environments?beta=true",{body:l,...t,headers:f([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}retrieve(n,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.get(m`/v1/environments/${n}?beta=true`,{...i,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}update(n,t,i){let{betas:c,workspace_id:l,...u}=t;return this._client.post(m`/v1/environments/${n}?beta=true`,{body:u,...i,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}list(n={},t){let{betas:i,workspace_id:c,...l}=n??{};return this._client.getAPIList("/v1/environments?beta=true",T,{query:l,...t,headers:f([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}delete(n,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.delete(m`/v1/environments/${n}?beta=true`,{...i,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}archive(n,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.post(m`/v1/environments/${n}/archive?beta=true`,{...i,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}}return s.Work=Jn,s})();class wr extends A{create(s,n,t){let{view:i,betas:c,workspace_id:l,...u}=n;return this._client.post(m`/v1/memory_stores/${s}/memories?beta=true`,{query:{view:i},body:u,...t,headers:f([{"anthropic-beta":[...c??[],"agent-memory-2026-07-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}retrieve(s,n,t){let{memory_store_id:i,betas:c,workspace_id:l,...u}=n;return this._client.get(m`/v1/memory_stores/${i}/memories/${s}?beta=true`,{query:u,...t,headers:f([{"anthropic-beta":[...c??[],"agent-memory-2026-07-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}update(s,n,t){let{memory_store_id:i,view:c,betas:l,workspace_id:u,...d}=n;return this._client.post(m`/v1/memory_stores/${i}/memories/${s}?beta=true`,{query:{view:c},body:d,...t,headers:f([{"anthropic-beta":[...l??[],"agent-memory-2026-07-22"].toString(),...u!=null?{"anthropic-workspace-id":u}:void 0},t?.headers])})}list(s,n={},t){let{betas:i,workspace_id:c,...l}=n??{};return this._client.getAPIList(m`/v1/memory_stores/${s}/memories?beta=true`,T,{query:l,...t,headers:f([{"anthropic-beta":[...i??[],"agent-memory-2026-07-22"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}delete(s,n,t){let{memory_store_id:i,expected_content_sha256:c,betas:l,workspace_id:u}=n;return this._client.delete(m`/v1/memory_stores/${i}/memories/${s}?beta=true`,{query:{expected_content_sha256:c},...t,headers:f([{"anthropic-beta":[...l??[],"agent-memory-2026-07-22"].toString(),...u!=null?{"anthropic-workspace-id":u}:void 0},t?.headers])})}}class yr extends A{retrieve(s,n,t){let{memory_store_id:i,betas:c,workspace_id:l,...u}=n;return this._client.get(m`/v1/memory_stores/${i}/memory_versions/${s}?beta=true`,{query:u,...t,headers:f([{"anthropic-beta":[...c??[],"agent-memory-2026-07-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}list(s,n={},t){let{betas:i,workspace_id:c,...l}=n??{};return this._client.getAPIList(m`/v1/memory_stores/${s}/memory_versions?beta=true`,T,{query:l,...t,headers:f([{"anthropic-beta":[...i??[],"agent-memory-2026-07-22"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}redact(s,n,t){let{memory_store_id:i,betas:c,workspace_id:l}=n;return this._client.post(m`/v1/memory_stores/${i}/memory_versions/${s}/redact?beta=true`,{...t,headers:f([{"anthropic-beta":[...c??[],"agent-memory-2026-07-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}}var Xn=(()=>{class s extends A{constructor(){super(...arguments);this.memories=new wr(this._client),this.memoryVersions=new yr(this._client)}create(n,t){let{betas:i,workspace_id:c,...l}=n;return this._client.post("/v1/memory_stores?beta=true",{body:l,...t,headers:f([{"anthropic-beta":[...i??[],"agent-memory-2026-07-22"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}retrieve(n,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.get(m`/v1/memory_stores/${n}?beta=true`,{...i,headers:f([{"anthropic-beta":[...c??[],"agent-memory-2026-07-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}update(n,t,i){let{betas:c,workspace_id:l,...u}=t;return this._client.post(m`/v1/memory_stores/${n}?beta=true`,{body:u,...i,headers:f([{"anthropic-beta":[...c??[],"agent-memory-2026-07-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}list(n={},t){let{betas:i,workspace_id:c,...l}=n??{};return this._client.getAPIList("/v1/memory_stores?beta=true",T,{query:l,...t,headers:f([{"anthropic-beta":[...i??[],"agent-memory-2026-07-22"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}delete(n,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.delete(m`/v1/memory_stores/${n}?beta=true`,{...i,headers:f([{"anthropic-beta":[...c??[],"agent-memory-2026-07-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}archive(n,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.post(m`/v1/memory_stores/${n}/archive?beta=true`,{...i,headers:f([{"anthropic-beta":[...c??[],"agent-memory-2026-07-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}}return s.Memories=wr,s.MemoryVersions=yr,s})();var Qn=(()=>{class s{constructor(n,t){this.iterator=n,this.controller=t}async*decoder(){let n=new Ft;for await(let t of this.iterator)for(let i of n.decode(t))yield JSON.parse(i);for(let t of n.flush())yield JSON.parse(t)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse(n,t){if(!n.body){if(t.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new p("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new p("Attempted to iterate over a response with no body")}return new s($t(n.body),t)}}return s})();class br extends A{create(s,n){let{betas:t,user_profile_id:i,workspace_id:c,...l}=s;return this._client.post("/v1/messages/batches?beta=true",{body:l,...n,headers:f([{"anthropic-beta":[...t??[],"message-batches-2024-09-24"].toString(),...i!=null?{"anthropic-user-profile-id":i}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},n?.headers])})}retrieve(s,n={},t){let{betas:i,workspace_id:c}=n??{};return this._client.get(m`/v1/messages/batches/${s}?beta=true`,{...t,headers:f([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}list(s={},n){let{betas:t,workspace_id:i,...c}=s??{};return this._client.getAPIList("/v1/messages/batches?beta=true",Z,{query:c,...n,headers:f([{"anthropic-beta":[...t??[],"message-batches-2024-09-24"].toString(),...i!=null?{"anthropic-workspace-id":i}:void 0},n?.headers])})}delete(s,n={},t){let{betas:i,workspace_id:c}=n??{};return this._client.delete(m`/v1/messages/batches/${s}?beta=true`,{...t,headers:f([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}cancel(s,n={},t){let{betas:i,workspace_id:c}=n??{};return this._client.post(m`/v1/messages/batches/${s}/cancel?beta=true`,{...t,headers:f([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}async results(s,n={},t){let i=await this.retrieve(s,n,t);if(!i.results_url)throw new p(`No batch \`results_url\`; Has it finished processing? ${i.processing_status} - ${i.id}`);let{betas:c,workspace_id:l}=n??{};return this._client.get(i.results_url,{...t,headers:f([{"anthropic-beta":[...c??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary",...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((u,d)=>Qn.fromResponse(d.response,d.controller))}}var Zn={"claude-opus-4@20250514":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192};function Ka(s){return s?.output_format??s?.output_config?.format}function bi(s,n,t){let i=Ka(n);if(!n||!("parse"in(i??{})))return{...s,content:s.content.map((c)=>{if(c.type==="text"){let l=Object.defineProperty({...c},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(l,"parsed",{get(){return t.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return c}),parsed_output:null};return ki(s,n,t)}function ki(s,n,t){let i=null,c=s.content.map((l)=>{if(l.type==="text"){let u=ql(n,l.text);if(i===null)i=u;let d=Object.defineProperty({...l},"parsed_output",{value:u,enumerable:!1});return Object.defineProperty(d,"parsed",{get(){return t.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),u},enumerable:!1})}return l});return{...s,content:c,parsed_output:i}}function ql(s,n){let t=Ka(s);if(t?.type!=="json_schema")return null;try{if("parse"in t)return t.parse(n);return JSON.parse(n)}catch(i){throw new p(`Failed to parse structured output: ${i}`)}}var Kl=(s)=>{let n=0,t=[];while(n<s.length){let i=s[n];if(i==="\\"){n++;continue}if(i==="{"){t.push({type:"brace",value:"{"}),n++;continue}if(i==="}"){t.push({type:"brace",value:"}"}),n++;continue}if(i==="["){t.push({type:"paren",value:"["}),n++;continue}if(i==="]"){t.push({type:"paren",value:"]"}),n++;continue}if(i===":"){t.push({type:"separator",value:":"}),n++;continue}if(i===","){t.push({type:"delimiter",value:","}),n++;continue}if(i==='"'){let d=n+1,h=d,g=!1;while(!0){if(h=s.indexOf('"',h),h===-1){g=!0;break}let x=0,_=h-1;while(_>=d&&s[_]==="\\")x++,_--;if(x%2===0)break;h++}if(g)n=s.length;else t.push({type:"string",value:s.slice(d,h)}),n=h+1;continue}if(i&&/\s/.test(i)){n++;continue}let l=/[0-9]/;if(i&&l.test(i)||i==="-"||i==="."){let d="";if(i==="-")d+=i,i=s[++n];while(i&&(l.test(i)||i==="."||i==="e"||i==="E"||(i==="-"||i==="+")&&(d[d.length-1]==="e"||d[d.length-1]==="E")))d+=i,i=s[++n];t.push({type:"number",value:d,unterminated:n===s.length});continue}let u=/[a-z]/i;if(i&&u.test(i)){let d="";while(i&&u.test(i)){if(n===s.length)break;d+=i,i=s[++n]}if(d=="true"||d=="false"||d==="null")t.push({type:"name",value:d});else{n++;continue}continue}n++}return t},zl=(s)=>{let n=[];for(let l of s)if(l.type==="brace"||l.type==="paren")if(l.value==="{"||l.value==="[")n.push(l.value);else n.pop();let t=n[n.length-1],i=s.length,c=/^-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][-+]?[0-9]+)?$/;while(i>0){let l=s[i-1];switch(l.type){case"separator":i--;continue;case"number":if(l.unterminated||!c.test(l.value)){i--;continue}break;case"string":let u=s[i-2];if(t==="{"&&(u?.type==="delimiter"||u?.type==="brace"&&u.value==="{")){i--;continue}break;case"delimiter":i--;break}break}return s.slice(0,i)},Vl=(s)=>{let n=[];if(s.map((t)=>{if(t.type==="brace")if(t.value==="{")n.push("}");else n.splice(n.lastIndexOf("}"),1);if(t.type==="paren")if(t.value==="[")n.push("]");else n.splice(n.lastIndexOf("]"),1)}),n.length>0)n.reverse().map((t)=>{if(t==="}")s.push({type:"brace",value:"}"});else if(t==="]")s.push({type:"paren",value:"]"})});return s},Yl=(s)=>{let n="";return s.map((t)=>{switch(t.type){case"string":n+='"'+t.value+'"';break;default:n+=t.value;break}}),n},za=(s)=>JSON.parse(Yl(Vl(zl(Kl(s)))));var Ye="__json_buf";function es(s,n){let t={};for(let l of Object.keys(s))if(l!=="input")t[l]=s[l];Object.defineProperty(t,Ye,{value:n,enumerable:!1,writable:!0});let i,c=!1;return Object.defineProperty(t,"input",{enumerable:!0,configurable:!0,get(){if(!c)i=n?za(n):{},c=!0;return i}}),t}var se,Je,xt,kr,ts,Sr,vr,cs,xr,Ne,Er,ls,us,nt,ds,hs,fs,Ar,Si,Va,Rr,vi,xi,Ei,Ya,Ai;function Ri(s){return s.type==="tool_use"||s.type==="server_tool_use"||s.type==="mcp_tool_use"}var ps=(()=>{class s{constructor(n,t){se.add(this),this.messages=[],this.receivedMessages=[],Je.set(this,void 0),xt.set(this,null),this.controller=new AbortController,kr.set(this,void 0),ts.set(this,()=>{}),Sr.set(this,()=>{}),vr.set(this,void 0),cs.set(this,()=>{}),xr.set(this,()=>{}),Ne.set(this,{}),Er.set(this,!1),ls.set(this,!1),us.set(this,!1),nt.set(this,!1),ds.set(this,void 0),hs.set(this,void 0),fs.set(this,void 0),Ar.set(this,void 0),Rr.set(this,(i)=>{if(o(this,ls,!0,"f"),ht(i))i=new Be;if(i instanceof Be)return o(this,us,!0,"f"),this._emit("abort",i);if(i instanceof p)return this._emit("error",i);if(i instanceof Error){let c=new p(i.message);return c.cause=i,this._emit("error",c)}return this._emit("error",new p(String(i)))}),o(this,kr,new Promise((i,c)=>{o(this,ts,i,"f"),o(this,Sr,c,"f")}),"f"),o(this,vr,new Promise((i,c)=>{o(this,cs,i,"f"),o(this,xr,c,"f")}),"f"),e(this,kr,"f").catch(()=>{}),e(this,vr,"f").catch(()=>{}),o(this,xt,n,"f"),o(this,Ar,t?.logger??console,"f")}get response(){return e(this,ds,"f")}get request_id(){return e(this,hs,"f")}get workspace_id(){return e(this,fs,"f")}async withResponse(){o(this,nt,!0,"f");let n=await e(this,kr,"f");if(!n)throw Error("Could not resolve a `Response` object");return{data:this,response:n,request_id:n.headers.get("request-id"),workspace_id:n.headers.get("anthropic-workspace-id")}}static fromReadableStream(n){let t=new s(null);return t._run(()=>t._fromReadableStream(n)),t}static createMessage(n,t,i,{logger:c}={}){let l=new s(t,{logger:c});for(let u of t.messages)l._addMessageParam(u);return o(l,xt,{...t,stream:!0},"f"),l._run(()=>l._createMessage(n,{...t,stream:!0},{...i,headers:{...i?.headers,[dt]:"stream"}})),l}_run(n){n().then(()=>{this._emitFinal(),this._emit("end")},e(this,Rr,"f"))}_addMessageParam(n){this.messages.push(n)}_addMessage(n,t=!0){if(this.receivedMessages.push(n),t)this._emit("message",n)}async _createMessage(n,t,i){let c=i?.signal,l;if(c){if(c.aborted)this.controller.abort();l=this.controller.abort.bind(this.controller),c.addEventListener("abort",l)}try{e(this,se,"m",vi).call(this);let{response:u,data:d}=await n.create({...t,stream:!0},{...i,signal:this.controller.signal}).withResponse();this._connected(u);for await(let h of d)e(this,se,"m",xi).call(this,h);if(d.controller.signal?.aborted)throw new Be;e(this,se,"m",Ei).call(this)}finally{if(c&&l)c.removeEventListener("abort",l)}}_connected(n){if(this.ended)return;o(this,ds,n,"f"),o(this,hs,n?.headers.get("request-id"),"f"),o(this,fs,n?.headers.get("anthropic-workspace-id"),"f"),e(this,ts,"f").call(this,n),this._emit("connect")}get ended(){return e(this,Er,"f")}get errored(){return e(this,ls,"f")}get aborted(){return e(this,us,"f")}abort(){this.controller.abort()}on(n,t){return(e(this,Ne,"f")[n]||(e(this,Ne,"f")[n]=[])).push({listener:t}),this}off(n,t){let i=e(this,Ne,"f")[n];if(!i)return this;let c=i.findIndex((l)=>l.listener===t);if(c>=0)i.splice(c,1);return this}once(n,t){return(e(this,Ne,"f")[n]||(e(this,Ne,"f")[n]=[])).push({listener:t,once:!0}),this}emitted(n){return new Promise((t,i)=>{if(o(this,nt,!0,"f"),n!=="error")this.once("error",i);this.once(n,t)})}async done(){o(this,nt,!0,"f"),await e(this,vr,"f")}get currentMessage(){return e(this,Je,"f")}async finalMessage(){return await this.done(),e(this,se,"m",Si).call(this)}async finalText(){return await this.done(),e(this,se,"m",Va).call(this)}_emit(n,...t){if(e(this,Er,"f"))return;if(n==="end")o(this,Er,!0,"f"),e(this,cs,"f").call(this);let i=e(this,Ne,"f")[n];if(i)e(this,Ne,"f")[n]=i.filter((c)=>!c.once),i.forEach(({listener:c})=>c(...t));if(n==="abort"){let c=t[0];if(!e(this,nt,"f")&&!i?.length)Promise.reject(c);e(this,Sr,"f").call(this,c),e(this,xr,"f").call(this,c),this._emit("end");return}if(n==="error"){let c=t[0];if(!e(this,nt,"f")&&!i?.length)Promise.reject(c);e(this,Sr,"f").call(this,c),e(this,xr,"f").call(this,c),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",e(this,se,"m",Si).call(this))}async _fromReadableStream(n,t){let i=t?.signal,c;if(i){if(i.aborted)this.controller.abort();c=this.controller.abort.bind(this.controller),i.addEventListener("abort",c)}try{e(this,se,"m",vi).call(this),this._connected(null);let l=Me.fromReadableStream(n,this.controller);for await(let u of l)e(this,se,"m",xi).call(this,u);if(l.controller.signal?.aborted)throw new Be;e(this,se,"m",Ei).call(this)}finally{if(i&&c)i.removeEventListener("abort",c)}}[(Je=new WeakMap,xt=new WeakMap,kr=new WeakMap,ts=new WeakMap,Sr=new WeakMap,vr=new WeakMap,cs=new WeakMap,xr=new WeakMap,Ne=new WeakMap,Er=new WeakMap,ls=new WeakMap,us=new WeakMap,nt=new WeakMap,ds=new WeakMap,hs=new WeakMap,fs=new WeakMap,Ar=new WeakMap,Rr=new WeakMap,se=new WeakSet,Si=function(){if(this.receivedMessages.length===0)throw new p("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},Va=function(){if(this.receivedMessages.length===0)throw new p("stream ended without producing a Message with role=assistant");let t=this.receivedMessages.at(-1).content.filter((i)=>i.type==="text").map((i)=>i.text);if(t.length===0)throw new p("stream ended without producing a content block with type=text");return t.join(" ")},vi=function(){if(this.ended)return;o(this,Je,void 0,"f")},xi=function(t){if(this.ended)return;let i=e(this,se,"m",Ya).call(this,t);switch(this._emit("streamEvent",t,i),t.type){case"content_block_delta":{let c=i.content.at(-1);switch(t.delta.type){case"text_delta":{if(c.type==="text")this._emit("text",t.delta.text,c.text||"");break}case"citations_delta":{if(c.type==="text")this._emit("citation",t.delta.citation,c.citations??[]);break}case"input_json_delta":{if(Ri(c)&&e(this,Ne,"f").inputJson?.length){let l;try{l=c.input}catch(u){e(this,Rr,"f").call(this,e(this,se,"m",Ai).call(this,c,u));break}this._emit("inputJson",t.delta.partial_json,l)}break}case"thinking_delta":{if(c.type==="thinking")this._emit("thinking",t.delta.thinking,c.thinking);break}case"signature_delta":{if(c.type==="thinking")this._emit("signature",c.signature);break}case"compaction_delta":{if(c.type==="compaction"&&c.content)this._emit("compaction",c.content);break}default:Vt(t.delta)}break}case"message_stop":{this._addMessageParam(i),this._addMessage(bi(i,e(this,xt,"f"),{logger:e(this,Ar,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",i.content.at(-1));break}case"message_start":{o(this,Je,i,"f");break}case"content_block_start":case"message_delta":break}},Ei=function(){if(this.ended)throw new p("stream has ended, this shouldn't happen");let t=e(this,Je,"f");if(!t)throw new p("request ended without sending any chunks");return o(this,Je,void 0,"f"),bi(t,e(this,xt,"f"),{logger:e(this,Ar,"f")})},Ya=function(t){let i=e(this,Je,"f");if(t.type==="message_start"){if(i)throw new p(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!i)throw new p(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return i;case"message_delta":if(i.stop_reason=t.delta.stop_reason,i.stop_sequence=t.delta.stop_sequence,i.stop_details=t.delta.stop_details,i.usage.output_tokens=t.usage.output_tokens,t.delta.container!=null)i.container=t.delta.container;if(t.context_management!=null)i.context_management=t.context_management;if(t.input_transformations!=null)i.input_transformations=t.input_transformations;if(t.usage.input_tokens!=null)i.usage.input_tokens=t.usage.input_tokens;if(t.usage.cache_creation_input_tokens!=null)i.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens;if(t.usage.cache_read_input_tokens!=null)i.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens;if(t.usage.server_tool_use!=null)i.usage.server_tool_use=t.usage.server_tool_use;if(t.usage.iterations!=null)i.usage.iterations=t.usage.iterations;if(t.usage.fallback_credit!=null)i.usage.fallback_credit=t.usage.fallback_credit;if(t.usage.output_tokens_details!=null)i.usage.output_tokens_details=t.usage.output_tokens_details;return i;case"content_block_start":if(i.content.push(t.content_block),t.content_block.type==="fallback")i.model=t.content_block.to.model;return i;case"content_block_delta":{let c=i.content.at(t.index);switch(t.delta.type){case"text_delta":{if(c?.type==="text")i.content[t.index]={...c,text:(c.text||"")+t.delta.text};break}case"citations_delta":{if(c?.type==="text")i.content[t.index]={...c,citations:[...c.citations??[],t.delta.citation]};break}case"input_json_delta":{if(c&&Ri(c)){let l=(c[Ye]||"")+t.delta.partial_json;i.content[t.index]=es(c,l)}break}case"thinking_delta":{if(c?.type==="thinking")i.content[t.index]={...c,thinking:c.thinking+t.delta.thinking};break}case"signature_delta":{if(c?.type==="thinking")i.content[t.index]={...c,signature:t.delta.signature};break}case"compaction_delta":{if(c?.type==="compaction"){let l={...c,content:t.delta.content};if("encrypted_content"in t.delta)l.encrypted_content=t.delta.encrypted_content;i.content[t.index]=l}break}default:Vt(t.delta)}return i}case"content_block_stop":{let c=i.content.at(t.index);if(c&&Ri(c)&&Ye in c){let l;try{l=c.input}catch(u){l={},e(this,Rr,"f").call(this,e(this,se,"m",Ai).call(this,c,u))}Object.defineProperty(c,"input",{value:l,enumerable:!0,configurable:!0,writable:!0})}return i}}},Ai=function(t,i){let c=t[Ye];return new p(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${i}. JSON: ${c}`)},Symbol.asyncIterator)](){let n=[],t=[],i=!1;return this.on("streamEvent",(c)=>{let l=t.shift();if(l)l.resolve(c);else n.push(c)}),this.on("end",()=>{i=!0;for(let c of t)c.resolve(void 0);t.length=0}),this.on("abort",(c)=>{i=!0;for(let l of t)l.reject(c);t.length=0}),this.on("error",(c)=>{i=!0;for(let l of t)l.reject(c);t.length=0}),{next:async()=>{if(!n.length){if(i)return{value:void 0,done:!0};return new Promise((l,u)=>t.push({resolve:l,reject:u})).then((l)=>l?{value:l,done:!1}:{value:void 0,done:!0})}return{value:n.shift(),done:!1}},return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new Me(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}return s})();var Ue,ms,st,At,_s,it,Rt,gs,Ja,ws,ys,Ii=(()=>{class s extends ps{constructor(n,t){super(n);Ue.add(this),ms.set(this,void 0),st.set(this,0),At.set(this,[]),_s.set(this,[]),it.set(this,void 0),Rt.set(this,[]),gs.set(this,!1),o(this,ms,t,"f")}get toolCalls(){return e(this,_s,"f")}static start(n,t,i,c){let l=new s({...t,stream:!0},c);for(let u of t.messages)l._addMessageParam(u);return l._run(()=>l._createMessage(n,{...t,stream:!0},{...i,headers:{...i?.headers,[dt]:"stream"}})),l}_emit(n,...t){var i;if(n!=="streamEvent"||this.ended){super._emit(n,...t);return}o(this,st,(i=e(this,st,"f"),i++,i),"f");let[c,l]=t,u=c.type==="content_block_stop"?l.content[c.index]:void 0,d=u?.type==="tool_use"?u:void 0;if(d)e(this,_s,"f").push(d);super._emit(n,...t),e(this,Ue,"m",Ja).call(this,c,d),e(this,Ue,"m",ws).call(this)}[(ms=new WeakMap,st=new WeakMap,At=new WeakMap,_s=new WeakMap,it=new WeakMap,Rt=new WeakMap,gs=new WeakMap,Ue=new WeakSet,Symbol.asyncIterator)](){let n=super[Symbol.asyncIterator](),t={handled:e(this,st,"f")};e(this,At,"f").push(t);let i=!1;return{next:async()=>{if(i)i=!1,t.handled++,e(this,Ue,"m",ws).call(this);try{let c=await n.next();if(i=!c.done,c.done)e(this,Ue,"m",ys).call(this,t);return c}catch(c){throw e(this,Ue,"m",ys).call(this,t),c}},return:async()=>{let c=n.return?.();return e(this,Ue,"m",ys).call(this,t),await c??{value:void 0,done:!0}}}}}return Ja=function(t,i){if(e(this,gs,"f"))return;if(t.type==="content_block_start"&&t.content_block.type==="fallback"){o(this,gs,!0,"f"),o(this,it,void 0,"f");return}let c=t.type==="content_block_start"||t.type==="message_delta"&&t.delta.stop_reason==="tool_use";if(e(this,it,"f")&&c)e(this,Rt,"f").push({toolUse:e(this,it,"f"),event:e(this,st,"f")}),o(this,it,void 0,"f");if(i)o(this,it,i,"f")},ws=function(){if(this.errored||this.controller.signal.aborted)return;let t=Math.min(e(this,st,"f"),...e(this,At,"f").map((i)=>i.handled));while(e(this,Rt,"f")[0]&&e(this,Rt,"f")[0].event<=t)e(this,ms,"f").call(this,e(this,Rt,"f").shift().toolUse)},ys=function(t){let i=e(this,At,"f").indexOf(t);if(i>=0)e(this,At,"f").splice(i,1),e(this,Ue,"m",ws).call(this)},s})();var j,It,ot,U,ie,oe,Ge,Le,Xe,Ir,pe,$e,Tt,Pt,at,Ti,Ga,Pi,Ci,Tr,bs,Xa,Oi,Mi,Qa,Ni,$i=(()=>{class s{constructor(n,t,i){j.add(this),this.client=n,It.set(this,!1),ot.set(this,!1),U.set(this,void 0),ie.set(this,void 0),oe.set(this,void 0),Ge.set(this,void 0),Le.set(this,void 0),Xe.set(this,void 0),Ir.set(this,0),pe.set(this,{status:"idle"}),$e.set(this,void 0),Tt.set(this,null),Pt.set(this,new Map),at.set(this,[]),Za(t),Jl(t),ec(t),o(this,U,{params:{...t,messages:JSON.parse(JSON.stringify(t.messages))}},"f");let c=hi(t.tools,t.messages);o(this,ie,{...i,headers:f([xn("BetaToolRunner"),c.length?{[vn]:c.join(", ")}:void 0,i?.headers])},"f"),o(this,Xe,fr(),"f")}async*[(It=new WeakMap,ot=new WeakMap,U=new WeakMap,ie=new WeakMap,oe=new WeakMap,Ge=new WeakMap,Le=new WeakMap,Xe=new WeakMap,Ir=new WeakMap,pe=new WeakMap,$e=new WeakMap,Tt=new WeakMap,Pt=new WeakMap,at=new WeakMap,j=new WeakSet,Symbol.asyncIterator)](){var n;if(e(this,It,"f"))throw new p("Cannot iterate over a consumed stream");o(this,It,!0,"f"),o(this,ot,!0,"f"),o(this,Le,void 0,"f");try{while(!0)try{if(e(this,U,"f").params.max_iterations&&e(this,Ir,"f")>=e(this,U,"f").params.max_iterations)break;if(e(this,j,"m",Qa).call(this),e(this,pe,"f").status==="scheduled"&&rc(e(this,Tt,"f"))!=="resume"){yield*e(this,j,"m",Ci).call(this,e(this,pe,"f").config);continue}o(this,ot,!1,"f"),o(this,Le,void 0,"f"),o(this,Ir,(n=e(this,Ir,"f"),n++,n),"f"),o(this,oe,void 0,"f");let{max_iterations:t,runToolsEagerly:i,...c}=e(this,U,"f").params;if(yield*e(this,j,"m",Ti).call(this,c),!e(this,ot,"f")){let u=await e(this,oe,"f"),d=rc(u.stop_reason);o(this,Tt,u.stop_reason,"f"),e(this,U,"f").params.messages.push({role:u.role,content:Ql(u.content)});let{container:h}=e(this,U,"f").params;if(u.container){if(h==null)e(this,U,"f").params.container=u.container.id;else if(typeof h==="object"&&h.id==null)e(this,U,"f").params.container={...h,id:u.container.id}}if(d==="stop"){yield*e(this,j,"m",Oi).call(this);break}if(d==="resume")continue}else o(this,Tt,null,"f");let l=await e(this,j,"m",Mi).call(this,e(this,U,"f").params.messages.at(-1));if(l)e(this,U,"f").params.messages.push(l);else if(!e(this,ot,"f")){yield*e(this,j,"m",Oi).call(this);break}}finally{e(this,Ge,"f")?.abort(),o(this,Ge,void 0,"f")}if(await e(this,j,"m",Pi).call(this),!e(this,oe,"f"))throw new p("ToolRunner concluded without a message from the server");e(this,Xe,"f").resolve(await e(this,oe,"f"))}catch(t){throw o(this,It,!1,"f"),e(this,Xe,"f").promise.catch(()=>{}),e(this,Xe,"f").reject(t),o(this,Xe,fr(),"f"),t}}setMessagesParams(n){let t=typeof n==="function"?n(e(this,U,"f").params):n;if(Za(t),ec(t),e(this,pe,"f").status!=="idle")Li(t);if(e(this,pe,"f").status==="in_flight"&&t.messages!==e(this,U,"f").params.messages)throw new p("Message params can't be changed while the conversation is being compacted, because the compaction response is about to replace them. Change them after this iteration instead.");e(this,U,"f").params=t,o(this,ot,!0,"f"),o(this,Le,void 0,"f")}setRequestOptions(n){if(typeof n==="function")o(this,ie,n(e(this,ie,"f")),"f");else o(this,ie,{...e(this,ie,"f"),...n},"f")}async generateToolResponse(n=e(this,ie,"f").signal){let t=await e(this,oe,"f")??this.params.messages.at(-1);if(!t)return null;return e(this,j,"m",Mi).call(this,t,n)}deferToolCall(n){let t=typeof n==="string"?n:n.id;if(e(this,$e,"f")&&!e(this,$e,"f").has(t))e(this,$e,"f").set(t,{status:"held"})}get deferredToolCalls(){let n=e(this,Ge,"f"),t=e(this,$e,"f");if(!(n instanceof Ii)||!t)return[];return n.toolCalls.filter((i)=>t.get(i.id)?.status==="held")}done(){return e(this,Xe,"f").promise}async runUntilDone(){if(!e(this,It,"f"))for await(let n of this);return this.done()}get params(){return e(this,U,"f").params}pushMessages(...n){this.setMessagesParams((t)=>({...t,messages:[...t.messages,...n]}))}compactBeforeNextTurn(n){if(e(this,pe,"f").status==="in_flight")return;Li(e(this,U,"f").params),o(this,pe,{status:"scheduled",config:n??{type:"summarize"}},"f")}addTools(...n){for(let t of n){if("name"in t)e(this,Pt,"f").set(t.name,"run"in t?t:null);e(this,at,"f").push({type:"addition",tool:t})}}removeTools(...n){for(let t of n){let i=typeof t==="string"?t:t.name;e(this,Pt,"f").set(i,null),e(this,at,"f").push({type:"removal",name:i})}}then(n,t){return this.runUntilDone().then(n,t)}}return Ti=async function*(t){if(await e(this,j,"m",Pi).call(this),o(this,$e,void 0,"f"),t.stream)o(this,Ge,e(this,U,"f").params.runToolsEagerly?e(this,j,"m",Ga).call(this,t):this.client.beta.messages.stream({...t},e(this,ie,"f")),"f"),o(this,oe,e(this,Ge,"f").finalMessage(),"f"),e(this,oe,"f").catch(()=>{}),yield e(this,Ge,"f");else o(this,oe,this.client.beta.messages.create({...t,stream:!1},e(this,ie,"f")),"f"),yield e(this,oe,"f")},Ga=function(t){let i=new Map;return o(this,$e,i,"f"),Ii.start(this.client.beta.messages,t,e(this,ie,"f"),(c)=>{if(i.has(c.id))return;let l=nc(e(this,j,"m",Tr).call(this),e(this,j,"m",bs).call(this),c,e(this,ie,"f"));l.catch(()=>{}),i.set(c.id,{status:"started",result:l})})},Pi=async function(){let t=[...e(this,$e,"f")?.values()??[]].filter((i)=>i.status==="started");await Promise.allSettled(t.map((i)=>i.result))},Ci=async function*(t){Li(e(this,U,"f").params);let{max_iterations:i,runToolsEagerly:c,...l}=e(this,U,"f").params,u=Gl(l);o(this,pe,{status:"in_flight"},"f"),o(this,Le,void 0,"f");let d=e(this,oe,"f");try{yield*e(this,j,"m",Ti).call(this,{...u,compaction:t});let h=await e(this,oe,"f");if(h.content.some((g)=>g.type==="compaction"&&g.content))e(this,j,"m",Xa).call(this),e(this,U,"f").params.messages=[{role:h.role,content:h.content}];else D(this.client).warn("Compaction produced no summary; keeping the conversation as it is."),o(this,oe,d,"f")}finally{o(this,pe,{status:"idle"},"f")}},Tr=function(){let t=new Map;for(let i of e(this,U,"f").params.tools)if("run"in i)t.set(i.name,i);for(let[i,c]of e(this,Pt,"f"))if(c)t.set(i,c);else t.delete(i);return t},bs=function(){let t=new Set(e(this,j,"m",Tr).call(this).keys());for(let i of[...e(this,U,"f").params.messages,e(this,j,"m",Ni).call(this)]){if(typeof i.content==="string")continue;for(let c of i.content)if(i.role==="system")tc(c,t);else if(i.role==="assistant"&&c.type==="compaction")for(let l of c.tool_changes??[])tc(l,t)}return t},Xa=function(){let t=e(this,j,"m",bs).call(this);for(let i of e(this,j,"m",Tr).call(this).keys())if(!t.has(i))e(this,Pt,"f").set(i,null)},Oi=async function*(){if(e(this,pe,"f").status!=="scheduled")return;let t=e(this,U,"f").params.messages.at(-1)?.content;if(Array.isArray(t)&&t.some((i)=>i.type==="tool_use")){D(this.client).warn("The pending compaction was skipped because the last turn ended with tool calls that were not run. Call `compactBeforeNextTurn()` again if you continue the conversation."),o(this,pe,{status:"idle"},"f");return}yield*e(this,j,"m",Ci).call(this,e(this,pe,"f").config)},Mi=async function(t,i=e(this,ie,"f").signal){if(e(this,Le,"f")!==void 0)return e(this,Le,"f");return o(this,Le,Xl(e(this,j,"m",Tr).call(this),e(this,j,"m",bs).call(this),t,{...e(this,ie,"f"),signal:i},e(this,$e,"f")),"f"),e(this,Le,"f")},Qa=function(){if(e(this,Tt,"f")==="pause_turn"||e(this,at,"f").length===0)return;e(this,U,"f").params.messages.push(e(this,j,"m",Ni).call(this)),o(this,at,[],"f")},Ni=function(){let t=[];for(let i of e(this,at,"f")){if(i.type==="removal"){t.push({type:"tool_removal",tool:{type:"tool_reference",name:i.name}});continue}let c=i.tool;if("run"in i.tool){let{run:l,parse:u,close:d,...h}=i.tool;c=h}t.push({type:"tool_addition",tool:{type:"tool_definition",definition:c}})}return{role:"system",content:t}},s})();function Za(s){if("compaction"in s&&s.compaction!=null)throw new p("`compaction` cannot be set on a tool runner: every request in the loop would compact again. Call `runner.compactBeforeNextTurn()` when the conversation should be compacted instead.")}function Jl(s){if("compactionControl"in s&&s.compactionControl!=null)throw new p("`compactionControl` has been removed from the tool runner. Use server-side compaction instead: call `runner.compactBeforeNextTurn()` when the conversation should be compacted.")}function ec(s){if(s.runToolsEagerly&&!s.stream)throw TypeError("`runToolsEagerly: true` needs `stream: true` in the tool runner's params, because a reply that isn't streamed arrives whole.")}function Li(s){if(s.context_management?.edits?.some((n)=>n.type.startsWith("compact_")))throw new p("`compactBeforeNextTurn()` can't be used while `context_management` has a compaction edit, because the API doesn't accept a compaction block together with one. Remove the edit first.")}function Gl(s){let{context_management:n,stop_sequences:t,output_format:i,...c}=s,l=({format:u,...d})=>d;if(c.tool_choice?.type==="any"||c.tool_choice?.type==="tool")delete c.tool_choice;if(c.output_config)c.output_config=l(c.output_config);if(Array.isArray(c.fallbacks))c.fallbacks=c.fallbacks.map((u)=>u.output_config?{...u,output_config:l(u.output_config)}:u);return c}async function Xl(s,n,t,i,c){if(!t||t.role!=="assistant"||!t.content||typeof t.content==="string")return null;let l=t.content.filter((d)=>d.type==="tool_use");if(l.length===0)return null;return{role:"user",content:await Promise.all(l.map((d)=>{let h=c?.get(d.id);if(h?.status==="started")return h.result;let g=nc(s,n,d,i);return c?.set(d.id,{status:"started",result:g}),g}))}}async function nc(s,n,t,i){let c=n.has(t.name)?s.get(t.name):void 0;if(!c)return Zl(t);try{let l=t.input;if("parse"in c&&c.parse)l=c.parse(l);let u=await c.run(l,{toolUse:t,toolUseBlock:t,signal:i?.signal});return{type:"tool_result",tool_use_id:t.id,content:u}}catch(l){return{type:"tool_result",tool_use_id:t.id,content:l instanceof I?l.content:`Error: ${l instanceof Error?l.message:String(l)}`,is_error:!0}}}function Ql(s){return s}function Zl(s){return{type:"tool_result",tool_use_id:s.id,content:`Error: Tool '${s.name}' not found`,is_error:!0}}function tc(s,n){switch(s.type){case"tool_removal":case"tool_addition":eu(s,n);break}}function eu(s,n){let t=tu(s.tool);if(t===void 0)return;if(s.type==="tool_removal")n.delete(t);else n.add(t)}function tu(s){switch(s.type){case"tool_reference":return s.name;case"tool_definition":return"name"in s.definition?s.definition.name:void 0;default:return}}function rc(s){if(s===null)return"stop";switch(s){case"tool_use":return"run_tools";case"pause_turn":case"compaction":return"resume";case"end_turn":case"stop_sequence":case"max_tokens":case"model_context_window_exceeded":case"refusal":return"stop";default:return Vt(s),"stop"}}var sc={},ru=["claude-mythos-preview","claude-opus-4-6"],ks=(()=>{class s extends A{constructor(){super(...arguments);this.batches=new br(this._client)}create(n,t){let i=ic(n),{betas:c,user_profile_id:l,workspace_id:u,...d}=i;if(d.model in sc)console.warn(`The model '${d.model}' is deprecated and will reach end-of-life on ${sc[d.model]}
11
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(ru.includes(d.model)&&d.thinking&&d.thinking.type==="enabled")console.warn(`Using Claude with ${d.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let h=t?.timeout??this._client._options.timeout;if(!d.stream&&h==null){let x=Zn[d.model]??void 0;h=this._client.calculateNonstreamingTimeout(d.max_tokens,x)}let g=En(d.tools,d.messages);return this._client.post("/v1/messages?beta=true",{body:d,timeout:h??600000,...t,headers:f([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0,...l!=null?{"anthropic-user-profile-id":l}:void 0,...u!=null?{"anthropic-workspace-id":u}:void 0},g,t?.headers]),stream:i.stream??!1})}parse(n,t){return t={...t,headers:f([{"anthropic-beta":[...n.betas??[],"structured-outputs-2025-12-15"].toString()},t?.headers])},this.create(n,t).then((i)=>ki(i,n,{logger:this._client.logger??console}))}stream(n,t){return ps.createMessage(this,n,t)}countTokens(n,t){let i=ic(n),{betas:c,user_profile_id:l,workspace_id:u,...d}=i;return this._client.post("/v1/messages/count_tokens?beta=true",{body:d,...t,headers:f([{"anthropic-beta":[...c??[],"token-counting-2024-11-01"].toString(),...l!=null?{"anthropic-user-profile-id":l}:void 0,...u!=null?{"anthropic-workspace-id":u}:void 0},t?.headers])})}toolRunner(n,t){return new $i(this._client,n,t)}}return s.Batches=br,s.BetaToolRunner=$i,s.ToolError=I,s})();function ic(s){if(!s.output_format)return s;if(s.output_config?.format)throw new p("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:n,...t}=s;return{...t,output_config:{...s.output_config,format:n}}}class Pr extends A{retrieve(s,n){return this._client.get(m`/v1/organizations/api_keys/${s}?beta=true`,n)}update(s,n,t){return this._client.post(m`/v1/organizations/api_keys/${s}?beta=true`,{body:n,...t})}list(s={},n){return this._client.getAPIList("/v1/organizations/api_keys?beta=true",Z,{query:s,...n})}}class Cr extends A{retrieve(s){return this._client.get("/v1/organizations/compliance_settings?beta=true",s)}update(s,n){return this._client.post("/v1/organizations/compliance_settings?beta=true",{body:s,...n})}}class Or extends A{create(s,n){return this._client.post("/v1/organizations/external_keys?beta=true",{body:s,...n})}retrieve(s,n){return this._client.get(m`/v1/organizations/external_keys/${s}?beta=true`,n)}update(s,n,t){return this._client.post(m`/v1/organizations/external_keys/${s}?beta=true`,{body:n,...t})}list(s={},n){return this._client.getAPIList("/v1/organizations/external_keys?beta=true",T,{query:s,...n})}delete(s,n){return this._client.delete(m`/v1/organizations/external_keys/${s}?beta=true`,n)}validate(s,n){return this._client.post(m`/v1/organizations/external_keys/${s}/validate?beta=true`,n)}}class Mr extends A{create(s,n){return this._client.post("/v1/organizations/invites?beta=true",{body:s,...n})}retrieve(s,n){return this._client.get(m`/v1/organizations/invites/${s}?beta=true`,n)}list(s={},n){return this._client.getAPIList("/v1/organizations/invites?beta=true",Z,{query:s,...n})}delete(s,n){return this._client.delete(m`/v1/organizations/invites/${s}?beta=true`,n)}}class Nr extends A{list(s={},n){return this._client.getAPIList("/v1/organizations/rate_limits?beta=true",T,{query:s,...n})}}class Lr extends A{retrieve(s,n){return this._client.get(m`/v1/organizations/users/${s}?beta=true`,n)}update(s,n,t){return this._client.post(m`/v1/organizations/users/${s}?beta=true`,{body:n,...t})}list(s={},n){return this._client.getAPIList("/v1/organizations/users?beta=true",Z,{query:s,...n})}remove(s,n){return this._client.delete(m`/v1/organizations/users/${s}?beta=true`,n)}}class $r extends A{create(s,n){let{betas:t,...i}=s;return this._client.post("/v1/organizations/federation_issuers?beta=true",{body:i,...n,headers:f([{...t?.toString()!=null?{"anthropic-beta":t?.toString()}:void 0},n?.headers])})}retrieve(s,n={},t){let{betas:i}=n??{};return this._client.get(m`/v1/organizations/federation_issuers/${s}?beta=true`,{...t,headers:f([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}update(s,n,t){let{betas:i,...c}=n;return this._client.post(m`/v1/organizations/federation_issuers/${s}?beta=true`,{body:c,...t,headers:f([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}list(s={},n){let{betas:t,...i}=s??{};return this._client.getAPIList("/v1/organizations/federation_issuers?beta=true",T,{query:i,...n,headers:f([{...t?.toString()!=null?{"anthropic-beta":t?.toString()}:void 0},n?.headers])})}archive(s,n={},t){let{betas:i}=n??{};return this._client.post(m`/v1/organizations/federation_issuers/${s}/archive?beta=true`,{...t,headers:f([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}}class Fr extends A{list(s,n={},t){let{betas:i,...c}=n??{};return this._client.getAPIList(m`/v1/organizations/federation_rules/${s}/workspaces?beta=true`,T,{query:c,...t,headers:f([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}add(s,n,t){let{betas:i,...c}=n;return this._client.post(m`/v1/organizations/federation_rules/${s}/workspaces?beta=true`,{body:c,...t,headers:f([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}remove(s,n,t){let{federation_rule_id:i,betas:c}=n;return this._client.delete(m`/v1/organizations/federation_rules/${i}/workspaces/${s}?beta=true`,{...t,headers:f([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0},t?.headers])})}}var Ss=(()=>{class s extends A{constructor(){super(...arguments);this.workspaces=new Fr(this._client)}create(n,t){let{betas:i,...c}=n;return this._client.post("/v1/organizations/federation_rules?beta=true",{body:c,...t,headers:f([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}retrieve(n,t={},i){let{betas:c}=t??{};return this._client.get(m`/v1/organizations/federation_rules/${n}?beta=true`,{...i,headers:f([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0},i?.headers])})}update(n,t,i){let{betas:c,...l}=t;return this._client.post(m`/v1/organizations/federation_rules/${n}?beta=true`,{body:l,...i,headers:f([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0},i?.headers])})}list(n={},t){let{betas:i,...c}=n??{};return this._client.getAPIList("/v1/organizations/federation_rules?beta=true",T,{query:c,...t,headers:f([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}archive(n,t={},i){let{betas:c}=t??{};return this._client.post(m`/v1/organizations/federation_rules/${n}/archive?beta=true`,{...i,headers:f([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0},i?.headers])})}}return s.Workspaces=Fr,s})();var vs=(()=>{class s extends A{constructor(){super(...arguments);this.issuers=new $r(this._client),this.rules=new Ss(this._client)}}return s.Issuers=$r,s.Rules=Ss,s})();class Dr extends A{list(s,n={},t){let{betas:i,...c}=n??{};return this._client.getAPIList(m`/v1/organizations/service_accounts/${s}/workspaces?beta=true`,T,{query:c,...t,headers:f([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}add(s,n,t){let{betas:i,...c}=n;return this._client.post(m`/v1/organizations/service_accounts/${s}/workspaces?beta=true`,{body:c,...t,headers:f([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}remove(s,n,t){let{service_account_id:i,betas:c}=n;return this._client.delete(m`/v1/organizations/service_accounts/${i}/workspaces/${s}?beta=true`,{...t,headers:f([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0},t?.headers])})}}var xs=(()=>{class s extends A{constructor(){super(...arguments);this.workspaces=new Dr(this._client)}create(n,t){let{betas:i,...c}=n;return this._client.post("/v1/organizations/service_accounts?beta=true",{body:c,...t,headers:f([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}retrieve(n,t={},i){let{betas:c}=t??{};return this._client.get(m`/v1/organizations/service_accounts/${n}?beta=true`,{...i,headers:f([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0},i?.headers])})}update(n,t,i){let{betas:c,...l}=t;return this._client.post(m`/v1/organizations/service_accounts/${n}?beta=true`,{body:l,...i,headers:f([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0},i?.headers])})}list(n={},t){let{betas:i,...c}=n??{};return this._client.getAPIList("/v1/organizations/service_accounts?beta=true",T,{query:c,...t,headers:f([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}archive(n,t={},i){let{betas:c}=t??{};return this._client.post(m`/v1/organizations/service_accounts/${n}/archive?beta=true`,{...i,headers:f([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0},i?.headers])})}}return s.Workspaces=Dr,s})();class Wr extends A{retrieve(s,n,t){let{workspace_id:i}=n;return this._client.get(m`/v1/organizations/workspaces/${i}/members/${s}?beta=true`,t)}update(s,n,t){let{workspace_id:i,...c}=n;return this._client.post(m`/v1/organizations/workspaces/${i}/members/${s}?beta=true`,{body:c,...t})}list(s,n={},t){return this._client.getAPIList(m`/v1/organizations/workspaces/${s}/members?beta=true`,Z,{query:n,...t})}add(s,n,t){return this._client.post(m`/v1/organizations/workspaces/${s}/members?beta=true`,{body:n,...t})}remove(s,n,t){let{workspace_id:i}=n;return this._client.delete(m`/v1/organizations/workspaces/${i}/members/${s}?beta=true`,t)}}class Ur extends A{list(s,n={},t){return this._client.getAPIList(m`/v1/organizations/workspaces/${s}/rate_limits?beta=true`,T,{query:n,...t})}}class jr extends A{retrieve(s,n,t){let{workspace_id:i,betas:c}=n;return this._client.get(m`/v1/organizations/workspaces/${i}/service_accounts/${s}?beta=true`,{...t,headers:f([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0},t?.headers])})}update(s,n,t){let{workspace_id:i,betas:c,...l}=n;return this._client.post(m`/v1/organizations/workspaces/${i}/service_accounts/${s}?beta=true`,{body:l,...t,headers:f([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0},t?.headers])})}list(s,n={},t){let{betas:i,...c}=n??{};return this._client.getAPIList(m`/v1/organizations/workspaces/${s}/service_accounts?beta=true`,T,{query:c,...t,headers:f([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}add(s,n,t){let{betas:i,...c}=n;return this._client.post(m`/v1/organizations/workspaces/${s}/service_accounts?beta=true`,{body:c,...t,headers:f([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}remove(s,n,t){let{workspace_id:i,betas:c}=n;return this._client.delete(m`/v1/organizations/workspaces/${i}/service_accounts/${s}?beta=true`,{...t,headers:f([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0},t?.headers])})}}var Es=(()=>{class s extends A{constructor(){super(...arguments);this.rateLimits=new Ur(this._client),this.members=new Wr(this._client),this.serviceAccounts=new jr(this._client)}create(n,t){let{betas:i,...c}=n;return this._client.post("/v1/organizations/workspaces?beta=true",{body:c,...t,headers:f([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}retrieve(n,t){return this._client.get(m`/v1/organizations/workspaces/${n}?beta=true`,t)}update(n,t,i){return this._client.post(m`/v1/organizations/workspaces/${n}?beta=true`,{body:t,...i})}list(n={},t){return this._client.getAPIList("/v1/organizations/workspaces?beta=true",Z,{query:n,...t})}archive(n,t){return this._client.post(m`/v1/organizations/workspaces/${n}/archive?beta=true`,t)}}return s.RateLimits=Ur,s.Members=Wr,s.ServiceAccounts=jr,s})();var As=(()=>{class s extends A{constructor(){super(...arguments);this.apiKeys=new Pr(this._client),this.externalKeys=new Or(this._client),this.federation=new vs(this._client),this.invites=new Mr(this._client),this.serviceAccounts=new xs(this._client),this.users=new Lr(this._client),this.workspaces=new Es(this._client),this.rateLimits=new Nr(this._client),this.complianceSettings=new Cr(this._client)}retrieve(n){return this._client.get("/v1/organizations/me?beta=true",n)}}return s.APIKeys=Pr,s.ExternalKeys=Or,s.Federation=vs,s.Invites=Mr,s.ServiceAccounts=xs,s.Users=Lr,s.Workspaces=Es,s.RateLimits=Nr,s.ComplianceSettings=Cr,s})();var Rs=(()=>{class s extends A{list(n,t={},i){let{betas:c,workspace_id:l,...u}=t??{};return this._client.getAPIList(m`/v1/sessions/${n}/events?beta=true`,T,{query:u,...i,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}send(n,t,i){let{betas:c,workspace_id:l,...u}=t;return this._client.post(m`/v1/sessions/${n}/events?beta=true`,{body:u,...i,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}stream(n,t={},i){let{betas:c,workspace_id:l,...u}=t??{};return this._client.get(m`/v1/sessions/${n}/events/stream?beta=true`,{query:u,...i,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers]),stream:!0})}toolRunner(n,t){return new pr(n,{...t,client:this._client})}}return s.SessionToolRunner=pr,s})();class qr extends A{retrieve(s,n,t){let{session_id:i,betas:c,workspace_id:l}=n;return this._client.get(m`/v1/sessions/${i}/resources/${s}?beta=true`,{...t,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}update(s,n,t){let{session_id:i,betas:c,workspace_id:l,...u}=n;return this._client.post(m`/v1/sessions/${i}/resources/${s}?beta=true`,{body:u,...t,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}list(s,n={},t){let{betas:i,workspace_id:c,...l}=n??{};return this._client.getAPIList(m`/v1/sessions/${s}/resources?beta=true`,T,{query:l,...t,headers:f([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}delete(s,n,t){let{session_id:i,betas:c,workspace_id:l}=n;return this._client.delete(m`/v1/sessions/${i}/resources/${s}?beta=true`,{...t,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}add(s,n,t){let{betas:i,workspace_id:c,...l}=n;return this._client.post(m`/v1/sessions/${s}/resources?beta=true`,{body:l,...t,headers:f([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}}class Kr extends A{list(s,n,t){let{session_id:i,betas:c,workspace_id:l,...u}=n;return this._client.getAPIList(m`/v1/sessions/${i}/threads/${s}/events?beta=true`,T,{query:u,...t,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}stream(s,n,t){let{session_id:i,betas:c,workspace_id:l,...u}=n;return this._client.get(m`/v1/sessions/${i}/threads/${s}/stream?beta=true`,{query:u,...t,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers]),stream:!0})}}var Is=(()=>{class s extends A{constructor(){super(...arguments);this.events=new Kr(this._client)}retrieve(n,t,i){let{session_id:c,betas:l,workspace_id:u}=t;return this._client.get(m`/v1/sessions/${c}/threads/${n}?beta=true`,{...i,headers:f([{"anthropic-beta":[...l??[],"managed-agents-2026-04-01"].toString(),...u!=null?{"anthropic-workspace-id":u}:void 0},i?.headers])})}list(n,t={},i){let{betas:c,workspace_id:l,...u}=t??{};return this._client.getAPIList(m`/v1/sessions/${n}/threads?beta=true`,T,{query:u,...i,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}archive(n,t,i){let{session_id:c,betas:l,workspace_id:u}=t;return this._client.post(m`/v1/sessions/${c}/threads/${n}/archive?beta=true`,{...i,headers:f([{"anthropic-beta":[...l??[],"managed-agents-2026-04-01"].toString(),...u!=null?{"anthropic-workspace-id":u}:void 0},i?.headers])})}}return s.Events=Kr,s})();var Ts=(()=>{class s extends A{constructor(){super(...arguments);this.events=new Rs(this._client),this.resources=new qr(this._client),this.threads=new Is(this._client)}create(n,t){let{betas:i,workspace_id:c,...l}=n;return this._client.post("/v1/sessions?beta=true",{body:l,...t,headers:f([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}retrieve(n,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.get(m`/v1/sessions/${n}?beta=true`,{...i,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}update(n,t,i){let{betas:c,workspace_id:l,...u}=t;return this._client.post(m`/v1/sessions/${n}?beta=true`,{body:u,...i,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}list(n={},t){let{betas:i,workspace_id:c,...l}=n??{};return this._client.getAPIList("/v1/sessions?beta=true",oi,{query:l,...t,headers:f([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}delete(n,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.delete(m`/v1/sessions/${n}?beta=true`,{...i,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}archive(n,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.post(m`/v1/sessions/${n}/archive?beta=true`,{...i,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}}return s.Events=Rs,s.Resources=qr,s.Threads=Is,s})();class zr extends A{create(s,n,t){let{betas:i,workspace_id:c,...l}=n;return this._client.post(m`/v1/skills/${s}/versions?beta=true`,ye({body:l,...t,headers:f([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])},this._client,!1))}retrieve(s,n,t){let{skill_id:i,betas:c,workspace_id:l}=n;return this._client.get(m`/v1/skills/${i}/versions/${s}?beta=true`,{...t,headers:f([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0,...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}list(s,n={},t){let{betas:i,workspace_id:c,...l}=n??{};return this._client.getAPIList(m`/v1/skills/${s}/versions?beta=true`,T,{query:l,...t,headers:f([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}delete(s,n,t){let{skill_id:i,betas:c,workspace_id:l}=n;return this._client.delete(m`/v1/skills/${i}/versions/${s}?beta=true`,{...t,headers:f([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0,...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}download(s,n,t){let{skill_id:i,betas:c,workspace_id:l}=n;return this._client.get(m`/v1/skills/${i}/versions/${s}/content?beta=true`,{...t,headers:f([{Accept:"application/binary",...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0,...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers]),__binaryResponse:!0})}}var Ps=(()=>{class s extends A{constructor(){super(...arguments);this.versions=new zr(this._client)}create(n,t){let{betas:i,workspace_id:c,...l}=n;return this._client.post("/v1/skills?beta=true",ye({body:l,...t,headers:f([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])},this._client,!1))}retrieve(n,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.get(m`/v1/skills/${n}?beta=true`,{...i,headers:f([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0,...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}list(n={},t){let{betas:i,workspace_id:c,...l}=n??{};return this._client.getAPIList("/v1/skills?beta=true",T,{query:l,...t,headers:f([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}delete(n,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.delete(m`/v1/skills/${n}?beta=true`,{...i,headers:f([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0,...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}}return s.Versions=zr,s})();class Vr extends A{create(s,n,t){let{betas:i,workspace_id:c,...l}=n;return this._client.post(m`/v1/tunnels/${s}/certificates?beta=true`,{body:l,...t,headers:f([{"anthropic-beta":[...i??[],"mcp-tunnels-2026-06-22"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}retrieve(s,n,t){let{tunnel_id:i,betas:c,workspace_id:l}=n;return this._client.get(m`/v1/tunnels/${i}/certificates/${s}?beta=true`,{...t,headers:f([{"anthropic-beta":[...c??[],"mcp-tunnels-2026-06-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}list(s,n={},t){let{betas:i,workspace_id:c,...l}=n??{};return this._client.getAPIList(m`/v1/tunnels/${s}/certificates?beta=true`,T,{query:l,...t,headers:f([{"anthropic-beta":[...i??[],"mcp-tunnels-2026-06-22"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}archive(s,n,t){let{tunnel_id:i,betas:c,workspace_id:l}=n;return this._client.post(m`/v1/tunnels/${i}/certificates/${s}/archive?beta=true`,{...t,headers:f([{"anthropic-beta":[...c??[],"mcp-tunnels-2026-06-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}}var Cs=(()=>{class s extends A{constructor(){super(...arguments);this.certificates=new Vr(this._client)}create(n,t){let{betas:i,workspace_id:c,...l}=n;return this._client.post("/v1/tunnels?beta=true",{body:l,...t,headers:f([{"anthropic-beta":[...i??[],"mcp-tunnels-2026-06-22"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}retrieve(n,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.get(m`/v1/tunnels/${n}?beta=true`,{...i,headers:f([{"anthropic-beta":[...c??[],"mcp-tunnels-2026-06-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}list(n={},t){let{betas:i,workspace_id:c,...l}=n??{};return this._client.getAPIList("/v1/tunnels?beta=true",T,{query:l,...t,headers:f([{"anthropic-beta":[...i??[],"mcp-tunnels-2026-06-22"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}archive(n,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.post(m`/v1/tunnels/${n}/archive?beta=true`,{...i,headers:f([{"anthropic-beta":[...c??[],"mcp-tunnels-2026-06-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}revealToken(n,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.post(m`/v1/tunnels/${n}/reveal_token?beta=true`,{...i,headers:f([{"anthropic-beta":[...c??[],"mcp-tunnels-2026-06-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}rotateToken(n,t,i){let{betas:c,workspace_id:l,...u}=t;return this._client.post(m`/v1/tunnels/${n}/rotate_token?beta=true`,{body:u,...i,headers:f([{"anthropic-beta":[...c??[],"mcp-tunnels-2026-06-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}}return s.Certificates=Vr,s})();class Yr extends A{create(s,n,t){let{betas:i,workspace_id:c,...l}=n;return this._client.post(m`/v1/vaults/${s}/credentials?beta=true`,{body:l,...t,headers:f([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}retrieve(s,n,t){let{vault_id:i,betas:c,workspace_id:l}=n;return this._client.get(m`/v1/vaults/${i}/credentials/${s}?beta=true`,{...t,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}update(s,n,t){let{vault_id:i,betas:c,workspace_id:l,...u}=n;return this._client.post(m`/v1/vaults/${i}/credentials/${s}?beta=true`,{body:u,...t,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}list(s,n={},t){let{betas:i,workspace_id:c,...l}=n??{};return this._client.getAPIList(m`/v1/vaults/${s}/credentials?beta=true`,T,{query:l,...t,headers:f([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}delete(s,n,t){let{vault_id:i,betas:c,workspace_id:l}=n;return this._client.delete(m`/v1/vaults/${i}/credentials/${s}?beta=true`,{...t,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}archive(s,n,t){let{vault_id:i,betas:c,workspace_id:l}=n;return this._client.post(m`/v1/vaults/${i}/credentials/${s}/archive?beta=true`,{...t,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}mcpOAuthValidate(s,n,t){let{vault_id:i,betas:c,workspace_id:l}=n;return this._client.post(m`/v1/vaults/${i}/credentials/${s}/mcp_oauth_validate?beta=true`,{...t,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}}var Os=(()=>{class s extends A{constructor(){super(...arguments);this.credentials=new Yr(this._client)}create(n,t){let{betas:i,workspace_id:c,...l}=n;return this._client.post("/v1/vaults?beta=true",{body:l,...t,headers:f([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}retrieve(n,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.get(m`/v1/vaults/${n}?beta=true`,{...i,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}update(n,t,i){let{betas:c,workspace_id:l,...u}=t;return this._client.post(m`/v1/vaults/${n}?beta=true`,{body:u,...i,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}list(n={},t){let{betas:i,workspace_id:c,...l}=n??{};return this._client.getAPIList("/v1/vaults?beta=true",T,{query:l,...t,headers:f([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}delete(n,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.delete(m`/v1/vaults/${n}?beta=true`,{...i,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}archive(n,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.post(m`/v1/vaults/${n}/archive?beta=true`,{...i,headers:f([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}}return s.Credentials=Yr,s})();var Jr=(()=>{class s extends A{constructor(){super(...arguments);this.models=new Xt(this._client),this.messages=new ks(this._client),this.agents=new Tn(this._client),this.environments=new Gn(this._client),this.sessions=new Ts(this._client),this.deployments=new jt(this._client),this.deploymentRuns=new Ut(this._client),this.vaults=new Os(this._client),this.memoryStores=new Xn(this._client),this.files=new Jt(this._client),this.skills=new Ps(this._client),this.webhooks=new rr(this._client),this.userProfiles=new Zt(this._client),this.dreams=new qt(this._client),this.tunnels=new Cs(this._client),this.organization=new As(this._client)}}return s.Models=Xt,s.Messages=ks,s.Agents=Tn,s.Environments=Gn,s.Sessions=Ts,s.Deployments=jt,s.DeploymentRuns=Ut,s.Vaults=Os,s.MemoryStores=Xn,s.Files=Jt,s.Skills=Ps,s.Webhooks=rr,s.UserProfiles=Zt,s.Dreams=qt,s.Tunnels=Cs,s.Organization=As,s})();class Ct extends A{create(s,n){let{betas:t,workspace_id:i,...c}=s;return this._client.post("/v1/complete",{body:c,timeout:this._client._options.timeout??600000,...n,headers:f([{...t?.toString()!=null?{"anthropic-beta":t?.toString()}:void 0,...i!=null?{"anthropic-workspace-id":i}:void 0},n?.headers]),stream:s.stream??!1})}}class Ot extends A{list(s={},n){let{workspace_id:t,...i}=s??{};return this._client.getAPIList("/v1/files",T,{query:i,...n,headers:f([{...t!=null?{"anthropic-workspace-id":t}:void 0},n?.headers])})}delete(s,n={},t){let{workspace_id:i}=n??{};return this._client.delete(m`/v1/files/${s}`,{...t,headers:f([{...i!=null?{"anthropic-workspace-id":i}:void 0},t?.headers])})}download(s,n={},t){let{workspace_id:i}=n??{};return this._client.get(m`/v1/files/${s}/content`,{...t,headers:f([{Accept:"application/binary",...i!=null?{"anthropic-workspace-id":i}:void 0},t?.headers]),__binaryResponse:!0})}retrieveMetadata(s,n={},t){let{workspace_id:i}=n??{};return this._client.get(m`/v1/files/${s}`,{...t,headers:f([{...i!=null?{"anthropic-workspace-id":i}:void 0},t?.headers])})}upload(s,n){let{workspace_id:t,...i}=s;return this._client.post("/v1/files",ye({body:i,...n,headers:f([{...t!=null?{"anthropic-workspace-id":t}:void 0},An(i.file),n?.headers])},this._client))}}function oc(s){return s?.output_config?.format}function Fi(s,n,t){let i=oc(n);if(!n||!("parse"in(i??{})))return{...s,content:s.content.map((c)=>{if(c.type==="text")return Object.defineProperty({...c},"parsed_output",{value:null,enumerable:!1});return c}),parsed_output:null};return Hi(s,n,t)}function Hi(s,n,t){let i=null,c=s.content.map((l)=>{if(l.type==="text"){let u=Ou(n,l.text);if(i===null)i=u;return Object.defineProperty({...l},"parsed_output",{value:u,enumerable:!1})}return l});return{...s,content:c,parsed_output:i}}function Ou(s,n){let t=oc(s);if(t?.type!=="json_schema")return null;try{if("parse"in t)return t.parse(n);return JSON.parse(n)}catch(i){throw new p(`Failed to parse structured output: ${i}`)}}var Ee,Qe,Mt,Gr,Ms,Xr,Qr,Ns,Zr,Fe,en,Ls,$s,ct,Fs,Hs,Ds,tn,Di,ac,Bi,Wi,Ui,ji,cc;function qi(s){return s.type==="tool_use"||s.type==="server_tool_use"}var lc=(()=>{class s{constructor(n,t){Ee.add(this),this.messages=[],this.receivedMessages=[],Qe.set(this,void 0),Mt.set(this,null),this.controller=new AbortController,Gr.set(this,void 0),Ms.set(this,()=>{}),Xr.set(this,()=>{}),Qr.set(this,void 0),Ns.set(this,()=>{}),Zr.set(this,()=>{}),Fe.set(this,{}),en.set(this,!1),Ls.set(this,!1),$s.set(this,!1),ct.set(this,!1),Fs.set(this,void 0),Hs.set(this,void 0),Ds.set(this,void 0),tn.set(this,void 0),Bi.set(this,(i)=>{if(o(this,Ls,!0,"f"),ht(i))i=new Be;if(i instanceof Be)return o(this,$s,!0,"f"),this._emit("abort",i);if(i instanceof p)return this._emit("error",i);if(i instanceof Error){let c=new p(i.message);return c.cause=i,this._emit("error",c)}return this._emit("error",new p(String(i)))}),o(this,Gr,new Promise((i,c)=>{o(this,Ms,i,"f"),o(this,Xr,c,"f")}),"f"),o(this,Qr,new Promise((i,c)=>{o(this,Ns,i,"f"),o(this,Zr,c,"f")}),"f"),e(this,Gr,"f").catch(()=>{}),e(this,Qr,"f").catch(()=>{}),o(this,Mt,n,"f"),o(this,tn,t?.logger??console,"f")}get response(){return e(this,Fs,"f")}get request_id(){return e(this,Hs,"f")}get workspace_id(){return e(this,Ds,"f")}async withResponse(){o(this,ct,!0,"f");let n=await e(this,Gr,"f");if(!n)throw Error("Could not resolve a `Response` object");return{data:this,response:n,request_id:n.headers.get("request-id"),workspace_id:n.headers.get("anthropic-workspace-id")}}static fromReadableStream(n){let t=new s(null);return t._run(()=>t._fromReadableStream(n)),t}static createMessage(n,t,i,{logger:c}={}){let l=new s(t,{logger:c});for(let u of t.messages)l._addMessageParam(u);return o(l,Mt,{...t,stream:!0},"f"),l._run(()=>l._createMessage(n,{...t,stream:!0},{...i,headers:{...i?.headers,[dt]:"stream"}})),l}_run(n){n().then(()=>{this._emitFinal(),this._emit("end")},e(this,Bi,"f"))}_addMessageParam(n){this.messages.push(n)}_addMessage(n,t=!0){if(this.receivedMessages.push(n),t)this._emit("message",n)}async _createMessage(n,t,i){let c=i?.signal,l;if(c){if(c.aborted)this.controller.abort();l=this.controller.abort.bind(this.controller),c.addEventListener("abort",l)}try{e(this,Ee,"m",Wi).call(this);let{response:u,data:d}=await n.create({...t,stream:!0},{...i,signal:this.controller.signal}).withResponse();this._connected(u);for await(let h of d)e(this,Ee,"m",Ui).call(this,h);if(d.controller.signal?.aborted)throw new Be;e(this,Ee,"m",ji).call(this)}finally{if(c&&l)c.removeEventListener("abort",l)}}_connected(n){if(this.ended)return;o(this,Fs,n,"f"),o(this,Hs,n?.headers.get("request-id"),"f"),o(this,Ds,n?.headers.get("anthropic-workspace-id"),"f"),e(this,Ms,"f").call(this,n),this._emit("connect")}get ended(){return e(this,en,"f")}get errored(){return e(this,Ls,"f")}get aborted(){return e(this,$s,"f")}abort(){this.controller.abort()}on(n,t){return(e(this,Fe,"f")[n]||(e(this,Fe,"f")[n]=[])).push({listener:t}),this}off(n,t){let i=e(this,Fe,"f")[n];if(!i)return this;let c=i.findIndex((l)=>l.listener===t);if(c>=0)i.splice(c,1);return this}once(n,t){return(e(this,Fe,"f")[n]||(e(this,Fe,"f")[n]=[])).push({listener:t,once:!0}),this}emitted(n){return new Promise((t,i)=>{if(o(this,ct,!0,"f"),n!=="error")this.once("error",i);this.once(n,t)})}async done(){o(this,ct,!0,"f"),await e(this,Qr,"f")}get currentMessage(){return e(this,Qe,"f")}async finalMessage(){return await this.done(),e(this,Ee,"m",Di).call(this)}async finalText(){return await this.done(),e(this,Ee,"m",ac).call(this)}_emit(n,...t){if(e(this,en,"f"))return;if(n==="end")o(this,en,!0,"f"),e(this,Ns,"f").call(this);let i=e(this,Fe,"f")[n];if(i)e(this,Fe,"f")[n]=i.filter((c)=>!c.once),i.forEach(({listener:c})=>c(...t));if(n==="abort"){let c=t[0];if(!e(this,ct,"f")&&!i?.length)Promise.reject(c);e(this,Xr,"f").call(this,c),e(this,Zr,"f").call(this,c),this._emit("end");return}if(n==="error"){let c=t[0];if(!e(this,ct,"f")&&!i?.length)Promise.reject(c);e(this,Xr,"f").call(this,c),e(this,Zr,"f").call(this,c),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",e(this,Ee,"m",Di).call(this))}async _fromReadableStream(n,t){let i=t?.signal,c;if(i){if(i.aborted)this.controller.abort();c=this.controller.abort.bind(this.controller),i.addEventListener("abort",c)}try{e(this,Ee,"m",Wi).call(this),this._connected(null);let l=Me.fromReadableStream(n,this.controller);for await(let u of l)e(this,Ee,"m",Ui).call(this,u);if(l.controller.signal?.aborted)throw new Be;e(this,Ee,"m",ji).call(this)}finally{if(i&&c)i.removeEventListener("abort",c)}}[(Qe=new WeakMap,Mt=new WeakMap,Gr=new WeakMap,Ms=new WeakMap,Xr=new WeakMap,Qr=new WeakMap,Ns=new WeakMap,Zr=new WeakMap,Fe=new WeakMap,en=new WeakMap,Ls=new WeakMap,$s=new WeakMap,ct=new WeakMap,Fs=new WeakMap,Hs=new WeakMap,Ds=new WeakMap,tn=new WeakMap,Bi=new WeakMap,Ee=new WeakSet,Di=function(){if(this.receivedMessages.length===0)throw new p("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},ac=function(){if(this.receivedMessages.length===0)throw new p("stream ended without producing a Message with role=assistant");let t=this.receivedMessages.at(-1).content.filter((i)=>i.type==="text").map((i)=>i.text);if(t.length===0)throw new p("stream ended without producing a content block with type=text");return t.join(" ")},Wi=function(){if(this.ended)return;o(this,Qe,void 0,"f")},Ui=function(t){if(this.ended)return;let i=e(this,Ee,"m",cc).call(this,t);switch(this._emit("streamEvent",t,i),t.type){case"content_block_delta":{let c=i.content.at(-1);switch(t.delta.type){case"text_delta":{if(c.type==="text")this._emit("text",t.delta.text,c.text||"");break}case"citations_delta":{if(c.type==="text")this._emit("citation",t.delta.citation,c.citations??[]);break}case"input_json_delta":{if(qi(c)&&e(this,Fe,"f").inputJson?.length)this._emit("inputJson",t.delta.partial_json,c.input);break}case"thinking_delta":{if(c.type==="thinking")this._emit("thinking",t.delta.thinking,c.thinking);break}case"signature_delta":{if(c.type==="thinking")this._emit("signature",c.signature);break}default:Vt(t.delta)}break}case"message_stop":{this._addMessageParam(i),this._addMessage(Fi(i,e(this,Mt,"f"),{logger:e(this,tn,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",i.content.at(-1));break}case"message_start":{o(this,Qe,i,"f");break}case"content_block_start":case"message_delta":break}},ji=function(){if(this.ended)throw new p("stream has ended, this shouldn't happen");let t=e(this,Qe,"f");if(!t)throw new p("request ended without sending any chunks");return o(this,Qe,void 0,"f"),Fi(t,e(this,Mt,"f"),{logger:e(this,tn,"f")})},cc=function(t){let i=e(this,Qe,"f");if(t.type==="message_start"){if(i)throw new p(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!i)throw new p(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return i;case"message_delta":if(i.stop_reason=t.delta.stop_reason,i.stop_sequence=t.delta.stop_sequence,i.stop_details=t.delta.stop_details,i.usage.output_tokens=t.usage.output_tokens,t.delta.container!=null)i.container=t.delta.container;if(t.usage.input_tokens!=null)i.usage.input_tokens=t.usage.input_tokens;if(t.usage.cache_creation_input_tokens!=null)i.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens;if(t.usage.cache_read_input_tokens!=null)i.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens;if(t.usage.server_tool_use!=null)i.usage.server_tool_use=t.usage.server_tool_use;if(t.usage.output_tokens_details!=null)i.usage.output_tokens_details=t.usage.output_tokens_details;return i;case"content_block_start":return i.content.push({...t.content_block}),i;case"content_block_delta":{let c=i.content.at(t.index);switch(t.delta.type){case"text_delta":{if(c?.type==="text")i.content[t.index]={...c,text:(c.text||"")+t.delta.text};break}case"citations_delta":{if(c?.type==="text")i.content[t.index]={...c,citations:[...c.citations??[],t.delta.citation]};break}case"input_json_delta":{if(c&&qi(c)){let l=(c[Ye]||"")+t.delta.partial_json;i.content[t.index]=es(c,l)}break}case"thinking_delta":{if(c?.type==="thinking")i.content[t.index]={...c,thinking:c.thinking+t.delta.thinking};break}case"signature_delta":{if(c?.type==="thinking")i.content[t.index]={...c,signature:t.delta.signature};break}default:Vt(t.delta)}return i}case"content_block_stop":{let c=i.content.at(t.index);if(c&&qi(c)&&Ye in c)Object.defineProperty(c,"input",{value:c.input,enumerable:!0,configurable:!0,writable:!0});return i}}},Symbol.asyncIterator)](){let n=[],t=[],i=!1;return this.on("streamEvent",(c)=>{let l=t.shift();if(l)l.resolve(c);else n.push(c)}),this.on("end",()=>{i=!0;for(let c of t)c.resolve(void 0);t.length=0}),this.on("abort",(c)=>{i=!0;for(let l of t)l.reject(c);t.length=0}),this.on("error",(c)=>{i=!0;for(let l of t)l.reject(c);t.length=0}),{next:async()=>{if(!n.length){if(i)return{value:void 0,done:!0};return new Promise((l,u)=>t.push({resolve:l,reject:u})).then((l)=>l?{value:l,done:!1}:{value:void 0,done:!0})}return{value:n.shift(),done:!1}},return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new Me(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}return s})();class rn extends A{create(s,n){let{user_profile_id:t,workspace_id:i,...c}=s;return this._client.post("/v1/messages/batches",{body:c,...n,headers:f([{...t!=null?{"anthropic-user-profile-id":t}:void 0,...i!=null?{"anthropic-workspace-id":i}:void 0},n?.headers])})}retrieve(s,n={},t){let{workspace_id:i}=n??{};return this._client.get(m`/v1/messages/batches/${s}`,{...t,headers:f([{...i!=null?{"anthropic-workspace-id":i}:void 0},t?.headers])})}list(s={},n){let{workspace_id:t,...i}=s??{};return this._client.getAPIList("/v1/messages/batches",Z,{query:i,...n,headers:f([{...t!=null?{"anthropic-workspace-id":t}:void 0},n?.headers])})}delete(s,n={},t){let{workspace_id:i}=n??{};return this._client.delete(m`/v1/messages/batches/${s}`,{...t,headers:f([{...i!=null?{"anthropic-workspace-id":i}:void 0},t?.headers])})}cancel(s,n={},t){let{workspace_id:i}=n??{};return this._client.post(m`/v1/messages/batches/${s}/cancel`,{...t,headers:f([{...i!=null?{"anthropic-workspace-id":i}:void 0},t?.headers])})}async results(s,n={},t){let i=await this.retrieve(s,n,t);if(!i.results_url)throw new p(`No batch \`results_url\`; Has it finished processing? ${i.processing_status} - ${i.id}`);let{workspace_id:c}=n??{};return this._client.get(i.results_url,{...t,headers:f([{Accept:"application/binary",...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((l,u)=>Qn.fromResponse(u.response,u.controller))}}var nn=(()=>{class s extends A{constructor(){super(...arguments);this.batches=new rn(this._client)}create(n,t){let{user_profile_id:i,workspace_id:c,...l}=n;if(l.model in uc)console.warn(`The model '${l.model}' is deprecated and will reach end-of-life on ${uc[l.model]}
12
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(Nu.includes(l.model)&&l.thinking&&l.thinking.type==="enabled")console.warn(`Using Claude with ${l.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let u=t?.timeout??this._client._options.timeout;if(!l.stream&&u==null){let h=Zn[l.model]??void 0;u=this._client.calculateNonstreamingTimeout(l.max_tokens,h)}let d=En(l.tools,l.messages);return this._client.post("/v1/messages",{body:l,timeout:u??600000,...t,headers:f([{...i!=null?{"anthropic-user-profile-id":i}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},d,t?.headers]),stream:n.stream??!1})}parse(n,t){return this.create(n,t).then((i)=>Hi(i,n,{logger:this._client.logger??console}))}stream(n,t){return lc.createMessage(this,n,t,{logger:this._client.logger??console})}countTokens(n,t){let{user_profile_id:i,workspace_id:c,...l}=n;return this._client.post("/v1/messages/count_tokens",{body:l,...t,headers:f([{...i!=null?{"anthropic-user-profile-id":i}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}}return s.Batches=rn,s})(),uc={},Nu=["claude-mythos-preview","claude-opus-4-6"];class Nt extends A{retrieve(s,n={},t){let{betas:i,workspace_id:c}=n??{};return this._client.get(m`/v1/models/${s}`,{...t,headers:f([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}list(s={},n){let{betas:t,workspace_id:i,...c}=s??{};return this._client.getAPIList("/v1/models",Z,{query:c,...n,headers:f([{...t?.toString()!=null?{"anthropic-beta":t?.toString()}:void 0,...i!=null?{"anthropic-workspace-id":i}:void 0},n?.headers])})}}class sn extends A{create(s,n,t){let{workspace_id:i,...c}=n;return this._client.post(m`/v1/skills/${s}/versions`,ye({body:c,...t,headers:f([{...i!=null?{"anthropic-workspace-id":i}:void 0},t?.headers])},this._client,!1))}retrieve(s,n,t){let{skill_id:i,workspace_id:c}=n;return this._client.get(m`/v1/skills/${i}/versions/${s}`,{...t,headers:f([{...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}list(s,n={},t){let{workspace_id:i,...c}=n??{};return this._client.getAPIList(m`/v1/skills/${s}/versions`,T,{query:c,...t,headers:f([{...i!=null?{"anthropic-workspace-id":i}:void 0},t?.headers])})}delete(s,n,t){let{skill_id:i,workspace_id:c}=n;return this._client.delete(m`/v1/skills/${i}/versions/${s}`,{...t,headers:f([{...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}}var on=(()=>{class s extends A{constructor(){super(...arguments);this.versions=new sn(this._client)}create(n,t){let{workspace_id:i,...c}=n;return this._client.post("/v1/skills",ye({body:c,...t,headers:f([{...i!=null?{"anthropic-workspace-id":i}:void 0},t?.headers])},this._client,!1))}retrieve(n,t={},i){let{workspace_id:c}=t??{};return this._client.get(m`/v1/skills/${n}`,{...i,headers:f([{...c!=null?{"anthropic-workspace-id":c}:void 0},i?.headers])})}list(n={},t){let{workspace_id:i,...c}=n??{};return this._client.getAPIList("/v1/skills",T,{query:c,...t,headers:f([{...i!=null?{"anthropic-workspace-id":i}:void 0},t?.headers])})}delete(n,t={},i){let{workspace_id:c}=t??{};return this._client.delete(m`/v1/skills/${n}`,{...i,headers:f([{...c!=null?{"anthropic-workspace-id":c}:void 0},i?.headers])})}}return s.Versions=sn,s})();var Ki,zi,Bs,dc,Fu="\\n\\nHuman:",Hu="\\n\\nAssistant:",Du=(()=>{class s{get credentials(){return this._authState.provider}constructor({baseURL:n=N("ANTHROPIC_BASE_URL"),apiKey:t,authToken:i,webhookKey:c=N("ANTHROPIC_WEBHOOK_SIGNING_KEY")??null,...l}={}){if(Ki.add(this),this._requestAuthFlags=new WeakMap,Bs.set(this,void 0),t===void 0)t=l.profile!=null?null:N("ANTHROPIC_API_KEY")??null;if(i===void 0)i=l.profile!=null?null:N("ANTHROPIC_AUTH_TOKEN")??null;if(l.profile!=null&&(l.credentials!=null||l.config!=null))throw TypeError("Pass at most one of `profile`, `credentials`, or `config`.");let u={apiKey:t,authToken:i,webhookKey:c,...l,baseURL:n||"https://api.anthropic.com"};if(!u.dangerouslyAllowBrowser&&ro())throw new p(`It looks like you're running in a browser-like environment.
13
+
14
+ This is disabled by default, as it risks exposing your secret API credentials to attackers.
15
+ If you understand the risks and have appropriate mitigations in place,
16
+ you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
17
+
18
+ new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
19
+ `);this.baseURL=u.baseURL,this._baseURLIsExplicit=l.__baseURLIsExplicit??!!n,this.timeout=u.timeout??zi.DEFAULT_TIMEOUT,this.logger=u.logger??console,this.logLevel=Dn,this.logLevel=Ko(u.logLevel,"ClientOptions.logLevel",D(this))??Ko(N("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",D(this))??Dn,this.fetchOptions=u.fetchOptions,this.maxRetries=Go("maxRetries",u.maxRetries??2),this.fetch=u.fetch??ao(),o(this,Bs,lo,"f"),this.middleware=[...u.middleware??[]];let d=N("ANTHROPIC_CUSTOM_HEADERS");if(d){let g={};for(let x of d.split(`
20
+ `)){let _=x.indexOf(":");if(_>=0)g[x.substring(0,_).trim()]=x.substring(_+1).trim()}u.defaultHeaders={...g,...u.defaultHeaders}}let h=l.__auth;if(delete u.__auth,delete u.__baseURLIsExplicit,this._options=u,this.apiKey=typeof t==="string"?t:null,this.authToken=i,this.webhookKey=c,h){if(this._authState=h,!this._baseURLIsExplicit&&h.baseURL)this.baseURL=h.baseURL}else if(this._authState={provider:null,tokenCache:null,resolution:null,error:null,extraHeaders:{}},this.apiKey==null&&this.authToken==null){let g=u.credentials??null;if(g)this._authState.provider=g,this._authState.tokenCache=this._makeTokenCache(g);else if(u.config!=null){let x=ri(u.config,this._credentialResolverOptions());this._authState.provider=x.provider,this._authState.tokenCache=this._makeTokenCache(x.provider),this._authState.extraHeaders=x.extraHeaders,this._applyCredentialBaseURL(x.baseURL)}else if(u.profile!=null)this._authState.resolution=this._resolveDefaultCredentials(u.profile);else if(this._shouldResolveDefaultCredentials())this._authState.resolution=this._resolveDefaultCredentials()}}_shouldResolveDefaultCredentials(){return!0}_applyCredentialBaseURL(n){if(!n)return;let t=n.replace(/\/+$/,"");if(this._authState.baseURL=t,!this._baseURLIsExplicit)this.baseURL=t}_credentialResolverOptions(){return{baseURL:this.baseURL,fetch:this._credentialsFetch(),userAgent:this.getUserAgent(),onCacheWriteError:(n)=>{D(this).debug("credential cache write failed (best-effort)",n)},onSafetyWarning:(n)=>{D(this).warn(n)}}}_credentialsFetch(){return si(this.fetch,this.middleware,void 0,this)}_makeTokenCache(n){return new Zs(n,(t)=>{D(this).debug("advisory token refresh failed; serving cached token",t)})}withOptions(n){let t="credentials"in n||"config"in n||"profile"in n,i="apiKey"in n||"authToken"in n||t,c={...this._options,...this._baseURLIsExplicit?{baseURL:this.baseURL}:{},maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,middleware:this.middleware,apiKey:this.apiKey,authToken:this.authToken,webhookKey:this.webhookKey,credentials:this.credentials,...t?{credentials:void 0,config:void 0,profile:void 0}:{},...n,__auth:i?void 0:this._authState,__baseURLIsExplicit:"baseURL"in n?!0:this._baseURLIsExplicit};return new this.constructor(c)}async _resolveDefaultCredentials(n){try{let t=await Zo(this._credentialResolverOptions(),n);if(t)this._authState.provider=t.provider,this._authState.tokenCache=this._makeTokenCache(t.provider),this._authState.extraHeaders=t.extraHeaders,this._applyCredentialBaseURL(t.baseURL);else if(n!=null)throw new p(`Profile "${n}" could not be resolved (no <config_dir>/configs/${n}.json found).`)}catch(t){this._authState.error=t}finally{this._authState.resolution=null}}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:n,nulls:t}){if(n.get("x-api-key")||n.get("authorization"))return;if(this._authState.error)throw this._authState.error;if(this._authState.tokenCache||this._authState.resolution)return;if(this.apiKey&&n.get("x-api-key"))return;if(t.has("x-api-key"))return;if(this.authToken&&n.get("authorization"))return;if(t.has("authorization"))return;throw Error('Could not resolve authentication method. Expected one of apiKey, authToken, credentials, config, or profile to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}_authFlags(n){let t=this._requestAuthFlags.get(n);if(!t)t={usedTokenCache:!1,didRefreshFor401:!1},this._requestAuthFlags.set(n,t);return t}async authHeaders(n){if(this._authState.resolution)await this._authState.resolution;if(this._authState.error)return;if(this._authState.tokenCache&&this.apiKey==null){let t=await this._authState.tokenCache.getToken();return this._authFlags(n).usedTokenCache=!0,f([{Authorization:`Bearer ${t}`}])}return f([await this.apiKeyAuth(n),await this.bearerAuth(n)])}async apiKeyAuth(n){if(this.apiKey==null)return;return f([{"X-Api-Key":this.apiKey}])}async bearerAuth(n){if(this.authToken==null)return;return f([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(n){return yo(n)}getUserAgent(){return`Anthropic/JS ${we}`}makeStatusError(n,t,i,c){return le.generate(n,t,i,c)}buildURL(n,t,i){let c=!e(this,Ki,"m",dc).call(this)&&i||this.baseURL,l=na(n)?new URL(n):new URL(c+(c.endsWith("/")&&n.startsWith("/")?n.slice(1):n)),u=this.defaultQuery(),d=Object.fromEntries(l.searchParams);if(!ss(u)||!ss(d))t={...d,...u,...t};if(typeof t==="object"&&t&&!Array.isArray(t))l.search=this.stringifyQuery(t);return l.toString()}_calculateNonstreamingTimeout(n){if(3600*n/128000>600)throw new p("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions(n){}async prepareRequest(n,{url:t,options:i}){if(this._authState.tokenCache&&this.apiKey==null){let c=n.headers instanceof Headers?n.headers:new Headers(n.headers);for(let[u,d]of Object.entries(this._authState.extraHeaders))if(!c.has(u))c.set(u,d);let l=c.get("anthropic-beta")?.split(",").map((u)=>u.trim());if(!l?.includes(et))c.set("anthropic-beta",[...l??[],et].join(","));n.headers=c}}backendMiddleware(){return[]}get(n,t){return this.methodRequest("get",n,t)}post(n,t){return this.methodRequest("post",n,t)}patch(n,t){return this.methodRequest("patch",n,t)}put(n,t){return this.methodRequest("put",n,t)}delete(n,t){return this.methodRequest("delete",n,t)}methodRequest(n,t,i){return this.request(Promise.resolve(i).then((c)=>({method:n,path:t,...c})))}request(n,t=null){return new bn(this,this.makeRequest(n,t,void 0))}async makeRequest(n,t,i){let c=await n,l=Go("maxRetries",c.maxRetries??this.maxRetries);if(this.isStreamBody(c.body))l=0;if(t==null)t=l,this._requestAuthFlags.delete(c);await this.prepareOptions(c);let{req:u,url:d,timeout:h}=await this.buildRequest(c,{retryCount:l-t}),g="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),x=i===void 0?"":`, retryOf: ${i}`,_=Date.now();if(c.signal?.aborted)throw new Be;let b=new AbortController,w=await this.fetchWithTimeout(d,u,h,b,c,{requestLogID:g,retryOfRequestLogID:i}).catch(dr),S=Date.now();if(w instanceof globalThis.Error){Ce(b);let R=`retrying, ${t} attempts remaining`;if(c.signal?.aborted)throw new Be;let y=ht(w)||/timed? ?out/i.test(String(w)+("cause"in w?String(w.cause):"")),C=this.middleware.length>0||!!c.middleware?.length||this.backendMiddleware().length>0;if(C&&!y&&!ua(w))throw D(this).info(`[${g}] middleware error (not retryable)`),Et(D(this),`[${g}] middleware error (not retryable)`,{retryOfRequestLogID:i,url:d,durationMs:S-_,message:w.message}),w;if(t)return D(this).info(`[${g}] connection ${y?"timed out":"failed"} - ${R}`),Et(D(this),`[${g}] connection ${y?"timed out":"failed"} (${R})`,{retryOfRequestLogID:i,url:d,durationMs:S-_,message:w.message}),this.retryRequest(c,t,i??g);if(D(this).info(`[${g}] connection ${y?"timed out":"failed"} - error; no more retries left`),Et(D(this),`[${g}] connection ${y?"timed out":"failed"} (error; no more retries left)`,{retryOfRequestLogID:i,url:d,durationMs:S-_,message:w.message}),y)throw new Uo;if(C&&!ni(w))throw w;throw new Gt({cause:w})}let P=[...w.headers.entries()].filter(([R])=>R==="request-id"||R==="anthropic-workspace-id").map(([R,y])=>", "+R+": "+JSON.stringify(y)).join(""),k=`[${g}${x}${P}] ${u.method} ${d} ${w.ok?"succeeded":"failed"} with status ${w.status} in ${S-_}ms`;if(!w.ok){let R=await this.shouldRetry(w,c);if(t&&R){let L=`retrying, ${t} attempts remaining`;return await co(w.body),Ce(b),D(this).info(`${k} - ${L}`),Et(D(this),`[${g}] response error (${L})`,{retryOfRequestLogID:i,url:w.url,status:w.status,headers:w.headers,durationMs:S-_}),this.retryRequest(c,t,i??g,w.headers)}let y=R?"error; no more retries left":"error; not retryable";D(this).info(`${k} - ${y}`);let C=await w.text().catch((L)=>dr(L).message),O=Vo(C),M=O?void 0:C;throw Et(D(this),`[${g}] response error (${y})`,{retryOfRequestLogID:i,url:w.url,status:w.status,headers:w.headers,message:M,durationMs:Date.now()-_}),Ce(b),this.makeStatusError(w.status,O,M,w.headers)}return D(this).info(k),Et(D(this),`[${g}] response start`,{retryOfRequestLogID:i,url:w.url,status:w.status,headers:w.headers,durationMs:S-_}),oo(w.body??w,b),{response:w,options:c,controller:b,requestLogID:g,retryOfRequestLogID:i,startTime:_}}getAPIList(n,t,i){return this.requestAPIList(t,i&&"then"in i?i.then((c)=>({method:"get",path:n,...c})):{method:"get",path:n,...i})}requestAPIList(n,t){let i=this.makeRequest(t,null,void 0);return new da(this,i,n)}async fetchWithTimeout(n,t,i,c,l,u){let{signal:d,method:h,...g}=t||{},x=this._makeAbort(c);if(d)d.addEventListener("abort",x,{once:!0}),so(c,d,x);let _=globalThis.ReadableStream&&g.body instanceof globalThis.ReadableStream||typeof g.body==="object"&&g.body!==null&&Symbol.asyncIterator in g.body,b={signal:c.signal,..._?{duplex:"half"}:{},method:"GET",...g};if(h)b.method=h.toUpperCase();let w=this.fetch,S=async(C,O)=>{let M=setTimeout(x,i);try{return await w.call(void 0,C,O)}finally{clearTimeout(M)}},P=l===void 0?S:async(C,O={})=>{let M=typeof C==="string"?C:C instanceof URL?C.href:C.url;if(O.headers=O.headers instanceof Headers?O.headers:new Headers(O.headers),await this.prepareRequest(O,{url:M,options:l}),u)Et(D(this),`[${u.requestLogID}] sending request`,{retryOfRequestLogID:u.retryOfRequestLogID,method:O.method,url:M,options:l,headers:O.headers});return S(C,O)},k=l?.middleware,R=this.backendMiddleware(),y=k?.length||R.length?[...this.middleware,...k??[],...R]:this.middleware;return await si(P,y,l,this)(n,b)}async shouldRetry(n,t){let i=this._authFlags(t);if(n.status===401&&this._authState.tokenCache&&i.usedTokenCache&&!i.didRefreshFor401)return i.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let c=n.headers.get("x-should-retry");if(c==="true")return!0;if(c==="false")return!1;if(n.status===408)return!0;if(n.status===409)return!0;if(n.status===429)return!0;if(n.status>=500)return!0;return!1}async retryRequest(n,t,i,c){let l,u=c?.get("retry-after-ms");if(u){let h=parseFloat(u);if(!Number.isNaN(h))l=h}let d=c?.get("retry-after");if(d&&!l){let h=parseFloat(d);if(!Number.isNaN(h))l=h*1000;else l=Date.parse(d)-Date.now()}if(l===void 0||!(l>0&&l<=2147483647)){let h=n.maxRetries??this.maxRetries;l=this.calculateDefaultRetryTimeoutMillis(t,h)}return await Re(l,n.signal??void 0),this.makeRequest(n,t-1,i)}calculateDefaultRetryTimeoutMillis(n,t){let l=t-n,u=Math.min(0.5*Math.pow(2,l),8),d=1-Math.random()*0.25;return u*d*1000}calculateNonstreamingTimeout(n,t){if(3600000*n/128000>600000||t!=null&&n>t)throw new p("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest(n,{retryCount:t=0}={}){let i={...n},{method:c,path:l,query:u,defaultBaseURL:d}=i;if(this._authState.resolution)await this._authState.resolution;if(!this._baseURLIsExplicit&&this._authState.baseURL&&this.baseURL!==this._authState.baseURL)this.baseURL=this._authState.baseURL;let h=this.buildURL(l,u,d);if("timeout"in i)Go("timeout",i.timeout);i.timeout=i.timeout??this.timeout;let{bodyHeaders:g,body:x}=this.buildBody({options:i}),_=await this.buildHeaders({options:n,method:c,bodyHeaders:g,retryCount:t,timeout:i.timeout});return{req:{method:c,headers:_,...i.signal&&{signal:i.signal},...globalThis.ReadableStream&&x instanceof globalThis.ReadableStream&&{duplex:"half"},...x&&{body:x},...this.fetchOptions??{},...i.fetchOptions??{}},url:h,timeout:i.timeout}}async buildHeaders({options:n,method:t,bodyHeaders:i,retryCount:c,timeout:l}){let u=f([{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(c),"X-Stainless-Timeout":String(Math.trunc(l/1000)),...Lt(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(n),this._options.defaultHeaders,i,n.headers]);return this.validateHeaders(u),u.values}_makeAbort(n){return()=>n.abort()}buildBody({options:{body:n,headers:t}}){if(!n)return{bodyHeaders:void 0,body:void 0};let i=f([t]);if(ArrayBuffer.isView(n)||n instanceof ArrayBuffer||n instanceof DataView||typeof n==="string"&&i.values.has("content-type")||globalThis.Blob&&n instanceof globalThis.Blob||n instanceof FormData||n instanceof URLSearchParams||globalThis.ReadableStream&&n instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:n};else if(this.isStreamBody(n))return{bodyHeaders:void 0,body:un(n)};else if(typeof n==="object"&&i.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(n)};else return e(this,Bs,"f").call(this,{body:n,headers:i})}isStreamBody(n){if(globalThis.ReadableStream&&n instanceof globalThis.ReadableStream)return!0;return typeof n==="object"&&n!==null&&((Symbol.asyncIterator in n)||(Symbol.iterator in n)&&("next"in n)&&typeof n.next==="function")}}return zi=s,Bs=new WeakMap,Ki=new WeakSet,dc=function(){return this.baseURL!=="https://api.anthropic.com"},s.Anthropic=zi,s.DEFAULT_TIMEOUT=600000,s.AnthropicError=p,s.APIError=le,s.APIConnectionError=Gt,s.APIConnectionTimeoutError=Uo,s.APIUserAbortError=Be,s.NotFoundError=jo,s.ConflictError=Wo,s.RateLimitError=zo,s.BadRequestError=Fo,s.AuthenticationError=Bo,s.InternalServerError=qo,s.PermissionDeniedError=$o,s.UnprocessableEntityError=Ho,s.toFile=di,s.HUMAN_PROMPT=Fu,s.AI_PROMPT=Hu,s})(),Ws=(()=>{class s extends Du{constructor(){super(...arguments);this.completions=new Ct(this),this.messages=new nn(this),this.models=new Nt(this),this.files=new Ot(this),this.skills=new on(this),this.beta=new Jr(this)}}return s.Completions=Ct,s.Messages=nn,s.Models=Nt,s.Files=Ot,s.Skills=on,s.Beta=Jr,s})();var Bu=function(s,n){if(typeof s==="string"&&/^\.\.?\//.test(s))return s.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(t,i,c,l,u){return i?n?".jsx":".js":c&&(!l||!u)?t:c+l+"."+u.toLowerCase()+"js"});return s},Wu=null,Uu=null,ju=null,Vi=(s)=>import(Bu(s)),qu="node:fs",Ku="node:os",zu="node:path";if(typeof process<"u"&&(process.versions?.node||process.versions?.bun))Vi(qu).then((s)=>{Wu=s.existsSync}),Vi(Ku).then((s)=>{Uu=s.homedir}),Vi(zu).then((s)=>{ju=s.join});var rs="ANTHROPIC_AUTH_TOKEN",ta="ANTHROPIC_OAUTH_TOKEN",ra="ANTHROPIC_API_KEY",Mo="ANTHROPIC_FEDERATION_RULE_ID",Oo="ANTHROPIC_ORGANIZATION_ID",Lo="ANTHROPIC_SERVICE_ACCOUNT_ID",Do="ANTHROPIC_IDENTITY_TOKEN_FILE",No="ANTHROPIC_WORKSPACE_ID";function hc(s,n){if(s)return s;if(E("PI_CACHE_RETENTION",n)==="long")return"long";return"short"}function Vu(s,n,t){let i=hc(n,t);if(i==="none")return{retention:i};let c=i==="long"&&cn(s).supportsLongCacheRetention?"1h":void 0;return{retention:i,cacheControl:{type:"ephemeral",...c&&{ttl:c}}}}var Yu="2.1.280",Ju=["Read","Write","Edit","Bash","Grep","Glob","AskUserQuestion","EnterPlanMode","ExitPlanMode","KillShell","NotebookEdit","Skill","Task","TaskOutput","TodoWrite","WebFetch","WebSearch"],Gu=new Map(Ju.map((s)=>[s.toLowerCase(),s])),Xi=(s)=>Gu.get(s.toLowerCase())??s,Xu=(s,n)=>{if(n&&n.length>0){let t=s.toLowerCase(),i=n.find((c)=>c.name.toLowerCase()===t);if(i)return i.name}return s};function Qu(s){if(!s.some((c)=>c.type==="image"))return v(s.map((c)=>c.text).join(`
21
+ `));let t=s.map((c)=>{if(c.type==="text")return{type:"text",text:v(c.text)};return{type:"image",source:{type:"base64",media_type:c.mimeType,data:c.data}}});if(!t.some((c)=>c.type==="text"))t.unshift({type:"text",text:"(see attached image)"});return t}var Zu="fine-grained-tool-streaming-2025-05-14",ed="interleaved-thinking-2025-05-14",td="server-side-fallback-2026-07-01",rd="mid-conversation-output-config-2026-07-01",nd="thinking-binding-controls-2026-08-01",sd="inline-tools-2026-09-15",id={name:"__pi_deferred_placeholder__",description:"Reserved placeholder. Never available. Never call this.",input_schema:{type:"object",properties:{},required:[]},defer_loading:!0};function od(s){return(s.compat?.allowedFallbackModels?.length??0)>0}function cn(s){let n=s.provider==="openrouter"||s.baseUrl.includes("openrouter.ai");return{supportsEagerToolInputStreaming:s.compat?.supportsEagerToolInputStreaming??!0,supportsLongCacheRetention:s.compat?.supportsLongCacheRetention??!0,sendSessionAffinityHeaders:s.compat?.sendSessionAffinityHeaders??n,sessionAffinityFormat:s.compat?.sessionAffinityFormat??(n?"openrouter":void 0),supportsCacheControlOnTools:s.compat?.supportsCacheControlOnTools??!0,supportsTemperature:s.compat?.supportsTemperature??!0,allowEmptySignature:s.compat?.allowEmptySignature??!1,supportsStrictTools:s.compat?.supportsStrictTools??!1,supportsMidConvoSystemMessages:s.compat?.supportsMidConvoSystemMessages??!1,supportsMidConvoToolChanges:s.compat?.supportsMidConvoToolChanges??!1}}function ad(...s){let n={};for(let t of s)if(t)Object.assign(n,t);return n}function Yi(...s){return ad({"User-Agent":ce()},...s)}function Ji(s,n){if(!s)return!1;let t=n.toLowerCase();for(let[i,c]of Object.entries(s))if(i.toLowerCase()===t&&c!==null&&c.trim().length>0)return!0;return!1}function fc(s,n){return!!s||Ji(n,"authorization")||Ji(n,"x-api-key")||Ji(n,"cf-aig-authorization")}function pc(s,n,t){if(!fc(n,t))throw Error(`No API key for provider: ${s}`)}class an extends Ws{_shouldResolveDefaultCredentials(){return!1}}function mc(s,n,t,i){if(s.provider!=="anthropic"||fc(n,t))return;let c=E(Mo,i),l=E(Oo,i),u=E(Do,i);if(!c||!l||!u)return;return{organization_id:l,workspace_id:E(No,i),authentication:{type:"oidc_federation",federation_rule_id:c,service_account_id:E(Lo,i),identity_token:{source:"file",path:u}}}}var Us,cd=new Set(["message_start","message_delta","message_stop","content_block_start","content_block_delta","content_block_stop"]);function _c(s){if(!s.event&&s.data.length===0)return null;let n={event:s.event,data:s.data.join(`
22
+ `),raw:[...s.raw]};return s.event=null,s.data=[],s.raw=[],n}function Gi(s,n){if(s==="")return _c(n);if(n.raw.push(s),s.startsWith(":"))return null;let t=s.indexOf(":"),i=t===-1?s:s.slice(0,t),c=t===-1?"":s.slice(t+1);if(c.startsWith(" "))c=c.slice(1);if(i==="event")n.event=c;else if(i==="data")n.data.push(c);return null}function ld(s){let n=s.indexOf("\r"),t=s.indexOf(`
23
+ `);if(n===-1)return t;if(t===-1)return n;return Math.min(n,t)}function js(s){let n=ld(s);if(n===-1)return null;let t=n+1;if(s[n]==="\r"&&s[t]===`
24
+ `)t+=1;return{line:s.slice(0,n),rest:s.slice(t)}}async function*ud(s,n){let t=s.getReader(),i=new TextDecoder,c={event:null,data:[],raw:[]},l="";try{while(!0){if(n?.aborted)throw Error("Request was aborted");let{value:h,done:g}=await t.read();if(g)break;l+=i.decode(h,{stream:!0});let x=js(l);while(x){l=x.rest;let _=Gi(x.line,c);if(_)yield _;x=js(l)}}l+=i.decode();let u=js(l);while(u){l=u.rest;let h=Gi(u.line,c);if(h)yield h;u=js(l)}if(l.length>0){let h=Gi(l,c);if(h)yield h}let d=_c(c);if(d)yield d}finally{t.releaseLock()}}async function*dd(s,n){if(!s.body)throw Error("Attempted to iterate over an Anthropic response with no body");let t=!1,i=!1;for await(let c of ud(s.body,n)){if(c.event==="error")throw Error(c.data);if(!cd.has(c.event??""))continue;try{let l=io(c.data);if(l.type==="message_start")t=!0;else if(l.type==="message_stop")i=!0;yield l}catch(l){let u=l instanceof Error?l.message:String(l);throw Error(`Could not parse Anthropic SSE event ${c.event}: ${u}; data=${c.data}; raw=${c.raw.join("\\n")}`)}}if(t&&!i)throw Error("Anthropic stream ended before message_stop")}var Br=(s,n,t)=>{let i=new W,c=ue(n,cn(s).supportsMidConvoSystemMessages),l=me(c.messages);return(async()=>{let u=s.compat?.supportsMidConvoEffort?t?.effort??"high":void 0,d={role:"assistant",content:[],api:s.api,provider:s.provider,model:s.id,...u===void 0?{}:{providerThinkingLevel:u},usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"pending",timestamp:Date.now()};try{let h,g,x=s,_;if(t?.client)h=t.client,g=!1;else{let k=t?.apiKey,R=mc(s,k,t?.headers,t?.env);if(!R)pc(s.provider,k,t?.headers);let y;if(s.provider==="github-copilot"){let q=Qt(c.messages);y=Yt({messages:c.messages,hasImages:q})}let O=hc(t?.cacheRetention,t?.env)==="none"?void 0:t?.sessionId,M=pd(s,k,t?.headers,t?.fetch,y,O,R);h=M.client,g=M.isOAuthToken}let b={...t?.signal?{signal:t.signal}:{},...t?.timeoutMs!==void 0?{timeout:t.timeoutMs}:{},maxRetries:0},w=!1,S;for(;;){t?.signal?.throwIfAborted();let k=_d(s,c,g,t,w),R=k.params,y=await t?.onPayload?.(R,s);if(y!==void 0)R={...y,stream:!0};try{S=await ge(()=>h.beta.messages.create(R,b).asResponse(),{maxRetries:t?.maxRetries,maxRetryDelayMs:t?.maxRetryDelayMs,signal:t?.signal});break}catch(C){if(t?.signal?.aborted||w||!k.hasPreferredStrictTools||!(C instanceof Ws.APIError)||C.status!==400||C.type!=="invalid_request_error"||!["The compiled grammar is too large","Too many strict tools (","Schemas contains too many parameters with union types ("].some((O)=>C.message.includes(O)))throw C;w=!0,He(d,{type:"anthropic_strict_tools_fallback",timestamp:Date.now(),error:{message:C.message},details:{reason:"strict_tool_limits_exceeded"}})}}await t?.onResponse?.({status:S.status,headers:J(S.headers)},s),i.push({type:"start",partial:d});let P=d.content;for await(let k of dd(S,t?.signal))if(await t?.onProviderStreamEvent?.(k,s),k.type==="message_start"){d.responseId=k.message.id;let R=k.message.input_transformations;if(Array.isArray(R))_=R;let y=k.message.model;if(y!==s.id)d.responseModel=y;let C=y===s.id?void 0:s.compat?.allowedFallbackModels?.find((O)=>O.provider===s.provider&&O.model===y)?.cost;x=C?{...s,id:y,cost:C}:s,d.usage.input=k.message.usage.input_tokens||0,d.usage.output=k.message.usage.output_tokens||0,d.usage.cacheRead=k.message.usage.cache_read_input_tokens||0,d.usage.cacheWrite=k.message.usage.cache_creation_input_tokens||0,d.usage.cacheWrite1h=k.message.usage.cache_creation?.ephemeral_1h_input_tokens||0,d.usage.totalTokens=d.usage.input+d.usage.output+d.usage.cacheRead+d.usage.cacheWrite,ne(x,d.usage)}else if(k.type==="content_block_start"){if(k.content_block.type==="fallback"){if(d.content.length>0)throw Error("Anthropic performed an unsupported mid-output model fallback");continue}if(k.content_block.type==="text"){let R={type:"text",text:k.content_block.text??"",index:k.index};d.content.push(R),i.push({type:"text_start",contentIndex:d.content.length-1,partial:d})}else if(k.content_block.type==="thinking"){let R={type:"thinking",thinking:k.content_block.thinking??"",thinkingSignature:k.content_block.signature??"",index:k.index};d.content.push(R),i.push({type:"thinking_start",contentIndex:d.content.length-1,partial:d})}else if(k.content_block.type==="redacted_thinking"){let R={type:"thinking",thinking:"[Reasoning redacted]",thinkingSignature:k.content_block.data,redacted:!0,index:k.index};d.content.push(R),i.push({type:"thinking_start",contentIndex:d.content.length-1,partial:d})}else if(k.content_block.type==="tool_use"){let R={type:"toolCall",id:k.content_block.id,name:g?Xu(k.content_block.name,l):k.content_block.name,arguments:k.content_block.input??{},partialJson:"",index:k.index};d.content.push(R),i.push({type:"toolcall_start",contentIndex:d.content.length-1,partial:d})}}else if(k.type==="content_block_delta"){if(k.delta.type==="text_delta"){let R=P.findIndex((C)=>C.index===k.index),y=P[R];if(y&&y.type==="text")y.text+=k.delta.text,i.push({type:"text_delta",contentIndex:R,delta:k.delta.text,partial:d})}else if(k.delta.type==="thinking_delta"){let R=P.findIndex((C)=>C.index===k.index),y=P[R];if(y&&y.type==="thinking")y.thinking+=k.delta.thinking,i.push({type:"thinking_delta",contentIndex:R,delta:k.delta.thinking,partial:d})}else if(k.delta.type==="input_json_delta"){let R=P.findIndex((C)=>C.index===k.index),y=P[R];if(y&&y.type==="toolCall")y.partialJson+=k.delta.partial_json,y.arguments=V(y.partialJson),i.push({type:"toolcall_delta",contentIndex:R,delta:k.delta.partial_json,partial:d})}else if(k.delta.type==="signature_delta"){let R=P.findIndex((C)=>C.index===k.index),y=P[R];if(y&&y.type==="thinking")y.thinkingSignature=y.thinkingSignature||"",y.thinkingSignature+=k.delta.signature}}else if(k.type==="content_block_stop"){let R=P.findIndex((C)=>C.index===k.index),y=P[R];if(y){if(delete y.index,y.type==="text")i.push({type:"text_end",contentIndex:R,content:y.text,partial:d});else if(y.type==="thinking")i.push({type:"thinking_end",contentIndex:R,content:y.thinking,partial:d});else if(y.type==="toolCall")y.arguments=V(y.partialJson),delete y.partialJson,i.push({type:"toolcall_end",contentIndex:R,toolCall:y,partial:d})}}else if(k.type==="message_delta"){let R=k.input_transformations;if(Array.isArray(R))_=R;if(k.delta.stop_reason){d.rawStopReason=k.delta.stop_reason;let y=Rd(k.delta.stop_reason,k.delta.stop_details);if(d.stopReason=y.stopReason,y.errorMessage)d.errorMessage=y.errorMessage}if(k.usage){if(k.usage.input_tokens!=null)d.usage.input=k.usage.input_tokens;if(k.usage.output_tokens!=null)d.usage.output=k.usage.output_tokens;if(k.usage.cache_read_input_tokens!=null)d.usage.cacheRead=k.usage.cache_read_input_tokens;if(k.usage.cache_creation_input_tokens!=null)d.usage.cacheWrite=k.usage.cache_creation_input_tokens;let y=k.usage.cache_creation;if(y?.ephemeral_1h_input_tokens!=null)d.usage.cacheWrite1h=y.ephemeral_1h_input_tokens;let C=k.usage.output_tokens_details?.thinking_tokens;if(C!=null)d.usage.reasoning=C}d.usage.totalTokens=d.usage.input+d.usage.output+d.usage.cacheRead+d.usage.cacheWrite,ne(x,d.usage)}if(t?.signal?.aborted)throw Error("Request was aborted");if(d.stopReason==="pending")throw Error("Anthropic stream ended without a stop reason");if(d.stopReason==="aborted"||d.stopReason==="error")throw Error(d.errorMessage||"An unknown error occurred");if(_&&_.length>0)He(d,{type:"anthropic_input_transformations",timestamp:Date.now(),details:{transformations:_.map((k)=>({type:k.type??void 0,path:k.path??void 0,reason:k.reason??void 0}))}});i.push({type:"done",reason:d.stopReason,message:d}),i.end()}catch(h){for(let g of d.content)delete g.index,delete g.partialJson;d.stopReason=t?.signal?.aborted?"aborted":"error",d.errorMessage=h instanceof Error?h.message:JSON.stringify(h),i.push({type:"error",reason:d.stopReason,error:d}),i.end()}})(),i};function hd(s,n){let t=n?s.thinkingLevelMap?.[n]:void 0;if(typeof t==="string")return t;switch(n){case"minimal":case"low":return"low";case"medium":return"medium";case"high":return"high";default:return"high"}}var ns=(s,n,t)=>{if(!mc(s,t?.apiKey,t?.headers,t?.env))pc(s.provider,t?.apiKey,t?.headers);let i={...te(s,n,t,t?.apiKey),toolChoice:t?.toolChoice};if(!t?.reasoning)return Br(s,n,{...i,thinkingEnabled:!1});if(s.compat?.forceAdaptiveThinking===!0){let u=hd(s,t.reasoning);return Br(s,n,{...i,thinkingEnabled:!0,effort:u})}let c=jn(i.maxTokens,s.maxTokens,t.reasoning,t.thinkingBudgets),l=Hr(s,n,c.maxTokens);return Br(s,n,{...i,maxTokens:l,thinkingEnabled:!0,thinkingBudgetTokens:Math.min(c.thinkingBudget,Math.max(0,l-1024))})};function fd(s){return s.includes("sk-ant-oat")}function pd(s,n,t,i,c,l,u){if(s.provider==="github-copilot")return{client:new an({apiKey:null,authToken:n??null,baseURL:s.baseUrl,dangerouslyAllowBrowser:!0,fetch:i,defaultHeaders:Yi({accept:"application/json","anthropic-dangerous-direct-browser-access":"true"},s.headers,c,t)}),isOAuthToken:!1};if(n&&fd(n))return{client:new an({apiKey:null,authToken:n,baseURL:s.baseUrl,dangerouslyAllowBrowser:!0,fetch:i,defaultHeaders:Yi({accept:"application/json","anthropic-dangerous-direct-browser-access":"true","user-agent":`claude-cli/${Yu}`,"x-app":"cli"},s.headers,t)}),isOAuthToken:!0};let d=cn(s),h={};if(l&&d.sendSessionAffinityHeaders){let _=d.sessionAffinityFormat==="openrouter"?"x-session-id":"x-session-affinity";h[_]=l}let g=Yi({accept:"application/json","anthropic-dangerous-direct-browser-access":"true"},h,s.headers,t);if(u){let _=JSON.stringify([s.baseUrl,u]);if(Us?.key!==_||Us.fetch!==i){let b=new an({apiKey:null,authToken:null,config:u,baseURL:s.baseUrl,dangerouslyAllowBrowser:!0,fetch:i});Us={key:_,fetch:i,client:b}}return{client:Us.client.withOptions({defaultHeaders:g}),isOAuthToken:!1}}return{client:new an({apiKey:n??null,authToken:null,baseURL:s.baseUrl,dangerouslyAllowBrowser:!0,fetch:i,defaultHeaders:g}),isOAuthToken:!1}}function md(s,n,t,i,c){let l;for(let d of[s.headers,c?.headers])for(let[h,g]of Object.entries(d??{}))if(h.toLowerCase()==="anthropic-beta")l=g;if(l===null)return[];if(l!==void 0)return[...new Set(l.split(",").map((d)=>d.trim()).filter((d)=>d.length>0))];let u=[];if(t)u.push("claude-code-20250219","oauth-2025-04-20");if(Sd(s,n))u.push(Zu);if(s.reasoning&&c?.thinkingEnabled===!0&&(c.interleavedThinking??!0)&&s.compat?.forceAdaptiveThinking!==!0)u.push(ed);if(od(s))u.push(td);if(s.compat?.supportsMidConvoEffort===!0)u.push(rd,nd);if(i)u.push(sd);return[...new Set(u)]}function _d(s,n,t,i,c=!1){let{cacheControl:l}=Vu(s,i?.cacheRetention,i?.env),u=cn(s),d=ve(n.messages),h=d?G(d):"",g=Te(n.messages,s,gd),x=d?g.slice(1):g,_=!1,b=(M,q)=>{let L=Ad(M,t,u.supportsEagerToolInputStreaming,u.supportsStrictTools,q,c);if(L.some((K,H)=>{let B=M[H].constrainedSampling;return K.strict===!0&&B&&B.type==="json_schema"&&B.strict==="prefer"}))_=!0;return L},w=d?.toolsAdded??[],S=u.supportsMidConvoSystemMessages&&u.supportsMidConvoToolChanges&&w.length>0,P=yd(x,t,l,u.allowEmptySignature,s.compat?.supportsMidConvoEffort===!0?s.provider:void 0,S?b:void 0),k=i?.effort??"high",R=md(s,n,t,S,i),y={model:s.id,messages:s.compat?.supportsMidConvoEffort===!0?kd(P,k):P.messages,max_tokens:i?.maxTokens??s.maxTokens,stream:!0,...R.length>0?{betas:R}:{}};if(t){if(y.system=[{type:"text",text:"You are Claude Code, Anthropic's official CLI for Claude.",...l?{cache_control:l}:{}}],h)y.system.push({type:"text",text:v(h),...l?{cache_control:l}:{}})}else if(h)y.system=[{type:"text",text:v(h),...l?{cache_control:l}:{}}];if(i?.temperature!==void 0&&!i?.thinkingEnabled&&s.compat?.supportsMidConvoEffort!==!0&&u.supportsTemperature)y.temperature=i.temperature;let C=u.supportsCacheControlOnTools?l:void 0;if(S)y.tools=[...b(w,C),id];else{let M=me(n.messages);if(M.length>0)y.tools=b(M,C)}if(s.compat?.supportsMidConvoEffort===!0)y.thinking={type:"adaptive",display:i?.thinkingDisplay??"summarized",block_binding:{prefix_mismatch_behavior:"drop_block"}},y.output_config={effort:"high"};else if(s.reasoning){if(i?.thinkingEnabled){let M=i.thinkingDisplay??"summarized";if(s.compat?.forceAdaptiveThinking===!0){if(y.thinking={type:"adaptive",display:M},i.effort)y.output_config={effort:i.effort}}else y.thinking={type:"enabled",budget_tokens:i.thinkingBudgetTokens||1024,display:M}}else if(i?.thinkingEnabled===!1&&s.thinkingLevelMap?.off!==null)y.thinking={type:"disabled"}}if(i?.metadata){let M=i.metadata.user_id;if(typeof M==="string")y.metadata={user_id:M}}if(i?.toolChoice)if(typeof i.toolChoice==="string")y.tool_choice={type:i.toolChoice};else y.tool_choice=i.toolChoice;let O=s.compat?.allowedFallbackModels;if(O&&O.length>0)y.fallbacks=O.map((M)=>({model:M.model}));return{params:y,hasPreferredStrictTools:_}}function gd(s){return s.replace(/[^a-zA-Z0-9_-]/g,"_").slice(0,64)}function wd(s){return{type:"tool_result",tool_use_id:s.toolCallId,content:Qu(s.content),is_error:s.isError}}function yd(s,n,t,i=!1,c,l){let u=[],d=new Map,h=[],g=()=>{u.push(...h),h.length=0};for(let x=0;x<s.length;x++){let _=s[x];if(_.role==="system"){let b=Ke(_),w=[];if(b.length>0)w.push({type:"text",text:v(b)});if(l){let S=_.toolsAdded??[],P=new Set(S.map((k)=>k.name));for(let k of _.toolsRemoved??[]){if(P.has(k.name))continue;w.push({type:"tool_removal",tool:{type:"tool_reference",name:n?Xi(k.name):k.name}})}for(let k of l(S))w.push({type:"tool_addition",tool:{type:"tool_definition",definition:k}})}if(w.length>0)h.push({role:"system",content:w})}else if(_.role==="user")if(typeof _.content==="string"){if(_.content.trim().length>0)u.push({role:"user",content:v(_.content)})}else{let w=_.content.map((S)=>{if(S.type==="text")return{type:"text",text:v(S.text)};else return{type:"image",source:{type:"base64",media_type:S.mimeType,data:S.data}}}).filter((S)=>{if(S.type==="text")return S.text.trim().length>0;return!0});if(w.length===0)continue;u.push({role:"user",content:w})}else if(_.role==="assistant"){g();let b=[];for(let S of _.content)if(S.type==="text"){if(S.text.trim().length===0)continue;b.push({type:"text",text:v(S.text)})}else if(S.type==="thinking"){if(S.redacted){b.push({type:"redacted_thinking",data:S.thinkingSignature});continue}let P=S.thinkingSignature,k=!!P&&P.trim().length>0;if(S.thinking.trim().length===0&&!k)continue;if(!k)b.push(i?{type:"thinking",thinking:v(S.thinking),signature:""}:{type:"text",text:v(S.thinking)});else b.push({type:"thinking",thinking:v(S.thinking),signature:P})}else if(S.type==="toolCall")b.push({type:"tool_use",id:S.id,name:n?Xi(S.name):S.name,input:S.arguments??{}});if(b.length===0)continue;let w=u.length;if(u.push({role:"assistant",content:b}),c!==void 0&&_.api==="anthropic-messages"&&_.provider===c&&bd(_.providerThinkingLevel))d.set(w,_.providerThinkingLevel)}else if(_.role==="toolResult"){let b=[],w=x;while(w<s.length&&s[w].role==="toolResult")b.push(wd(s[w])),w++;x=w-1,u.push({role:"user",content:b})}}if(g(),t&&u.length>0){let x=u[u.length-1];if(x.role==="user"||x.role==="system"){if(Array.isArray(x.content)){let _=x.content[x.content.length-1];if(_&&(_.type==="text"||_.type==="image"||_.type==="tool_result"||_.type==="tool_addition"||_.type==="tool_removal"))_.cache_control=t}else if(typeof x.content==="string")x.content=[{type:"text",text:x.content,cache_control:t}]}}return{messages:u,assistantLevels:d}}function bd(s){return s==="low"||s==="medium"||s==="high"||s==="xhigh"||s==="max"}function kd(s,n){let t=[];for(let i=0;i<s.messages.length;i++){let c=s.assistantLevels.get(i);if(c!==void 0)t.push({role:"system",content:[],output_config:{effort:c}});t.push(s.messages[i])}return t.push({role:"system",content:[],output_config:{effort:n}}),t}function Sd(s,n){return me(n.messages).length>0&&!cn(s).supportsEagerToolInputStreaming}var vd=new Set(["minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","maxItems","uniqueItems","minContains","maxContains","minProperties","maxProperties"]),xd=new Set(["date-time","time","date","duration","email","hostname","uri","ipv4","ipv6","uuid"]),Ed=(s,n)=>{if(vd.has(s))return!0;if(s==="minItems")return n!==0&&n!==1;if(s==="format")return typeof n!=="string"||!xd.has(n);return!1};function Ad(s,n,t,i,c,l=!1){if(!s)return[];return s.map((u,d)=>{let h=u.constrainedSampling,g=l&&h&&h.type==="json_schema"&&h.strict==="prefer"?void 0:xe(u,i,Ed),x=Ae(u,g),_=x,b={type:"object",properties:_.properties??{},required:_.required??[]},w=g===!0?{...x,...b}:b;return{name:n?Xi(u.name):u.name,description:u.description,...t?{eager_input_streaming:!0}:{},...g===!0?{strict:!0}:{},input_schema:w,...c&&d===s.length-1?{cache_control:c}:{}}})}function Rd(s,n){switch(s){case"end_turn":return{stopReason:"stop"};case"max_tokens":return{stopReason:"length"};case"tool_use":return{stopReason:"toolUse"};case"refusal":return{stopReason:"error",errorMessage:n?.explanation||"The model refused to complete the request"};case"pause_turn":return{stopReason:"stop"};case"stop_sequence":return{stopReason:"stop"};case"sensitive":return{stopReason:"error",errorMessage:"Provider stopped with: sensitive"};default:throw Error(`Unhandled stop reason: ${s}`)}}
25
+ export{rs,ta,ra,Mo,Oo,Lo,Do,No,Br,ns};