@qitqode/qitqode-android-arm64 0.2.10 → 0.2.11
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-06j0gaen.js +2 -0
- package/bundle/{chunk-1r81q7m3.js → chunk-075gkea2.js} +1 -1
- package/bundle/{chunk-9fjcgdea.js → chunk-09n24ztn.js} +1 -1
- package/bundle/chunk-0bn86djg.js +3 -0
- package/bundle/chunk-0mm40z8g.js +2 -0
- package/bundle/{chunk-mn5cacf6.js → chunk-0tya4pqb.js} +2 -2
- package/bundle/{chunk-ff8q10gk.js → chunk-1dnvdeat.js} +2 -2
- package/bundle/{chunk-kcqeh1e5.js → chunk-1h9sc0gy.js} +1 -1
- package/bundle/chunk-1mqfhw0f.js +2 -0
- package/bundle/{chunk-gq3zb4wv.js → chunk-1p39y33b.js} +2 -2
- package/bundle/{chunk-tg1f56s3.js → chunk-1pd943m9.js} +1 -1
- package/bundle/{chunk-qbewhcsz.js → chunk-1rsabv4p.js} +1 -1
- package/bundle/{chunk-vsfj16v9.js → chunk-1tdy73ha.js} +2 -2
- package/bundle/{chunk-3zzrdpsx.js → chunk-1yh1f9yj.js} +1 -1
- package/bundle/{chunk-62y6zk9x.js → chunk-22wa8zty.js} +1 -1
- package/bundle/chunk-28kte9rt.js +2 -0
- package/bundle/chunk-2dhjehxe.js +2 -0
- package/bundle/{chunk-dz3kcsb6.js → chunk-2h8b0csf.js} +2 -2
- package/bundle/chunk-2nnfxbd2.js +2 -0
- package/bundle/{chunk-g08qj9z3.js → chunk-2ts74cgq.js} +2 -2
- package/bundle/{chunk-0mwzxqt5.js → chunk-2vsqsxe1.js} +3 -3
- package/bundle/chunk-2w5zmgpb.js +2 -0
- package/bundle/{chunk-6wjdhvdf.js → chunk-32x2901e.js} +1 -1
- package/bundle/chunk-34qt3fqj.js +2 -0
- package/bundle/{chunk-by1kwg4r.js → chunk-3amgvg81.js} +2 -2
- package/bundle/{chunk-ge7csm6m.js → chunk-3hawwbw6.js} +2 -2
- package/bundle/chunk-3p0xvt47.js +2 -0
- package/bundle/chunk-3pzx5ret.js +2 -0
- package/bundle/{chunk-f6vy70p6.js → chunk-3tf7xfw5.js} +2 -2
- package/bundle/chunk-3y4rmqmm.js +2 -0
- package/bundle/{chunk-q0xgxygw.js → chunk-42gd2vx4.js} +1 -1
- package/bundle/{chunk-8rkszwxq.js → chunk-43eqr0ds.js} +6 -6
- package/bundle/{chunk-d1xfv4d3.js → chunk-43x9n8rp.js} +1 -1
- package/bundle/{chunk-kk850sdw.js → chunk-44685nzw.js} +2 -2
- package/bundle/{chunk-z023h7t8.js → chunk-46ewdxgh.js} +1 -1
- package/bundle/{chunk-v8bxj01h.js → chunk-4805mxf7.js} +1 -1
- package/bundle/chunk-486874bd.js +2 -0
- package/bundle/{chunk-0tkznq75.js → chunk-48y4n9ne.js} +1 -1
- package/bundle/{chunk-56yp5v0w.js → chunk-49brdmgp.js} +1 -1
- package/bundle/{chunk-ngyv4fhn.js → chunk-49we3vy1.js} +2 -2
- package/bundle/chunk-4bcbvfsw.js +2 -0
- package/bundle/{chunk-d0dsgxk4.js → chunk-4c6d1wy1.js} +2 -2
- package/bundle/{chunk-9tz18e54.js → chunk-4d9s7cgr.js} +1 -1
- package/bundle/{chunk-kec1xw1n.js → chunk-4ngvj758.js} +1 -1
- package/bundle/{chunk-pwsajn96.js → chunk-4q14whpc.js} +1 -1
- package/bundle/chunk-4t1ysdag.js +2 -0
- package/bundle/{chunk-nh4zk07t.js → chunk-50knjq36.js} +1 -1
- package/bundle/{chunk-9zy5tsry.js → chunk-51vn4f06.js} +3 -3
- package/bundle/{chunk-5fcyb122.js → chunk-5mgmq6yz.js} +1 -1
- package/bundle/chunk-5q7a4h2w.js +2 -0
- package/bundle/{chunk-dx7rexx3.js → chunk-5qydhr42.js} +3 -3
- package/bundle/{chunk-je8fcsa9.js → chunk-611wfdn3.js} +1 -1
- package/bundle/{chunk-9pj10pgd.js → chunk-63t0rhc9.js} +2 -2
- package/bundle/chunk-63vamhf7.js +2 -0
- package/bundle/chunk-6hhv3n7c.js +2 -0
- package/bundle/{chunk-gbkz04ke.js → chunk-6p848y99.js} +1 -1
- package/bundle/{chunk-tjfer79w.js → chunk-6xx66mr1.js} +1 -1
- package/bundle/{chunk-mmqyter3.js → chunk-71h3pmnn.js} +1 -1
- package/bundle/{chunk-yzd6cyep.js → chunk-78e76m4h.js} +1 -1
- package/bundle/{chunk-z0m1qm7j.js → chunk-78yvbv9b.js} +2 -2
- package/bundle/chunk-7a9kfb2n.js +2 -0
- package/bundle/{chunk-eme9xmh3.js → chunk-7b5vney6.js} +1 -1
- package/bundle/{chunk-yexzxx6f.js → chunk-7jvx29js.js} +1 -1
- package/bundle/{chunk-vy93mn7d.js → chunk-7wshaze9.js} +2 -2
- package/bundle/{chunk-q26s0wb5.js → chunk-7x4g7h04.js} +1 -1
- package/bundle/chunk-7x9m1smk.js +2 -0
- package/bundle/chunk-82mnr6sf.js +2 -0
- package/bundle/{chunk-mp1x10t5.js → chunk-84qx54nf.js} +2 -2
- package/bundle/{chunk-c1c8ch3g.js → chunk-88hmeyf5.js} +8 -8
- package/bundle/{chunk-vk35g121.js → chunk-89b6ttzs.js} +2 -2
- package/bundle/chunk-8bea2r6p.js +2 -0
- package/bundle/{chunk-fvv1cret.js → chunk-8gn7r4kb.js} +1 -1
- package/bundle/chunk-8h6mhzhg.js +2 -0
- package/bundle/chunk-8n1cmvr7.js +2 -0
- package/bundle/{chunk-e10c0crf.js → chunk-8qbhnwej.js} +1 -1
- package/bundle/{chunk-at4dge22.js → chunk-8rbbt1s8.js} +1 -1
- package/bundle/{chunk-6gbdvz6p.js → chunk-8rc7cvex.js} +1 -1
- package/bundle/{chunk-cdenq7jb.js → chunk-8t17w67q.js} +1 -1
- package/bundle/{chunk-qq9yc2tp.js → chunk-8y03p2md.js} +2 -2
- package/bundle/{chunk-m01h6kk1.js → chunk-8z65v9c9.js} +1 -1
- package/bundle/{chunk-f17se3hh.js → chunk-92xxg12q.js} +1 -1
- package/bundle/chunk-955zj1y6.js +2 -0
- package/bundle/{chunk-vbb1jg02.js → chunk-95tec4gm.js} +1 -1
- package/bundle/chunk-95vp9bvk.js +2 -0
- package/bundle/{chunk-eqpep2m2.js → chunk-96nmxprr.js} +1 -1
- package/bundle/{chunk-9nf5650d.js → chunk-98z5pfvj.js} +1 -1
- package/bundle/{chunk-xcmbxny8.js → chunk-9d2mtevw.js} +1 -1
- package/bundle/{chunk-c3ey896z.js → chunk-9d8meavf.js} +1 -1
- package/bundle/{chunk-fsndgr9a.js → chunk-9gs4en9v.js} +1 -1
- package/bundle/{chunk-djfrkbd5.js → chunk-9svh74gt.js} +1 -1
- package/bundle/chunk-9wzxnwv7.js +2 -0
- package/bundle/chunk-9zve998d.js +2 -0
- package/bundle/{chunk-yspstxkq.js → chunk-a2pd7nt5.js} +1 -1
- package/bundle/{chunk-pky8h8rh.js → chunk-a4cmpa56.js} +1 -1
- package/bundle/chunk-a9bkr9x4.js +2 -0
- package/bundle/chunk-ac5vzpzt.js +2 -0
- package/bundle/{chunk-532fnfmw.js → chunk-ajgwyrcf.js} +2 -2
- package/bundle/{chunk-c8k32724.js → chunk-ajyfms68.js} +1 -1
- package/bundle/{chunk-q7s6z0nz.js → chunk-akrcbxfa.js} +1 -1
- package/bundle/{chunk-ajnzv5jt.js → chunk-aykvrqrp.js} +2 -2
- package/bundle/{chunk-rk21wv4k.js → chunk-b274mb6v.js} +1 -1
- package/bundle/{chunk-5p2r8bxx.js → chunk-b79bb2g3.js} +1 -1
- package/bundle/{chunk-8nnajdwf.js → chunk-bd66q24j.js} +3 -3
- package/bundle/{chunk-qdbx1qkr.js → chunk-bffm0wv9.js} +1 -1
- package/bundle/{chunk-se8d5xg9.js → chunk-bh1zbz62.js} +1 -1
- package/bundle/{chunk-f3y5kr76.js → chunk-bqqxvagz.js} +2 -2
- package/bundle/{chunk-h6z86aay.js → chunk-bw0951fs.js} +1 -1
- package/bundle/{chunk-8peby2d1.js → chunk-bwzbcwff.js} +1 -1
- package/bundle/{chunk-wh2qqhep.js → chunk-bxc3z38f.js} +2 -2
- package/bundle/{chunk-ztvkzex1.js → chunk-bzz2expb.js} +1 -1
- package/bundle/chunk-c1exgasy.js +2 -0
- package/bundle/{chunk-qm9fm5ja.js → chunk-c53ev0da.js} +2 -2
- package/bundle/{chunk-wd2xmkdp.js → chunk-c5n49vrd.js} +2 -2
- package/bundle/{chunk-m4j6t713.js → chunk-ccghr6pm.js} +1 -1
- package/bundle/{chunk-j7637cwg.js → chunk-cg7zeppb.js} +2 -2
- package/bundle/chunk-cgxzmkkf.js +2 -0
- package/bundle/{chunk-1m78yy4k.js → chunk-cm7yp259.js} +1 -1
- package/bundle/chunk-cs3cbfm8.js +2 -0
- package/bundle/{chunk-x308f9j4.js → chunk-cshsqavb.js} +2 -2
- package/bundle/{chunk-vbfc0wgv.js → chunk-csmdhh7r.js} +2 -2
- package/bundle/{chunk-8v60bqm0.js → chunk-cydpdkx7.js} +1 -1
- package/bundle/{chunk-f6btedtt.js → chunk-czfjmrrq.js} +1 -1
- package/bundle/{chunk-a70m6kyn.js → chunk-d1j8frtq.js} +1 -1
- package/bundle/chunk-d29te4c1.js +2 -0
- package/bundle/{chunk-snf6ahg7.js → chunk-d39e4fa8.js} +1 -1
- package/bundle/chunk-d6q42p18.js +2 -0
- package/bundle/{chunk-f0ab2f28.js → chunk-d6qs2pbx.js} +1 -1
- package/bundle/{chunk-0bhzhh7s.js → chunk-datctfgt.js} +2 -2
- package/bundle/chunk-dfbexagg.js +2 -0
- package/bundle/chunk-dfkcp43a.js +2 -0
- package/bundle/chunk-dps1p1g1.js +2 -0
- package/bundle/{chunk-9d0exvey.js → chunk-dzw0j790.js} +2 -2
- package/bundle/chunk-e1fzgez5.js +2 -0
- package/bundle/{chunk-141p12c4.js → chunk-e5cds19n.js} +1 -1
- package/bundle/{chunk-nqk8d62j.js → chunk-e6ckxkj8.js} +1 -1
- package/bundle/{chunk-v0hnn7nb.js → chunk-e7a50j2w.js} +1 -1
- package/bundle/chunk-e9vh8d52.js +8 -0
- package/bundle/{chunk-j5z95b6f.js → chunk-eftk07r3.js} +1 -1
- package/bundle/chunk-egcvm4x2.js +3 -0
- package/bundle/chunk-ek3b08ed.js +2 -0
- package/bundle/{chunk-s27cz24e.js → chunk-ep92grvg.js} +52 -52
- package/bundle/{chunk-dnjyepb2.js → chunk-ex47pb9n.js} +2 -2
- package/bundle/{chunk-b9f78x5g.js → chunk-eya9c81t.js} +1 -1
- package/bundle/chunk-f78yth0b.js +2 -0
- package/bundle/{chunk-gbnf7zf9.js → chunk-fd6qxjtf.js} +1 -1
- package/bundle/{chunk-c8080519.js → chunk-fnmq42y5.js} +1 -1
- package/bundle/{chunk-nnkfdhh9.js → chunk-fqvrxy41.js} +1 -1
- package/bundle/{chunk-3sj0jv91.js → chunk-fqvsxg00.js} +1 -1
- package/bundle/{chunk-5w7ebtcd.js → chunk-fsagyvkz.js} +1 -1
- package/bundle/{chunk-gb51fn3r.js → chunk-fzxqn4j0.js} +1 -1
- package/bundle/{chunk-p506eydh.js → chunk-g7jwp73v.js} +1 -1
- package/bundle/{chunk-xnxw5zz9.js → chunk-g83d3a0t.js} +2 -2
- package/bundle/chunk-gamnnfna.js +2 -0
- package/bundle/{chunk-dp6ms01y.js → chunk-gfer8ch3.js} +2 -2
- package/bundle/{chunk-c2ns2csn.js → chunk-ghdegwnr.js} +1 -1
- package/bundle/chunk-gjxhz1a6.js +2 -0
- package/bundle/chunk-gpm39v12.js +2 -0
- package/bundle/chunk-gr8emzzx.js +2 -0
- package/bundle/chunk-gt6h68pk.js +2 -0
- package/bundle/{chunk-e72jwbfc.js → chunk-gz8k40ty.js} +1 -1
- package/bundle/{chunk-xvvt886p.js → chunk-h6kmpgak.js} +2 -2
- package/bundle/{chunk-2y5bthrp.js → chunk-h8yf5e2e.js} +1 -1
- package/bundle/{chunk-v8rqgt7h.js → chunk-hama2v6a.js} +1 -1
- package/bundle/{chunk-7a3txs9f.js → chunk-hav9pgf3.js} +2 -2
- package/bundle/chunk-hj588j4f.js +2 -0
- package/bundle/{chunk-c9cngded.js → chunk-hntsg7q4.js} +1 -1
- package/bundle/chunk-hqtex91e.js +2 -0
- package/bundle/{chunk-0sfc21qe.js → chunk-hts68y73.js} +2 -2
- package/bundle/{chunk-kc8n5cgb.js → chunk-j5dnzqjy.js} +1 -1
- package/bundle/{chunk-r81w6skn.js → chunk-j7d3v0x2.js} +1 -1
- package/bundle/{chunk-4a9jqe5s.js → chunk-jcn8bg31.js} +1 -1
- package/bundle/{chunk-2dmcpqak.js → chunk-jf4zyy7r.js} +1 -1
- package/bundle/{chunk-h0pvxre5.js → chunk-jfe9f2wv.js} +1 -1
- package/bundle/{chunk-8gpjmj42.js → chunk-jh2za7y4.js} +3 -3
- package/bundle/chunk-jmgpr5th.js +2 -0
- package/bundle/chunk-jt79yt0t.js +2 -0
- package/bundle/{chunk-7rbg6mg9.js → chunk-jt7g0r2j.js} +2 -2
- package/bundle/chunk-jtz5re73.js +2 -0
- package/bundle/{chunk-81dvy370.js → chunk-k232ny9m.js} +1 -1
- package/bundle/{chunk-t9pq363q.js → chunk-k4ajben7.js} +2 -2
- package/bundle/chunk-k4bj677f.js +3 -0
- package/bundle/{chunk-brk1jca3.js → chunk-k4d8gwxe.js} +1 -1
- package/bundle/{chunk-zskdxbbh.js → chunk-k558fr15.js} +1 -1
- package/bundle/{chunk-eabbrt1p.js → chunk-k56zj08h.js} +1 -1
- package/bundle/{chunk-61t4g8bh.js → chunk-k5swnh8m.js} +4 -4
- package/bundle/{chunk-gksbv613.js → chunk-k8zbhj2p.js} +2 -2
- package/bundle/{chunk-c8yc8qcd.js → chunk-kr975sx0.js} +1 -1
- package/bundle/{chunk-qdafm7qg.js → chunk-krk24aqm.js} +2 -2
- package/bundle/{chunk-3mtjxmw1.js → chunk-kt982884.js} +1 -1
- package/bundle/chunk-kw5z5awx.js +2 -0
- package/bundle/{chunk-vjt6mh10.js → chunk-kxdw2vtq.js} +2 -2
- package/bundle/{chunk-rxnd79h7.js → chunk-m8phqgxp.js} +1 -1
- package/bundle/{chunk-psqtptrs.js → chunk-mazakqr7.js} +1 -1
- package/bundle/{chunk-cxtwavyf.js → chunk-mnxcykeq.js} +2 -2
- package/bundle/chunk-mp42gb6q.js +2 -0
- package/bundle/{chunk-yh1t6jrj.js → chunk-mp5m0acf.js} +1 -1
- package/bundle/chunk-mq0733qh.js +2 -0
- package/bundle/chunk-mrcsatmn.js +2 -0
- package/bundle/{chunk-qtyapmy7.js → chunk-n230jbn9.js} +1 -1
- package/bundle/chunk-n24yx79r.js +5 -0
- package/bundle/{chunk-acsqvgdw.js → chunk-n2ytaxyn.js} +1 -1
- package/bundle/{chunk-819qr675.js → chunk-n4fwztya.js} +1 -1
- package/bundle/{chunk-z69tt390.js → chunk-n5dxwryh.js} +1 -1
- package/bundle/{chunk-xv03hbgj.js → chunk-n9969djm.js} +1 -1
- package/bundle/{chunk-pxm0x3e0.js → chunk-ncvr75f6.js} +2 -2
- package/bundle/chunk-ng2g9kkk.js +2 -0
- package/bundle/chunk-ngfhfyjs.js +2 -0
- package/bundle/{chunk-mn0pshpv.js → chunk-nvvja3ch.js} +1 -1
- package/bundle/{chunk-6axm2qtj.js → chunk-nwkp2f8e.js} +1 -1
- package/bundle/{chunk-d9w2bn2e.js → chunk-nwygsfhk.js} +2 -2
- package/bundle/chunk-p0dnmrqp.js +2 -0
- package/bundle/{chunk-x0hhw46n.js → chunk-p5p4jh9s.js} +1 -1
- package/bundle/chunk-p6h2ydcp.js +2 -0
- package/bundle/{chunk-e1x1mp9m.js → chunk-pcmsxhrb.js} +1 -1
- package/bundle/{chunk-rpdgn9z3.js → chunk-pdcj2rfz.js} +2 -2
- package/bundle/{chunk-t2r51r6v.js → chunk-pfd8gzy4.js} +1 -1
- package/bundle/{chunk-6y58jzak.js → chunk-ph46s66y.js} +1 -1
- package/bundle/{chunk-s05hqtx1.js → chunk-pkm3w0ks.js} +1 -1
- package/bundle/{chunk-dd461rg3.js → chunk-pnmadk2h.js} +1 -1
- package/bundle/{chunk-jt6bvxtr.js → chunk-q65qzc9w.js} +1 -1
- package/bundle/{chunk-qjw2zcq5.js → chunk-q8qx38kz.js} +1 -1
- package/bundle/chunk-qhakedgs.js +2 -0
- package/bundle/{chunk-xj0zc9za.js → chunk-qsgpbt4t.js} +1 -1
- package/bundle/{chunk-ccdjzn2m.js → chunk-qtdxy2q1.js} +3 -3
- package/bundle/chunk-r18zetwf.js +2 -0
- package/bundle/{chunk-3yfjgks3.js → chunk-r1936yb5.js} +1 -1
- package/bundle/{chunk-32xd626h.js → chunk-r4qpsa4e.js} +2 -2
- package/bundle/{chunk-azss4acq.js → chunk-r6055kk0.js} +2 -2
- package/bundle/chunk-r6rgrz25.js +2 -0
- package/bundle/{chunk-t5wdstzv.js → chunk-r9ng8xx5.js} +1 -1
- package/bundle/chunk-rk4vp09j.js +2 -0
- package/bundle/{chunk-e3mrw0k7.js → chunk-rkmg0gbq.js} +1 -1
- package/bundle/{chunk-9s5h0f1y.js → chunk-rpc0he6b.js} +2 -2
- package/bundle/{chunk-h2p984qb.js → chunk-rvev3cy6.js} +2 -2
- package/bundle/{chunk-waa781eh.js → chunk-rx29zmw2.js} +1 -1
- package/bundle/{chunk-5nm5egq0.js → chunk-rxh160jr.js} +2 -2
- package/bundle/{chunk-k10rtgsk.js → chunk-s3hbwksw.js} +1 -1
- package/bundle/{chunk-atacnspd.js → chunk-s3zmxfz2.js} +2 -2
- package/bundle/chunk-s4jp4zce.js +2 -0
- package/bundle/{chunk-qyan69nb.js → chunk-s6vhscvd.js} +2 -2
- package/bundle/{chunk-hgm8yfcb.js → chunk-s81ck6bw.js} +1 -1
- package/bundle/{chunk-3vae1s42.js → chunk-sbj816s8.js} +1 -1
- package/bundle/chunk-sec9y622.js +2 -0
- package/bundle/{chunk-dzma8zvf.js → chunk-seda5sfd.js} +2 -2
- package/bundle/{chunk-tm79yrf3.js → chunk-sjtq9bbb.js} +2 -2
- package/bundle/chunk-sn7q178t.js +2 -0
- package/bundle/chunk-st0h54dm.js +2 -0
- package/bundle/{chunk-b8rzn48q.js → chunk-sxtfssjv.js} +1 -1
- package/bundle/chunk-sz75fx13.js +2 -0
- package/bundle/{chunk-pbanj1gk.js → chunk-t076hwsv.js} +2 -2
- package/bundle/{chunk-p6jf1fyt.js → chunk-t3e19wdp.js} +1 -1
- package/bundle/{chunk-v16n1fep.js → chunk-t7s475b2.js} +2 -2
- package/bundle/chunk-tefh2cgk.js +2 -0
- package/bundle/chunk-tfez99qv.js +2 -0
- package/bundle/chunk-tjk1hymv.js +2 -0
- package/bundle/{chunk-9bbwxp5d.js → chunk-tpw1ewqn.js} +1 -1
- package/bundle/{chunk-wecs14rz.js → chunk-tqnf1p88.js} +1 -1
- package/bundle/{chunk-pyf649pz.js → chunk-tyk97q7c.js} +1 -1
- package/bundle/chunk-tz1sv9kt.js +3 -0
- package/bundle/{chunk-2zjet9tx.js → chunk-tz60e15h.js} +2 -2
- package/bundle/{chunk-xstxdw7v.js → chunk-tzwm08yc.js} +1 -1
- package/bundle/chunk-v1098rqc.js +2 -0
- package/bundle/chunk-v30ezr68.js +11 -0
- package/bundle/{chunk-q8fjktv4.js → chunk-v5j3ypfv.js} +1 -1
- package/bundle/chunk-v5wn741w.js +2 -0
- package/bundle/{chunk-tdevq564.js → chunk-vamwvx0x.js} +1 -1
- package/bundle/{chunk-yce8ph5b.js → chunk-vbcekkw2.js} +2 -2
- package/bundle/{chunk-te91d271.js → chunk-vf75j9wd.js} +1 -1
- package/bundle/{chunk-4sa9t0vx.js → chunk-vhh80d5j.js} +2 -2
- package/bundle/{chunk-5rqjze1g.js → chunk-vm8htc6d.js} +1 -1
- package/bundle/{chunk-cs825mxr.js → chunk-vnz9n9z0.js} +1 -1
- package/bundle/chunk-vp6ttkct.js +2 -0
- package/bundle/chunk-vpcsmwsb.js +2 -0
- package/bundle/{chunk-gmq1kwn0.js → chunk-vrt8wd3r.js} +1 -1
- package/bundle/{chunk-1q10jyka.js → chunk-vyf77kq1.js} +2 -2
- package/bundle/{chunk-pchv413c.js → chunk-w32xhz0x.js} +2 -2
- package/bundle/{chunk-xqwk2zsx.js → chunk-wdy0fsp8.js} +2 -2
- package/bundle/{chunk-gqgjybjc.js → chunk-wkepvmgt.js} +1 -1
- package/bundle/{chunk-g52wmt1v.js → chunk-wp0xd7at.js} +1 -1
- package/bundle/{chunk-x50adh71.js → chunk-wpkr3vzf.js} +1 -1
- package/bundle/{chunk-npdgfqaw.js → chunk-wpx2vmf5.js} +1 -1
- package/bundle/{chunk-2fbkw84y.js → chunk-wqkvsj5y.js} +2 -2
- package/bundle/{chunk-nk5vrenn.js → chunk-wspbjh74.js} +2 -2
- package/bundle/{chunk-qdh2dm62.js → chunk-wzfb19t6.js} +1 -1
- package/bundle/chunk-x23s1s8k.js +2 -0
- package/bundle/{chunk-7s0nq2aa.js → chunk-x28chfpz.js} +2 -2
- package/bundle/{chunk-gx4v8z64.js → chunk-xf1y0sc6.js} +2 -2
- package/bundle/{chunk-h91zmzs5.js → chunk-xfsccqsm.js} +1 -1
- package/bundle/{chunk-pf2vq6t1.js → chunk-xmt17jd4.js} +2 -2
- package/bundle/{chunk-q4mtwv1w.js → chunk-xphzr4wg.js} +2 -2
- package/bundle/chunk-xr6js4ek.js +2 -0
- package/bundle/chunk-y078gb3n.js +2 -0
- package/bundle/{chunk-yydqavgh.js → chunk-y24yxs9g.js} +2 -2
- package/bundle/{chunk-wbt31xap.js → chunk-y565z8n2.js} +2 -2
- package/bundle/{chunk-nq4x6792.js → chunk-y7cqyeve.js} +2 -2
- package/bundle/{chunk-d1fv2c7s.js → chunk-y8bxvp3c.js} +2 -2
- package/bundle/{chunk-zfqgh9h7.js → chunk-y8tx9x5b.js} +1 -1
- package/bundle/{chunk-kds2g7r2.js → chunk-ya6r72ng.js} +1 -1
- package/bundle/chunk-yewjnqee.js +2 -0
- package/bundle/{chunk-2cvwrabw.js → chunk-yg0rs4g1.js} +2 -2
- package/bundle/{chunk-jbcqhw3x.js → chunk-yhr7s8qm.js} +2 -2
- package/bundle/chunk-ykk9e9as.js +2 -0
- package/bundle/chunk-yqn88gjf.js +2 -0
- package/bundle/chunk-yrxg3dex.js +2 -0
- package/bundle/{chunk-7hdb1fhq.js → chunk-yvtbt12y.js} +2 -2
- package/bundle/chunk-z1xeqrgd.js +2 -0
- package/bundle/chunk-z5j46dem.js +2 -0
- package/bundle/{chunk-dm447tgc.js → chunk-zj5snrsa.js} +2 -2
- package/bundle/{chunk-asxmkyz2.js → chunk-zjfdptdj.js} +1 -1
- package/bundle/chunk-zq0hpja9.js +2 -0
- package/bundle/{chunk-td9hm9be.js → chunk-zqzh5hp3.js} +1 -1
- package/bundle/{chunk-ev6jwt7q.js → chunk-zr1cvkpb.js} +1 -1
- package/bundle/{chunk-6mnk5sg3.js → chunk-zr89enb8.js} +1 -1
- package/bundle/{chunk-ecz4h0a2.js → chunk-zskjqrmc.js} +1 -1
- package/bundle/{chunk-1h96bk6p.js → chunk-ztjrm8m0.js} +2 -2
- package/bundle/chunk-zv89qwjc.js +2 -0
- 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-062chtrq.js +0 -2
- package/bundle/chunk-062vs7bp.js +0 -2
- package/bundle/chunk-08g14hmz.js +0 -2
- package/bundle/chunk-0w2v8dfy.js +0 -2
- package/bundle/chunk-10fr7a2y.js +0 -2
- package/bundle/chunk-15bjhfav.js +0 -3
- package/bundle/chunk-1hv61m11.js +0 -2
- package/bundle/chunk-2mkvx8b2.js +0 -2
- package/bundle/chunk-2rykfc3a.js +0 -2
- package/bundle/chunk-2w5hx4fs.js +0 -2
- package/bundle/chunk-2yy63sxz.js +0 -2
- package/bundle/chunk-2z3fe4qw.js +0 -2
- package/bundle/chunk-361cmmrp.js +0 -2
- package/bundle/chunk-3r6dq1h3.js +0 -2
- package/bundle/chunk-4a12wv2m.js +0 -2
- package/bundle/chunk-547a55ba.js +0 -2
- package/bundle/chunk-5ztmc770.js +0 -2
- package/bundle/chunk-62x3r2q8.js +0 -2
- package/bundle/chunk-6th7vpwm.js +0 -2
- package/bundle/chunk-6ybh5smv.js +0 -2
- package/bundle/chunk-73kprndw.js +0 -2
- package/bundle/chunk-79fr19xf.js +0 -2
- package/bundle/chunk-7ezr478e.js +0 -2
- package/bundle/chunk-7gj1vqyj.js +0 -2
- package/bundle/chunk-7ywfkwb4.js +0 -2
- package/bundle/chunk-85fnnwm2.js +0 -2
- package/bundle/chunk-89fwh84w.js +0 -2
- package/bundle/chunk-8e724g3k.js +0 -2
- package/bundle/chunk-9894a2yn.js +0 -2
- package/bundle/chunk-98ye2nwt.js +0 -2
- package/bundle/chunk-9s4excg8.js +0 -2
- package/bundle/chunk-aetgcegz.js +0 -2
- package/bundle/chunk-agas0nay.js +0 -2
- package/bundle/chunk-ayknzc4m.js +0 -2
- package/bundle/chunk-b2ybst88.js +0 -2
- package/bundle/chunk-bd5vtjd7.js +0 -2
- package/bundle/chunk-bjqqk6jt.js +0 -2
- package/bundle/chunk-cpkcdykz.js +0 -2
- package/bundle/chunk-cyafm8d6.js +0 -2
- package/bundle/chunk-d4316r53.js +0 -2
- package/bundle/chunk-d8ym7mcg.js +0 -2
- package/bundle/chunk-dnpjxjkp.js +0 -2
- package/bundle/chunk-e5gjqtby.js +0 -2
- package/bundle/chunk-ee3mqzms.js +0 -2
- package/bundle/chunk-er5f61s5.js +0 -2
- package/bundle/chunk-er716522.js +0 -2
- package/bundle/chunk-ez3gacqe.js +0 -2
- package/bundle/chunk-fkc7wf1p.js +0 -2
- package/bundle/chunk-fm6z8nqb.js +0 -2
- package/bundle/chunk-g0qwm23d.js +0 -2
- package/bundle/chunk-g4yn8cj8.js +0 -2
- package/bundle/chunk-gsez13bg.js +0 -3
- package/bundle/chunk-h1spsy3y.js +0 -2
- package/bundle/chunk-h8gkv40j.js +0 -2
- package/bundle/chunk-j59kmb49.js +0 -2
- package/bundle/chunk-jv37ghev.js +0 -2
- package/bundle/chunk-k3hcb6qf.js +0 -2
- package/bundle/chunk-k5d822n2.js +0 -3
- package/bundle/chunk-m8ytbq04.js +0 -2
- package/bundle/chunk-mf9nc4xz.js +0 -2
- package/bundle/chunk-mxby91bj.js +0 -2
- package/bundle/chunk-mzv1gh6f.js +0 -2
- package/bundle/chunk-n0hsvvw8.js +0 -2
- package/bundle/chunk-nm1v9z14.js +0 -2
- package/bundle/chunk-p7nstcxa.js +0 -2
- package/bundle/chunk-pfwkvv7g.js +0 -2
- package/bundle/chunk-pn1jz8qj.js +0 -2
- package/bundle/chunk-pqvmtfk7.js +0 -2
- package/bundle/chunk-prgw26g3.js +0 -2
- package/bundle/chunk-pv9ty6v7.js +0 -2
- package/bundle/chunk-q4rstre7.js +0 -2
- package/bundle/chunk-q6jk2v6g.js +0 -2
- package/bundle/chunk-qd43npx3.js +0 -2
- package/bundle/chunk-qdb21y83.js +0 -2
- package/bundle/chunk-qeksaefy.js +0 -2
- package/bundle/chunk-r7t9yb9d.js +0 -2
- package/bundle/chunk-sdv3a4w3.js +0 -2
- package/bundle/chunk-sk89becn.js +0 -2
- package/bundle/chunk-tc0996xz.js +0 -2
- package/bundle/chunk-tfs50mgj.js +0 -2
- package/bundle/chunk-thecq33z.js +0 -3
- package/bundle/chunk-tjvtp9d9.js +0 -2
- package/bundle/chunk-tkm9m3n0.js +0 -2
- package/bundle/chunk-v03xq38e.js +0 -5
- package/bundle/chunk-v1s1rcqx.js +0 -2
- package/bundle/chunk-v4dt4062.js +0 -2
- package/bundle/chunk-wgrq86kd.js +0 -2
- package/bundle/chunk-x8ks2bn7.js +0 -2
- package/bundle/chunk-xgf4k9q7.js +0 -10
- package/bundle/chunk-xy2ty5h5.js +0 -8
- package/bundle/chunk-z0383stv.js +0 -2
- package/bundle/chunk-zewrmk8x.js +0 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var J=Symbol.for("drizzle:entityKind"),d2=Symbol.for("drizzle:hasOwnEntityKind");function D(X,Y){if(!X||typeof X!=="object")return!1;if(X instanceof Y)return!0;if(!Object.prototype.hasOwnProperty.call(Y,J))throw Error(`Class "${Y.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let Z=Object.getPrototypeOf(X)?.constructor;if(Z)while(Z){if(J in Z&&Z[J]===Y[J])return!0;Z=Object.getPrototypeOf(Z)}return!1}var S1=Symbol.for("drizzle:OriginalColumn");var R=class{static[J]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;length;isLengthExact;isAlias;config;table;onInit(){}constructor(X,Y){this.config=Y,this.onInit(),this.table=X,this.name=Y.name,this.isAlias=!1,this.keyAsName=Y.keyAsName,this.notNull=Y.notNull,this.default=Y.default,this.defaultFn=Y.defaultFn,this.onUpdateFn=Y.onUpdateFn,this.hasDefault=Y.hasDefault,this.primary=Y.primaryKey,this.isUnique=Y.isUnique,this.uniqueName=Y.uniqueName,this.uniqueType=Y.uniqueType,this.dataType=Y.dataType,this.columnType=Y.columnType,this.generated=Y.generated,this.generatedIdentity=Y.generatedIdentity,this.length=Y.length,this.isLengthExact=Y.isLengthExact}mapFromDriverValue(X){return X}mapToDriverValue(X){return X}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}[S1](){return this}};function r2(X){return X.table}var s=Symbol.for("drizzle:Name");var G1=Symbol.for("drizzle:Schema"),t=Symbol.for("drizzle:Columns"),JY=Symbol.for("drizzle:ExtraConfigColumns"),U1=Symbol.for("drizzle:OriginalName"),LX=Symbol.for("drizzle:BaseName"),_1=Symbol.for("drizzle:IsAlias"),HY=Symbol.for("drizzle:ExtraConfigBuilder"),_Y=Symbol.for("drizzle:IsDrizzleTable"),A=class{static[J]="Table";static Symbol={Name:s,Schema:G1,OriginalName:U1,Columns:t,ExtraConfigColumns:JY,BaseName:LX,IsAlias:_1,ExtraConfigBuilder:HY};[s];[U1];[G1];[t];[JY];[LX];[_1]=!1;[_Y]=!0;[HY]=void 0;constructor(X,Y,Z){this[s]=this[U1]=X,this[G1]=Y,this[LX]=Z}};function l2(X){return typeof X==="object"&&X!==null&&_Y in X}function z1(X){return X[s]}function A1(X){return`${X[G1]??"public"}.${X[s]}`}var q=class{static[J]="Subquery";constructor(X,Y,Z,$=!1,G=[]){this._={brand:"Subquery",sql:X,selectedFields:Y,alias:Z,isWith:$,usedTables:G}}},JX=class extends q{static[J]="WithSubquery"};function zY(X,...Y){return X(...Y)}var EY={startActiveSpan(X,Y){return Y()}};var w=Symbol.for("drizzle:ViewBaseConfig");var J0=class{static[J]="FakePrimitiveParam"};function E1(X){return X!==null&&X!==void 0&&typeof X.getSQL==="function"}function H0(X){let Y={sql:"",params:[]};for(let Z of X)if(Y.sql+=Z.sql,Y.params.push(...Z.params),Z.typings?.length){if(!Y.typings)Y.typings=[];Y.typings.push(...Z.typings)}return Y}var b=class{static[J]="StringChunk";value;constructor(X){this.value=Array.isArray(X)?X:[X]}getSQL(){return new x([this])}},x=class X{static[J]="SQL";decoder=q1;shouldInlineParams=!1;usedTables=[];constructor(Y){this.queryChunks=Y;for(let Z of Y)if(D(Z,A)){let $=Z[A.Symbol.Schema];this.usedTables.push($===void 0?Z[A.Symbol.Name]:$+"."+Z[A.Symbol.Name])}}append(Y){return this.queryChunks.push(...Y.queryChunks),this}toQuery(Y){return EY.startActiveSpan("drizzle.buildSQL",(Z)=>{let $=this.buildQueryFromSourceParams(this.queryChunks,Y);return Z?.setAttributes({"drizzle.query.text":$.sql,"drizzle.query.params":JSON.stringify($.params)}),$})}buildQueryFromSourceParams(Y,Z){let $=Object.assign({},Z,{inlineParams:Z.inlineParams||this.shouldInlineParams,paramStartIndex:Z.paramStartIndex||{value:0}}),{casing:G,escapeName:H,escapeParam:_,prepareTyping:z,inlineParams:O,paramStartIndex:E,invokeSource:U}=$;return H0(Y.map((F)=>{if(D(F,b))return{sql:F.value.join(""),params:[]};if(D(F,C1))return{sql:H(F.value),params:[]};if(F===void 0)return{sql:"",params:[]};if(Array.isArray(F)){let M=[new b("(")];for(let[V,P]of F.entries())if(M.push(P),V<F.length-1)M.push(new b(", "));return M.push(new b(")")),this.buildQueryFromSourceParams(M,$)}if(D(F,X))return this.buildQueryFromSourceParams(F.queryChunks,{...$,inlineParams:O||F.shouldInlineParams});if(D(F,A)){let M=F[A.Symbol.Schema],V=F[A.Symbol.Name];if(U==="mssql-view-with-schemabinding")return{sql:(M===void 0?H("dbo"):H(M))+"."+H(V),params:[]};return{sql:M===void 0||F[_1]?H(V):H(M)+"."+H(V),params:[]}}if(D(F,R)){let M=G.getColumnCasing(F);if(Z.invokeSource==="indexes")return{sql:H(M),params:[]};let V=U==="mssql-check"?void 0:F.table[A.Symbol.Schema];return{sql:F.isAlias?H(F.name):F.table[_1]||V===void 0?H(F.table[A.Symbol.Name])+"."+H(M):H(V)+"."+H(F.table[A.Symbol.Name])+"."+H(M),params:[]}}if(D(F,y)){let M=F[w].schema,V=F[w].name;return{sql:M===void 0||F[w].isAlias?H(V):H(M)+"."+H(V),params:[]}}if(D(F,c)){if(D(F.value,l))return{sql:_(E.value++,F),params:[F],typings:["none"]};let M=F.value===null?null:F.encoder.mapToDriverValue(F.value);if(D(M,X))return this.buildQueryFromSourceParams([M],$);if(O)return{sql:this.mapInlineParam(M,$),params:[]};let V=["none"];if(z)V=[z(F.encoder)];return{sql:_(E.value++,M),params:[M],typings:V}}if(D(F,l))return{sql:_(E.value++,F),params:[F],typings:["none"]};if(D(F,X.Aliased)&&F.fieldAlias!==void 0)return{sql:(F.origin!==void 0?H(F.origin)+".":"")+H(F.fieldAlias),params:[]};if(D(F,q)){if(F._.isWith)return{sql:H(F._.alias),params:[]};return this.buildQueryFromSourceParams([new b("("),F._.sql,new b(") "),new C1(F._.alias)],$)}if(typeof F==="function"&&"enumName"in F){if("schema"in F&&F.schema)return{sql:H(F.schema)+"."+H(F.enumName),params:[]};return{sql:H(F.enumName),params:[]}}if(E1(F)){if(F.shouldOmitSQLParens?.())return this.buildQueryFromSourceParams([F.getSQL()],$);return this.buildQueryFromSourceParams([new b("("),F.getSQL(),new b(")")],$)}if(O)return{sql:this.mapInlineParam(F,$),params:[]};return{sql:_(E.value++,F),params:[F],typings:["none"]}}))}mapInlineParam(Y,{escapeString:Z}){if(Y===null)return"null";if(typeof Y==="number"||typeof Y==="boolean"||typeof Y==="bigint")return Y.toString();if(typeof Y==="string")return Z(Y);if(typeof Y==="object"){let $=Y.toString();if($==="[object Object]")return Z(JSON.stringify(Y));return Z($)}throw Error("Unexpected param value: "+Y)}getSQL(){return this}as(Y){if(Y===void 0)return this;return new X.Aliased(this,Y)}mapWith(Y){return this.decoder=typeof Y==="function"?{mapFromDriverValue:Y}:Y,this}inlineParams(){return this.shouldInlineParams=!0,this}if(Y){return Y?this:void 0}},C1=class{static[J]="Name";brand;constructor(X){this.value=X}getSQL(){return new x([this])}};function _0(X){return new C1(X)}function BX(X){return typeof X==="object"&&X!==null&&"mapToDriverValue"in X&&typeof X.mapToDriverValue==="function"}var q1={mapFromDriverValue:(X)=>X},jX={mapToDriverValue:(X)=>X},z0={...q1,...jX},c=class{static[J]="Param";brand;constructor(X,Y=jX){this.value=X,this.encoder=Y}getSQL(){return new x([this])}};function E0(X,Y){return new c(X,Y)}function W(X,...Y){let Z=[];if(Y.length>0||X.length>0&&X[0]!=="")Z.push(new b(X[0]));for(let[$,G]of Y.entries())Z.push(G,new b(X[$+1]));return new x(Z)}(function(X){function Y(){return new x([])}X.empty=Y;function Z(O){return new x(O)}X.fromList=Z;function $(O){return new x([new b(O)])}X.raw=$;function G(O,E){let U=[];for(let[F,M]of O.entries()){if(F>0&&E!==void 0)U.push(E);U.push(M)}return new x(U)}X.join=G;function H(O){return new C1(O)}X.identifier=H;function _(O){return new l(O)}X.placeholder=_;function z(O,E){return new c(O,E)}X.param=z})(W||(W={}));(function(X){class Y{static[J]="SQL.Aliased";isSelectionField=!1;origin;constructor(Z,$){this.sql=Z,this.fieldAlias=$}getSQL(){return this.sql}clone(){return new Y(this.sql,this.fieldAlias)}}X.Aliased=Y})(x||(x={}));var l=class{static[J]="Placeholder";constructor(X){this.name=X}getSQL(){return new x([this])}};function D0(X){return new l(X)}function D1(X,Y){return X.map((Z)=>{if(D(Z,l)){if(!(Z.name in Y))throw Error(`No value for placeholder "${Z.name}" was provided`);return Y[Z.name]}if(D(Z,c)&&D(Z.value,l)){if(!(Z.value.name in Y))throw Error(`No value for placeholder "${Z.value.name}" was provided`);return Z.encoder.mapToDriverValue(Y[Z.value.name])}return Z})}var DY=Symbol.for("drizzle:IsDrizzleView"),y=class{static[J]="View";[w];[DY]=!0;get[s](){return this[w].name}get[G1](){return this[w].schema}get[_1](){return this[w].isAlias}get[U1](){return this[w].originalName}get[t](){return this[w].selectedFields}constructor({name:X,schema:Y,selectedFields:Z,query:$}){this[w]={name:X,originalName:X,schema:Y,selectedFields:Z,query:$,isExisting:!$,isAlias:!1}}};function O0(X){return typeof X==="object"&&X!==null&&DY in X}function F0(X){return X[w].name}R.prototype.getSQL=function(){return new x([this])};q.prototype.getSQL=function(){return new x([this])};function TX(X,Y,Z){let $={},G=X.reduce((H,{path:_,field:z},O)=>{let E;if(D(z,R))E=z;else if(D(z,x))E=z.decoder;else if(D(z,q))E=z._.sql.decoder;else E=z.sql.decoder;let U=H;for(let[F,M]of _.entries())if(F<_.length-1){if(!(M in U))U[M]={};U=U[M]}else{let V=Y[O],P=U[M]=V===null?null:E.mapFromDriverValue(V);if(Z&&D(z,R)&&_.length===2){let L=_[0];if(!(L in $))$[L]=P===null?z1(z.table):!1;else if(typeof $[L]==="string"&&$[L]!==z1(z.table))$[L]=!1}}return H},{});if(Z&&Object.keys($).length>0){for(let[H,_]of Object.entries($))if(typeof _==="string"&&!Z[_])G[H]=null}return G}function i(X,Y){return Object.entries(X).reduce((Z,[$,G])=>{if(typeof $!=="string")return Z;let H=Y?[...Y,$]:[$];if(D(G,R)||D(G,x)||D(G,x.Aliased)||D(G,q))Z.push({path:H,field:G});else if(D(G,A))Z.push(...i(G[A.Symbol.Columns],H));else Z.push(...i(G,H));return Z},[])}function v1(X,Y){let Z=Object.keys(X),$=Object.keys(Y);if(Z.length!==$.length)return!1;for(let[G,H]of Z.entries())if(H!==$[G])return!1;return!0}function HX(X,Y){let Z=Object.entries(Y).filter(([,$])=>$!==void 0).map(([$,G])=>{if(D(G,x)||D(G,R))return[$,G];else return[$,new c(G,X[A.Symbol.Columns][$])]});if(Z.length===0)throw Error("No values to set");return Object.fromEntries(Z)}function OY(X,Y){for(let Z of Y)for(let $ of Object.getOwnPropertyNames(Z.prototype)){if($==="constructor")continue;Object.defineProperty(X.prototype,$,Object.getOwnPropertyDescriptor(Z.prototype,$)||Object.create(null))}}function FY(X){return X[A.Symbol.Columns]}function L3(X){return X[w].selectedFields}function B3(X){return D(X,A)?X[A.Symbol.Columns]:D(X,y)?X[w].selectedFields:X._.selectedFields}function h1(X){return D(X,q)?X._.alias:D(X,y)?X[w].name:D(X,x)?void 0:X[A.Symbol.IsAlias]?X[A.Symbol.Name]:X[A.Symbol.BaseName]}function k(X,Y){return{name:typeof X==="string"&&X.length>0?X:"",config:typeof X==="object"?X:Y}}function j3(X){if(typeof X!=="object"||X===null)return!1;if(X.constructor.name!=="Object")return!1;if("logger"in X){let Y=typeof X.logger;if(Y!=="boolean"&&(Y!=="object"||typeof X.logger.logQuery!=="function")&&Y!=="undefined")return!1;return!0}if("schema"in X){let Y=typeof X.schema;if(Y!=="object"&&Y!=="undefined")return!1;return!0}if("relations"in X){let Y=typeof X.relations;if(Y!=="object"&&Y!=="undefined")return!1;return!0}if("casing"in X){let Y=typeof X.casing;if(Y!=="string"&&Y!=="undefined")return!1;return!0}if("mode"in X){if(X.mode!=="default"||X.mode!=="planetscale"||X.mode!==void 0)return!1;return!0}if("connection"in X){let Y=typeof X.connection;if(Y!=="string"&&Y!=="object"&&Y!=="undefined")return!1;return!0}if("client"in X){let Y=typeof X.client;if(Y!=="object"&&Y!=="function"&&Y!=="undefined")return!1;return!0}if(Object.keys(X).length===0)return!0;return!1}var SX=typeof TextDecoder>"u"?null:new TextDecoder;function T3(X){throw Error("Didn't expect to get here")}function S3(X){return(typeof X==="object"&&X!==null||typeof X==="function")&&"enumValues"in X&&Array.isArray(X.enumValues)&&X.enumValues.length>0}var C3={INT8_MIN:-128,INT8_MAX:127,INT8_UNSIGNED_MAX:255,INT16_MIN:-32768,INT16_MAX:32767,INT16_UNSIGNED_MAX:65535,INT24_MIN:-8388608,INT24_MAX:8388607,INT24_UNSIGNED_MAX:16777215,INT32_MIN:-2147483648,INT32_MAX:2147483647,INT32_UNSIGNED_MAX:4294967295,INT48_MIN:-140737488355328,INT48_MAX:140737488355327,INT48_UNSIGNED_MAX:281474976710655,INT64_MIN:-9223372036854775808n,INT64_MAX:9223372036854775807n,INT64_UNSIGNED_MAX:18446744073709551615n};var U0=class{static[J]="ConsoleLogWriter";write(X){console.log(X)}},UY=class{static[J]="DefaultLogger";writer;constructor(X){this.writer=X?.writer??new U0}logQuery(X,Y){let Z=Y.map((G)=>{try{return JSON.stringify(G)}catch{return String(G)}}),$=Z.length?` -- params: [${Z.join(", ")}]`:"";this.writer.write(`Query: ${X}${$}`)}},AY=class{static[J]="NoopLogger";logQuery(){}};function d3(X){let[Y,Z]=X.dataType.split(" ");return{type:Y,constraint:Z}}var VY=class{static[J]="ColumnBuilder";config;constructor(X,Y,Z){this.config={name:X,keyAsName:X==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:Y,columnType:Z,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(X){return this.config.default=X,this.config.hasDefault=!0,this}$defaultFn(X){return this.config.defaultFn=X,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(X){return this.config.onUpdateFn=X,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(X){if(this.config.name!=="")return;this.config.name=X}};var _X=class{static[J]="SQLiteForeignKeyBuilder";reference;_onUpdate;_onDelete;constructor(X,Y){if(this.reference=()=>{let{name:Z,columns:$,foreignColumns:G}=X();return{name:Z,columns:$,foreignTable:G[0].table,foreignColumns:G}},Y)this._onUpdate=Y.onUpdate,this._onDelete=Y.onDelete}onUpdate(X){return this._onUpdate=X,this}onDelete(X){return this._onDelete=X,this}build(X){return new IY(X,this)}},IY=class{static[J]="SQLiteForeignKey";reference;onUpdate;onDelete;constructor(X,Y){this.table=X,this.reference=Y.reference,this.onUpdate=Y._onUpdate,this.onDelete=Y._onDelete}getName(){let{name:X,columns:Y,foreignColumns:Z}=this.reference(),$=Y.map((_)=>_.name),G=Z.map((_)=>_.name),H=[this.table[s],...$,Z[0].table[s],...G];return X??`${H.join("_")}_fk`}isNameExplicit(){return!!this.reference().name}};function A0(X){function Y(){if(typeof X==="function"){let{name:Z,columns:$,foreignColumns:G}=X();return{name:Z,columns:$,foreignColumns:G}}return X}return new _X(Y)}var g=class extends VY{static[J]="SQLiteColumnBuilder";foreignKeyConfigs=[];references(X,Y={}){return this.foreignKeyConfigs.push({ref:X,actions:Y}),this}unique(X){return this.config.isUnique=!0,this.config.uniqueName=X,this}generatedAlwaysAs(X,Y){return this.config.generated={as:X,type:"always",mode:Y?.mode??"virtual"},this}buildForeignKeys(X,Y){return this.foreignKeyConfigs.map(({ref:Z,actions:$})=>{return((G,H)=>{let _=new _X(()=>{let z=G();return{columns:[X],foreignColumns:[z]}});if(H.onUpdate)_.onUpdate(H.onUpdate);if(H.onDelete)_.onDelete(H.onDelete);return _.build(Y)})(Z,$)})}},v=class extends R{static[J]="SQLiteColumn";table;constructor(X,Y){super(X,Y);this.table=X}};var zX=class extends g{static[J]="SQLiteBaseIntegerBuilder";constructor(X,Y,Z){super(X,Y,Z);this.config.autoIncrement=!1}primaryKey(X){if(X?.autoIncrement)this.config.autoIncrement=!0;return this.config.hasDefault=!0,super.primaryKey()}},EX=class extends v{static[J]="SQLiteBaseInteger";autoIncrement=this.config.autoIncrement;getSQLType(){return"integer"}},MY=class extends zX{static[J]="SQLiteIntegerBuilder";constructor(X){super(X,"number int53","SQLiteInteger")}build(X){return new xY(X,this.config)}},xY=class extends EX{static[J]="SQLiteInteger"},KY=class extends zX{static[J]="SQLiteTimestampBuilder";constructor(X,Y){super(X,"object date","SQLiteTimestamp");this.config.mode=Y}defaultNow(){return this.default(W`(cast((julianday('now') - 2440587.5)*86400000 as integer))`)}build(X){return new kY(X,this.config)}},kY=class extends EX{static[J]="SQLiteTimestamp";mode=this.config.mode;mapFromDriverValue(X){if(typeof X==="string")return new Date(X.replaceAll('"',""));if(this.config.mode==="timestamp")return new Date(X*1000);return new Date(X)}mapToDriverValue(X){if(typeof X==="number")return X;let Y=X.getTime();if(this.config.mode==="timestamp")return Math.floor(Y/1000);return Y}},NY=class extends zX{static[J]="SQLiteBooleanBuilder";constructor(X,Y){super(X,"boolean","SQLiteBoolean");this.config.mode=Y}build(X){return new RY(X,this.config)}},RY=class extends EX{static[J]="SQLiteBoolean";mode=this.config.mode;mapFromDriverValue(X){return Number(X)===1}mapToDriverValue(X){return X?1:0}};function CX(X,Y){let{name:Z,config:$}=k(X,Y);if($?.mode==="timestamp"||$?.mode==="timestamp_ms")return new KY(Z,$.mode);if($?.mode==="boolean")return new NY(Z,$.mode);return new MY(Z)}var wY=class extends g{static[J]="SQLiteTextBuilder";constructor(X,Y){super(X,Y.enum?.length?"string enum":"string","SQLiteText");this.config.enumValues=Y.enum,this.config.length=Y.length}build(X){return new QY(X,this.config)}},QY=class extends v{static[J]="SQLiteText";enumValues=this.config.enumValues;constructor(X,Y){super(X,Y)}getSQLType(){return`text${this.config.length?`(${this.config.length})`:""}`}},PY=class extends g{static[J]="SQLiteTextJsonBuilder";constructor(X){super(X,"object json","SQLiteTextJson")}build(X){return new LY(X,this.config)}},LY=class extends v{static[J]="SQLiteTextJson";getSQLType(){return"text"}mapFromDriverValue(X){return JSON.parse(X)}mapToDriverValue(X){return JSON.stringify(X)}};function qX(X,Y={}){let{name:Z,config:$}=k(X,Y);if($.mode==="json")return new PY(Z);return new wY(Z,$)}var BY=class{static[J]="SQLiteIndexBuilderOn";constructor(X,Y){this.name=X,this.unique=Y}on(...X){return new jY(this.name,X,this.unique)}},jY=class{static[J]="SQLiteIndexBuilder";config;constructor(X,Y,Z){this.config={name:X,columns:Y,unique:Z,where:void 0}}where(X){return this.config.where=X,this}build(X){return new TY(this.config,X)}},TY=class{static[J]="SQLiteIndex";config;isNameExplicit;constructor(X,Y){this.config={...X,table:Y},this.isNameExplicit=!!X.name}};function V0(X){return new BY(X,!1)}function SY(X){let Y="";for(let Z=0;Z<X.length;Z+=2){let $=X.slice(Z,Z+2),G=Number.parseInt($,16);Y+=String.fromCodePoint(G)}return Y}var I0=class extends g{static[J]="SQLiteBigIntBuilder";constructor(X){super(X,"bigint int64","SQLiteBigInt")}build(X){return new M0(X,this.config)}},M0=class extends v{static[J]="SQLiteBigInt";getSQLType(){return"blob"}mapFromDriverValue(X){if(typeof X==="string")return BigInt(SY(X));if(typeof Buffer<"u"&&Buffer.from){let Y=Buffer.isBuffer(X)?X:X instanceof ArrayBuffer?Buffer.from(X):X.buffer?Buffer.from(X.buffer,X.byteOffset,X.byteLength):Buffer.from(X);return BigInt(Y.toString("utf8"))}return BigInt(SX.decode(X))}mapToDriverValue(X){return Buffer.from(X.toString())}},x0=class extends g{static[J]="SQLiteBlobJsonBuilder";constructor(X){super(X,"object json","SQLiteBlobJson")}build(X){return new K0(X,this.config)}},K0=class extends v{static[J]="SQLiteBlobJson";getSQLType(){return"blob"}mapFromDriverValue(X){if(typeof X==="string")return JSON.parse(SY(X));if(typeof Buffer<"u"&&Buffer.from){let Y=Buffer.isBuffer(X)?X:X instanceof ArrayBuffer?Buffer.from(X):X.buffer?Buffer.from(X.buffer,X.byteOffset,X.byteLength):Buffer.from(X);return JSON.parse(Y.toString("utf8"))}return JSON.parse(SX.decode(X))}mapToDriverValue(X){return Buffer.from(JSON.stringify(X))}},k0=class extends g{static[J]="SQLiteBlobBufferBuilder";constructor(X){super(X,"object buffer","SQLiteBlobBuffer")}build(X){return new N0(X,this.config)}},N0=class extends v{static[J]="SQLiteBlobBuffer";mapFromDriverValue(X){if(Buffer.isBuffer(X))return X;if(typeof X==="string")return Buffer.from(X,"hex");return Buffer.from(X)}getSQLType(){return"blob"}};function CY(X,Y){let{name:Z,config:$}=k(X,Y);if($?.mode==="json")return new x0(Z);if($?.mode==="bigint")return new I0(Z);return new k0(Z)}var R0=class extends g{static[J]="SQLiteCustomColumnBuilder";constructor(X,Y,Z){super(X,"custom","SQLiteCustomColumn");this.config.fieldConfig=Y,this.config.customTypeParams=Z}build(X){return new w0(X,this.config)}},w0=class extends v{static[J]="SQLiteCustomColumn";sqlName;mapTo;mapFrom;mapJson;forJsonSelect;constructor(X,Y){super(X,Y);this.sqlName=Y.customTypeParams.dataType(Y.fieldConfig),this.mapTo=Y.customTypeParams.toDriver,this.mapFrom=Y.customTypeParams.fromDriver,this.mapJson=Y.customTypeParams.fromJson,this.forJsonSelect=Y.customTypeParams.forJsonSelect}getSQLType(){return this.sqlName}mapFromDriverValue(X){return typeof this.mapFrom==="function"?this.mapFrom(X):X}mapFromJsonValue(X){return typeof this.mapJson==="function"?this.mapJson(X):this.mapFromDriverValue(X)}jsonSelectIdentifier(X,Y){if(typeof this.forJsonSelect==="function")return this.forJsonSelect(X,Y);let Z=this.getSQLType().toLowerCase(),$=Z.indexOf("(");switch($+1?Z.slice(0,$):Z){case"numeric":case"decimal":case"bigint":return Y`cast(${X} as text)`;case"blob":return Y`hex(${X})`;default:return X}}mapToDriverValue(X){return typeof this.mapTo==="function"?this.mapTo(X):X}};function qY(X){return(Y,Z)=>{let{name:$,config:G}=k(Y,Z);return new R0($,G,X)}}var Q0=class extends g{static[J]="SQLiteNumericBuilder";constructor(X){super(X,"string numeric","SQLiteNumeric")}build(X){return new P0(X,this.config)}},P0=class extends v{static[J]="SQLiteNumeric";mapFromDriverValue(X){if(typeof X==="string")return X;return String(X)}getSQLType(){return"numeric"}},L0=class extends g{static[J]="SQLiteNumericNumberBuilder";constructor(X){super(X,"number","SQLiteNumericNumber")}build(X){return new B0(X,this.config)}},B0=class extends v{static[J]="SQLiteNumericNumber";mapFromDriverValue(X){if(typeof X==="number")return X;return Number(X)}mapToDriverValue=String;getSQLType(){return"numeric"}},j0=class extends g{static[J]="SQLiteNumericBigIntBuilder";constructor(X){super(X,"bigint int64","SQLiteNumericBigInt")}build(X){return new T0(X,this.config)}},T0=class extends v{static[J]="SQLiteNumericBigInt";mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return"numeric"}};function vY(X,Y){let{name:Z,config:$}=k(X,Y),G=$?.mode;return G==="number"?new L0(Z):G==="bigint"?new j0(Z):new Q0(Z)}var S0=class extends g{static[J]="SQLiteRealBuilder";constructor(X){super(X,"number double","SQLiteReal")}build(X){return new C0(X,this.config)}},C0=class extends v{static[J]="SQLiteReal";getSQLType(){return"real"}};function hY(X){return new S0(X??"")}function pY(){return{blob:CY,customType:qY,integer:CX,numeric:vY,real:hY,text:qX}}var DX=Symbol.for("drizzle:SQLiteInlineForeignKeys"),f=class extends A{static[J]="SQLiteTable";static Symbol=Object.assign({},A.Symbol,{InlineForeignKeys:DX});[A.Symbol.Columns];[DX]=[];[A.Symbol.ExtraConfigBuilder]=void 0};function q0(X,Y,Z,$,G=X){let H=new f(X,$,G),_=typeof Y==="function"?Y(pY()):Y,z=Object.fromEntries(Object.entries(_).map(([E,U])=>{let F=U;F.setName(E);let M=F.build(H);return H[DX].push(...F.buildForeignKeys(M,H)),[E,M]})),O=Object.assign(H,z);if(O[A.Symbol.Columns]=z,O[A.Symbol.ExtraConfigColumns]=z,Z)O[f.Symbol.ExtraConfigBuilder]=Z;return O}var v0=(X,Y,Z)=>{return q0(X,Y,Z)};function h0(...X){if(X[0].columns)return new vX(X[0].columns,X[0].name);return new vX(X)}var vX=class{static[J]="SQLitePrimaryKeyBuilder";columns;name;constructor(X,Y){this.columns=X,this.name=Y}build(X){return new yY(X,this.columns,this.name)}},yY=class{static[J]="SQLitePrimaryKey";columns;name;isNameExplicit;constructor(X,Y,Z){this.table=X,this.columns=Y,this.name=Z,this.isNameExplicit=!!Z}getName(){return this.name??`${this.table[f.Symbol.Name]}_${this.columns.map((X)=>X.name).join("_")}_pk`}};function p(X,Y){if(BX(Y)&&!E1(X)&&!D(X,c)&&!D(X,l)&&!D(X,R)&&!D(X,A)&&!D(X,y))return new c(X,Y);return X}var a=(X,Y)=>{return W`${X} = ${p(Y,X)}`},p1=(X,Y)=>{return W`${X} <> ${p(Y,X)}`};function u(...X){let Y=X.filter((Z)=>Z!==void 0);if(Y.length===0)return;if(Y.length===1)return new x(Y);return new x([new b("("),W.join(Y,new b(" and ")),new b(")")])}function V1(...X){let Y=X.filter((Z)=>Z!==void 0);if(Y.length===0)return;if(Y.length===1)return new x(Y);return new x([new b("("),W.join(Y,new b(" or ")),new b(")")])}function I1(X){return W`not ${X}`}var y1=(X,Y)=>{return W`${X} > ${p(Y,X)}`},f1=(X,Y)=>{return W`${X} >= ${p(Y,X)}`},b1=(X,Y)=>{return W`${X} < ${p(Y,X)}`},d1=(X,Y)=>{return W`${X} <= ${p(Y,X)}`};function g1(X,Y){if(Array.isArray(Y)){if(Y.length===0)return W`false`;return W`${X} in ${Y.map((Z)=>p(Z,X))}`}return W`${X} in ${p(Y,X)}`}function m1(X,Y){if(Array.isArray(Y)){if(Y.length===0)return W`true`;return W`${X} not in ${Y.map((Z)=>p(Z,X))}`}return W`${X} not in ${p(Y,X)}`}function c1(X){return W`(${X} is null)`}function u1(X){return W`(${X} is not null)`}function N1(X){return W`exists ${X}`}function R1(X){return W`not exists ${X}`}function r1(X,Y,Z){return W`${X} between ${p(Y,X)} and ${p(Z,X)}`}function o1(X,Y,Z){return W`${X} not between ${p(Y,X)} and ${p(Z,X)}`}function s1(X,Y){return W`${X} like ${Y}`}function t1(X,Y){return W`${X} not like ${Y}`}function n1(X,Y){return W`${X} ilike ${Y}`}function i1(X,Y){return W`${X} not ilike ${Y}`}function hX(X,Y){if(Array.isArray(Y)){if(Y.length===0)throw Error("arrayContains requires at least one value");let Z=p(Y,X);return W`${X} @> ${W`${Array.isArray(Z)?new c(Z):Z}`}`}return W`${X} @> ${p(Y,X)}`}function pX(X,Y){if(Array.isArray(Y)){if(Y.length===0)throw Error("arrayContained requires at least one value");let Z=p(Y,X);return W`${X} <@ ${W`${Array.isArray(Z)?new c(Z):Z}`}`}return W`${X} <@ ${p(Y,X)}`}function yX(X,Y){if(Array.isArray(Y)){if(Y.length===0)throw Error("arrayOverlaps requires at least one value");let Z=p(Y,X);return W`${X} && ${W`${Array.isArray(Z)?new c(Z):Z}`}`}return W`${X} && ${p(Y,X)}`}function M1(X){return W`${X} asc`}function l1(X){return W`${X} desc`}function fY(X,Y,Z){for(let $=Y;$<X.length;$++){let G=X[$];if(G==="\\"){$++;continue}if(G==='"')return[X.slice(Y,$).replace(/\\/g,""),$+1];if(Z)continue;if(G===","||G==="}")return[X.slice(Y,$).replace(/\\/g,""),$]}return[X.slice(Y).replace(/\\/g,""),X.length]}function bY(X,Y=0){let Z=[],$=Y,G=!1;while($<X.length){let H=X[$];if(H===","){if(G||$===Y)Z.push("");G=!0,$++;continue}if(G=!1,H==="\\"){$+=2;continue}if(H==='"'){let[O,E]=fY(X,$+1,!0);Z.push(O),$=E;continue}if(H==="}")return[Z,$+1];if(H==="{"){let[O,E]=bY(X,$+1);Z.push(O),$=E;continue}let[_,z]=fY(X,$,!1);Z.push(_),$=z}return[Z,$]}function OX(X){let[Y]=bY(X,1);return Y}function fX(X){return`{${X.map((Y)=>{if(Array.isArray(Y))return fX(Y);if(typeof Y==="string")return`"${Y.replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}"`;return`${Y}`}).join(",")}}`}var dY=class{static[J]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor(X,Y){if(this.reference=()=>{let{name:Z,columns:$,foreignColumns:G}=X();return{name:Z,columns:$,foreignTable:G[0].table,foreignColumns:G}},Y)this._onUpdate=Y.onUpdate,this._onDelete=Y.onDelete}onUpdate(X){return this._onUpdate=X===void 0?"no action":X,this}onDelete(X){return this._onDelete=X===void 0?"no action":X,this}build(X){return new p0(X,this)}},p0=class{static[J]="PgForeignKey";reference;onUpdate;onDelete;name;constructor(X,Y){this.table=X,this.reference=Y.reference,this.onUpdate=Y._onUpdate,this.onDelete=Y._onDelete}getName(){let{name:X,columns:Y,foreignColumns:Z}=this.reference(),$=Y.map((_)=>_.name),G=Z.map((_)=>_.name),H=[this.table[s],...$,Z[0].table[s],...G];return X??`${H.join("_")}_fk`}isNameExplicit(){return!!this.reference().name}};var K=class{static[J]="PgColumnBuilder";foreignKeyConfigs=[];config;constructor(X,Y,Z){this.config={name:X,keyAsName:X==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:Y,columnType:Z,generated:void 0,defaultFn:void 0,onUpdateFn:void 0,generatedIdentity:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(X){return this.config.default=X,this.config.hasDefault=!0,this}$defaultFn(X){return this.config.defaultFn=X,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(X){return this.config.onUpdateFn=X,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(X){if(this.config.name!=="")return;this.config.name=X}array(X){let Y=X??"[]";return this.config.dimensions=Y.length/2,this}references(X,Y={}){return this.foreignKeyConfigs.push({ref:X,config:Y}),this}unique(X,Y){return this.config.isUnique=!0,this.config.uniqueName=X,this.config.uniqueType=Y?.nulls,this}generatedAlwaysAs(X){return this.config.generated={as:X,type:"always",mode:"stored"},this}buildForeignKeys(X,Y){return this.foreignKeyConfigs.map(({ref:Z,config:$})=>{return zY((G,H)=>{let _=new dY(()=>{let z=G();return{name:H.name,columns:[X],foreignColumns:[z]}});if(H.onUpdate)_.onUpdate(H.onUpdate);if(H.onDelete)_.onDelete(H.onDelete);return _.build(Y)},Z,$)})}buildExtraConfigColumn(X){return new y0(X,{...this.config,dimensions:this.config.dimensions??0})}},I=class extends R{static[J]="PgColumn";table;dimensions;constructor(X,Y){super(X,Y);if(this.table=X,this.dimensions=Y.dimensions??0,this.dimensions){let Z=this.mapFromDriverValue.bind(this),$=this.mapToDriverValue.bind(this);this.mapFromDriverValue=(G)=>{if(G===null)return G;let H=typeof G==="string"?OX(G):G;return this.mapArrayElements(H,Z,this.dimensions)},this.mapToDriverValue=(G)=>{if(G===null)return G;return fX(this.mapArrayElements(G,$,this.dimensions))}}}mapArrayElements(X,Y,Z){if(Z>0&&Array.isArray(X))return X.map(($)=>$===null?null:this.mapArrayElements($,Y,Z-1));return Y(X)}},y0=class extends I{static[J]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(X){return this.indexConfig.opClass=X,this}};var O1=class extends K{static[J]="PgIntColumnBaseBuilder";generatedAlwaysAsIdentity(X){if(X){let{name:Y,...Z}=X;this.config.generatedIdentity={type:"always",sequenceName:Y,sequenceOptions:Z}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity(X){if(X){let{name:Y,...Z}=X;this.config.generatedIdentity={type:"byDefault",sequenceName:Y,sequenceOptions:Z}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}};var f0=class extends O1{static[J]="PgBigInt53Builder";constructor(X){super(X,"number int53","PgBigInt53")}build(X){return new b0(X,this.config)}},b0=class extends I{static[J]="PgBigInt53";getSQLType(){return"bigint"}mapFromDriverValue(X){if(typeof X==="number")return X;return Number(X)}},d0=class extends O1{static[J]="PgBigInt64Builder";constructor(X){super(X,"bigint int64","PgBigInt64")}build(X){return new g0(X,this.config)}},g0=class extends I{static[J]="PgBigInt64";getSQLType(){return"bigint"}mapFromDriverValue(X){return BigInt(X)}},m0=class extends O1{static[J]="PgBigIntStringBuilder";constructor(X){super(X,"string int64","PgBigIntString")}build(X){return new c0(X,this.config)}},c0=class extends I{static[J]="PgBigIntString";getSQLType(){return"bigint"}mapFromDriverValue(X){if(typeof X==="string")return X;return String(X)}};function gY(X,Y){let{name:Z,config:$}=k(X,Y);if($.mode==="number")return new f0(Z);if($.mode==="string")return new m0(Z);return new d0(Z)}var u0=class extends K{static[J]="PgBigSerial53Builder";constructor(X){super(X,"number int53","PgBigSerial53");this.config.hasDefault=!0,this.config.notNull=!0}build(X){return new r0(X,this.config)}},r0=class extends I{static[J]="PgBigSerial53";getSQLType(){return"bigserial"}mapFromDriverValue(X){if(typeof X==="number")return X;return Number(X)}},o0=class extends K{static[J]="PgBigSerial64Builder";constructor(X){super(X,"bigint int64","PgBigSerial64");this.config.hasDefault=!0,this.config.notNull=!0}build(X){return new s0(X,this.config)}},s0=class extends I{static[J]="PgBigSerial64";getSQLType(){return"bigserial"}mapFromDriverValue(X){return BigInt(X)}};function mY(X,Y){let{name:Z,config:$}=k(X,Y);if($.mode==="number")return new u0(Z);return new o0(Z)}var t0=class extends K{static[J]="PgBooleanBuilder";constructor(X){super(X,"boolean","PgBoolean")}build(X){return new n0(X,this.config)}},n0=class extends I{static[J]="PgBoolean";getSQLType(){return"boolean"}};function cY(X){return new t0(X??"")}var i0=class extends K{static[J]="PgCharBuilder";constructor(X,Y){super(X,Y.enum?.length?"string enum":"string","PgChar");this.config.length=Y.length??1,this.config.setLength=Y.length!==void 0,this.config.enumValues=Y.enum}build(X){return new l0(X,this.config)}},l0=class extends I{static[J]="PgChar";enumValues;setLength;constructor(X,Y){super(X,Y);this.enumValues=Y.enumValues,this.setLength=Y.setLength}getSQLType(){return this.setLength?`char(${this.length})`:"char"}};function uY(X,Y={}){let{name:Z,config:$}=k(X,Y);return new i0(Z,$)}var a0=class extends K{static[J]="PgCidrBuilder";constructor(X){super(X,"string cidr","PgCidr")}build(X){return new e0(X,this.config)}},e0=class extends I{static[J]="PgCidr";getSQLType(){return"cidr"}};function rY(X){return new a0(X??"")}var X8=class extends K{static[J]="PgCustomColumnBuilder";constructor(X,Y,Z){super(X,"custom","PgCustomColumn");this.config.fieldConfig=Y,this.config.customTypeParams=Z}build(X){return new Y8(X,this.config)}},Y8=class extends I{static[J]="PgCustomColumn";sqlName;mapTo;mapFrom;mapJson;forJsonSelect;constructor(X,Y){super(X,Y);if(this.sqlName=Y.customTypeParams.dataType(Y.fieldConfig),this.mapTo=Y.customTypeParams.toDriver,this.mapFrom=Y.customTypeParams.fromDriver,this.mapJson=Y.customTypeParams.fromJson,this.forJsonSelect=Y.customTypeParams.forJsonSelect,this.dimensions){let Z=($)=>{if(typeof this.mapJson==="function")return this.mapJson($);if(typeof this.mapFrom==="function")return this.mapFrom($);return $};this.mapFromJsonValue=($)=>{if($===null)return $;let G=typeof $==="string"?OX($):$;return this.mapJsonArrayElements(G,Z,this.dimensions)}}}mapJsonArrayElements(X,Y,Z){if(Z>0&&Array.isArray(X))return X.map(($)=>$===null?null:this.mapJsonArrayElements($,Y,Z-1));return Y(X)}getSQLType(){return this.sqlName}mapFromDriverValue(X){return typeof this.mapFrom==="function"?this.mapFrom(X):X}mapFromJsonValue(X){return typeof this.mapJson==="function"?this.mapJson(X):this.mapFromDriverValue(X)}jsonSelectIdentifier(X,Y,Z){if(typeof this.forJsonSelect==="function")return this.forJsonSelect(X,Y,Z);let $=this.getSQLType().toLowerCase(),G=$.indexOf("(");switch(G+1?$.slice(0,G):$){case"bytea":case"geometry":case"timestamp":case"numeric":case"bigint":{let H="[]".repeat(Z??0);return Y`${X}::text${Y.raw(H).if(Z)}`}default:return X}}mapToDriverValue(X){return typeof this.mapTo==="function"?this.mapTo(X):X}};function oY(X){return(Y,Z)=>{let{name:$,config:G}=k(Y,Z);return new X8($,G,X)}}var F1=class extends K{static[J]="PgDateColumnBaseBuilder";defaultNow(){return this.default(W`now()`)}};var Z8=class extends F1{static[J]="PgDateBuilder";constructor(X){super(X,"object date","PgDate")}build(X){return new $8(X,this.config)}},$8=class extends I{static[J]="PgDate";getSQLType(){return"date"}mapFromDriverValue(X){if(typeof X==="string")return new Date(X);return X}mapToDriverValue(X){if(typeof X==="string")return X;return X.toISOString()}},G8=class extends F1{static[J]="PgDateStringBuilder";constructor(X){super(X,"string date","PgDateString")}build(X){return new W8(X,this.config)}},W8=class extends I{static[J]="PgDateString";getSQLType(){return"date"}mapFromDriverValue(X){if(typeof X==="string")return X;return X.toISOString().slice(0,-14)}mapToDriverValue(X){if(typeof X==="string")return X;return X.toISOString()}};function sY(X,Y){let{name:Z,config:$}=k(X,Y);if($?.mode==="date")return new Z8(Z);return new G8(Z)}var J8=class extends K{static[J]="PgDoublePrecisionBuilder";constructor(X){super(X,"number double","PgDoublePrecision")}build(X){return new H8(X,this.config)}},H8=class extends I{static[J]="PgDoublePrecision";getSQLType(){return"double precision"}mapFromDriverValue(X){if(typeof X==="string")return Number.parseFloat(X);return X}};function tY(X){return new J8(X??"")}var _8=class extends K{static[J]="PgInetBuilder";constructor(X){super(X,"string inet","PgInet")}build(X){return new z8(X,this.config)}},z8=class extends I{static[J]="PgInet";getSQLType(){return"inet"}};function nY(X){return new _8(X??"")}var E8=class extends O1{static[J]="PgIntegerBuilder";constructor(X){super(X,"number int32","PgInteger")}build(X){return new D8(X,this.config)}},D8=class extends I{static[J]="PgInteger";getSQLType(){return"integer"}mapFromDriverValue(X){if(typeof X==="string")return Number.parseInt(X);return X}};function iY(X){return new E8(X??"")}var O8=class extends K{static[J]="PgIntervalBuilder";constructor(X,Y){super(X,"string interval","PgInterval");this.config.intervalConfig=Y}build(X){return new F8(X,this.config)}},F8=class extends I{static[J]="PgInterval";fields;precision;constructor(X,Y){super(X,Y);this.fields=Y.intervalConfig.fields,this.precision=Y.intervalConfig.precision}getSQLType(){return`interval${this.fields?` ${this.fields}`:""}${this.precision?`(${this.precision})`:""}`}};function lY(X,Y={}){let{name:Z,config:$}=k(X,Y);return new O8(Z,$)}var U8=class extends K{static[J]="PgJsonBuilder";constructor(X){super(X,"object json","PgJson")}build(X){return new A8(X,this.config)}},A8=class extends I{static[J]="PgJson";constructor(X,Y){super(X,Y)}getSQLType(){return"json"}mapToDriverValue(X){return JSON.stringify(X)}mapFromDriverValue(X){if(typeof X==="string")try{return JSON.parse(X)}catch{return X}return X}};function aY(X){return new U8(X??"")}var V8=class extends K{static[J]="PgJsonbBuilder";constructor(X){super(X,"object json","PgJsonb")}build(X){return new I8(X,this.config)}},I8=class extends I{static[J]="PgJsonb";constructor(X,Y){super(X,Y)}getSQLType(){return"jsonb"}mapToDriverValue(X){return JSON.stringify(X)}mapFromDriverValue(X){if(typeof X==="string")try{return JSON.parse(X)}catch{return X}return X}};function eY(X){return new V8(X??"")}var M8=class extends K{static[J]="PgLineBuilder";constructor(X){super(X,"array line","PgLine")}build(X){return new x8(X,this.config)}},x8=class extends I{static[J]="PgLine";mode="tuple";getSQLType(){return"line"}mapFromDriverValue(X){let[Y,Z,$]=X.slice(1,-1).split(",");return[Number.parseFloat(Y),Number.parseFloat(Z),Number.parseFloat($)]}mapToDriverValue(X){return`{${X[0]},${X[1]},${X[2]}}`}},K8=class extends K{static[J]="PgLineABCBuilder";constructor(X){super(X,"object line","PgLineABC")}build(X){return new k8(X,this.config)}},k8=class extends I{static[J]="PgLineABC";mode="abc";getSQLType(){return"line"}mapFromDriverValue(X){let[Y,Z,$]=X.slice(1,-1).split(",");return{a:Number.parseFloat(Y),b:Number.parseFloat(Z),c:Number.parseFloat($)}}mapToDriverValue(X){return`{${X.a},${X.b},${X.c}}`}};function XZ(X,Y){let{name:Z,config:$}=k(X,Y);if(!$?.mode||$.mode==="tuple")return new M8(Z);return new K8(Z)}var N8=class extends K{static[J]="PgMacaddrBuilder";constructor(X){super(X,"string macaddr","PgMacaddr")}build(X){return new R8(X,this.config)}},R8=class extends I{static[J]="PgMacaddr";getSQLType(){return"macaddr"}};function YZ(X){return new N8(X??"")}var w8=class extends K{static[J]="PgMacaddr8Builder";constructor(X){super(X,"string macaddr8","PgMacaddr8")}build(X){return new Q8(X,this.config)}},Q8=class extends I{static[J]="PgMacaddr8";getSQLType(){return"macaddr8"}};function ZZ(X){return new w8(X??"")}var P8=class extends K{static[J]="PgNumericBuilder";constructor(X,Y,Z){super(X,"string numeric","PgNumeric");this.config.precision=Y,this.config.scale=Z}build(X){return new L8(X,this.config)}},L8=class extends I{static[J]="PgNumeric";precision;scale;constructor(X,Y){super(X,Y);this.precision=Y.precision,this.scale=Y.scale}mapFromDriverValue(X){if(typeof X==="string")return X;return String(X)}getSQLType(){if(this.precision!==void 0&&this.scale!==void 0)return`numeric(${this.precision}, ${this.scale})`;else if(this.precision===void 0)return"numeric";else return`numeric(${this.precision})`}},B8=class extends K{static[J]="PgNumericNumberBuilder";constructor(X,Y,Z){super(X,"number","PgNumericNumber");this.config.precision=Y,this.config.scale=Z}build(X){return new j8(X,this.config)}},j8=class extends I{static[J]="PgNumericNumber";precision;scale;constructor(X,Y){super(X,Y);this.precision=Y.precision,this.scale=Y.scale}mapFromDriverValue(X){if(typeof X==="number")return X;return Number(X)}mapToDriverValue(X){return String(X)}getSQLType(){if(this.precision!==void 0&&this.scale!==void 0)return`numeric(${this.precision}, ${this.scale})`;else if(this.precision===void 0)return"numeric";else return`numeric(${this.precision})`}},T8=class extends K{static[J]="PgNumericBigIntBuilder";constructor(X,Y,Z){super(X,"bigint int64","PgNumericBigInt");this.config.precision=Y,this.config.scale=Z}build(X){return new S8(X,this.config)}},S8=class extends I{static[J]="PgNumericBigInt";precision;scale;constructor(X,Y){super(X,Y);this.precision=Y.precision,this.scale=Y.scale}mapFromDriverValue(X){return BigInt(X)}mapToDriverValue(X){return String(X)}getSQLType(){if(this.precision!==void 0&&this.scale!==void 0)return`numeric(${this.precision}, ${this.scale})`;else if(this.precision===void 0)return"numeric";else return`numeric(${this.precision})`}};function $Z(X,Y){let{name:Z,config:$}=k(X,Y),G=$?.mode;return G==="number"?new B8(Z,$?.precision,$?.scale):G==="bigint"?new T8(Z,$?.precision,$?.scale):new P8(Z,$?.precision,$?.scale)}var C8=class extends K{static[J]="PgPointTupleBuilder";constructor(X){super(X,"array point","PgPointTuple")}build(X){return new q8(X,this.config)}},q8=class extends I{static[J]="PgPointTuple";mode="tuple";getSQLType(){return"point"}mapFromDriverValue(X){if(typeof X==="string"){let[Y,Z]=X.slice(1,-1).split(",");return[Number.parseFloat(Y),Number.parseFloat(Z)]}return[X.x,X.y]}mapToDriverValue(X){return`(${X[0]},${X[1]})`}},v8=class extends K{static[J]="PgPointObjectBuilder";constructor(X){super(X,"object point","PgPointObject")}build(X){return new h8(X,this.config)}},h8=class extends I{static[J]="PgPointObject";mode="xy";getSQLType(){return"point"}mapFromDriverValue(X){if(typeof X==="string"){let[Y,Z]=X.slice(1,-1).split(",");return{x:Number.parseFloat(Y),y:Number.parseFloat(Z)}}return X}mapToDriverValue(X){return`(${X.x},${X.y})`}};function GZ(X,Y){let{name:Z,config:$}=k(X,Y);if(!$?.mode||$.mode==="tuple")return new C8(Z);return new v8(Z)}function p8(X){let Y=[];for(let Z=0;Z<X.length;Z+=2)Y.push(Number.parseInt(X.slice(Z,Z+2),16));return new Uint8Array(Y)}function WZ(X,Y){let $=new DataView(new ArrayBuffer(8));for(let G=0;G<8;G++)$.setUint8(G,X[Y+G]);return $.getFloat64(0,!0)}function bX(X){let Y=p8(X),Z=0,$=Y[Z];Z+=1;let G=new DataView(Y.buffer),H=G.getUint32(Z,$===1);Z+=4;let _;if(H&536870912)_=G.getUint32(Z,$===1),Z+=4;if((H&65535)===1){let z=WZ(Y,Z);Z+=8;let O=WZ(Y,Z);return Z+=8,{srid:_,point:[z,O]}}throw Error("Unsupported geometry type")}var y8=class extends K{static[J]="PgGeometryBuilder";constructor(X,Y){super(X,"array geometry","PgGeometry");this.config.srid=Y}build(X){return new f8(X,this.config)}},f8=class extends I{static[J]="PgGeometry";srid=this.config.srid;mode="tuple";getSQLType(){return`geometry(point${this.srid===void 0?"":`,${this.srid}`})`}mapFromDriverValue(X){if(typeof X!=="string")return X;return bX(X).point}mapToDriverValue(X){return`point(${X[0]} ${X[1]})`}},b8=class extends K{static[J]="PgGeometryObjectBuilder";constructor(X,Y){super(X,"object geometry","PgGeometryObject");this.config.srid=Y}build(X){return new d8(X,this.config)}},d8=class extends I{static[J]="PgGeometryObject";srid=this.config.srid;mode="object";getSQLType(){return`geometry(point${this.srid===void 0?"":`,${this.srid}`})`}mapFromDriverValue(X){let Y=bX(X);return{x:Y.point[0],y:Y.point[1]}}mapToDriverValue(X){return`point(${X.x} ${X.y})`}};function JZ(X,Y){let{name:Z,config:$}=k(X,Y);if(!$?.mode||$.mode==="tuple")return new y8(Z,$?.srid);return new b8(Z,$?.srid)}var g8=class extends K{static[J]="PgRealBuilder";constructor(X,Y){super(X,"number float","PgReal");this.config.length=Y}build(X){return new m8(X,this.config)}},m8=class extends I{static[J]="PgReal";constructor(X,Y){super(X,Y)}getSQLType(){return"real"}mapFromDriverValue(X){if(typeof X==="string")return Number.parseFloat(X);return X}};function HZ(X){return new g8(X??"")}var c8=class extends K{static[J]="PgSerialBuilder";constructor(X){super(X,"number int32","PgSerial");this.config.hasDefault=!0,this.config.notNull=!0}build(X){return new u8(X,this.config)}},u8=class extends I{static[J]="PgSerial";getSQLType(){return"serial"}};function _Z(X){return new c8(X??"")}var r8=class extends O1{static[J]="PgSmallIntBuilder";constructor(X){super(X,"number int16","PgSmallInt")}build(X){return new o8(X,this.config)}},o8=class extends I{static[J]="PgSmallInt";getSQLType(){return"smallint"}mapFromDriverValue(X){if(typeof X==="string")return Number(X);return X}};function zZ(X){return new r8(X??"")}var s8=class extends K{static[J]="PgSmallSerialBuilder";constructor(X){super(X,"number int16","PgSmallSerial");this.config.hasDefault=!0,this.config.notNull=!0}build(X){return new t8(X,this.config)}},t8=class extends I{static[J]="PgSmallSerial";getSQLType(){return"smallserial"}};function EZ(X){return new s8(X??"")}var n8=class extends K{static[J]="PgTextBuilder";constructor(X,Y){super(X,Y.enum?.length?"string enum":"string","PgText");this.config.enumValues=Y.enum}build(X){return new i8(X,this.config,this.config.enumValues)}},i8=class extends I{static[J]="PgText";enumValues;constructor(X,Y,Z){super(X,Y);this.enumValues=Z}getSQLType(){return"text"}};function DZ(X,Y={}){let{name:Z,config:$}=k(X,Y);return new n8(Z,$)}var l8=class extends F1{static[J]="PgTimeBuilder";constructor(X,Y,Z){super(X,"string time","PgTime");this.withTimezone=Y,this.precision=Z,this.config.withTimezone=Y,this.config.precision=Z}build(X){return new a8(X,this.config)}},a8=class extends I{static[J]="PgTime";withTimezone;precision;constructor(X,Y){super(X,Y);this.withTimezone=Y.withTimezone,this.precision=Y.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}};function OZ(X,Y={}){let{name:Z,config:$}=k(X,Y);return new l8(Z,$.withTimezone??!1,$.precision)}var e8=class extends F1{static[J]="PgTimestampBuilder";constructor(X,Y,Z){super(X,"object date","PgTimestamp");this.config.withTimezone=Y,this.config.precision=Z}build(X){return new X2(X,this.config)}},X2=class extends I{static[J]="PgTimestamp";withTimezone;precision;constructor(X,Y){super(X,Y);this.withTimezone=Y.withTimezone,this.precision=Y.precision}getSQLType(){return`timestamp${this.precision===void 0?"":` (${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue(X){if(typeof X==="string")return new Date(this.withTimezone?X:X+"+0000");return X}mapToDriverValue(X){if(typeof X==="string")return X;return X.toISOString()}},Y2=class extends F1{static[J]="PgTimestampStringBuilder";constructor(X,Y,Z){super(X,"string timestamp","PgTimestampString");this.config.withTimezone=Y,this.config.precision=Z}build(X){return new Z2(X,this.config)}},Z2=class extends I{static[J]="PgTimestampString";withTimezone;precision;constructor(X,Y){super(X,Y);this.withTimezone=Y.withTimezone,this.precision=Y.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue(X){if(typeof X==="string")return X;let Y=X.toISOString().slice(0,-1).replace("T"," ");if(this.withTimezone)return`${Y}+00`;return Y}mapToDriverValue(X){if(typeof X==="string")return X;return X.toISOString()}};function FZ(X,Y={}){let{name:Z,config:$}=k(X,Y);if($?.mode==="string")return new Y2(Z,$.withTimezone??!1,$.precision);return new e8(Z,$?.withTimezone??!1,$?.precision)}var $2=class extends K{static[J]="PgUUIDBuilder";constructor(X){super(X,"string uuid","PgUUID")}defaultRandom(){return this.default(W`gen_random_uuid()`)}build(X){return new G2(X,this.config)}},G2=class extends I{static[J]="PgUUID";getSQLType(){return"uuid"}};function UZ(X){return new $2(X??"")}var W2=class extends K{static[J]="PgVarcharBuilder";constructor(X,Y){super(X,Y.enum?.length?"string enum":"string","PgVarchar");this.config.length=Y.length,this.config.enumValues=Y.enum}build(X){return new J2(X,this.config)}},J2=class extends I{static[J]="PgVarchar";enumValues;constructor(X,Y){super(X,Y);this.enumValues=Y.enumValues}getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}};function AZ(X,Y={}){let{name:Z,config:$}=k(X,Y);return new W2(Z,$)}var H2=class extends K{static[J]="PgBinaryVectorBuilder";constructor(X,Y){super(X,"string binary","PgBinaryVector");this.config.length=Y.dimensions,this.config.isLengthExact=!0}build(X){return new _2(X,this.config)}},_2=class extends I{static[J]="PgBinaryVector";getSQLType(){return`bit(${this.length})`}};function VZ(X,Y){let{name:Z,config:$}=k(X,Y);return new H2(Z,$)}var z2=class extends K{static[J]="PgHalfVectorBuilder";constructor(X,Y){super(X,"array halfvector","PgHalfVector");this.config.length=Y.dimensions,this.config.isLengthExact=!0}build(X){return new E2(X,this.config)}},E2=class extends I{static[J]="PgHalfVector";getSQLType(){return`halfvec(${this.length})`}mapToDriverValue(X){return JSON.stringify(X)}mapFromDriverValue(X){return X.slice(1,-1).split(",").map((Y)=>Number.parseFloat(Y))}};function IZ(X,Y){let{name:Z,config:$}=k(X,Y);return new z2(Z,$)}var D2=class extends K{static[J]="PgSparseVectorBuilder";constructor(X,Y){super(X,"string sparsevec","PgSparseVector");this.config.vectorDimensions=Y.dimensions}build(X){return new O2(X,this.config)}},O2=class extends I{static[J]="PgSparseVector";vectorDimensions=this.config.vectorDimensions;getSQLType(){return`sparsevec(${this.vectorDimensions})`}};function MZ(X,Y){let{name:Z,config:$}=k(X,Y);return new D2(Z,$)}var F2=class extends K{static[J]="PgVectorBuilder";constructor(X,Y){super(X,"array vector","PgVector");this.config.length=Y.dimensions,this.config.isLengthExact=!0}build(X){return new U2(X,this.config)}},U2=class extends I{static[J]="PgVector";getSQLType(){return`vector(${this.length})`}mapToDriverValue(X){return JSON.stringify(X)}mapFromDriverValue(X){return X.slice(1,-1).split(",").map((Y)=>Number.parseFloat(Y))}};function xZ(X,Y){let{name:Z,config:$}=k(X,Y);return new F2(Z,$)}function KZ(){return{bigint:gY,bigserial:mY,boolean:cY,char:uY,cidr:rY,customType:oY,date:sY,doublePrecision:tY,inet:nY,integer:iY,interval:lY,json:aY,jsonb:eY,line:XZ,macaddr:YZ,macaddr8:ZZ,numeric:$Z,point:GZ,geometry:JZ,real:HZ,serial:_Z,smallint:zZ,smallserial:EZ,text:DZ,time:OZ,timestamp:FZ,uuid:UZ,varchar:AZ,bit:VZ,halfvec:IZ,sparsevec:MZ,vector:xZ}}var dX=Symbol.for("drizzle:PgInlineForeignKeys"),gX=Symbol.for("drizzle:EnableRLS"),a1=class extends A{static[J]="PgTable";static Symbol=Object.assign({},A.Symbol,{InlineForeignKeys:dX,EnableRLS:gX});[dX]=[];[gX]=!1;[A.Symbol.ExtraConfigBuilder]=void 0;[A.Symbol.ExtraConfigColumns]={}};function kZ(X,Y,Z,$,G=X){let H=new a1(X,$,G),_=typeof Y==="function"?Y(KZ()):Y,z=Object.fromEntries(Object.entries(_).map(([U,F])=>{let M=F;M.setName(U);let V=M.build(H);return H[dX].push(...M.buildForeignKeys(V,H)),[U,V]})),O=Object.fromEntries(Object.entries(_).map(([U,F])=>{let M=F;return M.setName(U),[U,M.buildExtraConfigColumn(H)]})),E=Object.assign(H,z);if(E[A.Symbol.Columns]=z,E[A.Symbol.ExtraConfigColumns]=O,Z)E[a1.Symbol.ExtraConfigBuilder]=Z;return Object.assign(E,{enableRLS:()=>{return E[a1.Symbol.EnableRLS]=!0,E}})}var A2=(X,Y,Z)=>{return kZ(X,Y,Z,void 0)},V2=(X,Y,Z)=>{let $=kZ(X,Y,Z,void 0);return $[gX]=!0,$},PG=Object.assign(A2,{withRLS:V2});var NZ=class{static[J]="PgPrimaryKeyBuilder";columns;name;constructor(X,Y){this.columns=X,this.name=Y}build(X){return new I2(X,this.columns,this.name)}},I2=class{static[J]="PgPrimaryKey";columns;name;isNameExplicit;constructor(X,Y,Z){this.table=X,this.columns=Y,this.name=Z,this.isNameExplicit=!!Z}getName(){return this.name??`${this.table[a1.Symbol.Name]}_${this.columns.map((X)=>X.name).join("_")}_pk`}};var RZ=class{static[J]="Relation";referencedTableName;fieldName;constructor(X,Y,Z){this.sourceTable=X,this.referencedTable=Y,this.relationName=Z,this.referencedTableName=Y[A.Symbol.Name]}},M2=class{static[J]="Relations";constructor(X,Y){this.table=X,this.config=Y}},w1=class X extends RZ{static[J]="One";constructor(Y,Z,$,G){super(Y,Z,$?.relationName);this.config=$,this.isNullable=G}withFieldName(Y){let Z=new X(this.sourceTable,this.referencedTable,this.config,this.isNullable);return Z.fieldName=Y,Z}},mX=class X extends RZ{static[J]="Many";constructor(Y,Z,$){super(Y,Z,$?.relationName);this.config=$}withFieldName(Y){let Z=new X(this.sourceTable,this.referencedTable,this.config);return Z.fieldName=Y,Z}};function wZ(){return{and:u,between:r1,eq:a,exists:N1,gt:y1,gte:f1,ilike:n1,inArray:g1,isNull:c1,isNotNull:u1,like:s1,lt:b1,lte:d1,ne:p1,not:I1,notBetween:o1,notExists:R1,notLike:t1,notIlike:i1,notInArray:m1,or:V1,sql:W}}function QZ(){return{sql:W,asc:M1,desc:l1}}function PZ(X,Y){if(Object.keys(X).length===1&&"default"in X&&!D(X.default,A))X=X.default;let Z={},$={},G={};for(let[H,_]of Object.entries(X))if(D(_,A)){let z=A1(_),O=$[z];Z[z]=H,G[H]={tsName:H,dbName:_[A.Symbol.Name],schema:_[A.Symbol.Schema],columns:_[A.Symbol.Columns],relations:O?.relations??{},primaryKey:O?.primaryKey??[]};for(let U of Object.values(_[A.Symbol.Columns]))if(U.primary)G[H].primaryKey.push(U);let E=_[A.Symbol.ExtraConfigBuilder]?.(_[A.Symbol.ExtraConfigColumns]);if(E){for(let U of Object.values(E))if(D(U,NZ))G[H].primaryKey.push(...U.columns)}}else if(D(_,M2)){let z=A1(_.table),O=Z[z],E=_.config(Y(_.table));for(let[U,F]of Object.entries(E))if(O){let M=G[O];M.relations[U]=F}else{if(!(z in $))$[z]={relations:{}};$[z].relations[U]=F}}return{tables:G,tableNamesMap:Z}}function x2(X){return function(Z,$){return new w1(X,Z,$,$?.fields.reduce((G,H)=>G&&H.notNull,!0)??!1)}}function K2(X){return function(Z,$){return new mX(X,Z,$)}}function LZ(X,Y,Z){if(D(Z,w1)&&Z.config)return{fields:Z.config.fields,references:Z.config.references};let $=Y[A1(Z.referencedTable)];if(!$)throw Error(`Table "${Z.referencedTable[A.Symbol.Name]}" not found in schema`);let G=X[$];if(!G)throw Error(`Table "${$}" not found in schema`);let H=Z.sourceTable,_=Y[A1(H)];if(!_)throw Error(`Table "${H[A.Symbol.Name]}" not found in schema`);let z=[];for(let O of Object.values(G.relations))if(Z.relationName&&Z!==O&&O.relationName===Z.relationName||!Z.relationName&&O.referencedTable===Z.sourceTable)z.push(O);if(z.length>1)throw Z.relationName?Error(`There are multiple relations with name "${Z.relationName}" in table "${$}"`):Error(`There are multiple relations between "${$}" and "${Z.sourceTable[A.Symbol.Name]}". Please specify relation name`);if(z[0]&&D(z[0],w1)&&z[0].config)return{fields:z[0].config.references,references:z[0].config.fields};throw Error(`There is not enough information to infer relation "${_}.${Z.fieldName}"`)}function BZ(X){return{one:x2(X),many:K2(X)}}function FX(X,Y,Z,$,G=(H)=>H){let H={};for(let[_,z]of $.entries())if(z.isJson){let O=Y.relations[z.tsKey],E=Z[_],U=typeof E==="string"?JSON.parse(E):E;H[z.tsKey]=D(O,w1)?U&&FX(X,X[z.relationTableTsKey],U,z.selection,G):U.map((F)=>FX(X,X[z.relationTableTsKey],F,z.selection,G))}else{let O=G(Z[_]),E=z.field,U;if(D(E,R))U=E;else if(D(E,x))U=E.decoder;else U=E.sql.decoder;H[z.tsKey]=O===null?null:U.mapFromDriverValue(O)}return H}var r=class{static[J]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(X){return this.then(void 0,X)}finally(X){return this.then((Y)=>{return X?.(),Y},(Y)=>{throw X?.(),Y})}then(X,Y){return this.execute().then(X,Y)}};var TZ=class{static[J]="SQLiteAsyncRelationalQueryBuilder";constructor(X,Y,Z,$,G,H,_,z){this.mode=X,this.fullSchema=Y,this.schema=Z,this.tableNamesMap=$,this.table=G,this.tableConfig=H,this.dialect=_,this.session=z}findMany(X){return this.mode==="sync"?new jZ(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,X?X:{},"many"):new uX(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,X?X:{},"many")}findFirst(X){return this.mode==="sync"?new jZ(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,X?{...X,limit:1}:{limit:1},"first"):new uX(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,X?{...X,limit:1}:{limit:1},"first")}},uX=class extends r{static[J]="SQLiteAsyncRelationalQuery";mode;constructor(X,Y,Z,$,G,H,_,z,O){super();this.fullSchema=X,this.schema=Y,this.tableNamesMap=Z,this.table=$,this.tableConfig=G,this.dialect=H,this.session=_,this.config=z,this.mode=O}getSQL(){return this.dialect._buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}).sql}_prepare(X=!1){let{query:Y,builtQuery:Z}=this._toSQL();return this.session[X?"prepareOneTimeQuery":"prepareQuery"](Z,void 0,this.mode==="first"?"get":"all",!0,($,G)=>{let H=$.map((_)=>FX(this.schema,this.tableConfig,_,Y.selection,G));if(this.mode==="first")return H[0];return H})}prepare(){return this._prepare(!1)}_toSQL(){let X=this.dialect._buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName});return{query:X,builtQuery:this.dialect.sqlToQuery(X.sql)}}toSQL(){return this._toSQL().builtQuery}executeRaw(){if(this.mode==="first")return this._prepare(!1).get();return this._prepare(!1).all()}async execute(){return this.executeRaw()}},jZ=class extends uX{static[J]="SQLiteSyncRelationalQuery";sync(){return this.executeRaw()}};var SZ=class X extends x{sql;static[J]="SQLiteCountBuilderAsync";[Symbol.toStringTag]="SQLiteCountBuilderAsync";session;static buildEmbeddedCount(Y,Z){return W`(select count(*) from ${Y}${W.raw(" where ").if(Z)}${Z})`}static buildCount(Y,Z){return W`select count(*) from ${Y}${W.raw(" where ").if(Z)}${Z}`}constructor(Y){super(X.buildEmbeddedCount(Y.source,Y.filters).queryChunks);this.params=Y,this.session=Y.session,this.sql=X.buildCount(Y.source,Y.filters)}then(Y,Z){return Promise.resolve(this.session.count(this.sql)).then(Y,Z)}catch(Y){return this.then(void 0,Y)}finally(Y){return this.then((Z)=>{return Y?.(),Z},(Z)=>{throw Y?.(),Z})}};var Q1=class{static[J]="ColumnTableAliasProxyHandler";constructor(X,Y){this.table=X,this.ignoreColumnAlias=Y}get(X,Y){if(Y==="table")return this.table;if(Y==="isAlias"&&this.ignoreColumnAlias)return!1;return X[Y]}},CZ=class{static[J]="ViewSelectionAliasProxyHandler";constructor(X,Y,Z){this.view=X,this.selection=Y,this.ignoreColumnAlias=Z}get(X,Y){let Z=X[Y];if(D(Z,R))return new Proxy(Z,new Q1(this.view,this.ignoreColumnAlias));if(D(Z,q)||D(Z,x)||D(Z,x.Aliased)||E1(Z)||typeof Z!=="object"||Z===null)return Z;return new Proxy(Z,this)}},UX=class{static[J]="TableAliasProxyHandler";constructor(X,Y,Z){this.alias=X,this.replaceOriginalName=Y,this.ignoreColumnAlias=Z}get(X,Y){if(Y===A.Symbol.IsAlias)return!0;if(Y===A.Symbol.Name)return this.alias;if(this.replaceOriginalName&&Y===A.Symbol.OriginalName)return this.alias;if(Y===w)return{...X[w],name:this.alias,isAlias:!0,selectedFields:new Proxy(X[w].selectedFields,new CZ(new Proxy(X,this),X[w].selectedFields,this.ignoreColumnAlias))};if(Y===A.Symbol.Columns){let $=X[A.Symbol.Columns];if(!$)return $;if(D(X,y))return new Proxy(X[A.Symbol.Columns],new CZ(new Proxy(X,this),X[A.Symbol.Columns],this.ignoreColumnAlias));let G={};return Object.keys($).map((H)=>{G[H]=new Proxy($[H],new Q1(new Proxy(X,this),this.ignoreColumnAlias))}),G}let Z=X[Y];if(D(Z,R))return new Proxy(Z,new Q1(new Proxy(X,this),this.ignoreColumnAlias));return Z}},k2=class{static[J]="ColumnAliasProxyHandler";constructor(X){this.alias=X}get(X,Y){if(Y==="isAlias")return!0;if(Y==="name")return this.alias;if(Y==="keyAsName")return!1;if(Y===S1)return()=>X;return X[Y]}},N2=class{static[J]="RelationTableAliasProxyHandler";constructor(X){this.alias=X}get(X,Y){if(Y==="sourceTable")return e(X.sourceTable,this.alias);return X[Y]}};function e(X,Y){return new Proxy(X,new UX(Y,!1,!1))}function R2(X,Y){return new Proxy(X,new k2(Y))}function _W(X,Y){return new Proxy(X,new N2(Y))}function Z1(X,Y){return new Proxy(X,new Q1(new Proxy(X.table,new UX(Y,!1,!1)),!1))}function rX(X,Y){return new x.Aliased(e1(X.sql,Y),X.fieldAlias)}function e1(X,Y){return W.join(X.queryChunks.map((Z)=>{if(D(Z,R))return Z1(Z,Y);if(D(Z,x))return e1(Z,Y);if(D(Z,x.Aliased))return rX(Z,Y);return Z}))}R.prototype.as=function(X){return R2(this,X)};function XX(X){return X[S1]()}var W1=class extends Error{static[J]="DrizzleError";constructor({message:X,cause:Y}){super(X);this.name="DrizzleError",this.cause=Y}},x1=class X extends Error{static[J]="DrizzleQueryError";constructor(Y,Z,$){super(`Failed query: ${Y}
|
|
3
|
+
params: ${Z}`);if(this.query=Y,this.params=Z,this.cause=$,Error.captureStackTrace(this,X),$)this.cause=$}},qZ=class extends W1{static[J]="TransactionRollbackError";constructor(){super({message:"Rollback"})}};function vZ(X,Y){for(let Z of Object.values(X))for(let[$,G]of Object.entries(Z.relations)){if(!D(G,P1))continue;G.sourceTable=Z.table,G.fieldName=$}for(let[Z,$]of Object.entries(X))for(let[G,H]of Object.entries($.relations)){if(!D(H,P1))continue;let _,{targetTableName:z,alias:O,sourceColumns:E,targetColumns:U,throughTable:F,sourceTable:M,through:V,where:P,sourceColumnTableNames:L,targetColumnTableNames:j}=H,B=`relations -> ${$.name}: { ${G}: r.${D(H,IX)?"one":"many"}.${z}(...) }`;if(G in $.table[t])throw Error(`${B}: relation name collides with column "${G}" of table "${$.name}"`);if(typeof O==="string"&&!O)throw Error(`${B}: "alias" cannot be an empty string - omit it if you don't need it`);if(E?.length===0)throw Error(`${B}: "from" cannot be empty`);if(U?.length===0)throw Error(`${B}: "to" cannot be empty`);if(E&&U){if(E.length!==U.length&&!F)throw Error(`${B}: "from" and "to" fields without "through" must have the same length`);for(let S of L)if(S!==Z)throw Error(`${B}: all "from" columns must belong to table "${Z}", found column of table "${S}"`);for(let S of j)if(S!==z)throw Error(`${B}: all "to" columns must belong to table "${z}", found column of table "${S}"`);if(V){if(V.source.length!==E.length||V.target.length!==U.length)throw Error(`${B}: ".through(column)" must be used either on all columns in "from" and "to" or not defined on any of them`);for(let S of V.source)if(Y[S._.tableName]!==F)throw Error(`${B}: ".through(column)" must be used on the same table by all columns of the relation`);for(let S of V.target)if(Y[S._.tableName]!==F)throw Error(`${B}: ".through(column)" must be used on the same table by all columns of the relation`)}continue}if(E||U)throw Error(`${B}: relation must have either both "from" and "to" defined, or none of them`);let N=X[z];if(!N)throw Error(`${B}: not enough data provided to build the relation - "from"/"to" are not defined, and no reverse relations of table "${z}" were found"`);if(O){let S=Object.values(N.relations).filter((C)=>D(C,P1)&&C.alias===O&&C!==H);if(S.length>1)throw Error(`${B}: not enough data provided to build the relation - "from"/"to" are not defined, and multiple relations with alias "${O}" found in table "${z}": ${S.map((C)=>`"${C.fieldName}"`).join(", ")}`);if(_=S[0],!_)throw Error(`${B}: not enough data provided to build the relation - "from"/"to" are not defined, and there is no reverse relation of table "${z}" with alias "${O}"`)}else{let S=Object.values(N.relations).filter((C)=>D(C,P1)&&C.targetTable===M&&!C.alias&&C!==H);if(S.length>1)throw Error(`${B}: not enough data provided to build the relation - "from"/"to" are not defined, and multiple relations between "${z}" and "${Z}" were found.
|
|
4
|
+
Hint: you can specify "alias" on both sides of the relation with the same value`);if(_=S[0],!_)throw Error(`${B}: not enough data provided to build the relation - "from"/"to" are not defined, and no reverse relation of table "${z}" with target table "${Z}" was found`)}if(!_.sourceColumns||!_.targetColumns)throw Error(`${B}: not enough data provided to build the relation - "from"/"to" are not defined, and reverse relation "${z}.${_.fieldName}" does not have "from"/"to" defined`);H.sourceColumns=_.targetColumns,H.targetColumns=_.sourceColumns,H.through=_.through?{source:_.through.target,target:_.through.source}:void 0,H.throughTable=_.throughTable,H.isReversed=!P,H.where=P??_.where}return X}function w2(X,Y){let Z={};for(let[$,G]of Object.entries(X))Z[$]={table:G,name:$,relations:Y[$]??{}};return vZ(Z,X)}function Q2(X,Y){let Z={};for(let[$,G]of Object.entries(Y)){if(!G||!X[$])continue;Z[$]={table:X[$],name:$,relations:G}}return vZ(Z,X)}var P1=class{static[J]="RelationV2";fieldName;sourceColumns;targetColumns;alias;where;sourceTable;targetTable;through;throughTable;isReversed;sourceColumnTableNames=[];targetColumnTableNames=[];constructor(X,Y){this.targetTableName=Y,this.targetTable=X}},IX=class extends P1{static[J]="OneV2";relationType="one";optional;constructor(X,Y,Z,$){super(Y,Z);if(this.alias=$?.alias,this.where=$?.where,$?.from)this.sourceColumns=(Array.isArray($.from)?$.from:[$.from]).map((G)=>{return this.throughTable??=G._.through?X[G._.through._.tableName]:void 0,this.sourceColumnTableNames.push(G._.tableName),G._.column});if($?.to)this.targetColumns=(Array.isArray($.to)?$.to:[$.to]).map((G)=>{return this.throughTable??=G._.through?X[G._.through._.tableName]:void 0,this.targetColumnTableNames.push(G._.tableName),G._.column});if(this.throughTable)this.through={source:(Array.isArray($?.from)?$.from:($?.from)?[$.from]:[]).map((G)=>G._.through),target:(Array.isArray($?.to)?$.to:($?.to)?[$.to]:[]).map((G)=>G._.through)};this.optional=$?.optional??!0}},P2=class extends P1{static[J]="ManyV2";relationType="many";constructor(X,Y,Z,$){super(Y,Z);if(this.config=$,this.alias=$?.alias,this.where=$?.where,$?.from)this.sourceColumns=(Array.isArray($.from)?$.from:[$.from]).map((G)=>{return this.throughTable??=G._.through?X[G._.through._.tableName]:void 0,this.sourceColumnTableNames.push(G._.tableName),G._.column});if($?.to)this.targetColumns=(Array.isArray($.to)?$.to:[$.to]).map((G)=>{return this.throughTable??=G._.through?X[G._.through._.tableName]:void 0,this.targetColumnTableNames.push(G._.tableName),G._.column});if(this.throughTable)this.through={source:(Array.isArray($?.from)?$.from:($?.from)?[$.from]:[]).map((G)=>G._.through),target:(Array.isArray($?.to)?$.to:($?.to)?[$.to]:[]).map((G)=>G._.through)}}},L2=class{static[J]="AggregatedField";table;onTable(X){return this.table=X,this}},B2=class extends L2{static[J]="AggregatedFieldCount";query;getSQL(){if(!this.query){if(!this.table)throw Error("Table must be set before building aggregate field");this.query=W`select count(*) as ${W.identifier("r")} from ${K1(this.table)}`.mapWith(Number)}return this.query}},L1={and:u,between:r1,eq:a,exists:N1,gt:y1,gte:f1,ilike:n1,inArray:g1,arrayContains:hX,arrayContained:pX,arrayOverlaps:yX,isNull:c1,isNotNull:u1,like:s1,lt:b1,lte:d1,ne:p1,not:I1,notBetween:o1,notExists:R1,notLike:t1,notIlike:i1,notInArray:m1,or:V1,sql:W},hZ={sql:W,asc:M1,desc:l1};function LW(){return hZ}function VX(X,Y,Z=(_)=>_,$=!1,G=!1,H){for(let _ of Y){if(_.selection){let U=`${H?`${H}.`:""}${_.key}`;if(X[_.key]===null)continue;if($){if(X[_.key]=JSON.parse(X[_.key]),X[_.key]===null)continue}if(G&&typeof X[_.key]==="string")X[_.key]=JSON.parse(X[_.key]);if(_.isArray){for(let F of X[_.key])VX(F,_.selection,Z,!1,G,U);continue}VX(X[_.key],_.selection,Z,!1,G,U);continue}let z=_.field,O=Z(X[_.key]);if(O===null)continue;let E;if(D(z,R))E=z;else if(D(z,x))E=z.decoder;else if(D(z,x.Aliased))E=z.sql.decoder;else if(D(z,A)||D(z,y))E=q1;else E=z.getSQL().decoder;X[_.key]="mapFromJsonValue"in E?E.mapFromJsonValue(O):E.mapFromDriverValue(O)}return X}var j2=class{static[J]="RelationsBuilderTable";_;constructor(X,Y){this._={name:Y,table:X}}},T2=class{static[J]="RelationsBuilderColumn";_;constructor(X,Y,Z){this._={tableName:Y,column:X,key:Z}}through(X){return new S2(this._.column,this._.tableName,this._.key,X)}},S2=class{static[J]="RelationsBuilderColumn";_;constructor(X,Y,Z,$){this._={tableName:Y,column:X,through:$,key:Z}}},C2=class{static[J]="RelationsHelperStatic";_;constructor(X){this._={tables:X};let Y={},Z={};for(let[$,G]of Object.entries(X))Y[$]=(H)=>{return new IX(X,G,$,H)},Z[$]=(H)=>{return new P2(X,G,$,H)};this.one=Y,this.many=Z}one;many;aggs={count(){return new B2}}};function pZ(X){let Y=new C2(X),Z=Object.entries(X).reduce(($,[G,H])=>{let _=new j2(H,G),z=Object.entries(H[t]).reduce((O,[E,U])=>{return O[E]=new T2(U,G,E),O},{});return $[G]=Object.assign(_,z),$},{});return Object.assign(Y,Z)}function yZ(X){return Object.fromEntries(Object.entries(X).filter(([Y,Z])=>D(Z,A)||D(Z,y)))}function BW(X,Y){let Z=yZ(X);return w2(Z,Y?Y(pZ(Z)):{})}function jW(X,Y){let Z=yZ(X);return Q2(Z,Y?Y(pZ(Z)):Object.fromEntries(Object.keys(Z).map(($)=>[$,{}])))}function fZ(X,Y){let Z=X[t][Y];return Z?D(Z,R)?Z:D(Z,x.Aliased)?W`${X}.${W.identifier(Z.fieldAlias)}`:W`${X}.${W.identifier(Y)}`:W`${X}.${W.identifier(Y)}`}function AX(X,Y){if(typeof Y!=="object"||D(Y,l))return a(X,Y);let Z=Object.entries(Y);if(!Z.length)return;let $=[];for(let[G,H]of Z){if(H===void 0)continue;switch(G){case"NOT":{let _=AX(X,H);if(!_)continue;$.push(I1(_));continue}case"OR":if(!H.length)continue;$.push(V1(...H.map((_)=>AX(X,_))));continue;case"AND":if(!H.length)continue;$.push(u(...H.map((_)=>AX(X,_))));continue;case"isNotNull":case"isNull":if(!H)continue;$.push(L1[G](X));continue;case"in":$.push(L1.inArray(X,H));continue;case"notIn":$.push(L1.notInArray(X,H));continue;default:$.push(L1[G](X,H));continue}}if(!$.length)return;return u(...$)}function J1(X,Y,Z={},$={},G,H=0){let _=Object.entries(Y);if(!_.length)return;let z=[];for(let[O,E]of _){if(E===void 0)continue;switch(O){case"RAW":{let U=typeof E==="function"?E(X,L1):E.getSQL();z.push(U);continue}case"OR":if(!E?.length)continue;z.push(V1(...E.map((U)=>J1(X,U,Z,$,G,H))));continue;case"AND":if(!E?.length)continue;z.push(u(...E.map((U)=>J1(X,U,Z,$,G,H))));continue;case"NOT":{if(E===void 0)continue;let U=J1(X,E,Z,$,G,H);if(!U)continue;z.push(I1(U));continue}default:{if(X[t][O]){let N=AX(fZ(X,O),E);if(N)z.push(N);continue}let U=Z[O];if(!U)throw new W1({message:`Unknown relational filter field: "${O}"`});let F=e(U.targetTable,`f${H}`),M=U.throughTable?e(U.throughTable,`ft${H}`):void 0,V=$[U.targetTableName],{filter:P,joinCondition:L}=oX(G,U,X,F,M),j=u(P,typeof E==="boolean"?void 0:J1(F,E,V.relations,$,G,H+1)),B=M?W`(select * from ${K1(F)} inner join ${K1(M)} on ${L}${W` where ${j}`.if(j)} limit 1)`:W`(select * from ${K1(F)}${W` where ${j}`.if(j)} limit 1)`;if(j)z.push((E?N1:R1)(B))}}}return u(...z)}function bZ(X,Y){if(typeof Y==="function"){let $=Y(X,hZ);return D($,x)?$:Array.isArray($)?$.length?W.join($.map((G)=>D(G,x)?G:M1(G)),W`, `):void 0:D($,R)?M1($):void 0}let Z=Object.entries(Y).filter(([$,G])=>G);if(!Z.length)return;return W.join(Z.map(([$,G])=>(G==="asc"?M1:l1)(fZ(X,$))),W`, `)}function dZ(X,Y){let Z=[],$=[];for(let[G,H]of Object.entries(Y)){if(!H)continue;let _=typeof H==="function"?H(X,{sql:L1.sql}):H,z=W`(${_.getSQL()}) as ${W.identifier(G)}`;z.decoder=_.getSQL().decoder,Z.push(z),$.push({key:G,field:z})}return{sql:Z.length?W.join(Z,W`, `):void 0,selection:$}}function oX(X,Y,Z,$,G){if(Y.through){let H=Y.sourceColumns.map((z,O)=>{let E=Y.through.source[O];return a(W`${Z}.${W.identifier(X.getColumnCasing(z))}`,W`${G}.${W.identifier(D(E._.column,R)?X.getColumnCasing(E._.column):E._.key)}`)}),_=Y.targetColumns.map((z,O)=>{let E=Y.through.target[O];return a(W`${G}.${W.identifier(D(E._.column,R)?X.getColumnCasing(E._.column):E._.key)}`,W`${$}.${W.identifier(X.getColumnCasing(z))}`)});return{filter:u(Y.where?J1(Y.isReversed?Z:$,Y.where):void 0,...H),joinCondition:u(..._)}}return{filter:u(...Y.sourceColumns.map((H,_)=>{let z=Y.targetColumns[_];return a(W`${Z}.${W.identifier(X.getColumnCasing(H))}`,W`${$}.${W.identifier(X.getColumnCasing(z))}`)}),Y.where?J1(Y.isReversed?Z:$,Y.where):void 0)}}function K1(X){return W`${X[_1]?W`${W`${W.identifier(X[G1]??"")}.`.if(X[G1])}${W.identifier(X[U1])} as ${X}`:X}`}var mZ=class{static[J]="SQLiteAsyncRelationalQueryBuilderV2";constructor(X,Y,Z,$,G,H,_,z){this.mode=X,this.schema=Y,this.table=Z,this.tableConfig=$,this.dialect=G,this.session=H,this.rowMode=_,this.forbidJsonb=z}findMany(X){return this.mode==="sync"?new gZ(this.schema,this.table,this.tableConfig,this.dialect,this.session,X??!0,"many",this.rowMode,this.forbidJsonb):new sX(this.schema,this.table,this.tableConfig,this.dialect,this.session,X??!0,"many",this.rowMode,this.forbidJsonb)}findFirst(X){return this.mode==="sync"?new gZ(this.schema,this.table,this.tableConfig,this.dialect,this.session,X??!0,"first",this.rowMode,this.forbidJsonb):new sX(this.schema,this.table,this.tableConfig,this.dialect,this.session,X??!0,"first",this.rowMode,this.forbidJsonb)}},sX=class extends r{static[J]="SQLiteAsyncRelationalQueryV2";mode;table;constructor(X,Y,Z,$,G,H,_,z,O){super();this.schema=X,this.tableConfig=Z,this.dialect=$,this.session=G,this.config=H,this.rowMode=z,this.forbidJsonb=O,this.mode=_,this.table=Y}getSQL(){return this.dialect.buildRelationalQuery({schema:this.schema,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,mode:this.mode,jsonb:this.forbidJsonb?W`json`:W`jsonb`}).sql}_prepare(X=!0){let{query:Y,builtQuery:Z}=this._toSQL();return this.session[X?"prepareOneTimeRelationalQuery":"prepareRelationalQuery"](Z,void 0,this.mode==="first"?"get":"all",($,G)=>{let H=$.map((_)=>VX(_,Y.selection,G,!this.rowMode));if(this.mode==="first")return H[0];return H})}prepare(){return this._prepare(!1)}_getQuery(){let X=this.forbidJsonb?W`json`:W`jsonb`,Y=this.dialect.buildRelationalQuery({schema:this.schema,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,mode:this.mode,isNested:this.rowMode,jsonb:X});if(this.rowMode)Y.sql=W`select json_object(${W.join(Y.selection.map((Z)=>{return W`${W.raw(this.dialect.escapeString(Z.key))}, ${Z.selection?W`${X}(${W.identifier(Z.key)})`:W.identifier(Z.key)}`}),W`, `)}) as ${W.identifier("r")} from (${Y.sql}) as ${W.identifier("t")}`;return Y}_toSQL(){let X=this._getQuery();return{query:X,builtQuery:this.dialect.sqlToQuery(X.sql)}}toSQL(){return this._toSQL().builtQuery}executeRaw(){if(this.mode==="first")return this._prepare().get();return this._prepare().all()}async execute(){return this.executeRaw()}},gZ=class extends sX{static[J]="SQLiteSyncRelationalQueryV2";sync(){return this.executeRaw()}};var YX=class extends r{static[J]="SQLiteRaw";config;constructor(X,Y,Z,$,G){super();this.execute=X,this.getSQL=Y,this.dialect=$,this.mapBatchResult=G,this.config={action:Z}}getQuery(){return{...this.dialect.sqlToQuery(this.getSQL()),method:this.config.action}}mapResult(X,Y){return Y?this.mapBatchResult(X):X}_prepare(){return this}isResponseInArrayMode(){return!1}};var m=class X{static[J]="SelectionProxyHandler";config;constructor(Y){this.config={...Y}}get(Y,Z){if(Z==="_")return{...Y._,selectedFields:new Proxy(Y._.selectedFields,this)};if(Z===w)return{...Y[w],selectedFields:new Proxy(Y[w].selectedFields,this)};if(typeof Z==="symbol")return Y[Z];let $=(D(Y,q)?Y._.selectedFields:D(Y,y)?Y[w].selectedFields:Y)[Z];if(D($,x.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!$.isSelectionField)return $.sql;let G=$.clone();return G.isSelectionField=!0,G.origin=this.config.alias,G}if(D($,x)){if(this.config.sqlBehavior==="sql")return $;throw Error(`You tried to reference "${Z}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}if(D($,R)){if(this.config.alias)return new Proxy($,new Q1(new Proxy($.table,new UX(this.config.alias,this.config.replaceOriginalName??!1,!0)),!0));return $}if(typeof $!=="object"||$===null)return $;return new Proxy($,new X(this.config))}};function X1(X){if(D(X,f))return[`${X[A.Symbol.BaseName]}`];if(D(X,q))return X._.usedTables??[];if(D(X,x))return X.usedTables??[];return[]}var MX=class extends r{static[J]="SQLiteDelete";config;constructor(X,Y,Z,$){super();this.table=X,this.session=Y,this.dialect=Z,this.config={table:X,withList:$}}where(X){return this.config.where=X,this}orderBy(...X){if(typeof X[0]==="function"){let Y=X[0](new Proxy(this.config.table[A.Symbol.Columns],new m({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),Z=Array.isArray(Y)?Y:[Y];this.config.orderBy=Z}else{let Y=X;this.config.orderBy=Y}return this}limit(X){return this.config.limit=X,this}returning(X=this.table[f.Symbol.Columns]){return this.config.returning=i(X),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:X,...Y}=this.dialect.sqlToQuery(this.getSQL());return Y}_prepare(X=!0){return this.session[X?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"delete",tables:X1(this.config.table)})}prepare(){return this._prepare(!1)}run=(X)=>{return this._prepare().run(X)};all=(X)=>{return this._prepare().all(X)};get=(X)=>{return this._prepare().get(X)};values=(X)=>{return this._prepare().values(X)};async execute(X){return this._prepare().execute(X)}$dynamic(){return this}};var B1=class extends y{static[J]="SQLiteViewBase"};var cZ=class{static[J]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}};var Y1=class{static[J]="SQLiteSelectBuilder";fields;session;dialect;withList;distinct;constructor(X){this.fields=X.fields,this.session=X.session,this.dialect=X.dialect,this.withList=X.withList,this.distinct=X.distinct}from(X){let Y=!!this.fields,Z;if(this.fields)Z=this.fields;else if(D(X,q))Z=Object.fromEntries(Object.keys(X._.selectedFields).map(($)=>[$,X[$]]));else if(D(X,B1))Z=X[w].selectedFields;else if(D(X,x))Z={};else Z=FY(X);return new tX({table:X,fields:Z,isPartialSelect:Y,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct})}},uZ=class extends cZ{static[J]="SQLiteSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:X,fields:Y,isPartialSelect:Z,session:$,dialect:G,withList:H,distinct:_}){super();this.config={withList:H,table:X,fields:{...Y},distinct:_,setOperators:[]},this.isPartialSelect=Z,this.session=$,this.dialect=G,this._={selectedFields:Y,config:this.config},this.tableName=h1(X),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{};for(let z of X1(X))this.usedTables.add(z)}getUsedTables(){return[...this.usedTables]}createJoin(X){return(Y,Z)=>{let $=this.tableName,G=h1(Y);for(let H of X1(Y))this.usedTables.add(H);if(typeof G==="string"&&this.config.joins?.some((H)=>H.alias===G))throw Error(`Alias "${G}" is already used in this query`);if(!this.isPartialSelect){if(Object.keys(this.joinsNotNullableMap).length===1&&typeof $==="string")this.config.fields={[$]:this.config.fields};if(typeof G==="string"&&!D(Y,x)){let H=D(Y,q)?Y._.selectedFields:D(Y,y)?Y[w].selectedFields:Y[A.Symbol.Columns];this.config.fields[G]=H}}if(typeof Z==="function")Z=Z(new Proxy(this.config.fields,new m({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));if(!this.config.joins)this.config.joins=[];if(this.config.joins.push({on:Z,table:Y,joinType:X,alias:G}),typeof G==="string")switch(X){case"left":this.joinsNotNullableMap[G]=!1;break;case"right":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([H])=>[H,!1])),this.joinsNotNullableMap[G]=!0;break;case"cross":case"inner":this.joinsNotNullableMap[G]=!0;break;case"full":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([H])=>[H,!1])),this.joinsNotNullableMap[G]=!1;break}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");crossJoin=this.createJoin("cross");createSetOperator(X,Y){return(Z)=>{let $=typeof Z==="function"?Z(q2()):Z;if(!v1(this.getSelectedFields(),$.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:X,isAll:Y,rightSelect:$}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);except=this.createSetOperator("except",!1);addSetOperators(X){return this.config.setOperators.push(...X),this}where(X){if(typeof X==="function")X=X(new Proxy(this.config.fields,new m({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.where=X,this}having(X){if(typeof X==="function")X=X(new Proxy(this.config.fields,new m({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.having=X,this}groupBy(...X){if(typeof X[0]==="function"){let Y=X[0](new Proxy(this.config.fields,new m({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(Y)?Y:[Y]}else this.config.groupBy=X;return this}orderBy(...X){if(typeof X[0]==="function"){let Y=X[0](new Proxy(this.config.fields,new m({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),Z=Array.isArray(Y)?Y:[Y];if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=Z;else this.config.orderBy=Z}else{let Y=X;if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=Y;else this.config.orderBy=Y}return this}limit(X){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).limit=X;else this.config.limit=X;return this}offset(X){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).offset=X;else this.config.offset=X;return this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:X,...Y}=this.dialect.sqlToQuery(this.getSQL());return Y}as(X){let Y=[];if(Y.push(...X1(this.config.table)),this.config.joins)for(let Z of this.config.joins)Y.push(...X1(Z.table));return new Proxy(new q(this.getSQL(),this.config.fields,X,!1,[...new Set(Y)]),new m({alias:X,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new m({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}},tX=class extends uZ{static[J]="SQLiteSelect";_prepare(X=!0){if(!this.session)throw Error("Cannot execute a query on a query builder. Please use a database instance instead.");let Y=i(this.config.fields),Z=this.session[X?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),Y,"all",!0,void 0,{type:"select",tables:[...this.usedTables]},this.cacheConfig);return Z.joinsNotNullableMap=this.joinsNotNullableMap,Z}$withCache(X){return this.cacheConfig=X===void 0?{config:{},enabled:!0,autoInvalidate:!0}:X===!1?{enabled:!1}:{enabled:!0,autoInvalidate:!0,...X},this}prepare(){return this._prepare(!1)}run=(X)=>{return this._prepare().run(X)};all=(X)=>{return this._prepare().all(X)};get=(X)=>{return this._prepare().get(X)};values=(X)=>{return this._prepare().values(X)};async execute(){return this.all()}};OY(tX,[r]);function xX(X,Y){return(Z,$,...G)=>{let H=[$,...G].map((_)=>({type:X,isAll:Y,rightSelect:_}));for(let _ of H)if(!v1(Z.getSelectedFields(),_.rightSelect.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return Z.addSetOperators(H)}}var q2=()=>({union:rZ,unionAll:oZ,intersect:sZ,except:tZ}),rZ=xX("union",!1),oZ=xX("union",!0),sZ=xX("intersect",!1),tZ=xX("except",!1);function mJ(X){let Y=parseInt(X.slice(0,4),10),Z=parseInt(X.slice(4,6),10)-1,$=parseInt(X.slice(6,8),10),G=parseInt(X.slice(8,10),10),H=parseInt(X.slice(10,12),10),_=parseInt(X.slice(12,14),10);return Date.UTC(Y,Z,$,G,H,_)}function nZ(X){let{localMigrations:Y,dbMigrations:Z}=X,$=new Set(Z.map((G)=>G.name).filter((G)=>G!==null));return Y.filter((G)=>!G.name||!$.has(G.name))}var iZ=1;function v2(X){if(X.includes("name"))return 1;return 0}function nX(X,Y,Z=()=>[]){let $=X.all(Y);if($.length===0)return[];if(Array.isArray($[0]))return $.map((G)=>Z(G));return $}function lZ(X,Y,Z){if(nX(Y,W`SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ${X}`,(G)=>({"1":G[0]})).length===0)return{newDb:!0};let $=v2(nX(Y,W`SELECT name as column_name FROM pragma_table_info(${X})`,(G)=>({column_name:G[0]})).map((G)=>G.column_name));for(let G=$;G<iZ;G++){let H=h2[G];if(!H)throw Error(`No upgrade path from migration table version ${G} to ${G+1}`);H(X,Y,Z)}return{prevVersion:$,currentVersion:iZ}}var h2={0:(X,Y,Z)=>{let $=W`${W.identifier(X)}`,G=nX(Y,W`SELECT id, hash, created_at FROM ${$} ORDER BY id ASC`,(E)=>({id:E[0],hash:E[1],created_at:E[2]}));Z.sort((E,U)=>E.folderMillis!==U.folderMillis?E.folderMillis-U.folderMillis:(E.name??"").localeCompare(U.name??""));let H=new Map,_=new Map;for(let E of Z){if(!H.has(E.folderMillis))H.set(E.folderMillis,[]);H.get(E.folderMillis).push(E),_.set(E.hash,E)}let z=[],O=[];for(let E of G){let U=String(E.created_at),F=Number(U.substring(0,U.length-3)+"000"),M=H.get(F),V,P=null;if(M&&M.length===1)V=M[0],P="millis";else if(M&&M.length>1){if(V=M.find((L)=>L.hash&&E.hash&&L.hash===E.hash),V)P="hash"}else if(V=_.get(E.hash),V)P="hash";if(V)z.push({id:E.id,name:V.name,hash:E.hash,created_at:U,matchedBy:E.id?"id":P});else O.push(E)}if(O.length>0)throw Error(`While upgrading your database migrations table we found ${O.length} (${O.map((E)=>`[id: ${E.id}, created_at: ${E.created_at}]`).join(", ")}) migrations in the database that do not match any local migration. This means that some migrations were applied to the database but are missing from the local environment`);Y.transaction((E)=>{E.run(W`ALTER TABLE ${$} ADD COLUMN ${W.identifier("name")} text`),E.run(W`ALTER TABLE ${$} ADD COLUMN ${W.identifier("applied_at")} TEXT`);for(let U of z){let F=W`UPDATE ${$} SET ${W.identifier("name")} = ${U.name}, ${W.identifier("applied_at")} = NULL WHERE`;if(U.id)F.append(W` ${W.identifier("id")} = ${U.id}`);else if(U.matchedBy==="millis")F.append(W` ${W.identifier("created_at")} = ${U.created_at}`);else F.append(W` ${W.identifier("hash")} = ${U.hash}`);E.run(F)}})}};function p2(X){return(X.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map((Y)=>Y.toLowerCase()).join("_")}function y2(X){return(X.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((Y,Z,$)=>{return Y+($===0?Z.toLowerCase():`${Z[0].toUpperCase()}${Z.slice(1)}`)},"")}function f2(X){return X}var aZ=class{static[J]="CasingCache";cache={};cachedTables={};convert;constructor(X){this.convert=X==="snake_case"?p2:X==="camelCase"?y2:f2}getColumnCasing(X){if(!X.keyAsName)return X.name;let Y=`${X.table[A.Symbol.Schema]??"public"}.${X.table[A.Symbol.OriginalName]}.${X.name}`;if(!this.cache[Y])this.cacheTable(X.table);return this.cache[Y]}cacheTable(X){let Y=`${X[A.Symbol.Schema]??"public"}.${X[A.Symbol.OriginalName]}`;if(!this.cachedTables[Y]){for(let Z of Object.values(X[A.Symbol.Columns])){if(!D(Z,R))continue;let $=`${Y}.${Z.name}`;this.cache[$]=this.convert(Z.name)}this.cachedTables[Y]=!0}}clearCache(){this.cache={},this.cachedTables={}}};var KX=class{static[J]="SQLiteDialect";casing;constructor(X){this.casing=new aZ(X?.casing)}escapeName(X){return`"${X}"`}escapeParam(X){return"?"}escapeString(X){return`'${X.replace(/'/g,"''")}'`}buildWithCTE(X){if(!X?.length)return;let Y=[W`with `];for(let[Z,$]of X.entries())if(Y.push(W`${W.identifier($._.alias)} as (${$._.sql})`),Z<X.length-1)Y.push(W`, `);return Y.push(W` `),W.join(Y)}buildDeleteQuery({table:X,where:Y,returning:Z,withList:$,limit:G,orderBy:H}){let _=this.buildWithCTE($),z=Z?W` returning ${this.buildSelection(Z,{isSingleTable:!0})}`:void 0;return W`${_}delete from ${X}${Y?W` where ${Y}`:void 0}${z}${this.buildOrderBy(H)}${this.buildLimit(G)}`}buildUpdateSet(X,Y){let Z=X[A.Symbol.Columns],$=Object.keys(Z).filter((H)=>Y[H]!==void 0||Z[H]?.onUpdateFn!==void 0),G=$.length;return W.join($.flatMap((H,_)=>{let z=Z[H],O=z.onUpdateFn?.(),E=Y[H]??(D(O,x)?O:W.param(O,z)),U=W`${W.identifier(this.casing.getColumnCasing(z))} = ${E}`;if(_<G-1)return[U,W.raw(", ")];return[U]}))}buildUpdateQuery({table:X,set:Y,where:Z,returning:$,withList:G,joins:H,from:_,limit:z,orderBy:O}){let E=this.buildWithCTE(G),U=this.buildUpdateSet(X,Y),F=_&&W.join([W.raw(" from "),this.buildFromTable(_)]),M=this.buildJoins(H),V=$?W` returning ${this.buildSelection($,{isSingleTable:!0})}`:void 0;return W`${E}update ${X} set ${U}${F}${M}${Z?W` where ${Z}`:void 0}${V}${this.buildOrderBy(O)}${this.buildLimit(z)}`}buildSelection(X,{isSingleTable:Y=!1}={}){let Z=X.length,$=X.flatMap(({field:G},H)=>{let _=[];if(D(G,x.Aliased)&&G.isSelectionField){if(!Y&&G.origin!==void 0)_.push(W.identifier(G.origin),W.raw("."));_.push(W.identifier(G.fieldAlias))}else if(D(G,x.Aliased)||D(G,x)){let z=D(G,x.Aliased)?G.sql:G;if(Y){let O=new x(z.queryChunks.map((E)=>{if(D(E,R))return W.identifier(this.casing.getColumnCasing(E));return E}));_.push(z.shouldInlineParams?O.inlineParams():O)}else _.push(z);if(D(G,x.Aliased))_.push(W` as ${W.identifier(G.fieldAlias)}`)}else if(D(G,R))if(G.columnType==="SQLiteNumericBigInt")if(Y)_.push(G.isAlias?W`cast(${W.identifier(this.casing.getColumnCasing(XX(G)))} as text) as ${G}`:W`cast(${W.identifier(this.casing.getColumnCasing(G))} as text)`);else _.push(G.isAlias?W`cast(${XX(G)} as text) as ${G}`:W`cast(${G} as text)`);else if(Y)_.push(G.isAlias?W`${W.identifier(this.casing.getColumnCasing(XX(G)))} as ${G}`:W.identifier(this.casing.getColumnCasing(G)));else _.push(G.isAlias?W`${XX(G)} as ${G}`:G);else if(D(G,q)){let z=Object.entries(G._.selectedFields);if(z.length===1){let O=z[0][1],E=D(O,x)?O.decoder:D(O,R)?{mapFromDriverValue:(U)=>O.mapFromDriverValue(U)}:O.sql.decoder;if(E)G._.sql.decoder=E}_.push(G)}if(H<Z-1)_.push(W`, `);return _});return W.join($)}buildJoins(X){if(!X||X.length===0)return;let Y=[];if(X)for(let[Z,$]of X.entries()){if(Z===0)Y.push(W` `);let G=$.table,H=$.on?W` on ${$.on}`:void 0;if(D(G,f)){let _=G[f.Symbol.Name],z=G[f.Symbol.Schema],O=G[f.Symbol.OriginalName],E=_===O?void 0:$.alias;Y.push(W`${W.raw($.joinType)} join ${z?W`${W.identifier(z)}.`:void 0}${W.identifier(O)}${E&&W` ${W.identifier(E)}`}${H}`)}else Y.push(W`${W.raw($.joinType)} join ${G}${H}`);if(Z<X.length-1)Y.push(W` `)}return W.join(Y)}buildLimit(X){return typeof X==="object"||typeof X==="number"&&X>=0?W` limit ${X}`:void 0}buildOrderBy(X){let Y=[];if(X){for(let[Z,$]of X.entries())if(Y.push($),Z<X.length-1)Y.push(W`, `)}return Y.length>0?W` order by ${W.join(Y)}`:void 0}buildFromTable(X){if(D(X,A)&&X[A.Symbol.IsAlias])return W`${W`${W.identifier(X[A.Symbol.Schema]??"")}.`.if(X[A.Symbol.Schema])}${W.identifier(X[A.Symbol.OriginalName])} ${W.identifier(X[A.Symbol.Name])}`;if(D(X,y)&&X[w].isAlias){let Y=W`${W.identifier(X[w].originalName)}`;if(X[w].schema)Y=W`${W.identifier(X[w].schema)}.${Y}`;return W`${Y} ${W.identifier(X[w].name)}`}return X}buildSelectQuery({withList:X,fields:Y,fieldsFlat:Z,where:$,having:G,table:H,joins:_,orderBy:z,groupBy:O,limit:E,offset:U,distinct:F,setOperators:M}){let V=Z??i(Y);for(let h of V)if(D(h.field,R)&&z1(h.field.table)!==(D(H,q)?H._.alias:D(H,B1)?H[w].name:D(H,x)?void 0:z1(H))&&!((o)=>_?.some(({alias:n})=>n===(o[A.Symbol.IsAlias]?z1(o):o[A.Symbol.BaseName])))(h.field.table)){let o=z1(h.field.table);throw Error(`Your "${h.path.join("->")}" field references a column "${o}"."${h.field.name}", but the table "${o}" is not part of the query! Did you forget to join it?`)}let P=!_||_.length===0,L=this.buildWithCTE(X),j=F?W` distinct`:void 0,B=this.buildSelection(V,{isSingleTable:P}),N=this.buildFromTable(H),S=this.buildJoins(_),C=$?W` where ${$}`:void 0,d=G?W` having ${G}`:void 0,Q=[];if(O){for(let[h,o]of O.entries())if(Q.push(o),h<O.length-1)Q.push(W`, `)}let T=W`${L}select${j} ${B} from ${N}${S}${C}${Q.length>0?W` group by ${W.join(Q)}`:void 0}${d}${this.buildOrderBy(z)}${this.buildLimit(E)}${U?W` offset ${U}`:void 0}`;if(M.length>0)return this.buildSetOperations(T,M);return T}buildSetOperations(X,Y){let[Z,...$]=Y;if(!Z)throw Error("Cannot pass undefined values to any set operator");if($.length===0)return this.buildSetOperationQuery({leftSelect:X,setOperator:Z});return this.buildSetOperations(this.buildSetOperationQuery({leftSelect:X,setOperator:Z}),$)}buildSetOperationQuery({leftSelect:X,setOperator:{type:Y,isAll:Z,rightSelect:$,limit:G,orderBy:H,offset:_}}){let z=W`${X.getSQL()} `,O=W`${$.getSQL()}`,E;if(H&&H.length>0){let V=[];for(let P of H)if(D(P,v))V.push(W.identifier(P.name));else if(D(P,x)){for(let L=0;L<P.queryChunks.length;L++){let j=P.queryChunks[L];if(D(j,v))P.queryChunks[L]=W.identifier(this.casing.getColumnCasing(j))}V.push(W`${P}`)}else V.push(W`${P}`);E=W` order by ${W.join(V,W`, `)}`}let U=typeof G==="object"||typeof G==="number"&&G>=0?W` limit ${G}`:void 0,F=W.raw(`${Y} ${Z?"all ":""}`),M=_?W` offset ${_}`:void 0;return W`${z}${F}${O}${E}${U}${M}`}buildInsertQuery({table:X,values:Y,onConflict:Z,returning:$,withList:G,select:H}){let _=[],z=X[A.Symbol.Columns],O=Object.entries(z).filter(([V,P])=>!P.shouldDisableInsert()),E=O.map(([,V])=>W.identifier(this.casing.getColumnCasing(V)));if(H){let V=Y;if(D(V,x))_.push(V);else _.push(V.getSQL())}else{let V=Y;_.push(W.raw("values "));for(let[P,L]of V.entries()){let j=[];for(let[B,N]of O){let S=L[B];if(S===void 0||D(S,c)&&S.value===void 0){let C;if(N.default!==null&&N.default!==void 0)C=D(N.default,x)?N.default:W.param(N.default,N);else if(N.defaultFn!==void 0){let d=N.defaultFn();C=D(d,x)?d:W.param(d,N)}else if(!N.default&&N.onUpdateFn!==void 0){let d=N.onUpdateFn();C=D(d,x)?d:W.param(d,N)}else C=W`null`;j.push(C)}else j.push(S)}if(_.push(j),P<V.length-1)_.push(W`, `)}}let U=this.buildWithCTE(G),F=W.join(_),M=$?W` returning ${this.buildSelection($,{isSingleTable:!0})}`:void 0;return W`${U}insert into ${X} ${E} ${F}${Z?.length?W.join(Z):void 0}${M}`}sqlToQuery(X,Y){return X.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,invokeSource:Y})}_buildRelationalQuery({fullSchema:X,schema:Y,tableNamesMap:Z,table:$,tableConfig:G,queryConfig:H,tableAlias:_,nestedQueryRelation:z,joinOn:O}){let E=[],U,F,M=[],V,P=[];if(H===!0)E=Object.entries(G.columns).map(([j,B])=>({dbKey:B.name,tsKey:j,field:Z1(B,_),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let j=Object.fromEntries(Object.entries(G.columns).map(([Q,T])=>[Q,Z1(T,_)]));if(H.where){let Q=typeof H.where==="function"?H.where(j,wZ()):H.where;V=Q&&e1(Q,_)}let B=[],N=[];if(H.columns){let Q=!1;for(let[T,h]of Object.entries(H.columns)){if(h===void 0)continue;if(T in G.columns){if(!Q&&h===!0)Q=!0;N.push(T)}}if(N.length>0)N=Q?N.filter((T)=>H.columns?.[T]===!0):Object.keys(G.columns).filter((T)=>!N.includes(T))}else N=Object.keys(G.columns);for(let Q of N){let T=G.columns[Q];B.push({tsKey:Q,value:T})}let S=[];if(H.with)S=Object.entries(H.with).filter((Q)=>!!Q[1]).map(([Q,T])=>({tsKey:Q,queryConfig:T,relation:G.relations[Q]}));let C;if(H.extras){C=typeof H.extras==="function"?H.extras(j,{sql:W}):H.extras;for(let[Q,T]of Object.entries(C))B.push({tsKey:Q,value:rX(T,_)})}for(let{tsKey:Q,value:T}of B)E.push({dbKey:D(T,x.Aliased)?T.fieldAlias:G.columns[Q].name,tsKey:Q,field:D(T,R)?Z1(T,_):T,relationTableTsKey:void 0,isJson:!1,selection:[]});let d=typeof H.orderBy==="function"?H.orderBy(j,QZ()):H.orderBy??[];if(!Array.isArray(d))d=[d];M=d.map((Q)=>{if(D(Q,R))return Z1(Q,_);return e1(Q,_)}),U=H.limit,F=H.offset;for(let{tsKey:Q,queryConfig:T,relation:h}of S){let o=LZ(Y,Z,h),n=Z[A1(h.referencedTable)],H1=`${_}_${Q}`,$1=u(...o.fields.map((T1,PX)=>a(Z1(o.references[PX],H1),Z1(T1,_)))),k1=this._buildRelationalQuery({fullSchema:X,schema:Y,tableNamesMap:Z,table:X[n],tableConfig:Y[n],queryConfig:D(h,w1)?T===!0?{limit:1}:{...T,limit:1}:T,tableAlias:H1,joinOn:$1,nestedQueryRelation:h}),j1=W`(${k1.sql})`.as(Q);E.push({dbKey:Q,tsKey:Q,field:j1,relationTableTsKey:n,isJson:!0,selection:k1.selection})}}if(E.length===0)throw new W1({message:`No fields selected for table "${G.tsName}" ("${_}"). You need to have at least one item in "columns", "with" or "extras". If you need to select all columns, omit the "columns" key or set it to undefined.`});let L;if(V=u(O,V),z){let j=W`json_array(${W.join(E.map(({field:N})=>D(N,v)?W.identifier(this.casing.getColumnCasing(N)):D(N,x.Aliased)?N.sql:N),W`, `)})`;if(D(z,mX))j=W`coalesce(json_group_array(${j}), json_array())`;let B=[{dbKey:"data",tsKey:"data",field:j.as("data"),isJson:!0,relationTableTsKey:G.tsName,selection:E}];if(U!==void 0||F!==void 0||M.length>0)L=this.buildSelectQuery({table:e($,_),fields:{},fieldsFlat:[{path:[],field:W.raw("*")}],where:V,limit:U,offset:F,orderBy:M,setOperators:[]}),V=void 0,U=void 0,F=void 0,M=void 0;else L=e($,_);L=this.buildSelectQuery({table:D(L,f)?L:new q(L,{},_),fields:{},fieldsFlat:B.map(({field:N})=>({path:[],field:D(N,R)?Z1(N,_):N})),joins:P,where:V,limit:U,offset:F,orderBy:M,setOperators:[]})}else L=this.buildSelectQuery({table:e($,_),fields:{},fieldsFlat:E.map(({field:j})=>({path:[],field:D(j,R)?Z1(j,_):j})),joins:P,where:V,limit:U,offset:F,orderBy:M,setOperators:[]});return{tableTsKey:G.tsName,sql:L,selection:E}}nestedSelectionerror(){throw new W1({message:"Views with nested selections are not supported by the relational query builder"})}buildRqbColumn(X,Y,Z){if(D(Y,R)){let $=W`${X}.${W.identifier(this.casing.getColumnCasing(Y))}`;switch(Y.columnType){case"SQLiteBigInt":case"SQLiteBlobJson":case"SQLiteBlobBuffer":return W`hex(${$}) as ${W.identifier(Z)}`;case"SQLiteNumeric":case"SQLiteNumericNumber":case"SQLiteNumericBigInt":return W`cast(${$} as text) as ${W.identifier(Z)}`;case"SQLiteCustomColumn":return W`${Y.jsonSelectIdentifier($,W)} as ${W.identifier(Z)}`;default:return W`${$} as ${W.identifier(Z)}`}}return W`${X}.${D(Y,x.Aliased)?W.identifier(Y.fieldAlias):E1(Y)?W.identifier(Z):this.nestedSelectionerror()} as ${W.identifier(Z)}`}unwrapAllColumns=(X,Y)=>{return W.join(Object.entries(X[t]).map(([Z,$])=>{return Y.push({key:Z,field:$}),this.buildRqbColumn(X,$,Z)}),W`, `)};getSelectedTableColumns=(X,Y)=>{let Z=[],$=X[t],G=Object.entries(Y),H;for(let[_,z]of G){if(z===void 0)continue;if(H=H||z,z){let O=$[_];Z.push({column:O,tsName:_})}}if(H===!1)for(let[_,z]of Object.entries($)){if(Y[_]===!1)continue;Z.push({column:z,tsName:_})}return Z};buildColumns=(X,Y,Z)=>Z?.columns?(()=>{let $=[],G=this.getSelectedTableColumns(X,Z?.columns);for(let{column:H,tsName:_}of G)$.push(this.buildRqbColumn(X,H,_)),Y.push({key:_,field:H});return $.length?W.join($,W`, `):void 0})():this.unwrapAllColumns(X,Y);buildRelationalQuery({schema:X,table:Y,tableConfig:Z,queryConfig:$,relationWhere:G,mode:H,isNested:_,errorPath:z,depth:O,throughJoin:E,jsonb:U}){let F=[],M=H==="first",V=$===!0?void 0:$,P=z??"",L=O??0;if(!L)Y=e(Y,`d${L}`);let j=M?1:V?.limit,B=V?.offset,N=this.buildColumns(Y,F,V),S=V?.where&&G?u(J1(Y,V.where,Z.relations,X,this.casing),G):V?.where?J1(Y,V.where,Z.relations,X,this.casing):G,C=V?.orderBy?bZ(Y,V.orderBy):void 0,d=V?.extras?dZ(Y,V.extras):void 0;if(d)F.push(...d.selection);let Q=V?(()=>{let{with:h}=V;if(!h)return;let o=Object.entries(h).filter(([n,H1])=>H1);if(!o.length)return;return W.join(o.map(([n,H1])=>{let $1=Z.relations[n],k1=D($1,IX),j1=e($1.targetTable,`d${L+1}`),T1=$1.throughTable?e($1.throughTable,`tr${L}`):void 0,{filter:PX,joinCondition:G0}=oX(this.casing,$1,Y,j1,T1),W0=T1?W` inner join ${K1(T1)} on ${G0}`:void 0,GX=this.buildRelationalQuery({table:j1,mode:k1?"first":"many",schema:X,queryConfig:H1,tableConfig:X[$1.targetTableName],relationWhere:PX,isNested:!0,errorPath:`${P.length?`${P}.`:""}${n}`,depth:L+1,throughJoin:W0,jsonb:U});F.push({field:j1,key:n,selection:GX.selection,isArray:!k1,isOptional:($1.optional??!1)||H1!==!0&&!!H1.where});let GY=W.join(GX.selection.map((WX)=>{return W`${W.raw(this.escapeString(WX.key))}, ${WX.selection?W`${U}(${W.identifier(WX.key)})`:W.identifier(WX.key)}`}),W`, `),WY=_?U:W`json`;return k1?W`(select ${WY}_object(${GY}) as ${W.identifier("r")} from (${GX.sql}) as ${W.identifier("t")}) as ${W.identifier(n)}`:W`coalesce((select ${WY}_group_array(json_object(${GY})) as ${W.identifier("r")} from (${GX.sql}) as ${W.identifier("t")}), ${U}_array()) as ${W.identifier(n)}`}),W`, `)})():void 0,T=[N,d?.sql,Q].filter((h)=>h!==void 0);if(!T.length)throw new W1({message:`No fields selected for table "${Z.name}"${P?` ("${P}")`:""}`});return{sql:W`select ${W.join(T,W`, `)} from ${K1(Y)}${E}${W` where ${S}`.if(S)}${W` order by ${C}`.if(C)}${W` limit ${j}`.if(j!==void 0)}${W` offset ${B}`.if(B!==void 0)}`,selection:F}}},kX=class extends KX{static[J]="SQLiteSyncDialect";migrate(X,Y,Z){let $=Z===void 0?"__drizzle_migrations":typeof Z==="string"?"__drizzle_migrations":Z.migrationsTable??"__drizzle_migrations",{newDb:G}=lZ($,Y,X);if(G){let z=W`
|
|
5
|
+
CREATE TABLE IF NOT EXISTS ${W.identifier($)} (
|
|
6
|
+
id INTEGER PRIMARY KEY,
|
|
7
|
+
hash text NOT NULL,
|
|
8
|
+
created_at numeric,
|
|
9
|
+
name text,
|
|
10
|
+
applied_at TEXT
|
|
11
|
+
)`;Y.run(z)}let H=Y.all(W`SELECT id, hash, created_at, name FROM ${W.identifier($)}`);if(typeof Z==="object"&&Z.init){if(H.length)return{exitCode:"databaseMigrations"};if(X.length>1)return{exitCode:"localMigrations"};let[z]=X;if(!z)return;Y.run(W`insert into ${W.identifier($)} ("hash", "created_at", "name", "applied_at") values(${z.hash}, ${z.folderMillis}, ${z.name}, ${new Date().toISOString()})`);return}let _=nZ({localMigrations:X,dbMigrations:H});Y.run(W`BEGIN`);try{for(let z of _){for(let O of z.sql)Y.run(W.raw(O));Y.run(W`INSERT INTO ${W.identifier($)} ("hash", "created_at", "name", "applied_at") values(${z.hash}, ${z.folderMillis}, ${z.name}, ${new Date().toISOString()})`)}Y.run(W`COMMIT`)}catch(z){throw Y.run(W`ROLLBACK`),z}}};var ZX=class{static[J]="SQLiteQueryBuilder";dialect;dialectConfig;constructor(X){this.dialect=D(X,KX)?X:void 0,this.dialectConfig=D(X,KX)?void 0:X}$with=(X,Y)=>{let Z=this;return{as:(G)=>{if(typeof G==="function")G=G(Z);return new Proxy(new JX(G.getSQL(),Y??("getSelectedFields"in G?G.getSelectedFields()??{}:{}),X,!0),new m({alias:X,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};with(...X){let Y=this;function Z(G){return new Y1({fields:G??void 0,session:void 0,dialect:Y.getDialect(),withList:X})}function $(G){return new Y1({fields:G??void 0,session:void 0,dialect:Y.getDialect(),withList:X,distinct:!0})}return{select:Z,selectDistinct:$}}select(X){return new Y1({fields:X??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(X){return new Y1({fields:X??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}getDialect(){if(!this.dialect)this.dialect=new kX(this.dialectConfig);return this.dialect}};var NX=class{static[J]="SQLiteInsertBuilder";constructor(X,Y,Z,$){this.table=X,this.session=Y,this.dialect=Z,this.withList=$}values(X){if(X=Array.isArray(X)?X:[X],X.length===0)throw Error("values() must be called with at least one value");let Y=X.map((Z)=>{let $={},G=this.table[A.Symbol.Columns];for(let H of Object.keys(Z)){let _=Z[H];$[H]=D(_,x)?_:new c(_,G[H])}return $});return new iX(this.table,Y,this.session,this.dialect,this.withList)}select(X){let Y=typeof X==="function"?X(new ZX):X;if(!D(Y,x)&&!v1(this.table[t],Y._.selectedFields))throw Error("Insert select error: selected fields are not the same or are in a different order compared to the table definition");return new iX(this.table,Y,this.session,this.dialect,this.withList,!0)}},iX=class extends r{static[J]="SQLiteInsert";config;constructor(X,Y,Z,$,G,H){super();this.session=Z,this.dialect=$,this.config={table:X,values:Y,withList:G,select:H}}returning(X=this.config.table[f.Symbol.Columns]){return this.config.returning=i(X),this}onConflictDoNothing(X={}){if(!this.config.onConflict)this.config.onConflict=[];if(X.target===void 0)this.config.onConflict.push(W` on conflict do nothing`);else{let Y=Array.isArray(X.target)?W`${X.target}`:W`${[X.target]}`,Z=X.where?W` where ${X.where}`:W``;this.config.onConflict.push(W` on conflict ${Y} do nothing${Z}`)}return this}onConflictDoUpdate(X){if(X.where&&(X.targetWhere||X.setWhere))throw Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');if(!this.config.onConflict)this.config.onConflict=[];let Y=X.where?W` where ${X.where}`:void 0,Z=X.targetWhere?W` where ${X.targetWhere}`:void 0,$=X.setWhere?W` where ${X.setWhere}`:void 0,G=Array.isArray(X.target)?W`${X.target}`:W`${[X.target]}`,H=this.dialect.buildUpdateSet(this.config.table,HX(this.config.table,X.set));return this.config.onConflict.push(W` on conflict ${G}${Z} do update set ${H}${Y}${$}`),this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:X,...Y}=this.dialect.sqlToQuery(this.getSQL());return Y}_prepare(X=!0){return this.session[X?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"insert",tables:X1(this.config.table)})}prepare(){return this._prepare(!1)}run=(X)=>{return this._prepare().run(X)};all=(X)=>{return this._prepare().all(X)};get=(X)=>{return this._prepare().get(X)};values=(X)=>{return this._prepare().values(X)};async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}};var RX=class{static[J]="SQLiteUpdateBuilder";constructor(X,Y,Z,$){this.table=X,this.session=Y,this.dialect=Z,this.withList=$}set(X){return new eZ(this.table,HX(this.table,X),this.session,this.dialect,this.withList)}},eZ=class extends r{static[J]="SQLiteUpdate";config;constructor(X,Y,Z,$,G){super();this.session=Z,this.dialect=$,this.config={set:Y,table:X,withList:G,joins:[]}}from(X){return this.config.from=X,this}createJoin(X){return(Y,Z)=>{let $=h1(Y);if(typeof $==="string"&&this.config.joins.some((G)=>G.alias===$))throw Error(`Alias "${$}" is already used in this query`);if(typeof Z==="function"){let G=this.config.from?D(Y,f)?Y[A.Symbol.Columns]:D(Y,q)?Y._.selectedFields:D(Y,B1)?Y[w].selectedFields:void 0:void 0;Z=Z(new Proxy(this.config.table[A.Symbol.Columns],new m({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),G&&new Proxy(G,new m({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}return this.config.joins.push({on:Z,table:Y,joinType:X,alias:$}),this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where(X){return this.config.where=X,this}orderBy(...X){if(typeof X[0]==="function"){let Y=X[0](new Proxy(this.config.table[A.Symbol.Columns],new m({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),Z=Array.isArray(Y)?Y:[Y];this.config.orderBy=Z}else{let Y=X;this.config.orderBy=Y}return this}limit(X){return this.config.limit=X,this}returning(X=this.config.table[f.Symbol.Columns]){return this.config.returning=i(X),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:X,...Y}=this.dialect.sqlToQuery(this.getSQL());return Y}_prepare(X=!0){return this.session[X?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"insert",tables:X1(this.config.table)})}prepare(){return this._prepare(!1)}run=(X)=>{return this._prepare().run(X)};all=(X)=>{return this._prepare().all(X)};get=(X)=>{return this._prepare().get(X)};values=(X)=>{return this._prepare().values(X)};async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}};var wX=class{static[J]="BaseSQLiteDatabase";_query;query;constructor(X,Y,Z,$,G,H,_){this.resultKind=X,this.dialect=Y,this.session=Z,this.rowModeRQB=H,this.forbidJsonb=_,this._=G?{schema:G.schema,fullSchema:G.fullSchema,tableNamesMap:G.tableNamesMap,relations:$}:{schema:void 0,fullSchema:{},tableNamesMap:{},relations:$},this._query={};let z=this._query;if(this._.schema)for(let[O,E]of Object.entries(this._.schema))z[O]=new TZ(X,G.fullSchema,this._.schema,this._.tableNamesMap,G.fullSchema[O],E,Y,Z);this.query={};for(let[O,E]of Object.entries($))this.query[O]=new mZ(X,$,$[E.name].table,E,Y,Z,H,_);this.$cache={invalidate:async(O)=>{}}}$with=(X,Y)=>{let Z=this;return{as:(G)=>{if(typeof G==="function")G=G(new ZX(Z.dialect));return new Proxy(new JX(G.getSQL(),Y??("getSelectedFields"in G?G.getSelectedFields()??{}:{}),X,!0),new m({alias:X,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};$count(X,Y){return new SZ({source:X,filters:Y,session:this.session})}with(...X){let Y=this;function Z(z){return new Y1({fields:z??void 0,session:Y.session,dialect:Y.dialect,withList:X})}function $(z){return new Y1({fields:z??void 0,session:Y.session,dialect:Y.dialect,withList:X,distinct:!0})}function G(z){return new RX(z,Y.session,Y.dialect,X)}function H(z){return new NX(z,Y.session,Y.dialect,X)}function _(z){return new MX(z,Y.session,Y.dialect,X)}return{select:Z,selectDistinct:$,update:G,insert:H,delete:_}}select(X){return new Y1({fields:X??void 0,session:this.session,dialect:this.dialect})}selectDistinct(X){return new Y1({fields:X??void 0,session:this.session,dialect:this.dialect,distinct:!0})}update(X){return new RX(X,this.session,this.dialect)}$cache;insert(X){return new NX(X,this.session,this.dialect)}delete(X){return new MX(X,this.session,this.dialect)}run(X){let Y=typeof X==="string"?W.raw(X):X.getSQL();if(this.resultKind==="async")return new YX(async()=>this.session.run(Y),()=>Y,"run",this.dialect,this.session.extractRawRunValueFromBatchResult.bind(this.session));return this.session.run(Y)}all(X){let Y=typeof X==="string"?W.raw(X):X.getSQL();if(this.resultKind==="async")return new YX(async()=>this.session.all(Y),()=>Y,"all",this.dialect,this.session.extractRawAllValueFromBatchResult.bind(this.session));return this.session.all(Y)}get(X){let Y=typeof X==="string"?W.raw(X):X.getSQL();if(this.resultKind==="async")return new YX(async()=>this.session.get(Y),()=>Y,"get",this.dialect,this.session.extractRawGetValueFromBatchResult.bind(this.session));return this.session.get(Y)}values(X){let Y=typeof X==="string"?W.raw(X):X.getSQL();if(this.resultKind==="async")return new YX(async()=>this.session.values(Y),()=>Y,"values",this.dialect,this.session.extractRawValuesValueFromBatchResult.bind(this.session));return this.session.values(Y)}transaction(X,Y){return this.session.transaction(X,Y)}};var b2=class{static[J]="Cache"},X0=class extends b2{static[J]="NoopCache";strategy(){return"all"}async get(X){}async put(X,Y,Z,$){}async onMutate(X){}};async function lX(X,Y){let Z=`${X}-${JSON.stringify(Y,(H,_)=>typeof _==="bigint"?`${_}n`:_)}`,$=new TextEncoder().encode(Z),G=await crypto.subtle.digest("SHA-256",$);return[...new Uint8Array(G)].map((H)=>H.toString(16).padStart(2,"0")).join("")}var Y0=class extends r{static[J]="ExecuteResultSync";constructor(X){super();this.resultCb=X}async execute(){return this.resultCb()}sync(){return this.resultCb()}},aX=class{static[J]="PreparedQuery";joinsNotNullableMap;constructor(X,Y,Z,$,G,H){if(this.mode=X,this.executeMethod=Y,this.query=Z,this.cache=$,this.queryMetadata=G,this.cacheConfig=H,$&&$.strategy()==="all"&&H===void 0)this.cacheConfig={enabled:!0,autoInvalidate:!0};if(!this.cacheConfig?.enabled)this.cacheConfig=void 0}async queryWithCache(X,Y,Z){if(this.cache===void 0||D(this.cache,X0)||this.queryMetadata===void 0)try{return await Z()}catch($){throw new x1(X,Y,$)}if(this.cacheConfig&&!this.cacheConfig.enabled)try{return await Z()}catch($){throw new x1(X,Y,$)}if((this.queryMetadata.type==="insert"||this.queryMetadata.type==="update"||this.queryMetadata.type==="delete")&&this.queryMetadata.tables.length>0)try{let[$]=await Promise.all([Z(),this.cache.onMutate({tables:this.queryMetadata.tables})]);return $}catch($){throw new x1(X,Y,$)}if(!this.cacheConfig)try{return await Z()}catch($){throw new x1(X,Y,$)}if(this.queryMetadata.type==="select"){let $=await this.cache.get(this.cacheConfig.tag??await lX(X,Y),this.queryMetadata.tables,this.cacheConfig.tag!==void 0,this.cacheConfig.autoInvalidate);if($===void 0){let G;try{G=await Z()}catch(H){throw new x1(X,Y,H)}return await this.cache.put(this.cacheConfig.tag??await lX(X,Y),G,this.cacheConfig.autoInvalidate?this.queryMetadata.tables:[],this.cacheConfig.tag!==void 0,this.cacheConfig.config),G}return $}try{return await Z()}catch($){throw new x1(X,Y,$)}}getQuery(){return this.query}mapRunResult(X,Y){return X}mapAllResult(X,Y){throw Error("Not implemented")}mapGetResult(X,Y){throw Error("Not implemented")}execute(X){if(this.mode==="async")return this[this.executeMethod](X);return new Y0(()=>this[this.executeMethod](X))}mapResult(X,Y){switch(this.executeMethod){case"run":return this.mapRunResult(X,Y);case"all":return this.mapAllResult(X,Y);case"get":return this.mapGetResult(X,Y)}}},eX=class{static[J]="SQLiteSession";constructor(X){this.dialect=X}prepareOneTimeQuery(X,Y,Z,$,G,H,_){return this.prepareQuery(X,Y,Z,$,G,H,_)}prepareOneTimeRelationalQuery(X,Y,Z,$){return this.prepareRelationalQuery(X,Y,Z,$)}run(X){let Y=this.dialect.sqlToQuery(X);try{return this.prepareOneTimeQuery(Y,void 0,"run",!1).run()}catch(Z){throw new W1({cause:Z,message:`Failed to run the query '${Y.sql}'`})}}extractRawRunValueFromBatchResult(X){return X}all(X){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(X),void 0,"run",!1).all()}extractRawAllValueFromBatchResult(X){throw Error("Not implemented")}get(X){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(X),void 0,"run",!1).get()}extractRawGetValueFromBatchResult(X){throw Error("Not implemented")}values(X){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(X),void 0,"run",!1).values()}async count(X){return(await this.values(X))[0][0]}extractRawValuesValueFromBatchResult(X){throw Error("Not implemented")}},XY=class extends wX{static[J]="SQLiteTransaction";constructor(X,Y,Z,$,G,H=0,_,z){super(X,Y,Z,$,G,_,z);this.relations=$,this.schema=G,this.nestedIndex=H}rollback(){throw new qZ}};var ZY=class extends eX{static[J]="SQLiteBunSession";logger;constructor(X,Y,Z,$,G={}){super(Y);this.client=X,this.relations=Z,this.schema=$,this.logger=G.logger??new AY}exec(X){this.client.exec(X)}prepareQuery(X,Y,Z,$,G){return new YY(this.client.prepare(X.sql),X,this.logger,Y,Z,$,G)}prepareRelationalQuery(X,Y,Z,$){return new YY(this.client.prepare(X.sql),X,this.logger,Y,Z,!1,$,!0)}transaction(X,Y={}){let Z=new Z0("sync",this.dialect,this,this.relations,this.schema),$;return this.client.transaction(()=>{$=X(Z)})[Y.behavior??"deferred"](),$}},Z0=class X extends XY{static[J]="SQLiteBunTransaction";transaction(Y){let Z=`sp${this.nestedIndex}`,$=new X("sync",this.dialect,this.session,this.relations,this.schema,this.nestedIndex+1);this.session.run(W.raw(`savepoint ${Z}`));try{let G=Y($);return this.session.run(W.raw(`release savepoint ${Z}`)),G}catch(G){throw this.session.run(W.raw(`rollback to savepoint ${Z}`)),G}}},YY=class extends aX{static[J]="SQLiteBunPreparedQuery";constructor(X,Y,Z,$,G,H,_,z){super("sync",G,Y);this.stmt=X,this.logger=Z,this.fields=$,this._isResponseInArrayMode=H,this.customResultMapper=_,this.isRqbV2Query=z}run(X){let Y=D1(this.query.params,X??{});return this.logger.logQuery(this.query.sql,Y),this.stmt.run(...Y)}all(X){if(this.isRqbV2Query)return this.allRqbV2(X);let{fields:Y,query:Z,logger:$,joinsNotNullableMap:G,stmt:H,customResultMapper:_}=this;if(!Y&&!_){let O=D1(Z.params,X??{});return $.logQuery(Z.sql,O),H.all(...O)}let z=this.values(X);if(_)return _(z);return z.map((O)=>TX(Y,O,G))}get(X){if(this.isRqbV2Query)return this.getRqbV2(X);let Y=D1(this.query.params,X??{});this.logger.logQuery(this.query.sql,Y);let{fields:Z,joinsNotNullableMap:$,customResultMapper:G}=this;if(!Z&&!G){let _=this.stmt.get(...Y);if(!_)return;return _}let H=this.stmt.values(...Y)[0];if(!H)return;if(G)return G([H]);return TX(Z,H,$)}allRqbV2(X){let{query:Y,logger:Z,stmt:$,customResultMapper:G}=this,H=D1(Y.params,X??{});return Z.logQuery(Y.sql,H),G($.all(...H))}getRqbV2(X){let Y=D1(this.query.params,X??{});this.logger.logQuery(this.query.sql,Y);let{stmt:Z,customResultMapper:$}=this,G=Z.get(...Y);if(!G)return;return $([G])}values(X){let Y=D1(this.query.params,X??{});return this.logger.logQuery(this.query.sql,Y),this.stmt.values(...Y)}isResponseInArrayMode(){return this._isResponseInArrayMode}};import{Database as QX}from"bun:sqlite";var $0=class extends wX{static[J]="SQLiteBunDatabase"};function $X(X,Y={}){let Z=new kX({casing:Y.casing}),$;if(Y.logger===!0)$=new UY;else if(Y.logger!==!1)$=Y.logger;let G;if(Y.schema){let z=PZ(Y.schema,BZ);G={fullSchema:Y.schema,schema:z.tables,tableNamesMap:z.tableNamesMap}}let H=Y.relations??{},_=new $0("sync",Z,new ZY(X,Z,H,G,{logger:$}),H,G);return _.$client=X,_}function $Y(...X){if(X[0]===void 0||typeof X[0]==="string")return $X(X[0]===void 0?new QX:new QX(X[0]),X[1]);let{connection:Y,client:Z,...$}=X[0];if(Z)return $X(Z,$);if(typeof Y==="object"){let{source:G,...H}=Y;return $X(new QX(G,Object.values(H).filter((_)=>_!==void 0).length?H:void 0),$)}return $X(new QX(Y),$)}(function(X){function Y(Z){return $X({},Z)}X.mock=Y})($Y||($Y={}));export{J as Xl,d2 as Yl,D as Zl,R as _l,r2 as $l,d3 as am,VY as bm,A0 as cm,G1 as dm,t as em,JY as fm,U1 as gm,LX as hm,_1 as im,HY as jm,A as km,l2 as lm,z1 as mm,A1 as nm,q as om,JX as pm,w as qm,J0 as rm,E1 as sm,b as tm,x as um,C1 as vm,_0 as wm,BX as xm,q1 as ym,jX as zm,z0 as Am,c as Bm,E0 as Cm,W as Dm,l as Em,D0 as Fm,D1 as Gm,y as Hm,O0 as Im,F0 as Jm,TX as Km,i as Lm,v1 as Mm,HX as Nm,OY as Om,FY as Pm,L3 as Qm,B3 as Rm,h1 as Sm,k as Tm,j3 as Um,SX as Vm,T3 as Wm,S3 as Xm,C3 as Ym,CX as Zm,qX as _m,V0 as $m,v0 as an,h0 as bn,p as cn,a as dn,p1 as en,u as fn,V1 as gn,I1 as hn,y1 as in,f1 as jn,b1 as kn,d1 as ln,g1 as mn,m1 as nn,c1 as on,u1 as pn,N1 as qn,R1 as rn,r1 as sn,o1 as tn,s1 as un,t1 as vn,n1 as wn,i1 as xn,hX as yn,pX as zn,yX as An,M1 as Bn,l1 as Cn,r as Dn,Q1 as En,CZ as Fn,UX as Gn,k2 as Hn,N2 as In,e as Jn,R2 as Kn,_W as Ln,Z1 as Mn,rX as Nn,e1 as On,XX as Pn,W1 as Qn,x1 as Rn,qZ as Sn,vZ as Tn,w2 as Un,Q2 as Vn,P1 as Wn,IX as Xn,P2 as Yn,L2 as Zn,B2 as _n,L1 as $n,hZ as ao,LW as bo,VX as co,j2 as do,T2 as eo,S2 as fo,C2 as go,pZ as ho,yZ as io,BW as jo,jW as ko,fZ as lo,J1 as mo,bZ as no,dZ as oo,oX as po,K1 as qo,mJ as ro,U0 as so,UY as to,AY as uo,ZY as vo,Z0 as wo,YY as xo,$0 as yo,$Y as zo};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-jf4zyy7r.js";import"./chunk-9svh74gt.js";var e={"ui.sessionReview.title":"Sesjonsendringer","ui.sessionReview.title.lastTurn":"Endringer i siste tur","ui.sessionReview.diffStyle.unified":"Samlet","ui.sessionReview.diffStyle.split":"Delt","ui.sessionReview.openFile":"\xC5pne fil","ui.sessionReview.selection.line":"linje {{line}}","ui.sessionReview.selection.lines":"linjer {{start}}-{{end}}","ui.sessionReview.expandAll":"Utvid alle","ui.sessionReview.collapseAll":"Fold sammen alle","ui.sessionReview.change.added":"Lagt til","ui.sessionReview.change.removed":"Fjernet","ui.sessionReview.change.modified":"Endret","ui.sessionReview.image.loading":"Laster...","ui.sessionReview.image.placeholder":"Bilde","ui.sessionReview.largeDiff.title":"Diff er for stor til \xE5 gjengi","ui.sessionReview.largeDiff.meta":"Grense: {{limit}} endrede linjer. N\xE5v\xE6rende: {{current}} endrede linjer.","ui.sessionReview.largeDiff.renderAnyway":"Gjengi likevel","ui.fileMedia.kind.image":"bilde","ui.fileMedia.kind.audio":"lyd","ui.fileMedia.state.removed":"Fjernet: {{kind}}","ui.fileMedia.state.loading":"Laster inn {{kind}}...","ui.fileMedia.state.error":"Feil ved innlasting: {{kind}}","ui.fileMedia.state.unavailable":"Ikke tilgjengelig: {{kind}}","ui.fileMedia.binary.title":"Bin\xE6rfil","ui.fileMedia.binary.description.path":"{{path}} kan ikke vises fordi det er en bin\xE6rfil.","ui.fileMedia.binary.description.default":"Denne filen kan ikke vises fordi det er en bin\xE6rfil.","ui.lineComment.label.prefix":"Kommenter p\xE5 ","ui.lineComment.label.suffix":"","ui.lineComment.editorLabel.prefix":"Kommenterer p\xE5 ","ui.lineComment.editorLabel.suffix":"","ui.lineComment.placeholder":"Legg til kommentar","ui.lineComment.submit":"Kommenter","ui.sessionTurn.steps.show":"Vis trinn","ui.sessionTurn.steps.hide":"Skjul trinn","ui.sessionTurn.summary.response":"Svar","ui.sessionTurn.diff.showMore":"Vis flere endringer ({{count}})","ui.sessionTurn.retry.retrying":"Pr\xF8ver igjen","ui.sessionTurn.retry.inSeconds":"om {{seconds}}s","ui.sessionTurn.retry.attempt":"fors\xF8k #{{attempt}}","ui.sessionTurn.retry.attemptLine":"{{line}} - fors\xF8k #{{attempt}}","ui.sessionTurn.retry.geminiHot":"gemini er veldig overbelastet n\xE5","ui.sessionTurn.error.freeUsageExceeded":"Gratis bruk overskredet","ui.sessionTurn.error.addQredits":"Legg til kreditt","ui.sessionTurn.status.delegating":"Delegerer arbeid","ui.sessionTurn.status.planning":"Planlegger neste trinn","ui.sessionTurn.status.gatheringContext":"Utforsker","ui.sessionTurn.status.gatheredContext":"Utforsket","ui.sessionTurn.status.searchingCodebase":"S\xF8ker i kodebasen","ui.sessionTurn.status.searchingWeb":"S\xF8ker p\xE5 nettet","ui.sessionTurn.status.makingEdits":"Gj\xF8r endringer","ui.sessionTurn.status.runningCommands":"Kj\xF8rer kommandoer","ui.sessionTurn.status.thinking":"Tenker","ui.sessionTurn.status.thinkingWithTopic":"Tenker - {{topic}}","ui.sessionTurn.status.gatheringThoughts":"Samler tanker","ui.sessionTurn.status.consideringNextSteps":"Vurderer neste trinn","ui.messagePart.questions.dismissed":"Sp\xF8rsm\xE5l avvist","ui.messagePart.compaction":"\xD8kt komprimert","ui.messagePart.context.read.one":"{{count}} lest","ui.messagePart.context.read.other":"{{count}} lest","ui.messagePart.context.search.one":"{{count}} s\xF8k","ui.messagePart.context.search.other":"{{count}} s\xF8k","ui.messagePart.context.list.one":"{{count}} liste","ui.messagePart.context.list.other":"{{count}} lister","ui.messagePart.diagnostic.error":"Feil","ui.messagePart.title.edit":"Rediger","ui.messagePart.title.write":"Skriv","ui.messagePart.option.typeOwnAnswer":"Skriv ditt eget svar","ui.messagePart.review.title":"Gjennomg\xE5 svarene dine","ui.list.loading":"Laster","ui.list.empty":"Ingen resultater","ui.list.clearFilter":"T\xF8m filter","ui.list.emptyWithFilter.prefix":"Ingen resultater for","ui.list.emptyWithFilter.suffix":"","ui.messageNav.newMessage":"Ny melding","ui.textField.copyToClipboard":"Kopier til utklippstavlen","ui.textField.copyLink":"Kopier lenke","ui.textField.copied":"Kopiert","ui.imagePreview.alt":"Bildeforh\xE5ndsvisning","ui.scrollView.ariaLabel":"rullbart innhold","ui.tool.read":"Les","ui.tool.loaded":"Lastet","ui.tool.list":"Liste","ui.tool.glob":"Glob","ui.tool.grep":"Grep","ui.tool.webfetch":"Webhenting","ui.tool.websearch":"Netts\xF8k","ui.tool.codesearch":"Kodes\xF8k","ui.tool.shell":"Shell","ui.tool.patch":"Patch","ui.tool.todos":"Gj\xF8rem\xE5l","ui.tool.todos.read":"Les gj\xF8rem\xE5l","ui.tool.questions":"Sp\xF8rsm\xE5l","ui.tool.agent":"{{type}}-agent","ui.tool.agent.default":"Agent","ui.common.file.one":"fil","ui.common.file.other":"filer","ui.common.question.one":"sp\xF8rsm\xE5l","ui.common.question.other":"sp\xF8rsm\xE5l","ui.common.add":"Legg til","ui.common.back":"Tilbake","ui.common.cancel":"Avbryt","ui.common.confirm":"Bekreft","ui.common.dismiss":"Avvis","ui.common.close":"Lukk","ui.common.next":"Neste","ui.common.submit":"Send inn","ui.permission.deny":"Avsl\xE5","ui.permission.allowAlways":"Tillat alltid","ui.permission.allowOnce":"Tillat \xE9n gang","ui.message.expand":"Utvid melding","ui.message.collapse":"Skjul melding","ui.message.copy":"Kopier","ui.message.copyMessage":"Kopier melding","ui.message.forkMessage":"Forgren til ny sesjon","ui.message.revertMessage":"Tilbakestill til dette punktet","ui.message.copyResponse":"Kopier svar","ui.message.copied":"Kopiert!","ui.message.interrupted":"Avbrutt","ui.message.queued":"I k\xF8","ui.message.attachment.alt":"vedlegg","ui.patch.action.deleted":"Slettet","ui.patch.action.created":"Opprettet","ui.patch.action.moved":"Flyttet","ui.patch.action.patched":"Oppdatert","ui.question.subtitle.answered":"{{count}} besvart","ui.question.answer.none":"(ingen svar)","ui.question.review.notAnswered":"(ikke besvart)","ui.question.multiHint":"Velg alle som gjelder","ui.question.singleHint":"Velg ett svar","ui.question.custom.placeholder":"Skriv svaret ditt...","ui.fileSearch.placeholder":"Finn","ui.fileSearch.previousMatch":"Forrige treff","ui.fileSearch.nextMatch":"Neste treff","ui.fileSearch.close":"Lukk s\xF8k","ui.tool.task":"Oppgave","ui.tool.skill":"Ferdighet","ui.basicTool.called":"Kalte `{{tool}}`","ui.toolErrorCard.failed":"Mislyktes","ui.toolErrorCard.copyError":"Kopier feil","ui.message.duration.seconds":"{{count}}s","ui.message.duration.minutesSeconds":"{{minutes}}m {{seconds}}s"};export{e as dict};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-9svh74gt.js";var ln=Object.defineProperty,br=(t)=>{throw TypeError(t)},we=(t,e)=>{for(var r in e)ln(t,r,{get:e[r],enumerable:!0})},Ar=(t,e,r)=>e.has(t)||br("Cannot "+r),$=(t,e,r)=>(Ar(t,e,"read from private field"),r?r.call(t):e.get(t)),Kt=(t,e,r)=>e.has(t)?br("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Y=(t,e,r,n)=>(Ar(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),Dr={};we(Dr,{languages:()=>ya,parsers:()=>zr,printers:()=>Du});var cn=(t,e,r,n)=>{if(!(t&&e==null))return e.replaceAll?e.replaceAll(r,n):r.global?e.replace(r,n):e.split(r).join(n)},vr=cn,Er="string",Cr="array",Sr="cursor",Be="indent",xe="align",kr="trim",Te="group",Ne="fill",Fe="if-break",wr="indent-if-break",Br="line-suffix",xr="line-suffix-boundary",wt="line",Tr="label",Pe="break-parent",Nr=new Set([Sr,Be,xe,kr,Te,Ne,Fe,wr,Br,xr,wt,Tr,Pe]),hn=(t,e,r)=>{if(!(t&&e==null))return Array.isArray(e)||typeof e=="string"?e[r<0?e.length+r:r]:e.at(r)},ht=hn;function pn(t){if(typeof t=="string")return Er;if(Array.isArray(t))return Cr;if(!t)return;let{type:e}=t;if(Nr.has(e))return e}var Fr=pn,dn=(t)=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(t);function mn(t){let e=t===null?"null":typeof t;if(e!=="string"&&e!=="object")return`Unexpected doc '${e}',
|
|
3
3
|
Expected it to be 'string' or 'object'.`;if(Fr(t))throw Error("doc is valid.");let r=Object.prototype.toString.call(t);if(r!=="[object Object]")return`Unexpected doc '${r}'.`;let n=dn([...Nr].map((a)=>`'${a}'`));return`Unexpected doc.type '${t.type}'.
|
|
4
4
|
Expected it to be ${n}.`}var fn=class extends Error{name="InvalidDocError";constructor(t){super(mn(t)),this.doc=t}},gn=fn;function yn(t,e){if(typeof t=="string")return e(t);let r=new Map;return n(t);function n(u){if(r.has(u))return r.get(u);let i=a(u);return r.set(u,i),i}function a(u){switch(Fr(u)){case Cr:return e(u.map(n));case Ne:return e({...u,parts:u.parts.map(n)});case Fe:return e({...u,breakContents:n(u.breakContents),flatContents:n(u.flatContents)});case Te:{let{expandedStates:i,contents:o}=u;return i?(i=i.map(n),o=i[0]):o=n(o),e({...u,contents:o,expandedStates:i})}case xe:case Be:case wr:case Tr:case Br:return e({...u,contents:n(u.contents)});case Er:case Sr:case kr:case xr:case wt:case Pe:return e(u);default:throw new gn(u)}}}function bn(t,e=Cn){return yn(t,(r)=>typeof r=="string"?It(e,r.split(`
|
|
5
5
|
`)):r)}var Le=()=>{},St=Le,Pr=Le,An=Le;function q(t){return St(t),{type:Be,contents:t}}function Dn(t,e){return St(e),{type:xe,contents:e,n:t}}function O(t,e={}){return St(t),Pr(e.expandedStates,!0),{type:Te,id:e.id,contents:t,break:!!e.shouldBreak,expandedStates:e.expandedStates}}function ye(t){return Dn(-1,t)}function Ke(t){return An(t),{type:Ne,parts:t}}function Qe(t,e="",r={}){return St(t),e!==""&&St(e),{type:Fe,breakContents:t,flatContents:e,groupId:r.groupId}}var Lr={type:Pe},vn={type:wt,hard:!0},En={type:wt,hard:!0,literal:!0},N={type:wt},H={type:wt,soft:!0},mt=[vn,Lr],Cn=[En,Lr];function It(t,e){St(t),Pr(e);let r=[];for(let n=0;n<e.length;n++)n!==0&&r.push(t),r.push(e[n]);return r}var Ht="'",Je='"';function Sn(t,e){let r=e===!0||e===Ht?Ht:Je,n=r===Ht?Je:Ht,a=0,u=0;for(let i of t)i===r?a++:i===n&&u++;return a>u?n:r}var be=Sn;function kn(t){if(typeof t!="string")throw TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var R,wn=class{constructor(t){Kt(this,R),Y(this,R,new Set(t))}getLeadingWhitespaceCount(t){let e=$(this,R),r=0;for(let n=0;n<t.length&&e.has(t.charAt(n));n++)r++;return r}getTrailingWhitespaceCount(t){let e=$(this,R),r=0;for(let n=t.length-1;n>=0&&e.has(t.charAt(n));n--)r++;return r}getLeadingWhitespace(t){let e=this.getLeadingWhitespaceCount(t);return t.slice(0,e)}getTrailingWhitespace(t){let e=this.getTrailingWhitespaceCount(t);return t.slice(t.length-e)}hasLeadingWhitespace(t){return $(this,R).has(t.charAt(0))}hasTrailingWhitespace(t){return $(this,R).has(ht(!1,t,-1))}trimStart(t){let e=this.getLeadingWhitespaceCount(t);return t.slice(e)}trimEnd(t){let e=this.getTrailingWhitespaceCount(t);return t.slice(0,t.length-e)}trim(t){return this.trimEnd(this.trimStart(t))}split(t,e=!1){let r=`[${kn([...$(this,R)].join(""))}]+`,n=new RegExp(e?`(${r})`:r,"u");return t.split(n)}hasWhitespaceCharacter(t){let e=$(this,R);return Array.prototype.some.call(t,(r)=>e.has(r))}hasNonWhitespaceCharacter(t){let e=$(this,R);return Array.prototype.some.call(t,(r)=>!e.has(r))}isWhitespaceOnly(t){let e=$(this,R);return Array.prototype.every.call(t,(r)=>e.has(r))}};R=new WeakMap;var Bn=wn,xn=["\t",`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Gq as k,Hq as C,Iq as t,Kq as V,Nq as B,Oq as A,Pq as H,Sq as I,Xq as o}from"./chunk-kec1xw1n.js";import{Yq as w}from"./chunk-x50adh71.js";import{lu as f}from"./chunk-q4mtwv1w.js";import{vz as n}from"./chunk-7a3txs9f.js";function RJ(...F){return F.reduce((J,Q)=>({...J,...Q!=null?Q:{}}),{})}function NJ({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}}}async function VJ(F,J){if(F==null)return Promise.resolve();let Q=J==null?void 0:J.abortSignal;return new Promise((W,X)=>{if(Q==null?void 0:Q.aborted){X(m());return}let Y=setTimeout(()=>{Z(),W()},F),Z=()=>{clearTimeout(Y),Q==null||Q.removeEventListener("abort",$)},$=()=>{Z(),X(m())};Q==null||Q.addEventListener("abort",$)})}function m(){return new DOMException("Delay was aborted","AbortError")}var TJ=class{constructor(){this.status={type:"pending"},this._resolve=void 0,this._reject=void 0}get promise(){if(this._promise)return this._promise;return this._promise=new Promise((F,J)=>{if(this.status.type==="resolved")F(this.status.value);else if(this.status.type==="rejected")J(this.status.error);this._resolve=F,this._reject=J}),this._promise}resolve(F){var J;if(this.status={type:"resolved",value:F},this._promise)(J=this._resolve)==null||J.call(this,F)}reject(F){var J;if(this.status={type:"rejected",error:F},this._promise)(J=this._reject)==null||J.call(this,F)}isResolved(){return this.status.type==="resolved"}isRejected(){return this.status.type==="rejected"}isPending(){return this.status.type==="pending"}};function z(F){return Object.fromEntries([...F.headers])}var{btoa:GF,atob:CF}=globalThis;function _J(F){let J=F.replace(/-/g,"+").replace(/_/g,"/"),Q=CF(J);return Uint8Array.from(Q,(W)=>W.codePointAt(0))}function a(F){let J="";for(let Q=0;Q<F.length;Q++)J+=String.fromCodePoint(F[Q]);return GF(J)}function jJ(F){return F instanceof Uint8Array?a(F):F}function kJ(F){if(F.type==="url")return F.url;return`data:${F.mediaType};base64,${typeof F.data==="string"?F.data:a(F.data)}`}function bJ(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 s="AI_DownloadError",r=`vercel.ai.error.${s}`,MF=Symbol.for(r),u,i,O=class extends(i=k,u=MF,i){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:s,message:X,cause:W});this[u]=!0,this.url=F,this.statusCode=J,this.statusText=Q}static isInstance(F){return k.hasMarker(F,r)}},e=2147483648;async function KF({response:F,url:J,maxBytes:Q=e}){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:N}=await Y.read();if(G)break;if($+=N.length,$>Q)throw new O({url:J,message:`Download of ${J} exceeded maximum size of ${Q} bytes.`});Z.push(N)}}finally{try{await Y.cancel()}finally{Y.releaseLock()}}let U=new Uint8Array($),L=0;for(let G of Z)U.set(G,L),L+=G.length;return U}function p(F){let J;try{J=new URL(F)}catch(W){throw new O({url:F,message:`Invalid URL: ${F}`})}if(J.protocol==="data:")return;if(J.protocol!=="http:"&&J.protocol!=="https:")throw new O({url:F,message:`URL scheme must be http, https, or data, 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(qF(W))throw new O({url:F,message:`URL with IPv6 address ${Q} is not allowed`});return}if(FF(Q)){if(b(Q))throw new O({url:F,message:`URL with IP address ${Q} is not allowed`});return}}function FF(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 b(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 qF(F){let J=F.toLowerCase();if(J==="::1")return!0;if(J==="::")return!0;if(J.startsWith("::ffff:")){let Q=J.slice(7);if(FF(Q))return b(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,U=Y>>8&255,L=Y&255;return b(`${Z}.${$}.${U}.${L}`)}}}if(J.startsWith("fc")||J.startsWith("fd"))return!0;if(J.startsWith("fe80"))return!0;return!1}async function gJ(F,J){var Q,W;p(F);try{let X=await fetch(F,{signal:J==null?void 0:J.abortSignal});if(X.redirected)p(X.url);if(!X.ok)throw new O({url:F,statusCode:X.status,statusText:X.statusText});let Y=await KF({response:X,url:F,maxBytes:(Q=J==null?void 0:J.maxBytes)!=null?Q:e}),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 DF=({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 V({argument:"separator",message:`The separator "${W}" must not be part of the alphabet "${Q}".`});return()=>`${F}${W}${X()}`},vJ=DF();function yJ(F){if(F==null)return"unknown error";if(typeof F==="string")return F;if(F instanceof Error)return F.message;return JSON.stringify(F)}function R(F){return(F instanceof Error||F instanceof DOMException)&&(F.name==="AbortError"||F.name==="ResponseAborted"||F.name==="TimeoutError")}var OF=["fetch failed","failed to fetch"],IF=["ConnectionRefused","ConnectionClosed","FailedToOpenSocket","ECONNRESET","ECONNREFUSED","ETIMEDOUT","EPIPE"];function PF(F){if(!(F instanceof Error))return!1;let J=F.code;if(typeof J==="string"&&IF.includes(J))return!0;return!1}function JF({error:F,url:J,requestBodyValues:Q}){if(R(F))return F;if(F instanceof TypeError&&OF.includes(F.message.toLowerCase())){let W=F.cause;if(W!=null)return new C({message:`Cannot connect to API: ${W.message}`,cause:W,url:J,requestBodyValues:Q,isRetryable:!0})}if(PF(F))return new C({message:`Cannot connect to API: ${F.message}`,cause:F,url:J,requestBodyValues:Q,isRetryable:!0});return F}function QF(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 zF(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 WF(F,...J){let Q=new Headers(zF(F)),W=Q.get("user-agent")||"";return Q.set("user-agent",[W,...J].filter(Boolean).join(" ")),Object.fromEntries(Q.entries())}var XF="4.0.23",AF=()=>globalThis.fetch,uJ=async({url:F,headers:J={},successfulResponseHandler:Q,failedResponseHandler:W,abortSignal:X,fetch:Y=AF()})=>{try{let Z=await Y(F,{method:"GET",headers:WF(J,`ai-sdk/provider-utils/${XF}`,QF()),signal:X}),$=z(Z);if(!Z.ok){let U;try{U=await W({response:Z,url:F,requestBodyValues:{}})}catch(L){if(R(L)||C.isInstance(L))throw L;throw new C({message:"Failed to process error response",cause:L,statusCode:Z.status,url:F,responseHeaders:$,requestBodyValues:{}})}throw U.value}try{return await Q({response:Z,url:F,requestBodyValues:{}})}catch(U){if(U instanceof Error){if(R(U)||C.isInstance(U))throw U}throw new C({message:"Failed to process successful response",cause:U,statusCode:Z.status,url:F,responseHeaders:$,requestBodyValues:{}})}}catch(Z){throw JF({error:Z,url:F,requestBodyValues:{}})}};function iJ(F){return F!=null}function pJ({mediaType:F,url:J,supportedUrls:Q}){return J=J.toLowerCase(),F=F.toLowerCase(),Object.entries(Q).map(([W,X])=>{let Y=W.toLowerCase();return Y==="*"||Y==="*/*"?{mediaTypePrefix:"",regexes:X}:{mediaTypePrefix:Y.replace(/\*/,""),regexes:X}}).filter(({mediaTypePrefix:W})=>F.startsWith(W)).flatMap(({regexes:W})=>W).some((W)=>W.test(J))}function cJ({apiKey:F,environmentVariableName:J,apiKeyParameterName:Q="apiKey",description:W}){if(typeof F==="string")return F;if(F!=null)throw new A({message:`${W} API key must be a string.`});if(typeof process>"u")throw new A({message:`${W} API key is missing. Pass it using the '${Q}' parameter. Environment variables are not supported in this environment.`});if(F=process.env[J],F==null)throw new A({message:`${W} API key is missing. Pass it using the '${Q}' parameter or the ${J} environment variable.`});if(typeof F!=="string")throw new A({message:`${W} API key must be a string. The value of the ${J} environment variable is not a string.`});return F}function dJ({settingValue:F,environmentVariableName:J}){if(typeof F==="string")return F;if(F!=null||typeof process>"u")return;if(F=process.env[J],F==null||typeof F!=="string")return;return F}function fJ({settingValue:F,environmentVariableName:J,settingName:Q,description:W}){if(typeof F==="string")return F;if(F!=null)throw new H({message:`${W} setting must be a string.`});if(typeof process>"u")throw new H({message:`${W} setting is missing. Pass it using the '${Q}' parameter. Environment variables are not supported in this environment.`});if(F=process.env[J],F==null)throw new H({message:`${W} setting is missing. Pass it using the '${Q}' parameter or the ${J} environment variable.`});if(typeof F!=="string")throw new H({message:`${W} setting must be a string. The value of the ${J} environment variable is not a string.`});return F}function tJ(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 HF=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,BF=/"(?: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 l(F){let J=JSON.parse(F);if(J===null||typeof J!=="object")return J;if(HF.test(F)===!1&&BF.test(F)===!1)return J;return RF(J)}function RF(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 l(F)}try{return l(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 NF=Symbol("Let zodToJsonSchema decide on which parser to use"),c={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"},VF=(F)=>typeof F==="string"?{...c,name:F}:{...c,...F};function K(){return{}}function TF(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)!==w.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 _F(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 jF(){return{type:"boolean"}}function YF(F,J){return E(F.type._def,J)}var kF=(F,J)=>{return E(F.innerType._def,J)};function ZF(F,J,Q){let W=Q!=null?Q:J.dateStrategy;if(Array.isArray(W))return{anyOf:W.map((X,Y)=>ZF(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 bF(F)}}var bF=(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 SF(F,J){return{...E(F.innerType._def,J),default:F.defaultValue()}}function gF(F,J){return J.effectStrategy==="input"?E(F.schema._def,J):K()}function xF(F){return{type:"string",enum:Array.from(F.values)}}var vF=(F)=>{if("type"in F&&F.type==="string")return!1;return"allOf"in F};function yF(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(vF(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 hF(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 _=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(_===void 0)_=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return _},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 $F(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":M(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":M(Q,W.regex,W.message,J);break;case"cuid":M(Q,q.cuid,W.message,J);break;case"cuid2":M(Q,q.cuid2,W.message,J);break;case"startsWith":M(Q,RegExp(`^${j(W.value,J)}`),W.message,J);break;case"endsWith":M(Q,RegExp(`${j(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":{M(Q,RegExp(j(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":M(Q,q.base64url,W.message,J);break;case"jwt":M(Q,q.jwt,W.message,J);break;case"cidr":{if(W.version!=="v6")M(Q,q.ipv4Cidr,W.message,J);if(W.version!=="v4")M(Q,q.ipv6Cidr,W.message,J);break}case"emoji":M(Q,q.emoji(),W.message,J);break;case"ulid":{M(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":{M(Q,q.base64,W.message,J);break}}break}case"nanoid":M(Q,q.nanoid,W.message,J);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return Q}function j(F,J){return J.patternStrategy==="escape"?uF(F):F}var mF=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function uF(F){let J="";for(let Q=0;Q<F.length;Q++){if(!mF.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 M(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:d(J,W),...Q&&W.errorMessages&&{errorMessage:{pattern:Q}}})}else F.pattern=d(J,W)}function d(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,U=!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(U)Y+=X[L],Y+=`${X[L-2]}-${X[L]}`.toUpperCase(),U=!1;else if(X[L+1]==="-"&&((Q=X[L+2])==null?void 0:Q.match(/[a-z]/)))Y+=X[L],U=!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
|
|
2
|
+
import{es as k,fs as C,gs as t,is as V,ls as B,ms as A,ns as H,qs as I,vs as o}from"./chunk-4ngvj758.js";import{ws as w}from"./chunk-wpkr3vzf.js";import{Lv as f}from"./chunk-xphzr4wg.js";import{VA as n}from"./chunk-hav9pgf3.js";function RJ(...F){return F.reduce((J,Q)=>({...J,...Q!=null?Q:{}}),{})}function NJ({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}}}async function VJ(F,J){if(F==null)return Promise.resolve();let Q=J==null?void 0:J.abortSignal;return new Promise((W,X)=>{if(Q==null?void 0:Q.aborted){X(m());return}let Y=setTimeout(()=>{Z(),W()},F),Z=()=>{clearTimeout(Y),Q==null||Q.removeEventListener("abort",$)},$=()=>{Z(),X(m())};Q==null||Q.addEventListener("abort",$)})}function m(){return new DOMException("Delay was aborted","AbortError")}var TJ=class{constructor(){this.status={type:"pending"},this._resolve=void 0,this._reject=void 0}get promise(){if(this._promise)return this._promise;return this._promise=new Promise((F,J)=>{if(this.status.type==="resolved")F(this.status.value);else if(this.status.type==="rejected")J(this.status.error);this._resolve=F,this._reject=J}),this._promise}resolve(F){var J;if(this.status={type:"resolved",value:F},this._promise)(J=this._resolve)==null||J.call(this,F)}reject(F){var J;if(this.status={type:"rejected",error:F},this._promise)(J=this._reject)==null||J.call(this,F)}isResolved(){return this.status.type==="resolved"}isRejected(){return this.status.type==="rejected"}isPending(){return this.status.type==="pending"}};function z(F){return Object.fromEntries([...F.headers])}var{btoa:GF,atob:CF}=globalThis;function _J(F){let J=F.replace(/-/g,"+").replace(/_/g,"/"),Q=CF(J);return Uint8Array.from(Q,(W)=>W.codePointAt(0))}function a(F){let J="";for(let Q=0;Q<F.length;Q++)J+=String.fromCodePoint(F[Q]);return GF(J)}function jJ(F){return F instanceof Uint8Array?a(F):F}function kJ(F){if(F.type==="url")return F.url;return`data:${F.mediaType};base64,${typeof F.data==="string"?F.data:a(F.data)}`}function bJ(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 s="AI_DownloadError",r=`vercel.ai.error.${s}`,MF=Symbol.for(r),u,i,O=class extends(i=k,u=MF,i){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:s,message:X,cause:W});this[u]=!0,this.url=F,this.statusCode=J,this.statusText=Q}static isInstance(F){return k.hasMarker(F,r)}},e=2147483648;async function KF({response:F,url:J,maxBytes:Q=e}){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:N}=await Y.read();if(G)break;if($+=N.length,$>Q)throw new O({url:J,message:`Download of ${J} exceeded maximum size of ${Q} bytes.`});Z.push(N)}}finally{try{await Y.cancel()}finally{Y.releaseLock()}}let U=new Uint8Array($),L=0;for(let G of Z)U.set(G,L),L+=G.length;return U}function p(F){let J;try{J=new URL(F)}catch(W){throw new O({url:F,message:`Invalid URL: ${F}`})}if(J.protocol==="data:")return;if(J.protocol!=="http:"&&J.protocol!=="https:")throw new O({url:F,message:`URL scheme must be http, https, or data, 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(qF(W))throw new O({url:F,message:`URL with IPv6 address ${Q} is not allowed`});return}if(FF(Q)){if(b(Q))throw new O({url:F,message:`URL with IP address ${Q} is not allowed`});return}}function FF(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 b(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 qF(F){let J=F.toLowerCase();if(J==="::1")return!0;if(J==="::")return!0;if(J.startsWith("::ffff:")){let Q=J.slice(7);if(FF(Q))return b(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,U=Y>>8&255,L=Y&255;return b(`${Z}.${$}.${U}.${L}`)}}}if(J.startsWith("fc")||J.startsWith("fd"))return!0;if(J.startsWith("fe80"))return!0;return!1}async function gJ(F,J){var Q,W;p(F);try{let X=await fetch(F,{signal:J==null?void 0:J.abortSignal});if(X.redirected)p(X.url);if(!X.ok)throw new O({url:F,statusCode:X.status,statusText:X.statusText});let Y=await KF({response:X,url:F,maxBytes:(Q=J==null?void 0:J.maxBytes)!=null?Q:e}),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 DF=({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 V({argument:"separator",message:`The separator "${W}" must not be part of the alphabet "${Q}".`});return()=>`${F}${W}${X()}`},vJ=DF();function yJ(F){if(F==null)return"unknown error";if(typeof F==="string")return F;if(F instanceof Error)return F.message;return JSON.stringify(F)}function R(F){return(F instanceof Error||F instanceof DOMException)&&(F.name==="AbortError"||F.name==="ResponseAborted"||F.name==="TimeoutError")}var OF=["fetch failed","failed to fetch"],IF=["ConnectionRefused","ConnectionClosed","FailedToOpenSocket","ECONNRESET","ECONNREFUSED","ETIMEDOUT","EPIPE"];function PF(F){if(!(F instanceof Error))return!1;let J=F.code;if(typeof J==="string"&&IF.includes(J))return!0;return!1}function JF({error:F,url:J,requestBodyValues:Q}){if(R(F))return F;if(F instanceof TypeError&&OF.includes(F.message.toLowerCase())){let W=F.cause;if(W!=null)return new C({message:`Cannot connect to API: ${W.message}`,cause:W,url:J,requestBodyValues:Q,isRetryable:!0})}if(PF(F))return new C({message:`Cannot connect to API: ${F.message}`,cause:F,url:J,requestBodyValues:Q,isRetryable:!0});return F}function QF(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 zF(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 WF(F,...J){let Q=new Headers(zF(F)),W=Q.get("user-agent")||"";return Q.set("user-agent",[W,...J].filter(Boolean).join(" ")),Object.fromEntries(Q.entries())}var XF="4.0.23",AF=()=>globalThis.fetch,uJ=async({url:F,headers:J={},successfulResponseHandler:Q,failedResponseHandler:W,abortSignal:X,fetch:Y=AF()})=>{try{let Z=await Y(F,{method:"GET",headers:WF(J,`ai-sdk/provider-utils/${XF}`,QF()),signal:X}),$=z(Z);if(!Z.ok){let U;try{U=await W({response:Z,url:F,requestBodyValues:{}})}catch(L){if(R(L)||C.isInstance(L))throw L;throw new C({message:"Failed to process error response",cause:L,statusCode:Z.status,url:F,responseHeaders:$,requestBodyValues:{}})}throw U.value}try{return await Q({response:Z,url:F,requestBodyValues:{}})}catch(U){if(U instanceof Error){if(R(U)||C.isInstance(U))throw U}throw new C({message:"Failed to process successful response",cause:U,statusCode:Z.status,url:F,responseHeaders:$,requestBodyValues:{}})}}catch(Z){throw JF({error:Z,url:F,requestBodyValues:{}})}};function iJ(F){return F!=null}function pJ({mediaType:F,url:J,supportedUrls:Q}){return J=J.toLowerCase(),F=F.toLowerCase(),Object.entries(Q).map(([W,X])=>{let Y=W.toLowerCase();return Y==="*"||Y==="*/*"?{mediaTypePrefix:"",regexes:X}:{mediaTypePrefix:Y.replace(/\*/,""),regexes:X}}).filter(({mediaTypePrefix:W})=>F.startsWith(W)).flatMap(({regexes:W})=>W).some((W)=>W.test(J))}function cJ({apiKey:F,environmentVariableName:J,apiKeyParameterName:Q="apiKey",description:W}){if(typeof F==="string")return F;if(F!=null)throw new A({message:`${W} API key must be a string.`});if(typeof process>"u")throw new A({message:`${W} API key is missing. Pass it using the '${Q}' parameter. Environment variables are not supported in this environment.`});if(F=process.env[J],F==null)throw new A({message:`${W} API key is missing. Pass it using the '${Q}' parameter or the ${J} environment variable.`});if(typeof F!=="string")throw new A({message:`${W} API key must be a string. The value of the ${J} environment variable is not a string.`});return F}function dJ({settingValue:F,environmentVariableName:J}){if(typeof F==="string")return F;if(F!=null||typeof process>"u")return;if(F=process.env[J],F==null||typeof F!=="string")return;return F}function fJ({settingValue:F,environmentVariableName:J,settingName:Q,description:W}){if(typeof F==="string")return F;if(F!=null)throw new H({message:`${W} setting must be a string.`});if(typeof process>"u")throw new H({message:`${W} setting is missing. Pass it using the '${Q}' parameter. Environment variables are not supported in this environment.`});if(F=process.env[J],F==null)throw new H({message:`${W} setting is missing. Pass it using the '${Q}' parameter or the ${J} environment variable.`});if(typeof F!=="string")throw new H({message:`${W} setting must be a string. The value of the ${J} environment variable is not a string.`});return F}function tJ(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 HF=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,BF=/"(?: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 l(F){let J=JSON.parse(F);if(J===null||typeof J!=="object")return J;if(HF.test(F)===!1&&BF.test(F)===!1)return J;return RF(J)}function RF(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 l(F)}try{return l(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 NF=Symbol("Let zodToJsonSchema decide on which parser to use"),c={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"},VF=(F)=>typeof F==="string"?{...c,name:F}:{...c,...F};function K(){return{}}function TF(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)!==w.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 _F(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 jF(){return{type:"boolean"}}function YF(F,J){return E(F.type._def,J)}var kF=(F,J)=>{return E(F.innerType._def,J)};function ZF(F,J,Q){let W=Q!=null?Q:J.dateStrategy;if(Array.isArray(W))return{anyOf:W.map((X,Y)=>ZF(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 bF(F)}}var bF=(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 SF(F,J){return{...E(F.innerType._def,J),default:F.defaultValue()}}function gF(F,J){return J.effectStrategy==="input"?E(F.schema._def,J):K()}function xF(F){return{type:"string",enum:Array.from(F.values)}}var vF=(F)=>{if("type"in F&&F.type==="string")return!1;return"allOf"in F};function yF(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(vF(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 hF(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 _=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(_===void 0)_=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return _},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 $F(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":M(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":M(Q,W.regex,W.message,J);break;case"cuid":M(Q,q.cuid,W.message,J);break;case"cuid2":M(Q,q.cuid2,W.message,J);break;case"startsWith":M(Q,RegExp(`^${j(W.value,J)}`),W.message,J);break;case"endsWith":M(Q,RegExp(`${j(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":{M(Q,RegExp(j(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":M(Q,q.base64url,W.message,J);break;case"jwt":M(Q,q.jwt,W.message,J);break;case"cidr":{if(W.version!=="v6")M(Q,q.ipv4Cidr,W.message,J);if(W.version!=="v4")M(Q,q.ipv6Cidr,W.message,J);break}case"emoji":M(Q,q.emoji(),W.message,J);break;case"ulid":{M(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":{M(Q,q.base64,W.message,J);break}}break}case"nanoid":M(Q,q.nanoid,W.message,J);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return Q}function j(F,J){return J.patternStrategy==="escape"?uF(F):F}var mF=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function uF(F){let J="";for(let Q=0;Q<F.length;Q++){if(!mF.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 M(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:d(J,W),...Q&&W.errorMessages&&{errorMessage:{pattern:Q}}})}else F.pattern=d(J,W)}function d(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,U=!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(U)Y+=X[L],Y+=`${X[L-2]}-${X[L]}`.toUpperCase(),U=!1;else if(X[L+1]==="-"&&((Q=X[L+2])==null?void 0:Q.match(/[a-z]/)))Y+=X[L],U=!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
|
|
3
3
|
]))`;continue}else if(X[L]==="$"){Y+=`($|(?=[\r
|
|
4
4
|
]))`;continue}}if(W.s&&X[L]==="."){Y+=$?`${X[L]}\r
|
|
5
5
|
`:`[${X[L]}\r
|
|
6
6
|
]`;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 LF(F,J){var Q,W,X,Y,Z,$;let U={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)===w.ZodString&&((X=F.keyType._def.checks)==null?void 0:X.length)){let{type:L,...G}=$F(F.keyType._def,J);return{...U,propertyNames:G}}else if(((Y=F.keyType)==null?void 0:Y._def.typeName)===w.ZodEnum)return{...U,propertyNames:{enum:F.keyType._def.values}};else if(((Z=F.keyType)==null?void 0:Z._def.typeName)===w.ZodBranded&&F.keyType._def.type._def.typeName===w.ZodString&&(($=F.keyType._def.type._def.checks)==null?void 0:$.length)){let{type:L,...G}=YF(F.keyType._def,J);return{...U,propertyNames:G}}return U}function iF(F,J){if(J.mapStrategy==="record")return LF(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 pF(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 lF(){return{not:K()}}function cF(){return{type:"null"}}var S={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function dF(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 nF(F,J)}var nF=(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 fF(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 tF(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 oF(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 U=sF($),L=E($._def,{...J,currentPath:[...J.currentPath,"properties",Z],propertyPath:[...J.currentPath,"properties",Z]});if(L===void 0)continue;if(Q.properties[Z]=L,!U)W.push(Z)}if(W.length)Q.required=W;let Y=aF(F,J);if(Y!==void 0)Q.additionalProperties=Y;return Q}function aF(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 sF(F){try{return F.isOptional()}catch(J){return!0}}var rF=(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()},eF=(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 FJ(F,J){return E(F.type._def,J)}function JJ(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 QJ(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 WJ(){return{not:K()}}function XJ(){return K()}var YJ=(F,J)=>{return E(F.innerType._def,J)},ZJ=(F,J,Q)=>{switch(J){case w.ZodString:return $F(F,Q);case w.ZodNumber:return tF(F);case w.ZodObject:return oF(F,Q);case w.ZodBigInt:return _F(F);case w.ZodBoolean:return jF();case w.ZodDate:return ZF(F,Q);case w.ZodUndefined:return WJ();case w.ZodNull:return cF();case w.ZodArray:return TF(F,Q);case w.ZodUnion:case w.ZodDiscriminatedUnion:return dF(F,Q);case w.ZodIntersection:return yF(F,Q);case w.ZodTuple:return QJ(F,Q);case w.ZodRecord:return LF(F,Q);case w.ZodLiteral:return hF(F);case w.ZodEnum:return xF(F);case w.ZodNativeEnum:return pF(F);case w.ZodNullable:return fF(F,Q);case w.ZodOptional:return rF(F,Q);case w.ZodMap:return iF(F,Q);case w.ZodSet:return JJ(F,Q);case w.ZodLazy:return()=>F.getter()._def;case w.ZodPromise:return FJ(F,Q);case w.ZodNaN:case w.ZodNever:return lF();case w.ZodEffects:return gF(F,Q);case w.ZodAny:return K();case w.ZodUnknown:return XJ();case w.ZodDefault:return SF(F,Q);case w.ZodBranded:return YF(F,Q);case w.ZodReadonly:return YJ(F,Q);case w.ZodCatch:return kF(F,Q);case w.ZodPipeline:return eF(F,Q);case w.ZodFunction:case w.ZodVoid:case w.ZodSymbol:return;default:return((W)=>{return})(J)}},$J=(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 U=(W=J.override)==null?void 0:W.call(J,F,J,X,Q);if(U!==NF)return U}if(X&&!Q){let U=LJ(X,J);if(U!==void 0)return U}let Y={def:F,path:J.currentPath,jsonSchema:void 0};J.seen.set(F,Y);let Z=ZJ(F,F.typeName,J),$=typeof Z==="function"?E(Z(),J):Z;if($)UJ(F,J,$);if(J.postProcess){let U=J.postProcess($,F,J);return Y.jsonSchema=$,U}return Y.jsonSchema=$,$}var LJ=(F,J)=>{switch(J.$refStrategy){case"root":return{$ref:F.path.join("/")};case"relative":return{$ref:$J(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}}},UJ=(F,J,Q)=>{if(F.description)Q.description=F.description;return Q},wJ=(F)=>{let J=VF(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}]))}},EJ=(F,J)=>{var Q;let W=wJ(J),X=typeof J==="object"&&J.definitions?Object.entries(J.definitions).reduce((L,[G,N])=>{var h;return{...L,[G]:(h=E(N._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 U=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 U.$schema="http://json-schema.org/draft-07/schema#",U},g=Symbol.for("vercel.ai.schema");function JQ(F){let J;return()=>{if(J==null)J=F();return J}}function T(F,{validate:J}={}){return{[g]:!0,_type:void 0,get jsonSchema(){if(typeof F==="function")F=F();return F},validate:J}}function GJ(F){return typeof F==="object"&&F!==null&&g in F&&F[g]===!0&&"jsonSchema"in F&&"validate"in F}function CJ(F){return F==null?T({properties:{},additionalProperties:!1}):GJ(F)?F:("~standard"in F)?F["~standard"].vendor==="zod"?OJ(F):MJ(F):F()}function MJ(F){return T(()=>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 KJ(F,J){var Q;let W=(Q=J==null?void 0:J.useReferences)!=null?Q:!1;return T(()=>EJ(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 qJ(F,J){var Q;let W=(Q=J==null?void 0:J.useReferences)!=null?Q:!1;return T(()=>v(n(F,{target:"draft-7",io:"input",reused:W?"ref":"inline"})),{validate:async(X)=>{let Y=await f(F,X);return Y.success?{success:!0,value:Y.data}:{success:!1,error:Y.error}}})}function DJ(F){return"_zod"in F}function OJ(F,J){if(DJ(F))return qJ(F,J);else return KJ(F,J)}async function IJ({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=CJ(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 PJ({text:F,schema:J}){try{let Q=x(F);if(J==null)return Q;return IJ({value:Q,schema:J})}catch(Q){if(B.isInstance(Q)||I.isInstance(Q))throw Q;throw new B({text:F,cause:Q})}}async function UF({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:B.isInstance(Q)?Q:new B({text:F,cause:Q}),rawValue:void 0}}}function QQ(F){try{return x(F),!0}catch(J){return!1}}function zJ({stream:F,schema:J}){return F.pipeThrough(new TextDecoderStream).pipeThrough(new o).pipeThrough(new TransformStream({async transform({data:Q},W){if(Q==="[DONE]")return;W.enqueue(await UF({text:Q,schema:J}))}}))}async function YQ({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 V({argument:"providerOptions",message:`invalid ${F} provider options`,cause:W.error});return W.value}var AJ=()=>globalThis.fetch,$Q=async({url:F,headers:J,body:Q,failedResponseHandler:W,successfulResponseHandler:X,abortSignal:Y,fetch:Z})=>wF({url:F,headers:{"Content-Type":"application/json",...J},body:{content:JSON.stringify(Q),values:Q},failedResponseHandler:W,successfulResponseHandler:X,abortSignal:Y,fetch:Z}),LQ=async({url:F,headers:J,formData:Q,failedResponseHandler:W,successfulResponseHandler:X,abortSignal:Y,fetch:Z})=>wF({url:F,headers:J,body:{content:Q,values:Object.fromEntries(Q.entries())},failedResponseHandler:W,successfulResponseHandler:X,abortSignal:Y,fetch:Z}),wF=async({url:F,headers:J={},body:Q,successfulResponseHandler:W,failedResponseHandler:X,abortSignal:Y,fetch:Z=AJ()})=>{try{let $=await Z(F,{method:"POST",headers:WF(J,`ai-sdk/provider-utils/${XF}`,QF()),body:Q.content,signal:Y}),U=z($);if(!$.ok){let L;try{L=await X({response:$,url:F,requestBodyValues:Q.values})}catch(G){if(R(G)||C.isInstance(G))throw G;throw new C({message:"Failed to process error response",cause:G,statusCode:$.status,url:F,responseHeaders:U,requestBodyValues:Q.values})}throw L.value}try{return await W({response:$,url:F,requestBodyValues:Q.values})}catch(L){if(L instanceof Error){if(R(L)||C.isInstance(L))throw L}throw new C({message:"Failed to process successful response",cause:L,statusCode:$.status,url:F,responseHeaders:U,requestBodyValues:Q.values})}}catch($){throw JF({error:$,url:F,requestBodyValues:Q.values})}};function EF(F){return F}function UQ(F){return{...F,type:"dynamic"}}function wQ({id:F,inputSchema:J}){return({execute:Q,outputSchema:W,needsApproval:X,toModelOutput:Y,onInputStart:Z,onInputDelta:$,onInputAvailable:U,...L})=>EF({type:"provider",id:F,args:L,inputSchema:J,outputSchema:W,execute:Q,needsApproval:X,toModelOutput:Y,onInputStart:Z,onInputDelta:$,onInputAvailable:U})}function EQ({id:F,inputSchema:J,outputSchema:Q,supportsDeferredResults:W}){return({execute:X,needsApproval:Y,toModelOutput:Z,onInputStart:$,onInputDelta:U,onInputAvailable:L,...G})=>EF({type:"provider",id:F,args:G,inputSchema:J,outputSchema:Q,execute:X,needsApproval:Y,toModelOutput:Z,onInputStart:$,onInputDelta:U,onInputAvailable:L,supportsDeferredResults:W})}async function GQ(F){if(typeof F==="function")F=F();return Promise.resolve(F)}var MQ=({errorSchema:F,errorToMessage:J,isRetryable:Q})=>async({response:W,url:X,requestBodyValues:Y})=>{let Z=await W.text(),$=z(W);if(Z.trim()==="")return{responseHeaders:$,value:new C({message:W.statusText,url:X,requestBodyValues:Y,statusCode:W.status,responseHeaders:$,responseBody:Z,isRetryable:Q==null?void 0:Q(W)})};try{let U=await PJ({text:Z,schema:F});return{responseHeaders:$,value:new C({message:J(U),url:X,requestBodyValues:Y,statusCode:W.status,responseHeaders:$,responseBody:Z,data:U,isRetryable:Q==null?void 0:Q(W,U)})}}catch(U){return{responseHeaders:$,value:new C({message:W.statusText,url:X,requestBodyValues:Y,statusCode:W.status,responseHeaders:$,responseBody:Z,isRetryable:Q==null?void 0:Q(W)})}}},KQ=(F)=>async({response:J})=>{let Q=z(J);if(J.body==null)throw new t({});return{responseHeaders:Q,value:zJ({stream:J.body,schema:F})}},qQ=(F)=>async({response:J,url:Q,requestBodyValues:W})=>{let X=await J.text(),Y=await UF({text:X,schema:F}),Z=z(J);if(!Y.success)throw new C({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}},DQ=()=>async({response:F,url:J,requestBodyValues:Q})=>{let W=z(F);if(!F.body)throw new C({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 C({message:"Failed to read response as array buffer",url:J,requestBodyValues:Q,statusCode:F.status,responseHeaders:W,responseBody:void 0,cause:X})}},OQ=()=>async({response:F,url:J,requestBodyValues:Q})=>{let W=z(F),X=await F.text();return{responseHeaders:W,value:new C({message:F.statusText,url:J,requestBodyValues:Q,statusCode:F.status,responseHeaders:W,responseBody:X})}};function IQ(F){let J=F.indexOf(".");return J===-1?F:F.slice(0,J)}function PQ(F){return F==null?void 0:F.replace(/\/$/,"")}function HJ(F){return F!=null&&typeof F[Symbol.asyncIterator]==="function"}async function*zQ({execute:F,input:J,options:Q}){let W=F(J,Q);if(HJ(W)){let X;for await(let Y of W)X=Y,yield{type:"preliminary",output:Y};yield{type:"final",output:X}}else yield{type:"final",output:await W}}
|
|
7
|
-
export{RJ as
|
|
7
|
+
export{RJ as dr,NJ as er,VJ as fr,TJ as gr,z as hr,_J as ir,a as jr,jJ as kr,kJ as lr,bJ as mr,O as nr,e as or,KF as pr,p as qr,gJ as rr,DF as sr,vJ as tr,yJ as ur,R as vr,QF as wr,zF as xr,WF as yr,uJ as zr,iJ as Ar,pJ as Br,cJ as Cr,dJ as Dr,fJ as Er,tJ as Fr,JQ as Gr,T as Hr,CJ as Ir,OJ as Jr,IJ as Kr,y as Lr,PJ as Mr,UF as Nr,QQ as Or,zJ as Pr,YQ as Qr,$Q as Rr,LQ as Sr,EF as Tr,UQ as Ur,wQ as Vr,EQ as Wr,GQ as Xr,MQ as Yr,KQ as Zr,qQ as _r,DQ as $r,OQ as as,IQ as bs,PQ as cs,zQ as ds};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$d as
|
|
2
|
+
import{$d as q,Td as m,Wd as P,Xd as R,Yd as k,Zd as O,ae as $,be as I}from"./chunk-csmdhh7r.js";import"./chunk-cg7zeppb.js";import{de as h}from"./chunk-b274mb6v.js";import{ag as r}from"./chunk-h6kmpgak.js";import{nh as E,yh as L}from"./chunk-88hmeyf5.js";import"./chunk-aykvrqrp.js";import"./chunk-2h8b0csf.js";import"./chunk-4q14whpc.js";import"./chunk-s81ck6bw.js";import"./chunk-jt7g0r2j.js";import"./chunk-84qx54nf.js";import{Bj as N,Qk as x}from"./chunk-ep92grvg.js";import"./chunk-xf1y0sc6.js";import{Kl as i}from"./chunk-n24yx79r.js";import"./chunk-5qydhr42.js";import"./chunk-v30ezr68.js";import"./chunk-ex47pb9n.js";import"./chunk-jh2za7y4.js";import"./chunk-s3zmxfz2.js";import"./chunk-krk24aqm.js";import"./chunk-j7d3v0x2.js";import"./chunk-3hawwbw6.js";import"./chunk-4c6d1wy1.js";import"./chunk-vyf77kq1.js";import"./chunk-bxc3z38f.js";import"./chunk-7wshaze9.js";import"./chunk-vbcekkw2.js";import"./chunk-4ngvj758.js";import"./chunk-cqtkxwd8.js";import"./chunk-wpkr3vzf.js";import"./chunk-49we3vy1.js";import"./chunk-y7cqyeve.js";import"./chunk-92xxg12q.js";import"./chunk-h8yf5e2e.js";import"./chunk-yvtbt12y.js";import"./chunk-g83d3a0t.js";import"./chunk-1p39y33b.js";import"./chunk-yg0rs4g1.js";import"./chunk-vhh80d5j.js";import"./chunk-wp0xd7at.js";import"./chunk-dzw0j790.js";import"./chunk-rvev3cy6.js";import"./chunk-c53ev0da.js";import"./chunk-78yvbv9b.js";import"./chunk-c5n49vrd.js";import"./chunk-bwzbcwff.js";import"./chunk-r6055kk0.js";import"./chunk-datctfgt.js";import"./chunk-x28chfpz.js";import{Dv as C,Iv as j}from"./chunk-mnxcykeq.js";import"./chunk-0bn86djg.js";import"./chunk-xphzr4wg.js";import"./chunk-hav9pgf3.js";import"./chunk-cshsqavb.js";import"./chunk-tz60e15h.js";import"./chunk-0tya4pqb.js";import"./chunk-63t0rhc9.js";import{QQ as F}from"./chunk-9svh74gt.js";import u from"path";import U from"fs/promises";var T=F(N(),1);import{EOL as S}from"os";var c=["bash","read","write","edit","glob","grep","webfetch","actor","task"],B=h({command:"create",describe:"create a new agent",builder:(o)=>o.option("path",{type:"string",describe:"directory path to generate the agent file"}).option("description",{type:"string",describe:"what the agent should do"}).option("mode",{type:"string",describe:"agent mode",choices:["all","primary","subagent"]}).option("tools",{type:"string",describe:`comma-separated list of tools to enable (default: all). Available: "${c.join(", ")}"`}).option("model",{type:"string",alias:["m"],describe:"model to use in the format of provider/model"}),async handler(o){await i.provide({directory:process.cwd(),async fn(){let{path:l,description:t,mode:s,tools:p}=o,d=l&&t&&s&&p!==void 0;if(!d)r.empty(),R("Create agent");let D=i.project,g;if(l)g=u.join(l,"agent");else{let e="global";if(D.vcs==="git"){let n=await $({message:"Location",options:[{label:"Current project",value:"project",hint:i.worktree},{label:"Global",value:"global",hint:j.Path.config}]});if(m(n))throw new r.CancelledError;e=n}g=u.join(e==="global"?j.Path.config:u.join(i.worktree,".qitqode"),"agent")}let b;if(t)b=t;else{let e=await I({message:"Description",placeholder:"What should this agent do?",validate:(n)=>n&&n.length>0?void 0:"Required"});if(m(e))throw new r.CancelledError;b=e}let w=q();w.start("Generating agent configuration...");let G=o.model?x.parseModel(o.model):void 0,f=await L.runPromise(E.Service.use((e)=>e.generate({description:b,model:G}))).catch((e)=>{if(w.stop(`LLM failed to generate agent: ${e.message}`,1),d)process.exit(1);throw new r.CancelledError});w.stop(`Agent ${f.identifier} generated`);let y;if(p!==void 0)y=p?p.split(",").map((e)=>e.trim()):c;else{let e=await O({message:"Select tools to enable (Space to toggle)",options:c.map((n)=>({label:n,value:n})),initialValues:c});if(m(e))throw new r.CancelledError;y=e}let v;if(s)v=s;else{let e=await $({message:"Agent mode",options:[{label:"All",value:"all",hint:"Can function in both primary and subagent roles"},{label:"Primary",value:"primary",hint:"Acts as a primary/main agent"},{label:"Subagent",value:"subagent",hint:"Can be used as a subagent by other agents"}],initialValue:"all"});if(m(e))throw new r.CancelledError;v=e}let A={};for(let e of c)if(!y.includes(e))A[e]=!1;let M={description:f.whenToUse,mode:v};if(Object.keys(A).length>0)M.tools=A;let V=T.default.stringify(f.systemPrompt,M),a=u.join(g,`${f.identifier}.md`);if(await U.mkdir(g,{recursive:!0}),await C.exists(a)){if(d)console.error(`Error: Agent file already exists: ${a}`),process.exit(1);throw P.error(`Agent file already exists: ${a}`),new r.CancelledError}if(await C.write(a,V),d)console.log(a);else P.success(`Agent created: ${a}`),k("Done")}})}}),J=h({command:"list",describe:"list all available agents",async handler(){await i.provide({directory:process.cwd(),async fn(){let l=(await L.runPromise(E.Service.use((t)=>t.list()))).sort((t,s)=>{if(t.native!==s.native)return t.native?-1:1;return t.name.localeCompare(s.name)});for(let t of l)process.stdout.write(`${t.name} (${t.mode})`+S),process.stdout.write(` ${JSON.stringify(t.permission,null,2)}`+S)}})}}),ne=h({command:"agent",describe:"manage agents",builder:(o)=>o.command(B).command(J).demandCommand(),async handler(){}});export{ne as AgentCommand};
|