@bkm016/basalt 0.1.36 → 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.
- package/chunk-02kyx0dt.js +3 -0
- package/chunk-19nje7ny.js +5 -0
- package/chunk-1jtnjzrz.js +3 -0
- package/chunk-1rt7fvft.js +51 -0
- package/chunk-23qfxx3v.js +3 -0
- package/chunk-28dpfw91.js +20 -0
- package/chunk-2bz3h7k7.js +18 -0
- package/chunk-2etdp9zt.js +3 -0
- package/chunk-3bc88p88.js +2 -0
- package/chunk-3bqs901a.js +3 -0
- package/chunk-412mm63g.js +3 -0
- package/chunk-4kg028qe.js +3 -0
- package/chunk-4ry04733.js +2 -0
- package/chunk-4zvzk6m5.js +25 -0
- package/chunk-5ngmwd2s.js +3 -0
- package/chunk-5yzts6r0.js +3 -0
- package/chunk-6bvjnr88.js +3 -0
- package/chunk-76jjaj1p.js +7 -0
- package/chunk-792xwgne.js +2 -0
- package/chunk-7ph88zkj.js +3 -0
- package/chunk-7t89zqqx.js +8 -0
- package/chunk-80vdhw6b.js +2 -0
- package/chunk-89aqq5v0.js +59 -0
- package/chunk-8bcc3rqc.js +2 -0
- package/chunk-8bvjjs3r.js +3 -0
- package/chunk-97531m3c.js +2 -0
- package/chunk-9b4ssdy4.js +3 -0
- package/chunk-9map5c1b.js +12 -0
- package/chunk-a0ycrvgz.js +2 -0
- package/chunk-ah2ttnaa.js +2 -0
- package/chunk-awe58cxg.js +3175 -0
- package/chunk-b3ss17r8.js +547 -0
- package/chunk-b5ph3ffy.js +39 -0
- package/chunk-bkabw9yr.js +3 -0
- package/chunk-cz9r99b6.js +2 -0
- package/chunk-d57kcznk.js +16 -0
- package/chunk-ebmmdfq3.js +2 -0
- package/chunk-etf8mj2z.js +2 -0
- package/chunk-fkgx9eab.js +2 -0
- package/chunk-fmvs5wd0.js +11 -0
- package/chunk-fpksd95h.js +3 -0
- package/chunk-hj1zcq3p.js +13 -0
- package/chunk-hnqtkgcq.js +3 -0
- package/chunk-hrxkr8a8.js +3 -0
- package/chunk-jaat2z8t.js +117 -0
- package/chunk-jkc887x8.js +2 -0
- package/chunk-jnas3anm.js +3 -0
- package/chunk-k3p05x7q.js +2 -0
- package/chunk-k6fqtjt8.js +3 -0
- package/chunk-kh4b25x0.js +12 -0
- package/chunk-kn8p9hm4.js +3 -0
- package/chunk-kxznfjhk.js +2 -0
- package/chunk-ma4nhnnj.js +3 -0
- package/chunk-n09zsaws.js +60 -0
- package/chunk-nb7c0e4a.js +10 -0
- package/chunk-pvbaf50c.js +7 -0
- package/chunk-pzg6f8rv.js +3 -0
- package/chunk-q7scf6rq.js +5 -0
- package/chunk-qc0d97yy.js +9 -0
- package/chunk-qn316bye.js +3 -0
- package/chunk-rapgtezp.js +3 -0
- package/chunk-rbz68jdh.js +2 -0
- package/chunk-rkq3zqph.js +3 -0
- package/chunk-rva3kxc4.js +3 -0
- package/chunk-s8ce8wwb.js +5 -0
- package/chunk-srmxyfvj.js +4 -0
- package/chunk-ss48r7hh.js +2 -0
- package/chunk-sxrwwyp7.js +3 -0
- package/chunk-tb3tj3ct.js +2 -0
- package/chunk-trf8d8md.js +2 -0
- package/chunk-v312dzv1.js +2 -0
- package/chunk-v9pc3ad7.js +3 -0
- package/chunk-vq3b921g.js +2 -0
- package/chunk-w8arnzsm.js +10 -0
- package/chunk-wa3w6q66.js +2 -0
- package/chunk-wyaep3eb.js +103 -0
- package/chunk-x31xqemq.js +3 -0
- package/chunk-x4nt43pv.js +2 -0
- package/chunk-xjr4j102.js +31 -0
- package/chunk-xp5p6tsp.js +286 -0
- package/chunk-xtzxv389.js +3 -0
- package/chunk-y91ea95f.js +7 -0
- package/chunk-yyeq63ns.js +2 -0
- package/chunk-z1hbxv39.js +2 -0
- package/chunk-zej3kgxg.js +5 -0
- package/chunk-zkhn196x.js +25 -0
- package/chunk-zztar24h.js +8 -0
- package/compiled.js +13 -13
- package/package.json +1 -1
- package/ui-test-worker.js +58 -57
- package/web/chunk-0qmwgbg8.js +1 -0
- package/web/chunk-0qmwgbg8.js.br +0 -0
- package/web/chunk-0qmwgbg8.js.gz +0 -0
- package/web/chunk-0vavwwh2.js +2 -0
- package/web/chunk-0vavwwh2.js.br +0 -0
- package/web/chunk-0vavwwh2.js.gz +0 -0
- package/web/chunk-0vmbj6hc.js +89 -0
- package/web/chunk-0vmbj6hc.js.br +0 -0
- package/web/chunk-0vmbj6hc.js.gz +0 -0
- package/web/chunk-17qjx34e.js +1 -0
- package/web/chunk-17qjx34e.js.br +0 -0
- package/web/chunk-17qjx34e.js.gz +0 -0
- package/web/chunk-1mkzfr1m.js +2 -0
- package/web/chunk-1mkzfr1m.js.br +0 -0
- package/web/chunk-1mkzfr1m.js.gz +0 -0
- package/web/chunk-1v45hcve.js +1 -0
- package/web/chunk-1v45hcve.js.br +0 -0
- package/web/chunk-1v45hcve.js.gz +0 -0
- package/web/chunk-1vewct29.js +78 -0
- package/web/chunk-1vewct29.js.br +0 -0
- package/web/chunk-1vewct29.js.gz +0 -0
- package/web/chunk-2hz3atj2.js +1 -0
- package/web/chunk-2hz3atj2.js.br +0 -0
- package/web/chunk-2hz3atj2.js.gz +0 -0
- package/web/chunk-3c66z204.js +1 -0
- package/web/chunk-3c66z204.js.br +0 -0
- package/web/chunk-3c66z204.js.gz +0 -0
- package/web/chunk-3ctk7p8b.js +200 -0
- package/web/chunk-3ctk7p8b.js.br +0 -0
- package/web/chunk-3ctk7p8b.js.gz +0 -0
- package/web/chunk-3rnbw3ds.js +2 -0
- package/web/chunk-3rnbw3ds.js.br +0 -0
- package/web/chunk-3rnbw3ds.js.gz +0 -0
- package/web/chunk-3t6c1rn7.js +2 -0
- package/web/chunk-3t6c1rn7.js.br +0 -0
- package/web/chunk-3t6c1rn7.js.gz +0 -0
- package/web/chunk-48f75wpj.js +1 -0
- package/web/chunk-48f75wpj.js.br +0 -0
- package/web/chunk-48f75wpj.js.gz +0 -0
- package/web/chunk-4sr7g3z6.js +70 -0
- package/web/chunk-4sr7g3z6.js.br +0 -0
- package/web/chunk-4sr7g3z6.js.gz +0 -0
- package/web/chunk-54kxhs8a.js +1 -0
- package/web/chunk-54kxhs8a.js.br +0 -0
- package/web/chunk-54kxhs8a.js.gz +0 -0
- package/web/chunk-5cbw7v9g.js +324 -0
- package/web/chunk-5cbw7v9g.js.br +0 -0
- package/web/chunk-5cbw7v9g.js.gz +0 -0
- package/web/chunk-5kxhdpsw.js +99 -0
- package/web/chunk-5kxhdpsw.js.br +0 -0
- package/web/chunk-5kxhdpsw.js.gz +0 -0
- package/web/chunk-5s16b1h5.js +2 -0
- package/web/chunk-5s16b1h5.js.br +0 -0
- package/web/chunk-5s16b1h5.js.gz +0 -0
- package/web/chunk-5z2f4vfh.js +1 -0
- package/web/chunk-5z2f4vfh.js.br +0 -0
- package/web/chunk-5z2f4vfh.js.gz +0 -0
- package/web/chunk-664zwasq.js +217 -0
- package/web/chunk-664zwasq.js.br +0 -0
- package/web/chunk-664zwasq.js.gz +0 -0
- package/web/chunk-6hgxmv17.js +1 -0
- package/web/chunk-6hgxmv17.js.br +0 -0
- package/web/chunk-6hgxmv17.js.gz +0 -0
- package/web/chunk-6wesgn4j.js +332 -0
- package/web/chunk-6wesgn4j.js.br +0 -0
- package/web/chunk-6wesgn4j.js.gz +0 -0
- package/web/chunk-6xnzhe0e.js +12 -0
- package/web/chunk-6xnzhe0e.js.br +0 -0
- package/web/chunk-6xnzhe0e.js.gz +0 -0
- package/web/chunk-73effb3e.js +1 -0
- package/web/chunk-73effb3e.js.br +0 -0
- package/web/chunk-73effb3e.js.gz +0 -0
- package/web/chunk-744jv40n.js +7 -0
- package/web/chunk-744jv40n.js.br +0 -0
- package/web/chunk-744jv40n.js.gz +0 -0
- package/web/chunk-74x21fpx.js +23 -0
- package/web/chunk-74x21fpx.js.br +0 -0
- package/web/chunk-74x21fpx.js.gz +0 -0
- package/web/chunk-75jp6b07.js +1 -0
- package/web/chunk-75jp6b07.js.br +0 -0
- package/web/chunk-75jp6b07.js.gz +0 -0
- package/web/chunk-776d411a.js +1143 -0
- package/web/chunk-776d411a.js.br +0 -0
- package/web/chunk-776d411a.js.gz +0 -0
- package/web/chunk-77fdf0t8.js +1 -0
- package/web/chunk-77fdf0t8.js.br +0 -0
- package/web/chunk-77fdf0t8.js.gz +0 -0
- package/web/chunk-85cyf9df.js +1 -0
- package/web/chunk-85cyf9df.js.br +0 -0
- package/web/chunk-85cyf9df.js.gz +0 -0
- package/web/chunk-8kxc78xp.js +4 -0
- package/web/chunk-8kxc78xp.js.br +0 -0
- package/web/chunk-8kxc78xp.js.gz +0 -0
- package/web/chunk-9j7v0e4v.js +2 -0
- package/web/chunk-9j7v0e4v.js.br +0 -0
- package/web/chunk-9j7v0e4v.js.gz +0 -0
- package/web/chunk-9kfxbebp.js +2 -0
- package/web/chunk-9kfxbebp.js.br +1 -0
- package/web/chunk-9kfxbebp.js.gz +0 -0
- package/web/chunk-b1x8wmyp.js +1 -0
- package/web/chunk-b1x8wmyp.js.br +2 -0
- package/web/chunk-b1x8wmyp.js.gz +0 -0
- package/web/chunk-bpy0qc5f.js +1 -0
- package/web/chunk-bpy0qc5f.js.br +0 -0
- package/web/chunk-bpy0qc5f.js.gz +0 -0
- package/web/chunk-brsvdef4.js +1 -0
- package/web/chunk-brsvdef4.js.br +0 -0
- package/web/chunk-brsvdef4.js.gz +0 -0
- package/web/chunk-bs8vnwtv.js +106 -0
- package/web/chunk-bs8vnwtv.js.br +0 -0
- package/web/chunk-bs8vnwtv.js.gz +0 -0
- package/web/chunk-cd3hhgn9.js +2 -0
- package/web/chunk-cd3hhgn9.js.br +0 -0
- package/web/chunk-cd3hhgn9.js.gz +0 -0
- package/web/chunk-ckpx6ky8.js +2 -0
- package/web/chunk-ckpx6ky8.js.br +0 -0
- package/web/chunk-ckpx6ky8.js.gz +0 -0
- package/web/chunk-cn4846p5.js +140 -0
- package/web/chunk-cn4846p5.js.br +0 -0
- package/web/chunk-cn4846p5.js.gz +0 -0
- package/web/chunk-cngcze57.js +84 -0
- package/web/chunk-cngcze57.js.br +0 -0
- package/web/chunk-cngcze57.js.gz +0 -0
- package/web/chunk-csg9anab.js +62 -0
- package/web/chunk-csg9anab.js.br +0 -0
- package/web/chunk-csg9anab.js.gz +0 -0
- package/web/chunk-ct98jt0b.js +2 -0
- package/web/chunk-ct98jt0b.js.br +0 -0
- package/web/chunk-ct98jt0b.js.gz +0 -0
- package/web/chunk-d67p0nr5.js +8 -0
- package/web/chunk-d67p0nr5.js.br +0 -0
- package/web/chunk-d67p0nr5.js.gz +0 -0
- package/web/chunk-dfv95z6w.js +1 -0
- package/web/chunk-dfv95z6w.js.br +0 -0
- package/web/chunk-dfv95z6w.js.gz +0 -0
- package/web/chunk-dqynqkew.js +3 -0
- package/web/chunk-dqynqkew.js.br +0 -0
- package/web/chunk-dqynqkew.js.gz +0 -0
- package/web/chunk-drn8wj2p.js +41 -0
- package/web/chunk-drn8wj2p.js.br +0 -0
- package/web/chunk-drn8wj2p.js.gz +0 -0
- package/web/chunk-e0r89rgm.js +2 -0
- package/web/chunk-e0r89rgm.js.br +0 -0
- package/web/chunk-e0r89rgm.js.gz +0 -0
- package/web/chunk-e6ffgm2z.js +89 -0
- package/web/chunk-e6ffgm2z.js.br +0 -0
- package/web/chunk-e6ffgm2z.js.gz +0 -0
- package/web/chunk-ebphre6k.js +292 -0
- package/web/chunk-ebphre6k.js.br +0 -0
- package/web/chunk-ebphre6k.js.gz +0 -0
- package/web/chunk-edeebkv0.js +2 -0
- package/web/chunk-edeebkv0.js.br +0 -0
- package/web/chunk-edeebkv0.js.gz +0 -0
- package/web/chunk-edkvcg8g.js +1 -0
- package/web/chunk-edkvcg8g.js.br +0 -0
- package/web/chunk-edkvcg8g.js.gz +0 -0
- package/web/chunk-evt920fg.js +142 -0
- package/web/chunk-evt920fg.js.br +0 -0
- package/web/chunk-evt920fg.js.gz +0 -0
- package/web/chunk-ezehzx5e.js +1 -0
- package/web/chunk-ezehzx5e.js.br +2 -0
- package/web/chunk-ezehzx5e.js.gz +0 -0
- package/web/chunk-f020aqdg.js +38 -0
- package/web/chunk-f020aqdg.js.br +0 -0
- package/web/chunk-f020aqdg.js.gz +0 -0
- package/web/chunk-f5a5x6be.js +1 -0
- package/web/chunk-f5a5x6be.js.br +0 -0
- package/web/chunk-f5a5x6be.js.gz +0 -0
- package/web/chunk-f9rv8b13.js +1 -0
- package/web/chunk-f9rv8b13.js.br +0 -0
- package/web/chunk-f9rv8b13.js.gz +0 -0
- package/web/chunk-fkmw2m49.js +1 -0
- package/web/chunk-fkmw2m49.js.br +0 -0
- package/web/chunk-fkmw2m49.js.gz +0 -0
- package/web/chunk-fn0hha9d.js +2 -0
- package/web/chunk-fn0hha9d.js.br +0 -0
- package/web/chunk-fn0hha9d.js.gz +0 -0
- package/web/chunk-fp5ny5dy.js +4 -0
- package/web/chunk-fp5ny5dy.js.br +0 -0
- package/web/chunk-fp5ny5dy.js.gz +0 -0
- package/web/chunk-fwckng4e.js +34 -0
- package/web/chunk-fwckng4e.js.br +0 -0
- package/web/chunk-fwckng4e.js.gz +0 -0
- package/web/chunk-g7yyp4ks.js +2 -0
- package/web/chunk-g7yyp4ks.js.br +0 -0
- package/web/chunk-g7yyp4ks.js.gz +0 -0
- package/web/chunk-gbhkp5f4.js +1 -0
- package/web/chunk-gbhkp5f4.js.br +2 -0
- package/web/chunk-gbhkp5f4.js.gz +0 -0
- package/web/chunk-ghz85g7f.js +1 -0
- package/web/chunk-ghz85g7f.js.br +0 -0
- package/web/chunk-ghz85g7f.js.gz +0 -0
- package/web/chunk-gpjdkgxz.js +2 -0
- package/web/chunk-gpjdkgxz.js.br +0 -0
- package/web/chunk-gpjdkgxz.js.gz +0 -0
- package/web/chunk-h3d8gb7m.js +1 -0
- package/web/chunk-h3d8gb7m.js.br +0 -0
- package/web/chunk-h3d8gb7m.js.gz +0 -0
- package/web/chunk-h47k4j7f.js +1 -0
- package/web/chunk-h47k4j7f.js.br +0 -0
- package/web/chunk-h47k4j7f.js.gz +0 -0
- package/web/chunk-h702ns45.js +1 -0
- package/web/chunk-h702ns45.js.br +0 -0
- package/web/chunk-h702ns45.js.gz +0 -0
- package/web/chunk-j3tjbge9.js +1 -0
- package/web/chunk-j3tjbge9.js.br +0 -0
- package/web/chunk-j3tjbge9.js.gz +0 -0
- package/web/chunk-j91f1v68.js +2 -0
- package/web/chunk-j91f1v68.js.br +0 -0
- package/web/chunk-j91f1v68.js.gz +0 -0
- package/web/chunk-jd82z5gg.js +1 -0
- package/web/chunk-jd82z5gg.js.br +0 -0
- package/web/chunk-jd82z5gg.js.gz +0 -0
- package/web/chunk-jmksme0n.js +2 -0
- package/web/chunk-jmksme0n.js.br +0 -0
- package/web/chunk-jmksme0n.js.gz +0 -0
- package/web/chunk-jz0wjyzp.js +7 -0
- package/web/chunk-jz0wjyzp.js.br +0 -0
- package/web/chunk-jz0wjyzp.js.gz +0 -0
- package/web/chunk-ka8jrbr5.js +55 -0
- package/web/chunk-ka8jrbr5.js.br +0 -0
- package/web/chunk-ka8jrbr5.js.gz +0 -0
- package/web/chunk-m770h1wv.js +2 -0
- package/web/chunk-m770h1wv.js.br +0 -0
- package/web/chunk-m770h1wv.js.gz +0 -0
- package/web/chunk-mfsdyw6v.js +2 -0
- package/web/chunk-mfsdyw6v.js.br +0 -0
- package/web/chunk-mfsdyw6v.js.gz +0 -0
- package/web/chunk-mvmpr9bn.js +1 -0
- package/web/chunk-mvmpr9bn.js.br +0 -0
- package/web/chunk-mvmpr9bn.js.gz +0 -0
- package/web/chunk-mx1e3jgh.js +1 -0
- package/web/chunk-mx1e3jgh.js.br +0 -0
- package/web/chunk-mx1e3jgh.js.gz +0 -0
- package/web/chunk-my4zxtxx.js +2 -0
- package/web/chunk-my4zxtxx.js.br +0 -0
- package/web/chunk-my4zxtxx.js.gz +0 -0
- package/web/chunk-n7nx158t.js +1 -0
- package/web/chunk-n7nx158t.js.br +0 -0
- package/web/chunk-n7nx158t.js.gz +0 -0
- package/web/chunk-na88frn3.js +1 -0
- package/web/chunk-na88frn3.js.br +0 -0
- package/web/chunk-na88frn3.js.gz +0 -0
- package/web/chunk-nbncq48b.js +1 -0
- package/web/chunk-nbncq48b.js.br +0 -0
- package/web/chunk-nbncq48b.js.gz +0 -0
- package/web/chunk-nyydkfyf.js +1 -0
- package/web/chunk-nyydkfyf.js.br +0 -0
- package/web/chunk-nyydkfyf.js.gz +0 -0
- package/web/chunk-nz06k08x.js +39 -0
- package/web/chunk-nz06k08x.js.br +0 -0
- package/web/chunk-nz06k08x.js.gz +0 -0
- package/web/chunk-p62swsj6.js +139 -0
- package/web/chunk-p62swsj6.js.br +0 -0
- package/web/chunk-p62swsj6.js.gz +0 -0
- package/web/chunk-pajjgx94.js +169 -0
- package/web/chunk-pajjgx94.js.br +0 -0
- package/web/chunk-pajjgx94.js.gz +0 -0
- package/web/chunk-phdpzq61.js +370 -0
- package/web/chunk-phdpzq61.js.br +0 -0
- package/web/chunk-phdpzq61.js.gz +0 -0
- package/web/chunk-pj9r4ha1.js +2 -0
- package/web/chunk-pj9r4ha1.js.br +0 -0
- package/web/chunk-pj9r4ha1.js.gz +0 -0
- package/web/chunk-pqvre6md.js +24 -0
- package/web/chunk-pqvre6md.js.br +0 -0
- package/web/chunk-pqvre6md.js.gz +0 -0
- package/web/chunk-pvq527d1.js +303 -0
- package/web/chunk-pvq527d1.js.br +0 -0
- package/web/chunk-pvq527d1.js.gz +0 -0
- package/web/chunk-pzbqpfpj.js +24 -0
- package/web/chunk-pzbqpfpj.js.br +0 -0
- package/web/chunk-pzbqpfpj.js.gz +0 -0
- package/web/chunk-q3v1563q.js +2 -0
- package/web/chunk-q3v1563q.js.br +0 -0
- package/web/chunk-q3v1563q.js.gz +0 -0
- package/web/chunk-q6vt7t8d.js +2 -0
- package/web/chunk-q6vt7t8d.js.br +0 -0
- package/web/chunk-q6vt7t8d.js.gz +0 -0
- package/web/chunk-q990zhg4.js +1 -0
- package/web/chunk-q990zhg4.js.br +0 -0
- package/web/chunk-q990zhg4.js.gz +0 -0
- package/web/chunk-qed51xj9.js +2 -0
- package/web/chunk-qed51xj9.js.br +0 -0
- package/web/chunk-qed51xj9.js.gz +0 -0
- package/web/chunk-r9m8jh7x.js +2 -0
- package/web/chunk-r9m8jh7x.js.br +0 -0
- package/web/chunk-r9m8jh7x.js.gz +0 -0
- package/web/chunk-rjax57j0.js +40 -0
- package/web/chunk-rjax57j0.js.br +0 -0
- package/web/chunk-rjax57j0.js.gz +0 -0
- package/web/chunk-s00tks2b.js +98 -0
- package/web/chunk-s00tks2b.js.br +0 -0
- package/web/chunk-s00tks2b.js.gz +0 -0
- package/web/chunk-s3symq0h.js +1 -0
- package/web/chunk-s3symq0h.js.br +0 -0
- package/web/chunk-s3symq0h.js.gz +0 -0
- package/web/chunk-sh2d0212.js +1 -0
- package/web/chunk-sh2d0212.js.br +0 -0
- package/web/chunk-sh2d0212.js.gz +0 -0
- package/web/chunk-t8ksmf3z.js +2 -0
- package/web/chunk-t8ksmf3z.js.br +0 -0
- package/web/chunk-t8ksmf3z.js.gz +0 -0
- package/web/chunk-te4ab7ee.css +1 -0
- package/web/chunk-te4ab7ee.css.br +0 -0
- package/web/chunk-te4ab7ee.css.gz +0 -0
- package/web/chunk-tjhxbt15.js +1 -0
- package/web/chunk-tjhxbt15.js.br +0 -0
- package/web/chunk-tjhxbt15.js.gz +0 -0
- package/web/chunk-tqr5maem.js +291 -0
- package/web/chunk-tqr5maem.js.br +0 -0
- package/web/chunk-tqr5maem.js.gz +0 -0
- package/web/chunk-tt3vgkx6.js +7 -0
- package/web/chunk-tt3vgkx6.js.br +0 -0
- package/web/chunk-tt3vgkx6.js.gz +0 -0
- package/web/chunk-v56w6y8n.js +2 -0
- package/web/chunk-v56w6y8n.js.br +0 -0
- package/web/chunk-v56w6y8n.js.gz +0 -0
- package/web/chunk-v65dz9y5.js +1 -0
- package/web/chunk-v65dz9y5.js.br +0 -0
- package/web/chunk-v65dz9y5.js.gz +0 -0
- package/web/chunk-vaspzebe.js +1 -0
- package/web/chunk-vaspzebe.js.br +0 -0
- package/web/chunk-vaspzebe.js.gz +0 -0
- package/web/chunk-ve5dccwy.js +1 -0
- package/web/chunk-ve5dccwy.js.br +0 -0
- package/web/chunk-ve5dccwy.js.gz +0 -0
- package/web/chunk-vsxzq4nb.js +1 -0
- package/web/chunk-vsxzq4nb.js.br +0 -0
- package/web/chunk-vsxzq4nb.js.gz +0 -0
- package/web/chunk-vvn66f2x.js +16 -0
- package/web/chunk-vvn66f2x.js.br +0 -0
- package/web/chunk-vvn66f2x.js.gz +0 -0
- package/web/chunk-vvqey05d.js +1 -0
- package/web/chunk-vvqey05d.js.br +2 -0
- package/web/chunk-vvqey05d.js.gz +0 -0
- package/web/chunk-w6ajcbm8.js +1 -0
- package/web/chunk-w6ajcbm8.js.br +0 -0
- package/web/chunk-w6ajcbm8.js.gz +0 -0
- package/web/chunk-w6p6dy3k.js +2 -0
- package/web/chunk-w6p6dy3k.js.br +0 -0
- package/web/chunk-w6p6dy3k.js.gz +0 -0
- package/web/chunk-wy1k8vz2.js +1 -0
- package/web/chunk-wy1k8vz2.js.br +0 -0
- package/web/chunk-wy1k8vz2.js.gz +0 -0
- package/web/chunk-wzgv2gv2.js +120 -0
- package/web/chunk-wzgv2gv2.js.br +0 -0
- package/web/chunk-wzgv2gv2.js.gz +0 -0
- package/web/chunk-x78hqhxv.js +1 -0
- package/web/chunk-x78hqhxv.js.br +2 -0
- package/web/chunk-x78hqhxv.js.gz +0 -0
- package/web/chunk-x7mw8704.js +36 -0
- package/web/chunk-x7mw8704.js.br +0 -0
- package/web/chunk-x7mw8704.js.gz +0 -0
- package/web/chunk-x85z35es.js +2 -0
- package/web/chunk-x85z35es.js.br +0 -0
- package/web/chunk-x85z35es.js.gz +0 -0
- package/web/chunk-xbrhmxd8.js +214 -0
- package/web/chunk-xbrhmxd8.js.br +0 -0
- package/web/chunk-xbrhmxd8.js.gz +0 -0
- package/web/chunk-xjpqg11m.js +1 -0
- package/web/chunk-xjpqg11m.js.br +0 -0
- package/web/chunk-xjpqg11m.js.gz +0 -0
- package/web/chunk-xkqekh81.js +2 -0
- package/web/chunk-xkqekh81.js.br +0 -0
- package/web/chunk-xkqekh81.js.gz +0 -0
- package/web/chunk-y2x9v76f.js +2 -0
- package/web/chunk-y2x9v76f.js.br +0 -0
- package/web/chunk-y2x9v76f.js.gz +0 -0
- package/web/chunk-y48mj5d7.js +1 -0
- package/web/chunk-y48mj5d7.js.br +0 -0
- package/web/chunk-y48mj5d7.js.gz +0 -0
- package/web/chunk-ykc1rttf.js +1 -0
- package/web/chunk-ykc1rttf.js.br +0 -0
- package/web/chunk-ykc1rttf.js.gz +0 -0
- package/web/chunk-yyw0rdyy.js +1 -0
- package/web/chunk-yyw0rdyy.js.br +0 -0
- package/web/chunk-yyw0rdyy.js.gz +0 -0
- package/web/chunk-yzyrc28t.js +30 -0
- package/web/chunk-yzyrc28t.js.br +0 -0
- package/web/chunk-yzyrc28t.js.gz +0 -0
- package/web/chunk-z7j6wnn3.js +2 -0
- package/web/chunk-z7j6wnn3.js.br +0 -0
- package/web/chunk-z7j6wnn3.js.gz +0 -0
- package/web/chunk-z8fgdsx5.js +1 -0
- package/web/chunk-z8fgdsx5.js.br +0 -0
- package/web/chunk-z8fgdsx5.js.gz +0 -0
- package/web/chunk-zcjdarjr.js +1 -0
- package/web/chunk-zcjdarjr.js.br +0 -0
- package/web/chunk-zcjdarjr.js.gz +0 -0
- package/web/explorer-ttd27vzr.png +0 -0
- package/web/finder-aynbqpvz.png +0 -0
- package/web/idea-c8rwk1e2.png +0 -0
- package/web/index.html +3 -13
- package/web/index.html.br +0 -0
- package/web/index.html.gz +0 -0
- package/web/manifest-g1mfa85c.webmanifest +35 -0
- package/web/manifest-g1mfa85c.webmanifest.br +0 -0
- package/web/manifest-g1mfa85c.webmanifest.gz +0 -0
- package/web/manifest.webmanifest +2 -2
- package/web/manifest.webmanifest.br +0 -0
- package/web/manifest.webmanifest.gz +0 -0
- package/web/sw.js +36 -17
- package/web/sw.js.br +0 -0
- package/web/sw.js.gz +0 -0
- package/web/vscode-33qgcrqp.png +0 -0
- package/worker.js +1 -1
- package/chunk-082x3g29.js +0 -3
- package/chunk-0aaf270z.js +0 -3
- package/chunk-0dqv9x0y.js +0 -51
- package/chunk-0ns02fzq.js +0 -2
- package/chunk-0y13kfpt.js +0 -5
- package/chunk-1753m6xk.js +0 -4179
- package/chunk-24ae99b6.js +0 -5
- package/chunk-2cp8why4.js +0 -2
- package/chunk-3bdzn4h2.js +0 -2
- package/chunk-48m0w8xg.js +0 -2
- package/chunk-4pr7ykh0.js +0 -2
- package/chunk-4qtw5cga.js +0 -12
- package/chunk-4yqge35f.js +0 -3
- package/chunk-65rd9zn4.js +0 -3
- package/chunk-67ehvv4n.js +0 -44
- package/chunk-6wm62kte.js +0 -18
- package/chunk-6zkggkdm.js +0 -13
- package/chunk-78ferdza.js +0 -3
- package/chunk-794r8w6m.js +0 -2
- package/chunk-7azn0brs.js +0 -7
- package/chunk-7wh4n0yg.js +0 -2
- package/chunk-7z0wh161.js +0 -25
- package/chunk-95aqrqnh.js +0 -2
- package/chunk-9nkb5q43.js +0 -3
- package/chunk-a0zcps2d.js +0 -2
- package/chunk-a23pv6tv.js +0 -3
- package/chunk-adb2nbxk.js +0 -2
- package/chunk-as2ty5w5.js +0 -3
- package/chunk-b84y794v.js +0 -3
- package/chunk-bh80e336.js +0 -3
- package/chunk-c6azecvs.js +0 -3
- package/chunk-cc8h8mz9.js +0 -2
- package/chunk-cdb6caq7.js +0 -3
- package/chunk-cjdbsa9s.js +0 -3
- package/chunk-cnqgtmwm.js +0 -10
- package/chunk-cwn9vs1a.js +0 -3
- package/chunk-cxybp3fn.js +0 -8
- package/chunk-dea2htm4.js +0 -2
- package/chunk-e01wravf.js +0 -12
- package/chunk-f0pz8pvb.js +0 -5
- package/chunk-fsekbhqb.js +0 -3
- package/chunk-fvmrsrmq.js +0 -3
- package/chunk-fwdhn0gw.js +0 -7
- package/chunk-h7x8g57v.js +0 -9
- package/chunk-h8qhy3px.js +0 -39
- package/chunk-hsvchrh3.js +0 -7
- package/chunk-j1peg724.js +0 -504
- package/chunk-j2cse817.js +0 -63
- package/chunk-j3jzgw98.js +0 -31
- package/chunk-jmzdtefg.js +0 -2
- package/chunk-k0e6n6yy.js +0 -3
- package/chunk-mb2jqd5z.js +0 -3
- package/chunk-nbgtqpay.js +0 -3
- package/chunk-prfczhpq.js +0 -10
- package/chunk-pv25a7sw.js +0 -2
- package/chunk-q8m2x20d.js +0 -286
- package/chunk-qnkxeh37.js +0 -3
- package/chunk-qvfrv3rb.js +0 -59
- package/chunk-r14x07ez.js +0 -2
- package/chunk-r1kah65k.js +0 -2
- package/chunk-r6pt44wk.js +0 -60
- package/chunk-rhkw8ygf.js +0 -3
- package/chunk-rvqeb7gr.js +0 -3
- package/chunk-rwa7mfwa.js +0 -2
- package/chunk-sj46f002.js +0 -2
- package/chunk-sp89jja7.js +0 -3
- package/chunk-sss5x2ak.js +0 -2
- package/chunk-szn4y5mx.js +0 -25
- package/chunk-t05q9ksf.js +0 -2
- package/chunk-tb66q678.js +0 -11
- package/chunk-tej75y8n.js +0 -2
- package/chunk-tmfr2ym8.js +0 -4
- package/chunk-tnay319j.js +0 -3
- package/chunk-txwheg1n.js +0 -2
- package/chunk-ve6n38r4.js +0 -16
- package/chunk-vfa49qcy.js +0 -3
- package/chunk-wcy1r6vv.js +0 -2
- package/chunk-wj6am3ag.js +0 -3
- package/chunk-x0afp8wt.js +0 -3
- package/chunk-xe627eyp.js +0 -20
- package/chunk-y18ey7s9.js +0 -8
- package/chunk-y9r7tt53.js +0 -3
- package/chunk-yq20v3va.js +0 -3
- package/chunk-yyg4ygv7.js +0 -2
- package/chunk-z2zhr4e5.js +0 -3
- package/chunk-zdtg52xn.js +0 -2
- package/chunk-zrhdrkdb.js +0 -5
- package/web/chunk-0d0fwb7b.js +0 -2
- package/web/chunk-0d0fwb7b.js.br +0 -0
- package/web/chunk-0d0fwb7b.js.gz +0 -0
- package/web/chunk-0jm4zyrt.js +0 -1
- package/web/chunk-0jm4zyrt.js.br +0 -0
- package/web/chunk-0jm4zyrt.js.gz +0 -0
- package/web/chunk-0pp7dzx1.js +0 -1
- package/web/chunk-0pp7dzx1.js.br +0 -0
- package/web/chunk-0pp7dzx1.js.gz +0 -0
- package/web/chunk-0w73jp4n.js +0 -1
- package/web/chunk-0w73jp4n.js.br +0 -0
- package/web/chunk-0w73jp4n.js.gz +0 -0
- package/web/chunk-1416f30c.js +0 -2
- package/web/chunk-1416f30c.js.br +0 -0
- package/web/chunk-1416f30c.js.gz +0 -0
- package/web/chunk-18wyawez.js +0 -30
- package/web/chunk-18wyawez.js.br +0 -0
- package/web/chunk-18wyawez.js.gz +0 -0
- package/web/chunk-19ew9re5.js +0 -1
- package/web/chunk-19ew9re5.js.br +0 -0
- package/web/chunk-19ew9re5.js.gz +0 -0
- package/web/chunk-1mdtr9wk.js +0 -8
- package/web/chunk-1mdtr9wk.js.br +0 -1
- package/web/chunk-1mdtr9wk.js.gz +0 -0
- package/web/chunk-1p4egv85.js +0 -1
- package/web/chunk-1p4egv85.js.br +0 -0
- package/web/chunk-1p4egv85.js.gz +0 -0
- package/web/chunk-1x61dvvr.js +0 -2
- package/web/chunk-1x61dvvr.js.br +0 -0
- package/web/chunk-1x61dvvr.js.gz +0 -0
- package/web/chunk-241n0y1h.js +0 -1
- package/web/chunk-241n0y1h.js.br +0 -0
- package/web/chunk-241n0y1h.js.gz +0 -0
- package/web/chunk-26sgnzb2.js +0 -1
- package/web/chunk-26sgnzb2.js.br +0 -0
- package/web/chunk-26sgnzb2.js.gz +0 -0
- package/web/chunk-2p77pefd.js +0 -1
- package/web/chunk-2p77pefd.js.br +0 -0
- package/web/chunk-2p77pefd.js.gz +0 -0
- package/web/chunk-2ppe5znq.js +0 -1
- package/web/chunk-2ppe5znq.js.br +0 -0
- package/web/chunk-2ppe5znq.js.gz +0 -0
- package/web/chunk-2qzr943m.js +0 -2
- package/web/chunk-2qzr943m.js.br +0 -0
- package/web/chunk-2qzr943m.js.gz +0 -0
- package/web/chunk-32k44660.js +0 -214
- package/web/chunk-32k44660.js.br +0 -0
- package/web/chunk-32k44660.js.gz +0 -0
- package/web/chunk-33zb5a76.js +0 -2
- package/web/chunk-33zb5a76.js.br +0 -0
- package/web/chunk-33zb5a76.js.gz +0 -0
- package/web/chunk-38bzkv9k.js +0 -7
- package/web/chunk-38bzkv9k.js.br +0 -0
- package/web/chunk-38bzkv9k.js.gz +0 -0
- package/web/chunk-42ytz496.js +0 -1
- package/web/chunk-42ytz496.js.br +0 -0
- package/web/chunk-42ytz496.js.gz +0 -0
- package/web/chunk-4749rrqv.js +0 -55
- package/web/chunk-4749rrqv.js.br +0 -0
- package/web/chunk-4749rrqv.js.gz +0 -0
- package/web/chunk-4d57cnh5.js +0 -40
- package/web/chunk-4d57cnh5.js.br +0 -0
- package/web/chunk-4d57cnh5.js.gz +0 -0
- package/web/chunk-4gh3hcrc.js +0 -1
- package/web/chunk-4gh3hcrc.js.br +0 -0
- package/web/chunk-4gh3hcrc.js.gz +0 -0
- package/web/chunk-4hg08mj3.js +0 -1
- package/web/chunk-4hg08mj3.js.br +0 -0
- package/web/chunk-4hg08mj3.js.gz +0 -0
- package/web/chunk-4rra9tt7.js +0 -78
- package/web/chunk-4rra9tt7.js.br +0 -0
- package/web/chunk-4rra9tt7.js.gz +0 -0
- package/web/chunk-572kjbne.js +0 -89
- package/web/chunk-572kjbne.js.br +0 -0
- package/web/chunk-572kjbne.js.gz +0 -0
- package/web/chunk-5hqe3cct.js +0 -98
- package/web/chunk-5hqe3cct.js.br +0 -0
- package/web/chunk-5hqe3cct.js.gz +0 -0
- package/web/chunk-5k4vdcwk.js +0 -24
- package/web/chunk-5k4vdcwk.js.br +0 -0
- package/web/chunk-5k4vdcwk.js.gz +0 -0
- package/web/chunk-5z44jbdc.js +0 -1
- package/web/chunk-5z44jbdc.js.br +0 -0
- package/web/chunk-5z44jbdc.js.gz +0 -0
- package/web/chunk-600x58nm.js +0 -1143
- package/web/chunk-600x58nm.js.br +0 -0
- package/web/chunk-600x58nm.js.gz +0 -0
- package/web/chunk-61djfs0t.js +0 -140
- package/web/chunk-61djfs0t.js.br +0 -0
- package/web/chunk-61djfs0t.js.gz +0 -0
- package/web/chunk-6j4jdvtd.js +0 -1
- package/web/chunk-6j4jdvtd.js.br +0 -0
- package/web/chunk-6j4jdvtd.js.gz +0 -0
- package/web/chunk-74ymgabb.js +0 -2
- package/web/chunk-74ymgabb.js.br +0 -0
- package/web/chunk-74ymgabb.js.gz +0 -0
- package/web/chunk-768vchz5.js +0 -169
- package/web/chunk-768vchz5.js.br +0 -0
- package/web/chunk-768vchz5.js.gz +0 -0
- package/web/chunk-7f87paxe.js +0 -36
- package/web/chunk-7f87paxe.js.br +0 -0
- package/web/chunk-7f87paxe.js.gz +0 -0
- package/web/chunk-7ns0kj87.js +0 -2
- package/web/chunk-7ns0kj87.js.br +0 -0
- package/web/chunk-7ns0kj87.js.gz +0 -0
- package/web/chunk-7vpk9y00.js +0 -1
- package/web/chunk-7vpk9y00.js.br +0 -0
- package/web/chunk-7vpk9y00.js.gz +0 -0
- package/web/chunk-89mc1vj3.js +0 -1
- package/web/chunk-89mc1vj3.js.br +0 -0
- package/web/chunk-89mc1vj3.js.gz +0 -0
- package/web/chunk-8wgpesrk.js +0 -139
- package/web/chunk-8wgpesrk.js.br +0 -0
- package/web/chunk-8wgpesrk.js.gz +0 -0
- package/web/chunk-9nh1aeqs.js +0 -303
- package/web/chunk-9nh1aeqs.js.br +0 -0
- package/web/chunk-9nh1aeqs.js.gz +0 -0
- package/web/chunk-9pgq2ax4.js +0 -1
- package/web/chunk-9pgq2ax4.js.br +0 -0
- package/web/chunk-9pgq2ax4.js.gz +0 -0
- package/web/chunk-9tfs2dg1.js +0 -1
- package/web/chunk-9tfs2dg1.js.br +0 -0
- package/web/chunk-9tfs2dg1.js.gz +0 -0
- package/web/chunk-9wemd2wn.js +0 -41
- package/web/chunk-9wemd2wn.js.br +0 -0
- package/web/chunk-9wemd2wn.js.gz +0 -0
- package/web/chunk-9wsz2j8n.js +0 -1
- package/web/chunk-9wsz2j8n.js.br +0 -0
- package/web/chunk-9wsz2j8n.js.gz +0 -0
- package/web/chunk-9wzvqpre.js +0 -2
- package/web/chunk-9wzvqpre.js.br +0 -0
- package/web/chunk-9wzvqpre.js.gz +0 -0
- package/web/chunk-a48wgrb1.js +0 -1
- package/web/chunk-a48wgrb1.js.br +0 -2
- package/web/chunk-a48wgrb1.js.gz +0 -0
- package/web/chunk-ah8e1y9j.js +0 -4
- package/web/chunk-ah8e1y9j.js.br +0 -0
- package/web/chunk-ah8e1y9j.js.gz +0 -0
- package/web/chunk-amsr9cg2.js +0 -1
- package/web/chunk-amsr9cg2.js.br +0 -0
- package/web/chunk-amsr9cg2.js.gz +0 -0
- package/web/chunk-aps2c5t2.js +0 -16
- package/web/chunk-aps2c5t2.js.br +0 -0
- package/web/chunk-aps2c5t2.js.gz +0 -0
- package/web/chunk-avfynf6y.js +0 -1
- package/web/chunk-avfynf6y.js.br +0 -0
- package/web/chunk-avfynf6y.js.gz +0 -0
- package/web/chunk-b5zrttcx.js +0 -2
- package/web/chunk-b5zrttcx.js.br +0 -0
- package/web/chunk-b5zrttcx.js.gz +0 -0
- package/web/chunk-bvvf024a.js +0 -24
- package/web/chunk-bvvf024a.js.br +0 -0
- package/web/chunk-bvvf024a.js.gz +0 -0
- package/web/chunk-by2dphx7.js +0 -200
- package/web/chunk-by2dphx7.js.br +0 -0
- package/web/chunk-by2dphx7.js.gz +0 -0
- package/web/chunk-c0sc2yy1.js +0 -1
- package/web/chunk-c0sc2yy1.js.br +0 -0
- package/web/chunk-c0sc2yy1.js.gz +0 -0
- package/web/chunk-c612n2pw.js +0 -2
- package/web/chunk-c612n2pw.js.br +0 -0
- package/web/chunk-c612n2pw.js.gz +0 -0
- package/web/chunk-c91rk85x.js +0 -2
- package/web/chunk-c91rk85x.js.br +0 -0
- package/web/chunk-c91rk85x.js.gz +0 -0
- package/web/chunk-catm30vp.js +0 -2
- package/web/chunk-catm30vp.js.br +0 -0
- package/web/chunk-catm30vp.js.gz +0 -0
- package/web/chunk-cbdxzddd.js +0 -142
- package/web/chunk-cbdxzddd.js.br +0 -0
- package/web/chunk-cbdxzddd.js.gz +0 -0
- package/web/chunk-cng693ts.js +0 -2
- package/web/chunk-cng693ts.js.br +0 -0
- package/web/chunk-cng693ts.js.gz +0 -0
- package/web/chunk-d5vcma5a.js +0 -89
- package/web/chunk-d5vcma5a.js.br +0 -0
- package/web/chunk-d5vcma5a.js.gz +0 -0
- package/web/chunk-d6d9cp71.js +0 -1
- package/web/chunk-d6d9cp71.js.br +0 -2
- package/web/chunk-d6d9cp71.js.gz +0 -0
- package/web/chunk-dsghhcew.js +0 -1
- package/web/chunk-dsghhcew.js.br +0 -0
- package/web/chunk-dsghhcew.js.gz +0 -0
- package/web/chunk-dt2e6evf.js +0 -1
- package/web/chunk-dt2e6evf.js.br +0 -0
- package/web/chunk-dt2e6evf.js.gz +0 -0
- package/web/chunk-dxrsmcah.js +0 -1
- package/web/chunk-dxrsmcah.js.br +0 -0
- package/web/chunk-dxrsmcah.js.gz +0 -0
- package/web/chunk-ent5zx24.js +0 -1
- package/web/chunk-ent5zx24.js.br +0 -2
- package/web/chunk-ent5zx24.js.gz +0 -0
- package/web/chunk-f4n1q3mf.js +0 -1
- package/web/chunk-f4n1q3mf.js.br +0 -0
- package/web/chunk-f4n1q3mf.js.gz +0 -0
- package/web/chunk-fdfrv6bc.js +0 -1
- package/web/chunk-fdfrv6bc.js.br +0 -2
- package/web/chunk-fdfrv6bc.js.gz +0 -0
- package/web/chunk-fh44xz70.js +0 -1
- package/web/chunk-fh44xz70.js.br +0 -0
- package/web/chunk-fh44xz70.js.gz +0 -0
- package/web/chunk-fkbp72gk.js +0 -1
- package/web/chunk-fkbp72gk.js.br +0 -0
- package/web/chunk-fkbp72gk.js.gz +0 -0
- package/web/chunk-fzkjgwzq.js +0 -4
- package/web/chunk-fzkjgwzq.js.br +0 -0
- package/web/chunk-fzkjgwzq.js.gz +0 -0
- package/web/chunk-gf2gznsb.js +0 -38
- package/web/chunk-gf2gznsb.js.br +0 -0
- package/web/chunk-gf2gznsb.js.gz +0 -0
- package/web/chunk-gne1ybac.js +0 -2
- package/web/chunk-gne1ybac.js.br +0 -0
- package/web/chunk-gne1ybac.js.gz +0 -0
- package/web/chunk-gws1fj71.js +0 -106
- package/web/chunk-gws1fj71.js.br +0 -0
- package/web/chunk-gws1fj71.js.gz +0 -0
- package/web/chunk-h4m88fg8.js +0 -2
- package/web/chunk-h4m88fg8.js.br +0 -0
- package/web/chunk-h4m88fg8.js.gz +0 -0
- package/web/chunk-h4vk09kd.js +0 -2
- package/web/chunk-h4vk09kd.js.br +0 -0
- package/web/chunk-h4vk09kd.js.gz +0 -0
- package/web/chunk-h6wzjfj2.js +0 -34
- package/web/chunk-h6wzjfj2.js.br +0 -0
- package/web/chunk-h6wzjfj2.js.gz +0 -0
- package/web/chunk-hajg1p0h.js +0 -7
- package/web/chunk-hajg1p0h.js.br +0 -0
- package/web/chunk-hajg1p0h.js.gz +0 -0
- package/web/chunk-hhmd6qrc.js +0 -2
- package/web/chunk-hhmd6qrc.js.br +0 -0
- package/web/chunk-hhmd6qrc.js.gz +0 -0
- package/web/chunk-hya0fh1r.js +0 -1
- package/web/chunk-hya0fh1r.js.br +0 -0
- package/web/chunk-hya0fh1r.js.gz +0 -0
- package/web/chunk-j469ky77.js +0 -1
- package/web/chunk-j469ky77.js.br +0 -0
- package/web/chunk-j469ky77.js.gz +0 -0
- package/web/chunk-j6ymcm3h.js +0 -2
- package/web/chunk-j6ymcm3h.js.br +0 -0
- package/web/chunk-j6ymcm3h.js.gz +0 -0
- package/web/chunk-j79z6bta.js +0 -21
- package/web/chunk-j79z6bta.js.br +0 -0
- package/web/chunk-j79z6bta.js.gz +0 -0
- package/web/chunk-jbxc5y3z.js +0 -12
- package/web/chunk-jbxc5y3z.js.br +0 -0
- package/web/chunk-jbxc5y3z.js.gz +0 -0
- package/web/chunk-jcc187d7.js +0 -1
- package/web/chunk-jcc187d7.js.br +0 -0
- package/web/chunk-jcc187d7.js.gz +0 -0
- package/web/chunk-jjvpdxhd.js +0 -2
- package/web/chunk-jjvpdxhd.js.br +0 -0
- package/web/chunk-jjvpdxhd.js.gz +0 -0
- package/web/chunk-jrh3mwmy.js +0 -2
- package/web/chunk-jrh3mwmy.js.br +0 -0
- package/web/chunk-jrh3mwmy.js.gz +0 -0
- package/web/chunk-jv3pgdp0.js +0 -1
- package/web/chunk-jv3pgdp0.js.br +0 -2
- package/web/chunk-jv3pgdp0.js.gz +0 -0
- package/web/chunk-ksxjhezb.js +0 -1
- package/web/chunk-ksxjhezb.js.br +0 -0
- package/web/chunk-ksxjhezb.js.gz +0 -0
- package/web/chunk-ktnd8t40.js +0 -2
- package/web/chunk-ktnd8t40.js.br +0 -0
- package/web/chunk-ktnd8t40.js.gz +0 -0
- package/web/chunk-mgwv3dp0.js +0 -1
- package/web/chunk-mgwv3dp0.js.br +0 -0
- package/web/chunk-mgwv3dp0.js.gz +0 -0
- package/web/chunk-mtjdfgjj.js +0 -2
- package/web/chunk-mtjdfgjj.js.br +0 -0
- package/web/chunk-mtjdfgjj.js.gz +0 -0
- package/web/chunk-mzkaanwd.js +0 -2
- package/web/chunk-mzkaanwd.js.br +0 -0
- package/web/chunk-mzkaanwd.js.gz +0 -0
- package/web/chunk-n22pg5xy.js +0 -1
- package/web/chunk-n22pg5xy.js.br +0 -0
- package/web/chunk-n22pg5xy.js.gz +0 -0
- package/web/chunk-n58ezsfb.js +0 -2
- package/web/chunk-n58ezsfb.js.br +0 -0
- package/web/chunk-n58ezsfb.js.gz +0 -0
- package/web/chunk-nhx74teq.js +0 -3
- package/web/chunk-nhx74teq.js.br +0 -0
- package/web/chunk-nhx74teq.js.gz +0 -0
- package/web/chunk-njjsgwfw.js +0 -2
- package/web/chunk-njjsgwfw.js.br +0 -0
- package/web/chunk-njjsgwfw.js.gz +0 -0
- package/web/chunk-nwhqcbnr.js +0 -1
- package/web/chunk-nwhqcbnr.js.br +0 -0
- package/web/chunk-nwhqcbnr.js.gz +0 -0
- package/web/chunk-pnghaajd.js +0 -70
- package/web/chunk-pnghaajd.js.br +0 -0
- package/web/chunk-pnghaajd.js.gz +0 -0
- package/web/chunk-pqfn8x7v.js +0 -1
- package/web/chunk-pqfn8x7v.js.br +0 -0
- package/web/chunk-pqfn8x7v.js.gz +0 -0
- package/web/chunk-ptk0jnyx.js +0 -1
- package/web/chunk-ptk0jnyx.js.br +0 -0
- package/web/chunk-ptk0jnyx.js.gz +0 -0
- package/web/chunk-pv7e5g4k.js +0 -370
- package/web/chunk-pv7e5g4k.js.br +0 -0
- package/web/chunk-pv7e5g4k.js.gz +0 -0
- package/web/chunk-pxnh5qgn.js +0 -2
- package/web/chunk-pxnh5qgn.js.br +0 -0
- package/web/chunk-pxnh5qgn.js.gz +0 -0
- package/web/chunk-q6eq5y2t.js +0 -1
- package/web/chunk-q6eq5y2t.js.br +0 -2
- package/web/chunk-q6eq5y2t.js.gz +0 -0
- package/web/chunk-qdwg9n1d.js +0 -1
- package/web/chunk-qdwg9n1d.js.br +0 -0
- package/web/chunk-qdwg9n1d.js.gz +0 -0
- package/web/chunk-qp42gtvd.js +0 -1
- package/web/chunk-qp42gtvd.js.br +0 -0
- package/web/chunk-qp42gtvd.js.gz +0 -0
- package/web/chunk-qzdw8vdp.js +0 -1
- package/web/chunk-qzdw8vdp.js.br +0 -0
- package/web/chunk-qzdw8vdp.js.gz +0 -0
- package/web/chunk-r571ywxq.js +0 -1
- package/web/chunk-r571ywxq.js.br +0 -0
- package/web/chunk-r571ywxq.js.gz +0 -0
- package/web/chunk-r9fx4cjw.js +0 -1
- package/web/chunk-r9fx4cjw.js.br +0 -0
- package/web/chunk-r9fx4cjw.js.gz +0 -0
- package/web/chunk-rhvq3c1c.js +0 -1
- package/web/chunk-rhvq3c1c.js.br +0 -0
- package/web/chunk-rhvq3c1c.js.gz +0 -0
- package/web/chunk-rjay9w1t.js +0 -1
- package/web/chunk-rjay9w1t.js.br +0 -0
- package/web/chunk-rjay9w1t.js.gz +0 -0
- package/web/chunk-rpvdnc3p.js +0 -1
- package/web/chunk-rpvdnc3p.js.br +0 -0
- package/web/chunk-rpvdnc3p.js.gz +0 -0
- package/web/chunk-rrfr4wyt.js +0 -62
- package/web/chunk-rrfr4wyt.js.br +0 -0
- package/web/chunk-rrfr4wyt.js.gz +0 -0
- package/web/chunk-rvngywg9.js +0 -2
- package/web/chunk-rvngywg9.js.br +0 -0
- package/web/chunk-rvngywg9.js.gz +0 -0
- package/web/chunk-rw7d025r.js +0 -84
- package/web/chunk-rw7d025r.js.br +0 -0
- package/web/chunk-rw7d025r.js.gz +0 -0
- package/web/chunk-s1g8acth.js +0 -324
- package/web/chunk-s1g8acth.js.br +0 -0
- package/web/chunk-s1g8acth.js.gz +0 -0
- package/web/chunk-s8572njv.js +0 -2
- package/web/chunk-s8572njv.js.br +0 -1
- package/web/chunk-s8572njv.js.gz +0 -0
- package/web/chunk-sb57e1m9.css +0 -1
- package/web/chunk-sb57e1m9.css.br +0 -0
- package/web/chunk-sb57e1m9.css.gz +0 -0
- package/web/chunk-sn3h5adt.js +0 -2
- package/web/chunk-sn3h5adt.js.br +0 -0
- package/web/chunk-sn3h5adt.js.gz +0 -0
- package/web/chunk-tb2v18q8.js +0 -2
- package/web/chunk-tb2v18q8.js.br +0 -0
- package/web/chunk-tb2v18q8.js.gz +0 -0
- package/web/chunk-tetbyky0.js +0 -39
- package/web/chunk-tetbyky0.js.br +0 -0
- package/web/chunk-tetbyky0.js.gz +0 -0
- package/web/chunk-tqvctvsv.js +0 -1
- package/web/chunk-tqvctvsv.js.br +0 -0
- package/web/chunk-tqvctvsv.js.gz +0 -0
- package/web/chunk-v9mj2pxz.js +0 -1
- package/web/chunk-v9mj2pxz.js.br +0 -0
- package/web/chunk-v9mj2pxz.js.gz +0 -0
- package/web/chunk-vkhah4nd.js +0 -2
- package/web/chunk-vkhah4nd.js.br +0 -0
- package/web/chunk-vkhah4nd.js.gz +0 -0
- package/web/chunk-vpnh7wmw.js +0 -1
- package/web/chunk-vpnh7wmw.js.br +0 -0
- package/web/chunk-vpnh7wmw.js.gz +0 -0
- package/web/chunk-w1qe2x5p.js +0 -217
- package/web/chunk-w1qe2x5p.js.br +0 -0
- package/web/chunk-w1qe2x5p.js.gz +0 -0
- package/web/chunk-werh47fw.js +0 -99
- package/web/chunk-werh47fw.js.br +0 -0
- package/web/chunk-werh47fw.js.gz +0 -0
- package/web/chunk-wfmf0dc8.js +0 -1
- package/web/chunk-wfmf0dc8.js.br +0 -0
- package/web/chunk-wfmf0dc8.js.gz +0 -0
- package/web/chunk-wna4vqp6.js +0 -1
- package/web/chunk-wna4vqp6.js.br +0 -0
- package/web/chunk-wna4vqp6.js.gz +0 -0
- package/web/chunk-wwhq09nf.js +0 -1
- package/web/chunk-wwhq09nf.js.br +0 -0
- package/web/chunk-wwhq09nf.js.gz +0 -0
- package/web/chunk-x6va53y6.js +0 -291
- package/web/chunk-x6va53y6.js.br +0 -0
- package/web/chunk-x6va53y6.js.gz +0 -0
- package/web/chunk-xefyzr9s.js +0 -120
- package/web/chunk-xefyzr9s.js.br +0 -0
- package/web/chunk-xefyzr9s.js.gz +0 -0
- package/web/chunk-xj1w9054.js +0 -2
- package/web/chunk-xj1w9054.js.br +0 -0
- package/web/chunk-xj1w9054.js.gz +0 -0
- package/web/chunk-xtb3xhxk.js +0 -2
- package/web/chunk-xtb3xhxk.js.br +0 -2
- package/web/chunk-xtb3xhxk.js.gz +0 -0
- package/web/chunk-y1eeptks.js +0 -2
- package/web/chunk-y1eeptks.js.br +0 -0
- package/web/chunk-y1eeptks.js.gz +0 -0
- package/web/chunk-y7z6zmvp.js +0 -292
- package/web/chunk-y7z6zmvp.js.br +0 -0
- package/web/chunk-y7z6zmvp.js.gz +0 -0
- package/web/chunk-yj8tkncg.js +0 -7
- package/web/chunk-yj8tkncg.js.br +0 -0
- package/web/chunk-yj8tkncg.js.gz +0 -0
- package/web/chunk-z0m2d74w.js +0 -1
- package/web/chunk-z0m2d74w.js.br +0 -0
- package/web/chunk-z0m2d74w.js.gz +0 -0
- package/web/chunk-z30kqv40.js +0 -1
- package/web/chunk-z30kqv40.js.br +0 -0
- package/web/chunk-z30kqv40.js.gz +0 -0
- package/web/chunk-z3a96d42.js +0 -332
- package/web/chunk-z3a96d42.js.br +0 -0
- package/web/chunk-z3a96d42.js.gz +0 -0
- package/web/manifest-txf6vfbq.webmanifest +0 -35
- package/web/manifest-txf6vfbq.webmanifest.br +0 -0
- 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{
|
|
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{Yn,Xn,si}from"./chunk-pv25a7sw.js";import{V}from"./chunk-0y13kfpt.js";imp
|
|
|
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
|
-
`),qo=!0}throw new te.CredentialsProviderError("AWS_PROFILE is set, skipping fromEnv provider.",{logger:e.logger,tryNextLink:!0})}return e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromEnv"),si(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 te.CredentialsProviderError("Skipping SSO provider in default chain (inputs do not include SSO fields).",{logger:e.logger});let{fromSSO:d}=await import("./chunk-cdb6caq7.js");return d(e)(t)},async(t)=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromIni");let{fromIni:o}=await import("./chunk-sss5x2ak.js");return o(e)(t)},async(t)=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromProcess");let{fromProcess:o}=await import("./chunk-r1kah65k.js");return o(e)(t)},async(t)=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromTokenFile");let{fromTokenFile:o}=await import("./chunk-794r8w6m.js");return o(e)(t)},async()=>(e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::remoteProvider"),(await zo(e))()),async()=>{throw new te.CredentialsProviderError("Could not load credentials from any providers",{tryNextLink:!1,logger:e.logger})}],Jo);var Jo=(e)=>e?.expiration!==void 0&&e.expiration.getTime()-Date.now()<300000;var Yo=c(yo());import{PassThrough as ci,pipeline as di,Readable as ui}from"stream";import{Transform as ii}from"stream";class Ft extends ii{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:ai(s.signature)}},body:e});return this.push(i),o()}catch(n){o(n)}}}function ai(e){let t=Buffer.from(e,"hex");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT)}class Ht{messageSigner;eventStreamCodec;systemClockOffsetProvider;credentials;constructor(e){this.messageSigner=e.messageSigner,this.eventStreamCodec=new Yo.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 ui))throw Error("Eventstream payload must be a Readable stream.");n.body=new ci({objectMode:!0});let d=n.headers?.authorization?.match(/Signature=([\w]+)$/)?.[1]??s?.["X-Amz-Signature"]??"";if(o.__staticSignature)d="";let a=new Ft({priorSignature:d,eventStreamCodec:this.eventStreamCodec,messageSigner:await this.messageSigner(),systemClockOffsetProvider:this.systemClockOffsetProvider,credentials:this.credentials}),u,l=new Promise((g,f)=>{u=()=>g(void 0),di(r,a,n.body,(m)=>{if(m)f(Error(`Pipeline error in @aws-sdk/eventstream-handler-node: ${m.message}`,{cause:m}))})}),p;try{p=await Promise.race([e(t),l])}catch(g){throw n.body.end(),g}finally{u()}return p}}var Wt=(e)=>new Ht(e);var Qo=c(H()),Zo=c(lt()),Vt=c(E()),Kt=({logger:e,signingName:t}={})=>async()=>{if(e?.debug?.("@aws-sdk/token-providers - fromEnvSigningName"),!t)throw new Vt.TokenProviderError("Please pass 'signingName' to compute environment variable key",{logger:e});let o=Zo.getBearerTokenEnvKey(t);if(!(o in process.env))throw new Vt.TokenProviderError(`Token not present in '${o}' environment variable`,{logger:e});let n={token:process.env[o]};return Qo.setTokenFeature(n,"BEARER_SERVICE_ENV_VARS","3"),n};var ae=c(E());var x=c(E());var en=300000,ne="To refresh this SSO session run 'aws sso login' with the corresponding profile.";var tn=async(e,t={},o)=>{let{SSOOIDCClient:n}=await import("./chunk-48m0w8xg.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 on=async(e,t,o={},n)=>{let{CreateTokenCommand:r}=await import("./chunk-48m0w8xg.js");return(await tn(t,o,n)).send(new r({clientId:e.clientId,clientSecret:e.clientSecret,refreshToken:e.refreshToken,grantType:"refresh_token"}))};var nn=c(E());var jt=(e)=>{if(e.expiration&&e.expiration.getTime()<Date.now())throw new nn.TokenProviderError(`Token is expired. ${ne}`,!1)};var rn=c(E());var B=(e,t,o=!1)=>{if(typeof t>"u")throw new rn.TokenProviderError(`Value not present for '${e}' in SSO Token${o?". Cannot refresh":""}. ${ne}`,!1)};var sn=c(E());import{promises as li}from"fs";var{writeFile:pi}=li,an=(e,t)=>{let o=sn.getSSOTokenFilepath(e),n=JSON.stringify(t,null,2);return pi(o,n)};var cn=new Map,dn=(e={})=>async({callerClientConfig:t}={})=>{e.logger?.debug("@aws-sdk/token-providers - fromSso");let o=await x.parseKnownFiles(e),n=x.getProfileName({profile:e.profile??t?.profile}),r=o[n];if(!r)throw new x.TokenProviderError(`Profile '${n}' could not be found in shared credentials file.`,!1);else if(!r.sso_session)throw new x.TokenProviderError(`Profile '${n}' is missing required property 'sso_session'.`);let s=r.sso_session,d=(await x.loadSsoSessionData(e))[s];if(!d)throw new x.TokenProviderError(`Sso session '${s}' could not be found in shared credentials file.`,!1);for(let _ of["sso_start_url","sso_region"])if(!d[_])throw new x.TokenProviderError(`Sso session '${s}' is missing required property '${_}'.`,!1);let{sso_start_url:a,sso_region:u}=d,l;try{l=await x.getSSOTokenFromFile(s)}catch(_){throw new x.TokenProviderError(`The SSO session token associated with profile=${n} was not found or is invalid. ${ne}`,!1)}B("accessToken",l.accessToken),B("expiresAt",l.expiresAt);let{accessToken:p,expiresAt:g}=l,f={token:p,expiration:new Date(g)};if(f.expiration.getTime()-Date.now()>en)return f;let m=cn.get(s)??0;if(Date.now()-m<30000)return jt(f),f;B("clientId",l.clientId,!0),B("clientSecret",l.clientSecret,!0),B("refreshToken",l.refreshToken,!0);try{cn.set(s,Date.now());let _=await on(l,u,e,t);B("accessToken",_.accessToken),B("expiresIn",_.expiresIn);let I=new Date(Date.now()+_.expiresIn*1000);try{await an(s,{...l,accessToken:_.accessToken,expiresAt:I.toISOString(),refreshToken:_.refreshToken})}catch(T){}return{token:_.accessToken,expiration:I}}catch(_){return jt(f),f}};var zt=(e={})=>ae.memoize(ae.chain(dn(e),async()=>{throw new ae.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 or=c($e()),_t=c(ie()),R=c(E()),nr=c(yo()),ue=c(gt()),rr=c(se()),ht=c(ut());var Kn=c(lt()),jn=c(Ut()),zn=c($e()),Jn=c(Tt()),Zn=c(ie()),er=c(K()),D=c(se());var Sn=c(H()),ce=c(Oe());var mn=c(Oe()),Ie="ref",z=-1,Ke=!0,un="isSet",gn="PartitionResult",je="booleanEquals",ln="getAttr",pn={[Ie]:"Endpoint"},_n={[Ie]:gn},ye={},hn=[{[Ie]:"Region"}],fn={conditions:[[un,[pn]],[un,hn],["aws.partition",hn,gn],[je,[{[Ie]:"UseFIPS"},Ke]],[je,[{[Ie]:"UseDualStack"},Ke]],[je,[{fn:ln,argv:[_n,"supportsDualStack"]},Ke]],[je,[{fn:ln,argv:[_n,"supportsFIPS"]},Ke]]],results:[[z],[z,"Invalid Configuration: FIPS and custom endpoint are not supported"],[z,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[pn,ye],["https://bedrock-runtime-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",ye],[z,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://bedrock-runtime-fips.{Region}.{PartitionResult#dnsSuffix}",ye],[z,"FIPS is enabled but this partition does not support FIPS"],["https://bedrock-runtime.{Region}.{PartitionResult#dualStackDnsSuffix}",ye],[z,"DualStack is enabled but this partition does not support DualStack"],["https://bedrock-runtime.{Region}.{PartitionResult#dnsSuffix}",ye],[z,"Invalid Configuration: Missing Region"]]},_i=2,w=1e8,hi=new Int32Array([-1,1,-1,0,12,3,1,4,w+11,2,5,w+11,3,8,6,4,7,w+10,5,w+8,w+9,4,10,9,6,w+6,w+7,5,11,w+5,6,w+4,w+5,3,w+1,13,4,w+2,w+3]),Cn=mn.BinaryDecisionDiagram.from(hi,_i,fn.conditions,fn.results);var fi=new ce.EndpointCache({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),En=(e,t={})=>fi.get(e,()=>ce.decideEndpoint(Cn,{endpointParams:e,logger:t.logger}));ce.customEndpointFunctions.aws=Sn.awsEndpointFunctions;var Xt=c(Me());var vn=c(ie());class S extends vn.ServiceException{constructor(e){super(e);Object.setPrototypeOf(this,S.prototype)}}class Xe extends S{name="AccessDeniedException";$fault="client";constructor(e){super({name:"AccessDeniedException",$fault:"client",...e});Object.setPrototypeOf(this,Xe.prototype)}}class qe extends S{name="InternalServerException";$fault="server";constructor(e){super({name:"InternalServerException",$fault:"server",...e});Object.setPrototypeOf(this,qe.prototype)}}class Je extends S{name="ThrottlingException";$fault="client";constructor(e){super({name:"ThrottlingException",$fault:"client",...e});Object.setPrototypeOf(this,Je.prototype)}}class Ye extends S{name="ValidationException";$fault="client";constructor(e){super({name:"ValidationException",$fault:"client",...e});Object.setPrototypeOf(this,Ye.prototype)}}class Qe extends S{name="ConflictException";$fault="client";constructor(e){super({name:"ConflictException",$fault:"client",...e});Object.setPrototypeOf(this,Qe.prototype)}}class Ze extends S{name="ResourceNotFoundException";$fault="client";constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e});Object.setPrototypeOf(this,Ze.prototype)}}class et extends S{name="ServiceQuotaExceededException";$fault="client";constructor(e){super({name:"ServiceQuotaExceededException",$fault:"client",...e});Object.setPrototypeOf(this,et.prototype)}}class ot extends S{name="ServiceUnavailableException";$fault="server";constructor(e){super({name:"ServiceUnavailableException",$fault:"server",...e});Object.setPrototypeOf(this,ot.prototype)}}class nt extends S{name="ModelErrorException";$fault="client";originalStatusCode;resourceName;constructor(e){super({name:"ModelErrorException",$fault:"client",...e});Object.setPrototypeOf(this,nt.prototype),this.originalStatusCode=e.originalStatusCode,this.resourceName=e.resourceName}}class rt extends S{name="ModelNotReadyException";$fault="client";$retryable={};constructor(e){super({name:"ModelNotReadyException",$fault:"client",...e});Object.setPrototypeOf(this,rt.prototype)}}class st extends S{name="ModelTimeoutException";$fault="client";constructor(e){super({name:"ModelTimeoutException",$fault:"client",...e});Object.setPrototypeOf(this,st.prototype)}}class it extends S{name="ModelStreamErrorException";$fault="client";originalStatusCode;originalMessage;constructor(e){super({name:"ModelStreamErrorException",$fault:"client",...e});Object.setPrototypeOf(this,it.prototype),this.originalStatusCode=e.originalStatusCode,this.originalMessage=e.originalMessage}}var Rn=Xt.TypeRegistry.for("smithy.ts.sdk.synthetic.com.amazonaws.bedrockruntime"),mi=[-3,"smithy.ts.sdk.synthetic.com.amazonaws.bedrockruntime","BedrockRuntimeServiceException",0,[],[]];Rn.registerError(mi,S);var k=Xt.TypeRegistry.for("com.amazonaws.bedrockruntime"),gi=[-3,"com.amazonaws.bedrockruntime","AccessDeniedException",{["error"]:"client",["httpError"]:403},["message"],[0]];k.registerError(gi,Xe);var Ci=[-3,"com.amazonaws.bedrockruntime","ConflictException",{["error"]:"client",["httpError"]:400},["message"],[0]];k.registerError(Ci,Qe);var yn=[-3,"com.amazonaws.bedrockruntime","InternalServerException",{["error"]:"server",["httpError"]:500},["message"],[0]];k.registerError(yn,qe);var Si=[-3,"com.amazonaws.bedrockruntime","ModelErrorException",{["error"]:"client",["httpError"]:424},["message","originalStatusCode","resourceName"],[0,1,0]];k.registerError(Si,nt);var Ei=[-3,"com.amazonaws.bedrockruntime","ModelNotReadyException",{["error"]:"client",["httpError"]:429},["message"],[0]];k.registerError(Ei,rt);var xn=[-3,"com.amazonaws.bedrockruntime","ModelStreamErrorException",{["error"]:"client",["httpError"]:424},["message","originalStatusCode","originalMessage"],[0,1,0]];k.registerError(xn,it);var vi=[-3,"com.amazonaws.bedrockruntime","ModelTimeoutException",{["error"]:"client",["httpError"]:408},["message"],[0]];k.registerError(vi,st);var Ai=[-3,"com.amazonaws.bedrockruntime","ResourceNotFoundException",{["error"]:"client",["httpError"]:404},["message"],[0]];k.registerError(Ai,Ze);var Ri=[-3,"com.amazonaws.bedrockruntime","ServiceQuotaExceededException",{["error"]:"client",["httpError"]:400},["message"],[0]];k.registerError(Ri,et);var In=[-3,"com.amazonaws.bedrockruntime","ServiceUnavailableException",{["error"]:"server",["httpError"]:503},["message"],[0]];k.registerError(In,ot);var Tn=[-3,"com.amazonaws.bedrockruntime","ThrottlingException",{["error"]:"client",["httpError"]:429},["message"],[0]];k.registerError(Tn,Je);var wn=[-3,"com.amazonaws.bedrockruntime","ValidationException",{["error"]:"client",["httpError"]:400},["message"],[0]];k.registerError(wn,Ye);var kn=[Rn,k];var yi=[0,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningStatementLogicContent",8,0],On=[0,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningStatementNaturalLanguageContent",8,0];var xi=[3,"com.amazonaws.bedrockruntime","AnyToolChoice",0,[],[]],Ii=[3,"com.amazonaws.bedrockruntime","AppliedGuardrailDetails",0,["guardrailId","guardrailVersion","guardrailArn","guardrailOrigin","guardrailOwnership"],[0,0,0,64,0]];var Ti=[3,"com.amazonaws.bedrockruntime","AudioBlock",0,["format","source","error"],[0,[()=>Tc,0],[()=>Jt,0]],2],wi=[3,"com.amazonaws.bedrockruntime","AutoToolChoice",0,[],[]];var ki=[3,"com.amazonaws.bedrockruntime","CacheDetail",0,["ttl","inputTokens"],[0,1],2],qt=[3,"com.amazonaws.bedrockruntime","CachePointBlock",0,["type","ttl"],[0,0],1],Oi=[3,"com.amazonaws.bedrockruntime","Citation",0,["title","source","sourceContent","location"],[0,0,()=>tc,()=>Fn]],Pn=[3,"com.amazonaws.bedrockruntime","CitationsConfig",0,["enabled"],[2],1],Pi=[3,"com.amazonaws.bedrockruntime","CitationsContentBlock",0,["content","citations"],[()=>Za,()=>ec]],Gi=[3,"com.amazonaws.bedrockruntime","CitationsDelta",0,["title","source","sourceContent","location"],[0,0,()=>oc,()=>Fn]],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"],[()=>Fa,()=>Bi,[()=>Fi,0],()=>Mn,()=>Bn],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],()=>Ta,()=>Wa,()=>Ca,15,[()=>xc,0],64,[()=>Ic,0],()=>Mn,()=>Bn,[()=>ba,0]],1],$i=[3,"com.amazonaws.bedrockruntime","ConverseStreamResponse",0,["stream"],[[()=>bc,16]]],Fi=[3,"com.amazonaws.bedrockruntime","ConverseStreamTrace",0,["guardrail","promptRouter"],[[()=>Aa,0],()=>La]];var bn=[3,"com.amazonaws.bedrockruntime","DocumentBlock",0,["name","source","format","context","citations"],[0,()=>Lc,0,0,()=>Pn],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]],Jt=[3,"com.amazonaws.bedrockruntime","ErrorBlock",8,["message"],[0]];var Nn=[3,"com.amazonaws.bedrockruntime","GuardrailAssessment",0,["topicPolicy","contentPolicy","wordPolicy","sensitiveInformationPolicy","contextualGroundingPolicy","automatedReasoningPolicy","invocationMetrics","appliedGuardrailDetails"],[()=>va,()=>ra,()=>ya,()=>ga,()=>ia,[()=>qi,0],()=>pa,()=>Ii]],Ki=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningImpossibleFinding",0,["translation","contradictingRules","logicWarning"],[[()=>Pe,0],()=>Yt,[()=>ct,0]]],ji=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningInputTextReference",0,["text"],[[()=>On,0]]],zi=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningInvalidFinding",0,["translation","contradictingRules","logicWarning"],[[()=>Pe,0],()=>Yt,[()=>ct,0]]],ct=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningLogicWarning",0,["type","premises","claims"],[0,[()=>we,0],[()=>we,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"],[[()=>Pe,0],[()=>at,0],[()=>at,0],[()=>ct,0]]],at=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningScenario",0,["statements"],[[()=>we,0]]],Qi=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningStatement",0,["logic","naturalLanguage"],[[()=>yi,0],[()=>On,0]]],Zi=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningTooComplexFinding",0,[],[]],Pe=[3,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningTranslation",0,["premises","claims","untranslatedPremises","untranslatedClaims","confidence"],[[()=>we,0],[()=>we,0],[()=>An,0],[()=>An,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"],[[()=>Pe,0],[()=>at,0],()=>Yt,[()=>ct,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"],[()=>Sa,()=>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,()=>Ra,()=>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],ma=[3,"com.amazonaws.bedrockruntime","GuardrailRegexFilter",0,["action","name","match","regex","detected"],[0,0,0,0,2],1],ga=[3,"com.amazonaws.bedrockruntime","GuardrailSensitiveInformationPolicyAssessment",0,["piiEntities","regexes"],[()=>hc,()=>fc],2],Ca=[3,"com.amazonaws.bedrockruntime","GuardrailStreamConfiguration",0,["guardrailIdentifier","guardrailVersion","trace","streamProcessingMode"],[0,0,0,0]];var Sa=[3,"com.amazonaws.bedrockruntime","GuardrailTextCharactersCoverage",0,["guarded","total"],[1,1]],Ea=[3,"com.amazonaws.bedrockruntime","GuardrailTopic",0,["name","type","action","detected"],[0,0,0,2],3],va=[3,"com.amazonaws.bedrockruntime","GuardrailTopicPolicyAssessment",0,["topics"],[()=>mc],1],Aa=[3,"com.amazonaws.bedrockruntime","GuardrailTraceAssessment",0,["modelOutput","inputAssessment","outputAssessments","actionReason"],[64,[()=>yc,0],[()=>Rc,0],0]],Ra=[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],ya=[3,"com.amazonaws.bedrockruntime","GuardrailWordPolicyAssessment",0,["customWords","managedWordLists"],[()=>pc,()=>_c],2],Ln=[3,"com.amazonaws.bedrockruntime","ImageBlock",0,["format","source","error"],[0,[()=>Wn,0],[()=>Jt,0]],2],xa=[3,"com.amazonaws.bedrockruntime","ImageBlockDelta",0,["source","error"],[[()=>Wn,0],[()=>Jt,0]]],Ia=[3,"com.amazonaws.bedrockruntime","ImageBlockStart",0,["format"],[0],1],Ta=[3,"com.amazonaws.bedrockruntime","InferenceConfiguration",0,["maxTokens","temperature","topP","stopSequences"],[1,1,1,64]];var ka=[3,"com.amazonaws.bedrockruntime","JsonSchemaDefinition",0,["schema","name","description"],[0,0,0],1];var Oa=[3,"com.amazonaws.bedrockruntime","Message",0,["role","content"],[0,[()=>nc,0]],2],Pa=[3,"com.amazonaws.bedrockruntime","MessageStartEvent",0,["role"],[0],1],Ga=[3,"com.amazonaws.bedrockruntime","MessageStopEvent",0,["stopReason","additionalModelResponseFields"],[0,15],1],ba=[3,"com.amazonaws.bedrockruntime","OutputConfig",0,["textFormat","effort"],[[()=>Na,0],0]],Na=[3,"com.amazonaws.bedrockruntime","OutputFormat",0,["type","structure"],[0,[()=>Bc,0]],2];var Mn=[3,"com.amazonaws.bedrockruntime","PerformanceConfiguration",0,["latency"],[0]],La=[3,"com.amazonaws.bedrockruntime","PromptRouterTrace",0,["invokedModelId"],[0]],Ma=[3,"com.amazonaws.bedrockruntime","ReasoningTextBlock",8,["text","signature"],[0,0],1],dt=[3,"com.amazonaws.bedrockruntime","S3Location",0,["uri","bucketOwner"],[0,0],1],Un=[3,"com.amazonaws.bedrockruntime","SearchResultBlock",0,["source","title","content","citations"],[0,0,()=>Cc,()=>Pn],3],Ua=[3,"com.amazonaws.bedrockruntime","SearchResultContentBlock",0,["text"],[0],1],Ba=[3,"com.amazonaws.bedrockruntime","SearchResultLocation",0,["searchResultIndex","start","end"],[1,1,1]],Bn=[3,"com.amazonaws.bedrockruntime","ServiceTier",0,["type"],[0],1],Da=[3,"com.amazonaws.bedrockruntime","SpecificToolChoice",0,["name"],[0],1];var $a=[3,"com.amazonaws.bedrockruntime","SystemTool",0,["name"],[0],1];var Fa=[3,"com.amazonaws.bedrockruntime","TokenUsage",0,["inputTokens","outputTokens","totalTokens","cacheReadInputTokens","cacheWriteInputTokens","cacheDetails"],[1,1,1,1,1,()=>Qa],3],Ha=[3,"com.amazonaws.bedrockruntime","ToolAdditionBlock",0,["tool"],[()=>Dn],1],Wa=[3,"com.amazonaws.bedrockruntime","ToolConfiguration",0,["tools","toolChoice"],[()=>Ac,()=>Vc],1],Dn=[3,"com.amazonaws.bedrockruntime","ToolReference",0,["type","name","serverName"],[0,0,0]],Va=[3,"com.amazonaws.bedrockruntime","ToolRemovalBlock",0,["tool"],[()=>Dn],1],Ka=[3,"com.amazonaws.bedrockruntime","ToolResultBlock",0,["toolUseId","content","status","type"],[0,[()=>vc,0],0,0],2],ja=[3,"com.amazonaws.bedrockruntime","ToolResultBlockStart",0,["toolUseId","type","status"],[0,0,0],1],za=[3,"com.amazonaws.bedrockruntime","ToolSpecification",0,["name","inputSchema","description","strict"],[0,()=>Kc,0,2],2],Xa=[3,"com.amazonaws.bedrockruntime","ToolUseBlock",0,["toolUseId","name","input","type"],[0,0,15,0],3],qa=[3,"com.amazonaws.bedrockruntime","ToolUseBlockDelta",0,["input"],[0],1],Ja=[3,"com.amazonaws.bedrockruntime","ToolUseBlockStart",0,["toolUseId","name","type"],[0,0,0],2],$n=[3,"com.amazonaws.bedrockruntime","VideoBlock",0,["format","source"],[0,()=>Xc],2],Ya=[3,"com.amazonaws.bedrockruntime","WebLocation",0,["url","domain"],[0,0]];var Qa=[1,"com.amazonaws.bedrockruntime","CacheDetailsList",0,()=>ki],Za=[1,"com.amazonaws.bedrockruntime","CitationGeneratedContentList",0,()=>wc],ec=[1,"com.amazonaws.bedrockruntime","Citations",0,()=>Oi],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,[()=>Nn,0]],ic=[1,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningDifferenceScenarioList",0,[()=>at,0]],ac=[1,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningFindingList",0,[()=>Mc,0]],An=[1,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningInputTextReferenceList",0,[()=>ji,0]],Yt=[1,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningRuleList",0,()=>Ji],we=[1,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningStatementList",0,[()=>Qi,0]],cc=[1,"com.amazonaws.bedrockruntime","GuardrailAutomatedReasoningTranslationList",0,[()=>Pe,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,()=>ma],mc=[1,"com.amazonaws.bedrockruntime","GuardrailTopicList",0,()=>Ea],gc=[1,"com.amazonaws.bedrockruntime","Messages",0,[()=>Oa,0]];var Cc=[1,"com.amazonaws.bedrockruntime","SearchResultContentBlocks",0,()=>Ua],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],[()=>Nn,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,()=>dt]],wc=[4,"com.amazonaws.bedrockruntime","CitationGeneratedContent",0,["text"],[0]],Fn=[4,"com.amazonaws.bedrockruntime","CitationLocation",0,["web","documentChar","documentPage","documentChunk","searchResultLocation"],[()=>Ya,()=>Hi,()=>Vi,()=>Wi,()=>Ba]],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,[()=>Ln,0],()=>bn,()=>$n,[()=>Ti,0],()=>Xa,[()=>Ka,0],[()=>Hn,0],()=>qt,[()=>$c,0],()=>Pi,()=>Un,()=>Ha,()=>Va]],Pc=[4,"com.amazonaws.bedrockruntime","ContentBlockDelta",0,["text","toolUse","toolResult","reasoningContent","citation","image"],[0,()=>qa,()=>Ec,[()=>Fc,0],()=>Gi,[()=>xa,0]]],Gc=[4,"com.amazonaws.bedrockruntime","ContentBlockStart",0,["toolUse","toolResult","image"],[()=>Ja,()=>ja,()=>Ia]];var bc=[4,"com.amazonaws.bedrockruntime","ConverseStreamOutput",{["streaming"]:1},["messageStart","contentBlockStart","contentBlockDelta","contentBlockStop","messageStop","metadata","internalServerException","modelStreamErrorException","validationException","throttlingException","serviceUnavailableException"],[()=>Pa,()=>Li,[()=>Ni,0],()=>Mi,()=>Ga,[()=>Ui,0],[()=>yn,0],[()=>xn,0],[()=>wn,0],[()=>Tn,0],[()=>In,0]]];var Nc=[4,"com.amazonaws.bedrockruntime","DocumentContentBlock",0,["text"],[0]],Lc=[4,"com.amazonaws.bedrockruntime","DocumentSource",0,["bytes","s3Location","text","content"],[21,()=>dt,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 Hn=[4,"com.amazonaws.bedrockruntime","GuardrailConverseContentBlock",0,["text","image"],[()=>ca,[()=>aa,0]]],Uc=[4,"com.amazonaws.bedrockruntime","GuardrailConverseImageSource",8,["bytes"],[21]];var Wn=[4,"com.amazonaws.bedrockruntime","ImageSource",8,["bytes","s3Location"],[21,()=>dt]];var Bc=[4,"com.amazonaws.bedrockruntime","OutputFormatStructure",8,["jsonSchema"],[()=>ka]],Dc=[4,"com.amazonaws.bedrockruntime","PromptVariableValues",0,["text"],[0]],$c=[4,"com.amazonaws.bedrockruntime","ReasoningContentBlock",8,["reasoningText","redactedContent"],[[()=>Ma,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,[()=>Hn,0],()=>qt]],Wc=[4,"com.amazonaws.bedrockruntime","Tool",0,["toolSpec","systemTool","cachePoint"],[()=>za,()=>$a,()=>qt]],Vc=[4,"com.amazonaws.bedrockruntime","ToolChoice",0,["auto","any","tool"],[()=>wi,()=>xi,()=>Da]],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,[()=>Ln,0],()=>bn,()=>$n,()=>Un]],Xc=[4,"com.amazonaws.bedrockruntime","VideoSource",0,["bytes","s3Location"],[21,()=>dt]];var Vn=[9,"com.amazonaws.bedrockruntime","ConverseStream",{["http"]:["POST","/model/{modelId}/converse-stream",200]},()=>Di,()=>$i];var tr=(e)=>({apiVersion:"2023-09-30",base64Decoder:e?.base64Decoder??D.fromBase64,base64Encoder:e?.base64Encoder??D.toBase64,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??En,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Fo,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(t)=>t.getIdentityProvider("aws.auth#sigv4"),signer:new Kn.AwsSdkSigV4Signer},{schemeId:"smithy.api#httpBearerAuth",identityProvider:(t)=>t.getIdentityProvider("smithy.api#httpBearerAuth"),signer:new zn.HttpBearerAuthSigner}],logger:e?.logger??new Zn.NoOpLogger,protocol:e?.protocol??jn.AwsRestJsonProtocol,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.bedrockruntime",errorTypeRegistries:kn,version:"2023-09-30",serviceTarget:"AmazonBedrockFrontendService"},serviceId:e?.serviceId??"Bedrock Runtime",sha256:e?.sha256??Jn.Sha256,urlParser:e?.urlParser??er.parseUrl,utf8Decoder:e?.utf8Decoder??D.fromUtf8,utf8Encoder:e?.utf8Encoder??D.toUtf8});var sr=(e)=>{_t.emitWarningIfUnsupportedVersion(process.version);let t=R.resolveDefaultsModeConfig(e),o=()=>t().then(_t.loadConfigsForDefaultMode),n=tr(e);de.emitWarningIfUnsupportedVersion(process.version);let r={profile:e?.profile,logger:n.logger,signingName:"bedrock"};return{...n,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??R.loadConfig(pt.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS,r),bodyLengthChecker:e?.bodyLengthChecker??rr.calculateBodyLength,credentialDefaultProvider:e?.credentialDefaultProvider??$t,defaultUserAgentProvider:e?.defaultUserAgentProvider??de.createDefaultUserAgentProvider({serviceId:n.serviceId,clientVersion:Ko.version}),eventStreamPayloadHandlerProvider:e?.eventStreamPayloadHandlerProvider??Wt,eventStreamSerdeProvider:e?.eventStreamSerdeProvider??nr.eventStreamSerdeProvider,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(s)=>s.getIdentityProvider("aws.auth#sigv4"),signer:new pt.AwsSdkSigV4Signer},{schemeId:"smithy.api#httpBearerAuth",identityProvider:(s)=>s.getIdentityProvider("smithy.api#httpBearerAuth")||(async(i)=>{try{return await Kt({signingName:"bedrock"})()}catch(d){return await zt(i)(i)}}),signer:new or.HttpBearerAuthSigner}],maxAttempts:e?.maxAttempts??R.loadConfig(ue.NODE_MAX_ATTEMPT_CONFIG_OPTIONS,e),region:e?.region??R.loadConfig(R.NODE_REGION_CONFIG_OPTIONS,{...R.NODE_REGION_CONFIG_FILE_OPTIONS,...r}),requestHandler:ht.NodeHttp2Handler.create(e?.requestHandler??(async()=>({...await o(),disableConcurrentStreams:!0}))),retryMode:e?.retryMode??R.loadConfig({...ue.NODE_RETRY_MODE_CONFIG_OPTIONS,default:async()=>(await o()).retryMode||ue.DEFAULT_RETRY_MODE},e),streamCollector:e?.streamCollector??ht.streamCollector,useDualstackEndpoint:e?.useDualstackEndpoint??R.loadConfig(R.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,r),useFipsEndpoint:e?.useFipsEndpoint??R.loadConfig(R.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,r),userAgentAppId:e?.userAgentAppId??R.loadConfig(de.NODE_APP_ID_CONFIG_OPTIONS,r)}};var ft=c(H()),mt=c(ie()),Ct=c(K());var ir=(e)=>{let{httpAuthSchemes:t,httpAuthSchemeProvider:o,credentials:n,token:r}=e;return{setHttpAuthScheme(s){let i=t.findIndex((d)=>d.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}}},ar=(e)=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials(),token:e.token()});var cr=(e,t)=>{let o=Object.assign(ft.getAwsRegionExtensionConfiguration(e),mt.getDefaultExtensionConfiguration(e),Ct.getHttpHandlerExtensionConfiguration(e),ir(e));return t.forEach((n)=>n.configure(o)),Object.assign(e,ft.resolveAwsRegionExtensionConfiguration(o),mt.resolveDefaultRuntimeConfig(o),Ct.resolveHttpHandlerRuntimeConfig(o),ar(o))};class Qt extends dr.Client{config;constructor(...[e]){let t=sr(e||{});super(t);this.initConfig=t;let o=Wo(t),n=O.resolveUserAgentConfig(o),r=St.resolveRetryConfig(n),s=ur.resolveRegionConfig(r),i=O.resolveHostHeaderConfig(s),d=lr.resolveEndpointConfig(i),a=pr.resolveEventStreamSerdeConfig(d),u=Ho(a),l=Mt(u),p=Dt(l),g=cr(p,e?.extensions||[]);this.config=g,this.middlewareStack.use(hr.getSchemaSerdePlugin(this.config)),this.middlewareStack.use(O.getUserAgentPlugin(this.config)),this.middlewareStack.use(St.getRetryPlugin(this.config)),this.middlewareStack.use(_r.getContentLengthPlugin(this.config)),this.middlewareStack.use(O.getHostHeaderPlugin(this.config)),this.middlewareStack.use(O.getLoggerPlugin(this.config)),this.middlewareStack.use(O.getRecursionDetectionPlugin(this.config)),this.middlewareStack.use(le.getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:$o,identityProviderConfigProvider:async(f)=>new le.DefaultIdentityProviderConfig({"aws.auth#sigv4":f.credentials,"smithy.api#httpBearerAuth":f.token})})),this.middlewareStack.use(le.getHttpSigningPlugin(this.config))}destroy(){super.destroy()}}var fr=c(ie()),mr=c(Oe());var gr=fr.makeBuilder(Vo,"AmazonBedrockFrontendService","BedrockRuntimeClient",mr.getEndpointPlugin),Cr={},Sr=(e,t,o,n)=>[];class Zt extends gr(Cr,Sr,"ConverseStream",Vn){}var Et={FIVE_MINUTES:"5m",ONE_HOUR:"1h"},eo={DEFAULT:"default"};var Ge={GIF:"gif",JPEG:"jpeg",PNG:"png",WEBP:"webp"};var be={ERROR:"error",SUCCESS:"success"};var pe={ASSISTANT:"assistant",SYSTEM:"system",USER:"user"};var _e={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 no=c(ut(),1);var Ir=c(Er(),1);import*as yr from"net";import*as xr from"tls";import{once as Jc}from"events";import*as vr from"net";import*as Ar from"http";import{Agent as qc}from"https";var L=Symbol("AgentBaseInternalState");class Ne extends Ar.Agent{constructor(e){super(e);this[L]={}}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
|
|
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),
|
|
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){
|
|
17
|
-
`),
|
|
18
|
-
`;if(o.username||o.password){let
|
|
19
|
-
`;let
|
|
20
|
-
`);let{connect:a,buffered:
|
|
21
|
-
`;if(n.username||n.password){let
|
|
22
|
-
`;let a=
|
|
23
|
-
`);let{connect:u}=await a;if(e.emit("proxyConnect",u),this.emit("proxyConnect",u,e),u.statusCode===200){if(e.once("socket",wr),t.secureEndpoint)return X("Upgrading socket connection to TLS"),Le.connect({...oo(yt(t),"host","path","port"),socket:r});return r}throw r.destroy(),Error(`Proxy authentication failed with status ${u.statusCode} after retry`)}}xt.protocols=["http","https"];function wr(e){setImmediate(()=>{e.resume()})}function oo(e,...t){let o={},n;for(n in e)if(!t.includes(n))o[n]=e[n];return o}var io="<empty>",ed="thinking-binding-controls-2026-08-01",Or="[Reasoning redacted]",fe=(e,t,o={})=>{let n=new W,r=tt(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,d=o.profile||o.env?.AWS_PROFILE,a={profile:d||A("AWS_PROFILE",o.env)},u=Mr(o),l=Boolean(A("AWS_PROFILE")),p=Ur(e.baseUrl),g=kd(e.baseUrl,u,l);if(g)a.endpoint=e.baseUrl;let f=A("AWS_BEDROCK_SKIP_AUTH",o.env)==="1",m=o.bearerToken||o.apiKey||A("AWS_BEARER_TOKEN_BEDROCK",o.env)||void 0,_=m!==void 0&&!f;if(typeof process<"u"&&(process.versions?.node||process.versions?.bun)){let T=e.id.match(/^arn:aws(?:-[a-z0-9-]+)?:bedrock:([a-z0-9-]+):/);if(T)a.region=T[1];else if(u)a.region=u;else if(p&&g)a.region=p;else if(!l)a.region="us-east-1";if(f)a.credentials={accessKeyId:"dummy-access-key",secretAccessKey:"dummy-secret-key"};let y=wd(o.env);if(!f&&y&&!d)a.credentials=y;let C=qn(e.baseUrl,o.env);if(C)a.requestHandler=new no.NodeHttpHandler({httpAgent:new At(C),httpsAgent:new xt(C)});else if(A("AWS_BEDROCK_FORCE_HTTP1",o.env)==="1")a.requestHandler=new no.NodeHttpHandler}else a.region=u||(p&&g?p:void 0)||"us-east-1";if(_)a.token={token:m},a.authSchemePreference=["httpBearerAuth"];let I;try{let T=e.compat?.supportsStrictMode??!1,y=new Qt(a),C=!1;if(o.onResponse)pd(y,o.onResponse,e,()=>{C=!0});let U=ke(o.headers);if(U)dd(y,U);let J=Ed(o.cacheRetention,o.env),Y=o.maxTokens??(wt(e)?e.maxTokens:void 0),j=ve(r.messages),Ys=j?G(j):void 0,Lt={modelId:e.id,messages:xd(r,e,J,o.env),system:Ad(Ys,e,J,o.env),inferenceConfig:{...Y!==void 0&&{maxTokens:Y},...o.temperature!==void 0&&{temperature:o.temperature}},toolConfig:Id(me(r.messages),o.toolChoice,T),additionalModelRequestFields:Pd(e,o),...o.requestMetadata!==void 0&&{requestMetadata:o.requestMetadata}},Lo=await o?.onPayload?.(Lt,e);if(Lo!==void 0)Lt=Lo;let Qs=new Zt(Lt),Z=await y.send(Qs,{abortSignal:o.signal});if(I=ao(Z.$metadata.requestId),!C&&Z.$metadata.httpStatusCode!==void 0){let h={};if(Z.$metadata.requestId)h["x-amzn-requestid"]=Z.$metadata.requestId;await o?.onResponse?.({status:Z.$metadata.httpStatusCode,headers:h},e)}for await(let h of Z.stream)if(await o.onProviderStreamEvent?.(h,e),h.messageStart){if(h.messageStart.role!==pe.ASSISTANT)throw Error("Unexpected assistant message start but got user message start instead");n.push({type:"start",partial:s})}else if(h.contentBlockStart)_d(h.contentBlockStart,i,s,n);else if(h.contentBlockDelta)hd(h.contentBlockDelta,i,s,n);else if(h.contentBlockStop)md(h.contentBlockStop,i,s,n);else if(h.messageStop){s.rawStopReason=h.messageStop.stopReason;let{stopReason:Zs,errorMessage:Mo}=Td(h.messageStop.stopReason);if(s.stopReason=Zs,Mo)s.errorMessage=Mo}else if(h.metadata)fd(h.metadata,e,s);else if(h.internalServerException)throw h.internalServerException;else if(h.modelStreamErrorException)throw h.modelStreamErrorException;else if(h.validationException)throw h.validationException;else if(h.throttlingException)throw h.throttlingException;else if(h.serviceUnavailableException)throw h.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 h of s.content)Pr(h);n.push({type:"done",reason:s.stopReason,message:s}),n.end()}catch(T){for(let y of s.content)Pr(y);if(s.stopReason=o.signal?.aborted?"aborted":"error",s.errorMessage=nd(T),s.stopReason==="error")id(s,T,I);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=Q(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 S)return`${td[e.name]??e.name}: ${o}${n}`;return`${o}${n}`}var rd=200;function ao(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 ao(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=ao(n?.requestId)??o;if(i!==void 0)r.requestId=i;if(Object.keys(r).length===0)return;ze(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[d,a]of Object.entries(t))if(!cd(d))i[d]=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 d=await s(i),a=ld(d.response);if(a)n(),await t(a,o);return d};e.middlewareStack.add(r,{step:"deserialize",name:"pi-ai-response-headers"})}var br=(e,t,o)=>{let n={...re(e,t,o,void 0),toolChoice:o?.toolChoice};if(!o?.reasoning)return fe(e,t,{...n,reasoning:void 0});if(wt(e)){if(ro(e.id,e.name))return fe(e,t,{...n,reasoning:o.reasoning,thinkingBudgets:o.thinkingBudgets});let r=Qn(n.maxTokens,e.maxTokens,o.reasoning,o.thinkingBudgets),s=Yr(e,t,r.maxTokens);return fe(e,t,{...n,maxTokens:s,reasoning:o.reasoning,thinkingBudgets:{...o.thinkingBudgets||{},[Ss(o.reasoning)]:Math.min(r.thinkingBudget,Math.max(0,s-1024))}})}return fe(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),d=t[i];if(s?.text!==void 0){if(!d){let a={type:"text",text:"",index:r};o.content.push(a),i=t.length-1,d=t[i],n.push({type:"text_start",contentIndex:i,partial:o})}if(d.type==="text")d.text+=s.text,n.push({type:"text_delta",contentIndex:i,delta:s.text,partial:o})}else if(s?.toolUse&&d?.type==="toolCall")d.partialJson=(d.partialJson||"")+(s.toolUse.input||""),d.arguments=V(d.partialJson),n.push({type:"toolcall_delta",contentIndex:i,delta:s.toolUse.input||"",partial:o});else if(s?.reasoningContent){let a=d,u=i;if(!a){let l={type:"thinking",thinking:"",thinkingSignature:"",index:r};o.content.push(l),u=t.length-1,a=t[u],n.push({type:"thinking_start",contentIndex:u,partial:o})}if(a?.type==="thinking"){if(s.reasoningContent.text)a.thinking+=s.reasoningContent.text,n.push({type:"thinking_delta",contentIndex:u,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+=Or,n.push({type:"thinking_delta",contentIndex:u,delta:Or,partial:o});a.redactedChunks??=[],a.redactedChunks.push(s.reasoningContent.redactedContent)}}}}function Nr(e){if(e.type!=="thinking"||!e.redactedChunks)return;e.thinkingSignature=Ld(e.redactedChunks),delete e.redactedChunks}function Pr(e){delete e.index,delete e.partialJson,Nr(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===Et.ONE_HOUR?r.inputTokens??0:0),0),o.usage.totalTokens=e.usage.totalTokens||o.usage.input+o.usage.output,oe(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":Nr(s),n.push({type:"thinking_end",contentIndex:r,content:s.thinking,partial:o});break;case"toolCall":s.arguments=V(s.partialJson),delete s.partialJson,n.push({type:"toolcall_end",contentIndex:r,toolCall:s,partial:o});break}}function Ue(e,t){return(t?[e,t]:[e]).flatMap((n)=>{let r=n.toLowerCase();return[r,r.replace(/[\s_.:]+/g,"-")]})}function ro(e,t){return Ue(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 Ue(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 Ue(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(A("PI_CACHE_RETENTION",t)==="long")return"long";return"short"}function wt(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 Lr(e,t){let o=Ue(e.id,e.name);if(!o.some((r)=>r.includes("claude"))){if(A("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 wt(e)}function Ad(e,t,o,n){if(!e)return;let r=[{text:v(e)}];if(o!=="none"&&Lr(t,n))r.push({cachePoint:{type:eo.DEFAULT,...o==="long"?{ttl:Et.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 It(e){let t=v(e);return t.trim().length===0?void 0:{text:t}}function yd(e){return It(e)??{text:io}}function so(e){if(Array.isArray(e))return e.map(so);if(e!==null&&typeof e==="object")return Object.fromEntries(Object.entries(e).filter(([t])=>t.length>0).map(([t,o])=>[t,so(o)]));return e}function Gr(e){let t=[];for(let o of e)if(o.type==="image")t.push({image:Br(o.mimeType,o.data)});else{let n=It(o.text);if(n)t.push(n)}if(t.length===0)t.push({text:io});return t}function xd(e,t,o,n){let r=[],s=Te(Dr(e.messages),t,Rd);for(let i=0;i<s.length;i++){let d=s[i];switch(d.role){case"user":{let a=[];if(typeof d.content==="string")a.push(yd(d.content));else{for(let u of d.content)switch(u.type){case"text":{let l=It(u.text);if(l)a.push(l);break}case"image":a.push({image:Br(u.mimeType,u.data)});break;default:continue}if(a.length===0)a.push({text:io})}r.push({role:pe.USER,content:a});break}case"assistant":{if(d.content.length===0)continue;let a=[];for(let u of d.content)switch(u.type){case"text":{let l=It(u.text);if(!l)continue;a.push(l);break}case"toolCall":a.push({toolUse:{toolUseId:u.id,name:u.name,input:so(u.arguments)}});break;case"thinking":{if(u.redacted){let p=Nd(u.thinkingSignature);if(p?.length)a.push({reasoningContent:{redactedContent:p}});continue}let l=v(u.thinking);if(l.trim().length===0)continue;if(vd(t))if(!u.thinkingSignature||u.thinkingSignature.trim().length===0)a.push({text:l});else a.push({reasoningContent:{reasoningText:{text:l,signature:u.thinkingSignature}}});else a.push({reasoningContent:{reasoningText:{text:l}}});break}default:continue}if(a.length===0)continue;r.push({role:pe.ASSISTANT,content:a});break}case"toolResult":{let a=[];a.push({toolResult:{toolUseId:d.toolCallId,content:Gr(d.content),status:d.isError?be.ERROR:be.SUCCESS}});let u=i+1;while(u<s.length&&s[u].role==="toolResult"){let l=s[u];a.push({toolResult:{toolUseId:l.toolCallId,content:Gr(l.content),status:l.isError?be.ERROR:be.SUCCESS}}),u++}i=u-1,r.push({role:pe.USER,content:a});break}default:continue}}if(o!=="none"&&Lr(t,n)&&r.length>0){let i=r[r.length-1];if(i.role===pe.USER&&i.content)i.content.push({cachePoint:{type:eo.DEFAULT,...o==="long"?{ttl:Et.ONE_HOUR}:{}}})}return r}function Id(e,t,o){if(!e?.length)return;if(t==="none")return;let n=e.map((s)=>{let i=xe(s,o);return{toolSpec:{name:s.name,description:s.description,inputSchema:{json:Ae(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 _e.END_TURN:case _e.STOP_SEQUENCE:return{stopReason:"stop"};case _e.MAX_TOKENS:case _e.MODEL_CONTEXT_WINDOW_EXCEEDED:return{stopReason:"length"};case _e.TOOL_USE:return{stopReason:"toolUse"};default:return e?{stopReason:"error",errorMessage:`Provider stopped with: ${e}`}:{stopReason:"error"}}}function Mr(e){return e.region||A("AWS_REGION",e.env)||A("AWS_DEFAULT_REGION",e.env)||void 0}function wd(e){let t=A("AWS_ACCESS_KEY_ID",e),o=A("AWS_SECRET_ACCESS_KEY",e);if(!t||!o)return;let n=A("AWS_SESSION_TOKEN",e);return{accessKeyId:t,secretAccessKey:o,...n?{sessionToken:n}:{}}}function Ur(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(!Ur(e))return!0;return!t&&!o}function Od(e,t){if(Mr(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(wt(e)){let n=Od(e,t),r=n?void 0:t.thinkingDisplay??"summarized",s=!n&&Cd(e),i=ro(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 d={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]??d[t.reasoning],...r!==void 0?{display:r}:{}}}})();if(!ro(e.id,e.name)&&(t.interleavedThinking??!0))i.anthropic_beta=["interleaved-thinking-2025-05-14"];return i}let o=Ue(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 Br(e,t){let o;switch(e){case"image/jpeg":case"image/jpg":o=Ge.JPEG;break;case"image/png":o=Ge.PNG;break;case"image/gif":o=Ge.GIF;break;case"image/webp":o=Ge.WEBP;break;default:throw Error(`Unknown image type: ${e}`)}return{source:{bytes:$r(t)},format:o}}function $r(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 $r(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 Fr={stream:fe,streamSimple:br};import{createServer as Md}from"http";function kt(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function Hr(e){let t=kt(e.title),o=kt(e.heading),n=kt(e.message),r=e.details?kt(e.details):void 0;return`<!doctype html>
|
|
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
|
+
`;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
|
+
`;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(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
|
+
`;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
|
+
`;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(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("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}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{Yn,Xn,si}from"./chunk-pv25a7sw.js";import{V}from"./chunk-0y13kfpt.js";imp
|
|
|
93
93
|
${r?`<div class="details">${r}</div>`:""}
|
|
94
94
|
</main>
|
|
95
95
|
</body>
|
|
96
|
-
</html>`}function Ot(e){return Hr({title:"Authentication successful",heading:"Authentication successful",message:e})}function P(e,t){return Hr({title:"Authentication failed",heading:"Authentication failed",message:e,details:t})}function q(e,t,o){e.writeHead(t,{"content-type":"text/html; charset=utf-8","cache-control":"no-store"}),e.end(o)}async function F(e){let{providerName:t,signal:o}=e;if(o?.aborted)throw Error("Login cancelled");let n=()=>{},r=()=>{},s=new Promise((m,_)=>{n=m,r=_});s.catch(()=>{return});let i=!1,d=!1,a,u=()=>l({error:Error("Login cancelled")}),l=(m)=>{if(d)return;if(d=!0,a)clearTimeout(a);if(o?.removeEventListener("abort",u),"error"in m)r(m.error);else n(m.value)},p=Md((m,_)=>{(async()=>{let I=new URL(m.url??"/","http://localhost");if(m.method!=="GET"||I.pathname!==e.path){q(_,404,P("Callback route not found."));return}if(e.state!==void 0&&I.searchParams.get("state")!==e.state){q(_,400,P("State mismatch."));return}if(i||d){q(_,409,P("This sign-in has already been handled."));return}let T=I.searchParams.get("error");if(T){let C=I.searchParams.get("error_description")??T;q(_,400,P(`${t} authorization failed.`,C)),l({error:Error(`${t} authorization failed: ${C}`)});return}let y=I.searchParams.get("code");if(!y){q(_,400,P("Missing authorization code."));return}i=!0;try{let C=await e.complete(y);q(_,200,Ot(`Signed in to ${t}. You may now close this page.`)),l({value:C})}catch(C){let U=C instanceof Error?C:Error(String(C));q(_,502,P(`${t} sign-in failed.`,U.message)),l({error:U})}})()});await new Promise((m,_)=>{p.once("error",_),p.listen(e.port,e.host,()=>{p.off("error",_),m()})});let g=p.address();if(!g||typeof g==="string")throw p.close(),Error("OAuth callback server did not bind to TCP");if(p.on("error",(m)=>l({error:m})),o?.addEventListener("abort",u,{once:!0}),e.timeoutMs!==void 0)a=setTimeout(()=>l({error:Error(`${t} sign-in timed out`)}),e.timeoutMs);let f=e.redirectHost??e.host;return{redirectUri:`http://${f.includes(":")?`[${f}]`:f}:${g.port}${e.path}`,wait:()=>s,cancel:()=>{if(!i)l({value:void 0})},close:()=>{l({error:Error("OAuth callback server closed")}),p.close()}}}async function ge(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 d=await s;if(r)throw r;return{type:"manual",input:d??""}}finally{n.abort()}}function Wr(e){let t="";for(let o of e)t+=String.fromCharCode(o);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}async function N(){let e=new Uint8Array(32);crypto.getRandomValues(e);let t=Wr(e),n=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",n),s=Wr(new Uint8Array(r));return{verifier:t,challenge:s}}var Ud=(e)=>atob(e),Pt=Ud("OWQxYzI1MGEtZTYxYi00NGQ5LTg4ZWQtNTk0NGQxOTYyZjVl"),Xr="https://claude.ai/oauth/authorize",Ce="https://platform.claude.com/v1/oauth/token",Bd=A("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1",qr=53692,Jr="/callback",Dd=`http://localhost:${qr}${Jr}`,Vr="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 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:Pt,code:e,state:t,redirect_uri:n,code_verifier:o},r)}catch(d){throw Error(`Token exchange request failed. url=${Ce}; redirect_uri=${n}; response_type=authorization_code; details=${Be(d)}`)}let i;try{i=JSON.parse(s)}catch(d){throw Error(`Token exchange returned invalid JSON. url=${Ce}; body=${s}; details=${Be(d)}`)}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 N(),n=(i)=>F({providerName:"Anthropic",host:Bd,port:i,path:Jr,redirectHost:"localhost",state:t,complete:async(d)=>d,signal:e.signal}),r=await n(qr).catch(()=>n(0)).catch(()=>{return}),s=r?.redirectUri??Dd;try{let i=new URLSearchParams({code:"true",client_id:Pt,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 d=await ge(e,r,{message:"Complete login in your browser, or paste the authorization code / redirect URL here:",placeholder:s}),a,u=t;if(d.type==="callback")a=d.value;else{let l=Zr(d.input);if(l.state&&l.state!==t)throw Error("OAuth state mismatch");a=l.code,u=l.state??t}if(!a)throw Error("Missing authorization code");return e.notify({type:"progress",message:"Exchanging authorization code for tokens..."}),await ts(a,u,t,s,e.signal)}finally{r?.close()}}async function Fd(e){let{verifier:t,challenge:o}=await N(),n=new URLSearchParams({code:"true",client_id:Pt,response_type:"code",redirect_uri:Vr,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,Vr,e.signal)}async function Hd(e,t){let o;try{o=await es(Ce,{grant_type:"refresh_token",client_id:Pt,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: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 Gt(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 b(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="),co={"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 uo(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 lo(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 De(e){return e&&typeof e==="object"?e:void 0}function jd(e,t){let o=De(e)?.data;if(!Array.isArray(o))throw Error("Invalid Copilot models response");let n=o.flatMap((a)=>{let u=De(a),l=u?.id;if(!u||typeof l!=="string")return[];let p=De(u.capabilities);if(De(p?.supports)?.tool_calls===!1)return[];return[{id:l,pickerEnabled:u.model_picker_enabled===!0,policyState:De(u.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),d=n.filter((a)=>a.policyState==="unconfigured"&&Object.hasOwn(Gn,a.id)&&(a.pickerEnabled||s)).map((a)=>a.id);return{availableModelIds:i,policyModelIds:d}}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 d=0;;d++){let a=await fetch(e,{...t,signal:AbortSignal.any([s,AbortSignal.timeout(5000)])});if(a.status!==429||d===n.maxRetries)return a;let u=a.headers.get("retry-after"),l=500*2**d;if(u){let p=Number.parseFloat(u);if(l=Number.isNaN(p)?Date.parse(u)-Date.now():p*1000,!Number.isFinite(l))return a}if(l=Math.max(0,l),i!==void 0&&l>=i-Date.now())return a;await a.body?.cancel(),await Gt(l,s)}}async function cs(e,t,o,n){let r=lo(e,t),s=r==="https://api.individual.githubcopilot.com",i=await as(`${r}/models`,{headers:{Accept:"application/json",Authorization:`Bearer ${e}`,...co,"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 po(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=uo(e),n=await po(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:d,expires_in:a}=n;if(typeof r!=="string"||typeof s!=="string"||typeof i!=="string"||d!==void 0&&typeof d!=="number"||typeof a!=="number")throw Error("Invalid device code response fields");let u;try{u=new URL(i)}catch{throw Error("Untrusted verification_uri in device code response")}if(u.protocol!=="https:"&&u.protocol!=="http:")throw Error("Untrusted verification_uri in device code response");return{device_code:r,user_code:s,verification_uri:u.href,interval:d,expires_in:a}}async function Xd(e,t,o){let n=uo(e);return b({intervalSeconds:t.interval,expiresInSeconds:t.expires_in,waitBeforeFirstPoll:!0,signal:o,poll:async()=>{let r=await po(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:d}=r;if(s==="authorization_pending")return{status:"pending"};if(s==="slow_down")return{status:"slow_down",intervalSeconds:typeof d==="number"?d: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=uo(t||"github.com"),s=await po(r.copilotTokenUrl,{headers:{Accept:"application/json",Authorization:`Bearer ${e}`,...co},signal:o});if(!s||typeof s!=="object")throw Error("Invalid Copilot token response");let{token:i,expires_at:d}=s;if(typeof i!=="string"||typeof d!=="number")throw Error("Invalid Copilot token response fields");return{type:"oauth",refresh:e,access:i,expires:d*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=`${lo(e,o)}/models/${t}/policy`,i;try{i=await as(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`,...co,"openai-intent":"chat-policy","x-interaction-type":"chat-policy"},body:JSON.stringify({state:"enabled"})},n,{maxRetries:2,maxElapsedMs:5000})}catch(d){if(n.aborted)throw d;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),d=await ds(i,n??void 0,e.signal),a=await cs(d.access,n??void 0,e.signal,{maxRetries:2,maxElapsedMs:5000}),u=[];if(a.policyModelIds.length>0)e.notify({type:"progress",message:"Enabling models..."}),u=await Yd(d.access,a.policyModelIds,n??void 0,e.signal);return{...d,availableModelIds:[...new Set([...a.availableModelIds,...u])]}}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:lo(e.access,rs(e))}}};var _o="17e5f671-d194-4dfb-9706-5516cb48c098",Zd="https://auth.kimi.com",eu=900,tu=5,ou=30000,ls=3;function _s(){return(A("KIMI_CODE_OAUTH_HOST")||A("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:_o}),signal:ho(t)});if(!o.ok){let l=await o.text().catch(()=>"");throw Error(`Kimi Code device authorization failed with status ${o.status}${l?`: ${l}`:""}`)}let n=await mo(o),r=n?.device_code,s=n?.user_code,i=n?.verification_uri,d=n?.verification_uri_complete;if(typeof r!=="string"||typeof s!=="string"||typeof i!=="string"||typeof d!=="string"||!ps(d)||!ps(i))throw Error(`Invalid Kimi Code device authorization response: ${JSON.stringify(n)}`);let a=n?.interval,u=n?.expires_in;return{deviceCode:r,userCode:s,verificationUri:i,verificationUriComplete:d,intervalSeconds:typeof a==="number"&&Number.isFinite(a)&&a>0?a:tu,expiresInSeconds:typeof u==="number"&&Number.isFinite(u)&&u>0?u: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 b({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:_o,device_code:t.deviceCode,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),signal:ho(o)});if(n.status>=500){let d=await n.text().catch(()=>"");return{status:"failed",message:`Kimi Code device token request failed with status ${n.status}${d?`: ${d}`:""}`}}let r=await mo(n);if(n.ok&&typeof r?.access_token==="string")try{return{status:"complete",value:hs(r,"poll")}}catch(d){return{status:"failed",message:d instanceof Error?d.message:String(d)}}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 d=r?.interval;return{status:"slow_down",intervalSeconds:typeof d==="number"&&d>0?d: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 Gt(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:_o,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 d=JSON.stringify(i);throw Error(`Kimi Code token refresh failed with status ${s.status}${d?`: ${d}`:""}`)}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 b({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 Es={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",Ro="https://api.openai.com/v1",Ru=A("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1",xo=1455,As="/auth/callback",Se=`http://127.0.0.1:${xo}${As}`,Ao="chatgpt.tokens.use.direct",yu=`openid profile email offline_access resource.invoke ${Ao}`,xu=180000;function vs(){return mu(32).toString("base64url")}function Rs(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 Rs(o,t)}function Fe(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((d,a)=>{n=d,r=a}),i=gu((d,a)=>{try{let u=new URL(d.url||"",Se);if(u.pathname!==As){Fe(a,404,P("Callback route not found."));return}let l=u.searchParams.get("error");if(l){Fe(a,400,P("ChatGPT was not connected.",`Error: ${l}`)),r(Error(`ChatGPT authorization failed: ${l}`));return}let p;try{p=Rs(u,e)}catch(g){let f=g instanceof Error?g.message:"Invalid callback";Fe(a,400,P(f));return}Fe(a,200,Ot("ChatGPT authentication completed. You can close this window.")),n(p)}catch{Fe(a,500,P("Internal error while processing the callback."))}});i.once("error",o),i.listen(xo,Ru,()=>{i.removeListener("error",o),i.on("error",r),t({server:i,result:s})})})}async function ys(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 vo(e,t){if(typeof e!=="string"||e.trim().length===0)throw Error(`OpenAI OAuth token response has invalid ${t}`);return e}function xs(e,t,o){let n=vo(e.access_token,"access_token"),r=vo(e.refresh_token,"refresh_token"),s=vo(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 d=s.trim().split(/\s+/).filter(Boolean);if(!d.includes(Ao))throw Error(`OpenAI OAuth grant did not include ${Ao}`);return{type:"oauth",...i?{idToken:i}:{},access:n,refresh:r,expires:Date.now()+e.expires_in*1000-xu,clientId:t,scopes:d}}async function wu(e,t,o,n){let r=await ys(new URLSearchParams({grant_type:"authorization_code",client_id:o,code:e,code_verifier:t,redirect_uri:Se,resource:Ro}),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 xs(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 ys(new URLSearchParams({grant_type:"refresh_token",client_id:o,refresh_token:e.refresh,resource:Ro}),t);return xs(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 N(),s=vs(),i=vs(),d=await Tu(s).catch((p)=>{if(!(p instanceof Error&&("code"in p)&&p.code==="EADDRINUSE"))throw p;throw Error(`Port ${xo} 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:Ro,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 u=new AbortController,l=e.prompt({type:"manual_code",message:"Complete login in your browser, or paste the final redirect URL here:",placeholder:Se,signal:AbortSignal.any([u.signal,e.signal])}).then((p)=>Iu(p,s));try{let p=await Promise.race([d.result,l]);return e.notify({type:"progress",message:"Exchanging authorization code for tokens..."}),await wu(p.code,n,p.clientId,e.signal)}catch(p){if(e.signal.aborted)throw Error("Login cancelled");throw p}finally{u.abort(),d.server.close(),d.server.closeAllConnections()}}var Is={name:"OpenAI (ChatGPT subscription)",isSubscription:!0,loginLabel:"Sign in with ChatGPT",login:Pu,refresh:ku,async toAuth(e){return{apiKey:e.access}}};var Io=null;if(typeof process<"u"&&(process.versions?.node||process.versions?.bun))import("crypto").then((e)=>{Io=e.randomBytes});var Nt="app_EMoamEEZ73f0CkXaXp7hrann",Ee="https://auth.openai.com",Gu=`${Ee}/oauth/authorize`,ks=`${Ee}/oauth/token`,To="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`,Os=900,Ts="browser",ws="device_code",Uu="openid profile email offline_access",Bu="https://api.openai.com/auth";function Du(){return A("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1"}function $u(){if(!Io)throw Error("OpenAI Codex OAuth is only available in Node.js environments");return Io(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 wo(e,t){try{return await fetch(e,t)}catch(o){if(t.signal?.aborted)throw Error("Login cancelled");throw o}}async function Ps(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 wo(ks,{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 Ps(r,"exchange")}async function Vu(e,t){let o;try{o=await fetch(ks,{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 Ps(o,"refresh")}async function Ku(e){let t=await wo(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 b({intervalSeconds:e.intervalSeconds,expiresInSeconds:Os,signal:t,poll:async()=>{let o=await wo(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 N(),n=$u(),r=new URL(Gu);return r.searchParams.set("response_type","code"),r.searchParams.set("client_id",Nt),r.searchParams.set("redirect_uri",To),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 Gs(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 bs(e,t,o,n){return Gs(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:Os});let o=await ju(t,e.signal);return bs(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 F({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 ge(e,s,{message:"Complete login in your browser, or paste the authorization code / redirect URL here:",placeholder:To}),d;if(i.type==="callback")d=i.value;else{let a=Fu(i.input);if(a.state&&a.state!==n)throw Error("State mismatch");d=a.code}if(!d)throw Error("Missing authorization code");return await bs(d,o,To,e.signal)}finally{s?.close()}}async function Yu(e,t){return Gs(await Vu(e,t))}var Ns={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:Ts,label:"Browser login (default)"},{id:ws,label:"Device code login (headless)"}]});if(o===ws)return qu(e);if(o!==Ts)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 A("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 Ls(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,d={};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))d=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(d);throw Error(`OpenRouter OAuth key exchange failed (HTTP ${i.status})${a?`: ${a}`:""}`)}if(typeof d.key!=="string"||d.key.length===0)throw Error('OpenRouter OAuth response carries no "key"');return{type:"oauth",access:d.key,refresh:"",expires:Number.MAX_SAFE_INTEGER}}async function sl(e){let{verifier:t,challenge:o}=await N(),n=await F({providerName:"OpenRouter",host:ol(),port:0,path:`/oauth/callback/${crypto.randomUUID()}`,complete:(r)=>Ls(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 ge(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 Ls(i,t,e.signal)}finally{n.close()}}var Ms={name:"OpenRouter OAuth",loginLabel:"Sign in with OpenRouter",login:sl,async refresh(e,t){return e},async toAuth(e){return{apiKey:e.access}}};var Ds="127.0.0.1",$s=1456,Fs="/oauth/callback",ko=`http://${Ds}:${$s}${Fs}`,il=60000,Us="browser",Bs="device-code",He="pi-gateway",Hs="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 Oo 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 Ws(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 Oo(e.status,n,r,t)}async function Po(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 Ws(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 N(),s=crypto.randomUUID(),i=new URL(t);i.search=new URLSearchParams({response_type:"code",client_id:He,redirect_uri:ko,scope:Hs,code_challenge:r,code_challenge_method:"S256",handoff:"url",state:s}).toString();let d=await F({providerName:"Radius",host:Ds,port:$s,path:Fs,state:s,complete:(a)=>Po(e,new URLSearchParams({grant_type:"authorization_code",client_id:He,redirect_uri:ko,code:a,code_verifier:n}),o.signal),signal:o.signal});o.notify({type:"progress",message:`Listening for OAuth callback on ${ko}`}),o.notify({type:"auth_url",url:i.toString(),instructions:"Continue in your browser."});try{let a=await d.wait();if(!a)throw Error("OAuth callback did not complete.");return a}finally{d.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:He,scope:Hs}),signal:t})}catch(r){if(t.aborted)throw Error("Login cancelled");throw r}if(!o.ok)throw await Ws(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}),b({intervalSeconds:o.interval,expiresInSeconds:o.expires_in,signal:t.signal,poll:async()=>{try{return{status:"complete",value:await Po(e,new URLSearchParams({grant_type:al,client_id:He,device_code:o.device_code}),t.signal)}}catch(n){if(!(n instanceof Oo))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 Vs(e){let t=Kr(e.gateway);return{name:e.name,async login(o){let n=await o.prompt({type:"select",message:`Sign in to ${e.name}:`,options:[{id:Us,label:"Sign in with browser (recommended)"},{id:Bs,label:"Sign in with device code (when signing in from another device)"}]});if(n===Bs)return ll(t,o);if(n===Us){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 Po(t,new URLSearchParams({grant_type:"refresh_token",client_id:He,refresh_token:o.refresh}),n)},async toAuth(o){return{apiKey:o.access}}}}var Go="b1a00492-073a-47ea-816f-4c329264a828",pl="openid profile email offline_access grok-cli:access api:access",_l="https://auth.x.ai/oauth2/device/code",js="https://auth.x.ai/oauth2/token",hl=300000,fl=3600;function We(e,t){let o=e[t];if(typeof o!=="string"||o.length===0)throw Error(`Invalid xAI OAuth response field: ${t}`);return o}function zs(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 Ks(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 bo(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 No(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?Ks(e.verification_uri_complete):void 0;return{deviceCode:We(e,"device_code"),userCode:We(e,"user_code"),verificationUri:Ks(We(e,"verification_uri")),verificationUriComplete:n,intervalSeconds:o,expiresInSeconds:zs(e,"expires_in")}}function Xs(e,t){let o=We(e,"access_token"),n=e.refresh_token===void 0&&t?t:We(e,"refresh_token"),r=e.expires_in===void 0?fl:zs(e,"expires_in");return{type:"oauth",access:o,refresh:n,expires:Date.now()+r*1000-hl}}async function gl(e){let t=await bo(_l,{client_id:Go,scope:pl,referrer:"pi"},e);if(!t.ok)throw No("device authorization",t);return ml(t.body)}async function Cl(e,t){return b({intervalSeconds:e.intervalSeconds,expiresInSeconds:e.expiresInSeconds,waitBeforeFirstPoll:!0,signal:t,poll:async()=>{let o=await bo(js,{grant_type:"urn:ietf:params:oauth:grant-type:device_code",client_id:Go,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:No("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 bo(js,{grant_type:"refresh_token",client_id:Go,refresh_token:e},t);if(!o.ok)throw No("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(){wa({anthropic:()=>os,openaiCodex:()=>Ns,openaiChatGPT:()=>Is,githubCopilot:()=>us,openrouter:()=>Ms,kimiCoding:()=>fs,meta:()=>Es,xai:()=>qs,radius:Vs})}fa(Fr);Js();await import("./chunk-r6pt44wk.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");
|