@qitqode/qitqode-android-arm64 0.2.8 → 0.2.10
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/bundle/chunk-062chtrq.js +2 -0
- package/bundle/chunk-062vs7bp.js +2 -0
- package/bundle/chunk-08g14hmz.js +2 -0
- package/bundle/{chunk-wgkcyqn1.js → chunk-0bhzhh7s.js} +2 -2
- package/bundle/{chunk-cfwz1hgr.js → chunk-0mwzxqt5.js} +3 -3
- package/bundle/{chunk-mr17tppa.js → chunk-0sfc21qe.js} +2 -2
- package/bundle/{chunk-7adsab4h.js → chunk-0tkznq75.js} +1 -1
- package/bundle/chunk-0w2v8dfy.js +2 -0
- package/bundle/chunk-10fr7a2y.js +2 -0
- package/bundle/chunk-141p12c4.js +4 -0
- package/bundle/chunk-15bjhfav.js +3 -0
- package/bundle/{chunk-92r1gw2j.js → chunk-1h96bk6p.js} +2 -2
- package/bundle/chunk-1hv61m11.js +2 -0
- package/bundle/{chunk-0z1keh2w.js → chunk-1m78yy4k.js} +1 -1
- package/bundle/chunk-1q10jyka.js +29 -0
- package/bundle/{chunk-g4tyaj0m.js → chunk-1r81q7m3.js} +1 -1
- package/bundle/{chunk-82xrfk5x.js → chunk-2cvwrabw.js} +2 -2
- package/bundle/{chunk-8p0t8qah.js → chunk-2dmcpqak.js} +1 -1
- package/bundle/{chunk-35fj1sfm.js → chunk-2fbkw84y.js} +2 -2
- package/bundle/chunk-2mkvx8b2.js +2 -0
- package/bundle/chunk-2rykfc3a.js +2 -0
- package/bundle/chunk-2w5hx4fs.js +2 -0
- package/bundle/{chunk-t3w43rft.js → chunk-2y5bthrp.js} +1 -1
- package/bundle/chunk-2yy63sxz.js +2 -0
- package/bundle/chunk-2z3fe4qw.js +2 -0
- package/bundle/{chunk-g7v6sp3c.js → chunk-2zjet9tx.js} +2 -2
- package/bundle/{chunk-qgkb6n8k.js → chunk-32xd626h.js} +2 -2
- package/bundle/chunk-361cmmrp.js +2 -0
- package/bundle/{chunk-eg1m81ax.js → chunk-3mtjxmw1.js} +1 -1
- package/bundle/chunk-3r6dq1h3.js +2 -0
- package/bundle/{chunk-wtt5wms9.js → chunk-3sj0jv91.js} +1 -1
- package/bundle/{chunk-hz02vrqs.js → chunk-3vae1s42.js} +1 -1
- package/bundle/{chunk-t18ka1e7.js → chunk-3yfjgks3.js} +1 -1
- package/bundle/{chunk-phf37x1c.js → chunk-3zzrdpsx.js} +1 -1
- package/bundle/chunk-4a12wv2m.js +2 -0
- package/bundle/{chunk-1rgt2vmt.js → chunk-4a9jqe5s.js} +1 -1
- package/bundle/{chunk-wqk1v8t0.js → chunk-4sa9t0vx.js} +2 -2
- package/bundle/{chunk-qbnt4ynd.js → chunk-532fnfmw.js} +2 -2
- package/bundle/chunk-547a55ba.js +2 -0
- package/bundle/{chunk-vr8nwzp0.js → chunk-56yp5v0w.js} +1 -1
- package/bundle/{chunk-ag8wxwwz.js → chunk-5fcyb122.js} +1 -1
- package/bundle/{chunk-4pmvxnkj.js → chunk-5nm5egq0.js} +2 -2
- package/bundle/{chunk-1v0khv7p.js → chunk-5p2r8bxx.js} +1 -1
- package/bundle/{chunk-5bv63rqj.js → chunk-5rqjze1g.js} +1 -1
- package/bundle/{chunk-sy9w1t2y.js → chunk-5w7ebtcd.js} +1 -1
- package/bundle/chunk-5ztmc770.js +2 -0
- package/bundle/{chunk-a1z8rnq7.js → chunk-61t4g8bh.js} +4 -4
- package/bundle/chunk-62x3r2q8.js +2 -0
- package/bundle/chunk-62y6zk9x.js +2 -0
- package/bundle/{chunk-c76cjhn0.js → chunk-6axm2qtj.js} +1 -1
- package/bundle/{chunk-zfrftgcy.js → chunk-6gbdvz6p.js} +1 -1
- package/bundle/{chunk-fa8pwdwv.js → chunk-6mnk5sg3.js} +1 -1
- package/bundle/chunk-6th7vpwm.js +2 -0
- package/bundle/{chunk-8yzghzjq.js → chunk-6wjdhvdf.js} +1 -1
- package/bundle/{chunk-a8bjcvda.js → chunk-6y58jzak.js} +1 -1
- package/bundle/chunk-6ybh5smv.js +2 -0
- package/bundle/chunk-73kprndw.js +2 -0
- package/bundle/chunk-79fr19xf.js +2 -0
- package/bundle/{chunk-3va85mbe.js → chunk-7a3txs9f.js} +2 -2
- package/bundle/chunk-7ezr478e.js +2 -0
- package/bundle/chunk-7gj1vqyj.js +2 -0
- package/bundle/{chunk-eacpc64g.js → chunk-7hdb1fhq.js} +2 -2
- package/bundle/{chunk-t8fjgkp8.js → chunk-7rbg6mg9.js} +2 -2
- package/bundle/{chunk-59csnjc3.js → chunk-7s0nq2aa.js} +2 -2
- package/bundle/chunk-7ywfkwb4.js +2 -0
- package/bundle/chunk-819qr675.js +2 -0
- package/bundle/{chunk-g6y2c5az.js → chunk-81dvy370.js} +1 -1
- package/bundle/chunk-85fnnwm2.js +2 -0
- package/bundle/chunk-89fwh84w.js +2 -0
- package/bundle/chunk-8e724g3k.js +2 -0
- package/bundle/{chunk-6qwk6z87.js → chunk-8gpjmj42.js} +3 -3
- package/bundle/{chunk-wtxh5m6j.js → chunk-8nnajdwf.js} +3 -3
- package/bundle/chunk-8peby2d1.js +2 -0
- package/bundle/{chunk-3zwma68w.js → chunk-8rkszwxq.js} +6 -6
- package/bundle/{chunk-w0nc0gcx.js → chunk-8v60bqm0.js} +1 -1
- package/bundle/chunk-9894a2yn.js +2 -0
- package/bundle/chunk-98ye2nwt.js +2 -0
- package/bundle/{chunk-48gap82w.js → chunk-9bbwxp5d.js} +1 -1
- package/bundle/{chunk-z0kbyr00.js → chunk-9d0exvey.js} +2 -2
- package/bundle/{chunk-8ysp6vf8.js → chunk-9fjcgdea.js} +1 -1
- package/bundle/{chunk-jpn9zfj5.js → chunk-9nf5650d.js} +1 -1
- package/bundle/{chunk-n6tqtk6h.js → chunk-9pj10pgd.js} +2 -2
- package/bundle/chunk-9s4excg8.js +2 -0
- package/bundle/{chunk-t6zz47zk.js → chunk-9s5h0f1y.js} +2 -2
- package/bundle/{chunk-p8ak162p.js → chunk-9tz18e54.js} +1 -1
- package/bundle/{chunk-fs1vb39f.js → chunk-9zy5tsry.js} +3 -3
- package/bundle/{chunk-bc2krtaf.js → chunk-a70m6kyn.js} +1 -1
- package/bundle/{chunk-cr5tknvb.js → chunk-acsqvgdw.js} +1 -1
- package/bundle/chunk-aetgcegz.js +2 -0
- package/bundle/chunk-agas0nay.js +2 -0
- package/bundle/{chunk-vs3s49jw.js → chunk-ajnzv5jt.js} +2 -2
- package/bundle/{chunk-9cf2ktyh.js → chunk-asxmkyz2.js} +1 -1
- package/bundle/{chunk-0ffmwhw7.js → chunk-at4dge22.js} +1 -1
- package/bundle/{chunk-sa0rrreh.js → chunk-atacnspd.js} +2 -2
- package/bundle/chunk-ayknzc4m.js +2 -0
- package/bundle/chunk-azss4acq.js +3 -0
- package/bundle/chunk-b2ybst88.js +2 -0
- package/bundle/{chunk-cghz0855.js → chunk-b8rzn48q.js} +1 -1
- package/bundle/{chunk-dhvx9p54.js → chunk-b9f78x5g.js} +1 -1
- package/bundle/chunk-bd5vtjd7.js +2 -0
- package/bundle/chunk-bjqqk6jt.js +2 -0
- package/bundle/{chunk-mv7q6ach.js → chunk-brk1jca3.js} +1 -1
- package/bundle/{chunk-5r7c6vvx.js → chunk-by1kwg4r.js} +2 -2
- package/bundle/{chunk-he9kpk9r.js → chunk-c1c8ch3g.js} +327 -313
- package/bundle/{chunk-2nheahmq.js → chunk-c2ns2csn.js} +1 -1
- package/bundle/{chunk-qk5vy2pr.js → chunk-c3ey896z.js} +1 -1
- package/bundle/{chunk-b7sr9rn3.js → chunk-c8080519.js} +1 -1
- package/bundle/{chunk-33ebjca6.js → chunk-c8yc8qcd.js} +1 -1
- package/bundle/{chunk-f81kk8ra.js → chunk-c9cngded.js} +1 -1
- package/bundle/{chunk-ejhhrece.js → chunk-ccdjzn2m.js} +3 -3
- package/bundle/{chunk-rk0fnvp5.js → chunk-cdenq7jb.js} +1 -1
- package/bundle/chunk-cpkcdykz.js +2 -0
- package/bundle/{chunk-56wq8cqj.js → chunk-cs825mxr.js} +1 -1
- package/bundle/{chunk-1bxfzd6r.js → chunk-cxtwavyf.js} +4 -4
- package/bundle/chunk-cyafm8d6.js +2 -0
- package/bundle/{chunk-eewe7tx1.js → chunk-d0dsgxk4.js} +2 -2
- package/bundle/{chunk-g3n465ee.js → chunk-d1fv2c7s.js} +2 -2
- package/bundle/{chunk-1p9s5jj1.js → chunk-d1xfv4d3.js} +1 -1
- package/bundle/chunk-d4316r53.js +2 -0
- package/bundle/chunk-d8ym7mcg.js +2 -0
- package/bundle/{chunk-epmc4aht.js → chunk-d9w2bn2e.js} +1 -1
- package/bundle/{chunk-g26redah.js → chunk-dd461rg3.js} +1 -1
- package/bundle/{chunk-e0vrxetq.js → chunk-djfrkbd5.js} +1 -1
- package/bundle/{chunk-ayb3bdb7.js → chunk-dm447tgc.js} +2 -2
- package/bundle/{chunk-qxdpgdfk.js → chunk-dnjyepb2.js} +2 -2
- package/bundle/chunk-dnpjxjkp.js +2 -0
- package/bundle/{chunk-0a4pmkc9.js → chunk-dp6ms01y.js} +2 -2
- package/bundle/{chunk-58f4y4b7.js → chunk-dx7rexx3.js} +3 -3
- package/bundle/{chunk-kre93a89.js → chunk-dz3kcsb6.js} +2 -2
- package/bundle/{chunk-4aajzxm9.js → chunk-dzma8zvf.js} +2 -2
- package/bundle/{chunk-e2wfj86b.js → chunk-e10c0crf.js} +1 -1
- package/bundle/{chunk-wn63q3xp.js → chunk-e1x1mp9m.js} +1 -1
- package/bundle/{chunk-w9qh2479.js → chunk-e3mrw0k7.js} +1 -1
- package/bundle/chunk-e5gjqtby.js +2 -0
- package/bundle/{chunk-3z2zn8rj.js → chunk-e72jwbfc.js} +1 -1
- package/bundle/{chunk-85wh85pk.js → chunk-eabbrt1p.js} +1 -1
- package/bundle/{chunk-jr80q31w.js → chunk-ecz4h0a2.js} +1 -1
- package/bundle/chunk-ee3mqzms.js +2 -0
- package/bundle/chunk-eme9xmh3.js +2 -0
- package/bundle/{chunk-cf9m9m9q.js → chunk-eqpep2m2.js} +1 -1
- package/bundle/chunk-er5f61s5.js +2 -0
- package/bundle/chunk-er716522.js +2 -0
- package/bundle/{chunk-qgek59e6.js → chunk-ev6jwt7q.js} +1 -1
- package/bundle/chunk-ez3gacqe.js +2 -0
- package/bundle/{chunk-ax64ngf2.js → chunk-f0ab2f28.js} +1 -1
- package/bundle/{chunk-ggncq8w8.js → chunk-f17se3hh.js} +1 -1
- package/bundle/chunk-f3y5kr76.js +14 -0
- package/bundle/{chunk-vsqvnxbz.js → chunk-f6btedtt.js} +1 -1
- package/bundle/{chunk-h4hs2rhf.js → chunk-f6vy70p6.js} +2 -2
- package/bundle/{chunk-5f0nhthe.js → chunk-ff8q10gk.js} +2 -2
- package/bundle/chunk-fkc7wf1p.js +2 -0
- package/bundle/chunk-fm6z8nqb.js +2 -0
- package/bundle/{chunk-fw1f47de.js → chunk-fsndgr9a.js} +1 -1
- package/bundle/{chunk-pqg1wjb5.js → chunk-fvv1cret.js} +1 -1
- package/bundle/{chunk-j10a984e.js → chunk-g08qj9z3.js} +2 -2
- package/bundle/chunk-g0qwm23d.js +2 -0
- package/bundle/chunk-g4yn8cj8.js +2 -0
- package/bundle/{chunk-vkjqy92f.js → chunk-g52wmt1v.js} +1 -1
- package/bundle/{chunk-trstb8ee.js → chunk-gb51fn3r.js} +1 -1
- package/bundle/{chunk-kgv68cpb.js → chunk-gbnf7zf9.js} +1 -1
- package/bundle/{chunk-0w19vmd7.js → chunk-ge7csm6m.js} +2 -2
- package/bundle/{chunk-gc5rhnht.js → chunk-gksbv613.js} +2 -2
- package/bundle/{chunk-afr8m0q1.js → chunk-gmq1kwn0.js} +1 -1
- package/bundle/{chunk-9009v4d0.js → chunk-gq3zb4wv.js} +2 -2
- package/bundle/{chunk-tbx741en.js → chunk-gqgjybjc.js} +1 -1
- package/bundle/{chunk-2qm46qvn.js → chunk-gx4v8z64.js} +2 -2
- package/bundle/{chunk-sm1g81cv.js → chunk-h0pvxre5.js} +1 -1
- package/bundle/chunk-h1spsy3y.js +2 -0
- package/bundle/{chunk-sbjymf20.js → chunk-h2p984qb.js} +2 -2
- package/bundle/{chunk-gznt3dv8.js → chunk-h6z86aay.js} +1 -1
- package/bundle/chunk-h8gkv40j.js +2 -0
- package/bundle/{chunk-zsg29gba.js → chunk-h91zmzs5.js} +1 -1
- package/bundle/{chunk-zrhw1szj.js → chunk-hgm8yfcb.js} +1 -1
- package/bundle/chunk-j59kmb49.js +2 -0
- package/bundle/chunk-j5z95b6f.js +3 -0
- package/bundle/{chunk-52xvhxek.js → chunk-j7637cwg.js} +2 -2
- package/bundle/{chunk-rwnwjm82.js → chunk-jbcqhw3x.js} +2 -2
- package/bundle/{chunk-qgfbsmsx.js → chunk-je8fcsa9.js} +1 -1
- package/bundle/{chunk-y0h3jfkj.js → chunk-jt6bvxtr.js} +1 -1
- package/bundle/chunk-jv37ghev.js +2 -0
- package/bundle/chunk-k10rtgsk.js +5 -0
- package/bundle/chunk-k3hcb6qf.js +2 -0
- package/bundle/chunk-k5d822n2.js +3 -0
- package/bundle/{chunk-2vaphpz0.js → chunk-kc8n5cgb.js} +1 -1
- package/bundle/chunk-kcqeh1e5.js +2 -0
- package/bundle/{chunk-5xkp27b1.js → chunk-kds2g7r2.js} +1 -1
- package/bundle/{chunk-scnbt714.js → chunk-kec1xw1n.js} +1 -1
- package/bundle/{chunk-s8z7v1me.js → chunk-kk850sdw.js} +2 -2
- package/bundle/{chunk-3bb4aqh9.js → chunk-m01h6kk1.js} +1 -1
- package/bundle/{chunk-2t5yh25f.js → chunk-m4j6t713.js} +1 -1
- package/bundle/chunk-m8ytbq04.js +2 -0
- package/bundle/chunk-mf9nc4xz.js +2 -0
- package/bundle/{chunk-7thhd7ds.js → chunk-mmqyter3.js} +1 -1
- package/bundle/{chunk-9cn8cmt0.js → chunk-mn0pshpv.js} +1 -1
- package/bundle/{chunk-s2tc3qs0.js → chunk-mn5cacf6.js} +2 -2
- package/bundle/{chunk-0egrckx0.js → chunk-mp1x10t5.js} +2 -2
- package/bundle/chunk-mxby91bj.js +2 -0
- package/bundle/chunk-mzv1gh6f.js +2 -0
- package/bundle/chunk-n0hsvvw8.js +2 -0
- package/bundle/{chunk-az3nss5m.js → chunk-ngyv4fhn.js} +2 -2
- package/bundle/{chunk-g9nwqwqp.js → chunk-nh4zk07t.js} +1 -1
- package/bundle/{chunk-8jmb5bd4.js → chunk-nk5vrenn.js} +2 -2
- package/bundle/chunk-nm1v9z14.js +2 -0
- package/bundle/chunk-nnkfdhh9.js +2 -0
- package/bundle/{chunk-jqj1ay7x.js → chunk-npdgfqaw.js} +1 -1
- package/bundle/{chunk-p2fte9vz.js → chunk-nq4x6792.js} +2 -2
- package/bundle/{chunk-wr6rnxr5.js → chunk-nqk8d62j.js} +1 -1
- package/bundle/{chunk-7jy53zqy.js → chunk-p506eydh.js} +1 -1
- package/bundle/{chunk-phpxxd48.js → chunk-p6jf1fyt.js} +1 -1
- package/bundle/chunk-p7nstcxa.js +2 -0
- package/bundle/{chunk-6ps30qax.js → chunk-pbanj1gk.js} +2 -2
- package/bundle/{chunk-vph4w4yy.js → chunk-pchv413c.js} +2 -2
- package/bundle/{chunk-5nmm1kvx.js → chunk-pf2vq6t1.js} +2 -2
- package/bundle/chunk-pfwkvv7g.js +2 -0
- package/bundle/{chunk-ntr0ezf2.js → chunk-pky8h8rh.js} +1 -1
- package/bundle/chunk-pn1jz8qj.js +2 -0
- package/bundle/chunk-pqvmtfk7.js +2 -0
- package/bundle/chunk-prgw26g3.js +2 -0
- package/bundle/{chunk-kckr30tf.js → chunk-psqtptrs.js} +1 -1
- package/bundle/chunk-pv9ty6v7.js +2 -0
- package/bundle/{chunk-060wbpz4.js → chunk-pwsajn96.js} +1 -1
- package/bundle/{chunk-c3yjbent.js → chunk-pxm0x3e0.js} +1 -1
- package/bundle/chunk-pyf649pz.js +2 -0
- package/bundle/{chunk-wd8f9r4k.js → chunk-q0xgxygw.js} +1 -1
- package/bundle/{chunk-rye1yjnr.js → chunk-q26s0wb5.js} +1 -1
- package/bundle/{chunk-a48mx917.js → chunk-q4mtwv1w.js} +2 -2
- package/bundle/chunk-q4rstre7.js +2 -0
- package/bundle/chunk-q6jk2v6g.js +2 -0
- package/bundle/{chunk-5wx962mw.js → chunk-q7s6z0nz.js} +1 -1
- package/bundle/{chunk-jmmtcr2r.js → chunk-q8fjktv4.js} +1 -1
- package/bundle/{chunk-m7tmgvh6.js → chunk-qbewhcsz.js} +1 -1
- package/bundle/chunk-qd43npx3.js +2 -0
- package/bundle/{chunk-ydgst3h8.js → chunk-qdafm7qg.js} +2 -2
- package/bundle/chunk-qdb21y83.js +2 -0
- package/bundle/{chunk-72crs18f.js → chunk-qdbx1qkr.js} +1 -1
- package/bundle/{chunk-nga216dm.js → chunk-qdh2dm62.js} +1 -1
- package/bundle/chunk-qeksaefy.js +2 -0
- package/bundle/{chunk-qk1jkc0n.js → chunk-qjw2zcq5.js} +1 -1
- package/bundle/{chunk-dt3bsmfe.js → chunk-qm9fm5ja.js} +2 -2
- package/bundle/{chunk-h8mfbbjh.js → chunk-qq9yc2tp.js} +2 -2
- package/bundle/{chunk-0tcggtwv.js → chunk-qtyapmy7.js} +1 -1
- package/bundle/{chunk-4064rbtp.js → chunk-qyan69nb.js} +1 -1
- package/bundle/chunk-r7t9yb9d.js +2 -0
- package/bundle/{chunk-6tqbnxar.js → chunk-r81w6skn.js} +1 -1
- package/bundle/{chunk-f4mnp6xd.js → chunk-rk21wv4k.js} +1 -1
- package/bundle/{chunk-ccf4pgkr.js → chunk-rpdgn9z3.js} +2 -2
- package/bundle/chunk-rxnd79h7.js +7 -0
- package/bundle/chunk-s05hqtx1.js +3 -0
- package/bundle/chunk-s27cz24e.js +808 -0
- package/bundle/chunk-sdv3a4w3.js +2 -0
- package/bundle/{chunk-zwhmg9dj.js → chunk-se8d5xg9.js} +1 -1
- package/bundle/chunk-sk89becn.js +2 -0
- package/bundle/{chunk-sz0favtz.js → chunk-snf6ahg7.js} +1 -1
- package/bundle/{chunk-dgcannw0.js → chunk-t2r51r6v.js} +1 -1
- package/bundle/{chunk-rva2ekrt.js → chunk-t5wdstzv.js} +1 -1
- package/bundle/{chunk-ytyzrqev.js → chunk-t9pq363q.js} +2 -2
- package/bundle/chunk-tc0996xz.js +2 -0
- package/bundle/chunk-td9hm9be.js +2 -0
- package/bundle/{chunk-xy8arehp.js → chunk-tdevq564.js} +1 -1
- package/bundle/chunk-te91d271.js +2 -0
- package/bundle/chunk-tfs50mgj.js +2 -0
- package/bundle/{chunk-5cw8235e.js → chunk-tg1f56s3.js} +1 -1
- package/bundle/chunk-thecq33z.js +3 -0
- package/bundle/{chunk-f2v4g7t1.js → chunk-tjfer79w.js} +1 -1
- package/bundle/chunk-tjvtp9d9.js +2 -0
- package/bundle/chunk-tkm9m3n0.js +2 -0
- package/bundle/{chunk-ynf17943.js → chunk-tm79yrf3.js} +2 -2
- package/bundle/{chunk-tsmj98yf.js → chunk-v03xq38e.js} +2 -2
- package/bundle/chunk-v0hnn7nb.js +2 -0
- package/bundle/{chunk-ftvvm4r5.js → chunk-v16n1fep.js} +2 -2
- package/bundle/chunk-v1s1rcqx.js +2 -0
- package/bundle/chunk-v4dt4062.js +2 -0
- package/bundle/{chunk-makegrxs.js → chunk-v8bxj01h.js} +1 -1
- package/bundle/{chunk-ryrxgn6d.js → chunk-v8rqgt7h.js} +1 -1
- package/bundle/{chunk-m4r8sepw.js → chunk-vbb1jg02.js} +1 -1
- package/bundle/{chunk-2kh0tg92.js → chunk-vbfc0wgv.js} +2 -2
- package/bundle/{chunk-d839fr0w.js → chunk-vjt6mh10.js} +2 -2
- package/bundle/{chunk-gsg6zn7e.js → chunk-vk35g121.js} +2 -2
- package/bundle/{chunk-dwkrqtbc.js → chunk-vsfj16v9.js} +2 -2
- package/bundle/{chunk-zqdjk4rf.js → chunk-vy93mn7d.js} +2 -2
- package/bundle/{chunk-1har4t9a.js → chunk-waa781eh.js} +1 -1
- package/bundle/{chunk-wb47k8ah.js → chunk-wbt31xap.js} +2 -2
- package/bundle/{chunk-0tm6589k.js → chunk-wd2xmkdp.js} +2 -2
- package/bundle/{chunk-fej5x648.js → chunk-wecs14rz.js} +1 -1
- package/bundle/chunk-wgrq86kd.js +2 -0
- package/bundle/chunk-wh2qqhep.js +8 -0
- package/bundle/{chunk-g878zd6e.js → chunk-x0hhw46n.js} +1 -1
- package/bundle/{chunk-w7a33cwa.js → chunk-x308f9j4.js} +2 -2
- package/bundle/{chunk-y3gy62q5.js → chunk-x50adh71.js} +1 -1
- package/bundle/chunk-x8ks2bn7.js +2 -0
- package/bundle/{chunk-f8cae1ap.js → chunk-xcmbxny8.js} +1 -1
- package/bundle/{chunk-rmsqb6r4.js → chunk-xgf4k9q7.js} +1 -1
- package/bundle/{chunk-2caaqmec.js → chunk-xj0zc9za.js} +1 -1
- package/bundle/{chunk-27saej0r.js → chunk-xnxw5zz9.js} +2 -2
- package/bundle/{chunk-fjftb2sz.js → chunk-xqwk2zsx.js} +2 -2
- package/bundle/{chunk-d30k7dpf.js → chunk-xstxdw7v.js} +1 -1
- package/bundle/{chunk-x00hwy3x.js → chunk-xv03hbgj.js} +1 -1
- package/bundle/{chunk-bwadggys.js → chunk-xvvt886p.js} +2 -2
- package/bundle/{chunk-khpfseej.js → chunk-xy2ty5h5.js} +2 -2
- package/bundle/{chunk-wm9nh9nb.js → chunk-yce8ph5b.js} +2 -2
- package/bundle/{chunk-fh3d0wce.js → chunk-yexzxx6f.js} +1 -1
- package/bundle/{chunk-eyr5ymt8.js → chunk-yh1t6jrj.js} +1 -1
- package/bundle/chunk-yspstxkq.js +2 -0
- package/bundle/{chunk-ykpj10nz.js → chunk-yydqavgh.js} +2 -2
- package/bundle/{chunk-bnaj2hh3.js → chunk-yzd6cyep.js} +1 -1
- package/bundle/chunk-z023h7t8.js +2 -0
- package/bundle/chunk-z0383stv.js +2 -0
- package/bundle/{chunk-vbfej8ds.js → chunk-z0m1qm7j.js} +2 -2
- package/bundle/{chunk-bpfq8fz4.js → chunk-z69tt390.js} +1 -1
- package/bundle/chunk-zewrmk8x.js +2 -0
- package/bundle/{chunk-29gwtcey.js → chunk-zfqgh9h7.js} +1 -1
- package/bundle/{chunk-h1bvqstw.js → chunk-zskdxbbh.js} +1 -1
- package/bundle/{chunk-kveztc6k.js → chunk-ztvkzex1.js} +1 -1
- package/bundle/index.js +3 -3
- package/bundle/parser.worker.js +2 -2
- package/bundle/worker.js +1 -1
- package/package.json +1 -1
- package/bundle/chunk-03zpnwk2.js +0 -2
- package/bundle/chunk-0aqdzyar.js +0 -2
- package/bundle/chunk-26cr51wa.js +0 -28
- package/bundle/chunk-2a5gjgvp.js +0 -2
- package/bundle/chunk-2pkfphgb.js +0 -2
- package/bundle/chunk-37cbrnke.js +0 -8
- package/bundle/chunk-3cx4p07h.js +0 -2
- package/bundle/chunk-3f2cjzb4.js +0 -2
- package/bundle/chunk-3qvap1kv.js +0 -2
- package/bundle/chunk-42hvspe7.js +0 -2
- package/bundle/chunk-452tk6v3.js +0 -2
- package/bundle/chunk-4gqb1hps.js +0 -2
- package/bundle/chunk-50qgz5ka.js +0 -2
- package/bundle/chunk-5b0xyq5z.js +0 -2
- package/bundle/chunk-5j4nxpdy.js +0 -2
- package/bundle/chunk-5nxgk6hw.js +0 -2
- package/bundle/chunk-5qkvhr6y.js +0 -2
- package/bundle/chunk-66qmmmdp.js +0 -2
- package/bundle/chunk-66wv82vf.js +0 -2
- package/bundle/chunk-6dpdkzrk.js +0 -2
- package/bundle/chunk-6p6m5956.js +0 -3
- package/bundle/chunk-6yhn9syz.js +0 -2
- package/bundle/chunk-7b60whxm.js +0 -2
- package/bundle/chunk-7g59hc61.js +0 -2
- package/bundle/chunk-7p88j56s.js +0 -2
- package/bundle/chunk-7trngc9g.js +0 -2
- package/bundle/chunk-8cebbmtf.js +0 -2
- package/bundle/chunk-8csas2jc.js +0 -2
- package/bundle/chunk-8g4jdqq1.js +0 -2
- package/bundle/chunk-8j1xcdmd.js +0 -2
- package/bundle/chunk-90r2z49k.js +0 -2
- package/bundle/chunk-94mjwy22.js +0 -2
- package/bundle/chunk-aenrd7dk.js +0 -2
- package/bundle/chunk-ahmy80vb.js +0 -2
- package/bundle/chunk-avn12jkt.js +0 -2
- package/bundle/chunk-b7ncyat6.js +0 -2
- package/bundle/chunk-bjv1h2dq.js +0 -2
- package/bundle/chunk-brk6bge4.js +0 -3
- package/bundle/chunk-c2a74stf.js +0 -2
- package/bundle/chunk-ce5e7j62.js +0 -2
- package/bundle/chunk-cw1gwjx9.js +0 -2
- package/bundle/chunk-czw30fjs.js +0 -2
- package/bundle/chunk-ddx2pcr4.js +0 -2
- package/bundle/chunk-dmkgjf1v.js +0 -3
- package/bundle/chunk-dwhsvpag.js +0 -2
- package/bundle/chunk-e01jgnnm.js +0 -2
- package/bundle/chunk-e0hfpdje.js +0 -2
- package/bundle/chunk-e5jk67xh.js +0 -2
- package/bundle/chunk-eg4pq4hv.js +0 -2
- package/bundle/chunk-ew3yz97p.js +0 -2
- package/bundle/chunk-ezgfhy4e.js +0 -2
- package/bundle/chunk-f2yfyhh8.js +0 -2
- package/bundle/chunk-f30em1wx.js +0 -2
- package/bundle/chunk-fge37dke.js +0 -2
- package/bundle/chunk-gbvm6dpv.js +0 -2
- package/bundle/chunk-gefx3n08.js +0 -14
- package/bundle/chunk-h5w91zr4.js +0 -2
- package/bundle/chunk-hmpb3c21.js +0 -2
- package/bundle/chunk-j32rr7rt.js +0 -2
- package/bundle/chunk-j871xzr7.js +0 -2
- package/bundle/chunk-k3hgwszx.js +0 -2
- package/bundle/chunk-kwfe4em6.js +0 -7
- package/bundle/chunk-kx88qekb.js +0 -2
- package/bundle/chunk-n61e0znt.js +0 -2
- package/bundle/chunk-n6v36np0.js +0 -2
- package/bundle/chunk-ndd4cn3z.js +0 -2
- package/bundle/chunk-nfafk3ts.js +0 -5
- package/bundle/chunk-njsmma3a.js +0 -2
- package/bundle/chunk-nr2j8ytn.js +0 -3
- package/bundle/chunk-nwj6mcxz.js +0 -2
- package/bundle/chunk-p5b5ekhh.js +0 -2
- package/bundle/chunk-pf23nw4z.js +0 -2
- package/bundle/chunk-pw3cv89g.js +0 -2
- package/bundle/chunk-q3c8mfbq.js +0 -2
- package/bundle/chunk-qc89yj61.js +0 -2
- package/bundle/chunk-qn8tz704.js +0 -2
- package/bundle/chunk-qq9m8fxv.js +0 -808
- package/bundle/chunk-qxre2gqn.js +0 -2
- package/bundle/chunk-rdk62809.js +0 -2
- package/bundle/chunk-rew6r516.js +0 -2
- package/bundle/chunk-rjhvdfn5.js +0 -2
- package/bundle/chunk-skgr9ypq.js +0 -2
- package/bundle/chunk-sv40pwe2.js +0 -2
- package/bundle/chunk-tfhpjmny.js +0 -2
- package/bundle/chunk-tnete6ye.js +0 -2
- package/bundle/chunk-tpyq7ycb.js +0 -2
- package/bundle/chunk-txkdt4ep.js +0 -2
- package/bundle/chunk-v5h5wxw5.js +0 -2
- package/bundle/chunk-v6141yq1.js +0 -2
- package/bundle/chunk-vfd3azkp.js +0 -3
- package/bundle/chunk-vjs69r6x.js +0 -2
- package/bundle/chunk-vmhar83s.js +0 -2
- package/bundle/chunk-vqvnw12p.js +0 -2
- package/bundle/chunk-w0sng8a9.js +0 -2
- package/bundle/chunk-w0sztk4y.js +0 -2
- package/bundle/chunk-w6bb320d.js +0 -2
- package/bundle/chunk-waa1ggtj.js +0 -2
- package/bundle/chunk-wb05bp10.js +0 -3
- package/bundle/chunk-wf41m019.js +0 -2
- package/bundle/chunk-wqw6yjrg.js +0 -2
- package/bundle/chunk-ws08rxge.js +0 -2
- package/bundle/chunk-wz3dvc3g.js +0 -2
- package/bundle/chunk-x2pmqvdc.js +0 -2
- package/bundle/chunk-x4wfq39v.js +0 -2
- package/bundle/chunk-xs6v0r9m.js +0 -3
- package/bundle/chunk-yb6m08zj.js +0 -2
- package/bundle/chunk-ybcqkgs7.js +0 -2
- package/bundle/chunk-zj1jc1xt.js +0 -2
- package/bundle/chunk-zm0m0504.js +0 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Gq as j,Hq as M,Iq as f,Kq as N,Nq as H,Oq as z,Pq as A,Sq as I,Xq as t}from"./chunk-kec1xw1n.js";import{Yq as U}from"./chunk-x50adh71.js";import{lu as n}from"./chunk-q4mtwv1w.js";import{vz as d}from"./chunk-7a3txs9f.js";function NJ(...F){return F.reduce((J,Q)=>({...J,...Q!=null?Q:{}}),{})}function VJ({tools:F=[],providerToolNames:J,resolveProviderToolName:Q}){var W;let X={},Y={};for(let Z of F)if(Z.type==="provider"){let $=(W=Q==null?void 0:Q(Z))!=null?W:(Z.id in J)?J[Z.id]:void 0;if($==null)continue;X[Z.name]=$,Y[$]=Z.name}return{toProviderToolName:(Z)=>{var $;return($=X[Z])!=null?$:Z},toCustomToolName:(Z)=>{var $;return($=Y[Z])!=null?$:Z}}}function B(F){return Object.fromEntries([...F.headers])}var{btoa:$F,atob:LF}=globalThis;function TJ(F){let J=F.replace(/-/g,"+").replace(/_/g,"/"),Q=LF(J);return Uint8Array.from(Q,(W)=>W.codePointAt(0))}function o(F){let J="";for(let Q=0;Q<F.length;Q++)J+=String.fromCodePoint(F[Q]);return $F(J)}function _J(F){return F instanceof Uint8Array?o(F):F}function jJ(F){if(F.type==="url")return F.url;return`data:${F.mediaType};base64,${typeof F.data==="string"?F.data:o(F.data)}`}function kJ(F,J={}){let{useArrayBrackets:Q=!0}=J,W=new FormData;for(let[X,Y]of Object.entries(F)){if(Y==null)continue;if(Array.isArray(Y)){if(Y.length===1){W.append(X,Y[0]);continue}let Z=Q?`${X}[]`:X;for(let $ of Y)W.append(Z,$);continue}W.append(X,Y)}return W}var a="AI_DownloadError",s=`vercel.ai.error.${a}`,UF=Symbol.for(s),m,u,O=class extends(u=j,m=UF,u){constructor({url:F,statusCode:J,statusText:Q,cause:W,message:X=W==null?`Failed to download ${F}: ${J} ${Q}`:`Failed to download ${F}: ${W}`}){super({name:a,message:X,cause:W});this[m]=!0,this.url=F,this.statusCode=J,this.statusText=Q}static isInstance(F){return j.hasMarker(F,s)}},r=2147483648;async function wF({response:F,url:J,maxBytes:Q=r}){let W=F.headers.get("content-length");if(W!=null){let G=parseInt(W,10);if(!isNaN(G)&&G>Q)throw new O({url:J,message:`Download of ${J} exceeded maximum size of ${Q} bytes (Content-Length: ${G}).`})}let X=F.body;if(X==null)return new Uint8Array(0);let Y=X.getReader(),Z=[],$=0;try{while(!0){let{done:G,value:R}=await Y.read();if(G)break;if($+=R.length,$>Q)throw new O({url:J,message:`Download of ${J} exceeded maximum size of ${Q} bytes.`});Z.push(R)}}finally{try{await Y.cancel()}finally{Y.releaseLock()}}let w=new Uint8Array($),L=0;for(let G of Z)w.set(G,L),L+=G.length;return w}function i(F){let J;try{J=new URL(F)}catch(W){throw new O({url:F,message:`Invalid URL: ${F}`})}if(J.protocol!=="http:"&&J.protocol!=="https:")throw new O({url:F,message:`URL scheme must be http or https, got ${J.protocol}`});let Q=J.hostname;if(!Q)throw new O({url:F,message:"URL must have a hostname"});if(Q==="localhost"||Q.endsWith(".local")||Q.endsWith(".localhost"))throw new O({url:F,message:`URL with hostname ${Q} is not allowed`});if(Q.startsWith("[")&&Q.endsWith("]")){let W=Q.slice(1,-1);if(EF(W))throw new O({url:F,message:`URL with IPv6 address ${Q} is not allowed`});return}if(e(Q)){if(k(Q))throw new O({url:F,message:`URL with IP address ${Q} is not allowed`});return}}function e(F){let J=F.split(".");if(J.length!==4)return!1;return J.every((Q)=>{let W=Number(Q);return Number.isInteger(W)&&W>=0&&W<=255&&String(W)===Q})}function k(F){let J=F.split(".").map(Number),[Q,W]=J;if(Q===0)return!0;if(Q===10)return!0;if(Q===127)return!0;if(Q===169&&W===254)return!0;if(Q===172&&W>=16&&W<=31)return!0;if(Q===192&&W===168)return!0;return!1}function EF(F){let J=F.toLowerCase();if(J==="::1")return!0;if(J==="::")return!0;if(J.startsWith("::ffff:")){let Q=J.slice(7);if(e(Q))return k(Q);let W=Q.split(":");if(W.length===2){let X=parseInt(W[0],16),Y=parseInt(W[1],16);if(!isNaN(X)&&!isNaN(Y)){let Z=X>>8&255,$=X&255,w=Y>>8&255,L=Y&255;return k(`${Z}.${$}.${w}.${L}`)}}}if(J.startsWith("fc")||J.startsWith("fd"))return!0;if(J.startsWith("fe80"))return!0;return!1}async function SJ(F,J){var Q,W;i(F);try{let X=await fetch(F,{signal:J==null?void 0:J.abortSignal});if(X.redirected)i(X.url);if(!X.ok)throw new O({url:F,statusCode:X.status,statusText:X.statusText});let Y=await wF({response:X,url:F,maxBytes:(Q=J==null?void 0:J.maxBytes)!=null?Q:r}),Z=(W=X.headers.get("content-type"))!=null?W:void 0;return new Blob([Y],Z?{type:Z}:void 0)}catch(X){if(O.isInstance(X))throw X;throw new O({url:F,cause:X})}}var GF=({prefix:F,size:J=16,alphabet:Q="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:W="-"}={})=>{let X=()=>{let Y=Q.length,Z=Array(J);for(let $=0;$<J;$++)Z[$]=Q[Math.random()*Y|0];return Z.join("")};if(F==null)return X;if(Q.includes(W))throw new N({argument:"separator",message:`The separator "${W}" must not be part of the alphabet "${Q}".`});return()=>`${F}${W}${X()}`},xJ=GF();function b(F){return(F instanceof Error||F instanceof DOMException)&&(F.name==="AbortError"||F.name==="ResponseAborted"||F.name==="TimeoutError")}var CF=["fetch failed","failed to fetch"],MF=["ConnectionRefused","ConnectionClosed","FailedToOpenSocket","ECONNRESET","ECONNREFUSED","ETIMEDOUT","EPIPE"];function KF(F){if(!(F instanceof Error))return!1;let J=F.code;if(typeof J==="string"&&MF.includes(J))return!0;return!1}function qF({error:F,url:J,requestBodyValues:Q}){if(b(F))return F;if(F instanceof TypeError&&CF.includes(F.message.toLowerCase())){let W=F.cause;if(W!=null)return new M({message:`Cannot connect to API: ${W.message}`,cause:W,url:J,requestBodyValues:Q,isRetryable:!0})}if(KF(F))return new M({message:`Cannot connect to API: ${F.message}`,cause:F,url:J,requestBodyValues:Q,isRetryable:!0});return F}function DF(F=globalThis){var J,Q,W;if(F.window)return"runtime/browser";if((J=F.navigator)==null?void 0:J.userAgent)return`runtime/${F.navigator.userAgent.toLowerCase()}`;if((W=(Q=F.process)==null?void 0:Q.versions)==null?void 0:W.node)return`runtime/node.js/${F.process.version.substring(0)}`;if(F.EdgeRuntime)return"runtime/vercel-edge";return"runtime/unknown"}function OF(F){if(F==null)return{};let J={};if(F instanceof Headers)F.forEach((Q,W)=>{J[W.toLowerCase()]=Q});else{if(!Array.isArray(F))F=Object.entries(F);for(let[Q,W]of F)if(W!=null)J[Q.toLowerCase()]=W}return J}function IF(F,...J){let Q=new Headers(OF(F)),W=Q.get("user-agent")||"";return Q.set("user-agent",[W,...J].filter(Boolean).join(" ")),Object.fromEntries(Q.entries())}var PF="4.0.21";var zF="JSON schema:",AF="You MUST answer with a JSON object that matches the JSON schema above.",HF="You MUST answer with JSON.";function BF({prompt:F,schema:J,schemaPrefix:Q=J!=null?zF:void 0,schemaSuffix:W=J!=null?AF:HF}){return[F!=null&&F.length>0?F:void 0,F!=null&&F.length>0?"":void 0,Q,J!=null?JSON.stringify(J):void 0,W].filter((X)=>X!=null).join(`
|
|
3
3
|
`)}function yJ({messages:F,schema:J,schemaPrefix:Q,schemaSuffix:W}){var X,Y;let Z=((X=F[0])==null?void 0:X.role)==="system"?{...F[0]}:{role:"system",content:""};return Z.content=BF({prompt:Z.content,schema:J,schemaPrefix:Q,schemaSuffix:W}),[Z,...((Y=F[0])==null?void 0:Y.role)==="system"?F.slice(1):F]}function hJ(F){return F!=null}function uJ({apiKey:F,environmentVariableName:J,apiKeyParameterName:Q="apiKey",description:W}){if(typeof F==="string")return F;if(F!=null)throw new z({message:`${W} API key must be a string.`});if(typeof process>"u")throw new z({message:`${W} API key is missing. Pass it using the '${Q}' parameter. Environment variables is not supported in this environment.`});if(F=process.env[J],F==null)throw new z({message:`${W} API key is missing. Pass it using the '${Q}' parameter or the ${J} environment variable.`});if(typeof F!=="string")throw new z({message:`${W} API key must be a string. The value of the ${J} environment variable is not a string.`});return F}function pJ({settingValue:F,environmentVariableName:J,settingName:Q,description:W}){if(typeof F==="string")return F;if(F!=null)throw new A({message:`${W} setting must be a string.`});if(typeof process>"u")throw new A({message:`${W} setting is missing. Pass it using the '${Q}' parameter. Environment variables is not supported in this environment.`});if(F=process.env[J],F==null)throw new A({message:`${W} setting is missing. Pass it using the '${Q}' parameter or the ${J} environment variable.`});if(typeof F!=="string")throw new A({message:`${W} setting must be a string. The value of the ${J} environment variable is not a string.`});return F}function lJ(F){var J;let[Q,W=""]=F.toLowerCase().split("/");return(J={mpeg:"mp3","x-wav":"wav",opus:"ogg",mp4:"m4a","x-m4a":"m4a"}[W])!=null?J:W}var RF=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,NF=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function p(F){let J=JSON.parse(F);if(J===null||typeof J!=="object")return J;if(RF.test(F)===!1&&NF.test(F)===!1)return J;return VF(J)}function VF(F){let J=[F];while(J.length){let Q=J;J=[];for(let W of Q){if(Object.prototype.hasOwnProperty.call(W,"__proto__"))throw SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(W,"constructor")&&W.constructor!==null&&typeof W.constructor==="object"&&Object.prototype.hasOwnProperty.call(W.constructor,"prototype"))throw SyntaxError("Object contains forbidden prototype property");for(let X in W){let Y=W[X];if(Y&&typeof Y==="object")J.push(Y)}}}return F}function x(F){let{stackTraceLimit:J}=Error;try{Error.stackTraceLimit=0}catch(Q){return p(F)}try{return p(F)}finally{Error.stackTraceLimit=J}}function v(F){if(F.type==="object"||Array.isArray(F.type)&&F.type.includes("object")){F.additionalProperties=!1;let{properties:Q}=F;if(Q!=null)for(let W of Object.keys(Q))Q[W]=P(Q[W])}if(F.items!=null)F.items=Array.isArray(F.items)?F.items.map(P):P(F.items);if(F.anyOf!=null)F.anyOf=F.anyOf.map(P);if(F.allOf!=null)F.allOf=F.allOf.map(P);if(F.oneOf!=null)F.oneOf=F.oneOf.map(P);let{definitions:J}=F;if(J!=null)for(let Q of Object.keys(J))J[Q]=P(J[Q]);return F}function P(F){if(typeof F==="boolean")return F;return v(F)}var TF=Symbol("Let zodToJsonSchema decide on which parser to use"),l={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},_F=(F)=>typeof F==="string"?{...l,name:F}:{...l,...F};function K(){return{}}function jF(F,J){var Q,W,X;let Y={type:"array"};if(((Q=F.type)==null?void 0:Q._def)&&((X=(W=F.type)==null?void 0:W._def)==null?void 0:X.typeName)!==U.ZodAny)Y.items=E(F.type._def,{...J,currentPath:[...J.currentPath,"items"]});if(F.minLength)Y.minItems=F.minLength.value;if(F.maxLength)Y.maxItems=F.maxLength.value;if(F.exactLength)Y.minItems=F.exactLength.value,Y.maxItems=F.exactLength.value;return Y}function kF(F){let J={type:"integer",format:"int64"};if(!F.checks)return J;for(let Q of F.checks)switch(Q.kind){case"min":if(Q.inclusive)J.minimum=Q.value;else J.exclusiveMinimum=Q.value;break;case"max":if(Q.inclusive)J.maximum=Q.value;else J.exclusiveMaximum=Q.value;break;case"multipleOf":J.multipleOf=Q.value;break}return J}function bF(){return{type:"boolean"}}function FF(F,J){return E(F.type._def,J)}var SF=(F,J)=>{return E(F.innerType._def,J)};function JF(F,J,Q){let W=Q!=null?Q:J.dateStrategy;if(Array.isArray(W))return{anyOf:W.map((X,Y)=>JF(F,J,X))};switch(W){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return gF(F)}}var gF=(F)=>{let J={type:"integer",format:"unix-time"};for(let Q of F.checks)switch(Q.kind){case"min":J.minimum=Q.value;break;case"max":J.maximum=Q.value;break}return J};function xF(F,J){return{...E(F.innerType._def,J),default:F.defaultValue()}}function vF(F,J){return J.effectStrategy==="input"?E(F.schema._def,J):K()}function yF(F){return{type:"string",enum:Array.from(F.values)}}var hF=(F)=>{if("type"in F&&F.type==="string")return!1;return"allOf"in F};function mF(F,J){let Q=[E(F.left._def,{...J,currentPath:[...J.currentPath,"allOf","0"]}),E(F.right._def,{...J,currentPath:[...J.currentPath,"allOf","1"]})].filter((X)=>!!X),W=[];return Q.forEach((X)=>{if(hF(X))W.push(...X.allOf);else{let Y=X;if("additionalProperties"in X&&X.additionalProperties===!1){let{additionalProperties:Z,...$}=X;Y=$}W.push(Y)}}),W.length?{allOf:W}:void 0}function uF(F){let J=typeof F.value;if(J!=="bigint"&&J!=="number"&&J!=="boolean"&&J!=="string")return{type:Array.isArray(F.value)?"array":"object"};return{type:J==="bigint"?"integer":J,const:F.value}}var T=void 0,q={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(T===void 0)T=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return T},uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function QF(F,J){let Q={type:"string"};if(F.checks)for(let W of F.checks)switch(W.kind){case"min":Q.minLength=typeof Q.minLength==="number"?Math.max(Q.minLength,W.value):W.value;break;case"max":Q.maxLength=typeof Q.maxLength==="number"?Math.min(Q.maxLength,W.value):W.value;break;case"email":switch(J.emailStrategy){case"format:email":D(Q,"email",W.message,J);break;case"format:idn-email":D(Q,"idn-email",W.message,J);break;case"pattern:zod":C(Q,q.email,W.message,J);break}break;case"url":D(Q,"uri",W.message,J);break;case"uuid":D(Q,"uuid",W.message,J);break;case"regex":C(Q,W.regex,W.message,J);break;case"cuid":C(Q,q.cuid,W.message,J);break;case"cuid2":C(Q,q.cuid2,W.message,J);break;case"startsWith":C(Q,RegExp(`^${_(W.value,J)}`),W.message,J);break;case"endsWith":C(Q,RegExp(`${_(W.value,J)}$`),W.message,J);break;case"datetime":D(Q,"date-time",W.message,J);break;case"date":D(Q,"date",W.message,J);break;case"time":D(Q,"time",W.message,J);break;case"duration":D(Q,"duration",W.message,J);break;case"length":Q.minLength=typeof Q.minLength==="number"?Math.max(Q.minLength,W.value):W.value,Q.maxLength=typeof Q.maxLength==="number"?Math.min(Q.maxLength,W.value):W.value;break;case"includes":{C(Q,RegExp(_(W.value,J)),W.message,J);break}case"ip":{if(W.version!=="v6")D(Q,"ipv4",W.message,J);if(W.version!=="v4")D(Q,"ipv6",W.message,J);break}case"base64url":C(Q,q.base64url,W.message,J);break;case"jwt":C(Q,q.jwt,W.message,J);break;case"cidr":{if(W.version!=="v6")C(Q,q.ipv4Cidr,W.message,J);if(W.version!=="v4")C(Q,q.ipv6Cidr,W.message,J);break}case"emoji":C(Q,q.emoji(),W.message,J);break;case"ulid":{C(Q,q.ulid,W.message,J);break}case"base64":{switch(J.base64Strategy){case"format:binary":{D(Q,"binary",W.message,J);break}case"contentEncoding:base64":{Q.contentEncoding="base64";break}case"pattern:zod":{C(Q,q.base64,W.message,J);break}}break}case"nanoid":C(Q,q.nanoid,W.message,J);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return Q}function _(F,J){return J.patternStrategy==="escape"?pF(F):F}var iF=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function pF(F){let J="";for(let Q=0;Q<F.length;Q++){if(!iF.has(F[Q]))J+="\\";J+=F[Q]}return J}function D(F,J,Q,W){var X;if(F.format||((X=F.anyOf)==null?void 0:X.some((Y)=>Y.format))){if(!F.anyOf)F.anyOf=[];if(F.format)F.anyOf.push({format:F.format}),delete F.format;F.anyOf.push({format:J,...Q&&W.errorMessages&&{errorMessage:{format:Q}}})}else F.format=J}function C(F,J,Q,W){var X;if(F.pattern||((X=F.allOf)==null?void 0:X.some((Y)=>Y.pattern))){if(!F.allOf)F.allOf=[];if(F.pattern)F.allOf.push({pattern:F.pattern}),delete F.pattern;F.allOf.push({pattern:c(J,W),...Q&&W.errorMessages&&{errorMessage:{pattern:Q}}})}else F.pattern=c(J,W)}function c(F,J){var Q;if(!J.applyRegexFlags||!F.flags)return F.source;let W={i:F.flags.includes("i"),m:F.flags.includes("m"),s:F.flags.includes("s")},X=W.i?F.source.toLowerCase():F.source,Y="",Z=!1,$=!1,w=!1;for(let L=0;L<X.length;L++){if(Z){Y+=X[L],Z=!1;continue}if(W.i){if($){if(X[L].match(/[a-z]/)){if(w)Y+=X[L],Y+=`${X[L-2]}-${X[L]}`.toUpperCase(),w=!1;else if(X[L+1]==="-"&&((Q=X[L+2])==null?void 0:Q.match(/[a-z]/)))Y+=X[L],w=!0;else Y+=`${X[L]}${X[L].toUpperCase()}`;continue}}else if(X[L].match(/[a-z]/)){Y+=`[${X[L]}${X[L].toUpperCase()}]`;continue}}if(W.m){if(X[L]==="^"){Y+=`(^|(?<=[\r
|
|
4
4
|
]))`;continue}else if(X[L]==="$"){Y+=`($|(?=[\r
|
|
5
5
|
]))`;continue}}if(W.s&&X[L]==="."){Y+=$?`${X[L]}\r
|
|
6
6
|
`:`[${X[L]}\r
|
|
7
7
|
]`;continue}if(Y+=X[L],X[L]==="\\")Z=!0;else if($&&X[L]==="]")$=!1;else if(!$&&X[L]==="[")$=!0}try{new RegExp(Y)}catch(L){return console.warn(`Could not convert regex pattern at ${J.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),F.source}return Y}function WF(F,J){var Q,W,X,Y,Z,$;let w={type:"object",additionalProperties:(Q=E(F.valueType._def,{...J,currentPath:[...J.currentPath,"additionalProperties"]}))!=null?Q:J.allowedAdditionalProperties};if(((W=F.keyType)==null?void 0:W._def.typeName)===U.ZodString&&((X=F.keyType._def.checks)==null?void 0:X.length)){let{type:L,...G}=QF(F.keyType._def,J);return{...w,propertyNames:G}}else if(((Y=F.keyType)==null?void 0:Y._def.typeName)===U.ZodEnum)return{...w,propertyNames:{enum:F.keyType._def.values}};else if(((Z=F.keyType)==null?void 0:Z._def.typeName)===U.ZodBranded&&F.keyType._def.type._def.typeName===U.ZodString&&(($=F.keyType._def.type._def.checks)==null?void 0:$.length)){let{type:L,...G}=FF(F.keyType._def,J);return{...w,propertyNames:G}}return w}function lF(F,J){if(J.mapStrategy==="record")return WF(F,J);let Q=E(F.keyType._def,{...J,currentPath:[...J.currentPath,"items","items","0"]})||K(),W=E(F.valueType._def,{...J,currentPath:[...J.currentPath,"items","items","1"]})||K();return{type:"array",maxItems:125,items:{type:"array",items:[Q,W],minItems:2,maxItems:2}}}function cF(F){let J=F.values,W=Object.keys(F.values).filter((Y)=>{return typeof J[J[Y]]!=="number"}).map((Y)=>J[Y]),X=Array.from(new Set(W.map((Y)=>typeof Y)));return{type:X.length===1?X[0]==="string"?"string":"number":["string","number"],enum:W}}function dF(){return{not:K()}}function nF(){return{type:"null"}}var S={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function fF(F,J){let Q=F.options instanceof Map?Array.from(F.options.values()):F.options;if(Q.every((W)=>(W._def.typeName in S)&&(!W._def.checks||!W._def.checks.length))){let W=Q.reduce((X,Y)=>{let Z=S[Y._def.typeName];return Z&&!X.includes(Z)?[...X,Z]:X},[]);return{type:W.length>1?W:W[0]}}else if(Q.every((W)=>W._def.typeName==="ZodLiteral"&&!W.description)){let W=Q.reduce((X,Y)=>{let Z=typeof Y._def.value;switch(Z){case"string":case"number":case"boolean":return[...X,Z];case"bigint":return[...X,"integer"];case"object":if(Y._def.value===null)return[...X,"null"];case"symbol":case"undefined":case"function":default:return X}},[]);if(W.length===Q.length){let X=W.filter((Y,Z,$)=>$.indexOf(Y)===Z);return{type:X.length>1?X:X[0],enum:Q.reduce((Y,Z)=>{return Y.includes(Z._def.value)?Y:[...Y,Z._def.value]},[])}}}else if(Q.every((W)=>W._def.typeName==="ZodEnum"))return{type:"string",enum:Q.reduce((W,X)=>[...W,...X._def.values.filter((Y)=>!W.includes(Y))],[])};return tF(F,J)}var tF=(F,J)=>{let Q=(F.options instanceof Map?Array.from(F.options.values()):F.options).map((W,X)=>E(W._def,{...J,currentPath:[...J.currentPath,"anyOf",`${X}`]})).filter((W)=>!!W&&(!J.strictUnions||typeof W==="object"&&Object.keys(W).length>0));return Q.length?{anyOf:Q}:void 0};function oF(F,J){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(F.innerType._def.typeName)&&(!F.innerType._def.checks||!F.innerType._def.checks.length))return{type:[S[F.innerType._def.typeName],"null"]};let Q=E(F.innerType._def,{...J,currentPath:[...J.currentPath,"anyOf","0"]});return Q&&{anyOf:[Q,{type:"null"}]}}function aF(F){let J={type:"number"};if(!F.checks)return J;for(let Q of F.checks)switch(Q.kind){case"int":J.type="integer";break;case"min":if(Q.inclusive)J.minimum=Q.value;else J.exclusiveMinimum=Q.value;break;case"max":if(Q.inclusive)J.maximum=Q.value;else J.exclusiveMaximum=Q.value;break;case"multipleOf":J.multipleOf=Q.value;break}return J}function sF(F,J){let Q={type:"object",properties:{}},W=[],X=F.shape();for(let Z in X){let $=X[Z];if($===void 0||$._def===void 0)continue;let w=eF($),L=E($._def,{...J,currentPath:[...J.currentPath,"properties",Z],propertyPath:[...J.currentPath,"properties",Z]});if(L===void 0)continue;if(Q.properties[Z]=L,!w)W.push(Z)}if(W.length)Q.required=W;let Y=rF(F,J);if(Y!==void 0)Q.additionalProperties=Y;return Q}function rF(F,J){if(F.catchall._def.typeName!=="ZodNever")return E(F.catchall._def,{...J,currentPath:[...J.currentPath,"additionalProperties"]});switch(F.unknownKeys){case"passthrough":return J.allowedAdditionalProperties;case"strict":return J.rejectedAdditionalProperties;case"strip":return J.removeAdditionalStrategy==="strict"?J.allowedAdditionalProperties:J.rejectedAdditionalProperties}}function eF(F){try{return F.isOptional()}catch(J){return!0}}var FJ=(F,J)=>{var Q;if(J.currentPath.toString()===((Q=J.propertyPath)==null?void 0:Q.toString()))return E(F.innerType._def,J);let W=E(F.innerType._def,{...J,currentPath:[...J.currentPath,"anyOf","1"]});return W?{anyOf:[{not:K()},W]}:K()},JJ=(F,J)=>{if(J.pipeStrategy==="input")return E(F.in._def,J);else if(J.pipeStrategy==="output")return E(F.out._def,J);let Q=E(F.in._def,{...J,currentPath:[...J.currentPath,"allOf","0"]}),W=E(F.out._def,{...J,currentPath:[...J.currentPath,"allOf",Q?"1":"0"]});return{allOf:[Q,W].filter((X)=>X!==void 0)}};function QJ(F,J){return E(F.type._def,J)}function WJ(F,J){let W={type:"array",uniqueItems:!0,items:E(F.valueType._def,{...J,currentPath:[...J.currentPath,"items"]})};if(F.minSize)W.minItems=F.minSize.value;if(F.maxSize)W.maxItems=F.maxSize.value;return W}function XJ(F,J){if(F.rest)return{type:"array",minItems:F.items.length,items:F.items.map((Q,W)=>E(Q._def,{...J,currentPath:[...J.currentPath,"items",`${W}`]})).reduce((Q,W)=>W===void 0?Q:[...Q,W],[]),additionalItems:E(F.rest._def,{...J,currentPath:[...J.currentPath,"additionalItems"]})};else return{type:"array",minItems:F.items.length,maxItems:F.items.length,items:F.items.map((Q,W)=>E(Q._def,{...J,currentPath:[...J.currentPath,"items",`${W}`]})).reduce((Q,W)=>W===void 0?Q:[...Q,W],[])}}function YJ(){return{not:K()}}function ZJ(){return K()}var $J=(F,J)=>{return E(F.innerType._def,J)},LJ=(F,J,Q)=>{switch(J){case U.ZodString:return QF(F,Q);case U.ZodNumber:return aF(F);case U.ZodObject:return sF(F,Q);case U.ZodBigInt:return kF(F);case U.ZodBoolean:return bF();case U.ZodDate:return JF(F,Q);case U.ZodUndefined:return YJ();case U.ZodNull:return nF();case U.ZodArray:return jF(F,Q);case U.ZodUnion:case U.ZodDiscriminatedUnion:return fF(F,Q);case U.ZodIntersection:return mF(F,Q);case U.ZodTuple:return XJ(F,Q);case U.ZodRecord:return WF(F,Q);case U.ZodLiteral:return uF(F);case U.ZodEnum:return yF(F);case U.ZodNativeEnum:return cF(F);case U.ZodNullable:return oF(F,Q);case U.ZodOptional:return FJ(F,Q);case U.ZodMap:return lF(F,Q);case U.ZodSet:return WJ(F,Q);case U.ZodLazy:return()=>F.getter()._def;case U.ZodPromise:return QJ(F,Q);case U.ZodNaN:case U.ZodNever:return dF();case U.ZodEffects:return vF(F,Q);case U.ZodAny:return K();case U.ZodUnknown:return ZJ();case U.ZodDefault:return xF(F,Q);case U.ZodBranded:return FF(F,Q);case U.ZodReadonly:return $J(F,Q);case U.ZodCatch:return SF(F,Q);case U.ZodPipeline:return JJ(F,Q);case U.ZodFunction:case U.ZodVoid:case U.ZodSymbol:return;default:return((W)=>{return})(J)}},UJ=(F,J)=>{let Q=0;for(;Q<F.length&&Q<J.length;Q++)if(F[Q]!==J[Q])break;return[(F.length-Q).toString(),...J.slice(Q)].join("/")};function E(F,J,Q=!1){var W;let X=J.seen.get(F);if(J.override){let w=(W=J.override)==null?void 0:W.call(J,F,J,X,Q);if(w!==TF)return w}if(X&&!Q){let w=wJ(X,J);if(w!==void 0)return w}let Y={def:F,path:J.currentPath,jsonSchema:void 0};J.seen.set(F,Y);let Z=LJ(F,F.typeName,J),$=typeof Z==="function"?E(Z(),J):Z;if($)EJ(F,J,$);if(J.postProcess){let w=J.postProcess($,F,J);return Y.jsonSchema=$,w}return Y.jsonSchema=$,$}var wJ=(F,J)=>{switch(J.$refStrategy){case"root":return{$ref:F.path.join("/")};case"relative":return{$ref:UJ(J.currentPath,F.path)};case"none":case"seen":{if(F.path.length<J.currentPath.length&&F.path.every((Q,W)=>J.currentPath[W]===Q))return console.warn(`Recursive reference detected at ${J.currentPath.join("/")}! Defaulting to any`),K();return J.$refStrategy==="seen"?K():void 0}}},EJ=(F,J,Q)=>{if(F.description)Q.description=F.description;return Q},GJ=(F)=>{let J=_F(F),Q=J.name!==void 0?[...J.basePath,J.definitionPath,J.name]:J.basePath;return{...J,currentPath:Q,propertyPath:void 0,seen:new Map(Object.entries(J.definitions).map(([W,X])=>[X._def,{def:X._def,path:[...J.basePath,J.definitionPath,W],jsonSchema:void 0}]))}},CJ=(F,J)=>{var Q;let W=GJ(J),X=typeof J==="object"&&J.definitions?Object.entries(J.definitions).reduce((L,[G,R])=>{var h;return{...L,[G]:(h=E(R._def,{...W,currentPath:[...W.basePath,W.definitionPath,G]},!0))!=null?h:K()}},{}):void 0,Y=typeof J==="string"?J:(J==null?void 0:J.nameStrategy)==="title"?void 0:J==null?void 0:J.name,Z=(Q=E(F._def,Y===void 0?W:{...W,currentPath:[...W.basePath,W.definitionPath,Y]},!1))!=null?Q:K(),$=typeof J==="object"&&J.name!==void 0&&J.nameStrategy==="title"?J.name:void 0;if($!==void 0)Z.title=$;let w=Y===void 0?X?{...Z,[W.definitionPath]:X}:Z:{$ref:[...W.$refStrategy==="relative"?[]:W.basePath,W.definitionPath,Y].join("/"),[W.definitionPath]:{...X,[Y]:Z}};return w.$schema="http://json-schema.org/draft-07/schema#",w},g=Symbol.for("vercel.ai.schema");function aJ(F){let J;return()=>{if(J==null)J=F();return J}}function V(F,{validate:J}={}){return{[g]:!0,_type:void 0,get jsonSchema(){if(typeof F==="function")F=F();return F},validate:J}}function MJ(F){return typeof F==="object"&&F!==null&&g in F&&F[g]===!0&&"jsonSchema"in F&&"validate"in F}function KJ(F){return F==null?V({properties:{},additionalProperties:!1}):MJ(F)?F:("~standard"in F)?F["~standard"].vendor==="zod"?PJ(F):qJ(F):F()}function qJ(F){return V(()=>v(F["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async(J)=>{let Q=await F["~standard"].validate(J);return"value"in Q?{success:!0,value:Q.value}:{success:!1,error:new I({value:J,cause:Q.issues})}}})}function DJ(F,J){var Q;let W=(Q=J==null?void 0:J.useReferences)!=null?Q:!1;return V(()=>CJ(F,{$refStrategy:W?"root":"none"}),{validate:async(X)=>{let Y=await F.safeParseAsync(X);return Y.success?{success:!0,value:Y.data}:{success:!1,error:Y.error}}})}function OJ(F,J){var Q;let W=(Q=J==null?void 0:J.useReferences)!=null?Q:!1;return V(()=>v(d(F,{target:"draft-7",io:"input",reused:W?"ref":"inline"})),{validate:async(X)=>{let Y=await n(F,X);return Y.success?{success:!0,value:Y.data}:{success:!1,error:Y.error}}})}function IJ(F){return"_zod"in F}function PJ(F,J){if(IJ(F))return OJ(F,J);else return DJ(F,J)}async function zJ({value:F,schema:J,context:Q}){let W=await y({value:F,schema:J,context:Q});if(!W.success)throw I.wrap({value:F,cause:W.error,context:Q});return W.value}async function y({value:F,schema:J,context:Q}){let W=KJ(J);try{if(W.validate==null)return{success:!0,value:F,rawValue:F};let X=await W.validate(F);if(X.success)return{success:!0,value:X.value,rawValue:F};return{success:!1,error:I.wrap({value:F,cause:X.error,context:Q}),rawValue:F}}catch(X){return{success:!1,error:I.wrap({value:F,cause:X,context:Q}),rawValue:F}}}async function AJ({text:F,schema:J}){try{let Q=x(F);if(J==null)return Q;return zJ({value:Q,schema:J})}catch(Q){if(H.isInstance(Q)||I.isInstance(Q))throw Q;throw new H({text:F,cause:Q})}}async function XF({text:F,schema:J}){try{let Q=x(F);if(J==null)return{success:!0,value:Q,rawValue:Q};return await y({value:Q,schema:J})}catch(Q){return{success:!1,error:H.isInstance(Q)?Q:new H({text:F,cause:Q}),rawValue:void 0}}}function sJ(F){try{return x(F),!0}catch(J){return!1}}function HJ({stream:F,schema:J}){return F.pipeThrough(new TextDecoderStream).pipeThrough(new t).pipeThrough(new TransformStream({async transform({data:Q},W){if(Q==="[DONE]")return;W.enqueue(await XF({text:Q,schema:J}))}}))}async function FQ({provider:F,providerOptions:J,schema:Q}){if((J==null?void 0:J[F])==null)return;let W=await y({value:J[F],schema:Q});if(!W.success)throw new N({argument:"providerOptions",message:`invalid ${F} provider options`,cause:W.error});return W.value}var BJ=()=>globalThis.fetch,QQ=async({url:F,headers:J,body:Q,failedResponseHandler:W,successfulResponseHandler:X,abortSignal:Y,fetch:Z})=>YF({url:F,headers:{"Content-Type":"application/json",...J},body:{content:JSON.stringify(Q),values:Q},failedResponseHandler:W,successfulResponseHandler:X,abortSignal:Y,fetch:Z}),WQ=async({url:F,headers:J,formData:Q,failedResponseHandler:W,successfulResponseHandler:X,abortSignal:Y,fetch:Z})=>YF({url:F,headers:J,body:{content:Q,values:Object.fromEntries(Q.entries())},failedResponseHandler:W,successfulResponseHandler:X,abortSignal:Y,fetch:Z}),YF=async({url:F,headers:J={},body:Q,successfulResponseHandler:W,failedResponseHandler:X,abortSignal:Y,fetch:Z=BJ()})=>{try{let $=await Z(F,{method:"POST",headers:IF(J,`ai-sdk/provider-utils/${PF}`,DF()),body:Q.content,signal:Y}),w=B($);if(!$.ok){let L;try{L=await X({response:$,url:F,requestBodyValues:Q.values})}catch(G){if(b(G)||M.isInstance(G))throw G;throw new M({message:"Failed to process error response",cause:G,statusCode:$.status,url:F,responseHeaders:w,requestBodyValues:Q.values})}throw L.value}try{return await W({response:$,url:F,requestBodyValues:Q.values})}catch(L){if(L instanceof Error){if(b(L)||M.isInstance(L))throw L}throw new M({message:"Failed to process successful response",cause:L,statusCode:$.status,url:F,responseHeaders:w,requestBodyValues:Q.values})}}catch($){throw qF({error:$,url:F,requestBodyValues:Q.values})}};function ZF(F){return F}function XQ({id:F,inputSchema:J}){return({execute:Q,outputSchema:W,needsApproval:X,toModelOutput:Y,onInputStart:Z,onInputDelta:$,onInputAvailable:w,...L})=>ZF({type:"provider",id:F,args:L,inputSchema:J,outputSchema:W,execute:Q,needsApproval:X,toModelOutput:Y,onInputStart:Z,onInputDelta:$,onInputAvailable:w})}function YQ({id:F,inputSchema:J,outputSchema:Q,supportsDeferredResults:W}){return({execute:X,needsApproval:Y,toModelOutput:Z,onInputStart:$,onInputDelta:w,onInputAvailable:L,...G})=>ZF({type:"provider",id:F,args:G,inputSchema:J,outputSchema:Q,execute:X,needsApproval:Y,toModelOutput:Z,onInputStart:$,onInputDelta:w,onInputAvailable:L,supportsDeferredResults:W})}var $Q=({errorSchema:F,errorToMessage:J,isRetryable:Q})=>async({response:W,url:X,requestBodyValues:Y})=>{let Z=await W.text(),$=B(W);if(Z.trim()==="")return{responseHeaders:$,value:new M({message:W.statusText,url:X,requestBodyValues:Y,statusCode:W.status,responseHeaders:$,responseBody:Z,isRetryable:Q==null?void 0:Q(W)})};try{let w=await AJ({text:Z,schema:F});return{responseHeaders:$,value:new M({message:J(w),url:X,requestBodyValues:Y,statusCode:W.status,responseHeaders:$,responseBody:Z,data:w,isRetryable:Q==null?void 0:Q(W,w)})}}catch(w){return{responseHeaders:$,value:new M({message:W.statusText,url:X,requestBodyValues:Y,statusCode:W.status,responseHeaders:$,responseBody:Z,isRetryable:Q==null?void 0:Q(W)})}}},LQ=(F)=>async({response:J})=>{let Q=B(J);if(J.body==null)throw new f({});return{responseHeaders:Q,value:HJ({stream:J.body,schema:F})}},UQ=(F)=>async({response:J,url:Q,requestBodyValues:W})=>{let X=await J.text(),Y=await XF({text:X,schema:F}),Z=B(J);if(!Y.success)throw new M({message:"Invalid JSON response",cause:Y.error,statusCode:J.status,responseHeaders:Z,responseBody:X,url:Q,requestBodyValues:W});return{responseHeaders:Z,value:Y.value,rawValue:Y.rawValue}},wQ=()=>async({response:F,url:J,requestBodyValues:Q})=>{let W=B(F);if(!F.body)throw new M({message:"Response body is empty",url:J,requestBodyValues:Q,statusCode:F.status,responseHeaders:W,responseBody:void 0});try{let X=await F.arrayBuffer();return{responseHeaders:W,value:new Uint8Array(X)}}catch(X){throw new M({message:"Failed to read response as array buffer",url:J,requestBodyValues:Q,statusCode:F.status,responseHeaders:W,responseBody:void 0,cause:X})}};function EQ(F){return F==null?void 0:F.replace(/\/$/,"")}
|
|
8
|
-
export{NJ as
|
|
8
|
+
export{NJ as Te,VJ as Ue,TJ as Ve,o as We,_J as Xe,jJ as Ye,kJ as Ze,SJ as _e,xJ as $e,IF as af,yJ as bf,hJ as cf,uJ as df,pJ as ef,lJ as ff,aJ as gf,PJ as hf,zJ as if,AJ as jf,sJ as kf,FQ as lf,QQ as mf,WQ as nf,XQ as of,YQ as pf,$Q as qf,LQ as rf,UQ as sf,wQ as tf,EQ as uf};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{n as
|
|
2
|
+
import{yf as u}from"./chunk-jbcqhw3x.js";import{rP as Q,uP as Kq}from"./chunk-djfrkbd5.js";var D=Q((iq,j)=>{var{defineProperty:X,getOwnPropertyDescriptor:r,getOwnPropertyNames:o}=Object,a=Object.prototype.hasOwnProperty,t=(q,z)=>X(q,"name",{value:z,configurable:!0}),qq=(q,z)=>{for(var G in z)X(q,G,{get:z[G],enumerable:!0})},zq=(q,z,G,K)=>{if(z&&typeof z==="object"||typeof z==="function"){for(let I of o(z))if(!a.call(q,I)&&I!==G)X(q,I,{get:()=>z[I],enumerable:!(K=r(z,I))||K.enumerable})}return q},Gq=(q)=>zq(X({},"__esModule",{value:!0}),q),J={};qq(J,{isArrayBuffer:()=>Iq});j.exports=Gq(J);var Iq=t((q)=>typeof ArrayBuffer==="function"&&q instanceof ArrayBuffer||Object.prototype.toString.call(q)==="[object ArrayBuffer]","isArrayBuffer")});var O=Q((dq,R)=>{var{defineProperty:Y,getOwnPropertyDescriptor:Qq,getOwnPropertyNames:Vq}=Object,Wq=Object.prototype.hasOwnProperty,E=(q,z)=>Y(q,"name",{value:z,configurable:!0}),Xq=(q,z)=>{for(var G in z)Y(q,G,{get:z[G],enumerable:!0})},Yq=(q,z,G,K)=>{if(z&&typeof z==="object"||typeof z==="function"){for(let I of Vq(z))if(!Wq.call(q,I)&&I!==G)Y(q,I,{get:()=>z[I],enumerable:!(K=Qq(z,I))||K.enumerable})}return q},Zq=(q)=>Yq(Y({},"__esModule",{value:!0}),q),L={};Xq(L,{fromArrayBuffer:()=>Nq,fromString:()=>Fq});R.exports=Zq(L);var $q=D(),$=Kq("buffer"),Nq=E((q,z=0,G=q.byteLength-z)=>{if(!(0,$q.isArrayBuffer)(q))throw TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof q} (${q})`);return $.Buffer.from(q,z,G)},"fromArrayBuffer"),Fq=E((q,z)=>{if(typeof q!=="string")throw TypeError(`The "input" argument must be of type string. Received type ${typeof q} (${q})`);return z?$.Buffer.from(q,z):$.Buffer.from(q)},"fromString")});var A=Q((mq,h)=>{var{defineProperty:Z,getOwnPropertyDescriptor:Hq,getOwnPropertyNames:Bq}=Object,Jq=Object.prototype.hasOwnProperty,N=(q,z)=>Z(q,"name",{value:z,configurable:!0}),jq=(q,z)=>{for(var G in z)Z(q,G,{get:z[G],enumerable:!0})},Dq=(q,z,G,K)=>{if(z&&typeof z==="object"||typeof z==="function"){for(let I of Bq(z))if(!Jq.call(q,I)&&I!==G)Z(q,I,{get:()=>z[I],enumerable:!(K=Hq(z,I))||K.enumerable})}return q},Eq=(q)=>Dq(Z({},"__esModule",{value:!0}),q),v={};jq(v,{fromUtf8:()=>S,toUint8Array:()=>Lq,toUtf8:()=>Rq});h.exports=Eq(v);var M=O(),S=N((q)=>{let z=(0,M.fromString)(q,"utf8");return new Uint8Array(z.buffer,z.byteOffset,z.byteLength/Uint8Array.BYTES_PER_ELEMENT)},"fromUtf8"),Lq=N((q)=>{if(typeof q==="string")return S(q);if(ArrayBuffer.isView(q))return new Uint8Array(q.buffer,q.byteOffset,q.byteLength/Uint8Array.BYTES_PER_ELEMENT);return new Uint8Array(q)},"toUint8Array"),Rq=N((q)=>{if(typeof q==="string")return q;if(typeof q!=="object"||typeof q.byteOffset!=="number"||typeof q.byteLength!=="number")throw Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return(0,M.fromArrayBuffer)(q.buffer,q.byteOffset,q.byteLength).toString("utf8")},"toUtf8")});var w=Q((C)=>{Object.defineProperty(C,"__esModule",{value:!0});C.convertToBuffer=void 0;var Oq=A(),vq=typeof Buffer<"u"&&Buffer.from?function(q){return Buffer.from(q,"utf8")}:Oq.fromUtf8;function Mq(q){if(q instanceof Uint8Array)return q;if(typeof q==="string")return vq(q);if(ArrayBuffer.isView(q))return new Uint8Array(q.buffer,q.byteOffset,q.byteLength/Uint8Array.BYTES_PER_ELEMENT);return new Uint8Array(q)}C.convertToBuffer=Mq});var U=Q((P)=>{Object.defineProperty(P,"__esModule",{value:!0});P.isEmptyData=void 0;function Sq(q){if(typeof q==="string")return q.length===0;return q.byteLength===0}P.isEmptyData=Sq});var y=Q((b)=>{Object.defineProperty(b,"__esModule",{value:!0});b.numToUint8=void 0;function hq(q){return new Uint8Array([(q&4278190080)>>24,(q&16711680)>>16,(q&65280)>>8,q&255])}b.numToUint8=hq});var l=Q((x)=>{Object.defineProperty(x,"__esModule",{value:!0});x.uint32ArrayFrom=void 0;function Aq(q){if(!Uint32Array.from){var z=new Uint32Array(q.length),G=0;while(G<q.length)z[G]=q[G],G+=1;return z}return Uint32Array.from(q)}x.uint32ArrayFrom=Aq});var F=Q((V)=>{Object.defineProperty(V,"__esModule",{value:!0});V.uint32ArrayFrom=V.numToUint8=V.isEmptyData=V.convertToBuffer=void 0;var Cq=w();Object.defineProperty(V,"convertToBuffer",{enumerable:!0,get:function(){return Cq.convertToBuffer}});var Tq=U();Object.defineProperty(V,"isEmptyData",{enumerable:!0,get:function(){return Tq.isEmptyData}});var wq=y();Object.defineProperty(V,"numToUint8",{enumerable:!0,get:function(){return wq.numToUint8}});var Pq=l();Object.defineProperty(V,"uint32ArrayFrom",{enumerable:!0,get:function(){return Pq.uint32ArrayFrom}})});var m=Q((i)=>{Object.defineProperty(i,"__esModule",{value:!0});i.AwsCrc32=void 0;var s=u(),H=F(),f=n(),Uq=function(){function q(){this.crc32=new f.Crc32}return q.prototype.update=function(z){if((0,H.isEmptyData)(z))return;this.crc32.update((0,H.convertToBuffer)(z))},q.prototype.digest=function(){return s.__awaiter(this,void 0,void 0,function(){return s.__generator(this,function(z){return[2,(0,H.numToUint8)(this.crc32.digest())]})})},q.prototype.reset=function(){this.crc32=new f.Crc32},q}();i.AwsCrc32=Uq});var n=Q((B)=>{Object.defineProperty(B,"__esModule",{value:!0});B.AwsCrc32=B.Crc32=B.crc32=void 0;var bq=u(),gq=F();function yq(q){return new p().update(q).digest()}B.crc32=yq;var p=function(){function q(){this.checksum=4294967295}return q.prototype.update=function(z){var G,K;try{for(var I=bq.__values(z),W=I.next();!W.done;W=I.next()){var _=W.value;this.checksum=this.checksum>>>8^cq[(this.checksum^_)&255]}}catch(e){G={error:e}}finally{try{if(W&&!W.done&&(K=I.return))K.call(I)}finally{if(G)throw G.error}}return this},q.prototype.digest=function(){return(this.checksum^4294967295)>>>0},q}();B.Crc32=p;var xq=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],cq=(0,gq.uint32ArrayFrom)(xq),lq=m();Object.defineProperty(B,"AwsCrc32",{enumerable:!0,get:function(){return lq.AwsCrc32}})});
|
|
3
|
+
export{n as xf};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Bp as f,Cp as s,Dp as O,Hp as IG,Io as y,No as l,Po as p,Ro as qG,Wo as NG,Yo as _,bp as DG,rp as t,tp as R,up as b,vp as xG}from"./chunk-wm9nh9nb.js";import{Op as AG,Pp as r,Up as PG,Wp as T}from"./chunk-scnbt714.js";import{Kt as Q}from"./chunk-a48mx917.js";function h(G){return G.replace(/[_-]([a-z])/g,(Y)=>Y[1].toUpperCase())}function MG(G,Y){let Z=h(G);if(Z!==G&&(Y==null?void 0:Y[Z])!=null)return Z;return G}var SG=Q.object({error:Q.object({message:Q.string(),type:Q.string().nullish(),param:Q.any().nullish(),code:Q.union([Q.string(),Q.number()]).nullish()})}),m={errorSchema:SG,errorToMessage:(G)=>G.error.message};function jG(G){var Y,Z,U,z,V,j;if(G==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let B=(Y=G.prompt_tokens)!=null?Y:0,H=(Z=G.completion_tokens)!=null?Z:0,X=(z=(U=G.prompt_tokens_details)==null?void 0:U.cached_tokens)!=null?z:0,L=(j=(V=G.completion_tokens_details)==null?void 0:V.reasoning_tokens)!=null?j:0;return{inputTokens:{total:B,noCache:B-X,cacheRead:X,cacheWrite:void 0},outputTokens:{total:H,text:H-L,reasoning:L},raw:G}}function u(G){var Y,Z;return(Z=(Y=G==null?void 0:G.providerOptions)==null?void 0:Y.openaiCompatible)!=null?Z:{}}function RG(G){switch(G){case"audio/wav":return"wav";case"audio/mp3":case"audio/mpeg":return"mp3";default:return null}}function yG(G){var Y,Z,U;let z=[];for(let{role:V,content:j,...B}of G){let H=u({...B});switch(V){case"system":{z.push({role:"system",content:j,...H});break}case"user":{if(j.length===1&&j[0].type==="text"){z.push({role:"user",content:j[0].text,...u(j[0])});break}z.push({role:"user",content:j.map((X)=>{var L;let $=u(X);switch(X.type){case"text":return{type:"text",text:X.text,...$};case"file":{if(X.mediaType.startsWith("image/")){let J=X.mediaType==="image/*"?"image/jpeg":X.mediaType;return{type:"image_url",image_url:{url:X.data instanceof URL?X.data.toString():`data:${J};base64,${p(X.data)}`},...$}}if(X.mediaType.startsWith("audio/")){if(X.data instanceof URL)throw new T({functionality:"audio file parts with URLs"});let J=RG(X.mediaType);if(J===null)throw new T({functionality:`audio media type ${X.mediaType}`});return{type:"input_audio",input_audio:{data:p(X.data),format:J},...$}}if(X.mediaType==="application/pdf"){if(X.data instanceof URL)throw new T({functionality:"PDF file parts with URLs"});return{type:"file",file:{filename:(L=X.filename)!=null?L:"document.pdf",file_data:`data:application/pdf;base64,${p(X.data)}`},...$}}if(X.mediaType.startsWith("text/"))return{type:"text",text:X.data instanceof URL?X.data.toString():typeof X.data==="string"?new TextDecoder().decode(l(X.data)):new TextDecoder().decode(X.data),...$};throw new T({functionality:`file part media type ${X.mediaType}`})}}}),...H});break}case"assistant":{let X="",L="",$=[];for(let J of j){let E=u(J);switch(J.type){case"text":{X+=J.text;break}case"reasoning":{L+=J.text;break}case"tool-call":{let A=(Z=(Y=J.providerOptions)==null?void 0:Y.google)==null?void 0:Z.thoughtSignature;$.push({id:J.toolCallId,type:"function",function:{name:J.toolName,arguments:JSON.stringify(J.input)},...E,...A?{extra_content:{google:{thought_signature:String(A)}}}:{}});break}}}z.push({role:"assistant",content:X,...L.length>0?{reasoning_content:L}:{},tool_calls:$.length>0?$:void 0,...H});break}case"tool":{for(let X of j){if(X.type==="tool-approval-response")continue;let L=X.output,$;switch(L.type){case"text":case"error-text":$=L.value;break;case"execution-denied":$=(U=L.reason)!=null?U:"Tool execution denied.";break;case"content":case"json":case"error-json":$=JSON.stringify(L.value);break}let J=u(X);z.push({role:"tool",tool_call_id:X.toolCallId,content:$,...J})}break}default:throw Error(`Unsupported role: ${V}`)}}return z}function LG({id:G,model:Y,created:Z}){return{id:G!=null?G:void 0,modelId:Y!=null?Y:void 0,timestamp:Z!=null?new Date(Z*1000):void 0}}function zG(G){switch(G){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"other"}}var g=Q.object({user:Q.string().optional(),reasoningEffort:Q.string().optional(),textVerbosity:Q.string().optional(),strictJsonSchema:Q.boolean().optional()});function TG({tools:G,toolChoice:Y}){G=(G==null?void 0:G.length)?G:void 0;let Z=[];if(G==null)return{tools:void 0,toolChoice:void 0,toolWarnings:Z};let U=[];for(let V of G)if(V.type==="provider")Z.push({type:"unsupported",feature:`provider-defined tool ${V.id}`});else U.push({type:"function",function:{name:V.name,description:V.description,parameters:V.inputSchema,...V.strict!=null?{strict:V.strict}:{}}});if(Y==null)return{tools:U,toolChoice:void 0,toolWarnings:Z};let z=Y.type;switch(z){case"auto":case"none":case"required":return{tools:U,toolChoice:z,toolWarnings:Z};case"tool":return{tools:U,toolChoice:{type:"function",function:{name:Y.toolName}},toolWarnings:Z};default:throw new T({functionality:`tool choice type: ${z}`})}}var bG=class{constructor(G,Y){this.specificationVersion="v3";var Z,U;this.modelId=G,this.config=Y;let z=(Z=Y.errorStructure)!=null?Z:m;this.chunkSchema=OG(z.errorSchema),this.failedResponseHandler=f(z),this.supportsStructuredOutputs=(U=Y.supportsStructuredOutputs)!=null?U:!1}get provider(){return this.config.provider}get providerOptionsName(){return this.config.provider.split(".")[0].trim()}get supportedUrls(){var G,Y,Z;return(Z=(Y=(G=this.config).supportedUrls)==null?void 0:Y.call(G))!=null?Z:{}}transformRequestBody(G){var Y,Z,U;return(U=(Z=(Y=this.config).transformRequestBody)==null?void 0:Z.call(Y,G))!=null?U:G}async getArgs({prompt:G,maxOutputTokens:Y,temperature:Z,topP:U,topK:z,frequencyPenalty:V,presencePenalty:j,providerOptions:B,stopSequences:H,responseFormat:X,seed:L,toolChoice:$,tools:J}){var E,A,P,K,W;let N=[],x=await R({provider:"openai-compatible",providerOptions:B,schema:g});if(x!=null)N.push({type:"other",message:"The 'openai-compatible' key in providerOptions is deprecated. Use 'openaiCompatible' instead."});let D=Object.assign(x!=null?x:{},(E=await R({provider:"openaiCompatible",providerOptions:B,schema:g}))!=null?E:{},(A=await R({provider:this.providerOptionsName,providerOptions:B,schema:g}))!=null?A:{},(P=await R({provider:h(this.providerOptionsName),providerOptions:B,schema:g}))!=null?P:{}),w=(K=D==null?void 0:D.strictJsonSchema)!=null?K:!0;if(z!=null)N.push({type:"unsupported",feature:"topK"});if((X==null?void 0:X.type)==="json"&&X.schema!=null&&!this.supportsStructuredOutputs)N.push({type:"unsupported",feature:"responseFormat",details:"JSON response format schema is only supported with structuredOutputs"});let{tools:q,toolChoice:I,toolWarnings:k}=TG({tools:J,toolChoice:$});return{metadataKey:MG(this.providerOptionsName,B),args:{model:this.modelId,user:D.user,max_tokens:Y,temperature:Z,top_p:U,frequency_penalty:V,presence_penalty:j,response_format:(X==null?void 0:X.type)==="json"?this.supportsStructuredOutputs===!0&&X.schema!=null?{type:"json_schema",json_schema:{schema:X.schema,strict:w,name:(W=X.name)!=null?W:"response",description:X.description}}:{type:"json_object"}:void 0,stop:H,seed:L,...Object.fromEntries(Object.entries({...B==null?void 0:B[this.providerOptionsName],...B==null?void 0:B[h(this.providerOptionsName)]}).filter(([d])=>!Object.keys(g.shape).includes(d))),reasoning_effort:D.reasoningEffort,verbosity:D.textVerbosity,messages:yG(G),tools:q,tool_choice:I},warnings:[...N,...k]}}async doGenerate(G){var Y,Z,U,z,V,j,B,H;let{args:X,warnings:L,metadataKey:$}=await this.getArgs({...G}),J=this.transformRequestBody(X),E=JSON.stringify(J),{responseHeaders:A,value:P,rawValue:K}=await b({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:y(this.config.headers(),G.headers),body:J,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:O(kG),abortSignal:G.abortSignal,fetch:this.config.fetch}),W=P.choices[0],N=[],x=W.message.content;if(x!=null&&x.length>0)N.push({type:"text",text:x});let D=(Y=W.message.reasoning_content)!=null?Y:W.message.reasoning;if(D!=null&&D.length>0)N.push({type:"reasoning",text:D});if(W.message.tool_calls!=null)for(let I of W.message.tool_calls){let k=(U=(Z=I.extra_content)==null?void 0:Z.google)==null?void 0:U.thought_signature;N.push({type:"tool-call",toolCallId:(z=I.id)!=null?z:_(),toolName:I.function.name,input:I.function.arguments,...k?{providerMetadata:{[$]:{thoughtSignature:k}}}:{}})}let w={[$]:{},...await((j=(V=this.config.metadataExtractor)==null?void 0:V.extractMetadata)==null?void 0:j.call(V,{parsedBody:K}))},q=(B=P.usage)==null?void 0:B.completion_tokens_details;if((q==null?void 0:q.accepted_prediction_tokens)!=null)w[$].acceptedPredictionTokens=q==null?void 0:q.accepted_prediction_tokens;if((q==null?void 0:q.rejected_prediction_tokens)!=null)w[$].rejectedPredictionTokens=q==null?void 0:q.rejected_prediction_tokens;return{content:N,finishReason:{unified:zG(W.finish_reason),raw:(H=W.finish_reason)!=null?H:void 0},usage:jG(P.usage),providerMetadata:w,request:{body:E},response:{...LG(P),headers:A,body:K},warnings:L}}async doStream(G){var Y;let{args:Z,warnings:U,metadataKey:z}=await this.getArgs({...G}),V=this.transformRequestBody({...Z,stream:!0,stream_options:this.config.includeUsage?{include_usage:!0}:void 0}),j=(Y=this.config.metadataExtractor)==null?void 0:Y.createStreamExtractor(),{responseHeaders:B,value:H}=await b({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:y(this.config.headers(),G.headers),body:V,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:s(this.chunkSchema),abortSignal:G.abortSignal,fetch:this.config.fetch}),X=[],L={unified:"other",raw:void 0},$=void 0,J=!0,E=z,A=!1,P=!1;return{stream:H.pipeThrough(new TransformStream({start(K){K.enqueue({type:"stream-start",warnings:U})},transform(K,W){var N,x,D,w,q,I,k,n,d,e,o,GG,QG,XG,YG,ZG,$G,JG;if(G.includeRawChunks)W.enqueue({type:"raw",rawValue:K.rawValue});if(!K.success){L={unified:"error",raw:void 0},W.enqueue({type:"error",error:K.error});return}if(j==null||j.processChunk(K.rawValue),"error"in K.value){L={unified:"error",raw:void 0},W.enqueue({type:"error",error:K.value.error.message});return}let c=K.value;if(J)J=!1,W.enqueue({type:"response-metadata",...LG(c)});if(c.usage!=null)$=c.usage;let v=c.choices[0];if((v==null?void 0:v.finish_reason)!=null)L={unified:zG(v.finish_reason),raw:(N=v.finish_reason)!=null?N:void 0};if((v==null?void 0:v.delta)==null)return;let C=v.delta,UG=(x=C.reasoning_content)!=null?x:C.reasoning;if(UG){if(!A)W.enqueue({type:"reasoning-start",id:"reasoning-0"}),A=!0;W.enqueue({type:"reasoning-delta",id:"reasoning-0",delta:UG})}if(C.content){if(A)W.enqueue({type:"reasoning-end",id:"reasoning-0"}),A=!1;if(!P)W.enqueue({type:"text-start",id:"txt-0"}),P=!0;W.enqueue({type:"text-delta",id:"txt-0",delta:C.content})}if(C.tool_calls!=null){if(A)W.enqueue({type:"reasoning-end",id:"reasoning-0"}),A=!1;for(let F of C.tool_calls){let i=(D=F.index)!=null?D:X.length;if(X[i]==null){if(F.id==null)throw new r({data:F,message:"Expected 'id' to be a string."});if(((w=F.function)==null?void 0:w.name)==null)throw new r({data:F,message:"Expected 'function.name' to be a string."});W.enqueue({type:"tool-input-start",id:F.id,toolName:F.function.name}),X[i]={id:F.id,type:"function",function:{name:F.function.name,arguments:(q=F.function.arguments)!=null?q:""},hasFinished:!1,thoughtSignature:(n=(k=(I=F.extra_content)==null?void 0:I.google)==null?void 0:k.thought_signature)!=null?n:void 0};let S=X[i];if(((d=S.function)==null?void 0:d.name)!=null&&((e=S.function)==null?void 0:e.arguments)!=null){if(S.function.arguments.length>0)W.enqueue({type:"tool-input-delta",id:S.id,delta:S.function.arguments});if(t(S.function.arguments))W.enqueue({type:"tool-input-end",id:S.id}),W.enqueue({type:"tool-call",toolCallId:(o=S.id)!=null?o:_(),toolName:S.function.name,input:S.function.arguments,...S.thoughtSignature?{providerMetadata:{[E]:{thoughtSignature:S.thoughtSignature}}}:{}}),S.hasFinished=!0}continue}let M=X[i];if(M.hasFinished)continue;if(((GG=F.function)==null?void 0:GG.arguments)!=null)M.function.arguments+=(XG=(QG=F.function)==null?void 0:QG.arguments)!=null?XG:"";if(W.enqueue({type:"tool-input-delta",id:M.id,delta:(YG=F.function.arguments)!=null?YG:""}),((ZG=M.function)==null?void 0:ZG.name)!=null&&(($G=M.function)==null?void 0:$G.arguments)!=null&&t(M.function.arguments))W.enqueue({type:"tool-input-end",id:M.id}),W.enqueue({type:"tool-call",toolCallId:(JG=M.id)!=null?JG:_(),toolName:M.function.name,input:M.function.arguments,...M.thoughtSignature?{providerMetadata:{[E]:{thoughtSignature:M.thoughtSignature}}}:{}}),M.hasFinished=!0}}},flush(K){var W,N,x,D,w;if(A)K.enqueue({type:"reasoning-end",id:"reasoning-0"});if(P)K.enqueue({type:"text-end",id:"txt-0"});for(let I of X.filter((k)=>!k.hasFinished))K.enqueue({type:"tool-input-end",id:I.id}),K.enqueue({type:"tool-call",toolCallId:(W=I.id)!=null?W:_(),toolName:I.function.name,input:I.function.arguments,...I.thoughtSignature?{providerMetadata:{[E]:{thoughtSignature:I.thoughtSignature}}}:{}});let q={[E]:{},...j==null?void 0:j.buildMetadata()};if(((N=$==null?void 0:$.completion_tokens_details)==null?void 0:N.accepted_prediction_tokens)!=null)q[E].acceptedPredictionTokens=(x=$==null?void 0:$.completion_tokens_details)==null?void 0:x.accepted_prediction_tokens;if(((D=$==null?void 0:$.completion_tokens_details)==null?void 0:D.rejected_prediction_tokens)!=null)q[E].rejectedPredictionTokens=(w=$==null?void 0:$.completion_tokens_details)==null?void 0:w.rejected_prediction_tokens;K.enqueue({type:"finish",finishReason:L,usage:jG($),providerMetadata:q})}})),request:{body:V},response:{headers:B}}}},FG=Q.looseObject({prompt_tokens:Q.number().nullish(),completion_tokens:Q.number().nullish(),total_tokens:Q.number().nullish(),prompt_tokens_details:Q.object({cached_tokens:Q.number().nullish()}).nullish(),completion_tokens_details:Q.object({reasoning_tokens:Q.number().nullish(),accepted_prediction_tokens:Q.number().nullish(),rejected_prediction_tokens:Q.number().nullish()}).nullish()}).nullish(),kG=Q.looseObject({id:Q.string().nullish(),created:Q.number().nullish(),model:Q.string().nullish(),choices:Q.array(Q.object({message:Q.object({role:Q.literal("assistant").nullish(),content:Q.string().nullish(),reasoning_content:Q.string().nullish(),reasoning:Q.string().nullish(),tool_calls:Q.array(Q.object({id:Q.string().nullish(),function:Q.object({name:Q.string(),arguments:Q.string()}),extra_content:Q.object({google:Q.object({thought_signature:Q.string().nullish()}).nullish()}).nullish()})).nullish()}),finish_reason:Q.string().nullish()})),usage:FG}),fG=Q.looseObject({id:Q.string().nullish(),created:Q.number().nullish(),model:Q.string().nullish(),choices:Q.array(Q.object({delta:Q.object({role:Q.enum(["assistant"]).nullish(),content:Q.string().nullish(),reasoning_content:Q.string().nullish(),reasoning:Q.string().nullish(),tool_calls:Q.array(Q.object({index:Q.number().nullish(),id:Q.string().nullish(),function:Q.object({name:Q.string().nullish(),arguments:Q.string().nullish()}),extra_content:Q.object({google:Q.object({thought_signature:Q.string().nullish()}).nullish()}).nullish()})).nullish()}).nullish(),finish_reason:Q.string().nullish()})),usage:FG}),OG=(G)=>Q.union([fG,G]);function BG(G){var Y,Z;if(G==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let U=(Y=G.prompt_tokens)!=null?Y:0,z=(Z=G.completion_tokens)!=null?Z:0;return{inputTokens:{total:U,noCache:U,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:z,text:z,reasoning:void 0},raw:G}}function vG({prompt:G,user:Y="user",assistant:Z="assistant"}){let U="";if(G[0].role==="system")U+=`${G[0].content}
|
|
2
|
+
import{Aq as O,Eq as IG,Fp as y,Kp as l,Mp as p,Op as qG,Tp as NG,Vp as _,_p as DG,oq as t,qq as R,rq as b,sq as xG,yq as f,zq as s}from"./chunk-yce8ph5b.js";import{Lq as AG,Mq as r,Rq as PG,Tq as T}from"./chunk-kec1xw1n.js";import{Hu as Q}from"./chunk-q4mtwv1w.js";function h(G){return G.replace(/[_-]([a-z])/g,(Y)=>Y[1].toUpperCase())}function MG(G,Y){let Z=h(G);if(Z!==G&&(Y==null?void 0:Y[Z])!=null)return Z;return G}var SG=Q.object({error:Q.object({message:Q.string(),type:Q.string().nullish(),param:Q.any().nullish(),code:Q.union([Q.string(),Q.number()]).nullish()})}),m={errorSchema:SG,errorToMessage:(G)=>G.error.message};function jG(G){var Y,Z,U,z,V,j;if(G==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let B=(Y=G.prompt_tokens)!=null?Y:0,H=(Z=G.completion_tokens)!=null?Z:0,X=(z=(U=G.prompt_tokens_details)==null?void 0:U.cached_tokens)!=null?z:0,L=(j=(V=G.completion_tokens_details)==null?void 0:V.reasoning_tokens)!=null?j:0;return{inputTokens:{total:B,noCache:B-X,cacheRead:X,cacheWrite:void 0},outputTokens:{total:H,text:H-L,reasoning:L},raw:G}}function u(G){var Y,Z;return(Z=(Y=G==null?void 0:G.providerOptions)==null?void 0:Y.openaiCompatible)!=null?Z:{}}function RG(G){switch(G){case"audio/wav":return"wav";case"audio/mp3":case"audio/mpeg":return"mp3";default:return null}}function yG(G){var Y,Z,U;let z=[];for(let{role:V,content:j,...B}of G){let H=u({...B});switch(V){case"system":{z.push({role:"system",content:j,...H});break}case"user":{if(j.length===1&&j[0].type==="text"){z.push({role:"user",content:j[0].text,...u(j[0])});break}z.push({role:"user",content:j.map((X)=>{var L;let $=u(X);switch(X.type){case"text":return{type:"text",text:X.text,...$};case"file":{if(X.mediaType.startsWith("image/")){let J=X.mediaType==="image/*"?"image/jpeg":X.mediaType;return{type:"image_url",image_url:{url:X.data instanceof URL?X.data.toString():`data:${J};base64,${p(X.data)}`},...$}}if(X.mediaType.startsWith("audio/")){if(X.data instanceof URL)throw new T({functionality:"audio file parts with URLs"});let J=RG(X.mediaType);if(J===null)throw new T({functionality:`audio media type ${X.mediaType}`});return{type:"input_audio",input_audio:{data:p(X.data),format:J},...$}}if(X.mediaType==="application/pdf"){if(X.data instanceof URL)throw new T({functionality:"PDF file parts with URLs"});return{type:"file",file:{filename:(L=X.filename)!=null?L:"document.pdf",file_data:`data:application/pdf;base64,${p(X.data)}`},...$}}if(X.mediaType.startsWith("text/"))return{type:"text",text:X.data instanceof URL?X.data.toString():typeof X.data==="string"?new TextDecoder().decode(l(X.data)):new TextDecoder().decode(X.data),...$};throw new T({functionality:`file part media type ${X.mediaType}`})}}}),...H});break}case"assistant":{let X="",L="",$=[];for(let J of j){let E=u(J);switch(J.type){case"text":{X+=J.text;break}case"reasoning":{L+=J.text;break}case"tool-call":{let A=(Z=(Y=J.providerOptions)==null?void 0:Y.google)==null?void 0:Z.thoughtSignature;$.push({id:J.toolCallId,type:"function",function:{name:J.toolName,arguments:JSON.stringify(J.input)},...E,...A?{extra_content:{google:{thought_signature:String(A)}}}:{}});break}}}z.push({role:"assistant",content:X,...L.length>0?{reasoning_content:L}:{},tool_calls:$.length>0?$:void 0,...H});break}case"tool":{for(let X of j){if(X.type==="tool-approval-response")continue;let L=X.output,$;switch(L.type){case"text":case"error-text":$=L.value;break;case"execution-denied":$=(U=L.reason)!=null?U:"Tool execution denied.";break;case"content":case"json":case"error-json":$=JSON.stringify(L.value);break}let J=u(X);z.push({role:"tool",tool_call_id:X.toolCallId,content:$,...J})}break}default:throw Error(`Unsupported role: ${V}`)}}return z}function LG({id:G,model:Y,created:Z}){return{id:G!=null?G:void 0,modelId:Y!=null?Y:void 0,timestamp:Z!=null?new Date(Z*1000):void 0}}function zG(G){switch(G){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"other"}}var g=Q.object({user:Q.string().optional(),reasoningEffort:Q.string().optional(),textVerbosity:Q.string().optional(),strictJsonSchema:Q.boolean().optional()});function TG({tools:G,toolChoice:Y}){G=(G==null?void 0:G.length)?G:void 0;let Z=[];if(G==null)return{tools:void 0,toolChoice:void 0,toolWarnings:Z};let U=[];for(let V of G)if(V.type==="provider")Z.push({type:"unsupported",feature:`provider-defined tool ${V.id}`});else U.push({type:"function",function:{name:V.name,description:V.description,parameters:V.inputSchema,...V.strict!=null?{strict:V.strict}:{}}});if(Y==null)return{tools:U,toolChoice:void 0,toolWarnings:Z};let z=Y.type;switch(z){case"auto":case"none":case"required":return{tools:U,toolChoice:z,toolWarnings:Z};case"tool":return{tools:U,toolChoice:{type:"function",function:{name:Y.toolName}},toolWarnings:Z};default:throw new T({functionality:`tool choice type: ${z}`})}}var bG=class{constructor(G,Y){this.specificationVersion="v3";var Z,U;this.modelId=G,this.config=Y;let z=(Z=Y.errorStructure)!=null?Z:m;this.chunkSchema=OG(z.errorSchema),this.failedResponseHandler=f(z),this.supportsStructuredOutputs=(U=Y.supportsStructuredOutputs)!=null?U:!1}get provider(){return this.config.provider}get providerOptionsName(){return this.config.provider.split(".")[0].trim()}get supportedUrls(){var G,Y,Z;return(Z=(Y=(G=this.config).supportedUrls)==null?void 0:Y.call(G))!=null?Z:{}}transformRequestBody(G){var Y,Z,U;return(U=(Z=(Y=this.config).transformRequestBody)==null?void 0:Z.call(Y,G))!=null?U:G}async getArgs({prompt:G,maxOutputTokens:Y,temperature:Z,topP:U,topK:z,frequencyPenalty:V,presencePenalty:j,providerOptions:B,stopSequences:H,responseFormat:X,seed:L,toolChoice:$,tools:J}){var E,A,P,K,W;let N=[],x=await R({provider:"openai-compatible",providerOptions:B,schema:g});if(x!=null)N.push({type:"other",message:"The 'openai-compatible' key in providerOptions is deprecated. Use 'openaiCompatible' instead."});let D=Object.assign(x!=null?x:{},(E=await R({provider:"openaiCompatible",providerOptions:B,schema:g}))!=null?E:{},(A=await R({provider:this.providerOptionsName,providerOptions:B,schema:g}))!=null?A:{},(P=await R({provider:h(this.providerOptionsName),providerOptions:B,schema:g}))!=null?P:{}),w=(K=D==null?void 0:D.strictJsonSchema)!=null?K:!0;if(z!=null)N.push({type:"unsupported",feature:"topK"});if((X==null?void 0:X.type)==="json"&&X.schema!=null&&!this.supportsStructuredOutputs)N.push({type:"unsupported",feature:"responseFormat",details:"JSON response format schema is only supported with structuredOutputs"});let{tools:q,toolChoice:I,toolWarnings:k}=TG({tools:J,toolChoice:$});return{metadataKey:MG(this.providerOptionsName,B),args:{model:this.modelId,user:D.user,max_tokens:Y,temperature:Z,top_p:U,frequency_penalty:V,presence_penalty:j,response_format:(X==null?void 0:X.type)==="json"?this.supportsStructuredOutputs===!0&&X.schema!=null?{type:"json_schema",json_schema:{schema:X.schema,strict:w,name:(W=X.name)!=null?W:"response",description:X.description}}:{type:"json_object"}:void 0,stop:H,seed:L,...Object.fromEntries(Object.entries({...B==null?void 0:B[this.providerOptionsName],...B==null?void 0:B[h(this.providerOptionsName)]}).filter(([d])=>!Object.keys(g.shape).includes(d))),reasoning_effort:D.reasoningEffort,verbosity:D.textVerbosity,messages:yG(G),tools:q,tool_choice:I},warnings:[...N,...k]}}async doGenerate(G){var Y,Z,U,z,V,j,B,H;let{args:X,warnings:L,metadataKey:$}=await this.getArgs({...G}),J=this.transformRequestBody(X),E=JSON.stringify(J),{responseHeaders:A,value:P,rawValue:K}=await b({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:y(this.config.headers(),G.headers),body:J,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:O(kG),abortSignal:G.abortSignal,fetch:this.config.fetch}),W=P.choices[0],N=[],x=W.message.content;if(x!=null&&x.length>0)N.push({type:"text",text:x});let D=(Y=W.message.reasoning_content)!=null?Y:W.message.reasoning;if(D!=null&&D.length>0)N.push({type:"reasoning",text:D});if(W.message.tool_calls!=null)for(let I of W.message.tool_calls){let k=(U=(Z=I.extra_content)==null?void 0:Z.google)==null?void 0:U.thought_signature;N.push({type:"tool-call",toolCallId:(z=I.id)!=null?z:_(),toolName:I.function.name,input:I.function.arguments,...k?{providerMetadata:{[$]:{thoughtSignature:k}}}:{}})}let w={[$]:{},...await((j=(V=this.config.metadataExtractor)==null?void 0:V.extractMetadata)==null?void 0:j.call(V,{parsedBody:K}))},q=(B=P.usage)==null?void 0:B.completion_tokens_details;if((q==null?void 0:q.accepted_prediction_tokens)!=null)w[$].acceptedPredictionTokens=q==null?void 0:q.accepted_prediction_tokens;if((q==null?void 0:q.rejected_prediction_tokens)!=null)w[$].rejectedPredictionTokens=q==null?void 0:q.rejected_prediction_tokens;return{content:N,finishReason:{unified:zG(W.finish_reason),raw:(H=W.finish_reason)!=null?H:void 0},usage:jG(P.usage),providerMetadata:w,request:{body:E},response:{...LG(P),headers:A,body:K},warnings:L}}async doStream(G){var Y;let{args:Z,warnings:U,metadataKey:z}=await this.getArgs({...G}),V=this.transformRequestBody({...Z,stream:!0,stream_options:this.config.includeUsage?{include_usage:!0}:void 0}),j=(Y=this.config.metadataExtractor)==null?void 0:Y.createStreamExtractor(),{responseHeaders:B,value:H}=await b({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:y(this.config.headers(),G.headers),body:V,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:s(this.chunkSchema),abortSignal:G.abortSignal,fetch:this.config.fetch}),X=[],L={unified:"other",raw:void 0},$=void 0,J=!0,E=z,A=!1,P=!1;return{stream:H.pipeThrough(new TransformStream({start(K){K.enqueue({type:"stream-start",warnings:U})},transform(K,W){var N,x,D,w,q,I,k,n,d,e,o,GG,QG,XG,YG,ZG,$G,JG;if(G.includeRawChunks)W.enqueue({type:"raw",rawValue:K.rawValue});if(!K.success){L={unified:"error",raw:void 0},W.enqueue({type:"error",error:K.error});return}if(j==null||j.processChunk(K.rawValue),"error"in K.value){L={unified:"error",raw:void 0},W.enqueue({type:"error",error:K.value.error.message});return}let c=K.value;if(J)J=!1,W.enqueue({type:"response-metadata",...LG(c)});if(c.usage!=null)$=c.usage;let v=c.choices[0];if((v==null?void 0:v.finish_reason)!=null)L={unified:zG(v.finish_reason),raw:(N=v.finish_reason)!=null?N:void 0};if((v==null?void 0:v.delta)==null)return;let C=v.delta,UG=(x=C.reasoning_content)!=null?x:C.reasoning;if(UG){if(!A)W.enqueue({type:"reasoning-start",id:"reasoning-0"}),A=!0;W.enqueue({type:"reasoning-delta",id:"reasoning-0",delta:UG})}if(C.content){if(A)W.enqueue({type:"reasoning-end",id:"reasoning-0"}),A=!1;if(!P)W.enqueue({type:"text-start",id:"txt-0"}),P=!0;W.enqueue({type:"text-delta",id:"txt-0",delta:C.content})}if(C.tool_calls!=null){if(A)W.enqueue({type:"reasoning-end",id:"reasoning-0"}),A=!1;for(let F of C.tool_calls){let i=(D=F.index)!=null?D:X.length;if(X[i]==null){if(F.id==null)throw new r({data:F,message:"Expected 'id' to be a string."});if(((w=F.function)==null?void 0:w.name)==null)throw new r({data:F,message:"Expected 'function.name' to be a string."});W.enqueue({type:"tool-input-start",id:F.id,toolName:F.function.name}),X[i]={id:F.id,type:"function",function:{name:F.function.name,arguments:(q=F.function.arguments)!=null?q:""},hasFinished:!1,thoughtSignature:(n=(k=(I=F.extra_content)==null?void 0:I.google)==null?void 0:k.thought_signature)!=null?n:void 0};let S=X[i];if(((d=S.function)==null?void 0:d.name)!=null&&((e=S.function)==null?void 0:e.arguments)!=null){if(S.function.arguments.length>0)W.enqueue({type:"tool-input-delta",id:S.id,delta:S.function.arguments});if(t(S.function.arguments))W.enqueue({type:"tool-input-end",id:S.id}),W.enqueue({type:"tool-call",toolCallId:(o=S.id)!=null?o:_(),toolName:S.function.name,input:S.function.arguments,...S.thoughtSignature?{providerMetadata:{[E]:{thoughtSignature:S.thoughtSignature}}}:{}}),S.hasFinished=!0}continue}let M=X[i];if(M.hasFinished)continue;if(((GG=F.function)==null?void 0:GG.arguments)!=null)M.function.arguments+=(XG=(QG=F.function)==null?void 0:QG.arguments)!=null?XG:"";if(W.enqueue({type:"tool-input-delta",id:M.id,delta:(YG=F.function.arguments)!=null?YG:""}),((ZG=M.function)==null?void 0:ZG.name)!=null&&(($G=M.function)==null?void 0:$G.arguments)!=null&&t(M.function.arguments))W.enqueue({type:"tool-input-end",id:M.id}),W.enqueue({type:"tool-call",toolCallId:(JG=M.id)!=null?JG:_(),toolName:M.function.name,input:M.function.arguments,...M.thoughtSignature?{providerMetadata:{[E]:{thoughtSignature:M.thoughtSignature}}}:{}}),M.hasFinished=!0}}},flush(K){var W,N,x,D,w;if(A)K.enqueue({type:"reasoning-end",id:"reasoning-0"});if(P)K.enqueue({type:"text-end",id:"txt-0"});for(let I of X.filter((k)=>!k.hasFinished))K.enqueue({type:"tool-input-end",id:I.id}),K.enqueue({type:"tool-call",toolCallId:(W=I.id)!=null?W:_(),toolName:I.function.name,input:I.function.arguments,...I.thoughtSignature?{providerMetadata:{[E]:{thoughtSignature:I.thoughtSignature}}}:{}});let q={[E]:{},...j==null?void 0:j.buildMetadata()};if(((N=$==null?void 0:$.completion_tokens_details)==null?void 0:N.accepted_prediction_tokens)!=null)q[E].acceptedPredictionTokens=(x=$==null?void 0:$.completion_tokens_details)==null?void 0:x.accepted_prediction_tokens;if(((D=$==null?void 0:$.completion_tokens_details)==null?void 0:D.rejected_prediction_tokens)!=null)q[E].rejectedPredictionTokens=(w=$==null?void 0:$.completion_tokens_details)==null?void 0:w.rejected_prediction_tokens;K.enqueue({type:"finish",finishReason:L,usage:jG($),providerMetadata:q})}})),request:{body:V},response:{headers:B}}}},FG=Q.looseObject({prompt_tokens:Q.number().nullish(),completion_tokens:Q.number().nullish(),total_tokens:Q.number().nullish(),prompt_tokens_details:Q.object({cached_tokens:Q.number().nullish()}).nullish(),completion_tokens_details:Q.object({reasoning_tokens:Q.number().nullish(),accepted_prediction_tokens:Q.number().nullish(),rejected_prediction_tokens:Q.number().nullish()}).nullish()}).nullish(),kG=Q.looseObject({id:Q.string().nullish(),created:Q.number().nullish(),model:Q.string().nullish(),choices:Q.array(Q.object({message:Q.object({role:Q.literal("assistant").nullish(),content:Q.string().nullish(),reasoning_content:Q.string().nullish(),reasoning:Q.string().nullish(),tool_calls:Q.array(Q.object({id:Q.string().nullish(),function:Q.object({name:Q.string(),arguments:Q.string()}),extra_content:Q.object({google:Q.object({thought_signature:Q.string().nullish()}).nullish()}).nullish()})).nullish()}),finish_reason:Q.string().nullish()})),usage:FG}),fG=Q.looseObject({id:Q.string().nullish(),created:Q.number().nullish(),model:Q.string().nullish(),choices:Q.array(Q.object({delta:Q.object({role:Q.enum(["assistant"]).nullish(),content:Q.string().nullish(),reasoning_content:Q.string().nullish(),reasoning:Q.string().nullish(),tool_calls:Q.array(Q.object({index:Q.number().nullish(),id:Q.string().nullish(),function:Q.object({name:Q.string().nullish(),arguments:Q.string().nullish()}),extra_content:Q.object({google:Q.object({thought_signature:Q.string().nullish()}).nullish()}).nullish()})).nullish()}).nullish(),finish_reason:Q.string().nullish()})),usage:FG}),OG=(G)=>Q.union([fG,G]);function BG(G){var Y,Z;if(G==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let U=(Y=G.prompt_tokens)!=null?Y:0,z=(Z=G.completion_tokens)!=null?Z:0;return{inputTokens:{total:U,noCache:U,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:z,text:z,reasoning:void 0},raw:G}}function vG({prompt:G,user:Y="user",assistant:Z="assistant"}){let U="";if(G[0].role==="system")U+=`${G[0].content}
|
|
3
3
|
|
|
4
4
|
`,G=G.slice(1);for(let{role:z,content:V}of G)switch(z){case"system":throw new AG({message:"Unexpected system message in prompt: ${content}",prompt:G});case"user":{let j=V.map((B)=>{switch(B.type){case"text":return B.text}}).filter(Boolean).join("");U+=`${Y}:
|
|
5
5
|
${j}
|
|
@@ -9,4 +9,4 @@ ${j}
|
|
|
9
9
|
|
|
10
10
|
`;break}case"tool":throw new T({functionality:"tool messages"});default:throw Error(`Unsupported role: ${z}`)}return U+=`${Z}:
|
|
11
11
|
`,{prompt:U,stopSequences:[`
|
|
12
|
-
${Y}:`]}}function VG({id:G,model:Y,created:Z}){return{id:G!=null?G:void 0,modelId:Y!=null?Y:void 0,timestamp:Z!=null?new Date(Z*1000):void 0}}function WG(G){switch(G){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"other"}}var EG=Q.object({echo:Q.boolean().optional(),logitBias:Q.record(Q.string(),Q.number()).optional(),suffix:Q.string().optional(),user:Q.string().optional()}),CG=class{constructor(G,Y){this.specificationVersion="v3";var Z;this.modelId=G,this.config=Y;let U=(Z=Y.errorStructure)!=null?Z:m;this.chunkSchema=uG(U.errorSchema),this.failedResponseHandler=f(U)}get provider(){return this.config.provider}get providerOptionsName(){return this.config.provider.split(".")[0].trim()}get supportedUrls(){var G,Y,Z;return(Z=(Y=(G=this.config).supportedUrls)==null?void 0:Y.call(G))!=null?Z:{}}async getArgs({prompt:G,maxOutputTokens:Y,temperature:Z,topP:U,topK:z,frequencyPenalty:V,presencePenalty:j,stopSequences:B,responseFormat:H,seed:X,providerOptions:L,tools:$,toolChoice:J}){var E,A;let P=[],K=Object.assign((E=await R({provider:this.providerOptionsName,providerOptions:L,schema:EG}))!=null?E:{},(A=await R({provider:h(this.providerOptionsName),providerOptions:L,schema:EG}))!=null?A:{});if(z!=null)P.push({type:"unsupported",feature:"topK"});if($==null?void 0:$.length)P.push({type:"unsupported",feature:"tools"});if(J!=null)P.push({type:"unsupported",feature:"toolChoice"});if(H!=null&&H.type!=="text")P.push({type:"unsupported",feature:"responseFormat",details:"JSON response format is not supported."});let{prompt:W,stopSequences:N}=vG({prompt:G}),x=[...N!=null?N:[],...B!=null?B:[]];return{args:{model:this.modelId,echo:K.echo,logit_bias:K.logitBias,suffix:K.suffix,user:K.user,max_tokens:Y,temperature:Z,top_p:U,frequency_penalty:V,presence_penalty:j,seed:X,...L==null?void 0:L[this.providerOptionsName],...L==null?void 0:L[h(this.providerOptionsName)],prompt:W,stop:x.length>0?x:void 0},warnings:P}}async doGenerate(G){let{args:Y,warnings:Z}=await this.getArgs(G),{responseHeaders:U,value:z,rawValue:V}=await b({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:y(this.config.headers(),G.headers),body:Y,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:O(hG),abortSignal:G.abortSignal,fetch:this.config.fetch}),j=z.choices[0],B=[];if(j.text!=null&&j.text.length>0)B.push({type:"text",text:j.text});return{content:B,usage:BG(z.usage),finishReason:{unified:WG(j.finish_reason),raw:j.finish_reason},request:{body:Y},response:{...VG(z),headers:U,body:V},warnings:Z}}async doStream(G){let{args:Y,warnings:Z}=await this.getArgs(G),U={...Y,stream:!0,stream_options:this.config.includeUsage?{include_usage:!0}:void 0},{responseHeaders:z,value:V}=await b({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:y(this.config.headers(),G.headers),body:U,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:s(this.chunkSchema),abortSignal:G.abortSignal,fetch:this.config.fetch}),j={unified:"other",raw:void 0},B=void 0,H=!0;return{stream:V.pipeThrough(new TransformStream({start(X){X.enqueue({type:"stream-start",warnings:Z})},transform(X,L){var $;if(G.includeRawChunks)L.enqueue({type:"raw",rawValue:X.rawValue});if(!X.success){j={unified:"error",raw:void 0},L.enqueue({type:"error",error:X.error});return}let J=X.value;if("error"in J){j={unified:"error",raw:void 0},L.enqueue({type:"error",error:J.error});return}if(H)H=!1,L.enqueue({type:"response-metadata",...VG(J)}),L.enqueue({type:"text-start",id:"0"});if(J.usage!=null)B=J.usage;let E=J.choices[0];if((E==null?void 0:E.finish_reason)!=null)j={unified:WG(E.finish_reason),raw:($=E.finish_reason)!=null?$:void 0};if((E==null?void 0:E.text)!=null)L.enqueue({type:"text-delta",id:"0",delta:E.text})},flush(X){if(!H)X.enqueue({type:"text-end",id:"0"});X.enqueue({type:"finish",finishReason:j,usage:BG(B)})}})),request:{body:U},response:{headers:z}}}},wG=Q.object({prompt_tokens:Q.number(),completion_tokens:Q.number(),total_tokens:Q.number()}),hG=Q.object({id:Q.string().nullish(),created:Q.number().nullish(),model:Q.string().nullish(),choices:Q.array(Q.object({text:Q.string(),finish_reason:Q.string()})),usage:wG.nullish()}),uG=(G)=>Q.union([Q.object({id:Q.string().nullish(),created:Q.number().nullish(),model:Q.string().nullish(),choices:Q.array(Q.object({text:Q.string(),finish_reason:Q.string().nullish(),index:Q.number()})),usage:wG.nullish()}),G]),a=Q.object({dimensions:Q.number().optional(),user:Q.string().optional()}),gG=class{constructor(G,Y){this.specificationVersion="v3",this.modelId=G,this.config=Y}get provider(){return this.config.provider}get maxEmbeddingsPerCall(){var G;return(G=this.config.maxEmbeddingsPerCall)!=null?G:2048}get supportsParallelCalls(){var G;return(G=this.config.supportsParallelCalls)!=null?G:!0}get providerOptionsName(){return this.config.provider.split(".")[0].trim()}async doEmbed({values:G,headers:Y,abortSignal:Z,providerOptions:U}){var z,V,j;let B=[],H=await R({provider:"openai-compatible",providerOptions:U,schema:a});if(H!=null)B.push({type:"other",message:"The 'openai-compatible' key in providerOptions is deprecated. Use 'openaiCompatible' instead."});let X=Object.assign(H!=null?H:{},(z=await R({provider:"openaiCompatible",providerOptions:U,schema:a}))!=null?z:{},(V=await R({provider:this.providerOptionsName,providerOptions:U,schema:a}))!=null?V:{});if(G.length>this.maxEmbeddingsPerCall)throw new PG({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:G});let{responseHeaders:L,value:$,rawValue:J}=await b({url:this.config.url({path:"/embeddings",modelId:this.modelId}),headers:y(this.config.headers(),Y),body:{model:this.modelId,input:G,encoding_format:"float",dimensions:X.dimensions,user:X.user},failedResponseHandler:f((j=this.config.errorStructure)!=null?j:m),successfulResponseHandler:O(_G),abortSignal:Z,fetch:this.config.fetch});return{warnings:B,embeddings:$.data.map((E)=>E.embedding),usage:$.usage?{tokens:$.usage.prompt_tokens}:void 0,providerMetadata:$.providerMetadata,response:{headers:L,body:J}}}},_G=Q.object({data:Q.array(Q.object({embedding:Q.array(Q.number())})),usage:Q.object({prompt_tokens:Q.number()}).nullish(),providerMetadata:Q.record(Q.string(),Q.record(Q.string(),Q.any())).optional()}),mG=class{constructor(G,Y){this.modelId=G,this.config=Y,this.specificationVersion="v3",this.maxImagesPerCall=10}get provider(){return this.config.provider}get providerOptionsKey(){return this.config.provider.split(".")[0].trim()}getArgs(G){return{...G[this.providerOptionsKey],...G[h(this.providerOptionsKey)]}}async doGenerate({prompt:G,n:Y,size:Z,aspectRatio:U,seed:z,providerOptions:V,headers:j,abortSignal:B,files:H,mask:X}){var L,$,J,E,A;let P=[];if(U!=null)P.push({type:"unsupported",feature:"aspectRatio",details:"This model does not support aspect ratio. Use `size` instead."});if(z!=null)P.push({type:"unsupported",feature:"seed"});let K=(J=($=(L=this.config._internal)==null?void 0:L.currentDate)==null?void 0:$.call(L))!=null?J:new Date,W=this.getArgs(V);if(H!=null&&H.length>0){let{value:D,responseHeaders:w}=await xG({url:this.config.url({path:"/images/edits",modelId:this.modelId}),headers:y(this.config.headers(),j),formData:qG({model:this.modelId,prompt:G,image:await Promise.all(H.map((q)=>KG(q))),mask:X!=null?await KG(X):void 0,n:Y,size:Z,...W}),failedResponseHandler:f((E=this.config.errorStructure)!=null?E:m),successfulResponseHandler:O(HG),abortSignal:B,fetch:this.config.fetch});return{images:D.data.map((q)=>q.b64_json),warnings:P,response:{timestamp:K,modelId:this.modelId,headers:w}}}let{value:N,responseHeaders:x}=await b({url:this.config.url({path:"/images/generations",modelId:this.modelId}),headers:y(this.config.headers(),j),body:{model:this.modelId,prompt:G,n:Y,size:Z,...W,response_format:"b64_json"},failedResponseHandler:f((A=this.config.errorStructure)!=null?A:m),successfulResponseHandler:O(HG),abortSignal:B,fetch:this.config.fetch});return{images:N.data.map((D)=>D.b64_json),warnings:P,response:{timestamp:K,modelId:this.modelId,headers:x}}}},HG=Q.object({data:Q.array(Q.object({b64_json:Q.string()}))});async function KG(G){if(G.type==="url")return NG(G.url);let Y=G.data instanceof Uint8Array?G.data:l(G.data);return new Blob([Y],{type:G.mediaType})}var dG="2.0.41";function jQ(G){let Y=IG(G.baseURL),Z=G.name,U={...G.apiKey&&{Authorization:`Bearer ${G.apiKey}`},...G.headers},z=()=>DG(U,`ai-sdk/openai-compatible/${dG}`),V=(J)=>({provider:`${Z}.${J}`,url:({path:E})=>{let A=new URL(`${Y}${E}`);if(G.queryParams)A.search=new URLSearchParams(G.queryParams).toString();return A.toString()},headers:z,fetch:G.fetch}),j=(J)=>B(J),B=(J)=>new bG(J,{...V("chat"),includeUsage:G.includeUsage,supportsStructuredOutputs:G.supportsStructuredOutputs,transformRequestBody:G.transformRequestBody,metadataExtractor:G.metadataExtractor}),H=(J)=>new CG(J,{...V("completion"),includeUsage:G.includeUsage}),X=(J)=>new gG(J,{...V("embedding")}),L=(J)=>new mG(J,V("image")),$=(J)=>j(J);return $.specificationVersion="v3",$.languageModel=j,$.chatModel=B,$.completionModel=H,$.embeddingModel=X,$.textEmbeddingModel=X,$.imageModel=L,$}export{bG as
|
|
12
|
+
${Y}:`]}}function VG({id:G,model:Y,created:Z}){return{id:G!=null?G:void 0,modelId:Y!=null?Y:void 0,timestamp:Z!=null?new Date(Z*1000):void 0}}function WG(G){switch(G){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"other"}}var EG=Q.object({echo:Q.boolean().optional(),logitBias:Q.record(Q.string(),Q.number()).optional(),suffix:Q.string().optional(),user:Q.string().optional()}),CG=class{constructor(G,Y){this.specificationVersion="v3";var Z;this.modelId=G,this.config=Y;let U=(Z=Y.errorStructure)!=null?Z:m;this.chunkSchema=uG(U.errorSchema),this.failedResponseHandler=f(U)}get provider(){return this.config.provider}get providerOptionsName(){return this.config.provider.split(".")[0].trim()}get supportedUrls(){var G,Y,Z;return(Z=(Y=(G=this.config).supportedUrls)==null?void 0:Y.call(G))!=null?Z:{}}async getArgs({prompt:G,maxOutputTokens:Y,temperature:Z,topP:U,topK:z,frequencyPenalty:V,presencePenalty:j,stopSequences:B,responseFormat:H,seed:X,providerOptions:L,tools:$,toolChoice:J}){var E,A;let P=[],K=Object.assign((E=await R({provider:this.providerOptionsName,providerOptions:L,schema:EG}))!=null?E:{},(A=await R({provider:h(this.providerOptionsName),providerOptions:L,schema:EG}))!=null?A:{});if(z!=null)P.push({type:"unsupported",feature:"topK"});if($==null?void 0:$.length)P.push({type:"unsupported",feature:"tools"});if(J!=null)P.push({type:"unsupported",feature:"toolChoice"});if(H!=null&&H.type!=="text")P.push({type:"unsupported",feature:"responseFormat",details:"JSON response format is not supported."});let{prompt:W,stopSequences:N}=vG({prompt:G}),x=[...N!=null?N:[],...B!=null?B:[]];return{args:{model:this.modelId,echo:K.echo,logit_bias:K.logitBias,suffix:K.suffix,user:K.user,max_tokens:Y,temperature:Z,top_p:U,frequency_penalty:V,presence_penalty:j,seed:X,...L==null?void 0:L[this.providerOptionsName],...L==null?void 0:L[h(this.providerOptionsName)],prompt:W,stop:x.length>0?x:void 0},warnings:P}}async doGenerate(G){let{args:Y,warnings:Z}=await this.getArgs(G),{responseHeaders:U,value:z,rawValue:V}=await b({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:y(this.config.headers(),G.headers),body:Y,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:O(hG),abortSignal:G.abortSignal,fetch:this.config.fetch}),j=z.choices[0],B=[];if(j.text!=null&&j.text.length>0)B.push({type:"text",text:j.text});return{content:B,usage:BG(z.usage),finishReason:{unified:WG(j.finish_reason),raw:j.finish_reason},request:{body:Y},response:{...VG(z),headers:U,body:V},warnings:Z}}async doStream(G){let{args:Y,warnings:Z}=await this.getArgs(G),U={...Y,stream:!0,stream_options:this.config.includeUsage?{include_usage:!0}:void 0},{responseHeaders:z,value:V}=await b({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:y(this.config.headers(),G.headers),body:U,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:s(this.chunkSchema),abortSignal:G.abortSignal,fetch:this.config.fetch}),j={unified:"other",raw:void 0},B=void 0,H=!0;return{stream:V.pipeThrough(new TransformStream({start(X){X.enqueue({type:"stream-start",warnings:Z})},transform(X,L){var $;if(G.includeRawChunks)L.enqueue({type:"raw",rawValue:X.rawValue});if(!X.success){j={unified:"error",raw:void 0},L.enqueue({type:"error",error:X.error});return}let J=X.value;if("error"in J){j={unified:"error",raw:void 0},L.enqueue({type:"error",error:J.error});return}if(H)H=!1,L.enqueue({type:"response-metadata",...VG(J)}),L.enqueue({type:"text-start",id:"0"});if(J.usage!=null)B=J.usage;let E=J.choices[0];if((E==null?void 0:E.finish_reason)!=null)j={unified:WG(E.finish_reason),raw:($=E.finish_reason)!=null?$:void 0};if((E==null?void 0:E.text)!=null)L.enqueue({type:"text-delta",id:"0",delta:E.text})},flush(X){if(!H)X.enqueue({type:"text-end",id:"0"});X.enqueue({type:"finish",finishReason:j,usage:BG(B)})}})),request:{body:U},response:{headers:z}}}},wG=Q.object({prompt_tokens:Q.number(),completion_tokens:Q.number(),total_tokens:Q.number()}),hG=Q.object({id:Q.string().nullish(),created:Q.number().nullish(),model:Q.string().nullish(),choices:Q.array(Q.object({text:Q.string(),finish_reason:Q.string()})),usage:wG.nullish()}),uG=(G)=>Q.union([Q.object({id:Q.string().nullish(),created:Q.number().nullish(),model:Q.string().nullish(),choices:Q.array(Q.object({text:Q.string(),finish_reason:Q.string().nullish(),index:Q.number()})),usage:wG.nullish()}),G]),a=Q.object({dimensions:Q.number().optional(),user:Q.string().optional()}),gG=class{constructor(G,Y){this.specificationVersion="v3",this.modelId=G,this.config=Y}get provider(){return this.config.provider}get maxEmbeddingsPerCall(){var G;return(G=this.config.maxEmbeddingsPerCall)!=null?G:2048}get supportsParallelCalls(){var G;return(G=this.config.supportsParallelCalls)!=null?G:!0}get providerOptionsName(){return this.config.provider.split(".")[0].trim()}async doEmbed({values:G,headers:Y,abortSignal:Z,providerOptions:U}){var z,V,j;let B=[],H=await R({provider:"openai-compatible",providerOptions:U,schema:a});if(H!=null)B.push({type:"other",message:"The 'openai-compatible' key in providerOptions is deprecated. Use 'openaiCompatible' instead."});let X=Object.assign(H!=null?H:{},(z=await R({provider:"openaiCompatible",providerOptions:U,schema:a}))!=null?z:{},(V=await R({provider:this.providerOptionsName,providerOptions:U,schema:a}))!=null?V:{});if(G.length>this.maxEmbeddingsPerCall)throw new PG({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:G});let{responseHeaders:L,value:$,rawValue:J}=await b({url:this.config.url({path:"/embeddings",modelId:this.modelId}),headers:y(this.config.headers(),Y),body:{model:this.modelId,input:G,encoding_format:"float",dimensions:X.dimensions,user:X.user},failedResponseHandler:f((j=this.config.errorStructure)!=null?j:m),successfulResponseHandler:O(_G),abortSignal:Z,fetch:this.config.fetch});return{warnings:B,embeddings:$.data.map((E)=>E.embedding),usage:$.usage?{tokens:$.usage.prompt_tokens}:void 0,providerMetadata:$.providerMetadata,response:{headers:L,body:J}}}},_G=Q.object({data:Q.array(Q.object({embedding:Q.array(Q.number())})),usage:Q.object({prompt_tokens:Q.number()}).nullish(),providerMetadata:Q.record(Q.string(),Q.record(Q.string(),Q.any())).optional()}),mG=class{constructor(G,Y){this.modelId=G,this.config=Y,this.specificationVersion="v3",this.maxImagesPerCall=10}get provider(){return this.config.provider}get providerOptionsKey(){return this.config.provider.split(".")[0].trim()}getArgs(G){return{...G[this.providerOptionsKey],...G[h(this.providerOptionsKey)]}}async doGenerate({prompt:G,n:Y,size:Z,aspectRatio:U,seed:z,providerOptions:V,headers:j,abortSignal:B,files:H,mask:X}){var L,$,J,E,A;let P=[];if(U!=null)P.push({type:"unsupported",feature:"aspectRatio",details:"This model does not support aspect ratio. Use `size` instead."});if(z!=null)P.push({type:"unsupported",feature:"seed"});let K=(J=($=(L=this.config._internal)==null?void 0:L.currentDate)==null?void 0:$.call(L))!=null?J:new Date,W=this.getArgs(V);if(H!=null&&H.length>0){let{value:D,responseHeaders:w}=await xG({url:this.config.url({path:"/images/edits",modelId:this.modelId}),headers:y(this.config.headers(),j),formData:qG({model:this.modelId,prompt:G,image:await Promise.all(H.map((q)=>KG(q))),mask:X!=null?await KG(X):void 0,n:Y,size:Z,...W}),failedResponseHandler:f((E=this.config.errorStructure)!=null?E:m),successfulResponseHandler:O(HG),abortSignal:B,fetch:this.config.fetch});return{images:D.data.map((q)=>q.b64_json),warnings:P,response:{timestamp:K,modelId:this.modelId,headers:w}}}let{value:N,responseHeaders:x}=await b({url:this.config.url({path:"/images/generations",modelId:this.modelId}),headers:y(this.config.headers(),j),body:{model:this.modelId,prompt:G,n:Y,size:Z,...W,response_format:"b64_json"},failedResponseHandler:f((A=this.config.errorStructure)!=null?A:m),successfulResponseHandler:O(HG),abortSignal:B,fetch:this.config.fetch});return{images:N.data.map((D)=>D.b64_json),warnings:P,response:{timestamp:K,modelId:this.modelId,headers:x}}}},HG=Q.object({data:Q.array(Q.object({b64_json:Q.string()}))});async function KG(G){if(G.type==="url")return NG(G.url);let Y=G.data instanceof Uint8Array?G.data:l(G.data);return new Blob([Y],{type:G.mediaType})}var dG="2.0.41";function jQ(G){let Y=IG(G.baseURL),Z=G.name,U={...G.apiKey&&{Authorization:`Bearer ${G.apiKey}`},...G.headers},z=()=>DG(U,`ai-sdk/openai-compatible/${dG}`),V=(J)=>({provider:`${Z}.${J}`,url:({path:E})=>{let A=new URL(`${Y}${E}`);if(G.queryParams)A.search=new URLSearchParams(G.queryParams).toString();return A.toString()},headers:z,fetch:G.fetch}),j=(J)=>B(J),B=(J)=>new bG(J,{...V("chat"),includeUsage:G.includeUsage,supportsStructuredOutputs:G.supportsStructuredOutputs,transformRequestBody:G.transformRequestBody,metadataExtractor:G.metadataExtractor}),H=(J)=>new CG(J,{...V("completion"),includeUsage:G.includeUsage}),X=(J)=>new gG(J,{...V("embedding")}),L=(J)=>new mG(J,V("image")),$=(J)=>j(J);return $.specificationVersion="v3",$.languageModel=j,$.chatModel=B,$.completionModel=H,$.embeddingModel=X,$.textEmbeddingModel=X,$.imageModel=L,$}export{bG as zp,CG as Ap,gG as Bp,mG as Cp,dG as Dp,jQ as Ep};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Cf as P}from"./chunk-dwkrqtbc.js";import"./chunk-rwnwjm82.js";import{Kf as Q}from"./chunk-35fj1sfm.js";import{wO as W,xO as J}from"./chunk-e0vrxetq.js";class M{bytes;constructor(e){if(this.bytes=e,e.byteLength!==8)throw Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776000||e<-9223372036854776000)throw Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let t=new Uint8Array(8);for(let r=7,n=Math.abs(Math.round(e));r>-1&&n>0;r--,n/=256)t[r]=n;if(e<0)A(t);return new M(t)}valueOf(){let e=this.bytes.slice(0),t=e[0]&128;if(t)A(e);return parseInt(b.toHex(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}function A(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1;t--)if(e[t]++,e[t]!==0)break}class I{toUtf8;fromUtf8;constructor(e,t){this.toUtf8=e,this.fromUtf8=t}format(e){let t=[];for(let s of Object.keys(e)){let a=this.fromUtf8(s);t.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(e[s]))}let r=new Uint8Array(t.reduce((s,a)=>s+a.byteLength,0)),n=0;for(let s of t)r.set(s,n),n+=s.byteLength;return r}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":let t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":let r=new DataView(new ArrayBuffer(5));return r.setUint8(0,4),r.setInt32(1,e.value,!1),new Uint8Array(r.buffer);case"long":let n=new Uint8Array(9);return n[0]=5,n.set(e.value.bytes,1),n;case"binary":let s=new DataView(new ArrayBuffer(3+e.value.byteLength));s.setUint8(0,6),s.setUint16(1,e.value.byteLength,!1);let a=new Uint8Array(s.buffer);return a.set(e.value,3),a;case"string":let l=this.fromUtf8(e.value),i=new DataView(new ArrayBuffer(3+l.byteLength));i.setUint8(0,7),i.setUint16(1,l.byteLength,!1);let f=new Uint8Array(i.buffer);return f.set(l,3),f;case"timestamp":let h=new Uint8Array(9);return h[0]=8,h.set(M.fromNumber(e.value.valueOf()).bytes,1),h;case"uuid":if(!te.test(e.value))throw Error(`Invalid UUID received: ${e.value}`);let u=new Uint8Array(17);return u[0]=9,u.set(b.fromHex(e.value.replace(/\-/g,"")),1),u}}parse(e){let t={},r=0;while(r<e.byteLength){let n=e.getUint8(r++),s=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+r,n));switch(r+=n,e.getUint8(r++)){case 0:t[s]={type:F,value:!0};break;case 1:t[s]={type:F,value:!1};break;case 2:t[s]={type:X,value:e.getInt8(r++)};break;case 3:t[s]={type:Z,value:e.getInt16(r,!1)},r+=2;break;case 4:t[s]={type:V,value:e.getInt32(r,!1)},r+=4;break;case 5:t[s]={type:D,value:new M(new Uint8Array(e.buffer,e.byteOffset+r,8))},r+=8;break;case 6:let a=e.getUint16(r,!1);r+=2,t[s]={type:E,value:new Uint8Array(e.buffer,e.byteOffset+r,a)},r+=a;break;case 7:let l=e.getUint16(r,!1);r+=2,t[s]={type:_,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+r,l))},r+=l;break;case 8:t[s]={type:Y,value:new Date(new M(new Uint8Array(e.buffer,e.byteOffset+r,8)).valueOf())},r+=8;break;case 9:let i=new Uint8Array(e.buffer,e.byteOffset+r,16);r+=16,t[s]={type:ee,value:`${b.toHex(i.subarray(0,4))}-${b.toHex(i.subarray(4,6))}-${b.toHex(i.subarray(6,8))}-${b.toHex(i.subarray(8,10))}-${b.toHex(i.subarray(10))}`};break;default:throw Error("Unrecognized header type tag")}}return t}}function se({byteLength:e,byteOffset:t,buffer:r}){if(e<re)throw Error("Provided message too short to accommodate event stream message overhead");let n=new DataView(r,t,e),s=n.getUint32(0,!1);if(e!==s)throw Error("Reported message length does not match received message length");let a=n.getUint32(q,!1),l=n.getUint32(p,!1),i=n.getUint32(e-S,!1),f=new j.Crc32().update(new Uint8Array(r,t,p));if(l!==f.digest())throw Error(`The prelude checksum specified in the message (${l}) does not match the calculated CRC32 checksum (${f.digest()})`);if(f.update(new Uint8Array(r,t+p,e-(p+S))),i!==f.digest())throw Error(`The message checksum (${f.digest()}) did not match the expected value of ${i}`);return{headers:new DataView(r,t+p+S,a),body:new Uint8Array(r,t+p+S+a,s-a-(p+S+S))}}class x{headerMarshaller;messageBuffer;isEndOfStream;constructor(e,t){this.headerMarshaller=new I(e,t),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){let e=this.messageBuffer.pop(),t=this.isEndOfStream;return{getMessage(){return e},isEndOfStream(){return t}}}getAvailableMessages(){let e=this.messageBuffer;this.messageBuffer=[];let t=this.isEndOfStream;return{getMessages(){return e},isEndOfStream(){return t}}}encode({headers:e,body:t}){let r=this.headerMarshaller.format(e),n=r.byteLength+t.byteLength+16,s=new Uint8Array(n),a=new DataView(s.buffer,s.byteOffset,s.byteLength),l=new j.Crc32;return a.setUint32(0,n,!1),a.setUint32(4,r.byteLength,!1),a.setUint32(8,l.update(s.subarray(0,8)).digest(),!1),s.set(r,12),s.set(t,r.byteLength+12),a.setUint32(n-4,l.update(s.subarray(8,n-4)).digest(),!1),s}decode(e){let{headers:t,body:r}=se(e);return{headers:this.headerMarshaller.parse(t),body:r}}formatHeaders(e){return this.headerMarshaller.format(e)}}function H(e){let t=0,r=0,n=null,s=null,a=(i)=>{if(typeof i!=="number")throw Error("Attempted to allocate an event message where size was not a number: "+i);t=i,r=4,n=new Uint8Array(i),new DataView(n.buffer).setUint32(0,i,!1)},l=async function*(){let i=e[Symbol.asyncIterator]();while(!0){let{value:f,done:h}=await i.next();if(h){if(!t)return;else if(t===r)yield n;else throw Error("Truncated event message received.");return}let u=f.length,o=0;while(o<u){if(!n){let m=u-o;if(!s)s=new Uint8Array(4);let y=Math.min(4-r,m);if(s.set(f.slice(o,o+y),r),r+=y,o+=y,r<4)break;a(new DataView(s.buffer).getUint32(0,!1)),s=null}let c=Math.min(t-r,u-o);if(n.set(f.slice(o,o+c),r),r+=c,o+=c,t&&t===r)yield n,n=null,t=0,r=0}}};return{[Symbol.asyncIterator]:l}}function ne(e,t){let r=C(t.deserializer,t.toUtf8);return{[Symbol.asyncIterator]:async function*(){for await(let n of e){let s=t.eventStreamCodec.decode(n),a=await r(s);if(a===void 0)continue;yield a}}}}function C(e,t){return async function(r){let{value:n}=r.headers[":message-type"];if(n==="error"){let s=Error(r.headers[":error-message"].value||"UnknownError");throw s.name=r.headers[":error-code"].value,s}else if(n==="exception"){let s=r.headers[":exception-type"].value,a={[s]:r},l=await e(a);if(l.$unknown){let i=Error(t(r.body));throw i.name=s,i}throw l[s]}else if(n==="event"){let s={[r.headers[":event-type"].value]:r},a=await e(s);if(a.$unknown)return;return a}else throw Error(`Unrecognizable event type: ${r.headers[":event-type"].value}`)}}class N{universalMarshaller;constructor({utf8Encoder:e,utf8Decoder:t}){this.universalMarshaller=new O({utf8Decoder:t,utf8Encoder:e})}deserialize(e,t){let r=typeof e[Symbol.asyncIterator]==="function"?e:ie(e);return this.universalMarshaller.deserialize(r,t)}serialize(e,t){return R.Readable.from(this.universalMarshaller.serialize(e,t))}}async function*ie(e){let t=!1,r=!1,n=[];e.on("error",(s)=>{if(!t)t=!0;if(s)throw s}),e.on("data",(s)=>{n.push(s)}),e.on("end",()=>{t=!0});while(!r){let s=await new Promise((a)=>setTimeout(()=>a(n.shift()),0));if(s)yield s;r=t&&n.length===0}}class K{marshaller;serializer;deserializer;serdeContext;defaultContentType;constructor({marshaller:e,serializer:t,deserializer:r,serdeContext:n,defaultContentType:s}){this.marshaller=e,this.serializer=t,this.deserializer=r,this.serdeContext=n,this.defaultContentType=s}async serializeEventStream({eventStream:e,requestSchema:t,initialRequest:r}){let n=this.marshaller,s=t.getEventStreamMember(),a=t.getMemberSchema(s),l=this.serializer,i=this.defaultContentType,f=Symbol("initialRequestMarker"),h={async*[Symbol.asyncIterator](){if(r){let u={":event-type":{type:"string",value:"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:i}};l.write(t,r);let o=l.flush();yield{[f]:!0,headers:u,body:o}}for await(let u of e)yield u}};return n.serialize(h,(u)=>{if(u[f])return{headers:u.headers,body:u.body};let o="";for(let d in u)if(d!=="__type"){o=d;break}let{additionalHeaders:c,body:m,eventType:y,explicitPayloadContentType:g}=this.writeEventBody(o,a,u);return{headers:{":event-type":{type:"string",value:y},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:g??i},...c},body:m}})}async deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:r}){let n=this.marshaller,s=t.getEventStreamMember(),l=t.getMemberSchema(s).getMemberSchemas(),i=Symbol("initialResponseMarker"),f=n.deserialize(e.body,async(o)=>{let c="";for(let y in o)if(y!=="__type"){c=y;break}let m=o[c].body;if(c==="initial-response"){let y=await this.deserializer.read(t,m);return delete y[s],{[i]:!0,...y}}else if(c in l){let y=l[c];if(y.isStructSchema()){let g={},w=!1;for(let[d,U]of y.structIterator()){let{eventHeader:$,eventPayload:G}=U.getMergedTraits();if(w=w||Boolean($||G),G){if(U.isBlobSchema())g[d]=m;else if(U.isStringSchema())g[d]=(this.serdeContext?.utf8Encoder??b.toUtf8)(m);else if(U.isStructSchema())g[d]=await this.deserializer.read(U,m)}else if($){let v=o[c].headers[d]?.value;if(v!=null)if(U.isNumericSchema())if(v&&typeof v==="object"&&"bytes"in v)g[d]=BigInt(v.toString());else g[d]=Number(v);else g[d]=v}}if(w)return{[c]:g};if(m.byteLength===0)return{[c]:{}}}return{[c]:await this.deserializer.read(y,m)}}else return{$unknown:o}}),h=f[Symbol.asyncIterator](),u=await h.next();if(u.done)return f;if(u.value?.[i]){if(!t)throw Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");for(let o in u.value)r[o]=u.value[o]}return{async*[Symbol.asyncIterator](){if(!u?.value?.[i])yield u.value;while(!0){let{done:o,value:c}=await h.next();if(o)break;yield c}}}}writeEventBody(e,t,r){let n=this.serializer,s=e,a=null,l,i=(()=>{return t.getSchema()[4].includes(e)})(),f={};if(!i){let[o,c]=r[e];s=o,n.write(15,c)}else{let o=t.getMemberSchema(e);if(o.isStructSchema()){for(let[c,m]of o.structIterator()){let{eventHeader:y,eventPayload:g}=m.getMergedTraits();if(g)a=c;else if(y){let w=r[e][c],d="binary";if(m.isNumericSchema())if(-2147483648<=w&&w<=2147483647)d="integer";else d="long";else if(m.isTimestampSchema())d="timestamp";else if(m.isStringSchema())d="string";else if(m.isBooleanSchema())d="boolean";if(w!=null)f[c]={type:d,value:w},delete r[e][c]}}if(a!==null){let c=o.getMemberSchema(a);if(c.isBlobSchema())l="application/octet-stream";else if(c.isStringSchema())l="text/plain";n.write(c,r[e][a])}else n.write(o,r[e])}else if(o.isUnitSchema())n.write(o,{});else throw Error("@smithy/core/event-streams - non-struct member not supported in event stream union.")}let h=n.flush()??new Uint8Array;return{body:typeof h==="string"?(this.serdeContext?.utf8Decoder??b.fromUtf8)(h):h,eventType:s,explicitPayloadContentType:l,additionalHeaders:f}}}var j,b,R,L,F="boolean",X="byte",Z="short",V="integer",D="long",E="binary",_="string",Y="timestamp",ee="uuid",te,q=4,p,S=4,re,k,B,T,z,O=class{eventStreamCodec;utfEncoder;constructor({utf8Encoder:t,utf8Decoder:r}){this.eventStreamCodec=new x(t,r),this.utfEncoder=t}deserialize(t,r){let n=H(t);return new T({messageStream:new k({inputStream:n,decoder:this.eventStreamCodec}),deserializer:C(r,this.utfEncoder)})}serialize(t,r){return new B({messageStream:new z({inputStream:t,serializer:r}),encoder:this.eventStreamCodec,includeEndFrame:!0})}},ae=(e)=>new O(e),oe=(e)=>new N(e),ce=(e)=>({[Symbol.asyncIterator]:async function*(){let t=e.getReader();try{while(!0){let{done:r,value:n}=await t.read();if(r)return;yield n}}finally{t.releaseLock()}}}),le=(e)=>{let t=e[Symbol.asyncIterator]();return new ReadableStream({async pull(r){let{done:n,value:s}=await t.next();if(n)return r.close();r.enqueue(s)}})},ue=(e)=>Object.assign(e,{eventStreamMarshaller:e.eventStreamSerdeProvider(e)}),fe,ye,de,me,he,ge,we,be,pe,ve,Se,Ue,Me,Ie,xe,ke,Be,Te;var ze=W(()=>{j=P(),b=Q(),R=J("stream");(function(e){e[e.boolTrue=0]="boolTrue",e[e.boolFalse=1]="boolFalse",e[e.byte=2]="byte",e[e.short=3]="short",e[e.integer=4]="integer",e[e.long=5]="long",e[e.byteArray=6]="byteArray",e[e.string=7]="string",e[e.timestamp=8]="timestamp",e[e.uuid=9]="uuid"})(L||(L={}));te=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,p=q*2,re=p+S*2;k=class k{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.decoder.decode(e)}};B=class B{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream)yield this.options.encoder.encode(e);if(this.options.includeEndFrame)yield new Uint8Array(0)}};T=class T{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream){let t=await this.options.deserializer(e);if(t===void 0)continue;yield t}}};z=class z{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.serializer(e)}};fe=x,ye=N,de=K,me=I,he=M,ge=k,we=B,be=T,pe=z,ve=O,Se=oe,Ue=H,Me=C,Ie=ne,xe=le,ke=ce,Be=ue,Te=ae});ze();export{Te as universalEventStreamSerdeProvider,Be as resolveEventStreamSerdeConfig,ke as readableStreamToIterable,xe as iterableToReadableStream,Ie as getUnmarshalledStream,Me as getMessageUnmarshaller,Ue as getChunkedStream,Se as eventStreamSerdeProvider,ve as UniversalEventStreamMarshaller,pe as SmithyMessageEncoderStream,be as SmithyMessageDecoderStream,we as MessageEncoderStream,ge as MessageDecoderStream,he as Int64,me as HeaderMarshaller,de as EventStreamSerde,ye as EventStreamMarshaller,fe as EventStreamCodec};export default {get universalEventStreamSerdeProvider(){return Te},get resolveEventStreamSerdeConfig(){return Be},get readableStreamToIterable(){return ke},get iterableToReadableStream(){return xe},get getUnmarshalledStream(){return Ie},get getMessageUnmarshaller(){return Me},get getChunkedStream(){return Ue},get eventStreamSerdeProvider(){return Se},get UniversalEventStreamMarshaller(){return ve},get SmithyMessageEncoderStream(){return pe},get SmithyMessageDecoderStream(){return be},get MessageEncoderStream(){return we},get MessageDecoderStream(){return ge},get Int64(){return he},get HeaderMarshaller(){return me},get EventStreamSerde(){return de},get EventStreamMarshaller(){return ye},get EventStreamCodec(){return fe}};
|
|
2
|
+
import{xf as P}from"./chunk-vsfj16v9.js";import"./chunk-jbcqhw3x.js";import{Ff as Q}from"./chunk-2fbkw84y.js";import{tP as W,uP as J}from"./chunk-djfrkbd5.js";class M{bytes;constructor(e){if(this.bytes=e,e.byteLength!==8)throw Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776000||e<-9223372036854776000)throw Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let t=new Uint8Array(8);for(let r=7,n=Math.abs(Math.round(e));r>-1&&n>0;r--,n/=256)t[r]=n;if(e<0)A(t);return new M(t)}valueOf(){let e=this.bytes.slice(0),t=e[0]&128;if(t)A(e);return parseInt(b.toHex(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}function A(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1;t--)if(e[t]++,e[t]!==0)break}class I{toUtf8;fromUtf8;constructor(e,t){this.toUtf8=e,this.fromUtf8=t}format(e){let t=[];for(let s of Object.keys(e)){let a=this.fromUtf8(s);t.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(e[s]))}let r=new Uint8Array(t.reduce((s,a)=>s+a.byteLength,0)),n=0;for(let s of t)r.set(s,n),n+=s.byteLength;return r}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":let t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":let r=new DataView(new ArrayBuffer(5));return r.setUint8(0,4),r.setInt32(1,e.value,!1),new Uint8Array(r.buffer);case"long":let n=new Uint8Array(9);return n[0]=5,n.set(e.value.bytes,1),n;case"binary":let s=new DataView(new ArrayBuffer(3+e.value.byteLength));s.setUint8(0,6),s.setUint16(1,e.value.byteLength,!1);let a=new Uint8Array(s.buffer);return a.set(e.value,3),a;case"string":let l=this.fromUtf8(e.value),i=new DataView(new ArrayBuffer(3+l.byteLength));i.setUint8(0,7),i.setUint16(1,l.byteLength,!1);let f=new Uint8Array(i.buffer);return f.set(l,3),f;case"timestamp":let h=new Uint8Array(9);return h[0]=8,h.set(M.fromNumber(e.value.valueOf()).bytes,1),h;case"uuid":if(!te.test(e.value))throw Error(`Invalid UUID received: ${e.value}`);let u=new Uint8Array(17);return u[0]=9,u.set(b.fromHex(e.value.replace(/\-/g,"")),1),u}}parse(e){let t={},r=0;while(r<e.byteLength){let n=e.getUint8(r++),s=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+r,n));switch(r+=n,e.getUint8(r++)){case 0:t[s]={type:F,value:!0};break;case 1:t[s]={type:F,value:!1};break;case 2:t[s]={type:X,value:e.getInt8(r++)};break;case 3:t[s]={type:Z,value:e.getInt16(r,!1)},r+=2;break;case 4:t[s]={type:V,value:e.getInt32(r,!1)},r+=4;break;case 5:t[s]={type:D,value:new M(new Uint8Array(e.buffer,e.byteOffset+r,8))},r+=8;break;case 6:let a=e.getUint16(r,!1);r+=2,t[s]={type:E,value:new Uint8Array(e.buffer,e.byteOffset+r,a)},r+=a;break;case 7:let l=e.getUint16(r,!1);r+=2,t[s]={type:_,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+r,l))},r+=l;break;case 8:t[s]={type:Y,value:new Date(new M(new Uint8Array(e.buffer,e.byteOffset+r,8)).valueOf())},r+=8;break;case 9:let i=new Uint8Array(e.buffer,e.byteOffset+r,16);r+=16,t[s]={type:ee,value:`${b.toHex(i.subarray(0,4))}-${b.toHex(i.subarray(4,6))}-${b.toHex(i.subarray(6,8))}-${b.toHex(i.subarray(8,10))}-${b.toHex(i.subarray(10))}`};break;default:throw Error("Unrecognized header type tag")}}return t}}function se({byteLength:e,byteOffset:t,buffer:r}){if(e<re)throw Error("Provided message too short to accommodate event stream message overhead");let n=new DataView(r,t,e),s=n.getUint32(0,!1);if(e!==s)throw Error("Reported message length does not match received message length");let a=n.getUint32(q,!1),l=n.getUint32(p,!1),i=n.getUint32(e-S,!1),f=new j.Crc32().update(new Uint8Array(r,t,p));if(l!==f.digest())throw Error(`The prelude checksum specified in the message (${l}) does not match the calculated CRC32 checksum (${f.digest()})`);if(f.update(new Uint8Array(r,t+p,e-(p+S))),i!==f.digest())throw Error(`The message checksum (${f.digest()}) did not match the expected value of ${i}`);return{headers:new DataView(r,t+p+S,a),body:new Uint8Array(r,t+p+S+a,s-a-(p+S+S))}}class x{headerMarshaller;messageBuffer;isEndOfStream;constructor(e,t){this.headerMarshaller=new I(e,t),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){let e=this.messageBuffer.pop(),t=this.isEndOfStream;return{getMessage(){return e},isEndOfStream(){return t}}}getAvailableMessages(){let e=this.messageBuffer;this.messageBuffer=[];let t=this.isEndOfStream;return{getMessages(){return e},isEndOfStream(){return t}}}encode({headers:e,body:t}){let r=this.headerMarshaller.format(e),n=r.byteLength+t.byteLength+16,s=new Uint8Array(n),a=new DataView(s.buffer,s.byteOffset,s.byteLength),l=new j.Crc32;return a.setUint32(0,n,!1),a.setUint32(4,r.byteLength,!1),a.setUint32(8,l.update(s.subarray(0,8)).digest(),!1),s.set(r,12),s.set(t,r.byteLength+12),a.setUint32(n-4,l.update(s.subarray(8,n-4)).digest(),!1),s}decode(e){let{headers:t,body:r}=se(e);return{headers:this.headerMarshaller.parse(t),body:r}}formatHeaders(e){return this.headerMarshaller.format(e)}}function H(e){let t=0,r=0,n=null,s=null,a=(i)=>{if(typeof i!=="number")throw Error("Attempted to allocate an event message where size was not a number: "+i);t=i,r=4,n=new Uint8Array(i),new DataView(n.buffer).setUint32(0,i,!1)},l=async function*(){let i=e[Symbol.asyncIterator]();while(!0){let{value:f,done:h}=await i.next();if(h){if(!t)return;else if(t===r)yield n;else throw Error("Truncated event message received.");return}let u=f.length,o=0;while(o<u){if(!n){let m=u-o;if(!s)s=new Uint8Array(4);let y=Math.min(4-r,m);if(s.set(f.slice(o,o+y),r),r+=y,o+=y,r<4)break;a(new DataView(s.buffer).getUint32(0,!1)),s=null}let c=Math.min(t-r,u-o);if(n.set(f.slice(o,o+c),r),r+=c,o+=c,t&&t===r)yield n,n=null,t=0,r=0}}};return{[Symbol.asyncIterator]:l}}function ne(e,t){let r=C(t.deserializer,t.toUtf8);return{[Symbol.asyncIterator]:async function*(){for await(let n of e){let s=t.eventStreamCodec.decode(n),a=await r(s);if(a===void 0)continue;yield a}}}}function C(e,t){return async function(r){let{value:n}=r.headers[":message-type"];if(n==="error"){let s=Error(r.headers[":error-message"].value||"UnknownError");throw s.name=r.headers[":error-code"].value,s}else if(n==="exception"){let s=r.headers[":exception-type"].value,a={[s]:r},l=await e(a);if(l.$unknown){let i=Error(t(r.body));throw i.name=s,i}throw l[s]}else if(n==="event"){let s={[r.headers[":event-type"].value]:r},a=await e(s);if(a.$unknown)return;return a}else throw Error(`Unrecognizable event type: ${r.headers[":event-type"].value}`)}}class N{universalMarshaller;constructor({utf8Encoder:e,utf8Decoder:t}){this.universalMarshaller=new O({utf8Decoder:t,utf8Encoder:e})}deserialize(e,t){let r=typeof e[Symbol.asyncIterator]==="function"?e:ie(e);return this.universalMarshaller.deserialize(r,t)}serialize(e,t){return R.Readable.from(this.universalMarshaller.serialize(e,t))}}async function*ie(e){let t=!1,r=!1,n=[];e.on("error",(s)=>{if(!t)t=!0;if(s)throw s}),e.on("data",(s)=>{n.push(s)}),e.on("end",()=>{t=!0});while(!r){let s=await new Promise((a)=>setTimeout(()=>a(n.shift()),0));if(s)yield s;r=t&&n.length===0}}class K{marshaller;serializer;deserializer;serdeContext;defaultContentType;constructor({marshaller:e,serializer:t,deserializer:r,serdeContext:n,defaultContentType:s}){this.marshaller=e,this.serializer=t,this.deserializer=r,this.serdeContext=n,this.defaultContentType=s}async serializeEventStream({eventStream:e,requestSchema:t,initialRequest:r}){let n=this.marshaller,s=t.getEventStreamMember(),a=t.getMemberSchema(s),l=this.serializer,i=this.defaultContentType,f=Symbol("initialRequestMarker"),h={async*[Symbol.asyncIterator](){if(r){let u={":event-type":{type:"string",value:"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:i}};l.write(t,r);let o=l.flush();yield{[f]:!0,headers:u,body:o}}for await(let u of e)yield u}};return n.serialize(h,(u)=>{if(u[f])return{headers:u.headers,body:u.body};let o="";for(let d in u)if(d!=="__type"){o=d;break}let{additionalHeaders:c,body:m,eventType:y,explicitPayloadContentType:g}=this.writeEventBody(o,a,u);return{headers:{":event-type":{type:"string",value:y},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:g??i},...c},body:m}})}async deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:r}){let n=this.marshaller,s=t.getEventStreamMember(),l=t.getMemberSchema(s).getMemberSchemas(),i=Symbol("initialResponseMarker"),f=n.deserialize(e.body,async(o)=>{let c="";for(let y in o)if(y!=="__type"){c=y;break}let m=o[c].body;if(c==="initial-response"){let y=await this.deserializer.read(t,m);return delete y[s],{[i]:!0,...y}}else if(c in l){let y=l[c];if(y.isStructSchema()){let g={},w=!1;for(let[d,U]of y.structIterator()){let{eventHeader:$,eventPayload:G}=U.getMergedTraits();if(w=w||Boolean($||G),G){if(U.isBlobSchema())g[d]=m;else if(U.isStringSchema())g[d]=(this.serdeContext?.utf8Encoder??b.toUtf8)(m);else if(U.isStructSchema())g[d]=await this.deserializer.read(U,m)}else if($){let v=o[c].headers[d]?.value;if(v!=null)if(U.isNumericSchema())if(v&&typeof v==="object"&&"bytes"in v)g[d]=BigInt(v.toString());else g[d]=Number(v);else g[d]=v}}if(w)return{[c]:g};if(m.byteLength===0)return{[c]:{}}}return{[c]:await this.deserializer.read(y,m)}}else return{$unknown:o}}),h=f[Symbol.asyncIterator](),u=await h.next();if(u.done)return f;if(u.value?.[i]){if(!t)throw Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");for(let o in u.value)r[o]=u.value[o]}return{async*[Symbol.asyncIterator](){if(!u?.value?.[i])yield u.value;while(!0){let{done:o,value:c}=await h.next();if(o)break;yield c}}}}writeEventBody(e,t,r){let n=this.serializer,s=e,a=null,l,i=(()=>{return t.getSchema()[4].includes(e)})(),f={};if(!i){let[o,c]=r[e];s=o,n.write(15,c)}else{let o=t.getMemberSchema(e);if(o.isStructSchema()){for(let[c,m]of o.structIterator()){let{eventHeader:y,eventPayload:g}=m.getMergedTraits();if(g)a=c;else if(y){let w=r[e][c],d="binary";if(m.isNumericSchema())if(-2147483648<=w&&w<=2147483647)d="integer";else d="long";else if(m.isTimestampSchema())d="timestamp";else if(m.isStringSchema())d="string";else if(m.isBooleanSchema())d="boolean";if(w!=null)f[c]={type:d,value:w},delete r[e][c]}}if(a!==null){let c=o.getMemberSchema(a);if(c.isBlobSchema())l="application/octet-stream";else if(c.isStringSchema())l="text/plain";n.write(c,r[e][a])}else n.write(o,r[e])}else if(o.isUnitSchema())n.write(o,{});else throw Error("@smithy/core/event-streams - non-struct member not supported in event stream union.")}let h=n.flush()??new Uint8Array;return{body:typeof h==="string"?(this.serdeContext?.utf8Decoder??b.fromUtf8)(h):h,eventType:s,explicitPayloadContentType:l,additionalHeaders:f}}}var j,b,R,L,F="boolean",X="byte",Z="short",V="integer",D="long",E="binary",_="string",Y="timestamp",ee="uuid",te,q=4,p,S=4,re,k,B,T,z,O=class{eventStreamCodec;utfEncoder;constructor({utf8Encoder:t,utf8Decoder:r}){this.eventStreamCodec=new x(t,r),this.utfEncoder=t}deserialize(t,r){let n=H(t);return new T({messageStream:new k({inputStream:n,decoder:this.eventStreamCodec}),deserializer:C(r,this.utfEncoder)})}serialize(t,r){return new B({messageStream:new z({inputStream:t,serializer:r}),encoder:this.eventStreamCodec,includeEndFrame:!0})}},ae=(e)=>new O(e),oe=(e)=>new N(e),ce=(e)=>({[Symbol.asyncIterator]:async function*(){let t=e.getReader();try{while(!0){let{done:r,value:n}=await t.read();if(r)return;yield n}}finally{t.releaseLock()}}}),le=(e)=>{let t=e[Symbol.asyncIterator]();return new ReadableStream({async pull(r){let{done:n,value:s}=await t.next();if(n)return r.close();r.enqueue(s)}})},ue=(e)=>Object.assign(e,{eventStreamMarshaller:e.eventStreamSerdeProvider(e)}),fe,ye,de,me,he,ge,we,be,pe,ve,Se,Ue,Me,Ie,xe,ke,Be,Te;var ze=W(()=>{j=P(),b=Q(),R=J("stream");(function(e){e[e.boolTrue=0]="boolTrue",e[e.boolFalse=1]="boolFalse",e[e.byte=2]="byte",e[e.short=3]="short",e[e.integer=4]="integer",e[e.long=5]="long",e[e.byteArray=6]="byteArray",e[e.string=7]="string",e[e.timestamp=8]="timestamp",e[e.uuid=9]="uuid"})(L||(L={}));te=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,p=q*2,re=p+S*2;k=class k{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.decoder.decode(e)}};B=class B{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream)yield this.options.encoder.encode(e);if(this.options.includeEndFrame)yield new Uint8Array(0)}};T=class T{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream){let t=await this.options.deserializer(e);if(t===void 0)continue;yield t}}};z=class z{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.serializer(e)}};fe=x,ye=N,de=K,me=I,he=M,ge=k,we=B,be=T,pe=z,ve=O,Se=oe,Ue=H,Me=C,Ie=ne,xe=le,ke=ce,Be=ue,Te=ae});ze();export{Te as universalEventStreamSerdeProvider,Be as resolveEventStreamSerdeConfig,ke as readableStreamToIterable,xe as iterableToReadableStream,Ie as getUnmarshalledStream,Me as getMessageUnmarshaller,Ue as getChunkedStream,Se as eventStreamSerdeProvider,ve as UniversalEventStreamMarshaller,pe as SmithyMessageEncoderStream,be as SmithyMessageDecoderStream,we as MessageEncoderStream,ge as MessageDecoderStream,he as Int64,me as HeaderMarshaller,de as EventStreamSerde,ye as EventStreamMarshaller,fe as EventStreamCodec};export default {get universalEventStreamSerdeProvider(){return Te},get resolveEventStreamSerdeConfig(){return Be},get readableStreamToIterable(){return ke},get iterableToReadableStream(){return xe},get getUnmarshalledStream(){return Ie},get getMessageUnmarshaller(){return Me},get getChunkedStream(){return Ue},get eventStreamSerdeProvider(){return Se},get UniversalEventStreamMarshaller(){return ve},get SmithyMessageEncoderStream(){return pe},get SmithyMessageDecoderStream(){return be},get MessageEncoderStream(){return we},get MessageDecoderStream(){return ge},get Int64(){return he},get HeaderMarshaller(){return me},get EventStreamSerde(){return de},get EventStreamMarshaller(){return ye},get EventStreamCodec(){return fe}};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{z as
|
|
2
|
+
import{rP as q,uP as b}from"./chunk-djfrkbd5.js";var z=q((f)=>{Object.defineProperty(f,"__esModule",{value:!0});f.execAsync=void 0;var v=b("child_process"),w=b("util");f.execAsync=w.promisify(v.exec)});
|
|
3
|
+
export{z as oP};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{r as
|
|
2
|
+
import{ju as e}from"./chunk-15bjhfav.js";class r extends Error{static hasName(t,n){return typeof t==="object"&&t!==null&&"name"in t&&t.name===n}static create(t,n){let s=e.object({name:e.literal(t),data:n}).meta({ref:t}),o=class extends r{data;static Schema=s;name=t;constructor(a,c){super(t,c);this.data=a;this.name=t}static isInstance(a){return typeof a==="object"&&"name"in a&&a.name===t}schema(){return s}toObject(){return{name:t,data:this.data}}};return Object.defineProperty(o,"name",{value:t}),o}static Unknown=r.create("UnknownError",e.object({message:e.string(),diagnostic:e.object({errorID:e.string(),errorName:e.string(),logFile:e.string()}).optional()}))}
|
|
3
|
+
export{r as _s};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Qe as F}from"./chunk-tm79yrf3.js";import{af as z,df as B,uf as D}from"./chunk-vk35g121.js";import{Qq as x}from"./chunk-kec1xw1n.js";import"./chunk-cqtkxwd8.js";import"./chunk-x50adh71.js";import{Hu as q}from"./chunk-q4mtwv1w.js";import"./chunk-7a3txs9f.js";import"./chunk-djfrkbd5.js";var N="2.0.41",P=q.object({message:q.string(),type:q.string(),param:q.string(),code:q.string()}),Q={errorSchema:P,errorToMessage:(k)=>k.message};function T(k={}){var y;let G=D((y=k.baseURL)!=null?y:"https://api.cerebras.ai/v1"),J=()=>z({Authorization:`Bearer ${B({apiKey:k.apiKey,environmentVariableName:"CEREBRAS_API_KEY",description:"Cerebras API key"})}`,...k.headers},`ai-sdk/cerebras/${N}`),w=(j)=>{return new F(j,{provider:"cerebras.chat",url:({path:K})=>`${G}${K}`,headers:J,fetch:k.fetch,errorStructure:Q,supportsStructuredOutputs:!0})},f=(j)=>w(j);return f.specificationVersion="v3",f.languageModel=w,f.chat=w,f.embeddingModel=(j)=>{throw new x({modelId:j,modelType:"embeddingModel"})},f.textEmbeddingModel=f.embeddingModel,f.imageModel=(j)=>{throw new x({modelId:j,modelType:"imageModel"})},f}var Z=T();export{T as createCerebras,Z as cerebras,N as VERSION};
|