@bkm016/basalt 0.1.37 → 0.1.38

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 (898) hide show
  1. package/chunk-02kyx0dt.js +3 -0
  2. package/chunk-19nje7ny.js +5 -0
  3. package/chunk-1rt7fvft.js +51 -0
  4. package/chunk-23qfxx3v.js +3 -0
  5. package/chunk-28dpfw91.js +20 -0
  6. package/chunk-2bz3h7k7.js +18 -0
  7. package/chunk-2etdp9zt.js +3 -0
  8. package/chunk-3bc88p88.js +2 -0
  9. package/chunk-3bqs901a.js +3 -0
  10. package/chunk-4kg028qe.js +3 -0
  11. package/chunk-4ry04733.js +2 -0
  12. package/chunk-4zvzk6m5.js +25 -0
  13. package/chunk-5ngmwd2s.js +3 -0
  14. package/chunk-5yzts6r0.js +3 -0
  15. package/chunk-6bvjnr88.js +3 -0
  16. package/chunk-76jjaj1p.js +7 -0
  17. package/chunk-7ph88zkj.js +3 -0
  18. package/chunk-7t89zqqx.js +8 -0
  19. package/chunk-80vdhw6b.js +2 -0
  20. package/chunk-89aqq5v0.js +59 -0
  21. package/chunk-8bcc3rqc.js +2 -0
  22. package/chunk-97531m3c.js +2 -0
  23. package/chunk-9b4ssdy4.js +3 -0
  24. package/chunk-9map5c1b.js +12 -0
  25. package/chunk-a0ycrvgz.js +2 -0
  26. package/chunk-ah2ttnaa.js +2 -0
  27. package/chunk-awe58cxg.js +3175 -0
  28. package/chunk-b3ss17r8.js +547 -0
  29. package/chunk-b5ph3ffy.js +39 -0
  30. package/chunk-cz9r99b6.js +2 -0
  31. package/chunk-d57kcznk.js +16 -0
  32. package/chunk-etf8mj2z.js +2 -0
  33. package/chunk-fkgx9eab.js +2 -0
  34. package/chunk-fmvs5wd0.js +11 -0
  35. package/chunk-fpksd95h.js +3 -0
  36. package/chunk-hj1zcq3p.js +13 -0
  37. package/chunk-jaat2z8t.js +117 -0
  38. package/chunk-jkc887x8.js +2 -0
  39. package/chunk-jnas3anm.js +3 -0
  40. package/chunk-k3p05x7q.js +2 -0
  41. package/chunk-k6fqtjt8.js +3 -0
  42. package/chunk-kh4b25x0.js +12 -0
  43. package/chunk-kn8p9hm4.js +3 -0
  44. package/chunk-kxznfjhk.js +2 -0
  45. package/chunk-ma4nhnnj.js +3 -0
  46. package/chunk-n09zsaws.js +60 -0
  47. package/chunk-nb7c0e4a.js +10 -0
  48. package/chunk-pvbaf50c.js +7 -0
  49. package/chunk-pzg6f8rv.js +3 -0
  50. package/chunk-q7scf6rq.js +5 -0
  51. package/chunk-qc0d97yy.js +9 -0
  52. package/chunk-qn316bye.js +3 -0
  53. package/chunk-rapgtezp.js +3 -0
  54. package/chunk-rbz68jdh.js +2 -0
  55. package/chunk-rkq3zqph.js +3 -0
  56. package/chunk-rva3kxc4.js +3 -0
  57. package/chunk-s8ce8wwb.js +5 -0
  58. package/chunk-srmxyfvj.js +4 -0
  59. package/chunk-ss48r7hh.js +2 -0
  60. package/chunk-trf8d8md.js +2 -0
  61. package/chunk-v312dzv1.js +2 -0
  62. package/chunk-v9pc3ad7.js +3 -0
  63. package/chunk-vq3b921g.js +2 -0
  64. package/chunk-w8arnzsm.js +10 -0
  65. package/chunk-wa3w6q66.js +2 -0
  66. package/chunk-wyaep3eb.js +103 -0
  67. package/chunk-x31xqemq.js +3 -0
  68. package/chunk-x4nt43pv.js +2 -0
  69. package/chunk-xjr4j102.js +31 -0
  70. package/chunk-xtzxv389.js +3 -0
  71. package/chunk-y91ea95f.js +7 -0
  72. package/chunk-yyeq63ns.js +2 -0
  73. package/chunk-z1hbxv39.js +2 -0
  74. package/chunk-zej3kgxg.js +5 -0
  75. package/chunk-zkhn196x.js +25 -0
  76. package/chunk-zztar24h.js +8 -0
  77. package/compiled.js +9 -9
  78. package/package.json +1 -1
  79. package/ui-test-worker.js +34 -33
  80. package/web/chunk-0qmwgbg8.js +1 -0
  81. package/web/chunk-0qmwgbg8.js.br +0 -0
  82. package/web/chunk-0qmwgbg8.js.gz +0 -0
  83. package/web/chunk-0vavwwh2.js +2 -0
  84. package/web/chunk-0vavwwh2.js.br +0 -0
  85. package/web/chunk-0vavwwh2.js.gz +0 -0
  86. package/web/chunk-0vmbj6hc.js +89 -0
  87. package/web/chunk-0vmbj6hc.js.br +0 -0
  88. package/web/chunk-0vmbj6hc.js.gz +0 -0
  89. package/web/chunk-17qjx34e.js +1 -0
  90. package/web/chunk-17qjx34e.js.br +0 -0
  91. package/web/chunk-17qjx34e.js.gz +0 -0
  92. package/web/chunk-1vewct29.js +78 -0
  93. package/web/chunk-1vewct29.js.br +0 -0
  94. package/web/chunk-1vewct29.js.gz +0 -0
  95. package/web/chunk-2hz3atj2.js +1 -0
  96. package/web/chunk-2hz3atj2.js.br +0 -0
  97. package/web/chunk-2hz3atj2.js.gz +0 -0
  98. package/web/chunk-3c66z204.js +1 -0
  99. package/web/chunk-3c66z204.js.br +0 -0
  100. package/web/chunk-3c66z204.js.gz +0 -0
  101. package/web/chunk-3ctk7p8b.js +200 -0
  102. package/web/chunk-3ctk7p8b.js.br +0 -0
  103. package/web/chunk-3ctk7p8b.js.gz +0 -0
  104. package/web/chunk-3rnbw3ds.js +2 -0
  105. package/web/chunk-3rnbw3ds.js.br +0 -0
  106. package/web/chunk-3rnbw3ds.js.gz +0 -0
  107. package/web/chunk-3t6c1rn7.js +2 -0
  108. package/web/chunk-3t6c1rn7.js.br +0 -0
  109. package/web/chunk-3t6c1rn7.js.gz +0 -0
  110. package/web/chunk-48f75wpj.js +1 -0
  111. package/web/chunk-48f75wpj.js.br +0 -0
  112. package/web/chunk-48f75wpj.js.gz +0 -0
  113. package/web/chunk-4sr7g3z6.js +70 -0
  114. package/web/chunk-4sr7g3z6.js.br +0 -0
  115. package/web/chunk-4sr7g3z6.js.gz +0 -0
  116. package/web/chunk-54kxhs8a.js +1 -0
  117. package/web/chunk-54kxhs8a.js.br +0 -0
  118. package/web/chunk-54kxhs8a.js.gz +0 -0
  119. package/web/chunk-5cbw7v9g.js +324 -0
  120. package/web/chunk-5cbw7v9g.js.br +0 -0
  121. package/web/chunk-5cbw7v9g.js.gz +0 -0
  122. package/web/chunk-5kxhdpsw.js +99 -0
  123. package/web/chunk-5kxhdpsw.js.br +0 -0
  124. package/web/chunk-5kxhdpsw.js.gz +0 -0
  125. package/web/chunk-5s16b1h5.js +2 -0
  126. package/web/chunk-5s16b1h5.js.br +0 -0
  127. package/web/chunk-5s16b1h5.js.gz +0 -0
  128. package/web/chunk-5z2f4vfh.js +1 -0
  129. package/web/chunk-5z2f4vfh.js.br +0 -0
  130. package/web/chunk-5z2f4vfh.js.gz +0 -0
  131. package/web/chunk-664zwasq.js +217 -0
  132. package/web/chunk-664zwasq.js.br +0 -0
  133. package/web/chunk-664zwasq.js.gz +0 -0
  134. package/web/chunk-6hgxmv17.js +1 -0
  135. package/web/chunk-6hgxmv17.js.br +0 -0
  136. package/web/chunk-6hgxmv17.js.gz +0 -0
  137. package/web/chunk-6wesgn4j.js +332 -0
  138. package/web/chunk-6wesgn4j.js.br +0 -0
  139. package/web/chunk-6wesgn4j.js.gz +0 -0
  140. package/web/chunk-6xnzhe0e.js +12 -0
  141. package/web/chunk-6xnzhe0e.js.br +0 -0
  142. package/web/chunk-6xnzhe0e.js.gz +0 -0
  143. package/web/chunk-73effb3e.js +1 -0
  144. package/web/chunk-73effb3e.js.br +0 -0
  145. package/web/chunk-73effb3e.js.gz +0 -0
  146. package/web/chunk-744jv40n.js +7 -0
  147. package/web/chunk-744jv40n.js.br +0 -0
  148. package/web/chunk-744jv40n.js.gz +0 -0
  149. package/web/chunk-74x21fpx.js +23 -0
  150. package/web/chunk-74x21fpx.js.br +0 -0
  151. package/web/chunk-74x21fpx.js.gz +0 -0
  152. package/web/chunk-75jp6b07.js +1 -0
  153. package/web/chunk-75jp6b07.js.br +0 -0
  154. package/web/chunk-75jp6b07.js.gz +0 -0
  155. package/web/chunk-776d411a.js +1143 -0
  156. package/web/chunk-776d411a.js.br +0 -0
  157. package/web/chunk-776d411a.js.gz +0 -0
  158. package/web/chunk-77fdf0t8.js +1 -0
  159. package/web/chunk-77fdf0t8.js.br +0 -0
  160. package/web/chunk-77fdf0t8.js.gz +0 -0
  161. package/web/chunk-85cyf9df.js +1 -0
  162. package/web/chunk-85cyf9df.js.br +0 -0
  163. package/web/chunk-85cyf9df.js.gz +0 -0
  164. package/web/chunk-8kxc78xp.js +4 -0
  165. package/web/chunk-8kxc78xp.js.br +0 -0
  166. package/web/chunk-8kxc78xp.js.gz +0 -0
  167. package/web/chunk-9j7v0e4v.js +2 -0
  168. package/web/chunk-9j7v0e4v.js.br +0 -0
  169. package/web/chunk-9j7v0e4v.js.gz +0 -0
  170. package/web/chunk-9kfxbebp.js +2 -0
  171. package/web/chunk-9kfxbebp.js.br +1 -0
  172. package/web/chunk-9kfxbebp.js.gz +0 -0
  173. package/web/chunk-b1x8wmyp.js +1 -0
  174. package/web/chunk-b1x8wmyp.js.br +2 -0
  175. package/web/chunk-b1x8wmyp.js.gz +0 -0
  176. package/web/chunk-bpy0qc5f.js +1 -0
  177. package/web/chunk-bpy0qc5f.js.br +0 -0
  178. package/web/chunk-bpy0qc5f.js.gz +0 -0
  179. package/web/chunk-brsvdef4.js +1 -0
  180. package/web/chunk-brsvdef4.js.br +0 -0
  181. package/web/chunk-brsvdef4.js.gz +0 -0
  182. package/web/chunk-bs8vnwtv.js +106 -0
  183. package/web/chunk-bs8vnwtv.js.br +0 -0
  184. package/web/chunk-bs8vnwtv.js.gz +0 -0
  185. package/web/chunk-cd3hhgn9.js +2 -0
  186. package/web/chunk-cd3hhgn9.js.br +0 -0
  187. package/web/chunk-cd3hhgn9.js.gz +0 -0
  188. package/web/chunk-ckpx6ky8.js +2 -0
  189. package/web/chunk-ckpx6ky8.js.br +0 -0
  190. package/web/chunk-ckpx6ky8.js.gz +0 -0
  191. package/web/chunk-cn4846p5.js +140 -0
  192. package/web/chunk-cn4846p5.js.br +0 -0
  193. package/web/chunk-cn4846p5.js.gz +0 -0
  194. package/web/chunk-cngcze57.js +84 -0
  195. package/web/chunk-cngcze57.js.br +0 -0
  196. package/web/chunk-cngcze57.js.gz +0 -0
  197. package/web/chunk-csg9anab.js +62 -0
  198. package/web/chunk-csg9anab.js.br +0 -0
  199. package/web/chunk-csg9anab.js.gz +0 -0
  200. package/web/chunk-ct98jt0b.js +2 -0
  201. package/web/chunk-ct98jt0b.js.br +0 -0
  202. package/web/chunk-ct98jt0b.js.gz +0 -0
  203. package/web/chunk-d67p0nr5.js +8 -0
  204. package/web/chunk-d67p0nr5.js.br +0 -0
  205. package/web/chunk-d67p0nr5.js.gz +0 -0
  206. package/web/chunk-dqynqkew.js +3 -0
  207. package/web/chunk-dqynqkew.js.br +0 -0
  208. package/web/chunk-dqynqkew.js.gz +0 -0
  209. package/web/chunk-drn8wj2p.js +41 -0
  210. package/web/chunk-drn8wj2p.js.br +0 -0
  211. package/web/chunk-drn8wj2p.js.gz +0 -0
  212. package/web/chunk-e0r89rgm.js +2 -0
  213. package/web/chunk-e0r89rgm.js.br +0 -0
  214. package/web/chunk-e0r89rgm.js.gz +0 -0
  215. package/web/chunk-e6ffgm2z.js +89 -0
  216. package/web/chunk-e6ffgm2z.js.br +0 -0
  217. package/web/chunk-e6ffgm2z.js.gz +0 -0
  218. package/web/chunk-ebphre6k.js +292 -0
  219. package/web/chunk-ebphre6k.js.br +0 -0
  220. package/web/chunk-ebphre6k.js.gz +0 -0
  221. package/web/chunk-edeebkv0.js +2 -0
  222. package/web/chunk-edeebkv0.js.br +0 -0
  223. package/web/chunk-edeebkv0.js.gz +0 -0
  224. package/web/chunk-edkvcg8g.js +1 -0
  225. package/web/chunk-edkvcg8g.js.br +0 -0
  226. package/web/chunk-edkvcg8g.js.gz +0 -0
  227. package/web/chunk-evt920fg.js +142 -0
  228. package/web/chunk-evt920fg.js.br +0 -0
  229. package/web/chunk-evt920fg.js.gz +0 -0
  230. package/web/chunk-ezehzx5e.js +1 -0
  231. package/web/chunk-ezehzx5e.js.br +2 -0
  232. package/web/chunk-ezehzx5e.js.gz +0 -0
  233. package/web/chunk-f020aqdg.js +38 -0
  234. package/web/chunk-f020aqdg.js.br +0 -0
  235. package/web/chunk-f020aqdg.js.gz +0 -0
  236. package/web/chunk-f5a5x6be.js +1 -0
  237. package/web/chunk-f5a5x6be.js.br +0 -0
  238. package/web/chunk-f5a5x6be.js.gz +0 -0
  239. package/web/chunk-fkmw2m49.js +1 -0
  240. package/web/chunk-fkmw2m49.js.br +0 -0
  241. package/web/chunk-fkmw2m49.js.gz +0 -0
  242. package/web/chunk-fn0hha9d.js +2 -0
  243. package/web/chunk-fn0hha9d.js.br +0 -0
  244. package/web/chunk-fn0hha9d.js.gz +0 -0
  245. package/web/chunk-fp5ny5dy.js +4 -0
  246. package/web/chunk-fp5ny5dy.js.br +0 -0
  247. package/web/chunk-fp5ny5dy.js.gz +0 -0
  248. package/web/chunk-fwckng4e.js +34 -0
  249. package/web/chunk-fwckng4e.js.br +0 -0
  250. package/web/chunk-fwckng4e.js.gz +0 -0
  251. package/web/chunk-g7yyp4ks.js +2 -0
  252. package/web/chunk-g7yyp4ks.js.br +0 -0
  253. package/web/chunk-g7yyp4ks.js.gz +0 -0
  254. package/web/chunk-gbhkp5f4.js +1 -0
  255. package/web/chunk-gbhkp5f4.js.br +2 -0
  256. package/web/chunk-gbhkp5f4.js.gz +0 -0
  257. package/web/chunk-ghz85g7f.js +1 -0
  258. package/web/chunk-ghz85g7f.js.br +0 -0
  259. package/web/chunk-ghz85g7f.js.gz +0 -0
  260. package/web/chunk-gpjdkgxz.js +2 -0
  261. package/web/chunk-gpjdkgxz.js.br +0 -0
  262. package/web/chunk-gpjdkgxz.js.gz +0 -0
  263. package/web/chunk-h3d8gb7m.js +1 -0
  264. package/web/chunk-h3d8gb7m.js.br +0 -0
  265. package/web/chunk-h3d8gb7m.js.gz +0 -0
  266. package/web/chunk-h47k4j7f.js +1 -0
  267. package/web/chunk-h47k4j7f.js.br +0 -0
  268. package/web/chunk-h47k4j7f.js.gz +0 -0
  269. package/web/chunk-h702ns45.js +1 -0
  270. package/web/chunk-h702ns45.js.br +0 -0
  271. package/web/chunk-h702ns45.js.gz +0 -0
  272. package/web/chunk-j3tjbge9.js +1 -0
  273. package/web/chunk-j3tjbge9.js.br +0 -0
  274. package/web/chunk-j3tjbge9.js.gz +0 -0
  275. package/web/chunk-j91f1v68.js +2 -0
  276. package/web/chunk-j91f1v68.js.br +0 -0
  277. package/web/chunk-j91f1v68.js.gz +0 -0
  278. package/web/chunk-jd82z5gg.js +1 -0
  279. package/web/chunk-jd82z5gg.js.br +0 -0
  280. package/web/chunk-jd82z5gg.js.gz +0 -0
  281. package/web/chunk-jmksme0n.js +2 -0
  282. package/web/chunk-jmksme0n.js.br +0 -0
  283. package/web/chunk-jmksme0n.js.gz +0 -0
  284. package/web/chunk-jz0wjyzp.js +7 -0
  285. package/web/chunk-jz0wjyzp.js.br +0 -0
  286. package/web/chunk-jz0wjyzp.js.gz +0 -0
  287. package/web/chunk-ka8jrbr5.js +55 -0
  288. package/web/chunk-ka8jrbr5.js.br +0 -0
  289. package/web/chunk-ka8jrbr5.js.gz +0 -0
  290. package/web/chunk-m770h1wv.js +2 -0
  291. package/web/chunk-m770h1wv.js.br +0 -0
  292. package/web/chunk-m770h1wv.js.gz +0 -0
  293. package/web/chunk-mfsdyw6v.js +2 -0
  294. package/web/chunk-mfsdyw6v.js.br +0 -0
  295. package/web/chunk-mfsdyw6v.js.gz +0 -0
  296. package/web/chunk-mvmpr9bn.js +1 -0
  297. package/web/chunk-mvmpr9bn.js.br +0 -0
  298. package/web/chunk-mvmpr9bn.js.gz +0 -0
  299. package/web/chunk-my4zxtxx.js +2 -0
  300. package/web/chunk-my4zxtxx.js.br +0 -0
  301. package/web/chunk-my4zxtxx.js.gz +0 -0
  302. package/web/chunk-n7nx158t.js +1 -0
  303. package/web/chunk-n7nx158t.js.br +0 -0
  304. package/web/chunk-n7nx158t.js.gz +0 -0
  305. package/web/chunk-na88frn3.js +1 -0
  306. package/web/chunk-na88frn3.js.br +0 -0
  307. package/web/chunk-na88frn3.js.gz +0 -0
  308. package/web/chunk-nbncq48b.js +1 -0
  309. package/web/chunk-nbncq48b.js.br +0 -0
  310. package/web/chunk-nbncq48b.js.gz +0 -0
  311. package/web/chunk-nyydkfyf.js +1 -0
  312. package/web/chunk-nyydkfyf.js.br +0 -0
  313. package/web/chunk-nyydkfyf.js.gz +0 -0
  314. package/web/chunk-nz06k08x.js +39 -0
  315. package/web/chunk-nz06k08x.js.br +0 -0
  316. package/web/chunk-nz06k08x.js.gz +0 -0
  317. package/web/chunk-p62swsj6.js +139 -0
  318. package/web/chunk-p62swsj6.js.br +0 -0
  319. package/web/chunk-p62swsj6.js.gz +0 -0
  320. package/web/chunk-pajjgx94.js +169 -0
  321. package/web/chunk-pajjgx94.js.br +0 -0
  322. package/web/chunk-pajjgx94.js.gz +0 -0
  323. package/web/chunk-phdpzq61.js +370 -0
  324. package/web/chunk-phdpzq61.js.br +0 -0
  325. package/web/chunk-phdpzq61.js.gz +0 -0
  326. package/web/chunk-pj9r4ha1.js +2 -0
  327. package/web/chunk-pj9r4ha1.js.br +0 -0
  328. package/web/chunk-pj9r4ha1.js.gz +0 -0
  329. package/web/chunk-pqvre6md.js +24 -0
  330. package/web/chunk-pqvre6md.js.br +0 -0
  331. package/web/chunk-pqvre6md.js.gz +0 -0
  332. package/web/chunk-pvq527d1.js +303 -0
  333. package/web/chunk-pvq527d1.js.br +0 -0
  334. package/web/chunk-pvq527d1.js.gz +0 -0
  335. package/web/chunk-pzbqpfpj.js +24 -0
  336. package/web/chunk-pzbqpfpj.js.br +0 -0
  337. package/web/chunk-pzbqpfpj.js.gz +0 -0
  338. package/web/chunk-q990zhg4.js +1 -0
  339. package/web/chunk-q990zhg4.js.br +0 -0
  340. package/web/chunk-q990zhg4.js.gz +0 -0
  341. package/web/chunk-qed51xj9.js +2 -0
  342. package/web/chunk-qed51xj9.js.br +0 -0
  343. package/web/chunk-qed51xj9.js.gz +0 -0
  344. package/web/chunk-r9m8jh7x.js +2 -0
  345. package/web/chunk-r9m8jh7x.js.br +0 -0
  346. package/web/chunk-r9m8jh7x.js.gz +0 -0
  347. package/web/chunk-rjax57j0.js +40 -0
  348. package/web/chunk-rjax57j0.js.br +0 -0
  349. package/web/chunk-rjax57j0.js.gz +0 -0
  350. package/web/chunk-s00tks2b.js +98 -0
  351. package/web/chunk-s00tks2b.js.br +0 -0
  352. package/web/chunk-s00tks2b.js.gz +0 -0
  353. package/web/chunk-s3symq0h.js +1 -0
  354. package/web/chunk-s3symq0h.js.br +0 -0
  355. package/web/chunk-s3symq0h.js.gz +0 -0
  356. package/web/chunk-sh2d0212.js +1 -0
  357. package/web/chunk-sh2d0212.js.br +0 -0
  358. package/web/chunk-sh2d0212.js.gz +0 -0
  359. package/web/chunk-t8ksmf3z.js +2 -0
  360. package/web/chunk-t8ksmf3z.js.br +0 -0
  361. package/web/chunk-t8ksmf3z.js.gz +0 -0
  362. package/web/chunk-te4ab7ee.css +1 -0
  363. package/web/chunk-te4ab7ee.css.br +0 -0
  364. package/web/chunk-te4ab7ee.css.gz +0 -0
  365. package/web/chunk-tjhxbt15.js +1 -0
  366. package/web/chunk-tjhxbt15.js.br +0 -0
  367. package/web/chunk-tjhxbt15.js.gz +0 -0
  368. package/web/chunk-tqr5maem.js +291 -0
  369. package/web/chunk-tqr5maem.js.br +0 -0
  370. package/web/chunk-tqr5maem.js.gz +0 -0
  371. package/web/chunk-tt3vgkx6.js +7 -0
  372. package/web/chunk-tt3vgkx6.js.br +0 -0
  373. package/web/chunk-tt3vgkx6.js.gz +0 -0
  374. package/web/chunk-v56w6y8n.js +2 -0
  375. package/web/chunk-v56w6y8n.js.br +0 -0
  376. package/web/chunk-v56w6y8n.js.gz +0 -0
  377. package/web/chunk-v65dz9y5.js +1 -0
  378. package/web/chunk-v65dz9y5.js.br +0 -0
  379. package/web/chunk-v65dz9y5.js.gz +0 -0
  380. package/web/chunk-vaspzebe.js +1 -0
  381. package/web/chunk-vaspzebe.js.br +0 -0
  382. package/web/chunk-vaspzebe.js.gz +0 -0
  383. package/web/chunk-ve5dccwy.js +1 -0
  384. package/web/chunk-ve5dccwy.js.br +0 -0
  385. package/web/chunk-ve5dccwy.js.gz +0 -0
  386. package/web/chunk-vsxzq4nb.js +1 -0
  387. package/web/chunk-vsxzq4nb.js.br +0 -0
  388. package/web/chunk-vsxzq4nb.js.gz +0 -0
  389. package/web/chunk-vvn66f2x.js +16 -0
  390. package/web/chunk-vvn66f2x.js.br +0 -0
  391. package/web/chunk-vvn66f2x.js.gz +0 -0
  392. package/web/chunk-vvqey05d.js +1 -0
  393. package/web/chunk-vvqey05d.js.br +2 -0
  394. package/web/chunk-vvqey05d.js.gz +0 -0
  395. package/web/chunk-w6ajcbm8.js +1 -0
  396. package/web/chunk-w6ajcbm8.js.br +0 -0
  397. package/web/chunk-w6ajcbm8.js.gz +0 -0
  398. package/web/chunk-w6p6dy3k.js +2 -0
  399. package/web/chunk-w6p6dy3k.js.br +0 -0
  400. package/web/chunk-w6p6dy3k.js.gz +0 -0
  401. package/web/chunk-wy1k8vz2.js +1 -0
  402. package/web/chunk-wy1k8vz2.js.br +0 -0
  403. package/web/chunk-wy1k8vz2.js.gz +0 -0
  404. package/web/chunk-wzgv2gv2.js +120 -0
  405. package/web/chunk-wzgv2gv2.js.br +0 -0
  406. package/web/chunk-wzgv2gv2.js.gz +0 -0
  407. package/web/chunk-x78hqhxv.js +1 -0
  408. package/web/chunk-x78hqhxv.js.br +2 -0
  409. package/web/chunk-x78hqhxv.js.gz +0 -0
  410. package/web/chunk-x7mw8704.js +36 -0
  411. package/web/chunk-x7mw8704.js.br +0 -0
  412. package/web/chunk-x7mw8704.js.gz +0 -0
  413. package/web/chunk-x85z35es.js +2 -0
  414. package/web/chunk-x85z35es.js.br +0 -0
  415. package/web/chunk-x85z35es.js.gz +0 -0
  416. package/web/chunk-xbrhmxd8.js +214 -0
  417. package/web/chunk-xbrhmxd8.js.br +0 -0
  418. package/web/chunk-xbrhmxd8.js.gz +0 -0
  419. package/web/chunk-xjpqg11m.js +1 -0
  420. package/web/chunk-xjpqg11m.js.br +0 -0
  421. package/web/chunk-xjpqg11m.js.gz +0 -0
  422. package/web/chunk-y2x9v76f.js +2 -0
  423. package/web/chunk-y2x9v76f.js.br +0 -0
  424. package/web/chunk-y2x9v76f.js.gz +0 -0
  425. package/web/chunk-y48mj5d7.js +1 -0
  426. package/web/chunk-y48mj5d7.js.br +0 -0
  427. package/web/chunk-y48mj5d7.js.gz +0 -0
  428. package/web/chunk-ykc1rttf.js +1 -0
  429. package/web/chunk-ykc1rttf.js.br +0 -0
  430. package/web/chunk-ykc1rttf.js.gz +0 -0
  431. package/web/chunk-yyw0rdyy.js +1 -0
  432. package/web/chunk-yyw0rdyy.js.br +0 -0
  433. package/web/chunk-yyw0rdyy.js.gz +0 -0
  434. package/web/chunk-yzyrc28t.js +30 -0
  435. package/web/chunk-yzyrc28t.js.br +0 -0
  436. package/web/chunk-yzyrc28t.js.gz +0 -0
  437. package/web/chunk-z7j6wnn3.js +2 -0
  438. package/web/chunk-z7j6wnn3.js.br +0 -0
  439. package/web/chunk-z7j6wnn3.js.gz +0 -0
  440. package/web/chunk-z8fgdsx5.js +1 -0
  441. package/web/chunk-z8fgdsx5.js.br +0 -0
  442. package/web/chunk-z8fgdsx5.js.gz +0 -0
  443. package/web/index.html +3 -13
  444. package/web/index.html.br +0 -0
  445. package/web/index.html.gz +0 -0
  446. package/web/manifest-g1mfa85c.webmanifest +35 -0
  447. package/web/manifest-g1mfa85c.webmanifest.br +0 -0
  448. package/web/manifest-g1mfa85c.webmanifest.gz +0 -0
  449. package/web/manifest.webmanifest +2 -2
  450. package/web/manifest.webmanifest.br +0 -0
  451. package/web/manifest.webmanifest.gz +0 -0
  452. package/web/sw.js +33 -16
  453. package/web/sw.js.br +0 -0
  454. package/web/sw.js.gz +0 -0
  455. package/worker.js +1 -1
  456. package/chunk-1xam7mw7.js +0 -2
  457. package/chunk-2df7yf47.js +0 -3
  458. package/chunk-3a3ta83t.js +0 -12
  459. package/chunk-3bb12192.js +0 -39
  460. package/chunk-3j24he2c.js +0 -25
  461. package/chunk-3yyt010j.js +0 -2
  462. package/chunk-4hrkad68.js +0 -2
  463. package/chunk-4kw8vvae.js +0 -3
  464. package/chunk-5xj2kq5h.js +0 -3
  465. package/chunk-6hajdf5x.js +0 -2
  466. package/chunk-6rkwh4w5.js +0 -3
  467. package/chunk-7ygt906s.js +0 -2
  468. package/chunk-8jf1kd0m.js +0 -3
  469. package/chunk-95npkaze.js +0 -5
  470. package/chunk-9yqn7drg.js +0 -3
  471. package/chunk-9zwy8ypg.js +0 -117
  472. package/chunk-ad5asgnr.js +0 -2
  473. package/chunk-akdav0ay.js +0 -3
  474. package/chunk-arzyd0f7.js +0 -8
  475. package/chunk-avrzwnbk.js +0 -2
  476. package/chunk-b3fwt4jy.js +0 -2
  477. package/chunk-b41a7yc5.js +0 -7
  478. package/chunk-be4p5qak.js +0 -103
  479. package/chunk-br7606yh.js +0 -7
  480. package/chunk-brgcdzj9.js +0 -60
  481. package/chunk-bvh3ccr2.js +0 -3
  482. package/chunk-c0htgv5v.js +0 -3
  483. package/chunk-ch8bhqmp.js +0 -2
  484. package/chunk-d2t7tx0d.js +0 -16
  485. package/chunk-d5qsqt4v.js +0 -2
  486. package/chunk-d5sxt7bc.js +0 -13
  487. package/chunk-dz8jyvp4.js +0 -547
  488. package/chunk-e431qjnf.js +0 -3
  489. package/chunk-e69h0e2f.js +0 -2
  490. package/chunk-e9rp422g.js +0 -9
  491. package/chunk-etvf4tkk.js +0 -3
  492. package/chunk-ewr4r5yx.js +0 -18
  493. package/chunk-ezm2t479.js +0 -11
  494. package/chunk-f5prr1x7.js +0 -59
  495. package/chunk-fxs37w3f.js +0 -10
  496. package/chunk-g27efryh.js +0 -20
  497. package/chunk-g8zcrfzr.js +0 -2
  498. package/chunk-gde46g2m.js +0 -2
  499. package/chunk-gnf6jvxv.js +0 -25
  500. package/chunk-gswcr5j6.js +0 -2
  501. package/chunk-h22spg1q.js +0 -3
  502. package/chunk-h2br80f8.js +0 -3
  503. package/chunk-he09tqj5.js +0 -2
  504. package/chunk-hkx2cpc5.js +0 -3
  505. package/chunk-hwkmxr9a.js +0 -5
  506. package/chunk-j9jg8h44.js +0 -2
  507. package/chunk-jhgf0vpr.js +0 -5
  508. package/chunk-k3ndw7d4.js +0 -3
  509. package/chunk-k8mc2tn3.js +0 -3
  510. package/chunk-mbf7201c.js +0 -5
  511. package/chunk-mzhebc7e.js +0 -7
  512. package/chunk-n1c3t0nj.js +0 -2
  513. package/chunk-nmpqx2sh.js +0 -3
  514. package/chunk-p0dacr9z.js +0 -12
  515. package/chunk-q8gv26ze.js +0 -3
  516. package/chunk-qj6bf18b.js +0 -3
  517. package/chunk-rxq62z5t.js +0 -3
  518. package/chunk-s27309w7.js +0 -3
  519. package/chunk-sjwsj82f.js +0 -10
  520. package/chunk-tadyy9xh.js +0 -51
  521. package/chunk-vgvp6cpk.js +0 -2
  522. package/chunk-vj5p29fr.js +0 -2
  523. package/chunk-wbpt03pe.js +0 -31
  524. package/chunk-wgjt31wp.js +0 -8
  525. package/chunk-wk6vjpmj.js +0 -3
  526. package/chunk-x1spmnj8.js +0 -2
  527. package/chunk-x4anmcq9.js +0 -4
  528. package/chunk-xd5hf1rg.js +0 -3178
  529. package/chunk-xpbt4cpe.js +0 -2
  530. package/chunk-yw2k2syh.js +0 -3
  531. package/chunk-z3x79jnt.js +0 -3
  532. package/chunk-zd569v9h.js +0 -2
  533. package/web/chunk-05b25kh6.js +0 -332
  534. package/web/chunk-05b25kh6.js.br +0 -0
  535. package/web/chunk-05b25kh6.js.gz +0 -0
  536. package/web/chunk-0g6z1xs1.js +0 -2
  537. package/web/chunk-0g6z1xs1.js.br +0 -0
  538. package/web/chunk-0g6z1xs1.js.gz +0 -0
  539. package/web/chunk-0kj45mje.js +0 -2
  540. package/web/chunk-0kj45mje.js.br +0 -0
  541. package/web/chunk-0kj45mje.js.gz +0 -0
  542. package/web/chunk-0wt52yw3.js +0 -1
  543. package/web/chunk-0wt52yw3.js.br +0 -2
  544. package/web/chunk-0wt52yw3.js.gz +0 -0
  545. package/web/chunk-0x9cf6bp.js +0 -38
  546. package/web/chunk-0x9cf6bp.js.br +0 -0
  547. package/web/chunk-0x9cf6bp.js.gz +0 -0
  548. package/web/chunk-0y2f60q6.js +0 -1
  549. package/web/chunk-0y2f60q6.js.br +0 -0
  550. package/web/chunk-0y2f60q6.js.gz +0 -0
  551. package/web/chunk-1axw7vb0.js +0 -214
  552. package/web/chunk-1axw7vb0.js.br +0 -0
  553. package/web/chunk-1axw7vb0.js.gz +0 -0
  554. package/web/chunk-1es5ak4r.js +0 -1
  555. package/web/chunk-1es5ak4r.js.br +0 -0
  556. package/web/chunk-1es5ak4r.js.gz +0 -0
  557. package/web/chunk-1vhk8j0c.js +0 -1
  558. package/web/chunk-1vhk8j0c.js.br +0 -0
  559. package/web/chunk-1vhk8j0c.js.gz +0 -0
  560. package/web/chunk-21jtjwe1.js +0 -1
  561. package/web/chunk-21jtjwe1.js.br +0 -0
  562. package/web/chunk-21jtjwe1.js.gz +0 -0
  563. package/web/chunk-26grg3rq.js +0 -1144
  564. package/web/chunk-26grg3rq.js.br +0 -0
  565. package/web/chunk-26grg3rq.js.gz +0 -0
  566. package/web/chunk-2nwvdqxm.js +0 -1
  567. package/web/chunk-2nwvdqxm.js.br +0 -0
  568. package/web/chunk-2nwvdqxm.js.gz +0 -0
  569. package/web/chunk-2vh05ags.js +0 -2
  570. package/web/chunk-2vh05ags.js.br +0 -0
  571. package/web/chunk-2vh05ags.js.gz +0 -0
  572. package/web/chunk-2wvgy7f4.js +0 -1
  573. package/web/chunk-2wvgy7f4.js.br +0 -0
  574. package/web/chunk-2wvgy7f4.js.gz +0 -0
  575. package/web/chunk-33bfatdr.js +0 -4
  576. package/web/chunk-33bfatdr.js.br +0 -0
  577. package/web/chunk-33bfatdr.js.gz +0 -0
  578. package/web/chunk-38xsaxws.js +0 -1
  579. package/web/chunk-38xsaxws.js.br +0 -0
  580. package/web/chunk-38xsaxws.js.gz +0 -0
  581. package/web/chunk-3av47wwa.js +0 -7
  582. package/web/chunk-3av47wwa.js.br +0 -0
  583. package/web/chunk-3av47wwa.js.gz +0 -0
  584. package/web/chunk-3rxgch48.js +0 -1
  585. package/web/chunk-3rxgch48.js.br +0 -0
  586. package/web/chunk-3rxgch48.js.gz +0 -0
  587. package/web/chunk-40j8gxty.js +0 -303
  588. package/web/chunk-40j8gxty.js.br +0 -0
  589. package/web/chunk-40j8gxty.js.gz +0 -0
  590. package/web/chunk-43kq2dk7.js +0 -21
  591. package/web/chunk-43kq2dk7.js.br +0 -0
  592. package/web/chunk-43kq2dk7.js.gz +0 -0
  593. package/web/chunk-4cw67sdz.js +0 -78
  594. package/web/chunk-4cw67sdz.js.br +0 -0
  595. package/web/chunk-4cw67sdz.js.gz +0 -0
  596. package/web/chunk-4k4c2se1.js +0 -2
  597. package/web/chunk-4k4c2se1.js.br +0 -0
  598. package/web/chunk-4k4c2se1.js.gz +0 -0
  599. package/web/chunk-50dr941q.js +0 -55
  600. package/web/chunk-50dr941q.js.br +0 -0
  601. package/web/chunk-50dr941q.js.gz +0 -0
  602. package/web/chunk-56hx6a5h.js +0 -1
  603. package/web/chunk-56hx6a5h.js.br +0 -0
  604. package/web/chunk-56hx6a5h.js.gz +0 -0
  605. package/web/chunk-5m1p98r5.js +0 -2
  606. package/web/chunk-5m1p98r5.js.br +0 -0
  607. package/web/chunk-5m1p98r5.js.gz +0 -0
  608. package/web/chunk-5m45mc2k.js +0 -99
  609. package/web/chunk-5m45mc2k.js.br +0 -0
  610. package/web/chunk-5m45mc2k.js.gz +0 -0
  611. package/web/chunk-6gfa17h5.js +0 -1
  612. package/web/chunk-6gfa17h5.js.br +0 -0
  613. package/web/chunk-6gfa17h5.js.gz +0 -0
  614. package/web/chunk-7e57me98.js +0 -1
  615. package/web/chunk-7e57me98.js.br +0 -0
  616. package/web/chunk-7e57me98.js.gz +0 -0
  617. package/web/chunk-7ht7dssg.js +0 -1
  618. package/web/chunk-7ht7dssg.js.br +0 -0
  619. package/web/chunk-7ht7dssg.js.gz +0 -0
  620. package/web/chunk-8jxg1srx.js +0 -1
  621. package/web/chunk-8jxg1srx.js.br +0 -2
  622. package/web/chunk-8jxg1srx.js.gz +0 -0
  623. package/web/chunk-8q9970dm.js +0 -2
  624. package/web/chunk-8q9970dm.js.br +0 -0
  625. package/web/chunk-8q9970dm.js.gz +0 -0
  626. package/web/chunk-8t1kh5r9.js +0 -370
  627. package/web/chunk-8t1kh5r9.js.br +0 -0
  628. package/web/chunk-8t1kh5r9.js.gz +0 -0
  629. package/web/chunk-8za5fkrq.js +0 -1
  630. package/web/chunk-8za5fkrq.js.br +0 -0
  631. package/web/chunk-8za5fkrq.js.gz +0 -0
  632. package/web/chunk-96dhr80q.js +0 -8
  633. package/web/chunk-96dhr80q.js.br +0 -0
  634. package/web/chunk-96dhr80q.js.gz +0 -0
  635. package/web/chunk-98y5p1r2.js +0 -1
  636. package/web/chunk-98y5p1r2.js.br +0 -0
  637. package/web/chunk-98y5p1r2.js.gz +0 -0
  638. package/web/chunk-9f77mxfz.js +0 -98
  639. package/web/chunk-9f77mxfz.js.br +0 -0
  640. package/web/chunk-9f77mxfz.js.gz +0 -0
  641. package/web/chunk-9g2fam83.js +0 -2
  642. package/web/chunk-9g2fam83.js.br +0 -0
  643. package/web/chunk-9g2fam83.js.gz +0 -0
  644. package/web/chunk-9we3a8ak.js +0 -84
  645. package/web/chunk-9we3a8ak.js.br +0 -0
  646. package/web/chunk-9we3a8ak.js.gz +0 -0
  647. package/web/chunk-adfd0mhj.js +0 -1
  648. package/web/chunk-adfd0mhj.js.br +0 -0
  649. package/web/chunk-adfd0mhj.js.gz +0 -0
  650. package/web/chunk-aem9wyqq.js +0 -30
  651. package/web/chunk-aem9wyqq.js.br +0 -0
  652. package/web/chunk-aem9wyqq.js.gz +0 -0
  653. package/web/chunk-ajzrsqpp.js +0 -1
  654. package/web/chunk-ajzrsqpp.js.br +0 -0
  655. package/web/chunk-ajzrsqpp.js.gz +0 -0
  656. package/web/chunk-b4t33dft.js +0 -7
  657. package/web/chunk-b4t33dft.js.br +0 -0
  658. package/web/chunk-b4t33dft.js.gz +0 -0
  659. package/web/chunk-b86sddt6.js +0 -1
  660. package/web/chunk-b86sddt6.js.br +0 -0
  661. package/web/chunk-b86sddt6.js.gz +0 -0
  662. package/web/chunk-bt8ww8df.js +0 -142
  663. package/web/chunk-bt8ww8df.js.br +0 -0
  664. package/web/chunk-bt8ww8df.js.gz +0 -0
  665. package/web/chunk-c1tsq0ta.js +0 -1
  666. package/web/chunk-c1tsq0ta.js.br +0 -0
  667. package/web/chunk-c1tsq0ta.js.gz +0 -0
  668. package/web/chunk-ckkd4qn1.js +0 -1
  669. package/web/chunk-ckkd4qn1.js.br +0 -0
  670. package/web/chunk-ckkd4qn1.js.gz +0 -0
  671. package/web/chunk-cxh1ztpm.js +0 -200
  672. package/web/chunk-cxh1ztpm.js.br +0 -0
  673. package/web/chunk-cxh1ztpm.js.gz +0 -0
  674. package/web/chunk-db2pew8j.js +0 -2
  675. package/web/chunk-db2pew8j.js.br +0 -0
  676. package/web/chunk-db2pew8j.js.gz +0 -0
  677. package/web/chunk-dk2jv3kv.js +0 -2
  678. package/web/chunk-dk2jv3kv.js.br +0 -0
  679. package/web/chunk-dk2jv3kv.js.gz +0 -0
  680. package/web/chunk-dk9efr2r.js +0 -1
  681. package/web/chunk-dk9efr2r.js.br +0 -0
  682. package/web/chunk-dk9efr2r.js.gz +0 -0
  683. package/web/chunk-dmn5rvmt.js +0 -169
  684. package/web/chunk-dmn5rvmt.js.br +0 -0
  685. package/web/chunk-dmn5rvmt.js.gz +0 -0
  686. package/web/chunk-dtzm3qsp.js +0 -34
  687. package/web/chunk-dtzm3qsp.js.br +0 -0
  688. package/web/chunk-dtzm3qsp.js.gz +0 -0
  689. package/web/chunk-e1j49cha.js +0 -140
  690. package/web/chunk-e1j49cha.js.br +0 -0
  691. package/web/chunk-e1j49cha.js.gz +0 -0
  692. package/web/chunk-e24ammbc.js +0 -292
  693. package/web/chunk-e24ammbc.js.br +0 -0
  694. package/web/chunk-e24ammbc.js.gz +0 -0
  695. package/web/chunk-ebvk893x.js +0 -2
  696. package/web/chunk-ebvk893x.js.br +0 -0
  697. package/web/chunk-ebvk893x.js.gz +0 -0
  698. package/web/chunk-ecv7r3t9.js +0 -24
  699. package/web/chunk-ecv7r3t9.js.br +0 -0
  700. package/web/chunk-ecv7r3t9.js.gz +0 -0
  701. package/web/chunk-etkhjrfg.js +0 -1
  702. package/web/chunk-etkhjrfg.js.br +0 -0
  703. package/web/chunk-etkhjrfg.js.gz +0 -0
  704. package/web/chunk-f3ennx3q.js +0 -1
  705. package/web/chunk-f3ennx3q.js.br +0 -0
  706. package/web/chunk-f3ennx3q.js.gz +0 -0
  707. package/web/chunk-f5wyg9zh.js +0 -2
  708. package/web/chunk-f5wyg9zh.js.br +0 -0
  709. package/web/chunk-f5wyg9zh.js.gz +0 -0
  710. package/web/chunk-fpg6cdg9.js +0 -1
  711. package/web/chunk-fpg6cdg9.js.br +0 -0
  712. package/web/chunk-fpg6cdg9.js.gz +0 -0
  713. package/web/chunk-fq9kkd61.js +0 -1
  714. package/web/chunk-fq9kkd61.js.br +0 -0
  715. package/web/chunk-fq9kkd61.js.gz +0 -0
  716. package/web/chunk-fr9gd1pt.js +0 -1
  717. package/web/chunk-fr9gd1pt.js.br +0 -0
  718. package/web/chunk-fr9gd1pt.js.gz +0 -0
  719. package/web/chunk-fsfpgs2w.css +0 -1
  720. package/web/chunk-fsfpgs2w.css.br +0 -0
  721. package/web/chunk-fsfpgs2w.css.gz +0 -0
  722. package/web/chunk-ftggg1s9.js +0 -324
  723. package/web/chunk-ftggg1s9.js.br +0 -0
  724. package/web/chunk-ftggg1s9.js.gz +0 -0
  725. package/web/chunk-g337nkpz.js +0 -2
  726. package/web/chunk-g337nkpz.js.br +0 -0
  727. package/web/chunk-g337nkpz.js.gz +0 -0
  728. package/web/chunk-g52np0en.js +0 -1
  729. package/web/chunk-g52np0en.js.br +0 -0
  730. package/web/chunk-g52np0en.js.gz +0 -0
  731. package/web/chunk-gc6pdwjs.js +0 -2
  732. package/web/chunk-gc6pdwjs.js.br +0 -0
  733. package/web/chunk-gc6pdwjs.js.gz +0 -0
  734. package/web/chunk-gks3ybk7.js +0 -291
  735. package/web/chunk-gks3ybk7.js.br +0 -0
  736. package/web/chunk-gks3ybk7.js.gz +0 -0
  737. package/web/chunk-hr1t5hxj.js +0 -1
  738. package/web/chunk-hr1t5hxj.js.br +0 -0
  739. package/web/chunk-hr1t5hxj.js.gz +0 -0
  740. package/web/chunk-k67ze3zq.js +0 -2
  741. package/web/chunk-k67ze3zq.js.br +0 -0
  742. package/web/chunk-k67ze3zq.js.gz +0 -0
  743. package/web/chunk-kcrkppec.js +0 -1
  744. package/web/chunk-kcrkppec.js.br +0 -0
  745. package/web/chunk-kcrkppec.js.gz +0 -0
  746. package/web/chunk-kd2346aw.js +0 -2
  747. package/web/chunk-kd2346aw.js.br +0 -0
  748. package/web/chunk-kd2346aw.js.gz +0 -0
  749. package/web/chunk-kh93xybm.js +0 -62
  750. package/web/chunk-kh93xybm.js.br +0 -0
  751. package/web/chunk-kh93xybm.js.gz +0 -0
  752. package/web/chunk-m32tg04f.js +0 -1
  753. package/web/chunk-m32tg04f.js.br +0 -0
  754. package/web/chunk-m32tg04f.js.gz +0 -0
  755. package/web/chunk-mg98g3yx.js +0 -106
  756. package/web/chunk-mg98g3yx.js.br +0 -0
  757. package/web/chunk-mg98g3yx.js.gz +0 -0
  758. package/web/chunk-mqdvg55y.js +0 -2
  759. package/web/chunk-mqdvg55y.js.br +0 -0
  760. package/web/chunk-mqdvg55y.js.gz +0 -0
  761. package/web/chunk-myg415b8.js +0 -1
  762. package/web/chunk-myg415b8.js.br +0 -0
  763. package/web/chunk-myg415b8.js.gz +0 -0
  764. package/web/chunk-myn0rj98.js +0 -2
  765. package/web/chunk-myn0rj98.js.br +0 -0
  766. package/web/chunk-myn0rj98.js.gz +0 -0
  767. package/web/chunk-nvq8s71g.js +0 -1
  768. package/web/chunk-nvq8s71g.js.br +0 -0
  769. package/web/chunk-nvq8s71g.js.gz +0 -0
  770. package/web/chunk-pphtw0xj.js +0 -7
  771. package/web/chunk-pphtw0xj.js.br +0 -0
  772. package/web/chunk-pphtw0xj.js.gz +0 -0
  773. package/web/chunk-ptdh13r5.js +0 -1
  774. package/web/chunk-ptdh13r5.js.br +0 -0
  775. package/web/chunk-ptdh13r5.js.gz +0 -0
  776. package/web/chunk-q1gyt5y6.js +0 -1
  777. package/web/chunk-q1gyt5y6.js.br +0 -0
  778. package/web/chunk-q1gyt5y6.js.gz +0 -0
  779. package/web/chunk-q40c0y7d.js +0 -24
  780. package/web/chunk-q40c0y7d.js.br +0 -0
  781. package/web/chunk-q40c0y7d.js.gz +0 -0
  782. package/web/chunk-q7pyqxqn.js +0 -89
  783. package/web/chunk-q7pyqxqn.js.br +0 -0
  784. package/web/chunk-q7pyqxqn.js.gz +0 -0
  785. package/web/chunk-r5rt7t62.js +0 -1
  786. package/web/chunk-r5rt7t62.js.br +0 -0
  787. package/web/chunk-r5rt7t62.js.gz +0 -0
  788. package/web/chunk-ra8jt8jw.js +0 -2
  789. package/web/chunk-ra8jt8jw.js.br +0 -0
  790. package/web/chunk-ra8jt8jw.js.gz +0 -0
  791. package/web/chunk-rgh3x4h4.js +0 -1
  792. package/web/chunk-rgh3x4h4.js.br +0 -0
  793. package/web/chunk-rgh3x4h4.js.gz +0 -0
  794. package/web/chunk-rvcq48wy.js +0 -1
  795. package/web/chunk-rvcq48wy.js.br +0 -0
  796. package/web/chunk-rvcq48wy.js.gz +0 -0
  797. package/web/chunk-rvgx4jhr.js +0 -1
  798. package/web/chunk-rvgx4jhr.js.br +0 -0
  799. package/web/chunk-rvgx4jhr.js.gz +0 -0
  800. package/web/chunk-rxvvg771.js +0 -1
  801. package/web/chunk-rxvvg771.js.br +0 -0
  802. package/web/chunk-rxvvg771.js.gz +0 -0
  803. package/web/chunk-sfb3w9nf.js +0 -1
  804. package/web/chunk-sfb3w9nf.js.br +0 -2
  805. package/web/chunk-sfb3w9nf.js.gz +0 -0
  806. package/web/chunk-srwx1v8c.js +0 -39
  807. package/web/chunk-srwx1v8c.js.br +0 -0
  808. package/web/chunk-srwx1v8c.js.gz +0 -0
  809. package/web/chunk-t1et0w6s.js +0 -2
  810. package/web/chunk-t1et0w6s.js.br +0 -0
  811. package/web/chunk-t1et0w6s.js.gz +0 -0
  812. package/web/chunk-tm7c78hm.js +0 -1
  813. package/web/chunk-tm7c78hm.js.br +0 -0
  814. package/web/chunk-tm7c78hm.js.gz +0 -0
  815. package/web/chunk-tmrh8hv1.js +0 -1
  816. package/web/chunk-tmrh8hv1.js.br +0 -0
  817. package/web/chunk-tmrh8hv1.js.gz +0 -0
  818. package/web/chunk-tntwwpyh.js +0 -2
  819. package/web/chunk-tntwwpyh.js.br +0 -0
  820. package/web/chunk-tntwwpyh.js.gz +0 -0
  821. package/web/chunk-tyengwea.js +0 -12
  822. package/web/chunk-tyengwea.js.br +0 -0
  823. package/web/chunk-tyengwea.js.gz +0 -0
  824. package/web/chunk-v13gqed9.js +0 -2
  825. package/web/chunk-v13gqed9.js.br +0 -0
  826. package/web/chunk-v13gqed9.js.gz +0 -0
  827. package/web/chunk-v6srkjvx.js +0 -41
  828. package/web/chunk-v6srkjvx.js.br +0 -0
  829. package/web/chunk-v6srkjvx.js.gz +0 -0
  830. package/web/chunk-vyn5qg7j.js +0 -1
  831. package/web/chunk-vyn5qg7j.js.br +0 -0
  832. package/web/chunk-vyn5qg7j.js.gz +0 -0
  833. package/web/chunk-w8se91rf.js +0 -2
  834. package/web/chunk-w8se91rf.js.br +0 -0
  835. package/web/chunk-w8se91rf.js.gz +0 -0
  836. package/web/chunk-wc533d3w.js +0 -4
  837. package/web/chunk-wc533d3w.js.br +0 -0
  838. package/web/chunk-wc533d3w.js.gz +0 -0
  839. package/web/chunk-wdd9pasx.js +0 -1
  840. package/web/chunk-wdd9pasx.js.br +0 -0
  841. package/web/chunk-wdd9pasx.js.gz +0 -0
  842. package/web/chunk-we9q8a9q.js +0 -2
  843. package/web/chunk-we9q8a9q.js.br +0 -0
  844. package/web/chunk-we9q8a9q.js.gz +0 -0
  845. package/web/chunk-wjpdjzkt.js +0 -36
  846. package/web/chunk-wjpdjzkt.js.br +0 -0
  847. package/web/chunk-wjpdjzkt.js.gz +0 -0
  848. package/web/chunk-wwnzjj7x.js +0 -2
  849. package/web/chunk-wwnzjj7x.js.br +0 -0
  850. package/web/chunk-wwnzjj7x.js.gz +0 -0
  851. package/web/chunk-wypacndw.js +0 -120
  852. package/web/chunk-wypacndw.js.br +0 -0
  853. package/web/chunk-wypacndw.js.gz +0 -0
  854. package/web/chunk-x3p573sq.js +0 -2
  855. package/web/chunk-x3p573sq.js.br +0 -0
  856. package/web/chunk-x3p573sq.js.gz +0 -0
  857. package/web/chunk-x6zh7fcc.js +0 -16
  858. package/web/chunk-x6zh7fcc.js.br +0 -0
  859. package/web/chunk-x6zh7fcc.js.gz +0 -0
  860. package/web/chunk-x87bgw5s.js +0 -89
  861. package/web/chunk-x87bgw5s.js.br +0 -0
  862. package/web/chunk-x87bgw5s.js.gz +0 -0
  863. package/web/chunk-xevjmmdd.js +0 -217
  864. package/web/chunk-xevjmmdd.js.br +0 -0
  865. package/web/chunk-xevjmmdd.js.gz +0 -0
  866. package/web/chunk-xwjytx6p.js +0 -139
  867. package/web/chunk-xwjytx6p.js.br +0 -0
  868. package/web/chunk-xwjytx6p.js.gz +0 -0
  869. package/web/chunk-y0xvbh5g.js +0 -1
  870. package/web/chunk-y0xvbh5g.js.br +0 -0
  871. package/web/chunk-y0xvbh5g.js.gz +0 -0
  872. package/web/chunk-ya7gs2bv.js +0 -1
  873. package/web/chunk-ya7gs2bv.js.br +0 -0
  874. package/web/chunk-ya7gs2bv.js.gz +0 -0
  875. package/web/chunk-ybq42mr5.js +0 -2
  876. package/web/chunk-ybq42mr5.js.br +0 -0
  877. package/web/chunk-ybq42mr5.js.gz +0 -0
  878. package/web/chunk-yhzcc87m.js +0 -3
  879. package/web/chunk-yhzcc87m.js.br +0 -0
  880. package/web/chunk-yhzcc87m.js.gz +0 -0
  881. package/web/chunk-yphdbf42.js +0 -70
  882. package/web/chunk-yphdbf42.js.br +0 -0
  883. package/web/chunk-yphdbf42.js.gz +0 -0
  884. package/web/chunk-ythxsag5.js +0 -40
  885. package/web/chunk-ythxsag5.js.br +0 -0
  886. package/web/chunk-ythxsag5.js.gz +0 -0
  887. package/web/chunk-z0smmkfw.js +0 -2
  888. package/web/chunk-z0smmkfw.js.br +0 -0
  889. package/web/chunk-z0smmkfw.js.gz +0 -0
  890. package/web/chunk-zmm3f9sr.js +0 -1
  891. package/web/chunk-zmm3f9sr.js.br +0 -0
  892. package/web/chunk-zmm3f9sr.js.gz +0 -0
  893. package/web/chunk-zxt6qh82.js +0 -2
  894. package/web/chunk-zxt6qh82.js.br +0 -0
  895. package/web/chunk-zxt6qh82.js.gz +0 -0
  896. package/web/manifest-txf6vfbq.webmanifest +0 -35
  897. package/web/manifest-txf6vfbq.webmanifest.br +0 -0
  898. package/web/manifest-txf6vfbq.webmanifest.gz +0 -0
package/compiled.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- import{xo,vo,Pi}from"./chunk-ad5asgnr.js";import{ne}from"./chunk-mbf7201c.js";import{O}from"./chunk-s27309w7.js";import{go}from"./chunk-4kw8vvae.js";import{Ga,yo,yn}from"./chunk-akdav0ay.js";import{qr}from"./chunk-br7606yh.js";import{ie}from"./chunk-qj6bf18b.js";import{Ya}from"./chunk-hrxkr8a8.js";import{De,Ie,wn,de,zs,So,Ne}from"./chunk-k3ndw7d4.js";import{C}from"./chunk-bkabw9yr.js";import{Ue}from"./chunk-5xj2kq5h.js";import{re,Me,on,ve,ht,me}from"./chunk-3a3ta83t.js";import{J,nt}from"./chunk-h2br80f8.js";import{xt,ar}from"./chunk-g27efryh.js";import{vt}from"./chunk-jhgf0vpr.js";import{Lt,Xe,Z}from"./chunk-ezm2t479.js";import{je,he,M,We,fe,qt,Qo,oe}from"./chunk-ewr4r5yx.js";import{m}from"./chunk-k8mc2tn3.js";var w=m(Z());function Nt(e){let{signer:t,signer:o}=e,n=Object.assign(e,{eventSigner:t,messageSigner:o}),r=n.eventStreamPayloadHandlerProvider(n);return Object.assign(n,{eventStreamPayloadHandler:r})}var Fo=m(oe());var $o=(e)=>e.protocol==="ws:"||e.protocol==="wss:";class Mt{signer;constructor(e){this.signer=e.signer}presign(e,t={}){return this.signer.presign(e,t)}async sign(e,t){if(Fo.HttpRequest.isInstance(e)&&$o(e))return{...await this.signer.presign({...e,body:""},{...t,expiresIn:60,unsignableHeaders:new Set(Object.keys(e.headers).filter((n)=>n!=="host"))}),body:e.body};else return this.signer.sign(e,t)}signMessage(e,t){return this.signer.signMessage(e,t)}}var Ut=(e)=>{let{signer:t}=e;return Object.assign(e,{signer:async(o)=>{let n=await t(o);if(ei(n))return new Mt({signer:n});throw Error("Expected WebsocketSignatureV4 signer, please check the client constructor.")}})},ei=(e)=>!!e;var ae=m(Xe()),pr=m(he()),_r=m(M()),hr=m(We()),fr=m(Qo()),mr=m(oe()),mt=m(Lt()),gr=m(je());var Ho=m(xt()),X=m(Xe()),Ee=m(he()),Wo=async(e,t,o)=>({operation:Ee.getSmithyContext(t).operation,region:await Ee.normalizeProvider(e.region)()||(()=>{throw Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function ti(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"bedrock",region:e.region},propertiesExtractor:(t,o)=>({signingProperties:{config:t,context:o}})}}function oi(e){return{schemeId:"smithy.api#httpBearerAuth",propertiesExtractor:({profile:t,filepath:o,configFilepath:n,ignoreCache:r},s)=>({identityProperties:{profile:t,filepath:o,configFilepath:n,ignoreCache:r}})}}var Vo=(e)=>{let t=[];switch(e.operation){default:t.push(ti(e)),t.push(oi(e))}return t},Ko=(e)=>{let t=X.memoizeIdentityProvider(e.token,X.isIdentityExpired,X.doesIdentityRequireRefresh),o=Ho.resolveAwsSdkSigV4Config(e);return Object.assign(o,{authSchemePreference:Ee.normalizeProvider(e.authSchemePreference??[]),token:t})};var jo=(e)=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"bedrock"}),zo={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var Xo={name:"@aws-sdk/client-bedrock-runtime",version:"3.1127.0",description:"AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-bedrock-runtime",license:"Apache-2.0",author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/sdk-for-javascript/"},repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-bedrock-runtime"},files:["dist-*/**"],sideEffects:!1,main:"./dist-cjs/index.js",module:"./dist-es/index.js",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},types:"./dist-types/index.d.ts",typesVersions:{"<4.5":{"dist-types/*":["dist-types/ts3.4/*"]}},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},scripts:{build:"concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs","build:cjs":"node ../../scripts/compilation/inline","build:es":"premove dist-es && tsc -p tsconfig.es.json","build:include:deps":'yarn g:turbo run build -F="$npm_package_name"',"build:types":"premove dist-types && tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"premove dist-cjs dist-es dist-types","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service",test:"yarn g:vitest run --passWithNoTests","test:watch":"yarn g:vitest watch --passWithNoTests","test:integration":"yarn g:vitest run --passWithNoTests -c vitest.config.integ.mts","test:integration:watch":"yarn g:vitest watch --passWithNoTests -c vitest.config.integ.mts","test:e2e":"yarn g:vitest run -c vitest.config.e2e.mts","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.mts","test:browser":"yarn g:vitest run -c vitest.config.browser.e2e.mts","test:browser:watch":"yarn g:vitest watch -c vitest.config.browser.e2e.mts","test:index":"tsc -p tsconfig.test.json && node ./test/index-objects.spec.mjs"},dependencies:{"@aws-sdk/core":"^3.977.9","@aws-sdk/credential-provider-node":"^3.972.82","@aws-sdk/eventstream-handler-node":"^3.972.34","@aws-sdk/middleware-eventstream":"^3.972.29","@aws-sdk/middleware-websocket":"^3.972.52","@aws-sdk/token-providers":"3.1127.0","@aws-sdk/types":"^3.974.5","@smithy/core":"^3.33.3","@smithy/fetch-http-handler":"^5.7.2","@smithy/node-http-handler":"^4.11.3","@smithy/types":"^4.17.2",tslib:"^2.6.2"},devDependencies:{"@smithy/snapshot-testing":"^2.3.2","@tsconfig/node20":"20.1.8","@types/node":"^20.14.8",concurrently:"7.0.0","downlevel-dts":"0.10.1",premove:"4.0.0",typescript:"~7.0.2",vitest:"^4.0.17"},engines:{node:">=20.0.0"}};var te=m(Z()),dt=m(xt());var q=m(M());var Fe=m(M()),qo="AWS_EC2_METADATA_DISABLED",Jo=async(e)=>{let{ENV_CMDS_FULL_URI:t,ENV_CMDS_RELATIVE_URI:o,fromContainerMetadata:n,fromInstanceMetadata:r}=await import("./chunk-8jf1kd0m.js");if(process.env[o]||process.env[t]){e.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromHttp/fromContainerMetadata");let{fromHttp:s}=await import("./chunk-b41a7yc5.js");return Fe.chain(s(e),n(e))}if(process.env[qo]&&process.env[qo]!=="false")return async()=>{throw new Fe.CredentialsProviderError("EC2 Instance Metadata Service access disabled",{logger:e.logger})};return e.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromInstanceMetadata"),r(e)};function Yo(e,t){let o=ri(e),n,r,s,i,c=async(a)=>{if(a?.forceRefresh){if(!i)i=o(a).then((d)=>{s=d}).finally(()=>{i=void 0});return await i,s}if(s?.expiration){if(s?.expiration?.getTime()<Date.now())s=void 0}if(n)await n;else if(!s||t?.(s))if(s){if(!r)r=o(a).then((d)=>{s=d}).catch(()=>{}).finally(()=>{r=void 0})}else return n=o(a).then((d)=>{s=d}).finally(()=>{n=void 0}),c(a);return s};return c}var ri=(e)=>async(t)=>{let o;for(let n of e)try{return await n(t)}catch(r){if(o=r,r?.tryNextLink)continue;throw r}throw o};var Zo=!1,Bt=(e={})=>Yo([async()=>{if(e.profile??process.env[q.ENV_PROFILE]){if(process.env[xo]&&process.env[vo]){if(!Zo)(e.logger?.warn&&e.logger?.constructor?.name!=="NoOpLogger"?e.logger.warn.bind(e.logger):console.warn)(`@aws-sdk/credential-provider-node - defaultProvider::fromEnv WARNING:
3
+ import{vo,_o,Pi}from"./chunk-v312dzv1.js";import{ne}from"./chunk-19nje7ny.js";import{O}from"./chunk-ma4nhnnj.js";import{yo}from"./chunk-9b4ssdy4.js";import{Ga,bo,_n}from"./chunk-7ph88zkj.js";import{Kr}from"./chunk-pvbaf50c.js";import{se}from"./chunk-pzg6f8rv.js";import{Ya}from"./chunk-hrxkr8a8.js";import{De,Ie,An,de,zs,xo,Ne}from"./chunk-qn316bye.js";import{C}from"./chunk-bkabw9yr.js";import{Ue}from"./chunk-fpksd95h.js";import{re,Me,pn,_e,ht,he}from"./chunk-kh4b25x0.js";import{J,it}from"./chunk-23qfxx3v.js";import{vt,sr}from"./chunk-28dpfw91.js";import{_t}from"./chunk-zej3kgxg.js";import{Ot,Ze,Z}from"./chunk-fmvs5wd0.js";import{qe,fe,M,Ge,ge,Gt,Qo,oe}from"./chunk-2bz3h7k7.js";import{m}from"./chunk-5ngmwd2s.js";var w=m(Z());function Mt(e){let{signer:t,signer:o}=e,n=Object.assign(e,{eventSigner:t,messageSigner:o}),r=n.eventStreamPayloadHandlerProvider(n);return Object.assign(n,{eventStreamPayloadHandler:r})}var Fo=m(oe());var $o=(e)=>e.protocol==="ws:"||e.protocol==="wss:";class Ut{signer;constructor(e){this.signer=e.signer}presign(e,t={}){return this.signer.presign(e,t)}async sign(e,t){if(Fo.HttpRequest.isInstance(e)&&$o(e))return{...await this.signer.presign({...e,body:""},{...t,expiresIn:60,unsignableHeaders:new Set(Object.keys(e.headers).filter((n)=>n!=="host"))}),body:e.body};else return this.signer.sign(e,t)}signMessage(e,t){return this.signer.signMessage(e,t)}}var Bt=(e)=>{let{signer:t}=e;return Object.assign(e,{signer:async(o)=>{let n=await t(o);if(ei(n))return new Ut({signer:n});throw Error("Expected WebsocketSignatureV4 signer, please check the client constructor.")}})},ei=(e)=>!!e;var ae=m(Ze()),pr=m(fe()),_r=m(M()),hr=m(Ge()),fr=m(Qo()),mr=m(oe()),gt=m(Ot()),gr=m(qe());var Ho=m(vt()),X=m(Ze()),ve=m(fe()),Wo=async(e,t,o)=>({operation:ve.getSmithyContext(t).operation,region:await ve.normalizeProvider(e.region)()||(()=>{throw Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function ti(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"bedrock",region:e.region},propertiesExtractor:(t,o)=>({signingProperties:{config:t,context:o}})}}function oi(e){return{schemeId:"smithy.api#httpBearerAuth",propertiesExtractor:({profile:t,filepath:o,configFilepath:n,ignoreCache:r},s)=>({identityProperties:{profile:t,filepath:o,configFilepath:n,ignoreCache:r}})}}var Vo=(e)=>{let t=[];switch(e.operation){default:t.push(ti(e)),t.push(oi(e))}return t},Ko=(e)=>{let t=X.memoizeIdentityProvider(e.token,X.isIdentityExpired,X.doesIdentityRequireRefresh),o=Ho.resolveAwsSdkSigV4Config(e);return Object.assign(o,{authSchemePreference:ve.normalizeProvider(e.authSchemePreference??[]),token:t})};var jo=(e)=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"bedrock"}),zo={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var Xo={name:"@aws-sdk/client-bedrock-runtime",version:"3.1127.0",description:"AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-bedrock-runtime",license:"Apache-2.0",author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/sdk-for-javascript/"},repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-bedrock-runtime"},files:["dist-*/**"],sideEffects:!1,main:"./dist-cjs/index.js",module:"./dist-es/index.js",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},types:"./dist-types/index.d.ts",typesVersions:{"<4.5":{"dist-types/*":["dist-types/ts3.4/*"]}},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},scripts:{build:"concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs","build:cjs":"node ../../scripts/compilation/inline","build:es":"premove dist-es && tsc -p tsconfig.es.json","build:include:deps":'yarn g:turbo run build -F="$npm_package_name"',"build:types":"premove dist-types && tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"premove dist-cjs dist-es dist-types","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service",test:"yarn g:vitest run --passWithNoTests","test:watch":"yarn g:vitest watch --passWithNoTests","test:integration":"yarn g:vitest run --passWithNoTests -c vitest.config.integ.mts","test:integration:watch":"yarn g:vitest watch --passWithNoTests -c vitest.config.integ.mts","test:e2e":"yarn g:vitest run -c vitest.config.e2e.mts","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.mts","test:browser":"yarn g:vitest run -c vitest.config.browser.e2e.mts","test:browser:watch":"yarn g:vitest watch -c vitest.config.browser.e2e.mts","test:index":"tsc -p tsconfig.test.json && node ./test/index-objects.spec.mjs"},dependencies:{"@aws-sdk/core":"^3.977.9","@aws-sdk/credential-provider-node":"^3.972.82","@aws-sdk/eventstream-handler-node":"^3.972.34","@aws-sdk/middleware-eventstream":"^3.972.29","@aws-sdk/middleware-websocket":"^3.972.52","@aws-sdk/token-providers":"3.1127.0","@aws-sdk/types":"^3.974.5","@smithy/core":"^3.33.3","@smithy/fetch-http-handler":"^5.7.2","@smithy/node-http-handler":"^4.11.3","@smithy/types":"^4.17.2",tslib:"^2.6.2"},devDependencies:{"@smithy/snapshot-testing":"^2.3.2","@tsconfig/node20":"20.1.8","@types/node":"^20.14.8",concurrently:"7.0.0","downlevel-dts":"0.10.1",premove:"4.0.0",typescript:"~7.0.2",vitest:"^4.0.17"},engines:{node:">=20.0.0"}};var te=m(Z()),dt=m(vt());var q=m(M());var He=m(M()),qo="AWS_EC2_METADATA_DISABLED",Jo=async(e)=>{let{ENV_CMDS_FULL_URI:t,ENV_CMDS_RELATIVE_URI:o,fromContainerMetadata:n,fromInstanceMetadata:r}=await import("./chunk-02kyx0dt.js");if(process.env[o]||process.env[t]){e.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromHttp/fromContainerMetadata");let{fromHttp:s}=await import("./chunk-76jjaj1p.js");return He.chain(s(e),n(e))}if(process.env[qo]&&process.env[qo]!=="false")return async()=>{throw new He.CredentialsProviderError("EC2 Instance Metadata Service access disabled",{logger:e.logger})};return e.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromInstanceMetadata"),r(e)};function Yo(e,t){let o=ri(e),n,r,s,i,c=async(a)=>{if(a?.forceRefresh){if(!i)i=o(a).then((d)=>{s=d}).finally(()=>{i=void 0});return await i,s}if(s?.expiration){if(s?.expiration?.getTime()<Date.now())s=void 0}if(n)await n;else if(!s||t?.(s))if(s){if(!r)r=o(a).then((d)=>{s=d}).catch(()=>{}).finally(()=>{r=void 0})}else return n=o(a).then((d)=>{s=d}).finally(()=>{n=void 0}),c(a);return s};return c}var ri=(e)=>async(t)=>{let o;for(let n of e)try{return await n(t)}catch(r){if(o=r,r?.tryNextLink)continue;throw r}throw o};var Zo=!1,Dt=(e={})=>Yo([async()=>{if(e.profile??process.env[q.ENV_PROFILE]){if(process.env[vo]&&process.env[_o]){if(!Zo)(e.logger?.warn&&e.logger?.constructor?.name!=="NoOpLogger"?e.logger.warn.bind(e.logger):console.warn)(`@aws-sdk/credential-provider-node - defaultProvider::fromEnv WARNING:
4
4
  Multiple credential sources detected:
5
5
  Both AWS_PROFILE and the pair AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY static credentials are set.
6
6
  This SDK will proceed with the AWS_PROFILE value.
@@ -8,19 +8,19 @@ import{xo,vo,Pi}from"./chunk-ad5asgnr.js";import{ne}from"./chunk-mbf7201c.js";im
8
8
  However, a future version may change this behavior to prefer the ENV static credentials.
9
9
  Please ensure that your environment only sets either the AWS_PROFILE or the
10
10
  AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY pair.
11
- `),Zo=!0}throw new q.CredentialsProviderError("AWS_PROFILE is set, skipping fromEnv provider.",{logger:e.logger,tryNextLink:!0})}return e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromEnv"),Pi(e)()},async(t)=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromSSO");let{ssoStartUrl:o,ssoAccountId:n,ssoRegion:r,ssoRoleName:s,ssoSession:i}=e;if(!o&&!n&&!r&&!s&&!i)throw new q.CredentialsProviderError("Skipping SSO provider in default chain (inputs do not include SSO fields).",{logger:e.logger});let{fromSSO:c}=await import("./chunk-z3x79jnt.js");return c(e)(t)},async(t)=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromIni");let{fromIni:o}=await import("./chunk-1xam7mw7.js");return o(e)(t)},async(t)=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromProcess");let{fromProcess:o}=await import("./chunk-vj5p29fr.js");return o(e)(t)},async(t)=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromTokenFile");let{fromTokenFile:o}=await import("./chunk-b3fwt4jy.js");return o(e)(t)},async()=>(e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::remoteProvider"),(await Jo(e))()),async()=>{throw new q.CredentialsProviderError("Could not load credentials from any providers",{tryNextLink:!1,logger:e.logger})}],en);var en=(e)=>e?.expiration!==void 0&&e.expiration.getTime()-Date.now()<300000;var tn=m(Qo());import{PassThrough as ai,pipeline as ci,Readable as di}from"stream";import{Transform as si}from"stream";class Dt extends si{priorSignature;messageSigner;eventStreamCodec;systemClockOffsetProvider;staticCredentials;constructor(e){super({autoDestroy:!0,readableObjectMode:!0,writableObjectMode:!0,...e});this.priorSignature=e.priorSignature,this.eventStreamCodec=e.eventStreamCodec,this.messageSigner=e.messageSigner,this.systemClockOffsetProvider=e.systemClockOffsetProvider,this.staticCredentials=e.credentials?.()}async _transform(e,t,o){try{let n=new Date(Date.now()+await this.systemClockOffsetProvider()),r={":date":{type:"timestamp",value:n}},s=await this.messageSigner.sign({message:{body:e,headers:r},priorSignature:this.priorSignature},{signingDate:n,eventStreamCredentials:await this.staticCredentials});this.priorSignature=s.signature;let i=this.eventStreamCodec.encode({headers:{...r,":chunk-signature":{type:"binary",value:ii(s.signature)}},body:e});return this.push(i),o()}catch(n){o(n)}}}function ii(e){let t=Buffer.from(e,"hex");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT)}class $t{messageSigner;eventStreamCodec;systemClockOffsetProvider;credentials;constructor(e){this.messageSigner=e.messageSigner,this.eventStreamCodec=new tn.EventStreamCodec(e.utf8Encoder,e.utf8Decoder),this.systemClockOffsetProvider=async()=>e.systemClockOffset??0,this.credentials=e.credentials}async handle(e,t,o={}){let n=t.request,{body:r,query:s}=n;if(!(r instanceof di))throw Error("Eventstream payload must be a Readable stream.");n.body=new ai({objectMode:!0});let c=n.headers?.authorization?.match(/Signature=([\w]+)$/)?.[1]??s?.["X-Amz-Signature"]??"";if(o.__staticSignature)c="";let a=new Dt({priorSignature:c,eventStreamCodec:this.eventStreamCodec,messageSigner:await this.messageSigner(),systemClockOffsetProvider:this.systemClockOffsetProvider,credentials:this.credentials}),d,u=new Promise((g,h)=>{d=()=>g(void 0),ci(r,a,n.body,(f)=>{if(f)h(Error(`Pipeline error in @aws-sdk/eventstream-handler-node: ${f.message}`,{cause:f}))})}),l;try{l=await Promise.race([e(t),u])}catch(g){throw n.body.end(),g}finally{d()}return l}}var Ft=(e)=>new $t(e);var nn=m(Z()),rn=m(xt()),Ht=m(M()),Wt=({logger:e,signingName:t}={})=>async()=>{if(e?.debug?.("@aws-sdk/token-providers - fromEnvSigningName"),!t)throw new Ht.TokenProviderError("Please pass 'signingName' to compute environment variable key",{logger:e});let o=rn.getBearerTokenEnvKey(t);if(!(o in process.env))throw new Ht.TokenProviderError(`Token not present in '${o}' environment variable`,{logger:e});let n={token:process.env[o]};return nn.setTokenFeature(n,"BEARER_SERVICE_ENV_VARS","3"),n};var Q=m(M());var R=m(M());var sn=300000,Y="To refresh this SSO session run 'aws sso login' with the corresponding profile.";var an=async(e,t={},o)=>{let{SSOOIDCClient:n}=await import("./chunk-7ygt906s.js"),r=(i)=>t.clientConfig?.[i]??t.parentClientConfig?.[i]??o?.[i];return new n(Object.assign({},t.clientConfig??{},{region:e??t.clientConfig?.region,logger:r("logger"),userAgentAppId:r("userAgentAppId")}))};var cn=async(e,t,o={},n)=>{let{CreateTokenCommand:r}=await import("./chunk-7ygt906s.js");return(await an(t,o,n)).send(new r({clientId:e.clientId,clientSecret:e.clientSecret,refreshToken:e.refreshToken,grantType:"refresh_token"}))};var dn=m(M());var Vt=(e)=>{if(e.expiration&&e.expiration.getTime()<Date.now())throw new dn.TokenProviderError(`Token is expired. ${Y}`,!1)};var un=m(M());var U=(e,t,o=!1)=>{if(typeof t>"u")throw new un.TokenProviderError(`Value not present for '${e}' in SSO Token${o?". Cannot refresh":""}. ${Y}`,!1)};var ln=m(M());import{promises as ui}from"fs";var{writeFile:li}=ui,pn=(e,t)=>{let o=ln.getSSOTokenFilepath(e),n=JSON.stringify(t,null,2);return li(o,n)};var _n=new Map,hn=(e={})=>async({callerClientConfig:t}={})=>{e.logger?.debug("@aws-sdk/token-providers - fromSso");let o=await R.parseKnownFiles(e),n=R.getProfileName({profile:e.profile??t?.profile}),r=o[n];if(!r)throw new R.TokenProviderError(`Profile '${n}' could not be found in shared credentials file.`,!1);else if(!r.sso_session)throw new R.TokenProviderError(`Profile '${n}' is missing required property 'sso_session'.`);let s=r.sso_session,c=(await R.loadSsoSessionData(e))[s];if(!c)throw new R.TokenProviderError(`Sso session '${s}' could not be found in shared credentials file.`,!1);for(let p of["sso_start_url","sso_region"])if(!c[p])throw new R.TokenProviderError(`Sso session '${s}' is missing required property '${p}'.`,!1);let{sso_start_url:a,sso_region:d}=c,u;try{u=await R.getSSOTokenFromFile(s)}catch(p){throw new R.TokenProviderError(`The SSO session token associated with profile=${n} was not found or is invalid. ${Y}`,!1)}U("accessToken",u.accessToken),U("expiresAt",u.expiresAt);let{accessToken:l,expiresAt:g}=u,h={token:l,expiration:new Date(g)};if(h.expiration.getTime()-Date.now()>sn)return h;let f=_n.get(s)??0;if(Date.now()-f<30000)return Vt(h),h;U("clientId",u.clientId,!0),U("clientSecret",u.clientSecret,!0),U("refreshToken",u.refreshToken,!0);try{_n.set(s,Date.now());let p=await cn(u,d,e,t);U("accessToken",p.accessToken),U("expiresIn",p.expiresIn);let y=new Date(Date.now()+p.expiresIn*1000);try{await pn(s,{...u,accessToken:p.accessToken,expiresAt:y.toISOString(),refreshToken:p.refreshToken})}catch(x){}return{token:p.accessToken,expiration:y}}catch(p){return Vt(h),h}};var Kt=(e={})=>Q.memoize(Q.chain(hn(e),async()=>{throw new Q.TokenProviderError("Could not load token from any providers",!1)}),(t)=>t.expiration!==void 0&&t.expiration.getTime()-Date.now()<300000,(t)=>t.expiration!==void 0);var rr=m(Xe()),ut=m(he()),v=m(M()),sr=m(Qo()),se=m(Lt()),ir=m(fe()),lt=m(vt());var Yn=m(xt()),Qn=m(ar()),Zn=m(Xe()),er=m(qt()),tr=m(he()),or=m(oe()),B=m(fe());var xn=m(Z()),ee=m(We());var vn=m(We()),Re="ref",H=-1,He=!0,fn="isSet",An="PartitionResult",Ve="booleanEquals",mn="getAttr",gn={[Re]:"Endpoint"},Cn={[Re]:An},Ae={},Sn=[{[Re]:"Region"}],En={conditions:[[fn,[gn]],[fn,Sn],["aws.partition",Sn,An],[Ve,[{[Re]:"UseFIPS"},He]],[Ve,[{[Re]:"UseDualStack"},He]],[Ve,[{fn:mn,argv:[Cn,"supportsDualStack"]},He]],[Ve,[{fn:mn,argv:[Cn,"supportsFIPS"]},He]]],results:[[H],[H,"Invalid Configuration: FIPS and custom endpoint are not supported"],[H,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[gn,Ae],["https://bedrock-runtime-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",Ae],[H,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://bedrock-runtime-fips.{Region}.{PartitionResult#dnsSuffix}",Ae],[H,"FIPS is enabled but this partition does not support FIPS"],["https://bedrock-runtime.{Region}.{PartitionResult#dualStackDnsSuffix}",Ae],[H,"DualStack is enabled but this partition does not support DualStack"],["https://bedrock-runtime.{Region}.{PartitionResult#dnsSuffix}",Ae],[H,"Invalid Configuration: Missing Region"]]},pi=2,I=1e8,_i=new Int32Array([-1,1,-1,0,12,3,1,4,I+11,2,5,I+11,3,8,6,4,7,I+10,5,I+8,I+9,4,10,9,6,I+6,I+7,5,11,I+5,6,I+4,I+5,3,I+1,13,4,I+2,I+3]),Rn=vn.BinaryDecisionDiagram.from(_i,pi,En.conditions,En.results);var hi=new ee.EndpointCache({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),In=(e,t={})=>hi.get(e,()=>ee.decideEndpoint(Rn,{endpointParams:e,logger:t.logger}));ee.customEndpointFunctions.aws=xn.awsEndpointFunctions;var jt=m(je());var Tn=m(he());class E extends Tn.ServiceException{constructor(e){super(e);Object.setPrototypeOf(this,E.prototype)}}class Ke extends E{name="AccessDeniedException";$fault="client";constructor(e){super({name:"AccessDeniedException",$fault:"client",...e});Object.setPrototypeOf(this,Ke.prototype)}}class ze extends E{name="InternalServerException";$fault="server";constructor(e){super({name:"InternalServerException",$fault:"server",...e});Object.setPrototypeOf(this,ze.prototype)}}class qe extends E{name="ThrottlingException";$fault="client";constructor(e){super({name:"ThrottlingException",$fault:"client",...e});Object.setPrototypeOf(this,qe.prototype)}}class Je extends E{name="ValidationException";$fault="client";constructor(e){super({name:"ValidationException",$fault:"client",...e});Object.setPrototypeOf(this,Je.prototype)}}class Ye extends E{name="ConflictException";$fault="client";constructor(e){super({name:"ConflictException",$fault:"client",...e});Object.setPrototypeOf(this,Ye.prototype)}}class Qe extends E{name="ResourceNotFoundException";$fault="client";constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e});Object.setPrototypeOf(this,Qe.prototype)}}class Ze extends E{name="ServiceQuotaExceededException";$fault="client";constructor(e){super({name:"ServiceQuotaExceededException",$fault:"client",...e});Object.setPrototypeOf(this,Ze.prototype)}}class et extends E{name="ServiceUnavailableException";$fault="server";constructor(e){super({name:"ServiceUnavailableException",$fault:"server",...e});Object.setPrototypeOf(this,et.prototype)}}class tt extends E{name="ModelErrorException";$fault="client";originalStatusCode;resourceName;constructor(e){super({name:"ModelErrorException",$fault:"client",...e});Object.setPrototypeOf(this,tt.prototype),this.originalStatusCode=e.originalStatusCode,this.resourceName=e.resourceName}}class ot extends E{name="ModelNotReadyException";$fault="client";$retryable={};constructor(e){super({name:"ModelNotReadyException",$fault:"client",...e});Object.setPrototypeOf(this,ot.prototype)}}class rt extends E{name="ModelTimeoutException";$fault="client";constructor(e){super({name:"ModelTimeoutException",$fault:"client",...e});Object.setPrototypeOf(this,rt.prototype)}}class st extends E{name="ModelStreamErrorException";$fault="client";originalStatusCode;originalMessage;constructor(e){super({name:"ModelStreamErrorException",$fault:"client",...e});Object.setPrototypeOf(this,st.prototype),this.originalStatusCode=e.originalStatusCode,this.originalMessage=e.originalMessage}}var On=jt.TypeRegistry.for("smithy.ts.sdk.synthetic.com.amazonaws.bedrockruntime"),fi=[-3,"smithy.ts.sdk.synthetic.com.amazonaws.bedrockruntime","BedrockRuntimeServiceException",0,[],[]];On.registerError(fi,E);var T=jt.TypeRegistry.for("com.amazonaws.bedrockruntime"),mi=[-3,"com.amazonaws.bedrockruntime","AccessDeniedException",{["error"]:"client",["httpError"]:403},["message"],[0]];T.registerError(mi,Ke);var gi=[-3,"com.amazonaws.bedrockruntime","ConflictException",{["error"]:"client",["httpError"]:400},["message"],[0]];T.registerError(gi,Ye);var Pn=[-3,"com.amazonaws.bedrockruntime","InternalServerException",{["error"]:"server",["httpError"]:500},["message"],[0]];T.registerError(Pn,ze);var Ci=[-3,"com.amazonaws.bedrockruntime","ModelErrorException",{["error"]:"client",["httpError"]:424},["message","originalStatusCode","resourceName"],[0,1,0]];T.registerError(Ci,tt);var Si=[-3,"com.amazonaws.bedrockruntime","ModelNotReadyException",{["error"]:"client",["httpError"]:429},["message"],[0]];T.registerError(Si,ot);var Gn=[-3,"com.amazonaws.bedrockruntime","ModelStreamErrorException",{["error"]:"client",["httpError"]:424},["message","originalStatusCode","originalMessage"],[0,1,0]];T.registerError(Gn,st);var Ei=[-3,"com.amazonaws.bedrockruntime","ModelTimeoutException",{["error"]:"client",["httpError"]:408},["message"],[0]];T.registerError(Ei,rt);var vi=[-3,"com.amazonaws.bedrockruntime","ResourceNotFoundException",{["error"]:"client",["httpError"]:404},["message"],[0]];T.registerError(vi,Qe);var Ai=[-3,"com.amazonaws.bedrockruntime","ServiceQuotaExceededException",{["error"]:"client",["httpError"]:400},["message"],[0]];T.registerError(Ai,Ze);var bn=[-3,"com.amazonaws.bedrockruntime","ServiceUnavailableException",{["error"]:"server",["httpError"]:503},["message"],[0]];T.registerError(bn,et);var Nn=[-3,"com.amazonaws.bedrockruntime","ThrottlingException",{["error"]:"client",["httpError"]:429},["message"],[0]];T.registerError(Nn,qe);var Ln=[-3,"com.amazonaws.bedrockruntime","ValidationException",{["error"]:"client",["httpError"]:400},["message"],[0]];T.registerError(Ln,Je);var Mn=[On,T];var Ri=[0,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningStatementLogicContent",8,0],Un=[0,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningStatementNaturalLanguageContent",8,0];var yi=[3,"com.amazonaws.bedrockruntime","AnyToolChoice",0,[],[]],xi=[3,"com.amazonaws.bedrockruntime","AppliedGuardrailDetails",0,["guardrailId","guardrailVersion","guardrailArn","guardrailOrigin","guardrailOwnership"],[0,0,0,64,0]];var Ii=[3,"com.amazonaws.bedrockruntime","AudioBlock",0,["format","source","error"],[0,[()=>Tc,0],[()=>Xt,0]],2],Ti=[3,"com.amazonaws.bedrockruntime","AutoToolChoice",0,[],[]];var wi=[3,"com.amazonaws.bedrockruntime","CacheDetail",0,["ttl","inputTokens"],[0,1],2],zt=[3,"com.amazonaws.bedrockruntime","CachePointBlock",0,["type","ttl"],[0,0],1],ki=[3,"com.amazonaws.bedrockruntime","Citation",0,["title","source","sourceContent","location"],[0,0,()=>tc,()=>zn]],Bn=[3,"com.amazonaws.bedrockruntime","CitationsConfig",0,["enabled"],[2],1],Oi=[3,"com.amazonaws.bedrockruntime","CitationsContentBlock",0,["content","citations"],[()=>Za,()=>ec]],Gi=[3,"com.amazonaws.bedrockruntime","CitationsDelta",0,["title","source","sourceContent","location"],[0,0,()=>oc,()=>zn]],bi=[3,"com.amazonaws.bedrockruntime","CitationSourceContentDelta",0,["text"],[0]],Ni=[3,"com.amazonaws.bedrockruntime","ContentBlockDeltaEvent",0,["delta","contentBlockIndex"],[[()=>Pc,0],1],2],Li=[3,"com.amazonaws.bedrockruntime","ContentBlockStartEvent",0,["start","contentBlockIndex"],[()=>Gc,1],2],Mi=[3,"com.amazonaws.bedrockruntime","ContentBlockStopEvent",0,["contentBlockIndex"],[1],1];var Ui=[3,"com.amazonaws.bedrockruntime","ConverseStreamMetadataEvent",0,["usage","metrics","trace","performanceConfig","serviceTier"],[()=>$a,()=>Bi,[()=>Fi,0],()=>Hn,()=>Vn],2],Bi=[3,"com.amazonaws.bedrockruntime","ConverseStreamMetrics",0,["latencyMs"],[1],1],Di=[3,"com.amazonaws.bedrockruntime","ConverseStreamRequest",0,["modelId","messages","system","inferenceConfig","toolConfig","guardrailConfig","additionalModelRequestFields","promptVariables","additionalModelResponseFieldPaths","requestMetadata","performanceConfig","serviceTier","outputConfig"],[[0,1],[()=>gc,0],[()=>Sc,0],()=>Ia,()=>Ha,()=>ga,15,[()=>xc,0],64,[()=>Ic,0],()=>Hn,()=>Vn,[()=>Pa,0]],1],$i=[3,"com.amazonaws.bedrockruntime","ConverseStreamResponse",0,["stream"],[[()=>bc,16]]],Fi=[3,"com.amazonaws.bedrockruntime","ConverseStreamTrace",0,["guardrail","promptRouter"],[[()=>va,0],()=>Na]];var Dn=[3,"com.amazonaws.bedrockruntime","DocumentBlock",0,["name","source","format","context","citations"],[0,()=>Lc,0,0,()=>Bn],2],Hi=[3,"com.amazonaws.bedrockruntime","DocumentCharLocation",0,["documentIndex","start","end"],[1,1,1]],Wi=[3,"com.amazonaws.bedrockruntime","DocumentChunkLocation",0,["documentIndex","start","end"],[1,1,1]],Vi=[3,"com.amazonaws.bedrockruntime","DocumentPageLocation",0,["documentIndex","start","end"],[1,1,1]],Xt=[3,"com.amazonaws.bedrockruntime","ErrorBlock",8,["message"],[0]];var $n=[3,"com.amazonaws.bedrockruntime","GuardrailAssessment",0,["topicPolicy","contentPolicy","wordPolicy","sensitiveInformationPolicy","contextualGroundingPolicy","automatedReasoningPolicy","invocationMetrics","appliedGuardrailDetails"],[()=>Ea,()=>ra,()=>Ra,()=>ma,()=>ia,[()=>qi,0],()=>pa,()=>xi]],Ki=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningImpossibleFinding",0,["translation","contradictingRules","logicWarning"],[[()=>xe,0],()=>Jt,[()=>at,0]]],ji=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningInputTextReference",0,["text"],[[()=>Un,0]]],zi=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningInvalidFinding",0,["translation","contradictingRules","logicWarning"],[[()=>xe,0],()=>Jt,[()=>at,0]]],at=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningLogicWarning",0,["type","premises","claims"],[0,[()=>ye,0],[()=>ye,0]]],Xi=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningNoTranslationsFinding",0,[],[]],qi=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningPolicyAssessment",0,["findings"],[[()=>ac,0]]],Ji=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningRule",0,["identifier","policyVersionArn"],[0,0]],Yi=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningSatisfiableFinding",0,["translation","claimsTrueScenario","claimsFalseScenario","logicWarning"],[[()=>xe,0],[()=>it,0],[()=>it,0],[()=>at,0]]],it=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningScenario",0,["statements"],[[()=>ye,0]]],Qi=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningStatement",0,["logic","naturalLanguage"],[[()=>Ri,0],[()=>Un,0]]],Zi=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningTooComplexFinding",0,[],[]],xe=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningTranslation",0,["premises","claims","untranslatedPremises","untranslatedClaims","confidence"],[[()=>ye,0],[()=>ye,0],[()=>kn,0],[()=>kn,0],1]],ea=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningTranslationAmbiguousFinding",0,["options","differenceScenarios"],[[()=>dc,0],[()=>ic,0]]],ta=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningTranslationOption",0,["translations"],[[()=>cc,0]]],oa=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningValidFinding",0,["translation","claimsTrueScenario","supportingRules","logicWarning"],[[()=>xe,0],[()=>it,0],()=>Jt,[()=>at,0]]];var na=[3,"com.amazonaws.bedrockruntime","GuardrailContentFilter",0,["type","confidence","action","filterStrength","detected"],[0,0,0,0,2],3],ra=[3,"com.amazonaws.bedrockruntime","GuardrailContentPolicyAssessment",0,["filters"],[()=>uc],1],sa=[3,"com.amazonaws.bedrockruntime","GuardrailContextualGroundingFilter",0,["type","threshold","score","action","detected"],[0,1,1,0,2],4],ia=[3,"com.amazonaws.bedrockruntime","GuardrailContextualGroundingPolicyAssessment",0,["filters"],[()=>lc]],aa=[3,"com.amazonaws.bedrockruntime","GuardrailConverseImageBlock",8,["format","source"],[0,[()=>Uc,0]],2],ca=[3,"com.amazonaws.bedrockruntime","GuardrailConverseTextBlock",0,["text","qualifiers"],[0,64],1],da=[3,"com.amazonaws.bedrockruntime","GuardrailCoverage",0,["textCharacters","images"],[()=>Ca,()=>la]],ua=[3,"com.amazonaws.bedrockruntime","GuardrailCustomWord",0,["match","action","detected"],[0,0,2],2];var la=[3,"com.amazonaws.bedrockruntime","GuardrailImageCoverage",0,["guarded","total"],[1,1]],pa=[3,"com.amazonaws.bedrockruntime","GuardrailInvocationMetrics",0,["guardrailProcessingLatency","usage","guardrailCoverage"],[1,()=>Aa,()=>da]],_a=[3,"com.amazonaws.bedrockruntime","GuardrailManagedWord",0,["match","type","action","detected"],[0,0,0,2],3];var ha=[3,"com.amazonaws.bedrockruntime","GuardrailPiiEntityFilter",0,["match","type","action","detected"],[0,0,0,2],3],fa=[3,"com.amazonaws.bedrockruntime","GuardrailRegexFilter",0,["action","name","match","regex","detected"],[0,0,0,0,2],1],ma=[3,"com.amazonaws.bedrockruntime","GuardrailSensitiveInformationPolicyAssessment",0,["piiEntities","regexes"],[()=>hc,()=>fc],2],ga=[3,"com.amazonaws.bedrockruntime","GuardrailStreamConfiguration",0,["guardrailIdentifier","guardrailVersion","trace","streamProcessingMode"],[0,0,0,0]];var Ca=[3,"com.amazonaws.bedrockruntime","GuardrailTextCharactersCoverage",0,["guarded","total"],[1,1]],Sa=[3,"com.amazonaws.bedrockruntime","GuardrailTopic",0,["name","type","action","detected"],[0,0,0,2],3],Ea=[3,"com.amazonaws.bedrockruntime","GuardrailTopicPolicyAssessment",0,["topics"],[()=>mc],1],va=[3,"com.amazonaws.bedrockruntime","GuardrailTraceAssessment",0,["modelOutput","inputAssessment","outputAssessments","actionReason"],[64,[()=>yc,0],[()=>Rc,0],0]],Aa=[3,"com.amazonaws.bedrockruntime","GuardrailUsage",0,["topicPolicyUnits","contentPolicyUnits","wordPolicyUnits","sensitiveInformationPolicyUnits","sensitiveInformationPolicyFreeUnits","contextualGroundingPolicyUnits","contentPolicyImageUnits","automatedReasoningPolicyUnits","automatedReasoningPolicies"],[1,1,1,1,1,1,1,1,1],6],Ra=[3,"com.amazonaws.bedrockruntime","GuardrailWordPolicyAssessment",0,["customWords","managedWordLists"],[()=>pc,()=>_c],2],Fn=[3,"com.amazonaws.bedrockruntime","ImageBlock",0,["format","source","error"],[0,[()=>qn,0],[()=>Xt,0]],2],ya=[3,"com.amazonaws.bedrockruntime","ImageBlockDelta",0,["source","error"],[[()=>qn,0],[()=>Xt,0]]],xa=[3,"com.amazonaws.bedrockruntime","ImageBlockStart",0,["format"],[0],1],Ia=[3,"com.amazonaws.bedrockruntime","InferenceConfiguration",0,["maxTokens","temperature","topP","stopSequences"],[1,1,1,64]];var Ta=[3,"com.amazonaws.bedrockruntime","JsonSchemaDefinition",0,["schema","name","description"],[0,0,0],1];var wa=[3,"com.amazonaws.bedrockruntime","Message",0,["role","content"],[0,[()=>nc,0]],2],ka=[3,"com.amazonaws.bedrockruntime","MessageStartEvent",0,["role"],[0],1],Oa=[3,"com.amazonaws.bedrockruntime","MessageStopEvent",0,["stopReason","additionalModelResponseFields"],[0,15],1],Pa=[3,"com.amazonaws.bedrockruntime","OutputConfig",0,["textFormat","effort"],[[()=>ba,0],0]],ba=[3,"com.amazonaws.bedrockruntime","OutputFormat",0,["type","structure"],[0,[()=>Bc,0]],2];var Hn=[3,"com.amazonaws.bedrockruntime","PerformanceConfiguration",0,["latency"],[0]],Na=[3,"com.amazonaws.bedrockruntime","PromptRouterTrace",0,["invokedModelId"],[0]],La=[3,"com.amazonaws.bedrockruntime","ReasoningTextBlock",8,["text","signature"],[0,0],1],ct=[3,"com.amazonaws.bedrockruntime","S3Location",0,["uri","bucketOwner"],[0,0],1],Wn=[3,"com.amazonaws.bedrockruntime","SearchResultBlock",0,["source","title","content","citations"],[0,0,()=>Cc,()=>Bn],3],Ma=[3,"com.amazonaws.bedrockruntime","SearchResultContentBlock",0,["text"],[0],1],Ua=[3,"com.amazonaws.bedrockruntime","SearchResultLocation",0,["searchResultIndex","start","end"],[1,1,1]],Vn=[3,"com.amazonaws.bedrockruntime","ServiceTier",0,["type"],[0],1],Ba=[3,"com.amazonaws.bedrockruntime","SpecificToolChoice",0,["name"],[0],1];var Da=[3,"com.amazonaws.bedrockruntime","SystemTool",0,["name"],[0],1];var $a=[3,"com.amazonaws.bedrockruntime","TokenUsage",0,["inputTokens","outputTokens","totalTokens","cacheReadInputTokens","cacheWriteInputTokens","cacheDetails"],[1,1,1,1,1,()=>Qa],3],Fa=[3,"com.amazonaws.bedrockruntime","ToolAdditionBlock",0,["tool"],[()=>Kn],1],Ha=[3,"com.amazonaws.bedrockruntime","ToolConfiguration",0,["tools","toolChoice"],[()=>Ac,()=>Vc],1],Kn=[3,"com.amazonaws.bedrockruntime","ToolReference",0,["type","name","serverName"],[0,0,0]],Wa=[3,"com.amazonaws.bedrockruntime","ToolRemovalBlock",0,["tool"],[()=>Kn],1],Va=[3,"com.amazonaws.bedrockruntime","ToolResultBlock",0,["toolUseId","content","status","type"],[0,[()=>vc,0],0,0],2],Ka=[3,"com.amazonaws.bedrockruntime","ToolResultBlockStart",0,["toolUseId","type","status"],[0,0,0],1],ja=[3,"com.amazonaws.bedrockruntime","ToolSpecification",0,["name","inputSchema","description","strict"],[0,()=>Kc,0,2],2],za=[3,"com.amazonaws.bedrockruntime","ToolUseBlock",0,["toolUseId","name","input","type"],[0,0,15,0],3],Xa=[3,"com.amazonaws.bedrockruntime","ToolUseBlockDelta",0,["input"],[0],1],qa=[3,"com.amazonaws.bedrockruntime","ToolUseBlockStart",0,["toolUseId","name","type"],[0,0,0],2],jn=[3,"com.amazonaws.bedrockruntime","VideoBlock",0,["format","source"],[0,()=>Xc],2],Ja=[3,"com.amazonaws.bedrockruntime","WebLocation",0,["url","domain"],[0,0]];var Qa=[1,"com.amazonaws.bedrockruntime","CacheDetailsList",0,()=>wi],Za=[1,"com.amazonaws.bedrockruntime","CitationGeneratedContentList",0,()=>wc],ec=[1,"com.amazonaws.bedrockruntime","Citations",0,()=>ki],tc=[1,"com.amazonaws.bedrockruntime","CitationSourceContentList",0,()=>kc],oc=[1,"com.amazonaws.bedrockruntime","CitationSourceContentListDelta",0,()=>bi],nc=[1,"com.amazonaws.bedrockruntime","ContentBlocks",0,[()=>Oc,0]],rc=[1,"com.amazonaws.bedrockruntime","DocumentContentBlocks",0,()=>Nc],sc=[1,"com.amazonaws.bedrockruntime","GuardrailAssessmentList",0,[()=>$n,0]],ic=[1,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningDifferenceScenarioList",0,[()=>it,0]],ac=[1,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningFindingList",0,[()=>Mc,0]],kn=[1,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningInputTextReferenceList",0,[()=>ji,0]],Jt=[1,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningRuleList",0,()=>Ji],ye=[1,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningStatementList",0,[()=>Qi,0]],cc=[1,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningTranslationList",0,[()=>xe,0]],dc=[1,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningTranslationOptionList",0,[()=>ta,0]];var uc=[1,"com.amazonaws.bedrockruntime","GuardrailContentFilterList",0,()=>na];var lc=[1,"com.amazonaws.bedrockruntime","GuardrailContextualGroundingFilters",0,()=>sa];var pc=[1,"com.amazonaws.bedrockruntime","GuardrailCustomWordList",0,()=>ua],_c=[1,"com.amazonaws.bedrockruntime","GuardrailManagedWordList",0,()=>_a];var hc=[1,"com.amazonaws.bedrockruntime","GuardrailPiiEntityFilterList",0,()=>ha],fc=[1,"com.amazonaws.bedrockruntime","GuardrailRegexFilterList",0,()=>fa],mc=[1,"com.amazonaws.bedrockruntime","GuardrailTopicList",0,()=>Sa],gc=[1,"com.amazonaws.bedrockruntime","Messages",0,[()=>wa,0]];var Cc=[1,"com.amazonaws.bedrockruntime","SearchResultContentBlocks",0,()=>Ma],Sc=[1,"com.amazonaws.bedrockruntime","SystemContentBlocks",0,[()=>Hc,0]];var Ec=[1,"com.amazonaws.bedrockruntime","ToolResultBlocksDelta",0,()=>jc],vc=[1,"com.amazonaws.bedrockruntime","ToolResultContentBlocks",0,[()=>zc,0]],Ac=[1,"com.amazonaws.bedrockruntime","Tools",0,()=>Wc],Rc=[2,"com.amazonaws.bedrockruntime","GuardrailAssessmentListMap",0,[0,0],[()=>sc,0]],yc=[2,"com.amazonaws.bedrockruntime","GuardrailAssessmentMap",0,[0,0],[()=>$n,0]],xc=[2,"com.amazonaws.bedrockruntime","PromptVariableMap",8,0,()=>Dc],Ic=[2,"com.amazonaws.bedrockruntime","RequestMetadata",8,0,0];var Tc=[4,"com.amazonaws.bedrockruntime","AudioSource",8,["bytes","s3Location"],[21,()=>ct]],wc=[4,"com.amazonaws.bedrockruntime","CitationGeneratedContent",0,["text"],[0]],zn=[4,"com.amazonaws.bedrockruntime","CitationLocation",0,["web","documentChar","documentPage","documentChunk","searchResultLocation"],[()=>Ja,()=>Hi,()=>Vi,()=>Wi,()=>Ua]],kc=[4,"com.amazonaws.bedrockruntime","CitationSourceContent",0,["text"],[0]],Oc=[4,"com.amazonaws.bedrockruntime","ContentBlock",0,["text","image","document","video","audio","toolUse","toolResult","guardContent","cachePoint","reasoningContent","citationsContent","searchResult","toolAddition","toolRemoval"],[0,[()=>Fn,0],()=>Dn,()=>jn,[()=>Ii,0],()=>za,[()=>Va,0],[()=>Xn,0],()=>zt,[()=>$c,0],()=>Oi,()=>Wn,()=>Fa,()=>Wa]],Pc=[4,"com.amazonaws.bedrockruntime","ContentBlockDelta",0,["text","toolUse","toolResult","reasoningContent","citation","image"],[0,()=>Xa,()=>Ec,[()=>Fc,0],()=>Gi,[()=>ya,0]]],Gc=[4,"com.amazonaws.bedrockruntime","ContentBlockStart",0,["toolUse","toolResult","image"],[()=>qa,()=>Ka,()=>xa]];var bc=[4,"com.amazonaws.bedrockruntime","ConverseStreamOutput",{["streaming"]:1},["messageStart","contentBlockStart","contentBlockDelta","contentBlockStop","messageStop","metadata","internalServerException","modelStreamErrorException","validationException","throttlingException","serviceUnavailableException"],[()=>ka,()=>Li,[()=>Ni,0],()=>Mi,()=>Oa,[()=>Ui,0],[()=>Pn,0],[()=>Gn,0],[()=>Ln,0],[()=>Nn,0],[()=>bn,0]]];var Nc=[4,"com.amazonaws.bedrockruntime","DocumentContentBlock",0,["text"],[0]],Lc=[4,"com.amazonaws.bedrockruntime","DocumentSource",0,["bytes","s3Location","text","content"],[21,()=>ct,0,()=>rc]],Mc=[4,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningFinding",0,["valid","invalid","satisfiable","impossible","translationAmbiguous","tooComplex","noTranslations"],[[()=>oa,0],[()=>zi,0],[()=>Yi,0],[()=>Ki,0],[()=>ea,0],()=>Zi,()=>Xi]];var Xn=[4,"com.amazonaws.bedrockruntime","GuardrailConverseContentBlock",0,["text","image"],[()=>ca,[()=>aa,0]]],Uc=[4,"com.amazonaws.bedrockruntime","GuardrailConverseImageSource",8,["bytes"],[21]];var qn=[4,"com.amazonaws.bedrockruntime","ImageSource",8,["bytes","s3Location"],[21,()=>ct]];var Bc=[4,"com.amazonaws.bedrockruntime","OutputFormatStructure",8,["jsonSchema"],[()=>Ta]],Dc=[4,"com.amazonaws.bedrockruntime","PromptVariableValues",0,["text"],[0]],$c=[4,"com.amazonaws.bedrockruntime","ReasoningContentBlock",8,["reasoningText","redactedContent"],[[()=>La,0],21]],Fc=[4,"com.amazonaws.bedrockruntime","ReasoningContentBlockDelta",8,["text","redactedContent","signature"],[0,21,0]];var Hc=[4,"com.amazonaws.bedrockruntime","SystemContentBlock",0,["text","guardContent","cachePoint"],[0,[()=>Xn,0],()=>zt]],Wc=[4,"com.amazonaws.bedrockruntime","Tool",0,["toolSpec","systemTool","cachePoint"],[()=>ja,()=>Da,()=>zt]],Vc=[4,"com.amazonaws.bedrockruntime","ToolChoice",0,["auto","any","tool"],[()=>Ti,()=>yi,()=>Ba]],Kc=[4,"com.amazonaws.bedrockruntime","ToolInputSchema",0,["json"],[15]],jc=[4,"com.amazonaws.bedrockruntime","ToolResultBlockDelta",0,["text","json"],[0,15]],zc=[4,"com.amazonaws.bedrockruntime","ToolResultContentBlock",0,["json","text","image","document","video","searchResult"],[15,0,[()=>Fn,0],()=>Dn,()=>jn,()=>Wn]],Xc=[4,"com.amazonaws.bedrockruntime","VideoSource",0,["bytes","s3Location"],[21,()=>ct]];var Jn=[9,"com.amazonaws.bedrockruntime","ConverseStream",{["http"]:["POST","/model/{modelId}/converse-stream",200]},()=>Di,()=>$i];var nr=(e)=>({apiVersion:"2023-09-30",base64Decoder:e?.base64Decoder??B.fromBase64,base64Encoder:e?.base64Encoder??B.toBase64,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??In,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Vo,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(t)=>t.getIdentityProvider("aws.auth#sigv4"),signer:new Yn.AwsSdkSigV4Signer},{schemeId:"smithy.api#httpBearerAuth",identityProvider:(t)=>t.getIdentityProvider("smithy.api#httpBearerAuth"),signer:new Zn.HttpBearerAuthSigner}],logger:e?.logger??new tr.NoOpLogger,protocol:e?.protocol??Qn.AwsRestJsonProtocol,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.bedrockruntime",errorTypeRegistries:Mn,version:"2023-09-30",serviceTarget:"AmazonBedrockFrontendService"},serviceId:e?.serviceId??"Bedrock Runtime",sha256:e?.sha256??er.Sha256,urlParser:e?.urlParser??or.parseUrl,utf8Decoder:e?.utf8Decoder??B.fromUtf8,utf8Encoder:e?.utf8Encoder??B.toUtf8});var cr=(e)=>{ut.emitWarningIfUnsupportedVersion(process.version);let t=v.resolveDefaultsModeConfig(e),o=()=>t().then(ut.loadConfigsForDefaultMode),n=nr(e);te.emitWarningIfUnsupportedVersion(process.version);let r={profile:e?.profile,logger:n.logger,signingName:"bedrock"};return{...n,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??v.loadConfig(dt.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS,r),bodyLengthChecker:e?.bodyLengthChecker??ir.calculateBodyLength,credentialDefaultProvider:e?.credentialDefaultProvider??Bt,defaultUserAgentProvider:e?.defaultUserAgentProvider??te.createDefaultUserAgentProvider({serviceId:n.serviceId,clientVersion:Xo.version}),eventStreamPayloadHandlerProvider:e?.eventStreamPayloadHandlerProvider??Ft,eventStreamSerdeProvider:e?.eventStreamSerdeProvider??sr.eventStreamSerdeProvider,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(s)=>s.getIdentityProvider("aws.auth#sigv4"),signer:new dt.AwsSdkSigV4Signer},{schemeId:"smithy.api#httpBearerAuth",identityProvider:(s)=>s.getIdentityProvider("smithy.api#httpBearerAuth")||(async(i)=>{try{return await Wt({signingName:"bedrock"})()}catch(c){return await Kt(i)(i)}}),signer:new rr.HttpBearerAuthSigner}],maxAttempts:e?.maxAttempts??v.loadConfig(se.NODE_MAX_ATTEMPT_CONFIG_OPTIONS,e),region:e?.region??v.loadConfig(v.NODE_REGION_CONFIG_OPTIONS,{...v.NODE_REGION_CONFIG_FILE_OPTIONS,...r}),requestHandler:lt.NodeHttp2Handler.create(e?.requestHandler??(async()=>({...await o(),disableConcurrentStreams:!0}))),retryMode:e?.retryMode??v.loadConfig({...se.NODE_RETRY_MODE_CONFIG_OPTIONS,default:async()=>(await o()).retryMode||se.DEFAULT_RETRY_MODE},e),streamCollector:e?.streamCollector??lt.streamCollector,useDualstackEndpoint:e?.useDualstackEndpoint??v.loadConfig(v.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,r),useFipsEndpoint:e?.useFipsEndpoint??v.loadConfig(v.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,r),userAgentAppId:e?.userAgentAppId??v.loadConfig(te.NODE_APP_ID_CONFIG_OPTIONS,r)}};var pt=m(Z()),_t=m(he()),ft=m(oe());var dr=(e)=>{let{httpAuthSchemes:t,httpAuthSchemeProvider:o,credentials:n,token:r}=e;return{setHttpAuthScheme(s){let i=t.findIndex((c)=>c.schemeId===s.schemeId);if(i===-1)t.push(s);else t.splice(i,1,s)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(s){o=s},httpAuthSchemeProvider(){return o},setCredentials(s){n=s},credentials(){return n},setToken(s){r=s},token(){return r}}},ur=(e)=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials(),token:e.token()});var lr=(e,t)=>{let o=Object.assign(pt.getAwsRegionExtensionConfiguration(e),_t.getDefaultExtensionConfiguration(e),ft.getHttpHandlerExtensionConfiguration(e),dr(e));return t.forEach((n)=>n.configure(o)),Object.assign(e,pt.resolveAwsRegionExtensionConfiguration(o),_t.resolveDefaultRuntimeConfig(o),ft.resolveHttpHandlerRuntimeConfig(o),ur(o))};class Yt extends pr.Client{config;constructor(...[e]){let t=cr(e||{});super(t);this.initConfig=t;let o=jo(t),n=w.resolveUserAgentConfig(o),r=mt.resolveRetryConfig(n),s=_r.resolveRegionConfig(r),i=w.resolveHostHeaderConfig(s),c=hr.resolveEndpointConfig(i),a=fr.resolveEventStreamSerdeConfig(c),d=Ko(a),u=Nt(d),l=Ut(u),g=lr(l,e?.extensions||[]);this.config=g,this.middlewareStack.use(gr.getSchemaSerdePlugin(this.config)),this.middlewareStack.use(w.getUserAgentPlugin(this.config)),this.middlewareStack.use(mt.getRetryPlugin(this.config)),this.middlewareStack.use(mr.getContentLengthPlugin(this.config)),this.middlewareStack.use(w.getHostHeaderPlugin(this.config)),this.middlewareStack.use(w.getLoggerPlugin(this.config)),this.middlewareStack.use(w.getRecursionDetectionPlugin(this.config)),this.middlewareStack.use(ae.getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:Wo,identityProviderConfigProvider:async(h)=>new ae.DefaultIdentityProviderConfig({"aws.auth#sigv4":h.credentials,"smithy.api#httpBearerAuth":h.token})})),this.middlewareStack.use(ae.getHttpSigningPlugin(this.config))}destroy(){super.destroy()}}var Cr=m(he()),Sr=m(We());var Er=Cr.makeBuilder(zo,"AmazonBedrockFrontendService","BedrockRuntimeClient",Sr.getEndpointPlugin),vr={},Ar=(e,t,o,n)=>[];class Qt extends Er(vr,Ar,"ConverseStream",Jn){}var gt={FIVE_MINUTES:"5m",ONE_HOUR:"1h"},Zt={DEFAULT:"default"};var Te={GIF:"gif",JPEG:"jpeg",PNG:"png",WEBP:"webp"};var we={ERROR:"error",SUCCESS:"success"};var ce={ASSISTANT:"assistant",SYSTEM:"system",USER:"user"};var ue={CONTENT_FILTERED:"content_filtered",END_TURN:"end_turn",GUARDRAIL_INTERVENED:"guardrail_intervened",MALFORMED_MODEL_OUTPUT:"malformed_model_output",MALFORMED_TOOL_USE:"malformed_tool_use",MAX_TOKENS:"max_tokens",MODEL_CONTEXT_WINDOW_EXCEEDED:"model_context_window_exceeded",STOP_SEQUENCE:"stop_sequence",TOOL_USE:"tool_use"};var oo=m(vt(),1);var wr=m(qr(),1);import*as Ir from"net";import*as Tr from"tls";import{once as Jc}from"events";import*as Rr from"net";import*as yr from"http";import{Agent as qc}from"https";var b=Symbol("AgentBaseInternalState");class ke extends yr.Agent{constructor(e){super(e);this[b]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint==="boolean")return e.secureEndpoint;if(typeof e.protocol==="string")return e.protocol==="https:"}let{stack:t}=Error();if(typeof t!=="string")return!1;return t.split(`
12
- `).some((o)=>o.indexOf("(https.js:")!==-1||o.indexOf("node:https:")!==-1)}incrementSockets(e){if(this.maxSockets===1/0&&this.maxTotalSockets===1/0)return null;if(!this.sockets[e])this.sockets[e]=[];let t=new Rr.Socket({writable:!1});return this.sockets[e].push(t),this.totalSocketCount++,t}decrementSockets(e,t){if(!this.sockets[e]||t===null)return;let o=this.sockets[e],n=o.indexOf(t);if(n!==-1){if(o.splice(n,1),this.totalSocketCount--,o.length===0)delete this.sockets[e]}}getName(e){if(this.isSecureEndpoint(e))return qc.prototype.getName.call(this,e);return super.getName(e)}createSocket(e,t,o){let n={...t,secureEndpoint:this.isSecureEndpoint(t)},r=this.getName(n),s=this.incrementSockets(r);Promise.resolve().then(()=>this.connect(e,n)).then((i)=>{if(this.decrementSockets(r,s),typeof i.addRequest==="function")try{return i.addRequest(e,n)}catch(c){return o(c)}this[b].currentSocket=i,super.createSocket(e,t,o)},(i)=>{this.decrementSockets(r,s),o(i)})}createConnection(){let e=this[b].currentSocket;if(this[b].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[b].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(e){if(this[b])this[b].defaultPort=e}get protocol(){return this[b].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(e){if(this[b])this[b].protocol=e}}import{URL as xr}from"url";function Ct(){return async({response:e,scheme:t})=>{if(t.toLowerCase()!=="negotiate")throw Error(`Expected Negotiate scheme but got "${t}"`);let o;try{o=await import("kerberos")}catch{throw Error('The "kerberos" package is required for Negotiate proxy authentication. Install it with: npm install kerberos')}let n=e.headers["proxy-authenticate"]||"",r=Array.isArray(n)?n[0]:n,s=typeof r==="string"&&r.includes(" ")?r.split(" ").slice(1).join(" "):void 0,c=await(await o.initializeClient("HTTP@proxy",{mechOID:o.GSS_MECH_OID_SPNEGO})).step(s||"");if(!c)throw Error("Kerberos client.step() returned no token");return{headers:{"Proxy-Authorization":`Negotiate ${c}`}}}}var le=wr.default("http-proxy-agent");class St extends ke{constructor(e,t){super(t);if(this.proxy=typeof e==="string"?new xr(e):e,this.proxyHeaders=t?.headers??{},le("Creating new HttpProxyAgent instance: %o",this.proxy.href),t?.negotiate)this.onProxyAuth=Ct();else if(t?.onProxyAuth)this.onProxyAuth=t.onProxyAuth;let o=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),n=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={...t?Yc(t,"headers","onProxyAuth","negotiate"):null,host:o,port:n}}addRequest(e,t){e._header=null,this.setRequestProps(e,t),super.addRequest(e,t)}setRequestProps(e,t){let{proxy:o}=this,n=t.secureEndpoint?"https:":"http:",r=e.getHeader("host")||"localhost",s=`${n}//${r}`,i=new xr(e.path,s);if(t.port!==80)i.port=String(t.port);e.path=String(i);let c=typeof this.proxyHeaders==="function"?this.proxyHeaders():{...this.proxyHeaders};if(o.username||o.password){let a=`${decodeURIComponent(o.username)}:${decodeURIComponent(o.password)}`;c["Proxy-Authorization"]=`Basic ${Buffer.from(a).toString("base64")}`}if(!c["Proxy-Connection"])c["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close";for(let a of Object.keys(c)){let d=c[a];if(d)e.setHeader(a,d)}}async connect(e,t){if(e._header=null,!e.path.includes("://"))this.setRequestProps(e,t);let o,n;if(le("Regenerating stored HTTP header string for request"),e._implicitHeader(),e.outputData&&e.outputData.length>0)le("Patching connection write() output buffer with updated header"),o=e.outputData[0].data,n=o.indexOf(`\r
11
+ `),Zo=!0}throw new q.CredentialsProviderError("AWS_PROFILE is set, skipping fromEnv provider.",{logger:e.logger,tryNextLink:!0})}return e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromEnv"),Pi(e)()},async(t)=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromSSO");let{ssoStartUrl:o,ssoAccountId:n,ssoRegion:r,ssoRoleName:s,ssoSession:i}=e;if(!o&&!n&&!r&&!s&&!i)throw new q.CredentialsProviderError("Skipping SSO provider in default chain (inputs do not include SSO fields).",{logger:e.logger});let{fromSSO:c}=await import("./chunk-kn8p9hm4.js");return c(e)(t)},async(t)=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromIni");let{fromIni:o}=await import("./chunk-wa3w6q66.js");return o(e)(t)},async(t)=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromProcess");let{fromProcess:o}=await import("./chunk-yyeq63ns.js");return o(e)(t)},async(t)=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromTokenFile");let{fromTokenFile:o}=await import("./chunk-k3p05x7q.js");return o(e)(t)},async()=>(e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::remoteProvider"),(await Jo(e))()),async()=>{throw new q.CredentialsProviderError("Could not load credentials from any providers",{tryNextLink:!1,logger:e.logger})}],en);var en=(e)=>e?.expiration!==void 0&&e.expiration.getTime()-Date.now()<300000;var tn=m(Qo());import{PassThrough as ai,pipeline as ci,Readable as di}from"stream";import{Transform as si}from"stream";class $t extends si{priorSignature;messageSigner;eventStreamCodec;systemClockOffsetProvider;staticCredentials;constructor(e){super({autoDestroy:!0,readableObjectMode:!0,writableObjectMode:!0,...e});this.priorSignature=e.priorSignature,this.eventStreamCodec=e.eventStreamCodec,this.messageSigner=e.messageSigner,this.systemClockOffsetProvider=e.systemClockOffsetProvider,this.staticCredentials=e.credentials?.()}async _transform(e,t,o){try{let n=new Date(Date.now()+await this.systemClockOffsetProvider()),r={":date":{type:"timestamp",value:n}},s=await this.messageSigner.sign({message:{body:e,headers:r},priorSignature:this.priorSignature},{signingDate:n,eventStreamCredentials:await this.staticCredentials});this.priorSignature=s.signature;let i=this.eventStreamCodec.encode({headers:{...r,":chunk-signature":{type:"binary",value:ii(s.signature)}},body:e});return this.push(i),o()}catch(n){o(n)}}}function ii(e){let t=Buffer.from(e,"hex");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT)}class Ft{messageSigner;eventStreamCodec;systemClockOffsetProvider;credentials;constructor(e){this.messageSigner=e.messageSigner,this.eventStreamCodec=new tn.EventStreamCodec(e.utf8Encoder,e.utf8Decoder),this.systemClockOffsetProvider=async()=>e.systemClockOffset??0,this.credentials=e.credentials}async handle(e,t,o={}){let n=t.request,{body:r,query:s}=n;if(!(r instanceof di))throw Error("Eventstream payload must be a Readable stream.");n.body=new ai({objectMode:!0});let c=n.headers?.authorization?.match(/Signature=([\w]+)$/)?.[1]??s?.["X-Amz-Signature"]??"";if(o.__staticSignature)c="";let a=new $t({priorSignature:c,eventStreamCodec:this.eventStreamCodec,messageSigner:await this.messageSigner(),systemClockOffsetProvider:this.systemClockOffsetProvider,credentials:this.credentials}),d,u=new Promise((g,h)=>{d=()=>g(void 0),ci(r,a,n.body,(f)=>{if(f)h(Error(`Pipeline error in @aws-sdk/eventstream-handler-node: ${f.message}`,{cause:f}))})}),l;try{l=await Promise.race([e(t),u])}catch(g){throw n.body.end(),g}finally{d()}return l}}var Ht=(e)=>new Ft(e);var on=m(Z()),nn=m(vt()),Wt=m(M()),Vt=({logger:e,signingName:t}={})=>async()=>{if(e?.debug?.("@aws-sdk/token-providers - fromEnvSigningName"),!t)throw new Wt.TokenProviderError("Please pass 'signingName' to compute environment variable key",{logger:e});let o=nn.getBearerTokenEnvKey(t);if(!(o in process.env))throw new Wt.TokenProviderError(`Token not present in '${o}' environment variable`,{logger:e});let n={token:process.env[o]};return on.setTokenFeature(n,"BEARER_SERVICE_ENV_VARS","3"),n};var Q=m(M());var R=m(M());var rn=300000,Y="To refresh this SSO session run 'aws sso login' with the corresponding profile.";var sn=async(e,t={},o)=>{let{SSOOIDCClient:n}=await import("./chunk-x4nt43pv.js"),r=(i)=>t.clientConfig?.[i]??t.parentClientConfig?.[i]??o?.[i];return new n(Object.assign({},t.clientConfig??{},{region:e??t.clientConfig?.region,logger:r("logger"),userAgentAppId:r("userAgentAppId")}))};var an=async(e,t,o={},n)=>{let{CreateTokenCommand:r}=await import("./chunk-x4nt43pv.js");return(await sn(t,o,n)).send(new r({clientId:e.clientId,clientSecret:e.clientSecret,refreshToken:e.refreshToken,grantType:"refresh_token"}))};var cn=m(M());var Kt=(e)=>{if(e.expiration&&e.expiration.getTime()<Date.now())throw new cn.TokenProviderError(`Token is expired. ${Y}`,!1)};var dn=m(M());var U=(e,t,o=!1)=>{if(typeof t>"u")throw new dn.TokenProviderError(`Value not present for '${e}' in SSO Token${o?". Cannot refresh":""}. ${Y}`,!1)};var un=m(M());import{promises as ui}from"fs";var{writeFile:li}=ui,ln=(e,t)=>{let o=un.getSSOTokenFilepath(e),n=JSON.stringify(t,null,2);return li(o,n)};var hn=new Map,fn=(e={})=>async({callerClientConfig:t}={})=>{e.logger?.debug("@aws-sdk/token-providers - fromSso");let o=await R.parseKnownFiles(e),n=R.getProfileName({profile:e.profile??t?.profile}),r=o[n];if(!r)throw new R.TokenProviderError(`Profile '${n}' could not be found in shared credentials file.`,!1);else if(!r.sso_session)throw new R.TokenProviderError(`Profile '${n}' is missing required property 'sso_session'.`);let s=r.sso_session,c=(await R.loadSsoSessionData(e))[s];if(!c)throw new R.TokenProviderError(`Sso session '${s}' could not be found in shared credentials file.`,!1);for(let p of["sso_start_url","sso_region"])if(!c[p])throw new R.TokenProviderError(`Sso session '${s}' is missing required property '${p}'.`,!1);let{sso_start_url:a,sso_region:d}=c,u;try{u=await R.getSSOTokenFromFile(s)}catch(p){throw new R.TokenProviderError(`The SSO session token associated with profile=${n} was not found or is invalid. ${Y}`,!1)}U("accessToken",u.accessToken),U("expiresAt",u.expiresAt);let{accessToken:l,expiresAt:g}=u,h={token:l,expiration:new Date(g)};if(h.expiration.getTime()-Date.now()>rn)return h;let f=hn.get(s)??0;if(Date.now()-f<30000)return Kt(h),h;U("clientId",u.clientId,!0),U("clientSecret",u.clientSecret,!0),U("refreshToken",u.refreshToken,!0);try{hn.set(s,Date.now());let p=await an(u,d,e,t);U("accessToken",p.accessToken),U("expiresIn",p.expiresIn);let y=new Date(Date.now()+p.expiresIn*1000);try{await ln(s,{...u,accessToken:p.accessToken,expiresAt:y.toISOString(),refreshToken:p.refreshToken})}catch(x){}return{token:p.accessToken,expiration:y}}catch(p){return Kt(h),h}};var jt=(e={})=>Q.memoize(Q.chain(fn(e),async()=>{throw new Q.TokenProviderError("Could not load token from any providers",!1)}),(t)=>t.expiration!==void 0&&t.expiration.getTime()-Date.now()<300000,(t)=>t.expiration!==void 0);var rr=m(Ze()),ut=m(fe()),v=m(M()),ir=m(Qo()),ie=m(Ot()),ar=m(ge()),lt=m(_t());var Yn=m(vt()),Qn=m(sr()),Zn=m(Ze()),er=m(Gt()),tr=m(fe()),or=m(oe()),B=m(ge());var In=m(Z()),ee=m(Ge());var Rn=m(Ge()),Re="ref",H=-1,We=!0,mn="isSet",yn="PartitionResult",Ve="booleanEquals",gn="getAttr",Cn={[Re]:"Endpoint"},Sn={[Re]:yn},Ae={},En=[{[Re]:"Region"}],vn={conditions:[[mn,[Cn]],[mn,En],["aws.partition",En,yn],[Ve,[{[Re]:"UseFIPS"},We]],[Ve,[{[Re]:"UseDualStack"},We]],[Ve,[{fn:gn,argv:[Sn,"supportsDualStack"]},We]],[Ve,[{fn:gn,argv:[Sn,"supportsFIPS"]},We]]],results:[[H],[H,"Invalid Configuration: FIPS and custom endpoint are not supported"],[H,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[Cn,Ae],["https://bedrock-runtime-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",Ae],[H,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://bedrock-runtime-fips.{Region}.{PartitionResult#dnsSuffix}",Ae],[H,"FIPS is enabled but this partition does not support FIPS"],["https://bedrock-runtime.{Region}.{PartitionResult#dualStackDnsSuffix}",Ae],[H,"DualStack is enabled but this partition does not support DualStack"],["https://bedrock-runtime.{Region}.{PartitionResult#dnsSuffix}",Ae],[H,"Invalid Configuration: Missing Region"]]},pi=2,I=1e8,_i=new Int32Array([-1,1,-1,0,12,3,1,4,I+11,2,5,I+11,3,8,6,4,7,I+10,5,I+8,I+9,4,10,9,6,I+6,I+7,5,11,I+5,6,I+4,I+5,3,I+1,13,4,I+2,I+3]),xn=Rn.BinaryDecisionDiagram.from(_i,pi,vn.conditions,vn.results);var hi=new ee.EndpointCache({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),Tn=(e,t={})=>hi.get(e,()=>ee.decideEndpoint(xn,{endpointParams:e,logger:t.logger}));ee.customEndpointFunctions.aws=In.awsEndpointFunctions;var zt=m(qe());var wn=m(fe());class E extends wn.ServiceException{constructor(e){super(e);Object.setPrototypeOf(this,E.prototype)}}class Ke extends E{name="AccessDeniedException";$fault="client";constructor(e){super({name:"AccessDeniedException",$fault:"client",...e});Object.setPrototypeOf(this,Ke.prototype)}}class je extends E{name="InternalServerException";$fault="server";constructor(e){super({name:"InternalServerException",$fault:"server",...e});Object.setPrototypeOf(this,je.prototype)}}class ze extends E{name="ThrottlingException";$fault="client";constructor(e){super({name:"ThrottlingException",$fault:"client",...e});Object.setPrototypeOf(this,ze.prototype)}}class Xe extends E{name="ValidationException";$fault="client";constructor(e){super({name:"ValidationException",$fault:"client",...e});Object.setPrototypeOf(this,Xe.prototype)}}class Je extends E{name="ConflictException";$fault="client";constructor(e){super({name:"ConflictException",$fault:"client",...e});Object.setPrototypeOf(this,Je.prototype)}}class Ye extends E{name="ResourceNotFoundException";$fault="client";constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e});Object.setPrototypeOf(this,Ye.prototype)}}class Qe extends E{name="ServiceQuotaExceededException";$fault="client";constructor(e){super({name:"ServiceQuotaExceededException",$fault:"client",...e});Object.setPrototypeOf(this,Qe.prototype)}}class et extends E{name="ServiceUnavailableException";$fault="server";constructor(e){super({name:"ServiceUnavailableException",$fault:"server",...e});Object.setPrototypeOf(this,et.prototype)}}class tt extends E{name="ModelErrorException";$fault="client";originalStatusCode;resourceName;constructor(e){super({name:"ModelErrorException",$fault:"client",...e});Object.setPrototypeOf(this,tt.prototype),this.originalStatusCode=e.originalStatusCode,this.resourceName=e.resourceName}}class ot extends E{name="ModelNotReadyException";$fault="client";$retryable={};constructor(e){super({name:"ModelNotReadyException",$fault:"client",...e});Object.setPrototypeOf(this,ot.prototype)}}class nt extends E{name="ModelTimeoutException";$fault="client";constructor(e){super({name:"ModelTimeoutException",$fault:"client",...e});Object.setPrototypeOf(this,nt.prototype)}}class rt extends E{name="ModelStreamErrorException";$fault="client";originalStatusCode;originalMessage;constructor(e){super({name:"ModelStreamErrorException",$fault:"client",...e});Object.setPrototypeOf(this,rt.prototype),this.originalStatusCode=e.originalStatusCode,this.originalMessage=e.originalMessage}}var On=zt.TypeRegistry.for("smithy.ts.sdk.synthetic.com.amazonaws.bedrockruntime"),fi=[-3,"smithy.ts.sdk.synthetic.com.amazonaws.bedrockruntime","BedrockRuntimeServiceException",0,[],[]];On.registerError(fi,E);var T=zt.TypeRegistry.for("com.amazonaws.bedrockruntime"),mi=[-3,"com.amazonaws.bedrockruntime","AccessDeniedException",{["error"]:"client",["httpError"]:403},["message"],[0]];T.registerError(mi,Ke);var gi=[-3,"com.amazonaws.bedrockruntime","ConflictException",{["error"]:"client",["httpError"]:400},["message"],[0]];T.registerError(gi,Je);var Pn=[-3,"com.amazonaws.bedrockruntime","InternalServerException",{["error"]:"server",["httpError"]:500},["message"],[0]];T.registerError(Pn,je);var Ci=[-3,"com.amazonaws.bedrockruntime","ModelErrorException",{["error"]:"client",["httpError"]:424},["message","originalStatusCode","resourceName"],[0,1,0]];T.registerError(Ci,tt);var Si=[-3,"com.amazonaws.bedrockruntime","ModelNotReadyException",{["error"]:"client",["httpError"]:429},["message"],[0]];T.registerError(Si,ot);var Gn=[-3,"com.amazonaws.bedrockruntime","ModelStreamErrorException",{["error"]:"client",["httpError"]:424},["message","originalStatusCode","originalMessage"],[0,1,0]];T.registerError(Gn,rt);var Ei=[-3,"com.amazonaws.bedrockruntime","ModelTimeoutException",{["error"]:"client",["httpError"]:408},["message"],[0]];T.registerError(Ei,nt);var vi=[-3,"com.amazonaws.bedrockruntime","ResourceNotFoundException",{["error"]:"client",["httpError"]:404},["message"],[0]];T.registerError(vi,Ye);var Ai=[-3,"com.amazonaws.bedrockruntime","ServiceQuotaExceededException",{["error"]:"client",["httpError"]:400},["message"],[0]];T.registerError(Ai,Qe);var bn=[-3,"com.amazonaws.bedrockruntime","ServiceUnavailableException",{["error"]:"server",["httpError"]:503},["message"],[0]];T.registerError(bn,et);var Nn=[-3,"com.amazonaws.bedrockruntime","ThrottlingException",{["error"]:"client",["httpError"]:429},["message"],[0]];T.registerError(Nn,ze);var Ln=[-3,"com.amazonaws.bedrockruntime","ValidationException",{["error"]:"client",["httpError"]:400},["message"],[0]];T.registerError(Ln,Xe);var Mn=[On,T];var Ri=[0,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningStatementLogicContent",8,0],Un=[0,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningStatementNaturalLanguageContent",8,0];var yi=[3,"com.amazonaws.bedrockruntime","AnyToolChoice",0,[],[]],xi=[3,"com.amazonaws.bedrockruntime","AppliedGuardrailDetails",0,["guardrailId","guardrailVersion","guardrailArn","guardrailOrigin","guardrailOwnership"],[0,0,0,64,0]];var Ii=[3,"com.amazonaws.bedrockruntime","AudioBlock",0,["format","source","error"],[0,[()=>Tc,0],[()=>qt,0]],2],Ti=[3,"com.amazonaws.bedrockruntime","AutoToolChoice",0,[],[]];var wi=[3,"com.amazonaws.bedrockruntime","CacheDetail",0,["ttl","inputTokens"],[0,1],2],Xt=[3,"com.amazonaws.bedrockruntime","CachePointBlock",0,["type","ttl"],[0,0],1],ki=[3,"com.amazonaws.bedrockruntime","Citation",0,["title","source","sourceContent","location"],[0,0,()=>tc,()=>zn]],Bn=[3,"com.amazonaws.bedrockruntime","CitationsConfig",0,["enabled"],[2],1],Oi=[3,"com.amazonaws.bedrockruntime","CitationsContentBlock",0,["content","citations"],[()=>Za,()=>ec]],Gi=[3,"com.amazonaws.bedrockruntime","CitationsDelta",0,["title","source","sourceContent","location"],[0,0,()=>oc,()=>zn]],bi=[3,"com.amazonaws.bedrockruntime","CitationSourceContentDelta",0,["text"],[0]],Ni=[3,"com.amazonaws.bedrockruntime","ContentBlockDeltaEvent",0,["delta","contentBlockIndex"],[[()=>Pc,0],1],2],Li=[3,"com.amazonaws.bedrockruntime","ContentBlockStartEvent",0,["start","contentBlockIndex"],[()=>Gc,1],2],Mi=[3,"com.amazonaws.bedrockruntime","ContentBlockStopEvent",0,["contentBlockIndex"],[1],1];var Ui=[3,"com.amazonaws.bedrockruntime","ConverseStreamMetadataEvent",0,["usage","metrics","trace","performanceConfig","serviceTier"],[()=>$a,()=>Bi,[()=>Fi,0],()=>Hn,()=>Vn],2],Bi=[3,"com.amazonaws.bedrockruntime","ConverseStreamMetrics",0,["latencyMs"],[1],1],Di=[3,"com.amazonaws.bedrockruntime","ConverseStreamRequest",0,["modelId","messages","system","inferenceConfig","toolConfig","guardrailConfig","additionalModelRequestFields","promptVariables","additionalModelResponseFieldPaths","requestMetadata","performanceConfig","serviceTier","outputConfig"],[[0,1],[()=>gc,0],[()=>Sc,0],()=>Ia,()=>Ha,()=>ga,15,[()=>xc,0],64,[()=>Ic,0],()=>Hn,()=>Vn,[()=>Pa,0]],1],$i=[3,"com.amazonaws.bedrockruntime","ConverseStreamResponse",0,["stream"],[[()=>bc,16]]],Fi=[3,"com.amazonaws.bedrockruntime","ConverseStreamTrace",0,["guardrail","promptRouter"],[[()=>va,0],()=>Na]];var Dn=[3,"com.amazonaws.bedrockruntime","DocumentBlock",0,["name","source","format","context","citations"],[0,()=>Lc,0,0,()=>Bn],2],Hi=[3,"com.amazonaws.bedrockruntime","DocumentCharLocation",0,["documentIndex","start","end"],[1,1,1]],Wi=[3,"com.amazonaws.bedrockruntime","DocumentChunkLocation",0,["documentIndex","start","end"],[1,1,1]],Vi=[3,"com.amazonaws.bedrockruntime","DocumentPageLocation",0,["documentIndex","start","end"],[1,1,1]],qt=[3,"com.amazonaws.bedrockruntime","ErrorBlock",8,["message"],[0]];var $n=[3,"com.amazonaws.bedrockruntime","GuardrailAssessment",0,["topicPolicy","contentPolicy","wordPolicy","sensitiveInformationPolicy","contextualGroundingPolicy","automatedReasoningPolicy","invocationMetrics","appliedGuardrailDetails"],[()=>Ea,()=>ra,()=>Ra,()=>ma,()=>ia,[()=>qi,0],()=>pa,()=>xi]],Ki=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningImpossibleFinding",0,["translation","contradictingRules","logicWarning"],[[()=>xe,0],()=>Jt,[()=>at,0]]],ji=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningInputTextReference",0,["text"],[[()=>Un,0]]],zi=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningInvalidFinding",0,["translation","contradictingRules","logicWarning"],[[()=>xe,0],()=>Jt,[()=>at,0]]],at=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningLogicWarning",0,["type","premises","claims"],[0,[()=>ye,0],[()=>ye,0]]],Xi=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningNoTranslationsFinding",0,[],[]],qi=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningPolicyAssessment",0,["findings"],[[()=>ac,0]]],Ji=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningRule",0,["identifier","policyVersionArn"],[0,0]],Yi=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningSatisfiableFinding",0,["translation","claimsTrueScenario","claimsFalseScenario","logicWarning"],[[()=>xe,0],[()=>st,0],[()=>st,0],[()=>at,0]]],st=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningScenario",0,["statements"],[[()=>ye,0]]],Qi=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningStatement",0,["logic","naturalLanguage"],[[()=>Ri,0],[()=>Un,0]]],Zi=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningTooComplexFinding",0,[],[]],xe=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningTranslation",0,["premises","claims","untranslatedPremises","untranslatedClaims","confidence"],[[()=>ye,0],[()=>ye,0],[()=>kn,0],[()=>kn,0],1]],ea=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningTranslationAmbiguousFinding",0,["options","differenceScenarios"],[[()=>dc,0],[()=>ic,0]]],ta=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningTranslationOption",0,["translations"],[[()=>cc,0]]],oa=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningValidFinding",0,["translation","claimsTrueScenario","supportingRules","logicWarning"],[[()=>xe,0],[()=>st,0],()=>Jt,[()=>at,0]]];var na=[3,"com.amazonaws.bedrockruntime","GuardrailContentFilter",0,["type","confidence","action","filterStrength","detected"],[0,0,0,0,2],3],ra=[3,"com.amazonaws.bedrockruntime","GuardrailContentPolicyAssessment",0,["filters"],[()=>uc],1],sa=[3,"com.amazonaws.bedrockruntime","GuardrailContextualGroundingFilter",0,["type","threshold","score","action","detected"],[0,1,1,0,2],4],ia=[3,"com.amazonaws.bedrockruntime","GuardrailContextualGroundingPolicyAssessment",0,["filters"],[()=>lc]],aa=[3,"com.amazonaws.bedrockruntime","GuardrailConverseImageBlock",8,["format","source"],[0,[()=>Uc,0]],2],ca=[3,"com.amazonaws.bedrockruntime","GuardrailConverseTextBlock",0,["text","qualifiers"],[0,64],1],da=[3,"com.amazonaws.bedrockruntime","GuardrailCoverage",0,["textCharacters","images"],[()=>Ca,()=>la]],ua=[3,"com.amazonaws.bedrockruntime","GuardrailCustomWord",0,["match","action","detected"],[0,0,2],2];var la=[3,"com.amazonaws.bedrockruntime","GuardrailImageCoverage",0,["guarded","total"],[1,1]],pa=[3,"com.amazonaws.bedrockruntime","GuardrailInvocationMetrics",0,["guardrailProcessingLatency","usage","guardrailCoverage"],[1,()=>Aa,()=>da]],_a=[3,"com.amazonaws.bedrockruntime","GuardrailManagedWord",0,["match","type","action","detected"],[0,0,0,2],3];var ha=[3,"com.amazonaws.bedrockruntime","GuardrailPiiEntityFilter",0,["match","type","action","detected"],[0,0,0,2],3],fa=[3,"com.amazonaws.bedrockruntime","GuardrailRegexFilter",0,["action","name","match","regex","detected"],[0,0,0,0,2],1],ma=[3,"com.amazonaws.bedrockruntime","GuardrailSensitiveInformationPolicyAssessment",0,["piiEntities","regexes"],[()=>hc,()=>fc],2],ga=[3,"com.amazonaws.bedrockruntime","GuardrailStreamConfiguration",0,["guardrailIdentifier","guardrailVersion","trace","streamProcessingMode"],[0,0,0,0]];var Ca=[3,"com.amazonaws.bedrockruntime","GuardrailTextCharactersCoverage",0,["guarded","total"],[1,1]],Sa=[3,"com.amazonaws.bedrockruntime","GuardrailTopic",0,["name","type","action","detected"],[0,0,0,2],3],Ea=[3,"com.amazonaws.bedrockruntime","GuardrailTopicPolicyAssessment",0,["topics"],[()=>mc],1],va=[3,"com.amazonaws.bedrockruntime","GuardrailTraceAssessment",0,["modelOutput","inputAssessment","outputAssessments","actionReason"],[64,[()=>yc,0],[()=>Rc,0],0]],Aa=[3,"com.amazonaws.bedrockruntime","GuardrailUsage",0,["topicPolicyUnits","contentPolicyUnits","wordPolicyUnits","sensitiveInformationPolicyUnits","sensitiveInformationPolicyFreeUnits","contextualGroundingPolicyUnits","contentPolicyImageUnits","automatedReasoningPolicyUnits","automatedReasoningPolicies"],[1,1,1,1,1,1,1,1,1],6],Ra=[3,"com.amazonaws.bedrockruntime","GuardrailWordPolicyAssessment",0,["customWords","managedWordLists"],[()=>pc,()=>_c],2],Fn=[3,"com.amazonaws.bedrockruntime","ImageBlock",0,["format","source","error"],[0,[()=>qn,0],[()=>qt,0]],2],ya=[3,"com.amazonaws.bedrockruntime","ImageBlockDelta",0,["source","error"],[[()=>qn,0],[()=>qt,0]]],xa=[3,"com.amazonaws.bedrockruntime","ImageBlockStart",0,["format"],[0],1],Ia=[3,"com.amazonaws.bedrockruntime","InferenceConfiguration",0,["maxTokens","temperature","topP","stopSequences"],[1,1,1,64]];var Ta=[3,"com.amazonaws.bedrockruntime","JsonSchemaDefinition",0,["schema","name","description"],[0,0,0],1];var wa=[3,"com.amazonaws.bedrockruntime","Message",0,["role","content"],[0,[()=>nc,0]],2],ka=[3,"com.amazonaws.bedrockruntime","MessageStartEvent",0,["role"],[0],1],Oa=[3,"com.amazonaws.bedrockruntime","MessageStopEvent",0,["stopReason","additionalModelResponseFields"],[0,15],1],Pa=[3,"com.amazonaws.bedrockruntime","OutputConfig",0,["textFormat","effort"],[[()=>ba,0],0]],ba=[3,"com.amazonaws.bedrockruntime","OutputFormat",0,["type","structure"],[0,[()=>Bc,0]],2];var Hn=[3,"com.amazonaws.bedrockruntime","PerformanceConfiguration",0,["latency"],[0]],Na=[3,"com.amazonaws.bedrockruntime","PromptRouterTrace",0,["invokedModelId"],[0]],La=[3,"com.amazonaws.bedrockruntime","ReasoningTextBlock",8,["text","signature"],[0,0],1],ct=[3,"com.amazonaws.bedrockruntime","S3Location",0,["uri","bucketOwner"],[0,0],1],Wn=[3,"com.amazonaws.bedrockruntime","SearchResultBlock",0,["source","title","content","citations"],[0,0,()=>Cc,()=>Bn],3],Ma=[3,"com.amazonaws.bedrockruntime","SearchResultContentBlock",0,["text"],[0],1],Ua=[3,"com.amazonaws.bedrockruntime","SearchResultLocation",0,["searchResultIndex","start","end"],[1,1,1]],Vn=[3,"com.amazonaws.bedrockruntime","ServiceTier",0,["type"],[0],1],Ba=[3,"com.amazonaws.bedrockruntime","SpecificToolChoice",0,["name"],[0],1];var Da=[3,"com.amazonaws.bedrockruntime","SystemTool",0,["name"],[0],1];var $a=[3,"com.amazonaws.bedrockruntime","TokenUsage",0,["inputTokens","outputTokens","totalTokens","cacheReadInputTokens","cacheWriteInputTokens","cacheDetails"],[1,1,1,1,1,()=>Qa],3],Fa=[3,"com.amazonaws.bedrockruntime","ToolAdditionBlock",0,["tool"],[()=>Kn],1],Ha=[3,"com.amazonaws.bedrockruntime","ToolConfiguration",0,["tools","toolChoice"],[()=>Ac,()=>Vc],1],Kn=[3,"com.amazonaws.bedrockruntime","ToolReference",0,["type","name","serverName"],[0,0,0]],Wa=[3,"com.amazonaws.bedrockruntime","ToolRemovalBlock",0,["tool"],[()=>Kn],1],Va=[3,"com.amazonaws.bedrockruntime","ToolResultBlock",0,["toolUseId","content","status","type"],[0,[()=>vc,0],0,0],2],Ka=[3,"com.amazonaws.bedrockruntime","ToolResultBlockStart",0,["toolUseId","type","status"],[0,0,0],1],ja=[3,"com.amazonaws.bedrockruntime","ToolSpecification",0,["name","inputSchema","description","strict"],[0,()=>Kc,0,2],2],za=[3,"com.amazonaws.bedrockruntime","ToolUseBlock",0,["toolUseId","name","input","type"],[0,0,15,0],3],Xa=[3,"com.amazonaws.bedrockruntime","ToolUseBlockDelta",0,["input"],[0],1],qa=[3,"com.amazonaws.bedrockruntime","ToolUseBlockStart",0,["toolUseId","name","type"],[0,0,0],2],jn=[3,"com.amazonaws.bedrockruntime","VideoBlock",0,["format","source"],[0,()=>Xc],2],Ja=[3,"com.amazonaws.bedrockruntime","WebLocation",0,["url","domain"],[0,0]];var Qa=[1,"com.amazonaws.bedrockruntime","CacheDetailsList",0,()=>wi],Za=[1,"com.amazonaws.bedrockruntime","CitationGeneratedContentList",0,()=>wc],ec=[1,"com.amazonaws.bedrockruntime","Citations",0,()=>ki],tc=[1,"com.amazonaws.bedrockruntime","CitationSourceContentList",0,()=>kc],oc=[1,"com.amazonaws.bedrockruntime","CitationSourceContentListDelta",0,()=>bi],nc=[1,"com.amazonaws.bedrockruntime","ContentBlocks",0,[()=>Oc,0]],rc=[1,"com.amazonaws.bedrockruntime","DocumentContentBlocks",0,()=>Nc],sc=[1,"com.amazonaws.bedrockruntime","GuardrailAssessmentList",0,[()=>$n,0]],ic=[1,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningDifferenceScenarioList",0,[()=>st,0]],ac=[1,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningFindingList",0,[()=>Mc,0]],kn=[1,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningInputTextReferenceList",0,[()=>ji,0]],Jt=[1,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningRuleList",0,()=>Ji],ye=[1,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningStatementList",0,[()=>Qi,0]],cc=[1,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningTranslationList",0,[()=>xe,0]],dc=[1,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningTranslationOptionList",0,[()=>ta,0]];var uc=[1,"com.amazonaws.bedrockruntime","GuardrailContentFilterList",0,()=>na];var lc=[1,"com.amazonaws.bedrockruntime","GuardrailContextualGroundingFilters",0,()=>sa];var pc=[1,"com.amazonaws.bedrockruntime","GuardrailCustomWordList",0,()=>ua],_c=[1,"com.amazonaws.bedrockruntime","GuardrailManagedWordList",0,()=>_a];var hc=[1,"com.amazonaws.bedrockruntime","GuardrailPiiEntityFilterList",0,()=>ha],fc=[1,"com.amazonaws.bedrockruntime","GuardrailRegexFilterList",0,()=>fa],mc=[1,"com.amazonaws.bedrockruntime","GuardrailTopicList",0,()=>Sa],gc=[1,"com.amazonaws.bedrockruntime","Messages",0,[()=>wa,0]];var Cc=[1,"com.amazonaws.bedrockruntime","SearchResultContentBlocks",0,()=>Ma],Sc=[1,"com.amazonaws.bedrockruntime","SystemContentBlocks",0,[()=>Hc,0]];var Ec=[1,"com.amazonaws.bedrockruntime","ToolResultBlocksDelta",0,()=>jc],vc=[1,"com.amazonaws.bedrockruntime","ToolResultContentBlocks",0,[()=>zc,0]],Ac=[1,"com.amazonaws.bedrockruntime","Tools",0,()=>Wc],Rc=[2,"com.amazonaws.bedrockruntime","GuardrailAssessmentListMap",0,[0,0],[()=>sc,0]],yc=[2,"com.amazonaws.bedrockruntime","GuardrailAssessmentMap",0,[0,0],[()=>$n,0]],xc=[2,"com.amazonaws.bedrockruntime","PromptVariableMap",8,0,()=>Dc],Ic=[2,"com.amazonaws.bedrockruntime","RequestMetadata",8,0,0];var Tc=[4,"com.amazonaws.bedrockruntime","AudioSource",8,["bytes","s3Location"],[21,()=>ct]],wc=[4,"com.amazonaws.bedrockruntime","CitationGeneratedContent",0,["text"],[0]],zn=[4,"com.amazonaws.bedrockruntime","CitationLocation",0,["web","documentChar","documentPage","documentChunk","searchResultLocation"],[()=>Ja,()=>Hi,()=>Vi,()=>Wi,()=>Ua]],kc=[4,"com.amazonaws.bedrockruntime","CitationSourceContent",0,["text"],[0]],Oc=[4,"com.amazonaws.bedrockruntime","ContentBlock",0,["text","image","document","video","audio","toolUse","toolResult","guardContent","cachePoint","reasoningContent","citationsContent","searchResult","toolAddition","toolRemoval"],[0,[()=>Fn,0],()=>Dn,()=>jn,[()=>Ii,0],()=>za,[()=>Va,0],[()=>Xn,0],()=>Xt,[()=>$c,0],()=>Oi,()=>Wn,()=>Fa,()=>Wa]],Pc=[4,"com.amazonaws.bedrockruntime","ContentBlockDelta",0,["text","toolUse","toolResult","reasoningContent","citation","image"],[0,()=>Xa,()=>Ec,[()=>Fc,0],()=>Gi,[()=>ya,0]]],Gc=[4,"com.amazonaws.bedrockruntime","ContentBlockStart",0,["toolUse","toolResult","image"],[()=>qa,()=>Ka,()=>xa]];var bc=[4,"com.amazonaws.bedrockruntime","ConverseStreamOutput",{["streaming"]:1},["messageStart","contentBlockStart","contentBlockDelta","contentBlockStop","messageStop","metadata","internalServerException","modelStreamErrorException","validationException","throttlingException","serviceUnavailableException"],[()=>ka,()=>Li,[()=>Ni,0],()=>Mi,()=>Oa,[()=>Ui,0],[()=>Pn,0],[()=>Gn,0],[()=>Ln,0],[()=>Nn,0],[()=>bn,0]]];var Nc=[4,"com.amazonaws.bedrockruntime","DocumentContentBlock",0,["text"],[0]],Lc=[4,"com.amazonaws.bedrockruntime","DocumentSource",0,["bytes","s3Location","text","content"],[21,()=>ct,0,()=>rc]],Mc=[4,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningFinding",0,["valid","invalid","satisfiable","impossible","translationAmbiguous","tooComplex","noTranslations"],[[()=>oa,0],[()=>zi,0],[()=>Yi,0],[()=>Ki,0],[()=>ea,0],()=>Zi,()=>Xi]];var Xn=[4,"com.amazonaws.bedrockruntime","GuardrailConverseContentBlock",0,["text","image"],[()=>ca,[()=>aa,0]]],Uc=[4,"com.amazonaws.bedrockruntime","GuardrailConverseImageSource",8,["bytes"],[21]];var qn=[4,"com.amazonaws.bedrockruntime","ImageSource",8,["bytes","s3Location"],[21,()=>ct]];var Bc=[4,"com.amazonaws.bedrockruntime","OutputFormatStructure",8,["jsonSchema"],[()=>Ta]],Dc=[4,"com.amazonaws.bedrockruntime","PromptVariableValues",0,["text"],[0]],$c=[4,"com.amazonaws.bedrockruntime","ReasoningContentBlock",8,["reasoningText","redactedContent"],[[()=>La,0],21]],Fc=[4,"com.amazonaws.bedrockruntime","ReasoningContentBlockDelta",8,["text","redactedContent","signature"],[0,21,0]];var Hc=[4,"com.amazonaws.bedrockruntime","SystemContentBlock",0,["text","guardContent","cachePoint"],[0,[()=>Xn,0],()=>Xt]],Wc=[4,"com.amazonaws.bedrockruntime","Tool",0,["toolSpec","systemTool","cachePoint"],[()=>ja,()=>Da,()=>Xt]],Vc=[4,"com.amazonaws.bedrockruntime","ToolChoice",0,["auto","any","tool"],[()=>Ti,()=>yi,()=>Ba]],Kc=[4,"com.amazonaws.bedrockruntime","ToolInputSchema",0,["json"],[15]],jc=[4,"com.amazonaws.bedrockruntime","ToolResultBlockDelta",0,["text","json"],[0,15]],zc=[4,"com.amazonaws.bedrockruntime","ToolResultContentBlock",0,["json","text","image","document","video","searchResult"],[15,0,[()=>Fn,0],()=>Dn,()=>jn,()=>Wn]],Xc=[4,"com.amazonaws.bedrockruntime","VideoSource",0,["bytes","s3Location"],[21,()=>ct]];var Jn=[9,"com.amazonaws.bedrockruntime","ConverseStream",{["http"]:["POST","/model/{modelId}/converse-stream",200]},()=>Di,()=>$i];var nr=(e)=>({apiVersion:"2023-09-30",base64Decoder:e?.base64Decoder??B.fromBase64,base64Encoder:e?.base64Encoder??B.toBase64,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??Tn,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Vo,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(t)=>t.getIdentityProvider("aws.auth#sigv4"),signer:new Yn.AwsSdkSigV4Signer},{schemeId:"smithy.api#httpBearerAuth",identityProvider:(t)=>t.getIdentityProvider("smithy.api#httpBearerAuth"),signer:new Zn.HttpBearerAuthSigner}],logger:e?.logger??new tr.NoOpLogger,protocol:e?.protocol??Qn.AwsRestJsonProtocol,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.bedrockruntime",errorTypeRegistries:Mn,version:"2023-09-30",serviceTarget:"AmazonBedrockFrontendService"},serviceId:e?.serviceId??"Bedrock Runtime",sha256:e?.sha256??er.Sha256,urlParser:e?.urlParser??or.parseUrl,utf8Decoder:e?.utf8Decoder??B.fromUtf8,utf8Encoder:e?.utf8Encoder??B.toUtf8});var cr=(e)=>{ut.emitWarningIfUnsupportedVersion(process.version);let t=v.resolveDefaultsModeConfig(e),o=()=>t().then(ut.loadConfigsForDefaultMode),n=nr(e);te.emitWarningIfUnsupportedVersion(process.version);let r={profile:e?.profile,logger:n.logger,signingName:"bedrock"};return{...n,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??v.loadConfig(dt.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS,r),bodyLengthChecker:e?.bodyLengthChecker??ar.calculateBodyLength,credentialDefaultProvider:e?.credentialDefaultProvider??Dt,defaultUserAgentProvider:e?.defaultUserAgentProvider??te.createDefaultUserAgentProvider({serviceId:n.serviceId,clientVersion:Xo.version}),eventStreamPayloadHandlerProvider:e?.eventStreamPayloadHandlerProvider??Ht,eventStreamSerdeProvider:e?.eventStreamSerdeProvider??ir.eventStreamSerdeProvider,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(s)=>s.getIdentityProvider("aws.auth#sigv4"),signer:new dt.AwsSdkSigV4Signer},{schemeId:"smithy.api#httpBearerAuth",identityProvider:(s)=>s.getIdentityProvider("smithy.api#httpBearerAuth")||(async(i)=>{try{return await Vt({signingName:"bedrock"})()}catch(c){return await jt(i)(i)}}),signer:new rr.HttpBearerAuthSigner}],maxAttempts:e?.maxAttempts??v.loadConfig(ie.NODE_MAX_ATTEMPT_CONFIG_OPTIONS,e),region:e?.region??v.loadConfig(v.NODE_REGION_CONFIG_OPTIONS,{...v.NODE_REGION_CONFIG_FILE_OPTIONS,...r}),requestHandler:lt.NodeHttp2Handler.create(e?.requestHandler??(async()=>({...await o(),disableConcurrentStreams:!0}))),retryMode:e?.retryMode??v.loadConfig({...ie.NODE_RETRY_MODE_CONFIG_OPTIONS,default:async()=>(await o()).retryMode||ie.DEFAULT_RETRY_MODE},e),streamCollector:e?.streamCollector??lt.streamCollector,useDualstackEndpoint:e?.useDualstackEndpoint??v.loadConfig(v.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,r),useFipsEndpoint:e?.useFipsEndpoint??v.loadConfig(v.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,r),userAgentAppId:e?.userAgentAppId??v.loadConfig(te.NODE_APP_ID_CONFIG_OPTIONS,r)}};var pt=m(Z()),ft=m(fe()),mt=m(oe());var dr=(e)=>{let{httpAuthSchemes:t,httpAuthSchemeProvider:o,credentials:n,token:r}=e;return{setHttpAuthScheme(s){let i=t.findIndex((c)=>c.schemeId===s.schemeId);if(i===-1)t.push(s);else t.splice(i,1,s)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(s){o=s},httpAuthSchemeProvider(){return o},setCredentials(s){n=s},credentials(){return n},setToken(s){r=s},token(){return r}}},ur=(e)=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials(),token:e.token()});var lr=(e,t)=>{let o=Object.assign(pt.getAwsRegionExtensionConfiguration(e),ft.getDefaultExtensionConfiguration(e),mt.getHttpHandlerExtensionConfiguration(e),dr(e));return t.forEach((n)=>n.configure(o)),Object.assign(e,pt.resolveAwsRegionExtensionConfiguration(o),ft.resolveDefaultRuntimeConfig(o),mt.resolveHttpHandlerRuntimeConfig(o),ur(o))};class Yt extends pr.Client{config;constructor(...[e]){let t=cr(e||{});super(t);this.initConfig=t;let o=jo(t),n=w.resolveUserAgentConfig(o),r=gt.resolveRetryConfig(n),s=_r.resolveRegionConfig(r),i=w.resolveHostHeaderConfig(s),c=hr.resolveEndpointConfig(i),a=fr.resolveEventStreamSerdeConfig(c),d=Ko(a),u=Mt(d),l=Bt(u),g=lr(l,e?.extensions||[]);this.config=g,this.middlewareStack.use(gr.getSchemaSerdePlugin(this.config)),this.middlewareStack.use(w.getUserAgentPlugin(this.config)),this.middlewareStack.use(gt.getRetryPlugin(this.config)),this.middlewareStack.use(mr.getContentLengthPlugin(this.config)),this.middlewareStack.use(w.getHostHeaderPlugin(this.config)),this.middlewareStack.use(w.getLoggerPlugin(this.config)),this.middlewareStack.use(w.getRecursionDetectionPlugin(this.config)),this.middlewareStack.use(ae.getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:Wo,identityProviderConfigProvider:async(h)=>new ae.DefaultIdentityProviderConfig({"aws.auth#sigv4":h.credentials,"smithy.api#httpBearerAuth":h.token})})),this.middlewareStack.use(ae.getHttpSigningPlugin(this.config))}destroy(){super.destroy()}}var Cr=m(fe()),Sr=m(Ge());var Er=Cr.makeBuilder(zo,"AmazonBedrockFrontendService","BedrockRuntimeClient",Sr.getEndpointPlugin),vr={},Ar=(e,t,o,n)=>[];class Qt extends Er(vr,Ar,"ConverseStream",Jn){}var Ct={FIVE_MINUTES:"5m",ONE_HOUR:"1h"},Zt={DEFAULT:"default"};var Te={GIF:"gif",JPEG:"jpeg",PNG:"png",WEBP:"webp"};var we={ERROR:"error",SUCCESS:"success"};var ce={ASSISTANT:"assistant",SYSTEM:"system",USER:"user"};var ue={CONTENT_FILTERED:"content_filtered",END_TURN:"end_turn",GUARDRAIL_INTERVENED:"guardrail_intervened",MALFORMED_MODEL_OUTPUT:"malformed_model_output",MALFORMED_TOOL_USE:"malformed_tool_use",MAX_TOKENS:"max_tokens",MODEL_CONTEXT_WINDOW_EXCEEDED:"model_context_window_exceeded",STOP_SEQUENCE:"stop_sequence",TOOL_USE:"tool_use"};var oo=m(_t(),1);var wr=m(Kr(),1);import*as Ir from"net";import*as Tr from"tls";import{once as Jc}from"events";import*as Rr from"net";import*as yr from"http";import{Agent as qc}from"https";var b=Symbol("AgentBaseInternalState");class ke extends yr.Agent{constructor(e){super(e);this[b]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint==="boolean")return e.secureEndpoint;if(typeof e.protocol==="string")return e.protocol==="https:"}let{stack:t}=Error();if(typeof t!=="string")return!1;return t.split(`
12
+ `).some((o)=>o.indexOf("(https.js:")!==-1||o.indexOf("node:https:")!==-1)}incrementSockets(e){if(this.maxSockets===1/0&&this.maxTotalSockets===1/0)return null;if(!this.sockets[e])this.sockets[e]=[];let t=new Rr.Socket({writable:!1});return this.sockets[e].push(t),this.totalSocketCount++,t}decrementSockets(e,t){if(!this.sockets[e]||t===null)return;let o=this.sockets[e],n=o.indexOf(t);if(n!==-1){if(o.splice(n,1),this.totalSocketCount--,o.length===0)delete this.sockets[e]}}getName(e){if(this.isSecureEndpoint(e))return qc.prototype.getName.call(this,e);return super.getName(e)}createSocket(e,t,o){let n={...t,secureEndpoint:this.isSecureEndpoint(t)},r=this.getName(n),s=this.incrementSockets(r);Promise.resolve().then(()=>this.connect(e,n)).then((i)=>{if(this.decrementSockets(r,s),typeof i.addRequest==="function")try{return i.addRequest(e,n)}catch(c){return o(c)}this[b].currentSocket=i,super.createSocket(e,t,o)},(i)=>{this.decrementSockets(r,s),o(i)})}createConnection(){let e=this[b].currentSocket;if(this[b].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[b].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(e){if(this[b])this[b].defaultPort=e}get protocol(){return this[b].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(e){if(this[b])this[b].protocol=e}}import{URL as xr}from"url";function St(){return async({response:e,scheme:t})=>{if(t.toLowerCase()!=="negotiate")throw Error(`Expected Negotiate scheme but got "${t}"`);let o;try{o=await import("kerberos")}catch{throw Error('The "kerberos" package is required for Negotiate proxy authentication. Install it with: npm install kerberos')}let n=e.headers["proxy-authenticate"]||"",r=Array.isArray(n)?n[0]:n,s=typeof r==="string"&&r.includes(" ")?r.split(" ").slice(1).join(" "):void 0,c=await(await o.initializeClient("HTTP@proxy",{mechOID:o.GSS_MECH_OID_SPNEGO})).step(s||"");if(!c)throw Error("Kerberos client.step() returned no token");return{headers:{"Proxy-Authorization":`Negotiate ${c}`}}}}var le=wr.default("http-proxy-agent");class Et extends ke{constructor(e,t){super(t);if(this.proxy=typeof e==="string"?new xr(e):e,this.proxyHeaders=t?.headers??{},le("Creating new HttpProxyAgent instance: %o",this.proxy.href),t?.negotiate)this.onProxyAuth=St();else if(t?.onProxyAuth)this.onProxyAuth=t.onProxyAuth;let o=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),n=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={...t?Yc(t,"headers","onProxyAuth","negotiate"):null,host:o,port:n}}addRequest(e,t){e._header=null,this.setRequestProps(e,t),super.addRequest(e,t)}setRequestProps(e,t){let{proxy:o}=this,n=t.secureEndpoint?"https:":"http:",r=e.getHeader("host")||"localhost",s=`${n}//${r}`,i=new xr(e.path,s);if(t.port!==80)i.port=String(t.port);e.path=String(i);let c=typeof this.proxyHeaders==="function"?this.proxyHeaders():{...this.proxyHeaders};if(o.username||o.password){let a=`${decodeURIComponent(o.username)}:${decodeURIComponent(o.password)}`;c["Proxy-Authorization"]=`Basic ${Buffer.from(a).toString("base64")}`}if(!c["Proxy-Connection"])c["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close";for(let a of Object.keys(c)){let d=c[a];if(d)e.setHeader(a,d)}}async connect(e,t){if(e._header=null,!e.path.includes("://"))this.setRequestProps(e,t);let o,n;if(le("Regenerating stored HTTP header string for request"),e._implicitHeader(),e.outputData&&e.outputData.length>0)le("Patching connection write() output buffer with updated header"),o=e.outputData[0].data,n=o.indexOf(`\r
13
13
  \r
14
- `)+4,e.outputData[0].data=e._header+o.substring(n),le("Output buffer: %o",e.outputData[0].data);let r;if(this.proxy.protocol==="https:")le("Creating `tls.Socket`: %o",this.connectOpts),r=Tr.connect(this.connectOpts);else le("Creating `net.Socket`: %o",this.connectOpts),r=Ir.connect(this.connectOpts);await Jc(r,"connect");let s={socket:r};return e.emit("proxyConnect",s),this.emit("proxyConnect",s,e),e.emit("proxy",{proxy:this.proxy.href,socket:r}),r}}St.protocols=["http","https"];function Yc(e,...t){let o={},n;for(n in e)if(!t.includes(n))o[n]=e[n];return o}var Pr=m(qr(),1);import*as N from"net";import*as Oe from"tls";import Qc from"assert";import{URL as Zc}from"url";var kr=m(qr(),1),Et=kr.default("https-proxy-agent:parse-proxy-response");function eo(e){return new Promise((t,o)=>{let n=0,r=[];function s(){let u=e.read();if(u)d(u);else e.once("readable",s)}function i(){e.removeListener("end",c),e.removeListener("error",a),e.removeListener("readable",s)}function c(){i(),Et("onend"),o(Error("Proxy connection ended before receiving CONNECT response"))}function a(u){i(),Et("onerror %o",u),o(u)}function d(u){r.push(u),n+=u.length;let l=Buffer.concat(r,n),g=l.indexOf(`\r
14
+ `)+4,e.outputData[0].data=e._header+o.substring(n),le("Output buffer: %o",e.outputData[0].data);let r;if(this.proxy.protocol==="https:")le("Creating `tls.Socket`: %o",this.connectOpts),r=Tr.connect(this.connectOpts);else le("Creating `net.Socket`: %o",this.connectOpts),r=Ir.connect(this.connectOpts);await Jc(r,"connect");let s={socket:r};return e.emit("proxyConnect",s),this.emit("proxyConnect",s,e),e.emit("proxy",{proxy:this.proxy.href,socket:r}),r}}Et.protocols=["http","https"];function Yc(e,...t){let o={},n;for(n in e)if(!t.includes(n))o[n]=e[n];return o}var Pr=m(Kr(),1);import*as N from"net";import*as Oe from"tls";import Qc from"assert";import{URL as Zc}from"url";var kr=m(Kr(),1),At=kr.default("https-proxy-agent:parse-proxy-response");function eo(e){return new Promise((t,o)=>{let n=0,r=[];function s(){let u=e.read();if(u)d(u);else e.once("readable",s)}function i(){e.removeListener("end",c),e.removeListener("error",a),e.removeListener("readable",s)}function c(){i(),At("onend"),o(Error("Proxy connection ended before receiving CONNECT response"))}function a(u){i(),At("onerror %o",u),o(u)}function d(u){r.push(u),n+=u.length;let l=Buffer.concat(r,n),g=l.indexOf(`\r
15
15
  \r
16
- `);if(g===-1){Et("have not received end of HTTP headers yet..."),s();return}let h=l.slice(0,g).toString("ascii").split(`\r
17
- `),f=h.shift();if(!f)return e.destroy(),o(Error("No header received from proxy CONNECT response"));let p=f.split(" "),y=+p[1],x=p.slice(2).join(" "),A={};for(let S of h){if(!S)continue;let L=S.indexOf(":");if(L===-1)return e.destroy(),o(Error(`Invalid header from proxy CONNECT response: "${S}"`));let K=S.slice(0,L).toLowerCase(),j=S.slice(L+1).trimStart(),F=A[K];if(typeof F==="string")A[K]=[F,j];else if(Array.isArray(F))F.push(j);else A[K]=j}Et("got proxy server response: %o %o",f,A),i(),t({connect:{statusCode:y,statusText:x,headers:A},buffered:l})}e.on("error",a),e.on("end",c),s()})}var W=Pr.default("https-proxy-agent"),At=(e)=>{if(e.servername===void 0&&e.host&&!N.isIP(e.host))return{...e,servername:e.host};return e};class Rt extends ke{constructor(e,t){super(t);if(this.options={path:void 0},this.proxy=typeof e==="string"?new Zc(e):e,this.proxyHeaders=t?.headers??{},W("Creating new HttpsProxyAgent instance: %o",this.proxy.href),t?.negotiate)this.onProxyAuth=Ct();else if(t?.onProxyAuth)this.onProxyAuth=t.onProxyAuth;let o=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),n=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...t?to(t,"headers","onProxyAuth","negotiate"):null,host:o,port:n}}async connect(e,t){let{proxy:o}=this;if(!t.host)throw TypeError('No "host" provided');let n;if(o.protocol==="https:")W("Creating `tls.Socket`: %o",this.connectOpts),n=Oe.connect(At(this.connectOpts));else W("Creating `net.Socket`: %o",this.connectOpts),n=N.connect(this.connectOpts);let r=typeof this.proxyHeaders==="function"?this.proxyHeaders():{...this.proxyHeaders},s=N.isIPv6(t.host)?`[${t.host}]`:t.host,i=`CONNECT ${s}:${t.port} HTTP/1.1\r
16
+ `);if(g===-1){At("have not received end of HTTP headers yet..."),s();return}let h=l.slice(0,g).toString("ascii").split(`\r
17
+ `),f=h.shift();if(!f)return e.destroy(),o(Error("No header received from proxy CONNECT response"));let p=f.split(" "),y=+p[1],x=p.slice(2).join(" "),A={};for(let S of h){if(!S)continue;let L=S.indexOf(":");if(L===-1)return e.destroy(),o(Error(`Invalid header from proxy CONNECT response: "${S}"`));let K=S.slice(0,L).toLowerCase(),j=S.slice(L+1).trimStart(),F=A[K];if(typeof F==="string")A[K]=[F,j];else if(Array.isArray(F))F.push(j);else A[K]=j}At("got proxy server response: %o %o",f,A),i(),t({connect:{statusCode:y,statusText:x,headers:A},buffered:l})}e.on("error",a),e.on("end",c),s()})}var W=Pr.default("https-proxy-agent"),Rt=(e)=>{if(e.servername===void 0&&e.host&&!N.isIP(e.host))return{...e,servername:e.host};return e};class yt extends ke{constructor(e,t){super(t);if(this.options={path:void 0},this.proxy=typeof e==="string"?new Zc(e):e,this.proxyHeaders=t?.headers??{},W("Creating new HttpsProxyAgent instance: %o",this.proxy.href),t?.negotiate)this.onProxyAuth=St();else if(t?.onProxyAuth)this.onProxyAuth=t.onProxyAuth;let o=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),n=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...t?to(t,"headers","onProxyAuth","negotiate"):null,host:o,port:n}}async connect(e,t){let{proxy:o}=this;if(!t.host)throw TypeError('No "host" provided');let n;if(o.protocol==="https:")W("Creating `tls.Socket`: %o",this.connectOpts),n=Oe.connect(Rt(this.connectOpts));else W("Creating `net.Socket`: %o",this.connectOpts),n=N.connect(this.connectOpts);let r=typeof this.proxyHeaders==="function"?this.proxyHeaders():{...this.proxyHeaders},s=N.isIPv6(t.host)?`[${t.host}]`:t.host,i=`CONNECT ${s}:${t.port} HTTP/1.1\r
18
18
  `;if(o.username||o.password){let l=`${decodeURIComponent(o.username)}:${decodeURIComponent(o.password)}`;r["Proxy-Authorization"]=`Basic ${Buffer.from(l).toString("base64")}`}if(r.Host=`${s}:${t.port}`,!r["Proxy-Connection"])r["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close";for(let l of Object.keys(r))i+=`${l}: ${r[l]}\r
19
19
  `;let c=eo(n);n.write(`${i}\r
20
- `);let{connect:a,buffered:d}=await c;if(e.emit("proxyConnect",a),this.emit("proxyConnect",a,e),e.emit("proxy",{proxy:this.proxy.href,socket:n}),a.statusCode===200){if(e.once("socket",Or),t.secureEndpoint)return W("Upgrading socket connection to TLS"),Oe.connect({...to(At(t),"host","path","port"),socket:n});return n}if(a.statusCode===407&&this.onProxyAuth){W("Got 407 response, invoking onProxyAuth callback"),n.destroy();let l=a.headers["proxy-authenticate"]||"",g=Array.isArray(l)?l[0].split(/\s/)[0]:l.split(/\s/)[0],h=await this.onProxyAuth({response:a,scheme:g});return this._connectWithAuth(e,t,h.headers)}n.destroy();let u=new N.Socket({writable:!1});return u.readable=!0,e.once("socket",(l)=>{W("Replaying proxy buffer for failed request"),Qc(l.listenerCount("data")>0),l.push(d),l.push(null)}),u}async _connectWithAuth(e,t,o){let{proxy:n}=this,r;if(n.protocol==="https:")r=Oe.connect(At(this.connectOpts));else r=N.connect(this.connectOpts);let s=typeof this.proxyHeaders==="function"?this.proxyHeaders():{...this.proxyHeaders},i=N.isIPv6(t.host)?`[${t.host}]`:t.host,c=`CONNECT ${i}:${t.port} HTTP/1.1\r
20
+ `);let{connect:a,buffered:d}=await c;if(e.emit("proxyConnect",a),this.emit("proxyConnect",a,e),e.emit("proxy",{proxy:this.proxy.href,socket:n}),a.statusCode===200){if(e.once("socket",Or),t.secureEndpoint)return W("Upgrading socket connection to TLS"),Oe.connect({...to(Rt(t),"host","path","port"),socket:n});return n}if(a.statusCode===407&&this.onProxyAuth){W("Got 407 response, invoking onProxyAuth callback"),n.destroy();let l=a.headers["proxy-authenticate"]||"",g=Array.isArray(l)?l[0].split(/\s/)[0]:l.split(/\s/)[0],h=await this.onProxyAuth({response:a,scheme:g});return this._connectWithAuth(e,t,h.headers)}n.destroy();let u=new N.Socket({writable:!1});return u.readable=!0,e.once("socket",(l)=>{W("Replaying proxy buffer for failed request"),Qc(l.listenerCount("data")>0),l.push(d),l.push(null)}),u}async _connectWithAuth(e,t,o){let{proxy:n}=this,r;if(n.protocol==="https:")r=Oe.connect(Rt(this.connectOpts));else r=N.connect(this.connectOpts);let s=typeof this.proxyHeaders==="function"?this.proxyHeaders():{...this.proxyHeaders},i=N.isIPv6(t.host)?`[${t.host}]`:t.host,c=`CONNECT ${i}:${t.port} HTTP/1.1\r
21
21
  `;if(n.username||n.password){let u=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;s["Proxy-Authorization"]=`Basic ${Buffer.from(u).toString("base64")}`}if(Object.assign(s,o),s.Host=`${i}:${t.port}`,!s["Proxy-Connection"])s["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close";for(let u of Object.keys(s))c+=`${u}: ${s[u]}\r
22
22
  `;let a=eo(r);r.write(`${c}\r
23
- `);let{connect:d}=await a;if(e.emit("proxyConnect",d),this.emit("proxyConnect",d,e),d.statusCode===200){if(e.once("socket",Or),t.secureEndpoint)return W("Upgrading socket connection to TLS"),Oe.connect({...to(At(t),"host","path","port"),socket:r});return r}throw r.destroy(),Error(`Proxy authentication failed with status ${d.statusCode} after retry`)}}Rt.protocols=["http","https"];function Or(e){setImmediate(()=>{e.resume()})}function to(e,...t){let o={},n;for(n in e)if(!t.includes(n))o[n]=e[n];return o}var so="<empty>",ed="thinking-binding-controls-2026-08-01",Gr="[Reasoning redacted]",pe=(e,t,o={})=>{let n=new J,r=ht(t);return(async()=>{let s={role:"assistant",content:[],api:"bedrock-converse-stream",provider:e.provider,model:e.id,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()},i=s.content,c=o.profile||o.env?.AWS_PROFILE,a={profile:c||O("AWS_PROFILE",o.env)},d=Br(o),u=Boolean(O("AWS_PROFILE")),l=Dr(e.baseUrl),g=kd(e.baseUrl,d,u);if(g)a.endpoint=e.baseUrl;let h=O("AWS_BEDROCK_SKIP_AUTH",o.env)==="1",f=o.bearerToken||o.apiKey||O("AWS_BEARER_TOKEN_BEDROCK",o.env)||void 0,p=f!==void 0&&!h;if(typeof process<"u"&&(process.versions?.node||process.versions?.bun)){let x=e.id.match(/^arn:aws(?:-[a-z0-9-]+)?:bedrock:([a-z0-9-]+):/);if(x)a.region=x[1];else if(d)a.region=d;else if(l&&g)a.region=l;else if(!u)a.region="us-east-1";if(h)a.credentials={accessKeyId:"dummy-access-key",secretAccessKey:"dummy-secret-key"};let A=wd(o.env);if(!h&&A&&!c)a.credentials=A;let S=go(e.baseUrl,o.env);if(S)a.requestHandler=new oo.NodeHttpHandler({httpAgent:new St(S),httpsAgent:new Rt(S)});else if(O("AWS_BEDROCK_FORCE_HTTP1",o.env)==="1")a.requestHandler=new oo.NodeHttpHandler}else a.region=d||(l&&g?l:void 0)||"us-east-1";if(p)a.token={token:f},a.authSchemePreference=["httpBearerAuth"];let y;try{let x=e.compat?.supportsStrictMode??!1,A=new Yt(a),S=!1;if(o.onResponse)pd(A,o.onResponse,e,()=>{S=!0});let L=Ue(o.headers);if(L)dd(A,L);let K=Ed(o.cacheRetention,o.env),j=o.maxTokens??(It(e)?e.maxTokens:void 0),F=Me(r.messages),Ys=F?re(F):void 0,bt={modelId:e.id,messages:xd(r,e,K,o.env),system:Ad(Ys,e,K,o.env),inferenceConfig:{...j!==void 0&&{maxTokens:j},...o.temperature!==void 0&&{temperature:o.temperature}},toolConfig:Id(ve(r.messages),o.toolChoice,x),additionalModelRequestFields:Pd(e,o),...o.requestMetadata!==void 0&&{requestMetadata:o.requestMetadata}},Bo=await o?.onPayload?.(bt,e);if(Bo!==void 0)bt=Bo;let Qs=new Qt(bt),z=await A.send(Qs,{abortSignal:o.signal});if(y=io(z.$metadata.requestId),!S&&z.$metadata.httpStatusCode!==void 0){let _={};if(z.$metadata.requestId)_["x-amzn-requestid"]=z.$metadata.requestId;await o?.onResponse?.({status:z.$metadata.httpStatusCode,headers:_},e)}for await(let _ of z.stream)if(await o.onProviderStreamEvent?.(_,e),_.messageStart){if(_.messageStart.role!==ce.ASSISTANT)throw Error("Unexpected assistant message start but got user message start instead");n.push({type:"start",partial:s})}else if(_.contentBlockStart)_d(_.contentBlockStart,i,s,n);else if(_.contentBlockDelta)hd(_.contentBlockDelta,i,s,n);else if(_.contentBlockStop)md(_.contentBlockStop,i,s,n);else if(_.messageStop){s.rawStopReason=_.messageStop.stopReason;let{stopReason:Zs,errorMessage:Do}=Td(_.messageStop.stopReason);if(s.stopReason=Zs,Do)s.errorMessage=Do}else if(_.metadata)fd(_.metadata,e,s);else if(_.internalServerException)throw _.internalServerException;else if(_.modelStreamErrorException)throw _.modelStreamErrorException;else if(_.validationException)throw _.validationException;else if(_.throttlingException)throw _.throttlingException;else if(_.serviceUnavailableException)throw _.serviceUnavailableException;if(o.signal?.aborted)throw Error("Request was aborted");if(s.stopReason==="pending")throw Error("Bedrock stream ended without a stop reason");if(s.stopReason==="error"||s.stopReason==="aborted")throw Error(s.errorMessage||"An unknown error occurred");for(let _ of s.content)br(_);n.push({type:"done",reason:s.stopReason,message:s}),n.end()}catch(x){for(let A of s.content)br(A);if(s.stopReason=o.signal?.aborted?"aborted":"error",s.errorMessage=nd(x),s.stopReason==="error")id(s,x,y);n.push({type:"error",reason:s.stopReason,error:s}),n.end()}})(),n},td={InternalServerException:"Internal server error",ModelStreamErrorException:"Model stream error",ValidationException:"Validation error",ThrottlingException:"Throttling error",ServiceUnavailableException:"Service unavailable"},od="https://docs.aws.amazon.com/bedrock/latest/userguide/data-retention.html";function nd(e){let t=ie(e),o=!t.messageCarriesBody&&t.status!==void 0&&t.body!==void 0?`${t.status}: ${t.body}`:t.message,n=/data retention mode/i.test(o)?` See ${od} for supported data retention modes.`:"";if(e instanceof E)return`${td[e.name]??e.name}: ${o}${n}`;return`${o}${n}`}var rd=200;function io(e){if(typeof e!=="string")return;let t=e.trim();if(t.length===0||t.length>rd)return;return t}function sd(e){if(!(e instanceof Error)||!e.name.endsWith("Exception"))return;return io(e.name)}function id(e,t,o){let n=t?.$metadata,r={};if(typeof n?.httpStatusCode==="number")r.status=n.httpStatusCode;let s=sd(t);if(s!==void 0)r.errorCode=s;let i=io(n?.requestId)??o;if(i!==void 0)r.requestId=i;if(Object.keys(r).length===0)return;nt(e,{type:"bedrock_response_failure",timestamp:Date.now(),details:r})}var ad=new Set(["authorization","host"]);function cd(e){let t=e.toLowerCase();return t.startsWith("x-amz-")||ad.has(t)}function dd(e,t){let o=(n)=>async(r)=>{let s=r.request;if(s&&typeof s==="object"&&"headers"in s){let i=s.headers;for(let[c,a]of Object.entries(t))if(!cd(c))i[c]=a}return n(r)};e.middlewareStack.add(o,{step:"build",name:"pi-ai-custom-headers",priority:"low"})}function ud(e){if(!e||typeof e!=="object")return!1;let t=e;return typeof t.statusCode==="number"&&!!t.headers&&typeof t.headers==="object"}function ld(e){if(!ud(e))return;return{status:e.statusCode,headers:{...e.headers}}}function pd(e,t,o,n){let r=(s)=>async(i)=>{let c=await s(i),a=ld(c.response);if(a)n(),await t(a,o);return c};e.middlewareStack.add(r,{step:"deserialize",name:"pi-ai-response-headers"})}var Lr=(e,t,o)=>{let n={...de(e,t,o,void 0),toolChoice:o?.toolChoice};if(!o?.reasoning)return pe(e,t,{...n,reasoning:void 0});if(It(e)){if(no(e.id,e.name))return pe(e,t,{...n,reasoning:o.reasoning,thinkingBudgets:o.thinkingBudgets});let r=So(n.maxTokens,e.maxTokens,o.reasoning,o.thinkingBudgets),s=wn(e,t,r.maxTokens);return pe(e,t,{...n,maxTokens:s,reasoning:o.reasoning,thinkingBudgets:{...o.thinkingBudgets||{},[zs(o.reasoning)]:Math.min(r.thinkingBudget,Math.max(0,s-1024))}})}return pe(e,t,{...n,reasoning:o.reasoning,thinkingBudgets:o.thinkingBudgets})};function _d(e,t,o,n){let{contentBlockIndex:r,start:s}=e;if(s?.toolUse){let i={type:"toolCall",id:s.toolUse.toolUseId||"",name:s.toolUse.name||"",arguments:{},partialJson:"",index:r};o.content.push(i),n.push({type:"toolcall_start",contentIndex:t.length-1,partial:o})}}function hd(e,t,o,n){let{contentBlockIndex:r,delta:s}=e,i=t.findIndex((a)=>a.index===r),c=t[i];if(s?.text!==void 0){if(!c){let a={type:"text",text:"",index:r};o.content.push(a),i=t.length-1,c=t[i],n.push({type:"text_start",contentIndex:i,partial:o})}if(c.type==="text")c.text+=s.text,n.push({type:"text_delta",contentIndex:i,delta:s.text,partial:o})}else if(s?.toolUse&&c?.type==="toolCall")c.partialJson=(c.partialJson||"")+(s.toolUse.input||""),c.arguments=ne(c.partialJson),n.push({type:"toolcall_delta",contentIndex:i,delta:s.toolUse.input||"",partial:o});else if(s?.reasoningContent){let a=c,d=i;if(!a){let u={type:"thinking",thinking:"",thinkingSignature:"",index:r};o.content.push(u),d=t.length-1,a=t[d],n.push({type:"thinking_start",contentIndex:d,partial:o})}if(a?.type==="thinking"){if(s.reasoningContent.text)a.thinking+=s.reasoningContent.text,n.push({type:"thinking_delta",contentIndex:d,delta:s.reasoningContent.text,partial:o});if(s.reasoningContent.signature&&!a.redacted)a.thinkingSignature=(a.thinkingSignature||"")+s.reasoningContent.signature;if(s.reasoningContent.redactedContent?.length){if(!a.redacted)a.redacted=!0,a.thinkingSignature="",a.thinking+=Gr,n.push({type:"thinking_delta",contentIndex:d,delta:Gr,partial:o});a.redactedChunks??=[],a.redactedChunks.push(s.reasoningContent.redactedContent)}}}}function Mr(e){if(e.type!=="thinking"||!e.redactedChunks)return;e.thinkingSignature=Ld(e.redactedChunks),delete e.redactedChunks}function br(e){delete e.index,delete e.partialJson,Mr(e)}function fd(e,t,o){if(e.usage)o.usage.input=e.usage.inputTokens||0,o.usage.output=e.usage.outputTokens||0,o.usage.cacheRead=e.usage.cacheReadInputTokens||0,o.usage.cacheWrite=e.usage.cacheWriteInputTokens||0,o.usage.cacheWrite1h=e.usage.cacheDetails?.reduce((n,r)=>n+(r.ttl===gt.ONE_HOUR?r.inputTokens??0:0),0),o.usage.totalTokens=e.usage.totalTokens||o.usage.input+o.usage.output,me(t,o.usage)}function md(e,t,o,n){let r=t.findIndex((i)=>i.index===e.contentBlockIndex),s=t[r];if(!s)return;switch(delete s.index,s.type){case"text":n.push({type:"text_end",contentIndex:r,content:s.text,partial:o});break;case"thinking":Mr(s),n.push({type:"thinking_end",contentIndex:r,content:s.thinking,partial:o});break;case"toolCall":s.arguments=ne(s.partialJson),delete s.partialJson,n.push({type:"toolcall_end",contentIndex:r,toolCall:s,partial:o});break}}function Pe(e,t){return(t?[e,t]:[e]).flatMap((n)=>{let r=n.toLowerCase();return[r,r.replace(/[\s_.:]+/g,"-")]})}function no(e,t){return Pe(e,t).some((n)=>n.includes("opus-4-6")||n.includes("opus-4-7")||n.includes("opus-4-8")||n.includes("opus-5")||n.includes("sonnet-4-6")||n.includes("sonnet-5")||n.includes("haiku-5")||n.includes("fable-5"))}function gd(e){return Pe(e.id,e.name).some((o)=>o.includes("opus-4-7")||o.includes("opus-4-8")||o.includes("opus-5")||o.includes("sonnet-5")||o.includes("haiku-5")||o.includes("fable-5"))}function Cd(e){return Pe(e.id,e.name).some((o)=>o.includes("opus-4-7")||o.includes("opus-4-8")||o.includes("opus-5")||o.includes("sonnet-5")||o.includes("haiku-5")||o.includes("fable-5"))}function Sd(e,t){if(t==="xhigh"&&gd(e))return"xhigh";let o=t?e.thinkingLevelMap?.[t]:void 0;if(typeof o==="string")return o;switch(t){case"minimal":case"low":return"low";case"medium":return"medium";case"high":return"high";default:return"high"}}function Ed(e,t){if(e)return e;if(O("PI_CACHE_RETENTION",t)==="long")return"long";return"short"}function It(e){let t=e.id.toLowerCase(),o=e.name?.toLowerCase()??"";return t.includes("anthropic.claude")||t.includes("anthropic/claude")||o.includes("anthropic.claude")||o.includes("anthropic/claude")||o.includes("claude")}function Ur(e,t){let o=Pe(e.id,e.name);if(!o.some((r)=>r.includes("claude"))){if(O("AWS_BEDROCK_FORCE_CACHE",t)==="1")return!0;return!1}if(o.some((r)=>r.includes("fable-5")||r.includes("opus-5")||r.includes("sonnet-5")||r.includes("haiku-5")))return!0;if(o.some((r)=>r.includes("-4-")))return!0;if(o.some((r)=>r.includes("claude-3-7-sonnet")))return!0;if(o.some((r)=>r.includes("claude-3-5-haiku")))return!0;return!1}function vd(e){return It(e)}function Ad(e,t,o,n){if(!e)return;let r=[{text:C(e)}];if(o!=="none"&&Ur(t,n))r.push({cachePoint:{type:Zt.DEFAULT,...o==="long"?{ttl:gt.ONE_HOUR}:{}}});return r}function Rd(e){let t=e.replace(/[^a-zA-Z0-9_-]/g,"_");return t.length>64?t.slice(0,64):t}function yt(e){let t=C(e);return t.trim().length===0?void 0:{text:t}}function yd(e){return yt(e)??{text:so}}function ro(e){if(Array.isArray(e))return e.map(ro);if(e!==null&&typeof e==="object")return Object.fromEntries(Object.entries(e).filter(([t])=>t.length>0).map(([t,o])=>[t,ro(o)]));return e}function Nr(e){let t=[];for(let o of e)if(o.type==="image")t.push({image:$r(o.mimeType,o.data)});else{let n=yt(o.text);if(n)t.push(n)}if(t.length===0)t.push({text:so});return t}function xd(e,t,o,n){let r=[],s=Ne(on(e.messages),t,Rd);for(let i=0;i<s.length;i++){let c=s[i];switch(c.role){case"user":{let a=[];if(typeof c.content==="string")a.push(yd(c.content));else{for(let d of c.content)switch(d.type){case"text":{let u=yt(d.text);if(u)a.push(u);break}case"image":a.push({image:$r(d.mimeType,d.data)});break;default:continue}if(a.length===0)a.push({text:so})}r.push({role:ce.USER,content:a});break}case"assistant":{if(c.content.length===0)continue;let a=[];for(let d of c.content)switch(d.type){case"text":{let u=yt(d.text);if(!u)continue;a.push(u);break}case"toolCall":a.push({toolUse:{toolUseId:d.id,name:d.name,input:ro(d.arguments)}});break;case"thinking":{if(d.redacted){let l=Nd(d.thinkingSignature);if(l?.length)a.push({reasoningContent:{redactedContent:l}});continue}let u=C(d.thinking);if(u.trim().length===0)continue;if(vd(t))if(!d.thinkingSignature||d.thinkingSignature.trim().length===0)a.push({text:u});else a.push({reasoningContent:{reasoningText:{text:u,signature:d.thinkingSignature}}});else a.push({reasoningContent:{reasoningText:{text:u}}});break}default:continue}if(a.length===0)continue;r.push({role:ce.ASSISTANT,content:a});break}case"toolResult":{let a=[];a.push({toolResult:{toolUseId:c.toolCallId,content:Nr(c.content),status:c.isError?we.ERROR:we.SUCCESS}});let d=i+1;while(d<s.length&&s[d].role==="toolResult"){let u=s[d];a.push({toolResult:{toolUseId:u.toolCallId,content:Nr(u.content),status:u.isError?we.ERROR:we.SUCCESS}}),d++}i=d-1,r.push({role:ce.USER,content:a});break}default:continue}}if(o!=="none"&&Ur(t,n)&&r.length>0){let i=r[r.length-1];if(i.role===ce.USER&&i.content)i.content.push({cachePoint:{type:Zt.DEFAULT,...o==="long"?{ttl:gt.ONE_HOUR}:{}}})}return r}function Id(e,t,o){if(!e?.length)return;if(t==="none")return;let n=e.map((s)=>{let i=Ie(s,o);return{toolSpec:{name:s.name,description:s.description,inputSchema:{json:De(s,i)},...i===!0?{strict:!0}:{}}}}),r;switch(t){case"auto":r={auto:{}};break;case"any":r={any:{}};break;default:if(t?.type==="tool")r={tool:{name:t.name}}}return{tools:n,toolChoice:r}}function Td(e){switch(e){case ue.END_TURN:case ue.STOP_SEQUENCE:return{stopReason:"stop"};case ue.MAX_TOKENS:case ue.MODEL_CONTEXT_WINDOW_EXCEEDED:return{stopReason:"length"};case ue.TOOL_USE:return{stopReason:"toolUse"};default:return e?{stopReason:"error",errorMessage:`Provider stopped with: ${e}`}:{stopReason:"error"}}}function Br(e){return e.region||O("AWS_REGION",e.env)||O("AWS_DEFAULT_REGION",e.env)||void 0}function wd(e){let t=O("AWS_ACCESS_KEY_ID",e),o=O("AWS_SECRET_ACCESS_KEY",e);if(!t||!o)return;let n=O("AWS_SESSION_TOKEN",e);return{accessKeyId:t,secretAccessKey:o,...n?{sessionToken:n}:{}}}function Dr(e){if(!e)return;try{let{hostname:t}=new URL(e);return t.toLowerCase().match(/^bedrock-runtime(?:-fips)?\.([a-z0-9-]+)\.amazonaws\.com(?:\.cn)?$/)?.[1]}catch{return}}function kd(e,t,o){if(!Dr(e))return!0;return!t&&!o}function Od(e,t){if(Br(t)?.toLowerCase().startsWith("us-gov-"))return!0;let n=e.id.toLowerCase();return n.startsWith("us-gov.")||n.startsWith("arn:aws-us-gov:")}function Pd(e,t){if(!t.reasoning||!e.reasoning)return;if(It(e)){let n=Od(e,t),r=n?void 0:t.thinkingDisplay??"summarized",s=!n&&Cd(e),i=no(e.id,e.name)?{thinking:{type:"adaptive",...r!==void 0?{display:r}:{},...s?{block_binding:{prefix_mismatch_behavior:"drop_block"}}:{}},output_config:{effort:Sd(e,t.reasoning)},...s?{anthropic_beta:[ed]}:{}}:(()=>{let c={minimal:1024,low:2048,medium:8192,high:16384,xhigh:16384,max:16384},a=t.reasoning==="xhigh"||t.reasoning==="max"?"high":t.reasoning;return{thinking:{type:"enabled",budget_tokens:t.thinkingBudgets?.[a]??c[t.reasoning],...r!==void 0?{display:r}:{}}}})();if(!no(e.id,e.name)&&(t.interleavedThinking??!0))i.anthropic_beta=["interleaved-thinking-2025-05-14"];return i}let o=Pe(e.id,e.name);if(o.some((n)=>n.includes("gpt-oss")))return{reasoning_effort:bd[t.reasoning]};if(o.some((n)=>n.includes("gpt-"))){let n=e.thinkingLevelMap?.[t.reasoning];return{reasoning:{effort:typeof n==="string"?n:Gd[t.reasoning]}}}return}var Gd={minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},bd={minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"high",max:"high"};function $r(e,t){let o;switch(e){case"image/jpeg":case"image/jpg":o=Te.JPEG;break;case"image/png":o=Te.PNG;break;case"image/gif":o=Te.GIF;break;case"image/webp":o=Te.WEBP;break;default:throw Error(`Unknown image type: ${e}`)}return{source:{bytes:Fr(t)},format:o}}function Fr(e){let t=atob(e),o=new Uint8Array(t.length);for(let n=0;n<t.length;n++)o[n]=t.charCodeAt(n);return o}function Nd(e){if(!e)return;try{return Fr(e)}catch{return}}function Ld(e){let o="";for(let n of e)for(let r=0;r<n.length;r+=32768)o+=String.fromCharCode(...n.subarray(r,r+32768));return btoa(o)}var Hr={stream:pe,streamSimple:Lr};import{createServer as Md}from"http";function Tt(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;")}function Wr(e){let t=Tt(e.title),o=Tt(e.heading),n=Tt(e.message),r=e.details?Tt(e.details):void 0;return`<!doctype html>
23
+ `);let{connect:d}=await a;if(e.emit("proxyConnect",d),this.emit("proxyConnect",d,e),d.statusCode===200){if(e.once("socket",Or),t.secureEndpoint)return W("Upgrading socket connection to TLS"),Oe.connect({...to(Rt(t),"host","path","port"),socket:r});return r}throw r.destroy(),Error(`Proxy authentication failed with status ${d.statusCode} after retry`)}}yt.protocols=["http","https"];function Or(e){setImmediate(()=>{e.resume()})}function to(e,...t){let o={},n;for(n in e)if(!t.includes(n))o[n]=e[n];return o}var so="<empty>",ed="thinking-binding-controls-2026-08-01",Gr="[Reasoning redacted]",pe=(e,t,o={})=>{let n=new J,r=ht(t);return(async()=>{let s={role:"assistant",content:[],api:"bedrock-converse-stream",provider:e.provider,model:e.id,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()},i=s.content,c=o.profile||o.env?.AWS_PROFILE,a={profile:c||O("AWS_PROFILE",o.env)},d=Br(o),u=Boolean(O("AWS_PROFILE")),l=Dr(e.baseUrl),g=kd(e.baseUrl,d,u);if(g)a.endpoint=e.baseUrl;let h=O("AWS_BEDROCK_SKIP_AUTH",o.env)==="1",f=o.bearerToken||o.apiKey||O("AWS_BEARER_TOKEN_BEDROCK",o.env)||void 0,p=f!==void 0&&!h;if(typeof process<"u"&&(process.versions?.node||process.versions?.bun)){let x=e.id.match(/^arn:aws(?:-[a-z0-9-]+)?:bedrock:([a-z0-9-]+):/);if(x)a.region=x[1];else if(d)a.region=d;else if(l&&g)a.region=l;else if(!u)a.region="us-east-1";if(h)a.credentials={accessKeyId:"dummy-access-key",secretAccessKey:"dummy-secret-key"};let A=wd(o.env);if(!h&&A&&!c)a.credentials=A;let S=yo(e.baseUrl,o.env);if(S)a.requestHandler=new oo.NodeHttpHandler({httpAgent:new Et(S),httpsAgent:new yt(S)});else if(O("AWS_BEDROCK_FORCE_HTTP1",o.env)==="1")a.requestHandler=new oo.NodeHttpHandler}else a.region=d||(l&&g?l:void 0)||"us-east-1";if(p)a.token={token:f},a.authSchemePreference=["httpBearerAuth"];let y;try{let x=e.compat?.supportsStrictMode??!1,A=new Yt(a),S=!1;if(o.onResponse)pd(A,o.onResponse,e,()=>{S=!0});let L=Ue(o.headers);if(L)dd(A,L);let K=Ed(o.cacheRetention,o.env),j=o.maxTokens??(It(e)?e.maxTokens:void 0),F=Me(r.messages),Ys=F?re(F):void 0,Lt={modelId:e.id,messages:xd(r,e,K,o.env),system:Ad(Ys,e,K,o.env),inferenceConfig:{...j!==void 0&&{maxTokens:j},...o.temperature!==void 0&&{temperature:o.temperature}},toolConfig:Id(_e(r.messages),o.toolChoice,x),additionalModelRequestFields:Pd(e,o),...o.requestMetadata!==void 0&&{requestMetadata:o.requestMetadata}},Bo=await o?.onPayload?.(Lt,e);if(Bo!==void 0)Lt=Bo;let Qs=new Qt(Lt),z=await A.send(Qs,{abortSignal:o.signal});if(y=io(z.$metadata.requestId),!S&&z.$metadata.httpStatusCode!==void 0){let _={};if(z.$metadata.requestId)_["x-amzn-requestid"]=z.$metadata.requestId;await o?.onResponse?.({status:z.$metadata.httpStatusCode,headers:_},e)}for await(let _ of z.stream)if(await o.onProviderStreamEvent?.(_,e),_.messageStart){if(_.messageStart.role!==ce.ASSISTANT)throw Error("Unexpected assistant message start but got user message start instead");n.push({type:"start",partial:s})}else if(_.contentBlockStart)_d(_.contentBlockStart,i,s,n);else if(_.contentBlockDelta)hd(_.contentBlockDelta,i,s,n);else if(_.contentBlockStop)md(_.contentBlockStop,i,s,n);else if(_.messageStop){s.rawStopReason=_.messageStop.stopReason;let{stopReason:Zs,errorMessage:Do}=Td(_.messageStop.stopReason);if(s.stopReason=Zs,Do)s.errorMessage=Do}else if(_.metadata)fd(_.metadata,e,s);else if(_.internalServerException)throw _.internalServerException;else if(_.modelStreamErrorException)throw _.modelStreamErrorException;else if(_.validationException)throw _.validationException;else if(_.throttlingException)throw _.throttlingException;else if(_.serviceUnavailableException)throw _.serviceUnavailableException;if(o.signal?.aborted)throw Error("Request was aborted");if(s.stopReason==="pending")throw Error("Bedrock stream ended without a stop reason");if(s.stopReason==="error"||s.stopReason==="aborted")throw Error(s.errorMessage||"An unknown error occurred");for(let _ of s.content)br(_);n.push({type:"done",reason:s.stopReason,message:s}),n.end()}catch(x){for(let A of s.content)br(A);if(s.stopReason=o.signal?.aborted?"aborted":"error",s.errorMessage=nd(x),s.stopReason==="error")id(s,x,y);n.push({type:"error",reason:s.stopReason,error:s}),n.end()}})(),n},td={InternalServerException:"Internal server error",ModelStreamErrorException:"Model stream error",ValidationException:"Validation error",ThrottlingException:"Throttling error",ServiceUnavailableException:"Service unavailable"},od="https://docs.aws.amazon.com/bedrock/latest/userguide/data-retention.html";function nd(e){let t=se(e),o=!t.messageCarriesBody&&t.status!==void 0&&t.body!==void 0?`${t.status}: ${t.body}`:t.message,n=/data retention mode/i.test(o)?` See ${od} for supported data retention modes.`:"";if(e instanceof E)return`${td[e.name]??e.name}: ${o}${n}`;return`${o}${n}`}var rd=200;function io(e){if(typeof e!=="string")return;let t=e.trim();if(t.length===0||t.length>rd)return;return t}function sd(e){if(!(e instanceof Error)||!e.name.endsWith("Exception"))return;return io(e.name)}function id(e,t,o){let n=t?.$metadata,r={};if(typeof n?.httpStatusCode==="number")r.status=n.httpStatusCode;let s=sd(t);if(s!==void 0)r.errorCode=s;let i=io(n?.requestId)??o;if(i!==void 0)r.requestId=i;if(Object.keys(r).length===0)return;it(e,{type:"bedrock_response_failure",timestamp:Date.now(),details:r})}var ad=new Set(["authorization","host"]);function cd(e){let t=e.toLowerCase();return t.startsWith("x-amz-")||ad.has(t)}function dd(e,t){let o=(n)=>async(r)=>{let s=r.request;if(s&&typeof s==="object"&&"headers"in s){let i=s.headers;for(let[c,a]of Object.entries(t))if(!cd(c))i[c]=a}return n(r)};e.middlewareStack.add(o,{step:"build",name:"pi-ai-custom-headers",priority:"low"})}function ud(e){if(!e||typeof e!=="object")return!1;let t=e;return typeof t.statusCode==="number"&&!!t.headers&&typeof t.headers==="object"}function ld(e){if(!ud(e))return;return{status:e.statusCode,headers:{...e.headers}}}function pd(e,t,o,n){let r=(s)=>async(i)=>{let c=await s(i),a=ld(c.response);if(a)n(),await t(a,o);return c};e.middlewareStack.add(r,{step:"deserialize",name:"pi-ai-response-headers"})}var Lr=(e,t,o)=>{let n={...de(e,t,o,void 0),toolChoice:o?.toolChoice};if(!o?.reasoning)return pe(e,t,{...n,reasoning:void 0});if(It(e)){if(no(e.id,e.name))return pe(e,t,{...n,reasoning:o.reasoning,thinkingBudgets:o.thinkingBudgets});let r=xo(n.maxTokens,e.maxTokens,o.reasoning,o.thinkingBudgets),s=An(e,t,r.maxTokens);return pe(e,t,{...n,maxTokens:s,reasoning:o.reasoning,thinkingBudgets:{...o.thinkingBudgets||{},[zs(o.reasoning)]:Math.min(r.thinkingBudget,Math.max(0,s-1024))}})}return pe(e,t,{...n,reasoning:o.reasoning,thinkingBudgets:o.thinkingBudgets})};function _d(e,t,o,n){let{contentBlockIndex:r,start:s}=e;if(s?.toolUse){let i={type:"toolCall",id:s.toolUse.toolUseId||"",name:s.toolUse.name||"",arguments:{},partialJson:"",index:r};o.content.push(i),n.push({type:"toolcall_start",contentIndex:t.length-1,partial:o})}}function hd(e,t,o,n){let{contentBlockIndex:r,delta:s}=e,i=t.findIndex((a)=>a.index===r),c=t[i];if(s?.text!==void 0){if(!c){let a={type:"text",text:"",index:r};o.content.push(a),i=t.length-1,c=t[i],n.push({type:"text_start",contentIndex:i,partial:o})}if(c.type==="text")c.text+=s.text,n.push({type:"text_delta",contentIndex:i,delta:s.text,partial:o})}else if(s?.toolUse&&c?.type==="toolCall")c.partialJson=(c.partialJson||"")+(s.toolUse.input||""),c.arguments=ne(c.partialJson),n.push({type:"toolcall_delta",contentIndex:i,delta:s.toolUse.input||"",partial:o});else if(s?.reasoningContent){let a=c,d=i;if(!a){let u={type:"thinking",thinking:"",thinkingSignature:"",index:r};o.content.push(u),d=t.length-1,a=t[d],n.push({type:"thinking_start",contentIndex:d,partial:o})}if(a?.type==="thinking"){if(s.reasoningContent.text)a.thinking+=s.reasoningContent.text,n.push({type:"thinking_delta",contentIndex:d,delta:s.reasoningContent.text,partial:o});if(s.reasoningContent.signature&&!a.redacted)a.thinkingSignature=(a.thinkingSignature||"")+s.reasoningContent.signature;if(s.reasoningContent.redactedContent?.length){if(!a.redacted)a.redacted=!0,a.thinkingSignature="",a.thinking+=Gr,n.push({type:"thinking_delta",contentIndex:d,delta:Gr,partial:o});a.redactedChunks??=[],a.redactedChunks.push(s.reasoningContent.redactedContent)}}}}function Mr(e){if(e.type!=="thinking"||!e.redactedChunks)return;e.thinkingSignature=Ld(e.redactedChunks),delete e.redactedChunks}function br(e){delete e.index,delete e.partialJson,Mr(e)}function fd(e,t,o){if(e.usage)o.usage.input=e.usage.inputTokens||0,o.usage.output=e.usage.outputTokens||0,o.usage.cacheRead=e.usage.cacheReadInputTokens||0,o.usage.cacheWrite=e.usage.cacheWriteInputTokens||0,o.usage.cacheWrite1h=e.usage.cacheDetails?.reduce((n,r)=>n+(r.ttl===Ct.ONE_HOUR?r.inputTokens??0:0),0),o.usage.totalTokens=e.usage.totalTokens||o.usage.input+o.usage.output,he(t,o.usage)}function md(e,t,o,n){let r=t.findIndex((i)=>i.index===e.contentBlockIndex),s=t[r];if(!s)return;switch(delete s.index,s.type){case"text":n.push({type:"text_end",contentIndex:r,content:s.text,partial:o});break;case"thinking":Mr(s),n.push({type:"thinking_end",contentIndex:r,content:s.thinking,partial:o});break;case"toolCall":s.arguments=ne(s.partialJson),delete s.partialJson,n.push({type:"toolcall_end",contentIndex:r,toolCall:s,partial:o});break}}function Pe(e,t){return(t?[e,t]:[e]).flatMap((n)=>{let r=n.toLowerCase();return[r,r.replace(/[\s_.:]+/g,"-")]})}function no(e,t){return Pe(e,t).some((n)=>n.includes("opus-4-6")||n.includes("opus-4-7")||n.includes("opus-4-8")||n.includes("opus-5")||n.includes("sonnet-4-6")||n.includes("sonnet-5")||n.includes("haiku-5")||n.includes("fable-5"))}function gd(e){return Pe(e.id,e.name).some((o)=>o.includes("opus-4-7")||o.includes("opus-4-8")||o.includes("opus-5")||o.includes("sonnet-5")||o.includes("haiku-5")||o.includes("fable-5"))}function Cd(e){return Pe(e.id,e.name).some((o)=>o.includes("opus-4-7")||o.includes("opus-4-8")||o.includes("opus-5")||o.includes("sonnet-5")||o.includes("haiku-5")||o.includes("fable-5"))}function Sd(e,t){if(t==="xhigh"&&gd(e))return"xhigh";let o=t?e.thinkingLevelMap?.[t]:void 0;if(typeof o==="string")return o;switch(t){case"minimal":case"low":return"low";case"medium":return"medium";case"high":return"high";default:return"high"}}function Ed(e,t){if(e)return e;if(O("PI_CACHE_RETENTION",t)==="long")return"long";return"short"}function It(e){let t=e.id.toLowerCase(),o=e.name?.toLowerCase()??"";return t.includes("anthropic.claude")||t.includes("anthropic/claude")||o.includes("anthropic.claude")||o.includes("anthropic/claude")||o.includes("claude")}function Ur(e,t){let o=Pe(e.id,e.name);if(!o.some((r)=>r.includes("claude"))){if(O("AWS_BEDROCK_FORCE_CACHE",t)==="1")return!0;return!1}if(o.some((r)=>r.includes("fable-5")||r.includes("opus-5")||r.includes("sonnet-5")||r.includes("haiku-5")))return!0;if(o.some((r)=>r.includes("-4-")))return!0;if(o.some((r)=>r.includes("claude-3-7-sonnet")))return!0;if(o.some((r)=>r.includes("claude-3-5-haiku")))return!0;return!1}function vd(e){return It(e)}function Ad(e,t,o,n){if(!e)return;let r=[{text:C(e)}];if(o!=="none"&&Ur(t,n))r.push({cachePoint:{type:Zt.DEFAULT,...o==="long"?{ttl:Ct.ONE_HOUR}:{}}});return r}function Rd(e){let t=e.replace(/[^a-zA-Z0-9_-]/g,"_");return t.length>64?t.slice(0,64):t}function xt(e){let t=C(e);return t.trim().length===0?void 0:{text:t}}function yd(e){return xt(e)??{text:so}}function ro(e){if(Array.isArray(e))return e.map(ro);if(e!==null&&typeof e==="object")return Object.fromEntries(Object.entries(e).filter(([t])=>t.length>0).map(([t,o])=>[t,ro(o)]));return e}function Nr(e){let t=[];for(let o of e)if(o.type==="image")t.push({image:$r(o.mimeType,o.data)});else{let n=xt(o.text);if(n)t.push(n)}if(t.length===0)t.push({text:so});return t}function xd(e,t,o,n){let r=[],s=Ne(pn(e.messages),t,Rd);for(let i=0;i<s.length;i++){let c=s[i];switch(c.role){case"user":{let a=[];if(typeof c.content==="string")a.push(yd(c.content));else{for(let d of c.content)switch(d.type){case"text":{let u=xt(d.text);if(u)a.push(u);break}case"image":a.push({image:$r(d.mimeType,d.data)});break;default:continue}if(a.length===0)a.push({text:so})}r.push({role:ce.USER,content:a});break}case"assistant":{if(c.content.length===0)continue;let a=[];for(let d of c.content)switch(d.type){case"text":{let u=xt(d.text);if(!u)continue;a.push(u);break}case"toolCall":a.push({toolUse:{toolUseId:d.id,name:d.name,input:ro(d.arguments)}});break;case"thinking":{if(d.redacted){let l=Nd(d.thinkingSignature);if(l?.length)a.push({reasoningContent:{redactedContent:l}});continue}let u=C(d.thinking);if(u.trim().length===0)continue;if(vd(t))if(!d.thinkingSignature||d.thinkingSignature.trim().length===0)a.push({text:u});else a.push({reasoningContent:{reasoningText:{text:u,signature:d.thinkingSignature}}});else a.push({reasoningContent:{reasoningText:{text:u}}});break}default:continue}if(a.length===0)continue;r.push({role:ce.ASSISTANT,content:a});break}case"toolResult":{let a=[];a.push({toolResult:{toolUseId:c.toolCallId,content:Nr(c.content),status:c.isError?we.ERROR:we.SUCCESS}});let d=i+1;while(d<s.length&&s[d].role==="toolResult"){let u=s[d];a.push({toolResult:{toolUseId:u.toolCallId,content:Nr(u.content),status:u.isError?we.ERROR:we.SUCCESS}}),d++}i=d-1,r.push({role:ce.USER,content:a});break}default:continue}}if(o!=="none"&&Ur(t,n)&&r.length>0){let i=r[r.length-1];if(i.role===ce.USER&&i.content)i.content.push({cachePoint:{type:Zt.DEFAULT,...o==="long"?{ttl:Ct.ONE_HOUR}:{}}})}return r}function Id(e,t,o){if(!e?.length)return;if(t==="none")return;let n=e.map((s)=>{let i=Ie(s,o);return{toolSpec:{name:s.name,description:s.description,inputSchema:{json:De(s,i)},...i===!0?{strict:!0}:{}}}}),r;switch(t){case"auto":r={auto:{}};break;case"any":r={any:{}};break;default:if(t?.type==="tool")r={tool:{name:t.name}}}return{tools:n,toolChoice:r}}function Td(e){switch(e){case ue.END_TURN:case ue.STOP_SEQUENCE:return{stopReason:"stop"};case ue.MAX_TOKENS:case ue.MODEL_CONTEXT_WINDOW_EXCEEDED:return{stopReason:"length"};case ue.TOOL_USE:return{stopReason:"toolUse"};default:return e?{stopReason:"error",errorMessage:`Provider stopped with: ${e}`}:{stopReason:"error"}}}function Br(e){return e.region||O("AWS_REGION",e.env)||O("AWS_DEFAULT_REGION",e.env)||void 0}function wd(e){let t=O("AWS_ACCESS_KEY_ID",e),o=O("AWS_SECRET_ACCESS_KEY",e);if(!t||!o)return;let n=O("AWS_SESSION_TOKEN",e);return{accessKeyId:t,secretAccessKey:o,...n?{sessionToken:n}:{}}}function Dr(e){if(!e)return;try{let{hostname:t}=new URL(e);return t.toLowerCase().match(/^bedrock-runtime(?:-fips)?\.([a-z0-9-]+)\.amazonaws\.com(?:\.cn)?$/)?.[1]}catch{return}}function kd(e,t,o){if(!Dr(e))return!0;return!t&&!o}function Od(e,t){if(Br(t)?.toLowerCase().startsWith("us-gov-"))return!0;let n=e.id.toLowerCase();return n.startsWith("us-gov.")||n.startsWith("arn:aws-us-gov:")}function Pd(e,t){if(!t.reasoning||!e.reasoning)return;if(It(e)){let n=Od(e,t),r=n?void 0:t.thinkingDisplay??"summarized",s=!n&&Cd(e),i=no(e.id,e.name)?{thinking:{type:"adaptive",...r!==void 0?{display:r}:{},...s?{block_binding:{prefix_mismatch_behavior:"drop_block"}}:{}},output_config:{effort:Sd(e,t.reasoning)},...s?{anthropic_beta:[ed]}:{}}:(()=>{let c={minimal:1024,low:2048,medium:8192,high:16384,xhigh:16384,max:16384},a=t.reasoning==="xhigh"||t.reasoning==="max"?"high":t.reasoning;return{thinking:{type:"enabled",budget_tokens:t.thinkingBudgets?.[a]??c[t.reasoning],...r!==void 0?{display:r}:{}}}})();if(!no(e.id,e.name)&&(t.interleavedThinking??!0))i.anthropic_beta=["interleaved-thinking-2025-05-14"];return i}let o=Pe(e.id,e.name);if(o.some((n)=>n.includes("gpt-oss")))return{reasoning_effort:bd[t.reasoning]};if(o.some((n)=>n.includes("gpt-"))){let n=e.thinkingLevelMap?.[t.reasoning];return{reasoning:{effort:typeof n==="string"?n:Gd[t.reasoning]}}}return}var Gd={minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},bd={minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"high",max:"high"};function $r(e,t){let o;switch(e){case"image/jpeg":case"image/jpg":o=Te.JPEG;break;case"image/png":o=Te.PNG;break;case"image/gif":o=Te.GIF;break;case"image/webp":o=Te.WEBP;break;default:throw Error(`Unknown image type: ${e}`)}return{source:{bytes:Fr(t)},format:o}}function Fr(e){let t=atob(e),o=new Uint8Array(t.length);for(let n=0;n<t.length;n++)o[n]=t.charCodeAt(n);return o}function Nd(e){if(!e)return;try{return Fr(e)}catch{return}}function Ld(e){let o="";for(let n of e)for(let r=0;r<n.length;r+=32768)o+=String.fromCharCode(...n.subarray(r,r+32768));return btoa(o)}var Hr={stream:pe,streamSimple:Lr};import{createServer as Md}from"http";function Tt(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;")}function Wr(e){let t=Tt(e.title),o=Tt(e.heading),n=Tt(e.message),r=e.details?Tt(e.details):void 0;return`<!doctype html>
24
24
  <html lang="en">
25
25
  <head>
26
26
  <meta charset="utf-8" />
@@ -93,4 +93,4 @@ import{xo,vo,Pi}from"./chunk-ad5asgnr.js";import{ne}from"./chunk-mbf7201c.js";im
93
93
  ${r?`<div class="details">${r}</div>`:""}
94
94
  </main>
95
95
  </body>
96
- </html>`}function wt(e){return Wr({title:"Authentication successful",heading:"Authentication successful",message:e})}function k(e,t){return Wr({title:"Authentication failed",heading:"Authentication failed",message:e,details:t})}function V(e,t,o){e.writeHead(t,{"content-type":"text/html; charset=utf-8","cache-control":"no-store"}),e.end(o)}async function D(e){let{providerName:t,signal:o}=e;if(o?.aborted)throw Error("Login cancelled");let n=()=>{},r=()=>{},s=new Promise((f,p)=>{n=f,r=p});s.catch(()=>{return});let i=!1,c=!1,a,d=()=>u({error:Error("Login cancelled")}),u=(f)=>{if(c)return;if(c=!0,a)clearTimeout(a);if(o?.removeEventListener("abort",d),"error"in f)r(f.error);else n(f.value)},l=Md((f,p)=>{(async()=>{let y=new URL(f.url??"/","http://localhost");if(f.method!=="GET"||y.pathname!==e.path){V(p,404,k("Callback route not found."));return}if(e.state!==void 0&&y.searchParams.get("state")!==e.state){V(p,400,k("State mismatch."));return}if(i||c){V(p,409,k("This sign-in has already been handled."));return}let x=y.searchParams.get("error");if(x){let S=y.searchParams.get("error_description")??x;V(p,400,k(`${t} authorization failed.`,S)),u({error:Error(`${t} authorization failed: ${S}`)});return}let A=y.searchParams.get("code");if(!A){V(p,400,k("Missing authorization code."));return}i=!0;try{let S=await e.complete(A);V(p,200,wt(`Signed in to ${t}. You may now close this page.`)),u({value:S})}catch(S){let L=S instanceof Error?S:Error(String(S));V(p,502,k(`${t} sign-in failed.`,L.message)),u({error:L})}})()});await new Promise((f,p)=>{l.once("error",p),l.listen(e.port,e.host,()=>{l.off("error",p),f()})});let g=l.address();if(!g||typeof g==="string")throw l.close(),Error("OAuth callback server did not bind to TCP");if(l.on("error",(f)=>u({error:f})),o?.addEventListener("abort",d,{once:!0}),e.timeoutMs!==void 0)a=setTimeout(()=>u({error:Error(`${t} sign-in timed out`)}),e.timeoutMs);let h=e.redirectHost??e.host;return{redirectUri:`http://${h.includes(":")?`[${h}]`:h}:${g.port}${e.path}`,wait:()=>s,cancel:()=>{if(!i)u({value:void 0})},close:()=>{u({error:Error("OAuth callback server closed")}),l.close()}}}async function _e(e,t,o){let n=new AbortController,r,s=e.prompt({type:"manual_code",...o,signal:n.signal}).then((i)=>(t?.cancel(),i)).catch((i)=>{r=i instanceof Error?i:Error(String(i)),t?.cancel();return});try{let i=await t?.wait();if(r)throw r;if(i!==void 0)return{type:"callback",value:i};let c=await s;if(r)throw r;return{type:"manual",input:c??""}}finally{n.abort()}}function Vr(e){let t="";for(let o of e)t+=String.fromCharCode(o);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}async function G(){let e=new Uint8Array(32);crypto.getRandomValues(e);let t=Vr(e),n=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",n),s=Vr(new Uint8Array(r));return{verifier:t,challenge:s}}var Ud=(e)=>atob(e),kt=Ud("OWQxYzI1MGEtZTYxYi00NGQ5LTg4ZWQtNTk0NGQxOTYyZjVl"),Xr="https://claude.ai/oauth/authorize",ge="https://platform.claude.com/v1/oauth/token",Bd=O("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1",Jr=53692,Yr="/callback",Dd=`http://localhost:${Jr}${Yr}`,Kr="https://platform.claude.com/oauth/code/callback",jr="browser",zr="copy_code",Qr="org:create_api_key user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload";function Zr(e){let t=e.trim();if(!t)return{};try{let o=new URL(t);return{code:o.searchParams.get("code")??void 0,state:o.searchParams.get("state")??void 0}}catch{}if(t.includes("#")){let[o,n]=t.split("#",2);return{code:o,state:n}}if(t.includes("code=")){let o=new URLSearchParams(t);return{code:o.get("code")??void 0,state:o.get("state")??void 0}}return{code:t}}function Ge(e){if(e instanceof Error){let t=[`${e.name}: ${e.message}`],o=e;if(o.code)t.push(`code=${o.code}`);if(typeof o.errno<"u")t.push(`errno=${String(o.errno)}`);if(typeof e.cause<"u")t.push(`cause=${Ge(e.cause)}`);if(e.stack)t.push(`stack=${e.stack}`);return t.join("; ")}return String(e)}async function es(e,t,o){let n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t),signal:AbortSignal.any([o,AbortSignal.timeout(30000)])}),r=await n.text();if(!n.ok)throw Error(`HTTP request failed. status=${n.status}; url=${e}; body=${r}`);return r}async function ts(e,t,o,n,r){let s;try{s=await es(ge,{grant_type:"authorization_code",client_id:kt,code:e,state:t,redirect_uri:n,code_verifier:o},r)}catch(c){throw Error(`Token exchange request failed. url=${ge}; redirect_uri=${n}; response_type=authorization_code; details=${Ge(c)}`)}let i;try{i=JSON.parse(s)}catch(c){throw Error(`Token exchange returned invalid JSON. url=${ge}; body=${s}; details=${Ge(c)}`)}return{type:"oauth",refresh:i.refresh_token,access:i.access_token,expires:Date.now()+i.expires_in*1000-300000}}async function $d(e){let{verifier:t,challenge:o}=await G(),n=(i)=>D({providerName:"Anthropic",host:Bd,port:i,path:Yr,redirectHost:"localhost",state:t,complete:async(c)=>c,signal:e.signal}),r=await n(Jr).catch(()=>n(0)).catch(()=>{return}),s=r?.redirectUri??Dd;try{let i=new URLSearchParams({code:"true",client_id:kt,response_type:"code",redirect_uri:s,scope:Qr,code_challenge:o,code_challenge_method:"S256",state:t});e.notify({type:"auth_url",url:`${Xr}?${i.toString()}`,instructions:"Complete login in your browser. If the browser is on another machine, paste the final redirect URL here."});let c=await _e(e,r,{message:"Complete login in your browser, or paste the authorization code / redirect URL here:",placeholder:s}),a,d=t;if(c.type==="callback")a=c.value;else{let u=Zr(c.input);if(u.state&&u.state!==t)throw Error("OAuth state mismatch");a=u.code,d=u.state??t}if(!a)throw Error("Missing authorization code");return e.notify({type:"progress",message:"Exchanging authorization code for tokens..."}),await ts(a,d,t,s,e.signal)}finally{r?.close()}}async function Fd(e){let{verifier:t,challenge:o}=await G(),n=new URLSearchParams({code:"true",client_id:kt,response_type:"code",redirect_uri:Kr,scope:Qr,code_challenge:o,code_challenge_method:"S256",state:t});e.notify({type:"auth_url",url:`${Xr}?${n.toString()}`,instructions:"Complete login in your browser, then copy the code Anthropic shows and paste it here."});let r=await e.prompt({type:"manual_code",message:"Paste the code Anthropic shows after you sign in:",placeholder:"code#state",signal:e.signal}),s=Zr(r);if(s.state&&s.state!==t)throw Error("OAuth state mismatch");if(!s.code)throw Error("Missing authorization code");return e.notify({type:"progress",message:"Exchanging authorization code for tokens..."}),await ts(s.code,s.state??t,t,Kr,e.signal)}async function Hd(e,t){let o;try{o=await es(ge,{grant_type:"refresh_token",client_id:kt,refresh_token:e},t)}catch(r){throw Error(`Anthropic token refresh request failed. url=${ge}; details=${Ge(r)}`)}let n;try{n=JSON.parse(o)}catch(r){throw Error(`Anthropic token refresh returned invalid JSON. url=${ge}; body=${o}; details=${Ge(r)}`)}return{type:"oauth",refresh:n.refresh_token,access:n.access_token,expires:Date.now()+n.expires_in*1000-300000}}var os={name:"Anthropic (Claude Pro/Max)",isSubscription:!0,async login(e){let t=await e.prompt({type:"select",message:"Select Anthropic login method:",options:[{id:jr,label:"Browser login (default)"},{id:zr,label:"Copy code login (headless)"}]});if(t===zr)return Fd(e);if(t!==jr)throw Error(`Unknown Anthropic login method: ${t}`);return $d(e)},refresh:(e,t)=>Hd(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};function Ot(e,t){return new Promise((o,n)=>{t.throwIfAborted();let r=()=>{clearTimeout(s),n(t.reason)},s=setTimeout(()=>{t.removeEventListener("abort",r),o()},e);t.addEventListener("abort",r,{once:!0})})}function ns(e,t,o){return new Promise((n,r)=>{if(t.aborted){r(Error(o));return}let s=()=>{clearTimeout(i),r(Error(o))},i=setTimeout(()=>{t.removeEventListener("abort",s),n()},e);t.addEventListener("abort",s,{once:!0})})}async function P(e){let t=typeof e.expiresInSeconds==="number"?Date.now()+e.expiresInSeconds*1000:Number.POSITIVE_INFINITY,o=Math.max(1000,Math.floor((e.intervalSeconds??5)*1000)),n=0;if(e.waitBeforeFirstPoll){let r=t-Date.now();if(r>0)await ns(Math.min(o,r),e.signal,"Login cancelled")}while(Date.now()<t){if(e.signal.aborted)throw Error("Login cancelled");let r=await e.poll();if(r.status==="complete")return r.value;if(r.status==="failed")throw Error(r.message);if(r.status==="slow_down")n+=1,o=typeof r.intervalSeconds==="number"&&Number.isFinite(r.intervalSeconds)&&r.intervalSeconds>0?Math.max(1000,Math.floor(r.intervalSeconds*1000)):Math.max(1000,o+5000);let s=t-Date.now();if(s<=0)break;await ns(Math.min(o,s),e.signal,"Login cancelled")}throw Error(n>0?"Device flow timed out after one or more slow_down responses. This is often caused by clock drift in WSL or VM environments. Please sync or restart the VM clock and try again.":"Device flow timed out")}var Wd=(e)=>atob(e),ss=Wd("SXYxLmI1MDdhMDhjODdlY2ZlOTg="),ao={"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},Vd="2026-06-01";function is(e){let t=e.trim();if(!t)return null;try{return(t.includes("://")?new URL(t):new URL(`https://${t}`)).hostname}catch{return null}}function co(e){return{deviceCodeUrl:`https://${e}/login/device/code`,accessTokenUrl:`https://${e}/login/oauth/access_token`,copilotTokenUrl:`https://api.${e}/copilot_internal/v2/token`}}function Kd(e){let t=e.match(/proxy-ep=([^;]+)/);if(!t)return null;return`https://${t[1].replace(/^proxy\./,"api.")}`}function uo(e,t){if(e){let o=Kd(e);if(o)return o}if(t)return`https://copilot-api.${t}`;return"https://api.individual.githubcopilot.com"}function be(e){return e&&typeof e==="object"?e:void 0}function jd(e,t){let o=be(e)?.data;if(!Array.isArray(o))throw Error("Invalid Copilot models response");let n=o.flatMap((a)=>{let d=be(a),u=d?.id;if(!d||typeof u!=="string")return[];let l=be(d.capabilities);if(be(l?.supports)?.tool_calls===!1)return[];return[{id:u,pickerEnabled:d.model_picker_enabled===!0,policyState:be(d.policy)?.state}]}),r=n.filter((a)=>a.pickerEnabled&&a.policyState!=="disabled").map((a)=>a.id),s=t&&r.length===0,i=r.length>0||!t?r:n.filter((a)=>a.policyState==="enabled").map((a)=>a.id),c=n.filter((a)=>a.policyState==="unconfigured"&&Object.hasOwn(yo,a.id)&&(a.pickerEnabled||s)).map((a)=>a.id);return{availableModelIds:i,policyModelIds:c}}async function as(e,t,o,n){let r=n.maxRetries>0&&n.maxElapsedMs>0?AbortSignal.timeout(n.maxElapsedMs):void 0,s=r?AbortSignal.any([o,r]):o,i=r?Date.now()+n.maxElapsedMs:void 0;for(let c=0;;c++){let a=await fetch(e,{...t,signal:AbortSignal.any([s,AbortSignal.timeout(5000)])});if(a.status!==429||c===n.maxRetries)return a;let d=a.headers.get("retry-after"),u=500*2**c;if(d){let l=Number.parseFloat(d);if(u=Number.isNaN(l)?Date.parse(d)-Date.now():l*1000,!Number.isFinite(u))return a}if(u=Math.max(0,u),i!==void 0&&u>=i-Date.now())return a;await a.body?.cancel(),await Ot(u,s)}}async function cs(e,t,o,n){let r=uo(e,t),s=r==="https://api.individual.githubcopilot.com",i=await as(`${r}/models`,{headers:{Accept:"application/json",Authorization:`Bearer ${e}`,...ao,"X-GitHub-Api-Version":Vd}},o,n);if(!i.ok)throw Error(`${i.status} ${i.statusText}: ${await i.text()}`);return jd(await i.json(),s)}async function lo(e,t){let o=await fetch(e,t);if(!o.ok){let n=await o.text();throw Error(`${o.status} ${o.statusText}: ${n}`)}return o.json()}async function zd(e,t){let o=co(e),n=await lo(o.deviceCodeUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:ss,scope:"read:user"}),signal:t});if(!n||typeof n!=="object")throw Error("Invalid device code response");let{device_code:r,user_code:s,verification_uri:i,interval:c,expires_in:a}=n;if(typeof r!=="string"||typeof s!=="string"||typeof i!=="string"||c!==void 0&&typeof c!=="number"||typeof a!=="number")throw Error("Invalid device code response fields");let d;try{d=new URL(i)}catch{throw Error("Untrusted verification_uri in device code response")}if(d.protocol!=="https:"&&d.protocol!=="http:")throw Error("Untrusted verification_uri in device code response");return{device_code:r,user_code:s,verification_uri:d.href,interval:c,expires_in:a}}async function Xd(e,t,o){let n=co(e);return P({intervalSeconds:t.interval,expiresInSeconds:t.expires_in,waitBeforeFirstPoll:!0,signal:o,poll:async()=>{let r=await lo(n.accessTokenUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:ss,device_code:t.device_code,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),signal:o});if(r&&typeof r==="object"&&typeof r.access_token==="string")return{status:"complete",value:r.access_token};if(r&&typeof r==="object"&&typeof r.error==="string"){let{error:s,error_description:i,interval:c}=r;if(s==="authorization_pending")return{status:"pending"};if(s==="slow_down")return{status:"slow_down",intervalSeconds:typeof c==="number"?c:void 0};let a=i?`: ${i}`:"";return{status:"failed",message:`Device flow failed: ${s}${a}`}}return{status:"failed",message:"Invalid device token response"}}})}async function ds(e,t,o){let r=co(t||"github.com"),s=await lo(r.copilotTokenUrl,{headers:{Accept:"application/json",Authorization:`Bearer ${e}`,...ao},signal:o});if(!s||typeof s!=="object")throw Error("Invalid Copilot token response");let{token:i,expires_at:c}=s;if(typeof i!=="string"||typeof c!=="number")throw Error("Invalid Copilot token response fields");return{type:"oauth",refresh:e,access:i,expires:c*1000-300000,enterpriseUrl:t}}async function qd(e,t,o){let n=await ds(e,t,o),{availableModelIds:r}=await cs(n.access,t,o,{maxRetries:0,maxElapsedMs:0});return{...n,availableModelIds:r}}async function Jd(e,t,o,n){let s=`${uo(e,o)}/models/${t}/policy`,i;try{i=await as(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`,...ao,"openai-intent":"chat-policy","x-interaction-type":"chat-policy"},body:JSON.stringify({state:"enabled"})},n,{maxRetries:2,maxElapsedMs:5000})}catch(c){if(n.aborted)throw c;return!1}if(i.status===429)throw Error(`${i.status} ${i.statusText}: ${await i.text()}`);return i.ok}async function Yd(e,t,o,n){let r=[];for(let s of t)try{if(await Jd(e,s,o,n))r.push(s)}catch(i){if(n.aborted)throw i;break}return r}async function Qd(e){let t=await e.prompt({type:"text",message:"GitHub Enterprise URL/domain (blank for github.com)",placeholder:"company.ghe.com"});if(e.signal.aborted)throw Error("Login cancelled");let o=t.trim(),n=is(t);if(o&&!n)throw Error("Invalid GitHub Enterprise URL/domain");let r=n||"github.com",s=await zd(r,e.signal);e.notify({type:"device_code",userCode:s.user_code,verificationUri:s.verification_uri,intervalSeconds:s.interval,expiresInSeconds:s.expires_in});let i=await Xd(r,s,e.signal),c=await ds(i,n??void 0,e.signal),a=await cs(c.access,n??void 0,e.signal,{maxRetries:2,maxElapsedMs:5000}),d=[];if(a.policyModelIds.length>0)e.notify({type:"progress",message:"Enabling models..."}),d=await Yd(c.access,a.policyModelIds,n??void 0,e.signal);return{...c,availableModelIds:[...new Set([...a.availableModelIds,...d])]}}function rs(e){let t=e.enterpriseUrl;if(typeof t!=="string"||!t)return;return is(t)??void 0}var us={name:"GitHub Copilot",isSubscription:!0,login:Qd,refresh:(e,t)=>qd(e.refresh,rs(e),t),async toAuth(e){return{apiKey:e.access,baseUrl:uo(e.access,rs(e))}}};var po="17e5f671-d194-4dfb-9706-5516cb48c098",Zd="https://auth.kimi.com",eu=900,tu=5,ou=30000,ls=3;function _s(){return(O("KIMI_CODE_OAUTH_HOST")||O("KIMI_OAUTH_HOST")||Zd).replace(/\/+$/,"")}function _o(e){return AbortSignal.any([AbortSignal.timeout(ou),e])}function ho(e){return new URLSearchParams(e).toString()}async function fo(e){try{let t=await e.json();return t&&typeof t==="object"?t:null}catch{return null}}function ps(e){if(typeof e!=="string"||!e)return null;try{let t=new URL(e);if(t.protocol!=="https:"&&t.protocol!=="http:")return null;return t.href}catch{return null}}async function nu(e,t){let o=await fetch(`${e}/api/oauth/device_authorization`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:ho({client_id:po}),signal:_o(t)});if(!o.ok){let u=await o.text().catch(()=>"");throw Error(`Kimi Code device authorization failed with status ${o.status}${u?`: ${u}`:""}`)}let n=await fo(o),r=n?.device_code,s=n?.user_code,i=n?.verification_uri,c=n?.verification_uri_complete;if(typeof r!=="string"||typeof s!=="string"||typeof i!=="string"||typeof c!=="string"||!ps(c)||!ps(i))throw Error(`Invalid Kimi Code device authorization response: ${JSON.stringify(n)}`);let a=n?.interval,d=n?.expires_in;return{deviceCode:r,userCode:s,verificationUri:i,verificationUriComplete:c,intervalSeconds:typeof a==="number"&&Number.isFinite(a)&&a>0?a:tu,expiresInSeconds:typeof d==="number"&&Number.isFinite(d)&&d>0?d:eu}}function hs(e,t){let o=e?.access_token,n=e?.refresh_token,r=e?.expires_in;if(typeof o!=="string"||!o||typeof n!=="string"||!n||typeof r!=="number"||!Number.isFinite(r)||r<=0)throw Error(`Kimi Code token ${t} response missing fields: ${JSON.stringify(e)}`);return{access:o,refresh:n,expires:Date.now()+r*1000}}async function ru(e,t,o){return P({intervalSeconds:t.intervalSeconds,expiresInSeconds:t.expiresInSeconds,waitBeforeFirstPoll:!0,signal:o,poll:async()=>{let n=await fetch(`${e}/api/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:ho({client_id:po,device_code:t.deviceCode,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),signal:_o(o)});if(n.status>=500){let c=await n.text().catch(()=>"");return{status:"failed",message:`Kimi Code device token request failed with status ${n.status}${c?`: ${c}`:""}`}}let r=await fo(n);if(n.ok&&typeof r?.access_token==="string")try{return{status:"complete",value:hs(r,"poll")}}catch(c){return{status:"failed",message:c instanceof Error?c.message:String(c)}}let s=r?.error,i=typeof r?.error_description==="string"?`: ${r.error_description}`:"";if(s==="authorization_pending")return{status:"pending"};if(s==="slow_down"){let c=r?.interval;return{status:"slow_down",intervalSeconds:typeof c==="number"&&c>0?c:void 0}}if(s==="expired_token")return{status:"failed",message:"Kimi Code device authorization expired. Please restart login."};if(s==="access_denied")return{status:"failed",message:"Kimi Code login was denied."};return{status:"failed",message:`Kimi Code device token request failed (status ${n.status})${typeof s==="string"?`: ${s}${i}`:""}`}}})}function su(e){return e.status===429||e.status>=500}async function iu(e,t,o){let n;for(let r=0;r<=ls;r++){if(r>0)await Ot(1000*2**(r-1),o);if(o.aborted)throw Error("Kimi Code token refresh aborted");let s;try{s=await fetch(`${e}/api/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:ho({client_id:po,grant_type:"refresh_token",refresh_token:t}),signal:_o(o)})}catch(a){n=a instanceof Error?a:Error(String(a));continue}let i=await fo(s);if(s.ok)return hs(i,"refresh");if(s.status===401||s.status===403||i?.error==="invalid_grant"){let a=typeof i?.error_description==="string"?`: ${i.error_description}`:"";throw Error(`Kimi Code token refresh unauthorized (status ${s.status})${a}`)}if(su(s)&&r<ls){n=Error(`Kimi Code token refresh failed with status ${s.status}`);continue}let c=JSON.stringify(i);throw Error(`Kimi Code token refresh failed with status ${s.status}${c?`: ${c}`:""}`)}throw n??Error("Kimi Code token refresh failed")}async function au(e){let t=_s(),o=await nu(t,e.signal);e.notify({type:"device_code",userCode:o.userCode,verificationUri:o.verificationUriComplete,intervalSeconds:o.intervalSeconds,expiresInSeconds:o.expiresInSeconds});let n=await ru(t,o,e.signal);return{type:"oauth",access:n.access,refresh:n.refresh,expires:n.expires}}var fs={name:"Kimi Code (subscription)",isSubscription:!0,loginLabel:"Sign in with Kimi Code",login:au,refresh:async(e,t)=>{let o=await iu(_s(),e.refresh,t);return{type:"oauth",access:o.access,refresh:o.refresh,expires:o.expires}},async toAuth(e){return{headers:{Authorization:`Bearer ${e.access}`}}}};var ms="1031625952748946",gs="https://auth.meta.com",cu=`${gs}/oidc/device/authorization/`,du=`${gs}/oidc/device/token/`,uu="https://api.meta.ai/muse-code/key",lu=86400000,pu=30000;function Eo(e){return AbortSignal.any([AbortSignal.timeout(pu),e])}async function Ao(e){try{let t=await e.json();return t&&typeof t==="object"?t:null}catch{return null}}function Pt(e){for(let t of["error_description","detail","message","error"]){let o=e?.[t];if(typeof o==="string"&&o.trim())return`: ${o.trim()}`}return""}function mo(e){if(typeof e!=="string"||!e)return null;try{let t=new URL(e);if(t.protocol!=="https:"&&t.protocol!=="http:")return null;return t.href}catch{return null}}function Co(e){return typeof e==="number"&&Number.isFinite(e)&&e>0?e:void 0}async function _u(e){let t=await fetch(cu,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({client_id:ms}).toString(),signal:Eo(e)}),o=await Ao(t);if(!t.ok)throw Error(`Meta device authorization failed with status ${t.status}${Pt(o)}`);let n=o?.device_code,r=o?.user_code,s=mo(o?.verification_uri_complete)??mo(o?.verification_uri);if(typeof n!=="string"||!n||typeof r!=="string"||!r||!s)throw Error(`Invalid Meta device authorization response: ${JSON.stringify(o)}`);return{deviceCode:n,userCode:r,verificationUri:s,intervalSeconds:Co(o?.interval),expiresInSeconds:Co(o?.expires_in)}}async function hu(e,t){return P({intervalSeconds:e.intervalSeconds,expiresInSeconds:e.expiresInSeconds,waitBeforeFirstPoll:!0,signal:t,poll:async()=>{let o=await fetch(du,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:e.deviceCode,client_id:ms}).toString(),signal:Eo(t)}),n=await Ao(o);if(o.ok&&typeof n?.access_token==="string"&&n.access_token)return{status:"complete",value:n.access_token};switch(n?.error){case"authorization_pending":return{status:"pending"};case"slow_down":return{status:"slow_down",intervalSeconds:Co(n?.interval)};case"access_denied":return{status:"failed",message:"Meta login was denied."};case"expired_token":return{status:"failed",message:"Meta device authorization expired. Please restart login."};default:return{status:"failed",message:`Meta device token request failed with status ${o.status}${Pt(n)}`}}}})}async function Cs(e,t){let o=await fetch(uu,{method:"POST",headers:{Accept:"application/json",Authorization:`Bearer ${e}`,"Content-Type":"application/json","x-api-version":"1.0.0"},body:"{}",signal:Eo(t)}),n=await Ao(o);if(o.status===401||o.status===403)throw Error(`Meta session expired (status ${o.status}). Run \`/login meta\` to sign in again.${Pt(n)}`);if(!o.ok)throw Error(`Meta API key mint failed with status ${o.status}${Pt(n)}`);let r=n?.api_key;if(typeof r!=="string"||!r){let s=mo(n?.action_url);throw Error(`Meta did not issue an API key.${s?` Complete setup at ${s}`:""}`)}return{type:"oauth",refresh:e,access:r,expires:Date.now()+lu}}async function fu(e){try{let t=await _u(e.signal);e.notify({type:"device_code",userCode:t.userCode,verificationUri:t.verificationUri,intervalSeconds:t.intervalSeconds,expiresInSeconds:t.expiresInSeconds});let o=await hu(t,e.signal);return e.notify({type:"progress",message:"Enabling Meta Model API access..."}),await Cs(o,e.signal)}catch(t){if(e.signal.aborted)throw Error("Login cancelled");throw t}}var Ss={name:"Meta (Muse subscription)",isSubscription:!0,loginLabel:"Sign in with Meta",login:fu,refresh:(e,t)=>Cs(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};import{randomBytes as mu}from"crypto";import{createServer as gu}from"http";var Cu="dynamic_agent_client",Su="Pi",Eu=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,vu="https://auth.openai.com/api/accounts/authorize",Au="https://auth.openai.com/api/accounts/oauth/token",To="https://api.openai.com/v1",Ru=O("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1",wo=1455,vs="/auth/callback",Ce=`http://127.0.0.1:${wo}${vs}`,Io="chatgpt.tokens.use.direct",yu=`openid profile email offline_access resource.invoke ${Io}`,xu=180000;function Es(){return mu(32).toString("base64url")}function As(e,t){let o=e.searchParams.get("code");if(!o)throw Error("Missing authorization code");let n=e.searchParams.get("state");if(!n)throw Error("Missing OAuth state");if(n!==t)throw Error("OAuth state mismatch");let r=e.searchParams.get("client_id")?.trim();if(!r)throw Error("OpenAI OAuth registration callback did not contain an issued client ID");return{code:o,clientId:r}}function Iu(e,t){let o;try{o=new URL(e.trim())}catch{throw Error("Paste the full callback URL from the browser")}let n=new URL(Ce);if(o.origin!==n.origin||o.pathname!==n.pathname)throw Error(`The pasted callback URL must start with ${Ce}`);let r=o.searchParams.get("error");if(r)throw Error(`ChatGPT authorization failed: ${r}`);return As(o,t)}function Le(e,t,o){e.writeHead(t,{"Content-Type":"text/html; charset=utf-8"}),e.end(o)}function Tu(e){return new Promise((t,o)=>{let n,r,s=new Promise((c,a)=>{n=c,r=a}),i=gu((c,a)=>{try{let d=new URL(c.url||"",Ce);if(d.pathname!==vs){Le(a,404,k("Callback route not found."));return}let u=d.searchParams.get("error");if(u){Le(a,400,k("ChatGPT was not connected.",`Error: ${u}`)),r(Error(`ChatGPT authorization failed: ${u}`));return}let l;try{l=As(d,e)}catch(g){let h=g instanceof Error?g.message:"Invalid callback";Le(a,400,k(h));return}Le(a,200,wt("ChatGPT authentication completed. You can close this window.")),n(l)}catch{Le(a,500,k("Internal error while processing the callback."))}});i.once("error",o),i.listen(wo,Ru,()=>{i.removeListener("error",o),i.on("error",r),t({server:i,result:s})})})}async function Rs(e,t){let o=await fetch(Au,{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:e,signal:t});if(!o.ok){let r=await o.text().catch(()=>"");throw Error(`OpenAI OAuth token request failed (${o.status}): ${r||o.statusText}`)}let n=await o.json();if(typeof n!=="object"||n===null||Array.isArray(n))throw Error("OpenAI OAuth token response must be an object");return n}function Ro(e,t){if(typeof e!=="string"||e.trim().length===0)throw Error(`OpenAI OAuth token response has invalid ${t}`);return e}function ys(e,t,o){let n=Ro(e.access_token,"access_token"),r=Ro(e.refresh_token,"refresh_token"),s=Ro(e.scope,"scope"),i=typeof e.id_token==="string"?e.id_token:o?.idToken;if(typeof e.expires_in!=="number"||!Number.isFinite(e.expires_in)||e.expires_in<=0)throw Error("OpenAI OAuth token response has invalid expires_in");let c=s.trim().split(/\s+/).filter(Boolean);if(!c.includes(Io))throw Error(`OpenAI OAuth grant did not include ${Io}`);return{type:"oauth",...i?{idToken:i}:{},access:n,refresh:r,expires:Date.now()+e.expires_in*1000-xu,clientId:t,scopes:c}}async function wu(e,t,o,n){let r=await Rs(new URLSearchParams({grant_type:"authorization_code",client_id:o,code:e,code_verifier:t,redirect_uri:Ce,resource:To}),n);if(typeof r.id_token!=="string"||r.id_token.trim().length===0)throw Error("OpenAI OAuth token response did not contain an ID token");return ys(r,o)}async function ku(e,t){let o=e.clientId;if(typeof o!=="string"||o.trim().length===0)throw Error("Stored OpenAI OAuth credential does not contain an issued client ID; reconnect ChatGPT");let n=await Rs(new URLSearchParams({grant_type:"refresh_token",client_id:o,refresh_token:e.refresh,resource:To}),t);return ys(n,o,e)}function Ou(e){if(!e||!Eu.test(e))throw Error("Sign in with ChatGPT requires a device ID (UUID) for this installation");return`urn:uuid:${e.toLowerCase()}`}async function Pu(e,t){let o=Ou(t?.getDeviceId?.()),{verifier:n,challenge:r}=await G(),s=Es(),i=Es(),c=await Tu(s).catch((l)=>{if(!(l instanceof Error&&("code"in l)&&l.code==="EADDRINUSE"))throw l;throw Error(`Port ${wo} is in use, probably by an unfinished login in another pi session or by the Codex CLI. Cancel that login and try again.`)}),a=new URL(vu);a.search=new URLSearchParams({client_id:Cu,agent_name_hint:t?.agentName??Su,ext_agent_host_id:o,response_type:"code",redirect_uri:Ce,resource:To,scope:yu,state:s,code_challenge:r,code_challenge_method:"S256",nonce:i}).toString(),e.notify({type:"auth_url",url:a.toString(),instructions:"Complete sign-in in your browser. If the callback does not complete, paste the final redirect URL here."});let d=new AbortController,u=e.prompt({type:"manual_code",message:"Complete login in your browser, or paste the final redirect URL here:",placeholder:Ce,signal:AbortSignal.any([d.signal,e.signal])}).then((l)=>Iu(l,s));try{let l=await Promise.race([c.result,u]);return e.notify({type:"progress",message:"Exchanging authorization code for tokens..."}),await wu(l.code,n,l.clientId,e.signal)}catch(l){if(e.signal.aborted)throw Error("Login cancelled");throw l}finally{d.abort(),c.server.close(),c.server.closeAllConnections()}}var xs={name:"OpenAI (ChatGPT subscription)",isSubscription:!0,loginLabel:"Sign in with ChatGPT",login:Pu,refresh:ku,async toAuth(e){return{apiKey:e.access}}};var ko=null;if(typeof process<"u"&&(process.versions?.node||process.versions?.bun))import("crypto").then((e)=>{ko=e.randomBytes});var Gt="app_EMoamEEZ73f0CkXaXp7hrann",Se="https://auth.openai.com",Gu=`${Se}/oauth/authorize`,ws=`${Se}/oauth/token`,Oo="http://localhost:1455/auth/callback",bu=`${Se}/api/accounts/deviceauth/usercode`,Nu=`${Se}/api/accounts/deviceauth/token`,Lu=`${Se}/codex/device`,Mu=`${Se}/deviceauth/callback`,ks=900,Is="browser",Ts="device_code",Uu="openid profile email offline_access",Bu="https://api.openai.com/auth";function Du(){return O("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1"}function $u(){if(!ko)throw Error("OpenAI Codex OAuth is only available in Node.js environments");return ko(16).toString("hex")}function Fu(e){let t=e.trim();if(!t)return{};try{let o=new URL(t);return{code:o.searchParams.get("code")??void 0,state:o.searchParams.get("state")??void 0}}catch{}if(t.includes("#")){let[o,n]=t.split("#",2);return{code:o,state:n}}if(t.includes("code=")){let o=new URLSearchParams(t);return{code:o.get("code")??void 0,state:o.get("state")??void 0}}return{code:t}}function Hu(e){try{let t=e.split(".");if(t.length!==3)return null;let o=t[1]??"",n=atob(o);return JSON.parse(n)}catch{return null}}async function Po(e,t){try{return await fetch(e,t)}catch(o){if(t.signal?.aborted)throw Error("Login cancelled");throw o}}async function Os(e,t){if(!e.ok){let r=await e.text().catch(()=>"");throw Error(`OpenAI Codex token ${t} failed (${e.status}): ${r||e.statusText}`)}let n=await e.json();if(!n?.access_token||!n.refresh_token||typeof n.expires_in!=="number")throw Error(`OpenAI Codex token ${t} response missing fields: ${JSON.stringify(n)}`);return{access:n.access_token,refresh:n.refresh_token,expires:Date.now()+n.expires_in*1000}}async function Wu(e,t,o,n){let r=await Po(ws,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",client_id:Gt,code:e,code_verifier:t,redirect_uri:o}),signal:n});return Os(r,"exchange")}async function Vu(e,t){let o;try{o=await fetch(ws,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:e,client_id:Gt}),signal:t})}catch(n){throw Error(`OpenAI Codex token refresh error: ${n instanceof Error?n.message:String(n)}`)}return Os(o,"refresh")}async function Ku(e){let t=await Po(bu,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:Gt}),signal:e});if(!t.ok){if(t.status===404)throw Error("OpenAI Codex device code login is not enabled for this server. Use browser login or verify the server URL.");let s=await t.text().catch(()=>"");throw Error(`OpenAI Codex device code request failed with status ${t.status}${s?`: ${s}`:""}`)}let n=await t.json(),r=typeof n?.interval==="string"?Number(n.interval.trim()):n?.interval;if(!n?.device_auth_id||!n.user_code||typeof r!=="number"||!Number.isFinite(r)||r<0)throw Error(`Invalid OpenAI Codex device code response: ${JSON.stringify(n)}`);return{deviceAuthId:n.device_auth_id,userCode:n.user_code,intervalSeconds:r}}async function ju(e,t){return P({intervalSeconds:e.intervalSeconds,expiresInSeconds:ks,signal:t,poll:async()=>{let o=await Po(Nu,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_auth_id:e.deviceAuthId,user_code:e.userCode}),signal:t});if(o.ok){let i=await o.json();if(!i?.authorization_code||!i.code_verifier)return{status:"failed",message:`Invalid OpenAI Codex device auth token response: ${JSON.stringify(i)}`};return{status:"complete",value:{authorizationCode:i.authorization_code,codeVerifier:i.code_verifier}}}if(o.status===403||o.status===404)return{status:"pending"};let n=await o.text().catch(()=>""),r;try{let i=JSON.parse(n)?.error;r=typeof i==="object"?i?.code:i}catch{}if(r==="deviceauth_authorization_pending")return{status:"pending"};if(r==="slow_down")return{status:"slow_down"};return{status:"failed",message:`OpenAI Codex device auth failed with status ${o.status}${n?`: ${n}`:""}`}}})}async function zu(e="pi"){let{verifier:t,challenge:o}=await G(),n=$u(),r=new URL(Gu);return r.searchParams.set("response_type","code"),r.searchParams.set("client_id",Gt),r.searchParams.set("redirect_uri",Oo),r.searchParams.set("scope",Uu),r.searchParams.set("code_challenge",o),r.searchParams.set("code_challenge_method","S256"),r.searchParams.set("state",n),r.searchParams.set("id_token_add_organizations","true"),r.searchParams.set("codex_cli_simplified_flow","true"),r.searchParams.set("originator",e),{verifier:t,state:n,url:r.toString()}}function Xu(e){let n=Hu(e)?.[Bu]?.chatgpt_account_id;return typeof n==="string"&&n.length>0?n:null}function Ps(e){let t=Xu(e.access);if(!t)throw Error("Failed to extract accountId from token");return{type:"oauth",access:e.access,refresh:e.refresh,expires:e.expires,accountId:t}}async function Gs(e,t,o,n){return Ps(await Wu(e,t,o,n))}async function qu(e){let t=await Ku(e.signal);e.notify({type:"device_code",userCode:t.userCode,verificationUri:Lu,intervalSeconds:t.intervalSeconds,expiresInSeconds:ks});let o=await ju(t,e.signal);return Gs(o.authorizationCode,o.codeVerifier,Mu,e.signal)}async function Ju(e,t){let{verifier:o,state:n,url:r}=await zu(t?.agentName),s=await D({providerName:"OpenAI",host:Du(),port:1455,path:"/auth/callback",state:n,complete:async(i)=>i,signal:e.signal}).catch(()=>{return});e.notify({type:"auth_url",url:r,instructions:"A browser window should open. Complete login to finish."});try{let i=await _e(e,s,{message:"Complete login in your browser, or paste the authorization code / redirect URL here:",placeholder:Oo}),c;if(i.type==="callback")c=i.value;else{let a=Fu(i.input);if(a.state&&a.state!==n)throw Error("State mismatch");c=a.code}if(!c)throw Error("Missing authorization code");return await Gs(c,o,Oo,e.signal)}finally{s?.close()}}async function Yu(e,t){return Ps(await Vu(e,t))}var bs={name:"OpenAI (ChatGPT Plus/Pro)",isSubscription:!0,async login(e,t){let o=await e.prompt({type:"select",message:"Select OpenAI Codex login method:",options:[{id:Is,label:"Browser login (default)"},{id:Ts,label:"Device code login (headless)"}]});if(o===Ts)return qu(e);if(o!==Is)throw Error(`Unknown OpenAI Codex login method: ${o}`);return Ju(e,t)},refresh:(e,t)=>Yu(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};var Qu="https://openrouter.ai/auth",Zu="https://openrouter.ai/api/v1/auth/keys",el=300000,tl=30000;function ol(){return O("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1"}function nl(e){let t=e.trim();if(!t)return;try{return new URL(t).searchParams.get("code")??void 0}catch{}if(t.includes("code="))return new URLSearchParams(t).get("code")??void 0;return t}function rl(e){if(typeof e.error_description==="string")return e.error_description;if(typeof e.message==="string")return e.message;if(typeof e.error==="string")return e.error;if(e.error&&typeof e.error==="object"&&!Array.isArray(e.error)){let t=e.error.message;if(typeof t==="string")return t}return}async function Ns(e,t,o){if(o.aborted)throw Error("Login cancelled");let n=new AbortController,r=()=>n.abort(o.reason);o.addEventListener("abort",r,{once:!0});let s=setTimeout(()=>n.abort(Error("OpenRouter OAuth token exchange timed out")),tl),i,c={};try{i=await fetch(Zu,{method:"POST",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({code:e,code_verifier:t,code_challenge_method:"S256"}),signal:n.signal});try{let a=await i.json();if(a&&typeof a==="object"&&!Array.isArray(a))c=a}catch{if(i.ok)throw Error("OpenRouter OAuth returned invalid JSON")}}catch(a){if(o.aborted)throw Error("Login cancelled");if(n.signal.aborted)throw Error("OpenRouter OAuth token exchange timed out");throw a}finally{clearTimeout(s),o.removeEventListener("abort",r)}if(!i.ok){let a=rl(c);throw Error(`OpenRouter OAuth key exchange failed (HTTP ${i.status})${a?`: ${a}`:""}`)}if(typeof c.key!=="string"||c.key.length===0)throw Error('OpenRouter OAuth response carries no "key"');return{type:"oauth",access:c.key,refresh:"",expires:Number.MAX_SAFE_INTEGER}}async function sl(e){let{verifier:t,challenge:o}=await G(),n=await D({providerName:"OpenRouter",host:ol(),port:0,path:`/oauth/callback/${crypto.randomUUID()}`,complete:(r)=>Ns(r,t,e.signal),signal:e.signal,timeoutMs:el});try{let r=new URL(Qu);r.search=new URLSearchParams({callback_url:n.redirectUri,code_challenge:o,code_challenge_method:"S256"}).toString(),e.notify({type:"progress",message:`Listening for OpenRouter OAuth callback on ${n.redirectUri}`}),e.notify({type:"auth_url",url:r.toString(),instructions:"Complete sign-in in your browser. If the browser is on another machine, paste the final redirect URL here."});let s=await _e(e,n,{message:"Complete sign-in in your browser, or paste the authorization code / redirect URL here:",placeholder:n.redirectUri});if(s.type==="callback")return s.value;let i=nl(s.input);if(!i)throw Error("Missing authorization code");return e.notify({type:"progress",message:"Exchanging authorization code for an API key..."}),await Ns(i,t,e.signal)}finally{n.close()}}var Ls={name:"OpenRouter OAuth",loginLabel:"Sign in with OpenRouter",login:sl,async refresh(e,t){return e},async toAuth(e){return{apiKey:e.access}}};var Bs="127.0.0.1",Ds=1456,$s="/oauth/callback",Go=`http://${Bs}:${Ds}${$s}`,il=60000,Ms="browser",Us="device-code",Be="pi-gateway",Fs="gateway offline_access",al="urn:ietf:params:oauth:grant-type:device_code";async function cl(e,t){let o=await fetch(new URL("/v1/oauth",e),{headers:{accept:"application/json"},signal:t});if(!o.ok)throw Error(`Could not load Radius OAuth config from ${e}: ${o.status} ${await o.text()}`);let n=await o.json();if(typeof n.authorizationEndpoint!=="string")throw Error(`Invalid Radius OAuth config from ${e}`);return{authorizationEndpoint:n.authorizationEndpoint}}class bo extends Error{status;oauthError;constructor(e,t,o,n){let r=t?o?`${t}: ${o}`:t:o||String(e);super(`${n}: ${r}`);this.status=e,this.oauthError=t}}async function Hs(e,t){let o=await e.text().catch(()=>""),n,r;if(o)try{let s=JSON.parse(o);n=typeof s.error==="string"?s.error:void 0,r=typeof s.error_description==="string"?s.error_description:void 0}catch{r=o}return new bo(e.status,n,r,t)}async function No(e,t,o){let n;try{n=await fetch(new URL("/v1/oauth/token",e),{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:t,signal:o})}catch(s){if(o.aborted)throw Error("Login cancelled");throw s}if(!n.ok)throw await Hs(n,"Radius OAuth token request failed");let r=await n.json();return{type:"oauth",access:r.access_token,refresh:r.refresh_token,expires:Date.now()+r.expires_in*1000-il,scope:r.scope}}async function dl(e,t,o){let{verifier:n,challenge:r}=await G(),s=crypto.randomUUID(),i=new URL(t);i.search=new URLSearchParams({response_type:"code",client_id:Be,redirect_uri:Go,scope:Fs,code_challenge:r,code_challenge_method:"S256",handoff:"url",state:s}).toString();let c=await D({providerName:"Radius",host:Bs,port:Ds,path:$s,state:s,complete:(a)=>No(e,new URLSearchParams({grant_type:"authorization_code",client_id:Be,redirect_uri:Go,code:a,code_verifier:n}),o.signal),signal:o.signal});o.notify({type:"progress",message:`Listening for OAuth callback on ${Go}`}),o.notify({type:"auth_url",url:i.toString(),instructions:"Continue in your browser."});try{let a=await c.wait();if(!a)throw Error("OAuth callback did not complete.");return a}finally{c.close()}}async function ul(e,t){let o;try{o=await fetch(new URL("/v1/oauth/device",e),{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:Be,scope:Fs}),signal:t})}catch(r){if(t.aborted)throw Error("Login cancelled");throw r}if(!o.ok)throw await Hs(o,"Radius OAuth device authorization failed");let n=await o.json();if(!n.device_code||!n.user_code||!n.verification_uri||!n.expires_in)throw Error("Radius OAuth device authorization response is missing required fields");return{device_code:n.device_code,user_code:n.user_code,verification_uri:n.verification_uri,expires_in:n.expires_in,interval:n.interval}}async function ll(e,t){let o=await ul(e,t.signal);return t.notify({type:"device_code",userCode:o.user_code,verificationUri:o.verification_uri,intervalSeconds:o.interval,expiresInSeconds:o.expires_in}),P({intervalSeconds:o.interval,expiresInSeconds:o.expires_in,signal:t.signal,poll:async()=>{try{return{status:"complete",value:await No(e,new URLSearchParams({grant_type:al,client_id:Be,device_code:o.device_code}),t.signal)}}catch(n){if(!(n instanceof bo))throw n;switch(n.oauthError){case"authorization_pending":return{status:"pending"};case"slow_down":return{status:"slow_down"};case"expired_token":return{status:"failed",message:"Device authorization expired."};case"access_denied":return{status:"failed",message:"Device authorization was denied."};default:throw n}}}})}function Ws(e){let t=yn(e.gateway);return{name:e.name,async login(o){let n=await o.prompt({type:"select",message:`Sign in to ${e.name}:`,options:[{id:Ms,label:"Sign in with browser (recommended)"},{id:Us,label:"Sign in with device code (when signing in from another device)"}]});if(n===Us)return ll(t,o);if(n===Ms){let r=await cl(t,o.signal);return dl(t,r.authorizationEndpoint,o)}throw Error(`Unknown ${e.name} sign-in method: ${n}`)},async refresh(o,n){return await No(t,new URLSearchParams({grant_type:"refresh_token",client_id:Be,refresh_token:o.refresh}),n)},async toAuth(o){return{apiKey:o.access}}}}var Lo="b1a00492-073a-47ea-816f-4c329264a828",pl="openid profile email offline_access grok-cli:access api:access",_l="https://auth.x.ai/oauth2/device/code",Ks="https://auth.x.ai/oauth2/token",hl=300000,fl=3600;function $e(e,t){let o=e[t];if(typeof o!=="string"||o.length===0)throw Error(`Invalid xAI OAuth response field: ${t}`);return o}function js(e,t){let o=e[t];if(typeof o!=="number"||!Number.isFinite(o)||o<=0)throw Error(`Invalid xAI OAuth response field: ${t}`);return o}function Vs(e){let t;try{t=new URL(e)}catch{throw Error("Untrusted verification URI in xAI OAuth response")}if(t.protocol!=="https:")throw Error("Untrusted verification URI in xAI OAuth response");return t.href}async function Mo(e,t,o){let n;try{n=await fetch(e,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(t),signal:o})}catch(s){if(o.aborted)throw Error("Login cancelled");throw s}let r;try{let s=await n.json();r=s&&typeof s==="object"&&!Array.isArray(s)?s:{}}catch{if(o.aborted)throw Error("Login cancelled");throw Error(`xAI OAuth returned invalid JSON (HTTP ${n.status})`)}return{ok:n.ok,status:n.status,body:r}}function Uo(e,t){let o=typeof t.body.error==="string"?t.body.error:void 0,n=typeof t.body.error_description==="string"?t.body.error_description:void 0,r=[o,n].filter(Boolean).join(": ");return Error(`xAI OAuth ${e} failed (HTTP ${t.status})${r?`: ${r}`:""}`)}function ml(e){let t=e.interval,o=typeof t==="number"&&Number.isFinite(t)&&t>0?t:void 0,n=typeof e.verification_uri_complete==="string"&&e.verification_uri_complete.length>0?Vs(e.verification_uri_complete):void 0;return{deviceCode:$e(e,"device_code"),userCode:$e(e,"user_code"),verificationUri:Vs($e(e,"verification_uri")),verificationUriComplete:n,intervalSeconds:o,expiresInSeconds:js(e,"expires_in")}}function Xs(e,t){let o=$e(e,"access_token"),n=e.refresh_token===void 0&&t?t:$e(e,"refresh_token"),r=e.expires_in===void 0?fl:js(e,"expires_in");return{type:"oauth",access:o,refresh:n,expires:Date.now()+r*1000-hl}}async function gl(e){let t=await Mo(_l,{client_id:Lo,scope:pl,referrer:"pi"},e);if(!t.ok)throw Uo("device authorization",t);return ml(t.body)}async function Cl(e,t){return P({intervalSeconds:e.intervalSeconds,expiresInSeconds:e.expiresInSeconds,waitBeforeFirstPoll:!0,signal:t,poll:async()=>{let o=await Mo(Ks,{grant_type:"urn:ietf:params:oauth:grant-type:device_code",client_id:Lo,device_code:e.deviceCode},t);if(o.ok)return{status:"complete",value:Xs(o.body)};let n=o.body.error;if(n==="authorization_pending")return{status:"pending"};if(n==="slow_down"){let r=o.body.interval;return{status:"slow_down",intervalSeconds:typeof r==="number"?r:void 0}}if(n==="access_denied"||n==="authorization_denied")return{status:"failed",message:"xAI device authorization was denied"};if(n==="expired_token")return{status:"failed",message:"xAI device code expired"};return{status:"failed",message:Uo("device token polling",o).message}}})}async function Sl(e){let t=await gl(e.signal);return e.notify({type:"device_code",userCode:t.userCode,verificationUri:t.verificationUriComplete??t.verificationUri,intervalSeconds:t.intervalSeconds,expiresInSeconds:t.expiresInSeconds}),Cl(t,e.signal)}async function El(e,t){let o=await Mo(Ks,{grant_type:"refresh_token",client_id:Lo,refresh_token:e},t);if(!o.ok)throw Uo("token refresh",o);return Xs(o.body,e)}var qs={name:"xAI (Grok/X subscription)",isSubscription:!0,loginLabel:"Sign in with SuperGrok or X Premium",login:Sl,refresh:(e,t)=>El(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};function Js(){Ya({anthropic:()=>os,openaiCodex:()=>bs,openaiChatGPT:()=>xs,githubCopilot:()=>us,openrouter:()=>Ls,kimiCoding:()=>fs,meta:()=>Ss,xai:()=>qs,radius:Ws})}Ga(Hr);Js();await import("./chunk-brgcdzj9.js");
96
+ </html>`}function wt(e){return Wr({title:"Authentication successful",heading:"Authentication successful",message:e})}function k(e,t){return Wr({title:"Authentication failed",heading:"Authentication failed",message:e,details:t})}function V(e,t,o){e.writeHead(t,{"content-type":"text/html; charset=utf-8","cache-control":"no-store"}),e.end(o)}async function D(e){let{providerName:t,signal:o}=e;if(o?.aborted)throw Error("Login cancelled");let n=()=>{},r=()=>{},s=new Promise((f,p)=>{n=f,r=p});s.catch(()=>{return});let i=!1,c=!1,a,d=()=>u({error:Error("Login cancelled")}),u=(f)=>{if(c)return;if(c=!0,a)clearTimeout(a);if(o?.removeEventListener("abort",d),"error"in f)r(f.error);else n(f.value)},l=Md((f,p)=>{(async()=>{let y=new URL(f.url??"/","http://localhost");if(f.method!=="GET"||y.pathname!==e.path){V(p,404,k("Callback route not found."));return}if(e.state!==void 0&&y.searchParams.get("state")!==e.state){V(p,400,k("State mismatch."));return}if(i||c){V(p,409,k("This sign-in has already been handled."));return}let x=y.searchParams.get("error");if(x){let S=y.searchParams.get("error_description")??x;V(p,400,k(`${t} authorization failed.`,S)),u({error:Error(`${t} authorization failed: ${S}`)});return}let A=y.searchParams.get("code");if(!A){V(p,400,k("Missing authorization code."));return}i=!0;try{let S=await e.complete(A);V(p,200,wt(`Signed in to ${t}. You may now close this page.`)),u({value:S})}catch(S){let L=S instanceof Error?S:Error(String(S));V(p,502,k(`${t} sign-in failed.`,L.message)),u({error:L})}})()});await new Promise((f,p)=>{l.once("error",p),l.listen(e.port,e.host,()=>{l.off("error",p),f()})});let g=l.address();if(!g||typeof g==="string")throw l.close(),Error("OAuth callback server did not bind to TCP");if(l.on("error",(f)=>u({error:f})),o?.addEventListener("abort",d,{once:!0}),e.timeoutMs!==void 0)a=setTimeout(()=>u({error:Error(`${t} sign-in timed out`)}),e.timeoutMs);let h=e.redirectHost??e.host;return{redirectUri:`http://${h.includes(":")?`[${h}]`:h}:${g.port}${e.path}`,wait:()=>s,cancel:()=>{if(!i)u({value:void 0})},close:()=>{u({error:Error("OAuth callback server closed")}),l.close()}}}async function me(e,t,o){let n=new AbortController,r,s=e.prompt({type:"manual_code",...o,signal:n.signal}).then((i)=>(t?.cancel(),i)).catch((i)=>{r=i instanceof Error?i:Error(String(i)),t?.cancel();return});try{let i=await t?.wait();if(r)throw r;if(i!==void 0)return{type:"callback",value:i};let c=await s;if(r)throw r;return{type:"manual",input:c??""}}finally{n.abort()}}function Vr(e){let t="";for(let o of e)t+=String.fromCharCode(o);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}async function G(){let e=new Uint8Array(32);crypto.getRandomValues(e);let t=Vr(e),n=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",n),s=Vr(new Uint8Array(r));return{verifier:t,challenge:s}}var Ud=(e)=>atob(e),kt=Ud("OWQxYzI1MGEtZTYxYi00NGQ5LTg4ZWQtNTk0NGQxOTYyZjVl"),qr="https://claude.ai/oauth/authorize",Ce="https://platform.claude.com/v1/oauth/token",Bd=O("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1",Jr=53692,Yr="/callback",Dd=`http://localhost:${Jr}${Yr}`,jr="https://platform.claude.com/oauth/code/callback",zr="browser",Xr="copy_code",Qr="org:create_api_key user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload";function Zr(e){let t=e.trim();if(!t)return{};try{let o=new URL(t);return{code:o.searchParams.get("code")??void 0,state:o.searchParams.get("state")??void 0}}catch{}if(t.includes("#")){let[o,n]=t.split("#",2);return{code:o,state:n}}if(t.includes("code=")){let o=new URLSearchParams(t);return{code:o.get("code")??void 0,state:o.get("state")??void 0}}return{code:t}}function be(e){if(e instanceof Error){let t=[`${e.name}: ${e.message}`],o=e;if(o.code)t.push(`code=${o.code}`);if(typeof o.errno<"u")t.push(`errno=${String(o.errno)}`);if(typeof e.cause<"u")t.push(`cause=${be(e.cause)}`);if(e.stack)t.push(`stack=${e.stack}`);return t.join("; ")}return String(e)}async function es(e,t,o){let n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t),signal:AbortSignal.any([o,AbortSignal.timeout(30000)])}),r=await n.text();if(!n.ok)throw Error(`HTTP request failed. status=${n.status}; url=${e}; body=${r}`);return r}async function ts(e,t,o,n,r){let s;try{s=await es(Ce,{grant_type:"authorization_code",client_id:kt,code:e,state:t,redirect_uri:n,code_verifier:o},r)}catch(c){throw Error(`Token exchange request failed. url=${Ce}; redirect_uri=${n}; response_type=authorization_code; details=${be(c)}`)}let i;try{i=JSON.parse(s)}catch(c){throw Error(`Token exchange returned invalid JSON. url=${Ce}; body=${s}; details=${be(c)}`)}return{type:"oauth",refresh:i.refresh_token,access:i.access_token,expires:Date.now()+i.expires_in*1000-300000}}async function $d(e){let{verifier:t,challenge:o}=await G(),n=(i)=>D({providerName:"Anthropic",host:Bd,port:i,path:Yr,redirectHost:"localhost",state:t,complete:async(c)=>c,signal:e.signal}),r=await n(Jr).catch(()=>n(0)).catch(()=>{return}),s=r?.redirectUri??Dd;try{let i=new URLSearchParams({code:"true",client_id:kt,response_type:"code",redirect_uri:s,scope:Qr,code_challenge:o,code_challenge_method:"S256",state:t});e.notify({type:"auth_url",url:`${qr}?${i.toString()}`,instructions:"Complete login in your browser. If the browser is on another machine, paste the final redirect URL here."});let c=await me(e,r,{message:"Complete login in your browser, or paste the authorization code / redirect URL here:",placeholder:s}),a,d=t;if(c.type==="callback")a=c.value;else{let u=Zr(c.input);if(u.state&&u.state!==t)throw Error("OAuth state mismatch");a=u.code,d=u.state??t}if(!a)throw Error("Missing authorization code");return e.notify({type:"progress",message:"Exchanging authorization code for tokens..."}),await ts(a,d,t,s,e.signal)}finally{r?.close()}}async function Fd(e){let{verifier:t,challenge:o}=await G(),n=new URLSearchParams({code:"true",client_id:kt,response_type:"code",redirect_uri:jr,scope:Qr,code_challenge:o,code_challenge_method:"S256",state:t});e.notify({type:"auth_url",url:`${qr}?${n.toString()}`,instructions:"Complete login in your browser, then copy the code Anthropic shows and paste it here."});let r=await e.prompt({type:"manual_code",message:"Paste the code Anthropic shows after you sign in:",placeholder:"code#state",signal:e.signal}),s=Zr(r);if(s.state&&s.state!==t)throw Error("OAuth state mismatch");if(!s.code)throw Error("Missing authorization code");return e.notify({type:"progress",message:"Exchanging authorization code for tokens..."}),await ts(s.code,s.state??t,t,jr,e.signal)}async function Hd(e,t){let o;try{o=await es(Ce,{grant_type:"refresh_token",client_id:kt,refresh_token:e},t)}catch(r){throw Error(`Anthropic token refresh request failed. url=${Ce}; details=${be(r)}`)}let n;try{n=JSON.parse(o)}catch(r){throw Error(`Anthropic token refresh returned invalid JSON. url=${Ce}; body=${o}; details=${be(r)}`)}return{type:"oauth",refresh:n.refresh_token,access:n.access_token,expires:Date.now()+n.expires_in*1000-300000}}var os={name:"Anthropic (Claude Pro/Max)",isSubscription:!0,async login(e){let t=await e.prompt({type:"select",message:"Select Anthropic login method:",options:[{id:zr,label:"Browser login (default)"},{id:Xr,label:"Copy code login (headless)"}]});if(t===Xr)return Fd(e);if(t!==zr)throw Error(`Unknown Anthropic login method: ${t}`);return $d(e)},refresh:(e,t)=>Hd(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};function Pt(e,t){return new Promise((o,n)=>{t.throwIfAborted();let r=()=>{clearTimeout(s),n(t.reason)},s=setTimeout(()=>{t.removeEventListener("abort",r),o()},e);t.addEventListener("abort",r,{once:!0})})}function ns(e,t,o){return new Promise((n,r)=>{if(t.aborted){r(Error(o));return}let s=()=>{clearTimeout(i),r(Error(o))},i=setTimeout(()=>{t.removeEventListener("abort",s),n()},e);t.addEventListener("abort",s,{once:!0})})}async function P(e){let t=typeof e.expiresInSeconds==="number"?Date.now()+e.expiresInSeconds*1000:Number.POSITIVE_INFINITY,o=Math.max(1000,Math.floor((e.intervalSeconds??5)*1000)),n=0;if(e.waitBeforeFirstPoll){let r=t-Date.now();if(r>0)await ns(Math.min(o,r),e.signal,"Login cancelled")}while(Date.now()<t){if(e.signal.aborted)throw Error("Login cancelled");let r=await e.poll();if(r.status==="complete")return r.value;if(r.status==="failed")throw Error(r.message);if(r.status==="slow_down")n+=1,o=typeof r.intervalSeconds==="number"&&Number.isFinite(r.intervalSeconds)&&r.intervalSeconds>0?Math.max(1000,Math.floor(r.intervalSeconds*1000)):Math.max(1000,o+5000);let s=t-Date.now();if(s<=0)break;await ns(Math.min(o,s),e.signal,"Login cancelled")}throw Error(n>0?"Device flow timed out after one or more slow_down responses. This is often caused by clock drift in WSL or VM environments. Please sync or restart the VM clock and try again.":"Device flow timed out")}var Wd=(e)=>atob(e),ss=Wd("SXYxLmI1MDdhMDhjODdlY2ZlOTg="),ao={"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},Vd="2026-06-01";function is(e){let t=e.trim();if(!t)return null;try{return(t.includes("://")?new URL(t):new URL(`https://${t}`)).hostname}catch{return null}}function co(e){return{deviceCodeUrl:`https://${e}/login/device/code`,accessTokenUrl:`https://${e}/login/oauth/access_token`,copilotTokenUrl:`https://api.${e}/copilot_internal/v2/token`}}function Kd(e){let t=e.match(/proxy-ep=([^;]+)/);if(!t)return null;return`https://${t[1].replace(/^proxy\./,"api.")}`}function uo(e,t){if(e){let o=Kd(e);if(o)return o}if(t)return`https://copilot-api.${t}`;return"https://api.individual.githubcopilot.com"}function Le(e){return e&&typeof e==="object"?e:void 0}function jd(e,t){let o=Le(e)?.data;if(!Array.isArray(o))throw Error("Invalid Copilot models response");let n=o.flatMap((a)=>{let d=Le(a),u=d?.id;if(!d||typeof u!=="string")return[];let l=Le(d.capabilities);if(Le(l?.supports)?.tool_calls===!1)return[];return[{id:u,pickerEnabled:d.model_picker_enabled===!0,policyState:Le(d.policy)?.state}]}),r=n.filter((a)=>a.pickerEnabled&&a.policyState!=="disabled").map((a)=>a.id),s=t&&r.length===0,i=r.length>0||!t?r:n.filter((a)=>a.policyState==="enabled").map((a)=>a.id),c=n.filter((a)=>a.policyState==="unconfigured"&&Object.hasOwn(bo,a.id)&&(a.pickerEnabled||s)).map((a)=>a.id);return{availableModelIds:i,policyModelIds:c}}async function as(e,t,o,n){let r=n.maxRetries>0&&n.maxElapsedMs>0?AbortSignal.timeout(n.maxElapsedMs):void 0,s=r?AbortSignal.any([o,r]):o,i=r?Date.now()+n.maxElapsedMs:void 0;for(let c=0;;c++){let a=await fetch(e,{...t,signal:AbortSignal.any([s,AbortSignal.timeout(5000)])});if(a.status!==429||c===n.maxRetries)return a;let d=a.headers.get("retry-after"),u=500*2**c;if(d){let l=Number.parseFloat(d);if(u=Number.isNaN(l)?Date.parse(d)-Date.now():l*1000,!Number.isFinite(u))return a}if(u=Math.max(0,u),i!==void 0&&u>=i-Date.now())return a;await a.body?.cancel(),await Pt(u,s)}}async function cs(e,t,o,n){let r=uo(e,t),s=r==="https://api.individual.githubcopilot.com",i=await as(`${r}/models`,{headers:{Accept:"application/json",Authorization:`Bearer ${e}`,...ao,"X-GitHub-Api-Version":Vd}},o,n);if(!i.ok)throw Error(`${i.status} ${i.statusText}: ${await i.text()}`);return jd(await i.json(),s)}async function lo(e,t){let o=await fetch(e,t);if(!o.ok){let n=await o.text();throw Error(`${o.status} ${o.statusText}: ${n}`)}return o.json()}async function zd(e,t){let o=co(e),n=await lo(o.deviceCodeUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:ss,scope:"read:user"}),signal:t});if(!n||typeof n!=="object")throw Error("Invalid device code response");let{device_code:r,user_code:s,verification_uri:i,interval:c,expires_in:a}=n;if(typeof r!=="string"||typeof s!=="string"||typeof i!=="string"||c!==void 0&&typeof c!=="number"||typeof a!=="number")throw Error("Invalid device code response fields");let d;try{d=new URL(i)}catch{throw Error("Untrusted verification_uri in device code response")}if(d.protocol!=="https:"&&d.protocol!=="http:")throw Error("Untrusted verification_uri in device code response");return{device_code:r,user_code:s,verification_uri:d.href,interval:c,expires_in:a}}async function Xd(e,t,o){let n=co(e);return P({intervalSeconds:t.interval,expiresInSeconds:t.expires_in,waitBeforeFirstPoll:!0,signal:o,poll:async()=>{let r=await lo(n.accessTokenUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:ss,device_code:t.device_code,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),signal:o});if(r&&typeof r==="object"&&typeof r.access_token==="string")return{status:"complete",value:r.access_token};if(r&&typeof r==="object"&&typeof r.error==="string"){let{error:s,error_description:i,interval:c}=r;if(s==="authorization_pending")return{status:"pending"};if(s==="slow_down")return{status:"slow_down",intervalSeconds:typeof c==="number"?c:void 0};let a=i?`: ${i}`:"";return{status:"failed",message:`Device flow failed: ${s}${a}`}}return{status:"failed",message:"Invalid device token response"}}})}async function ds(e,t,o){let r=co(t||"github.com"),s=await lo(r.copilotTokenUrl,{headers:{Accept:"application/json",Authorization:`Bearer ${e}`,...ao},signal:o});if(!s||typeof s!=="object")throw Error("Invalid Copilot token response");let{token:i,expires_at:c}=s;if(typeof i!=="string"||typeof c!=="number")throw Error("Invalid Copilot token response fields");return{type:"oauth",refresh:e,access:i,expires:c*1000-300000,enterpriseUrl:t}}async function qd(e,t,o){let n=await ds(e,t,o),{availableModelIds:r}=await cs(n.access,t,o,{maxRetries:0,maxElapsedMs:0});return{...n,availableModelIds:r}}async function Jd(e,t,o,n){let s=`${uo(e,o)}/models/${t}/policy`,i;try{i=await as(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`,...ao,"openai-intent":"chat-policy","x-interaction-type":"chat-policy"},body:JSON.stringify({state:"enabled"})},n,{maxRetries:2,maxElapsedMs:5000})}catch(c){if(n.aborted)throw c;return!1}if(i.status===429)throw Error(`${i.status} ${i.statusText}: ${await i.text()}`);return i.ok}async function Yd(e,t,o,n){let r=[];for(let s of t)try{if(await Jd(e,s,o,n))r.push(s)}catch(i){if(n.aborted)throw i;break}return r}async function Qd(e){let t=await e.prompt({type:"text",message:"GitHub Enterprise URL/domain (blank for github.com)",placeholder:"company.ghe.com"});if(e.signal.aborted)throw Error("Login cancelled");let o=t.trim(),n=is(t);if(o&&!n)throw Error("Invalid GitHub Enterprise URL/domain");let r=n||"github.com",s=await zd(r,e.signal);e.notify({type:"device_code",userCode:s.user_code,verificationUri:s.verification_uri,intervalSeconds:s.interval,expiresInSeconds:s.expires_in});let i=await Xd(r,s,e.signal),c=await ds(i,n??void 0,e.signal),a=await cs(c.access,n??void 0,e.signal,{maxRetries:2,maxElapsedMs:5000}),d=[];if(a.policyModelIds.length>0)e.notify({type:"progress",message:"Enabling models..."}),d=await Yd(c.access,a.policyModelIds,n??void 0,e.signal);return{...c,availableModelIds:[...new Set([...a.availableModelIds,...d])]}}function rs(e){let t=e.enterpriseUrl;if(typeof t!=="string"||!t)return;return is(t)??void 0}var us={name:"GitHub Copilot",isSubscription:!0,login:Qd,refresh:(e,t)=>qd(e.refresh,rs(e),t),async toAuth(e){return{apiKey:e.access,baseUrl:uo(e.access,rs(e))}}};var po="17e5f671-d194-4dfb-9706-5516cb48c098",Zd="https://auth.kimi.com",eu=900,tu=5,ou=30000,ls=3;function _s(){return(O("KIMI_CODE_OAUTH_HOST")||O("KIMI_OAUTH_HOST")||Zd).replace(/\/+$/,"")}function ho(e){return AbortSignal.any([AbortSignal.timeout(ou),e])}function fo(e){return new URLSearchParams(e).toString()}async function mo(e){try{let t=await e.json();return t&&typeof t==="object"?t:null}catch{return null}}function ps(e){if(typeof e!=="string"||!e)return null;try{let t=new URL(e);if(t.protocol!=="https:"&&t.protocol!=="http:")return null;return t.href}catch{return null}}async function nu(e,t){let o=await fetch(`${e}/api/oauth/device_authorization`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:fo({client_id:po}),signal:ho(t)});if(!o.ok){let u=await o.text().catch(()=>"");throw Error(`Kimi Code device authorization failed with status ${o.status}${u?`: ${u}`:""}`)}let n=await mo(o),r=n?.device_code,s=n?.user_code,i=n?.verification_uri,c=n?.verification_uri_complete;if(typeof r!=="string"||typeof s!=="string"||typeof i!=="string"||typeof c!=="string"||!ps(c)||!ps(i))throw Error(`Invalid Kimi Code device authorization response: ${JSON.stringify(n)}`);let a=n?.interval,d=n?.expires_in;return{deviceCode:r,userCode:s,verificationUri:i,verificationUriComplete:c,intervalSeconds:typeof a==="number"&&Number.isFinite(a)&&a>0?a:tu,expiresInSeconds:typeof d==="number"&&Number.isFinite(d)&&d>0?d:eu}}function hs(e,t){let o=e?.access_token,n=e?.refresh_token,r=e?.expires_in;if(typeof o!=="string"||!o||typeof n!=="string"||!n||typeof r!=="number"||!Number.isFinite(r)||r<=0)throw Error(`Kimi Code token ${t} response missing fields: ${JSON.stringify(e)}`);return{access:o,refresh:n,expires:Date.now()+r*1000}}async function ru(e,t,o){return P({intervalSeconds:t.intervalSeconds,expiresInSeconds:t.expiresInSeconds,waitBeforeFirstPoll:!0,signal:o,poll:async()=>{let n=await fetch(`${e}/api/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:fo({client_id:po,device_code:t.deviceCode,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),signal:ho(o)});if(n.status>=500){let c=await n.text().catch(()=>"");return{status:"failed",message:`Kimi Code device token request failed with status ${n.status}${c?`: ${c}`:""}`}}let r=await mo(n);if(n.ok&&typeof r?.access_token==="string")try{return{status:"complete",value:hs(r,"poll")}}catch(c){return{status:"failed",message:c instanceof Error?c.message:String(c)}}let s=r?.error,i=typeof r?.error_description==="string"?`: ${r.error_description}`:"";if(s==="authorization_pending")return{status:"pending"};if(s==="slow_down"){let c=r?.interval;return{status:"slow_down",intervalSeconds:typeof c==="number"&&c>0?c:void 0}}if(s==="expired_token")return{status:"failed",message:"Kimi Code device authorization expired. Please restart login."};if(s==="access_denied")return{status:"failed",message:"Kimi Code login was denied."};return{status:"failed",message:`Kimi Code device token request failed (status ${n.status})${typeof s==="string"?`: ${s}${i}`:""}`}}})}function su(e){return e.status===429||e.status>=500}async function iu(e,t,o){let n;for(let r=0;r<=ls;r++){if(r>0)await Pt(1000*2**(r-1),o);if(o.aborted)throw Error("Kimi Code token refresh aborted");let s;try{s=await fetch(`${e}/api/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:fo({client_id:po,grant_type:"refresh_token",refresh_token:t}),signal:ho(o)})}catch(a){n=a instanceof Error?a:Error(String(a));continue}let i=await mo(s);if(s.ok)return hs(i,"refresh");if(s.status===401||s.status===403||i?.error==="invalid_grant"){let a=typeof i?.error_description==="string"?`: ${i.error_description}`:"";throw Error(`Kimi Code token refresh unauthorized (status ${s.status})${a}`)}if(su(s)&&r<ls){n=Error(`Kimi Code token refresh failed with status ${s.status}`);continue}let c=JSON.stringify(i);throw Error(`Kimi Code token refresh failed with status ${s.status}${c?`: ${c}`:""}`)}throw n??Error("Kimi Code token refresh failed")}async function au(e){let t=_s(),o=await nu(t,e.signal);e.notify({type:"device_code",userCode:o.userCode,verificationUri:o.verificationUriComplete,intervalSeconds:o.intervalSeconds,expiresInSeconds:o.expiresInSeconds});let n=await ru(t,o,e.signal);return{type:"oauth",access:n.access,refresh:n.refresh,expires:n.expires}}var fs={name:"Kimi Code (subscription)",isSubscription:!0,loginLabel:"Sign in with Kimi Code",login:au,refresh:async(e,t)=>{let o=await iu(_s(),e.refresh,t);return{type:"oauth",access:o.access,refresh:o.refresh,expires:o.expires}},async toAuth(e){return{headers:{Authorization:`Bearer ${e.access}`}}}};var ms="1031625952748946",gs="https://auth.meta.com",cu=`${gs}/oidc/device/authorization/`,du=`${gs}/oidc/device/token/`,uu="https://api.meta.ai/muse-code/key",lu=86400000,pu=30000;function So(e){return AbortSignal.any([AbortSignal.timeout(pu),e])}async function Eo(e){try{let t=await e.json();return t&&typeof t==="object"?t:null}catch{return null}}function bt(e){for(let t of["error_description","detail","message","error"]){let o=e?.[t];if(typeof o==="string"&&o.trim())return`: ${o.trim()}`}return""}function go(e){if(typeof e!=="string"||!e)return null;try{let t=new URL(e);if(t.protocol!=="https:"&&t.protocol!=="http:")return null;return t.href}catch{return null}}function Co(e){return typeof e==="number"&&Number.isFinite(e)&&e>0?e:void 0}async function _u(e){let t=await fetch(cu,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({client_id:ms}).toString(),signal:So(e)}),o=await Eo(t);if(!t.ok)throw Error(`Meta device authorization failed with status ${t.status}${bt(o)}`);let n=o?.device_code,r=o?.user_code,s=go(o?.verification_uri_complete)??go(o?.verification_uri);if(typeof n!=="string"||!n||typeof r!=="string"||!r||!s)throw Error(`Invalid Meta device authorization response: ${JSON.stringify(o)}`);return{deviceCode:n,userCode:r,verificationUri:s,intervalSeconds:Co(o?.interval),expiresInSeconds:Co(o?.expires_in)}}async function hu(e,t){return P({intervalSeconds:e.intervalSeconds,expiresInSeconds:e.expiresInSeconds,waitBeforeFirstPoll:!0,signal:t,poll:async()=>{let o=await fetch(du,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:e.deviceCode,client_id:ms}).toString(),signal:So(t)}),n=await Eo(o);if(o.ok&&typeof n?.access_token==="string"&&n.access_token)return{status:"complete",value:n.access_token};switch(n?.error){case"authorization_pending":return{status:"pending"};case"slow_down":return{status:"slow_down",intervalSeconds:Co(n?.interval)};case"access_denied":return{status:"failed",message:"Meta login was denied."};case"expired_token":return{status:"failed",message:"Meta device authorization expired. Please restart login."};default:return{status:"failed",message:`Meta device token request failed with status ${o.status}${bt(n)}`}}}})}async function Cs(e,t){let o=await fetch(uu,{method:"POST",headers:{Accept:"application/json",Authorization:`Bearer ${e}`,"Content-Type":"application/json","x-api-version":"1.0.0"},body:"{}",signal:So(t)}),n=await Eo(o);if(o.status===401||o.status===403)throw Error(`Meta session expired (status ${o.status}). Run \`/login meta\` to sign in again.${bt(n)}`);if(!o.ok)throw Error(`Meta API key mint failed with status ${o.status}${bt(n)}`);let r=n?.api_key;if(typeof r!=="string"||!r){let s=go(n?.action_url);throw Error(`Meta did not issue an API key.${s?` Complete setup at ${s}`:""}`)}return{type:"oauth",refresh:e,access:r,expires:Date.now()+lu}}async function fu(e){try{let t=await _u(e.signal);e.notify({type:"device_code",userCode:t.userCode,verificationUri:t.verificationUri,intervalSeconds:t.intervalSeconds,expiresInSeconds:t.expiresInSeconds});let o=await hu(t,e.signal);return e.notify({type:"progress",message:"Enabling Meta Model API access..."}),await Cs(o,e.signal)}catch(t){if(e.signal.aborted)throw Error("Login cancelled");throw t}}var Ss={name:"Meta (Muse subscription)",isSubscription:!0,loginLabel:"Sign in with Meta",login:fu,refresh:(e,t)=>Cs(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};import{randomBytes as mu}from"crypto";import{createServer as gu}from"http";var Cu="dynamic_agent_client",Su="Pi",Eu=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,vu="https://auth.openai.com/api/accounts/authorize",Au="https://auth.openai.com/api/accounts/oauth/token",Io="https://api.openai.com/v1",Ru=O("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1",To=1455,vs="/auth/callback",Se=`http://127.0.0.1:${To}${vs}`,Ro="chatgpt.tokens.use.direct",yu=`openid profile email offline_access resource.invoke ${Ro}`,xu=180000;function Es(){return mu(32).toString("base64url")}function As(e,t){let o=e.searchParams.get("code");if(!o)throw Error("Missing authorization code");let n=e.searchParams.get("state");if(!n)throw Error("Missing OAuth state");if(n!==t)throw Error("OAuth state mismatch");let r=e.searchParams.get("client_id")?.trim();if(!r)throw Error("OpenAI OAuth registration callback did not contain an issued client ID");return{code:o,clientId:r}}function Iu(e,t){let o;try{o=new URL(e.trim())}catch{throw Error("Paste the full callback URL from the browser")}let n=new URL(Se);if(o.origin!==n.origin||o.pathname!==n.pathname)throw Error(`The pasted callback URL must start with ${Se}`);let r=o.searchParams.get("error");if(r)throw Error(`ChatGPT authorization failed: ${r}`);return As(o,t)}function Be(e,t,o){e.writeHead(t,{"Content-Type":"text/html; charset=utf-8"}),e.end(o)}function Tu(e){return new Promise((t,o)=>{let n,r,s=new Promise((c,a)=>{n=c,r=a}),i=gu((c,a)=>{try{let d=new URL(c.url||"",Se);if(d.pathname!==vs){Be(a,404,k("Callback route not found."));return}let u=d.searchParams.get("error");if(u){Be(a,400,k("ChatGPT was not connected.",`Error: ${u}`)),r(Error(`ChatGPT authorization failed: ${u}`));return}let l;try{l=As(d,e)}catch(g){let h=g instanceof Error?g.message:"Invalid callback";Be(a,400,k(h));return}Be(a,200,wt("ChatGPT authentication completed. You can close this window.")),n(l)}catch{Be(a,500,k("Internal error while processing the callback."))}});i.once("error",o),i.listen(To,Ru,()=>{i.removeListener("error",o),i.on("error",r),t({server:i,result:s})})})}async function Rs(e,t){let o=await fetch(Au,{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:e,signal:t});if(!o.ok){let r=await o.text().catch(()=>"");throw Error(`OpenAI OAuth token request failed (${o.status}): ${r||o.statusText}`)}let n=await o.json();if(typeof n!=="object"||n===null||Array.isArray(n))throw Error("OpenAI OAuth token response must be an object");return n}function Ao(e,t){if(typeof e!=="string"||e.trim().length===0)throw Error(`OpenAI OAuth token response has invalid ${t}`);return e}function ys(e,t,o){let n=Ao(e.access_token,"access_token"),r=Ao(e.refresh_token,"refresh_token"),s=Ao(e.scope,"scope"),i=typeof e.id_token==="string"?e.id_token:o?.idToken;if(typeof e.expires_in!=="number"||!Number.isFinite(e.expires_in)||e.expires_in<=0)throw Error("OpenAI OAuth token response has invalid expires_in");let c=s.trim().split(/\s+/).filter(Boolean);if(!c.includes(Ro))throw Error(`OpenAI OAuth grant did not include ${Ro}`);return{type:"oauth",...i?{idToken:i}:{},access:n,refresh:r,expires:Date.now()+e.expires_in*1000-xu,clientId:t,scopes:c}}async function wu(e,t,o,n){let r=await Rs(new URLSearchParams({grant_type:"authorization_code",client_id:o,code:e,code_verifier:t,redirect_uri:Se,resource:Io}),n);if(typeof r.id_token!=="string"||r.id_token.trim().length===0)throw Error("OpenAI OAuth token response did not contain an ID token");return ys(r,o)}async function ku(e,t){let o=e.clientId;if(typeof o!=="string"||o.trim().length===0)throw Error("Stored OpenAI OAuth credential does not contain an issued client ID; reconnect ChatGPT");let n=await Rs(new URLSearchParams({grant_type:"refresh_token",client_id:o,refresh_token:e.refresh,resource:Io}),t);return ys(n,o,e)}function Ou(e){if(!e||!Eu.test(e))throw Error("Sign in with ChatGPT requires a device ID (UUID) for this installation");return`urn:uuid:${e.toLowerCase()}`}async function Pu(e,t){let o=Ou(t?.getDeviceId?.()),{verifier:n,challenge:r}=await G(),s=Es(),i=Es(),c=await Tu(s).catch((l)=>{if(!(l instanceof Error&&("code"in l)&&l.code==="EADDRINUSE"))throw l;throw Error(`Port ${To} is in use, probably by an unfinished login in another pi session or by the Codex CLI. Cancel that login and try again.`)}),a=new URL(vu);a.search=new URLSearchParams({client_id:Cu,agent_name_hint:t?.agentName??Su,ext_agent_host_id:o,response_type:"code",redirect_uri:Se,resource:Io,scope:yu,state:s,code_challenge:r,code_challenge_method:"S256",nonce:i}).toString(),e.notify({type:"auth_url",url:a.toString(),instructions:"Complete sign-in in your browser. If the callback does not complete, paste the final redirect URL here."});let d=new AbortController,u=e.prompt({type:"manual_code",message:"Complete login in your browser, or paste the final redirect URL here:",placeholder:Se,signal:AbortSignal.any([d.signal,e.signal])}).then((l)=>Iu(l,s));try{let l=await Promise.race([c.result,u]);return e.notify({type:"progress",message:"Exchanging authorization code for tokens..."}),await wu(l.code,n,l.clientId,e.signal)}catch(l){if(e.signal.aborted)throw Error("Login cancelled");throw l}finally{d.abort(),c.server.close(),c.server.closeAllConnections()}}var xs={name:"OpenAI (ChatGPT subscription)",isSubscription:!0,loginLabel:"Sign in with ChatGPT",login:Pu,refresh:ku,async toAuth(e){return{apiKey:e.access}}};var wo=null;if(typeof process<"u"&&(process.versions?.node||process.versions?.bun))import("crypto").then((e)=>{wo=e.randomBytes});var Nt="app_EMoamEEZ73f0CkXaXp7hrann",Ee="https://auth.openai.com",Gu=`${Ee}/oauth/authorize`,ws=`${Ee}/oauth/token`,ko="http://localhost:1455/auth/callback",bu=`${Ee}/api/accounts/deviceauth/usercode`,Nu=`${Ee}/api/accounts/deviceauth/token`,Lu=`${Ee}/codex/device`,Mu=`${Ee}/deviceauth/callback`,ks=900,Is="browser",Ts="device_code",Uu="openid profile email offline_access",Bu="https://api.openai.com/auth";function Du(){return O("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1"}function $u(){if(!wo)throw Error("OpenAI Codex OAuth is only available in Node.js environments");return wo(16).toString("hex")}function Fu(e){let t=e.trim();if(!t)return{};try{let o=new URL(t);return{code:o.searchParams.get("code")??void 0,state:o.searchParams.get("state")??void 0}}catch{}if(t.includes("#")){let[o,n]=t.split("#",2);return{code:o,state:n}}if(t.includes("code=")){let o=new URLSearchParams(t);return{code:o.get("code")??void 0,state:o.get("state")??void 0}}return{code:t}}function Hu(e){try{let t=e.split(".");if(t.length!==3)return null;let o=t[1]??"",n=atob(o);return JSON.parse(n)}catch{return null}}async function Oo(e,t){try{return await fetch(e,t)}catch(o){if(t.signal?.aborted)throw Error("Login cancelled");throw o}}async function Os(e,t){if(!e.ok){let r=await e.text().catch(()=>"");throw Error(`OpenAI Codex token ${t} failed (${e.status}): ${r||e.statusText}`)}let n=await e.json();if(!n?.access_token||!n.refresh_token||typeof n.expires_in!=="number")throw Error(`OpenAI Codex token ${t} response missing fields: ${JSON.stringify(n)}`);return{access:n.access_token,refresh:n.refresh_token,expires:Date.now()+n.expires_in*1000}}async function Wu(e,t,o,n){let r=await Oo(ws,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",client_id:Nt,code:e,code_verifier:t,redirect_uri:o}),signal:n});return Os(r,"exchange")}async function Vu(e,t){let o;try{o=await fetch(ws,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:e,client_id:Nt}),signal:t})}catch(n){throw Error(`OpenAI Codex token refresh error: ${n instanceof Error?n.message:String(n)}`)}return Os(o,"refresh")}async function Ku(e){let t=await Oo(bu,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:Nt}),signal:e});if(!t.ok){if(t.status===404)throw Error("OpenAI Codex device code login is not enabled for this server. Use browser login or verify the server URL.");let s=await t.text().catch(()=>"");throw Error(`OpenAI Codex device code request failed with status ${t.status}${s?`: ${s}`:""}`)}let n=await t.json(),r=typeof n?.interval==="string"?Number(n.interval.trim()):n?.interval;if(!n?.device_auth_id||!n.user_code||typeof r!=="number"||!Number.isFinite(r)||r<0)throw Error(`Invalid OpenAI Codex device code response: ${JSON.stringify(n)}`);return{deviceAuthId:n.device_auth_id,userCode:n.user_code,intervalSeconds:r}}async function ju(e,t){return P({intervalSeconds:e.intervalSeconds,expiresInSeconds:ks,signal:t,poll:async()=>{let o=await Oo(Nu,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_auth_id:e.deviceAuthId,user_code:e.userCode}),signal:t});if(o.ok){let i=await o.json();if(!i?.authorization_code||!i.code_verifier)return{status:"failed",message:`Invalid OpenAI Codex device auth token response: ${JSON.stringify(i)}`};return{status:"complete",value:{authorizationCode:i.authorization_code,codeVerifier:i.code_verifier}}}if(o.status===403||o.status===404)return{status:"pending"};let n=await o.text().catch(()=>""),r;try{let i=JSON.parse(n)?.error;r=typeof i==="object"?i?.code:i}catch{}if(r==="deviceauth_authorization_pending")return{status:"pending"};if(r==="slow_down")return{status:"slow_down"};return{status:"failed",message:`OpenAI Codex device auth failed with status ${o.status}${n?`: ${n}`:""}`}}})}async function zu(e="pi"){let{verifier:t,challenge:o}=await G(),n=$u(),r=new URL(Gu);return r.searchParams.set("response_type","code"),r.searchParams.set("client_id",Nt),r.searchParams.set("redirect_uri",ko),r.searchParams.set("scope",Uu),r.searchParams.set("code_challenge",o),r.searchParams.set("code_challenge_method","S256"),r.searchParams.set("state",n),r.searchParams.set("id_token_add_organizations","true"),r.searchParams.set("codex_cli_simplified_flow","true"),r.searchParams.set("originator",e),{verifier:t,state:n,url:r.toString()}}function Xu(e){let n=Hu(e)?.[Bu]?.chatgpt_account_id;return typeof n==="string"&&n.length>0?n:null}function Ps(e){let t=Xu(e.access);if(!t)throw Error("Failed to extract accountId from token");return{type:"oauth",access:e.access,refresh:e.refresh,expires:e.expires,accountId:t}}async function Gs(e,t,o,n){return Ps(await Wu(e,t,o,n))}async function qu(e){let t=await Ku(e.signal);e.notify({type:"device_code",userCode:t.userCode,verificationUri:Lu,intervalSeconds:t.intervalSeconds,expiresInSeconds:ks});let o=await ju(t,e.signal);return Gs(o.authorizationCode,o.codeVerifier,Mu,e.signal)}async function Ju(e,t){let{verifier:o,state:n,url:r}=await zu(t?.agentName),s=await D({providerName:"OpenAI",host:Du(),port:1455,path:"/auth/callback",state:n,complete:async(i)=>i,signal:e.signal}).catch(()=>{return});e.notify({type:"auth_url",url:r,instructions:"A browser window should open. Complete login to finish."});try{let i=await me(e,s,{message:"Complete login in your browser, or paste the authorization code / redirect URL here:",placeholder:ko}),c;if(i.type==="callback")c=i.value;else{let a=Fu(i.input);if(a.state&&a.state!==n)throw Error("State mismatch");c=a.code}if(!c)throw Error("Missing authorization code");return await Gs(c,o,ko,e.signal)}finally{s?.close()}}async function Yu(e,t){return Ps(await Vu(e,t))}var bs={name:"OpenAI (ChatGPT Plus/Pro)",isSubscription:!0,async login(e,t){let o=await e.prompt({type:"select",message:"Select OpenAI Codex login method:",options:[{id:Is,label:"Browser login (default)"},{id:Ts,label:"Device code login (headless)"}]});if(o===Ts)return qu(e);if(o!==Is)throw Error(`Unknown OpenAI Codex login method: ${o}`);return Ju(e,t)},refresh:(e,t)=>Yu(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};var Qu="https://openrouter.ai/auth",Zu="https://openrouter.ai/api/v1/auth/keys",el=300000,tl=30000;function ol(){return O("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1"}function nl(e){let t=e.trim();if(!t)return;try{return new URL(t).searchParams.get("code")??void 0}catch{}if(t.includes("code="))return new URLSearchParams(t).get("code")??void 0;return t}function rl(e){if(typeof e.error_description==="string")return e.error_description;if(typeof e.message==="string")return e.message;if(typeof e.error==="string")return e.error;if(e.error&&typeof e.error==="object"&&!Array.isArray(e.error)){let t=e.error.message;if(typeof t==="string")return t}return}async function Ns(e,t,o){if(o.aborted)throw Error("Login cancelled");let n=new AbortController,r=()=>n.abort(o.reason);o.addEventListener("abort",r,{once:!0});let s=setTimeout(()=>n.abort(Error("OpenRouter OAuth token exchange timed out")),tl),i,c={};try{i=await fetch(Zu,{method:"POST",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({code:e,code_verifier:t,code_challenge_method:"S256"}),signal:n.signal});try{let a=await i.json();if(a&&typeof a==="object"&&!Array.isArray(a))c=a}catch{if(i.ok)throw Error("OpenRouter OAuth returned invalid JSON")}}catch(a){if(o.aborted)throw Error("Login cancelled");if(n.signal.aborted)throw Error("OpenRouter OAuth token exchange timed out");throw a}finally{clearTimeout(s),o.removeEventListener("abort",r)}if(!i.ok){let a=rl(c);throw Error(`OpenRouter OAuth key exchange failed (HTTP ${i.status})${a?`: ${a}`:""}`)}if(typeof c.key!=="string"||c.key.length===0)throw Error('OpenRouter OAuth response carries no "key"');return{type:"oauth",access:c.key,refresh:"",expires:Number.MAX_SAFE_INTEGER}}async function sl(e){let{verifier:t,challenge:o}=await G(),n=await D({providerName:"OpenRouter",host:ol(),port:0,path:`/oauth/callback/${crypto.randomUUID()}`,complete:(r)=>Ns(r,t,e.signal),signal:e.signal,timeoutMs:el});try{let r=new URL(Qu);r.search=new URLSearchParams({callback_url:n.redirectUri,code_challenge:o,code_challenge_method:"S256"}).toString(),e.notify({type:"progress",message:`Listening for OpenRouter OAuth callback on ${n.redirectUri}`}),e.notify({type:"auth_url",url:r.toString(),instructions:"Complete sign-in in your browser. If the browser is on another machine, paste the final redirect URL here."});let s=await me(e,n,{message:"Complete sign-in in your browser, or paste the authorization code / redirect URL here:",placeholder:n.redirectUri});if(s.type==="callback")return s.value;let i=nl(s.input);if(!i)throw Error("Missing authorization code");return e.notify({type:"progress",message:"Exchanging authorization code for an API key..."}),await Ns(i,t,e.signal)}finally{n.close()}}var Ls={name:"OpenRouter OAuth",loginLabel:"Sign in with OpenRouter",login:sl,async refresh(e,t){return e},async toAuth(e){return{apiKey:e.access}}};var Bs="127.0.0.1",Ds=1456,$s="/oauth/callback",Po=`http://${Bs}:${Ds}${$s}`,il=60000,Ms="browser",Us="device-code",$e="pi-gateway",Fs="gateway offline_access",al="urn:ietf:params:oauth:grant-type:device_code";async function cl(e,t){let o=await fetch(new URL("/v1/oauth",e),{headers:{accept:"application/json"},signal:t});if(!o.ok)throw Error(`Could not load Radius OAuth config from ${e}: ${o.status} ${await o.text()}`);let n=await o.json();if(typeof n.authorizationEndpoint!=="string")throw Error(`Invalid Radius OAuth config from ${e}`);return{authorizationEndpoint:n.authorizationEndpoint}}class Go extends Error{status;oauthError;constructor(e,t,o,n){let r=t?o?`${t}: ${o}`:t:o||String(e);super(`${n}: ${r}`);this.status=e,this.oauthError=t}}async function Hs(e,t){let o=await e.text().catch(()=>""),n,r;if(o)try{let s=JSON.parse(o);n=typeof s.error==="string"?s.error:void 0,r=typeof s.error_description==="string"?s.error_description:void 0}catch{r=o}return new Go(e.status,n,r,t)}async function No(e,t,o){let n;try{n=await fetch(new URL("/v1/oauth/token",e),{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:t,signal:o})}catch(s){if(o.aborted)throw Error("Login cancelled");throw s}if(!n.ok)throw await Hs(n,"Radius OAuth token request failed");let r=await n.json();return{type:"oauth",access:r.access_token,refresh:r.refresh_token,expires:Date.now()+r.expires_in*1000-il,scope:r.scope}}async function dl(e,t,o){let{verifier:n,challenge:r}=await G(),s=crypto.randomUUID(),i=new URL(t);i.search=new URLSearchParams({response_type:"code",client_id:$e,redirect_uri:Po,scope:Fs,code_challenge:r,code_challenge_method:"S256",handoff:"url",state:s}).toString();let c=await D({providerName:"Radius",host:Bs,port:Ds,path:$s,state:s,complete:(a)=>No(e,new URLSearchParams({grant_type:"authorization_code",client_id:$e,redirect_uri:Po,code:a,code_verifier:n}),o.signal),signal:o.signal});o.notify({type:"progress",message:`Listening for OAuth callback on ${Po}`}),o.notify({type:"auth_url",url:i.toString(),instructions:"Continue in your browser."});try{let a=await c.wait();if(!a)throw Error("OAuth callback did not complete.");return a}finally{c.close()}}async function ul(e,t){let o;try{o=await fetch(new URL("/v1/oauth/device",e),{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:$e,scope:Fs}),signal:t})}catch(r){if(t.aborted)throw Error("Login cancelled");throw r}if(!o.ok)throw await Hs(o,"Radius OAuth device authorization failed");let n=await o.json();if(!n.device_code||!n.user_code||!n.verification_uri||!n.expires_in)throw Error("Radius OAuth device authorization response is missing required fields");return{device_code:n.device_code,user_code:n.user_code,verification_uri:n.verification_uri,expires_in:n.expires_in,interval:n.interval}}async function ll(e,t){let o=await ul(e,t.signal);return t.notify({type:"device_code",userCode:o.user_code,verificationUri:o.verification_uri,intervalSeconds:o.interval,expiresInSeconds:o.expires_in}),P({intervalSeconds:o.interval,expiresInSeconds:o.expires_in,signal:t.signal,poll:async()=>{try{return{status:"complete",value:await No(e,new URLSearchParams({grant_type:al,client_id:$e,device_code:o.device_code}),t.signal)}}catch(n){if(!(n instanceof Go))throw n;switch(n.oauthError){case"authorization_pending":return{status:"pending"};case"slow_down":return{status:"slow_down"};case"expired_token":return{status:"failed",message:"Device authorization expired."};case"access_denied":return{status:"failed",message:"Device authorization was denied."};default:throw n}}}})}function Ws(e){let t=_n(e.gateway);return{name:e.name,async login(o){let n=await o.prompt({type:"select",message:`Sign in to ${e.name}:`,options:[{id:Ms,label:"Sign in with browser (recommended)"},{id:Us,label:"Sign in with device code (when signing in from another device)"}]});if(n===Us)return ll(t,o);if(n===Ms){let r=await cl(t,o.signal);return dl(t,r.authorizationEndpoint,o)}throw Error(`Unknown ${e.name} sign-in method: ${n}`)},async refresh(o,n){return await No(t,new URLSearchParams({grant_type:"refresh_token",client_id:$e,refresh_token:o.refresh}),n)},async toAuth(o){return{apiKey:o.access}}}}var Lo="b1a00492-073a-47ea-816f-4c329264a828",pl="openid profile email offline_access grok-cli:access api:access",_l="https://auth.x.ai/oauth2/device/code",Ks="https://auth.x.ai/oauth2/token",hl=300000,fl=3600;function Fe(e,t){let o=e[t];if(typeof o!=="string"||o.length===0)throw Error(`Invalid xAI OAuth response field: ${t}`);return o}function js(e,t){let o=e[t];if(typeof o!=="number"||!Number.isFinite(o)||o<=0)throw Error(`Invalid xAI OAuth response field: ${t}`);return o}function Vs(e){let t;try{t=new URL(e)}catch{throw Error("Untrusted verification URI in xAI OAuth response")}if(t.protocol!=="https:")throw Error("Untrusted verification URI in xAI OAuth response");return t.href}async function Mo(e,t,o){let n;try{n=await fetch(e,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(t),signal:o})}catch(s){if(o.aborted)throw Error("Login cancelled");throw s}let r;try{let s=await n.json();r=s&&typeof s==="object"&&!Array.isArray(s)?s:{}}catch{if(o.aborted)throw Error("Login cancelled");throw Error(`xAI OAuth returned invalid JSON (HTTP ${n.status})`)}return{ok:n.ok,status:n.status,body:r}}function Uo(e,t){let o=typeof t.body.error==="string"?t.body.error:void 0,n=typeof t.body.error_description==="string"?t.body.error_description:void 0,r=[o,n].filter(Boolean).join(": ");return Error(`xAI OAuth ${e} failed (HTTP ${t.status})${r?`: ${r}`:""}`)}function ml(e){let t=e.interval,o=typeof t==="number"&&Number.isFinite(t)&&t>0?t:void 0,n=typeof e.verification_uri_complete==="string"&&e.verification_uri_complete.length>0?Vs(e.verification_uri_complete):void 0;return{deviceCode:Fe(e,"device_code"),userCode:Fe(e,"user_code"),verificationUri:Vs(Fe(e,"verification_uri")),verificationUriComplete:n,intervalSeconds:o,expiresInSeconds:js(e,"expires_in")}}function Xs(e,t){let o=Fe(e,"access_token"),n=e.refresh_token===void 0&&t?t:Fe(e,"refresh_token"),r=e.expires_in===void 0?fl:js(e,"expires_in");return{type:"oauth",access:o,refresh:n,expires:Date.now()+r*1000-hl}}async function gl(e){let t=await Mo(_l,{client_id:Lo,scope:pl,referrer:"pi"},e);if(!t.ok)throw Uo("device authorization",t);return ml(t.body)}async function Cl(e,t){return P({intervalSeconds:e.intervalSeconds,expiresInSeconds:e.expiresInSeconds,waitBeforeFirstPoll:!0,signal:t,poll:async()=>{let o=await Mo(Ks,{grant_type:"urn:ietf:params:oauth:grant-type:device_code",client_id:Lo,device_code:e.deviceCode},t);if(o.ok)return{status:"complete",value:Xs(o.body)};let n=o.body.error;if(n==="authorization_pending")return{status:"pending"};if(n==="slow_down"){let r=o.body.interval;return{status:"slow_down",intervalSeconds:typeof r==="number"?r:void 0}}if(n==="access_denied"||n==="authorization_denied")return{status:"failed",message:"xAI device authorization was denied"};if(n==="expired_token")return{status:"failed",message:"xAI device code expired"};return{status:"failed",message:Uo("device token polling",o).message}}})}async function Sl(e){let t=await gl(e.signal);return e.notify({type:"device_code",userCode:t.userCode,verificationUri:t.verificationUriComplete??t.verificationUri,intervalSeconds:t.intervalSeconds,expiresInSeconds:t.expiresInSeconds}),Cl(t,e.signal)}async function El(e,t){let o=await Mo(Ks,{grant_type:"refresh_token",client_id:Lo,refresh_token:e},t);if(!o.ok)throw Uo("token refresh",o);return Xs(o.body,e)}var qs={name:"xAI (Grok/X subscription)",isSubscription:!0,loginLabel:"Sign in with SuperGrok or X Premium",login:Sl,refresh:(e,t)=>El(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};function Js(){Ya({anthropic:()=>os,openaiCodex:()=>bs,openaiChatGPT:()=>xs,githubCopilot:()=>us,openrouter:()=>Ls,kimiCoding:()=>fs,meta:()=>Ss,xai:()=>qs,radius:Ws})}Ga(Hr);Js();await import("./chunk-n09zsaws.js");