@qitqode/qitqode-android-arm64 0.1.35 → 0.1.36
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-7311jry1.js → chunk-00sr2gwz.js} +2 -2
- package/bundle/{chunk-azhw650z.js → chunk-02xcb52z.js} +2 -2
- package/bundle/{chunk-gws1rn1v.js → chunk-08q55ya0.js} +1 -1
- package/bundle/chunk-092bx2yw.js +2 -0
- package/bundle/{chunk-xgr6jnd6.js → chunk-0g25z230.js} +1 -1
- package/bundle/chunk-0j6dhrew.js +2 -0
- package/bundle/chunk-0jrgk6vk.js +2 -0
- package/bundle/chunk-0qn52zsd.js +2 -0
- package/bundle/chunk-10accb7b.js +2 -0
- package/bundle/{chunk-t3eymzg1.js → chunk-132tcp2j.js} +2 -2
- package/bundle/chunk-13kpdfr7.js +2 -0
- package/bundle/chunk-15s8zwgf.js +2 -0
- package/bundle/{chunk-nj4d554m.js → chunk-1bx2sjn6.js} +1 -1
- package/bundle/chunk-1kgyfja6.js +2 -0
- package/bundle/{chunk-bv29k2pf.js → chunk-1mcsf4yb.js} +2 -2
- package/bundle/{chunk-kwx9ewe0.js → chunk-1wpjmwnh.js} +1 -1
- package/bundle/chunk-1yv5h8k4.js +2 -0
- package/bundle/chunk-24rw1br0.js +3 -0
- package/bundle/{chunk-snr44en9.js → chunk-25bp7pcm.js} +2 -2
- package/bundle/{chunk-kmcsz8yv.js → chunk-2dkrfc1s.js} +1 -1
- package/bundle/chunk-364ccew0.js +3 -0
- package/bundle/{chunk-aa8hymcv.js → chunk-37dvnent.js} +2 -2
- package/bundle/chunk-3bkdbqjj.js +2 -0
- package/bundle/chunk-3bnqw3xp.js +3 -0
- package/bundle/{chunk-08m0hkdz.js → chunk-3dr4469n.js} +1 -1
- package/bundle/{chunk-hv6eccx1.js → chunk-3gw6r3hf.js} +179 -179
- package/bundle/{chunk-n96tvjgj.js → chunk-3mepk08v.js} +2 -2
- package/bundle/chunk-3sz6gw10.js +3 -0
- package/bundle/chunk-41x11r2s.js +3 -0
- package/bundle/{chunk-xqdrr7xg.js → chunk-45mjcxqk.js} +1 -1
- package/bundle/{chunk-qrtc3etn.js → chunk-4fa390yr.js} +2 -2
- package/bundle/chunk-4gs87ghj.js +3 -0
- package/bundle/chunk-4kqdzdv5.js +3 -0
- package/bundle/{chunk-3k2b05fv.js → chunk-4sazy0nq.js} +1 -1
- package/bundle/chunk-4tbqsrsn.js +2 -0
- package/bundle/{chunk-ngccf7ga.js → chunk-52b1v7mn.js} +1 -1
- package/bundle/chunk-53kns5wy.js +2 -0
- package/bundle/{chunk-11v7vz3y.js → chunk-549ptbaj.js} +1 -1
- package/bundle/chunk-559ek1ym.js +2 -0
- package/bundle/{chunk-34p46th6.js → chunk-5bate758.js} +1 -1
- package/bundle/{chunk-kdcnder5.js → chunk-5kmfnkzv.js} +1 -1
- package/bundle/{chunk-w1n4rf6n.js → chunk-5pkg052s.js} +2 -2
- package/bundle/chunk-5yfzzmv0.js +2 -0
- package/bundle/{chunk-rsszcqxd.js → chunk-60qyqqxx.js} +1 -1
- package/bundle/{chunk-94pcpztx.js → chunk-64s7vfj7.js} +2 -2
- package/bundle/{chunk-bzgj60w4.js → chunk-6sfhbckv.js} +1 -1
- package/bundle/{chunk-8762ty72.js → chunk-70pb4kcm.js} +2 -2
- package/bundle/{chunk-04hvaaje.js → chunk-72zxassf.js} +1 -1
- package/bundle/{chunk-yz6898wy.js → chunk-73ckx171.js} +1 -1
- package/bundle/chunk-7cbj28fp.js +2 -0
- package/bundle/chunk-7dep7g7c.js +2 -0
- package/bundle/{chunk-gj0wt0cy.js → chunk-7fawtcnn.js} +1 -1
- package/bundle/{chunk-zfn0z4sh.js → chunk-7gbytqkn.js} +2 -2
- package/bundle/{chunk-x66ycpfs.js → chunk-7jhrxzjx.js} +2 -2
- package/bundle/{chunk-09pkckr1.js → chunk-7vftsy04.js} +1 -1
- package/bundle/{chunk-zfd70p01.js → chunk-8dxdeksr.js} +1 -1
- package/bundle/{chunk-6styp5dn.js → chunk-8fgamz4y.js} +1 -1
- package/bundle/{chunk-9qdr9t8c.js → chunk-8q6z6emx.js} +1 -1
- package/bundle/{chunk-4ttf9rjd.js → chunk-8r3410c2.js} +1 -1
- package/bundle/{chunk-3mzcr3fw.js → chunk-8tp4whyw.js} +1 -1
- package/bundle/chunk-8yn64y27.js +2 -0
- package/bundle/{chunk-41v0x1jk.js → chunk-8yr682pv.js} +2 -2
- package/bundle/chunk-8ywa7az5.js +2 -0
- package/bundle/chunk-8ywdddts.js +2 -0
- package/bundle/chunk-8zmreqxx.js +2 -0
- package/bundle/chunk-92zjark4.js +2 -0
- package/bundle/chunk-983rqajz.js +7 -0
- package/bundle/{chunk-kjyw00jp.js → chunk-9cw4cnz0.js} +1 -1
- package/bundle/{chunk-2swch6mx.js → chunk-9dh9bc9d.js} +1 -1
- package/bundle/{chunk-y437vyza.js → chunk-9fkmhmh6.js} +1 -1
- package/bundle/{chunk-7vd91wsd.js → chunk-9nk0ts0s.js} +1 -1
- package/bundle/{chunk-p9cnzxb8.js → chunk-9s4whpg1.js} +2 -2
- package/bundle/{chunk-yajd975f.js → chunk-9xvctnjr.js} +1 -1
- package/bundle/chunk-9yakc5yv.js +28 -0
- package/bundle/{chunk-4wxxyrxn.js → chunk-9zre5e54.js} +1 -1
- package/bundle/chunk-a42q5mx4.js +3 -0
- package/bundle/{chunk-yt3f3j35.js → chunk-a9y27zd2.js} +1 -1
- package/bundle/{chunk-mex0fe9s.js → chunk-acyj91wq.js} +1 -1
- package/bundle/chunk-aq28ejhv.js +2 -0
- package/bundle/{chunk-pkc4ddw1.js → chunk-atpzz901.js} +1 -1
- package/bundle/chunk-ax1y4699.js +2 -0
- package/bundle/{chunk-dctj3c22.js → chunk-b0jh0rby.js} +2 -2
- package/bundle/chunk-b0x888w9.js +2 -0
- package/bundle/chunk-b10px5g4.js +2 -0
- package/bundle/chunk-b1qhpxee.js +2 -0
- package/bundle/chunk-b4ysd5b4.js +9 -0
- package/bundle/chunk-bcs2gvmp.js +2 -0
- package/bundle/{chunk-7mxt5b0h.js → chunk-bjcb9kt0.js} +1 -1
- package/bundle/{chunk-67d5d8mr.js → chunk-bnz0mxak.js} +1 -1
- package/bundle/{chunk-er38zew1.js → chunk-brh35yt5.js} +2 -2
- package/bundle/chunk-bs020a3x.js +2 -0
- package/bundle/{chunk-7eexey82.js → chunk-c72jajx9.js} +1 -1
- package/bundle/{chunk-81trveht.js → chunk-cagk1sjd.js} +1 -1
- package/bundle/{chunk-1byd3wma.js → chunk-cdh26622.js} +2 -2
- package/bundle/chunk-cjxcnhmq.js +14 -0
- package/bundle/{chunk-zddknkw7.js → chunk-cx0j6mpq.js} +1 -1
- package/bundle/{chunk-zh3fny3z.js → chunk-cx7p4ezk.js} +2 -2
- package/bundle/chunk-d0xs3j5h.js +2 -0
- package/bundle/{chunk-pxmhe36r.js → chunk-d1rn44wz.js} +1 -1
- package/bundle/chunk-d72rty3t.js +2 -0
- package/bundle/{chunk-0c6ep9mc.js → chunk-d93z6hrn.js} +1 -1
- package/bundle/{chunk-seghf5fc.js → chunk-dgx4rq86.js} +1 -1
- package/bundle/{chunk-qzj6027k.js → chunk-dh1h513y.js} +1 -1
- package/bundle/chunk-dj951pms.js +2 -0
- package/bundle/chunk-dp6zktka.js +2 -0
- package/bundle/{chunk-ba3h1pzs.js → chunk-dshnn54c.js} +1 -1
- package/bundle/{chunk-73myw3bj.js → chunk-dt899wbf.js} +2 -2
- package/bundle/chunk-dvqdtdza.js +2 -0
- package/bundle/{chunk-6ynxf3q7.js → chunk-dvxk6mr6.js} +2 -2
- package/bundle/chunk-dx7h5r8j.js +2 -0
- package/bundle/{chunk-bnss5dkk.js → chunk-dykqn0nj.js} +2 -2
- package/bundle/chunk-e03tgfpb.js +8 -0
- package/bundle/chunk-e07dbha4.js +2 -0
- package/bundle/chunk-e88wd9ex.js +2 -0
- package/bundle/{chunk-y9zstzed.js → chunk-eaqfnwdj.js} +1 -1
- package/bundle/chunk-ebabnv33.js +3 -0
- package/bundle/chunk-ebdpg3cn.js +2 -0
- package/bundle/{chunk-8vg4fmg2.js → chunk-ebkztnpf.js} +180 -178
- package/bundle/chunk-ec7pznsp.js +2 -0
- package/bundle/chunk-et7kz7kx.js +2 -0
- package/bundle/{chunk-kfmz2p27.js → chunk-ev3a2sxv.js} +2 -2
- package/bundle/{chunk-d00c1k9w.js → chunk-ewpzqnj4.js} +1 -1
- package/bundle/chunk-eyc6tb5h.js +2 -0
- package/bundle/chunk-eywryd3k.js +2 -0
- package/bundle/chunk-eze57bty.js +2 -0
- package/bundle/{chunk-qddt2gcs.js → chunk-ezrskm25.js} +1 -1
- package/bundle/chunk-f36ctnbp.js +3 -0
- package/bundle/{chunk-9ayxg9mq.js → chunk-f77nxt23.js} +2 -2
- package/bundle/chunk-fa47vzfc.js +2 -0
- package/bundle/chunk-fe397ph0.js +2 -0
- package/bundle/chunk-fjm9kstr.js +5 -0
- package/bundle/{chunk-exmw8jfa.js → chunk-fmxm4kaj.js} +2 -2
- package/bundle/chunk-fr75ytdr.js +2 -0
- package/bundle/chunk-fw2tnbt6.js +2 -0
- package/bundle/chunk-fwr2qgqb.js +2 -0
- package/bundle/chunk-g204pt98.js +2 -0
- package/bundle/chunk-g5prcvq2.js +14 -0
- package/bundle/{chunk-ggydr1ze.js → chunk-g794ey6w.js} +1 -1
- package/bundle/chunk-gcgmwqhh.js +2 -0
- package/bundle/{chunk-rmve21dh.js → chunk-gg7bg3ek.js} +1 -1
- package/bundle/{chunk-9x25d115.js → chunk-gkj4a27z.js} +1 -1
- package/bundle/chunk-gvtjxg0d.js +2 -0
- package/bundle/chunk-gw36mrg4.js +2 -0
- package/bundle/{chunk-z8gdmvgg.js → chunk-gwfx7tx7.js} +2 -2
- package/bundle/{chunk-q8hd01j7.js → chunk-gxmxx8jb.js} +1 -1
- package/bundle/{chunk-tge53d52.js → chunk-h1kg35mn.js} +1 -1
- package/bundle/chunk-h36qec67.js +2 -0
- package/bundle/{chunk-0msqaywp.js → chunk-h7w35n7w.js} +1 -1
- package/bundle/chunk-h9gtymfm.js +2 -0
- package/bundle/chunk-h9qn35pn.js +2 -0
- package/bundle/{chunk-mr8j7rc6.js → chunk-hb9mc5f9.js} +1 -1
- package/bundle/{chunk-5a7fs1hg.js → chunk-hbh2034m.js} +1 -1
- package/bundle/{chunk-df2aswz3.js → chunk-hcy77w6t.js} +1 -1
- package/bundle/{chunk-6a7c7wnf.js → chunk-hgsykghj.js} +2 -2
- package/bundle/chunk-hhjkezfz.js +2 -0
- package/bundle/chunk-hnz570f9.js +3 -0
- package/bundle/{chunk-tbgczapt.js → chunk-htkwc2se.js} +2 -2
- package/bundle/chunk-j21dnncc.js +4 -0
- package/bundle/{chunk-1yt5rsew.js → chunk-j63fkt6n.js} +1 -1
- package/bundle/chunk-ja18tvc7.js +2 -0
- package/bundle/{chunk-03xppy47.js → chunk-jcjaw7tk.js} +2 -2
- package/bundle/{chunk-jkh6eg7d.js → chunk-jf6ry79j.js} +4 -4
- package/bundle/{chunk-ke7n9t5p.js → chunk-jgz1a29w.js} +3 -3
- package/bundle/{chunk-ebcdxmdd.js → chunk-jngchw38.js} +1 -1
- package/bundle/{chunk-j5ymkhry.js → chunk-jqn27885.js} +1 -1
- package/bundle/chunk-jr2q5295.js +3 -0
- package/bundle/{chunk-hj3ddt53.js → chunk-jts0dma5.js} +2 -2
- package/bundle/chunk-jw16f6t0.js +4 -0
- package/bundle/chunk-jxg15t11.js +2 -0
- package/bundle/{chunk-7hm0c2yg.js → chunk-kqhh2pm9.js} +1 -1
- package/bundle/{chunk-0h8wdch6.js → chunk-kt0ej3nq.js} +1 -1
- package/bundle/chunk-kwzawx7r.js +2 -0
- package/bundle/{chunk-n6msxne8.js → chunk-kx2dp8ch.js} +1 -1
- package/bundle/chunk-m0mek3es.js +2 -0
- package/bundle/chunk-m31d2n6h.js +2 -0
- package/bundle/{chunk-egn55fa2.js → chunk-mcc5ynma.js} +3 -3
- package/bundle/{chunk-md8161zd.js → chunk-mdzzcrf9.js} +2 -2
- package/bundle/{chunk-gckgaqqr.js → chunk-mqtqcc10.js} +2 -2
- package/bundle/{chunk-ynwkr3yh.js → chunk-mvnxwwe7.js} +2 -2
- package/bundle/{chunk-6a77w77q.js → chunk-mvsrzvc4.js} +4 -4
- package/bundle/{chunk-b4knxpqh.js → chunk-mw2hr4pd.js} +1 -1
- package/bundle/{chunk-vszbqv24.js → chunk-mzbr0m2v.js} +1 -1
- package/bundle/{chunk-bj00xk8k.js → chunk-n0trgp1c.js} +2 -2
- package/bundle/chunk-n14qktbg.js +2 -0
- package/bundle/{chunk-yjk6zv2z.js → chunk-n2ygpy76.js} +1 -1
- package/bundle/{chunk-54wh8b12.js → chunk-n7xgfm5x.js} +2 -2
- package/bundle/{chunk-06k6egt2.js → chunk-neqy8j4n.js} +1 -1
- package/bundle/{chunk-nj61v4n7.js → chunk-njkserae.js} +1 -1
- package/bundle/{chunk-n6gtdx5h.js → chunk-nq495be3.js} +1 -1
- package/bundle/chunk-nr4q9fv7.js +2 -0
- package/bundle/{chunk-p3qkexpk.js → chunk-nsjp44fp.js} +1 -1
- package/bundle/chunk-nzzsj54n.js +2 -0
- package/bundle/chunk-p19qfw59.js +2 -0
- package/bundle/chunk-p2yxj9s4.js +2 -0
- package/bundle/{chunk-1dtzxt2w.js → chunk-p3rp99na.js} +1 -1
- package/bundle/chunk-p8czsxp0.js +3 -0
- package/bundle/chunk-p8k48st6.js +5 -0
- package/bundle/{chunk-79agp7v3.js → chunk-p8kpqyxb.js} +2 -2
- package/bundle/{chunk-9fxkh84w.js → chunk-p9zrk16q.js} +1 -1
- package/bundle/{chunk-6ged58yw.js → chunk-pmv8yr8c.js} +2 -2
- package/bundle/{chunk-ee23d2nz.js → chunk-pnq1h5az.js} +2 -2
- package/bundle/chunk-pq3qwxa8.js +2 -0
- package/bundle/{chunk-wfd5h6ax.js → chunk-pqnbdygz.js} +2 -2
- package/bundle/chunk-ps9p14y6.js +2 -0
- package/bundle/{chunk-zfcp509b.js → chunk-pxx2hz0g.js} +2 -2
- package/bundle/{chunk-txbwmwxj.js → chunk-q7rt76qw.js} +1 -1
- package/bundle/{chunk-rq4w0by4.js → chunk-q81m4m9z.js} +1 -1
- package/bundle/chunk-qagc6v17.js +2 -0
- package/bundle/{chunk-mq6jn47r.js → chunk-qb35hqm4.js} +1 -1
- package/bundle/chunk-qc0zhbhm.js +2 -0
- package/bundle/{chunk-keveg5gx.js → chunk-qdcf1ay5.js} +2 -2
- package/bundle/chunk-qp9y0g73.js +3 -0
- package/bundle/chunk-qpd0gab8.js +2 -0
- package/bundle/{chunk-axdzm75h.js → chunk-qqne79vp.js} +2 -2
- package/bundle/{chunk-g4gjz7sq.js → chunk-qs4wef8c.js} +1 -1
- package/bundle/chunk-r0ewmh6f.js +2 -0
- package/bundle/chunk-r3df289z.js +2 -0
- package/bundle/{chunk-by855es0.js → chunk-r58gzg6m.js} +1 -1
- package/bundle/{chunk-fmq0m4k5.js → chunk-r6ndvzd0.js} +1 -1
- package/bundle/chunk-r78kfhvz.js +2 -0
- package/bundle/{chunk-dyv2hqvc.js → chunk-rcyhqkv5.js} +1 -1
- package/bundle/{chunk-t2vm08v6.js → chunk-rd4x4tsv.js} +1 -1
- package/bundle/chunk-rebsz3bj.js +2 -0
- package/bundle/{chunk-yp5bypsp.js → chunk-rexdr63q.js} +2 -2
- package/bundle/{chunk-1me21qdc.js → chunk-rgxy4ngt.js} +1 -1
- package/bundle/chunk-rph5xswc.js +2 -0
- package/bundle/{chunk-dcndy4sr.js → chunk-rph9zj24.js} +1 -1
- package/bundle/chunk-rqmvj7f4.js +3 -0
- package/bundle/{chunk-ryfqwsft.js → chunk-rrd0jf5m.js} +1 -1
- package/bundle/{chunk-mpygdb5a.js → chunk-s8mghr5a.js} +2 -2
- package/bundle/chunk-schtpyjs.js +2 -0
- package/bundle/{chunk-nmehsm3w.js → chunk-shwjjrj8.js} +1 -1
- package/bundle/{chunk-08f4khsw.js → chunk-snt1kefv.js} +3 -3
- package/bundle/{chunk-s8hq6trz.js → chunk-srxx88nb.js} +1 -1
- package/bundle/{chunk-gy0wm7e1.js → chunk-std2bgv7.js} +2 -2
- package/bundle/{chunk-dffhkd30.js → chunk-swcgsrbj.js} +1 -1
- package/bundle/chunk-sy3n0qhc.js +800 -0
- package/bundle/{chunk-wgk7ynt3.js → chunk-t01bhw5h.js} +3 -3
- package/bundle/chunk-t0jjes17.js +2 -0
- package/bundle/{chunk-yprmd5b7.js → chunk-t5tfppwv.js} +2 -2
- package/bundle/chunk-t8rke5fr.js +8 -0
- package/bundle/chunk-tabcpx7t.js +4 -0
- package/bundle/{chunk-gmzrvxnv.js → chunk-tdmn21z0.js} +2 -2
- package/bundle/{chunk-71zw0qhf.js → chunk-tdxbm1nd.js} +1 -1
- package/bundle/{chunk-p825vsjy.js → chunk-te5tfq79.js} +1 -1
- package/bundle/chunk-tf4xwqz7.js +2 -0
- package/bundle/{chunk-fg35hwa0.js → chunk-tgd5ctnt.js} +2 -2
- package/bundle/chunk-tqazneg6.js +2 -0
- package/bundle/{chunk-qa2j0qmy.js → chunk-txqc7543.js} +2 -2
- package/bundle/chunk-tzg4z74d.js +2 -0
- package/bundle/{chunk-a3a1trap.js → chunk-v3x5nrc4.js} +2 -2
- package/bundle/chunk-v8dd6tyn.js +2 -0
- package/bundle/chunk-v8ksjgc3.js +2 -0
- package/bundle/chunk-v8vcwx23.js +2 -0
- package/bundle/chunk-vc4e6xc4.js +10 -0
- package/bundle/chunk-vcrakhgy.js +3 -0
- package/bundle/{chunk-a1hzeejj.js → chunk-vdpd4akk.js} +2 -2
- package/bundle/{chunk-6p7yg5sr.js → chunk-vftqwdpg.js} +1 -1
- package/bundle/chunk-vg41rtdy.js +2 -0
- package/bundle/{chunk-r0k21apr.js → chunk-vgaxv70x.js} +2 -2
- package/bundle/{chunk-nkk4fyqf.js → chunk-vgnddhdj.js} +1 -1
- package/bundle/{chunk-xd3xc1vv.js → chunk-vm58fkrv.js} +1 -1
- package/bundle/{chunk-qg2vk5fw.js → chunk-vsys768k.js} +1 -1
- package/bundle/{chunk-s4qtphwx.js → chunk-w03fdrxe.js} +1 -1
- package/bundle/chunk-w1ypf53m.js +3 -0
- package/bundle/chunk-w24660y4.js +3 -0
- package/bundle/{chunk-z1ay3qd0.js → chunk-w3bmf3zz.js} +1 -1
- package/bundle/{chunk-5e4fxy99.js → chunk-w57j3pgz.js} +82 -82
- package/bundle/{chunk-vsr8mnj6.js → chunk-w5940jxm.js} +1 -1
- package/bundle/chunk-w6rf2knb.js +2 -0
- package/bundle/chunk-w9pdvcf9.js +3 -0
- package/bundle/{chunk-yk97q51d.js → chunk-wev34grp.js} +2 -2
- package/bundle/chunk-wh7r96t3.js +2 -0
- package/bundle/{chunk-1pg6pv0m.js → chunk-wm77svwm.js} +1 -1
- package/bundle/chunk-wnjqaxze.js +2 -0
- package/bundle/{chunk-qkjdr337.js → chunk-x6rr6ss1.js} +1 -1
- package/bundle/{chunk-bbzztav6.js → chunk-xdacgfba.js} +1 -1
- package/bundle/{chunk-6p94fpbn.js → chunk-xdjwapwy.js} +2 -2
- package/bundle/chunk-xfz698bh.js +2 -0
- package/bundle/{chunk-zwnhf4z1.js → chunk-xhbb8b5g.js} +1 -1
- package/bundle/chunk-xqwvx3qq.js +2 -0
- package/bundle/chunk-xxj3sgd5.js +2 -0
- package/bundle/chunk-xyjehgzm.js +3 -0
- package/bundle/{chunk-cs38g1bx.js → chunk-y0ydzdfc.js} +1 -1
- package/bundle/{chunk-wvf5q2hz.js → chunk-y1b2h15z.js} +1 -1
- package/bundle/{chunk-1gf116rg.js → chunk-yacccwf6.js} +1 -1
- package/bundle/chunk-ydc6ypjt.js +77 -0
- package/bundle/{chunk-dhqaqeq6.js → chunk-yeq7b87a.js} +1 -1
- package/bundle/chunk-yfp9y71y.js +2 -0
- package/bundle/chunk-yg9c1v8v.js +2 -0
- package/bundle/{chunk-e6xnynaz.js → chunk-yha554nm.js} +2 -2
- package/bundle/{chunk-rv1stdvb.js → chunk-yj6rbe9p.js} +2 -2
- package/bundle/chunk-yjjh339w.js +2 -0
- package/bundle/{chunk-sjw56r2n.js → chunk-yjp0btmq.js} +3 -3
- package/bundle/{chunk-c5pb87yf.js → chunk-ymtcm4xd.js} +1 -1
- package/bundle/chunk-yt6vd7a5.js +2 -0
- package/bundle/{chunk-ssk8tkwd.js → chunk-yw9pfqxt.js} +1 -1
- package/bundle/{chunk-g6cyhxwg.js → chunk-yykjvt7f.js} +2 -2
- package/bundle/{chunk-sfes6pp1.js → chunk-yzh4rmrt.js} +1 -1
- package/bundle/chunk-yzq3c3dq.js +2 -0
- package/bundle/{chunk-prh3c44x.js → chunk-yzwgvjzd.js} +1 -1
- package/bundle/chunk-z1j25911.js +2 -0
- package/bundle/{chunk-rkwrjphh.js → chunk-z1rshv6g.js} +1 -1
- package/bundle/chunk-z29ahthm.js +2 -0
- package/bundle/{chunk-jgjnz82k.js → chunk-zaan8jk6.js} +1 -1
- package/bundle/{chunk-6gb65bv1.js → chunk-zbqzm65q.js} +1 -1
- package/bundle/{chunk-bk4phk66.js → chunk-zesbm9k1.js} +1 -1
- package/bundle/{chunk-c6vfwjg4.js → chunk-zfcfyagt.js} +1 -1
- package/bundle/{chunk-ywkvq7zb.js → chunk-zfnbk5gy.js} +1 -1
- package/bundle/chunk-zgre4gc2.js +2 -0
- package/bundle/{chunk-z7430qxg.js → chunk-zrmx397j.js} +1 -1
- package/bundle/chunk-zthkjx33.js +2 -0
- package/bundle/chunk-zxddasg8.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-0442cmw2.js +0 -2
- package/bundle/chunk-085pvqr4.js +0 -2
- package/bundle/chunk-0x5jn813.js +0 -2
- package/bundle/chunk-11g2rpv8.js +0 -3
- package/bundle/chunk-28t9akfn.js +0 -2
- package/bundle/chunk-2h1fcqvf.js +0 -2
- package/bundle/chunk-2kens6wh.js +0 -2
- package/bundle/chunk-2scyp9ns.js +0 -2
- package/bundle/chunk-2tw58kwb.js +0 -2
- package/bundle/chunk-2vxx0tax.js +0 -2
- package/bundle/chunk-2ybt3p5z.js +0 -2
- package/bundle/chunk-2zpkw3ge.js +0 -2
- package/bundle/chunk-31g86yn6.js +0 -2
- package/bundle/chunk-397be2x0.js +0 -2
- package/bundle/chunk-3c78nkgn.js +0 -2
- package/bundle/chunk-3d91q2qd.js +0 -2
- package/bundle/chunk-43yv7tz1.js +0 -2
- package/bundle/chunk-496ajawz.js +0 -2
- package/bundle/chunk-499gp5g5.js +0 -2
- package/bundle/chunk-4hzm14xt.js +0 -3
- package/bundle/chunk-4xw14sed.js +0 -2
- package/bundle/chunk-536naqqv.js +0 -2
- package/bundle/chunk-57nvmhjq.js +0 -2
- package/bundle/chunk-5he3d7cy.js +0 -2
- package/bundle/chunk-5qr286w8.js +0 -2
- package/bundle/chunk-606vpgc4.js +0 -4
- package/bundle/chunk-6a1skxcj.js +0 -3
- package/bundle/chunk-6cj7cn5x.js +0 -2
- package/bundle/chunk-6hybp2mt.js +0 -2
- package/bundle/chunk-6y423jax.js +0 -3
- package/bundle/chunk-72ghkgcn.js +0 -2
- package/bundle/chunk-741teh8k.js +0 -2
- package/bundle/chunk-7b3wx6kn.js +0 -2
- package/bundle/chunk-891yevv2.js +0 -2
- package/bundle/chunk-8c1ypgw5.js +0 -3
- package/bundle/chunk-8ktgy41r.js +0 -2
- package/bundle/chunk-8q73cjyj.js +0 -2
- package/bundle/chunk-8rt63jbm.js +0 -2
- package/bundle/chunk-8y623qdx.js +0 -2
- package/bundle/chunk-921vn745.js +0 -2
- package/bundle/chunk-945ebhte.js +0 -2
- package/bundle/chunk-9548cc0c.js +0 -2
- package/bundle/chunk-9yrypq1r.js +0 -14
- package/bundle/chunk-a0rp7gh4.js +0 -77
- package/bundle/chunk-a48t0g95.js +0 -3
- package/bundle/chunk-a949at1c.js +0 -3
- package/bundle/chunk-akk84fnc.js +0 -2
- package/bundle/chunk-aw7j7brm.js +0 -2
- package/bundle/chunk-b6cybdj3.js +0 -2
- package/bundle/chunk-c5fa8cb1.js +0 -2
- package/bundle/chunk-ca4r31we.js +0 -2
- package/bundle/chunk-ckbwdrm3.js +0 -2
- package/bundle/chunk-cqj21rfj.js +0 -3
- package/bundle/chunk-cz3h5n1v.js +0 -3
- package/bundle/chunk-dhc6e1t7.js +0 -2
- package/bundle/chunk-dk6rbqvp.js +0 -2
- package/bundle/chunk-dk975etf.js +0 -3
- package/bundle/chunk-dwajajaq.js +0 -2
- package/bundle/chunk-dxcrggvq.js +0 -2
- package/bundle/chunk-dyt3n3fe.js +0 -2
- package/bundle/chunk-e74efvj2.js +0 -800
- package/bundle/chunk-e7ah0e61.js +0 -2
- package/bundle/chunk-e7v9trve.js +0 -11
- package/bundle/chunk-e8ws454m.js +0 -2
- package/bundle/chunk-efndtzby.js +0 -2
- package/bundle/chunk-eq2pepce.js +0 -2
- package/bundle/chunk-eva3nqqb.js +0 -14
- package/bundle/chunk-f3bnn9rf.js +0 -8
- package/bundle/chunk-f693s9vn.js +0 -2
- package/bundle/chunk-ftepqwyq.js +0 -2
- package/bundle/chunk-g18ax6yp.js +0 -2
- package/bundle/chunk-gadyp6mb.js +0 -2
- package/bundle/chunk-ge8315te.js +0 -5
- package/bundle/chunk-gk28ffhg.js +0 -2
- package/bundle/chunk-gpfc4z4v.js +0 -2
- package/bundle/chunk-gqvg02zp.js +0 -2
- package/bundle/chunk-gsyt2sv7.js +0 -2
- package/bundle/chunk-h3k1dk9m.js +0 -2
- package/bundle/chunk-h8c3dcqt.js +0 -2
- package/bundle/chunk-hfq11w4h.js +0 -2
- package/bundle/chunk-hw5qyht3.js +0 -3
- package/bundle/chunk-hwf58w1k.js +0 -2
- package/bundle/chunk-jyczz3yh.js +0 -8
- package/bundle/chunk-k8k8z6b7.js +0 -3
- package/bundle/chunk-kk3ve911.js +0 -2
- package/bundle/chunk-kv72hxkp.js +0 -3
- package/bundle/chunk-m4j7jyrd.js +0 -3
- package/bundle/chunk-mf3sm0pk.js +0 -2
- package/bundle/chunk-mkng9ykt.js +0 -2
- package/bundle/chunk-mxvypy3s.js +0 -2
- package/bundle/chunk-n5ypgxrn.js +0 -28
- package/bundle/chunk-n9xw9kqc.js +0 -2
- package/bundle/chunk-nc4wbc89.js +0 -2
- package/bundle/chunk-ngk67rt3.js +0 -3
- package/bundle/chunk-nj2bbtmx.js +0 -2
- package/bundle/chunk-nr1g57b2.js +0 -2
- package/bundle/chunk-p0ahbpxv.js +0 -2
- package/bundle/chunk-p7y8z5rd.js +0 -2
- package/bundle/chunk-pt26gerr.js +0 -2
- package/bundle/chunk-qkk1as5n.js +0 -2
- package/bundle/chunk-qsm9xw87.js +0 -2
- package/bundle/chunk-qw980y8h.js +0 -2
- package/bundle/chunk-r2w3gr8d.js +0 -2
- package/bundle/chunk-r5bqcpkz.js +0 -2
- package/bundle/chunk-r67c858b.js +0 -2
- package/bundle/chunk-r9fvfkee.js +0 -2
- package/bundle/chunk-rcn0dhbj.js +0 -2
- package/bundle/chunk-rq47pn3r.js +0 -2
- package/bundle/chunk-rvt1tdy8.js +0 -2
- package/bundle/chunk-ry7q8xn6.js +0 -2
- package/bundle/chunk-s27xvrft.js +0 -2
- package/bundle/chunk-s5nde2kd.js +0 -5
- package/bundle/chunk-scy39p6q.js +0 -2
- package/bundle/chunk-srpe3v8e.js +0 -9
- package/bundle/chunk-st5jaszz.js +0 -3
- package/bundle/chunk-t5qamf96.js +0 -2
- package/bundle/chunk-t9mz17gb.js +0 -3
- package/bundle/chunk-tns5x4w0.js +0 -3
- package/bundle/chunk-ttevj0pj.js +0 -2
- package/bundle/chunk-v7c54cyj.js +0 -2
- package/bundle/chunk-vgefaens.js +0 -2
- package/bundle/chunk-vv59b4re.js +0 -2
- package/bundle/chunk-vwqy7n3g.js +0 -2
- package/bundle/chunk-vysa9hp4.js +0 -7
- package/bundle/chunk-wn076jwj.js +0 -2
- package/bundle/chunk-x0m1qye9.js +0 -2
- package/bundle/chunk-xvntsbb1.js +0 -3
- package/bundle/chunk-y70aachh.js +0 -2
- package/bundle/chunk-yqk58hf6.js +0 -3
- package/bundle/chunk-ysgxt83y.js +0 -2
- package/bundle/chunk-ze9e6nt3.js +0 -3
- package/bundle/chunk-znzan00b.js +0 -3
- package/bundle/chunk-zrp55k47.js +0 -2
- package/bundle/chunk-zwdnh860.js +0 -2
|
@@ -0,0 +1,800 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Al as Il,tl as KN}from"./chunk-364ccew0.js";import{Fl as L7,Hl as l$,Il as xY,Jl as AY,Kl as I1,Ll as D$,Ml as P8,Ol as MA,Sl as W1,Ul as KX,Vl as aA,Wl as $9,am as S8,bm as B0,dm as T7}from"./chunk-vdpd4akk.js";import{gm as xU,hm as hU,im as hw,km as gw,mm as L1}from"./chunk-yjp0btmq.js";import{Bn as oA,Cn as WX,Dn as Jd,En as k5,Gn as iK,Mn as sA,Un as o6,Vm as Zd,pn as q8,qn as w1,rn as K9,sn as g6,tn as k9,vn as m0,xn as O$,yn as DL}from"./chunk-1bx2sjn6.js";import{So as a8,To as $U,Uo as r8,Vo as Ww}from"./chunk-g5prcvq2.js";import{Wo as Nw,Zo as AN,_o as ON,ap as aD,cp as j6,dp as jm,ep as Cm,fp as Nm,ip as Mm,jp as Dm,lp as wm,np as CA,op as Em,pp as bm,up as JX}from"./chunk-t5tfppwv.js";import{Ap as w0,wp as u0,xp as Zm,yp as F$,zp as tD}from"./chunk-qdcf1ay5.js";import{Bp as Lm}from"./chunk-45mjcxqk.js";import{Cp as d0}from"./chunk-qqne79vp.js";import{Ep as dL,Lp as pL}from"./chunk-64s7vfj7.js";import{Mp as k7,Np as g2,Sp as SA,Up as Al,Vp as Ol,oq as kl,pq as vl}from"./chunk-e03tgfpb.js";import{$q as y8,Dq as z4,Eq as xL,Fq as hL,Gq as aU,Iq as a6,Kq as AX,Lq as N4,Mq as gL,Oq as OX,Qq as uL,Rq as mL,Wq as M4,Yq as v8,Zq as qX,_q as A4,br as G8,lr as QH,tr as lL,vq as yL,wq as Q8,yq as FJ,zq as HX}from"./chunk-gwfx7tx7.js";import{Br as JH,Cr as YH,Er as XH,Gr as I8,Hr as g5,Ir as rU,Jr as UX,ur as p0,vr as FX,xr as r6,zr as yZ}from"./chunk-1wpjmwnh.js";import{Sr as uu}from"./chunk-3mepk08v.js";import{Vr as BA,Wr as bu}from"./chunk-0g25z230.js";import{hs as Gw,js as AO,ns as VO}from"./chunk-brh35yt5.js";import{ps as Q2}from"./chunk-vcrakhgy.js";import{Fs as V$,Gs as PZ,Ms as h9,Ns as WN,ys as GN}from"./chunk-xdjwapwy.js";import{jt as M8,ut as qA}from"./chunk-7dep7g7c.js";import{vt as o8,zt as f1}from"./chunk-tabcpx7t.js";import{At as W00}from"./chunk-cx7p4ezk.js";import{Ht as Y30}from"./chunk-tgd5ctnt.js";import{Ot as j1}from"./chunk-3sz6gw10.js";import{Qt as c8}from"./chunk-xqwvx3qq.js";import{$t as N1,Rt as E$,Vt as DN,Wt as km,Zt as Ql,_t as bK,au as _K,bu as v6,ku as eQ}from"./chunk-qp9y0g73.js";import{qu as J8,su as UY,tu as U6}from"./chunk-xyjehgzm.js";import{Bu as b0,Ku as E0}from"./chunk-j21dnncc.js";import{Qu as $4,Ru as C$,Vu as o0,Wu as V4,Xu as mV,_u as F0}from"./chunk-vc4e6xc4.js";import{$u as P}from"./chunk-hnz570f9.js";import{xv as D}from"./chunk-tdmn21z0.js";import{pA as oV}from"./chunk-pqnbdygz.js";import{$C as O1,GF as B9,HP as O,LL as P$,MG as W4,NF as k6,OD as y7,UI as L,aK as jw,bG as PY,cE as gl,iJ as nV,jK as h6,nD as S1,oE as Z8,rG as T0,wK as xw,xD as v7,yG as n7,zF as yw}from"./chunk-ydc6ypjt.js";import{fQ as vL}from"./chunk-pnq1h5az.js";import{gQ as m6,hQ as S,iQ as F1,kQ as Y0,lQ as CK,mQ as EK}from"./chunk-4sazy0nq.js";var R7=S((MO)=>{Object.defineProperty(MO,"__esModule",{value:!0});MO.stringArray=MO.array=MO.func=MO.error=MO.number=MO.string=MO.boolean=void 0;function td($){return $===!0||$===!1}MO.boolean=td;function jO($){return typeof $==="string"||$ instanceof String}MO.string=jO;function ed($){return typeof $==="number"||$ instanceof Number}MO.number=ed;function $p($){return $ instanceof Error}MO.error=$p;function Zp($){return typeof $==="function"}MO.func=Zp;function NO($){return Array.isArray($)}MO.array=NO;function Jp($){return NO($)&&$.every((Z)=>jO(Z))}MO.stringArray=Jp});var HV=S((cO)=>{Object.defineProperty(cO,"__esModule",{value:!0});cO.Message=cO.NotificationType9=cO.NotificationType8=cO.NotificationType7=cO.NotificationType6=cO.NotificationType5=cO.NotificationType4=cO.NotificationType3=cO.NotificationType2=cO.NotificationType1=cO.NotificationType0=cO.NotificationType=cO.RequestType9=cO.RequestType8=cO.RequestType7=cO.RequestType6=cO.RequestType5=cO.RequestType4=cO.RequestType3=cO.RequestType2=cO.RequestType1=cO.RequestType=cO.RequestType0=cO.AbstractMessageSignature=cO.ParameterStructures=cO.ResponseError=cO.ErrorCodes=void 0;var z5=R7(),VV;(function($){$.ParseError=-32700,$.InvalidRequest=-32600,$.MethodNotFound=-32601,$.InvalidParams=-32602,$.InternalError=-32603,$.jsonrpcReservedErrorRangeStart=-32099,$.serverErrorStart=-32099,$.MessageWriteError=-32099,$.MessageReadError=-32098,$.PendingResponseRejected=-32097,$.ConnectionInactive=-32096,$.ServerNotInitialized=-32002,$.UnknownErrorCode=-32001,$.jsonrpcReservedErrorRangeEnd=-32000,$.serverErrorEnd=-32000})(VV||(cO.ErrorCodes=VV={}));class UV extends Error{constructor($,Z,J){super(Z);this.code=z5.number($)?$:VV.UnknownErrorCode,this.data=J,Object.setPrototypeOf(this,UV.prototype)}toJson(){let $={code:this.code,message:this.message};if(this.data!==void 0)$.data=this.data;return $}}cO.ResponseError=UV;class h${constructor($){this.kind=$}static is($){return $===h$.auto||$===h$.byName||$===h$.byPosition}toString(){return this.kind}}cO.ParameterStructures=h$;h$.auto=new h$("auto");h$.byPosition=new h$("byPosition");h$.byName=new h$("byName");class n1{constructor($,Z){this.method=$,this.numberOfParams=Z}get parameterStructures(){return h$.auto}}cO.AbstractMessageSignature=n1;class LO extends n1{constructor($){super($,0)}}cO.RequestType0=LO;class TO extends n1{constructor($,Z=h$.auto){super($,1);this._parameterStructures=Z}get parameterStructures(){return this._parameterStructures}}cO.RequestType=TO;class RO extends n1{constructor($,Z=h$.auto){super($,1);this._parameterStructures=Z}get parameterStructures(){return this._parameterStructures}}cO.RequestType1=RO;class PO extends n1{constructor($){super($,2)}}cO.RequestType2=PO;class IO extends n1{constructor($){super($,3)}}cO.RequestType3=IO;class CO extends n1{constructor($){super($,4)}}cO.RequestType4=CO;class EO extends n1{constructor($){super($,5)}}cO.RequestType5=EO;class bO extends n1{constructor($){super($,6)}}cO.RequestType6=bO;class _O extends n1{constructor($){super($,7)}}cO.RequestType7=_O;class SO extends n1{constructor($){super($,8)}}cO.RequestType8=SO;class fO extends n1{constructor($){super($,9)}}cO.RequestType9=fO;class kO extends n1{constructor($,Z=h$.auto){super($,1);this._parameterStructures=Z}get parameterStructures(){return this._parameterStructures}}cO.NotificationType=kO;class vO extends n1{constructor($){super($,0)}}cO.NotificationType0=vO;class yO extends n1{constructor($,Z=h$.auto){super($,1);this._parameterStructures=Z}get parameterStructures(){return this._parameterStructures}}cO.NotificationType1=yO;class xO extends n1{constructor($){super($,2)}}cO.NotificationType2=xO;class hO extends n1{constructor($){super($,3)}}cO.NotificationType3=hO;class gO extends n1{constructor($){super($,4)}}cO.NotificationType4=gO;class uO extends n1{constructor($){super($,5)}}cO.NotificationType5=uO;class mO extends n1{constructor($){super($,6)}}cO.NotificationType6=mO;class lO extends n1{constructor($){super($,7)}}cO.NotificationType7=lO;class dO extends n1{constructor($){super($,8)}}cO.NotificationType8=dO;class pO extends n1{constructor($){super($,9)}}cO.NotificationType9=pO;var wO;(function($){function Z(X){let Q=X;return Q&&z5.string(Q.method)&&(z5.string(Q.id)||z5.number(Q.id))}$.isRequest=Z;function J(X){let Q=X;return Q&&z5.string(Q.method)&&X.id===void 0}$.isNotification=J;function Y(X){let Q=X;return Q&&(Q.result!==void 0||!!Q.error)&&(z5.string(Q.id)||z5.number(Q.id)||Q.id===null)}$.isResponse=Y})(wO||(cO.Message=wO={}))});var zV=S((sO)=>{var nO;Object.defineProperty(sO,"__esModule",{value:!0});sO.LRUCache=sO.LinkedMap=sO.Touch=void 0;var g$;(function($){$.None=0,$.First=1,$.AsOld=$.First,$.Last=2,$.AsNew=$.Last})(g$||(sO.Touch=g$={}));class BV{constructor(){this[nO]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has($){return this._map.has($)}get($,Z=g$.None){let J=this._map.get($);if(!J)return;if(Z!==g$.None)this.touch(J,Z);return J.value}set($,Z,J=g$.None){let Y=this._map.get($);if(Y){if(Y.value=Z,J!==g$.None)this.touch(Y,J)}else{switch(Y={key:$,value:Z,next:void 0,previous:void 0},J){case g$.None:this.addItemLast(Y);break;case g$.First:this.addItemFirst(Y);break;case g$.Last:this.addItemLast(Y);break;default:this.addItemLast(Y);break}this._map.set($,Y),this._size++}return this}delete($){return!!this.remove($)}remove($){let Z=this._map.get($);if(!Z)return;return this._map.delete($),this.removeItem(Z),this._size--,Z.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw Error("Invalid list");let $=this._head;return this._map.delete($.key),this.removeItem($),this._size--,$.value}forEach($,Z){let J=this._state,Y=this._head;while(Y){if(Z)$.bind(Z)(Y.value,Y.key,this);else $(Y.value,Y.key,this);if(this._state!==J)throw Error("LinkedMap got modified during iteration.");Y=Y.next}}keys(){let $=this._state,Z=this._head,J={[Symbol.iterator]:()=>{return J},next:()=>{if(this._state!==$)throw Error("LinkedMap got modified during iteration.");if(Z){let Y={value:Z.key,done:!1};return Z=Z.next,Y}else return{value:void 0,done:!0}}};return J}values(){let $=this._state,Z=this._head,J={[Symbol.iterator]:()=>{return J},next:()=>{if(this._state!==$)throw Error("LinkedMap got modified during iteration.");if(Z){let Y={value:Z.value,done:!1};return Z=Z.next,Y}else return{value:void 0,done:!0}}};return J}entries(){let $=this._state,Z=this._head,J={[Symbol.iterator]:()=>{return J},next:()=>{if(this._state!==$)throw Error("LinkedMap got modified during iteration.");if(Z){let Y={value:[Z.key,Z.value],done:!1};return Z=Z.next,Y}else return{value:void 0,done:!0}}};return J}[(nO=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld($){if($>=this.size)return;if($===0){this.clear();return}let Z=this._head,J=this.size;while(Z&&J>$)this._map.delete(Z.key),Z=Z.next,J--;if(this._head=Z,this._size=J,Z)Z.previous=void 0;this._state++}addItemFirst($){if(!this._head&&!this._tail)this._tail=$;else if(!this._head)throw Error("Invalid list");else $.next=this._head,this._head.previous=$;this._head=$,this._state++}addItemLast($){if(!this._head&&!this._tail)this._head=$;else if(!this._tail)throw Error("Invalid list");else $.previous=this._tail,this._tail.next=$;this._tail=$,this._state++}removeItem($){if($===this._head&&$===this._tail)this._head=void 0,this._tail=void 0;else if($===this._head){if(!$.next)throw Error("Invalid list");$.next.previous=void 0,this._head=$.next}else if($===this._tail){if(!$.previous)throw Error("Invalid list");$.previous.next=void 0,this._tail=$.previous}else{let{next:Z,previous:J}=$;if(!Z||!J)throw Error("Invalid list");Z.previous=J,J.next=Z}$.next=void 0,$.previous=void 0,this._state++}touch($,Z){if(!this._head||!this._tail)throw Error("Invalid list");if(Z!==g$.First&&Z!==g$.Last)return;if(Z===g$.First){if($===this._head)return;let{next:J,previous:Y}=$;if($===this._tail)Y.next=void 0,this._tail=Y;else J.previous=Y,Y.next=J;$.previous=void 0,$.next=this._head,this._head.previous=$,this._head=$,this._state++}else if(Z===g$.Last){if($===this._tail)return;let{next:J,previous:Y}=$;if($===this._head)J.previous=void 0,this._head=J;else J.previous=Y,Y.next=J;$.next=void 0,$.previous=this._tail,this._tail.next=$,this._tail=$,this._state++}}toJSON(){let $=[];return this.forEach((Z,J)=>{$.push([J,Z])}),$}fromJSON($){this.clear();for(let[Z,J]of $)this.set(Z,J)}}sO.LinkedMap=BV;class oO extends BV{constructor($,Z=1){super();this._limit=$,this._ratio=Math.min(Math.max(0,Z),1)}get limit(){return this._limit}set limit($){this._limit=$,this.checkTrim()}get ratio(){return this._ratio}set ratio($){this._ratio=Math.min(Math.max(0,$),1),this.checkTrim()}get($,Z=g$.AsNew){return super.get($,Z)}peek($){return super.get($,g$.None)}set($,Z){return super.set($,Z,g$.Last),this.checkTrim(),this}checkTrim(){if(this.size>this._limit)this.trimOld(Math.round(this._limit*this._ratio))}}sO.LRUCache=oO});var $q=S((tO)=>{Object.defineProperty(tO,"__esModule",{value:!0});tO.Disposable=void 0;var aO;(function($){function Z(J){return{dispose:J}}$.create=Z})(aO||(tO.Disposable=aO={}))});var DZ=S((Zq)=>{Object.defineProperty(Zq,"__esModule",{value:!0});var FV;function AV(){if(FV===void 0)throw Error("No runtime abstraction layer installed");return FV}(function($){function Z(J){if(J===void 0)throw Error("No runtime abstraction layer provided");FV=J}$.install=Z})(AV||(AV={}));Zq.default=AV});var P7=S((Xq)=>{Object.defineProperty(Xq,"__esModule",{value:!0});Xq.Emitter=Xq.Event=void 0;var hp=DZ(),Jq;(function($){let Z={dispose(){}};$.None=function(){return Z}})(Jq||(Xq.Event=Jq={}));class Yq{add($,Z=null,J){if(!this._callbacks)this._callbacks=[],this._contexts=[];if(this._callbacks.push($),this._contexts.push(Z),Array.isArray(J))J.push({dispose:()=>this.remove($,Z)})}remove($,Z=null){if(!this._callbacks)return;let J=!1;for(let Y=0,X=this._callbacks.length;Y<X;Y++)if(this._callbacks[Y]===$)if(this._contexts[Y]===Z){this._callbacks.splice(Y,1),this._contexts.splice(Y,1);return}else J=!0;if(J)throw Error("When adding a listener with a context, you should remove it with the same context")}invoke(...$){if(!this._callbacks)return[];let Z=[],J=this._callbacks.slice(0),Y=this._contexts.slice(0);for(let X=0,Q=J.length;X<Q;X++)try{Z.push(J[X].apply(Y[X],$))}catch(G){(0,hp.default)().console.error(G)}return Z}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}}class q9{constructor($){this._options=$}get event(){if(!this._event)this._event=($,Z,J)=>{if(!this._callbacks)this._callbacks=new Yq;if(this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty())this._options.onFirstListenerAdd(this);this._callbacks.add($,Z);let Y={dispose:()=>{if(!this._callbacks)return;if(this._callbacks.remove($,Z),Y.dispose=q9._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty())this._options.onLastListenerRemove(this)}};if(Array.isArray(J))J.push(Y);return Y};return this._event}fire($){if(this._callbacks)this._callbacks.invoke.call(this._callbacks,$)}dispose(){if(this._callbacks)this._callbacks.dispose(),this._callbacks=void 0}}Xq.Emitter=q9;q9._noop=function(){}});var N9=S((Wq)=>{Object.defineProperty(Wq,"__esModule",{value:!0});Wq.CancellationTokenSource=Wq.CancellationToken=void 0;var up=DZ(),mp=R7(),OV=P7(),j9;(function($){$.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:OV.Event.None}),$.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:OV.Event.None});function Z(J){let Y=J;return Y&&(Y===$.None||Y===$.Cancelled||mp.boolean(Y.isCancellationRequested)&&!!Y.onCancellationRequested)}$.is=Z})(j9||(Wq.CancellationToken=j9={}));var lp=Object.freeze(function($,Z){let J=(0,up.default)().timer.setTimeout($.bind(Z),0);return{dispose(){J.dispose()}}});class qV{constructor(){this._isCancelled=!1}cancel(){if(!this._isCancelled){if(this._isCancelled=!0,this._emitter)this._emitter.fire(void 0),this.dispose()}}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){if(this._isCancelled)return lp;if(!this._emitter)this._emitter=new OV.Emitter;return this._emitter.event}dispose(){if(this._emitter)this._emitter.dispose(),this._emitter=void 0}}class Gq{get token(){if(!this._token)this._token=new qV;return this._token}cancel(){if(!this._token)this._token=j9.Cancelled;else this._token.cancel()}dispose(){if(!this._token)this._token=j9.None;else if(this._token instanceof qV)this._token.dispose()}}Wq.CancellationTokenSource=Gq});var Aq=S((zq)=>{Object.defineProperty(zq,"__esModule",{value:!0});zq.SharedArrayReceiverStrategy=zq.SharedArraySenderStrategy=void 0;var pp=N9(),bY;(function($){$.Continue=0,$.Cancelled=1})(bY||(bY={}));class Vq{constructor(){this.buffers=new Map}enableCancellation($){if($.id===null)return;let Z=new SharedArrayBuffer(4),J=new Int32Array(Z,0,1);J[0]=bY.Continue,this.buffers.set($.id,Z),$.$cancellationData=Z}async sendCancellation($,Z){let J=this.buffers.get(Z);if(J===void 0)return;let Y=new Int32Array(J,0,1);Atomics.store(Y,0,bY.Cancelled)}cleanup($){this.buffers.delete($)}dispose(){this.buffers.clear()}}zq.SharedArraySenderStrategy=Vq;class Uq{constructor($){this.data=new Int32Array($,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===bY.Cancelled}get onCancellationRequested(){throw Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}}class Hq{constructor($){this.token=new Uq($)}cancel(){}dispose(){}}class Bq{constructor(){this.kind="request"}createCancellationTokenSource($){let Z=$.$cancellationData;if(Z===void 0)return new pp.CancellationTokenSource;return new Hq(Z)}}zq.SharedArrayReceiverStrategy=Bq});var jV=S((qq)=>{Object.defineProperty(qq,"__esModule",{value:!0});qq.Semaphore=void 0;var ip=DZ();class Oq{constructor($=1){if($<=0)throw Error("Capacity must be greater than 0");this._capacity=$,this._active=0,this._waiting=[]}lock($){return new Promise((Z,J)=>{this._waiting.push({thunk:$,resolve:Z,reject:J}),this.runNext()})}get active(){return this._active}runNext(){if(this._waiting.length===0||this._active===this._capacity)return;(0,ip.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let $=this._waiting.shift();if(this._active++,this._active>this._capacity)throw Error("To many thunks active");try{let Z=$.thunk();if(Z instanceof Promise)Z.then((J)=>{this._active--,$.resolve(J),this.runNext()},(J)=>{this._active--,$.reject(J),this.runNext()});else this._active--,$.resolve(Z),this.runNext()}catch(Z){this._active--,$.reject(Z),this.runNext()}}}qq.Semaphore=Oq});var Lq=S((Dq)=>{Object.defineProperty(Dq,"__esModule",{value:!0});Dq.ReadableStreamMessageReader=Dq.AbstractMessageReader=Dq.MessageReader=void 0;var MV=DZ(),I7=R7(),NV=P7(),np=jV(),Nq;(function($){function Z(J){let Y=J;return Y&&I7.func(Y.listen)&&I7.func(Y.dispose)&&I7.func(Y.onError)&&I7.func(Y.onClose)&&I7.func(Y.onPartialMessage)}$.is=Z})(Nq||(Dq.MessageReader=Nq={}));class wV{constructor(){this.errorEmitter=new NV.Emitter,this.closeEmitter=new NV.Emitter,this.partialMessageEmitter=new NV.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError($){this.errorEmitter.fire(this.asError($))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage($){this.partialMessageEmitter.fire($)}asError($){if($ instanceof Error)return $;else return Error(`Reader received error. Reason: ${I7.string($.message)?$.message:"unknown"}`)}}Dq.AbstractMessageReader=wV;var DV;(function($){function Z(J){let Y,X,Q,G=new Map,W,K=new Map;if(J===void 0||typeof J==="string")Y=J??"utf-8";else{if(Y=J.charset??"utf-8",J.contentDecoder!==void 0)Q=J.contentDecoder,G.set(Q.name,Q);if(J.contentDecoders!==void 0)for(let V of J.contentDecoders)G.set(V.name,V);if(J.contentTypeDecoder!==void 0)W=J.contentTypeDecoder,K.set(W.name,W);if(J.contentTypeDecoders!==void 0)for(let V of J.contentTypeDecoders)K.set(V.name,V)}if(W===void 0)W=(0,MV.default)().applicationJson.decoder,K.set(W.name,W);return{charset:Y,contentDecoder:Q,contentDecoders:G,contentTypeDecoder:W,contentTypeDecoders:K}}$.fromOptions=Z})(DV||(DV={}));class Mq extends wV{constructor($,Z){super();this.readable=$,this.options=DV.fromOptions(Z),this.buffer=(0,MV.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new np.Semaphore(1)}set partialMessageTimeout($){this._partialMessageTimeout=$}get partialMessageTimeout(){return this._partialMessageTimeout}listen($){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=$;let Z=this.readable.onData((J)=>{this.onData(J)});return this.readable.onError((J)=>this.fireError(J)),this.readable.onClose(()=>this.fireClose()),Z}onData($){try{this.buffer.append($);while(!0){if(this.nextMessageLength===-1){let J=this.buffer.tryReadHeaders(!0);if(!J)return;let Y=J.get("content-length");if(!Y){this.fireError(Error(`Header must provide a Content-Length property.
|
|
3
|
+
${JSON.stringify(Object.fromEntries(J))}`));return}let X=parseInt(Y);if(isNaN(X)){this.fireError(Error(`Content-Length value must be a number. Got ${Y}`));return}this.nextMessageLength=X}let Z=this.buffer.tryReadBody(this.nextMessageLength);if(Z===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let J=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(Z):Z,Y=await this.options.contentTypeDecoder.decode(J,this.options);this.callback(Y)}).catch((J)=>{this.fireError(J)})}}catch(Z){this.fireError(Z)}}clearPartialMessageTimer(){if(this.partialMessageTimer)this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0}setPartialMessageTimer(){if(this.clearPartialMessageTimer(),this._partialMessageTimeout<=0)return;this.partialMessageTimer=(0,MV.default)().timer.setTimeout(($,Z)=>{if(this.partialMessageTimer=void 0,$===this.messageToken)this.firePartialMessage({messageToken:$,waitingTime:Z}),this.setPartialMessageTimer()},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout)}}Dq.ReadableStreamMessageReader=Mq});var _q=S((Eq)=>{Object.defineProperty(Eq,"__esModule",{value:!0});Eq.WriteableStreamMessageWriter=Eq.AbstractMessageWriter=Eq.MessageWriter=void 0;var Tq=DZ(),_Y=R7(),rp=jV(),Rq=P7(),ap="Content-Length: ",Pq=`\r
|
|
4
|
+
`,Iq;(function($){function Z(J){let Y=J;return Y&&_Y.func(Y.dispose)&&_Y.func(Y.onClose)&&_Y.func(Y.onError)&&_Y.func(Y.write)}$.is=Z})(Iq||(Eq.MessageWriter=Iq={}));class TV{constructor(){this.errorEmitter=new Rq.Emitter,this.closeEmitter=new Rq.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError($,Z,J){this.errorEmitter.fire([this.asError($),Z,J])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError($){if($ instanceof Error)return $;else return Error(`Writer received error. Reason: ${_Y.string($.message)?$.message:"unknown"}`)}}Eq.AbstractMessageWriter=TV;var LV;(function($){function Z(J){if(J===void 0||typeof J==="string")return{charset:J??"utf-8",contentTypeEncoder:(0,Tq.default)().applicationJson.encoder};else return{charset:J.charset??"utf-8",contentEncoder:J.contentEncoder,contentTypeEncoder:J.contentTypeEncoder??(0,Tq.default)().applicationJson.encoder}}$.fromOptions=Z})(LV||(LV={}));class Cq extends TV{constructor($,Z){super();this.writable=$,this.options=LV.fromOptions(Z),this.errorCount=0,this.writeSemaphore=new rp.Semaphore(1),this.writable.onError((J)=>this.fireError(J)),this.writable.onClose(()=>this.fireClose())}async write($){return this.writeSemaphore.lock(async()=>{return this.options.contentTypeEncoder.encode($,this.options).then((J)=>{if(this.options.contentEncoder!==void 0)return this.options.contentEncoder.encode(J);else return J}).then((J)=>{let Y=[];return Y.push(ap,J.byteLength.toString(),Pq),Y.push(Pq),this.doWrite($,Y,J)},(J)=>{throw this.fireError(J),J})})}async doWrite($,Z,J){try{return await this.writable.write(Z.join(""),"ascii"),this.writable.write(J)}catch(Y){return this.handleError(Y,$),Promise.reject(Y)}}handleError($,Z){this.errorCount++,this.fireError($,Z,this.errorCount)}end(){this.writable.end()}}Eq.WriteableStreamMessageWriter=Cq});var vq=S((fq)=>{Object.defineProperty(fq,"__esModule",{value:!0});fq.AbstractMessageBuffer=void 0;var $c=13,Zc=10,Jc=`\r
|
|
5
|
+
`;class Sq{constructor($="utf-8"){this._encoding=$,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append($){let Z=typeof $==="string"?this.fromString($,this._encoding):$;this._chunks.push(Z),this._totalLength+=Z.byteLength}tryReadHeaders($=!1){if(this._chunks.length===0)return;let Z=0,J=0,Y=0,X=0;$:while(J<this._chunks.length){let K=this._chunks[J];Y=0;Z:while(Y<K.length){switch(K[Y]){case $c:switch(Z){case 0:Z=1;break;case 2:Z=3;break;default:Z=0}break;case Zc:switch(Z){case 1:Z=2;break;case 3:Z=4,Y++;break $;default:Z=0}break;default:Z=0}Y++}X+=K.byteLength,J++}if(Z!==4)return;let Q=this._read(X+Y),G=new Map,W=this.toString(Q,"ascii").split(Jc);if(W.length<2)return G;for(let K=0;K<W.length-2;K++){let V=W[K],U=V.indexOf(":");if(U===-1)throw Error(`Message header must separate key and value using ':'
|
|
6
|
+
${V}`);let H=V.substr(0,U),B=V.substr(U+1).trim();G.set($?H.toLowerCase():H,B)}return G}tryReadBody($){if(this._totalLength<$)return;return this._read($)}get numberOfBytes(){return this._totalLength}_read($){if($===0)return this.emptyBuffer();if($>this._totalLength)throw Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===$){let X=this._chunks[0];return this._chunks.shift(),this._totalLength-=$,this.asNative(X)}if(this._chunks[0].byteLength>$){let X=this._chunks[0],Q=this.asNative(X,$);return this._chunks[0]=X.slice($),this._totalLength-=$,Q}let Z=this.allocNative($),J=0,Y=0;while($>0){let X=this._chunks[Y];if(X.byteLength>$){let Q=X.slice(0,$);Z.set(Q,J),J+=$,this._chunks[Y]=X.slice($),this._totalLength-=$,$-=$}else Z.set(X,J),J+=X.byteLength,this._chunks.shift(),this._totalLength-=X.byteLength,$-=X.byteLength}return Z}}fq.AbstractMessageBuffer=Sq});var iq=S((mq)=>{Object.defineProperty(mq,"__esModule",{value:!0});mq.createMessageConnection=mq.ConnectionOptions=mq.MessageStrategy=mq.CancellationStrategy=mq.CancellationSenderStrategy=mq.CancellationReceiverStrategy=mq.RequestCancellationReceiverStrategy=mq.IdCancellationReceiverStrategy=mq.ConnectionStrategy=mq.ConnectionError=mq.ConnectionErrors=mq.LogTraceNotification=mq.SetTraceNotification=mq.TraceFormat=mq.TraceValues=mq.Trace=mq.NullLogger=mq.ProgressType=mq.ProgressToken=void 0;var yq=DZ(),t1=R7(),l0=HV(),xq=zV(),SY=P7(),RV=N9(),vY;(function($){$.type=new l0.NotificationType("$/cancelRequest")})(vY||(vY={}));var PV;(function($){function Z(J){return typeof J==="string"||typeof J==="number"}$.is=Z})(PV||(mq.ProgressToken=PV={}));var fY;(function($){$.type=new l0.NotificationType("$/progress")})(fY||(fY={}));class uq{constructor(){}}mq.ProgressType=uq;var IV;(function($){function Z(J){return t1.func(J)}$.is=Z})(IV||(IV={}));mq.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var T1;(function($){$[$.Off=0]="Off",$[$.Messages=1]="Messages",$[$.Compact=2]="Compact",$[$.Verbose=3]="Verbose"})(T1||(mq.Trace=T1={}));var hq;(function($){$.Off="off",$.Messages="messages",$.Compact="compact",$.Verbose="verbose"})(hq||(mq.TraceValues=hq={}));(function($){function Z(Y){if(!t1.string(Y))return $.Off;switch(Y=Y.toLowerCase(),Y){case"off":return $.Off;case"messages":return $.Messages;case"compact":return $.Compact;case"verbose":return $.Verbose;default:return $.Off}}$.fromString=Z;function J(Y){switch(Y){case $.Off:return"off";case $.Messages:return"messages";case $.Compact:return"compact";case $.Verbose:return"verbose";default:return"off"}}$.toString=J})(T1||(mq.Trace=T1={}));var j8;(function($){$.Text="text",$.JSON="json"})(j8||(mq.TraceFormat=j8={}));(function($){function Z(J){if(!t1.string(J))return $.Text;if(J=J.toLowerCase(),J==="json")return $.JSON;else return $.Text}$.fromString=Z})(j8||(mq.TraceFormat=j8={}));var CV;(function($){$.type=new l0.NotificationType("$/setTrace")})(CV||(mq.SetTraceNotification=CV={}));var M9;(function($){$.type=new l0.NotificationType("$/logTrace")})(M9||(mq.LogTraceNotification=M9={}));var kY;(function($){$[$.Closed=1]="Closed",$[$.Disposed=2]="Disposed",$[$.AlreadyListening=3]="AlreadyListening"})(kY||(mq.ConnectionErrors=kY={}));class C7 extends Error{constructor($,Z){super(Z);this.code=$,Object.setPrototypeOf(this,C7.prototype)}}mq.ConnectionError=C7;var EV;(function($){function Z(J){let Y=J;return Y&&t1.func(Y.cancelUndispatched)}$.is=Z})(EV||(mq.ConnectionStrategy=EV={}));var D9;(function($){function Z(J){let Y=J;return Y&&(Y.kind===void 0||Y.kind==="id")&&t1.func(Y.createCancellationTokenSource)&&(Y.dispose===void 0||t1.func(Y.dispose))}$.is=Z})(D9||(mq.IdCancellationReceiverStrategy=D9={}));var bV;(function($){function Z(J){let Y=J;return Y&&Y.kind==="request"&&t1.func(Y.createCancellationTokenSource)&&(Y.dispose===void 0||t1.func(Y.dispose))}$.is=Z})(bV||(mq.RequestCancellationReceiverStrategy=bV={}));var w9;(function($){$.Message=Object.freeze({createCancellationTokenSource(J){return new RV.CancellationTokenSource}});function Z(J){return D9.is(J)||bV.is(J)}$.is=Z})(w9||(mq.CancellationReceiverStrategy=w9={}));var L9;(function($){$.Message=Object.freeze({sendCancellation(J,Y){return J.sendNotification(vY.type,{id:Y})},cleanup(J){}});function Z(J){let Y=J;return Y&&t1.func(Y.sendCancellation)&&t1.func(Y.cleanup)}$.is=Z})(L9||(mq.CancellationSenderStrategy=L9={}));var T9;(function($){$.Message=Object.freeze({receiver:w9.Message,sender:L9.Message});function Z(J){let Y=J;return Y&&w9.is(Y.receiver)&&L9.is(Y.sender)}$.is=Z})(T9||(mq.CancellationStrategy=T9={}));var R9;(function($){function Z(J){let Y=J;return Y&&t1.func(Y.handleMessage)}$.is=Z})(R9||(mq.MessageStrategy=R9={}));var gq;(function($){function Z(J){let Y=J;return Y&&(T9.is(Y.cancellationStrategy)||EV.is(Y.connectionStrategy)||R9.is(Y.messageStrategy))}$.is=Z})(gq||(mq.ConnectionOptions=gq={}));var n8;(function($){$[$.New=1]="New",$[$.Listening=2]="Listening",$[$.Closed=3]="Closed",$[$.Disposed=4]="Disposed"})(n8||(n8={}));function Yc($,Z,J,Y){let X=J!==void 0?J:mq.NullLogger,Q=0,G=0,W=0,K="2.0",V=void 0,U=new Map,H=void 0,B=new Map,z=new Map,F,A=new xq.LinkedMap,j=new Map,N=new Set,w=new Map,q=T1.Off,M=j8.Text,C,R=n8.New,T=new SY.Emitter,I=new SY.Emitter,_=new SY.Emitter,E=new SY.Emitter,f=new SY.Emitter,b=Y&&Y.cancellationStrategy?Y.cancellationStrategy:T9.Message;function y(x){if(x===null)throw Error("Can't send requests with id null since the response can't be correlated.");return"req-"+x.toString()}function k(x){if(x===null)return"res-unknown-"+(++W).toString();else return"res-"+x.toString()}function g(){return"not-"+(++G).toString()}function d(x,i){if(l0.Message.isRequest(i))x.set(y(i.id),i);else if(l0.Message.isResponse(i))x.set(k(i.id),i);else x.set(g(),i)}function p(x){return}function t(){return R===n8.Listening}function r(){return R===n8.Closed}function G0(){return R===n8.Disposed}function O0(){if(R===n8.New||R===n8.Listening)R=n8.Closed,I.fire(void 0)}function h0(x){T.fire([x,void 0,void 0])}function u(x){T.fire(x)}$.onClose(O0),$.onError(h0),Z.onClose(O0),Z.onError(u);function l(){if(F||A.size===0)return;F=(0,yq.default)().timer.setImmediate(()=>{F=void 0,v()})}function $0(x){if(l0.Message.isRequest(x))c(x);else if(l0.Message.isNotification(x))a(x);else if(l0.Message.isResponse(x))m(x);else e(x)}function v(){if(A.size===0)return;let x=A.shift();try{let i=Y?.messageStrategy;if(R9.is(i))i.handleMessage(x,$0);else $0(x)}finally{l()}}let h=(x)=>{try{if(l0.Message.isNotification(x)&&x.method===vY.type.method){let i=x.params.id,n=y(i),J0=A.get(n);if(l0.Message.isRequest(J0)){let M0=Y?.connectionStrategy,D1=M0&&M0.cancelUndispatched?M0.cancelUndispatched(J0,p):p(J0);if(D1&&(D1.error!==void 0||D1.result!==void 0)){A.delete(n),w.delete(i),D1.id=J0.id,s0(D1,x.method,Date.now()),Z.write(D1).catch(()=>X.error("Sending response for canceled message failed."));return}}let C0=w.get(i);if(C0!==void 0){C0.cancel(),K0(x);return}else N.add(i)}d(A,x)}finally{l()}};function c(x){if(G0())return;function i(Z0,v0,V0){let $1={jsonrpc:K,id:x.id};if(Z0 instanceof l0.ResponseError)$1.error=Z0.toJson();else $1.result=Z0===void 0?null:Z0;s0($1,v0,V0),Z.write($1).catch(()=>X.error("Sending response failed."))}function n(Z0,v0,V0){let $1={jsonrpc:K,id:x.id,error:Z0.toJson()};s0($1,v0,V0),Z.write($1).catch(()=>X.error("Sending response failed."))}function J0(Z0,v0,V0){if(Z0===void 0)Z0=null;let $1={jsonrpc:K,id:x.id,result:Z0};s0($1,v0,V0),Z.write($1).catch(()=>X.error("Sending response failed."))}o(x);let C0=U.get(x.method),M0,D1;if(C0)M0=C0.type,D1=C0.handler;let g0=Date.now();if(D1||V){let Z0=x.id??String(Date.now()),v0=D9.is(b.receiver)?b.receiver.createCancellationTokenSource(Z0):b.receiver.createCancellationTokenSource(x);if(x.id!==null&&N.has(x.id))v0.cancel();if(x.id!==null)w.set(Z0,v0);try{let V0;if(D1)if(x.params===void 0){if(M0!==void 0&&M0.numberOfParams!==0){n(new l0.ResponseError(l0.ErrorCodes.InvalidParams,`Request ${x.method} defines ${M0.numberOfParams} params but received none.`),x.method,g0);return}V0=D1(v0.token)}else if(Array.isArray(x.params)){if(M0!==void 0&&M0.parameterStructures===l0.ParameterStructures.byName){n(new l0.ResponseError(l0.ErrorCodes.InvalidParams,`Request ${x.method} defines parameters by name but received parameters by position`),x.method,g0);return}V0=D1(...x.params,v0.token)}else{if(M0!==void 0&&M0.parameterStructures===l0.ParameterStructures.byPosition){n(new l0.ResponseError(l0.ErrorCodes.InvalidParams,`Request ${x.method} defines parameters by position but received parameters by name`),x.method,g0);return}V0=D1(x.params,v0.token)}else if(V)V0=V(x.method,x.params,v0.token);let $1=V0;if(!V0)w.delete(Z0),J0(V0,x.method,g0);else if($1.then)$1.then((D0)=>{w.delete(Z0),i(D0,x.method,g0)},(D0)=>{if(w.delete(Z0),D0 instanceof l0.ResponseError)n(D0,x.method,g0);else if(D0&&t1.string(D0.message))n(new l0.ResponseError(l0.ErrorCodes.InternalError,`Request ${x.method} failed with message: ${D0.message}`),x.method,g0);else n(new l0.ResponseError(l0.ErrorCodes.InternalError,`Request ${x.method} failed unexpectedly without providing any details.`),x.method,g0)});else w.delete(Z0),i(V0,x.method,g0)}catch(V0){if(w.delete(Z0),V0 instanceof l0.ResponseError)i(V0,x.method,g0);else if(V0&&t1.string(V0.message))n(new l0.ResponseError(l0.ErrorCodes.InternalError,`Request ${x.method} failed with message: ${V0.message}`),x.method,g0);else n(new l0.ResponseError(l0.ErrorCodes.InternalError,`Request ${x.method} failed unexpectedly without providing any details.`),x.method,g0)}}else n(new l0.ResponseError(l0.ErrorCodes.MethodNotFound,`Unhandled method ${x.method}`),x.method,g0)}function m(x){if(G0())return;if(x.id===null)if(x.error)X.error(`Received response message without id: Error is:
|
|
7
|
+
${JSON.stringify(x.error,void 0,4)}`);else X.error("Received response message without id. No further error information provided.");else{let i=x.id,n=j.get(i);if(z0(x,n),n!==void 0){j.delete(i);try{if(x.error){let J0=x.error;n.reject(new l0.ResponseError(J0.code,J0.message,J0.data))}else if(x.result!==void 0)n.resolve(x.result);else throw Error("Should never happen.")}catch(J0){if(J0.message)X.error(`Response handler '${n.method}' failed with message: ${J0.message}`);else X.error(`Response handler '${n.method}' failed unexpectedly.`)}}}}function a(x){if(G0())return;let i=void 0,n;if(x.method===vY.type.method){let J0=x.params.id;N.delete(J0),K0(x);return}else{let J0=B.get(x.method);if(J0)n=J0.handler,i=J0.type}if(n||H)try{if(K0(x),n)if(x.params===void 0){if(i!==void 0){if(i.numberOfParams!==0&&i.parameterStructures!==l0.ParameterStructures.byName)X.error(`Notification ${x.method} defines ${i.numberOfParams} params but received none.`)}n()}else if(Array.isArray(x.params)){let J0=x.params;if(x.method===fY.type.method&&J0.length===2&&PV.is(J0[0]))n({token:J0[0],value:J0[1]});else{if(i!==void 0){if(i.parameterStructures===l0.ParameterStructures.byName)X.error(`Notification ${x.method} defines parameters by name but received parameters by position`);if(i.numberOfParams!==x.params.length)X.error(`Notification ${x.method} defines ${i.numberOfParams} params but received ${J0.length} arguments`)}n(...J0)}}else{if(i!==void 0&&i.parameterStructures===l0.ParameterStructures.byPosition)X.error(`Notification ${x.method} defines parameters by position but received parameters by name`);n(x.params)}else if(H)H(x.method,x.params)}catch(J0){if(J0.message)X.error(`Notification handler '${x.method}' failed with message: ${J0.message}`);else X.error(`Notification handler '${x.method}' failed unexpectedly.`)}else _.fire(x)}function e(x){if(!x){X.error("Received empty message.");return}X.error(`Received message which is neither a response nor a notification message:
|
|
8
|
+
${JSON.stringify(x,null,4)}`);let i=x;if(t1.string(i.id)||t1.number(i.id)){let n=i.id,J0=j.get(n);if(J0)J0.reject(Error("The received response has neither a result nor an error property."))}}function H0(x){if(x===void 0||x===null)return;switch(q){case T1.Verbose:return JSON.stringify(x,null,4);case T1.Compact:return JSON.stringify(x);default:return}}function A0(x){if(q===T1.Off||!C)return;if(M===j8.Text){let i=void 0;if((q===T1.Verbose||q===T1.Compact)&&x.params)i=`Params: ${H0(x.params)}
|
|
9
|
+
|
|
10
|
+
`;C.log(`Sending request '${x.method} - (${x.id})'.`,i)}else j0("send-request",x)}function P0(x){if(q===T1.Off||!C)return;if(M===j8.Text){let i=void 0;if(q===T1.Verbose||q===T1.Compact)if(x.params)i=`Params: ${H0(x.params)}
|
|
11
|
+
|
|
12
|
+
`;else i=`No parameters provided.
|
|
13
|
+
|
|
14
|
+
`;C.log(`Sending notification '${x.method}'.`,i)}else j0("send-notification",x)}function s0(x,i,n){if(q===T1.Off||!C)return;if(M===j8.Text){let J0=void 0;if(q===T1.Verbose||q===T1.Compact){if(x.error&&x.error.data)J0=`Error data: ${H0(x.error.data)}
|
|
15
|
+
|
|
16
|
+
`;else if(x.result)J0=`Result: ${H0(x.result)}
|
|
17
|
+
|
|
18
|
+
`;else if(x.error===void 0)J0=`No result returned.
|
|
19
|
+
|
|
20
|
+
`}C.log(`Sending response '${i} - (${x.id})'. Processing request took ${Date.now()-n}ms`,J0)}else j0("send-response",x)}function o(x){if(q===T1.Off||!C)return;if(M===j8.Text){let i=void 0;if((q===T1.Verbose||q===T1.Compact)&&x.params)i=`Params: ${H0(x.params)}
|
|
21
|
+
|
|
22
|
+
`;C.log(`Received request '${x.method} - (${x.id})'.`,i)}else j0("receive-request",x)}function K0(x){if(q===T1.Off||!C||x.method===M9.type.method)return;if(M===j8.Text){let i=void 0;if(q===T1.Verbose||q===T1.Compact)if(x.params)i=`Params: ${H0(x.params)}
|
|
23
|
+
|
|
24
|
+
`;else i=`No parameters provided.
|
|
25
|
+
|
|
26
|
+
`;C.log(`Received notification '${x.method}'.`,i)}else j0("receive-notification",x)}function z0(x,i){if(q===T1.Off||!C)return;if(M===j8.Text){let n=void 0;if(q===T1.Verbose||q===T1.Compact){if(x.error&&x.error.data)n=`Error data: ${H0(x.error.data)}
|
|
27
|
+
|
|
28
|
+
`;else if(x.result)n=`Result: ${H0(x.result)}
|
|
29
|
+
|
|
30
|
+
`;else if(x.error===void 0)n=`No result returned.
|
|
31
|
+
|
|
32
|
+
`}if(i){let J0=x.error?` Request failed: ${x.error.message} (${x.error.code}).`:"";C.log(`Received response '${i.method} - (${x.id})' in ${Date.now()-i.timerStart}ms.${J0}`,n)}else C.log(`Received response ${x.id} without active response promise.`,n)}else j0("receive-response",x)}function j0(x,i){if(!C||q===T1.Off)return;let n={isLSPMessage:!0,type:x,message:i,timestamp:Date.now()};C.log(n)}function Q1(){if(r())throw new C7(kY.Closed,"Connection is closed.");if(G0())throw new C7(kY.Disposed,"Connection is disposed.")}function _0(){if(t())throw new C7(kY.AlreadyListening,"Connection is already listening")}function e0(){if(!t())throw Error("Call listen() first.")}function S0(x){if(x===void 0)return null;else return x}function C1(x){if(x===null)return;else return x}function n0(x){return x!==void 0&&x!==null&&!Array.isArray(x)&&typeof x==="object"}function z1(x,i){switch(x){case l0.ParameterStructures.auto:if(n0(i))return C1(i);else return[S0(i)];case l0.ParameterStructures.byName:if(!n0(i))throw Error("Received parameters by name but param is not an object literal.");return C1(i);case l0.ParameterStructures.byPosition:return[S0(i)];default:throw Error(`Unknown parameter structure ${x.toString()}`)}}function a0(x,i){let n,J0=x.numberOfParams;switch(J0){case 0:n=void 0;break;case 1:n=z1(x.parameterStructures,i[0]);break;default:n=[];for(let C0=0;C0<i.length&&C0<J0;C0++)n.push(S0(i[C0]));if(i.length<J0)for(let C0=i.length;C0<J0;C0++)n.push(null);break}return n}let U1={sendNotification:(x,...i)=>{Q1();let n,J0;if(t1.string(x)){n=x;let M0=i[0],D1=0,g0=l0.ParameterStructures.auto;if(l0.ParameterStructures.is(M0))D1=1,g0=M0;let Z0=i.length,v0=Z0-D1;switch(v0){case 0:J0=void 0;break;case 1:J0=z1(g0,i[D1]);break;default:if(g0===l0.ParameterStructures.byName)throw Error(`Received ${v0} parameters for 'by Name' notification parameter structure.`);J0=i.slice(D1,Z0).map((V0)=>S0(V0));break}}else{let M0=i;n=x.method,J0=a0(x,M0)}let C0={jsonrpc:K,method:n,params:J0};return P0(C0),Z.write(C0).catch((M0)=>{throw X.error("Sending notification failed."),M0})},onNotification:(x,i)=>{Q1();let n;if(t1.func(x))H=x;else if(i)if(t1.string(x))n=x,B.set(x,{type:void 0,handler:i});else n=x.method,B.set(x.method,{type:x,handler:i});return{dispose:()=>{if(n!==void 0)B.delete(n);else H=void 0}}},onProgress:(x,i,n)=>{if(z.has(i))throw Error(`Progress handler for token ${i} already registered`);return z.set(i,n),{dispose:()=>{z.delete(i)}}},sendProgress:(x,i,n)=>{return U1.sendNotification(fY.type,{token:i,value:n})},onUnhandledProgress:E.event,sendRequest:(x,...i)=>{Q1(),e0();let n,J0,C0=void 0;if(t1.string(x)){n=x;let Z0=i[0],v0=i[i.length-1],V0=0,$1=l0.ParameterStructures.auto;if(l0.ParameterStructures.is(Z0))V0=1,$1=Z0;let D0=i.length;if(RV.CancellationToken.is(v0))D0=D0-1,C0=v0;let H1=D0-V0;switch(H1){case 0:J0=void 0;break;case 1:J0=z1($1,i[V0]);break;default:if($1===l0.ParameterStructures.byName)throw Error(`Received ${H1} parameters for 'by Name' request parameter structure.`);J0=i.slice(V0,D0).map((P1)=>S0(P1));break}}else{let Z0=i;n=x.method,J0=a0(x,Z0);let v0=x.numberOfParams;C0=RV.CancellationToken.is(Z0[v0])?Z0[v0]:void 0}let M0=Q++,D1;if(C0)D1=C0.onCancellationRequested(()=>{let Z0=b.sender.sendCancellation(U1,M0);if(Z0===void 0)return X.log(`Received no promise from cancellation strategy when cancelling id ${M0}`),Promise.resolve();else return Z0.catch(()=>{X.log(`Sending cancellation messages for id ${M0} failed`)})});let g0={jsonrpc:K,id:M0,method:n,params:J0};if(A0(g0),typeof b.sender.enableCancellation==="function")b.sender.enableCancellation(g0);return new Promise(async(Z0,v0)=>{let V0=(H1)=>{Z0(H1),b.sender.cleanup(M0),D1?.dispose()},$1=(H1)=>{v0(H1),b.sender.cleanup(M0),D1?.dispose()},D0={method:n,timerStart:Date.now(),resolve:V0,reject:$1};try{j.set(M0,D0),await Z.write(g0)}catch(H1){throw j.delete(M0),D0.reject(new l0.ResponseError(l0.ErrorCodes.MessageWriteError,H1.message?H1.message:"Unknown reason")),X.error("Sending request failed."),H1}})},onRequest:(x,i)=>{Q1();let n=null;if(IV.is(x))n=void 0,V=x;else if(t1.string(x)){if(n=null,i!==void 0)n=x,U.set(x,{handler:i,type:void 0})}else if(i!==void 0)n=x.method,U.set(x.method,{type:x,handler:i});return{dispose:()=>{if(n===null)return;if(n!==void 0)U.delete(n);else V=void 0}}},hasPendingResponse:()=>{return j.size>0},trace:async(x,i,n)=>{let J0=!1,C0=j8.Text;if(n!==void 0)if(t1.boolean(n))J0=n;else J0=n.sendNotification||!1,C0=n.traceFormat||j8.Text;if(q=x,M=C0,q===T1.Off)C=void 0;else C=i;if(J0&&!r()&&!G0())await U1.sendNotification(CV.type,{value:T1.toString(x)})},onError:T.event,onClose:I.event,onUnhandledNotification:_.event,onDispose:f.event,end:()=>{Z.end()},dispose:()=>{if(G0())return;R=n8.Disposed,f.fire(void 0);let x=new l0.ResponseError(l0.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let i of j.values())i.reject(x);if(j=new Map,w=new Map,N=new Set,A=new xq.LinkedMap,t1.func(Z.dispose))Z.dispose();if(t1.func($.dispose))$.dispose()},listen:()=>{Q1(),_0(),R=n8.Listening,$.listen(h)},inspect:()=>{(0,yq.default)().console.log("inspect")}};return U1.onNotification(M9.type,(x)=>{if(q===T1.Off||!C)return;let i=q===T1.Verbose||q===T1.Compact;C.log(x.message,i?x.verbose:void 0)}),U1.onNotification(fY.type,(x)=>{let i=z.get(x.token);if(i)i(x.value);else E.fire(x)}),U1}mq.createMessageConnection=Yc});var P9=S((q0)=>{Object.defineProperty(q0,"__esModule",{value:!0});q0.ProgressType=q0.ProgressToken=q0.createMessageConnection=q0.NullLogger=q0.ConnectionOptions=q0.ConnectionStrategy=q0.AbstractMessageBuffer=q0.WriteableStreamMessageWriter=q0.AbstractMessageWriter=q0.MessageWriter=q0.ReadableStreamMessageReader=q0.AbstractMessageReader=q0.MessageReader=q0.SharedArrayReceiverStrategy=q0.SharedArraySenderStrategy=q0.CancellationToken=q0.CancellationTokenSource=q0.Emitter=q0.Event=q0.Disposable=q0.LRUCache=q0.Touch=q0.LinkedMap=q0.ParameterStructures=q0.NotificationType9=q0.NotificationType8=q0.NotificationType7=q0.NotificationType6=q0.NotificationType5=q0.NotificationType4=q0.NotificationType3=q0.NotificationType2=q0.NotificationType1=q0.NotificationType0=q0.NotificationType=q0.ErrorCodes=q0.ResponseError=q0.RequestType9=q0.RequestType8=q0.RequestType7=q0.RequestType6=q0.RequestType5=q0.RequestType4=q0.RequestType3=q0.RequestType2=q0.RequestType1=q0.RequestType0=q0.RequestType=q0.Message=q0.RAL=void 0;q0.MessageStrategy=q0.CancellationStrategy=q0.CancellationSenderStrategy=q0.CancellationReceiverStrategy=q0.ConnectionError=q0.ConnectionErrors=q0.LogTraceNotification=q0.SetTraceNotification=q0.TraceFormat=q0.TraceValues=q0.Trace=void 0;var g1=HV();Object.defineProperty(q0,"Message",{enumerable:!0,get:function(){return g1.Message}});Object.defineProperty(q0,"RequestType",{enumerable:!0,get:function(){return g1.RequestType}});Object.defineProperty(q0,"RequestType0",{enumerable:!0,get:function(){return g1.RequestType0}});Object.defineProperty(q0,"RequestType1",{enumerable:!0,get:function(){return g1.RequestType1}});Object.defineProperty(q0,"RequestType2",{enumerable:!0,get:function(){return g1.RequestType2}});Object.defineProperty(q0,"RequestType3",{enumerable:!0,get:function(){return g1.RequestType3}});Object.defineProperty(q0,"RequestType4",{enumerable:!0,get:function(){return g1.RequestType4}});Object.defineProperty(q0,"RequestType5",{enumerable:!0,get:function(){return g1.RequestType5}});Object.defineProperty(q0,"RequestType6",{enumerable:!0,get:function(){return g1.RequestType6}});Object.defineProperty(q0,"RequestType7",{enumerable:!0,get:function(){return g1.RequestType7}});Object.defineProperty(q0,"RequestType8",{enumerable:!0,get:function(){return g1.RequestType8}});Object.defineProperty(q0,"RequestType9",{enumerable:!0,get:function(){return g1.RequestType9}});Object.defineProperty(q0,"ResponseError",{enumerable:!0,get:function(){return g1.ResponseError}});Object.defineProperty(q0,"ErrorCodes",{enumerable:!0,get:function(){return g1.ErrorCodes}});Object.defineProperty(q0,"NotificationType",{enumerable:!0,get:function(){return g1.NotificationType}});Object.defineProperty(q0,"NotificationType0",{enumerable:!0,get:function(){return g1.NotificationType0}});Object.defineProperty(q0,"NotificationType1",{enumerable:!0,get:function(){return g1.NotificationType1}});Object.defineProperty(q0,"NotificationType2",{enumerable:!0,get:function(){return g1.NotificationType2}});Object.defineProperty(q0,"NotificationType3",{enumerable:!0,get:function(){return g1.NotificationType3}});Object.defineProperty(q0,"NotificationType4",{enumerable:!0,get:function(){return g1.NotificationType4}});Object.defineProperty(q0,"NotificationType5",{enumerable:!0,get:function(){return g1.NotificationType5}});Object.defineProperty(q0,"NotificationType6",{enumerable:!0,get:function(){return g1.NotificationType6}});Object.defineProperty(q0,"NotificationType7",{enumerable:!0,get:function(){return g1.NotificationType7}});Object.defineProperty(q0,"NotificationType8",{enumerable:!0,get:function(){return g1.NotificationType8}});Object.defineProperty(q0,"NotificationType9",{enumerable:!0,get:function(){return g1.NotificationType9}});Object.defineProperty(q0,"ParameterStructures",{enumerable:!0,get:function(){return g1.ParameterStructures}});var _V=zV();Object.defineProperty(q0,"LinkedMap",{enumerable:!0,get:function(){return _V.LinkedMap}});Object.defineProperty(q0,"LRUCache",{enumerable:!0,get:function(){return _V.LRUCache}});Object.defineProperty(q0,"Touch",{enumerable:!0,get:function(){return _V.Touch}});var Nc=$q();Object.defineProperty(q0,"Disposable",{enumerable:!0,get:function(){return Nc.Disposable}});var nq=P7();Object.defineProperty(q0,"Event",{enumerable:!0,get:function(){return nq.Event}});Object.defineProperty(q0,"Emitter",{enumerable:!0,get:function(){return nq.Emitter}});var oq=N9();Object.defineProperty(q0,"CancellationTokenSource",{enumerable:!0,get:function(){return oq.CancellationTokenSource}});Object.defineProperty(q0,"CancellationToken",{enumerable:!0,get:function(){return oq.CancellationToken}});var sq=Aq();Object.defineProperty(q0,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return sq.SharedArraySenderStrategy}});Object.defineProperty(q0,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return sq.SharedArrayReceiverStrategy}});var SV=Lq();Object.defineProperty(q0,"MessageReader",{enumerable:!0,get:function(){return SV.MessageReader}});Object.defineProperty(q0,"AbstractMessageReader",{enumerable:!0,get:function(){return SV.AbstractMessageReader}});Object.defineProperty(q0,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return SV.ReadableStreamMessageReader}});var fV=_q();Object.defineProperty(q0,"MessageWriter",{enumerable:!0,get:function(){return fV.MessageWriter}});Object.defineProperty(q0,"AbstractMessageWriter",{enumerable:!0,get:function(){return fV.AbstractMessageWriter}});Object.defineProperty(q0,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return fV.WriteableStreamMessageWriter}});var Mc=vq();Object.defineProperty(q0,"AbstractMessageBuffer",{enumerable:!0,get:function(){return Mc.AbstractMessageBuffer}});var I$=iq();Object.defineProperty(q0,"ConnectionStrategy",{enumerable:!0,get:function(){return I$.ConnectionStrategy}});Object.defineProperty(q0,"ConnectionOptions",{enumerable:!0,get:function(){return I$.ConnectionOptions}});Object.defineProperty(q0,"NullLogger",{enumerable:!0,get:function(){return I$.NullLogger}});Object.defineProperty(q0,"createMessageConnection",{enumerable:!0,get:function(){return I$.createMessageConnection}});Object.defineProperty(q0,"ProgressToken",{enumerable:!0,get:function(){return I$.ProgressToken}});Object.defineProperty(q0,"ProgressType",{enumerable:!0,get:function(){return I$.ProgressType}});Object.defineProperty(q0,"Trace",{enumerable:!0,get:function(){return I$.Trace}});Object.defineProperty(q0,"TraceValues",{enumerable:!0,get:function(){return I$.TraceValues}});Object.defineProperty(q0,"TraceFormat",{enumerable:!0,get:function(){return I$.TraceFormat}});Object.defineProperty(q0,"SetTraceNotification",{enumerable:!0,get:function(){return I$.SetTraceNotification}});Object.defineProperty(q0,"LogTraceNotification",{enumerable:!0,get:function(){return I$.LogTraceNotification}});Object.defineProperty(q0,"ConnectionErrors",{enumerable:!0,get:function(){return I$.ConnectionErrors}});Object.defineProperty(q0,"ConnectionError",{enumerable:!0,get:function(){return I$.ConnectionError}});Object.defineProperty(q0,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return I$.CancellationReceiverStrategy}});Object.defineProperty(q0,"CancellationSenderStrategy",{enumerable:!0,get:function(){return I$.CancellationSenderStrategy}});Object.defineProperty(q0,"CancellationStrategy",{enumerable:!0,get:function(){return I$.CancellationStrategy}});Object.defineProperty(q0,"MessageStrategy",{enumerable:!0,get:function(){return I$.MessageStrategy}});var Dc=DZ();q0.RAL=Dc.default});var Zj=S(($j)=>{Object.defineProperty($j,"__esModule",{value:!0});var rq=Y0("util"),u6=P9();class I9 extends u6.AbstractMessageBuffer{constructor($="utf-8"){super($)}emptyBuffer(){return I9.emptyBuffer}fromString($,Z){return Buffer.from($,Z)}toString($,Z){if($ instanceof Buffer)return $.toString(Z);else return new rq.TextDecoder(Z).decode($)}asNative($,Z){if(Z===void 0)return $ instanceof Buffer?$:Buffer.from($);else return $ instanceof Buffer?$.slice(0,Z):Buffer.from($,0,Z)}allocNative($){return Buffer.allocUnsafe($)}}I9.emptyBuffer=Buffer.allocUnsafe(0);class aq{constructor($){this.stream=$}onClose($){return this.stream.on("close",$),u6.Disposable.create(()=>this.stream.off("close",$))}onError($){return this.stream.on("error",$),u6.Disposable.create(()=>this.stream.off("error",$))}onEnd($){return this.stream.on("end",$),u6.Disposable.create(()=>this.stream.off("end",$))}onData($){return this.stream.on("data",$),u6.Disposable.create(()=>this.stream.off("data",$))}}class tq{constructor($){this.stream=$}onClose($){return this.stream.on("close",$),u6.Disposable.create(()=>this.stream.off("close",$))}onError($){return this.stream.on("error",$),u6.Disposable.create(()=>this.stream.off("error",$))}onEnd($){return this.stream.on("end",$),u6.Disposable.create(()=>this.stream.off("end",$))}write($,Z){return new Promise((J,Y)=>{let X=(Q)=>{if(Q===void 0||Q===null)J();else Y(Q)};if(typeof $==="string")this.stream.write($,Z,X);else this.stream.write($,X)})}end(){this.stream.end()}}var eq=Object.freeze({messageBuffer:Object.freeze({create:($)=>new I9($)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:($,Z)=>{try{return Promise.resolve(Buffer.from(JSON.stringify($,void 0,0),Z.charset))}catch(J){return Promise.reject(J)}}}),decoder:Object.freeze({name:"application/json",decode:($,Z)=>{try{if($ instanceof Buffer)return Promise.resolve(JSON.parse($.toString(Z.charset)));else return Promise.resolve(JSON.parse(new rq.TextDecoder(Z.charset).decode($)))}catch(J){return Promise.reject(J)}}})}),stream:Object.freeze({asReadableStream:($)=>new aq($),asWritableStream:($)=>new tq($)}),console,timer:Object.freeze({setTimeout($,Z,...J){let Y=setTimeout($,Z,...J);return{dispose:()=>clearTimeout(Y)}},setImmediate($,...Z){let J=setImmediate($,...Z);return{dispose:()=>clearImmediate(J)}},setInterval($,Z,...J){let Y=setInterval($,Z,...J);return{dispose:()=>clearInterval(Y)}}})});function kV(){return eq}(function($){function Z(){u6.RAL.install(eq)}$.install=Z})(kV||(kV={}));$j.default=kV});var Kj=S((A1)=>{var Pc=A1&&A1.__createBinding||(Object.create?function($,Z,J,Y){if(Y===void 0)Y=J;var X=Object.getOwnPropertyDescriptor(Z,J);if(!X||("get"in X?!Z.__esModule:X.writable||X.configurable))X={enumerable:!0,get:function(){return Z[J]}};Object.defineProperty($,Y,X)}:function($,Z,J,Y){if(Y===void 0)Y=J;$[Y]=Z[J]}),Ic=A1&&A1.__exportStar||function($,Z){for(var J in $)if(J!=="default"&&!Object.prototype.hasOwnProperty.call(Z,J))Pc(Z,$,J)};Object.defineProperty(A1,"__esModule",{value:!0});A1.createMessageConnection=A1.createServerSocketTransport=A1.createClientSocketTransport=A1.createServerPipeTransport=A1.createClientPipeTransport=A1.generateRandomPipeName=A1.StreamMessageWriter=A1.StreamMessageReader=A1.SocketMessageWriter=A1.SocketMessageReader=A1.PortMessageWriter=A1.PortMessageReader=A1.IPCMessageWriter=A1.IPCMessageReader=void 0;var E7=Zj();E7.default.install();var Jj=Y0("path"),Cc=Y0("os"),Ec=Y0("crypto"),C9=Y0("net"),N8=P9();Ic(P9(),A1);class Xj extends N8.AbstractMessageReader{constructor($){super();this.process=$;let Z=this.process;Z.on("error",(J)=>this.fireError(J)),Z.on("close",()=>this.fireClose())}listen($){return this.process.on("message",$),N8.Disposable.create(()=>this.process.off("message",$))}}A1.IPCMessageReader=Xj;class Qj extends N8.AbstractMessageWriter{constructor($){super();this.process=$,this.errorCount=0;let Z=this.process;Z.on("error",(J)=>this.fireError(J)),Z.on("close",()=>this.fireClose)}write($){try{if(typeof this.process.send==="function")this.process.send($,void 0,void 0,(Z)=>{if(Z)this.errorCount++,this.handleError(Z,$);else this.errorCount=0});return Promise.resolve()}catch(Z){return this.handleError(Z,$),Promise.reject(Z)}}handleError($,Z){this.errorCount++,this.fireError($,Z,this.errorCount)}end(){}}A1.IPCMessageWriter=Qj;class Gj extends N8.AbstractMessageReader{constructor($){super();this.onData=new N8.Emitter,$.on("close",()=>this.fireClose),$.on("error",(Z)=>this.fireError(Z)),$.on("message",(Z)=>{this.onData.fire(Z)})}listen($){return this.onData.event($)}}A1.PortMessageReader=Gj;class Wj extends N8.AbstractMessageWriter{constructor($){super();this.port=$,this.errorCount=0,$.on("close",()=>this.fireClose()),$.on("error",(Z)=>this.fireError(Z))}write($){try{return this.port.postMessage($),Promise.resolve()}catch(Z){return this.handleError(Z,$),Promise.reject(Z)}}handleError($,Z){this.errorCount++,this.fireError($,Z,this.errorCount)}end(){}}A1.PortMessageWriter=Wj;class b7 extends N8.ReadableStreamMessageReader{constructor($,Z="utf-8"){super((0,E7.default)().stream.asReadableStream($),Z)}}A1.SocketMessageReader=b7;class _7 extends N8.WriteableStreamMessageWriter{constructor($,Z){super((0,E7.default)().stream.asWritableStream($),Z);this.socket=$}dispose(){super.dispose(),this.socket.destroy()}}A1.SocketMessageWriter=_7;class vV extends N8.ReadableStreamMessageReader{constructor($,Z){super((0,E7.default)().stream.asReadableStream($),Z)}}A1.StreamMessageReader=vV;class yV extends N8.WriteableStreamMessageWriter{constructor($,Z){super((0,E7.default)().stream.asWritableStream($),Z)}}A1.StreamMessageWriter=yV;var Yj=process.env.XDG_RUNTIME_DIR,bc=new Map([["linux",107],["darwin",103]]);function _c(){let $=(0,Ec.randomBytes)(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${$}-sock`;let Z;if(Yj)Z=Jj.join(Yj,`vscode-ipc-${$}.sock`);else Z=Jj.join(Cc.tmpdir(),`vscode-${$}.sock`);let J=bc.get(process.platform);if(J!==void 0&&Z.length>J)(0,E7.default)().console.warn(`WARNING: IPC handle "${Z}" is longer than ${J} characters.`);return Z}A1.generateRandomPipeName=_c;function Sc($,Z="utf-8"){let J,Y=new Promise((X,Q)=>{J=X});return new Promise((X,Q)=>{let G=(0,C9.createServer)((W)=>{G.close(),J([new b7(W,Z),new _7(W,Z)])});G.on("error",Q),G.listen($,()=>{G.removeListener("error",Q),X({onConnected:()=>{return Y}})})})}A1.createClientPipeTransport=Sc;function fc($,Z="utf-8"){let J=(0,C9.createConnection)($);return[new b7(J,Z),new _7(J,Z)]}A1.createServerPipeTransport=fc;function kc($,Z="utf-8"){let J,Y=new Promise((X,Q)=>{J=X});return new Promise((X,Q)=>{let G=(0,C9.createServer)((W)=>{G.close(),J([new b7(W,Z),new _7(W,Z)])});G.on("error",Q),G.listen($,"127.0.0.1",()=>{G.removeListener("error",Q),X({onConnected:()=>{return Y}})})})}A1.createClientSocketTransport=kc;function vc($,Z="utf-8"){let J=(0,C9.createConnection)($,"127.0.0.1");return[new b7(J,Z),new _7(J,Z)]}A1.createServerSocketTransport=vc;function yc($){let Z=$;return Z.read!==void 0&&Z.addListener!==void 0}function xc($){let Z=$;return Z.write!==void 0&&Z.addListener!==void 0}function hc($,Z,J,Y){if(!J)J=N8.NullLogger;let X=yc($)?new vV($):$,Q=xc(Z)?new yV(Z):Z;if(N8.ConnectionStrategy.is(Y))Y={connectionStrategy:Y};return(0,N8.createMessageConnection)(X,Q,J,Y)}A1.createMessageConnection=hc});var cY=S((d20,_N)=>{var Oi=Object.prototype.toString;_N.exports=function(Z){if(Z===void 0)return"undefined";if(Z===null)return"null";var J=typeof Z;if(J==="boolean")return"boolean";if(J==="string")return"string";if(J==="number")return"number";if(J==="symbol")return"symbol";if(J==="function")return Di(Z)?"generatorfunction":"function";if(qi(Z))return"array";if(Ti(Z))return"buffer";if(Li(Z))return"arguments";if(Ni(Z))return"date";if(ji(Z))return"error";if(Mi(Z))return"regexp";switch(bN(Z)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(wi(Z))return"generator";switch(J=Oi.call(Z),J){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return J.slice(8,-1).toLowerCase().replace(/\s/g,"")};function bN($){return typeof $.constructor==="function"?$.constructor.name:null}function qi($){if(Array.isArray)return Array.isArray($);return $ instanceof Array}function ji($){return $ instanceof Error||typeof $.message==="string"&&$.constructor&&typeof $.constructor.stackTraceLimit==="number"}function Ni($){if($ instanceof Date)return!0;return typeof $.toDateString==="function"&&typeof $.getDate==="function"&&typeof $.setDate==="function"}function Mi($){if($ instanceof RegExp)return!0;return typeof $.flags==="string"&&typeof $.ignoreCase==="boolean"&&typeof $.multiline==="boolean"&&typeof $.global==="boolean"}function Di($,Z){return bN($)==="GeneratorFunction"}function wi($){return typeof $.throw==="function"&&typeof $.return==="function"&&typeof $.next==="function"}function Li($){try{if(typeof $.length==="number"&&typeof $.callee==="function")return!0}catch(Z){if(Z.message.indexOf("callee")!==-1)return!0}return!1}function Ti($){if($.constructor&&typeof $.constructor.isBuffer==="function")return $.constructor.isBuffer($);return!1}});var fN=S((p20,SN)=>{/*!
|
|
33
|
+
* is-extendable <https://github.com/jonschlinkert/is-extendable>
|
|
34
|
+
*
|
|
35
|
+
* Copyright (c) 2015, Jon Schlinkert.
|
|
36
|
+
* Licensed under the MIT License.
|
|
37
|
+
*/SN.exports=function(Z){return typeof Z<"u"&&Z!==null&&(typeof Z==="object"||typeof Z==="function")}});var yN=S((c20,vN)=>{var kN=fN();vN.exports=function(Z){if(!kN(Z))Z={};var J=arguments.length;for(var Y=1;Y<J;Y++){var X=arguments[Y];if(kN(X))Ri(Z,X)}return Z};function Ri($,Z){for(var J in Z)if(Pi(Z,J))$[J]=Z[J]}function Pi($,Z){return Object.prototype.hasOwnProperty.call($,Z)}});var gN=S((i20,hN)=>{var Ii=cY(),Ci=yN();hN.exports=function($,Z){if(typeof Z==="function")Z={parse:Z};var J=bi($),Y={section_delimiter:"---",parse:Si},X=Ci({},Y,Z),Q=X.section_delimiter,G=J.content.split(/\r?\n/),W=null,K=xN(),V=[],U=[];function H(N){J.content=N,W=[],V=[]}function B(N){if(U.length)K.key=_i(U[0],Q),K.content=N,X.parse(K,W),W.push(K),K=xN(),V=[],U=[]}for(var z=0;z<G.length;z++){var F=G[z],A=U.length,j=F.trim();if(Ei(j,Q)){if(j.length===3&&z!==0){if(A===0||A===2){V.push(F);continue}U.push(j),K.data=V.join(`
|
|
38
|
+
`),V=[];continue}if(W===null)H(V.join(`
|
|
39
|
+
`));if(A===2)B(V.join(`
|
|
40
|
+
`));U.push(j);continue}V.push(F)}if(W===null)H(V.join(`
|
|
41
|
+
`));else B(V.join(`
|
|
42
|
+
`));return J.sections=W,J};function Ei($,Z){if($.slice(0,Z.length)!==Z)return!1;if($.charAt(Z.length+1)===Z.slice(-1))return!1;return!0}function bi($){if(Ii($)!=="object")$={content:$};if(typeof $.content!=="string"&&!fi($.content))throw TypeError("expected a buffer or string");return $.content=$.content.toString(),$.sections=[],$}function _i($,Z){return $?$.slice(Z.length).trim():""}function xN(){return{key:"",data:"",content:""}}function Si($){return $}function fi($){if($&&$.constructor&&typeof $.constructor.isBuffer==="function")return $.constructor.isBuffer($);return!1}});var M5=S((gi,N5)=>{function uN($){return typeof $>"u"||$===null}function ki($){return typeof $==="object"&&$!==null}function vi($){if(Array.isArray($))return $;else if(uN($))return[];return[$]}function yi($,Z){var J,Y,X,Q;if(Z){Q=Object.keys(Z);for(J=0,Y=Q.length;J<Y;J+=1)X=Q[J],$[X]=Z[X]}return $}function xi($,Z){var J="",Y;for(Y=0;Y<Z;Y+=1)J+=$;return J}function hi($){return $===0&&Number.NEGATIVE_INFINITY===1/$}gi.isNothing=uN;gi.isObject=ki;gi.toArray=vi;gi.repeat=xi;gi.isNegativeZero=hi;gi.extend=yi});var r7=S((n20,mN)=>{function iY($,Z){if(Error.call(this),this.name="YAMLException",this.reason=$,this.mark=Z,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);else this.stack=Error().stack||""}iY.prototype=Object.create(Error.prototype);iY.prototype.constructor=iY;iY.prototype.toString=function(Z){var J=this.name+": ";if(J+=this.reason||"(unknown reason)",!Z&&this.mark)J+=" "+this.mark.toString();return J};mN.exports=iY});var pN=S((o20,dN)=>{var lN=M5();function WU($,Z,J,Y,X){this.name=$,this.buffer=Z,this.position=J,this.line=Y,this.column=X}WU.prototype.getSnippet=function(Z,J){var Y,X,Q,G,W;if(!this.buffer)return null;Z=Z||4,J=J||75,Y="",X=this.position;while(X>0&&`\x00\r
|
|
43
|
+
\x85\u2028\u2029`.indexOf(this.buffer.charAt(X-1))===-1)if(X-=1,this.position-X>J/2-1){Y=" ... ",X+=5;break}Q="",G=this.position;while(G<this.buffer.length&&`\x00\r
|
|
44
|
+
\x85\u2028\u2029`.indexOf(this.buffer.charAt(G))===-1)if(G+=1,G-this.position>J/2-1){Q=" ... ",G-=5;break}return W=this.buffer.slice(X,G),lN.repeat(" ",Z)+Y+W+Q+`
|
|
45
|
+
`+lN.repeat(" ",Z+this.position-X+Y.length)+"^"};WU.prototype.toString=function(Z){var J,Y="";if(this.name)Y+='in "'+this.name+'" ';if(Y+="at line "+(this.line+1)+", column "+(this.column+1),!Z){if(J=this.getSnippet(),J)Y+=`:
|
|
46
|
+
`+J}return Y};dN.exports=WU});var A$=S((s20,iN)=>{var cN=r7(),ii=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],ni=["scalar","sequence","mapping"];function oi($){var Z={};if($!==null)Object.keys($).forEach(function(J){$[J].forEach(function(Y){Z[String(Y)]=J})});return Z}function si($,Z){if(Z=Z||{},Object.keys(Z).forEach(function(J){if(ii.indexOf(J)===-1)throw new cN('Unknown option "'+J+'" is met in definition of "'+$+'" YAML type.')}),this.tag=$,this.kind=Z.kind||null,this.resolve=Z.resolve||function(){return!0},this.construct=Z.construct||function(J){return J},this.instanceOf=Z.instanceOf||null,this.predicate=Z.predicate||null,this.represent=Z.represent||null,this.defaultStyle=Z.defaultStyle||null,this.styleAliases=oi(Z.styleAliases||null),ni.indexOf(this.kind)===-1)throw new cN('Unknown kind "'+this.kind+'" is specified for "'+$+'" YAML type.')}iN.exports=si});var D5=S((r20,oN)=>{var nN=M5(),l9=r7(),ri=A$();function KU($,Z,J){var Y=[];return $.include.forEach(function(X){J=KU(X,Z,J)}),$[Z].forEach(function(X){J.forEach(function(Q,G){if(Q.tag===X.tag&&Q.kind===X.kind)Y.push(G)}),J.push(X)}),J.filter(function(X,Q){return Y.indexOf(Q)===-1})}function ai(){var $={scalar:{},sequence:{},mapping:{},fallback:{}},Z,J;function Y(X){$[X.kind][X.tag]=$.fallback[X.tag]=X}for(Z=0,J=arguments.length;Z<J;Z+=1)arguments[Z].forEach(Y);return $}function a7($){this.include=$.include||[],this.implicit=$.implicit||[],this.explicit=$.explicit||[],this.implicit.forEach(function(Z){if(Z.loadKind&&Z.loadKind!=="scalar")throw new l9("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=KU(this,"implicit",[]),this.compiledExplicit=KU(this,"explicit",[]),this.compiledTypeMap=ai(this.compiledImplicit,this.compiledExplicit)}a7.DEFAULT=null;a7.create=function(){var Z,J;switch(arguments.length){case 1:Z=a7.DEFAULT,J=arguments[0];break;case 2:Z=arguments[0],J=arguments[1];break;default:throw new l9("Wrong number of arguments for Schema.create function")}if(Z=nN.toArray(Z),J=nN.toArray(J),!Z.every(function(Y){return Y instanceof a7}))throw new l9("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!J.every(function(Y){return Y instanceof ri}))throw new l9("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new a7({include:Z,explicit:J})};oN.exports=a7});var rN=S((a20,sN)=>{var ti=A$();sN.exports=new ti("tag:yaml.org,2002:str",{kind:"scalar",construct:function($){return $!==null?$:""}})});var tN=S((t20,aN)=>{var ei=A$();aN.exports=new ei("tag:yaml.org,2002:seq",{kind:"sequence",construct:function($){return $!==null?$:[]}})});var $M=S((e20,eN)=>{var $n=A$();eN.exports=new $n("tag:yaml.org,2002:map",{kind:"mapping",construct:function($){return $!==null?$:{}}})});var d9=S(($R0,ZM)=>{var Zn=D5();ZM.exports=new Zn({explicit:[rN(),tN(),$M()]})});var YM=S((ZR0,JM)=>{var Jn=A$();function Yn($){if($===null)return!0;var Z=$.length;return Z===1&&$==="~"||Z===4&&($==="null"||$==="Null"||$==="NULL")}function Xn(){return null}function Qn($){return $===null}JM.exports=new Jn("tag:yaml.org,2002:null",{kind:"scalar",resolve:Yn,construct:Xn,predicate:Qn,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})});var QM=S((JR0,XM)=>{var Gn=A$();function Wn($){if($===null)return!1;var Z=$.length;return Z===4&&($==="true"||$==="True"||$==="TRUE")||Z===5&&($==="false"||$==="False"||$==="FALSE")}function Kn($){return $==="true"||$==="True"||$==="TRUE"}function Vn($){return Object.prototype.toString.call($)==="[object Boolean]"}XM.exports=new Gn("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Wn,construct:Kn,predicate:Vn,represent:{lowercase:function($){return $?"true":"false"},uppercase:function($){return $?"TRUE":"FALSE"},camelcase:function($){return $?"True":"False"}},defaultStyle:"lowercase"})});var WM=S((YR0,GM)=>{var Un=M5(),Hn=A$();function Bn($){return 48<=$&&$<=57||65<=$&&$<=70||97<=$&&$<=102}function zn($){return 48<=$&&$<=55}function Fn($){return 48<=$&&$<=57}function An($){if($===null)return!1;var Z=$.length,J=0,Y=!1,X;if(!Z)return!1;if(X=$[J],X==="-"||X==="+")X=$[++J];if(X==="0"){if(J+1===Z)return!0;if(X=$[++J],X==="b"){J++;for(;J<Z;J++){if(X=$[J],X==="_")continue;if(X!=="0"&&X!=="1")return!1;Y=!0}return Y&&X!=="_"}if(X==="x"){J++;for(;J<Z;J++){if(X=$[J],X==="_")continue;if(!Bn($.charCodeAt(J)))return!1;Y=!0}return Y&&X!=="_"}for(;J<Z;J++){if(X=$[J],X==="_")continue;if(!zn($.charCodeAt(J)))return!1;Y=!0}return Y&&X!=="_"}if(X==="_")return!1;for(;J<Z;J++){if(X=$[J],X==="_")continue;if(X===":")break;if(!Fn($.charCodeAt(J)))return!1;Y=!0}if(!Y||X==="_")return!1;if(X!==":")return!0;return/^(:[0-5]?[0-9])+$/.test($.slice(J))}function On($){var Z=$,J=1,Y,X,Q=[];if(Z.indexOf("_")!==-1)Z=Z.replace(/_/g,"");if(Y=Z[0],Y==="-"||Y==="+"){if(Y==="-")J=-1;Z=Z.slice(1),Y=Z[0]}if(Z==="0")return 0;if(Y==="0"){if(Z[1]==="b")return J*parseInt(Z.slice(2),2);if(Z[1]==="x")return J*parseInt(Z,16);return J*parseInt(Z,8)}if(Z.indexOf(":")!==-1)return Z.split(":").forEach(function(G){Q.unshift(parseInt(G,10))}),Z=0,X=1,Q.forEach(function(G){Z+=G*X,X*=60}),J*Z;return J*parseInt(Z,10)}function qn($){return Object.prototype.toString.call($)==="[object Number]"&&($%1===0&&!Un.isNegativeZero($))}GM.exports=new Hn("tag:yaml.org,2002:int",{kind:"scalar",resolve:An,construct:On,predicate:qn,represent:{binary:function($){return $>=0?"0b"+$.toString(2):"-0b"+$.toString(2).slice(1)},octal:function($){return $>=0?"0"+$.toString(8):"-0"+$.toString(8).slice(1)},decimal:function($){return $.toString(10)},hexadecimal:function($){return $>=0?"0x"+$.toString(16).toUpperCase():"-0x"+$.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})});var UM=S((XR0,VM)=>{var KM=M5(),jn=A$(),Nn=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Mn($){if($===null)return!1;if(!Nn.test($)||$[$.length-1]==="_")return!1;return!0}function Dn($){var Z,J,Y,X;if(Z=$.replace(/_/g,"").toLowerCase(),J=Z[0]==="-"?-1:1,X=[],"+-".indexOf(Z[0])>=0)Z=Z.slice(1);if(Z===".inf")return J===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;else if(Z===".nan")return NaN;else if(Z.indexOf(":")>=0)return Z.split(":").forEach(function(Q){X.unshift(parseFloat(Q,10))}),Z=0,Y=1,X.forEach(function(Q){Z+=Q*Y,Y*=60}),J*Z;return J*parseFloat(Z,10)}var wn=/^[-+]?[0-9]+e/;function Ln($,Z){var J;if(isNaN($))switch(Z){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===$)switch(Z){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===$)switch(Z){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(KM.isNegativeZero($))return"-0.0";return J=$.toString(10),wn.test(J)?J.replace("e",".e"):J}function Tn($){return Object.prototype.toString.call($)==="[object Number]"&&($%1!==0||KM.isNegativeZero($))}VM.exports=new jn("tag:yaml.org,2002:float",{kind:"scalar",resolve:Mn,construct:Dn,predicate:Tn,represent:Ln,defaultStyle:"lowercase"})});var VU=S((QR0,HM)=>{var Rn=D5();HM.exports=new Rn({include:[d9()],implicit:[YM(),QM(),WM(),UM()]})});var UU=S((GR0,BM)=>{var Pn=D5();BM.exports=new Pn({include:[VU()]})});var OM=S((WR0,AM)=>{var In=A$(),zM=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),FM=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function Cn($){if($===null)return!1;if(zM.exec($)!==null)return!0;if(FM.exec($)!==null)return!0;return!1}function En($){var Z,J,Y,X,Q,G,W,K=0,V=null,U,H,B;if(Z=zM.exec($),Z===null)Z=FM.exec($);if(Z===null)throw Error("Date resolve error");if(J=+Z[1],Y=+Z[2]-1,X=+Z[3],!Z[4])return new Date(Date.UTC(J,Y,X));if(Q=+Z[4],G=+Z[5],W=+Z[6],Z[7]){K=Z[7].slice(0,3);while(K.length<3)K+="0";K=+K}if(Z[9]){if(U=+Z[10],H=+(Z[11]||0),V=(U*60+H)*60000,Z[9]==="-")V=-V}if(B=new Date(Date.UTC(J,Y,X,Q,G,W,K)),V)B.setTime(B.getTime()-V);return B}function bn($){return $.toISOString()}AM.exports=new In("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:Cn,construct:En,instanceOf:Date,represent:bn})});var jM=S((KR0,qM)=>{var _n=A$();function Sn($){return $==="<<"||$===null}qM.exports=new _n("tag:yaml.org,2002:merge",{kind:"scalar",resolve:Sn})});var MM=S((VR0,NM)=>{var w5;try{HU=Y0,w5=HU("buffer").Buffer}catch($){}var HU,fn=A$(),BU=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
47
|
+
\r`;function kn($){if($===null)return!1;var Z,J,Y=0,X=$.length,Q=BU;for(J=0;J<X;J++){if(Z=Q.indexOf($.charAt(J)),Z>64)continue;if(Z<0)return!1;Y+=6}return Y%8===0}function vn($){var Z,J,Y=$.replace(/[\r\n=]/g,""),X=Y.length,Q=BU,G=0,W=[];for(Z=0;Z<X;Z++){if(Z%4===0&&Z)W.push(G>>16&255),W.push(G>>8&255),W.push(G&255);G=G<<6|Q.indexOf(Y.charAt(Z))}if(J=X%4*6,J===0)W.push(G>>16&255),W.push(G>>8&255),W.push(G&255);else if(J===18)W.push(G>>10&255),W.push(G>>2&255);else if(J===12)W.push(G>>4&255);if(w5)return w5.from?w5.from(W):new w5(W);return W}function yn($){var Z="",J=0,Y,X,Q=$.length,G=BU;for(Y=0;Y<Q;Y++){if(Y%3===0&&Y)Z+=G[J>>18&63],Z+=G[J>>12&63],Z+=G[J>>6&63],Z+=G[J&63];J=(J<<8)+$[Y]}if(X=Q%3,X===0)Z+=G[J>>18&63],Z+=G[J>>12&63],Z+=G[J>>6&63],Z+=G[J&63];else if(X===2)Z+=G[J>>10&63],Z+=G[J>>4&63],Z+=G[J<<2&63],Z+=G[64];else if(X===1)Z+=G[J>>2&63],Z+=G[J<<4&63],Z+=G[64],Z+=G[64];return Z}function xn($){return w5&&w5.isBuffer($)}NM.exports=new fn("tag:yaml.org,2002:binary",{kind:"scalar",resolve:kn,construct:vn,predicate:xn,represent:yn})});var wM=S((HR0,DM)=>{var hn=A$(),gn=Object.prototype.hasOwnProperty,un=Object.prototype.toString;function mn($){if($===null)return!0;var Z=[],J,Y,X,Q,G,W=$;for(J=0,Y=W.length;J<Y;J+=1){if(X=W[J],G=!1,un.call(X)!=="[object Object]")return!1;for(Q in X)if(gn.call(X,Q))if(!G)G=!0;else return!1;if(!G)return!1;if(Z.indexOf(Q)===-1)Z.push(Q);else return!1}return!0}function ln($){return $!==null?$:[]}DM.exports=new hn("tag:yaml.org,2002:omap",{kind:"sequence",resolve:mn,construct:ln})});var TM=S((BR0,LM)=>{var dn=A$(),pn=Object.prototype.toString;function cn($){if($===null)return!0;var Z,J,Y,X,Q,G=$;Q=Array(G.length);for(Z=0,J=G.length;Z<J;Z+=1){if(Y=G[Z],pn.call(Y)!=="[object Object]")return!1;if(X=Object.keys(Y),X.length!==1)return!1;Q[Z]=[X[0],Y[X[0]]]}return!0}function nn($){if($===null)return[];var Z,J,Y,X,Q,G=$;Q=Array(G.length);for(Z=0,J=G.length;Z<J;Z+=1)Y=G[Z],X=Object.keys(Y),Q[Z]=[X[0],Y[X[0]]];return Q}LM.exports=new dn("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:cn,construct:nn})});var PM=S((zR0,RM)=>{var on=A$(),sn=Object.prototype.hasOwnProperty;function rn($){if($===null)return!0;var Z,J=$;for(Z in J)if(sn.call(J,Z)){if(J[Z]!==null)return!1}return!0}function an($){return $!==null?$:{}}RM.exports=new on("tag:yaml.org,2002:set",{kind:"mapping",resolve:rn,construct:an})});var t7=S((FR0,IM)=>{var tn=D5();IM.exports=new tn({include:[UU()],implicit:[OM(),jM()],explicit:[MM(),wM(),TM(),PM()]})});var EM=S((AR0,CM)=>{var en=A$();function $o(){return!0}function Zo(){return}function Jo(){return""}function Yo($){return typeof $>"u"}CM.exports=new en("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:$o,construct:Zo,predicate:Yo,represent:Jo})});var _M=S((OR0,bM)=>{var Xo=A$();function Qo($){if($===null)return!1;if($.length===0)return!1;var Z=$,J=/\/([gim]*)$/.exec($),Y="";if(Z[0]==="/"){if(J)Y=J[1];if(Y.length>3)return!1;if(Z[Z.length-Y.length-1]!=="/")return!1}return!0}function Go($){var Z=$,J=/\/([gim]*)$/.exec($),Y="";if(Z[0]==="/"){if(J)Y=J[1];Z=Z.slice(1,Z.length-Y.length-1)}return new RegExp(Z,Y)}function Wo($){var Z="/"+$.source+"/";if($.global)Z+="g";if($.multiline)Z+="m";if($.ignoreCase)Z+="i";return Z}function Ko($){return Object.prototype.toString.call($)==="[object RegExp]"}bM.exports=new Xo("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:Qo,construct:Go,predicate:Ko,represent:Wo})});var fM=S((qR0,SM)=>{var p9;try{zU=Y0,p9=zU("esprima")}catch($){if(typeof window<"u")p9=window.esprima}var zU,Vo=A$();function Uo($){if($===null)return!1;try{var Z="("+$+")",J=p9.parse(Z,{range:!0});if(J.type!=="Program"||J.body.length!==1||J.body[0].type!=="ExpressionStatement"||J.body[0].expression.type!=="ArrowFunctionExpression"&&J.body[0].expression.type!=="FunctionExpression")return!1;return!0}catch(Y){return!1}}function Ho($){var Z="("+$+")",J=p9.parse(Z,{range:!0}),Y=[],X;if(J.type!=="Program"||J.body.length!==1||J.body[0].type!=="ExpressionStatement"||J.body[0].expression.type!=="ArrowFunctionExpression"&&J.body[0].expression.type!=="FunctionExpression")throw Error("Failed to resolve function");if(J.body[0].expression.params.forEach(function(Q){Y.push(Q.name)}),X=J.body[0].expression.body.range,J.body[0].expression.body.type==="BlockStatement")return Function(Y,Z.slice(X[0]+1,X[1]-1));return Function(Y,"return "+Z.slice(X[0],X[1]))}function Bo($){return $.toString()}function zo($){return Object.prototype.toString.call($)==="[object Function]"}SM.exports=new Vo("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:Uo,construct:Ho,predicate:zo,represent:Bo})});var nY=S((NR0,vM)=>{var kM=D5();vM.exports=kM.DEFAULT=new kM({include:[t7()],explicit:[EM(),_M(),fM()]})});var ZD=S((xo,oY)=>{var d6=M5(),lM=r7(),Fo=pN(),dM=t7(),Ao=nY(),bZ=Object.prototype.hasOwnProperty,c9=1,pM=2,cM=3,i9=4,FU=1,Oo=2,yM=3,qo=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,jo=/[\x85\u2028\u2029]/,No=/[,\[\]\{\}]/,iM=/^(?:!|!!|![a-z\-]+!)$/i,nM=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function xM($){return Object.prototype.toString.call($)}function L6($){return $===10||$===13}function L5($){return $===9||$===32}function Y8($){return $===9||$===32||$===10||$===13}function e7($){return $===44||$===91||$===93||$===123||$===125}function Mo($){var Z;if(48<=$&&$<=57)return $-48;if(Z=$|32,97<=Z&&Z<=102)return Z-97+10;return-1}function Do($){if($===120)return 2;if($===117)return 4;if($===85)return 8;return 0}function wo($){if(48<=$&&$<=57)return $-48;return-1}function hM($){return $===48?"\x00":$===97?"\x07":$===98?"\b":$===116?"\t":$===9?"\t":$===110?`
|
|
48
|
+
`:$===118?"\v":$===102?"\f":$===114?"\r":$===101?"\x1B":$===32?" ":$===34?'"':$===47?"/":$===92?"\\":$===78?"\x85":$===95?"\xA0":$===76?"\u2028":$===80?"\u2029":""}function Lo($){if($<=65535)return String.fromCharCode($);return String.fromCharCode(($-65536>>10)+55296,($-65536&1023)+56320)}function oM($,Z,J){if(Z==="__proto__")Object.defineProperty($,Z,{configurable:!0,enumerable:!0,writable:!0,value:J});else $[Z]=J}var sM=Array(256),rM=Array(256);for(CZ=0;CZ<256;CZ++)sM[CZ]=hM(CZ)?1:0,rM[CZ]=hM(CZ);var CZ;function To($,Z){this.input=$,this.filename=Z.filename||null,this.schema=Z.schema||Ao,this.onWarning=Z.onWarning||null,this.legacy=Z.legacy||!1,this.json=Z.json||!1,this.listener=Z.listener||null,this.maxTotalMergeKeys=typeof Z.maxTotalMergeKeys==="number"?Z.maxTotalMergeKeys:1e4,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=$.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.totalMergeKeys=0,this.documents=[]}function aM($,Z){return new lM(Z,new Fo($.filename,$.input,$.position,$.line,$.position-$.lineStart))}function f0($,Z){throw aM($,Z)}function n9($,Z){if($.onWarning)$.onWarning.call(null,aM($,Z))}var gM={YAML:function(Z,J,Y){var X,Q,G;if(Z.version!==null)f0(Z,"duplication of %YAML directive");if(Y.length!==1)f0(Z,"YAML directive accepts exactly one argument");if(X=/^([0-9]+)\.([0-9]+)$/.exec(Y[0]),X===null)f0(Z,"ill-formed argument of the YAML directive");if(Q=parseInt(X[1],10),G=parseInt(X[2],10),Q!==1)f0(Z,"unacceptable YAML version of the document");if(Z.version=Y[0],Z.checkLineBreaks=G<2,G!==1&&G!==2)n9(Z,"unsupported YAML version of the document")},TAG:function(Z,J,Y){var X,Q;if(Y.length!==2)f0(Z,"TAG directive accepts exactly two arguments");if(X=Y[0],Q=Y[1],!iM.test(X))f0(Z,"ill-formed tag handle (first argument) of the TAG directive");if(bZ.call(Z.tagMap,X))f0(Z,'there is a previously declared suffix for "'+X+'" tag handle');if(!nM.test(Q))f0(Z,"ill-formed tag prefix (second argument) of the TAG directive");Z.tagMap[X]=Q}};function EZ($,Z,J,Y){var X,Q,G,W;if(Z<J){if(W=$.input.slice(Z,J),Y){for(X=0,Q=W.length;X<Q;X+=1)if(G=W.charCodeAt(X),!(G===9||32<=G&&G<=1114111))f0($,"expected valid JSON character")}else if(qo.test(W))f0($,"the stream contains non-printable characters");$.result+=W}}function uM($,Z,J,Y){var X,Q,G,W;if(!d6.isObject(J))f0($,"cannot merge mappings; the provided source object is unacceptable");X=Object.keys(J);for(G=0,W=X.length;G<W;G+=1){if(Q=X[G],$.maxTotalMergeKeys!==-1&&++$.totalMergeKeys>$.maxTotalMergeKeys)f0($,"merge keys exceeded maxTotalMergeKeys ("+$.maxTotalMergeKeys+")");if(!bZ.call(Z,Q))oM(Z,Q,J[Q]),Y[Q]=!0}}function $J($,Z,J,Y,X,Q,G,W){var K,V;if(Array.isArray(X)){X=Array.prototype.slice.call(X);for(K=0,V=X.length;K<V;K+=1){if(Array.isArray(X[K]))f0($,"nested arrays are not supported inside keys");if(typeof X==="object"&&xM(X[K])==="[object Object]")X[K]="[object Object]"}}if(typeof X==="object"&&xM(X)==="[object Object]")X="[object Object]";if(X=String(X),Z===null)Z={};if(Y==="tag:yaml.org,2002:merge")if(Array.isArray(Q))for(K=0,V=Q.length;K<V;K+=1)uM($,Z,Q[K],J);else uM($,Z,Q,J);else{if(!$.json&&!bZ.call(J,X)&&bZ.call(Z,X))$.line=G||$.line,$.position=W||$.position,f0($,"duplicated mapping key");oM(Z,X,Q),delete J[X]}return Z}function AU($){var Z=$.input.charCodeAt($.position);if(Z===10)$.position++;else if(Z===13){if($.position++,$.input.charCodeAt($.position)===10)$.position++}else f0($,"a line break is expected");$.line+=1,$.lineStart=$.position}function U$($,Z,J){var Y=0,X=$.input.charCodeAt($.position);while(X!==0){while(L5(X))X=$.input.charCodeAt(++$.position);if(Z&&X===35)do X=$.input.charCodeAt(++$.position);while(X!==10&&X!==13&&X!==0);if(L6(X)){AU($),X=$.input.charCodeAt($.position),Y++,$.lineIndent=0;while(X===32)$.lineIndent++,X=$.input.charCodeAt(++$.position)}else break}if(J!==-1&&Y!==0&&$.lineIndent<J)n9($,"deficient indentation");return Y}function o9($){var Z=$.position,J;if(J=$.input.charCodeAt(Z),(J===45||J===46)&&J===$.input.charCodeAt(Z+1)&&J===$.input.charCodeAt(Z+2)){if(Z+=3,J=$.input.charCodeAt(Z),J===0||Y8(J))return!0}return!1}function OU($,Z){if(Z===1)$.result+=" ";else if(Z>1)$.result+=d6.repeat(`
|
|
49
|
+
`,Z-1)}function Ro($,Z,J){var Y,X,Q,G,W,K,V,U,H=$.kind,B=$.result,z;if(z=$.input.charCodeAt($.position),Y8(z)||e7(z)||z===35||z===38||z===42||z===33||z===124||z===62||z===39||z===34||z===37||z===64||z===96)return!1;if(z===63||z===45){if(X=$.input.charCodeAt($.position+1),Y8(X)||J&&e7(X))return!1}$.kind="scalar",$.result="",Q=G=$.position,W=!1;while(z!==0){if(z===58){if(X=$.input.charCodeAt($.position+1),Y8(X)||J&&e7(X))break}else if(z===35){if(Y=$.input.charCodeAt($.position-1),Y8(Y))break}else if($.position===$.lineStart&&o9($)||J&&e7(z))break;else if(L6(z))if(K=$.line,V=$.lineStart,U=$.lineIndent,U$($,!1,-1),$.lineIndent>=Z){W=!0,z=$.input.charCodeAt($.position);continue}else{$.position=G,$.line=K,$.lineStart=V,$.lineIndent=U;break}if(W)EZ($,Q,G,!1),OU($,$.line-K),Q=G=$.position,W=!1;if(!L5(z))G=$.position+1;z=$.input.charCodeAt(++$.position)}if(EZ($,Q,G,!1),$.result)return!0;return $.kind=H,$.result=B,!1}function Po($,Z){var J,Y,X;if(J=$.input.charCodeAt($.position),J!==39)return!1;$.kind="scalar",$.result="",$.position++,Y=X=$.position;while((J=$.input.charCodeAt($.position))!==0)if(J===39)if(EZ($,Y,$.position,!0),J=$.input.charCodeAt(++$.position),J===39)Y=$.position,$.position++,X=$.position;else return!0;else if(L6(J))EZ($,Y,X,!0),OU($,U$($,!1,Z)),Y=X=$.position;else if($.position===$.lineStart&&o9($))f0($,"unexpected end of the document within a single quoted scalar");else $.position++,X=$.position;f0($,"unexpected end of the stream within a single quoted scalar")}function Io($,Z){var J,Y,X,Q,G,W;if(W=$.input.charCodeAt($.position),W!==34)return!1;$.kind="scalar",$.result="",$.position++,J=Y=$.position;while((W=$.input.charCodeAt($.position))!==0)if(W===34)return EZ($,J,$.position,!0),$.position++,!0;else if(W===92){if(EZ($,J,$.position,!0),W=$.input.charCodeAt(++$.position),L6(W))U$($,!1,Z);else if(W<256&&sM[W])$.result+=rM[W],$.position++;else if((G=Do(W))>0){X=G,Q=0;for(;X>0;X--)if(W=$.input.charCodeAt(++$.position),(G=Mo(W))>=0)Q=(Q<<4)+G;else f0($,"expected hexadecimal character");$.result+=Lo(Q),$.position++}else f0($,"unknown escape sequence");J=Y=$.position}else if(L6(W))EZ($,J,Y,!0),OU($,U$($,!1,Z)),J=Y=$.position;else if($.position===$.lineStart&&o9($))f0($,"unexpected end of the document within a double quoted scalar");else $.position++,Y=$.position;f0($,"unexpected end of the stream within a double quoted scalar")}function Co($,Z){var J=!0,Y,X=$.tag,Q,G=$.anchor,W,K,V,U,H,B={},z,F,A,j;if(j=$.input.charCodeAt($.position),j===91)K=93,H=!1,Q=[];else if(j===123)K=125,H=!0,Q={};else return!1;if($.anchor!==null)$.anchorMap[$.anchor]=Q;j=$.input.charCodeAt(++$.position);while(j!==0){if(U$($,!0,Z),j=$.input.charCodeAt($.position),j===K)return $.position++,$.tag=X,$.anchor=G,$.kind=H?"mapping":"sequence",$.result=Q,!0;else if(!J)f0($,"missed comma between flow collection entries");if(F=z=A=null,V=U=!1,j===63){if(W=$.input.charCodeAt($.position+1),Y8(W))V=U=!0,$.position++,U$($,!0,Z)}if(Y=$.line,ZJ($,Z,c9,!1,!0),F=$.tag,z=$.result,U$($,!0,Z),j=$.input.charCodeAt($.position),(U||$.line===Y)&&j===58)V=!0,j=$.input.charCodeAt(++$.position),U$($,!0,Z),ZJ($,Z,c9,!1,!0),A=$.result;if(H)$J($,Q,B,F,z,A);else if(V)Q.push($J($,null,B,F,z,A));else Q.push(z);if(U$($,!0,Z),j=$.input.charCodeAt($.position),j===44)J=!0,j=$.input.charCodeAt(++$.position);else J=!1}f0($,"unexpected end of the stream within a flow collection")}function Eo($,Z){var J,Y,X=FU,Q=!1,G=!1,W=Z,K=0,V=!1,U,H;if(H=$.input.charCodeAt($.position),H===124)Y=!1;else if(H===62)Y=!0;else return!1;$.kind="scalar",$.result="";while(H!==0)if(H=$.input.charCodeAt(++$.position),H===43||H===45)if(FU===X)X=H===43?yM:Oo;else f0($,"repeat of a chomping mode identifier");else if((U=wo(H))>=0)if(U===0)f0($,"bad explicit indentation width of a block scalar; it cannot be less than one");else if(!G)W=Z+U-1,G=!0;else f0($,"repeat of an indentation width identifier");else break;if(L5(H)){do H=$.input.charCodeAt(++$.position);while(L5(H));if(H===35)do H=$.input.charCodeAt(++$.position);while(!L6(H)&&H!==0)}while(H!==0){AU($),$.lineIndent=0,H=$.input.charCodeAt($.position);while((!G||$.lineIndent<W)&&H===32)$.lineIndent++,H=$.input.charCodeAt(++$.position);if(!G&&$.lineIndent>W)W=$.lineIndent;if(L6(H)){K++;continue}if($.lineIndent<W){if(X===yM)$.result+=d6.repeat(`
|
|
50
|
+
`,Q?1+K:K);else if(X===FU){if(Q)$.result+=`
|
|
51
|
+
`}break}if(Y)if(L5(H))V=!0,$.result+=d6.repeat(`
|
|
52
|
+
`,Q?1+K:K);else if(V)V=!1,$.result+=d6.repeat(`
|
|
53
|
+
`,K+1);else if(K===0){if(Q)$.result+=" "}else $.result+=d6.repeat(`
|
|
54
|
+
`,K);else $.result+=d6.repeat(`
|
|
55
|
+
`,Q?1+K:K);Q=!0,G=!0,K=0,J=$.position;while(!L6(H)&&H!==0)H=$.input.charCodeAt(++$.position);EZ($,J,$.position,!1)}return!0}function mM($,Z){var J,Y=$.tag,X=$.anchor,Q=[],G,W=!1,K;if($.anchor!==null)$.anchorMap[$.anchor]=Q;K=$.input.charCodeAt($.position);while(K!==0){if(K!==45)break;if(G=$.input.charCodeAt($.position+1),!Y8(G))break;if(W=!0,$.position++,U$($,!0,-1)){if($.lineIndent<=Z){Q.push(null),K=$.input.charCodeAt($.position);continue}}if(J=$.line,ZJ($,Z,cM,!1,!0),Q.push($.result),U$($,!0,-1),K=$.input.charCodeAt($.position),($.line===J||$.lineIndent>Z)&&K!==0)f0($,"bad indentation of a sequence entry");else if($.lineIndent<Z)break}if(W)return $.tag=Y,$.anchor=X,$.kind="sequence",$.result=Q,!0;return!1}function bo($,Z,J){var Y,X,Q,G,W=$.tag,K=$.anchor,V={},U={},H=null,B=null,z=null,F=!1,A=!1,j;if($.anchor!==null)$.anchorMap[$.anchor]=V;j=$.input.charCodeAt($.position);while(j!==0){if(Y=$.input.charCodeAt($.position+1),Q=$.line,G=$.position,(j===63||j===58)&&Y8(Y)){if(j===63){if(F)$J($,V,U,H,B,null),H=B=z=null;A=!0,F=!0,X=!0}else if(F)F=!1,X=!0;else f0($,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");$.position+=1,j=Y}else if(ZJ($,J,pM,!1,!0))if($.line===Q){j=$.input.charCodeAt($.position);while(L5(j))j=$.input.charCodeAt(++$.position);if(j===58){if(j=$.input.charCodeAt(++$.position),!Y8(j))f0($,"a whitespace character is expected after the key-value separator within a block mapping");if(F)$J($,V,U,H,B,null),H=B=z=null;A=!0,F=!1,X=!1,H=$.tag,B=$.result}else if(A)f0($,"can not read an implicit mapping pair; a colon is missed");else return $.tag=W,$.anchor=K,!0}else if(A)f0($,"can not read a block mapping entry; a multiline key may not be an implicit key");else return $.tag=W,$.anchor=K,!0;else break;if($.line===Q||$.lineIndent>Z){if(ZJ($,Z,i9,!0,X))if(F)B=$.result;else z=$.result;if(!F)$J($,V,U,H,B,z,Q,G),H=B=z=null;U$($,!0,-1),j=$.input.charCodeAt($.position)}if($.lineIndent>Z&&j!==0)f0($,"bad indentation of a mapping entry");else if($.lineIndent<Z)break}if(F)$J($,V,U,H,B,null);if(A)$.tag=W,$.anchor=K,$.kind="mapping",$.result=V;return A}function _o($){var Z,J=!1,Y=!1,X,Q,G;if(G=$.input.charCodeAt($.position),G!==33)return!1;if($.tag!==null)f0($,"duplication of a tag property");if(G=$.input.charCodeAt(++$.position),G===60)J=!0,G=$.input.charCodeAt(++$.position);else if(G===33)Y=!0,X="!!",G=$.input.charCodeAt(++$.position);else X="!";if(Z=$.position,J){do G=$.input.charCodeAt(++$.position);while(G!==0&&G!==62);if($.position<$.length)Q=$.input.slice(Z,$.position),G=$.input.charCodeAt(++$.position);else f0($,"unexpected end of the stream within a verbatim tag")}else{while(G!==0&&!Y8(G)){if(G===33)if(!Y){if(X=$.input.slice(Z-1,$.position+1),!iM.test(X))f0($,"named tag handle cannot contain such characters");Y=!0,Z=$.position+1}else f0($,"tag suffix cannot contain exclamation marks");G=$.input.charCodeAt(++$.position)}if(Q=$.input.slice(Z,$.position),No.test(Q))f0($,"tag suffix cannot contain flow indicator characters")}if(Q&&!nM.test(Q))f0($,"tag name cannot contain such characters: "+Q);if(J)$.tag=Q;else if(bZ.call($.tagMap,X))$.tag=$.tagMap[X]+Q;else if(X==="!")$.tag="!"+Q;else if(X==="!!")$.tag="tag:yaml.org,2002:"+Q;else f0($,'undeclared tag handle "'+X+'"');return!0}function So($){var Z,J;if(J=$.input.charCodeAt($.position),J!==38)return!1;if($.anchor!==null)f0($,"duplication of an anchor property");J=$.input.charCodeAt(++$.position),Z=$.position;while(J!==0&&!Y8(J)&&!e7(J))J=$.input.charCodeAt(++$.position);if($.position===Z)f0($,"name of an anchor node must contain at least one character");return $.anchor=$.input.slice(Z,$.position),!0}function fo($){var Z,J,Y;if(Y=$.input.charCodeAt($.position),Y!==42)return!1;Y=$.input.charCodeAt(++$.position),Z=$.position;while(Y!==0&&!Y8(Y)&&!e7(Y))Y=$.input.charCodeAt(++$.position);if($.position===Z)f0($,"name of an alias node must contain at least one character");if(J=$.input.slice(Z,$.position),!bZ.call($.anchorMap,J))f0($,'unidentified alias "'+J+'"');return $.result=$.anchorMap[J],U$($,!0,-1),!0}function ZJ($,Z,J,Y,X){var Q,G,W,K=1,V=!1,U=!1,H,B,z,F,A;if($.listener!==null)$.listener("open",$);if($.tag=null,$.anchor=null,$.kind=null,$.result=null,Q=G=W=i9===J||cM===J,Y){if(U$($,!0,-1)){if(V=!0,$.lineIndent>Z)K=1;else if($.lineIndent===Z)K=0;else if($.lineIndent<Z)K=-1}}if(K===1)while(_o($)||So($))if(U$($,!0,-1)){if(V=!0,W=Q,$.lineIndent>Z)K=1;else if($.lineIndent===Z)K=0;else if($.lineIndent<Z)K=-1}else W=!1;if(W)W=V||X;if(K===1||i9===J){if(c9===J||pM===J)F=Z;else F=Z+1;if(A=$.position-$.lineStart,K===1)if(W&&(mM($,A)||bo($,A,F))||Co($,F))U=!0;else{if(G&&Eo($,F)||Po($,F)||Io($,F))U=!0;else if(fo($)){if(U=!0,$.tag!==null||$.anchor!==null)f0($,"alias node should not have any properties")}else if(Ro($,F,c9===J)){if(U=!0,$.tag===null)$.tag="?"}if($.anchor!==null)$.anchorMap[$.anchor]=$.result}else if(K===0)U=W&&mM($,A)}if($.tag!==null&&$.tag!=="!")if($.tag==="?"){if($.result!==null&&$.kind!=="scalar")f0($,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+$.kind+'"');for(H=0,B=$.implicitTypes.length;H<B;H+=1)if(z=$.implicitTypes[H],z.resolve($.result)){if($.result=z.construct($.result),$.tag=z.tag,$.anchor!==null)$.anchorMap[$.anchor]=$.result;break}}else if(bZ.call($.typeMap[$.kind||"fallback"],$.tag)){if(z=$.typeMap[$.kind||"fallback"][$.tag],$.result!==null&&z.kind!==$.kind)f0($,"unacceptable node kind for !<"+$.tag+'> tag; it should be "'+z.kind+'", not "'+$.kind+'"');if(!z.resolve($.result))f0($,"cannot resolve a node with !<"+$.tag+"> explicit tag");else if($.result=z.construct($.result),$.anchor!==null)$.anchorMap[$.anchor]=$.result}else f0($,"unknown tag !<"+$.tag+">");if($.listener!==null)$.listener("close",$);return $.tag!==null||$.anchor!==null||U}function ko($){var Z=$.position,J,Y,X,Q=!1,G;$.version=null,$.checkLineBreaks=$.legacy,$.tagMap={},$.anchorMap={};while((G=$.input.charCodeAt($.position))!==0){if(U$($,!0,-1),G=$.input.charCodeAt($.position),$.lineIndent>0||G!==37)break;Q=!0,G=$.input.charCodeAt(++$.position),J=$.position;while(G!==0&&!Y8(G))G=$.input.charCodeAt(++$.position);if(Y=$.input.slice(J,$.position),X=[],Y.length<1)f0($,"directive name must not be less than one character in length");while(G!==0){while(L5(G))G=$.input.charCodeAt(++$.position);if(G===35){do G=$.input.charCodeAt(++$.position);while(G!==0&&!L6(G));break}if(L6(G))break;J=$.position;while(G!==0&&!Y8(G))G=$.input.charCodeAt(++$.position);X.push($.input.slice(J,$.position))}if(G!==0)AU($);if(bZ.call(gM,Y))gM[Y]($,Y,X);else n9($,'unknown document directive "'+Y+'"')}if(U$($,!0,-1),$.lineIndent===0&&$.input.charCodeAt($.position)===45&&$.input.charCodeAt($.position+1)===45&&$.input.charCodeAt($.position+2)===45)$.position+=3,U$($,!0,-1);else if(Q)f0($,"directives end mark is expected");if(ZJ($,$.lineIndent-1,i9,!1,!0),U$($,!0,-1),$.checkLineBreaks&&jo.test($.input.slice(Z,$.position)))n9($,"non-ASCII line breaks are interpreted as content");if($.documents.push($.result),$.position===$.lineStart&&o9($)){if($.input.charCodeAt($.position)===46)$.position+=3,U$($,!0,-1);return}if($.position<$.length-1)f0($,"end of the stream or a document separator is expected");else return}function tM($,Z){if($=String($),Z=Z||{},$.length!==0){if($.charCodeAt($.length-1)!==10&&$.charCodeAt($.length-1)!==13)$+=`
|
|
56
|
+
`;if($.charCodeAt(0)===65279)$=$.slice(1)}var J=new To($,Z),Y=$.indexOf("\x00");if(Y!==-1)J.position=Y,f0(J,"null byte is not allowed in input");J.input+="\x00";while(J.input.charCodeAt(J.position)===32)J.lineIndent+=1,J.position+=1;while(J.position<J.length-1)ko(J);return J.documents}function eM($,Z,J){if(Z!==null&&typeof Z==="object"&&typeof J>"u")J=Z,Z=null;var Y=tM($,J);if(typeof Z!=="function")return Y;for(var X=0,Q=Y.length;X<Q;X+=1)Z(Y[X])}function $D($,Z){var J=tM($,Z);if(J.length===0)return;else if(J.length===1)return J[0];throw new lM("expected a single document in the stream, but found more")}function vo($,Z,J){if(typeof Z==="object"&&Z!==null&&typeof J>"u")J=Z,Z=null;return eM($,Z,d6.extend({schema:dM},J))}function yo($,Z){return $D($,d6.extend({schema:dM},Z))}xo.loadAll=eM;xo.load=$D;xo.safeLoadAll=vo;xo.safeLoad=yo});var TD=S((Ls,MU)=>{var rY=M5(),aY=r7(),lo=nY(),po=t7(),VD=Object.prototype.toString,UD=Object.prototype.hasOwnProperty,co=9,sY=10,io=13,no=32,oo=33,so=34,HD=35,ro=37,ao=38,to=39,eo=42,BD=44,$s=45,zD=58,Zs=61,Js=62,Ys=63,Xs=64,FD=91,AD=93,Qs=96,OD=123,Gs=124,qD=125,u$={};u$[0]="\\0";u$[7]="\\a";u$[8]="\\b";u$[9]="\\t";u$[10]="\\n";u$[11]="\\v";u$[12]="\\f";u$[13]="\\r";u$[27]="\\e";u$[34]="\\\"";u$[92]="\\\\";u$[133]="\\N";u$[160]="\\_";u$[8232]="\\L";u$[8233]="\\P";var Ws=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function Ks($,Z){var J,Y,X,Q,G,W,K;if(Z===null)return{};J={},Y=Object.keys(Z);for(X=0,Q=Y.length;X<Q;X+=1){if(G=Y[X],W=String(Z[G]),G.slice(0,2)==="!!")G="tag:yaml.org,2002:"+G.slice(2);if(K=$.compiledTypeMap.fallback[G],K&&UD.call(K.styleAliases,W))W=K.styleAliases[W];J[G]=W}return J}function JD($){var Z,J,Y;if(Z=$.toString(16).toUpperCase(),$<=255)J="x",Y=2;else if($<=65535)J="u",Y=4;else if($<=4294967295)J="U",Y=8;else throw new aY("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+J+rY.repeat("0",Y-Z.length)+Z}function Vs($){this.schema=$.schema||lo,this.indent=Math.max(1,$.indent||2),this.noArrayIndent=$.noArrayIndent||!1,this.skipInvalid=$.skipInvalid||!1,this.flowLevel=rY.isNothing($.flowLevel)?-1:$.flowLevel,this.styleMap=Ks(this.schema,$.styles||null),this.sortKeys=$.sortKeys||!1,this.lineWidth=$.lineWidth||80,this.noRefs=$.noRefs||!1,this.noCompatMode=$.noCompatMode||!1,this.condenseFlow=$.condenseFlow||!1,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function YD($,Z){var J=rY.repeat(" ",Z),Y=0,X=-1,Q="",G,W=$.length;while(Y<W){if(X=$.indexOf(`
|
|
57
|
+
`,Y),X===-1)G=$.slice(Y),Y=W;else G=$.slice(Y,X+1),Y=X+1;if(G.length&&G!==`
|
|
58
|
+
`)Q+=J;Q+=G}return Q}function qU($,Z){return`
|
|
59
|
+
`+rY.repeat(" ",$.indent*Z)}function Us($,Z){var J,Y,X;for(J=0,Y=$.implicitTypes.length;J<Y;J+=1)if(X=$.implicitTypes[J],X.resolve(Z))return!0;return!1}function NU($){return $===no||$===co}function JJ($){return 32<=$&&$<=126||161<=$&&$<=55295&&$!==8232&&$!==8233||57344<=$&&$<=65533&&$!==65279||65536<=$&&$<=1114111}function Hs($){return JJ($)&&!NU($)&&$!==65279&&$!==io&&$!==sY}function XD($,Z){return JJ($)&&$!==65279&&$!==BD&&$!==FD&&$!==AD&&$!==OD&&$!==qD&&$!==zD&&($!==HD||Z&&Hs(Z))}function Bs($){return JJ($)&&$!==65279&&!NU($)&&$!==$s&&$!==Ys&&$!==zD&&$!==BD&&$!==FD&&$!==AD&&$!==OD&&$!==qD&&$!==HD&&$!==ao&&$!==eo&&$!==oo&&$!==Gs&&$!==Zs&&$!==Js&&$!==to&&$!==so&&$!==ro&&$!==Xs&&$!==Qs}function jD($){var Z=/^\n* /;return Z.test($)}var ND=1,MD=2,DD=3,wD=4,s9=5;function zs($,Z,J,Y,X){var Q,G,W,K=!1,V=!1,U=Y!==-1,H=-1,B=Bs($.charCodeAt(0))&&!NU($.charCodeAt($.length-1));if(Z)for(Q=0;Q<$.length;Q++){if(G=$.charCodeAt(Q),!JJ(G))return s9;W=Q>0?$.charCodeAt(Q-1):null,B=B&&XD(G,W)}else{for(Q=0;Q<$.length;Q++){if(G=$.charCodeAt(Q),G===sY){if(K=!0,U)V=V||Q-H-1>Y&&$[H+1]!==" ",H=Q}else if(!JJ(G))return s9;W=Q>0?$.charCodeAt(Q-1):null,B=B&&XD(G,W)}V=V||U&&(Q-H-1>Y&&$[H+1]!==" ")}if(!K&&!V)return B&&!X($)?ND:MD;if(J>9&&jD($))return s9;return V?wD:DD}function Fs($,Z,J,Y){$.dump=function(){if(Z.length===0)return"''";if(!$.noCompatMode&&Ws.indexOf(Z)!==-1)return"'"+Z+"'";var X=$.indent*Math.max(1,J),Q=$.lineWidth===-1?-1:Math.max(Math.min($.lineWidth,40),$.lineWidth-X),G=Y||$.flowLevel>-1&&J>=$.flowLevel;function W(K){return Us($,K)}switch(zs(Z,G,$.indent,Q,W)){case ND:return Z;case MD:return"'"+Z.replace(/'/g,"''")+"'";case DD:return"|"+QD(Z,$.indent)+GD(YD(Z,X));case wD:return">"+QD(Z,$.indent)+GD(YD(As(Z,Q),X));case s9:return'"'+Os(Z,Q)+'"';default:throw new aY("impossible error: invalid scalar style")}}()}function QD($,Z){var J=jD($)?String(Z):"",Y=$[$.length-1]===`
|
|
60
|
+
`,X=Y&&($[$.length-2]===`
|
|
61
|
+
`||$===`
|
|
62
|
+
`),Q=X?"+":Y?"":"-";return J+Q+`
|
|
63
|
+
`}function GD($){return $[$.length-1]===`
|
|
64
|
+
`?$.slice(0,-1):$}function As($,Z){var J=/(\n+)([^\n]*)/g,Y=function(){var V=$.indexOf(`
|
|
65
|
+
`);return V=V!==-1?V:$.length,J.lastIndex=V,WD($.slice(0,V),Z)}(),X=$[0]===`
|
|
66
|
+
`||$[0]===" ",Q,G;while(G=J.exec($)){var W=G[1],K=G[2];Q=K[0]===" ",Y+=W+(!X&&!Q&&K!==""?`
|
|
67
|
+
`:"")+WD(K,Z),X=Q}return Y}function WD($,Z){if($===""||$[0]===" ")return $;var J=/ [^ ]/g,Y,X=0,Q,G=0,W=0,K="";while(Y=J.exec($)){if(W=Y.index,W-X>Z)Q=G>X?G:W,K+=`
|
|
68
|
+
`+$.slice(X,Q),X=Q+1;G=W}if(K+=`
|
|
69
|
+
`,$.length-X>Z&&G>X)K+=$.slice(X,G)+`
|
|
70
|
+
`+$.slice(G+1);else K+=$.slice(X);return K.slice(1)}function Os($){var Z="",J,Y,X;for(var Q=0;Q<$.length;Q++){if(J=$.charCodeAt(Q),J>=55296&&J<=56319){if(Y=$.charCodeAt(Q+1),Y>=56320&&Y<=57343){Z+=JD((J-55296)*1024+Y-56320+65536),Q++;continue}}X=u$[J],Z+=!X&&JJ(J)?$[Q]:X||JD(J)}return Z}function qs($,Z,J){var Y="",X=$.tag,Q,G;for(Q=0,G=J.length;Q<G;Q+=1)if(T5($,Z,J[Q],!1,!1)){if(Q!==0)Y+=","+(!$.condenseFlow?" ":"");Y+=$.dump}$.tag=X,$.dump="["+Y+"]"}function js($,Z,J,Y){var X="",Q=$.tag,G,W;for(G=0,W=J.length;G<W;G+=1)if(T5($,Z+1,J[G],!0,!0)){if(!Y||G!==0)X+=qU($,Z);if($.dump&&sY===$.dump.charCodeAt(0))X+="-";else X+="- ";X+=$.dump}$.tag=Q,$.dump=X||"[]"}function Ns($,Z,J){var Y="",X=$.tag,Q=Object.keys(J),G,W,K,V,U;for(G=0,W=Q.length;G<W;G+=1){if(U="",G!==0)U+=", ";if($.condenseFlow)U+='"';if(K=Q[G],V=J[K],!T5($,Z,K,!1,!1))continue;if($.dump.length>1024)U+="? ";if(U+=$.dump+($.condenseFlow?'"':"")+":"+($.condenseFlow?"":" "),!T5($,Z,V,!1,!1))continue;U+=$.dump,Y+=U}$.tag=X,$.dump="{"+Y+"}"}function Ms($,Z,J,Y){var X="",Q=$.tag,G=Object.keys(J),W,K,V,U,H,B;if($.sortKeys===!0)G.sort();else if(typeof $.sortKeys==="function")G.sort($.sortKeys);else if($.sortKeys)throw new aY("sortKeys must be a boolean or a function");for(W=0,K=G.length;W<K;W+=1){if(B="",!Y||W!==0)B+=qU($,Z);if(V=G[W],U=J[V],!T5($,Z+1,V,!0,!0,!0))continue;if(H=$.tag!==null&&$.tag!=="?"||$.dump&&$.dump.length>1024,H)if($.dump&&sY===$.dump.charCodeAt(0))B+="?";else B+="? ";if(B+=$.dump,H)B+=qU($,Z);if(!T5($,Z+1,U,!0,H))continue;if($.dump&&sY===$.dump.charCodeAt(0))B+=":";else B+=": ";B+=$.dump,X+=B}$.tag=Q,$.dump=X||"{}"}function KD($,Z,J){var Y,X,Q,G,W,K;X=J?$.explicitTypes:$.implicitTypes;for(Q=0,G=X.length;Q<G;Q+=1)if(W=X[Q],(W.instanceOf||W.predicate)&&(!W.instanceOf||typeof Z==="object"&&Z instanceof W.instanceOf)&&(!W.predicate||W.predicate(Z))){if($.tag=J?W.tag:"?",W.represent){if(K=$.styleMap[W.tag]||W.defaultStyle,VD.call(W.represent)==="[object Function]")Y=W.represent(Z,K);else if(UD.call(W.represent,K))Y=W.represent[K](Z,K);else throw new aY("!<"+W.tag+'> tag resolver accepts not "'+K+'" style');$.dump=Y}return!0}return!1}function T5($,Z,J,Y,X,Q){if($.tag=null,$.dump=J,!KD($,J,!1))KD($,J,!0);var G=VD.call($.dump);if(Y)Y=$.flowLevel<0||$.flowLevel>Z;var W=G==="[object Object]"||G==="[object Array]",K,V;if(W)K=$.duplicates.indexOf(J),V=K!==-1;if($.tag!==null&&$.tag!=="?"||V||$.indent!==2&&Z>0)X=!1;if(V&&$.usedDuplicates[K])$.dump="*ref_"+K;else{if(W&&V&&!$.usedDuplicates[K])$.usedDuplicates[K]=!0;if(G==="[object Object]"){if(Y&&Object.keys($.dump).length!==0){if(Ms($,Z,$.dump,X),V)$.dump="&ref_"+K+$.dump}else if(Ns($,Z,$.dump),V)$.dump="&ref_"+K+" "+$.dump}else if(G==="[object Array]"){var U=$.noArrayIndent&&Z>0?Z-1:Z;if(Y&&$.dump.length!==0){if(js($,U,$.dump,X),V)$.dump="&ref_"+K+$.dump}else if(qs($,U,$.dump),V)$.dump="&ref_"+K+" "+$.dump}else if(G==="[object String]"){if($.tag!=="?")Fs($,$.dump,Z,Q)}else{if($.skipInvalid)return!1;throw new aY("unacceptable kind of an object to dump "+G)}if($.tag!==null&&$.tag!=="?")$.dump="!<"+$.tag+"> "+$.dump}return!0}function Ds($,Z){var J=[],Y=[],X,Q;jU($,J,Y);for(X=0,Q=Y.length;X<Q;X+=1)Z.duplicates.push(J[Y[X]]);Z.usedDuplicates=Array(Q)}function jU($,Z,J){var Y,X,Q;if($!==null&&typeof $==="object")if(X=Z.indexOf($),X!==-1){if(J.indexOf(X)===-1)J.push(X)}else if(Z.push($),Array.isArray($))for(X=0,Q=$.length;X<Q;X+=1)jU($[X],Z,J);else{Y=Object.keys($);for(X=0,Q=Y.length;X<Q;X+=1)jU($[Y[X]],Z,J)}}function LD($,Z){Z=Z||{};var J=new Vs(Z);if(!J.noRefs)Ds($,J);if(T5(J,0,$,!0,!0))return J.dump+`
|
|
71
|
+
`;return""}function ws($,Z){return LD($,rY.extend({schema:po},Z))}Ls.dump=LD;Ls.safeDump=ws});var PD=S((Ps,Z$)=>{var r9=ZD(),RD=TD();function a9($){return function(){throw Error("Function "+$+" is deprecated and cannot be used.")}}Ps.Type=A$();Ps.Schema=D5();Ps.FAILSAFE_SCHEMA=d9();Ps.JSON_SCHEMA=VU();Ps.CORE_SCHEMA=UU();Ps.DEFAULT_SAFE_SCHEMA=t7();Ps.DEFAULT_FULL_SCHEMA=nY();Ps.load=r9.load;Ps.loadAll=r9.loadAll;Ps.safeLoad=r9.safeLoad;Ps.safeLoadAll=r9.safeLoadAll;Ps.dump=RD.dump;Ps.safeDump=RD.safeDump;Ps.YAMLException=r7();Ps.MINIMAL_SCHEMA=d9();Ps.SAFE_SCHEMA=t7();Ps.DEFAULT_SCHEMA=nY();Ps.scan=a9("scan");Ps.parse=a9("parse");Ps.compose=a9("compose");Ps.addConstructor=a9("addConstructor")});var CD=S((MR0,ID)=>{var os=PD();ID.exports=os});var TU=S((wU,LU)=>{var t9=CD(),DU=wU=LU.exports;DU.yaml={parse:t9.safeLoad.bind(t9),stringify:t9.safeDump.bind(t9)};DU.json={parse:JSON.parse.bind(JSON),stringify:function($,Z){let J=Object.assign({replacer:null,space:2},Z);return JSON.stringify($,J.replacer,J.space)}};DU.javascript={parse:function parse(str,options,wrap){try{if(wrap!==!1)str=`(function() {
|
|
72
|
+
return `+str.trim()+`;
|
|
73
|
+
}());`;return eval(str)||{}}catch($){if(wrap!==!1&&/(unexpected|identifier)/i.test($.message))return parse(str,options,!1);throw SyntaxError($)}},stringify:function(){throw Error("stringifying JavaScript is not supported")}}});var bD=S((DR0,ED)=>{/*!
|
|
74
|
+
* strip-bom-string <https://github.com/jonschlinkert/strip-bom-string>
|
|
75
|
+
*
|
|
76
|
+
* Copyright (c) 2015, 2017, Jon Schlinkert.
|
|
77
|
+
* Released under the MIT License.
|
|
78
|
+
*/ED.exports=function($){if(typeof $==="string"&&$.charAt(0)==="\uFEFF")return $.slice(1);return $}});var e9=S((ss)=>{var _D=bD(),SD=cY();ss.define=function($,Z,J){Reflect.defineProperty($,Z,{enumerable:!1,configurable:!0,writable:!0,value:J})};ss.isBuffer=function($){return SD($)==="buffer"};ss.isObject=function($){return SD($)==="object"};ss.toBuffer=function($){return typeof $==="string"?Buffer.from($):$};ss.toString=function($){if(ss.isBuffer($))return _D(String($));if(typeof $!=="string")throw TypeError("expected input to be a string or buffer");return _D($)};ss.arrayify=function($){return $?Array.isArray($)?$:[$]:[]};ss.startsWith=function($,Z,J){if(typeof J!=="number")J=Z.length;return $.slice(0,J)===Z}});var tY=S((LR0,kD)=>{var Jr=TU(),Yr=e9();kD.exports=function($){let Z=Object.assign({},$);if(Z.delimiters=Yr.arrayify(Z.delims||Z.delimiters||"---"),Z.delimiters.length===1)Z.delimiters.push(Z.delimiters[0]);return Z.language=(Z.language||Z.lang||"yaml").toLowerCase(),Z.engines=Object.assign({},Jr,Z.parsers,Z.engines),Z}});var RU=S((TR0,vD)=>{vD.exports=function($,Z){let J=Z.engines[$]||Z.engines[Xr($)];if(typeof J>"u")throw Error('gray-matter engine "'+$+'" is not registered');if(typeof J==="function")J={parse:J};return J};function Xr($){switch($.toLowerCase()){case"js":case"javascript":return"javascript";case"coffee":case"coffeescript":case"cson":return"coffee";case"yaml":case"yml":return"yaml";default:return $}}});var PU=S((RR0,yD)=>{var Qr=cY(),Gr=RU(),Wr=tY();yD.exports=function($,Z,J){if(Z==null&&J==null)switch(Qr($)){case"object":Z=$.data,J={};break;case"string":return $;default:throw TypeError("expected file to be a string or object")}let Y=$.content,X=Wr(J);if(Z==null){if(!X.data)return $;Z=X.data}let Q=$.language||X.language,G=Gr(Q,X);if(typeof G.stringify!=="function")throw TypeError('expected "'+Q+'.stringify" to be a function');Z=Object.assign({},$.data,Z);let W=X.delimiters[0],K=X.delimiters[1],V=G.stringify(Z,J).trim(),U="";if(V!=="{}")U=YJ(W)+YJ(V)+YJ(K);if(typeof $.excerpt==="string"&&$.excerpt!==""){if(Y.indexOf($.excerpt.trim())===-1)U+=YJ($.excerpt)+YJ(K)}return U+YJ(Y)};function YJ($){return $.slice(-1)!==`
|
|
79
|
+
`?$+`
|
|
80
|
+
`:$}});var hD=S((PR0,xD)=>{var Kr=tY();xD.exports=function($,Z){let J=Kr(Z);if($.data==null)$.data={};if(typeof J.excerpt==="function")return J.excerpt($,J);let Y=$.data.excerpt_separator||J.excerpt_separator;if(Y==null&&(J.excerpt===!1||J.excerpt==null))return $;let X=typeof J.excerpt==="string"?J.excerpt:Y||J.delimiters[0],Q=$.content.indexOf(X);if(Q!==-1)$.excerpt=$.content.slice(0,Q);return $}});var mD=S((IR0,uD)=>{var gD=cY(),Vr=PU(),XJ=e9();uD.exports=function($){if(gD($)!=="object")$={content:$};if(gD($.data)!=="object")$.data={};if($.contents&&$.content==null)$.content=$.contents;return XJ.define($,"orig",XJ.toBuffer($.content)),XJ.define($,"language",$.language||""),XJ.define($,"matter",$.matter||""),XJ.define($,"stringify",function(Z,J){if(J&&J.language)$.language=J.language;return Vr($,Z,J)}),$.content=XJ.toString($.content),$.isEmpty=!1,$.excerpt="",$}});var dD=S((CR0,lD)=>{var Ur=RU(),Hr=tY();lD.exports=function($,Z,J){let Y=Hr(J),X=Ur($,Y);if(typeof X.parse!=="function")throw TypeError('expected "'+$+'.parse" to be a function');return X.parse(Z,Y)}});var nD=S((ER0,iD)=>{var Br=Y0("fs"),zr=gN(),IU=tY(),Fr=PU(),pD=hD(),Ar=TU(),Or=mD(),qr=dD(),cD=e9();function o$($,Z){if($==="")return{data:{},content:$,excerpt:"",orig:$};let J=Or($),Y=o$.cache[J.content];if(!Z){if(Y)return J=Object.assign({},Y),J.orig=Y.orig,J;o$.cache[J.content]=J}return jr(J,Z)}function jr($,Z){let J=IU(Z),Y=J.delimiters[0],X=`
|
|
81
|
+
`+J.delimiters[1],Q=$.content;if(J.language)$.language=J.language;let G=Y.length;if(!cD.startsWith(Q,Y,G))return pD($,J),$;if(Q.charAt(G)===Y.slice(-1))return $;Q=Q.slice(G);let W=Q.length,K=o$.language(Q,J);if(K.name)$.language=K.name,Q=Q.slice(K.raw.length);let V=Q.indexOf(X);if(V===-1)V=W;if($.matter=Q.slice(0,V),$.matter.replace(/^\s*#[^\n]+/gm,"").trim()==="")$.isEmpty=!0,$.empty=$.content,$.data={};else $.data=qr($.language,$.matter,J);if(V===W)$.content="";else{if($.content=Q.slice(V+X.length),$.content[0]==="\r")$.content=$.content.slice(1);if($.content[0]===`
|
|
82
|
+
`)$.content=$.content.slice(1)}if(pD($,J),J.sections===!0||typeof J.section==="function")zr($,J.section);return $}o$.engines=Ar;o$.stringify=function($,Z,J){if(typeof $==="string")$=o$($,J);return Fr($,Z,J)};o$.read=function($,Z){let J=Br.readFileSync($,"utf8"),Y=o$(J,Z);return Y.path=$,Y};o$.test=function($,Z){return cD.startsWith($,IU(Z).delimiters[0])};o$.language=function($,Z){let Y=IU(Z).delimiters[0];if(o$.test($))$=$.slice(Y.length);let X=$.slice(0,$.search(/\r?\n/));return{raw:X,name:X?X.trim():""}};o$.cache={};o$.clearCache=function(){o$.cache={}};iD.exports=o$});var e2=S((Vf0,t2)=>{function P00($){var Z=new $,J=Z;function Y(){var Q=Z;if(Q.next)Z=Q.next;else Z=new $,J=Z;return Q.next=null,Q}function X(Q){J.next=Q,J=Q}return{get:Y,release:X}}t2.exports=P00});var ZR=S((Uf0,SH)=>{var I00=e2();function $R($,Z,J){if(typeof $==="function")J=Z,Z=$,$=null;if(!(J>=1))throw Error("fastqueue concurrency must be equal to or greater than 1");var Y=I00(C00),X=null,Q=null,G=0,W=null,K={push:A,drain:W8,saturated:W8,pause:U,paused:!1,get concurrency(){return J},set concurrency(R){if(!(R>=1))throw Error("fastqueue concurrency must be equal to or greater than 1");if(J=R,K.paused)return;for(;X&&G<J;)G++,N()},running:V,resume:z,idle:F,length:H,getQueue:B,unshift:j,empty:W8,kill:w,killAndDrain:q,error:C,abort:M};return K;function V(){return G}function U(){K.paused=!0}function H(){var R=X,T=0;while(R)R=R.next,T++;return T}function B(){var R=X,T=[];while(R)T.push(R.value),R=R.next;return T}function z(){if(!K.paused)return;if(K.paused=!1,X===null){G++,N();return}for(;X&&G<J;)G++,N()}function F(){return G===0&&K.length()===0}function A(R,T){var I=Y.get();if(I.context=$,I.release=N,I.value=R,I.callback=T||W8,I.errorHandler=W,G>=J||K.paused)if(Q)Q.next=I,Q=I;else X=I,Q=I,K.saturated();else G++,Z.call($,I.value,I.worked)}function j(R,T){var I=Y.get();if(I.context=$,I.release=N,I.value=R,I.callback=T||W8,I.errorHandler=W,G>=J||K.paused)if(X)I.next=X,X=I;else X=I,Q=I,K.saturated();else G++,Z.call($,I.value,I.worked)}function N(R){if(R)Y.release(R);var T=X;if(T&&G<=J)if(!K.paused){if(Q===X)Q=null;if(X=T.next,T.next=null,Z.call($,T.value,T.worked),Q===null)K.empty()}else G--;else if(--G===0)K.drain()}function w(){X=null,Q=null,K.drain=W8}function q(){X=null,Q=null,K.drain(),K.drain=W8}function M(){var R=X;X=null,Q=null;while(R){var{next:T,callback:I,errorHandler:_,value:E,context:f}=R;if(R.value=null,R.callback=W8,R.errorHandler=null,_)_(Error("abort"),E);I.call(f,Error("abort")),R.release(R),R=T}K.drain=W8}function C(R){W=R}}function W8(){}function C00(){this.value=null,this.callback=W8,this.next=null,this.release=W8,this.context=null,this.errorHandler=null;var $=this;this.worked=function(J,Y){var{callback:X,errorHandler:Q,value:G}=$;if($.value=null,$.callback=W8,$.errorHandler)Q(J,G);X.call($.context,J,Y),$.release($)}}function E00($,Z,J){if(typeof $==="function")J=Z,Z=$,$=null;function Y(U,H){Z.call(this,U).then(function(B){H(null,B)},H)}var X=$R($,Y,J),Q=X.push,G=X.unshift;return X.push=W,X.unshift=K,X.drained=V,X;function W(U){var H=new Promise(function(B,z){Q(U,function(F,A){if(F){z(F);return}B(A)})});return H.catch(W8),H}function K(U){var H=new Promise(function(B,z){G(U,function(F,A){if(F){z(F);return}B(A)})});return H.catch(W8),H}function V(){var U=new Promise(function(H){process.nextTick(function(){if(X.idle())H();else{var B=X.drain;X.drain=function(){if(typeof B==="function")B();H(),X.drain=B}}})});return U}}SH.exports=$R;SH.exports.promise=E00});var fH=S((Hf0,TX)=>{var{format:b00}=Y0("util");function _00(){return`${this.name} [${this.code}]: ${this.message}`}var C4=Symbol.for("fastify-error-generic");function qJ($,Z,J=500,Y=Error,X=qJ.captureStackTrace){let Q=$===C4;if(Q)$="FST_ERR";if(!$)throw Error("Fastify error code must not be empty");if(!Z)throw Error("Fastify error message must not be empty");$=$.toUpperCase(),!J&&(J=void 0);let G=Symbol.for(`fastify-error ${$}`);function W(...K){if(!new.target)return new W(...K);this.code=$,this.name="FastifyError",this.statusCode=J;let V=K.length-1;if(V!==-1&&K[V]&&typeof K[V]==="object"&&"cause"in K[V])this.cause=K.pop().cause;this.message=b00(Z,...K),Error.stackTraceLimit&&X&&Error.captureStackTrace(this,W)}if(W.prototype=Object.create(Y.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0},[C4]:{value:!0,enumerable:!1,writable:!1,configurable:!1},[G]:{value:!0,enumerable:!1,writable:!1,configurable:!1}}),Q)Object.defineProperty(W,Symbol.hasInstance,{value(K){return K&&K[C4]},configurable:!1,writable:!1,enumerable:!1});else Object.defineProperty(W,Symbol.hasInstance,{value(K){return K&&K[G]},configurable:!1,writable:!1,enumerable:!1});return W.prototype[Symbol.toStringTag]="Error",W.prototype.toString=_00,W}qJ.captureStackTrace=!0;var S00=qJ(C4,"Fastify Error",500,Error);TX.exports=qJ;TX.exports.FastifyError=S00;TX.exports.default=qJ;TX.exports.createError=qJ});var E4=S((Bf0,JR)=>{var{createError:gZ}=fH();JR.exports={AVV_ERR_EXPOSE_ALREADY_DEFINED:gZ("AVV_ERR_EXPOSE_ALREADY_DEFINED","'%s' is already defined, specify an expose option for '%s'"),AVV_ERR_ATTRIBUTE_ALREADY_DEFINED:gZ("AVV_ERR_ATTRIBUTE_ALREADY_DEFINED","'%s' is already defined"),AVV_ERR_CALLBACK_NOT_FN:gZ("AVV_ERR_CALLBACK_NOT_FN","Callback for '%s' hook is not a function. Received: '%s'"),AVV_ERR_PLUGIN_NOT_VALID:gZ("AVV_ERR_PLUGIN_NOT_VALID","Plugin must be a function or a promise. Received: '%s'"),AVV_ERR_ROOT_PLG_BOOTED:gZ("AVV_ERR_ROOT_PLG_BOOTED","Root plugin has already booted"),AVV_ERR_PARENT_PLG_LOADED:gZ("AVV_ERR_PARENT_PLG_LOADED","Impossible to load '%s' plugin because the parent '%s' was already loaded"),AVV_ERR_READY_TIMEOUT:gZ("AVV_ERR_READY_TIMEOUT","Plugin did not start in time: '%s'. You may have forgotten to call 'done' function or to resolve a Promise"),AVV_ERR_PLUGIN_EXEC_TIMEOUT:gZ("AVV_ERR_PLUGIN_EXEC_TIMEOUT","Plugin did not start in time: '%s'. You may have forgotten to call 'done' function or to resolve a Promise")}});var jJ=S((zf0,YR)=>{var f00=Symbol("avvio.Boot"),k00=Symbol("isOnCloseHandler"),v00=Symbol("avvio.ThenifyDoNotWrap"),y00=Symbol("avvio.TimeTree.untrackNode"),x00=Symbol("avvio.TimeTree.trackNode"),h00=Symbol("avvio.TimeTree.getParent"),g00=Symbol("avvio.TimeTree.getNode"),u00=Symbol("avvio.TimeTree.addNode"),m00=Symbol.for("plugin-meta");YR.exports={kAvvio:f00,kIsOnCloseHandler:k00,kThenifyDoNotWrap:v00,kUntrackNode:y00,kTrackNode:x00,kGetParent:h00,kGetNode:g00,kAddNode:u00,kPluginMeta:m00}});var HR=S((Ff0,UR)=>{var{kUntrackNode:XR,kTrackNode:kH,kGetParent:QR,kGetNode:GR,kAddNode:WR}=jJ();class KR{constructor(){this.root=null,this.tableId=new Map,this.tableLabel=new Map}[kH]($){if(this.tableId.set($.id,$),this.tableLabel.has($.label))this.tableLabel.get($.label).push($);else this.tableLabel.set($.label,[$])}[XR]($){this.tableId.delete($.id);let Z=this.tableLabel.get($.label);if(Z.pop(),Z.length===0)this.tableLabel.delete($.label)}[QR]($){if($===null)return null;else if(this.tableLabel.has($)){let Z=this.tableLabel.get($);return Z[Z.length-1]}else return null}[GR]($){return this.tableId.get($)}[WR]($,Z,J){let Y=this[QR]($);if(Y===null)return this.root={parent:null,id:"root",label:Z,nodes:[],start:J,stop:null,diff:-1},this[kH](this.root),this.root.id;let Q=`${Z}-${Math.random()}`,G={parent:$,id:Q,label:Z,nodes:[],start:J,stop:null,diff:-1};return Y.nodes.push(G),this[kH](G),Q}start($,Z,J=Date.now()){return this[WR]($,Z,J)}stop($,Z=Date.now()){let J=this[GR]($);if(J)J.stop=Z,J.diff=J.stop-J.start||0,this[XR](J)}toJSON(){return Object.assign({},this.root)}prettyPrint(){return VR(this.toJSON())}}function VR($,Z=""){let J=Z,Y=$.nodes.length,X=Y-1;J+=`${$.label} ${$.diff} ms
|
|
83
|
+
`;for(let Q=0;Q<Y;++Q){let G=$.nodes[Q],W=Z+(Q===X?" ":"\u2502 ");J+=Z,J+=Q===X?"\u2514\u2500":"\u251C\u2500",J+=G.nodes.length===0?"\u2500 ":"\u252C ",J+=VR(G,W).slice(Z.length+2)}return J}UR.exports={TimeTree:KR}});var b4=S((Af0,BR)=>{var{debuglog:l00}=Y0("util"),d00=l00("avvio");BR.exports={debug:d00}});var FR=S((Of0,zR)=>{function p00(){let $={resolve:null,reject:null,promise:null};return $.promise=new Promise((Z,J)=>{$.resolve=Z,$.reject=J}),$}zR.exports={createPromise:p00}});var qR=S((qf0,OR)=>{var{kPluginMeta:AR}=jJ();function c00($,Z){if($[AR]?.name)return $[AR].name;if(Z?.name)return Z.name;if($.name)return $.name;else return $.toString().split(`
|
|
84
|
+
`).slice(0,2).map((J)=>J.trim()).join(" -- ")}OR.exports={getPluginName:c00}});var _4=S((jf0,jR)=>{function i00($){return $!==null&&typeof $==="object"&&typeof $.then==="function"}jR.exports={isPromiseLike:i00}});var MR=S((Nf0,NR)=>{var{EventEmitter:n00}=Y0("events"),{inherits:o00}=Y0("util"),{debug:_$}=b4(),{createPromise:s00}=FR(),{AVV_ERR_PLUGIN_EXEC_TIMEOUT:r00}=E4(),{getPluginName:a00}=qR(),{isPromiseLike:t00}=_4();function NJ($,Z,J,Y,X){this.queue=$,this.func=Z,this.options=J,this.isAfter=Y,this.timeout=X,this.started=!1,this.name=a00(Z,J),this.queue.pause(),this._error=null,this.loaded=!1,this._promise=null,this.startTime=null}o00(NJ,n00);NJ.prototype.exec=function($,Z){_$("exec",this.name),this.server=$;let J=this.func,Y=this.name,X=!1;this.options=typeof this.options==="function"?this.options(this.server):this.options;let Q=null,G=(K)=>{if(X){_$("loading complete",Y);return}if(this._error=K,K)_$("exec errored",Y);else _$("exec completed",Y);if(X=!0,Q)clearTimeout(Q);Z(K)};if(this.timeout>0)_$("setting up timeout",Y,this.timeout),Q=setTimeout(function(){_$("timed out",Y),Q=null;let K=new r00(Y);K.fn=J,G(K)},this.timeout);this.started=!0,this.startTime=Date.now(),this.emit("start",this.server?this.server.name:null,this.name,Date.now());let W=J(this.server,this.options,G);if(t00(W))_$("exec: resolving promise",Y),W.then(()=>process.nextTick(G),(K)=>process.nextTick(G,K));else if(J.length<3)G()};NJ.prototype.loadedSoFar=function(){if(_$("loadedSoFar",this.name),this.loaded)return Promise.resolve();let $=()=>{this.server.after((J,Y)=>{if(this._error=J,this.queue.pause(),this._promise){if(J)_$("rejecting promise",this.name,J),this._promise.reject(J);else _$("resolving promise",this.name),this._promise.resolve();this._promise=null}process.nextTick(Y,J)}),this.queue.resume()},Z;if(!this._promise)if(this._promise=s00(),Z=this._promise.promise,!this.server)this.on("start",$);else $();else Z=Promise.resolve();return Z};NJ.prototype.enqueue=function($,Z){_$("enqueue",this.name,$.name),this.emit("enqueue",this.server?this.server.name:null,this.name,Date.now()),this.queue.push($,Z)};NJ.prototype.finish=function($,Z){_$("finish",this.name,$);let J=()=>{if(this.loaded)return;_$("loaded",this.name),this.emit("loaded",this.server?this.server.name:null,this.name,Date.now()),this.loaded=!0,Z($)};if($){if(this._promise)this._promise.reject($),this._promise=null;J();return}let Y=()=>{if(_$("check",this.name,this.queue.length(),this.queue.running(),this._promise),this.queue.length()===0&&this.queue.running()===0)if(this._promise){let X=()=>{_$("wrap"),queueMicrotask(Y)};this._promise.resolve(),this._promise.promise.then(X,X),this._promise=null}else J();else _$("delayed",this.name),this.queue.drain=()=>{_$("drain",this.name),this.queue.drain=e00,queueMicrotask(Y)}};queueMicrotask(Y),this.queue.resume()};function e00(){}NR.exports={Plugin:NJ}});var wR=S((Mf0,DR)=>{var{AVV_ERR_PLUGIN_NOT_VALID:vH}=E4();function $10($){if(!($&&(typeof $==="function"||typeof $.then==="function")))if(Array.isArray($))throw new vH("array");else if($===null)throw new vH("null");else throw new vH(typeof $)}DR.exports={validatePlugin:$10}});var TR=S((Df0,LR)=>{function Z10($){return $!==null&&typeof $==="object"&&typeof $.default==="function"}LR.exports={isBundledOrTypescriptPlugin:Z10}});var IR=S((wf0,PR)=>{var{debug:RR}=b4(),{kThenifyDoNotWrap:yH}=jJ();function J10(){if(this.booted){RR("thenify returning undefined because we are already booted");return}if(this[yH]){this[yH]=!1;return}return RR("thenify"),($,Z)=>{return this._loadRegistered().then(()=>{return this[yH]=!0,$(this._server)},Z)}}PR.exports={thenify:J10}});var ER=S((Lf0,CR)=>{var{isPromiseLike:Y10}=_4(),{kAvvio:X10}=jJ();function Q10($,Z,J){let Y;try{Y=$.apply($,Z)}catch(X){if(J)process.nextTick(J,X);return}if(Y10(Y)&&!Y[X10])Y.then(()=>process.nextTick(J),(X)=>process.nextTick(J,X));else if(J)process.nextTick(J)}CR.exports={executeWithThenable:Q10}});var hR=S((Tf0,xR)=>{var S4=ZR(),G10=Y0("events").EventEmitter,W10=Y0("util").inherits,{AVV_ERR_EXPOSE_ALREADY_DEFINED:RX,AVV_ERR_CALLBACK_NOT_FN:MJ,AVV_ERR_ROOT_PLG_BOOTED:K10,AVV_ERR_READY_TIMEOUT:V10,AVV_ERR_ATTRIBUTE_ALREADY_DEFINED:U10}=E4(),{kAvvio:SR,kIsOnCloseHandler:fR}=jJ(),{TimeTree:H10}=HR(),{Plugin:kR}=MR(),{debug:DJ}=b4(),{validatePlugin:B10}=wR(),{isBundledOrTypescriptPlugin:z10}=TR(),{isPromiseLike:F10}=_4(),{thenify:vR}=IR(),{executeWithThenable:bR}=ER();function Q$($,Z,J){if(typeof $==="function"&&arguments.length===1)J=$,Z={},$=null;if(typeof Z==="function")J=Z,Z={};if(Z=Z||{},Z.autostart=Z.autostart!==!1,Z.timeout=Number(Z.timeout)||0,Z.expose=Z.expose||{},!new.target)return new Q$($,Z,J);if(this._server=$||this,this._opts=Z,$)this._expose();if(this._current=[],this._error=null,this._lastUsed=null,this.setMaxListeners(0),J)this.once("start",J);this.started=!1,this.booted=!1,this.pluginTree=new H10,this._readyQ=S4(this,yR,1),this._readyQ.pause(),this._readyQ.drain=()=>{this.emit("start"),this._readyQ.drain=_R},this._closeQ=S4(this,O10,1),this._closeQ.pause(),this._closeQ.drain=()=>{this.emit("close"),this._closeQ.drain=_R},this._doStart=null;let Y=this;this._root=new kR(S4(this,this._loadPluginNextTick,1),function(Q,G,W){Y._doStart=W,G.autostart&&Y.start()},Z,!1,0),this._trackPluginLoading(this._root),this._loadPlugin(this._root,(X)=>{DJ("root plugin ready");try{this.emit("preReady"),this._root=null}catch(Q){X=X||this._error||Q}if(X){if(this._error=X,this._readyQ.length()===0)throw X}else this.booted=!0;this._readyQ.resume()})}W10(Q$,G10);if("asyncDispose"in Symbol)Q$.prototype[Symbol.asyncDispose]=function(){return new Promise(($,Z)=>{this.close((J)=>{if(J)return Z(J);$()})})};Q$.prototype.start=function(){return this.started=!0,process.nextTick(this._doStart),this};Q$.prototype.override=function($,Z,J){return $};Q$.prototype[SR]=!0;Q$.prototype.use=function($,Z){return this._lastUsed=this._addPlugin($,Z,!1),this};Q$.prototype._loadRegistered=function(){let $=this._current[0];if(!this.started&&!this.booted)process.nextTick(()=>this._root.queue.resume());if(!$)return Promise.resolve();return $.loadedSoFar()};Object.defineProperty(Q$.prototype,"then",{get:vR});Q$.prototype._addPlugin=function($,Z,J){if(z10($))$=$.default;if(B10($),Z=Z||{},this.booted)throw new K10;let Y=this._current[0],X=this._opts.timeout;if(!Y.loaded&&Y.timeout>0){let G=Date.now()-Y.startTime;X=Y.timeout-(G+3)}let Q=new kR(S4(this,this._loadPluginNextTick,1),$,Z,J,X);if(this._trackPluginLoading(Q),Y.loaded)throw Error(Q.name,Y.name);return Y.enqueue(Q,(G)=>{G&&(this._error=G)}),Q};Q$.prototype._expose=function(){let Z=this,J=Z._server,{use:Y="use",after:X="after",ready:Q="ready",onClose:G="onClose",close:W="close"}=this._opts.expose;if(J[Y])throw new RX(Y,"use");if(J[Y]=function(K,V){return Z.use(K,V),this},J[X])throw new RX(X,"after");if(J[X]=function(K){if(typeof K!=="function")return Z._loadRegistered();return Z.after(xH(K,this)),this},J[Q])throw new RX(Q,"ready");if(J[Q]=function(K){if(K&&typeof K!=="function")throw new MJ(Q,typeof K);return Z.ready(K?xH(K,this):void 0)},J[G])throw new RX(G,"onClose");if(J[G]=function(K){if(typeof K!=="function")throw new MJ(G,typeof K);return Z.onClose(q10(K,this)),this},J[W])throw new RX(W,"close");if(J[W]=function(K){if(K&&typeof K!=="function")throw new MJ(W,typeof K);if(K)return Z.close(xH(K,this)),this;return Z.close()},J.then)throw new U10("then");Object.defineProperty(J,"then",{get:vR.bind(Z)}),J[SR]=!0};Q$.prototype.after=function($){if(!$)return this._loadRegistered();this._addPlugin(Z.bind(this),{},!0);function Z(J,Y,X){yR.call(this,$,X)}return this};Q$.prototype.onClose=function($){if(typeof $!=="function")throw new MJ("onClose",typeof $);return $[fR]=!0,this._closeQ.unshift($,(Z)=>{Z&&(this._error=Z)}),this};Q$.prototype.close=function($){let Z;if($){if(typeof $!=="function")throw new MJ("close",typeof $)}else Z=new Promise(function(J,Y){$=function(X){if(X)return Y(X);J()}});return this.ready(()=>{this._error=null,this._closeQ.push($),process.nextTick(this._closeQ.resume.bind(this._closeQ))}),Z};Q$.prototype.ready=function($){if($){if(typeof $!=="function")throw new MJ("ready",typeof $);this._readyQ.push($),queueMicrotask(this.start.bind(this));return}return new Promise((Z,J)=>{this._readyQ.push(X),this.start();let Y=this._current[0].server;function X(Q,G,W){if(Q)J(Q);else Z(Y);process.nextTick(W)}})};Q$.prototype._trackPluginLoading=function($){let Z=this._current[0]?.name||null;$.once("start",(J,Y,X)=>{let Q=this.pluginTree.start(Z||null,Y,X);$.once("loaded",(G,W,K)=>{this.pluginTree.stop(Q,K)})})};Q$.prototype.prettyPrint=function(){return this.pluginTree.prettyPrint()};Q$.prototype.toJSON=function(){return this.pluginTree.toJSON()};Q$.prototype._loadPlugin=function($,Z){let J=this;if(F10($.func)){$.func.then((G)=>{if(typeof G.default==="function")G=G.default;$.func=G,this._loadPlugin($,Z)},Z);return}let Y=J._current[0];if(J._current.unshift($),J._error&&!$.isAfter){DJ("skipping loading of plugin as instance errored and it is not an after",$.name),process.nextTick(Q);return}let X=Y?.server||J._server;if(!$.isAfter)try{X=J.override(X,$.func,$.options)}catch(G){return DJ("override errored",$.name),Q(G)}$.exec(X,Q);function Q(G){$.finish(G,(W)=>{J._current.shift(),Z(W)})}};Q$.prototype._loadPluginNextTick=function($,Z){process.nextTick(this._loadPlugin.bind(this),$,Z)};function _R(){}function yR($,Z){let J=this._server,Y=this._error;if(this._error=null,$.length===0)this._error=Y,bR($,[],Z);else if($.length===1)bR($,[Y],Z);else if(this._opts.timeout===0){let X=(Q)=>{this._error=Q,Z(this._error)};if($.length===2)$(Y,X);else $(Y,J,X)}else A10.call(this,$,Y,J,Z)}function A10($,Z,J,Y){let X=$.unwrappedName??$.name;DJ("setting up ready timeout",X,this._opts.timeout);let Q=setTimeout(()=>{DJ("timed out",X),Q=null;let W=new V10(X);W.fn=$,this._error=W,Y(W)},this._opts.timeout);if($.length===2)$(Z,G.bind(this));else $(Z,J,G.bind(this));function G(W){if(Q)clearTimeout(Q),this._error=W,Y(this._error)}}function O10($,Z){let J=this._server,Y=$[fR];if($.length===0||$.length===1){let X;if(Y)X=$(J);else X=$(this._error);if(X&&typeof X.then==="function")DJ("resolving close/onClose promise"),X.then(()=>process.nextTick(Z),(Q)=>process.nextTick(Z,Q));else process.nextTick(Z)}else if($.length===2)if(Y)$(J,Z);else $(this._error,Z);else if(Y)$(J,Z);else $(this._error,J,Z)}function q10($,Z){return J.bind(Z);function J(Y,X){let Q;if($.length===0)if(Q=$(),Q?.then)Q.then(function(){process.nextTick(X)},X);else process.nextTick(X);else if($.length===1)if(Q=$(this),Q?.then)Q.then(function(){process.nextTick(X)},X);else process.nextTick(X);else $(this,X)}}function xH($,Z){let J=Y.bind(Z);return J.unwrappedName=$.name,J;function Y(X,Q){let G;if(!$)process.nextTick(Q);else if($.length===0)if(G=$(),G?.then)G.then(function(){process.nextTick(Q,X)},Q);else process.nextTick(Q,X);else if($.length===1)if(G=$(X),G?.then)G.then(function(){process.nextTick(Q)},Q);else process.nextTick(Q);else if($.length===2)$(X,Q);else $(X,this,Q)}}xR.exports=Q$});var H$=S((Rf0,gR)=>{var j10={kAvvioBoot:Symbol("fastify.avvioBoot"),kChildren:Symbol("fastify.children"),kServerBindings:Symbol("fastify.serverBindings"),kBodyLimit:Symbol("fastify.bodyLimit"),kSupportedHTTPMethods:Symbol("fastify.acceptedHTTPMethods"),kRoutePrefix:Symbol("fastify.routePrefix"),kLogLevel:Symbol("fastify.logLevel"),kLogSerializers:Symbol("fastify.logSerializers"),kHooks:Symbol("fastify.hooks"),kContentTypeParser:Symbol("fastify.contentTypeParser"),kState:Symbol("fastify.state"),kOptions:Symbol("fastify.options"),kDisableRequestLogging:Symbol("fastify.disableRequestLogging"),kPluginNameChain:Symbol("fastify.pluginNameChain"),kRouteContext:Symbol("fastify.context"),kGenReqId:Symbol("fastify.genReqId"),kHttp2ServerSessions:Symbol("fastify.http2ServerSessions"),kSchemaController:Symbol("fastify.schemaController"),kSchemaHeaders:Symbol("headers-schema"),kSchemaParams:Symbol("params-schema"),kSchemaQuerystring:Symbol("querystring-schema"),kSchemaBody:Symbol("body-schema"),kSchemaResponse:Symbol("response-schema"),kSchemaErrorFormatter:Symbol("fastify.schemaErrorFormatter"),kSchemaVisited:Symbol("fastify.schemas.visited"),kRequest:Symbol("fastify.Request"),kRequestPayloadStream:Symbol("fastify.RequestPayloadStream"),kRequestAcceptVersion:Symbol("fastify.RequestAcceptVersion"),kRequestCacheValidateFns:Symbol("fastify.request.cache.validateFns"),kRequestOriginalUrl:Symbol("fastify.request.originalUrl"),kRequestSignal:Symbol("fastify.request.signal"),kHandlerTimeout:Symbol("fastify.handlerTimeout"),kTimeoutTimer:Symbol("fastify.request.timeoutTimer"),kOnAbort:Symbol("fastify.request.onAbort"),kFourOhFour:Symbol("fastify.404"),kCanSetNotFoundHandler:Symbol("fastify.canSetNotFoundHandler"),kFourOhFourLevelInstance:Symbol("fastify.404LogLevelInstance"),kFourOhFourContext:Symbol("fastify.404ContextKey"),kDefaultJsonParse:Symbol("fastify.defaultJSONParse"),kReply:Symbol("fastify.Reply"),kReplySerializer:Symbol("fastify.reply.serializer"),kReplyIsError:Symbol("fastify.reply.isError"),kReplyHeaders:Symbol("fastify.reply.headers"),kReplyTrailers:Symbol("fastify.reply.trailers"),kReplyHasStatusCode:Symbol("fastify.reply.hasStatusCode"),kReplyHijacked:Symbol("fastify.reply.hijacked"),kReplyStartTime:Symbol("fastify.reply.startTime"),kReplyNextErrorHandler:Symbol("fastify.reply.nextErrorHandler"),kReplyEndTime:Symbol("fastify.reply.endTime"),kReplyErrorHandlerCalled:Symbol("fastify.reply.errorHandlerCalled"),kReplyIsRunningOnErrorHook:Symbol("fastify.reply.isRunningOnErrorHook"),kReplySerializerDefault:Symbol("fastify.replySerializerDefault"),kReplyCacheSerializeFns:Symbol("fastify.reply.cache.serializeFns"),kTestInternals:Symbol("fastify.testInternals"),kErrorHandler:Symbol("fastify.errorHandler"),kErrorHandlerAlreadySet:Symbol("fastify.errorHandlerAlreadySet"),kChildLoggerFactory:Symbol("fastify.childLoggerFactory"),kHasBeenDecorated:Symbol("fastify.hasBeenDecorated"),kKeepAliveConnections:Symbol("fastify.keepAliveConnections"),kRouteByFastify:Symbol("fastify.routeByFastify")};gR.exports=j10});var mR=S((Pf0,f4)=>{var{format:hH}=Y0("util");function N10($){return uR({...$,name:"DeprecationWarning"})}function uR({name:$,code:Z,message:J,unlimited:Y=!1}={}){if(!$)throw Error("Warning name must not be empty");if(!Z)throw Error("Warning code must not be empty");if(!J)throw Error("Warning message must not be empty");if(typeof Y!=="boolean")throw Error("Warning opts.unlimited must be a boolean");Z=Z.toUpperCase();let X={[$]:function(G,W,K){if(Q.emitted===!0&&Q.unlimited!==!0)return;Q.emitted=!0,process.emitWarning(Q.format(G,W,K),Q.name,Q.code)}};if(Y)X={[$]:function(G,W,K){Q.emitted=!0,process.emitWarning(Q.format(G,W,K),Q.name,Q.code)}};let Q=X[$];return Q.emitted=!1,Q.message=J,Q.unlimited=Y,Q.code=Z,Q.format=function(G,W,K){let V;if(G&&W&&K)V=hH(J,G,W,K);else if(G&&W)V=hH(J,G,W);else if(G)V=hH(J,G);else V=J;return V},Q}var gH={createWarning:uR,createDeprecation:N10};f4.exports=gH;f4.exports.default=gH;f4.exports.processWarning=gH});var wJ=S((If0,lR)=>{var{createWarning:PX}=mR(),M10=PX({name:"FastifyWarning",code:"FSTWRN001",message:"The %s schema for %s: %s is missing. This may indicate the schema is not well specified.",unlimited:!0}),D10=PX({name:"FastifyWarning",code:"FSTWRN003",message:"The %s mixes async and callback styles that may lead to unhandled rejections. Please use only one of them.",unlimited:!0}),w10=PX({name:"FastifyWarning",code:"FSTWRN004",message:"It seems that you are overriding an errorHandler in the same scope, which can lead to subtle bugs.",unlimited:!0}),L10=PX({name:"FastifySecurity",code:"FSTSEC001",message:'You are using /%s/ Content-Type which may be vulnerable to CORS attack. Please make sure your RegExp start with "^" or include ";?" to proper detection of the essence MIME type.',unlimited:!0}),T10=PX({name:"FastifyWarning",code:"FSTDEP022",message:'The router options for %s property access is deprecated. Please use "options.routerOptions" instead for accessing router options. The router options will be removed in `fastify@6`.',unlimited:!0});lR.exports={FSTWRN001:M10,FSTWRN003:D10,FSTWRN004:w10,FSTSEC001:L10,FSTDEP022:T10}});var w$=S((Cf0,k4)=>{var W0=fH(),d5={FST_ERR_NOT_FOUND:W0("FST_ERR_NOT_FOUND","Not Found",404),FST_ERR_OPTIONS_NOT_OBJ:W0("FST_ERR_OPTIONS_NOT_OBJ","Options must be an object",500,TypeError),FST_ERR_QSP_NOT_FN:W0("FST_ERR_QSP_NOT_FN","querystringParser option should be a function, instead got '%s'",500,TypeError),FST_ERR_SCHEMA_CONTROLLER_BUCKET_OPT_NOT_FN:W0("FST_ERR_SCHEMA_CONTROLLER_BUCKET_OPT_NOT_FN","schemaController.bucket option should be a function, instead got '%s'",500,TypeError),FST_ERR_SCHEMA_ERROR_FORMATTER_NOT_FN:W0("FST_ERR_SCHEMA_ERROR_FORMATTER_NOT_FN","schemaErrorFormatter option should be a non async function. Instead got '%s'.",500,TypeError),FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_OBJ:W0("FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_OBJ","ajv.customOptions option should be an object, instead got '%s'",500,TypeError),FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_ARR:W0("FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_ARR","ajv.plugins option should be an array, instead got '%s'",500,TypeError),FST_ERR_VALIDATION:W0("FST_ERR_VALIDATION","%s",400),FST_ERR_LISTEN_OPTIONS_INVALID:W0("FST_ERR_LISTEN_OPTIONS_INVALID","Invalid listen options: '%s'",500,TypeError),FST_ERR_ERROR_HANDLER_NOT_FN:W0("FST_ERR_ERROR_HANDLER_NOT_FN","Error Handler must be a function",500,TypeError),FST_ERR_ERROR_HANDLER_ALREADY_SET:W0("FST_ERR_ERROR_HANDLER_ALREADY_SET","Error Handler already set in this scope. Set 'allowErrorHandlerOverride: true' to allow overriding.",500,TypeError),FST_ERR_CTP_ALREADY_PRESENT:W0("FST_ERR_CTP_ALREADY_PRESENT","Content type parser '%s' already present."),FST_ERR_CTP_INVALID_TYPE:W0("FST_ERR_CTP_INVALID_TYPE","The content type should be a string or a RegExp",500,TypeError),FST_ERR_CTP_EMPTY_TYPE:W0("FST_ERR_CTP_EMPTY_TYPE","The content type cannot be an empty string",500,TypeError),FST_ERR_CTP_INVALID_HANDLER:W0("FST_ERR_CTP_INVALID_HANDLER","The content type handler should be a function",500,TypeError),FST_ERR_CTP_INVALID_PARSE_TYPE:W0("FST_ERR_CTP_INVALID_PARSE_TYPE","The body parser can only parse your data as 'string' or 'buffer', you asked '%s' which is not supported.",500,TypeError),FST_ERR_CTP_BODY_TOO_LARGE:W0("FST_ERR_CTP_BODY_TOO_LARGE","Request body is too large",413,RangeError),FST_ERR_CTP_INVALID_MEDIA_TYPE:W0("FST_ERR_CTP_INVALID_MEDIA_TYPE","Unsupported Media Type",415),FST_ERR_CTP_INVALID_CONTENT_LENGTH:W0("FST_ERR_CTP_INVALID_CONTENT_LENGTH","Request body size did not match Content-Length",400,RangeError),FST_ERR_CTP_EMPTY_JSON_BODY:W0("FST_ERR_CTP_EMPTY_JSON_BODY","Body cannot be empty when content-type is set to 'application/json'",400),FST_ERR_CTP_INVALID_JSON_BODY:W0("FST_ERR_CTP_INVALID_JSON_BODY","Body is not valid JSON but content-type is set to 'application/json'",400),FST_ERR_CTP_INSTANCE_ALREADY_STARTED:W0("FST_ERR_CTP_INSTANCE_ALREADY_STARTED",'Cannot call "%s" when fastify instance is already started!',400),FST_ERR_DEC_ALREADY_PRESENT:W0("FST_ERR_DEC_ALREADY_PRESENT","The decorator '%s' has already been added!"),FST_ERR_DEC_DEPENDENCY_INVALID_TYPE:W0("FST_ERR_DEC_DEPENDENCY_INVALID_TYPE","The dependencies of decorator '%s' must be of type Array.",500,TypeError),FST_ERR_DEC_MISSING_DEPENDENCY:W0("FST_ERR_DEC_MISSING_DEPENDENCY","The decorator is missing dependency '%s'."),FST_ERR_DEC_AFTER_START:W0("FST_ERR_DEC_AFTER_START","The decorator '%s' has been added after start!"),FST_ERR_DEC_REFERENCE_TYPE:W0("FST_ERR_DEC_REFERENCE_TYPE","The decorator '%s' of type '%s' is a reference type. Use the { getter, setter } interface instead."),FST_ERR_DEC_UNDECLARED:W0("FST_ERR_DEC_UNDECLARED","No decorator '%s' has been declared on %s."),FST_ERR_HOOK_INVALID_TYPE:W0("FST_ERR_HOOK_INVALID_TYPE","The hook name must be a string",500,TypeError),FST_ERR_HOOK_INVALID_HANDLER:W0("FST_ERR_HOOK_INVALID_HANDLER","%s hook should be a function, instead got %s",500,TypeError),FST_ERR_HOOK_INVALID_ASYNC_HANDLER:W0("FST_ERR_HOOK_INVALID_ASYNC_HANDLER","Async function has too many arguments. Async hooks should not use the 'done' argument.",500,TypeError),FST_ERR_HOOK_NOT_SUPPORTED:W0("FST_ERR_HOOK_NOT_SUPPORTED","%s hook not supported!",500,TypeError),FST_ERR_MISSING_MIDDLEWARE:W0("FST_ERR_MISSING_MIDDLEWARE","You must register a plugin for handling middlewares, visit fastify.dev/docs/latest/Reference/Middleware/ for more info.",500),FST_ERR_HOOK_TIMEOUT:W0("FST_ERR_HOOK_TIMEOUT","A callback for '%s' hook%s timed out. You may have forgotten to call 'done' function or to resolve a Promise"),FST_ERR_LOG_INVALID_DESTINATION:W0("FST_ERR_LOG_INVALID_DESTINATION","Cannot specify both logger.stream and logger.file options"),FST_ERR_LOG_INVALID_LOGGER:W0("FST_ERR_LOG_INVALID_LOGGER","Invalid logger object provided. The logger instance should have these functions(s): '%s'.",500,TypeError),FST_ERR_LOG_INVALID_LOGGER_INSTANCE:W0("FST_ERR_LOG_INVALID_LOGGER_INSTANCE","loggerInstance only accepts a logger instance.",500,TypeError),FST_ERR_LOG_INVALID_LOGGER_CONFIG:W0("FST_ERR_LOG_INVALID_LOGGER_CONFIG","logger options only accepts a configuration object.",500,TypeError),FST_ERR_LOG_LOGGER_AND_LOGGER_INSTANCE_PROVIDED:W0("FST_ERR_LOG_LOGGER_AND_LOGGER_INSTANCE_PROVIDED","You cannot provide both logger and loggerInstance. Please provide only one.",500,TypeError),FST_ERR_REP_INVALID_PAYLOAD_TYPE:W0("FST_ERR_REP_INVALID_PAYLOAD_TYPE","Attempted to send payload of invalid type '%s'. Expected a string or Buffer.",500,TypeError),FST_ERR_REP_RESPONSE_BODY_CONSUMED:W0("FST_ERR_REP_RESPONSE_BODY_CONSUMED","Response.body is already consumed."),FST_ERR_REP_READABLE_STREAM_LOCKED:W0("FST_ERR_REP_READABLE_STREAM_LOCKED","ReadableStream was locked. You should call releaseLock() method on reader before sending."),FST_ERR_REP_ALREADY_SENT:W0("FST_ERR_REP_ALREADY_SENT",'Reply was already sent, did you forget to "return reply" in "%s" (%s)?'),FST_ERR_REP_SENT_VALUE:W0("FST_ERR_REP_SENT_VALUE","The only possible value for reply.sent is true.",500,TypeError),FST_ERR_SEND_INSIDE_ONERR:W0("FST_ERR_SEND_INSIDE_ONERR","You cannot use `send` inside the `onError` hook"),FST_ERR_SEND_UNDEFINED_ERR:W0("FST_ERR_SEND_UNDEFINED_ERR","Undefined error has occurred"),FST_ERR_BAD_STATUS_CODE:W0("FST_ERR_BAD_STATUS_CODE","Called reply with an invalid status code: %s"),FST_ERR_BAD_TRAILER_NAME:W0("FST_ERR_BAD_TRAILER_NAME","Called reply.trailer with an invalid header name: %s"),FST_ERR_BAD_TRAILER_VALUE:W0("FST_ERR_BAD_TRAILER_VALUE","Called reply.trailer('%s', fn) with an invalid type: %s. Expected a function."),FST_ERR_FAILED_ERROR_SERIALIZATION:W0("FST_ERR_FAILED_ERROR_SERIALIZATION","Failed to serialize an error. Error: %s. Original error: %s"),FST_ERR_MISSING_SERIALIZATION_FN:W0("FST_ERR_MISSING_SERIALIZATION_FN",'Missing serialization function. Key "%s"'),FST_ERR_MISSING_CONTENTTYPE_SERIALIZATION_FN:W0("FST_ERR_MISSING_CONTENTTYPE_SERIALIZATION_FN",'Missing serialization function. Key "%s:%s"'),FST_ERR_REQ_INVALID_VALIDATION_INVOCATION:W0("FST_ERR_REQ_INVALID_VALIDATION_INVOCATION",'Invalid validation invocation. Missing validation function for HTTP part "%s" nor schema provided.'),FST_ERR_SCH_MISSING_ID:W0("FST_ERR_SCH_MISSING_ID","Missing schema $id property"),FST_ERR_SCH_ALREADY_PRESENT:W0("FST_ERR_SCH_ALREADY_PRESENT","Schema with id '%s' already declared!"),FST_ERR_SCH_CONTENT_MISSING_SCHEMA:W0("FST_ERR_SCH_CONTENT_MISSING_SCHEMA","Schema is missing for the content type '%s'"),FST_ERR_SCH_DUPLICATE:W0("FST_ERR_SCH_DUPLICATE","Schema with '%s' already present!"),FST_ERR_SCH_VALIDATION_BUILD:W0("FST_ERR_SCH_VALIDATION_BUILD","Failed building the validation schema for %s: %s, due to error %s"),FST_ERR_SCH_SERIALIZATION_BUILD:W0("FST_ERR_SCH_SERIALIZATION_BUILD","Failed building the serialization schema for %s: %s, due to error %s"),FST_ERR_SCH_RESPONSE_SCHEMA_NOT_NESTED_2XX:W0("FST_ERR_SCH_RESPONSE_SCHEMA_NOT_NESTED_2XX",'response schemas should be nested under a valid status code, e.g { 2xx: { type: "object" } }'),FST_ERR_INIT_OPTS_INVALID:W0("FST_ERR_INIT_OPTS_INVALID","Invalid initialization options: '%s'"),FST_ERR_FORCE_CLOSE_CONNECTIONS_IDLE_NOT_AVAILABLE:W0("FST_ERR_FORCE_CLOSE_CONNECTIONS_IDLE_NOT_AVAILABLE","Cannot set forceCloseConnections to 'idle' as your HTTP server does not support closeIdleConnections method"),FST_ERR_DUPLICATED_ROUTE:W0("FST_ERR_DUPLICATED_ROUTE","Method '%s' already declared for route '%s'"),FST_ERR_BAD_URL:W0("FST_ERR_BAD_URL","'%s' is not a valid url component",400,URIError),FST_ERR_ASYNC_CONSTRAINT:W0("FST_ERR_ASYNC_CONSTRAINT","Unexpected error from async constraint",500),FST_ERR_INVALID_URL:W0("FST_ERR_INVALID_URL","URL must be a string. Received '%s'",400,TypeError),FST_ERR_ROUTE_OPTIONS_NOT_OBJ:W0("FST_ERR_ROUTE_OPTIONS_NOT_OBJ",'Options for "%s:%s" route must be an object',500,TypeError),FST_ERR_ROUTE_DUPLICATED_HANDLER:W0("FST_ERR_ROUTE_DUPLICATED_HANDLER",'Duplicate handler for "%s:%s" route is not allowed!',500),FST_ERR_ROUTE_HANDLER_NOT_FN:W0("FST_ERR_ROUTE_HANDLER_NOT_FN","Error Handler for %s:%s route, if defined, must be a function",500,TypeError),FST_ERR_ROUTE_MISSING_HANDLER:W0("FST_ERR_ROUTE_MISSING_HANDLER",'Missing handler function for "%s:%s" route.',500),FST_ERR_ROUTE_METHOD_INVALID:W0("FST_ERR_ROUTE_METHOD_INVALID","Provided method is invalid!",500,TypeError),FST_ERR_ROUTE_METHOD_NOT_SUPPORTED:W0("FST_ERR_ROUTE_METHOD_NOT_SUPPORTED","%s method is not supported.",500),FST_ERR_ROUTE_BODY_VALIDATION_SCHEMA_NOT_SUPPORTED:W0("FST_ERR_ROUTE_BODY_VALIDATION_SCHEMA_NOT_SUPPORTED","Body validation schema for %s:%s route is not supported!",500),FST_ERR_ROUTE_BODY_LIMIT_OPTION_NOT_INT:W0("FST_ERR_ROUTE_BODY_LIMIT_OPTION_NOT_INT","'bodyLimit' option must be an integer > 0. Got '%s'",500,TypeError),FST_ERR_HANDLER_TIMEOUT:W0("FST_ERR_HANDLER_TIMEOUT","Request timed out after %s ms on route '%s'",503),FST_ERR_ROUTE_HANDLER_TIMEOUT_OPTION_NOT_INT:W0("FST_ERR_ROUTE_HANDLER_TIMEOUT_OPTION_NOT_INT","'handlerTimeout' option must be an integer > 0. Got '%s'",500,TypeError),FST_ERR_ROUTE_REWRITE_NOT_STR:W0("FST_ERR_ROUTE_REWRITE_NOT_STR",'Rewrite url for "%s" needs to be of type "string" but received "%s"',500,TypeError),FST_ERR_REOPENED_CLOSE_SERVER:W0("FST_ERR_REOPENED_CLOSE_SERVER","Fastify has already been closed and cannot be reopened"),FST_ERR_REOPENED_SERVER:W0("FST_ERR_REOPENED_SERVER","Fastify is already listening"),FST_ERR_INSTANCE_ALREADY_LISTENING:W0("FST_ERR_INSTANCE_ALREADY_LISTENING","Fastify instance is already listening. %s"),FST_ERR_PLUGIN_VERSION_MISMATCH:W0("FST_ERR_PLUGIN_VERSION_MISMATCH","fastify-plugin: %s - expected '%s' fastify version, '%s' is installed"),FST_ERR_PLUGIN_NOT_PRESENT_IN_INSTANCE:W0("FST_ERR_PLUGIN_NOT_PRESENT_IN_INSTANCE","The decorator '%s'%s is not present in %s"),FST_ERR_PLUGIN_INVALID_ASYNC_HANDLER:W0("FST_ERR_PLUGIN_INVALID_ASYNC_HANDLER","The %s plugin being registered mixes async and callback styles. Async plugin should not mix async and callback style.",500,TypeError),FST_ERR_PLUGIN_CALLBACK_NOT_FN:W0("FST_ERR_PLUGIN_CALLBACK_NOT_FN","fastify-plugin: %s",500,TypeError),FST_ERR_PLUGIN_NOT_VALID:W0("FST_ERR_PLUGIN_NOT_VALID","fastify-plugin: %s"),FST_ERR_ROOT_PLG_BOOTED:W0("FST_ERR_ROOT_PLG_BOOTED","fastify-plugin: %s"),FST_ERR_PARENT_PLUGIN_BOOTED:W0("FST_ERR_PARENT_PLUGIN_BOOTED","fastify-plugin: %s"),FST_ERR_PLUGIN_TIMEOUT:W0("FST_ERR_PLUGIN_TIMEOUT","fastify-plugin: %s")};function R10($,Z){return Z.cause=$,Z}k4.exports=d5;k4.exports.appendStackTrace=R10;k4.exports.AVVIO_ERRORS_MAP={AVV_ERR_CALLBACK_NOT_FN:d5.FST_ERR_PLUGIN_CALLBACK_NOT_FN,AVV_ERR_PLUGIN_NOT_VALID:d5.FST_ERR_PLUGIN_NOT_VALID,AVV_ERR_ROOT_PLG_BOOTED:d5.FST_ERR_ROOT_PLG_BOOTED,AVV_ERR_PARENT_PLG_LOADED:d5.FST_ERR_PARENT_PLUGIN_BOOTED,AVV_ERR_READY_TIMEOUT:d5.FST_ERR_PLUGIN_TIMEOUT,AVV_ERR_PLUGIN_EXEC_TIMEOUT:d5.FST_ERR_PLUGIN_TIMEOUT}});var uZ=S((Ef0,aR)=>{var P10=["onRoute","onRegister","onReady","onListen","preClose","onClose"],iR=["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError","onRequestAbort"],I10=iR.concat(P10),{FST_ERR_HOOK_INVALID_TYPE:C10,FST_ERR_HOOK_INVALID_HANDLER:E10,FST_ERR_SEND_UNDEFINED_ERR:v4,FST_ERR_HOOK_TIMEOUT:b10,FST_ERR_HOOK_NOT_SUPPORTED:_10,AVVIO_ERRORS_MAP:dR,appendStackTrace:pR}=w$(),{kChildren:IX,kHooks:nR,kRequestPayloadStream:cR}=H$();function CX(){this.onRequest=[],this.preParsing=[],this.preValidation=[],this.preSerialization=[],this.preHandler=[],this.onResponse=[],this.onSend=[],this.onError=[],this.onRoute=[],this.onRegister=[],this.onReady=[],this.onListen=[],this.onTimeout=[],this.onRequestAbort=[],this.preClose=[]}CX.prototype=Object.create(null);CX.prototype.validate=function($,Z){if(typeof $!=="string")throw new C10;if(Array.isArray(this[$])===!1)throw new _10($);if(typeof Z!=="function")throw new E10($,Object.prototype.toString.call(Z))};CX.prototype.add=function($,Z){this.validate($,Z),this[$].push(Z)};function S10($){let Z=new CX;return Z.onRequest=$.onRequest.slice(),Z.preParsing=$.preParsing.slice(),Z.preValidation=$.preValidation.slice(),Z.preSerialization=$.preSerialization.slice(),Z.preHandler=$.preHandler.slice(),Z.onSend=$.onSend.slice(),Z.onResponse=$.onResponse.slice(),Z.onError=$.onError.slice(),Z.onRoute=$.onRoute.slice(),Z.onRegister=$.onRegister.slice(),Z.onTimeout=$.onTimeout.slice(),Z.onRequestAbort=$.onRequestAbort.slice(),Z.onReady=[],Z.onListen=[],Z.preClose=[],Z}function oR($,Z,J,Y){let X=J[nR][$],Q=0,G=0;K();function W(U){let H=X[Q-1]?.name,B=H?` "${H}"`:"";if(U){if(U.code==="AVV_ERR_READY_TIMEOUT")U=pR(U,new b10($,B));else U=dR[U.code]!=null?pR(U,new dR[U.code](U.message)):U;Y(U);return}Y()}function K(U){if(U){W(U);return}if(Q===X.length&&G===J[IX].length){if(Q===0&&G===0)W();else Z(function(B,z){W(B),z(B)});return}if(Q===X.length&&G<J[IX].length){let H=J[IX][G++];oR($,Z,H,K);return}Z(V(X[Q++],J)),K()}function V(U,H){return function(B,z){if(B){z(B);return}if(U.length===1){try{U.call(H,z)}catch(F){z(F)}return}try{let F=U.call(H);if(F&&typeof F.then==="function"){F.then(z,z);return}}catch(F){B=F}z(B)}}}function sR($){let Z=$[nR].onListen,J=Z.length,Y=0,X=0;Q();function Q(W){if(W&&$.log.error(W),Y===J){while(X<$[IX].length){let K=$[IX][X++];sR(K)}return}G(Z[Y++],$,Q)}async function G(W,K,V){if(W.length===1){try{W.call(K,V)}catch(U){V(U)}return}try{let U=W.call(K);if(U&&typeof U.then==="function"){U.then(V,V);return}V()}catch(U){V(U)}}}function LJ($){return function(J,Y,X,Q){let G=0;function W(U){if(U||G===J.length){Q(U,Y,X);return}let H;try{H=$(J[G++],Y,X,W)}catch(B){Q(B,Y,X);return}if(H&&typeof H.then==="function")H.then(K,V)}function K(){W()}function V(U){if(!U)U=new v4;Q(U,Y,X)}W()}}function f10($,Z,J,Y){return $(Z,J,Y)}var k10=LJ(f10),v10=LJ(EX),y10=LJ(EX),x10=LJ(EX),h10=LJ(EX);function rR($,Z,J,Y,X){let Q=0;function G(V,U){if(V){X(V,Z,J,Y);return}if(U!==void 0)Y=U;if(Q===$.length){X(null,Z,J,Y);return}let H;try{H=$[Q++](Z,J,Y,G)}catch(B){X(B,Z,J);return}if(H&&typeof H.then==="function")H.then(W,K)}function W(V){G(null,V)}function K(V){if(!V)V=new v4;X(V,Z,J,Y)}G()}var g10=rR;function u10($,Z,J,Y){let X=0;function Q(K,V){if(J.sent)return;if(V!==void 0)Z[cR]=V;if(K||X===$.length){Y(K,Z,J);return}let U;try{U=$[X++](Z,J,Z[cR],Q)}catch(H){Y(H,Z,J);return}if(U&&typeof U.then==="function")U.then(G,W)}function G(K){Q(null,K)}function W(K){if(!K)K=new v4;Y(K,Z,J)}Q()}function m10($,Z,J){let Y=0;function X(W){if(W||Y===$.length){J(W,Z);return}let K;try{K=$[Y++](Z,X)}catch(V){J(V,Z);return}if(K&&typeof K.then==="function")K.then(Q,G)}function Q(){X()}function G(W){if(!W)W=new v4;J(W,Z)}X()}function EX($,Z,J,Y){if(J.sent===!0)return;return $(Z,J,Y)}aR.exports={Hooks:CX,buildHooks:S10,hookRunnerGenerator:LJ,preParsingHookRunner:u10,onResponseHookRunner:k10,onSendHookRunner:rR,preSerializationHookRunner:g10,onRequestAbortHookRunner:m10,hookIterator:EX,hookRunnerApplication:oR,onListenHookRunner:sR,preHandlerHookRunner:y10,preValidationHookRunner:v10,onRequestHookRunner:h10,onTimeoutHookRunner:x10,lifecycleHooks:iR,supportedHooks:I10}});var eR=S((bf0,tR)=>{tR.exports=function(){return{[Symbol.iterator]:function*(){},add(){},delete(){},has(){return!0}}}});var uH=S((_f0,ZP)=>{var{kTestInternals:l10}=H$();function $P(){let $,Z;return{promise:new Promise((Y,X)=>{$=Y,Z=X}),resolve:$,reject:Z}}ZP.exports={withResolvers:typeof Promise.withResolvers==="function"?Promise.withResolvers.bind(Promise):$P,[l10]:{withResolvers:$P}}});var BP=S((Y$0,HP)=>{var d10=Y0("http"),p10=Y0("https"),JP=Y0("http2"),c10=Y0("dns"),i10=Y0("os"),{kState:G$,kOptions:n10,kServerBindings:o10,kHttp2ServerSessions:p5}=H$(),{FSTWRN003:s10}=wJ(),{onListenHookRunner:y4}=uZ(),{FST_ERR_REOPENED_CLOSE_SERVER:XP,FST_ERR_REOPENED_SERVER:QP,FST_ERR_LISTEN_OPTIONS_INVALID:r10,FST_ERR_FORCE_CLOSE_CONNECTIONS_IDLE_NOT_AVAILABLE:a10}=w$(),t10=eR(),GP=uH();Y$0.createServer=e10;function WP($){return`Server listening at ${$}`}function e10($,Z){let J=VP($,Z);function Y(V={port:0,host:"localhost"},U=void 0){if(typeof U==="function"){if(U.constructor.name==="AsyncFunction")s10("listen method");V.cb=U}if(V.signal){if(typeof V.signal.on!=="function"&&typeof V.signal.addEventListener!=="function")throw new r10("Invalid options.signal");if(this[G$].aborted=V.signal.aborted,this[G$].aborted)return this.close();else{let B=()=>{this[G$].aborted=!0,this.close()};V.signal.addEventListener("abort",B,{once:!0})}}let H;if(V.path==null)H=V.host??"localhost";else H=V.host;if(!Object.hasOwn(V,"host")||V.host==null)V.host=H;if(H==="localhost")V.cb=(B,z)=>{if(B){U(B,z);return}YP.call(this,J,Z,$,V,()=>{this[G$].listening=!0,U(null,z),y4(this)})};else V.cb=(B,z)=>{if(B){U(B,z);return}this[G$].listening=!0,U(null,z),y4(this)};if(U===void 0)return $$0.call(this,J,V).then((z)=>{let{promise:F,resolve:A}=GP.withResolvers();if(H==="localhost")YP.call(this,J,Z,$,V,()=>{this[G$].listening=!0,A(z),y4(this)});else A(z),y4(this);return F});this.ready(KP.call(this,J,V))}let X=typeof J.closeAllConnections==="function",Q=typeof J.closeIdleConnections==="function",G=typeof J.closeHttp2Sessions==="function",W=$.forceCloseConnections;if(W==="idle"&&!Q)throw new a10;else if(typeof W!=="boolean")W=Q?"idle":!1;let K=!X&&W===!0?new Set:t10();return{server:J,listen:Y,forceCloseConnections:W,serverHasCloseAllConnections:X,serverHasCloseHttp2Sessions:G,keepAliveConnections:K}}function YP($,Z,J,Y,X){this[G$].listening=!1,c10.lookup(Y.host,{all:!0},(Q,G)=>{if(Q||this[G$].aborted){X();return}let W=$.listening&&J.serverFactory,K=0,V=0;if(!W){let H=$.address();for(let B of G)if(B.address!==H.address){K++;let z=Object.assign({},Y,{host:B.address,port:H.port,cb:(j)=>{if(V++,!j)this[o10].push(F);if(V===K)X()}}),F=VP(J,Z),A=()=>{if(F.close(()=>{}),typeof F.closeAllConnections==="function"&&J.forceCloseConnections===!0)F.closeAllConnections();if(typeof F.closeHttp2Sessions==="function")F.closeHttp2Sessions()};F.on("upgrade",$.emit.bind($,"upgrade")),$.on("unref",A),$.on("close",A),$.on("error",A),this[G$].listening=!1,KP.call(this,F,z)()}}if(K===0){X();return}let U=$.unref;$.unref=function(){U.call($),$.emit("unref")}})}function KP($,Z){let J=(Y)=>{if($.removeListener("error",J),$.removeListener("listening",J),!Y){let X=UP.call(this,$,Z.listenTextResolver||WP);Z.cb(null,X)}else this[G$].listening=!1,Z.cb(Y,null)};return(Y)=>{if(Y!=null)return Z.cb(Y);if(this[G$].listening&&this[G$].closing)return Z.cb(new XP,null);if(this[G$].listening)return Z.cb(new QP,null);if($.once("error",J),!this[G$].closing)$.once("listening",J),$.listen(Z),this[G$].listening=!0}}function $$0($,Z){if(this[G$].listening&&this[G$].closing)return Promise.reject(new XP);if(this[G$].listening)return Promise.reject(new QP);return this.ready().then(()=>{if(this[G$].aborted)return;let{promise:J,resolve:Y,reject:X}=GP.withResolvers(),Q=(K)=>{W(),this[G$].listening=!1,X(K)},G=()=>{W(),this[G$].listening=!0,Y(UP.call(this,$,Z.listenTextResolver||WP))};function W(){$.removeListener("error",Q),$.removeListener("listening",G)}return $.once("error",Q),$.once("listening",G),$.listen(Z),J})}function VP($,Z){if($.serverFactory)return $.serverFactory(Z,$);let J=$.https===!0?{}:$.https;if($.http2){let X=typeof J==="object"?JP.createSecureServer(J,Z):JP.createServer($.http,Z);if(X.on("session",(Q)=>Q.setTimeout($.http2SessionTimeout,()=>{Q.close()})),$.forceCloseConnections===!0)X.closeHttp2Sessions=J$0(X);return X.setTimeout($.connectionTimeout),X}let Y=J?p10.createServer(J,Z):d10.createServer($.http,Z);if(Y.keepAliveTimeout=$.keepAliveTimeout,Y.requestTimeout=$.requestTimeout,Y.setTimeout($.connectionTimeout),$.maxRequestsPerSocket>0)Y.maxRequestsPerSocket=$.maxRequestsPerSocket;return Y}function Z$0($){if($.address==="0.0.0.0")return Object.values(i10.networkInterfaces()).flatMap((Z)=>{return Z.filter((J)=>J.family==="IPv4")}).sort((Z)=>{return Z.internal?-1:1}).map((Z)=>{return Z.address});return[$.address]}function UP($,Z){let J;if(typeof $.address()!=="string"){if($.address().address.indexOf(":")===-1)J=Z$0($.address()).map((X)=>X+":"+$.address().port);else J=["["+$.address().address+"]:"+$.address().port];J=J.map((X)=>"http"+(this[n10].https?"s":"")+"://"+X)}else J=[$.address()];for(let X of J)this.log.info(Z(X));return J[0]}function J$0($){return $[p5]=new Set,$.on("session",function(Z){Z.once("connect",function(){$[p5].add(Z)}),Z.once("close",function(){$[p5].delete(Z)}),Z.once("frameError",function(J,Y,X){if(X===0)$[p5].delete(Z)}),Z.once("goaway",function(){$[p5].delete(Z)})}),function(){if($[p5].size===0)return;for(let J of $[p5])J.close()}}});var lH=S((Sf0,OP)=>{var mH=/(?:^|;)\s*([\w!#$%&'*+.^`|~-]+)=([^;]*)/gm,zP=/^[\w!#$%&'*+.^`|~-]+$/,FP=/^[\w!#$%&'*+.^`|~-]+\s*$/;class AP{#$=!1;#Z=!0;#J="";#Y="";#X=new Map;#Q;constructor($){if($==null||$===""||$==="undefined")return;let Z=$.indexOf(";");if(Z===-1){if(Z=$.indexOf("/"),Z===-1)return;let W=$.slice(0,Z).trimStart().toLowerCase(),K=$.slice(Z+1).trimEnd().toLowerCase();if(zP.test(W)===!0&&FP.test(K)===!0)this.#$=!0,this.#Z=!1,this.#J=W,this.#Y=K;return}let J=$.slice(0,Z).toLowerCase(),Y=$.slice(Z+1).trim();if(Z=J.indexOf("/"),Z===-1)return;let X=J.slice(0,Z).trimStart(),Q=J.slice(Z+1).trimEnd();if(zP.test(X)===!1||FP.test(Q)===!1)return;this.#J=X,this.#Y=Q,this.#$=!0,this.#Z=!1;let G=mH.exec(Y);while(G){let W=G[1],K=G[2];if(K[0]==='"'){if(K.at(-1)!=='"'){this.#X.set(W,"invalid quoted string"),G=mH.exec(Y);continue}this.#X.set(W,K.slice(1,K.length-1))}else this.#X.set(W,K);G=mH.exec(Y)}}get[Symbol.toStringTag](){return"ContentType"}get isEmpty(){return this.#Z}get isValid(){return this.#$}get mediaType(){return`${this.#J}/${this.#Y}`}get type(){return this.#J}get subtype(){return this.#Y}get parameters(){return this.#X}toString(){if(this.#Q)return this.#Q;let $=[];for(let[J,Y]of this.#X.entries())$.push(`${J}="${Y}"`);let Z=[this.#J,"/",this.#Y];if($.length>0)Z.push("; "),Z.push($.join("; "));return this.#Q=Z.join(""),this.#Q}}OP.exports=AP});var x4=S((ff0,qP)=>{var{kReplyHasStatusCode:Q$0}=H$();function G$0($,Z){if(!$[Q$0]||$.statusCode===200){let J=Z&&(Z.statusCode||Z.status);$.code(J>=400?J:500)}}qP.exports={setErrorStatusCode:G$0}});var dH=S((kf0,NP)=>{var{kReplyIsError:jP,kReplyHijacked:W$0}=H$(),{setErrorStatusCode:K$0}=x4(),V$0=Y0("diagnostics_channel"),bX=V$0.tracingChannel("fastify.request.handler");function U$0($,Z,J){if(J)J.async=!0;$.then(function(Y){if(Z[W$0]===!0)return;if(J)bX.asyncStart.publish(J);try{if(Y!==void 0||Z.sent===!1&&Z.raw.headersSent===!1&&Z.request.raw.aborted===!1&&Z.request.socket&&!Z.request.socket.destroyed)try{Z.send(Y)}catch(X){Z[jP]=!0,Z.send(X)}}finally{if(J)bX.asyncEnd.publish(J)}},function(Y){if(J)J.error=Y,K$0(Z,Y),bX.error.publish(J),bX.asyncStart.publish(J);try{if(Z.sent===!0){Z.log.error({err:Y},"Promise errored, but reply.sent = true was set");return}Z[jP]=!0,Z.send(Y)}catch(X){Z.send(X)}finally{if(J)bX.asyncEnd.publish(J)}})}NP.exports=U$0});var iH=S((vf0,DP)=>{var{kSchemaHeaders:u4,kSchemaParams:pH,kSchemaQuerystring:cH,kSchemaBody:c5,kSchemaResponse:MP}=H$(),H$0=/^[1-5](?:\d{2}|xx)$|^default$/,{FST_ERR_SCH_RESPONSE_SCHEMA_NOT_NESTED_2XX:B$0}=w$(),{FSTWRN001:h4}=wJ();function z$0($,Z){if(!$.schema||!$.schema.response)return;let{method:J,url:Y}=$.config||{};$[MP]=Object.keys($.schema.response).reduce(function(X,Q){let G=$.schema.response[Q];if(Q=Q.toLowerCase(),!H$0.test(Q))throw new B$0;if(G.content){let W={};for(let K of Object.keys(G.content)){let V=G.content[K].schema;W[K]=Z({schema:V,url:Y,method:J,httpStatus:Q,contentType:K})}X[Q]=W}else X[Q]=Z({schema:G,url:Y,method:J,httpStatus:Q});return X},{})}function F$0($,Z,J){let{schema:Y}=$;if(!Y)return;let{method:X,url:Q}=$.config||{},G=Y.headers;if(G&&(J||Object.getPrototypeOf(G)!==Object.prototype))$[u4]=Z({schema:G,method:X,url:Q,httpPart:"headers"});else if(G){let W={};if(Object.keys(G).forEach((K)=>{W[K]=G[K]}),W.required instanceof Array)W.required=W.required.map((K)=>K.toLowerCase());if(G.properties)W.properties={},Object.keys(G.properties).forEach((K)=>{W.properties[K.toLowerCase()]=G.properties[K]});$[u4]=Z({schema:W,method:X,url:Q,httpPart:"headers"})}else if(Object.hasOwn(Y,"headers"))h4("headers",X,Q);if(Y.body){let W=Y.body.content;if(W){let K={};for(let V of Object.keys(W)){let U=W[V].schema;K[V]=Z({schema:U,method:X,url:Q,httpPart:"body",contentType:V})}$[c5]=K}else $[c5]=Z({schema:Y.body,method:X,url:Q,httpPart:"body"})}else if(Object.hasOwn(Y,"body"))h4("body",X,Q);if(Y.querystring)$[cH]=Z({schema:Y.querystring,method:X,url:Q,httpPart:"querystring"});else if(Object.hasOwn(Y,"querystring"))h4("querystring",X,Q);if(Y.params)$[pH]=Z({schema:Y.params,method:X,url:Q,httpPart:"params"});else if(Object.hasOwn(Y,"params"))h4("params",X,Q)}function g4($,Z,J){let Y=Z[J]===void 0,X;try{X=$?.(Y?null:Z[J])}catch(G){return G.statusCode=500,G}if(X&&typeof X.then==="function")return X.then((G)=>{return Q(G)}).catch((G)=>{return G});return Q(X);function Q(G){if(G===!1)return $.errors;if(G&&G.error)return G.error;if(G&&G.value)Z[J]=G.value;return!1}}function m4($,Z,J){let Y=J===void 0;if(Y||!J.skipParams){let Q=g4($[pH],Z,"params");if(Q)if(typeof Q.then!=="function")return mZ(Q,"params",$.schemaErrorFormatter);else return A$0(Q,$,Z)}if(Y||!J.skipBody){let Q=null;if(typeof $[c5]==="function")Q=$[c5];else if($[c5]){let W=N$0(Z.headers["content-type"]),K=$[c5][W];if(K)Q=K}let G=g4(Q,Z,"body");if(G)if(typeof G.then!=="function")return mZ(G,"body",$.schemaErrorFormatter);else return O$0(G,$,Z)}if(Y||!J.skipQuery){let Q=g4($[cH],Z,"query");if(Q)if(typeof Q.then!=="function")return mZ(Q,"querystring",$.schemaErrorFormatter);else return q$0(Q,$,Z)}let X=g4($[u4],Z,"headers");if(X)if(typeof X.then!=="function")return mZ(X,"headers",$.schemaErrorFormatter);else return j$0(X,$,Z);return!1}function A$0($,Z,J){return $.then((Y)=>{if(Y)return mZ(Y,"params",Z.schemaErrorFormatter);return m4(Z,J,{skipParams:!0})})}function O$0($,Z,J){return $.then((Y)=>{if(Y)return mZ(Y,"body",Z.schemaErrorFormatter);return m4(Z,J,{skipParams:!0,skipBody:!0})})}function q$0($,Z,J){return $.then((Y)=>{if(Y)return mZ(Y,"querystring",Z.schemaErrorFormatter);return m4(Z,J,{skipParams:!0,skipBody:!0,skipQuery:!0})})}function j$0($,Z,J){return $.then((Y)=>{if(Y)return mZ(Y,"headers",Z.schemaErrorFormatter);return!1})}function mZ($,Z,J){if($ instanceof Error)return $.statusCode=$.statusCode||400,$.code=$.code||"FST_ERR_VALIDATION",$.validationContext=$.validationContext||Z,$;let Y=J($,Z);return Y.statusCode=Y.statusCode||400,Y.code=Y.code||"FST_ERR_VALIDATION",Y.validation=$,Y.validationContext=Z,Y}function N$0($){if(!$)return"";return $.trimStart().split(/[ ;]/,1)[0].trim().toLowerCase()}DP.exports={symbols:{bodySchema:c5,querystringSchema:cH,responseSchema:MP,paramsSchema:pH,headersSchema:u4},compileSchemasForValidation:F$0,compileSchemasForSerialization:z$0,validate:m4}});var rH=S((yf0,sH)=>{var M$0=Y0("diagnostics_channel"),D$0=lH(),w$0=dH(),{validate:L$0}=iH(),{preValidationHookRunner:T$0,preHandlerHookRunner:R$0}=uZ(),{FST_ERR_CTP_INVALID_MEDIA_TYPE:P$0}=w$(),{setErrorStatusCode:wP}=x4(),{kReplyIsError:SX,kRouteContext:P6,kFourOhFourContext:I$0,kSupportedHTTPMethods:LP}=H$(),_X=M$0.tracingChannel("fastify.request.handler");function C$0($,Z,J){if(J.sent===!0)return;if($!=null){J[SX]=!0,J.send($);return}let Y=Z.method;if(this[LP].bodyless.has(Y)){TJ(Z,J);return}if(this[LP].bodywith.has(Y)){let X=Z.headers,Q=X["content-type"];if(Q===void 0){let W=X["content-length"];if(X["transfer-encoding"]===void 0&&(W===void 0||W==="0")){TJ(Z,J);return}Z[P6].contentTypeParser.run("",TJ,Z,J);return}let G=new D$0(Q);if(G.isValid===!1){J[SX]=!0,J.status(415).send(new P$0);return}Z[P6].contentTypeParser.run(G.toString(),TJ,Z,J);return}TJ(Z,J)}function TJ($,Z){try{if($[P6].preValidation!==null)T$0($[P6].preValidation,$,Z,nH);else nH(null,$,Z)}catch(J){nH(J,$,Z)}}function nH($,Z,J){if(J.sent===!0)return;if($!=null){J[SX]=!0,J.send($);return}let Y=L$0(J[P6],Z);if(Y&&typeof Y.then==="function"||!1){let Q=TP.bind(null,Z,J);Y.then(Q,Q)}else TP(Z,J,Y)}function TP($,Z,J){if(J){if(Z[P6].attachValidation===!1){Z.send(J);return}Z.request.validationError=J}if($[P6].preHandler!==null)R$0($[P6].preHandler,$,Z,oH);else oH(null,$,Z)}function oH($,Z,J){if(J.sent)return;let Y=Z[P6];if(!_X.hasSubscribers||Y[I$0]===null)RP($,Z,J);else{let X={request:Z,reply:J,async:!1,route:{url:Y.config.url,method:Y.config.method}};_X.start.runStores(X,RP,void 0,$,Z,J,X)}}function RP($,Z,J,Y){let X=Z[P6];try{if($!=null){if(J[SX]=!0,Y)Y.error=$,wP(J,$),_X.error.publish(Y);J.send($);return}let Q;try{Q=X.handler(Z,J)}catch(G){if(Y)Y.error=G,wP(J,G),_X.error.publish(Y);J[SX]=!0,J.send(G);return}if(Q!==void 0)if(Q!==null&&typeof Q.then==="function")w$0(Q,J,Y);else J.send(Q)}finally{if(Y)_X.end.publish(Y)}}sH.exports=C$0;sH.exports[Symbol.for("internals")]={handler:TJ,preHandlerCallback:oH}});var IP=S((xf0,PP)=>{function RJ(){}var E$0={fatal:RJ,error:RJ,warn:RJ,info:RJ,debug:RJ,trace:RJ};Object.defineProperty(PP,"exports",{get(){return Object.create(E$0)}})});var tH=S((hf0,bP)=>{var fX=($)=>{return $&&typeof $.message==="string"},aH=($)=>{if(!$)return;let Z=$.cause;if(typeof Z==="function"){let J=$.cause();return fX(J)?J:void 0}else return fX(Z)?Z:void 0},CP=($,Z)=>{if(!fX($))return"";let J=$.stack||"";if(Z.has($))return J+`
|
|
85
|
+
causes have become circular...`;let Y=aH($);if(Y)return Z.add($),J+`
|
|
86
|
+
caused by: `+CP(Y,Z);else return J},b$0=($)=>CP($,new Set),EP=($,Z,J)=>{if(!fX($))return"";let Y=J?"":$.message||"";if(Z.has($))return Y+": ...";let X=aH($);if(X){Z.add($);let Q=typeof $.cause==="function";return Y+(Q?"":": ")+EP(X,Z,Q)}else return Y},_$0=($)=>EP($,new Set);bP.exports={isErrorLike:fX,getErrorCause:aH,stackWithCauses:b$0,messageWithCauses:_$0}});var eH=S((gf0,SP)=>{var S$0=Symbol("circular-ref-tag"),l4=Symbol("pino-raw-err-ref"),_P=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[l4]},set:function($){this[l4]=$}}});Object.defineProperty(_P,l4,{writable:!0,value:{}});SP.exports={pinoErrProto:_P,pinoErrorSymbols:{seen:S$0,rawSymbol:l4}}});var vP=S((uf0,kP)=>{kP.exports=ZB;var{messageWithCauses:f$0,stackWithCauses:k$0,isErrorLike:fP}=tH(),{pinoErrProto:v$0,pinoErrorSymbols:y$0}=eH(),{seen:$B}=y$0,{toString:x$0}=Object.prototype;function ZB($){if(!fP($))return $;$[$B]=void 0;let Z=Object.create(v$0);if(Z.type=x$0.call($.constructor)==="[object Function]"?$.constructor.name:$.name,Z.message=f$0($),Z.stack=k$0($),Array.isArray($.errors))Z.aggregateErrors=$.errors.map((J)=>ZB(J));for(let J in $)if(Z[J]===void 0){let Y=$[J];if(fP(Y)){if(J!=="cause"&&!Object.prototype.hasOwnProperty.call(Y,$B))Z[J]=ZB(Y)}else Z[J]=Y}return delete $[$B],Z.raw=$,Z}});var xP=S((mf0,yP)=>{yP.exports=p4;var{isErrorLike:JB}=tH(),{pinoErrProto:h$0,pinoErrorSymbols:g$0}=eH(),{seen:d4}=g$0,{toString:u$0}=Object.prototype;function p4($){if(!JB($))return $;$[d4]=void 0;let Z=Object.create(h$0);if(Z.type=u$0.call($.constructor)==="[object Function]"?$.constructor.name:$.name,Z.message=$.message,Z.stack=$.stack,Array.isArray($.errors))Z.aggregateErrors=$.errors.map((J)=>p4(J));if(JB($.cause)&&!Object.prototype.hasOwnProperty.call($.cause,d4))Z.cause=p4($.cause);for(let J in $)if(Z[J]===void 0){let Y=$[J];if(JB(Y)){if(!Object.prototype.hasOwnProperty.call(Y,d4))Z[J]=p4(Y)}else Z[J]=Y}return delete $[d4],Z.raw=$,Z}});var mP=S((lf0,uP)=>{uP.exports={mapHttpRequest:m$0,reqSerializer:gP};var YB=Symbol("pino-raw-req-ref"),hP=Object.create({},{id:{enumerable:!0,writable:!0,value:""},method:{enumerable:!0,writable:!0,value:""},url:{enumerable:!0,writable:!0,value:""},query:{enumerable:!0,writable:!0,value:""},params:{enumerable:!0,writable:!0,value:""},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:""},remotePort:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[YB]},set:function($){this[YB]=$}}});Object.defineProperty(hP,YB,{writable:!0,value:{}});function gP($){let Z=$.info||$.socket,J=Object.create(hP);if(J.id=typeof $.id==="function"?$.id():$.id||($.info?$.info.id:void 0),J.method=$.method,$.originalUrl)J.url=$.originalUrl;else{let Y=$.path;J.url=typeof Y==="string"?Y:$.url?$.url.path||$.url:void 0}if($.query)J.query=$.query;if($.params)J.params=$.params;return J.headers=$.headers,J.remoteAddress=Z&&Z.remoteAddress,J.remotePort=Z&&Z.remotePort,J.raw=$.raw||$,J}function m$0($){return{req:gP($)}}});var cP=S((df0,pP)=>{pP.exports={mapHttpResponse:l$0,resSerializer:dP};var XB=Symbol("pino-raw-res-ref"),lP=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[XB]},set:function($){this[XB]=$}}});Object.defineProperty(lP,XB,{writable:!0,value:{}});function dP($){let Z=Object.create(lP);return Z.statusCode=$.headersSent?$.statusCode:null,Z.headers=$.getHeaders?$.getHeaders():$._headers,Z.raw=$,Z}function l$0($){return{res:dP($)}}});var GB=S((pf0,iP)=>{var QB=vP(),d$0=xP(),c4=mP(),i4=cP();iP.exports={err:QB,errWithCause:d$0,mapHttpRequest:c4.mapHttpRequest,mapHttpResponse:i4.mapHttpResponse,req:c4.reqSerializer,res:i4.resSerializer,wrapErrorSerializer:function(Z){if(Z===QB)return Z;return function(Y){return Z(QB(Y))}},wrapRequestSerializer:function(Z){if(Z===c4.reqSerializer)return Z;return function(Y){return Z(c4.reqSerializer(Y))}},wrapResponseSerializer:function(Z){if(Z===i4.resSerializer)return Z;return function(Y){return Z(i4.resSerializer(Y))}}}});var WB=S((cf0,nP)=>{function p$0($,Z){return Z}nP.exports=function(){let Z=Error.prepareStackTrace;Error.prepareStackTrace=p$0;let J=Error().stack;if(Error.prepareStackTrace=Z,!Array.isArray(J))return;let Y=J.slice(2),X=[];for(let Q of Y){if(!Q)continue;X.push(Q.getFileName())}return X}});var eP=S((if0,tP)=>{function KB($){if($===null||typeof $!=="object")return $;if($ instanceof Date)return new Date($.getTime());if($ instanceof Array){let Z=[];for(let J=0;J<$.length;J++)Z[J]=KB($[J]);return Z}if(typeof $==="object"){let Z=Object.create(Object.getPrototypeOf($));for(let J in $)if(Object.prototype.hasOwnProperty.call($,J))Z[J]=KB($[J]);return Z}return $}function oP($){let Z=[],J="",Y=!1,X=!1,Q="";for(let G=0;G<$.length;G++){let W=$[G];if(!Y&&W==="."){if(J)Z.push(J),J=""}else if(W==="["){if(J)Z.push(J),J="";Y=!0}else if(W==="]"&&Y)Z.push(J),J="",Y=!1,X=!1;else if((W==='"'||W==="'")&&Y)if(!X)X=!0,Q=W;else if(W===Q)X=!1,Q="";else J+=W;else J+=W}if(J)Z.push(J);return Z}function sP($,Z,J){let Y=$;for(let Q=0;Q<Z.length-1;Q++){let G=Z[Q];if(typeof Y!=="object"||Y===null||!(G in Y))return!1;if(typeof Y[G]!=="object"||Y[G]===null)return!1;Y=Y[G]}let X=Z[Z.length-1];if(X==="*"){if(Array.isArray(Y))for(let Q=0;Q<Y.length;Q++)Y[Q]=J;else if(typeof Y==="object"&&Y!==null){for(let Q in Y)if(Object.prototype.hasOwnProperty.call(Y,Q))Y[Q]=J}}else if(typeof Y==="object"&&Y!==null&&X in Y&&Object.prototype.hasOwnProperty.call(Y,X))Y[X]=J;return!0}function rP($,Z){let J=$;for(let X=0;X<Z.length-1;X++){let Q=Z[X];if(typeof J!=="object"||J===null||!(Q in J))return!1;if(typeof J[Q]!=="object"||J[Q]===null)return!1;J=J[Q]}let Y=Z[Z.length-1];if(Y==="*"){if(Array.isArray(J))for(let X=0;X<J.length;X++)J[X]=void 0;else if(typeof J==="object"&&J!==null){for(let X in J)if(Object.prototype.hasOwnProperty.call(J,X))delete J[X]}}else if(typeof J==="object"&&J!==null&&Y in J&&Object.prototype.hasOwnProperty.call(J,Y))delete J[Y];return!0}var n4=Symbol("PATH_NOT_FOUND");function c$0($,Z){let J=$;for(let Y of Z){if(J===null||J===void 0)return n4;if(typeof J!=="object"||J===null)return n4;if(!(Y in J))return n4;J=J[Y]}return J}function i$0($,Z){let J=$;for(let Y of Z){if(J===null||J===void 0)return;if(typeof J!=="object"||J===null)return;J=J[Y]}return J}function n$0($,Z,J,Y=!1){for(let X of Z){let Q=oP(X);if(Q.includes("*"))aP($,Q,J,X,Y);else if(Y)rP($,Q);else{let G=c$0($,Q);if(G===n4)continue;let W=typeof J==="function"?J(G,Q):J;sP($,Q,W)}}}function aP($,Z,J,Y,X=!1){let Q=Z.indexOf("*");if(Q===Z.length-1){let G=Z.slice(0,-1),W=$;for(let K of G){if(W===null||W===void 0)return;if(typeof W!=="object"||W===null)return;W=W[K]}if(Array.isArray(W))if(X)for(let K=0;K<W.length;K++)W[K]=void 0;else for(let K=0;K<W.length;K++){let V=[...G,K.toString()],U=typeof J==="function"?J(W[K],V):J;W[K]=U}else if(typeof W==="object"&&W!==null)if(X){let K=[];for(let V in W)if(Object.prototype.hasOwnProperty.call(W,V))K.push(V);for(let V of K)delete W[V]}else for(let K in W){let V=[...G,K],U=typeof J==="function"?J(W[K],V):J;W[K]=U}}else o$0($,Z,J,Q,Y,X)}function o$0($,Z,J,Y,X,Q=!1){let G=Z.slice(0,Y),W=Z.slice(Y+1),K=[];function V(U,H){if(H===G.length){if(Array.isArray(U))for(let B=0;B<U.length;B++)K[H]=B.toString(),V(U[B],H+1);else if(typeof U==="object"&&U!==null)for(let B in U)K[H]=B,V(U[B],H+1)}else if(H<G.length){let B=G[H];if(U&&typeof U==="object"&&U!==null&&B in U)K[H]=B,V(U[B],H+1)}else if(W.includes("*"))aP(U,W,typeof J==="function"?(z,F)=>{let A=[...K.slice(0,H),...F];return J(z,A)}:J,X,Q);else if(Q)rP(U,W);else{let B=typeof J==="function"?J(i$0(U,W),[...K.slice(0,H),...W]):J;sP(U,W,B)}}if(G.length===0)V($,0);else{let U=$;for(let H=0;H<G.length;H++){let B=G[H];if(U===null||U===void 0)return;if(typeof U!=="object"||U===null)return;U=U[B],K[H]=B}if(U!==null&&U!==void 0)V(U,G.length)}}function s$0($){if($.length===0)return null;let Z=new Map;for(let J of $){let Y=oP(J),X=Z;for(let Q=0;Q<Y.length;Q++){let G=Y[Q];if(!X.has(G))X.set(G,new Map);X=X.get(G)}}return Z}function r$0($,Z){if(!Z)return $;function J(Y,X,Q=0){if(!X||X.size===0)return Y;if(Y===null||typeof Y!=="object")return Y;if(Y instanceof Date)return new Date(Y.getTime());if(Array.isArray(Y)){let W=[];for(let K=0;K<Y.length;K++){let V=K.toString();if(X.has(V)||X.has("*"))W[K]=J(Y[K],X.get(V)||X.get("*"));else W[K]=Y[K]}return W}let G=Object.create(Object.getPrototypeOf(Y));for(let W in Y)if(Object.prototype.hasOwnProperty.call(Y,W))if(X.has(W)||X.has("*"))G[W]=J(Y[W],X.get(W)||X.get("*"));else G[W]=Y[W];return G}return J($,Z)}function a$0($){if(typeof $!=="string")throw Error("Paths must be (non-empty) strings");if($==="")throw Error("Invalid redaction path ()");if($.includes(".."))throw Error(`Invalid redaction path (${$})`);if($.includes(","))throw Error(`Invalid redaction path (${$})`);let Z=0,J=!1,Y="";for(let X=0;X<$.length;X++){let Q=$[X];if((Q==='"'||Q==="'")&&Z>0){if(!J)J=!0,Y=Q;else if(Q===Y)J=!1,Y=""}else if(Q==="["&&!J)Z++;else if(Q==="]"&&!J){if(Z--,Z<0)throw Error(`Invalid redaction path (${$})`)}}if(Z!==0)throw Error(`Invalid redaction path (${$})`)}function t$0($){if(!Array.isArray($))throw TypeError("paths must be an array");for(let Z of $)a$0(Z)}function e$0($={}){let{paths:Z=[],censor:J="[REDACTED]",serialize:Y=JSON.stringify,strict:X=!0,remove:Q=!1}=$;t$0(Z);let G=s$0(Z);return function(K){if(X&&(K===null||typeof K!=="object")){if(K===null||K===void 0)return Y?Y(K):K;if(typeof K!=="object")return Y?Y(K):K}let V=r$0(K,G),U=K,H=J;if(typeof J==="function")H=J;if(n$0(V,Z,H,Q),Y===!1)return V.restore=function(){return KB(U)},V;if(typeof Y==="function")return Y(V);return JSON.stringify(V)}}tP.exports=e$0});var PJ=S((nf0,$I)=>{var $80=Symbol("pino.setLevel"),Z80=Symbol("pino.getLevel"),J80=Symbol("pino.levelVal"),Y80=Symbol("pino.levelComp"),X80=Symbol("pino.useLevelLabels"),Q80=Symbol("pino.useOnlyCustomLevels"),G80=Symbol("pino.mixin"),W80=Symbol("pino.lsCache"),K80=Symbol("pino.chindings"),V80=Symbol("pino.asJson"),U80=Symbol("pino.write"),H80=Symbol("pino.redactFmt"),B80=Symbol("pino.time"),z80=Symbol("pino.timeSliceIndex"),F80=Symbol("pino.stream"),A80=Symbol("pino.stringify"),O80=Symbol("pino.stringifySafe"),q80=Symbol("pino.stringifiers"),j80=Symbol("pino.end"),N80=Symbol("pino.formatOpts"),M80=Symbol("pino.messageKey"),D80=Symbol("pino.errorKey"),w80=Symbol("pino.nestedKey"),L80=Symbol("pino.nestedKeyStr"),T80=Symbol("pino.mixinMergeStrategy"),R80=Symbol("pino.msgPrefix"),P80=Symbol("pino.wildcardFirst"),I80=Symbol.for("pino.serializers"),C80=Symbol.for("pino.formatters"),E80=Symbol.for("pino.hooks"),b80=Symbol.for("pino.metadata");$I.exports={setLevelSym:$80,getLevelSym:Z80,levelValSym:J80,levelCompSym:Y80,useLevelLabelsSym:X80,mixinSym:G80,lsCacheSym:W80,chindingsSym:K80,asJsonSym:V80,writeSym:U80,serializersSym:I80,redactFmtSym:H80,timeSym:B80,timeSliceIndexSym:z80,streamSym:F80,stringifySym:A80,stringifySafeSym:O80,stringifiersSym:q80,endSym:j80,formatOptsSym:N80,messageKeySym:M80,errorKeySym:D80,nestedKeySym:w80,wildcardFirstSym:P80,needsMetadataGsym:b80,useOnlyCustomLevelsSym:Q80,formattersSym:C80,hooksSym:E80,nestedKeyStrSym:L80,mixinMergeStrategySym:T80,msgPrefixSym:R80}});var UB=S((of0,JI)=>{var ZI=eP(),{redactFmtSym:_80,wildcardFirstSym:o4}=PJ(),VB=/[^.[\]]+|\[([^[\]]*?)\]/g;function S80($,Z){let{paths:J,censor:Y,remove:X}=f80($),Q=J.reduce((K,V)=>{VB.lastIndex=0;let U=VB.exec(V),H=VB.exec(V),B=U[1]!==void 0?U[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,"$1"):U[0];if(B==="*")B=o4;if(H===null)return K[B]=null,K;if(K[B]===null)return K;let{index:z}=H,F=`${V.substr(z,V.length-1)}`;if(K[B]=K[B]||[],B!==o4&&K[B].length===0)K[B].push(...K[o4]||[]);if(B===o4)Object.keys(K).forEach(function(A){if(K[A])K[A].push(F)});return K[B].push(F),K},{}),G={[_80]:ZI({paths:J,censor:Y,serialize:Z,strict:!1,remove:X})},W=(...K)=>{return typeof Y==="function"?Z(Y(...K)):Z(Y)};return[...Object.keys(Q),...Object.getOwnPropertySymbols(Q)].reduce((K,V)=>{if(Q[V]===null)K[V]=(U)=>W(U,[V]);else{let U=typeof Y==="function"?(H,B)=>{return Y(H,[V,...B])}:Y;K[V]=ZI({paths:Q[V],censor:U,serialize:Z,strict:!1,remove:X})}return K},G)}function f80($){if(Array.isArray($))return $={paths:$,censor:"[Redacted]"},$;let{paths:Z,censor:J="[Redacted]",remove:Y}=$;if(Array.isArray(Z)===!1)throw Error("pino \u2013 redact must contain an array of strings");if(Y===!0)J=void 0;return{paths:Z,censor:J,remove:Y}}JI.exports=S80});var QI=S((sf0,XI)=>{var k80=()=>"",v80=()=>`,"time":${Date.now()}`,y80=()=>`,"time":${Math.round(Date.now()/1000)}`,x80=()=>`,"time":"${new Date(Date.now()).toISOString()}"`,h80=1000000n,YI=1000000000n,g80=BigInt(Date.now())*h80,u80=process.hrtime.bigint(),m80=()=>{let $=process.hrtime.bigint()-u80,Z=g80+$,J=Z/YI,Y=Z%YI,X=Number(J*1000n+Y/1000000n),Q=new Date(X),G=Q.getUTCFullYear(),W=(Q.getUTCMonth()+1).toString().padStart(2,"0"),K=Q.getUTCDate().toString().padStart(2,"0"),V=Q.getUTCHours().toString().padStart(2,"0"),U=Q.getUTCMinutes().toString().padStart(2,"0"),H=Q.getUTCSeconds().toString().padStart(2,"0");return`,"time":"${G}-${W}-${K}T${V}:${U}:${H}.${Y.toString().padStart(9,"0")}Z"`};XI.exports={nullTime:k80,epochTime:v80,unixTime:y80,isoTime:x80,isoTimeNano:m80}});var WI=S((rf0,GI)=>{function l80($){try{return JSON.stringify($)}catch(Z){return'"[Circular]"'}}GI.exports=d80;function d80($,Z,J){var Y=J&&J.stringify||l80,X=1;if(typeof $==="object"&&$!==null){var Q=Z.length+X;if(Q===1)return $;var G=Array(Q);G[0]=Y($);for(var W=1;W<Q;W++)G[W]=Y(Z[W]);return G.join(" ")}if(typeof $!=="string")return $;var K=Z.length;if(K===0)return $;var V="",U=1-X,H=-1,B=$&&$.length||0;for(var z=0;z<B;){if($.charCodeAt(z)===37&&z+1<B){switch(H=H>-1?H:0,$.charCodeAt(z+1)){case 100:case 102:if(U>=K)break;if(Z[U]==null)break;if(H<z)V+=$.slice(H,z);V+=Number(Z[U]),H=z+2,z++;break;case 105:if(U>=K)break;if(Z[U]==null)break;if(H<z)V+=$.slice(H,z);V+=Math.floor(Number(Z[U])),H=z+2,z++;break;case 79:case 111:case 106:if(U>=K)break;if(Z[U]===void 0)break;if(H<z)V+=$.slice(H,z);var F=typeof Z[U];if(F==="string"){V+="'"+Z[U]+"'",H=z+2,z++;break}if(F==="function"){V+=Z[U].name||"<anonymous>",H=z+2,z++;break}V+=Y(Z[U]),H=z+2,z++;break;case 115:if(U>=K)break;if(H<z)V+=$.slice(H,z);V+=String(Z[U]),H=z+2,z++;break;case 37:if(H<z)V+=$.slice(H,z);V+="%",H=z+2,z++,U--;break}++U}++z}if(H===-1)return $;else if(H<B)V+=$.slice(H);return V}});var BB=S((af0,HB)=>{if(typeof SharedArrayBuffer<"u"&&typeof Atomics<"u"){let Z=function(J){if((J>0&&J<1/0)===!1){if(typeof J!=="number"&&typeof J!=="bigint")throw TypeError("sleep: ms must be a number");throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity")}Atomics.wait($,0,0,Number(J))},$=new Int32Array(new SharedArrayBuffer(4));HB.exports=Z}else{let $=function(Z){if((Z>0&&Z<1/0)===!1){if(typeof Z!=="number"&&typeof Z!=="bigint")throw TypeError("sleep: ms must be a number");throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity")}let Y=Date.now()+Number(Z);while(Y>Date.now());};HB.exports=$}});var zI=S((tf0,BI)=>{var p1=Y0("fs"),p80=Y0("events"),c80=Y0("util").inherits,KI=Y0("path"),FB=BB(),i80=Y0("assert"),s4=Buffer.allocUnsafe(0),[n80,o80]=(process.versions.node||"0.0").split(".").map(Number),s80=n80>=22&&o80>=7;function VI($,Z){Z._opening=!0,Z._writing=!0,Z._asyncDrainScheduled=!1;function J(Q,G){if(Q){if(Z._reopening=!1,Z._writing=!1,Z._opening=!1,Z.sync)process.nextTick(()=>{if(Z.listenerCount("error")>0)Z.emit("error",Q)});else Z.emit("error",Q);return}let W=Z._reopening;if(Z.fd=G,Z.file=$,Z._reopening=!1,Z._opening=!1,Z._writing=!1,Z.sync)process.nextTick(()=>Z.emit("ready"));else Z.emit("ready");if(Z.destroyed)return;if(!Z._writing&&Z._len>Z.minLength||Z._flushPending)Z._actualWrite();else if(W)process.nextTick(()=>Z.emit("drain"))}let Y=Z.append?"a":"w",X=Z.mode;if(Z.sync)try{if(Z.mkdir)p1.mkdirSync(KI.dirname($),{recursive:!0});let Q=p1.openSync($,Y,X);J(null,Q)}catch(Q){throw J(Q),Q}else if(Z.mkdir)p1.mkdir(KI.dirname($),{recursive:!0},(Q)=>{if(Q)return J(Q);p1.open($,Y,X,J)});else p1.open($,Y,X,J)}function $6($){if(!(this instanceof $6))return new $6($);let{fd:Z,dest:J,minLength:Y,maxLength:X,maxWrite:Q,periodicFlush:G,sync:W,append:K=!0,mkdir:V,retryEAGAIN:U,fsync:H,contentMode:B,mode:z}=$||{};Z=Z||J,this._len=0,this.fd=-1,this._bufs=[],this._lens=[],this._writing=!1,this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._flushPending=!1,this._hwm=Math.max(Y||0,16387),this.file=null,this.destroyed=!1,this.minLength=Y||0,this.maxLength=X||0,this.maxWrite=Q||16384,this._periodicFlush=G||0,this._periodicFlushTimer=void 0,this.sync=W||!1,this.writable=!0,this._fsync=H||!1,this.append=K||!1,this.mode=z,this.retryEAGAIN=U||(()=>!0),this.mkdir=V||!1;let F,A;if(B==="buffer")this._writingBuf=s4,this.write=t80,this.flush=$60,this.flushSync=J60,this._actualWrite=X60,F=()=>p1.writeSync(this.fd,this._writingBuf),A=()=>p1.write(this.fd,this._writingBuf,this.release);else if(B===void 0||B==="utf8")this._writingBuf="",this.write=a80,this.flush=e80,this.flushSync=Z60,this._actualWrite=Y60,F=()=>{if(Buffer.isBuffer(this._writingBuf))return p1.writeSync(this.fd,this._writingBuf);return p1.writeSync(this.fd,this._writingBuf,"utf8")},A=()=>{if(Buffer.isBuffer(this._writingBuf))return p1.write(this.fd,this._writingBuf,this.release);return p1.write(this.fd,this._writingBuf,"utf8",this.release)};else throw Error(`SonicBoom supports "utf8" and "buffer", but passed ${B}`);if(typeof Z==="number")this.fd=Z,process.nextTick(()=>this.emit("ready"));else if(typeof Z==="string")VI(Z,this);else throw Error("SonicBoom supports only file descriptors and files");if(this.minLength>=this.maxWrite)throw Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);if(this.release=(j,N)=>{if(j){if((j.code==="EAGAIN"||j.code==="EBUSY")&&this.retryEAGAIN(j,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{FB(100),this.release(void 0,0)}catch(M){this.release(M)}else setTimeout(A,100);else this._writing=!1,this.emit("error",j);return}this.emit("write",N);let w=zB(this._writingBuf,this._len,N);if(this._len=w.len,this._writingBuf=w.writingBuf,this._writingBuf.length){if(!this.sync){A();return}try{do{let M=F(),C=zB(this._writingBuf,this._len,M);this._len=C.len,this._writingBuf=C.writingBuf}while(this._writingBuf.length)}catch(M){this.release(M);return}}if(this._fsync)p1.fsyncSync(this.fd);let q=this._len;if(this._reopening)this._writing=!1,this._reopening=!1,this.reopen();else if(q>this.minLength)this._actualWrite();else if(this._ending)if(q>0)this._actualWrite();else this._writing=!1,r4(this);else if(this._writing=!1,this.sync){if(!this._asyncDrainScheduled)this._asyncDrainScheduled=!0,process.nextTick(r80,this)}else this.emit("drain")},this.on("newListener",function(j){if(j==="drain")this._asyncDrainScheduled=!1}),this._periodicFlush!==0)this._periodicFlushTimer=setInterval(()=>this.flush(null),this._periodicFlush),this._periodicFlushTimer.unref()}function zB($,Z,J){if(typeof $==="string")$=Buffer.from($);return Z=Math.max(Z-J,0),$=$.subarray(J),{writingBuf:$,len:Z}}function r80($){if(!($.listenerCount("drain")>0))return;$._asyncDrainScheduled=!1,$.emit("drain")}c80($6,p80);function UI($,Z){if($.length===0)return s4;if($.length===1)return $[0];return Buffer.concat($,Z)}function a80($){if(this.destroyed)throw Error("SonicBoom destroyed");$=""+$;let Z=Buffer.byteLength($),J=this._len+Z,Y=this._bufs;if(this.maxLength&&J>this.maxLength)return this.emit("drop",$),this._len<this._hwm;if(Y.length===0||Buffer.byteLength(Y[Y.length-1])+Z>this.maxWrite)Y.push($);else Y[Y.length-1]+=$;if(this._len=J,!this._writing&&this._len>=this.minLength)this._actualWrite();return this._len<this._hwm}function t80($){if(this.destroyed)throw Error("SonicBoom destroyed");let Z=this._len+$.length,J=this._bufs,Y=this._lens;if(this.maxLength&&Z>this.maxLength)return this.emit("drop",$),this._len<this._hwm;if(J.length===0||Y[Y.length-1]+$.length>this.maxWrite)J.push([$]),Y.push($.length);else J[J.length-1].push($),Y[Y.length-1]+=$.length;if(this._len=Z,!this._writing&&this._len>=this.minLength)this._actualWrite();return this._len<this._hwm}function HI($){this._flushPending=!0;let Z=()=>{if(!this._fsync)try{p1.fsync(this.fd,(Y)=>{this._flushPending=!1,$(Y)})}catch(Y){$(Y)}else this._flushPending=!1,$();this.off("error",J)},J=(Y)=>{this._flushPending=!1,$(Y),this.off("drain",Z)};this.once("drain",Z),this.once("error",J)}function e80($){if($!=null&&typeof $!=="function")throw Error("flush cb must be a function");if(this.destroyed){let Z=Error("SonicBoom destroyed");if($){$(Z);return}throw Z}if(this.minLength<=0){$?.();return}if($)HI.call(this,$);if(this._writing)return;if(this._bufs.length===0)this._bufs.push("");this._actualWrite()}function $60($){if($!=null&&typeof $!=="function")throw Error("flush cb must be a function");if(this.destroyed){let Z=Error("SonicBoom destroyed");if($){$(Z);return}throw Z}if(this.minLength<=0){$?.();return}if($)HI.call(this,$);if(this._writing)return;if(this._bufs.length===0)this._bufs.push([]),this._lens.push(0);this._actualWrite()}$6.prototype.reopen=function($){if(this.destroyed)throw Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.reopen($)});return}if(this._ending)return;if(!this.file)throw Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");if($)this.file=$;if(this._reopening=!0,this._writing)return;let Z=this.fd;this.once("ready",()=>{if(Z!==this.fd)p1.close(Z,(J)=>{if(J)return this.emit("error",J)})}),VI(this.file,this)};$6.prototype.end=function(){if(this.destroyed)throw Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.end()});return}if(this._ending)return;if(this._ending=!0,this._writing)return;if(this._len>0&&this.fd>=0)this._actualWrite();else r4(this)};function Z60(){if(this.destroyed)throw Error("SonicBoom destroyed");if(this.fd<0)throw Error("sonic boom is not ready yet");if(!this._writing&&this._writingBuf.length>0)this._bufs.unshift(this._writingBuf),this._writingBuf="";let $="";while(this._bufs.length||$.length){if($.length<=0)$=this._bufs[0];try{let Z=Buffer.isBuffer($)?p1.writeSync(this.fd,$):p1.writeSync(this.fd,$,"utf8"),J=zB($,this._len,Z);if($=J.writingBuf,this._len=J.len,$.length<=0)this._bufs.shift()}catch(Z){if((Z.code==="EAGAIN"||Z.code==="EBUSY")&&!this.retryEAGAIN(Z,$.length,this._len-$.length))throw Z;FB(100)}}try{p1.fsyncSync(this.fd)}catch{}}function J60(){if(this.destroyed)throw Error("SonicBoom destroyed");if(this.fd<0)throw Error("sonic boom is not ready yet");if(!this._writing&&this._writingBuf.length>0)this._bufs.unshift([this._writingBuf]),this._writingBuf=s4;let $=s4;while(this._bufs.length||$.length){if($.length<=0)$=UI(this._bufs[0],this._lens[0]);try{let Z=p1.writeSync(this.fd,$);if($=$.subarray(Z),this._len=Math.max(this._len-Z,0),$.length<=0)this._bufs.shift(),this._lens.shift()}catch(Z){if((Z.code==="EAGAIN"||Z.code==="EBUSY")&&!this.retryEAGAIN(Z,$.length,this._len-$.length))throw Z;FB(100)}}}$6.prototype.destroy=function(){if(this.destroyed)return;r4(this)};function Y60(){let $=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:this._bufs.shift()||"",this.sync)try{let Z=Buffer.isBuffer(this._writingBuf)?p1.writeSync(this.fd,this._writingBuf):p1.writeSync(this.fd,this._writingBuf,"utf8");$(null,Z)}catch(Z){$(Z)}else p1.write(this.fd,this._writingBuf,$)}function X60(){let $=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:UI(this._bufs.shift(),this._lens.shift()),this.sync)try{let Z=p1.writeSync(this.fd,this._writingBuf);$(null,Z)}catch(Z){$(Z)}else{if(s80)this._writingBuf=Buffer.from(this._writingBuf);p1.write(this.fd,this._writingBuf,$)}}function r4($){if($.fd===-1){$.once("ready",r4.bind(null,$));return}if($._periodicFlushTimer!==void 0)clearInterval($._periodicFlushTimer);$.destroyed=!0,$._bufs=[],$._lens=[],i80(typeof $.fd==="number",`sonic.fd must be a number, got ${typeof $.fd}`);try{p1.fsync($.fd,Z)}catch{}function Z(){if($.fd!==1&&$.fd!==2)p1.close($.fd,J);else J()}function J(Y){if(Y){$.emit("error",Y);return}if($._ending&&!$._writing)$.emit("finish");$.emit("close")}}$6.SonicBoom=$6;$6.default=$6;BI.exports=$6});var AB=S((ef0,jI)=>{var Z6={exit:[],beforeExit:[]},FI={exit:W60,beforeExit:K60},IJ;function Q60(){if(IJ===void 0)IJ=new FinalizationRegistry(V60)}function G60($){if(Z6[$].length>0)return;process.on($,FI[$])}function AI($){if(Z6[$].length>0)return;if(process.removeListener($,FI[$]),Z6.exit.length===0&&Z6.beforeExit.length===0)IJ=void 0}function W60(){OI("exit")}function K60(){OI("beforeExit")}function OI($){for(let Z of Z6[$]){let J=Z.deref(),Y=Z.fn;if(J!==void 0)Y(J,$)}Z6[$]=[]}function V60($){for(let Z of["exit","beforeExit"]){let J=Z6[Z].indexOf($);Z6[Z].splice(J,J+1),AI(Z)}}function qI($,Z,J){if(Z===void 0)throw Error("the object can't be undefined");G60($);let Y=new WeakRef(Z);Y.fn=J,Q60(),IJ.register(Z,Y),Z6[$].push(Y)}function U60($,Z){qI("exit",$,Z)}function H60($,Z){qI("beforeExit",$,Z)}function B60($){if(IJ===void 0)return;IJ.unregister($);for(let Z of["exit","beforeExit"])Z6[Z]=Z6[Z].filter((J)=>{let Y=J.deref();return Y&&Y!==$}),AI(Z)}jI.exports={register:U60,registerBeforeExit:H60,unregister:B60}});var NI=S(($k0,z60)=>{z60.exports={name:"thread-stream",version:"4.2.0",description:"A streaming way to send data to a Node.js Worker Thread",main:"index.js",types:"index.d.ts",engines:{node:">=20"},dependencies:{"real-require":"^1.0.0"},devDependencies:{"@types/node":"^25.0.2","@yao-pkg/pkg":"^6.0.0",borp:"^1.0.0",desm:"^1.3.0",eslint:"^9.39.1",fastbench:"^1.0.1",neostandard:"^0.13.0","pino-elasticsearch":"^9.0.0","sonic-boom":"^5.0.0","ts-node":"^10.8.0",typescript:"~5.7.3"},scripts:{build:"tsc --noEmit",lint:"eslint",test:'npm run lint && npm run build && npm run transpile && borp --pattern "test/*.test.{js,mjs}"',"test:ci":'npm run lint && npm run transpile && borp --pattern "test/*.test.{js,mjs}"',"test:yarn":'npm run transpile && borp --pattern "test/*.test.js"',transpile:"sh ./test/ts/transpile.sh"},repository:{type:"git",url:"git+https://github.com/mcollina/thread-stream.git"},keywords:["worker","thread","threads","stream"],author:"Matteo Collina <hello@matteocollina.com>",license:"MIT",bugs:{url:"https://github.com/mcollina/thread-stream/issues"},homepage:"https://github.com/mcollina/thread-stream#readme"}});var DI=S((Zk0,MI)=>{function F60($,Z,J,Y,X){let Q=Y===1/0?1/0:Date.now()+Y,G=()=>{let W=Atomics.load($,Z);if(W===J){X(null,"ok");return}if(Q!==1/0&&Date.now()>Q){X(null,"timed-out");return}let K=Q===1/0?1e4:Math.min(1e4,Math.max(1,Q-Date.now())),V=Atomics.waitAsync($,Z,W,K);if(V.async)V.value.then(G);else setImmediate(G)};G()}function A60($,Z,J,Y,X){let Q=Y===1/0?1/0:Date.now()+Y,G=()=>{if(Atomics.load($,Z)!==J){X(null,"ok");return}if(Q!==1/0&&Date.now()>Q){X(null,"timed-out");return}let K=Q===1/0?1e4:Math.min(1e4,Math.max(1,Q-Date.now())),V=Atomics.waitAsync($,Z,J,K);if(V.async)V.value.then((U)=>{if(U==="ok"){X(null,"ok");return}G()});else setImmediate(G)};G()}MI.exports={wait:F60,waitDiff:A60}});var LI=S((Jk0,wI)=>{wI.exports={WRITE_INDEX:4,READ_INDEX:8,SEQ_INDEX:2}});var yI=S((Yk0,vI)=>{var __dirname="/home/runner/workspace/qode/node_modules/.bun/thread-stream@4.2.0/node_modules/thread-stream",{version:O60}=NI(),{EventEmitter:q60}=Y0("events"),{Worker:j60}=Y0("worker_threads"),{join:N60}=Y0("path"),{pathToFileURL:M60}=Y0("url"),{wait:D60}=DI(),{WRITE_INDEX:t6,READ_INDEX:i5,SEQ_INDEX:OB}=LI(),w60=Y0("buffer"),L60=Y0("assert"),s=Symbol("kImpl"),T60=w60.constants.MAX_STRING_LENGTH;function TI(){}function MB($,Z){Atomics.add($[s].state,OB,1),Z(),Atomics.add($[s].state,OB,1),Atomics.notify($[s].state,OB)}function RI($){MB($,()=>{Atomics.store($[s].state,i5,0),Atomics.store($[s].state,t6,0)})}class a4{constructor($){this._value=$}deref(){return this._value}}class jB{register(){}unregister(){}}var R60=process.env.NODE_V8_COVERAGE?jB:global.FinalizationRegistry||jB,P60=process.env.NODE_V8_COVERAGE?a4:global.WeakRef||a4,PI=new R60(($)=>{if($.exited)return;$.terminate()});function I60($,Z){let{filename:J,workerData:Y}=Z,Q=("__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||N60(__dirname,"lib","worker.js"),G=new j60(Q,{...Z.workerOpts,name:Z.workerOpts?.name||"thread-stream",trackUnmanagedFds:!1,workerData:{filename:J.indexOf("file://")===0?J:M60(J).href,dataBuf:$[s].dataBuf,stateBuf:$[s].stateBuf,workerData:{$context:{threadStreamVersion:O60},...Y}}});return G.stream=new a4($),G.on("message",C60),G.on("exit",EI),PI.register($,G),G}function II($){if(L60(!$[s].sync),$[s].needDrain)$[s].needDrain=!1,$.emit("drain")}function CI($){while(!0){let Z=Atomics.load($[s].state,t6),J=$[s].data.length-Z;if(J>0){if($[s].bufLen===0){if($[s].flushing=!1,$[s].ending)DB($);else if($[s].needDrain)process.nextTick(II,$);return}fI($,J,TI);continue}if(J===0){if(Z===0&&$[s].bufLen===0)return;t4($,()=>{if($.destroyed)return;RI($),CI($)});return}x8($,Error("overwritten"));return}}function C60($){let Z=this.stream.deref();if(Z===void 0){this.exited=!0,this.terminate();return}if($?.code==null)return;switch($.code){case"READY":this.stream=new P60(Z),t4(Z,()=>{Z[s].ready=!0,Z.emit("ready")});break;case"ERROR":x8(Z,$.err);break;case"EVENT":if(Array.isArray($.args))Z.emit($.name,...$.args);else Z.emit($.name,$.args);break;case"FLUSHED":{if($.context!=="thread-stream"){x8(Z,Error("this should not happen: "+$.code));break}let J=Z[s].flushCallbacks.get($.id);if(J)Z[s].flushCallbacks.delete($.id),process.nextTick(J);break}case"WARNING":process.emitWarning($.err);break;default:x8(Z,Error("this should not happen: "+$.code))}}function EI($){let Z=this.stream.deref();if(Z===void 0)return;PI.unregister(Z),Z.worker.exited=!0,Z.worker.off("exit",EI),x8(Z,$!==0?Error("the worker thread exited"):null)}class bI extends q60{constructor($={}){super();if($.bufferSize<4)throw Error("bufferSize must at least fit a 4-byte utf-8 char");this[s]={},this[s].stateBuf=new SharedArrayBuffer(128),this[s].state=new Int32Array(this[s].stateBuf),this[s].dataBuf=new SharedArrayBuffer($.bufferSize||4194304),this[s].data=Buffer.from(this[s].dataBuf),this[s].sync=$.sync||!1,this[s].ending=!1,this[s].ended=!1,this[s].needDrain=!1,this[s].destroyed=!1,this[s].flushing=!1,this[s].ready=!1,this[s].finished=!1,this[s].errored=null,this[s].closed=!1,this[s].buf=[],this[s].bufHead=0,this[s].bufLen=0,this[s].flushCallbacks=new Map,this[s].nextFlushId=0,this.worker=I60(this,$),this.on("message",(Z,J)=>{this.worker.postMessage(Z,J)})}write($){let Z=Buffer.isBuffer($)?$:Buffer.from($);if(this[s].destroyed)return NB(this,Error("the worker has exited")),!1;if(this[s].ending)return NB(this,Error("the worker is ending")),!1;if(this[s].flushing&&this[s].bufLen+Z.length>=T60)try{qB(this),this[s].flushing=!0}catch(J){return x8(this,J),!1}if(this[s].buf.push(Z),this[s].bufLen+=Z.length,this[s].sync)try{return qB(this),!0}catch(J){return x8(this,J),!1}if(!this[s].flushing)this[s].flushing=!0,setImmediate(CI,this);return this[s].needDrain=this[s].data.length-this[s].bufLen-Atomics.load(this[s].state,t6)<=0,!this[s].needDrain}end(){if(this[s].destroyed)return;this[s].ending=!0,DB(this)}flush($){$=typeof $==="function"?$:TI,_I(this,(Z)=>{if(Z){process.nextTick($,Z);return}SI(this,$)})}flushSync(){if(this[s].destroyed)return;qB(this),kI(this)}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[s].ready}get destroyed(){return this[s].destroyed}get closed(){return this[s].closed}get writable(){return!this[s].destroyed&&!this[s].ending}get writableEnded(){return this[s].ending}get writableFinished(){return this[s].finished}get writableNeedDrain(){return this[s].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[s].errored}}function _I($,Z){if($[s].destroyed){process.nextTick(Z,Error("the worker has exited"));return}if(!$[s].sync&&($[s].flushing||$[s].bufLen>0)){setImmediate(_I,$,Z);return}t4($,Z)}function t4($,Z){let J=Atomics.load($[s].state,t6);D60($[s].state,i5,J,1/0,(Y,X)=>{if(Y){x8($,Y),Z(Y);return}if(X!=="ok"){t4($,Z);return}Z()})}function SI($,Z){if($[s].destroyed){process.nextTick(Z,Error("the worker has exited"));return}if(!$[s].ready){let Y=()=>{Q(),SI($,Z)},X=()=>{Q(),process.nextTick(Z,Error("the worker has exited"))},Q=()=>{$.off("ready",Y),$.off("close",X)};$.once("ready",Y),$.once("close",X);return}let J=++$[s].nextFlushId;$[s].flushCallbacks.set(J,Z);try{$.worker.postMessage({code:"FLUSH",context:"thread-stream",id:J})}catch(Y){$[s].flushCallbacks.delete(J),x8($,Y),process.nextTick(Z,Y)}}function E60($,Z){let J=$[s].flushCallbacks;if(J.size===0)return;let Y=Z||Error("the worker has exited");for(let X of J.values())process.nextTick(X,Y);J.clear()}function NB($,Z){setImmediate(()=>{$.emit("error",Z)})}function x8($,Z){if($[s].destroyed)return;if($[s].destroyed=!0,E60($,Z),Z)$[s].errored=Z,NB($,Z);if(!$.worker.exited)$.worker.terminate().catch(()=>{}).then(()=>{$[s].closed=!0,$.emit("close")});else setImmediate(()=>{$[s].closed=!0,$.emit("close")})}function fI($,Z,J){let X=Atomics.load($[s].state,t6),Q=Z;while(Q>0&&$[s].bufLen!==0){let G=$[s].bufHead,W=$[s].buf[G];if(W.length<=Q){if(W.copy($[s].data,X),X+=W.length,Q-=W.length,$[s].bufLen-=W.length,$[s].bufHead=G+1,$[s].bufHead===$[s].buf.length)$[s].buf.length=0,$[s].bufHead=0;else if($[s].bufHead>=1024&&$[s].bufHead*2>=$[s].buf.length)$[s].buf.splice(0,$[s].bufHead),$[s].bufHead=0;continue}W.copy($[s].data,X,0,Q),$[s].buf[G]=W.subarray(Q),$[s].bufLen-=Q,X+=Q,Q=0}return MB($,()=>{Atomics.store($[s].state,t6,X)}),J(),!0}function DB($){if($[s].ended||!$[s].ending||$[s].flushing)return;$[s].ended=!0;try{$.flushSync();let Z=Atomics.load($[s].state,i5);MB($,()=>{Atomics.store($[s].state,t6,-1)});let J=0;while(Z!==-1){if(Atomics.wait($[s].state,i5,Z,1000),Z=Atomics.load($[s].state,i5),Z===-2){x8($,Error("end() failed"));return}if(++J===10){x8($,Error("end() took too long (10s)"));return}}process.nextTick(()=>{$[s].finished=!0,$.emit("finish")})}catch(Z){x8($,Z)}}function qB($){let Z=()=>{if($[s].ending)DB($);else if($[s].needDrain)process.nextTick(II,$)};$[s].flushing=!1;while($[s].bufLen!==0){let J=Atomics.load($[s].state,t6),Y=$[s].data.length-J;if(Y===0){kI($),RI($);continue}else if(Y<0)throw Error("overwritten");fI($,Y,Z)}}function kI($){if($[s].flushing)throw Error("unable to flush while flushing");let Z=Atomics.load($[s].state,t6),J=0;while(!0){let Y=Atomics.load($[s].state,i5);if(Y===-2)throw Error("_flushSync failed");if(Y!==Z)Atomics.wait($[s].state,i5,Y,1000);else break;if(++J===10)throw Error("_flushSync took too long (10s)")}}vI.exports=bI});var TB=S((Xk0,gI)=>{var __dirname="/home/runner/workspace/qode/node_modules/.bun/pino@10.3.1/node_modules/pino/lib",{createRequire:b60}=Y0("module"),{existsSync:_60}=Y0("fs"),S60=WB(),{join:wB,isAbsolute:hI,sep:f60}=Y0("path"),{fileURLToPath:k60}=Y0("url"),v60=BB(),LB=AB(),y60=yI();function x60($){LB.register($,l60),LB.registerBeforeExit($,d60),$.on("close",function(){LB.unregister($)})}function h60(){let $=process.execArgv;for(let Z=0;Z<$.length;Z++){let J=$[Z];if(J==="--import"||J==="--require"||J==="-r")return!0;if(J.startsWith("--import=")||J.startsWith("--require=")||J.startsWith("-r="))return!0}return!1}function g60($){let Z=$.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);if(!Z)return $;let J=[],Y=!1;for(let X=0;X<Z.length;X++){let Q=Z[X];if(Q==="--require"||Q==="-r"||Q==="--import"){let G=Z[X+1];if(G&&xI(G)){Y=!0,X++;continue}if(J.push(Q),G)J.push(G),X++;continue}if(Q.startsWith("--require=")||Q.startsWith("-r=")||Q.startsWith("--import=")){let G=Q.slice(Q.indexOf("=")+1);if(xI(G)){Y=!0;continue}}J.push(Q)}return Y?J.join(" "):$}function xI($){let Z=u60($);if(!Z)return!1;let J=Z;if(J.startsWith("file://"))try{J=k60(J)}catch{return!1}return hI(J)&&!_60(J)}function u60($){let Z=$[0],J=$[$.length-1];if(Z==='"'&&J==='"'||Z==="'"&&J==="'")return $.slice(1,-1);return $}function m60($,Z,J,Y,X){if(!J.execArgv&&h60()&&Y0.main===void 0)J={...J,execArgv:[]};if(!J.env&&process.env.NODE_OPTIONS){let K=g60(process.env.NODE_OPTIONS);if(K!==process.env.NODE_OPTIONS)J={...J,env:{...process.env,NODE_OPTIONS:K}}}J={...J,name:X};let Q=new y60({filename:$,workerData:Z,workerOpts:J,sync:Y});Q.on("ready",G),Q.on("close",function(){process.removeListener("exit",W)}),process.on("exit",W);function G(){if(process.removeListener("exit",W),Q.unref(),J.autoEnd!==!1)x60(Q)}function W(){if(Q.closed)return;Q.flushSync(),v60(100),Q.end()}return Q}function l60($){$.ref(),$.flushSync(),$.end(),$.once("close",function(){$.unref()})}function d60($){$.flushSync()}function p60($){let{pipeline:Z,targets:J,levels:Y,dedupe:X,worker:Q={},caller:G=S60(),sync:W=!1}=$,K={...$.options},V=typeof G==="string"?[G]:G,U=typeof globalThis==="object"&&Object.prototype.hasOwnProperty.call(globalThis,"__bundlerPathsOverrides")&&globalThis.__bundlerPathsOverrides&&typeof globalThis.__bundlerPathsOverrides==="object"?globalThis.__bundlerPathsOverrides:Object.create(null),H=$.target;if(H&&J)throw Error("only one of target or targets can be specified");if(J)H=U["pino-worker"]||wB(__dirname,"worker.js"),K.targets=J.filter((F)=>F.target).map((F)=>{return{...F,target:z(F.target)}}),K.pipelines=J.filter((F)=>F.pipeline).map((F)=>{return F.pipeline.map((A)=>{return{...A,level:F.level,target:z(A.target)}})});else if(Z)H=U["pino-worker"]||wB(__dirname,"worker.js"),K.pipelines=[Z.map((F)=>{return{...F,target:z(F.target)}})];if(Y)K.levels=Y;if(X)K.dedupe=X;K.pinoWillSendConfig=!0;let B=J||Z?"pino.transport":H;return m60(z(H),K,Q,W,B);function z(F){if(F=U[F]||F,hI(F)||F.indexOf("file://")===0)return F;if(F==="pino/file")return wB(__dirname,"..","file.js");let A;for(let j of V)try{let N=j==="node:repl"?process.cwd()+f60:j;A=b60(N).resolve(F);break}catch(N){continue}if(!A)throw Error(`unable to determine transport target for "${F}"`);return A}}gI.exports=p60});var ZG=S((Gk0,tI)=>{var c60=Y0("diagnostics_channel"),uI=WI(),{mapHttpRequest:i60,mapHttpResponse:n60}=GB(),PB=zI(),mI=AB(),{lsCacheSym:o60,chindingsSym:iI,writeSym:lI,serializersSym:nI,formatOptsSym:dI,endSym:s60,stringifiersSym:oI,stringifySym:sI,stringifySafeSym:IB,wildcardFirstSym:rI,nestedKeySym:r60,formattersSym:aI,messageKeySym:a60,errorKeySym:t60,nestedKeyStrSym:e60,msgPrefixSym:e4}=PJ(),{isMainThread:$Z0}=Y0("worker_threads"),ZZ0=TB(),[JZ0]=process.versions.node.split(".").map(($)=>Number($)),pI=c60.tracingChannel("pino_asJson"),RB=JZ0>=25?($)=>JSON.stringify($):XZ0;function CJ(){}function YZ0($,Z){if(!Z)return J;return function(...X){Z.call(this,X,J,$)};function J(Y,...X){if(typeof Y==="object"){let Q=Y;if(Y!==null){if(Y.method&&Y.headers&&Y.socket)Y=i60(Y);else if(typeof Y.setHeader==="function")Y=n60(Y)}let G;if(Q===null&&X.length===0)G=[null];else Q=X.shift(),G=X;if(typeof this[e4]==="string"&&Q!==void 0&&Q!==null)Q=this[e4]+Q;this[lI](Y,uI(Q,G,this[dI]),$)}else{let Q=Y===void 0?X.shift():Y;if(typeof this[e4]==="string"&&Q!==void 0&&Q!==null)Q=this[e4]+Q;this[lI](null,uI(Q,X,this[dI]),$)}}}function XZ0($){let Z="",J=0,Y=!1,X=255,Q=$.length;if(Q>100)return JSON.stringify($);for(var G=0;G<Q&&X>=32;G++)if(X=$.charCodeAt(G),X===34||X===92)Z+=$.slice(J,G)+"\\",J=G,Y=!0;if(!Y)Z=$;else Z+=$.slice(J);return X<32?JSON.stringify($):'"'+Z+'"'}function QZ0($,Z,J,Y){if(pI.hasSubscribers===!1)return cI.call(this,$,Z,J,Y);let X={instance:this,arguments};return pI.traceSync(cI,X,this,$,Z,J,Y)}function cI($,Z,J,Y){let X=this[sI],Q=this[IB],G=this[oI],W=this[s60],K=this[iI],V=this[nI],U=this[aI],H=this[a60],B=this[t60],z=this[o60][J]+Y;z=z+K;let F;if(U.log)$=U.log($);let A=G[rI],j="";for(let w in $)if(F=$[w],Object.prototype.hasOwnProperty.call($,w)&&F!==void 0){if(V[w])F=V[w](F);else if(w===B&&V.err)F=V.err(F);let q=G[w]||A;switch(typeof F){case"undefined":case"function":continue;case"number":if(Number.isFinite(F)===!1)F=null;case"boolean":if(q)F=q(F);break;case"string":F=(q||RB)(F);break;default:F=(q||X)(F,Q)}if(F===void 0)continue;let M=RB(w);j+=","+M+":"+F}let N="";if(Z!==void 0){F=V[H]?V[H](Z):Z;let w=G[H]||A;switch(typeof F){case"function":break;case"number":if(Number.isFinite(F)===!1)F=null;case"boolean":if(w)F=w(F);N=',"'+H+'":'+F;break;case"string":F=(w||RB)(F),N=',"'+H+'":'+F;break;default:F=(w||X)(F,Q),N=',"'+H+'":'+F}}if(this[r60]&&j)return z+this[e60]+j.slice(1)+"}"+N+W;else return z+j+N+W}function GZ0($,Z){let J,Y=$[iI],X=$[sI],Q=$[IB],G=$[oI],W=G[rI],K=$[nI],V=$[aI].bindings;Z=V(Z);for(let U in Z)if(J=Z[U],((U.length<5||U!=="level"&&U!=="serializers"&&U!=="formatters"&&U!=="customLevels")&&Z.hasOwnProperty(U)&&J!==void 0)===!0){if(J=K[U]?K[U](J):J,J=(G[U]||W||X)(J,Q),J===void 0)continue;Y+=',"'+U+'":'+J}return Y}function WZ0($){return $.write!==$.constructor.prototype.write}function $G($){let Z=new PB($);if(Z.on("error",J),!$.sync&&$Z0)mI.register(Z,KZ0),Z.on("close",function(){mI.unregister(Z)});return Z;function J(Y){if(Y.code==="EPIPE"){Z.write=CJ,Z.end=CJ,Z.flushSync=CJ,Z.destroy=CJ;return}Z.removeListener("error",J),Z.emit("error",Y)}}function KZ0($,Z){if($.destroyed)return;if(Z==="beforeExit")$.flush(),$.on("drain",function(){$.end()});else $.flushSync()}function VZ0($){return function(J,Y,X={},Q){if(typeof X==="string")Q=$G({dest:X}),X={};else if(typeof Q==="string"){if(X&&X.transport)throw Error("only one of option.transport or stream can be specified");Q=$G({dest:Q})}else if(X instanceof PB||X.writable||X._writableState)Q=X,X={};else if(X.transport){if(X.transport instanceof PB||X.transport.writable||X.transport._writableState)throw Error("option.transport do not allow stream, please pass to option directly. e.g. pino(transport)");if(X.transport.targets&&X.transport.targets.length&&X.formatters&&typeof X.formatters.level==="function")throw Error("option.transport.targets do not allow custom level formatters");let K;if(X.customLevels)K=X.useOnlyCustomLevels?X.customLevels:Object.assign({},X.levels,X.customLevels);Q=ZZ0({caller:Y,...X.transport,levels:K})}if(X=Object.assign({},$,X),X.serializers=Object.assign({},$.serializers,X.serializers),X.formatters=Object.assign({},$.formatters,X.formatters),X.prettyPrint)throw Error("prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)");let{enabled:G,onChild:W}=X;if(G===!1)X.level="silent";if(!W)X.onChild=CJ;if(!Q)if(!WZ0(process.stdout))Q=$G({fd:process.stdout.fd||1});else Q=process.stdout;return{opts:X,stream:Q}}}function UZ0($,Z){try{return JSON.stringify($)}catch(J){try{return(Z||this[IB])($)}catch(Y){return'"[unable to serialize, circular reference is too complex to analyze]"'}}}function HZ0($,Z,J){return{level:$,bindings:Z,log:J}}function BZ0($){let Z=Number($);if(typeof $==="string"&&Number.isFinite(Z))return Z;if($===void 0)return 1;return $}tI.exports={noop:CJ,buildSafeSonicBoom:$G,asChindings:GZ0,asJson:QZ0,genLog:YZ0,createArgsNormalizer:VZ0,stringify:UZ0,buildFormatters:HZ0,normalizeDestFileDescriptor:BZ0}});var JG=S((Wk0,eI)=>{var zZ0={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},FZ0={ASC:"ASC",DESC:"DESC"};eI.exports={DEFAULT_LEVELS:zZ0,SORTING_ORDER:FZ0}});var bB=S((Kk0,YC)=>{var{lsCacheSym:AZ0,levelValSym:CB,useOnlyCustomLevelsSym:OZ0,streamSym:qZ0,formattersSym:jZ0,hooksSym:NZ0,levelCompSym:$C}=PJ(),{noop:MZ0,genLog:n5}=ZG(),{DEFAULT_LEVELS:I6,SORTING_ORDER:ZC}=JG(),JC={fatal:($)=>{let Z=n5(I6.fatal,$);return function(...J){let Y=this[qZ0];if(Z.call(this,...J),typeof Y.flushSync==="function")try{Y.flushSync()}catch(X){}}},error:($)=>n5(I6.error,$),warn:($)=>n5(I6.warn,$),info:($)=>n5(I6.info,$),debug:($)=>n5(I6.debug,$),trace:($)=>n5(I6.trace,$)},EB=Object.keys(I6).reduce(($,Z)=>{return $[I6[Z]]=Z,$},{}),DZ0=Object.keys(EB).reduce(($,Z)=>{return $[Z]='{"level":'+Number(Z),$},{});function wZ0($){let Z=$[jZ0].level,{labels:J}=$.levels,Y={};for(let X in J){let Q=Z(J[X],Number(X));Y[X]=JSON.stringify(Q).slice(0,-1)}return $[AZ0]=Y,$}function LZ0($,Z){if(Z)return!1;switch($){case"fatal":case"error":case"warn":case"info":case"debug":case"trace":return!0;default:return!1}}function TZ0($){let{labels:Z,values:J}=this.levels;if(typeof $==="number"){if(Z[$]===void 0)throw Error("unknown level value"+$);$=Z[$]}if(J[$]===void 0)throw Error("unknown level "+$);let Y=this[CB],X=this[CB]=J[$],Q=this[OZ0],G=this[$C],W=this[NZ0].logMethod;for(let K in J){if(G(J[K],X)===!1){this[K]=MZ0;continue}this[K]=LZ0(K,Q)?JC[K](W):n5(J[K],W)}this.emit("level-change",$,X,Z[Y],Y,this)}function RZ0($){let{levels:Z,levelVal:J}=this;return Z&&Z.labels?Z.labels[J]:""}function PZ0($){let{values:Z}=this.levels,J=Z[$];return J!==void 0&&this[$C](J,this[CB])}function IZ0($,Z,J){if($===ZC.DESC)return Z<=J;return Z>=J}function CZ0($){if(typeof $==="string")return IZ0.bind(null,$);return $}function EZ0($=null,Z=!1){let J=$?Object.keys($).reduce((Q,G)=>{return Q[$[G]]=G,Q},{}):null,Y=Object.assign(Object.create(Object.prototype,{Infinity:{value:"silent"}}),Z?null:EB,J),X=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),Z?null:I6,$);return{labels:Y,values:X}}function bZ0($,Z,J){if(typeof $==="number"){if(![].concat(Object.keys(Z||{}).map((Q)=>Z[Q]),J?[]:Object.keys(EB).map((Q)=>+Q),1/0).includes($))throw Error(`default level:${$} must be included in custom levels`);return}let Y=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),J?null:I6,Z);if(!($ in Y))throw Error(`default level:${$} must be included in custom levels`)}function _Z0($,Z){let{labels:J,values:Y}=$;for(let X in Z){if(X in Y)throw Error("levels cannot be overridden");if(Z[X]in J)throw Error("pre-existing level values cannot be used for new levels")}}function SZ0($){if(typeof $==="function")return;if(typeof $==="string"&&Object.values(ZC).includes($))return;throw Error('Levels comparison should be one of "ASC", "DESC" or "function" type')}YC.exports={initialLsCache:DZ0,genLsCache:wZ0,levelMethods:JC,getLevel:RZ0,setLevel:TZ0,isLevelEnabled:PZ0,mappings:EZ0,assertNoLevelCollisions:_Z0,assertDefaultLevelFound:bZ0,genLevelComparison:CZ0,assertLevelComparison:SZ0}});var _B=S((Vk0,XC)=>{XC.exports={version:"10.3.1"}});var BC=S((Uk0,HC)=>{var{EventEmitter:fZ0}=Y0("events"),{lsCacheSym:kZ0,levelValSym:vZ0,setLevelSym:fB,getLevelSym:QC,chindingsSym:XG,mixinSym:yZ0,asJsonSym:WC,writeSym:xZ0,mixinMergeStrategySym:hZ0,timeSym:gZ0,timeSliceIndexSym:uZ0,streamSym:KC,serializersSym:o5,formattersSym:kX,errorKeySym:mZ0,messageKeySym:lZ0,useOnlyCustomLevelsSym:dZ0,needsMetadataGsym:pZ0,redactFmtSym:cZ0,stringifySym:iZ0,formatOptsSym:nZ0,stringifiersSym:oZ0,msgPrefixSym:kB,hooksSym:sZ0}=PJ(),{getLevel:rZ0,setLevel:aZ0,isLevelEnabled:tZ0,mappings:eZ0,initialLsCache:$50,genLsCache:Z50,assertNoLevelCollisions:J50}=bB(),{asChindings:vB,asJson:Y50,buildFormatters:SB,stringify:GC,noop:VC}=ZG(),{version:X50}=_B(),Q50=UB(),G50=class{},UC={constructor:G50,child:W50,bindings:K50,setBindings:V50,flush:B50,isLevelEnabled:tZ0,version:X50,get level(){return this[QC]()},set level($){this[fB]($)},get levelVal(){return this[vZ0]},set levelVal($){throw Error("levelVal is read-only")},get msgPrefix(){return this[kB]},get[Symbol.toStringTag](){return"Pino"},[kZ0]:$50,[xZ0]:H50,[WC]:Y50,[QC]:rZ0,[fB]:aZ0};Object.setPrototypeOf(UC,fZ0.prototype);HC.exports=function(){return Object.create(UC)};var YG=($)=>$;function W50($,Z){if(!$)throw Error("missing bindings for child Pino");let J=this[o5],Y=this[kX],X=Object.create(this);if(Z==null){if(X[kX].bindings!==YG)X[kX]=SB(Y.level,YG,Y.log);if(X[XG]=vB(X,$),this.onChild!==VC)this.onChild(X);return X}if(Z.hasOwnProperty("serializers")===!0){X[o5]=Object.create(null);for(let V in J)X[o5][V]=J[V];let W=Object.getOwnPropertySymbols(J);for(var Q=0;Q<W.length;Q++){let V=W[Q];X[o5][V]=J[V]}for(let V in Z.serializers)X[o5][V]=Z.serializers[V];let K=Object.getOwnPropertySymbols(Z.serializers);for(var G=0;G<K.length;G++){let V=K[G];X[o5][V]=Z.serializers[V]}}else X[o5]=J;if(Z.hasOwnProperty("formatters")){let{level:W,bindings:K,log:V}=Z.formatters;X[kX]=SB(W||Y.level,K||YG,V||Y.log)}else X[kX]=SB(Y.level,YG,Y.log);if(Z.hasOwnProperty("customLevels")===!0)J50(this.levels,Z.customLevels),X.levels=eZ0(Z.customLevels,X[dZ0]),Z50(X);if(typeof Z.redact==="object"&&Z.redact!==null||Array.isArray(Z.redact)){X.redact=Z.redact;let W=Q50(X.redact,GC),K={stringify:W[cZ0]};X[iZ0]=GC,X[oZ0]=W,X[nZ0]=K}if(typeof Z.msgPrefix==="string")X[kB]=(this[kB]||"")+Z.msgPrefix;if(X[XG]=vB(X,$),Z.level!==void 0&&Z.level!==this.level||Z.hasOwnProperty("customLevels")){let W=Z.level||this.level;X[fB](W)}return this.onChild(X),X}function K50(){let Z=`{${this[XG].substr(1)}}`,J=JSON.parse(Z);return delete J.pid,delete J.hostname,J}function V50($){let Z=vB(this,$);this[XG]=Z}function U50($,Z){return Object.assign(Z,$)}function H50($,Z,J){let Y=this[gZ0](),X=this[yZ0],Q=this[mZ0],G=this[lZ0],W=this[hZ0]||U50,K,V=this[sZ0].streamWrite;if($===void 0||$===null)K={};else if($ instanceof Error){if(K={[Q]:$},Z===void 0)Z=$.message}else if(K=$,Z===void 0&&$[G]===void 0&&$[Q])Z=$[Q].message;if(X)K=W(K,X(K,J,this));let U=this[WC](K,Z,J,Y),H=this[KC];if(H[pZ0]===!0)H.lastLevel=J,H.lastObj=K,H.lastMsg=Z,H.lastTime=Y.slice(this[uZ0]),H.lastLogger=this;H.write(V?V(U):U)}function B50($){if($!=null&&typeof $!=="function")throw Error("callback must be a function");let Z=this[KC];if(typeof Z.flush==="function")Z.flush($||VC);else if($)$()}});var OC=S((Hk0,AC)=>{var{hasOwnProperty:vX}=Object.prototype,r5=hB();r5.configure=hB;r5.stringify=r5;r5.default=r5;Hk0.stringify=r5;Hk0.configure=hB;AC.exports=r5;var z50=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function lZ($){if($.length<5000&&!z50.test($))return`"${$}"`;return JSON.stringify($)}function yB($,Z){if($.length>200||Z)return $.sort(Z);for(let J=1;J<$.length;J++){let Y=$[J],X=J;while(X!==0&&$[X-1]>Y)$[X]=$[X-1],X--;$[X]=Y}return $}var F50=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function xB($){return F50.call($)!==void 0&&$.length!==0}function zC($,Z,J){if($.length<J)J=$.length;let Y=Z===","?"":" ",X=`"0":${Y}${$[0]}`;for(let Q=1;Q<J;Q++)X+=`${Z}"${Q}":${Y}${$[Q]}`;return X}function A50($){if(vX.call($,"circularValue")){let Z=$.circularValue;if(typeof Z==="string")return`"${Z}"`;if(Z==null)return Z;if(Z===Error||Z===TypeError)return{toString(){throw TypeError("Converting circular structure to JSON")}};throw TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function O50($){let Z;if(vX.call($,"deterministic")){if(Z=$.deterministic,typeof Z!=="boolean"&&typeof Z!=="function")throw TypeError('The "deterministic" argument must be of type boolean or comparator function')}return Z===void 0?!0:Z}function q50($,Z){let J;if(vX.call($,Z)){if(J=$[Z],typeof J!=="boolean")throw TypeError(`The "${Z}" argument must be of type boolean`)}return J===void 0?!0:J}function FC($,Z){let J;if(vX.call($,Z)){if(J=$[Z],typeof J!=="number")throw TypeError(`The "${Z}" argument must be of type number`);if(!Number.isInteger(J))throw TypeError(`The "${Z}" argument must be an integer`);if(J<1)throw RangeError(`The "${Z}" argument must be >= 1`)}return J===void 0?1/0:J}function s5($){if($===1)return"1 item";return`${$} items`}function j50($){let Z=new Set;for(let J of $)if(typeof J==="string"||typeof J==="number")Z.add(String(J));return Z}function N50($){if(vX.call($,"strict")){let Z=$.strict;if(typeof Z!=="boolean")throw TypeError('The "strict" argument must be of type boolean');if(Z)return(J)=>{let Y=`Object can not safely be stringified. Received type ${typeof J}`;if(typeof J!=="function")Y+=` (${J.toString()})`;throw Error(Y)}}}function hB($){$={...$};let Z=N50($);if(Z){if($.bigint===void 0)$.bigint=!1;if(!("circularValue"in $))$.circularValue=Error}let J=A50($),Y=q50($,"bigint"),X=O50($),Q=typeof X==="function"?X:void 0,G=FC($,"maximumDepth"),W=FC($,"maximumBreadth");function K(z,F,A,j,N,w){let q=F[z];if(typeof q==="object"&&q!==null&&typeof q.toJSON==="function")q=q.toJSON(z);switch(q=j.call(F,z,q),typeof q){case"string":return lZ(q);case"object":{if(q===null)return"null";if(A.indexOf(q)!==-1)return J;let M="",C=",",R=w;if(Array.isArray(q)){if(q.length===0)return"[]";if(G<A.length+1)return'"[Array]"';if(A.push(q),N!=="")w+=N,M+=`
|
|
87
|
+
${w}`,C=`,
|
|
88
|
+
${w}`;let b=Math.min(q.length,W),y=0;for(;y<b-1;y++){let g=K(String(y),q,A,j,N,w);M+=g!==void 0?g:"null",M+=C}let k=K(String(y),q,A,j,N,w);if(M+=k!==void 0?k:"null",q.length-1>W){let g=q.length-W-1;M+=`${C}"... ${s5(g)} not stringified"`}if(N!=="")M+=`
|
|
89
|
+
${R}`;return A.pop(),`[${M}]`}let T=Object.keys(q),I=T.length;if(I===0)return"{}";if(G<A.length+1)return'"[Object]"';let _="",E="";if(N!=="")w+=N,C=`,
|
|
90
|
+
${w}`,_=" ";let f=Math.min(I,W);if(X&&!xB(q))T=yB(T,Q);A.push(q);for(let b=0;b<f;b++){let y=T[b],k=K(y,q,A,j,N,w);if(k!==void 0)M+=`${E}${lZ(y)}:${_}${k}`,E=C}if(I>W){let b=I-W;M+=`${E}"...":${_}"${s5(b)} not stringified"`,E=C}if(N!==""&&E.length>1)M=`
|
|
91
|
+
${w}${M}
|
|
92
|
+
${R}`;return A.pop(),`{${M}}`}case"number":return isFinite(q)?String(q):Z?Z(q):"null";case"boolean":return q===!0?"true":"false";case"undefined":return;case"bigint":if(Y)return String(q);default:return Z?Z(q):void 0}}function V(z,F,A,j,N,w){if(typeof F==="object"&&F!==null&&typeof F.toJSON==="function")F=F.toJSON(z);switch(typeof F){case"string":return lZ(F);case"object":{if(F===null)return"null";if(A.indexOf(F)!==-1)return J;let q=w,M="",C=",";if(Array.isArray(F)){if(F.length===0)return"[]";if(G<A.length+1)return'"[Array]"';if(A.push(F),N!=="")w+=N,M+=`
|
|
93
|
+
${w}`,C=`,
|
|
94
|
+
${w}`;let I=Math.min(F.length,W),_=0;for(;_<I-1;_++){let f=V(String(_),F[_],A,j,N,w);M+=f!==void 0?f:"null",M+=C}let E=V(String(_),F[_],A,j,N,w);if(M+=E!==void 0?E:"null",F.length-1>W){let f=F.length-W-1;M+=`${C}"... ${s5(f)} not stringified"`}if(N!=="")M+=`
|
|
95
|
+
${q}`;return A.pop(),`[${M}]`}A.push(F);let R="";if(N!=="")w+=N,C=`,
|
|
96
|
+
${w}`,R=" ";let T="";for(let I of j){let _=V(I,F[I],A,j,N,w);if(_!==void 0)M+=`${T}${lZ(I)}:${R}${_}`,T=C}if(N!==""&&T.length>1)M=`
|
|
97
|
+
${w}${M}
|
|
98
|
+
${q}`;return A.pop(),`{${M}}`}case"number":return isFinite(F)?String(F):Z?Z(F):"null";case"boolean":return F===!0?"true":"false";case"undefined":return;case"bigint":if(Y)return String(F);default:return Z?Z(F):void 0}}function U(z,F,A,j,N){switch(typeof F){case"string":return lZ(F);case"object":{if(F===null)return"null";if(typeof F.toJSON==="function"){if(F=F.toJSON(z),typeof F!=="object")return U(z,F,A,j,N);if(F===null)return"null"}if(A.indexOf(F)!==-1)return J;let w=N;if(Array.isArray(F)){if(F.length===0)return"[]";if(G<A.length+1)return'"[Array]"';A.push(F),N+=j;let _=`
|
|
99
|
+
${N}`,E=`,
|
|
100
|
+
${N}`,f=Math.min(F.length,W),b=0;for(;b<f-1;b++){let k=U(String(b),F[b],A,j,N);_+=k!==void 0?k:"null",_+=E}let y=U(String(b),F[b],A,j,N);if(_+=y!==void 0?y:"null",F.length-1>W){let k=F.length-W-1;_+=`${E}"... ${s5(k)} not stringified"`}return _+=`
|
|
101
|
+
${w}`,A.pop(),`[${_}]`}let q=Object.keys(F),M=q.length;if(M===0)return"{}";if(G<A.length+1)return'"[Object]"';N+=j;let C=`,
|
|
102
|
+
${N}`,R="",T="",I=Math.min(M,W);if(xB(F))R+=zC(F,C,W),q=q.slice(F.length),I-=F.length,T=C;if(X)q=yB(q,Q);A.push(F);for(let _=0;_<I;_++){let E=q[_],f=U(E,F[E],A,j,N);if(f!==void 0)R+=`${T}${lZ(E)}: ${f}`,T=C}if(M>W){let _=M-W;R+=`${T}"...": "${s5(_)} not stringified"`,T=C}if(T!=="")R=`
|
|
103
|
+
${N}${R}
|
|
104
|
+
${w}`;return A.pop(),`{${R}}`}case"number":return isFinite(F)?String(F):Z?Z(F):"null";case"boolean":return F===!0?"true":"false";case"undefined":return;case"bigint":if(Y)return String(F);default:return Z?Z(F):void 0}}function H(z,F,A){switch(typeof F){case"string":return lZ(F);case"object":{if(F===null)return"null";if(typeof F.toJSON==="function"){if(F=F.toJSON(z),typeof F!=="object")return H(z,F,A);if(F===null)return"null"}if(A.indexOf(F)!==-1)return J;let j="",N=F.length!==void 0;if(N&&Array.isArray(F)){if(F.length===0)return"[]";if(G<A.length+1)return'"[Array]"';A.push(F);let R=Math.min(F.length,W),T=0;for(;T<R-1;T++){let _=H(String(T),F[T],A);j+=_!==void 0?_:"null",j+=","}let I=H(String(T),F[T],A);if(j+=I!==void 0?I:"null",F.length-1>W){let _=F.length-W-1;j+=`,"... ${s5(_)} not stringified"`}return A.pop(),`[${j}]`}let w=Object.keys(F),q=w.length;if(q===0)return"{}";if(G<A.length+1)return'"[Object]"';let M="",C=Math.min(q,W);if(N&&xB(F))j+=zC(F,",",W),w=w.slice(F.length),C-=F.length,M=",";if(X)w=yB(w,Q);A.push(F);for(let R=0;R<C;R++){let T=w[R],I=H(T,F[T],A);if(I!==void 0)j+=`${M}${lZ(T)}:${I}`,M=","}if(q>W){let R=q-W;j+=`${M}"...":"${s5(R)} not stringified"`}return A.pop(),`{${j}}`}case"number":return isFinite(F)?String(F):Z?Z(F):"null";case"boolean":return F===!0?"true":"false";case"undefined":return;case"bigint":if(Y)return String(F);default:return Z?Z(F):void 0}}function B(z,F,A){if(arguments.length>1){let j="";if(typeof A==="number")j=" ".repeat(Math.min(A,10));else if(typeof A==="string")j=A.slice(0,10);if(F!=null){if(typeof F==="function")return K("",{"":z},[],F,j,"");if(Array.isArray(F))return V("",z,[],j50(F),j,"")}if(j.length!==0)return U("",z,[],j,"")}return H("",z,[])}return B}});var MC=S((Bk0,NC)=>{var gB=Symbol.for("pino.metadata"),{DEFAULT_LEVELS:jC}=JG(),w50=jC.info;function L50($,Z){$=$||[],Z=Z||{dedupe:!1};let J=Object.create(jC);if(J.silent=1/0,Z.levels&&typeof Z.levels==="object")Object.keys(Z.levels).forEach((H)=>{J[H]=Z.levels[H]});let Y={write:X,add:W,remove:K,emit:Q,flushSync:G,end:V,minLevel:0,lastId:0,streams:[],clone:U,[gB]:!0,streamLevels:J};if(Array.isArray($))$.forEach(W,Y);else W.call(Y,$);return $=null,Y;function X(H){let B,z=this.lastLevel,{streams:F}=this,A=0,j;for(let N=T50(F.length,Z.dedupe);P50(N,F.length,Z.dedupe);N=R50(N,Z.dedupe))if(B=F[N],B.level<=z){if(A!==0&&A!==B.level)break;if(j=B.stream,j[gB]){let{lastTime:w,lastMsg:q,lastObj:M,lastLogger:C}=this;j.lastLevel=z,j.lastTime=w,j.lastMsg=q,j.lastObj=M,j.lastLogger=C}if(j.write(H),Z.dedupe)A=B.level}else if(!Z.dedupe)break}function Q(...H){for(let{stream:B}of this.streams)if(typeof B.emit==="function")B.emit(...H)}function G(){for(let{stream:H}of this.streams)if(typeof H.flushSync==="function")H.flushSync()}function W(H){if(!H)return Y;let B=typeof H.write==="function"||H.stream,z=H.write?H:H.stream;if(!B)throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");let{streams:F,streamLevels:A}=this,j;if(typeof H.levelVal==="number")j=H.levelVal;else if(typeof H.level==="string")j=A[H.level];else if(typeof H.level==="number")j=H.level;else j=w50;let N={stream:z,level:j,levelVal:void 0,id:++Y.lastId};return F.unshift(N),F.sort(qC),this.minLevel=F[0].level,Y}function K(H){let{streams:B}=this,z=B.findIndex((F)=>F.id===H);if(z>=0)B.splice(z,1),B.sort(qC),this.minLevel=B.length>0?B[0].level:-1;return Y}function V(){for(let{stream:H}of this.streams){if(typeof H.flushSync==="function")H.flushSync();H.end()}}function U(H){let B=Array(this.streams.length);for(let z=0;z<B.length;z++)B[z]={level:H,stream:this.streams[z].stream};return{write:X,add:W,remove:K,minLevel:H,streams:B,clone:U,emit:Q,flushSync:G,[gB]:!0}}}function qC($,Z){return $.level-Z.level}function T50($,Z){return Z?$-1:0}function R50($,Z){return Z?$-1:$+1}function P50($,Z,J){return J?$>=0:$<Z}NC.exports=L50});var kC=S((zk0,h8)=>{var I50=Y0("os"),CC=GB(),C50=WB(),E50=UB(),EC=QI(),b50=BC(),bC=PJ(),{configure:_50}=OC(),{assertDefaultLevelFound:S50,mappings:_C,genLsCache:f50,genLevelComparison:k50,assertLevelComparison:v50}=bB(),{DEFAULT_LEVELS:SC,SORTING_ORDER:y50}=JG(),{createArgsNormalizer:x50,asChindings:h50,buildSafeSonicBoom:DC,buildFormatters:g50,stringify:uB,normalizeDestFileDescriptor:wC,noop:u50}=ZG(),{version:m50}=_B(),{chindingsSym:LC,redactFmtSym:l50,serializersSym:TC,timeSym:d50,timeSliceIndexSym:p50,streamSym:c50,stringifySym:RC,stringifySafeSym:mB,stringifiersSym:PC,setLevelSym:i50,endSym:n50,formatOptsSym:o50,messageKeySym:s50,errorKeySym:r50,nestedKeySym:a50,mixinSym:t50,levelCompSym:e50,useOnlyCustomLevelsSym:$70,formattersSym:IC,hooksSym:Z70,nestedKeyStrSym:J70,mixinMergeStrategySym:Y70,msgPrefixSym:X70}=bC,{epochTime:fC,nullTime:Q70}=EC,{pid:G70}=process,W70=I50.hostname(),K70=CC.err,V70={level:"info",levelComparison:y50.ASC,levels:SC,messageKey:"msg",errorKey:"err",nestedKey:null,enabled:!0,base:{pid:G70,hostname:W70},serializers:Object.assign(Object.create(null),{err:K70}),formatters:Object.assign(Object.create(null),{bindings($){return $},level($,Z){return{level:Z}}}),hooks:{logMethod:void 0,streamWrite:void 0},timestamp:fC,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100},U70=x50(V70),H70=Object.assign(Object.create(null),CC);function lB(...$){let Z={},{opts:J,stream:Y}=U70(Z,C50(),...$);if(J.level&&typeof J.level==="string"&&SC[J.level.toLowerCase()]!==void 0)J.level=J.level.toLowerCase();let{redact:X,crlf:Q,serializers:G,timestamp:W,messageKey:K,errorKey:V,nestedKey:U,base:H,name:B,level:z,customLevels:F,levelComparison:A,mixin:j,mixinMergeStrategy:N,useOnlyCustomLevels:w,formatters:q,hooks:M,depthLimit:C,edgeLimit:R,onChild:T,msgPrefix:I}=J,_=_50({maximumDepth:C,maximumBreadth:R}),E=g50(q.level,q.bindings,q.log),f=uB.bind({[mB]:_}),b=X?E50(X,f):{},y=X?{stringify:b[l50]}:{stringify:f},k="}"+(Q?`\r
|
|
105
|
+
`:`
|
|
106
|
+
`),g=h50.bind(null,{[LC]:"",[TC]:G,[PC]:b,[RC]:uB,[mB]:_,[IC]:E}),d="";if(H!==null)if(B===void 0)d=g(H);else d=g(Object.assign({},H,{name:B}));let p=W instanceof Function?W:W?fC:Q70,t=p().indexOf(":")+1;if(w&&!F)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(j&&typeof j!=="function")throw Error(`Unknown mixin type "${typeof j}" - expected "function"`);if(I&&typeof I!=="string")throw Error(`Unknown msgPrefix type "${typeof I}" - expected "string"`);S50(z,F,w);let r=_C(F,w);if(typeof Y.emit==="function")Y.emit("message",{code:"PINO_CONFIG",config:{levels:r,messageKey:K,errorKey:V}});v50(A);let G0=k50(A);return Object.assign(Z,{levels:r,[e50]:G0,[$70]:w,[c50]:Y,[d50]:p,[p50]:t,[RC]:uB,[mB]:_,[PC]:b,[n50]:k,[o50]:y,[s50]:K,[r50]:V,[a50]:U,[J70]:U?`,${JSON.stringify(U)}:{`:"",[TC]:G,[t50]:j,[Y70]:N,[LC]:d,[IC]:E,[Z70]:M,silent:u50,onChild:T,[X70]:I}),Object.setPrototypeOf(Z,b50()),f50(Z),Z[i50](z),Z}h8.exports=lB;h8.exports.destination=($=process.stdout.fd)=>{if(typeof $==="object")return $.dest=wC($.dest||process.stdout.fd),DC($);else return DC({dest:wC($),minLength:0})};h8.exports.transport=TB();h8.exports.multistream=MC();h8.exports.levels=_C();h8.exports.stdSerializers=H70;h8.exports.stdTimeFunctions=Object.assign({},EC);h8.exports.symbols=bC;h8.exports.version=m50;h8.exports.default=lB;h8.exports.pino=lB});var xC=S((Fk0,yC)=>{var QG=kC(),{serializersSym:vC}=QG.symbols,{FST_ERR_LOG_INVALID_DESTINATION:B70}=w$();function z70($){if($.stream&&$.file)throw new B70;else if($.file)$.stream=QG.destination($.file),delete $.file;let{logger:Z,genReqId:J}=$,Y=null;if(Z){if($.logger=void 0,$.genReqId=void 0,Z[vC])$.serializers=Object.assign({},$.serializers,Z[vC]);Y=Z.child({},$),$.logger=Z,$.genReqId=J}else Y=QG($,$.stream);return Y}var F70={req:function(Z){return{method:Z.method,url:Z.url,version:Z.headers&&Z.headers["accept-version"],host:Z.host,remoteAddress:Z.ip,remotePort:Z.socket?Z.socket.remotePort:void 0}},err:QG.stdSerializers.err,res:function(Z){return{statusCode:Z.statusCode}}};yC.exports={serializers:F70,createPinoLogger:z70}});var yX=S((Ak0,gC)=>{var{FST_ERR_LOG_LOGGER_AND_LOGGER_INSTANCE_PROVIDED:A70,FST_ERR_LOG_INVALID_LOGGER_CONFIG:O70,FST_ERR_LOG_INVALID_LOGGER_INSTANCE:q70,FST_ERR_LOG_INVALID_LOGGER:j70}=w$();function N70($,Z,J,Y,X){let Q={[$.requestIdLogLabel]:Y},G=$.childLoggerFactory.call($.server,Z,Q,X||{},J);if($.childLoggerFactory!==hC)GG(G,!0);return G}function hC($,Z,J){return $.child(Z,J)}function GG($,Z){let J=["info","error","debug","fatal","warn","trace","child"],Y=$?J.filter((X)=>!$[X]||typeof $[X]!=="function"):J;if(!Y.length)return!0;else if(Y.length===J.length&&!Z)return!1;else throw j70(Y.join(","))}function M70($){if($.logger&&$.loggerInstance)throw new A70;if(!$.loggerInstance&&!$.logger){let G=IP();return G.child=()=>G,{logger:G,hasLogger:!1}}let{createPinoLogger:Z,serializers:J}=xC();if(GG($.loggerInstance))return{logger:Z({logger:$.loggerInstance,serializers:Object.assign({},J,$.loggerInstance.serializers)}),hasLogger:!0};if(GG($.logger))throw O70();if($.loggerInstance)throw q70();let Y={};if(Object.prototype.toString.call($.logger)==="[object Object]")Reflect.ownKeys($.logger).forEach((Q)=>{Object.defineProperty(Y,Q,{value:$.logger[Q],writable:!0,enumerable:!0,configurable:!0})});return Y.level=Y.level||"info",Y.serializers=Object.assign({},J,Y.serializers),$.logger=Y,{logger:Z($.logger),hasLogger:!0}}function D70(){let $=process.hrtime();return $[0]*1000+$[1]/1e6}gC.exports={createChildLogger:N70,defaultChildLoggerFactory:hC,createLogger:M70,validateLogger:GG,now:D70}});var WG=S((Ok0,uC)=>{uC.exports=w70;function EJ($){if($ instanceof Buffer)return Buffer.from($);return new $.constructor($.buffer.slice(),$.byteOffset,$.length)}function w70($){if($=$||{},$.circles)return L70($);let Z=new Map;if(Z.set(Date,(G)=>new Date(G)),Z.set(Map,(G,W)=>new Map(Y(Array.from(G),W))),Z.set(Set,(G,W)=>new Set(Y(Array.from(G),W))),$.constructorHandlers)for(let G of $.constructorHandlers)Z.set(G[0],G[1]);let J=null;return $.proto?Q:X;function Y(G,W){let K=Object.keys(G),V=Array(K.length);for(let U=0;U<K.length;U++){let H=K[U],B=G[H];if(typeof B!=="object"||B===null)V[H]=B;else if(B.constructor!==Object&&(J=Z.get(B.constructor)))V[H]=J(B,W);else if(ArrayBuffer.isView(B))V[H]=EJ(B);else V[H]=W(B)}return V}function X(G){if(typeof G!=="object"||G===null)return G;if(Array.isArray(G))return Y(G,X);if(G.constructor!==Object&&(J=Z.get(G.constructor)))return J(G,X);let W={};for(let K in G){if(Object.hasOwnProperty.call(G,K)===!1)continue;let V=G[K];if(typeof V!=="object"||V===null)W[K]=V;else if(V.constructor!==Object&&(J=Z.get(V.constructor)))W[K]=J(V,X);else if(ArrayBuffer.isView(V))W[K]=EJ(V);else W[K]=X(V)}return W}function Q(G){if(typeof G!=="object"||G===null)return G;if(Array.isArray(G))return Y(G,Q);if(G.constructor!==Object&&(J=Z.get(G.constructor)))return J(G,Q);let W={};for(let K in G){let V=G[K];if(typeof V!=="object"||V===null)W[K]=V;else if(V.constructor!==Object&&(J=Z.get(V.constructor)))W[K]=J(V,Q);else if(ArrayBuffer.isView(V))W[K]=EJ(V);else W[K]=Q(V)}return W}}function L70($){let Z=[],J=[],Y=new Map;if(Y.set(Date,(K)=>new Date(K)),Y.set(Map,(K,V)=>new Map(Q(Array.from(K),V))),Y.set(Set,(K,V)=>new Set(Q(Array.from(K),V))),$.constructorHandlers)for(let K of $.constructorHandlers)Y.set(K[0],K[1]);let X=null;return $.proto?W:G;function Q(K,V){let U=Object.keys(K),H=Array(U.length);for(let B=0;B<U.length;B++){let z=U[B],F=K[z];if(typeof F!=="object"||F===null)H[z]=F;else if(F.constructor!==Object&&(X=Y.get(F.constructor)))H[z]=X(F,V);else if(ArrayBuffer.isView(F))H[z]=EJ(F);else{let A=Z.indexOf(F);if(A!==-1)H[z]=J[A];else H[z]=V(F)}}return H}function G(K){if(typeof K!=="object"||K===null)return K;if(Array.isArray(K))return Q(K,G);if(K.constructor!==Object&&(X=Y.get(K.constructor)))return X(K,G);let V={};Z.push(K),J.push(V);for(let U in K){if(Object.hasOwnProperty.call(K,U)===!1)continue;let H=K[U];if(typeof H!=="object"||H===null)V[U]=H;else if(H.constructor!==Object&&(X=Y.get(H.constructor)))V[U]=X(H,G);else if(ArrayBuffer.isView(H))V[U]=EJ(H);else{let B=Z.indexOf(H);if(B!==-1)V[U]=J[B];else V[U]=G(H)}}return Z.pop(),J.pop(),V}function W(K){if(typeof K!=="object"||K===null)return K;if(Array.isArray(K))return Q(K,W);if(K.constructor!==Object&&(X=Y.get(K.constructor)))return X(K,W);let V={};Z.push(K),J.push(V);for(let U in K){let H=K[U];if(typeof H!=="object"||H===null)V[U]=H;else if(H.constructor!==Object&&(X=Y.get(H.constructor)))V[U]=X(H,W);else if(ArrayBuffer.isView(H))V[U]=EJ(H);else{let B=Z.indexOf(H);if(B!==-1)V[U]=J[B];else V[U]=W(H)}}return Z.pop(),J.pop(),V}}});var xX=S((qk0,cC)=>{var T70=WG()({circles:!1,proto:!0}),{kSchemaVisited:mC,kSchemaResponse:R70}=H$(),dB=Symbol.for("fluent-schema-object"),{FST_ERR_SCH_MISSING_ID:P70,FST_ERR_SCH_ALREADY_PRESENT:I70,FST_ERR_SCH_DUPLICATE:C70,FST_ERR_SCH_CONTENT_MISSING_SCHEMA:lC}=w$(),pC=["params","body","querystring","query","headers"];function KG($){this.store=$||{}}KG.prototype.add=function($){let Z=T70($.isFluentSchema||$.isFluentJSONSchema||$[dB]?$.valueOf():$),J=Z.$id;if(!J)throw new P70;if(this.store[J])throw new I70(J);this.store[J]=Z};KG.prototype.getSchemas=function(){return Object.assign({},this.store)};KG.prototype.getSchema=function($){return this.store[$]};function dC($){return typeof $==="object"&&Object.getPrototypeOf($)!==Object.prototype}function E70($,Z){if($[mC])return $;if($.query){if($.querystring)throw new C70("querystring");$.querystring=$.query}b70($);for(let J of pC){let Y=$[J];if(Y&&!dC(Y)){if(J==="body"&&Y.content){let X=Y.content,Q=Object.keys(X);for(let G=0;G<Q.length;G++){let W=Q[G];if(!X[W].schema)throw new lC(W)}continue}}}if($.response){let J=Object.keys($.response);for(let Y of J){if(dC($.response[Y]))continue;let X=$.response[Y].content;if(X){let Q=Object.keys(X);for(let G=0;G<Q.length;G++){let W=Q[G];if(!X[W].schema)throw new lC(W)}}}}return $[mC]=!0,$}function b70($){for(let Z of pC)if($[Z]&&($[Z].isFluentSchema||$[Z][dB]))$[Z]=$[Z].valueOf();if($.response){let Z=Object.keys($.response);for(let J of Z)if($.response[J].isFluentSchema||$.response[J][dB])$.response[J]=$.response[J].valueOf()}}function _70($,Z,J){let Y=$[R70];if(!Y)return!1;if(Y[Z]){if(Y[Z].constructor===Object&&J){let Q=J.split(";",1)[0];if(Y[Z][Q])return Y[Z][Q];if(Y[Z]["*/*"])return Y[Z]["*/*"];return!1}return Y[Z]}let X=(Z+"")[0]+"xx";if(Y[X]){if(Y[X].constructor===Object&&J){let Q=J.split(";",1)[0];if(Y[X][Q])return Y[X][Q];if(Y[X]["*/*"])return Y[X]["*/*"];return!1}return Y[X]}if(Y.default){if(Y.default.constructor===Object&&J){let Q=J.split(";",1)[0];if(Y.default[Q])return Y.default[Q];if(Y.default["*/*"])return Y.default["*/*"];return!1}return Y.default}return!1}cC.exports={buildSchemas($){return new KG($)},getSchemaSerializer:_70,normalizeSchema:E70}});var VG=S((jk0,iC)=>{var S70=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;iC.exports=class ${constructor(Z){switch(Z&&Z.rounding){case"floor":this.parseInteger=Math.floor;break;case"ceil":this.parseInteger=Math.ceil;break;case"round":this.parseInteger=Math.round;break;case"trunc":default:this.parseInteger=Math.trunc;break}this._options=Z}asInteger(Z){if(Number.isInteger(Z))return""+Z;else if(typeof Z==="bigint")return Z.toString();let J=this.parseInteger(Z);if(J===1/0||J===-1/0||J!==J)throw Error(`The value "${Z}" cannot be converted to an integer.`);return""+J}asNumber(Z){let J=Number(Z);if(J!==J)throw Error(`The value "${Z}" cannot be converted to a number.`);else if(J===1/0||J===-1/0)return"null";else return""+J}asBoolean(Z){return Z&&"true"||"false"}asDateTime(Z){if(Z===null)return'""';if(Z instanceof Date)return'"'+Z.toISOString()+'"';if(typeof Z==="string")return'"'+Z+'"';throw Error(`The value "${Z}" cannot be converted to a date-time.`)}asDate(Z){if(Z===null)return'""';if(Z instanceof Date)return'"'+new Date(Z.getTime()-Z.getTimezoneOffset()*60000).toISOString().slice(0,10)+'"';if(typeof Z==="string")return'"'+Z+'"';throw Error(`The value "${Z}" cannot be converted to a date.`)}asTime(Z){if(Z===null)return'""';if(Z instanceof Date)return'"'+new Date(Z.getTime()-Z.getTimezoneOffset()*60000).toISOString().slice(11,19)+'"';if(typeof Z==="string")return'"'+Z+'"';throw Error(`The value "${Z}" cannot be converted to a time.`)}asString(Z){let J=Z.length;if(J===0)return'""';else if(J<42){let Y="",X=-1,Q=255;for(let G=0;G<J;G++)if(Q=Z.charCodeAt(G),Q===34||Q===92)X===-1&&(X=0),Y+=Z.slice(X,G)+"\\",X=G;else if(Q<32||Q>=55296&&Q<=57343)return JSON.stringify(Z);return X===-1&&'"'+Z+'"'||'"'+Y+Z.slice(X)+'"'}else if(J<5000&&S70.test(Z)===!1)return'"'+Z+'"';else return JSON.stringify(Z)}asUnsafeString(Z){return'"'+Z+'"'}getState(){return this._options}static restoreFromState(Z){return new $(Z)}}});var oC=S((Nk0,nC)=>{var f70=VG(),k70={mode:"standalone"},v70=f70.restoreFromState(k70);nC.exports=function(Z,J){let{asString:Y,asNumber:X,asBoolean:Q,asDateTime:G,asDate:W,asTime:K,asUnsafeString:V}=J,U=J.asInteger.bind(J),H="{",B="}",z="[",F="]",A=",",j=":",N='"',w="{}",q="[]",M='""',C="null";function R(I){let _=I&&typeof I.toJSON==="function"?I.toJSON():I;if(_===null)return w;let E,f="{",b=!1;if(E=_.statusCode,E!==void 0)!b&&(b=!0)||(f+=","),f+='"statusCode":',f+=X(E);if(E=_.code,E!==void 0)if(!b&&(b=!0)||(f+=","),f+='"code":',typeof E!=="string")if(E===null)f+=M;else if(E instanceof Date)f+='"'+E.toISOString()+'"';else if(E instanceof RegExp)f+=Y(E.source);else f+=Y(E.toString());else f+=Y(E);if(E=_.error,E!==void 0)if(!b&&(b=!0)||(f+=","),f+='"error":',typeof E!=="string")if(E===null)f+=M;else if(E instanceof Date)f+='"'+E.toISOString()+'"';else if(E instanceof RegExp)f+=Y(E.source);else f+=Y(E.toString());else f+=Y(E);if(E=_.message,E!==void 0)if(!b&&(b=!0)||(f+=","),f+='"message":',typeof E!=="string")if(E===null)f+=M;else if(E instanceof Date)f+='"'+E.toISOString()+'"';else if(E instanceof RegExp)f+=Y(E.source);else f+=Y(E.toString());else f+=Y(E);return f+"}"}return R}(null,v70)});var hX=S((Mk0,tC)=>{var sC=Y0("http").STATUS_CODES,y70=dH(),{setErrorStatusCode:x70}=x4(),{kReplyHeaders:a5,kReplyNextErrorHandler:UG,kReplyIsRunningOnErrorHook:h70,kRouteContext:aC,kDisableRequestLogging:HG}=H$(),{FST_ERR_REP_INVALID_PAYLOAD_TYPE:g70,FST_ERR_FAILED_ERROR_SERIALIZATION:u70}=w$(),{getSchemaSerializer:m70}=xX(),pB=oC(),l70={func:p70,toJSON(){return this.func.name.toString()+"()"}};function d70($,Z,J){$[h70]=!1;let Y=$[aC];if($[UG]===!1){rC(Z,$,function(G,W){try{G.raw.writeHead(G.raw.statusCode,G[a5])}catch(K){if(!G.log[HG])G.log.warn({req:G.request,res:G,err:K},K?.message);G.raw.writeHead(G.raw.statusCode)}G.raw.end(W)});return}let X=$[UG]||Y.errorHandler;$[UG]=Object.getPrototypeOf(X),delete $[a5]["content-type"],delete $[a5]["content-length"];let Q=X.func;if(!Q){$[UG]=!1,rC(Z,$,J);return}try{let G=Q(Z,$.request,$);if(G!==void 0)if(G!==null&&typeof G.then==="function")y70(G,$);else $.send(G)}catch(G){$.send(G)}}function p70($,Z,J){if(i70($,J),x70(J,$),J.statusCode<500){if(!J.log[HG])J.log.info({res:J,err:$},$?.message)}else if(!J.log[HG])J.log.error({req:Z,res:J,err:$},$?.message);J.send($)}function rC($,Z,J){let{raw:Y,statusCode:X}=Z;Z[a5]["content-type"]=Z[a5]["content-type"]??"application/json; charset=utf-8";let Q;try{let G=m70(Z[aC],X,Z[a5]["content-type"]);if(G===!1)Q=pB({error:sC[X+""],code:$.code,message:$.message,statusCode:X});else Q=G(Object.create($,{error:{value:sC[X+""]},message:{value:$.message},statusCode:{value:X}}))}catch(G){if(!Z.log[HG])Z.log.error({err:G,statusCode:Y.statusCode},"The serializer for the given status code failed");Z.code(500),Q=pB(new u70(G.message,$.message))}if(typeof Q!=="string"&&!Buffer.isBuffer(Q))Q=pB(new g70(typeof Q));Z[a5]["content-length"]=""+Buffer.byteLength(Q),J(Z,Q)}function c70($=l70,Z){if(!Z)return $;let J=Object.create($);return J.func=Z,J}function i70($,Z){let J=Z.raw,Y=J.statusCode;if(Y=Y>=400?Y:500,$!=null){if($.headers!==void 0)Z.headers($.headers);if($.status>=400)Y=$.status;else if($.statusCode>=400)Y=$.statusCode}J.statusCode=Y}tC.exports={buildErrorHandler:c70,handleError:d70}});var mX=S((Dk0,JE)=>{var{kReply:cB,kRequest:iB,kState:n70,kHasBeenDecorated:o70}=H$(),{FST_ERR_DEC_ALREADY_PRESENT:eC,FST_ERR_DEC_MISSING_DEPENDENCY:s70,FST_ERR_DEC_AFTER_START:r70,FST_ERR_DEC_REFERENCE_TYPE:a70,FST_ERR_DEC_DEPENDENCY_INVALID_TYPE:t70,FST_ERR_DEC_UNDECLARED:e70}=w$();function $J0($,Z,J,Y){if(Object.hasOwn($,Z))throw new eC(Z);if(nB($,Z,Y),J&&(typeof J.getter==="function"||typeof J.setter==="function"))Object.defineProperty($,Z,{get:J.getter,set:J.setter});else $[Z]=J}function ZJ0($){if(!gX(this,$))throw new e70($,"instance");if(typeof this[$]==="function")return this[$].bind(this);return this[$]}function $E($,Z,J,Y){let X=$.prototype;if(Object.hasOwn(X,Z)||uX($,Z))throw new eC(Z);if($[o70]=!0,nB($,Z,Y),J&&(typeof J.getter==="function"||typeof J.setter==="function"))Object.defineProperty(X,Z,{get:J.getter,set:J.setter});else if(typeof J==="function")X[Z]=J;else $.props.push({key:Z,value:J})}function ZE($,Z){if(typeof Z==="object"&&Z&&!(typeof Z.getter==="function"||typeof Z.setter==="function"))throw new a70($,typeof Z)}function JJ0($,Z,J){return oB(this,$),$J0(this,$,Z,J),this}function gX($,Z){if(Z)return Z in $||$.prototype&&Z in $.prototype||uX($,Z);return $ in this}function uX($,Z){if($.props)return $.props.find(({key:J})=>J===Z);return!1}function YJ0($){if($&&uX(this[iB],$))return!0;return gX(this[iB].prototype,$)}function XJ0($){if($&&uX(this[cB],$))return!0;return gX(this[cB].prototype,$)}function nB($,Z,J){if(J===void 0||J===null)return;if(!Array.isArray(J))throw new t70(Z);for(let Y=0;Y!==J.length;++Y)if(!gX($,J[Y]))throw new s70(J[Y])}function QJ0($,Z,J){return oB(this,$),ZE($,Z),$E(this[cB],$,Z,J),this}function GJ0($,Z,J){return oB(this,$),ZE($,Z),$E(this[iB],$,Z,J),this}function oB($,Z){if($[n70].started)throw new r70(Z)}JE.exports={add:JJ0,exist:gX,existRequest:YJ0,existReply:XJ0,dependencies:nB,decorateReply:QJ0,decorateRequest:GJ0,getInstanceDecorator:ZJ0,hasKey:uX}});var MG=S((wk0,NG)=>{var BG=Y0("stream").finished,{kFourOhFourContext:YE,kReplyErrorHandlerCalled:UE,kReplyHijacked:eB,kReplyStartTime:dX,kReplyEndTime:$z,kReplySerializer:e6,kReplySerializerDefault:zG,kReplyIsError:FG,kReplyHeaders:k1,kReplyTrailers:L$,kReplyHasStatusCode:Zz,kReplyIsRunningOnErrorHook:Jz,kReplyNextErrorHandler:WJ0,kDisableRequestLogging:HE,kSchemaResponse:AG,kReplyCacheSerializeFns:dZ,kSchemaController:sB,kOptions:KJ0,kRouteContext:K1,kTimeoutTimer:OG,kOnAbort:bJ,kRequestSignal:BE}=H$(),{onSendHookRunner:zE,onResponseHookRunner:VJ0,preHandlerHookRunner:UJ0,preSerializationHookRunner:HJ0}=uZ(),XE=rH()[Symbol.for("internals")],BJ0=yX(),tB=BJ0.now,{handleError:QE}=hX(),{getSchemaSerializer:zJ0}=xX(),rB={JSON:"application/json; charset=utf-8",PLAIN:"text/plain; charset=utf-8",OCTET:"application/octet-stream"},{FST_ERR_REP_INVALID_PAYLOAD_TYPE:FJ0,FST_ERR_REP_RESPONSE_BODY_CONSUMED:AJ0,FST_ERR_REP_READABLE_STREAM_LOCKED:OJ0,FST_ERR_REP_ALREADY_SENT:qJ0,FST_ERR_SEND_INSIDE_ONERR:jJ0,FST_ERR_BAD_STATUS_CODE:NJ0,FST_ERR_BAD_TRAILER_NAME:MJ0,FST_ERR_BAD_TRAILER_VALUE:DJ0,FST_ERR_MISSING_SERIALIZATION_FN:wJ0,FST_ERR_MISSING_CONTENTTYPE_SERIALIZATION_FN:LJ0,FST_ERR_DEC_UNDECLARED:TJ0}=w$(),GE=mX(),FE=Object.prototype.toString;function v1($,Z,J){this.raw=$,this[e6]=null,this[UE]=!1,this[FG]=!1,this[Jz]=!1,this.request=Z,this[k1]={},this[L$]=null,this[Zz]=!1,this[dX]=void 0,this.log=J}v1.props=[];Object.defineProperties(v1.prototype,{[K1]:{get(){return this.request[K1]}},elapsedTime:{get(){if(this[dX]===void 0)return 0;return(this[$z]||tB())-this[dX]}},server:{get(){return this.request[K1].server}},sent:{enumerable:!0,get(){return(this[eB]||this.raw.writableEnded)===!0}},statusCode:{get(){return this.raw.statusCode},set($){this.code($)}},routeOptions:{get(){return this.request.routeOptions}}});v1.prototype.writeEarlyHints=function($,Z){return this.raw.writeEarlyHints($,Z),this};v1.prototype.hijack=function(){if(this[eB]=!0,this.request[BE]){if(clearTimeout(this.request[OG]),this.request[OG]=null,this.request[bJ])this.request.raw.removeListener("close",this.request[bJ]),this.request[bJ]=null}return this};v1.prototype.send=function($){if(this[Jz])throw new jJ0;if(this.sent===!0)return this.log.warn({err:new qJ0(this.request.url,this.request.method)}),this;if(this[FG]||$ instanceof Error)return this[FG]=!1,_J(this,$,t5),this;if($===void 0)return t5(this,$),this;let Z=this.getHeader("content-type"),J=Z!==void 0;if($!==null){if(typeof $.pipe==="function"||typeof $.getReader==="function"||FE.call($)==="[object Response]")return t5(this,$),this;if($.buffer instanceof ArrayBuffer){if(!J)this[k1]["content-type"]=rB.OCTET;let Y=Buffer.isBuffer($)?$:Buffer.from($.buffer,$.byteOffset,$.byteLength);return t5(this,Y),this}if(!J&&typeof $==="string")return this[k1]["content-type"]=rB.PLAIN,t5(this,$),this}if(this[e6]!==null){if(typeof $!=="string")return WE(this,$),this;$=this[e6]($)}else if(!J||Z.indexOf("json")!==-1){if(!J)this[k1]["content-type"]=rB.JSON;else if(Z.indexOf("charset")===-1){let Y=Z.trim();if(Y.endsWith(";"))this[k1]["content-type"]=`${Y} charset=utf-8`;else this[k1]["content-type"]=`${Y}; charset=utf-8`}if(typeof $!=="string")return WE(this,$),this}return t5(this,$),this};v1.prototype.getHeader=function($){$=$.toLowerCase();let Z=this[k1][$];return Z!==void 0?Z:this.raw.getHeader($)};v1.prototype.getHeaders=function(){return{...this.raw.getHeaders(),...this[k1]}};v1.prototype.hasHeader=function($){return $=$.toLowerCase(),this[k1][$]!==void 0||this.raw.hasHeader($)};v1.prototype.removeHeader=function($){return delete this[k1][$.toLowerCase()],this};v1.prototype.header=function($,Z=""){if($=$.toLowerCase(),this[k1][$]&&$==="set-cookie"){if(typeof this[k1][$]==="string")this[k1][$]=[this[k1][$]];if(Array.isArray(Z))Array.prototype.push.apply(this[k1][$],Z);else this[k1][$].push(Z)}else this[k1][$]=Z;return this};v1.prototype.headers=function($){let Z=Object.keys($);for(let J=0;J!==Z.length;++J){let Y=Z[J];this.header(Y,$[Y])}return this};var RJ0=new Set(["transfer-encoding","content-length","host","cache-control","max-forwards","te","authorization","set-cookie","content-encoding","content-type","content-range","trailer"]);v1.prototype.trailer=function($,Z){if($=$.toLowerCase(),RJ0.has($))throw new MJ0($);if(typeof Z!=="function")throw new DJ0($,typeof Z);if(this[L$]===null)this[L$]={};return this[L$][$]=Z,this};v1.prototype.hasTrailer=function($){return this[L$]?.[$.toLowerCase()]!==void 0};v1.prototype.removeTrailer=function($){if(this[L$]===null)return this;return this[L$][$.toLowerCase()]=void 0,this};v1.prototype.code=function($){let Z=+$;if(!(Z>=100&&Z<=599))throw new NJ0($||String($));return this.raw.statusCode=Z,this[Zz]=!0,this};v1.prototype.status=v1.prototype.code;v1.prototype.getSerializationFunction=function($,Z){let J;if(typeof $==="string"||typeof $==="number")if(typeof Z==="string")J=this[K1][AG]?.[$]?.[Z];else J=this[K1][AG]?.[$];else if(typeof $==="object")J=this[K1][dZ]?.get($);return J};v1.prototype.compileSerializationSchema=function($,Z=null,J=null){let{request:Y}=this,{method:X,url:Q}=Y;if(this[K1][dZ]?.has($))return this[K1][dZ].get($);let W=(this[K1].serializerCompiler||this.server[sB].serializerCompiler||(this.server[sB].setupSerializer(this.server[KJ0])||this.server[sB].serializerCompiler))({schema:$,method:X,url:Q,httpStatus:Z,contentType:J});if(this[K1][dZ]==null)this[K1][dZ]=new WeakMap;return this[K1][dZ].set($,W),W};v1.prototype.serializeInput=function($,Z,J,Y){let X=J,Q;if(J=typeof Z==="string"||typeof Z==="number"?Z:J,Y=J&&X!==J?X:Y,J!=null){if(Y!=null)Q=this[K1][AG]?.[J]?.[Y];else Q=this[K1][AG]?.[J];if(Q==null){if(Y)throw new LJ0(J,Y);throw new wJ0(J)}}else if(this[K1][dZ]?.has(Z))Q=this[K1][dZ].get(Z);else Q=this.compileSerializationSchema(Z,J,Y);return Q($)};v1.prototype.serialize=function($){if(this[e6]!==null)return this[e6]($);else if(this[K1]&&this[K1][zG])return this[K1][zG]($,this.raw.statusCode);else return OE(this[K1],$,this.raw.statusCode)};v1.prototype.serializer=function($){return this[e6]=$,this};v1.prototype.type=function($){return this[k1]["content-type"]=$,this};v1.prototype.redirect=function($,Z){if(!Z)Z=this[Zz]?this.raw.statusCode:302;return this.header("location",$).code(Z).send()};v1.prototype.callNotFound=function(){return fJ0(this),this};v1.prototype.then=function($,Z){if(this.sent){$();return}BG(this.raw,(J)=>{if(J&&J.code!=="ERR_STREAM_PREMATURE_CLOSE")if(Z)Z(J);else this.log&&this.log.warn("unhandled rejection on reply.then");else $()})};v1.prototype.getDecorator=function($){if(!GE.hasKey(this,$)&&!GE.exist(this,$))throw new TJ0($,"reply");let Z=this[$];if(typeof Z==="function")return Z.bind(this);return Z};function WE($,Z){if($[K1].preSerialization!==null)HJ0($[K1].preSerialization,$.request,$,Z,KE);else KE(null,void 0,$,Z)}function KE($,Z,J,Y){if($!=null){_J(J,$);return}try{if(J[e6]!==null)Y=J[e6](Y);else if(J[K1]&&J[K1][zG])Y=J[K1][zG](Y,J.raw.statusCode);else Y=OE(J[K1],Y,J.raw.statusCode,J[k1]["content-type"])}catch(X){PJ0(X,J),_J(J,X);return}t5(J,Y)}function PJ0($,Z){$.serialization=Z[K1].config}function t5($,Z){if($[K1].onSend!==null)zE($[K1].onSend,$.request,$,Z,IJ0);else AE($,Z)}function IJ0($,Z,J,Y){if($!=null)_J(J,$);else AE(J,Y)}function aB($,Z){let J=$.raw;try{J.writeHead(Z,$[k1])}catch(Y){if(Y.code==="ERR_HTTP_HEADERS_SENT")$.log.warn(`Reply was already sent, did you forget to "return reply" in the "${$.request.raw.url}" (${$.request.raw.method}) route?`);throw Y}}function AE($,Z){let{raw:J,request:Y}=$;if($[L$]!==null){let Q=Object.keys($[L$]),G="";for(let W of Q){if(typeof $[L$][W]!=="function")continue;G+=" ",G+=W}$.header("Transfer-Encoding","chunked"),$.header("Trailer",G.trim())}if(FE.call(Z)==="[object Response]"){if(typeof Z.status==="number")$.code(Z.status);if(typeof Z.headers==="object"&&typeof Z.headers.forEach==="function")for(let[Q,G]of Z.headers)$.header(Q,G);if(Z.body!==null){if(Z.bodyUsed)throw new AJ0}Z=Z.body}let X=J.statusCode;if(Z===void 0||Z===null){if(X>=200&&X!==204&&X!==304&&Y.method!=="HEAD"&&$[L$]===null)$[k1]["content-length"]="0";aB($,X),lX(Z,J,$);return}if(X>=100&&X<200||X===204){if($.removeHeader("content-type"),$.removeHeader("content-length"),aB($,X),lX(void 0,J,$),typeof Z.resume==="function")Z.on("error",jG),Z.resume();return}if(typeof Z.pipe==="function"){EJ0(Z,J,$);return}if(typeof Z.getReader==="function"){CJ0(Z,J,$);return}if(typeof Z!=="string"&&!Buffer.isBuffer(Z))throw new FJ0(typeof Z);if($[L$]===null){let Q=$[k1]["content-length"];if(!Q||Y.raw.method!=="HEAD"&&Number(Q)!==Buffer.byteLength(Z))$[k1]["content-length"]=""+Buffer.byteLength(Z)}aB($,X),J.write(Z),lX(Z,J,$)}function qG($,Z,J){if(Z.code==="ERR_STREAM_PREMATURE_CLOSE"){if(!$[HE])$.info({res:J},"stream closed prematurely")}else $.warn({err:Z},"response terminated with an error with headers already sent")}function CJ0($,Z,J){if($.locked)throw new OJ0;let Y=!0,X=!1,Q=!1,G=$.getReader();if(BG(Z,function(U){if(Y){if(U!=null&&Z.headersSent&&!X)X=!0,qG(J.log,U,Z);G.cancel().catch(jG)}}),!Z.headersSent)for(let U in J[k1])Z.setHeader(U,J[k1][U]);else J.log.warn("response will send, but you shouldn't use res.writeHead in stream mode");function W(U){if(U.done){Y=!1,lX(null,Z,J);return}if(Z.destroyed){Y=!1,G.cancel().catch(jG);return}if(Z.write(U.value)===!1){Q=!0,Z.once("drain",K);return}G.read().then(W,V)}function K(){if(!Q||!Y||Z.destroyed)return;Q=!1,G.read().then(W,V)}function V(U){if(Y=!1,Z.headersSent||J.request.raw.aborted===!0){if(!X)X=!0,qG(J.log,U,J);Z.destroy()}else _J(J,U)}G.read().then(W,V)}function EJ0($,Z,J){let Y=!0,X=!1;if(bJ0($,Z,J),BG($,{readable:!0,writable:!1},function(Q){if(Y=!1,Q!=null)if(Z.headersSent||J.request.raw.aborted===!0){if(!X)X=!0,qG(J.log,Q,J);Z.destroy()}else _J(J,Q)}),BG(Z,function(Q){if(Y){if(Q!=null&&Z.headersSent&&!X)X=!0,qG(J.log,Q,Z);if(typeof $.destroy==="function")$.destroy();else if(typeof $.close==="function")$.close(jG);else if(typeof $.abort==="function")$.abort();else J.log.warn("stream payload does not end properly")}}),!Z.headersSent)for(let Q in J[k1])Z.setHeader(Q,J[k1][Q]);else J.log.warn("response will send, but you shouldn't use res.writeHead in stream mode");$.pipe(Z)}function lX($,Z,J){if(J[L$]===null){Z.end(null,null,null);return}let Y=Object.keys(J[L$]),X={},Q=0,G=!0;function W(){if(Q===0)Z.addTrailers(X),Z.end(null,null,null)}for(let K of Y){let V=function(H,B){if(Q++,H)J.log.debug(H);else X[K]=B;process.nextTick(W)};if(typeof J[L$][K]!=="function")continue;G=!1,Q--;let U=J[L$][K](J,$,V);if(typeof U==="object"&&typeof U.then==="function")U.then((H)=>V(null,H),V)}if(G)Z.end(null,null,null)}function bJ0($,Z,J){if(J[L$]===null)return;$.on("end",()=>lX(null,Z,J))}function _J($,Z,J){if($[K1].onError!==null&&!$[WJ0])$[Jz]=!0,zE($[K1].onError,$.request,$,Z,()=>QE($,Z,J));else QE($,Z,J)}function _J0($){$[dX]=tB();let Z=(J)=>{$[$z]=tB(),$.raw.removeListener("finish",Z),$.raw.removeListener("error",Z);let Y=$[K1];if($.request[BE]){if(clearTimeout($.request[OG]),$.request[OG]=null,$.request[bJ])$.request.raw.removeListener("close",$.request[bJ]),$.request[bJ]=null}if(Y&&Y.onResponse!==null)VJ0(Y.onResponse,$.request,$,VE);else VE(J,$.request,$)};$.raw.on("finish",Z),$.raw.on("error",Z)}function VE($,Z,J){if(J.log[HE])return;let Y=J.elapsedTime;if($!=null){J.log.error({res:J,err:$,responseTime:Y},"request errored");return}J.log.info({res:J,responseTime:Y},"request completed")}function SJ0($){let Z=$.props.slice();function J(Y,X,Q){this.raw=Y,this[FG]=!1,this[UE]=!1,this[eB]=!1,this[e6]=null,this.request=X,this[k1]={},this[L$]=null,this[dX]=void 0,this[$z]=void 0,this.log=Q;let G;for(let W=0;W<Z.length;W++)G=Z[W],this[G.key]=G.value}return Object.setPrototypeOf(J.prototype,$.prototype),Object.setPrototypeOf(J,$),J.parent=$,J.props=Z,J}function fJ0($){if($[K1][YE]===null){$.log.warn("Trying to send a NotFound error inside a 404 handler. Sending basic 404 response."),$.code(404).send("404 Not Found");return}if($.request[K1]=$[K1][YE],$[K1].preHandler!==null)UJ0($[K1].preHandler,$.request,$,XE.preHandlerCallback);else XE.preHandlerCallback(null,$.request,$)}function OE($,Z,J,Y){let X=zJ0($,J,Y);if(X)return X(Z);return JSON.stringify(Z)}function jG(){}NG.exports=v1;NG.exports.buildReply=SJ0;NG.exports.setupResponseListeners=_J0});var qE=S((Lk0,DG)=>{function Yz($){if(!$)throw TypeError("argument req is required");let Z=$.headers["x-forwarded-for"],J=$.socket.remoteAddress;if(!Z||typeof Z!=="string")return[J];else if(Z.indexOf(",")===-1){let Y=Z.trim();return Y.length?[J,Y]:[J]}else return kJ0(Z,J)}function kJ0($,Z){let J=[Z],Y=$.length,X=Y,Q,G;for(G=Y-1;G>=0;--G)if(Q=$[G],Q===" ")X===Y&&(X=Y=G);else if(Q===",")X!==Y&&J.push($.slice(X,Y)),X=Y=G;else X=G;return X!==Y&&J.push($.substring(X,Y)),J}DG.exports=Yz;DG.exports.default=Yz;DG.exports.forwarded=Yz});var NE=S((jE,wG)=>{(function($){let J={fourOctet:new RegExp("^(0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)$","i"),threeOctet:new RegExp("^(0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)$","i"),twoOctet:new RegExp("^(0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)$","i"),longValue:new RegExp("^(0?\\d+|0x[a-f0-9]+)$","i")},Y=new RegExp("^0[0-7]+$","i"),X=new RegExp("^0x[a-f0-9]+$","i"),Q="%[0-9a-z]{1,}",G="(?:[0-9a-f]+::?)+",W={zoneIndex:new RegExp("%[0-9a-z]{1,}","i"),native:new RegExp("^(::)?((?:[0-9a-f]+::?)+)?([0-9a-f]+)?(::)?(%[0-9a-z]{1,})?$","i"),deprecatedTransitional:new RegExp("^(?:::)((0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)(%[0-9a-z]{1,})?)$","i"),transitional:new RegExp("^((?:(?:[0-9a-f]+::?)+)|(?:::)(?:(?:[0-9a-f]+::?)+)?)(0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)\\.(0?\\d+|0x[a-f0-9]+)(%[0-9a-z]{1,})?$","i")};function K(z,F){if(z.indexOf("::")!==z.lastIndexOf("::"))return null;let A=0,j=-1,N=(z.match(W.zoneIndex)||[])[0],w,q;if(N)N=N.substring(1),z=z.replace(/%.+$/,"");while((j=z.indexOf(":",j+1))>=0)A++;if(z.substr(0,2)==="::")A--;if(z.substr(-2,2)==="::")A--;if(A>F)return null;q=F-A,w=":";while(q--)w+="0:";if(z=z.replace("::",w),z[0]===":")z=z.slice(1);if(z[z.length-1]===":")z=z.slice(0,-1);return F=function(){let M=z.split(":"),C=[];for(let R=0;R<M.length;R++)C.push(parseInt(M[R],16));return C}(),{parts:F,zoneId:N}}function V(z,F,A,j){if(z.length!==F.length)throw Error("ipaddr: cannot match CIDR for objects with different lengths");let N=0,w;while(j>0){if(w=A-j,w<0)w=0;if(z[N]>>w!==F[N]>>w)return!1;j-=A,N+=1}return!0}function U(z){if(X.test(z))return parseInt(z,16);if(z[0]==="0"&&!isNaN(parseInt(z[1],10))){if(Y.test(z))return parseInt(z,8);throw Error(`ipaddr: cannot parse ${z} as octal`)}return parseInt(z,10)}function H(z,F){while(z.length<F)z=`0${z}`;return z}let B={};if(B.IPv4=function(){function z(F){if(F.length!==4)throw Error("ipaddr: ipv4 octet count should be 4");let A,j;for(A=0;A<F.length;A++)if(j=F[A],!(0<=j&&j<=255))throw Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=F}return z.prototype.SpecialRanges={unspecified:[[new z([0,0,0,0]),8]],broadcast:[[new z([255,255,255,255]),32]],multicast:[[new z([224,0,0,0]),4]],linkLocal:[[new z([169,254,0,0]),16]],loopback:[[new z([127,0,0,0]),8]],carrierGradeNat:[[new z([100,64,0,0]),10]],private:[[new z([10,0,0,0]),8],[new z([172,16,0,0]),12],[new z([192,168,0,0]),16]],reserved:[[new z([192,0,0,0]),24],[new z([192,0,2,0]),24],[new z([192,88,99,0]),24],[new z([198,18,0,0]),15],[new z([198,51,100,0]),24],[new z([203,0,113,0]),24],[new z([240,0,0,0]),4]],as112:[[new z([192,175,48,0]),24],[new z([192,31,196,0]),24]],amt:[[new z([192,52,193,0]),24]]},z.prototype.kind=function(){return"ipv4"},z.prototype.match=function(F,A){let j;if(A===void 0)j=F,F=j[0],A=j[1];if(F.kind()!=="ipv4")throw Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return V(this.octets,F.octets,8,A)},z.prototype.prefixLengthFromSubnetMask=function(){let F=0,A=!1,j={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},N,w,q;for(N=3;N>=0;N-=1)if(w=this.octets[N],w in j){if(q=j[w],A&&q!==0)return null;if(q!==8)A=!0;F+=q}else return null;return 32-F},z.prototype.range=function(){return B.subnetMatch(this,this.SpecialRanges)},z.prototype.toByteArray=function(){return this.octets.slice(0)},z.prototype.toIPv4MappedAddress=function(){return B.IPv6.parse(`::ffff:${this.toString()}`)},z.prototype.toNormalizedString=function(){return this.toString()},z.prototype.toString=function(){return this.octets.join(".")},z}(),B.IPv4.broadcastAddressFromCIDR=function(z){try{let F=this.parseCIDR(z),A=F[0].toByteArray(),j=this.subnetMaskFromPrefixLength(F[1]).toByteArray(),N=[],w=0;while(w<4)N.push(parseInt(A[w],10)|parseInt(j[w],10)^255),w++;return new this(N)}catch(F){throw Error("ipaddr: the address does not have IPv4 CIDR format")}},B.IPv4.isIPv4=function(z){return this.parser(z)!==null},B.IPv4.isValid=function(z){try{return new this(this.parser(z)),!0}catch(F){return!1}},B.IPv4.isValidCIDR=function(z){try{return this.parseCIDR(z),!0}catch(F){return!1}},B.IPv4.isValidFourPartDecimal=function(z){if(B.IPv4.isValid(z)&&z.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))return!0;else return!1},B.IPv4.isValidCIDRFourPartDecimal=function(z){let F=z.match(/^(.+)\/(\d+)$/);if(!B.IPv4.isValidCIDR(z)||!F)return!1;return B.IPv4.isValidFourPartDecimal(F[1])},B.IPv4.networkAddressFromCIDR=function(z){let F,A,j,N,w;try{F=this.parseCIDR(z),j=F[0].toByteArray(),w=this.subnetMaskFromPrefixLength(F[1]).toByteArray(),N=[],A=0;while(A<4)N.push(parseInt(j[A],10)&parseInt(w[A],10)),A++;return new this(N)}catch(q){throw Error("ipaddr: the address does not have IPv4 CIDR format")}},B.IPv4.parse=function(z){let F=this.parser(z);if(F===null)throw Error("ipaddr: string is not formatted like an IPv4 Address");return new this(F)},B.IPv4.parseCIDR=function(z){let F;if(F=z.match(/^(.+)\/(\d+)$/)){let A=parseInt(F[2]);if(A>=0&&A<=32){let j=[this.parse(F[1]),A];return Object.defineProperty(j,"toString",{value:function(){return this.join("/")}}),j}}throw Error("ipaddr: string is not formatted like an IPv4 CIDR range")},B.IPv4.parser=function(z){let F,A,j;if(F=z.match(J.fourOctet))return function(){let N=F.slice(1,6),w=[];for(let q=0;q<N.length;q++)A=N[q],w.push(U(A));return w}();else if(F=z.match(J.longValue)){if(j=U(F[1]),j>4294967295||j<0)throw Error("ipaddr: address outside defined range");return function(){let N=[],w;for(w=0;w<=24;w+=8)N.push(j>>w&255);return N}().reverse()}else if(F=z.match(J.twoOctet))return function(){let N=F.slice(1,4),w=[];if(j=U(N[1]),j>16777215||j<0)throw Error("ipaddr: address outside defined range");return w.push(U(N[0])),w.push(j>>16&255),w.push(j>>8&255),w.push(j&255),w}();else if(F=z.match(J.threeOctet))return function(){let N=F.slice(1,5),w=[];if(j=U(N[2]),j>65535||j<0)throw Error("ipaddr: address outside defined range");return w.push(U(N[0])),w.push(U(N[1])),w.push(j>>8&255),w.push(j&255),w}();else return null},B.IPv4.subnetMaskFromPrefixLength=function(z){if(z=parseInt(z),z<0||z>32)throw Error("ipaddr: invalid IPv4 prefix length");let F=[0,0,0,0],A=0,j=Math.floor(z/8);while(A<j)F[A]=255,A++;if(j<4)F[j]=Math.pow(2,z%8)-1<<8-z%8;return new this(F)},B.IPv6=function(){function z(F,A){let j,N;if(F.length===16){this.parts=[];for(j=0;j<=14;j+=2)this.parts.push(F[j]<<8|F[j+1])}else if(F.length===8)this.parts=F;else throw Error("ipaddr: ipv6 part count should be 8 or 16");for(j=0;j<this.parts.length;j++)if(N=this.parts[j],!(0<=N&&N<=65535))throw Error("ipaddr: ipv6 part should fit in 16 bits");if(A)this.zoneId=A}return z.prototype.SpecialRanges={unspecified:[new z([0,0,0,0,0,0,0,0]),128],linkLocal:[new z([65152,0,0,0,0,0,0,0]),10],multicast:[new z([65280,0,0,0,0,0,0,0]),8],loopback:[new z([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new z([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new z([0,0,0,0,0,65535,0,0]),96],deprecatedSiteLocal:[new z([65216,0,0,0,0,0,0,0]),10],discard:[new z([256,0,0,0,0,0,0,0]),64],rfc6145:[new z([0,0,0,0,65535,0,0,0]),96],rfc6052:[[new z([100,65435,0,0,0,0,0,0]),96],[new z([100,65435,1,0,0,0,0,0]),48]],"6to4":[new z([8194,0,0,0,0,0,0,0]),16],teredo:[new z([8193,0,0,0,0,0,0,0]),32],benchmarking:[new z([8193,2,0,0,0,0,0,0]),48],amt:[new z([8193,3,0,0,0,0,0,0]),32],as112v6:[[new z([8193,4,274,0,0,0,0,0]),48],[new z([9760,79,32768,0,0,0,0,0]),48]],deprecatedOrchid:[new z([8193,16,0,0,0,0,0,0]),28],orchid2:[new z([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new z([8193,48,0,0,0,0,0,0]),28],segmentRouting:[new z([24320,0,0,0,0,0,0,0]),16],reserved:[[new z([8193,0,0,0,0,0,0,0]),23],[new z([8193,3512,0,0,0,0,0,0]),32],[new z([16383,0,0,0,0,0,0,0]),20]]},z.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},z.prototype.kind=function(){return"ipv6"},z.prototype.match=function(F,A){let j;if(A===void 0)j=F,F=j[0],A=j[1];if(F.kind()!=="ipv6")throw Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return V(this.parts,F.parts,16,A)},z.prototype.prefixLengthFromSubnetMask=function(){let F=0,A=!1,j={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},N,w;for(let q=7;q>=0;q-=1)if(N=this.parts[q],N in j){if(w=j[N],A&&w!==0)return null;if(w!==16)A=!0;F+=w}else return null;return 128-F},z.prototype.range=function(){return B.subnetMatch(this,this.SpecialRanges)},z.prototype.toByteArray=function(){let F,A=[],j=this.parts;for(let N=0;N<j.length;N++)F=j[N],A.push(F>>8),A.push(F&255);return A},z.prototype.toFixedLengthString=function(){let F=function(){let j=[];for(let N=0;N<this.parts.length;N++)j.push(H(this.parts[N].toString(16),4));return j}.call(this).join(":"),A="";if(this.zoneId)A=`%${this.zoneId}`;return F+A},z.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let F=this.parts.slice(-2),A=F[0],j=F[1];return new B.IPv4([A>>8,A&255,j>>8,j&255])},z.prototype.toNormalizedString=function(){let F=function(){let j=[];for(let N=0;N<this.parts.length;N++)j.push(this.parts[N].toString(16));return j}.call(this).join(":"),A="";if(this.zoneId)A=`%${this.zoneId}`;return F+A},z.prototype.toRFC5952String=function(){let F=/((^|:)(0(:|$)){2,})/g,A=this.toNormalizedString(),j=0,N=-1,w;while(w=F.exec(A))if(w[0].length>N)j=w.index,N=w[0].length;if(N<0)return A;return`${A.substring(0,j)}::${A.substring(j+N)}`},z.prototype.toString=function(){return this.toRFC5952String()},z}(),B.IPv6.broadcastAddressFromCIDR=function(z){try{let F=this.parseCIDR(z),A=F[0].toByteArray(),j=this.subnetMaskFromPrefixLength(F[1]).toByteArray(),N=[],w=0;while(w<16)N.push(parseInt(A[w],10)|parseInt(j[w],10)^255),w++;return new this(N)}catch(F){throw Error(`ipaddr: the address does not have IPv6 CIDR format (${F})`)}},B.IPv6.isIPv6=function(z){return this.parser(z)!==null},B.IPv6.isValid=function(z){if(typeof z==="string"&&z.indexOf(":")===-1)return!1;try{let F=this.parser(z);return new this(F.parts,F.zoneId),!0}catch(F){return!1}},B.IPv6.isValidCIDR=function(z){if(typeof z==="string"&&z.indexOf(":")===-1)return!1;try{return this.parseCIDR(z),!0}catch(F){return!1}},B.IPv6.networkAddressFromCIDR=function(z){let F,A,j,N,w;try{F=this.parseCIDR(z),j=F[0].toByteArray(),w=this.subnetMaskFromPrefixLength(F[1]).toByteArray(),N=[],A=0;while(A<16)N.push(parseInt(j[A],10)&parseInt(w[A],10)),A++;return new this(N)}catch(q){throw Error(`ipaddr: the address does not have IPv6 CIDR format (${q})`)}},B.IPv6.parse=function(z){let F=this.parser(z);if(F.parts===null)throw Error("ipaddr: string is not formatted like an IPv6 Address");return new this(F.parts,F.zoneId)},B.IPv6.parseCIDR=function(z){let F,A,j;if(A=z.match(/^(.+)\/(\d+)$/)){if(F=parseInt(A[2]),F>=0&&F<=128)return j=[this.parse(A[1]),F],Object.defineProperty(j,"toString",{value:function(){return this.join("/")}}),j}throw Error("ipaddr: string is not formatted like an IPv6 CIDR range")},B.IPv6.parser=function(z){let F,A,j,N,w,q;if(j=z.match(W.deprecatedTransitional))return this.parser(`::ffff:${j[1]}`);if(W.native.test(z))return K(z,8);if(j=z.match(W.transitional)){if(q=j[6]||"",F=j[1],!j[1].endsWith("::"))F=F.slice(0,-1);if(F=K(F+q,6),F.parts){w=[parseInt(j[2]),parseInt(j[3]),parseInt(j[4]),parseInt(j[5])];for(A=0;A<w.length;A++)if(N=w[A],!(0<=N&&N<=255))return null;return F.parts.push(w[0]<<8|w[1]),F.parts.push(w[2]<<8|w[3]),{parts:F.parts,zoneId:F.zoneId}}}return null},B.IPv6.subnetMaskFromPrefixLength=function(z){if(z=parseInt(z),z<0||z>128)throw Error("ipaddr: invalid IPv6 prefix length");let F=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],A=0,j=Math.floor(z/8);while(A<j)F[A]=255,A++;if(j<16)F[j]=Math.pow(2,z%8)-1<<8-z%8;return new this(F)},B.fromByteArray=function(z){let F=z.length;if(F===4)return new B.IPv4(z);else if(F===16)return new B.IPv6(z);else throw Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},B.isValid=function(z){return B.IPv6.isValid(z)||B.IPv4.isValid(z)},B.isValidCIDR=function(z){return B.IPv6.isValidCIDR(z)||B.IPv4.isValidCIDR(z)},B.parse=function(z){if(B.IPv6.isValid(z))return B.IPv6.parse(z);else if(B.IPv4.isValid(z))return B.IPv4.parse(z);else throw Error("ipaddr: the address has neither IPv6 nor IPv4 format")},B.parseCIDR=function(z){try{return B.IPv6.parseCIDR(z)}catch(F){try{return B.IPv4.parseCIDR(z)}catch(A){throw Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},B.process=function(z){let F=this.parse(z);if(F.kind()==="ipv6"&&F.isIPv4MappedAddress())return F.toIPv4Address();else return F},B.subnetMatch=function(z,F,A){let j,N,w,q;if(A===void 0||A===null)A="unicast";for(N in F)if(Object.prototype.hasOwnProperty.call(F,N)){if(w=F[N],w[0]&&!(w[0]instanceof Array))w=[w];for(j=0;j<w.length;j++)if(q=w[j],z.kind()===q[0].kind()&&z.match.apply(z,q))return N}return A},typeof wG<"u"&&wG.exports)wG.exports=B;else $.ipaddr=B})(jE)});var TE=S((Tk0,SJ)=>{/*!
|
|
107
|
+
* proxy-addr
|
|
108
|
+
* Copyright(c) 2021 Fastify collaborators
|
|
109
|
+
* Copyright(c) 2014-2016 Douglas Christopher Wilson
|
|
110
|
+
* MIT Licensed
|
|
111
|
+
*/SJ.exports=Xz;SJ.exports.default=Xz;SJ.exports.proxyaddr=Xz;SJ.exports.all=wE;SJ.exports.compile=LE;var vJ0=qE(),DE=NE(),yJ0=/^\d+$/u,LG=DE.isValid,TG=DE.parse,ME={linklocal:["169.254.0.0/16","fe80::/10"],loopback:["127.0.0.1/8","::1/128"],uniquelocal:["10.0.0.0/8","172.16.0.0/12","192.168.0.0/16","fc00::/7"]};function wE($,Z){let J=vJ0($);if(!Z)return J;if(typeof Z!=="function")Z=LE(Z);for(let Y=0;Y<J.length-1;Y++){if(Z(J[Y],Y))continue;J.length=Y+1}return J}function LE($){if(!$)throw TypeError("argument is required");let Z;if(typeof $==="string")Z=[$];else if(Array.isArray($))Z=$.slice();else throw TypeError("unsupported trust argument");for(let J=0;J<Z.length;J++){if($=Z[J],!Object.hasOwn(ME,$))continue;$=ME[$],Z.splice.apply(Z,[J,1].concat($)),J+=$.length-1}return hJ0(xJ0(Z))}function xJ0($){let Z=Array($.length);for(let J=0;J<$.length;J++)Z[J]=gJ0($[J]);return Z}function hJ0($){let Z=$.length;return Z===0?mJ0:Z===1?dJ0($[0]):lJ0($)}function gJ0($){let Z=$.lastIndexOf("/"),J=Z!==-1?$.substring(0,Z):$;if(!LG(J))throw TypeError("invalid IP address: "+J);let Y=TG(J);if(Z===-1&&Y.kind()==="ipv6"&&Y.isIPv4MappedAddress())Y=Y.toIPv4Address();let X=Y.kind()==="ipv6"?128:32,Q=Z!==-1?$.substring(Z+1,$.length):null;if(Q===null)Q=X;else if(yJ0.test(Q))Q=parseInt(Q,10);else if(Y.kind()==="ipv4"&&LG(Q))Q=uJ0(Q);else Q=null;if(Q<=0||Q>X)throw TypeError("invalid range on address: "+$);return[Y,Q]}function uJ0($){let Z=TG($);return Z.kind()==="ipv4"?Z.prefixLengthFromSubnetMask():null}function Xz($,Z){if(!$)throw TypeError("req argument is required");if(!Z)throw TypeError("trust argument is required");let J=wE($,Z);return J[J.length-1]}function mJ0(){return!1}function lJ0($){return function(J){if(!LG(J))return!1;let Y=TG(J),X,Q=Y.kind();for(let G=0;G<$.length;G++){let W=$[G],K=W[0],V=K.kind(),U=W[1],H=Y;if(Q!==V){let B=V==="ipv4";if(B&&!Y.isIPv4MappedAddress())continue;if(!X)X=B?Y.toIPv4Address():Y.toIPv4MappedAddress();H=X}if(H.match(K,U))return!0}return!1}}function dJ0($){let Z=$[0],J=Z.kind(),Y=J==="ipv4",X=$[1];return function(G){if(!LG(G))return!1;let W=TG(G);if(W.kind()!==J){if(Y&&!W.isIPv4MappedAddress())return!1;W=Y?W.toIPv4Address():W.toIPv4MappedAddress()}return W.match(Z,X)}}});var PG=S((Rk0,Kz)=>{var RG=TE(),{kHasBeenDecorated:pJ0,kSchemaBody:cJ0,kSchemaHeaders:iJ0,kSchemaParams:nJ0,kSchemaQuerystring:RE,kSchemaController:Qz,kOptions:oJ0,kRequestCacheValidateFns:pZ,kRouteContext:d$,kRequestOriginalUrl:Gz,kRequestSignal:PE,kOnAbort:sJ0}=H$(),{FST_ERR_REQ_INVALID_VALIDATION_INVOCATION:rJ0,FST_ERR_DEC_UNDECLARED:aJ0}=w$(),IE=mX(),CE={body:cJ0,headers:iJ0,params:nJ0,querystring:RE,query:RE};function Wz($,Z,J,Y,X,Q){this.id=$,this[d$]=Q,this.params=Z,this.raw=J,this.query=Y,this.log=X,this.body=void 0}Wz.props=[];function tJ0($){if(typeof $==="function")return $;if($===!0)return function(){return!0};if(typeof $==="number")return function(Z,J){return J<$};if(typeof $==="string"){let Z=$.split(",").map((J)=>J.trim());return RG.compile(Z)}return RG.compile($)}function eJ0($,Z){if(Z)return $Y0($,Z);return _E($)}function _E($){let Z=$.props.slice();function J(Y,X,Q,G,W,K){this.id=Y,this[d$]=K,this.params=X,this.raw=Q,this.query=G,this.log=W,this.body=void 0;let V;for(let U=0;U<Z.length;U++)V=Z[U],this[V.key]=V.value}return Object.setPrototypeOf(J.prototype,$.prototype),Object.setPrototypeOf(J,$),J.props=Z,J.parent=$,J}function EE($){let Z=$.lastIndexOf(",");return Z===-1?$.trim():$.slice(Z+1).trim()}function $Y0($,Z){let J=_E($),Y=tJ0(Z);return J[pJ0]=!0,Object.defineProperties(J.prototype,{ip:{get(){let X=RG.all(this.raw,Y);return X[X.length-1]}},ips:{get(){return RG.all(this.raw,Y)}},host:{get(){let X=this.raw.socket?.remoteAddress;if(this.headers["x-forwarded-host"]&&X!==null&&Y(X,0))return EE(this.headers["x-forwarded-host"]);return this.headers.host??this.headers[":authority"]??""}},protocol:{get(){let X=this.raw.socket?.remoteAddress;if(this.headers["x-forwarded-proto"]&&X!==null&&Y(X,0))return EE(this.headers["x-forwarded-proto"]);if(this.socket)return this.socket.encrypted?"https":"http"}}}),J}function bE($,Z){if(!IE.hasKey($,Z)&&!IE.exist($,Z))throw new aJ0(Z,"request")}Object.defineProperties(Wz.prototype,{server:{get(){return this[d$].server}},url:{get(){return this.raw.url}},originalUrl:{get(){if(!this[Gz])this[Gz]=this.raw.originalUrl||this.raw.url;return this[Gz]}},method:{get(){return this.raw.method}},routeOptions:{get(){let $=this[d$],Z=$._parserOptions.limit,J=$.server.initialConfig.bodyLimit,Y=$.server.hasConstraintStrategy("version")?this.raw.headers["accept-version"]:void 0;return{method:$.config?.method,url:$.config?.url,bodyLimit:Z||J,handlerTimeout:$.handlerTimeout,attachValidation:$.attachValidation,logLevel:$.logLevel,exposeHeadRoute:$.exposeHeadRoute,prefixTrailingSlash:$.prefixTrailingSlash,handler:$.handler,config:$.config,schema:$.schema,version:Y}}},is404:{get(){return this[d$].config?.url===void 0}},socket:{get(){return this.raw.socket}},signal:{get(){let $=this[PE];if($)return $.signal;$=new AbortController,this[PE]=$;let Z=()=>{if(!$.signal.aborted)$.abort()};return this.raw.on("close",Z),this[sJ0]=Z,$.signal}},ip:{get(){if(this.socket)return this.socket.remoteAddress}},host:{get(){return this.raw.headers.host??this.raw.headers[":authority"]??""}},hostname:{get(){if(this.host[0]==="[")return this.host.slice(0,this.host.indexOf("]")+1);return this.host.split(":",1)[0]}},port:{get(){let $=/(?<port>:\d+)$/,Z=this.headers.host??this.headers[":authority"]??"",J=$.exec(Z);if(J===null||J[1]===void 0)return null;return parseInt(J.groups.port.slice(1),10)}},protocol:{get(){if(this.socket)return this.socket.encrypted?"https":"http"}},headers:{get(){if(this.additionalHeaders)return Object.assign({},this.raw.headers,this.additionalHeaders);return this.raw.headers},set($){this.additionalHeaders=$}},getValidationFunction:{value:function($){if(typeof $==="string"){let Z=CE[$];return this[d$][Z]}else if(typeof $==="object")return this[d$][pZ]?.get($)}},compileValidationSchema:{value:function($,Z=null){let{method:J,url:Y}=this;if(this[d$][pZ]?.has($))return this[d$][pZ].get($);let Q=(this[d$].validatorCompiler||this.server[Qz].validatorCompiler||(this.server[Qz].setupValidator(this.server[oJ0])||this.server[Qz].validatorCompiler))({schema:$,method:J,url:Y,httpPart:Z});if(this[d$][pZ]==null)this[d$][pZ]=new WeakMap;return this[d$][pZ].set($,Q),Q}},validateInput:{value:function($,Z,J){J=typeof Z==="string"?Z:J;let Y=J!=null&&typeof J==="string"&&CE[J],X;if(Y)X=this[d$][Y];if(X==null&&(Z==null||typeof Z!=="object"||Array.isArray(Z)))throw new rJ0(J);if(X==null)if(this[d$][pZ]?.has(Z))X=this[d$][pZ].get(Z);else X=this.compileValidationSchema(Z,J);return X($)}},getDecorator:{value:function($){bE(this,$);let Z=this[$];if(typeof Z==="function")return Z.bind(this);return Z}},setDecorator:{value:function($,Z){bE(this,$),this[$]=Z}}});Kz.exports=Wz;Kz.exports.buildRequest=eJ0});var IG=S((Pk0,SE)=>{var{kFourOhFourContext:ZY0,kReplySerializerDefault:JY0,kSchemaErrorFormatter:YY0,kErrorHandler:XY0,kChildLoggerFactory:QY0,kOptions:GY0,kReply:WY0,kRequest:KY0,kBodyLimit:VY0,kLogLevel:UY0,kContentTypeParser:HY0,kRouteByFastify:BY0,kRequestCacheValidateFns:zY0,kReplyCacheSerializeFns:FY0,kHandlerTimeout:AY0}=H$();function OY0({schema:$,handler:Z,config:J,requestIdLogLabel:Y,childLoggerFactory:X,errorHandler:Q,bodyLimit:G,logLevel:W,logSerializers:K,attachValidation:V,validatorCompiler:U,serializerCompiler:H,replySerializer:B,schemaErrorFormatter:z,exposeHeadRoute:F,prefixTrailingSlash:A,server:j,isFastify:N,handlerTimeout:w}){this.schema=$,this.handler=Z,this.Reply=j[WY0],this.Request=j[KY0],this.contentTypeParser=j[HY0],this.onRequest=null,this.onSend=null,this.onError=null,this.onTimeout=null,this.preHandler=null,this.onResponse=null,this.preSerialization=null,this.onRequestAbort=null,this.config=J,this.errorHandler=Q||j[XY0],this.requestIdLogLabel=Y||j[GY0].requestIdLogLabel,this.childLoggerFactory=X||j[QY0],this._middie=null,this._parserOptions={limit:G||j[VY0]},this.exposeHeadRoute=F,this.prefixTrailingSlash=A,this.logLevel=W||j[UY0],this.logSerializers=K,this[ZY0]=null,this.attachValidation=V,this[JY0]=B,this.schemaErrorFormatter=z||j[YY0]||qY0,this[BY0]=N,this[zY0]=null,this[FY0]=null,this.validatorCompiler=U||null,this.serializerCompiler=H||null,this.handlerTimeout=w||j[AY0]||0,this.server=j}function qY0($,Z){let J="",Y=", ";for(let X=0;X!==$.length;++X){let Q=$[X];J+=Z+(Q.instancePath||"")+" "+Q.message+Y}return Error(J.slice(0,-Y.length))}SE.exports=OY0});var Bz=S((jY0)=>{class kE{constructor($=1000,Z=0){if(isNaN($)||$<0)throw Error("Invalid max value");if(isNaN(Z)||Z<0)throw Error("Invalid ttl value");this.first=null,this.items=new Map,this.last=null,this.max=$,this.ttl=Z}get size(){return this.items.size}clear(){this.items=new Map,this.first=null,this.last=null}delete($){if(this.items.has($)){let Z=this.items.get($);if(this.items.delete($),Z.prev!==null)Z.prev.next=Z.next;if(Z.next!==null)Z.next.prev=Z.prev;if(this.first===Z)this.first=Z.next;if(this.last===Z)this.last=Z.prev}}deleteMany($){for(var Z=0;Z<$.length;Z++)this.delete($[Z])}evict(){if(this.size>0){let $=this.first;if(this.items.delete($.key),this.size===0)this.first=null,this.last=null;else this.first=$.next,this.first.prev=null}}expiresAt($){if(this.items.has($))return this.items.get($).expiry}get($){if(this.items.has($)){let Z=this.items.get($);if(this.ttl>0&&Z.expiry<=Date.now()){this.delete($);return}return Z.value}}getMany($){let Z=[];for(var J=0;J<$.length;J++)Z.push(this.get($[J]));return Z}keys(){return this.items.keys()}set($,Z){if(this.items.has($)){let Y=this.items.get($);Y.value=Z,Y.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl;return}if(this.max>0&&this.size===this.max)this.evict();let J={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:$,prev:this.last,next:null,value:Z};if(this.items.set($,J),this.size===1)this.first=J;else this.last.next=J;this.last=J}}class Vz{constructor($=1000,Z=0){if(isNaN($)||$<0)throw Error("Invalid max value");if(isNaN(Z)||Z<0)throw Error("Invalid ttl value");this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this.max=$,this.ttl=Z}clear(){this.items=Object.create(null),this.first=null,this.last=null,this.size=0}delete($){if(Object.prototype.hasOwnProperty.call(this.items,$)){let Z=this.items[$];if(delete this.items[$],this.size--,Z.prev!==null)Z.prev.next=Z.next;if(Z.next!==null)Z.next.prev=Z.prev;if(this.first===Z)this.first=Z.next;if(this.last===Z)this.last=Z.prev}}deleteMany($){for(var Z=0;Z<$.length;Z++)this.delete($[Z])}evict(){if(this.size>0){let $=this.first;if(delete this.items[$.key],--this.size===0)this.first=null,this.last=null;else this.first=$.next,this.first.prev=null}}expiresAt($){if(Object.prototype.hasOwnProperty.call(this.items,$))return this.items[$].expiry}get($){if(Object.prototype.hasOwnProperty.call(this.items,$)){let Z=this.items[$];if(this.ttl>0&&Z.expiry<=Date.now()){this.delete($);return}return Z.value}}getMany($){let Z=[];for(var J=0;J<$.length;J++)Z.push(this.get($[J]));return Z}keys(){return Object.keys(this.items)}set($,Z){if(Object.prototype.hasOwnProperty.call(this.items,$)){let Y=this.items[$];Y.value=Z,Y.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl;return}if(this.max>0&&this.size===this.max)this.evict();let J={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:$,prev:this.last,next:null,value:Z};if(this.items[$]=J,++this.size===1)this.first=J;else this.last.next=J;this.last=J}}class Uz{constructor(){this.records={}}initForCache($,Z){this.records[$]={[Z]:{cacheSize:0,hits:0,falsyHits:0,emptyHits:0,misses:0,expirations:0,evictions:0,invalidateOne:0,invalidateAll:0,sets:0}}}resetForCache($){for(let Z of Object.keys(this.records[$]))this.records[$][Z]={cacheSize:0,hits:0,falsyHits:0,emptyHits:0,misses:0,expirations:0,evictions:0,invalidateOne:0,invalidateAll:0,sets:0}}getStatistics(){return this.records}}class vE{constructor($=1000,Z=0){if(isNaN($)||$<0)throw Error("Invalid max value");if(isNaN(Z)||Z<0)throw Error("Invalid ttl value");this.first=null,this.items=new Map,this.last=null,this.max=$,this.ttl=Z}get size(){return this.items.size}bumpLru($){if(this.last===$)return;let Z=this.last,J=$.next,Y=$.prev;if(this.first===$)this.first=J;if($.next=null,$.prev=Z,Z.next=$,Y!==null)Y.next=J;if(J!==null)J.prev=Y;this.last=$}clear(){this.items=new Map,this.first=null,this.last=null}delete($){if(this.items.has($)){let Z=this.items.get($);if(this.items.delete($),Z.prev!==null)Z.prev.next=Z.next;if(Z.next!==null)Z.next.prev=Z.prev;if(this.first===Z)this.first=Z.next;if(this.last===Z)this.last=Z.prev}}deleteMany($){for(var Z=0;Z<$.length;Z++)this.delete($[Z])}evict(){if(this.size>0){let $=this.first;if(this.items.delete($.key),this.size===0)this.first=null,this.last=null;else this.first=$.next,this.first.prev=null}}expiresAt($){if(this.items.has($))return this.items.get($).expiry}get($){if(this.items.has($)){let Z=this.items.get($);if(this.ttl>0&&Z.expiry<=Date.now()){this.delete($);return}return this.bumpLru(Z),Z.value}}getMany($){let Z=[];for(var J=0;J<$.length;J++)Z.push(this.get($[J]));return Z}keys(){return this.items.keys()}set($,Z){if(this.items.has($)){let Y=this.items.get($);if(Y.value=Z,Y.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl,this.last!==Y)this.bumpLru(Y);return}if(this.max>0&&this.size===this.max)this.evict();let J={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:$,prev:this.last,next:null,value:Z};if(this.items.set($,J),this.size===1)this.first=J;else this.last.next=J;this.last=J}}class CG{constructor($=1000,Z=0){if(isNaN($)||$<0)throw Error("Invalid max value");if(isNaN(Z)||Z<0)throw Error("Invalid ttl value");this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this.max=$,this.ttl=Z}bumpLru($){if(this.last===$)return;let Z=this.last,J=$.next,Y=$.prev;if(this.first===$)this.first=J;if($.next=null,$.prev=Z,Z.next=$,Y!==null)Y.next=J;if(J!==null)J.prev=Y;this.last=$}clear(){this.items=Object.create(null),this.first=null,this.last=null,this.size=0}delete($){if(Object.prototype.hasOwnProperty.call(this.items,$)){let Z=this.items[$];if(delete this.items[$],this.size--,Z.prev!==null)Z.prev.next=Z.next;if(Z.next!==null)Z.next.prev=Z.prev;if(this.first===Z)this.first=Z.next;if(this.last===Z)this.last=Z.prev}}deleteMany($){for(var Z=0;Z<$.length;Z++)this.delete($[Z])}evict(){if(this.size>0){let $=this.first;if(delete this.items[$.key],--this.size===0)this.first=null,this.last=null;else this.first=$.next,this.first.prev=null}}expiresAt($){if(Object.prototype.hasOwnProperty.call(this.items,$))return this.items[$].expiry}get($){if(Object.prototype.hasOwnProperty.call(this.items,$)){let Z=this.items[$];if(this.ttl>0&&Z.expiry<=Date.now()){this.delete($);return}return this.bumpLru(Z),Z.value}}getMany($){let Z=[];for(var J=0;J<$.length;J++)Z.push(this.get($[J]));return Z}keys(){return Object.keys(this.items)}set($,Z){if(Object.prototype.hasOwnProperty.call(this.items,$)){let Y=this.items[$];if(Y.value=Z,Y.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl,this.last!==Y)this.bumpLru(Y);return}if(this.max>0&&this.size===this.max)this.evict();let J={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:$,prev:this.last,next:null,value:Z};if(this.items[$]=J,++this.size===1)this.first=J;else this.last.next=J;this.last=J}}function fE($){return`${$.getFullYear()}-${($.getMonth()+1).toString().padStart(2,"0")}-${$.getDate().toString().padStart(2,"0")}`}class yE{constructor($,Z,J){this.cacheId=$,this.statisticTtlInHours=Z,this.collectionStart=new Date,this.currentTimeStamp=fE(this.collectionStart),this.records=J||new Uz,this.records.initForCache(this.cacheId,this.currentTimeStamp)}get currentRecord(){if(!this.records.records[this.cacheId][this.currentTimeStamp])this.records.records[this.cacheId][this.currentTimeStamp]={cacheSize:0,hits:0,falsyHits:0,emptyHits:0,misses:0,expirations:0,evictions:0,sets:0,invalidateOne:0,invalidateAll:0};return this.records.records[this.cacheId][this.currentTimeStamp]}hoursPassed(){return(Date.now()-this.collectionStart)/1000/60/60}addHit(){this.archiveIfNeeded(),this.currentRecord.hits++}addFalsyHit(){this.archiveIfNeeded(),this.currentRecord.falsyHits++}addEmptyHit(){this.archiveIfNeeded(),this.currentRecord.emptyHits++}addMiss(){this.archiveIfNeeded(),this.currentRecord.misses++}addEviction(){this.archiveIfNeeded(),this.currentRecord.evictions++}setCacheSize($){this.archiveIfNeeded(),this.currentRecord.cacheSize=$}addExpiration(){this.archiveIfNeeded(),this.currentRecord.expirations++}addSet(){this.archiveIfNeeded(),this.currentRecord.sets++}addInvalidateOne(){this.archiveIfNeeded(),this.currentRecord.invalidateOne++}addInvalidateAll(){this.archiveIfNeeded(),this.currentRecord.invalidateAll++}getStatistics(){return this.records.getStatistics()}archiveIfNeeded(){if(this.hoursPassed()>=this.statisticTtlInHours)this.collectionStart=new Date,this.currentTimeStamp=fE(this.collectionStart),this.records.initForCache(this.cacheId,this.currentTimeStamp)}}class Hz extends CG{constructor($,Z,J,Y,X){super($||1000,Z||0);if(!J)throw Error("Cache id is mandatory");this.hitStatistics=new yE(J,X!==void 0?X:24,Y)}getStatistics(){return this.hitStatistics.getStatistics()}set($,Z){super.set($,Z),this.hitStatistics.addSet(),this.hitStatistics.setCacheSize(this.size)}evict(){super.evict(),this.hitStatistics.addEviction(),this.hitStatistics.setCacheSize(this.size)}delete($,Z=!1){if(super.delete($),!Z)this.hitStatistics.addInvalidateOne();this.hitStatistics.setCacheSize(this.size)}clear(){super.clear(),this.hitStatistics.addInvalidateAll(),this.hitStatistics.setCacheSize(this.size)}get($){if(Object.prototype.hasOwnProperty.call(this.items,$)){let Z=this.items[$];if(this.ttl>0&&Z.expiry<=Date.now()){this.delete($,!0),this.hitStatistics.addExpiration();return}if(this.bumpLru(Z),!Z.value)this.hitStatistics.addFalsyHit();if(Z.value===void 0||Z.value===null||Z.value==="")this.hitStatistics.addEmptyHit();return this.hitStatistics.addHit(),Z.value}this.hitStatistics.addMiss()}}jY0.Fifo=Vz;jY0.FifoMap=kE;jY0.FifoObject=Vz;jY0.HitStatisticsRecord=Uz;jY0.Lru=CG;jY0.LruHitStatistics=Hz;jY0.LruMap=vE;jY0.LruObject=CG;jY0.LruObjectHitStatistics=Hz});var mE=S((Ck0,fJ)=>{var CY0=typeof Buffer<"u",xE=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,hE=/"(?: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 gE($,Z,J){if(J==null){if(Z!==null&&typeof Z==="object")J=Z,Z=void 0}if(CY0&&Buffer.isBuffer($))$=$.toString();if($&&$.charCodeAt(0)===65279)$=$.slice(1);let Y=JSON.parse($,Z);if(Y===null||typeof Y!=="object")return Y;let X=J&&J.protoAction||"error",Q=J&&J.constructorAction||"error";if(X==="ignore"&&Q==="ignore")return Y;if(X!=="ignore"&&Q!=="ignore"){if(xE.test($)===!1&&hE.test($)===!1)return Y}else if(X!=="ignore"&&Q==="ignore"){if(xE.test($)===!1)return Y}else if(hE.test($)===!1)return Y;return uE(Y,{protoAction:X,constructorAction:Q,safe:J&&J.safe})}function uE($,{protoAction:Z="error",constructorAction:J="error",safe:Y}={}){let X=[$];while(X.length){let Q=X;X=[];for(let G of Q){if(Z!=="ignore"&&Object.prototype.hasOwnProperty.call(G,"__proto__")){if(Y===!0)return null;else if(Z==="error")throw SyntaxError("Object contains forbidden prototype property");delete G.__proto__}if(J!=="ignore"&&Object.prototype.hasOwnProperty.call(G,"constructor")&&G.constructor!==null&&typeof G.constructor==="object"&&Object.prototype.hasOwnProperty.call(G.constructor,"prototype")){if(Y===!0)return null;else if(J==="error")throw SyntaxError("Object contains forbidden prototype property");delete G.constructor}for(let W in G){let K=G[W];if(K&&typeof K==="object")X.push(K)}}}return $}function zz($,Z,J){let{stackTraceLimit:Y}=Error;Error.stackTraceLimit=0;try{return gE($,Z,J)}finally{Error.stackTraceLimit=Y}}function EY0($,Z){let{stackTraceLimit:J}=Error;Error.stackTraceLimit=0;try{return gE($,Z,{safe:!0})}catch{return}finally{Error.stackTraceLimit=J}}fJ.exports=zz;fJ.exports.default=zz;fJ.exports.parse=zz;fJ.exports.safeParse=EY0;fJ.exports.scan=uE});var jz=S((Ek0,iX)=>{var{AsyncResource:bY0}=Y0("async_hooks"),{FifoMap:pE}=Bz(),{parse:_Y0}=mE(),cX=lH(),{kDefaultJsonParse:pX,kContentTypeParser:kJ,kBodyLimit:SY0,kRequestPayloadStream:cE,kState:Az,kTestInternals:fY0,kReplyIsError:lE,kRouteContext:kY0}=H$(),{FST_ERR_CTP_INVALID_TYPE:EG,FST_ERR_CTP_EMPTY_TYPE:vY0,FST_ERR_CTP_ALREADY_PRESENT:yY0,FST_ERR_CTP_INVALID_HANDLER:xY0,FST_ERR_CTP_INVALID_PARSE_TYPE:hY0,FST_ERR_CTP_BODY_TOO_LARGE:dE,FST_ERR_CTP_INVALID_MEDIA_TYPE:gY0,FST_ERR_CTP_INVALID_CONTENT_LENGTH:uY0,FST_ERR_CTP_EMPTY_JSON_BODY:mY0,FST_ERR_CTP_INSTANCE_ALREADY_STARTED:Oz,FST_ERR_CTP_INVALID_JSON_BODY:lY0}=w$(),{FSTSEC001:dY0}=wJ();function $Z($,Z,J){this[pX]=nE(Z,J),this.customParsers=new Map,this.customParsers.set("application/json",new Fz(!0,!1,$,this[pX])),this.customParsers.set("text/plain",new Fz(!0,!1,$,qz)),this.parserList=["application/json","text/plain"],this.parserRegExpList=[],this.cache=new pE(100)}$Z.prototype.add=function($,Z,J){let Y=typeof $==="string";if(Y){if($=$.trim().toLowerCase(),$.length===0)throw new vY0}else if(!($ instanceof RegExp))throw new EG;if(typeof J!=="function")throw new xY0;if(this.existingParser($))throw new yY0($);if(Z.parseAs!==void 0){if(Z.parseAs!=="string"&&Z.parseAs!=="buffer")throw new hY0(Z.parseAs)}let X=new Fz(Z.parseAs==="string",Z.parseAs==="buffer",Z.bodyLimit,J);if($==="*")this.customParsers.set("",X);else if(Y){let Q=new cX($);if(Q.isValid===!1)throw new EG;let G=Q.toString();this.parserList.unshift(G),this.customParsers.set(G,X)}else sY0($),this.parserRegExpList.unshift($),this.customParsers.set($.toString(),X)};$Z.prototype.hasParser=function($){if(typeof $==="string")$=new cX($).toString();else{if(!($ instanceof RegExp))throw new EG;$=$.toString()}return this.customParsers.has($)};$Z.prototype.existingParser=function($){if(typeof $==="string"){let Z=new cX($).toString();if($==="application/json"&&this.customParsers.has($))return this.customParsers.get(Z).fn!==this[pX];if($==="text/plain"&&this.customParsers.has($))return this.customParsers.get(Z).fn!==qz}return this.hasParser($)};$Z.prototype.getParser=function($){if(typeof $==="string")$=new cX($);let Z=$.toString(),J=this.cache.get(Z);if(J!==void 0)return J;if(J=this.customParsers.get(Z),J!==void 0)return this.cache.set(Z,J),J;if(J=this.customParsers.get($.mediaType),J!==void 0)return J;for(let Y=0;Y!==this.parserRegExpList.length;++Y){let X=this.parserRegExpList[Y];if(X.test(Z))return J=this.customParsers.get(X.toString()),this.cache.set(Z,J),J}return this.customParsers.get("")};$Z.prototype.removeAll=function(){this.customParsers=new Map,this.parserRegExpList=[],this.parserList=[],this.cache=new pE(100)};$Z.prototype.remove=function($){let Z;if(typeof $==="string")$=new cX($).toString(),Z=this.parserList;else{if(!($ instanceof RegExp))throw new EG;$=$.toString(),Z=this.parserRegExpList}let J=this.customParsers.delete($),Y=Z.findIndex((X)=>X.toString()===$);if(Y>-1)Z.splice(Y,1);return J||Y>-1};$Z.prototype.run=function($,Z,J,Y){let X=this.getParser($);if(X===void 0){if(J.is404===!0){Z(J,Y);return}Y[lE]=!0,Y.send(new gY0);return}let Q=new bY0("content-type-parser:run",J),G=Q.bind(K);if(X.asString===!0||X.asBuffer===!0){iE(J,Y,Y[kY0]._parserOptions,X,G);return}let W=X.fn(J,J[cE],G);if(W&&typeof W.then==="function")W.then((V)=>{G(null,V)},G);function K(V,U){if(Q.emitDestroy(),V!=null){Y.header("connection","close"),Y[lE]=!0,Y.send(V);return}J.body=U,Z(J,Y)}};function iE($,Z,J,Y,X){let Q=Y.asString===!0,G=J.limit===null?Y.bodyLimit:J.limit,W=Number($.headers["content-length"]);if(W>G){X(new dE,void 0);return}let K=0,V=Q?"":[],U=$[cE]||$.raw;if(Q)U.setEncoding("utf8");U.on("data",H),U.on("end",B),U.on("error",B),U.resume();function H(z){K+=Q?Buffer.byteLength(z):z.length;let{receivedEncodedLength:F=0}=U;if(K>G||F>G){U.removeListener("data",H),U.removeListener("end",B),U.removeListener("error",B),X(new dE,void 0);return}if(Q)V+=z;else V.push(z)}function B(z){if(U.removeListener("data",H),U.removeListener("end",B),U.removeListener("error",B),z!=null){if(!(typeof z.statusCode==="number"&&z.statusCode>=400))z.statusCode=400;X(z,void 0);return}if(!Number.isNaN(W)&&(U.receivedEncodedLength||K)!==W){X(new uY0,void 0);return}if(!Q)V=Buffer.concat(V);let F=Y.fn($,V,X);if(F&&typeof F.then==="function")F.then((A)=>{X(null,A)},X)}}function nE($,Z){let J={protoAction:$,constructorAction:Z};return Y;function Y(X,Q,G){if(Q.length===0){G(new mY0,void 0);return}try{G(null,_Y0(Q,J))}catch{G(new lY0,void 0)}}}function qz($,Z,J){J(null,Z)}function Fz($,Z,J,Y){this.asString=$,this.asBuffer=Z,this.bodyLimit=J,this.fn=Y}function pY0($){let Z=new $Z;return Z[pX]=$[pX],Z.customParsers=new Map($.customParsers.entries()),Z.parserList=$.parserList.slice(),Z.parserRegExpList=$.parserRegExpList.slice(),Z}function cY0($,Z,J){if(this[Az].started)throw new Oz("addContentTypeParser");if(typeof Z==="function")J=Z,Z={};if(!Z)Z={};if(!Z.bodyLimit)Z.bodyLimit=this[SY0];if(Array.isArray($))$.forEach((Y)=>this[kJ].add(Y,Z,J));else this[kJ].add($,Z,J);return this}function iY0($){return this[kJ].hasParser($)}function nY0($){if(this[Az].started)throw new Oz("removeContentTypeParser");if(Array.isArray($))for(let Z of $)this[kJ].remove(Z);else this[kJ].remove($)}function oY0(){if(this[Az].started)throw new Oz("removeAllContentTypeParsers");this[kJ].removeAll()}function sY0($){if($.source[0]!=="^"&&$.source.includes(";?")===!1)dY0($.source)}iX.exports=$Z;iX.exports.helpers={buildContentTypeParser:pY0,addContentTypeParser:cY0,hasContentTypeParser:iY0,removeContentTypeParser:nY0,removeAllContentTypeParsers:oY0};iX.exports.defaultParsers={getDefaultJsonParser:nE,defaultTextParser:qz};iX.exports[fY0]={rawBody:iE}});var yJ=S((rE)=>{Object.defineProperty(rE,"__esModule",{value:!0});rE.regexpCode=rE.getEsmExportName=rE.getProperty=rE.safeStringify=rE.stringify=rE.strConcat=rE.addCodeArg=rE.str=rE._=rE.nil=rE._Code=rE.Name=rE.IDENTIFIER=rE._CodeOrName=void 0;class bG{}rE._CodeOrName=bG;rE.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class vJ extends bG{constructor($){super();if(!rE.IDENTIFIER.test($))throw Error("CodeGen: name must be a valid identifier");this.str=$}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}rE.Name=vJ;class J6 extends bG{constructor($){super();this._items=typeof $==="string"?[$]:$}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let $=this._items[0];return $===""||$==='""'}get str(){var $;return($=this._str)!==null&&$!==void 0?$:this._str=this._items.reduce((Z,J)=>`${Z}${J}`,"")}get names(){var $;return($=this._names)!==null&&$!==void 0?$:this._names=this._items.reduce((Z,J)=>{if(J instanceof vJ)Z[J.str]=(Z[J.str]||0)+1;return Z},{})}}rE._Code=J6;rE.nil=new J6("");function oE($,...Z){let J=[$[0]],Y=0;while(Y<Z.length)Mz(J,Z[Y]),J.push($[++Y]);return new J6(J)}rE._=oE;var Nz=new J6("+");function sE($,...Z){let J=[nX($[0])],Y=0;while(Y<Z.length)J.push(Nz),Mz(J,Z[Y]),J.push(Nz,nX($[++Y]));return rY0(J),new J6(J)}rE.str=sE;function Mz($,Z){if(Z instanceof J6)$.push(...Z._items);else if(Z instanceof vJ)$.push(Z);else $.push(eY0(Z))}rE.addCodeArg=Mz;function rY0($){let Z=1;while(Z<$.length-1){if($[Z]===Nz){let J=aY0($[Z-1],$[Z+1]);if(J!==void 0){$.splice(Z-1,3,J);continue}$[Z++]="+"}Z++}}function aY0($,Z){if(Z==='""')return $;if($==='""')return Z;if(typeof $=="string"){if(Z instanceof vJ||$[$.length-1]!=='"')return;if(typeof Z!="string")return`${$.slice(0,-1)}${Z}"`;if(Z[0]==='"')return $.slice(0,-1)+Z.slice(1);return}if(typeof Z=="string"&&Z[0]==='"'&&!($ instanceof vJ))return`"${$}${Z.slice(1)}`;return}function tY0($,Z){return Z.emptyStr()?$:$.emptyStr()?Z:sE`${$}${Z}`}rE.strConcat=tY0;function eY0($){return typeof $=="number"||typeof $=="boolean"||$===null?$:nX(Array.isArray($)?$.join(","):$)}function $X0($){return new J6(nX($))}rE.stringify=$X0;function nX($){return JSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}rE.safeStringify=nX;function ZX0($){return typeof $=="string"&&rE.IDENTIFIER.test($)?new J6(`.${$}`):oE`[${$}]`}rE.getProperty=ZX0;function JX0($){if(typeof $=="string"&&rE.IDENTIFIER.test($))return new J6(`${$}`);throw Error(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}rE.getEsmExportName=JX0;function YX0($){return new J6($.toString())}rE.regexpCode=YX0});var fG=S(($b)=>{Object.defineProperty($b,"__esModule",{value:!0});$b.ValueScope=$b.ValueScopeName=$b.Scope=$b.varKinds=$b.UsedValueState=void 0;var K8=yJ();class tE extends Error{constructor($){super(`CodeGen: "code" for ${$} not defined`);this.value=$.value}}var SG;(function($){$[$.Started=0]="Started",$[$.Completed=1]="Completed"})(SG||($b.UsedValueState=SG={}));$b.varKinds={const:new K8.Name("const"),let:new K8.Name("let"),var:new K8.Name("var")};class wz{constructor({prefixes:$,parent:Z}={}){this._names={},this._prefixes=$,this._parent=Z}toName($){return $ instanceof K8.Name?$:this.name($)}name($){return new K8.Name(this._newName($))}_newName($){let Z=this._names[$]||this._nameGroup($);return`${$}${Z.index++}`}_nameGroup($){var Z,J;if(((J=(Z=this._parent)===null||Z===void 0?void 0:Z._prefixes)===null||J===void 0?void 0:J.has($))||this._prefixes&&!this._prefixes.has($))throw Error(`CodeGen: prefix "${$}" is not allowed in this scope`);return this._names[$]={prefix:$,index:0}}}$b.Scope=wz;class Lz extends K8.Name{constructor($,Z){super(Z);this.prefix=$}setValue($,{property:Z,itemIndex:J}){this.value=$,this.scopePath=K8._`.${new K8.Name(Z)}[${J}]`}}$b.ValueScopeName=Lz;var OX0=K8._`\n`;class eE extends wz{constructor($){super($);this._values={},this._scope=$.scope,this.opts={...$,_n:$.lines?OX0:K8.nil}}get(){return this._scope}name($){return new Lz($,this._newName($))}value($,Z){var J;if(Z.ref===void 0)throw Error("CodeGen: ref must be passed in value");let Y=this.toName($),{prefix:X}=Y,Q=(J=Z.key)!==null&&J!==void 0?J:Z.ref,G=this._values[X];if(G){let V=G.get(Q);if(V)return V}else G=this._values[X]=new Map;G.set(Q,Y);let W=this._scope[X]||(this._scope[X]=[]),K=W.length;return W[K]=Z.ref,Y.setValue(Z,{property:X,itemIndex:K}),Y}getValue($,Z){let J=this._values[$];if(!J)return;return J.get(Z)}scopeRefs($,Z=this._values){return this._reduceValues(Z,(J)=>{if(J.scopePath===void 0)throw Error(`CodeGen: name "${J}" has no value`);return K8._`${$}${J.scopePath}`})}scopeCode($=this._values,Z,J){return this._reduceValues($,(Y)=>{if(Y.value===void 0)throw Error(`CodeGen: name "${Y}" has no value`);return Y.value.code},Z,J)}_reduceValues($,Z,J={},Y){let X=K8.nil;for(let Q in $){let G=$[Q];if(!G)continue;let W=J[Q]=J[Q]||new Map;G.forEach((K)=>{if(W.has(K))return;W.set(K,SG.Started);let V=Z(K);if(V){let U=this.opts.es5?$b.varKinds.var:$b.varKinds.const;X=K8._`${X}${U} ${K} = ${V};${this.opts._n}`}else if(V=Y===null||Y===void 0?void 0:Y(K))X=K8._`${X}${V}${this.opts._n}`;else throw new tE(K);W.set(K,SG.Completed)})}return X}}$b.ValueScope=eE});var k0=S((V8)=>{Object.defineProperty(V8,"__esModule",{value:!0});V8.or=V8.and=V8.not=V8.CodeGen=V8.operators=V8.varKinds=V8.ValueScopeName=V8.ValueScope=V8.Scope=V8.Name=V8.regexpCode=V8.stringify=V8.getProperty=V8.nil=V8.strConcat=V8.str=V8._=void 0;var q1=yJ(),Y6=fG(),cZ=yJ();Object.defineProperty(V8,"_",{enumerable:!0,get:function(){return cZ._}});Object.defineProperty(V8,"str",{enumerable:!0,get:function(){return cZ.str}});Object.defineProperty(V8,"strConcat",{enumerable:!0,get:function(){return cZ.strConcat}});Object.defineProperty(V8,"nil",{enumerable:!0,get:function(){return cZ.nil}});Object.defineProperty(V8,"getProperty",{enumerable:!0,get:function(){return cZ.getProperty}});Object.defineProperty(V8,"stringify",{enumerable:!0,get:function(){return cZ.stringify}});Object.defineProperty(V8,"regexpCode",{enumerable:!0,get:function(){return cZ.regexpCode}});Object.defineProperty(V8,"Name",{enumerable:!0,get:function(){return cZ.Name}});var gG=fG();Object.defineProperty(V8,"Scope",{enumerable:!0,get:function(){return gG.Scope}});Object.defineProperty(V8,"ValueScope",{enumerable:!0,get:function(){return gG.ValueScope}});Object.defineProperty(V8,"ValueScopeName",{enumerable:!0,get:function(){return gG.ValueScopeName}});Object.defineProperty(V8,"varKinds",{enumerable:!0,get:function(){return gG.varKinds}});V8.operators={GT:new q1._Code(">"),GTE:new q1._Code(">="),LT:new q1._Code("<"),LTE:new q1._Code("<="),EQ:new q1._Code("==="),NEQ:new q1._Code("!=="),NOT:new q1._Code("!"),OR:new q1._Code("||"),AND:new q1._Code("&&"),ADD:new q1._Code("+")};class iZ{optimizeNodes(){return this}optimizeNames($,Z){return this}}class Jb extends iZ{constructor($,Z,J){super();this.varKind=$,this.name=Z,this.rhs=J}render({es5:$,_n:Z}){let J=$?Y6.varKinds.var:this.varKind,Y=this.rhs===void 0?"":` = ${this.rhs}`;return`${J} ${this.name}${Y};`+Z}optimizeNames($,Z){if(!$[this.name.str])return;if(this.rhs)this.rhs=hJ(this.rhs,$,Z);return this}get names(){return this.rhs instanceof q1._CodeOrName?this.rhs.names:{}}}class Pz extends iZ{constructor($,Z,J){super();this.lhs=$,this.rhs=Z,this.sideEffects=J}render({_n:$}){return`${this.lhs} = ${this.rhs};`+$}optimizeNames($,Z){if(this.lhs instanceof q1.Name&&!$[this.lhs.str]&&!this.sideEffects)return;return this.rhs=hJ(this.rhs,$,Z),this}get names(){let $=this.lhs instanceof q1.Name?{}:{...this.lhs.names};return hG($,this.rhs)}}class Yb extends Pz{constructor($,Z,J,Y){super($,J,Y);this.op=Z}render({_n:$}){return`${this.lhs} ${this.op}= ${this.rhs};`+$}}class Xb extends iZ{constructor($){super();this.label=$,this.names={}}render({_n:$}){return`${this.label}:`+$}}class Qb extends iZ{constructor($){super();this.label=$,this.names={}}render({_n:$}){return`break${this.label?` ${this.label}`:""};`+$}}class Gb extends iZ{constructor($){super();this.error=$}render({_n:$}){return`throw ${this.error};`+$}get names(){return this.error.names}}class Wb extends iZ{constructor($){super();this.code=$}render({_n:$}){return`${this.code};`+$}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames($,Z){return this.code=hJ(this.code,$,Z),this}get names(){return this.code instanceof q1._CodeOrName?this.code.names:{}}}class uG extends iZ{constructor($=[]){super();this.nodes=$}render($){return this.nodes.reduce((Z,J)=>Z+J.render($),"")}optimizeNodes(){let{nodes:$}=this,Z=$.length;while(Z--){let J=$[Z].optimizeNodes();if(Array.isArray(J))$.splice(Z,1,...J);else if(J)$[Z]=J;else $.splice(Z,1)}return $.length>0?this:void 0}optimizeNames($,Z){let{nodes:J}=this,Y=J.length;while(Y--){let X=J[Y];if(X.optimizeNames($,Z))continue;MX0($,X.names),J.splice(Y,1)}return J.length>0?this:void 0}get names(){return this.nodes.reduce(($,Z)=>e5($,Z.names),{})}}class nZ extends uG{render($){return"{"+$._n+super.render($)+"}"+$._n}}class Kb extends uG{}class oX extends nZ{}oX.kind="else";class ZZ extends nZ{constructor($,Z){super(Z);this.condition=$}render($){let Z=`if(${this.condition})`+super.render($);if(this.else)Z+="else "+this.else.render($);return Z}optimizeNodes(){super.optimizeNodes();let $=this.condition;if($===!0)return this.nodes;let Z=this.else;if(Z){let J=Z.optimizeNodes();Z=this.else=Array.isArray(J)?new oX(J):J}if(Z){if($===!1)return Z instanceof ZZ?Z:Z.nodes;if(this.nodes.length)return this;return new ZZ(zb($),Z instanceof ZZ?[Z]:Z.nodes)}if($===!1||!this.nodes.length)return;return this}optimizeNames($,Z){var J;if(this.else=(J=this.else)===null||J===void 0?void 0:J.optimizeNames($,Z),!(super.optimizeNames($,Z)||this.else))return;return this.condition=hJ(this.condition,$,Z),this}get names(){let $=super.names;if(hG($,this.condition),this.else)e5($,this.else.names);return $}}ZZ.kind="if";class xJ extends nZ{}xJ.kind="for";class Vb extends xJ{constructor($){super();this.iteration=$}render($){return`for(${this.iteration})`+super.render($)}optimizeNames($,Z){if(!super.optimizeNames($,Z))return;return this.iteration=hJ(this.iteration,$,Z),this}get names(){return e5(super.names,this.iteration.names)}}class Ub extends xJ{constructor($,Z,J,Y){super();this.varKind=$,this.name=Z,this.from=J,this.to=Y}render($){let Z=$.es5?Y6.varKinds.var:this.varKind,{name:J,from:Y,to:X}=this;return`for(${Z} ${J}=${Y}; ${J}<${X}; ${J}++)`+super.render($)}get names(){let $=hG(super.names,this.from);return hG($,this.to)}}class Tz extends xJ{constructor($,Z,J,Y){super();this.loop=$,this.varKind=Z,this.name=J,this.iterable=Y}render($){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render($)}optimizeNames($,Z){if(!super.optimizeNames($,Z))return;return this.iterable=hJ(this.iterable,$,Z),this}get names(){return e5(super.names,this.iterable.names)}}class kG extends nZ{constructor($,Z,J){super();this.name=$,this.args=Z,this.async=J}render($){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render($)}}kG.kind="func";class vG extends uG{render($){return"return "+super.render($)}}vG.kind="return";class Hb extends nZ{render($){let Z="try"+super.render($);if(this.catch)Z+=this.catch.render($);if(this.finally)Z+=this.finally.render($);return Z}optimizeNodes(){var $,Z;return super.optimizeNodes(),($=this.catch)===null||$===void 0||$.optimizeNodes(),(Z=this.finally)===null||Z===void 0||Z.optimizeNodes(),this}optimizeNames($,Z){var J,Y;return super.optimizeNames($,Z),(J=this.catch)===null||J===void 0||J.optimizeNames($,Z),(Y=this.finally)===null||Y===void 0||Y.optimizeNames($,Z),this}get names(){let $=super.names;if(this.catch)e5($,this.catch.names);if(this.finally)e5($,this.finally.names);return $}}class yG extends nZ{constructor($){super();this.error=$}render($){return`catch(${this.error})`+super.render($)}}yG.kind="catch";class xG extends nZ{render($){return"finally"+super.render($)}}xG.kind="finally";class Bb{constructor($,Z={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...Z,_n:Z.lines?`
|
|
112
|
+
`:""},this._extScope=$,this._scope=new Y6.Scope({parent:$}),this._nodes=[new Kb]}toString(){return this._root.render(this.opts)}name($){return this._scope.name($)}scopeName($){return this._extScope.name($)}scopeValue($,Z){let J=this._extScope.value($,Z);return(this._values[J.prefix]||(this._values[J.prefix]=new Set)).add(J),J}getScopeValue($,Z){return this._extScope.getValue($,Z)}scopeRefs($){return this._extScope.scopeRefs($,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def($,Z,J,Y){let X=this._scope.toName(Z);if(J!==void 0&&Y)this._constants[X.str]=J;return this._leafNode(new Jb($,X,J)),X}const($,Z,J){return this._def(Y6.varKinds.const,$,Z,J)}let($,Z,J){return this._def(Y6.varKinds.let,$,Z,J)}var($,Z,J){return this._def(Y6.varKinds.var,$,Z,J)}assign($,Z,J){return this._leafNode(new Pz($,Z,J))}add($,Z){return this._leafNode(new Yb($,V8.operators.ADD,Z))}code($){if(typeof $=="function")$();else if($!==q1.nil)this._leafNode(new Wb($));return this}object(...$){let Z=["{"];for(let[J,Y]of $){if(Z.length>1)Z.push(",");if(Z.push(J),J!==Y||this.opts.es5)Z.push(":"),(0,q1.addCodeArg)(Z,Y)}return Z.push("}"),new q1._Code(Z)}if($,Z,J){if(this._blockNode(new ZZ($)),Z&&J)this.code(Z).else().code(J).endIf();else if(Z)this.code(Z).endIf();else if(J)throw Error('CodeGen: "else" body without "then" body');return this}elseIf($){return this._elseNode(new ZZ($))}else(){return this._elseNode(new oX)}endIf(){return this._endBlockNode(ZZ,oX)}_for($,Z){if(this._blockNode($),Z)this.code(Z).endFor();return this}for($,Z){return this._for(new Vb($),Z)}forRange($,Z,J,Y,X=this.opts.es5?Y6.varKinds.var:Y6.varKinds.let){let Q=this._scope.toName($);return this._for(new Ub(X,Q,Z,J),()=>Y(Q))}forOf($,Z,J,Y=Y6.varKinds.const){let X=this._scope.toName($);if(this.opts.es5){let Q=Z instanceof q1.Name?Z:this.var("_arr",Z);return this.forRange("_i",0,q1._`${Q}.length`,(G)=>{this.var(X,q1._`${Q}[${G}]`),J(X)})}return this._for(new Tz("of",Y,X,Z),()=>J(X))}forIn($,Z,J,Y=this.opts.es5?Y6.varKinds.var:Y6.varKinds.const){if(this.opts.ownProperties)return this.forOf($,q1._`Object.keys(${Z})`,J);let X=this._scope.toName($);return this._for(new Tz("in",Y,X,Z),()=>J(X))}endFor(){return this._endBlockNode(xJ)}label($){return this._leafNode(new Xb($))}break($){return this._leafNode(new Qb($))}return($){let Z=new vG;if(this._blockNode(Z),this.code($),Z.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(vG)}try($,Z,J){if(!Z&&!J)throw Error('CodeGen: "try" without "catch" and "finally"');let Y=new Hb;if(this._blockNode(Y),this.code($),Z){let X=this.name("e");this._currNode=Y.catch=new yG(X),Z(X)}if(J)this._currNode=Y.finally=new xG,this.code(J);return this._endBlockNode(yG,xG)}throw($){return this._leafNode(new Gb($))}block($,Z){if(this._blockStarts.push(this._nodes.length),$)this.code($).endBlock(Z);return this}endBlock($){let Z=this._blockStarts.pop();if(Z===void 0)throw Error("CodeGen: not in self-balancing block");let J=this._nodes.length-Z;if(J<0||$!==void 0&&J!==$)throw Error(`CodeGen: wrong number of nodes: ${J} vs ${$} expected`);return this._nodes.length=Z,this}func($,Z=q1.nil,J,Y){if(this._blockNode(new kG($,Z,J)),Y)this.code(Y).endFunc();return this}endFunc(){return this._endBlockNode(kG)}optimize($=1){while($-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode($){return this._currNode.nodes.push($),this}_blockNode($){this._currNode.nodes.push($),this._nodes.push($)}_endBlockNode($,Z){let J=this._currNode;if(J instanceof $||Z&&J instanceof Z)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${Z?`${$.kind}/${Z.kind}`:$.kind}"`)}_elseNode($){let Z=this._currNode;if(!(Z instanceof ZZ))throw Error('CodeGen: "else" without "if"');return this._currNode=Z.else=$,this}get _root(){return this._nodes[0]}get _currNode(){let $=this._nodes;return $[$.length-1]}set _currNode($){let Z=this._nodes;Z[Z.length-1]=$}}V8.CodeGen=Bb;function e5($,Z){for(let J in Z)$[J]=($[J]||0)+(Z[J]||0);return $}function hG($,Z){return Z instanceof q1._CodeOrName?e5($,Z.names):$}function hJ($,Z,J){if($ instanceof q1.Name)return Y($);if(!X($))return $;return new q1._Code($._items.reduce((Q,G)=>{if(G instanceof q1.Name)G=Y(G);if(G instanceof q1._Code)Q.push(...G._items);else Q.push(G);return Q},[]));function Y(Q){let G=J[Q.str];if(G===void 0||Z[Q.str]!==1)return Q;return delete Z[Q.str],G}function X(Q){return Q instanceof q1._Code&&Q._items.some((G)=>G instanceof q1.Name&&Z[G.str]===1&&J[G.str]!==void 0)}}function MX0($,Z){for(let J in Z)$[J]=($[J]||0)-(Z[J]||0)}function zb($){return typeof $=="boolean"||typeof $=="number"||$===null?!$:q1._`!${Rz($)}`}V8.not=zb;var DX0=Fb(V8.operators.AND);function wX0(...$){return $.reduce(DX0)}V8.and=wX0;var LX0=Fb(V8.operators.OR);function TX0(...$){return $.reduce(LX0)}V8.or=TX0;function Fb($){return(Z,J)=>Z===q1.nil?J:J===q1.nil?Z:q1._`${Rz(Z)} ${$} ${Rz(J)}`}function Rz($){return $ instanceof q1.Name?$:q1._`(${$})`}});var J1=S((Lb)=>{Object.defineProperty(Lb,"__esModule",{value:!0});Lb.checkStrictMode=Lb.getErrorPath=Lb.Type=Lb.useFunc=Lb.setEvaluated=Lb.evaluatedPropsToName=Lb.mergeEvaluated=Lb.eachItem=Lb.unescapeJsonPointer=Lb.escapeJsonPointer=Lb.escapeFragment=Lb.unescapeFragment=Lb.schemaRefOrVal=Lb.schemaHasRulesButRef=Lb.schemaHasRules=Lb.checkUnknownRules=Lb.alwaysValidSchema=Lb.toHash=void 0;var x1=k0(),CX0=yJ();function EX0($){let Z={};for(let J of $)Z[J]=!0;return Z}Lb.toHash=EX0;function bX0($,Z){if(typeof Z=="boolean")return Z;if(Object.keys(Z).length===0)return!0;return jb($,Z),!Nb(Z,$.self.RULES.all)}Lb.alwaysValidSchema=bX0;function jb($,Z=$.schema){let{opts:J,self:Y}=$;if(!J.strictSchema)return;if(typeof Z==="boolean")return;let X=Y.RULES.keywords;for(let Q in Z)if(!X[Q])wb($,`unknown keyword: "${Q}"`)}Lb.checkUnknownRules=jb;function Nb($,Z){if(typeof $=="boolean")return!$;for(let J in $)if(Z[J])return!0;return!1}Lb.schemaHasRules=Nb;function _X0($,Z){if(typeof $=="boolean")return!$;for(let J in $)if(J!=="$ref"&&Z.all[J])return!0;return!1}Lb.schemaHasRulesButRef=_X0;function SX0({topSchemaRef:$,schemaPath:Z},J,Y,X){if(!X){if(typeof J=="number"||typeof J=="boolean")return J;if(typeof J=="string")return x1._`${J}`}return x1._`${$}${Z}${(0,x1.getProperty)(Y)}`}Lb.schemaRefOrVal=SX0;function fX0($){return Mb(decodeURIComponent($))}Lb.unescapeFragment=fX0;function kX0($){return encodeURIComponent(Cz($))}Lb.escapeFragment=kX0;function Cz($){if(typeof $=="number")return`${$}`;return $.replace(/~/g,"~0").replace(/\//g,"~1")}Lb.escapeJsonPointer=Cz;function Mb($){return $.replace(/~1/g,"/").replace(/~0/g,"~")}Lb.unescapeJsonPointer=Mb;function vX0($,Z){if(Array.isArray($))for(let J of $)Z(J);else Z($)}Lb.eachItem=vX0;function Ob({mergeNames:$,mergeToName:Z,mergeValues:J,resultToName:Y}){return(X,Q,G,W)=>{let K=G===void 0?Q:G instanceof x1.Name?(Q instanceof x1.Name?$(X,Q,G):Z(X,Q,G),G):Q instanceof x1.Name?(Z(X,G,Q),Q):J(Q,G);return W===x1.Name&&!(K instanceof x1.Name)?Y(X,K):K}}Lb.mergeEvaluated={props:Ob({mergeNames:($,Z,J)=>$.if(x1._`${J} !== true && ${Z} !== undefined`,()=>{$.if(x1._`${Z} === true`,()=>$.assign(J,!0),()=>$.assign(J,x1._`${J} || {}`).code(x1._`Object.assign(${J}, ${Z})`))}),mergeToName:($,Z,J)=>$.if(x1._`${J} !== true`,()=>{if(Z===!0)$.assign(J,!0);else $.assign(J,x1._`${J} || {}`),Ez($,J,Z)}),mergeValues:($,Z)=>$===!0?!0:{...$,...Z},resultToName:Db}),items:Ob({mergeNames:($,Z,J)=>$.if(x1._`${J} !== true && ${Z} !== undefined`,()=>$.assign(J,x1._`${Z} === true ? true : ${J} > ${Z} ? ${J} : ${Z}`)),mergeToName:($,Z,J)=>$.if(x1._`${J} !== true`,()=>$.assign(J,Z===!0?!0:x1._`${J} > ${Z} ? ${J} : ${Z}`)),mergeValues:($,Z)=>$===!0?!0:Math.max($,Z),resultToName:($,Z)=>$.var("items",Z)})};function Db($,Z){if(Z===!0)return $.var("props",!0);let J=$.var("props",x1._`{}`);if(Z!==void 0)Ez($,J,Z);return J}Lb.evaluatedPropsToName=Db;function Ez($,Z,J){Object.keys(J).forEach((Y)=>$.assign(x1._`${Z}${(0,x1.getProperty)(Y)}`,!0))}Lb.setEvaluated=Ez;var qb={};function yX0($,Z){return $.scopeValue("func",{ref:Z,code:qb[Z.code]||(qb[Z.code]=new CX0._Code(Z.code))})}Lb.useFunc=yX0;var Iz;(function($){$[$.Num=0]="Num",$[$.Str=1]="Str"})(Iz||(Lb.Type=Iz={}));function xX0($,Z,J){if($ instanceof x1.Name){let Y=Z===Iz.Num;return J?Y?x1._`"[" + ${$} + "]"`:x1._`"['" + ${$} + "']"`:Y?x1._`"/" + ${$}`:x1._`"/" + ${$}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return J?(0,x1.getProperty)($).toString():"/"+Cz($)}Lb.getErrorPath=xX0;function wb($,Z,J=$.opts.strictSchema){if(!J)return;if(Z=`strict mode: ${Z}`,J===!0)throw Error(Z);$.self.logger.warn(Z)}Lb.checkStrictMode=wb});var g8=S((Rb)=>{Object.defineProperty(Rb,"__esModule",{value:!0});var p$=k0(),ZQ0={data:new p$.Name("data"),valCxt:new p$.Name("valCxt"),instancePath:new p$.Name("instancePath"),parentData:new p$.Name("parentData"),parentDataProperty:new p$.Name("parentDataProperty"),rootData:new p$.Name("rootData"),dynamicAnchors:new p$.Name("dynamicAnchors"),vErrors:new p$.Name("vErrors"),errors:new p$.Name("errors"),this:new p$.Name("this"),self:new p$.Name("self"),scope:new p$.Name("scope"),json:new p$.Name("json"),jsonPos:new p$.Name("jsonPos"),jsonLen:new p$.Name("jsonLen"),jsonPart:new p$.Name("jsonPart")};Rb.default=ZQ0});var sX=S((Eb)=>{Object.defineProperty(Eb,"__esModule",{value:!0});Eb.extendErrors=Eb.resetErrorsCount=Eb.reportExtraError=Eb.reportError=Eb.keyword$DataError=Eb.keywordError=void 0;var M1=k0(),lG=J1(),a$=g8();Eb.keywordError={message:({keyword:$})=>M1.str`must pass "${$}" keyword validation`};Eb.keyword$DataError={message:({keyword:$,schemaType:Z})=>Z?M1.str`"${$}" keyword must be ${Z} ($data)`:M1.str`"${$}" keyword is invalid ($data)`};function YQ0($,Z=Eb.keywordError,J,Y){let{it:X}=$,{gen:Q,compositeRule:G,allErrors:W}=X,K=Cb($,Z,J);if(Y!==null&&Y!==void 0?Y:G||W)Pb(Q,K);else Ib(X,M1._`[${K}]`)}Eb.reportError=YQ0;function XQ0($,Z=Eb.keywordError,J){let{it:Y}=$,{gen:X,compositeRule:Q,allErrors:G}=Y,W=Cb($,Z,J);if(Pb(X,W),!(Q||G))Ib(Y,a$.default.vErrors)}Eb.reportExtraError=XQ0;function QQ0($,Z){$.assign(a$.default.errors,Z),$.if(M1._`${a$.default.vErrors} !== null`,()=>$.if(Z,()=>$.assign(M1._`${a$.default.vErrors}.length`,Z),()=>$.assign(a$.default.vErrors,null)))}Eb.resetErrorsCount=QQ0;function GQ0({gen:$,keyword:Z,schemaValue:J,data:Y,errsCount:X,it:Q}){if(X===void 0)throw Error("ajv implementation error");let G=$.name("err");$.forRange("i",X,a$.default.errors,(W)=>{if($.const(G,M1._`${a$.default.vErrors}[${W}]`),$.if(M1._`${G}.instancePath === undefined`,()=>$.assign(M1._`${G}.instancePath`,(0,M1.strConcat)(a$.default.instancePath,Q.errorPath))),$.assign(M1._`${G}.schemaPath`,M1.str`${Q.errSchemaPath}/${Z}`),Q.opts.verbose)$.assign(M1._`${G}.schema`,J),$.assign(M1._`${G}.data`,Y)})}Eb.extendErrors=GQ0;function Pb($,Z){let J=$.const("err",Z);$.if(M1._`${a$.default.vErrors} === null`,()=>$.assign(a$.default.vErrors,M1._`[${J}]`),M1._`${a$.default.vErrors}.push(${J})`),$.code(M1._`${a$.default.errors}++`)}function Ib($,Z){let{gen:J,validateName:Y,schemaEnv:X}=$;if(X.$async)J.throw(M1._`new ${$.ValidationError}(${Z})`);else J.assign(M1._`${Y}.errors`,Z),J.return(!1)}var $7={keyword:new M1.Name("keyword"),schemaPath:new M1.Name("schemaPath"),params:new M1.Name("params"),propertyName:new M1.Name("propertyName"),message:new M1.Name("message"),schema:new M1.Name("schema"),parentSchema:new M1.Name("parentSchema")};function Cb($,Z,J){let{createErrors:Y}=$.it;if(Y===!1)return M1._`{}`;return WQ0($,Z,J)}function WQ0($,Z,J={}){let{gen:Y,it:X}=$,Q=[KQ0(X,J),VQ0($,J)];return UQ0($,Z,Q),Y.object(...Q)}function KQ0({errorPath:$},{instancePath:Z}){let J=Z?M1.str`${$}${(0,lG.getErrorPath)(Z,lG.Type.Str)}`:$;return[a$.default.instancePath,(0,M1.strConcat)(a$.default.instancePath,J)]}function VQ0({keyword:$,it:{errSchemaPath:Z}},{schemaPath:J,parentSchema:Y}){let X=Y?Z:M1.str`${Z}/${$}`;if(J)X=M1.str`${X}${(0,lG.getErrorPath)(J,lG.Type.Str)}`;return[$7.schemaPath,X]}function UQ0($,{params:Z,message:J},Y){let{keyword:X,data:Q,schemaValue:G,it:W}=$,{opts:K,propertyName:V,topSchemaRef:U,schemaPath:H}=W;if(Y.push([$7.keyword,X],[$7.params,typeof Z=="function"?Z($):Z||M1._`{}`]),K.messages)Y.push([$7.message,typeof J=="function"?J($):J]);if(K.verbose)Y.push([$7.schema,G],[$7.parentSchema,M1._`${U}${H}`],[a$.default.data,Q]);if(V)Y.push([$7.propertyName,V])}});var kb=S((Sb)=>{Object.defineProperty(Sb,"__esModule",{value:!0});Sb.boolOrEmptySchema=Sb.topBoolOrEmptySchema=void 0;var AQ0=sX(),OQ0=k0(),qQ0=g8(),jQ0={message:"boolean schema is false"};function NQ0($){let{gen:Z,schema:J,validateName:Y}=$;if(J===!1)_b($,!1);else if(typeof J=="object"&&J.$async===!0)Z.return(qQ0.default.data);else Z.assign(OQ0._`${Y}.errors`,null),Z.return(!0)}Sb.topBoolOrEmptySchema=NQ0;function MQ0($,Z){let{gen:J,schema:Y}=$;if(Y===!1)J.var(Z,!1),_b($);else J.var(Z,!0)}Sb.boolOrEmptySchema=MQ0;function _b($,Z){let{gen:J,data:Y}=$,X={gen:J,keyword:"false schema",data:Y,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:$};(0,AQ0.reportError)(X,jQ0,void 0,Z)}});var _z=S((vb)=>{Object.defineProperty(vb,"__esModule",{value:!0});vb.getRules=vb.isJSONType=void 0;var wQ0=["string","number","integer","boolean","null","object","array"],LQ0=new Set(wQ0);function TQ0($){return typeof $=="string"&&LQ0.has($)}vb.isJSONType=TQ0;function RQ0(){let $={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...$,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},$.number,$.string,$.array,$.object],post:{rules:[]},all:{},keywords:{}}}vb.getRules=RQ0});var Sz=S((gb)=>{Object.defineProperty(gb,"__esModule",{value:!0});gb.shouldUseRule=gb.shouldUseGroup=gb.schemaHasRulesForType=void 0;function IQ0({schema:$,self:Z},J){let Y=Z.RULES.types[J];return Y&&Y!==!0&&xb($,Y)}gb.schemaHasRulesForType=IQ0;function xb($,Z){return Z.rules.some((J)=>hb($,J))}gb.shouldUseGroup=xb;function hb($,Z){var J;return $[Z.keyword]!==void 0||((J=Z.definition.implements)===null||J===void 0?void 0:J.some((Y)=>$[Y]!==void 0))}gb.shouldUseRule=hb});var rX=S((pb)=>{Object.defineProperty(pb,"__esModule",{value:!0});pb.reportTypeError=pb.checkDataTypes=pb.checkDataType=pb.coerceAndCheckDataType=pb.getJSONTypes=pb.getSchemaTypes=pb.DataType=void 0;var bQ0=_z(),_Q0=Sz(),SQ0=sX(),Y1=k0(),mb=J1(),gJ;(function($){$[$.Correct=0]="Correct",$[$.Wrong=1]="Wrong"})(gJ||(pb.DataType=gJ={}));function fQ0($){let Z=lb($.type);if(Z.includes("null")){if($.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!Z.length&&$.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if($.nullable===!0)Z.push("null")}return Z}pb.getSchemaTypes=fQ0;function lb($){let Z=Array.isArray($)?$:$?[$]:[];if(Z.every(bQ0.isJSONType))return Z;throw Error("type must be JSONType or JSONType[]: "+Z.join(","))}pb.getJSONTypes=lb;function kQ0($,Z){let{gen:J,data:Y,opts:X}=$,Q=vQ0(Z,X.coerceTypes),G=Z.length>0&&!(Q.length===0&&Z.length===1&&(0,_Q0.schemaHasRulesForType)($,Z[0]));if(G){let W=kz(Z,Y,X.strictNumbers,gJ.Wrong);J.if(W,()=>{if(Q.length)yQ0($,Z,Q);else vz($)})}return G}pb.coerceAndCheckDataType=kQ0;var db=new Set(["string","number","integer","boolean","null"]);function vQ0($,Z){return Z?$.filter((J)=>db.has(J)||Z==="array"&&J==="array"):[]}function yQ0($,Z,J){let{gen:Y,data:X,opts:Q}=$,G=Y.let("dataType",Y1._`typeof ${X}`),W=Y.let("coerced",Y1._`undefined`);if(Q.coerceTypes==="array")Y.if(Y1._`${G} == 'object' && Array.isArray(${X}) && ${X}.length == 1`,()=>Y.assign(X,Y1._`${X}[0]`).assign(G,Y1._`typeof ${X}`).if(kz(Z,X,Q.strictNumbers),()=>Y.assign(W,X)));Y.if(Y1._`${W} !== undefined`);for(let V of J)if(db.has(V)||V==="array"&&Q.coerceTypes==="array")K(V);Y.else(),vz($),Y.endIf(),Y.if(Y1._`${W} !== undefined`,()=>{Y.assign(X,W),xQ0($,W)});function K(V){switch(V){case"string":Y.elseIf(Y1._`${G} == "number" || ${G} == "boolean"`).assign(W,Y1._`"" + ${X}`).elseIf(Y1._`${X} === null`).assign(W,Y1._`""`);return;case"number":Y.elseIf(Y1._`${G} == "boolean" || ${X} === null
|
|
113
|
+
|| (${G} == "string" && ${X} && ${X} == +${X})`).assign(W,Y1._`+${X}`);return;case"integer":Y.elseIf(Y1._`${G} === "boolean" || ${X} === null
|
|
114
|
+
|| (${G} === "string" && ${X} && ${X} == +${X} && !(${X} % 1))`).assign(W,Y1._`+${X}`);return;case"boolean":Y.elseIf(Y1._`${X} === "false" || ${X} === 0 || ${X} === null`).assign(W,!1).elseIf(Y1._`${X} === "true" || ${X} === 1`).assign(W,!0);return;case"null":Y.elseIf(Y1._`${X} === "" || ${X} === 0 || ${X} === false`),Y.assign(W,null);return;case"array":Y.elseIf(Y1._`${G} === "string" || ${G} === "number"
|
|
115
|
+
|| ${G} === "boolean" || ${X} === null`).assign(W,Y1._`[${X}]`)}}}function xQ0({gen:$,parentData:Z,parentDataProperty:J},Y){$.if(Y1._`${Z} !== undefined`,()=>$.assign(Y1._`${Z}[${J}]`,Y))}function fz($,Z,J,Y=gJ.Correct){let X=Y===gJ.Correct?Y1.operators.EQ:Y1.operators.NEQ,Q;switch($){case"null":return Y1._`${Z} ${X} null`;case"array":Q=Y1._`Array.isArray(${Z})`;break;case"object":Q=Y1._`${Z} && typeof ${Z} == "object" && !Array.isArray(${Z})`;break;case"integer":Q=G(Y1._`!(${Z} % 1) && !isNaN(${Z})`);break;case"number":Q=G();break;default:return Y1._`typeof ${Z} ${X} ${$}`}return Y===gJ.Correct?Q:(0,Y1.not)(Q);function G(W=Y1.nil){return(0,Y1.and)(Y1._`typeof ${Z} == "number"`,W,J?Y1._`isFinite(${Z})`:Y1.nil)}}pb.checkDataType=fz;function kz($,Z,J,Y){if($.length===1)return fz($[0],Z,J,Y);let X,Q=(0,mb.toHash)($);if(Q.array&&Q.object){let G=Y1._`typeof ${Z} != "object"`;X=Q.null?G:Y1._`!${Z} || ${G}`,delete Q.null,delete Q.array,delete Q.object}else X=Y1.nil;if(Q.number)delete Q.integer;for(let G in Q)X=(0,Y1.and)(X,fz(G,Z,J,Y));return X}pb.checkDataTypes=kz;var hQ0={message:({schema:$})=>`must be ${$}`,params:({schema:$,schemaValue:Z})=>typeof $=="string"?Y1._`{type: ${$}}`:Y1._`{type: ${Z}}`};function vz($){let Z=gQ0($);(0,SQ0.reportError)(Z,hQ0)}pb.reportTypeError=vz;function gQ0($){let{gen:Z,data:J,schema:Y}=$,X=(0,mb.schemaRefOrVal)($,Y,"type");return{gen:Z,keyword:"type",data:J,schema:Y.type,schemaCode:X,schemaValue:X,parentSchema:Y,params:{},it:$}}});var sb=S((nb)=>{Object.defineProperty(nb,"__esModule",{value:!0});nb.assignDefaults=void 0;var uJ=k0(),iQ0=J1();function nQ0($,Z){let{properties:J,items:Y}=$.schema;if(Z==="object"&&J)for(let X in J)ib($,X,J[X].default);else if(Z==="array"&&Array.isArray(Y))Y.forEach((X,Q)=>ib($,Q,X.default))}nb.assignDefaults=nQ0;function ib($,Z,J){let{gen:Y,compositeRule:X,data:Q,opts:G}=$;if(J===void 0)return;let W=uJ._`${Q}${(0,uJ.getProperty)(Z)}`;if(X){(0,iQ0.checkStrictMode)($,`default is ignored for: ${W}`);return}let K=uJ._`${W} === undefined`;if(G.useDefaults==="empty")K=uJ._`${K} || ${W} === null || ${W} === ""`;Y.if(K,uJ._`${W} = ${(0,uJ.stringify)(J)}`)}});var S$=S((tb)=>{Object.defineProperty(tb,"__esModule",{value:!0});tb.validateUnion=tb.validateArray=tb.usePattern=tb.callValidateCode=tb.schemaProperties=tb.allSchemaProperties=tb.noPropertyInData=tb.propertyInData=tb.isOwnProperty=tb.hasPropFunc=tb.reportMissingProp=tb.checkMissingProp=tb.checkReportMissingProp=void 0;var c1=k0(),yz=J1(),oZ=g8(),oQ0=J1();function sQ0($,Z){let{gen:J,data:Y,it:X}=$;J.if(hz(J,Y,Z,X.opts.ownProperties),()=>{$.setParams({missingProperty:c1._`${Z}`},!0),$.error()})}tb.checkReportMissingProp=sQ0;function rQ0({gen:$,data:Z,it:{opts:J}},Y,X){return(0,c1.or)(...Y.map((Q)=>(0,c1.and)(hz($,Z,Q,J.ownProperties),c1._`${X} = ${Q}`)))}tb.checkMissingProp=rQ0;function aQ0($,Z){$.setParams({missingProperty:Z},!0),$.error()}tb.reportMissingProp=aQ0;function rb($){return $.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:c1._`Object.prototype.hasOwnProperty`})}tb.hasPropFunc=rb;function xz($,Z,J){return c1._`${rb($)}.call(${Z}, ${J})`}tb.isOwnProperty=xz;function tQ0($,Z,J,Y){let X=c1._`${Z}${(0,c1.getProperty)(J)} !== undefined`;return Y?c1._`${X} && ${xz($,Z,J)}`:X}tb.propertyInData=tQ0;function hz($,Z,J,Y){let X=c1._`${Z}${(0,c1.getProperty)(J)} === undefined`;return Y?(0,c1.or)(X,(0,c1.not)(xz($,Z,J))):X}tb.noPropertyInData=hz;function ab($){return $?Object.keys($).filter((Z)=>Z!=="__proto__"):[]}tb.allSchemaProperties=ab;function eQ0($,Z){return ab(Z).filter((J)=>!(0,yz.alwaysValidSchema)($,Z[J]))}tb.schemaProperties=eQ0;function $90({schemaCode:$,data:Z,it:{gen:J,topSchemaRef:Y,schemaPath:X,errorPath:Q},it:G},W,K,V){let U=V?c1._`${$}, ${Z}, ${Y}${X}`:Z,H=[[oZ.default.instancePath,(0,c1.strConcat)(oZ.default.instancePath,Q)],[oZ.default.parentData,G.parentData],[oZ.default.parentDataProperty,G.parentDataProperty],[oZ.default.rootData,oZ.default.rootData]];if(G.opts.dynamicRef)H.push([oZ.default.dynamicAnchors,oZ.default.dynamicAnchors]);let B=c1._`${U}, ${J.object(...H)}`;return K!==c1.nil?c1._`${W}.call(${K}, ${B})`:c1._`${W}(${B})`}tb.callValidateCode=$90;var Z90=c1._`new RegExp`;function J90({gen:$,it:{opts:Z}},J){let Y=Z.unicodeRegExp?"u":"",{regExp:X}=Z.code,Q=X(J,Y);return $.scopeValue("pattern",{key:Q.toString(),ref:Q,code:c1._`${X.code==="new RegExp"?Z90:(0,oQ0.useFunc)($,X)}(${J}, ${Y})`})}tb.usePattern=J90;function Y90($){let{gen:Z,data:J,keyword:Y,it:X}=$,Q=Z.name("valid");if(X.allErrors){let W=Z.let("valid",!0);return G(()=>Z.assign(W,!1)),W}return Z.var(Q,!0),G(()=>Z.break()),Q;function G(W){let K=Z.const("len",c1._`${J}.length`);Z.forRange("i",0,K,(V)=>{$.subschema({keyword:Y,dataProp:V,dataPropType:yz.Type.Num},Q),Z.if((0,c1.not)(Q),W)})}}tb.validateArray=Y90;function X90($){let{gen:Z,schema:J,keyword:Y,it:X}=$;if(!Array.isArray(J))throw Error("ajv implementation error");if(J.some((K)=>(0,yz.alwaysValidSchema)(X,K))&&!X.opts.unevaluated)return;let G=Z.let("valid",!1),W=Z.name("_valid");Z.block(()=>J.forEach((K,V)=>{let U=$.subschema({keyword:Y,schemaProp:V,compositeRule:!0},W);if(Z.assign(G,c1._`${G} || ${W}`),!$.mergeValidEvaluated(U,W))Z.if((0,c1.not)(G))})),$.result(G,()=>$.reset(),()=>$.error(!0))}tb.validateUnion=X90});var X_=S((J_)=>{Object.defineProperty(J_,"__esModule",{value:!0});J_.validateKeywordUsage=J_.validSchemaType=J_.funcKeywordCode=J_.macroKeywordCode=void 0;var t$=k0(),Z7=g8(),q90=S$(),j90=sX();function N90($,Z){let{gen:J,keyword:Y,schema:X,parentSchema:Q,it:G}=$,W=Z.macro.call(G.self,X,Q,G),K=Z_(J,Y,W);if(G.opts.validateSchema!==!1)G.self.validateSchema(W,!0);let V=J.name("valid");$.subschema({schema:W,schemaPath:t$.nil,errSchemaPath:`${G.errSchemaPath}/${Y}`,topSchemaRef:K,compositeRule:!0},V),$.pass(V,()=>$.error(!0))}J_.macroKeywordCode=N90;function M90($,Z){var J;let{gen:Y,keyword:X,schema:Q,parentSchema:G,$data:W,it:K}=$;w90(K,Z);let V=!W&&Z.compile?Z.compile.call(K.self,Q,G,K):Z.validate,U=Z_(Y,X,V),H=Y.let("valid");$.block$data(H,B),$.ok((J=Z.valid)!==null&&J!==void 0?J:H);function B(){if(Z.errors===!1){if(A(),Z.modifying)$_($);j(()=>$.error())}else{let N=Z.async?z():F();if(Z.modifying)$_($);j(()=>D90($,N))}}function z(){let N=Y.let("ruleErrs",null);return Y.try(()=>A(t$._`await `),(w)=>Y.assign(H,!1).if(t$._`${w} instanceof ${K.ValidationError}`,()=>Y.assign(N,t$._`${w}.errors`),()=>Y.throw(w))),N}function F(){let N=t$._`${U}.errors`;return Y.assign(N,null),A(t$.nil),N}function A(N=Z.async?t$._`await `:t$.nil){let w=K.opts.passContext?Z7.default.this:Z7.default.self,q=!(("compile"in Z)&&!W||Z.schema===!1);Y.assign(H,t$._`${N}${(0,q90.callValidateCode)($,U,w,q)}`,Z.modifying)}function j(N){var w;Y.if((0,t$.not)((w=Z.valid)!==null&&w!==void 0?w:H),N)}}J_.funcKeywordCode=M90;function $_($){let{gen:Z,data:J,it:Y}=$;Z.if(Y.parentData,()=>Z.assign(J,t$._`${Y.parentData}[${Y.parentDataProperty}]`))}function D90($,Z){let{gen:J}=$;J.if(t$._`Array.isArray(${Z})`,()=>{J.assign(Z7.default.vErrors,t$._`${Z7.default.vErrors} === null ? ${Z} : ${Z7.default.vErrors}.concat(${Z})`).assign(Z7.default.errors,t$._`${Z7.default.vErrors}.length`),(0,j90.extendErrors)($)},()=>$.error())}function w90({schemaEnv:$},Z){if(Z.async&&!$.$async)throw Error("async keyword in sync schema")}function Z_($,Z,J){if(J===void 0)throw Error(`keyword "${Z}" failed to compile`);return $.scopeValue("keyword",typeof J=="function"?{ref:J}:{ref:J,code:(0,t$.stringify)(J)})}function L90($,Z,J=!1){return!Z.length||Z.some((Y)=>Y==="array"?Array.isArray($):Y==="object"?$&&typeof $=="object"&&!Array.isArray($):typeof $==Y||J&&typeof $>"u")}J_.validSchemaType=L90;function T90({schema:$,opts:Z,self:J,errSchemaPath:Y},X,Q){if(Array.isArray(X.keyword)?!X.keyword.includes(Q):X.keyword!==Q)throw Error("ajv implementation error");let G=X.dependencies;if(G===null||G===void 0?void 0:G.some((W)=>!Object.prototype.hasOwnProperty.call($,W)))throw Error(`parent schema must have dependencies of ${Q}: ${G.join(",")}`);if(X.validateSchema){if(!X.validateSchema($[Q])){let K=`keyword "${Q}" value is invalid at path "${Y}": `+J.errorsText(X.validateSchema.errors);if(Z.validateSchema==="log")J.logger.error(K);else throw Error(K)}}}J_.validateKeywordUsage=T90});var K_=S((G_)=>{Object.defineProperty(G_,"__esModule",{value:!0});G_.extendSubschemaMode=G_.extendSubschemaData=G_.getSubschema=void 0;var C6=k0(),Q_=J1();function C90($,{keyword:Z,schemaProp:J,schema:Y,schemaPath:X,errSchemaPath:Q,topSchemaRef:G}){if(Z!==void 0&&Y!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(Z!==void 0){let W=$.schema[Z];return J===void 0?{schema:W,schemaPath:C6._`${$.schemaPath}${(0,C6.getProperty)(Z)}`,errSchemaPath:`${$.errSchemaPath}/${Z}`}:{schema:W[J],schemaPath:C6._`${$.schemaPath}${(0,C6.getProperty)(Z)}${(0,C6.getProperty)(J)}`,errSchemaPath:`${$.errSchemaPath}/${Z}/${(0,Q_.escapeFragment)(J)}`}}if(Y!==void 0){if(X===void 0||Q===void 0||G===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:Y,schemaPath:X,topSchemaRef:G,errSchemaPath:Q}}throw Error('either "keyword" or "schema" must be passed')}G_.getSubschema=C90;function E90($,Z,{dataProp:J,dataPropType:Y,data:X,dataTypes:Q,propertyName:G}){if(X!==void 0&&J!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:W}=Z;if(J!==void 0){let{errorPath:V,dataPathArr:U,opts:H}=Z,B=W.let("data",C6._`${Z.data}${(0,C6.getProperty)(J)}`,!0);K(B),$.errorPath=C6.str`${V}${(0,Q_.getErrorPath)(J,Y,H.jsPropertySyntax)}`,$.parentDataProperty=C6._`${J}`,$.dataPathArr=[...U,$.parentDataProperty]}if(X!==void 0){let V=X instanceof C6.Name?X:W.let("data",X,!0);if(K(V),G!==void 0)$.propertyName=G}if(Q)$.dataTypes=Q;function K(V){$.data=V,$.dataLevel=Z.dataLevel+1,$.dataTypes=[],Z.definedProperties=new Set,$.parentData=Z.data,$.dataNames=[...Z.dataNames,V]}}G_.extendSubschemaData=E90;function b90($,{jtdDiscriminator:Z,jtdMetadata:J,compositeRule:Y,createErrors:X,allErrors:Q}){if(Y!==void 0)$.compositeRule=Y;if(X!==void 0)$.createErrors=X;if(Q!==void 0)$.allErrors=Q;$.jtdDiscriminator=Z,$.jtdMetadata=J}G_.extendSubschemaMode=b90});var aX=S((Jv0,V_)=>{V_.exports=function $(Z,J){if(Z===J)return!0;if(Z&&J&&typeof Z=="object"&&typeof J=="object"){if(Z.constructor!==J.constructor)return!1;var Y,X,Q;if(Array.isArray(Z)){if(Y=Z.length,Y!=J.length)return!1;for(X=Y;X--!==0;)if(!$(Z[X],J[X]))return!1;return!0}if(Z.constructor===RegExp)return Z.source===J.source&&Z.flags===J.flags;if(Z.valueOf!==Object.prototype.valueOf)return Z.valueOf()===J.valueOf();if(Z.toString!==Object.prototype.toString)return Z.toString()===J.toString();if(Q=Object.keys(Z),Y=Q.length,Y!==Object.keys(J).length)return!1;for(X=Y;X--!==0;)if(!Object.prototype.hasOwnProperty.call(J,Q[X]))return!1;for(X=Y;X--!==0;){var G=Q[X];if(!$(Z[G],J[G]))return!1}return!0}return Z!==Z&&J!==J}});var H_=S((Yv0,U_)=>{var sZ=U_.exports=function($,Z,J){if(typeof Z=="function")J=Z,Z={};J=Z.cb||J;var Y=typeof J=="function"?J:J.pre||function(){},X=J.post||function(){};dG(Z,Y,X,$,"",$)};sZ.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};sZ.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};sZ.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};sZ.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function dG($,Z,J,Y,X,Q,G,W,K,V){if(Y&&typeof Y=="object"&&!Array.isArray(Y)){Z(Y,X,Q,G,W,K,V);for(var U in Y){var H=Y[U];if(Array.isArray(H)){if(U in sZ.arrayKeywords)for(var B=0;B<H.length;B++)dG($,Z,J,H[B],X+"/"+U+"/"+B,Q,X,U,Y,B)}else if(U in sZ.propsKeywords){if(H&&typeof H=="object")for(var z in H)dG($,Z,J,H[z],X+"/"+U+"/"+f90(z),Q,X,U,Y,z)}else if(U in sZ.keywords||$.allKeys&&!(U in sZ.skipKeywords))dG($,Z,J,H,X+"/"+U,Q,X,U,Y)}J(Y,X,Q,G,W,K,V)}}function f90($){return $.replace(/~/g,"~0").replace(/\//g,"~1")}});var tX=S((A_)=>{Object.defineProperty(A_,"__esModule",{value:!0});A_.getSchemaRefs=A_.resolveUrl=A_.normalizeId=A_._getFullPath=A_.getFullPath=A_.inlineRef=void 0;var k90=J1(),v90=aX(),y90=H_(),x90=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function h90($,Z=!0){if(typeof $=="boolean")return!0;if(Z===!0)return!gz($);if(!Z)return!1;return B_($)<=Z}A_.inlineRef=h90;var g90=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function gz($){for(let Z in $){if(g90.has(Z))return!0;let J=$[Z];if(Array.isArray(J)&&J.some(gz))return!0;if(typeof J=="object"&&gz(J))return!0}return!1}function B_($){let Z=0;for(let J in $){if(J==="$ref")return 1/0;if(Z++,x90.has(J))continue;if(typeof $[J]=="object")(0,k90.eachItem)($[J],(Y)=>Z+=B_(Y));if(Z===1/0)return 1/0}return Z}function z_($,Z="",J){if(J!==!1)Z=mJ(Z);let Y=$.parse(Z);return F_($,Y)}A_.getFullPath=z_;function F_($,Z){return $.serialize(Z).split("#")[0]+"#"}A_._getFullPath=F_;var u90=/#\/?$/;function mJ($){return $?$.replace(u90,""):""}A_.normalizeId=mJ;function m90($,Z,J){return J=mJ(J),$.resolve(Z,J)}A_.resolveUrl=m90;var l90=/^[a-z_][-a-z0-9._]*$/i;function d90($,Z){if(typeof $=="boolean")return{};let{schemaId:J,uriResolver:Y}=this.opts,X=mJ($[J]||Z),Q={"":X},G=z_(Y,X,!1),W={},K=new Set;return y90($,{allKeys:!0},(H,B,z,F)=>{if(F===void 0)return;let A=G+B,j=Q[F];if(typeof H[J]=="string")j=N.call(this,H[J]);w.call(this,H.$anchor),w.call(this,H.$dynamicAnchor),Q[B]=j;function N(q){let M=this.opts.uriResolver.resolve;if(q=mJ(j?M(j,q):q),K.has(q))throw U(q);K.add(q);let C=this.refs[q];if(typeof C=="string")C=this.refs[C];if(typeof C=="object")V(H,C.schema,q);else if(q!==mJ(A))if(q[0]==="#")V(H,W[q],q),W[q]=H;else this.refs[q]=A;return q}function w(q){if(typeof q=="string"){if(!l90.test(q))throw Error(`invalid anchor "${q}"`);N.call(this,`#${q}`)}}}),W;function V(H,B,z){if(B!==void 0&&!v90(H,B))throw U(z)}function U(H){return Error(`reference "${H}" resolves to more than one schema`)}}A_.getSchemaRefs=d90});var lJ=S((__)=>{Object.defineProperty(__,"__esModule",{value:!0});__.getData=__.KeywordCxt=__.validateFunctionCode=void 0;var D_=kb(),q_=rX(),mz=Sz(),pG=rX(),s90=sb(),$Q=X_(),uz=K_(),L0=k0(),c0=g8(),r90=tX(),JZ=J1(),eX=sX();function a90($){if(T_($)){if(R_($),L_($)){$40($);return}}w_($,()=>(0,D_.topBoolOrEmptySchema)($))}__.validateFunctionCode=a90;function w_({gen:$,validateName:Z,schema:J,schemaEnv:Y,opts:X},Q){if(X.code.es5)$.func(Z,L0._`${c0.default.data}, ${c0.default.valCxt}`,Y.$async,()=>{$.code(L0._`"use strict"; ${j_(J,X)}`),e90($,X),$.code(Q)});else $.func(Z,L0._`${c0.default.data}, ${t90(X)}`,Y.$async,()=>$.code(j_(J,X)).code(Q))}function t90($){return L0._`{${c0.default.instancePath}="", ${c0.default.parentData}, ${c0.default.parentDataProperty}, ${c0.default.rootData}=${c0.default.data}${$.dynamicRef?L0._`, ${c0.default.dynamicAnchors}={}`:L0.nil}}={}`}function e90($,Z){$.if(c0.default.valCxt,()=>{if($.var(c0.default.instancePath,L0._`${c0.default.valCxt}.${c0.default.instancePath}`),$.var(c0.default.parentData,L0._`${c0.default.valCxt}.${c0.default.parentData}`),$.var(c0.default.parentDataProperty,L0._`${c0.default.valCxt}.${c0.default.parentDataProperty}`),$.var(c0.default.rootData,L0._`${c0.default.valCxt}.${c0.default.rootData}`),Z.dynamicRef)$.var(c0.default.dynamicAnchors,L0._`${c0.default.valCxt}.${c0.default.dynamicAnchors}`)},()=>{if($.var(c0.default.instancePath,L0._`""`),$.var(c0.default.parentData,L0._`undefined`),$.var(c0.default.parentDataProperty,L0._`undefined`),$.var(c0.default.rootData,c0.default.data),Z.dynamicRef)$.var(c0.default.dynamicAnchors,L0._`{}`)})}function $40($){let{schema:Z,opts:J,gen:Y}=$;w_($,()=>{if(J.$comment&&Z.$comment)I_($);if(Q40($),Y.let(c0.default.vErrors,null),Y.let(c0.default.errors,0),J.unevaluated)Z40($);P_($),K40($)});return}function Z40($){let{gen:Z,validateName:J}=$;$.evaluated=Z.const("evaluated",L0._`${J}.evaluated`),Z.if(L0._`${$.evaluated}.dynamicProps`,()=>Z.assign(L0._`${$.evaluated}.props`,L0._`undefined`)),Z.if(L0._`${$.evaluated}.dynamicItems`,()=>Z.assign(L0._`${$.evaluated}.items`,L0._`undefined`))}function j_($,Z){let J=typeof $=="object"&&$[Z.schemaId];return J&&(Z.code.source||Z.code.process)?L0._`/*# sourceURL=${J} */`:L0.nil}function J40($,Z){if(T_($)){if(R_($),L_($)){Y40($,Z);return}}(0,D_.boolOrEmptySchema)($,Z)}function L_({schema:$,self:Z}){if(typeof $=="boolean")return!$;for(let J in $)if(Z.RULES.all[J])return!0;return!1}function T_($){return typeof $.schema!="boolean"}function Y40($,Z){let{schema:J,gen:Y,opts:X}=$;if(X.$comment&&J.$comment)I_($);G40($),W40($);let Q=Y.const("_errs",c0.default.errors);P_($,Q),Y.var(Z,L0._`${Q} === ${c0.default.errors}`)}function R_($){(0,JZ.checkUnknownRules)($),X40($)}function P_($,Z){if($.opts.jtd)return N_($,[],!1,Z);let J=(0,q_.getSchemaTypes)($.schema),Y=(0,q_.coerceAndCheckDataType)($,J);N_($,J,!Y,Z)}function X40($){let{schema:Z,errSchemaPath:J,opts:Y,self:X}=$;if(Z.$ref&&Y.ignoreKeywordsWithRef&&(0,JZ.schemaHasRulesButRef)(Z,X.RULES))X.logger.warn(`$ref: keywords ignored in schema at path "${J}"`)}function Q40($){let{schema:Z,opts:J}=$;if(Z.default!==void 0&&J.useDefaults&&J.strictSchema)(0,JZ.checkStrictMode)($,"default is ignored in the schema root")}function G40($){let Z=$.schema[$.opts.schemaId];if(Z)$.baseId=(0,r90.resolveUrl)($.opts.uriResolver,$.baseId,Z)}function W40($){if($.schema.$async&&!$.schemaEnv.$async)throw Error("async schema in sync schema")}function I_({gen:$,schemaEnv:Z,schema:J,errSchemaPath:Y,opts:X}){let Q=J.$comment;if(X.$comment===!0)$.code(L0._`${c0.default.self}.logger.log(${Q})`);else if(typeof X.$comment=="function"){let G=L0.str`${Y}/$comment`,W=$.scopeValue("root",{ref:Z.root});$.code(L0._`${c0.default.self}.opts.$comment(${Q}, ${G}, ${W}.schema)`)}}function K40($){let{gen:Z,schemaEnv:J,validateName:Y,ValidationError:X,opts:Q}=$;if(J.$async)Z.if(L0._`${c0.default.errors} === 0`,()=>Z.return(c0.default.data),()=>Z.throw(L0._`new ${X}(${c0.default.vErrors})`));else{if(Z.assign(L0._`${Y}.errors`,c0.default.vErrors),Q.unevaluated)V40($);Z.return(L0._`${c0.default.errors} === 0`)}}function V40({gen:$,evaluated:Z,props:J,items:Y}){if(J instanceof L0.Name)$.assign(L0._`${Z}.props`,J);if(Y instanceof L0.Name)$.assign(L0._`${Z}.items`,Y)}function N_($,Z,J,Y){let{gen:X,schema:Q,data:G,allErrors:W,opts:K,self:V}=$,{RULES:U}=V;if(Q.$ref&&(K.ignoreKeywordsWithRef||!(0,JZ.schemaHasRulesButRef)(Q,U))){X.block(()=>E_($,"$ref",U.all.$ref.definition));return}if(!K.jtd)U40($,Z);X.block(()=>{for(let B of U.rules)H(B);H(U.post)});function H(B){if(!(0,mz.shouldUseGroup)(Q,B))return;if(B.type){if(X.if((0,pG.checkDataType)(B.type,G,K.strictNumbers)),M_($,B),Z.length===1&&Z[0]===B.type&&J)X.else(),(0,pG.reportTypeError)($);X.endIf()}else M_($,B);if(!W)X.if(L0._`${c0.default.errors} === ${Y||0}`)}}function M_($,Z){let{gen:J,schema:Y,opts:{useDefaults:X}}=$;if(X)(0,s90.assignDefaults)($,Z.type);J.block(()=>{for(let Q of Z.rules)if((0,mz.shouldUseRule)(Y,Q))E_($,Q.keyword,Q.definition,Z.type)})}function U40($,Z){if($.schemaEnv.meta||!$.opts.strictTypes)return;if(H40($,Z),!$.opts.allowUnionTypes)B40($,Z);z40($,$.dataTypes)}function H40($,Z){if(!Z.length)return;if(!$.dataTypes.length){$.dataTypes=Z;return}Z.forEach((J)=>{if(!C_($.dataTypes,J))lz($,`type "${J}" not allowed by context "${$.dataTypes.join(",")}"`)}),A40($,Z)}function B40($,Z){if(Z.length>1&&!(Z.length===2&&Z.includes("null")))lz($,"use allowUnionTypes to allow union type keyword")}function z40($,Z){let J=$.self.RULES.all;for(let Y in J){let X=J[Y];if(typeof X=="object"&&(0,mz.shouldUseRule)($.schema,X)){let{type:Q}=X.definition;if(Q.length&&!Q.some((G)=>F40(Z,G)))lz($,`missing type "${Q.join(",")}" for keyword "${Y}"`)}}}function F40($,Z){return $.includes(Z)||Z==="number"&&$.includes("integer")}function C_($,Z){return $.includes(Z)||Z==="integer"&&$.includes("number")}function A40($,Z){let J=[];for(let Y of $.dataTypes)if(C_(Z,Y))J.push(Y);else if(Z.includes("integer")&&Y==="number")J.push("integer");$.dataTypes=J}function lz($,Z){let J=$.schemaEnv.baseId+$.errSchemaPath;Z+=` at "${J}" (strictTypes)`,(0,JZ.checkStrictMode)($,Z,$.opts.strictTypes)}class dz{constructor($,Z,J){if((0,$Q.validateKeywordUsage)($,Z,J),this.gen=$.gen,this.allErrors=$.allErrors,this.keyword=J,this.data=$.data,this.schema=$.schema[J],this.$data=Z.$data&&$.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,JZ.schemaRefOrVal)($,this.schema,J,this.$data),this.schemaType=Z.schemaType,this.parentSchema=$.schema,this.params={},this.it=$,this.def=Z,this.$data)this.schemaCode=$.gen.const("vSchema",b_(this.$data,$));else if(this.schemaCode=this.schemaValue,!(0,$Q.validSchemaType)(this.schema,Z.schemaType,Z.allowUndefined))throw Error(`${J} value must be ${JSON.stringify(Z.schemaType)}`);if("code"in Z?Z.trackErrors:Z.errors!==!1)this.errsCount=$.gen.const("_errs",c0.default.errors)}result($,Z,J){this.failResult((0,L0.not)($),Z,J)}failResult($,Z,J){if(this.gen.if($),J)J();else this.error();if(Z){if(this.gen.else(),Z(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass($,Z){this.failResult((0,L0.not)($),void 0,Z)}fail($){if($===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if($),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data($){if(!this.$data)return this.fail($);let{schemaCode:Z}=this;this.fail(L0._`${Z} !== undefined && (${(0,L0.or)(this.invalid$data(),$)})`)}error($,Z,J){if(Z){this.setParams(Z),this._error($,J),this.setParams({});return}this._error($,J)}_error($,Z){($?eX.reportExtraError:eX.reportError)(this,this.def.error,Z)}$dataError(){(0,eX.reportError)(this,this.def.$dataError||eX.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,eX.resetErrorsCount)(this.gen,this.errsCount)}ok($){if(!this.allErrors)this.gen.if($)}setParams($,Z){if(Z)Object.assign(this.params,$);else this.params=$}block$data($,Z,J=L0.nil){this.gen.block(()=>{this.check$data($,J),Z()})}check$data($=L0.nil,Z=L0.nil){if(!this.$data)return;let{gen:J,schemaCode:Y,schemaType:X,def:Q}=this;if(J.if((0,L0.or)(L0._`${Y} === undefined`,Z)),$!==L0.nil)J.assign($,!0);if(X.length||Q.validateSchema){if(J.elseIf(this.invalid$data()),this.$dataError(),$!==L0.nil)J.assign($,!1)}J.else()}invalid$data(){let{gen:$,schemaCode:Z,schemaType:J,def:Y,it:X}=this;return(0,L0.or)(Q(),G());function Q(){if(J.length){if(!(Z instanceof L0.Name))throw Error("ajv implementation error");let W=Array.isArray(J)?J:[J];return L0._`${(0,pG.checkDataTypes)(W,Z,X.opts.strictNumbers,pG.DataType.Wrong)}`}return L0.nil}function G(){if(Y.validateSchema){let W=$.scopeValue("validate$data",{ref:Y.validateSchema});return L0._`!${W}(${Z})`}return L0.nil}}subschema($,Z){let J=(0,uz.getSubschema)(this.it,$);(0,uz.extendSubschemaData)(J,this.it,$),(0,uz.extendSubschemaMode)(J,$);let Y={...this.it,...J,items:void 0,props:void 0};return J40(Y,Z),Y}mergeEvaluated($,Z){let{it:J,gen:Y}=this;if(!J.opts.unevaluated)return;if(J.props!==!0&&$.props!==void 0)J.props=JZ.mergeEvaluated.props(Y,$.props,J.props,Z);if(J.items!==!0&&$.items!==void 0)J.items=JZ.mergeEvaluated.items(Y,$.items,J.items,Z)}mergeValidEvaluated($,Z){let{it:J,gen:Y}=this;if(J.opts.unevaluated&&(J.props!==!0||J.items!==!0))return Y.if(Z,()=>this.mergeEvaluated($,L0.Name)),!0}}__.KeywordCxt=dz;function E_($,Z,J,Y){let X=new dz($,J,Z);if("code"in J)J.code(X,Y);else if(X.$data&&J.validate)(0,$Q.funcKeywordCode)(X,J);else if("macro"in J)(0,$Q.macroKeywordCode)(X,J);else if(J.compile||J.validate)(0,$Q.funcKeywordCode)(X,J)}var O40=/^\/(?:[^~]|~0|~1)*$/,q40=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function b_($,{dataLevel:Z,dataNames:J,dataPathArr:Y}){let X,Q;if($==="")return c0.default.rootData;if($[0]==="/"){if(!O40.test($))throw Error(`Invalid JSON-pointer: ${$}`);X=$,Q=c0.default.rootData}else{let V=q40.exec($);if(!V)throw Error(`Invalid JSON-pointer: ${$}`);let U=+V[1];if(X=V[2],X==="#"){if(U>=Z)throw Error(K("property/index",U));return Y[Z-U]}if(U>Z)throw Error(K("data",U));if(Q=J[Z-U],!X)return Q}let G=Q,W=X.split("/");for(let V of W)if(V)Q=L0._`${Q}${(0,L0.getProperty)((0,JZ.unescapeJsonPointer)(V))}`,G=L0._`${G} && ${Q}`;return G;function K(V,U){return`Cannot access ${V} ${U} levels up, current level is ${Z}`}}__.getData=b_});var ZQ=S((k_)=>{Object.defineProperty(k_,"__esModule",{value:!0});class f_ extends Error{constructor($){super("validation failed");this.errors=$,this.ajv=this.validation=!0}}k_.default=f_});var YZ=S((y_)=>{Object.defineProperty(y_,"__esModule",{value:!0});var pz=tX();class v_ extends Error{constructor($,Z,J,Y){super(Y||`can't resolve reference ${J} from id ${Z}`);this.missingRef=(0,pz.resolveUrl)($,Z,J),this.missingSchema=(0,pz.normalizeId)((0,pz.getFullPath)($,this.missingRef))}}y_.default=v_});var Y7=S((g_)=>{Object.defineProperty(g_,"__esModule",{value:!0});g_.resolveSchema=g_.getCompilingSchema=g_.resolveRef=g_.compileSchema=g_.SchemaEnv=void 0;var X6=k0(),w40=ZQ(),J7=g8(),Q6=tX(),x_=J1(),L40=lJ();class JQ{constructor($){var Z;this.refs={},this.dynamicAnchors={};let J;if(typeof $.schema=="object")J=$.schema;this.schema=$.schema,this.schemaId=$.schemaId,this.root=$.root||this,this.baseId=(Z=$.baseId)!==null&&Z!==void 0?Z:(0,Q6.normalizeId)(J===null||J===void 0?void 0:J[$.schemaId||"$id"]),this.schemaPath=$.schemaPath,this.localRefs=$.localRefs,this.meta=$.meta,this.$async=J===null||J===void 0?void 0:J.$async,this.refs={}}}g_.SchemaEnv=JQ;function iz($){let Z=h_.call(this,$);if(Z)return Z;let J=(0,Q6.getFullPath)(this.opts.uriResolver,$.root.baseId),{es5:Y,lines:X}=this.opts.code,{ownProperties:Q}=this.opts,G=new X6.CodeGen(this.scope,{es5:Y,lines:X,ownProperties:Q}),W;if($.$async)W=G.scopeValue("Error",{ref:w40.default,code:X6._`require("ajv/dist/runtime/validation_error").default`});let K=G.scopeName("validate");$.validateName=K;let V={gen:G,allErrors:this.opts.allErrors,data:J7.default.data,parentData:J7.default.parentData,parentDataProperty:J7.default.parentDataProperty,dataNames:[J7.default.data],dataPathArr:[X6.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:G.scopeValue("schema",this.opts.code.source===!0?{ref:$.schema,code:(0,X6.stringify)($.schema)}:{ref:$.schema}),validateName:K,ValidationError:W,schema:$.schema,schemaEnv:$,rootId:J,baseId:$.baseId||J,schemaPath:X6.nil,errSchemaPath:$.schemaPath||(this.opts.jtd?"":"#"),errorPath:X6._`""`,opts:this.opts,self:this},U;try{this._compilations.add($),(0,L40.validateFunctionCode)(V),G.optimize(this.opts.code.optimize);let H=G.toString();if(U=`${G.scopeRefs(J7.default.scope)}return ${H}`,this.opts.code.process)U=this.opts.code.process(U,$);let z=Function(`${J7.default.self}`,`${J7.default.scope}`,U)(this,this.scope.get());if(this.scope.value(K,{ref:z}),z.errors=null,z.schema=$.schema,z.schemaEnv=$,$.$async)z.$async=!0;if(this.opts.code.source===!0)z.source={validateName:K,validateCode:H,scopeValues:G._values};if(this.opts.unevaluated){let{props:F,items:A}=V;if(z.evaluated={props:F instanceof X6.Name?void 0:F,items:A instanceof X6.Name?void 0:A,dynamicProps:F instanceof X6.Name,dynamicItems:A instanceof X6.Name},z.source)z.source.evaluated=(0,X6.stringify)(z.evaluated)}return $.validate=z,$}catch(H){if(delete $.validate,delete $.validateName,U)this.logger.error("Error compiling schema, function code:",U);throw H}finally{this._compilations.delete($)}}g_.compileSchema=iz;function T40($,Z,J){var Y;J=(0,Q6.resolveUrl)(this.opts.uriResolver,Z,J);let X=$.refs[J];if(X)return X;let Q=I40.call(this,$,J);if(Q===void 0){let G=(Y=$.localRefs)===null||Y===void 0?void 0:Y[J],{schemaId:W}=this.opts;if(G)Q=new JQ({schema:G,schemaId:W,root:$,baseId:Z})}if(Q===void 0)return;return $.refs[J]=R40.call(this,Q)}g_.resolveRef=T40;function R40($){if((0,Q6.inlineRef)($.schema,this.opts.inlineRefs))return $.schema;return $.validate?$:iz.call(this,$)}function h_($){for(let Z of this._compilations)if(P40(Z,$))return Z}g_.getCompilingSchema=h_;function P40($,Z){return $.schema===Z.schema&&$.root===Z.root&&$.baseId===Z.baseId}function I40($,Z){let J;while(typeof(J=this.refs[Z])=="string")Z=J;return J||this.schemas[Z]||cG.call(this,$,Z)}function cG($,Z){let J=this.opts.uriResolver.parse(Z),Y=(0,Q6._getFullPath)(this.opts.uriResolver,J),X=(0,Q6.getFullPath)(this.opts.uriResolver,$.baseId,void 0);if(Object.keys($.schema).length>0&&Y===X)return cz.call(this,J,$);let Q=(0,Q6.normalizeId)(Y),G=this.refs[Q]||this.schemas[Q];if(typeof G=="string"){let W=cG.call(this,$,G);if(typeof(W===null||W===void 0?void 0:W.schema)!=="object")return;return cz.call(this,J,W)}if(typeof(G===null||G===void 0?void 0:G.schema)!=="object")return;if(!G.validate)iz.call(this,G);if(Q===(0,Q6.normalizeId)(Z)){let{schema:W}=G,{schemaId:K}=this.opts,V=W[K];if(V)X=(0,Q6.resolveUrl)(this.opts.uriResolver,X,V);return new JQ({schema:W,schemaId:K,root:$,baseId:X})}return cz.call(this,J,G)}g_.resolveSchema=cG;var C40=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function cz($,{baseId:Z,schema:J,root:Y}){var X;if(((X=$.fragment)===null||X===void 0?void 0:X[0])!=="/")return;for(let W of $.fragment.slice(1).split("/")){if(typeof J==="boolean")return;let K=J[(0,x_.unescapeFragment)(W)];if(K===void 0)return;J=K;let V=typeof J==="object"&&J[this.opts.schemaId];if(!C40.has(W)&&V)Z=(0,Q6.resolveUrl)(this.opts.uriResolver,Z,V)}let Q;if(typeof J!="boolean"&&J.$ref&&!(0,x_.schemaHasRulesButRef)(J,this.RULES)){let W=(0,Q6.resolveUrl)(this.opts.uriResolver,Z,J.$ref);Q=cG.call(this,Y,W)}let{schemaId:G}=this.opts;if(Q=Q||new JQ({schema:J,schemaId:G,root:Y,baseId:Z}),Q.schema!==Q.root.schema)return Q;return}});var m_=S((Vv0,f40)=>{f40.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var sz=S((Uv0,n_)=>{var k40=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),d_=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),nz=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),p_=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),v40=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function oz($){let Z="",J=0,Y=0;for(Y=0;Y<$.length;Y++){if(J=$[Y].charCodeAt(0),J===48)continue;if(!(J>=48&&J<=57||J>=65&&J<=70||J>=97&&J<=102))return"";Z+=$[Y];break}for(Y+=1;Y<$.length;Y++){if(J=$[Y].charCodeAt(0),!(J>=48&&J<=57||J>=65&&J<=70||J>=97&&J<=102))return"";Z+=$[Y]}return Z}var y40=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function l_($){return $.length=0,!0}function x40($,Z,J){if($.length){let Y=oz($);if(Y!=="")Z.push(Y);else return J.error=!0,!1;$.length=0}return!0}function h40($){let Z=0,J={error:!1,address:"",zone:""},Y=[],X=[],Q=!1,G=!1,W=x40;for(let K=0;K<$.length;K++){let V=$[K];if(V==="["||V==="]")continue;if(V===":"){if(Q===!0)G=!0;if(!W(X,Y,J))break;if(++Z>7){J.error=!0;break}if(K>0&&$[K-1]===":")Q=!0;Y.push(":");continue}else if(V==="%"){if(!W(X,Y,J))break;W=l_}else{X.push(V);continue}}if(X.length)if(W===l_)J.zone=X.join("");else if(G)Y.push(X.join(""));else Y.push(oz(X));return J.address=Y.join(""),J}function c_($){if(g40($,":")<2)return{host:$,isIPV6:!1};let Z=h40($);if(!Z.error){let{address:J,address:Y}=Z;if(Z.zone)J+="%"+Z.zone,Y+="%25"+Z.zone;return{host:J,isIPV6:!0,escapedHost:Y}}else return{host:$,isIPV6:!1}}function g40($,Z){let J=0;for(let Y=0;Y<$.length;Y++)if($[Y]===Z)J++;return J}function u40($){let Z=$,J=[],Y=-1,X=0;while(X=Z.length){if(X===1)if(Z===".")break;else if(Z==="/"){J.push("/");break}else{J.push(Z);break}else if(X===2){if(Z[0]==="."){if(Z[1]===".")break;else if(Z[1]==="/"){Z=Z.slice(2);continue}}else if(Z[0]==="/"){if(Z[1]==="."||Z[1]==="/"){J.push("/");break}}}else if(X===3){if(Z==="/.."){if(J.length!==0)J.pop();J.push("/");break}}if(Z[0]==="."){if(Z[1]==="."){if(Z[2]==="/"){Z=Z.slice(3);continue}}else if(Z[1]==="/"){Z=Z.slice(2);continue}}else if(Z[0]==="/"){if(Z[1]==="."){if(Z[2]==="/"){Z=Z.slice(2);continue}else if(Z[2]==="."){if(Z[3]==="/"){if(Z=Z.slice(3),J.length!==0)J.pop();continue}}}}if((Y=Z.indexOf("/",1))===-1){J.push(Z);break}else J.push(Z.slice(0,Y)),Z=Z.slice(Y)}return J.join("")}var m40={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},l40=/[@/?#:]/g,d40=/[@/?#]/g;function i_($,Z){let J=Z?d40:l40;return J.lastIndex=0,$.replace(J,(Y)=>m40[Y])}function p40($,Z=!1){if($.indexOf("%")===-1)return $;let J="";for(let Y=0;Y<$.length;Y++){if($[Y]==="%"&&Y+2<$.length){let X=$.slice(Y+1,Y+3);if(nz(X)){let Q=X.toUpperCase(),G=String.fromCharCode(parseInt(Q,16));if(Z&&p_(G))J+=G;else J+="%"+Q;Y+=2;continue}}J+=$[Y]}return J}function c40($){let Z="";for(let J=0;J<$.length;J++){if($[J]==="%"&&J+2<$.length){let Y=$.slice(J+1,J+3);if(nz(Y)){let X=Y.toUpperCase(),Q=String.fromCharCode(parseInt(X,16));if(Q!=="."&&p_(Q))Z+=Q;else Z+="%"+X;J+=2;continue}}if(v40($[J]))Z+=$[J];else Z+=escape($[J])}return Z}function i40($){let Z="";for(let J=0;J<$.length;J++){if($[J]==="%"&&J+2<$.length){let Y=$.slice(J+1,J+3);if(nz(Y)){Z+="%"+Y.toUpperCase(),J+=2;continue}}Z+=escape($[J])}return Z}function n40($){let Z=[];if($.userinfo!==void 0)Z.push($.userinfo),Z.push("@");if($.host!==void 0){let J=unescape($.host);if(!d_(J)){let Y=c_(J);if(Y.isIPV6===!0)J=`[${Y.escapedHost}]`;else J=i_(J,!1)}Z.push(J)}if(typeof $.port==="number"||typeof $.port==="string")Z.push(":"),Z.push(String($.port));return Z.length?Z.join(""):void 0}n_.exports={nonSimpleDomain:y40,recomposeAuthority:n40,reescapeHostDelimiters:i_,normalizePercentEncoding:p40,normalizePathEncoding:c40,escapePreservingEscapes:i40,removeDotSegments:u40,isIPv4:d_,isUUID:k40,normalizeIPv6:c_,stringArrayToHexStripped:oz}});var t_=S((Hv0,a_)=>{var{isUUID:o40}=sz(),s40=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,r40=["http","https","ws","wss","urn","urn:uuid"];function a40($){return r40.indexOf($)!==-1}function rz($){if($.secure===!0)return!0;else if($.secure===!1)return!1;else if($.scheme)return $.scheme.length===3&&($.scheme[0]==="w"||$.scheme[0]==="W")&&($.scheme[1]==="s"||$.scheme[1]==="S")&&($.scheme[2]==="s"||$.scheme[2]==="S");else return!1}function o_($){if(!$.host)$.error=$.error||"HTTP URIs must have a host.";return $}function s_($){let Z=String($.scheme).toLowerCase()==="https";if($.port===(Z?443:80)||$.port==="")$.port=void 0;if(!$.path)$.path="/";return $}function t40($){return $.secure=rz($),$.resourceName=($.path||"/")+($.query?"?"+$.query:""),$.path=void 0,$.query=void 0,$}function e40($){if($.port===(rz($)?443:80)||$.port==="")$.port=void 0;if(typeof $.secure==="boolean")$.scheme=$.secure?"wss":"ws",$.secure=void 0;if($.resourceName){let[Z,J]=$.resourceName.split("?");$.path=Z&&Z!=="/"?Z:void 0,$.query=J,$.resourceName=void 0}return $.fragment=void 0,$}function $G0($,Z){if(!$.path)return $.error="URN can not be parsed",$;let J=$.path.match(s40);if(J){let Y=Z.scheme||$.scheme||"urn";$.nid=J[1].toLowerCase(),$.nss=J[2];let X=`${Y}:${Z.nid||$.nid}`,Q=az(X);if($.path=void 0,Q)$=Q.parse($,Z)}else $.error=$.error||"URN can not be parsed.";return $}function ZG0($,Z){if($.nid===void 0)throw Error("URN without nid cannot be serialized");let J=Z.scheme||$.scheme||"urn",Y=$.nid.toLowerCase(),X=`${J}:${Z.nid||Y}`,Q=az(X);if(Q)$=Q.serialize($,Z);let G=$,W=$.nss;return G.path=`${Y||Z.nid}:${W}`,Z.skipEscape=!0,G}function JG0($,Z){let J=$;if(J.uuid=J.nss,J.nss=void 0,!Z.tolerant&&(!J.uuid||!o40(J.uuid)))J.error=J.error||"UUID is not valid.";return J}function YG0($){let Z=$;return Z.nss=($.uuid||"").toLowerCase(),Z}var r_={scheme:"http",domainHost:!0,parse:o_,serialize:s_},XG0={scheme:"https",domainHost:r_.domainHost,parse:o_,serialize:s_},iG={scheme:"ws",domainHost:!0,parse:t40,serialize:e40},QG0={scheme:"wss",domainHost:iG.domainHost,parse:iG.parse,serialize:iG.serialize},GG0={scheme:"urn",parse:$G0,serialize:ZG0,skipNormalize:!0},WG0={scheme:"urn:uuid",parse:JG0,serialize:YG0,skipNormalize:!0},nG={http:r_,https:XG0,ws:iG,wss:QG0,urn:GG0,"urn:uuid":WG0};Object.setPrototypeOf(nG,null);function az($){return $&&(nG[$]||nG[$.toLowerCase()])||void 0}a_.exports={wsIsSecure:rz,SCHEMES:nG,isValidSchemeName:a40,getSchemeHandler:az}});var sG=S((Bv0,oG)=>{var{normalizeIPv6:KG0,removeDotSegments:YQ,recomposeAuthority:VG0,normalizePercentEncoding:UG0,normalizePathEncoding:HG0,escapePreservingEscapes:BG0,reescapeHostDelimiters:zG0,isIPv4:FG0,nonSimpleDomain:AG0}=sz(),{SCHEMES:OG0,getSchemeHandler:$S}=t_();function qG0($,Z){if(typeof $==="string")$=wG0($,Z);else if(typeof $==="object")$=dJ(X7($,Z),Z);return $}function jG0($,Z,J){let Y=J?Object.assign({scheme:"null"},J):{scheme:"null"},X=ZS(dJ($,Y),dJ(Z,Y),Y,!0);return Y.skipEscape=!0,X7(X,Y)}function ZS($,Z,J,Y){let X={};if(!Y)$=dJ(X7($,J),J),Z=dJ(X7(Z,J),J);if(J=J||{},!J.tolerant&&Z.scheme)X.scheme=Z.scheme,X.userinfo=Z.userinfo,X.host=Z.host,X.port=Z.port,X.path=YQ(Z.path||""),X.query=Z.query;else{if(Z.userinfo!==void 0||Z.host!==void 0||Z.port!==void 0)X.userinfo=Z.userinfo,X.host=Z.host,X.port=Z.port,X.path=YQ(Z.path||""),X.query=Z.query;else{if(!Z.path)if(X.path=$.path,Z.query!==void 0)X.query=Z.query;else X.query=$.query;else{if(Z.path[0]==="/")X.path=YQ(Z.path);else{if(($.userinfo!==void 0||$.host!==void 0||$.port!==void 0)&&!$.path)X.path="/"+Z.path;else if(!$.path)X.path=Z.path;else X.path=$.path.slice(0,$.path.lastIndexOf("/")+1)+Z.path;X.path=YQ(X.path)}X.query=Z.query}X.userinfo=$.userinfo,X.host=$.host,X.port=$.port}X.scheme=$.scheme}return X.fragment=Z.fragment,X}function NG0($,Z,J){let Y=e_($,J),X=e_(Z,J);return Y!==void 0&&X!==void 0&&Y.toLowerCase()===X.toLowerCase()}function X7($,Z){let J={host:$.host,scheme:$.scheme,userinfo:$.userinfo,port:$.port,path:$.path,query:$.query,nid:$.nid,nss:$.nss,uuid:$.uuid,fragment:$.fragment,reference:$.reference,resourceName:$.resourceName,secure:$.secure,error:""},Y=Object.assign({},Z),X=[],Q=$S(Y.scheme||J.scheme);if(Q&&Q.serialize)Q.serialize(J,Y);if(J.path!==void 0)if(!Y.skipEscape){if(J.path=BG0(J.path),J.scheme!==void 0)J.path=J.path.split("%3A").join(":")}else J.path=UG0(J.path);if(Y.reference!=="suffix"&&J.scheme)X.push(J.scheme,":");let G=VG0(J);if(G!==void 0){if(Y.reference!=="suffix")X.push("//");if(X.push(G),J.path&&J.path[0]!=="/")X.push("/")}if(J.path!==void 0){let W=J.path;if(!Y.absolutePath&&(!Q||!Q.absolutePath))W=YQ(W);if(G===void 0&&W[0]==="/"&&W[1]==="/")W="/%2F"+W.slice(2);X.push(W)}if(J.query!==void 0)X.push("?",J.query);if(J.fragment!==void 0)X.push("#",J.fragment);return X.join("")}var MG0=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function DG0($,Z){if(Z[2]!==void 0&&$.path&&$.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof $.port==="number"&&($.port<0||$.port>65535))return"URI port is malformed.";return}function JS($,Z){let J=Object.assign({},Z),Y={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},X=!1,Q=!1;if(J.reference==="suffix")if(J.scheme)$=J.scheme+":"+$;else $="//"+$;let G=$.match(MG0);if(G){if(Y.scheme=G[1],Y.userinfo=G[3],Y.host=G[4],Y.port=parseInt(G[5],10),Y.path=G[6]||"",Y.query=G[7],Y.fragment=G[8],isNaN(Y.port))Y.port=G[5];let W=DG0(Y,G);if(W!==void 0)Y.error=Y.error||W,X=!0;if(Y.host)if(FG0(Y.host)===!1){let U=KG0(Y.host);Y.host=U.host.toLowerCase(),Q=U.isIPV6}else Q=!0;if(Y.scheme===void 0&&Y.userinfo===void 0&&Y.host===void 0&&Y.port===void 0&&Y.query===void 0&&!Y.path)Y.reference="same-document";else if(Y.scheme===void 0)Y.reference="relative";else if(Y.fragment===void 0)Y.reference="absolute";else Y.reference="uri";if(J.reference&&J.reference!=="suffix"&&J.reference!==Y.reference)Y.error=Y.error||"URI is not a "+J.reference+" reference.";let K=$S(J.scheme||Y.scheme);if(!J.unicodeSupport&&(!K||!K.unicodeSupport)){if(Y.host&&(J.domainHost||K&&K.domainHost)&&Q===!1&&AG0(Y.host))try{Y.host=URL.domainToASCII(Y.host.toLowerCase())}catch(V){Y.error=Y.error||"Host's domain name can not be converted to ASCII: "+V}}if(!K||K&&!K.skipNormalize){if($.indexOf("%")!==-1){if(Y.scheme!==void 0)Y.scheme=unescape(Y.scheme);if(Y.host!==void 0)Y.host=zG0(unescape(Y.host),Q)}if(Y.path)Y.path=HG0(Y.path);if(Y.fragment)try{Y.fragment=encodeURI(decodeURIComponent(Y.fragment))}catch{Y.error=Y.error||"URI malformed"}}if(K&&K.parse)K.parse(Y,J)}else Y.error=Y.error||"URI can not be parsed.";return{parsed:Y,malformedAuthorityOrPort:X}}function dJ($,Z){return JS($,Z).parsed}function wG0($,Z){return YS($,Z).normalized}function YS($,Z){let{parsed:J,malformedAuthorityOrPort:Y}=JS($,Z);return{normalized:Y?$:X7(J,Z),malformedAuthorityOrPort:Y}}function e_($,Z){if(typeof $==="string"){let{normalized:J,malformedAuthorityOrPort:Y}=YS($,Z);return Y?void 0:J}if(typeof $==="object")return X7($,Z)}var tz={SCHEMES:OG0,normalize:qG0,resolve:jG0,resolveComponent:ZS,equal:NG0,serialize:X7,parse:dJ};oG.exports=tz;oG.exports.default=tz;oG.exports.fastUri=tz});var GS=S((QS)=>{Object.defineProperty(QS,"__esModule",{value:!0});var XS=sG();XS.code='require("ajv/dist/runtime/uri").default';QS.default=XS});var Z3=S((XZ)=>{Object.defineProperty(XZ,"__esModule",{value:!0});XZ.CodeGen=XZ.Name=XZ.nil=XZ.stringify=XZ.str=XZ._=XZ.KeywordCxt=void 0;var TG0=lJ();Object.defineProperty(XZ,"KeywordCxt",{enumerable:!0,get:function(){return TG0.KeywordCxt}});var pJ=k0();Object.defineProperty(XZ,"_",{enumerable:!0,get:function(){return pJ._}});Object.defineProperty(XZ,"str",{enumerable:!0,get:function(){return pJ.str}});Object.defineProperty(XZ,"stringify",{enumerable:!0,get:function(){return pJ.stringify}});Object.defineProperty(XZ,"nil",{enumerable:!0,get:function(){return pJ.nil}});Object.defineProperty(XZ,"Name",{enumerable:!0,get:function(){return pJ.Name}});Object.defineProperty(XZ,"CodeGen",{enumerable:!0,get:function(){return pJ.CodeGen}});var RG0=ZQ(),HS=YZ(),PG0=_z(),XQ=Y7(),IG0=k0(),QQ=tX(),rG=rX(),$3=J1(),WS=m_(),CG0=GS(),BS=($,Z)=>new RegExp($,Z);BS.code="new RegExp";var EG0=["removeAdditional","useDefaults","coerceTypes"],bG0=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),_G0={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},SG0={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},KS=200;function fG0($){var Z,J,Y,X,Q,G,W,K,V,U,H,B,z,F,A,j,N,w,q,M,C,R,T,I,_;let E=$.strict,f=(Z=$.code)===null||Z===void 0?void 0:Z.optimize,b=f===!0||f===void 0?1:f||0,y=(Y=(J=$.code)===null||J===void 0?void 0:J.regExp)!==null&&Y!==void 0?Y:BS,k=(X=$.uriResolver)!==null&&X!==void 0?X:CG0.default;return{strictSchema:(G=(Q=$.strictSchema)!==null&&Q!==void 0?Q:E)!==null&&G!==void 0?G:!0,strictNumbers:(K=(W=$.strictNumbers)!==null&&W!==void 0?W:E)!==null&&K!==void 0?K:!0,strictTypes:(U=(V=$.strictTypes)!==null&&V!==void 0?V:E)!==null&&U!==void 0?U:"log",strictTuples:(B=(H=$.strictTuples)!==null&&H!==void 0?H:E)!==null&&B!==void 0?B:"log",strictRequired:(F=(z=$.strictRequired)!==null&&z!==void 0?z:E)!==null&&F!==void 0?F:!1,code:$.code?{...$.code,optimize:b,regExp:y}:{optimize:b,regExp:y},loopRequired:(A=$.loopRequired)!==null&&A!==void 0?A:KS,loopEnum:(j=$.loopEnum)!==null&&j!==void 0?j:KS,meta:(N=$.meta)!==null&&N!==void 0?N:!0,messages:(w=$.messages)!==null&&w!==void 0?w:!0,inlineRefs:(q=$.inlineRefs)!==null&&q!==void 0?q:!0,schemaId:(M=$.schemaId)!==null&&M!==void 0?M:"$id",addUsedSchema:(C=$.addUsedSchema)!==null&&C!==void 0?C:!0,validateSchema:(R=$.validateSchema)!==null&&R!==void 0?R:!0,validateFormats:(T=$.validateFormats)!==null&&T!==void 0?T:!0,unicodeRegExp:(I=$.unicodeRegExp)!==null&&I!==void 0?I:!0,int32range:(_=$.int32range)!==null&&_!==void 0?_:!0,uriResolver:k}}class aG{constructor($={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,$=this.opts={...$,...fG0($)};let{es5:Z,lines:J}=this.opts.code;this.scope=new IG0.ValueScope({scope:{},prefixes:bG0,es5:Z,lines:J}),this.logger=gG0($.logger);let Y=$.validateFormats;if($.validateFormats=!1,this.RULES=(0,PG0.getRules)(),VS.call(this,_G0,$,"NOT SUPPORTED"),VS.call(this,SG0,$,"DEPRECATED","warn"),this._metaOpts=xG0.call(this),$.formats)vG0.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),$.keywords)yG0.call(this,$.keywords);if(typeof $.meta=="object")this.addMetaSchema($.meta);kG0.call(this),$.validateFormats=Y}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:$,meta:Z,schemaId:J}=this.opts,Y=WS;if(J==="id")Y={...WS},Y.id=Y.$id,delete Y.$id;if(Z&&$)this.addMetaSchema(Y,Y[J],!1)}defaultMeta(){let{meta:$,schemaId:Z}=this.opts;return this.opts.defaultMeta=typeof $=="object"?$[Z]||$:void 0}validate($,Z){let J;if(typeof $=="string"){if(J=this.getSchema($),!J)throw Error(`no schema with key or ref "${$}"`)}else J=this.compile($);let Y=J(Z);if(!("$async"in J))this.errors=J.errors;return Y}compile($,Z){let J=this._addSchema($,Z);return J.validate||this._compileSchemaEnv(J)}compileAsync($,Z){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:J}=this.opts;return Y.call(this,$,Z);async function Y(V,U){await X.call(this,V.$schema);let H=this._addSchema(V,U);return H.validate||Q.call(this,H)}async function X(V){if(V&&!this.getSchema(V))await Y.call(this,{$ref:V},!0)}async function Q(V){try{return this._compileSchemaEnv(V)}catch(U){if(!(U instanceof HS.default))throw U;return G.call(this,U),await W.call(this,U.missingSchema),Q.call(this,V)}}function G({missingSchema:V,missingRef:U}){if(this.refs[V])throw Error(`AnySchema ${V} is loaded but ${U} cannot be resolved`)}async function W(V){let U=await K.call(this,V);if(!this.refs[V])await X.call(this,U.$schema);if(!this.refs[V])this.addSchema(U,V,Z)}async function K(V){let U=this._loading[V];if(U)return U;try{return await(this._loading[V]=J(V))}finally{delete this._loading[V]}}}addSchema($,Z,J,Y=this.opts.validateSchema){if(Array.isArray($)){for(let Q of $)this.addSchema(Q,void 0,J,Y);return this}let X;if(typeof $==="object"){let{schemaId:Q}=this.opts;if(X=$[Q],X!==void 0&&typeof X!="string")throw Error(`schema ${Q} must be string`)}return Z=(0,QQ.normalizeId)(Z||X),this._checkUnique(Z),this.schemas[Z]=this._addSchema($,J,Z,Y,!0),this}addMetaSchema($,Z,J=this.opts.validateSchema){return this.addSchema($,Z,!0,J),this}validateSchema($,Z){if(typeof $=="boolean")return!0;let J;if(J=$.$schema,J!==void 0&&typeof J!="string")throw Error("$schema must be a string");if(J=J||this.opts.defaultMeta||this.defaultMeta(),!J)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let Y=this.validate(J,$);if(!Y&&Z){let X="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(X);else throw Error(X)}return Y}getSchema($){let Z;while(typeof(Z=US.call(this,$))=="string")$=Z;if(Z===void 0){let{schemaId:J}=this.opts,Y=new XQ.SchemaEnv({schema:{},schemaId:J});if(Z=XQ.resolveSchema.call(this,Y,$),!Z)return;this.refs[$]=Z}return Z.validate||this._compileSchemaEnv(Z)}removeSchema($){if($ instanceof RegExp)return this._removeAllSchemas(this.schemas,$),this._removeAllSchemas(this.refs,$),this;switch(typeof $){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let Z=US.call(this,$);if(typeof Z=="object")this._cache.delete(Z.schema);return delete this.schemas[$],delete this.refs[$],this}case"object":{let Z=$;this._cache.delete(Z);let J=$[this.opts.schemaId];if(J)J=(0,QQ.normalizeId)(J),delete this.schemas[J],delete this.refs[J];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary($){for(let Z of $)this.addKeyword(Z);return this}addKeyword($,Z){let J;if(typeof $=="string"){if(J=$,typeof Z=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),Z.keyword=J}else if(typeof $=="object"&&Z===void 0){if(Z=$,J=Z.keyword,Array.isArray(J)&&!J.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(mG0.call(this,J,Z),!Z)return(0,$3.eachItem)(J,(X)=>ez.call(this,X)),this;dG0.call(this,Z);let Y={...Z,type:(0,rG.getJSONTypes)(Z.type),schemaType:(0,rG.getJSONTypes)(Z.schemaType)};return(0,$3.eachItem)(J,Y.type.length===0?(X)=>ez.call(this,X,Y):(X)=>Y.type.forEach((Q)=>ez.call(this,X,Y,Q))),this}getKeyword($){let Z=this.RULES.all[$];return typeof Z=="object"?Z.definition:!!Z}removeKeyword($){let{RULES:Z}=this;delete Z.keywords[$],delete Z.all[$];for(let J of Z.rules){let Y=J.rules.findIndex((X)=>X.keyword===$);if(Y>=0)J.rules.splice(Y,1)}return this}addFormat($,Z){if(typeof Z=="string")Z=new RegExp(Z);return this.formats[$]=Z,this}errorsText($=this.errors,{separator:Z=", ",dataVar:J="data"}={}){if(!$||$.length===0)return"No errors";return $.map((Y)=>`${J}${Y.instancePath} ${Y.message}`).reduce((Y,X)=>Y+Z+X)}$dataMetaSchema($,Z){let J=this.RULES.all;$=JSON.parse(JSON.stringify($));for(let Y of Z){let X=Y.split("/").slice(1),Q=$;for(let G of X)Q=Q[G];for(let G in J){let W=J[G];if(typeof W!="object")continue;let{$data:K}=W.definition,V=Q[G];if(K&&V)Q[G]=zS(V)}}return $}_removeAllSchemas($,Z){for(let J in $){let Y=$[J];if(!Z||Z.test(J)){if(typeof Y=="string")delete $[J];else if(Y&&!Y.meta)this._cache.delete(Y.schema),delete $[J]}}}_addSchema($,Z,J,Y=this.opts.validateSchema,X=this.opts.addUsedSchema){let Q,{schemaId:G}=this.opts;if(typeof $=="object")Q=$[G];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof $!="boolean")throw Error("schema must be object or boolean");let W=this._cache.get($);if(W!==void 0)return W;J=(0,QQ.normalizeId)(Q||J);let K=QQ.getSchemaRefs.call(this,$,J);if(W=new XQ.SchemaEnv({schema:$,schemaId:G,meta:Z,baseId:J,localRefs:K}),this._cache.set(W.schema,W),X&&!J.startsWith("#")){if(J)this._checkUnique(J);this.refs[J]=W}if(Y)this.validateSchema($,!0);return W}_checkUnique($){if(this.schemas[$]||this.refs[$])throw Error(`schema with key or id "${$}" already exists`)}_compileSchemaEnv($){if($.meta)this._compileMetaSchema($);else XQ.compileSchema.call(this,$);if(!$.validate)throw Error("ajv implementation error");return $.validate}_compileMetaSchema($){let Z=this.opts;this.opts=this._metaOpts;try{XQ.compileSchema.call(this,$)}finally{this.opts=Z}}}aG.ValidationError=RG0.default;aG.MissingRefError=HS.default;XZ.default=aG;function VS($,Z,J,Y="error"){for(let X in $){let Q=X;if(Q in Z)this.logger[Y](`${J}: option ${X}. ${$[Q]}`)}}function US($){return $=(0,QQ.normalizeId)($),this.schemas[$]||this.refs[$]}function kG0(){let $=this.opts.schemas;if(!$)return;if(Array.isArray($))this.addSchema($);else for(let Z in $)this.addSchema($[Z],Z)}function vG0(){for(let $ in this.opts.formats){let Z=this.opts.formats[$];if(Z)this.addFormat($,Z)}}function yG0($){if(Array.isArray($)){this.addVocabulary($);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let Z in $){let J=$[Z];if(!J.keyword)J.keyword=Z;this.addKeyword(J)}}function xG0(){let $={...this.opts};for(let Z of EG0)delete $[Z];return $}var hG0={log(){},warn(){},error(){}};function gG0($){if($===!1)return hG0;if($===void 0)return console;if($.log&&$.warn&&$.error)return $;throw Error("logger must implement log, warn and error methods")}var uG0=/^[a-z_$][a-z0-9_$:-]*$/i;function mG0($,Z){let{RULES:J}=this;if((0,$3.eachItem)($,(Y)=>{if(J.keywords[Y])throw Error(`Keyword ${Y} is already defined`);if(!uG0.test(Y))throw Error(`Keyword ${Y} has invalid name`)}),!Z)return;if(Z.$data&&!(("code"in Z)||("validate"in Z)))throw Error('$data keyword must have "code" or "validate" function')}function ez($,Z,J){var Y;let X=Z===null||Z===void 0?void 0:Z.post;if(J&&X)throw Error('keyword with "post" flag cannot have "type"');let{RULES:Q}=this,G=X?Q.post:Q.rules.find(({type:K})=>K===J);if(!G)G={type:J,rules:[]},Q.rules.push(G);if(Q.keywords[$]=!0,!Z)return;let W={keyword:$,definition:{...Z,type:(0,rG.getJSONTypes)(Z.type),schemaType:(0,rG.getJSONTypes)(Z.schemaType)}};if(Z.before)lG0.call(this,G,W,Z.before);else G.rules.push(W);Q.all[$]=W,(Y=Z.implements)===null||Y===void 0||Y.forEach((K)=>this.addKeyword(K))}function lG0($,Z,J){let Y=$.rules.findIndex((X)=>X.keyword===J);if(Y>=0)$.rules.splice(Y,0,Z);else $.rules.push(Z),this.logger.warn(`rule ${J} is not defined`)}function dG0($){let{metaSchema:Z}=$;if(Z===void 0)return;if($.$data&&this.opts.$data)Z=zS(Z);$.validateSchema=this.compile(Z,!0)}var pG0={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function zS($){return{anyOf:[$,pG0]}}});var AS=S((FS)=>{Object.defineProperty(FS,"__esModule",{value:!0});var nG0={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};FS.default=nG0});var J3=S((NS)=>{Object.defineProperty(NS,"__esModule",{value:!0});NS.callRef=NS.getValidate=void 0;var sG0=YZ(),OS=S$(),U8=k0(),cJ=g8(),qS=Y7(),tG=J1(),rG0={keyword:"$ref",schemaType:"string",code($){let{gen:Z,schema:J,it:Y}=$,{baseId:X,schemaEnv:Q,validateName:G,opts:W,self:K}=Y,{root:V}=Q;if((J==="#"||J==="#/")&&X===V.baseId)return H();let U=qS.resolveRef.call(K,V,X,J);if(U===void 0)throw new sG0.default(Y.opts.uriResolver,X,J);if(U instanceof qS.SchemaEnv)return B(U);return z(U);function H(){if(Q===V)return eG($,G,Q,Q.$async);let F=Z.scopeValue("root",{ref:V});return eG($,U8._`${F}.validate`,V,V.$async)}function B(F){let A=jS($,F);eG($,A,F,F.$async)}function z(F){let A=Z.scopeValue("schema",W.code.source===!0?{ref:F,code:(0,U8.stringify)(F)}:{ref:F}),j=Z.name("valid"),N=$.subschema({schema:F,dataTypes:[],schemaPath:U8.nil,topSchemaRef:A,errSchemaPath:J},j);$.mergeEvaluated(N),$.ok(j)}}};function jS($,Z){let{gen:J}=$;return Z.validate?J.scopeValue("validate",{ref:Z.validate}):U8._`${J.scopeValue("wrapper",{ref:Z})}.validate`}NS.getValidate=jS;function eG($,Z,J,Y){let{gen:X,it:Q}=$,{allErrors:G,schemaEnv:W,opts:K}=Q,V=K.passContext?cJ.default.this:U8.nil;if(Y)U();else H();function U(){if(!W.$async)throw Error("async schema referenced by sync schema");let F=X.let("valid");X.try(()=>{if(X.code(U8._`await ${(0,OS.callValidateCode)($,Z,V)}`),z(Z),!G)X.assign(F,!0)},(A)=>{if(X.if(U8._`!(${A} instanceof ${Q.ValidationError})`,()=>X.throw(A)),B(A),!G)X.assign(F,!1)}),$.ok(F)}function H(){$.result((0,OS.callValidateCode)($,Z,V),()=>z(Z),()=>B(Z))}function B(F){let A=U8._`${F}.errors`;X.assign(cJ.default.vErrors,U8._`${cJ.default.vErrors} === null ? ${A} : ${cJ.default.vErrors}.concat(${A})`),X.assign(cJ.default.errors,U8._`${cJ.default.vErrors}.length`)}function z(F){var A;if(!Q.opts.unevaluated)return;let j=(A=J===null||J===void 0?void 0:J.validate)===null||A===void 0?void 0:A.evaluated;if(Q.props!==!0)if(j&&!j.dynamicProps){if(j.props!==void 0)Q.props=tG.mergeEvaluated.props(X,j.props,Q.props)}else{let N=X.var("props",U8._`${F}.evaluated.props`);Q.props=tG.mergeEvaluated.props(X,N,Q.props,U8.Name)}if(Q.items!==!0)if(j&&!j.dynamicItems){if(j.items!==void 0)Q.items=tG.mergeEvaluated.items(X,j.items,Q.items)}else{let N=X.var("items",U8._`${F}.evaluated.items`);Q.items=tG.mergeEvaluated.items(X,N,Q.items,U8.Name)}}}NS.callRef=eG;NS.default=rG0});var wS=S((DS)=>{Object.defineProperty(DS,"__esModule",{value:!0});var eG0=AS(),$W0=J3(),ZW0=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",eG0.default,$W0.default];DS.default=ZW0});var TS=S((LS)=>{Object.defineProperty(LS,"__esModule",{value:!0});var $W=k0(),rZ=$W.operators,ZW={maximum:{okStr:"<=",ok:rZ.LTE,fail:rZ.GT},minimum:{okStr:">=",ok:rZ.GTE,fail:rZ.LT},exclusiveMaximum:{okStr:"<",ok:rZ.LT,fail:rZ.GTE},exclusiveMinimum:{okStr:">",ok:rZ.GT,fail:rZ.LTE}},YW0={message:({keyword:$,schemaCode:Z})=>$W.str`must be ${ZW[$].okStr} ${Z}`,params:({keyword:$,schemaCode:Z})=>$W._`{comparison: ${ZW[$].okStr}, limit: ${Z}}`},XW0={keyword:Object.keys(ZW),type:"number",schemaType:"number",$data:!0,error:YW0,code($){let{keyword:Z,data:J,schemaCode:Y}=$;$.fail$data($W._`${J} ${ZW[Z].fail} ${Y} || isNaN(${J})`)}};LS.default=XW0});var PS=S((RS)=>{Object.defineProperty(RS,"__esModule",{value:!0});var GQ=k0(),GW0={message:({schemaCode:$})=>GQ.str`must be multiple of ${$}`,params:({schemaCode:$})=>GQ._`{multipleOf: ${$}}`},WW0={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:GW0,code($){let{gen:Z,data:J,schemaCode:Y,it:X}=$,Q=X.opts.multipleOfPrecision,G=Z.let("res"),W=Q?GQ._`Math.abs(Math.round(${G}) - ${G}) > 1e-${Q}`:GQ._`${G} !== parseInt(${G})`;$.fail$data(GQ._`(${Y} === 0 || (${G} = ${J}/${Y}, ${W}))`)}};RS.default=WW0});var ES=S((CS)=>{Object.defineProperty(CS,"__esModule",{value:!0});function IS($){let Z=$.length,J=0,Y=0,X;while(Y<Z)if(J++,X=$.charCodeAt(Y++),X>=55296&&X<=56319&&Y<Z){if(X=$.charCodeAt(Y),(X&64512)===56320)Y++}return J}CS.default=IS;IS.code='require("ajv/dist/runtime/ucs2length").default'});var _S=S((bS)=>{Object.defineProperty(bS,"__esModule",{value:!0});var Q7=k0(),UW0=J1(),HW0=ES(),BW0={message({keyword:$,schemaCode:Z}){let J=$==="maxLength"?"more":"fewer";return Q7.str`must NOT have ${J} than ${Z} characters`},params:({schemaCode:$})=>Q7._`{limit: ${$}}`},zW0={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:BW0,code($){let{keyword:Z,data:J,schemaCode:Y,it:X}=$,Q=Z==="maxLength"?Q7.operators.GT:Q7.operators.LT,G=X.opts.unicode===!1?Q7._`${J}.length`:Q7._`${(0,UW0.useFunc)($.gen,HW0.default)}(${J})`;$.fail$data(Q7._`${G} ${Q} ${Y}`)}};bS.default=zW0});var fS=S((SS)=>{Object.defineProperty(SS,"__esModule",{value:!0});var AW0=S$(),OW0=J1(),iJ=k0(),qW0={message:({schemaCode:$})=>iJ.str`must match pattern "${$}"`,params:({schemaCode:$})=>iJ._`{pattern: ${$}}`},jW0={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:qW0,code($){let{gen:Z,data:J,$data:Y,schema:X,schemaCode:Q,it:G}=$,W=G.opts.unicodeRegExp?"u":"";if(Y){let{regExp:K}=G.opts.code,V=K.code==="new RegExp"?iJ._`new RegExp`:(0,OW0.useFunc)(Z,K),U=Z.let("valid");Z.try(()=>Z.assign(U,iJ._`${V}(${Q}, ${W}).test(${J})`),()=>Z.assign(U,!1)),$.fail$data(iJ._`!${U}`)}else{let K=(0,AW0.usePattern)($,X);$.fail$data(iJ._`!${K}.test(${J})`)}}};SS.default=jW0});var vS=S((kS)=>{Object.defineProperty(kS,"__esModule",{value:!0});var WQ=k0(),MW0={message({keyword:$,schemaCode:Z}){let J=$==="maxProperties"?"more":"fewer";return WQ.str`must NOT have ${J} than ${Z} properties`},params:({schemaCode:$})=>WQ._`{limit: ${$}}`},DW0={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:MW0,code($){let{keyword:Z,data:J,schemaCode:Y}=$,X=Z==="maxProperties"?WQ.operators.GT:WQ.operators.LT;$.fail$data(WQ._`Object.keys(${J}).length ${X} ${Y}`)}};kS.default=DW0});var xS=S((yS)=>{Object.defineProperty(yS,"__esModule",{value:!0});var KQ=S$(),VQ=k0(),LW0=J1(),TW0={message:({params:{missingProperty:$}})=>VQ.str`must have required property '${$}'`,params:({params:{missingProperty:$}})=>VQ._`{missingProperty: ${$}}`},RW0={keyword:"required",type:"object",schemaType:"array",$data:!0,error:TW0,code($){let{gen:Z,schema:J,schemaCode:Y,data:X,$data:Q,it:G}=$,{opts:W}=G;if(!Q&&J.length===0)return;let K=J.length>=W.loopRequired;if(G.allErrors)V();else U();if(W.strictRequired){let z=$.parentSchema.properties,{definedProperties:F}=$.it;for(let A of J)if((z===null||z===void 0?void 0:z[A])===void 0&&!F.has(A)){let j=G.schemaEnv.baseId+G.errSchemaPath,N=`required property "${A}" is not defined at "${j}" (strictRequired)`;(0,LW0.checkStrictMode)(G,N,G.opts.strictRequired)}}function V(){if(K||Q)$.block$data(VQ.nil,H);else for(let z of J)(0,KQ.checkReportMissingProp)($,z)}function U(){let z=Z.let("missing");if(K||Q){let F=Z.let("valid",!0);$.block$data(F,()=>B(z,F)),$.ok(F)}else Z.if((0,KQ.checkMissingProp)($,J,z)),(0,KQ.reportMissingProp)($,z),Z.else()}function H(){Z.forOf("prop",Y,(z)=>{$.setParams({missingProperty:z}),Z.if((0,KQ.noPropertyInData)(Z,X,z,W.ownProperties),()=>$.error())})}function B(z,F){$.setParams({missingProperty:z}),Z.forOf(z,Y,()=>{Z.assign(F,(0,KQ.propertyInData)(Z,X,z,W.ownProperties)),Z.if((0,VQ.not)(F),()=>{$.error(),Z.break()})},VQ.nil)}}};yS.default=RW0});var gS=S((hS)=>{Object.defineProperty(hS,"__esModule",{value:!0});var UQ=k0(),IW0={message({keyword:$,schemaCode:Z}){let J=$==="maxItems"?"more":"fewer";return UQ.str`must NOT have ${J} than ${Z} items`},params:({schemaCode:$})=>UQ._`{limit: ${$}}`},CW0={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:IW0,code($){let{keyword:Z,data:J,schemaCode:Y}=$,X=Z==="maxItems"?UQ.operators.GT:UQ.operators.LT;$.fail$data(UQ._`${J}.length ${X} ${Y}`)}};hS.default=CW0});var HQ=S((mS)=>{Object.defineProperty(mS,"__esModule",{value:!0});var uS=aX();uS.code='require("ajv/dist/runtime/equal").default';mS.default=uS});var dS=S((lS)=>{Object.defineProperty(lS,"__esModule",{value:!0});var Y3=rX(),f$=k0(),_W0=J1(),SW0=HQ(),fW0={message:({params:{i:$,j:Z}})=>f$.str`must NOT have duplicate items (items ## ${Z} and ${$} are identical)`,params:({params:{i:$,j:Z}})=>f$._`{i: ${$}, j: ${Z}}`},kW0={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:fW0,code($){let{gen:Z,data:J,$data:Y,schema:X,parentSchema:Q,schemaCode:G,it:W}=$;if(!Y&&!X)return;let K=Z.let("valid"),V=Q.items?(0,Y3.getSchemaTypes)(Q.items):[];$.block$data(K,U,f$._`${G} === false`),$.ok(K);function U(){let F=Z.let("i",f$._`${J}.length`),A=Z.let("j");$.setParams({i:F,j:A}),Z.assign(K,!0),Z.if(f$._`${F} > 1`,()=>(H()?B:z)(F,A))}function H(){return V.length>0&&!V.some((F)=>F==="object"||F==="array")}function B(F,A){let j=Z.name("item"),N=(0,Y3.checkDataTypes)(V,j,W.opts.strictNumbers,Y3.DataType.Wrong),w=Z.const("indices",f$._`{}`);Z.for(f$._`;${F}--;`,()=>{if(Z.let(j,f$._`${J}[${F}]`),Z.if(N,f$._`continue`),V.length>1)Z.if(f$._`typeof ${j} == "string"`,f$._`${j} += "_"`);Z.if(f$._`typeof ${w}[${j}] == "number"`,()=>{Z.assign(A,f$._`${w}[${j}]`),$.error(),Z.assign(K,!1).break()}).code(f$._`${w}[${j}] = ${F}`)})}function z(F,A){let j=(0,_W0.useFunc)(Z,SW0.default),N=Z.name("outer");Z.label(N).for(f$._`;${F}--;`,()=>Z.for(f$._`${A} = ${F}; ${A}--;`,()=>Z.if(f$._`${j}(${J}[${F}], ${J}[${A}])`,()=>{$.error(),Z.assign(K,!1).break(N)})))}}};lS.default=kW0});var cS=S((pS)=>{Object.defineProperty(pS,"__esModule",{value:!0});var X3=k0(),yW0=J1(),xW0=HQ(),hW0={message:"must be equal to constant",params:({schemaCode:$})=>X3._`{allowedValue: ${$}}`},gW0={keyword:"const",$data:!0,error:hW0,code($){let{gen:Z,data:J,$data:Y,schemaCode:X,schema:Q}=$;if(Y||Q&&typeof Q=="object")$.fail$data(X3._`!${(0,yW0.useFunc)(Z,xW0.default)}(${J}, ${X})`);else $.fail(X3._`${Q} !== ${J}`)}};pS.default=gW0});var nS=S((iS)=>{Object.defineProperty(iS,"__esModule",{value:!0});var BQ=k0(),mW0=J1(),lW0=HQ(),dW0={message:"must be equal to one of the allowed values",params:({schemaCode:$})=>BQ._`{allowedValues: ${$}}`},pW0={keyword:"enum",schemaType:"array",$data:!0,error:dW0,code($){let{gen:Z,data:J,$data:Y,schema:X,schemaCode:Q,it:G}=$;if(!Y&&X.length===0)throw Error("enum must have non-empty array");let W=X.length>=G.opts.loopEnum,K,V=()=>K!==null&&K!==void 0?K:K=(0,mW0.useFunc)(Z,lW0.default),U;if(W||Y)U=Z.let("valid"),$.block$data(U,H);else{if(!Array.isArray(X))throw Error("ajv implementation error");let z=Z.const("vSchema",Q);U=(0,BQ.or)(...X.map((F,A)=>B(z,A)))}$.pass(U);function H(){Z.assign(U,!1),Z.forOf("v",Q,(z)=>Z.if(BQ._`${V()}(${J}, ${z})`,()=>Z.assign(U,!0).break()))}function B(z,F){let A=X[F];return typeof A==="object"&&A!==null?BQ._`${V()}(${J}, ${z}[${F}])`:BQ._`${J} === ${A}`}}};iS.default=pW0});var sS=S((oS)=>{Object.defineProperty(oS,"__esModule",{value:!0});var iW0=TS(),nW0=PS(),oW0=_S(),sW0=fS(),rW0=vS(),aW0=xS(),tW0=gS(),eW0=dS(),$K0=cS(),ZK0=nS(),JK0=[iW0.default,nW0.default,oW0.default,sW0.default,rW0.default,aW0.default,tW0.default,eW0.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},$K0.default,ZK0.default];oS.default=JK0});var G3=S((aS)=>{Object.defineProperty(aS,"__esModule",{value:!0});aS.validateAdditionalItems=void 0;var G7=k0(),Q3=J1(),XK0={message:({params:{len:$}})=>G7.str`must NOT have more than ${$} items`,params:({params:{len:$}})=>G7._`{limit: ${$}}`},QK0={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:XK0,code($){let{parentSchema:Z,it:J}=$,{items:Y}=Z;if(!Array.isArray(Y)){(0,Q3.checkStrictMode)(J,'"additionalItems" is ignored when "items" is not an array of schemas');return}rS($,Y)}};function rS($,Z){let{gen:J,schema:Y,data:X,keyword:Q,it:G}=$;G.items=!0;let W=J.const("len",G7._`${X}.length`);if(Y===!1)$.setParams({len:Z.length}),$.pass(G7._`${W} <= ${Z.length}`);else if(typeof Y=="object"&&!(0,Q3.alwaysValidSchema)(G,Y)){let V=J.var("valid",G7._`${W} <= ${Z.length}`);J.if((0,G7.not)(V),()=>K(V)),$.ok(V)}function K(V){J.forRange("i",Z.length,W,(U)=>{if($.subschema({keyword:Q,dataProp:U,dataPropType:Q3.Type.Num},V),!G.allErrors)J.if((0,G7.not)(V),()=>J.break())})}}aS.validateAdditionalItems=rS;aS.default=QK0});var W3=S((Zf)=>{Object.defineProperty(Zf,"__esModule",{value:!0});Zf.validateTuple=void 0;var eS=k0(),JW=J1(),WK0=S$(),KK0={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code($){let{schema:Z,it:J}=$;if(Array.isArray(Z))return $f($,"additionalItems",Z);if(J.items=!0,(0,JW.alwaysValidSchema)(J,Z))return;$.ok((0,WK0.validateArray)($))}};function $f($,Z,J=$.schema){let{gen:Y,parentSchema:X,data:Q,keyword:G,it:W}=$;if(U(X),W.opts.unevaluated&&J.length&&W.items!==!0)W.items=JW.mergeEvaluated.items(Y,J.length,W.items);let K=Y.name("valid"),V=Y.const("len",eS._`${Q}.length`);J.forEach((H,B)=>{if((0,JW.alwaysValidSchema)(W,H))return;Y.if(eS._`${V} > ${B}`,()=>$.subschema({keyword:G,schemaProp:B,dataProp:B},K)),$.ok(K)});function U(H){let{opts:B,errSchemaPath:z}=W,F=J.length,A=F===H.minItems&&(F===H.maxItems||H[Z]===!1);if(B.strictTuples&&!A){let j=`"${G}" is ${F}-tuple, but minItems or maxItems/${Z} are not specified or different at path "${z}"`;(0,JW.checkStrictMode)(W,j,B.strictTuples)}}}Zf.validateTuple=$f;Zf.default=KK0});var Xf=S((Yf)=>{Object.defineProperty(Yf,"__esModule",{value:!0});var UK0=W3(),HK0={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:($)=>(0,UK0.validateTuple)($,"items")};Yf.default=HK0});var Wf=S((Gf)=>{Object.defineProperty(Gf,"__esModule",{value:!0});var Qf=k0(),zK0=J1(),FK0=S$(),AK0=G3(),OK0={message:({params:{len:$}})=>Qf.str`must NOT have more than ${$} items`,params:({params:{len:$}})=>Qf._`{limit: ${$}}`},qK0={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:OK0,code($){let{schema:Z,parentSchema:J,it:Y}=$,{prefixItems:X}=J;if(Y.items=!0,(0,zK0.alwaysValidSchema)(Y,Z))return;if(X)(0,AK0.validateAdditionalItems)($,X);else $.ok((0,FK0.validateArray)($))}};Gf.default=qK0});var Vf=S((Kf)=>{Object.defineProperty(Kf,"__esModule",{value:!0});var u8=k0(),YW=J1(),NK0={message:({params:{min:$,max:Z}})=>Z===void 0?u8.str`must contain at least ${$} valid item(s)`:u8.str`must contain at least ${$} and no more than ${Z} valid item(s)`,params:({params:{min:$,max:Z}})=>Z===void 0?u8._`{minContains: ${$}}`:u8._`{minContains: ${$}, maxContains: ${Z}}`},MK0={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:NK0,code($){let{gen:Z,schema:J,parentSchema:Y,data:X,it:Q}=$,G,W,{minContains:K,maxContains:V}=Y;if(Q.opts.next)G=K===void 0?1:K,W=V;else G=1;let U=Z.const("len",u8._`${X}.length`);if($.setParams({min:G,max:W}),W===void 0&&G===0){(0,YW.checkStrictMode)(Q,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(W!==void 0&&G>W){(0,YW.checkStrictMode)(Q,'"minContains" > "maxContains" is always invalid'),$.fail();return}if((0,YW.alwaysValidSchema)(Q,J)){let A=u8._`${U} >= ${G}`;if(W!==void 0)A=u8._`${A} && ${U} <= ${W}`;$.pass(A);return}Q.items=!0;let H=Z.name("valid");if(W===void 0&&G===1)z(H,()=>Z.if(H,()=>Z.break()));else if(G===0){if(Z.let(H,!0),W!==void 0)Z.if(u8._`${X}.length > 0`,B)}else Z.let(H,!1),B();$.result(H,()=>$.reset());function B(){let A=Z.name("_valid"),j=Z.let("count",0);z(A,()=>Z.if(A,()=>F(j)))}function z(A,j){Z.forRange("i",0,U,(N)=>{$.subschema({keyword:"contains",dataProp:N,dataPropType:YW.Type.Num,compositeRule:!0},A),j()})}function F(A){if(Z.code(u8._`${A}++`),W===void 0)Z.if(u8._`${A} >= ${G}`,()=>Z.assign(H,!0).break());else if(Z.if(u8._`${A} > ${W}`,()=>Z.assign(H,!1).break()),G===1)Z.assign(H,!0);else Z.if(u8._`${A} >= ${G}`,()=>Z.assign(H,!0))}}};Kf.default=MK0});var Af=S((Bf)=>{Object.defineProperty(Bf,"__esModule",{value:!0});Bf.validateSchemaDeps=Bf.validatePropertyDeps=Bf.error=void 0;var K3=k0(),wK0=J1(),zQ=S$();Bf.error={message:({params:{property:$,depsCount:Z,deps:J}})=>{let Y=Z===1?"property":"properties";return K3.str`must have ${Y} ${J} when property ${$} is present`},params:({params:{property:$,depsCount:Z,deps:J,missingProperty:Y}})=>K3._`{property: ${$},
|
|
116
|
+
missingProperty: ${Y},
|
|
117
|
+
depsCount: ${Z},
|
|
118
|
+
deps: ${J}}`};var LK0={keyword:"dependencies",type:"object",schemaType:"object",error:Bf.error,code($){let[Z,J]=TK0($);Uf($,Z),Hf($,J)}};function TK0({schema:$}){let Z={},J={};for(let Y in $){if(Y==="__proto__")continue;let X=Array.isArray($[Y])?Z:J;X[Y]=$[Y]}return[Z,J]}function Uf($,Z=$.schema){let{gen:J,data:Y,it:X}=$;if(Object.keys(Z).length===0)return;let Q=J.let("missing");for(let G in Z){let W=Z[G];if(W.length===0)continue;let K=(0,zQ.propertyInData)(J,Y,G,X.opts.ownProperties);if($.setParams({property:G,depsCount:W.length,deps:W.join(", ")}),X.allErrors)J.if(K,()=>{for(let V of W)(0,zQ.checkReportMissingProp)($,V)});else J.if(K3._`${K} && (${(0,zQ.checkMissingProp)($,W,Q)})`),(0,zQ.reportMissingProp)($,Q),J.else()}}Bf.validatePropertyDeps=Uf;function Hf($,Z=$.schema){let{gen:J,data:Y,keyword:X,it:Q}=$,G=J.name("valid");for(let W in Z){if((0,wK0.alwaysValidSchema)(Q,Z[W]))continue;J.if((0,zQ.propertyInData)(J,Y,W,Q.opts.ownProperties),()=>{let K=$.subschema({keyword:X,schemaProp:W},G);$.mergeValidEvaluated(K,G)},()=>J.var(G,!0)),$.ok(G)}}Bf.validateSchemaDeps=Hf;Bf.default=LK0});var jf=S((qf)=>{Object.defineProperty(qf,"__esModule",{value:!0});var Of=k0(),IK0=J1(),CK0={message:"property name must be valid",params:({params:$})=>Of._`{propertyName: ${$.propertyName}}`},EK0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:CK0,code($){let{gen:Z,schema:J,data:Y,it:X}=$;if((0,IK0.alwaysValidSchema)(X,J))return;let Q=Z.name("valid");Z.forIn("key",Y,(G)=>{$.setParams({propertyName:G}),$.subschema({keyword:"propertyNames",data:G,dataTypes:["string"],propertyName:G,compositeRule:!0},Q),Z.if((0,Of.not)(Q),()=>{if($.error(!0),!X.allErrors)Z.break()})}),$.ok(Q)}};qf.default=EK0});var V3=S((Nf)=>{Object.defineProperty(Nf,"__esModule",{value:!0});var XW=S$(),G6=k0(),_K0=g8(),QW=J1(),SK0={message:"must NOT have additional properties",params:({params:$})=>G6._`{additionalProperty: ${$.additionalProperty}}`},fK0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:SK0,code($){let{gen:Z,schema:J,parentSchema:Y,data:X,errsCount:Q,it:G}=$;if(!Q)throw Error("ajv implementation error");let{allErrors:W,opts:K}=G;if(G.props=!0,K.removeAdditional!=="all"&&(0,QW.alwaysValidSchema)(G,J))return;let V=(0,XW.allSchemaProperties)(Y.properties),U=(0,XW.allSchemaProperties)(Y.patternProperties);H(),$.ok(G6._`${Q} === ${_K0.default.errors}`);function H(){Z.forIn("key",X,(j)=>{if(!V.length&&!U.length)F(j);else Z.if(B(j),()=>F(j))})}function B(j){let N;if(V.length>8){let w=(0,QW.schemaRefOrVal)(G,Y.properties,"properties");N=(0,XW.isOwnProperty)(Z,w,j)}else if(V.length)N=(0,G6.or)(...V.map((w)=>G6._`${j} === ${w}`));else N=G6.nil;if(U.length)N=(0,G6.or)(N,...U.map((w)=>G6._`${(0,XW.usePattern)($,w)}.test(${j})`));return(0,G6.not)(N)}function z(j){Z.code(G6._`delete ${X}[${j}]`)}function F(j){if(K.removeAdditional==="all"||K.removeAdditional&&J===!1){z(j);return}if(J===!1){if($.setParams({additionalProperty:j}),$.error(),!W)Z.break();return}if(typeof J=="object"&&!(0,QW.alwaysValidSchema)(G,J)){let N=Z.name("valid");if(K.removeAdditional==="failing")A(j,N,!1),Z.if((0,G6.not)(N),()=>{$.reset(),z(j)});else if(A(j,N),!W)Z.if((0,G6.not)(N),()=>Z.break())}}function A(j,N,w){let q={keyword:"additionalProperties",dataProp:j,dataPropType:QW.Type.Str};if(w===!1)Object.assign(q,{compositeRule:!0,createErrors:!1,allErrors:!1});$.subschema(q,N)}}};Nf.default=fK0});var Lf=S((wf)=>{Object.defineProperty(wf,"__esModule",{value:!0});var vK0=lJ(),Mf=S$(),U3=J1(),Df=V3(),yK0={keyword:"properties",type:"object",schemaType:"object",code($){let{gen:Z,schema:J,parentSchema:Y,data:X,it:Q}=$;if(Q.opts.removeAdditional==="all"&&Y.additionalProperties===void 0)Df.default.code(new vK0.KeywordCxt(Q,Df.default,"additionalProperties"));let G=(0,Mf.allSchemaProperties)(J);for(let H of G)Q.definedProperties.add(H);if(Q.opts.unevaluated&&G.length&&Q.props!==!0)Q.props=U3.mergeEvaluated.props(Z,(0,U3.toHash)(G),Q.props);let W=G.filter((H)=>!(0,U3.alwaysValidSchema)(Q,J[H]));if(W.length===0)return;let K=Z.name("valid");for(let H of W){if(V(H))U(H);else{if(Z.if((0,Mf.propertyInData)(Z,X,H,Q.opts.ownProperties)),U(H),!Q.allErrors)Z.else().var(K,!0);Z.endIf()}$.it.definedProperties.add(H),$.ok(K)}function V(H){return Q.opts.useDefaults&&!Q.compositeRule&&J[H].default!==void 0}function U(H){$.subschema({keyword:"properties",schemaProp:H,dataProp:H},K)}}};wf.default=yK0});var Cf=S((If)=>{Object.defineProperty(If,"__esModule",{value:!0});var Tf=S$(),GW=k0(),Rf=J1(),Pf=J1(),hK0={keyword:"patternProperties",type:"object",schemaType:"object",code($){let{gen:Z,schema:J,data:Y,parentSchema:X,it:Q}=$,{opts:G}=Q,W=(0,Tf.allSchemaProperties)(J),K=W.filter((A)=>(0,Rf.alwaysValidSchema)(Q,J[A]));if(W.length===0||K.length===W.length&&(!Q.opts.unevaluated||Q.props===!0))return;let V=G.strictSchema&&!G.allowMatchingProperties&&X.properties,U=Z.name("valid");if(Q.props!==!0&&!(Q.props instanceof GW.Name))Q.props=(0,Pf.evaluatedPropsToName)(Z,Q.props);let{props:H}=Q;B();function B(){for(let A of W){if(V)z(A);if(Q.allErrors)F(A);else Z.var(U,!0),F(A),Z.if(U)}}function z(A){for(let j in V)if(new RegExp(A).test(j))(0,Rf.checkStrictMode)(Q,`property ${j} matches pattern ${A} (use allowMatchingProperties)`)}function F(A){Z.forIn("key",Y,(j)=>{Z.if(GW._`${(0,Tf.usePattern)($,A)}.test(${j})`,()=>{let N=K.includes(A);if(!N)$.subschema({keyword:"patternProperties",schemaProp:A,dataProp:j,dataPropType:Pf.Type.Str},U);if(Q.opts.unevaluated&&H!==!0)Z.assign(GW._`${H}[${j}]`,!0);else if(!N&&!Q.allErrors)Z.if((0,GW.not)(U),()=>Z.break())})})}}};If.default=hK0});var bf=S((Ef)=>{Object.defineProperty(Ef,"__esModule",{value:!0});var uK0=J1(),mK0={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code($){let{gen:Z,schema:J,it:Y}=$;if((0,uK0.alwaysValidSchema)(Y,J)){$.fail();return}let X=Z.name("valid");$.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},X),$.failResult(X,()=>$.reset(),()=>$.error())},error:{message:"must NOT be valid"}};Ef.default=mK0});var Sf=S((_f)=>{Object.defineProperty(_f,"__esModule",{value:!0});var dK0=S$(),pK0={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:dK0.validateUnion,error:{message:"must match a schema in anyOf"}};_f.default=pK0});var kf=S((ff)=>{Object.defineProperty(ff,"__esModule",{value:!0});var WW=k0(),iK0=J1(),nK0={message:"must match exactly one schema in oneOf",params:({params:$})=>WW._`{passingSchemas: ${$.passing}}`},oK0={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:nK0,code($){let{gen:Z,schema:J,parentSchema:Y,it:X}=$;if(!Array.isArray(J))throw Error("ajv implementation error");if(X.opts.discriminator&&Y.discriminator)return;let Q=J,G=Z.let("valid",!1),W=Z.let("passing",null),K=Z.name("_valid");$.setParams({passing:W}),Z.block(V),$.result(G,()=>$.reset(),()=>$.error(!0));function V(){Q.forEach((U,H)=>{let B;if((0,iK0.alwaysValidSchema)(X,U))Z.var(K,!0);else B=$.subschema({keyword:"oneOf",schemaProp:H,compositeRule:!0},K);if(H>0)Z.if(WW._`${K} && ${G}`).assign(G,!1).assign(W,WW._`[${W}, ${H}]`).else();Z.if(K,()=>{if(Z.assign(G,!0),Z.assign(W,H),B)$.mergeEvaluated(B,WW.Name)})})}}};ff.default=oK0});var yf=S((vf)=>{Object.defineProperty(vf,"__esModule",{value:!0});var rK0=J1(),aK0={keyword:"allOf",schemaType:"array",code($){let{gen:Z,schema:J,it:Y}=$;if(!Array.isArray(J))throw Error("ajv implementation error");let X=Z.name("valid");J.forEach((Q,G)=>{if((0,rK0.alwaysValidSchema)(Y,Q))return;let W=$.subschema({keyword:"allOf",schemaProp:G},X);$.ok(X),$.mergeEvaluated(W)})}};vf.default=aK0});var uf=S((gf)=>{Object.defineProperty(gf,"__esModule",{value:!0});var KW=k0(),hf=J1(),eK0={message:({params:$})=>KW.str`must match "${$.ifClause}" schema`,params:({params:$})=>KW._`{failingKeyword: ${$.ifClause}}`},$V0={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:eK0,code($){let{gen:Z,parentSchema:J,it:Y}=$;if(J.then===void 0&&J.else===void 0)(0,hf.checkStrictMode)(Y,'"if" without "then" and "else" is ignored');let X=xf(Y,"then"),Q=xf(Y,"else");if(!X&&!Q)return;let G=Z.let("valid",!0),W=Z.name("_valid");if(K(),$.reset(),X&&Q){let U=Z.let("ifClause");$.setParams({ifClause:U}),Z.if(W,V("then",U),V("else",U))}else if(X)Z.if(W,V("then"));else Z.if((0,KW.not)(W),V("else"));$.pass(G,()=>$.error(!0));function K(){let U=$.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},W);$.mergeEvaluated(U)}function V(U,H){return()=>{let B=$.subschema({keyword:U},W);if(Z.assign(G,W),$.mergeValidEvaluated(B,G),H)Z.assign(H,KW._`${U}`);else $.setParams({ifClause:U})}}}};function xf($,Z){let J=$.schema[Z];return J!==void 0&&!(0,hf.alwaysValidSchema)($,J)}gf.default=$V0});var lf=S((mf)=>{Object.defineProperty(mf,"__esModule",{value:!0});var JV0=J1(),YV0={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:$,parentSchema:Z,it:J}){if(Z.if===void 0)(0,JV0.checkStrictMode)(J,`"${$}" without "if" is ignored`)}};mf.default=YV0});var pf=S((df)=>{Object.defineProperty(df,"__esModule",{value:!0});var QV0=G3(),GV0=Xf(),WV0=W3(),KV0=Wf(),VV0=Vf(),UV0=Af(),HV0=jf(),BV0=V3(),zV0=Lf(),FV0=Cf(),AV0=bf(),OV0=Sf(),qV0=kf(),jV0=yf(),NV0=uf(),MV0=lf();function DV0($=!1){let Z=[AV0.default,OV0.default,qV0.default,jV0.default,NV0.default,MV0.default,HV0.default,BV0.default,UV0.default,zV0.default,FV0.default];if($)Z.push(GV0.default,KV0.default);else Z.push(QV0.default,WV0.default);return Z.push(VV0.default),Z}df.default=DV0});var nf=S((cf)=>{Object.defineProperty(cf,"__esModule",{value:!0});var W$=k0(),LV0={message:({schemaCode:$})=>W$.str`must match format "${$}"`,params:({schemaCode:$})=>W$._`{format: ${$}}`},TV0={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:LV0,code($,Z){let{gen:J,data:Y,$data:X,schema:Q,schemaCode:G,it:W}=$,{opts:K,errSchemaPath:V,schemaEnv:U,self:H}=W;if(!K.validateFormats)return;if(X)B();else z();function B(){let F=J.scopeValue("formats",{ref:H.formats,code:K.code.formats}),A=J.const("fDef",W$._`${F}[${G}]`),j=J.let("fType"),N=J.let("format");J.if(W$._`typeof ${A} == "object" && !(${A} instanceof RegExp)`,()=>J.assign(j,W$._`${A}.type || "string"`).assign(N,W$._`${A}.validate`),()=>J.assign(j,W$._`"string"`).assign(N,A)),$.fail$data((0,W$.or)(w(),q()));function w(){if(K.strictSchema===!1)return W$.nil;return W$._`${G} && !${N}`}function q(){let M=U.$async?W$._`(${A}.async ? await ${N}(${Y}) : ${N}(${Y}))`:W$._`${N}(${Y})`,C=W$._`(typeof ${N} == "function" ? ${M} : ${N}.test(${Y}))`;return W$._`${N} && ${N} !== true && ${j} === ${Z} && !${C}`}}function z(){let F=H.formats[Q];if(!F){w();return}if(F===!0)return;let[A,j,N]=q(F);if(A===Z)$.pass(M());function w(){if(K.strictSchema===!1){H.logger.warn(C());return}throw Error(C());function C(){return`unknown format "${Q}" ignored in schema at path "${V}"`}}function q(C){let R=C instanceof RegExp?(0,W$.regexpCode)(C):K.code.formats?W$._`${K.code.formats}${(0,W$.getProperty)(Q)}`:void 0,T=J.scopeValue("formats",{key:Q,ref:C,code:R});if(typeof C=="object"&&!(C instanceof RegExp))return[C.type||"string",C.validate,W$._`${T}.validate`];return["string",C,T]}function M(){if(typeof F=="object"&&!(F instanceof RegExp)&&F.async){if(!U.$async)throw Error("async format in sync schema");return W$._`await ${N}(${Y})`}return typeof j=="function"?W$._`${N}(${Y})`:W$._`${N}.test(${Y})`}}}};cf.default=TV0});var sf=S((of)=>{Object.defineProperty(of,"__esModule",{value:!0});var PV0=nf(),IV0=[PV0.default];of.default=IV0});var tf=S((rf)=>{Object.defineProperty(rf,"__esModule",{value:!0});rf.contentVocabulary=rf.metadataVocabulary=void 0;rf.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];rf.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Zk=S(($k)=>{Object.defineProperty($k,"__esModule",{value:!0});var bV0=wS(),_V0=sS(),SV0=pf(),fV0=sf(),ef=tf(),kV0=[bV0.default,_V0.default,(0,SV0.default)(),fV0.default,ef.metadataVocabulary,ef.contentVocabulary];$k.default=kV0});var H3=S((Yk)=>{Object.defineProperty(Yk,"__esModule",{value:!0});Yk.DiscrError=void 0;var Jk;(function($){$.Tag="tag",$.Mapping="mapping"})(Jk||(Yk.DiscrError=Jk={}))});var Wk=S((Gk)=>{Object.defineProperty(Gk,"__esModule",{value:!0});var nJ=k0(),B3=H3(),Qk=Y7(),yV0=YZ(),xV0=J1(),hV0={message:({params:{discrError:$,tagName:Z}})=>$===B3.DiscrError.Tag?`tag "${Z}" must be string`:`value of tag "${Z}" must be in oneOf`,params:({params:{discrError:$,tag:Z,tagName:J}})=>nJ._`{error: ${$}, tag: ${J}, tagValue: ${Z}}`},gV0={keyword:"discriminator",type:"object",schemaType:"object",error:hV0,code($){let{gen:Z,data:J,schema:Y,parentSchema:X,it:Q}=$,{oneOf:G}=X;if(!Q.opts.discriminator)throw Error("discriminator: requires discriminator option");let W=Y.propertyName;if(typeof W!="string")throw Error("discriminator: requires propertyName");if(Y.mapping)throw Error("discriminator: mapping is not supported");if(!G)throw Error("discriminator: requires oneOf keyword");let K=Z.let("valid",!1),V=Z.const("tag",nJ._`${J}${(0,nJ.getProperty)(W)}`);Z.if(nJ._`typeof ${V} == "string"`,()=>U(),()=>$.error(!1,{discrError:B3.DiscrError.Tag,tag:V,tagName:W})),$.ok(K);function U(){let z=B();Z.if(!1);for(let F in z)Z.elseIf(nJ._`${V} === ${F}`),Z.assign(K,H(z[F]));Z.else(),$.error(!1,{discrError:B3.DiscrError.Mapping,tag:V,tagName:W}),Z.endIf()}function H(z){let F=Z.name("valid"),A=$.subschema({keyword:"oneOf",schemaProp:z},F);return $.mergeEvaluated(A,nJ.Name),F}function B(){var z;let F={},A=N(X),j=!0;for(let M=0;M<G.length;M++){let C=G[M];if((C===null||C===void 0?void 0:C.$ref)&&!(0,xV0.schemaHasRulesButRef)(C,Q.self.RULES)){let T=C.$ref;if(C=Qk.resolveRef.call(Q.self,Q.schemaEnv.root,Q.baseId,T),C instanceof Qk.SchemaEnv)C=C.schema;if(C===void 0)throw new yV0.default(Q.opts.uriResolver,Q.baseId,T)}let R=(z=C===null||C===void 0?void 0:C.properties)===null||z===void 0?void 0:z[W];if(typeof R!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${W}"`);j=j&&(A||N(C)),w(R,M)}if(!j)throw Error(`discriminator: "${W}" must be required`);return F;function N({required:M}){return Array.isArray(M)&&M.includes(W)}function w(M,C){if(M.const)q(M.const,C);else if(M.enum)for(let R of M.enum)q(R,C);else throw Error(`discriminator: "properties/${W}" must have "const" or "enum"`)}function q(M,C){if(typeof M!="string"||M in F)throw Error(`discriminator: "${W}" values must be unique strings`);F[M]=C}}}};Gk.default=gV0});var Kk=S((Gy0,mV0)=>{mV0.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var UW=S((H8,z3)=>{Object.defineProperty(H8,"__esModule",{value:!0});H8.MissingRefError=H8.ValidationError=H8.CodeGen=H8.Name=H8.nil=H8.stringify=H8.str=H8._=H8.KeywordCxt=H8.Ajv=void 0;var lV0=Z3(),dV0=Zk(),pV0=Wk(),Vk=Kk(),cV0=["/properties"],VW="http://json-schema.org/draft-07/schema";class FQ extends lV0.default{_addVocabularies(){if(super._addVocabularies(),dV0.default.forEach(($)=>this.addVocabulary($)),this.opts.discriminator)this.addKeyword(pV0.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let $=this.opts.$data?this.$dataMetaSchema(Vk,cV0):Vk;this.addMetaSchema($,VW,!1),this.refs["http://json-schema.org/schema"]=VW}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(VW)?VW:void 0)}}H8.Ajv=FQ;z3.exports=H8=FQ;z3.exports.Ajv=FQ;Object.defineProperty(H8,"__esModule",{value:!0});H8.default=FQ;var iV0=lJ();Object.defineProperty(H8,"KeywordCxt",{enumerable:!0,get:function(){return iV0.KeywordCxt}});var oJ=k0();Object.defineProperty(H8,"_",{enumerable:!0,get:function(){return oJ._}});Object.defineProperty(H8,"str",{enumerable:!0,get:function(){return oJ.str}});Object.defineProperty(H8,"stringify",{enumerable:!0,get:function(){return oJ.stringify}});Object.defineProperty(H8,"nil",{enumerable:!0,get:function(){return oJ.nil}});Object.defineProperty(H8,"Name",{enumerable:!0,get:function(){return oJ.Name}});Object.defineProperty(H8,"CodeGen",{enumerable:!0,get:function(){return oJ.CodeGen}});var nV0=ZQ();Object.defineProperty(H8,"ValidationError",{enumerable:!0,get:function(){return nV0.default}});var oV0=YZ();Object.defineProperty(H8,"MissingRefError",{enumerable:!0,get:function(){return oV0.default}})});var QZ=S((Hk)=>{Object.defineProperty(Hk,"__esModule",{value:!0});Hk.checkMetadata=void 0;var aV0=J1(),tV0={keyword:"metadata",schemaType:"object",code($){Uk($);let{gen:Z,schema:J,it:Y}=$;if((0,aV0.alwaysValidSchema)(Y,J))return;let X=Z.name("valid");$.subschema({keyword:"metadata",jtdMetadata:!0},X),$.ok(X)}};function Uk({it:$,keyword:Z},J){if($.jtdMetadata!==J)throw Error(`JTD: "${Z}" cannot be used in this schema location`)}Hk.checkMetadata=Uk;Hk.default=tV0});var HW=S((Ok)=>{Object.defineProperty(Ok,"__esModule",{value:!0});Ok.hasRef=void 0;var zk=Y7(),AQ=k0(),$U0=YZ(),Fk=g8(),Ak=J3(),ZU0=QZ(),JU0={keyword:"ref",schemaType:"string",code($){(0,ZU0.checkMetadata)($);let{gen:Z,data:J,schema:Y,parentSchema:X,it:Q}=$,{schemaEnv:{root:G}}=Q,W=Z.name("valid");if(X.nullable)Z.var(W,AQ._`${J} === null`),Z.if((0,AQ.not)(W),K);else Z.var(W,!1),K();$.ok(W);function K(){var H;let B=(H=G.schema.definitions)===null||H===void 0?void 0:H[Y];if(!B)throw new $U0.default(Q.opts.uriResolver,"",Y,`No definition ${Y}`);if(F3(B)||!Q.opts.inlineRefs)V(B);else U(B)}function V(H){let B=zk.compileSchema.call(Q.self,new zk.SchemaEnv({schema:H,root:G,schemaPath:`/definitions/${Y}`})),z=(0,Ak.getValidate)($,B),F=Z.const("_errs",Fk.default.errors);(0,Ak.callRef)($,z,B,B.$async),Z.assign(W,AQ._`${F} === ${Fk.default.errors}`)}function U(H){let B=Z.scopeValue("schema",Q.opts.code.source===!0?{ref:H,code:(0,AQ.stringify)(H)}:{ref:H});$.subschema({schema:H,dataTypes:[],schemaPath:AQ.nil,topSchemaRef:B,errSchemaPath:`/definitions/${Y}`},W)}}};function F3($){for(let Z in $){let J;if(Z==="ref"||typeof(J=$[Z])=="object"&&F3(J))return!0}return!1}Ok.hasRef=F3;Ok.default=JU0});var A3=S((Mk)=>{Object.defineProperty(Mk,"__esModule",{value:!0});var XU0=/t|\s/i,QU0=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,GU0=/^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:z|([+-]\d\d)(?::?(\d\d))?)$/i,WU0=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Nk($,Z){let J=$.split(XU0);return J.length===2&&jk(J[0])&&KU0(J[1])||Z&&J.length===1&&jk(J[0])}Mk.default=Nk;function jk($){let Z=QU0.exec($);if(!Z)return!1;let J=+Z[1],Y=+Z[2],X=+Z[3];return Y>=1&&Y<=12&&X>=1&&(X<=WU0[Y]||Y===2&&X===29&&(J%100===0?J%400===0:J%4===0))}function KU0($){let Z=GU0.exec($);if(!Z)return!1;let J=+Z[1],Y=+Z[2],X=+Z[3],Q=+(Z[4]||0),G=+(Z[5]||0);return J<=23&&Y<=59&&X<=59||J-Q===23&&Y-G===59&&X===60}Nk.code='require("ajv/dist/runtime/timestamp").default'});var sJ=S((Lk)=>{Object.defineProperty(Lk,"__esModule",{value:!0});Lk.typeErrorParams=Lk.typeErrorMessage=Lk.typeError=void 0;var UU0=k0();function HU0($){return{message:(Z)=>Dk(Z,$),params:(Z)=>wk(Z,$)}}Lk.typeError=HU0;function Dk({parentSchema:$},Z){return($===null||$===void 0?void 0:$.nullable)?`must be ${Z} or null`:`must be ${Z}`}Lk.typeErrorMessage=Dk;function wk({parentSchema:$},Z){return UU0._`{type: ${Z}, nullable: ${!!($===null||$===void 0?void 0:$.nullable)}}`}Lk.typeErrorParams=wk});var q3=S((Pk)=>{Object.defineProperty(Pk,"__esModule",{value:!0});Pk.intRange=void 0;var E8=k0(),FU0=A3(),AU0=J1(),OU0=QZ(),Rk=sJ();Pk.intRange={int8:[-128,127,3],uint8:[0,255,3],int16:[-32768,32767,5],uint16:[0,65535,5],int32:[-2147483648,2147483647,10],uint32:[0,4294967295,10]};var qU0={message:($)=>(0,Rk.typeErrorMessage)($,$.schema),params:($)=>(0,Rk.typeErrorParams)($,$.schema)};function jU0($){let{gen:Z,data:J,it:Y}=$,{timestamp:X,allowDate:Q}=Y.opts;if(X==="date")return E8._`${J} instanceof Date `;let G=(0,AU0.useFunc)(Z,FU0.default),W=Q?E8._`, true`:E8.nil,K=E8._`typeof ${J} == "string" && ${G}(${J}${W})`;return X==="string"?K:(0,E8.or)(E8._`${J} instanceof Date`,K)}var NU0={keyword:"type",schemaType:"string",error:qU0,code($){(0,OU0.checkMetadata)($);let{data:Z,schema:J,parentSchema:Y,it:X}=$,Q;switch(J){case"boolean":case"string":Q=E8._`typeof ${Z} == ${J}`;break;case"timestamp":{Q=jU0($);break}case"float32":case"float64":Q=E8._`typeof ${Z} == "number"`;break;default:{let G=J;if(Q=E8._`typeof ${Z} == "number" && isFinite(${Z}) && !(${Z} % 1)`,!X.opts.int32range&&(G==="int32"||G==="uint32")){if(G==="uint32")Q=E8._`${Q} && ${Z} >= 0`}else{let[W,K]=Pk.intRange[G];Q=E8._`${Q} && ${Z} >= ${W} && ${Z} <= ${K}`}}}$.pass(Y.nullable?(0,E8.or)(E8._`${Z} === null`,Q):Q)}};Pk.default=NU0});var rJ=S((Ck)=>{Object.defineProperty(Ck,"__esModule",{value:!0});Ck.checkNullableObject=Ck.checkNullable=void 0;var BW=k0();function Ik({gen:$,data:Z,parentSchema:J},Y=BW.nil){let X=$.name("valid");if(J.nullable)$.let(X,BW._`${Z} === null`),Y=(0,BW.not)(X);else $.let(X,!1);return[X,Y]}Ck.checkNullable=Ik;function DU0($,Z){let[J,Y]=Ik($,Z);return[J,BW._`${Y} && typeof ${$.data} == "object" && !Array.isArray(${$.data})`]}Ck.checkNullableObject=DU0});var _k=S((bk)=>{Object.defineProperty(bk,"__esModule",{value:!0});var aZ=k0(),LU0=QZ(),TU0=rJ(),RU0={message:"must be equal to one of the allowed values",params:({schemaCode:$})=>aZ._`{allowedValues: ${$}}`},PU0={keyword:"enum",schemaType:"array",error:RU0,code($){(0,LU0.checkMetadata)($);let{gen:Z,data:J,schema:Y,schemaValue:X,parentSchema:Q,it:G}=$;if(Y.length===0)throw Error("enum must have non-empty array");if(Y.length!==new Set(Y).size)throw Error("enum items must be unique");let W,K=aZ._`typeof ${J} == "string"`;if(Y.length>=G.opts.loopEnum){let U;[W,U]=(0,TU0.checkNullable)($,K),Z.if(U,V)}else{if(!Array.isArray(Y))throw Error("ajv implementation error");if(W=(0,aZ.and)(K,(0,aZ.or)(...Y.map((U)=>aZ._`${J} === ${U}`))),Q.nullable)W=(0,aZ.or)(aZ._`${J} === null`,W)}$.pass(W);function V(){Z.forOf("v",X,(U)=>Z.if(aZ._`${W} = ${J} === ${U}`,()=>Z.break()))}}};bk.default=PU0});var kk=S((fk)=>{Object.defineProperty(fk,"__esModule",{value:!0});var CU0=J1(),EU0=S$(),Sk=k0(),bU0=QZ(),_U0=rJ(),SU0=sJ(),fU0={keyword:"elements",schemaType:"object",error:(0,SU0.typeError)("array"),code($){(0,bU0.checkMetadata)($);let{gen:Z,data:J,schema:Y,it:X}=$;if((0,CU0.alwaysValidSchema)(X,Y))return;let[Q]=(0,_U0.checkNullable)($);Z.if((0,Sk.not)(Q),()=>Z.if(Sk._`Array.isArray(${J})`,()=>Z.assign(Q,(0,EU0.validateArray)($)),()=>$.error())),$.ok(Q)}};fk.default=fU0});var N3=S((hk)=>{Object.defineProperty(hk,"__esModule",{value:!0});hk.validateProperties=hk.error=void 0;var j3=S$(),vk=J1(),GZ=k0(),vU0=QZ(),yU0=rJ(),yk=sJ(),aJ;(function($){$.Additional="additional",$.Missing="missing"})(aJ||(aJ={}));hk.error={message:($)=>{let{params:Z}=$;return Z.propError?Z.propError===aJ.Additional?"must NOT have additional properties":`must have property '${Z.missingProperty}'`:(0,yk.typeErrorMessage)($,"object")},params:($)=>{let{params:Z}=$;return Z.propError?Z.propError===aJ.Additional?GZ._`{error: ${Z.propError}, additionalProperty: ${Z.additionalProperty}}`:GZ._`{error: ${Z.propError}, missingProperty: ${Z.missingProperty}}`:(0,yk.typeErrorParams)($,"object")}};var xU0={keyword:"properties",schemaType:"object",error:hk.error,code:xk};function xk($){(0,vU0.checkMetadata)($);let{gen:Z,data:J,parentSchema:Y,it:X}=$,{additionalProperties:Q,nullable:G}=Y;if(X.jtdDiscriminator&&G)throw Error("JTD: nullable inside discriminator mapping");if(z())throw Error("JTD: properties and optionalProperties have common members");let[W,K]=F("properties"),[V,U]=F("optionalProperties");if(K.length===0&&U.length===0&&Q)return;let[H,B]=X.jtdDiscriminator===void 0?(0,yU0.checkNullableObject)($,J):[Z.let("valid",!1),!0];Z.if(B,()=>Z.assign(H,!0).block(()=>{if(A(K,"properties",!0),A(U,"optionalProperties"),!Q)N()})),$.pass(H);function z(){let{properties:q,optionalProperties:M}=Y;if(!(q&&M))return!1;for(let C in q)if(Object.prototype.hasOwnProperty.call(M,C))return!0;return!1}function F(q){let M=Y[q],C=M?(0,j3.allSchemaProperties)(M):[];if(X.jtdDiscriminator&&C.some((T)=>T===X.jtdDiscriminator))throw Error(`JTD: discriminator tag used in ${q}`);let R=C.filter((T)=>!(0,vk.alwaysValidSchema)(X,M[T]));return[C,R]}function A(q,M,C){let R=Z.var("valid");for(let I of q)Z.if((0,j3.propertyInData)(Z,J,I,X.opts.ownProperties),()=>j(I,M,R),()=>T(I)),$.ok(R);function T(I){if(C)Z.assign(R,!1),$.error(!1,{propError:aJ.Missing,missingProperty:I},{schemaPath:I});else Z.assign(R,!0)}}function j(q,M,C){$.subschema({keyword:M,schemaProp:q,dataProp:q},C)}function N(){Z.forIn("key",J,(q)=>{let M=w(q,W,"properties",X.jtdDiscriminator),C=w(q,V,"optionalProperties"),R=M===!0?C:C===!0?M:(0,GZ.and)(M,C);Z.if(R,()=>{if(X.opts.removeAdditional)Z.code(GZ._`delete ${J}[${q}]`);else if($.error(!1,{propError:aJ.Additional,additionalProperty:q},{instancePath:q,parentSchema:!0}),!X.opts.allErrors)Z.break()})})}function w(q,M,C,R){let T;if(M.length>8){let I=(0,vk.schemaRefOrVal)(X,Y[C],C);if(T=(0,GZ.not)((0,j3.isOwnProperty)(Z,I,q)),R!==void 0)T=(0,GZ.and)(T,GZ._`${q} !== ${R}`)}else if(M.length||R!==void 0){let I=R===void 0?M:[R].concat(M);T=(0,GZ.and)(...I.map((_)=>GZ._`${q} !== ${_}`))}else T=!0;return T}}hk.validateProperties=xk;hk.default=xU0});var dk=S((lk)=>{Object.defineProperty(lk,"__esModule",{value:!0});var mk=N3(),gU0={keyword:"optionalProperties",schemaType:"object",error:mk.error,code($){if($.parentSchema.properties)return;(0,mk.validateProperties)($)}};lk.default=gU0});var ik=S((ck)=>{Object.defineProperty(ck,"__esModule",{value:!0});var W7=k0(),mU0=QZ(),lU0=rJ(),pk=sJ(),zW=H3(),dU0={message:($)=>{let{schema:Z,params:J}=$;return J.discrError?J.discrError===zW.DiscrError.Tag?`tag "${Z}" must be string`:`value of tag "${Z}" must be in mapping`:(0,pk.typeErrorMessage)($,"object")},params:($)=>{let{schema:Z,params:J}=$;return J.discrError?W7._`{error: ${J.discrError}, tag: ${Z}, tagValue: ${J.tag}}`:(0,pk.typeErrorParams)($,"object")}},pU0={keyword:"discriminator",schemaType:"string",implements:["mapping"],error:dU0,code($){(0,mU0.checkMetadata)($);let{gen:Z,data:J,schema:Y,parentSchema:X}=$,[Q,G]=(0,lU0.checkNullableObject)($,J);Z.if(G),W(),Z.elseIf((0,W7.not)(Q)),$.error(),Z.endIf(),$.ok(Q);function W(){let U=Z.const("tag",W7._`${J}${(0,W7.getProperty)(Y)}`);Z.if(W7._`${U} === undefined`),$.error(!1,{discrError:zW.DiscrError.Tag,tag:U}),Z.elseIf(W7._`typeof ${U} == "string"`),K(U),Z.else(),$.error(!1,{discrError:zW.DiscrError.Tag,tag:U},{instancePath:Y}),Z.endIf()}function K(U){Z.if(!1);for(let H in X.mapping)Z.elseIf(W7._`${U} === ${H}`),Z.assign(Q,V(H));Z.else(),$.error(!1,{discrError:zW.DiscrError.Mapping,tag:U},{instancePath:Y,schemaPath:"mapping",parentSchema:!0}),Z.endIf()}function V(U){let H=Z.name("valid");return $.subschema({keyword:"mapping",schemaProp:U,jtdDiscriminator:Y},H),H}}};ck.default=pU0});var sk=S((ok)=>{Object.defineProperty(ok,"__esModule",{value:!0});var nk=J1(),FW=k0(),iU0=QZ(),nU0=rJ(),oU0=sJ(),sU0={keyword:"values",schemaType:"object",error:(0,oU0.typeError)("object"),code($){(0,iU0.checkMetadata)($);let{gen:Z,data:J,schema:Y,it:X}=$,[Q,G]=(0,nU0.checkNullableObject)($,J);if((0,nk.alwaysValidSchema)(X,Y))Z.if((0,FW.not)((0,FW.or)(G,Q)),()=>$.error());else Z.if(G),Z.assign(Q,W()),Z.elseIf((0,FW.not)(Q)),$.error(),Z.endIf();$.ok(Q);function W(){let K=Z.name("valid");if(X.allErrors){let U=Z.let("valid",!0);return V(()=>Z.assign(U,!1)),U}return Z.var(K,!0),V(()=>Z.break()),K;function V(U){Z.forIn("key",J,(H)=>{$.subschema({keyword:"values",dataProp:H,dataPropType:nk.Type.Str},K),Z.if((0,FW.not)(K),U)})}}}};ok.default=sU0});var ak=S((rk)=>{Object.defineProperty(rk,"__esModule",{value:!0});var aU0=S$(),tU0={keyword:"union",schemaType:"array",trackErrors:!0,code:aU0.validateUnion,error:{message:"must match a schema in union"}};rk.default=tU0});var ek=S((tk)=>{Object.defineProperty(tk,"__esModule",{value:!0});var $H0=HW(),ZH0=q3(),JH0=_k(),YH0=kk(),XH0=N3(),QH0=dk(),GH0=ik(),WH0=sk(),KH0=ak(),VH0=QZ(),UH0=["definitions",$H0.default,ZH0.default,JH0.default,YH0.default,XH0.default,QH0.default,GH0.default,WH0.default,KH0.default,VH0.default,{keyword:"additionalProperties",schemaType:"boolean"},{keyword:"nullable",schemaType:"boolean"}];tk.default=UH0});var Xv=S((Yv)=>{Object.defineProperty(Yv,"__esModule",{value:!0});var WZ=($)=>{let Z={nullable:{type:"boolean"},metadata:{optionalProperties:{union:{elements:{ref:"schema"}}},additionalProperties:!0}};if($)Z.definitions={values:{ref:"schema"}};return Z},BH0=($)=>({optionalProperties:WZ($)}),zH0=($)=>({properties:{ref:{type:"string"}},optionalProperties:WZ($)}),FH0=($)=>({properties:{type:{enum:["boolean","timestamp","string","float32","float64","int8","uint8","int16","uint16","int32","uint32"]}},optionalProperties:WZ($)}),AH0=($)=>({properties:{enum:{elements:{type:"string"}}},optionalProperties:WZ($)}),OH0=($)=>({properties:{elements:{ref:"schema"}},optionalProperties:WZ($)}),Zv=($)=>({properties:{properties:{values:{ref:"schema"}}},optionalProperties:{optionalProperties:{values:{ref:"schema"}},additionalProperties:{type:"boolean"},...WZ($)}}),Jv=($)=>({properties:{optionalProperties:{values:{ref:"schema"}}},optionalProperties:{additionalProperties:{type:"boolean"},...WZ($)}}),qH0=($)=>({properties:{discriminator:{type:"string"},mapping:{values:{metadata:{union:[Zv(!1),Jv(!1)]}}}},optionalProperties:WZ($)}),jH0=($)=>({properties:{values:{ref:"schema"}},optionalProperties:WZ($)}),$v=($)=>({metadata:{union:[BH0,zH0,FH0,AH0,OH0,Zv,Jv,qH0,jH0].map((Z)=>Z($))}}),NH0={definitions:{schema:$v(!1)},...$v(!0)};Yv.default=NH0});var M3=S((Qv)=>{Object.defineProperty(Qv,"__esModule",{value:!0});Qv.jtdForms=void 0;Qv.jtdForms=["elements","values","discriminator","properties","optionalProperties","enum","type","ref"]});var Vv=S((Kv)=>{Object.defineProperty(Kv,"__esModule",{value:!0});var D3=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,DH0={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':"\\\"","\\":"\\\\"};function Wv($){return D3.lastIndex=0,'"'+(D3.test($)?$.replace(D3,(Z)=>{let J=DH0[Z];return typeof J==="string"?J:"\\u"+("0000"+Z.charCodeAt(0).toString(16)).slice(-4)}):$)+'"'}Kv.default=Wv;Wv.code='require("ajv/dist/runtime/quote").default'});var Ov=S((Av)=>{Object.defineProperty(Av,"__esModule",{value:!0});var LH0=M3(),Hv=Y7(),G1=k0(),TH0=YZ(),y1=g8(),RH0=S$(),PH0=HW(),IH0=J1(),CH0=Vv(),EH0={elements:_H0,values:SH0,discriminator:fH0,properties:Uv,optionalProperties:Uv,enum:OQ,type:kH0,ref:yH0};function Bv($,Z){let J=Hv.getCompilingSchema.call(this,$);if(J)return J;let{es5:Y,lines:X}=this.opts.code,{ownProperties:Q}=this.opts,G=new G1.CodeGen(this.scope,{es5:Y,lines:X,ownProperties:Q}),W=G.scopeName("serialize"),K={self:this,gen:G,schema:$.schema,schemaEnv:$,definitions:Z,data:y1.default.data},V;try{this._compilations.add($),$.serializeName=W,G.func(W,y1.default.data,!1,()=>{G.let(y1.default.json,G1.str``),qQ(K),G.return(y1.default.json)}),G.optimize(this.opts.code.optimize);let U=G.toString();V=`${G.scopeRefs(y1.default.scope)}return ${U}`;let B=Function(`${y1.default.scope}`,V)(this.scope.get());this.scope.value(W,{ref:B}),$.serialize=B}catch(U){if(V)this.logger.error("Error compiling serializer, function code:",V);throw delete $.serialize,delete $.serializeName,U}finally{this._compilations.delete($)}return $}Av.default=Bv;function qQ($){let Z;for(let J of LH0.jtdForms)if(J in $.schema){Z=J;break}bH0($,Z?EH0[Z]:hH0)}function bH0($,Z){let{gen:J,schema:Y,data:X}=$;if(!Y.nullable)return Z($);J.if(G1._`${X} === undefined || ${X} === null`,()=>J.add(y1.default.json,G1._`"null"`),()=>Z($))}function _H0($){let{gen:Z,schema:J,data:Y}=$;Z.add(y1.default.json,G1.str`[`);let X=Z.let("first",!0);Z.forOf("el",Y,(Q)=>{w3($,X),qQ({...$,schema:J.elements,data:Q})}),Z.add(y1.default.json,G1.str`]`)}function SH0($){let{gen:Z,schema:J,data:Y}=$;Z.add(y1.default.json,G1.str`{`);let X=Z.let("first",!0);Z.forIn("key",Y,(Q)=>zv($,Q,J.values,X)),Z.add(y1.default.json,G1.str`}`)}function zv($,Z,J,Y){let{gen:X,data:Q}=$;w3($,Y),OQ({...$,data:Z}),X.add(y1.default.json,G1.str`:`);let G=X.const("value",G1._`${Q}${(0,G1.getProperty)(Z)}`);qQ({...$,schema:J,data:G})}function fH0($){let{gen:Z,schema:J,data:Y}=$,{discriminator:X}=J;Z.add(y1.default.json,G1.str`{${JSON.stringify(X)}:`);let Q=Z.const("tag",G1._`${Y}${(0,G1.getProperty)(X)}`);OQ({...$,data:Q}),Z.if(!1);for(let G in J.mapping){Z.elseIf(G1._`${Q} === ${G}`);let W=J.mapping[G];Fv({...$,schema:W},X)}Z.endIf(),Z.add(y1.default.json,G1.str`}`)}function Uv($){let{gen:Z}=$;Z.add(y1.default.json,G1.str`{`),Fv($),Z.add(y1.default.json,G1.str`}`)}function Fv($,Z){let{gen:J,schema:Y,data:X}=$,{properties:Q,optionalProperties:G}=Y,W=B(Q),K=B(G),V=z(W.concat(K)),U=!Z,H;for(let N of W){if(U)U=!1;else J.add(y1.default.json,G1.str`,`);A(N,Q[N],F(N))}if(U)H=J.let("first",!0);for(let N of K){let w=F(N);J.if((0,G1.and)(G1._`${w} !== undefined`,(0,RH0.isOwnProperty)(J,X,N)),()=>{w3($,H),A(N,G[N],w)})}if(Y.additionalProperties)J.forIn("key",X,(N)=>J.if(j(N,V),()=>zv($,N,{},H)));function B(N){return N?Object.keys(N):[]}function z(N){if(Z)N.push(Z);if(new Set(N).size!==N.length)throw Error("JTD: properties/optionalProperties/disciminator overlap");return N}function F(N){return J.const("value",G1._`${X}${(0,G1.getProperty)(N)}`)}function A(N,w,q){J.add(y1.default.json,G1.str`${JSON.stringify(N)}:`),qQ({...$,schema:w,data:q})}function j(N,w){return w.length?(0,G1.and)(...w.map((q)=>G1._`${N} !== ${q}`)):!0}}function kH0($){let{gen:Z,schema:J,data:Y}=$;switch(J.type){case"boolean":Z.add(y1.default.json,G1._`${Y} ? "true" : "false"`);break;case"string":OQ($);break;case"timestamp":Z.if(G1._`${Y} instanceof Date`,()=>Z.add(y1.default.json,G1._`'"' + ${Y}.toISOString() + '"'`),()=>OQ($));break;default:vH0($)}}function OQ({gen:$,data:Z}){$.add(y1.default.json,G1._`${(0,IH0.useFunc)($,CH0.default)}(${Z})`)}function vH0({gen:$,data:Z,self:J}){let Y=G1._`${Z} === Infinity || ${Z} === -Infinity || ${Z} !== ${Z}`;if(J.opts.specialNumbers===void 0||J.opts.specialNumbers==="fast")$.add(y1.default.json,G1._`"" + ${Z}`);else $.if(Y,()=>$.add(y1.default.json,G1._`null`),()=>$.add(y1.default.json,G1._`"" + ${Z}`))}function yH0($){let{gen:Z,self:J,data:Y,definitions:X,schema:Q,schemaEnv:G}=$,{ref:W}=Q,K=X[W];if(!K)throw new TH0.default(J.opts.uriResolver,"",W,`No definition ${W}`);if(!(0,PH0.hasRef)(K))return qQ({...$,schema:K});let{root:V}=G,U=Bv.call(J,new Hv.SchemaEnv({schema:K,root:V}),X);Z.add(y1.default.json,G1._`${xH0(Z,U)}(${Y})`)}function xH0($,Z){return Z.serialize?$.scopeValue("serialize",{ref:Z.serialize}):G1._`${$.scopeValue("wrapper",{ref:Z})}.serialize`}function hH0({gen:$,data:Z}){$.add(y1.default.json,G1._`JSON.stringify(${Z})`)}function w3({gen:$},Z){if(Z)$.if(Z,()=>$.assign(Z,!1),()=>$.add(y1.default.json,G1.str`,`));else $.add(y1.default.json,G1.str`,`)}});var Mv=S((jv)=>{Object.defineProperty(jv,"__esModule",{value:!0});jv.parseJsonString=jv.parseJsonNumber=jv.parseJson=void 0;var uH0=/position\s(\d+)(?: \(line \d+ column \d+\))?$/;function KZ($,Z){let J;KZ.message=void 0;let Y;if(Z)$=$.slice(Z);try{return KZ.position=Z+$.length,JSON.parse($)}catch(X){if(Y=uH0.exec(X.message),!Y){KZ.message="unexpected end";return}J=+Y[1];let Q=$[J];$=$.slice(0,J),KZ.position=Z+J;try{return JSON.parse($)}catch(G){KZ.message=`unexpected token ${Q}`;return}}}jv.parseJson=KZ;KZ.message=void 0;KZ.position=0;KZ.code='require("ajv/dist/runtime/parseJson").parseJson';function VZ($,Z,J){let Y="",X;if(VZ.message=void 0,$[Z]==="-")Y+="-",Z++;if($[Z]==="0")Y+="0",Z++;else if(!Q(J)){G();return}if(J)return VZ.position=Z,+Y;if($[Z]==="."){if(Y+=".",Z++,!Q()){G();return}}if(X=$[Z],X==="e"||X==="E"){if(Y+="e",Z++,X=$[Z],X==="+"||X==="-")Y+=X,Z++;if(!Q()){G();return}}return VZ.position=Z,+Y;function Q(W){let K=!1;while(X=$[Z],X>="0"&&X<="9"&&(W===void 0||W-- >0))K=!0,Y+=X,Z++;return K}function G(){VZ.position=Z,VZ.message=Z<$.length?`unexpected token ${$[Z]}`:"unexpected end"}}jv.parseJsonNumber=VZ;VZ.message=void 0;VZ.position=0;VZ.code='require("ajv/dist/runtime/parseJson").parseJsonNumber';var qv={b:"\b",f:"\f",n:`
|
|
119
|
+
`,r:"\r",t:"\t",'"':'"',"/":"/","\\":"\\"},mH0=97,lH0=48;function tZ($,Z){let J="",Y;tZ.message=void 0;while(!0){if(Y=$[Z++],Y==='"')break;if(Y==="\\")if(Y=$[Z],Y in qv)J+=qv[Y],Z++;else if(Y==="u"){Z++;let Q=4,G=0;while(Q--){if(G<<=4,Y=$[Z],Y===void 0){X("unexpected end");return}if(Y=Y.toLowerCase(),Y>="a"&&Y<="f")G+=Y.charCodeAt(0)-mH0+10;else if(Y>="0"&&Y<="9")G+=Y.charCodeAt(0)-lH0;else{X(`unexpected token ${Y}`);return}Z++}J+=String.fromCharCode(G)}else{X(`unexpected token ${Y}`);return}else if(Y===void 0){X("unexpected end");return}else if(Y.charCodeAt(0)>=32)J+=Y;else{X(`unexpected token ${Y}`);return}}return tZ.position=Z,J;function X(Q){tZ.position=Z,tZ.message=Q}}jv.parseJsonString=tZ;tZ.message=void 0;tZ.position=0;tZ.code='require("ajv/dist/runtime/parseJson").parseJsonString'});var Sv=S((_v)=>{Object.defineProperty(_v,"__esModule",{value:!0});var cH0=M3(),Tv=Y7(),R0=k0(),iH0=YZ(),V1=g8(),nH0=S$(),oH0=HW(),sH0=q3(),R3=Mv(),Rv=J1(),rH0=A3(),aH0={elements:ZB0,values:JB0,discriminator:XB0,properties:Dv,optionalProperties:Dv,enum:GB0,type:QB0,ref:WB0};function Pv($,Z){let J=Tv.getCompilingSchema.call(this,$);if(J)return J;let{es5:Y,lines:X}=this.opts.code,{ownProperties:Q}=this.opts,G=new R0.CodeGen(this.scope,{es5:Y,lines:X,ownProperties:Q}),W=G.scopeName("parse"),K={self:this,gen:G,schema:$.schema,schemaEnv:$,definitions:Z,data:V1.default.data,parseName:W,char:G.name("c")},V;try{this._compilations.add($),$.parseName=W,tH0(K),G.optimize(this.opts.code.optimize);let U=G.toString();V=`${G.scopeRefs(V1.default.scope)}return ${U}`;let B=Function(`${V1.default.scope}`,V)(this.scope.get());this.scope.value(W,{ref:B}),$.parse=B}catch(U){if(V)this.logger.error("Error compiling parser, function code:",V);throw delete $.parse,delete $.parseName,U}finally{this._compilations.delete($)}return $}_v.default=Pv;var T3=R0._`undefined`;function tH0($){let{gen:Z,parseName:J,char:Y}=$;Z.func(J,R0._`${V1.default.json}, ${V1.default.jsonPos}, ${V1.default.jsonPart}`,!1,()=>{Z.let(V1.default.data),Z.let(Y),Z.assign(R0._`${J}.message`,T3),Z.assign(R0._`${J}.position`,T3),Z.assign(V1.default.jsonPos,R0._`${V1.default.jsonPos} || 0`),Z.const(V1.default.jsonLen,R0._`${V1.default.json}.length`),AW($),E3($),Z.if(V1.default.jsonPart,()=>{Z.assign(R0._`${J}.position`,V1.default.jsonPos),Z.return(V1.default.data)}),Z.if(R0._`${V1.default.jsonPos} === ${V1.default.jsonLen}`,()=>Z.return(V1.default.data)),tJ($)})}function AW($){let Z;for(let J of cH0.jtdForms)if(J in $.schema){Z=J;break}if(Z)$B0($,aH0[Z]);else I3($)}var eH0=Lv(!0,Lv(!1,tJ));function $B0($,Z){let{gen:J,schema:Y,data:X}=$;if(!Y.nullable)return Z($);jQ($,"null",Z,()=>J.assign(X,null))}function ZB0($){let{gen:Z,schema:J,data:Y}=$;E6($,"[");let X=Z.let("i",0);Z.assign(Y,R0._`[]`),P3($,"]",()=>{let Q=Z.let("el");AW({...$,schema:J.elements,data:Q}),Z.assign(R0._`${Y}[${X}++]`,Q)})}function JB0($){let{gen:Z,schema:J,data:Y}=$;E6($,"{"),Z.assign(Y,R0._`{}`),P3($,"}",()=>YB0($,J.values))}function P3($,Z,J){Iv($,Z,J),E6($,Z)}function Iv($,Z,J){let{gen:Y}=$;Y.for(R0._`;${V1.default.jsonPos}<${V1.default.jsonLen} && ${OW(1)}!==${Z};`,()=>{J(),jQ($,",",()=>Y.break(),X)});function X(){jQ($,Z,()=>{},tJ)}}function YB0($,Z){let{gen:J}=$,Y=J.let("key");K7({...$,data:Y}),E6($,":"),Ev($,Y,Z)}function XB0($){let{gen:Z,data:J,schema:Y}=$,{discriminator:X,mapping:Q}=Y;E6($,"{"),Z.assign(J,R0._`{}`);let G=Z.const("pos",V1.default.jsonPos),W=Z.let("value"),K=Z.let("tag");Iv($,"}",()=>{let V=Z.let("key");K7({...$,data:V}),E6($,":"),Z.if(R0._`${V} === ${X}`,()=>{K7({...$,data:K}),Z.assign(R0._`${J}[${V}]`,K),Z.break()},()=>I3({...$,data:W}))}),Z.assign(V1.default.jsonPos,G),Z.if(R0._`${K} === undefined`),UZ($,R0.str`discriminator tag not found`);for(let V in Q)Z.elseIf(R0._`${K} === ${V}`),Cv({...$,schema:Q[V]},X);Z.else(),UZ($,R0.str`discriminator value not in schema`),Z.endIf()}function Dv($){let{gen:Z,data:J}=$;E6($,"{"),Z.assign(J,R0._`{}`),Cv($)}function Cv($,Z){let{gen:J,schema:Y,data:X}=$,{properties:Q,optionalProperties:G,additionalProperties:W}=Y;if(P3($,"}",()=>{let K=J.let("key");if(K7({...$,data:K}),E6($,":"),J.if(!1),wv($,K,Q),wv($,K,G),Z){J.elseIf(R0._`${K} === ${Z}`);let V=J.let("tag");K7({...$,data:V})}if(J.else(),W)I3({...$,data:R0._`${X}[${K}]`});else UZ($,R0.str`property ${K} not allowed`);J.endIf()}),Q){let K=(0,nH0.hasPropFunc)(J),V=(0,R0.and)(...Object.keys(Q).map((U)=>R0._`${K}.call(${X}, ${U})`));J.if((0,R0.not)(V),()=>UZ($,R0.str`missing required properties`))}}function wv($,Z,J={}){let{gen:Y}=$;for(let X in J)Y.elseIf(R0._`${Z} === ${X}`),Ev($,Z,J[X])}function Ev($,Z,J){AW({...$,schema:J,data:R0._`${$.data}[${Z}]`})}function QB0($){let{gen:Z,schema:J,data:Y,self:X}=$;switch(J.type){case"boolean":eH0($);break;case"string":K7($);break;case"timestamp":{K7($);let Q=(0,Rv.useFunc)(Z,rH0.default),{allowDate:G,parseDate:W}=X.opts,K=G?R0._`!${Q}(${Y}, true)`:R0._`!${Q}(${Y})`,V=W?(0,R0.or)(K,R0._`(${Y} = new Date(${Y}), false)`,R0._`isNaN(${Y}.valueOf())`):K;Z.if(V,()=>UZ($,R0.str`invalid timestamp`));break}case"float32":case"float64":L3($);break;default:{let Q=J.type;if(!X.opts.int32range&&(Q==="int32"||Q==="uint32")){if(L3($,16),Q==="uint32")Z.if(R0._`${Y} < 0`,()=>UZ($,R0.str`integer out of range`))}else{let[G,W,K]=sH0.intRange[Q];L3($,K),Z.if(R0._`${Y} < ${G} || ${Y} > ${W}`,()=>UZ($,R0.str`integer out of range`))}}}}function K7($){E6($,'"'),C3($,R3.parseJsonString)}function GB0($){let{gen:Z,data:J,schema:Y}=$,X=Y.enum;E6($,'"'),Z.if(!1);for(let Q of X){let G=JSON.stringify(Q).slice(1);Z.elseIf(R0._`${OW(G.length)} === ${G}`),Z.assign(J,R0.str`${Q}`),Z.add(V1.default.jsonPos,G.length)}Z.else(),tJ($),Z.endIf()}function L3($,Z){let{gen:J}=$;E3($),J.if(R0._`"-0123456789".indexOf(${OW(1)}) < 0`,()=>tJ($),()=>C3($,R3.parseJsonNumber,Z))}function Lv($,Z){return(J)=>{let{gen:Y,data:X}=J;jQ(J,`${$}`,()=>Z(J),()=>Y.assign(X,$))}}function WB0($){let{gen:Z,self:J,definitions:Y,schema:X,schemaEnv:Q}=$,{ref:G}=X,W=Y[G];if(!W)throw new iH0.default(J.opts.uriResolver,"",G,`No definition ${G}`);if(!(0,oH0.hasRef)(W))return AW({...$,schema:W});let{root:K}=Q,V=Pv.call(J,new Tv.SchemaEnv({schema:W,root:K}),Y);bv($,KB0(Z,V),!0)}function KB0($,Z){return Z.parse?$.scopeValue("parse",{ref:Z.parse}):R0._`${$.scopeValue("wrapper",{ref:Z})}.parse`}function I3($){C3($,R3.parseJson)}function C3($,Z,J){bv($,(0,Rv.useFunc)($.gen,Z),J)}function bv($,Z,J){let{gen:Y,data:X}=$;Y.assign(X,R0._`${Z}(${V1.default.json}, ${V1.default.jsonPos}${J?R0._`, ${J}`:R0.nil})`),Y.assign(V1.default.jsonPos,R0._`${Z}.position`),Y.if(R0._`${X} === undefined`,()=>UZ($,R0._`${Z}.message`))}function E6($,Z){jQ($,Z,tJ)}function jQ($,Z,J,Y){let{gen:X}=$,Q=Z.length;E3($),X.if(R0._`${OW(Q)} === ${Z}`,()=>{X.add(V1.default.jsonPos,Q),Y===null||Y===void 0||Y($)},()=>J($))}function E3({gen:$,char:Z}){$.code(R0._`while((${Z}=${V1.default.json}[${V1.default.jsonPos}],${Z}===" "||${Z}==="\\n"||${Z}==="\\r"||${Z}==="\\t"))${V1.default.jsonPos}++;`)}function OW($){return $===1?R0._`${V1.default.json}[${V1.default.jsonPos}]`:R0._`${V1.default.json}.slice(${V1.default.jsonPos}, ${V1.default.jsonPos}+${$})`}function tJ($){UZ($,R0._`"unexpected token " + ${V1.default.json}[${V1.default.jsonPos}]`)}function UZ({gen:$,parseName:Z},J){$.assign(R0._`${Z}.message`,J),$.assign(R0._`${Z}.position`,V1.default.jsonPos),$.return(T3)}});var S3=S((B8,_3)=>{Object.defineProperty(B8,"__esModule",{value:!0});B8.MissingRefError=B8.ValidationError=B8.CodeGen=B8.Name=B8.nil=B8.stringify=B8.str=B8._=B8.KeywordCxt=B8.Ajv=void 0;var UB0=Z3(),HB0=ek(),BB0=Xv(),zB0=Ov(),FB0=Sv(),b3="JTD-meta-schema";class NQ extends UB0.default{constructor($={}){super({...$,jtd:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(HB0.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;this.addMetaSchema(BB0.default,b3,!1)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(b3)?b3:void 0)}compileSerializer($){let Z=this._addSchema($);return Z.serialize||this._compileSerializer(Z)}compileParser($){let Z=this._addSchema($);return Z.parse||this._compileParser(Z)}_compileSerializer($){if(zB0.default.call(this,$,$.schema.definitions||{}),!$.serialize)throw Error("ajv implementation error");return $.serialize}_compileParser($){if(FB0.default.call(this,$,$.schema.definitions||{}),!$.parse)throw Error("ajv implementation error");return $.parse}}B8.Ajv=NQ;_3.exports=B8=NQ;_3.exports.Ajv=NQ;Object.defineProperty(B8,"__esModule",{value:!0});B8.default=NQ;var AB0=lJ();Object.defineProperty(B8,"KeywordCxt",{enumerable:!0,get:function(){return AB0.KeywordCxt}});var eJ=k0();Object.defineProperty(B8,"_",{enumerable:!0,get:function(){return eJ._}});Object.defineProperty(B8,"str",{enumerable:!0,get:function(){return eJ.str}});Object.defineProperty(B8,"stringify",{enumerable:!0,get:function(){return eJ.stringify}});Object.defineProperty(B8,"nil",{enumerable:!0,get:function(){return eJ.nil}});Object.defineProperty(B8,"Name",{enumerable:!0,get:function(){return eJ.Name}});Object.defineProperty(B8,"CodeGen",{enumerable:!0,get:function(){return eJ.CodeGen}});var OB0=ZQ();Object.defineProperty(B8,"ValidationError",{enumerable:!0,get:function(){return OB0.default}});var qB0=YZ();Object.defineProperty(B8,"MissingRefError",{enumerable:!0,get:function(){return qB0.default}})});var f3=S((dy0,fv)=>{var MB0=sG();fv.exports=Object.freeze({coerceTypes:"array",useDefaults:!0,removeAdditional:!0,uriResolver:MB0,addUsedSchema:!1,allErrors:!1})});var qW=S((mv)=>{Object.defineProperty(mv,"__esModule",{value:!0});mv.formatNames=mv.fastFormats=mv.fullFormats=void 0;function b6($,Z){return{validate:$,compare:Z}}mv.fullFormats={date:b6(xv,x3),time:b6(v3(!0),h3),"date-time":b6(kv(!0),gv),"iso-time":b6(v3(),hv),"iso-date-time":b6(kv(),uv),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:PB0,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:fB0,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:IB0,int32:{type:"number",validate:bB0},int64:{type:"number",validate:_B0},float:{type:"number",validate:yv},double:{type:"number",validate:yv},password:!0,binary:!0};mv.fastFormats={...mv.fullFormats,date:b6(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,x3),time:b6(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,h3),"date-time":b6(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,gv),"iso-time":b6(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,hv),"iso-date-time":b6(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,uv),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};mv.formatNames=Object.keys(mv.fullFormats);function DB0($){return $%4===0&&($%100!==0||$%400===0)}var wB0=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,LB0=[0,31,28,31,30,31,30,31,31,30,31,30,31];function xv($){let Z=wB0.exec($);if(!Z)return!1;let J=+Z[1],Y=+Z[2],X=+Z[3];return Y>=1&&Y<=12&&X>=1&&X<=(Y===2&&DB0(J)?29:LB0[Y])}function x3($,Z){if(!($&&Z))return;if($>Z)return 1;if($<Z)return-1;return 0}var k3=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function v3($){return function(J){let Y=k3.exec(J);if(!Y)return!1;let X=+Y[1],Q=+Y[2],G=+Y[3],W=Y[4],K=Y[5]==="-"?-1:1,V=+(Y[6]||0),U=+(Y[7]||0);if(V>23||U>59||$&&!W)return!1;if(X<=23&&Q<=59&&G<60)return!0;let H=Q-U*K,B=X-V*K-(H<0?1:0);return(B===23||B===-1)&&(H===59||H===-1)&&G<61}}function h3($,Z){if(!($&&Z))return;let J=new Date("2020-01-01T"+$).valueOf(),Y=new Date("2020-01-01T"+Z).valueOf();if(!(J&&Y))return;return J-Y}function hv($,Z){if(!($&&Z))return;let J=k3.exec($),Y=k3.exec(Z);if(!(J&&Y))return;if($=J[1]+J[2]+J[3],Z=Y[1]+Y[2]+Y[3],$>Z)return 1;if($<Z)return-1;return 0}var y3=/t|\s/i;function kv($){let Z=v3($);return function(Y){let X=Y.split(y3);return X.length===2&&xv(X[0])&&Z(X[1])}}function gv($,Z){if(!($&&Z))return;let J=new Date($).valueOf(),Y=new Date(Z).valueOf();if(!(J&&Y))return;return J-Y}function uv($,Z){if(!($&&Z))return;let[J,Y]=$.split(y3),[X,Q]=Z.split(y3),G=x3(J,X);if(G===void 0)return;return G||h3(Y,Q)}var TB0=/\/|:/,RB0=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function PB0($){return TB0.test($)&&RB0.test($)}var vv=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function IB0($){return vv.lastIndex=0,vv.test($)}var CB0=-2147483648,EB0=2147483647;function bB0($){return Number.isInteger($)&&$<=EB0&&$>=CB0}function _B0($){return Number.isInteger($)}function yv(){return!0}var SB0=/[^\\]\\Z/;function fB0($){if(SB0.test($))return!1;try{return new RegExp($),!0}catch(Z){return!1}}});var pv=S((dv)=>{Object.defineProperty(dv,"__esModule",{value:!0});dv.formatLimitDefinition=void 0;var vB0=UW(),W6=k0(),eZ=W6.operators,jW={formatMaximum:{okStr:"<=",ok:eZ.LTE,fail:eZ.GT},formatMinimum:{okStr:">=",ok:eZ.GTE,fail:eZ.LT},formatExclusiveMaximum:{okStr:"<",ok:eZ.LT,fail:eZ.GTE},formatExclusiveMinimum:{okStr:">",ok:eZ.GT,fail:eZ.LTE}},yB0={message:({keyword:$,schemaCode:Z})=>W6.str`should be ${jW[$].okStr} ${Z}`,params:({keyword:$,schemaCode:Z})=>W6._`{comparison: ${jW[$].okStr}, limit: ${Z}}`};dv.formatLimitDefinition={keyword:Object.keys(jW),type:"string",schemaType:"string",$data:!0,error:yB0,code($){let{gen:Z,data:J,schemaCode:Y,keyword:X,it:Q}=$,{opts:G,self:W}=Q;if(!G.validateFormats)return;let K=new vB0.KeywordCxt(Q,W.RULES.all.format.definition,"format");if(K.$data)V();else U();function V(){let B=Z.scopeValue("formats",{ref:W.formats,code:G.code.formats}),z=Z.const("fmt",W6._`${B}[${K.schemaCode}]`);$.fail$data((0,W6.or)(W6._`typeof ${z} != "object"`,W6._`${z} instanceof RegExp`,W6._`typeof ${z}.compare != "function"`,H(z)))}function U(){let B=K.schema,z=W.formats[B];if(!z||z===!0)return;if(typeof z!="object"||z instanceof RegExp||typeof z.compare!="function")throw Error(`"${X}": format "${B}" does not define "compare" function`);let F=Z.scopeValue("formats",{key:B,ref:z,code:G.code.formats?W6._`${G.code.formats}${(0,W6.getProperty)(B)}`:void 0});$.fail$data(H(F))}function H(B){return W6._`${B}.compare(${J}, ${Y}) ${jW[X].fail} 0`}},dependencies:["format"]};var xB0=($)=>{return $.addKeyword(dv.formatLimitDefinition),$};dv.default=xB0});var d3=S((MQ,nv)=>{Object.defineProperty(MQ,"__esModule",{value:!0});var $Y=qW(),gB0=pv(),m3=k0(),cv=new m3.Name("fullFormats"),uB0=new m3.Name("fastFormats"),l3=($,Z={keywords:!0})=>{if(Array.isArray(Z))return iv($,Z,$Y.fullFormats,cv),$;let[J,Y]=Z.mode==="fast"?[$Y.fastFormats,uB0]:[$Y.fullFormats,cv],X=Z.formats||$Y.formatNames;if(iv($,X,J,Y),Z.keywords)(0,gB0.default)($);return $};l3.get=($,Z="full")=>{let Y=(Z==="fast"?$Y.fastFormats:$Y.fullFormats)[$];if(!Y)throw Error(`Unknown format "${$}"`);return Y};function iv($,Z,J,Y){var X,Q;(X=(Q=$.opts.code).formats)!==null&&X!==void 0||(Q.formats=m3._`require("ajv-formats/dist/formats").${Y}`);for(let G of Z)$.addFormat(G,J[G])}nv.exports=MQ=l3;Object.defineProperty(MQ,"__esModule",{value:!0});MQ.default=l3});var av=S((iy0,rv)=>{var mB0=UW().default,lB0=S3(),ov=f3();class sv{constructor($,Z){if(Z.mode==="JTD")this.ajv=new lB0(Object.assign({},ov,Z.customOptions));else this.ajv=new mB0(Object.assign({},ov,Z.customOptions));let J=!0;if(Z.plugins&&Z.plugins.length>0)for(let X of Z.plugins)if(Array.isArray(X))J=J&&X[0].name!=="formatsPlugin",X[0](this.ajv,X[1]);else J=J&&X.name!=="formatsPlugin",X(this.ajv);if(J)d3()(this.ajv);Z.onCreate?.(this.ajv);let Y=Object.values($);for(let X of Y)this.ajv.addSchema(X)}buildValidatorFunction({schema:$}){if($.$id){let Z=this.ajv.getSchema($.$id);if(Z)return Z}return this.ajv.compile($)}}rv.exports=sv});var $y=S((ny0,ev)=>{var dB0=S3(),pB0=f3();class tv{constructor($,Z){this.ajv=new dB0(Object.assign({},pB0,Z))}buildSerializerFunction({schema:$}){return this.ajv.compileSerializer($)}}ev.exports=tv});var Yy=S((wQ,Jy)=>{Object.defineProperty(wQ,"__esModule",{value:!0});var DQ=fG(),K6=yJ();function Zy($,Z){if(!$.opts.code.source)throw Error("moduleCode: ajv instance must have code.source option");let{_n:J}=$.scope.opts;return typeof Z=="function"?X(Z.source):Z!==void 0?Q(Z,Y):Q($.schemas,(W)=>W.meta?void 0:$.compile(W.schema));function Y(W){let K=$.getSchema(W);if(!K)throw Error(`moduleCode: no schema with id ${W}`);return K}function X(W){let K={},V=W===null||W===void 0?void 0:W.validateName,U=G(K,W);if($.opts.code.esm)return`"use strict";${J}export const validate = ${V};${J}export default ${V};${J}${U}`;return`"use strict";${J}module.exports = ${V};${J}module.exports.default = ${V};${J}${U}`}function Q(W,K){var V;let U={},H=K6._`"use strict";`;for(let B in W){let z=K(W[B]);if(z){let F=G(U,z.source),A=$.opts.code.esm?K6._`export const ${(0,K6.getEsmExportName)(B)}`:K6._`exports${(0,K6.getProperty)(B)}`;H=K6._`${H}${J}${A} = ${(V=z.source)===null||V===void 0?void 0:V.validateName};${J}${F}`}}return`${H}`}function G(W,K){if(!K)throw Error('moduleCode: function does not have "source" property');if(B(K.validateName)===DQ.UsedValueState.Completed)return K6.nil;z(K.validateName,DQ.UsedValueState.Started);let V=$.scope.scopeCode(K.scopeValues,W,H),U=new K6._Code(`${V}${J}${K.validateCode}`);return K.evaluated?K6._`${U}${K.validateName}.evaluated = ${K.evaluated};${J}`:U;function H(F){var A;let j=(A=F.value)===null||A===void 0?void 0:A.ref;if(F.prefix==="validate"&&typeof j=="function")return G(W,j.source);else if((F.prefix==="root"||F.prefix==="wrapper")&&typeof j=="object"){let{validate:N,validateName:w}=j;if(!w)throw Error("ajv internal error");let q=$.opts.code.es5?DQ.varKinds.var:DQ.varKinds.const,M=K6._`${q} ${F} = {validate: ${w}};`;if(B(w)===DQ.UsedValueState.Started)return M;let C=G(W,N===null||N===void 0?void 0:N.source);return K6._`${M}${J}${C}`}return}function B(F){var A;return(A=W[F.prefix])===null||A===void 0?void 0:A.get(F)}function z(F,A){let{prefix:j}=F;(W[j]=W[j]||new Map).set(F,A)}}}Jy.exports=wQ=Zy;Object.defineProperty(wQ,"__esModule",{value:!0});wQ.default=Zy});var Gy=S((oy0,Qy)=>{var Xy=p3(),cB0=Yy().default;function iB0($={readMode:!0}){if($.readMode===!0&&!$.restoreFunction)throw Error("You must provide a restoreFunction options when readMode ON");if($.readMode!==!0&&!$.storeFunction)throw Error("You must provide a storeFunction options when readMode OFF");if($.readMode===!0)return function(){return function(Y){return $.restoreFunction(Y)}};let Z=Xy();return function(Y,X={}){if(!X.customOptions||!X.customOptions.code)X.customOptions=Object.assign({},X.customOptions,{code:{source:!0}});let Q=Z(Y,X);return function(G){let W=Q(G),K=cB0(Q[Xy.AjvReference].ajv,W);return $.storeFunction(G,K),W}}}Qy.exports=iB0});var p3=S((sy0,ZY)=>{var Ky=Symbol.for("fastify.ajv-compiler.reference"),nB0=av(),oB0=$y();function c3($){let Z=new Map,J=new Map;if($&&$.jtdSerializer===!0)return function(X,Q){let G=Wy({},Q);if(J.has(G))return J.get(G);let W=new oB0(X,Q),K=W.buildSerializerFunction.bind(W);return J.set(G,K),K};return function(X,Q){let G=Wy(X,Q.customOptions);if(Z.has(G))return Z.get(G);let W=new nB0(X,Q),K=W.buildValidatorFunction.bind(W);if(Z.set(G,K),Q.customOptions.code!==void 0)K[Ky]=W;return K}}function Wy($,Z){let J=JSON.stringify($),Y=JSON.stringify(Z);return`${J}${Y}`}ZY.exports=c3;ZY.exports.default=c3;ZY.exports.AjvCompiler=c3;ZY.exports.AjvReference=Ky;ZY.exports.StandaloneValidator=Gy()});var NW=S((sB0)=>{var Vy=Object.prototype.hasOwnProperty;function Uy($,Z,J){for(J of $.keys())if(LQ(J,Z))return J}function LQ($,Z){var J,Y,X;if($===Z)return!0;if($&&Z&&(J=$.constructor)===Z.constructor){if(J===Date)return $.getTime()===Z.getTime();if(J===RegExp)return $.toString()===Z.toString();if(J===Array){if((Y=$.length)===Z.length)while(Y--&&LQ($[Y],Z[Y]));return Y===-1}if(J===Set){if($.size!==Z.size)return!1;for(Y of $){if(X=Y,X&&typeof X==="object"){if(X=Uy(Z,X),!X)return!1}if(!Z.has(X))return!1}return!0}if(J===Map){if($.size!==Z.size)return!1;for(Y of $){if(X=Y[0],X&&typeof X==="object"){if(X=Uy(Z,X),!X)return!1}if(!LQ(Y[1],Z.get(X)))return!1}return!0}if(J===ArrayBuffer)$=new Uint8Array($),Z=new Uint8Array(Z);else if(J===DataView){if((Y=$.byteLength)===Z.byteLength)while(Y--&&$.getInt8(Y)===Z.getInt8(Y));return Y===-1}if(ArrayBuffer.isView($)){if((Y=$.byteLength)===Z.byteLength)while(Y--&&$[Y]===Z[Y]);return Y===-1}if(!J||typeof $==="object"){Y=0;for(J in $){if(Vy.call($,J)&&++Y&&!Vy.call(Z,J))return!1;if(!(J in Z)||!LQ($[J],Z[J]))return!1}return Object.keys(Z).length===Y}}return $!==$&&Z!==Z}sB0.dequal=LQ});var Ay=S((ay0,Fy)=>{var{dequal:Hy}=NW(),aB0=Symbol.for("json-schema-ref");class zy{#$;#Z;#J;#Y;#X;constructor($={}){this.#$={},this.#Z={},this.#J=$.insertRefSymbol??!1,this.#Y=$.allowEqualDuplicates??!0,this.#X=$.cloneSchemaWithoutRefs??!1}addSchema($,Z,J=!0){if(J)if($.$id!==void 0&&$.$id.charAt(0)!=="#")Z=$.$id;else this.#K($,Z);let Y=$.$id;if(Y!==void 0&&typeof Y==="string")if(Y.charAt(0)==="#")this.#U($,Z,Y);else this.#K($,Y),Z=Y;let X=$.$ref;if(X!==void 0&&typeof X==="string"){let{refSchemaId:Q,refJsonPointer:G}=this.#Q(X,Z);this.#$[Z].refs.push({schemaId:Q,jsonPointer:G})}for(let Q in $)if(typeof $[Q]==="object"&&$[Q]!==null)this.addSchema($[Q],Z,!1)}getSchema($,Z="#"){let J=this.#$[$];if(J===void 0)throw Error(`Cannot resolve ref "${$}${Z}". Schema with id "${$}" is not found.`);if(J.anchors[Z]!==void 0)return J.anchors[Z];return By(J.schema,Z)}hasSchema($){return this.#$[$]!==void 0}getSchemaRefs($){let Z=this.#$[$];if(Z===void 0)throw Error(`Schema with id "${$}" is not found.`);return Z.refs}getSchemaDependencies($,Z={}){let J=this.#$[$];for(let Y of J.refs){let X=Y.schemaId;if(X===$||Z[X]!==void 0)continue;Z[X]=this.getSchema(X),this.getSchemaDependencies(X,Z)}return Z}derefSchema($){if(this.#Z[$]!==void 0)return;let Z=this.#$[$];if(Z===void 0)throw Error(`Schema with id "${$}" is not found.`);if(!this.#X&&Z.refs.length===0)this.#Z[$]={schema:Z.schema,anchors:Z.anchors};let J=[];this.#G(Z.schema,$,!0,J);let Y=this.getSchemaDependencies($);for(let X in Y){let Q=Y[X];this.#G(Q,X,!0,J)}for(let X of J){let{refSchemaId:Q,refJsonPointer:G}=this.#Q(X.ref,X.sourceSchemaId),W=this.getDerefSchema(Q,G);if(W===null)throw Error(`Cannot resolve ref "${X.ref}". Ref "${G}" is not found in schema "${Q}".`);X.targetSchema=W,X.targetSchemaId=Q}for(let X of J)this.#W(X,J)}getDerefSchema($,Z="#"){let J=this.#Z[$];if(J===void 0)this.derefSchema($),J=this.#Z[$];if(J.anchors[Z]!==void 0)return J.anchors[Z];return By(J.schema,Z)}#Q($,Z){let J=$.indexOf("#");if(J===-1)return{refSchemaId:$,refJsonPointer:"#"};if(J===0)return{refSchemaId:Z,refJsonPointer:$};return{refSchemaId:$.slice(0,J),refJsonPointer:$.slice(J)}}#G($,Z,J,Y=[]){let X=Array.isArray($)?[...$]:{...$};if(J)if($.$id!==void 0&&$.$id.charAt(0)!=="#")Z=$.$id;else this.#V(X,Z);let Q=X.$id;if(Q!==void 0&&typeof Q==="string")if(Q.charAt(0)==="#")this.#H(X,Z,Q);else this.#V(X,Q),Z=Q;if(X.$ref!==void 0)Y.push({ref:X.$ref,sourceSchemaId:Z,sourceSchema:X});for(let G in X){let W=X[G];if(typeof W==="object"&&W!==null)X[G]=this.#G(W,Z,!1,Y)}return X}#W($,Z){let{sourceSchema:J,targetSchema:Y}=$;if(!J.$ref)return;if(this.#J)J[aB0]=J.$ref;if(delete J.$ref,Y.$ref){let X=Z.find((Q)=>Q.sourceSchema===Y);this.#W(X,Z)}for(let X in Y){if(X==="$id")continue;if(J[X]!==void 0){if(Hy(J[X],Y[X]))continue;throw Error(`Cannot resolve ref "${$.ref}". Property "${X}" already exists in schema "${$.sourceSchemaId}".`)}J[X]=Y[X]}$.isResolved=!0}#K($,Z){let J=this.#$[Z];if(J!==void 0){if(this.#Y&&Hy($,J.schema))return;throw Error(`There is already another schema with id "${Z}".`)}this.#$[Z]={schema:$,anchors:{},refs:[]}}#U($,Z,J){let{anchors:Y}=this.#$[Z];if(Y[J]!==void 0)throw Error(`There is already another anchor "${J}" in schema "${Z}".`);Y[J]=$}#V($,Z){if(this.#Z[Z]!==void 0)return;this.#Z[Z]={schema:$,anchors:{}}}#H($,Z,J){let{anchors:Y}=this.#Z[Z];Y[J]=$}}function By($,Z){let J=Z.split("/"),Y=$;for(let X of J){if(X===""||X==="#")continue;if(typeof Y!=="object"||Y===null)return null;Y=Y[X]}return Y??null}Fy.exports={RefResolver:zy}});var n3=S((ty0,Oy)=>{var tB0=UW(),eB0=sG(),$z0=d3(),Zz0=WG()({proto:!0});class i3{constructor($){this.ajv=new tB0({...$,strictSchema:!1,validateSchema:!1,allowUnionTypes:!0,uriResolver:eB0}),$z0(this.ajv),this.ajv.addKeyword({keyword:"fjs_type",type:"object",errors:!1,validate:(Z,J)=>{return J&&typeof J.toJSON==="function"}}),this._ajvSchemas={},this._ajvOptions=$||{}}addSchema($,Z){let J=$.$id||Z;if($.$id!==void 0&&$.$id[0]==="#")J=Z+$.$id;if(this.ajv.refs[J]===void 0&&this.ajv.schemas[J]===void 0){let Y=Zz0($);this.convertSchemaToAjvFormat(Y),this.ajv.addSchema(Y,J),this._ajvSchemas[J]=$}}validate($,Z){return this.ajv.validate($,Z)}convertSchemaToAjvFormat($){if($===null)return;if($.type==="string")$.fjs_type="string",$.type=["string","object"];else if(Array.isArray($.type)&&$.type.includes("string")&&!$.type.includes("object"))$.fjs_type="string",$.type.push("object");for(let Z in $)if(typeof $[Z]==="object")this.convertSchemaToAjvFormat($[Z])}getState(){return{ajvOptions:this._ajvOptions,ajvSchemas:this._ajvSchemas}}static restoreFromState($){let Z=new i3($.ajvOptions);for(let[J,Y]of Object.entries($.ajvSchemas))Z.ajv.addSchema(Y,J);return Z}}Oy.exports=i3});var jy=S((ey0,qy)=>{class o3{constructor($,Z,J="#"){this.schema=$,this.schemaId=Z,this.jsonPointer=J}getPropertyLocation($){return new o3(this.schema[$],this.schemaId,this.jsonPointer+"/"+$)}getSchemaRef(){return this.schemaId+this.jsonPointer}}qy.exports=o3});var Ly=S(($x0,r3)=>{r3.exports=U0;r3.exports.default=U0;var Jz0={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0},Ny={enum:["array","boolean","integer","null","number","object","string"]},My=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Yz0=qW().fullFormats.uri,Dy=qW().fullFormats.regex;function m8($,{instancePath:Z="",parentData:J,parentDataProperty:Y,rootData:X=$}={}){let Q=null,G=0,W=G;if(!(typeof $=="number"&&(!($%1)&&!isNaN($))&&isFinite($)))return m8.errors=[{instancePath:Z,schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(G===W){if(typeof $=="number"&&isFinite($)){if($<0||isNaN($))return m8.errors=[{instancePath:Z,schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1}}return m8.errors=Q,G===0}var s3={validate:U0};function e$($,{instancePath:Z="",parentData:J,parentDataProperty:Y,rootData:X=$}={}){let Q=null,G=0;if(G===0)if(Array.isArray($))if($.length<1)return e$.errors=[{instancePath:Z,schemaPath:"#/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;else{var W=!0;let K=$.length;for(let V=0;V<K;V++){let U=G;if(!s3.validate($[V],{instancePath:Z+"/"+V,parentData:$,parentDataProperty:V,rootData:X}))Q=Q===null?s3.validate.errors:Q.concat(s3.validate.errors),G=Q.length;var W=U===G;if(!W)break}}else return e$.errors=[{instancePath:Z,schemaPath:"#/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;return e$.errors=Q,G===0}var wy=HQ().default;function U0($,{instancePath:Z="",parentData:J,parentDataProperty:Y,rootData:X=$}={}){let Q=null,G=0;if(!($&&typeof $=="object"&&!Array.isArray($))&&typeof $!=="boolean")return U0.errors=[{instancePath:Z,schemaPath:"#/type",keyword:"type",params:{type:Jz0.type},message:"must be object,boolean"}],!1;if(G===0){if($&&typeof $=="object"&&!Array.isArray($)){if($.$id!==void 0){let q=$.$id,M=G;if(G===M){if(G===M)if(typeof q==="string"){if(!My.test(q))return U0.errors=[{instancePath:Z+"/$id",schemaPath:"#/properties/%24id/format",keyword:"format",params:{format:"uri-reference"},message:'must match format "uri-reference"'}],!1}else return U0.errors=[{instancePath:Z+"/$id",schemaPath:"#/properties/%24id/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1}var W=M===G}else var W=!0;if(W){if($.$schema!==void 0){let q=$.$schema,M=G;if(G===M){if(G===M)if(typeof q==="string"){if(!Yz0(q))return U0.errors=[{instancePath:Z+"/$schema",schemaPath:"#/properties/%24schema/format",keyword:"format",params:{format:"uri"},message:'must match format "uri"'}],!1}else return U0.errors=[{instancePath:Z+"/$schema",schemaPath:"#/properties/%24schema/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1}var W=M===G}else var W=!0;if(W){if($.$ref!==void 0){let q=$.$ref,M=G;if(G===M){if(G===M)if(typeof q==="string"){if(!My.test(q))return U0.errors=[{instancePath:Z+"/$ref",schemaPath:"#/properties/%24ref/format",keyword:"format",params:{format:"uri-reference"},message:'must match format "uri-reference"'}],!1}else return U0.errors=[{instancePath:Z+"/$ref",schemaPath:"#/properties/%24ref/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1}var W=M===G}else var W=!0;if(W){if($.$comment!==void 0){let q=G;if(typeof $.$comment!=="string")return U0.errors=[{instancePath:Z+"/$comment",schemaPath:"#/properties/%24comment/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var W=q===G}else var W=!0;if(W){if($.title!==void 0){let q=G;if(typeof $.title!=="string")return U0.errors=[{instancePath:Z+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var W=q===G}else var W=!0;if(W){if($.description!==void 0){let q=G;if(typeof $.description!=="string")return U0.errors=[{instancePath:Z+"/description",schemaPath:"#/properties/description/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var W=q===G}else var W=!0;if(W){if($.readOnly!==void 0){let q=G;if(typeof $.readOnly!=="boolean")return U0.errors=[{instancePath:Z+"/readOnly",schemaPath:"#/properties/readOnly/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var W=q===G}else var W=!0;if(W){if($.examples!==void 0){let q=G;if(G===q){if(!Array.isArray($.examples))return U0.errors=[{instancePath:Z+"/examples",schemaPath:"#/properties/examples/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1}var W=q===G}else var W=!0;if(W){if($.multipleOf!==void 0){let q=$.multipleOf,M=G;if(G===M)if(typeof q=="number"&&isFinite(q)){if(q<=0||isNaN(q))return U0.errors=[{instancePath:Z+"/multipleOf",schemaPath:"#/properties/multipleOf/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0"}],!1}else return U0.errors=[{instancePath:Z+"/multipleOf",schemaPath:"#/properties/multipleOf/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var W=M===G}else var W=!0;if(W){if($.maximum!==void 0){let q=$.maximum,M=G;if(!(typeof q=="number"&&isFinite(q)))return U0.errors=[{instancePath:Z+"/maximum",schemaPath:"#/properties/maximum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var W=M===G}else var W=!0;if(W){if($.exclusiveMaximum!==void 0){let q=$.exclusiveMaximum,M=G;if(!(typeof q=="number"&&isFinite(q)))return U0.errors=[{instancePath:Z+"/exclusiveMaximum",schemaPath:"#/properties/exclusiveMaximum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var W=M===G}else var W=!0;if(W){if($.minimum!==void 0){let q=$.minimum,M=G;if(!(typeof q=="number"&&isFinite(q)))return U0.errors=[{instancePath:Z+"/minimum",schemaPath:"#/properties/minimum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var W=M===G}else var W=!0;if(W){if($.exclusiveMinimum!==void 0){let q=$.exclusiveMinimum,M=G;if(!(typeof q=="number"&&isFinite(q)))return U0.errors=[{instancePath:Z+"/exclusiveMinimum",schemaPath:"#/properties/exclusiveMinimum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var W=M===G}else var W=!0;if(W){if($.maxLength!==void 0){let q=$.maxLength,M=G,C=G;if(!(typeof q=="number"&&(!(q%1)&&!isNaN(q))&&isFinite(q)))return U0.errors=[{instancePath:Z+"/maxLength",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(G===C){if(typeof q=="number"&&isFinite(q)){if(q<0||isNaN(q))return U0.errors=[{instancePath:Z+"/maxLength",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1}}var W=M===G}else var W=!0;if(W){if($.minLength!==void 0){let q=G;if(!m8($.minLength,{instancePath:Z+"/minLength",parentData:$,parentDataProperty:"minLength",rootData:X}))Q=Q===null?m8.errors:Q.concat(m8.errors),G=Q.length;var W=q===G}else var W=!0;if(W){if($.pattern!==void 0){let q=$.pattern,M=G;if(G===M){if(G===M)if(typeof q==="string"){if(!Dy(q))return U0.errors=[{instancePath:Z+"/pattern",schemaPath:"#/properties/pattern/format",keyword:"format",params:{format:"regex"},message:'must match format "regex"'}],!1}else return U0.errors=[{instancePath:Z+"/pattern",schemaPath:"#/properties/pattern/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1}var W=M===G}else var W=!0;if(W){if($.additionalItems!==void 0){let q=G;if(!U0($.additionalItems,{instancePath:Z+"/additionalItems",parentData:$,parentDataProperty:"additionalItems",rootData:X}))Q=Q===null?U0.errors:Q.concat(U0.errors),G=Q.length;var W=q===G}else var W=!0;if(W){if($.items!==void 0){let q=$.items,M=G,C=G,R=!1,T=G;if(!U0(q,{instancePath:Z+"/items",parentData:$,parentDataProperty:"items",rootData:X}))Q=Q===null?U0.errors:Q.concat(U0.errors),G=Q.length;var K=T===G;if(R=R||K,!R){let _=G;if(!e$(q,{instancePath:Z+"/items",parentData:$,parentDataProperty:"items",rootData:X}))Q=Q===null?e$.errors:Q.concat(e$.errors),G=Q.length;var K=_===G;R=R||K}if(!R){let _={instancePath:Z+"/items",schemaPath:"#/properties/items/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(Q===null)Q=[_];else Q.push(_);return G++,U0.errors=Q,!1}else if(G=C,Q!==null)if(C)Q.length=C;else Q=null;var W=M===G}else var W=!0;if(W){if($.maxItems!==void 0){let q=$.maxItems,M=G,C=G;if(!(typeof q=="number"&&(!(q%1)&&!isNaN(q))&&isFinite(q)))return U0.errors=[{instancePath:Z+"/maxItems",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(G===C){if(typeof q=="number"&&isFinite(q)){if(q<0||isNaN(q))return U0.errors=[{instancePath:Z+"/maxItems",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1}}var W=M===G}else var W=!0;if(W){if($.minItems!==void 0){let q=G;if(!m8($.minItems,{instancePath:Z+"/minItems",parentData:$,parentDataProperty:"minItems",rootData:X}))Q=Q===null?m8.errors:Q.concat(m8.errors),G=Q.length;var W=q===G}else var W=!0;if(W){if($.uniqueItems!==void 0){let q=G;if(typeof $.uniqueItems!=="boolean")return U0.errors=[{instancePath:Z+"/uniqueItems",schemaPath:"#/properties/uniqueItems/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var W=q===G}else var W=!0;if(W){if($.contains!==void 0){let q=G;if(!U0($.contains,{instancePath:Z+"/contains",parentData:$,parentDataProperty:"contains",rootData:X}))Q=Q===null?U0.errors:Q.concat(U0.errors),G=Q.length;var W=q===G}else var W=!0;if(W){if($.maxProperties!==void 0){let q=$.maxProperties,M=G,C=G;if(!(typeof q=="number"&&(!(q%1)&&!isNaN(q))&&isFinite(q)))return U0.errors=[{instancePath:Z+"/maxProperties",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(G===C){if(typeof q=="number"&&isFinite(q)){if(q<0||isNaN(q))return U0.errors=[{instancePath:Z+"/maxProperties",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1}}var W=M===G}else var W=!0;if(W){if($.minProperties!==void 0){let q=G;if(!m8($.minProperties,{instancePath:Z+"/minProperties",parentData:$,parentDataProperty:"minProperties",rootData:X}))Q=Q===null?m8.errors:Q.concat(m8.errors),G=Q.length;var W=q===G}else var W=!0;if(W){if($.required!==void 0){let q=$.required,M=G;if(G===G)if(Array.isArray(q)){var V=!0;let T=q.length;for(let I=0;I<T;I++){let _=G;if(typeof q[I]!=="string")return U0.errors=[{instancePath:Z+"/required/"+I,schemaPath:"#/definitions/stringArray/items/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var V=_===G;if(!V)break}if(V){let I=q.length,_;if(I>1){let E={};for(;I--;){let f=q[I];if(typeof f!=="string")continue;if(typeof E[f]=="number"){return _=E[f],U0.errors=[{instancePath:Z+"/required",schemaPath:"#/definitions/stringArray/uniqueItems",keyword:"uniqueItems",params:{i:I,j:_},message:"must NOT have duplicate items (items ## "+_+" and "+I+" are identical)"}],!1;break}E[f]=I}}}}else return U0.errors=[{instancePath:Z+"/required",schemaPath:"#/definitions/stringArray/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var W=M===G}else var W=!0;if(W){if($.additionalProperties!==void 0){let q=G;if(!U0($.additionalProperties,{instancePath:Z+"/additionalProperties",parentData:$,parentDataProperty:"additionalProperties",rootData:X}))Q=Q===null?U0.errors:Q.concat(U0.errors),G=Q.length;var W=q===G}else var W=!0;if(W){if($.definitions!==void 0){let q=$.definitions,M=G;if(G===M)if(q&&typeof q=="object"&&!Array.isArray(q))for(let R in q){let T=G;if(!U0(q[R],{instancePath:Z+"/definitions/"+R.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:q,parentDataProperty:R,rootData:X}))Q=Q===null?U0.errors:Q.concat(U0.errors),G=Q.length;var U=T===G;if(!U)break}else return U0.errors=[{instancePath:Z+"/definitions",schemaPath:"#/properties/definitions/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var W=M===G}else var W=!0;if(W){if($.properties!==void 0){let q=$.properties,M=G;if(G===M)if(q&&typeof q=="object"&&!Array.isArray(q))for(let R in q){let T=G;if(!U0(q[R],{instancePath:Z+"/properties/"+R.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:q,parentDataProperty:R,rootData:X}))Q=Q===null?U0.errors:Q.concat(U0.errors),G=Q.length;var H=T===G;if(!H)break}else return U0.errors=[{instancePath:Z+"/properties",schemaPath:"#/properties/properties/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var W=M===G}else var W=!0;if(W){if($.patternProperties!==void 0){let q=$.patternProperties,M=G;if(G===M)if(q&&typeof q=="object"&&!Array.isArray(q)){for(let R in q){let T=G;if(G===T){if(typeof R==="string"){if(!Dy(R)){let I={instancePath:Z+"/patternProperties",schemaPath:"#/properties/patternProperties/propertyNames/format",keyword:"format",params:{format:"regex"},message:'must match format "regex"',propertyName:R};if(Q===null)Q=[I];else Q.push(I);G++}}}var B=T===G;if(!B){let I={instancePath:Z+"/patternProperties",schemaPath:"#/properties/patternProperties/propertyNames",keyword:"propertyNames",params:{propertyName:R},message:"property name must be valid"};if(Q===null)Q=[I];else Q.push(I);return G++,U0.errors=Q,!1;break}}if(B)for(let R in q){let T=G;if(!U0(q[R],{instancePath:Z+"/patternProperties/"+R.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:q,parentDataProperty:R,rootData:X}))Q=Q===null?U0.errors:Q.concat(U0.errors),G=Q.length;var z=T===G;if(!z)break}}else return U0.errors=[{instancePath:Z+"/patternProperties",schemaPath:"#/properties/patternProperties/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var W=M===G}else var W=!0;if(W){if($.dependencies!==void 0){let q=$.dependencies,M=G;if(G===M)if(q&&typeof q=="object"&&!Array.isArray(q))for(let R in q){let T=q[R],I=G,_=G,E=!1,f=G;if(!U0(T,{instancePath:Z+"/dependencies/"+R.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:q,parentDataProperty:R,rootData:X}))Q=Q===null?U0.errors:Q.concat(U0.errors),G=Q.length;var F=f===G;if(E=E||F,!E){let b=G;if(G===G)if(Array.isArray(T)){var A=!0;let g=T.length;for(let d=0;d<g;d++){let p=G;if(typeof T[d]!=="string"){let r={instancePath:Z+"/dependencies/"+R.replace(/~/g,"~0").replace(/\//g,"~1")+"/"+d,schemaPath:"#/definitions/stringArray/items/type",keyword:"type",params:{type:"string"},message:"must be string"};if(Q===null)Q=[r];else Q.push(r);G++}var A=p===G;if(!A)break}if(A){let d=T.length,p;if(d>1){let t={};for(;d--;){let r=T[d];if(typeof r!=="string")continue;if(typeof t[r]=="number"){p=t[r];let G0={instancePath:Z+"/dependencies/"+R.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/definitions/stringArray/uniqueItems",keyword:"uniqueItems",params:{i:d,j:p},message:"must NOT have duplicate items (items ## "+p+" and "+d+" are identical)"};if(Q===null)Q=[G0];else Q.push(G0);G++;break}t[r]=d}}}}else{let g={instancePath:Z+"/dependencies/"+R.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/definitions/stringArray/type",keyword:"type",params:{type:"array"},message:"must be array"};if(Q===null)Q=[g];else Q.push(g);G++}var F=b===G;E=E||F}if(!E){let b={instancePath:Z+"/dependencies/"+R.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/dependencies/additionalProperties/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(Q===null)Q=[b];else Q.push(b);return G++,U0.errors=Q,!1}else if(G=_,Q!==null)if(_)Q.length=_;else Q=null;var j=I===G;if(!j)break}else return U0.errors=[{instancePath:Z+"/dependencies",schemaPath:"#/properties/dependencies/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var W=M===G}else var W=!0;if(W){if($.propertyNames!==void 0){let q=G;if(!U0($.propertyNames,{instancePath:Z+"/propertyNames",parentData:$,parentDataProperty:"propertyNames",rootData:X}))Q=Q===null?U0.errors:Q.concat(U0.errors),G=Q.length;var W=q===G}else var W=!0;if(W){if($.enum!==void 0){let q=$.enum,M=G;if(G===M)if(Array.isArray(q))if(q.length<1)return U0.errors=[{instancePath:Z+"/enum",schemaPath:"#/properties/enum/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;else{let R=q.length,T;if(R>1)$:for(;R--;)for(T=R;T--;)if(wy(q[R],q[T])){return U0.errors=[{instancePath:Z+"/enum",schemaPath:"#/properties/enum/uniqueItems",keyword:"uniqueItems",params:{i:R,j:T},message:"must NOT have duplicate items (items ## "+T+" and "+R+" are identical)"}],!1;break $}}else return U0.errors=[{instancePath:Z+"/enum",schemaPath:"#/properties/enum/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var W=M===G}else var W=!0;if(W){if($.type!==void 0){let q=$.type,M=G,C=G,R=!1,T=G;if(!(q==="array"||q==="boolean"||q==="integer"||q==="null"||q==="number"||q==="object"||q==="string")){let _={instancePath:Z+"/type",schemaPath:"#/definitions/simpleTypes/enum",keyword:"enum",params:{allowedValues:Ny.enum},message:"must be equal to one of the allowed values"};if(Q===null)Q=[_];else Q.push(_);G++}var N=T===G;if(R=R||N,!R){let _=G;if(G===_)if(Array.isArray(q))if(q.length<1){let f={instancePath:Z+"/type",schemaPath:"#/properties/type/anyOf/1/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};if(Q===null)Q=[f];else Q.push(f);G++}else{var w=!0;let f=q.length;for(let b=0;b<f;b++){let y=q[b],k=G;if(!(y==="array"||y==="boolean"||y==="integer"||y==="null"||y==="number"||y==="object"||y==="string")){let d={instancePath:Z+"/type/"+b,schemaPath:"#/definitions/simpleTypes/enum",keyword:"enum",params:{allowedValues:Ny.enum},message:"must be equal to one of the allowed values"};if(Q===null)Q=[d];else Q.push(d);G++}var w=k===G;if(!w)break}if(w){let b=q.length,y;if(b>1)$:for(;b--;)for(y=b;y--;)if(wy(q[b],q[y])){let k={instancePath:Z+"/type",schemaPath:"#/properties/type/anyOf/1/uniqueItems",keyword:"uniqueItems",params:{i:b,j:y},message:"must NOT have duplicate items (items ## "+y+" and "+b+" are identical)"};if(Q===null)Q=[k];else Q.push(k);G++;break $}}}else{let f={instancePath:Z+"/type",schemaPath:"#/properties/type/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array"};if(Q===null)Q=[f];else Q.push(f);G++}var N=_===G;R=R||N}if(!R){let _={instancePath:Z+"/type",schemaPath:"#/properties/type/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(Q===null)Q=[_];else Q.push(_);return G++,U0.errors=Q,!1}else if(G=C,Q!==null)if(C)Q.length=C;else Q=null;var W=M===G}else var W=!0;if(W){if($.format!==void 0){let q=G;if(typeof $.format!=="string")return U0.errors=[{instancePath:Z+"/format",schemaPath:"#/properties/format/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var W=q===G}else var W=!0;if(W){if($.contentMediaType!==void 0){let q=G;if(typeof $.contentMediaType!=="string")return U0.errors=[{instancePath:Z+"/contentMediaType",schemaPath:"#/properties/contentMediaType/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var W=q===G}else var W=!0;if(W){if($.contentEncoding!==void 0){let q=G;if(typeof $.contentEncoding!=="string")return U0.errors=[{instancePath:Z+"/contentEncoding",schemaPath:"#/properties/contentEncoding/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var W=q===G}else var W=!0;if(W){if($.if!==void 0){let q=G;if(!U0($.if,{instancePath:Z+"/if",parentData:$,parentDataProperty:"if",rootData:X}))Q=Q===null?U0.errors:Q.concat(U0.errors),G=Q.length;var W=q===G}else var W=!0;if(W){if($.then!==void 0){let q=G;if(!U0($.then,{instancePath:Z+"/then",parentData:$,parentDataProperty:"then",rootData:X}))Q=Q===null?U0.errors:Q.concat(U0.errors),G=Q.length;var W=q===G}else var W=!0;if(W){if($.else!==void 0){let q=G;if(!U0($.else,{instancePath:Z+"/else",parentData:$,parentDataProperty:"else",rootData:X}))Q=Q===null?U0.errors:Q.concat(U0.errors),G=Q.length;var W=q===G}else var W=!0;if(W){if($.allOf!==void 0){let q=G;if(!e$($.allOf,{instancePath:Z+"/allOf",parentData:$,parentDataProperty:"allOf",rootData:X}))Q=Q===null?e$.errors:Q.concat(e$.errors),G=Q.length;var W=q===G}else var W=!0;if(W){if($.anyOf!==void 0){let q=G;if(!e$($.anyOf,{instancePath:Z+"/anyOf",parentData:$,parentDataProperty:"anyOf",rootData:X}))Q=Q===null?e$.errors:Q.concat(e$.errors),G=Q.length;var W=q===G}else var W=!0;if(W){if($.oneOf!==void 0){let q=G;if(!e$($.oneOf,{instancePath:Z+"/oneOf",parentData:$,parentDataProperty:"oneOf",rootData:X}))Q=Q===null?e$.errors:Q.concat(e$.errors),G=Q.length;var W=q===G}else var W=!0;if(W)if($.not!==void 0){let q=G;if(!U0($.not,{instancePath:Z+"/not",parentData:$,parentDataProperty:"not",rootData:X}))Q=Q===null?U0.errors:Q.concat(U0.errors),G=Q.length;var W=q===G}else var W=!0}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}return U0.errors=Q,G===0}});var a3=S((Zx0,Iy)=>{class Ty extends Error{constructor($,Z){super();this.name="JsonSchemaMergeError",this.code="JSON_SCHEMA_MERGE_ERROR",this.message=`Failed to merge "${$}" keyword schemas.`,this.schemas=Z}}class Ry extends Error{constructor($,Z){super();this.name="JsonSchemaMergeError",this.code="JSON_SCHEMA_MERGE_ERROR",this.message=`Resolver for "${$}" keyword not found.`,this.schemas=Z}}class Py extends Error{constructor($){super();this.name="JsonSchemaMergeError",this.code="JSON_SCHEMA_MERGE_ERROR",this.message=`Invalid "onConflict" option: "${$}".`}}Iy.exports={MergeError:Ty,ResolverNotFoundError:Ry,InvalidOnConflictOptionError:Py}});var by=S((Jx0,Ey)=>{var{dequal:Xz0}=NW(),{MergeError:t3}=a3();function Cy($){let Z=$[0];for(let J=1;J<$.length;J++)Z=Z.filter((Y)=>$[J].includes(Y));return Z}function Qz0($,Z,J){let Y=Cy(Z);if(Y.length===0)throw new t3($,Z);J[$]=Y}function Gz0($,Z,J){for(let X=0;X<Z.length;X++)if(!Array.isArray(Z[X]))Z[X]=[Z[X]];let Y=Cy(Z);if(Y.length===0)throw new t3($,Z);if(Y.length===1)J[$]=Y[0];else J[$]=Y}function Wz0($,Z,J){let Y=[];for(let X of Z)for(let Q of X)if(!Y.includes(Q))Y.push(Q);J[$]=Y}function Kz0($,Z,J){J[$]=Math.min(...Z)}function Vz0($,Z,J){J[$]=Math.max(...Z)}function Uz0($,Z,J){let Y=(W,K)=>!K?W:Y(K,W%K),X=(W,K)=>W*K/Y(W,K),Q=1;for(let W of Z)while(W*Q%1!==0)Q*=10;let G=Z[0]*Q;for(let W of Z)G=X(G,W*Q);J[$]=G/Q}function Hz0($,Z,J){let Y=Z[0];for(let X=1;X<Z.length;X++)if(!Xz0(Z[X],Y))throw new t3($,Z);J[$]=Y}function Bz0(){}function zz0($,Z,J){for(let Y of Z)if(Y===!1){J[$]=!1;return}J[$]=!0}function Fz0($,Z,J){for(let Y of Z)if(Y===!0){J[$]=!0;return}J[$]=!1}Ey.exports={arraysIntersection:Qz0,hybridArraysIntersection:Gz0,arraysUnion:Wz0,minNumber:Kz0,maxNumber:Vz0,commonMultiple:Uz0,allEqual:Hz0,booleanAnd:zz0,booleanOr:Fz0,skip:Bz0}});var yy=S((Yx0,vy)=>{var{dequal:Az0}=NW(),e1=by(),wW=a3(),fy={$id:e1.skip,type:e1.hybridArraysIntersection,enum:e1.arraysIntersection,minLength:e1.maxNumber,maxLength:e1.minNumber,minimum:e1.maxNumber,maximum:e1.minNumber,multipleOf:e1.commonMultiple,exclusiveMinimum:e1.maxNumber,exclusiveMaximum:e1.minNumber,minItems:e1.maxNumber,maxItems:e1.minNumber,maxProperties:e1.minNumber,minProperties:e1.maxNumber,const:e1.allEqual,default:e1.allEqual,format:e1.allEqual,required:e1.arraysUnion,properties:Dz0,patternProperties:DW,additionalProperties:MW,items:jz0,additionalItems:Nz0,definitions:DW,$defs:DW,nullable:e1.booleanAnd,oneOf:_y,anyOf:_y,allOf:e1.arraysUnion,not:MW,if:wz0,then:e1.skip,else:e1.skip,dependencies:Sy,dependentRequired:Sy,dependentSchemas:DW,propertyNames:MW,uniqueItems:e1.booleanOr,contains:MW};function MW($,Z,J,Y,X){J[$]=V6(Z,X)}function Oz0($){let Z=[[]];for(let J of $){let Y=[];for(let X of Z)for(let Q of J)Y.push([...X,Q]);Z=Y}return Z}function _y($,Z,J,Y,X){if(Z.length===1){J[$]=Z[0];return}let Q=Oz0(Z),G=[];for(let W of Q)try{let K=V6(W,X);if(K!==void 0)G.push(K)}catch(K){if(K instanceof wW.MergeError)continue;throw K}J[$]=G}function qz0($,Z){let{items:J,additionalItems:Y}=$;if(Array.isArray(J)){if(Z<J.length)return J[Z];return Y}if(J!==void 0)return J;return Y}function jz0($,Z,J,Y,X){let Q=0;for(let W of Z)if(Array.isArray(W))Q=Math.max(Q,W.length);if(Q===0){J[$]=V6(Z,X);return}let G=[];for(let W=0;W<Q;W++){let K=[];for(let V of Y){let U=qz0(V,W);if(U!==void 0)K.push(U)}G[W]=V6(K,X)}J[$]=G}function Nz0($,Z,J,Y,X){let Q=!1;for(let W of Y)if(Array.isArray(W.items)){Q=!0;break}if(!Q){J[$]=V6(Z,X);return}let G=[];for(let W of Y){let K=W.additionalItems;if(K===void 0&&!Array.isArray(W.items))K=W.items;if(K!==void 0)G.push(K)}J[$]=V6(G,X)}function Mz0($,Z){let{properties:J,patternProperties:Y,additionalProperties:X}=$;if(J?.[Z]!==void 0)return J[Z];for(let Q of Object.keys(Y??{}))if(new RegExp(Q).test(Z))return Y[Q];return X}function Dz0($,Z,J,Y,X){let Q={};for(let W of Y){let K=W.properties??{};for(let V of Object.keys(K)){if(Q[V]!==void 0)continue;let U=K[V];Q[V]=[U];for(let H of Y){if(W===H)continue;let B=Mz0(H,V);if(B!==void 0)Q[V].push(B)}}}let G={};for(let W of Object.keys(Q)){let K=Q[W];G[W]=V6(K,X)}J[$]=G}function DW($,Z,J,Y,X){let Q={};for(let W of Z)for(let K of Object.keys(W)){if(Q[K]===void 0)Q[K]=[];Q[K].push(W[K])}let G={};for(let W of Object.keys(Q)){let K=Q[W],V=V6(K,X);G[W]=V}J[$]=G}function wz0($,Z,J,Y,X){for(let Q=0;Q<Y.length;Q++){let G={if:Y[Q].if,then:Y[Q].then,else:Y[Q].else};if(G.if===void 0)continue;if(J.if===void 0){if(J.if=G.if,G.then!==void 0)J.then=G.then;if(G.else!==void 0)J.else=G.else;continue}if(J.then!==void 0)J.then=V6([J.then,G],X);if(J.else!==void 0)J.else=V6([J.else,G],X)}}function Sy($,Z,J){let Y={};for(let X of Z)for(let Q of Object.keys(X)){if(Y[Q]===void 0)Y[Q]=[];let G=Y[Q];for(let W of X[Q])if(!G.includes(W))G.push(W)}J[$]=Y}function V6($,Z){if($.length===0)return{};if($.length===1)return $[0];let J={},Y={},X=!0;for(let Q of $){if(Q===!1)return!1;if(Q===!0)continue;X=!1;for(let G of Object.keys(Q)){if(Y[G]===void 0)Y[G]=[];Y[G].push(Q[G])}}if(X)return!0;for(let Q of Object.keys(Y)){let G=Y[Q];(Z.resolvers[Q]??Z.defaultResolver)(Q,G,J,$,Z)}return J}function ky($,Z,J,Y,X){let Q=X.onConflict??"throw";if(Z.length===1||Q==="first"){J[$]=Z[0];return}let G=!0;for(let W=1;W<Z.length;W++)if(!Az0(Z[W],Z[0])){G=!1;break}if(G){J[$]=Z[0];return}if(Q==="throw")throw new wW.ResolverNotFoundError($,Z);if(Q==="skip")return;throw new wW.InvalidOnConflictOptionError(Q)}function Lz0($,Z={}){if(Z.defaultResolver===void 0)Z.defaultResolver=ky;return Z.resolvers={...fy,...Z.resolvers},V6($,Z)}vy.exports={mergeSchemas:Lz0,keywordsResolvers:fy,defaultResolver:ky,...wW}});var hy=S((Xx0,xy)=>{var{mergeSchemas:Tz0}=yy();function Rz0($){return Tz0($,{onConflict:"skip"})}xy.exports=Rz0});var gy=S((Qx0,e3)=>{function Pz0($,Z,J,Y){let X="";if(Z.validatorSchemasIds.size>0)X+=`const Validator = require('fast-json-stringify/lib/validator')
|
|
120
|
+
`,X+=`const validatorState = ${JSON.stringify(Y.getState())}
|
|
121
|
+
`,X+=`const validator = Validator.restoreFromState(validatorState)
|
|
122
|
+
`;else X+=`const validator = null
|
|
123
|
+
`;let{schema:Q,...G}=J.getState();return`
|
|
124
|
+
'use strict'
|
|
125
|
+
|
|
126
|
+
const Serializer = require('fast-json-stringify/lib/serializer')
|
|
127
|
+
const serializerState = ${JSON.stringify(G)}
|
|
128
|
+
const serializer = Serializer.restoreFromState(serializerState)
|
|
129
|
+
|
|
130
|
+
${X}
|
|
131
|
+
|
|
132
|
+
module.exports = ${$.toString()}(validator, serializer)`}e3.exports=Pz0;e3.exports.dependencies={Serializer:VG(),Validator:n3()}});var oy=S((Gx0,JY)=>{var{RefResolver:Iz0}=Ay(),Cz0=VG(),Ez0=n3(),V7=jy(),uy=Ly(),bz0=hy(),_z0=/'/g,TQ=20000,LW="default",Sz0=`
|
|
133
|
+
const {
|
|
134
|
+
asString,
|
|
135
|
+
asNumber,
|
|
136
|
+
asBoolean,
|
|
137
|
+
asDateTime,
|
|
138
|
+
asDate,
|
|
139
|
+
asTime,
|
|
140
|
+
asUnsafeString
|
|
141
|
+
} = serializer
|
|
142
|
+
|
|
143
|
+
const asInteger = serializer.asInteger.bind(serializer)
|
|
144
|
+
|
|
145
|
+
`,fz0=new Set(["floor","ceil","round","trunc"]),py=new Set(["default","json-stringify"]),RQ=0;function $F($,Z){if(!uy($)){if(Z)Z=`"${Z}" `;else Z="";let J=uy.errors[0],Y=Error(`${Z}schema is invalid: data${J.instancePath} ${J.message}`);throw Y.errors=$F.errors,Y}}function HZ($,Z){let J=Z.schema.$ref,Y=J.indexOf("#");if(Y===-1)Y=J.length;let X=J.slice(0,Y)||Z.schemaId,Q=J.slice(Y)||"#",G=$.refResolver.getSchema(X,Q);if(G===null)throw Error(`Cannot find reference "${J}"`);let W=new V7(G,X,Q);if(G.$ref!==void 0)return HZ($,W);return W}function TW($,Z){let J=$.refResolver.getSchema(Z,"#");return new V7(J,Z,"#")}function my($,Z){if($.$id&&$.$id.charAt(0)!=="#")return $.$id;return Z}function PQ($,Z){let J=Z.getSchemaRef()||"";if(J.startsWith($.rootSchemaId))J=J.replace($.rootSchemaId,"")||"#";return J}function JF($,Z){$F($),Z=Z||{};let J={functions:[],functionsCounter:0,functionsNamesBySchema:new Map,options:Z,refResolver:new Iz0,rootSchemaId:$.$id||`__fjs_root_${RQ++}`,validatorSchemasIds:new Set,mergedSchemasIds:new Map,recursiveSchemas:new Set,recursivePaths:new Set,buildingSet:new Set,uid:0},Y=my($,J.rootSchemaId);if(!J.refResolver.hasSchema(Y))J.refResolver.addSchema($,J.rootSchemaId);if(Z.schema)for(let U in Z.schema){let H=Z.schema[U],B=my(H,U);if(!J.refResolver.hasSchema(B))$F(H,U),J.refResolver.addSchema(H,U)}if(Z.rounding){if(!fz0.has(Z.rounding))throw Error(`Unsupported integer rounding method ${Z.rounding}`)}if(Z.largeArrayMechanism)if(py.has(Z.largeArrayMechanism))LW=Z.largeArrayMechanism;else throw Error(`Unsupported large array mechanism ${Z.largeArrayMechanism}`);if(Z.largeArraySize){let U=typeof Z.largeArraySize,H;if(U==="string"&&Number.isFinite(H=Number.parseInt(Z.largeArraySize,10)))TQ=H;else if(U==="number"&&Number.isInteger(Z.largeArraySize))TQ=Z.largeArraySize;else if(U==="bigint")TQ=Number(Z.largeArraySize);else throw Error(`Unsupported large array size. Expected integer-like, got ${typeof Z.largeArraySize} with value ${Z.largeArraySize}`)}let X=new V7($,J.rootSchemaId);dz0(J,X);let Q=c$(J,X,"input"),G=`
|
|
146
|
+
${Sz0}
|
|
147
|
+
const JSON_STR_BEGIN_OBJECT = '{'
|
|
148
|
+
const JSON_STR_END_OBJECT = '}'
|
|
149
|
+
const JSON_STR_BEGIN_ARRAY = '['
|
|
150
|
+
const JSON_STR_END_ARRAY = ']'
|
|
151
|
+
const JSON_STR_COMMA = ','
|
|
152
|
+
const JSON_STR_COLONS = ':'
|
|
153
|
+
const JSON_STR_QUOTE = '"'
|
|
154
|
+
const JSON_STR_EMPTY_OBJECT = JSON_STR_BEGIN_OBJECT + JSON_STR_END_OBJECT
|
|
155
|
+
const JSON_STR_EMPTY_ARRAY = JSON_STR_BEGIN_ARRAY + JSON_STR_END_ARRAY
|
|
156
|
+
const JSON_STR_EMPTY_STRING = JSON_STR_QUOTE + JSON_STR_QUOTE
|
|
157
|
+
const JSON_STR_NULL = 'null'
|
|
158
|
+
`;if(Q==="json += anonymous0(input)")G+=`
|
|
159
|
+
${J.functions.join(`
|
|
160
|
+
`)}
|
|
161
|
+
const main = anonymous0
|
|
162
|
+
return main
|
|
163
|
+
`;else G+=`
|
|
164
|
+
function main (input) {
|
|
165
|
+
let json = ''
|
|
166
|
+
${Q}
|
|
167
|
+
return json
|
|
168
|
+
}
|
|
169
|
+
${J.functions.join(`
|
|
170
|
+
`)}
|
|
171
|
+
return main
|
|
172
|
+
`;let W=new Cz0(Z),K=new Ez0(Z.ajv);for(let U of J.validatorSchemasIds){let H=J.refResolver.getSchema(U);K.addSchema(H,U);let B=J.refResolver.getSchemaDependencies(U);for(let[z,F]of Object.entries(B))K.addSchema(F,z)}if(Z.debugMode)Z.mode="debug";if(Z.mode==="debug")return{validator:K,serializer:W,code:`validator
|
|
173
|
+
serializer
|
|
174
|
+
${G}`,ajv:K.ajv};let V=Function("validator","serializer",G);if(Z.mode==="standalone")return gy()(V,J,W,K);return V(K,W)}var kz0=["properties","required","additionalProperties","patternProperties","maxProperties","minProperties","dependencies"],vz0=["items","additionalItems","maxItems","minItems","uniqueItems","contains"],yz0=["maxLength","minLength","pattern"],xz0=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum"];function hz0($){for(let Z of kz0)if(Z in $)return"object";for(let Z of vz0)if(Z in $)return"array";for(let Z of yz0)if(Z in $)return"string";for(let Z of xz0)if(Z in $)return"number";return $.type}function gz0($,Z,J,Y){let X=Z.schema,Q=Object.keys(X.properties||{}),G=`
|
|
175
|
+
for (const key of Object.keys(${Y})) {
|
|
176
|
+
if (
|
|
177
|
+
${Q.length>0?Q.map((H)=>`key === ${JSON.stringify(H)}`).join(" || ")+" ||":""}
|
|
178
|
+
${Y}[key] === undefined ||
|
|
179
|
+
typeof ${Y}[key] === 'function' ||
|
|
180
|
+
typeof ${Y}[key] === 'symbol'
|
|
181
|
+
) continue
|
|
182
|
+
const value = ${Y}[key]
|
|
183
|
+
`,W=Z.getPropertyLocation("patternProperties"),K=W.schema;if(K!==void 0)for(let H in K){let B=W.getPropertyLocation(H);G+=`
|
|
184
|
+
if (/${H.replace(/\\*\//g,"\\/")}/.test(key)) {
|
|
185
|
+
${J}
|
|
186
|
+
json += asString(key) + JSON_STR_COLONS
|
|
187
|
+
${c$($,B,"value")}
|
|
188
|
+
continue
|
|
189
|
+
}
|
|
190
|
+
`}let U=Z.getPropertyLocation("additionalProperties").schema;if(U!==void 0)if(U===!0)G+=`
|
|
191
|
+
${J}
|
|
192
|
+
json += asString(key) + JSON_STR_COLONS + JSON.stringify(value)
|
|
193
|
+
`;else{let H=Z.getPropertyLocation("additionalProperties");G+=`
|
|
194
|
+
${J}
|
|
195
|
+
json += asString(key) + JSON_STR_COLONS
|
|
196
|
+
${c$($,H,"value")}
|
|
197
|
+
`}return G+=`
|
|
198
|
+
}
|
|
199
|
+
`,G}function ly($,Z,J){let Y=Z.schema,X=Z.getPropertyLocation("properties"),Q=Y.required||[],G=Object.keys(Y.properties||{}).sort((U,H)=>{let B=Q.includes(U),z=Q.includes(H);return B===z?0:B?-1:1}),W="";for(let U of Q)if(!G.includes(U)){let H=JSON.stringify(U);W+=`if (${J}[${H}] === undefined) throw new Error('${H.replace(/'/g,"\\'")} is required!')
|
|
200
|
+
`}W+=`json += JSON_STR_BEGIN_OBJECT
|
|
201
|
+
`;let K=$.uid++,V="";if(Q.length>0){for(let U=0;U<G.length;U++){let H=G[U],B=X.getPropertyLocation(H),z=B;if(B.schema.$ref)z=HZ($,B);let F=JSON.stringify(H),A=`value_${H.replace(/[^a-zA-Z0-9]/g,"_")}_${$.uid++}`,j=z.schema.default,N=Q.includes(H),w=U===0?"":"json += JSON_STR_COMMA";if(W+=`
|
|
202
|
+
const ${A} = ${J}[${F}]
|
|
203
|
+
if (${A} !== undefined) {
|
|
204
|
+
${w}
|
|
205
|
+
json += ${JSON.stringify(F+":")}
|
|
206
|
+
${c$($,z,`${A}`)}
|
|
207
|
+
}`,j!==void 0)W+=` else {
|
|
208
|
+
${w}
|
|
209
|
+
json += ${JSON.stringify(F+":"+JSON.stringify(j))}
|
|
210
|
+
}
|
|
211
|
+
`;else if(N)W+=` else {
|
|
212
|
+
throw new Error('${F.replace(/'/g,"\\'")} is required!')
|
|
213
|
+
}
|
|
214
|
+
`;else W+=`
|
|
215
|
+
`}V="json += JSON_STR_COMMA"}else{if(G.length>1||Y.patternProperties||Y.additionalProperties!==void 0&&Y.additionalProperties!==!1)W+=`let addComma_${K} = false
|
|
216
|
+
`,V=`!addComma_${K} && (addComma_${K} = true) || (json += JSON_STR_COMMA)`;for(let H of G){let B=X.getPropertyLocation(H);if(B.schema.$ref)B=HZ($,B);let z=JSON.stringify(H),F=`value_${H.replace(/[^a-zA-Z0-9]/g,"_")}_${$.uid++}`,A=B.schema.default,j=Q.includes(H);if(W+=`
|
|
217
|
+
const ${F} = ${J}[${z}]
|
|
218
|
+
if (${F} !== undefined) {
|
|
219
|
+
${V}
|
|
220
|
+
json += ${JSON.stringify(z+":")}
|
|
221
|
+
${c$($,B,`${F}`)}
|
|
222
|
+
}`,A!==void 0)W+=` else {
|
|
223
|
+
${V}
|
|
224
|
+
json += ${JSON.stringify(z+":"+JSON.stringify(A))}
|
|
225
|
+
}
|
|
226
|
+
`;else if(j)W+=` else {
|
|
227
|
+
throw new Error('${z.replace(/'/g,"\\'")} is required!')
|
|
228
|
+
}
|
|
229
|
+
`;else W+=`
|
|
230
|
+
`}}if(Y.patternProperties||Y.additionalProperties)W+=gz0($,Z,V,J);return W+=`
|
|
231
|
+
json += JSON_STR_END_OBJECT
|
|
232
|
+
`,W}function RW($,Z,J){for(let G=0,W=J.length;G<W;G++){let K=J[G];if(K.schema.$ref)J[G]=HZ($,K)}let Y=[];for(let G of J){let W=cy($,G.schema,G.schemaId);delete W.$id,Y.push(W)}let X=bz0(Y),Q=new V7(X,Z);return $.refResolver.addSchema(X,Z),Q}function cy($,Z,J){let Y=Array.isArray(Z)?[]:{};if(Z.$id!==void 0&&Z.$id.charAt(0)!=="#")J=Z.$id;let X=$.mergedSchemasIds.get(Z);if(X)$.mergedSchemasIds.set(Y,X);for(let Q in Z){let G=Z[Q];if(Q==="$ref"&&typeof G==="string"&&G.charAt(0)==="#")G=J+G;if(typeof G==="object"&&G!==null)G=cy($,G,J);Y[Q]=G}return Y}function dy($){return`(${$} && typeof ${$}.toJSON === 'function')
|
|
233
|
+
? ${$}.toJSON()
|
|
234
|
+
: ${$}
|
|
235
|
+
`}function uz0($,Z,J){let Y=Z.schema;if($.functionsNamesBySchema.has(Y))return`json += ${$.functionsNamesBySchema.get(Y)}(${J})`;let X=Y.nullable===!0,Q=Z.schemaId||"",G=Z.jsonPointer||"",W=`${Q}#${G}`;if($.recursivePaths.has(W)||$.buildingSet.has(Y)||Q!==""){let U=iy($);$.functionsNamesBySchema.set(Y,U);let B=`
|
|
236
|
+
// ${PQ($,Z)}
|
|
237
|
+
function ${U} (input) {
|
|
238
|
+
const obj = ${dy("input")}
|
|
239
|
+
if (obj === null) return ${X?"JSON_STR_NULL":"JSON_STR_EMPTY_OBJECT"}
|
|
240
|
+
let json = ''
|
|
241
|
+
|
|
242
|
+
${ly($,Z,"obj")}
|
|
243
|
+
return json
|
|
244
|
+
}
|
|
245
|
+
`;return $.functions.push(B),`json += ${U}(${J})`}$.buildingSet.add(Y);let K=`obj_${$.uid++}`,V=`
|
|
246
|
+
const ${K} = ${dy(J)}
|
|
247
|
+
if (${K} === null) {
|
|
248
|
+
json += ${X?"JSON_STR_NULL":"JSON_STR_EMPTY_OBJECT"}
|
|
249
|
+
} else {
|
|
250
|
+
${ly($,Z,K)}
|
|
251
|
+
}
|
|
252
|
+
`;return $.buildingSet.delete(Y),V}function mz0($,Z,J){let Y=Z.schema,X=Z.getPropertyLocation("items");if(X.schema=X.schema||{},X.schema.$ref)X=HZ($,X);let Q=X.schema;if($.functionsNamesBySchema.has(Y))return`json += ${$.functionsNamesBySchema.get(Y)}(${J})`;let G=Y.nullable===!0,W=Z.schemaId||"",K=Z.jsonPointer||"",V=`${W}#${K}`;if($.recursivePaths.has(V)||$.buildingSet.has(Y)||W!==""){let z=iy($);$.functionsNamesBySchema.set(Y,z);let F=PQ($,Z),A=`
|
|
253
|
+
function ${z} (obj) {
|
|
254
|
+
// ${F}
|
|
255
|
+
let json = ''
|
|
256
|
+
`;if(A+=`
|
|
257
|
+
if (obj === null) return ${G?"JSON_STR_NULL":"JSON_STR_EMPTY_ARRAY"}
|
|
258
|
+
if (!Array.isArray(obj)) {
|
|
259
|
+
throw new TypeError(\`The value of '${F}' does not match schema definition.\`)
|
|
260
|
+
}
|
|
261
|
+
const arrayLength = obj.length
|
|
262
|
+
`,!Y.additionalItems&&Array.isArray(Q))A+=`
|
|
263
|
+
if (arrayLength > ${Q.length}) {
|
|
264
|
+
throw new Error(\`Item at ${Q.length} does not match schema definition.\`)
|
|
265
|
+
}
|
|
266
|
+
`;if(LW==="json-stringify")A+=`if (arrayLength >= ${TQ}) return JSON.stringify(obj)
|
|
267
|
+
`;if(A+=`
|
|
268
|
+
json += JSON_STR_BEGIN_ARRAY
|
|
269
|
+
`,Array.isArray(Q)){for(let j=0,N=Q.length;j<N;j++){let w=Q[j],q=X.getPropertyLocation(j);if(q.schema.$ref)q=HZ($,q),w=q.schema;let M=`value_${j}`;A+=`const ${M} = obj[${j}]`;let C=c$($,q,M);A+=`
|
|
270
|
+
if (${j} < arrayLength) {
|
|
271
|
+
if (${ZF(w.type,M)}) {
|
|
272
|
+
if (${j}) {
|
|
273
|
+
json += JSON_STR_COMMA
|
|
274
|
+
}
|
|
275
|
+
${C}
|
|
276
|
+
} else {
|
|
277
|
+
throw new Error(\`Item at ${j} does not match schema definition.\`)
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
`}if(Y.additionalItems)A+=`
|
|
281
|
+
for (let i = ${Q.length}; i < arrayLength; i++) {
|
|
282
|
+
if (i) {
|
|
283
|
+
json += JSON_STR_COMMA
|
|
284
|
+
}
|
|
285
|
+
json += JSON.stringify(obj[i])
|
|
286
|
+
}`}else{let j=c$($,X,"value");A+=`
|
|
287
|
+
if (arrayLength > 0) {
|
|
288
|
+
const value = obj[0]
|
|
289
|
+
${j}
|
|
290
|
+
for (let i = 1; i < arrayLength; i++) {
|
|
291
|
+
json += JSON_STR_COMMA
|
|
292
|
+
const value = obj[i]
|
|
293
|
+
${j}
|
|
294
|
+
}
|
|
295
|
+
}`}return A+=`
|
|
296
|
+
return json + JSON_STR_END_ARRAY
|
|
297
|
+
}`,$.functions.push(A),`json += ${z}(${J})`}$.buildingSet.add(Y);let U=PQ($,Z),H=`obj_${$.uid++}`,B=`
|
|
298
|
+
const ${H} = ${J}
|
|
299
|
+
if (${H} === null) {
|
|
300
|
+
json += ${G?"JSON_STR_NULL":"JSON_STR_EMPTY_ARRAY"}
|
|
301
|
+
} else if (!Array.isArray(${H})) {
|
|
302
|
+
throw new TypeError(\`The value of '${U}' does not match schema definition.\`)
|
|
303
|
+
} else {
|
|
304
|
+
const arrayLength_${H} = ${H}.length
|
|
305
|
+
`;if(!Y.additionalItems&&Array.isArray(Q))B+=`
|
|
306
|
+
if (arrayLength_${H} > ${Q.length}) {
|
|
307
|
+
throw new Error(\`Item at ${Q.length} does not match schema definition.\`)
|
|
308
|
+
}
|
|
309
|
+
`;if(LW==="json-stringify")B+=`if (arrayLength_${H} >= ${TQ}) json += JSON.stringify(${H})
|
|
310
|
+
else {`;if(B+=`
|
|
311
|
+
json += JSON_STR_BEGIN_ARRAY
|
|
312
|
+
`,Array.isArray(Q)){let z=$.uid++;B+=`let addComma_${z} = false
|
|
313
|
+
`;for(let F=0,A=Q.length;F<A;F++){let j=Q[F],N=X.getPropertyLocation(F);if(N.schema.$ref)N=HZ($,N),j=N.schema;let w=`value_${F}_${$.uid++}`;B+=`const ${w} = ${H}[${F}]`;let q=c$($,N,w);B+=`
|
|
314
|
+
if (${F} < arrayLength_${H}) {
|
|
315
|
+
if (${ZF(j.type,w)}) {
|
|
316
|
+
!addComma_${z} && (addComma_${z} = true) || (json += JSON_STR_COMMA)
|
|
317
|
+
${q}
|
|
318
|
+
} else {
|
|
319
|
+
throw new Error(\`Item at ${F} does not match schema definition.\`)
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
`}if(Y.additionalItems)B+=`
|
|
323
|
+
for (let i = ${Q.length}; i < arrayLength_${H}; i++) {
|
|
324
|
+
!addComma_${z} && (addComma_${z} = true) || (json += JSON_STR_COMMA)
|
|
325
|
+
json += JSON.stringify(${H}[i])
|
|
326
|
+
}`}else{let z=c$($,X,"value");B+=`
|
|
327
|
+
if (arrayLength_${H} > 0) {
|
|
328
|
+
const value = ${H}[0]
|
|
329
|
+
${z}
|
|
330
|
+
for (let i = 1; i < arrayLength_${H}; i++) {
|
|
331
|
+
json += JSON_STR_COMMA
|
|
332
|
+
const value = ${H}[i]
|
|
333
|
+
${z}
|
|
334
|
+
}
|
|
335
|
+
}`}if(B+=`
|
|
336
|
+
json += JSON_STR_END_ARRAY
|
|
337
|
+
`,LW==="json-stringify")B+="}";return B+="}",$.buildingSet.delete(Y),B}function ZF($,Z){let J;switch($){case"null":J=`${Z} === null`;break;case"string":J=`typeof ${Z} === 'string' ||
|
|
338
|
+
${Z} === null ||
|
|
339
|
+
${Z} instanceof Date ||
|
|
340
|
+
${Z} instanceof RegExp ||
|
|
341
|
+
(
|
|
342
|
+
typeof ${Z} === "object" &&
|
|
343
|
+
typeof ${Z}.toString === "function" &&
|
|
344
|
+
${Z}.toString !== Object.prototype.toString
|
|
345
|
+
)`;break;case"integer":J=`Number.isInteger(${Z})`;break;case"number":J=`Number.isFinite(${Z})`;break;case"boolean":J=`typeof ${Z} === 'boolean'`;break;case"object":J=`${Z} && typeof ${Z} === 'object' && ${Z}.constructor === Object`;break;case"array":J=`Array.isArray(${Z})`;break;default:if(Array.isArray($))J=`(${$.map((X)=>{return ZF(X,Z)}).join(" || ")})`}return J}function iy($){return"anonymous"+$.functionsCounter++}function lz0($,Z,J){let X=Z.schema.type.sort((G)=>G==="null"?-1:1),Q="";return X.forEach((G,W)=>{Z.schema={...Z.schema,type:G};let K=ny($,Z,J),V=W===0?"if":"else if";switch(G){case"null":Q+=`
|
|
346
|
+
${V} (${J} === null) {
|
|
347
|
+
${K}
|
|
348
|
+
}
|
|
349
|
+
`;break;case"string":{Q+=`
|
|
350
|
+
${V}(
|
|
351
|
+
typeof ${J} === "string" ||
|
|
352
|
+
${J} === null ||
|
|
353
|
+
${J} instanceof Date ||
|
|
354
|
+
${J} instanceof RegExp ||
|
|
355
|
+
(
|
|
356
|
+
typeof ${J} === "object" &&
|
|
357
|
+
typeof ${J}.toString === "function" &&
|
|
358
|
+
${J}.toString !== Object.prototype.toString
|
|
359
|
+
)
|
|
360
|
+
) {
|
|
361
|
+
${K}
|
|
362
|
+
}
|
|
363
|
+
`;break}case"array":{Q+=`
|
|
364
|
+
${V}(Array.isArray(${J})) {
|
|
365
|
+
${K}
|
|
366
|
+
}
|
|
367
|
+
`;break}case"integer":{Q+=`
|
|
368
|
+
${V}(Number.isInteger(${J}) || ${J} === null) {
|
|
369
|
+
${K}
|
|
370
|
+
}
|
|
371
|
+
`;break}default:{Q+=`
|
|
372
|
+
${V}(typeof ${J} === "${G}" || ${J} === null) {
|
|
373
|
+
${K}
|
|
374
|
+
}
|
|
375
|
+
`;break}}}),Q+=`
|
|
376
|
+
else throw new TypeError(\`The value of '${PQ($,Z)}' does not match schema definition.\`)
|
|
377
|
+
`,Q}function ny($,Z,J){let Y=Z.schema;switch(Y.type){case"null":return"json += JSON_STR_NULL";case"string":if(Y.format==="date-time")return`json += asDateTime(${J})`;else if(Y.format==="date")return`json += asDate(${J})`;else if(Y.format==="time")return`json += asTime(${J})`;else if(Y.format==="unsafe")return`json += asUnsafeString(${J})`;else return`
|
|
378
|
+
if (typeof ${J} !== 'string') {
|
|
379
|
+
if (${J} === null) {
|
|
380
|
+
json += JSON_STR_EMPTY_STRING
|
|
381
|
+
} else if (${J} instanceof Date) {
|
|
382
|
+
json += JSON_STR_QUOTE + ${J}.toISOString() + JSON_STR_QUOTE
|
|
383
|
+
} else if (${J} instanceof RegExp) {
|
|
384
|
+
json += asString(${J}.source)
|
|
385
|
+
} else {
|
|
386
|
+
json += asString(${J}.toString())
|
|
387
|
+
}
|
|
388
|
+
} else {
|
|
389
|
+
json += asString(${J})
|
|
390
|
+
}
|
|
391
|
+
`;case"integer":return`json += asInteger(${J})`;case"number":return`json += asNumber(${J})`;case"boolean":return`json += asBoolean(${J})`;case"object":return uz0($,Z,J);case"array":return mz0($,Z,J);case void 0:return`json += JSON.stringify(${J})`;default:throw Error(`${Y.type} unsupported`)}}function dz0($,Z){let J=new Set;function Y(X){let Q=X.schema;if(typeof Q!=="object"||Q===null)return;let G=X.schemaId||"",W=X.jsonPointer||"",K=`${G}#${W}`;if(J.has(K)){let V=!1;for(let U of J){if(U===K)V=!0;if(V)$.recursivePaths.add(U)}$.recursivePaths.add(K);return}if(J.add(K),Q.$ref)try{let V=HZ($,X);Y(V)}catch(V){}if(Q.properties){let V=X.getPropertyLocation("properties");for(let U in Q.properties)Y(V.getPropertyLocation(U))}if(Q.additionalProperties&&typeof Q.additionalProperties==="object")Y(X.getPropertyLocation("additionalProperties"));if(Q.patternProperties){let V=X.getPropertyLocation("patternProperties");for(let U in Q.patternProperties)Y(V.getPropertyLocation(U))}if(Q.items){let V=X.getPropertyLocation("items");if(Array.isArray(Q.items))for(let U=0;U<Q.items.length;U++)Y(V.getPropertyLocation(U));else Y(V)}if(Q.additionalItems&&typeof Q.additionalItems==="object")Y(X.getPropertyLocation("additionalItems"));if(Q.oneOf){let V=X.getPropertyLocation("oneOf");for(let U=0;U<Q.oneOf.length;U++)Y(V.getPropertyLocation(U))}if(Q.anyOf){let V=X.getPropertyLocation("anyOf");for(let U=0;U<Q.anyOf.length;U++)Y(V.getPropertyLocation(U))}if(Q.allOf){let V=X.getPropertyLocation("allOf");for(let U=0;U<Q.allOf.length;U++)Y(V.getPropertyLocation(U))}if(Q.then)Y(X.getPropertyLocation("then"));if(Q.else)Y(X.getPropertyLocation("else"));J.delete(K)}Y(Z)}function pz0($,Z){let J=$.schema,Y=J.type,X=Array.isArray(Y)&&Y.includes("null"),Q="";if(X)Q+=`
|
|
392
|
+
if (${Z} === null) {
|
|
393
|
+
json += JSON_STR_NULL
|
|
394
|
+
} else {
|
|
395
|
+
`;if(Q+=`json += '${JSON.stringify(J.const).replace(_z0,"\\'")}'`,X)Q+=`
|
|
396
|
+
}
|
|
397
|
+
`;return Q}function cz0($,Z,J){let Y=Z.schema,X=$.mergedSchemasIds.get(Y);if(X){let U=TW($,X);return c$($,U,J)}X=`__fjs_merged_${RQ++}`,$.mergedSchemasIds.set(Y,X);let{allOf:Q,...G}=Z.schema,W=[new V7(G,Z.schemaId,Z.jsonPointer)],K=Z.getPropertyLocation("allOf");for(let U=0,H=Q.length;U<H;U++)W.push(K.getPropertyLocation(U));let V=RW($,X,W);return c$($,V,J)}function iz0($,Z,J){$.validatorSchemasIds.add(Z.schemaId);let X=Z.schema.anyOf?"anyOf":"oneOf",{[X]:Q,...G}=Z.schema,W=new V7(G,Z.schemaId,Z.jsonPointer),K=Z.getPropertyLocation(X),V="";for(let U=0,H=Q.length;U<H;U++){let B=K.getPropertyLocation(U),z=B.schema,F=$.mergedSchemasIds.get(z),A=null;if(F)A=TW($,F);else F=`__fjs_merged_${RQ++}`,$.mergedSchemasIds.set(z,F),A=RW($,F,[W,B]);let j=c$($,A,J),N=B.getSchemaRef();V+=`
|
|
398
|
+
${U===0?"if":"else if"}(validator.validate("${N}", ${J})) {
|
|
399
|
+
${j}
|
|
400
|
+
}
|
|
401
|
+
`}return V+=`
|
|
402
|
+
else throw new TypeError(\`The value of '${PQ($,Z)}' does not match schema definition.\`)
|
|
403
|
+
`,V}function nz0($,Z,J){$.validatorSchemasIds.add(Z.schemaId);let{if:Y,then:X,else:Q,...G}=Z.schema,W=new V7(G,Z.schemaId,Z.jsonPointer),V=Z.getPropertyLocation("if").getSchemaRef(),U=Z.getPropertyLocation("then"),H=$.mergedSchemasIds.get(X),B=null;if(H)B=TW($,H);else H=`__fjs_merged_${RQ++}`,$.mergedSchemasIds.set(X,H),B=RW($,H,[W,U]);if(!Q)return`
|
|
404
|
+
if (validator.validate("${V}", ${J})) {
|
|
405
|
+
${c$($,B,J)}
|
|
406
|
+
} else {
|
|
407
|
+
${c$($,W,J)}
|
|
408
|
+
}
|
|
409
|
+
`;let z=Z.getPropertyLocation("else"),F=$.mergedSchemasIds.get(Q),A=null;if(F)A=TW($,F);else F=`__fjs_merged_${RQ++}`,$.mergedSchemasIds.set(Q,F),A=RW($,F,[W,z]);return`
|
|
410
|
+
if (validator.validate("${V}", ${J})) {
|
|
411
|
+
${c$($,B,J)}
|
|
412
|
+
} else {
|
|
413
|
+
${c$($,A,J)}
|
|
414
|
+
}
|
|
415
|
+
`}function c$($,Z,J){let Y=Z.schema;if(typeof Y==="boolean")return`json += JSON.stringify(${J})`;if(Y.$ref)Z=HZ($,Z),Y=Z.schema;if(Y.allOf)return cz0($,Z,J);if(Y.anyOf||Y.oneOf)return iz0($,Z,J);if(Y.if&&Y.then)return nz0($,Z,J);if(Y.type===void 0){let W=hz0(Y);if(W)Y.type=W}let X="",Q=Y.type,G=Y.nullable===!0;if(G)X+=`
|
|
416
|
+
if (${J} === null) {
|
|
417
|
+
json += JSON_STR_NULL
|
|
418
|
+
} else {
|
|
419
|
+
`;if(Y.const!==void 0)X+=pz0(Z,J);else if(Array.isArray(Q))X+=lz0($,Z,J);else X+=ny($,Z,J);if(G)X+=`
|
|
420
|
+
}
|
|
421
|
+
`;return X}JY.exports=JF;JY.exports.default=JF;JY.exports.build=JF;JY.exports.validLargeArrayMechanisms=py;JY.exports.restore=function({code:$,validator:Z,serializer:J}){return Function.apply(null,["validator","serializer",$]).apply(null,[Z,J])}});var ay=S((rz0,PW)=>{var oz0=oy();function sy(){return function(Z,J){let Y=Object.assign({},J,{schema:Z});return sz0.bind(null,Y)}}function sz0($,{schema:Z}){if($.schema&&Z.$id&&$.schema[Z.$id])$.schema={...$.schema},delete $.schema[Z.$id];return oz0(Z,$)}function ry($={readMode:!0}){if($.readMode===!0&&typeof $.restoreFunction!=="function")throw Error("You must provide a function for the restoreFunction-option when readMode ON");if($.readMode!==!0&&typeof $.storeFunction!=="function")throw Error("You must provide a function for the storeFunction-option when readMode OFF");if($.readMode===!0)return function(){return function(Y){return $.restoreFunction(Y)}};let Z=sy();return function(Y,X={}){X.mode="standalone";let Q=Z(Y,X);return function(G){let W=Q(G);return $.storeFunction(G,W),Function(W)}}}rz0.SerializerSelector=sy;rz0.StandaloneSerializer=ry;rz0.default=ry});var ty=S((Wx0,IQ)=>{var{SerializerSelector:YF,StandaloneSerializer:$30}=ay();IQ.exports=YF;IQ.exports.default=YF;IQ.exports.SerializerSelector=YF;IQ.exports.StandaloneSerializer=$30});var XF=S((Kx0,ey)=>{var{buildSchemas:Z30}=xX();function J30($,Z){if($)return new CQ($,Z);let J=Object.assign({buildValidator:null,buildSerializer:null},Z?.compilersFactory);if(!J.buildValidator){let X=p3();J.buildValidator=X()}if(!J.buildSerializer){let X=ty();J.buildSerializer=X()}let Y={bucket:Z&&Z.bucket||Z30,compilersFactory:J,isCustomValidatorCompiler:typeof Z?.compilersFactory?.buildValidator==="function",isCustomSerializerCompiler:typeof Z?.compilersFactory?.buildValidator==="function"};return new CQ(void 0,Y)}class CQ{constructor($,Z){if(this.opts=Z||$?.opts,this.addedSchemas=!1,this.compilersFactory=this.opts.compilersFactory,$)this.schemaBucket=this.opts.bucket($.getSchemas()),this.validatorCompiler=$.getValidatorCompiler(),this.serializerCompiler=$.getSerializerCompiler(),this.isCustomValidatorCompiler=$.isCustomValidatorCompiler,this.isCustomSerializerCompiler=$.isCustomSerializerCompiler,this.parent=$;else this.schemaBucket=this.opts.bucket(),this.isCustomValidatorCompiler=this.opts.isCustomValidatorCompiler||!1,this.isCustomSerializerCompiler=this.opts.isCustomSerializerCompiler||!1}add($){return this.addedSchemas=!0,this.schemaBucket.add($)}getSchema($){return this.schemaBucket.getSchema($)}getSchemas(){return this.schemaBucket.getSchemas()}setValidatorCompiler($){this.compilersFactory=Object.assign({},this.compilersFactory,{buildValidator:()=>$}),this.validatorCompiler=$,this.isCustomValidatorCompiler=!0}setSerializerCompiler($){this.compilersFactory=Object.assign({},this.compilersFactory,{buildSerializer:()=>$}),this.serializerCompiler=$,this.isCustomSerializerCompiler=!0}getValidatorCompiler(){return this.validatorCompiler||this.parent&&this.parent.getValidatorCompiler()}getSerializerCompiler(){return this.serializerCompiler||this.parent&&this.parent.getSerializerCompiler()}getSerializerBuilder(){return this.compilersFactory.buildSerializer||this.parent&&this.parent.getSerializerBuilder()}getValidatorBuilder(){return this.compilersFactory.buildValidator||this.parent&&this.parent.getValidatorBuilder()}setupValidator($){if(this.validatorCompiler!==void 0&&!this.addedSchemas)return;this.validatorCompiler=this.getValidatorBuilder()(this.schemaBucket.getSchemas(),$.ajv)}setupSerializer($){if(this.serializerCompiler!==void 0&&!this.addedSchemas)return;this.serializerCompiler=this.getSerializerBuilder()(this.schemaBucket.getSchemas(),$.serializerOpts)}}CQ.buildSchemaController=J30;ey.exports=CQ});var UF=S((Vx0,VF)=>{var QF=Y30(),WF=Y0("assert"),KF=Symbol.for("registered-plugin"),{kTestInternals:X30}=H$(),{exist:Q30,existReply:G30,existRequest:W30}=mX(),{FST_ERR_PLUGIN_VERSION_MISMATCH:K30,FST_ERR_PLUGIN_NOT_PRESENT_IN_INSTANCE:V30,FST_ERR_PLUGIN_INVALID_ASYNC_HANDLER:U30}=w$(),H30=/-(?:rc|pre|alpha).+$/u;function EQ($){return $[Symbol.for("plugin-meta")]}function $x($){let Z=Zx($);if(Z)return Z;let J=Y0.cache;if(J){let Y=Object.keys(J);for(let X=0;X<Y.length;X++){let Q=Y[X];if(J[Q].exports===$)return Q}}if($.name)return $.name;return null}function B30($){return $.toString().split(`
|
|
422
|
+
`,2).map((Z)=>Z.trim()).join(" -- ")}function Zx($){return $[Symbol.for("fastify.display-name")]}function Jx($){return!!$[Symbol.for("skip-override")]}function Yx($){let Z=EQ($);if(!Z)return;let J=Z.dependencies;if(!J)return;WF(Array.isArray(J),"The dependencies should be an array of strings"),J.forEach((Y)=>{WF(this[KF].indexOf(Y)>-1,`The dependency '${Y}' of plugin '${Z.name}' is not registered`)})}function Xx($){let Z=EQ($);if(!Z)return;let{decorators:J,name:Y}=Z;if(!J)return;if(J.fastify)GF(this,"Fastify",J.fastify,Y);if(J.reply)GF(this,"Reply",J.reply,Y);if(J.request)GF(this,"Request",J.request,Y)}var z30={Fastify:Q30,Request:W30,Reply:G30};function GF($,Z,J,Y){WF(Array.isArray(J),"The decorators should be an array of strings"),J.forEach((X)=>{let Q=typeof Y==="string"?` required by '${Y}'`:"";if(!z30[Z].call($,X))throw new V30(X,Q,Z)})}function F30($){let Z=EQ($);if(Z?.fastify==null)return;let J=Z.fastify,Y=H30.test(this.version);if(Y===!0&&QF.gt(this.version,QF.coerce(J))===!0)return;if(J&&QF.satisfies(this.version,J,{includePrerelease:Y})===!1)throw new K30(Z.name,J,this.version)}function A30($){let Z=EQ($);if(!Z)return;let J=Z.name;if(!J)return;return this[KF].push(J),J}function O30($,Z){if($.constructor.name==="AsyncFunction"&&$.length===3)throw new U30(Z)}function q30($){let Z=A30.call(this,$)||$x($);return O30.call(this,$,Z),F30.call(this,$),Xx.call(this,$),Yx.call(this,$),Jx($)}VF.exports={getPluginName:$x,getFuncPreview:B30,kRegisteredPlugins:KF,getDisplayName:Zx,registerPlugin:q30};VF.exports[X30]={shouldSkipOverride:Jx,getMeta:EQ,checkDecorators:Xx,checkDependencies:Yx}});var IW=S((Hx0,Qx)=>{function j30($,Z){let J=Z||M30();if($)return D30($,J);return J}function N30($,Z){return $.genReqId(Z)}function M30(){let Z=0;return function(){return Z=Z+1&2147483647,`req-${Z.toString(36)}`}}function D30($,Z){return function(J){return J.headers[$]||Z(J)}}Qx.exports={getGenReqId:N30,reqIdGenFactory:j30}});var Vx=S((Bx0,Kx)=>{var Gx=12,w30=0,HF=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,7,7,7,7,7,7,7,7,7,7,7,7,8,7,7,10,9,9,9,11,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,24,36,48,60,72,84,96,0,12,12,12,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,24,24,24,0,0,0,0,0,0,0,0,0,24,24,0,0,0,0,0,0,0,0,0,0,48,48,48,0,0,0,0,0,0,0,0,0,0,48,48,0,0,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,0,0,0,127,63,63,63,0,31,15,15,15,7,7,7];function L30($){var Z=$.indexOf("%");if(Z===-1)return $;var J=$.length,Y="",X=0,Q=0,G=Z,W=Gx;while(Z>-1&&Z<J){var K=Wx($[Z+1],4),V=Wx($[Z+2],0),U=K|V,H=HF[U];if(W=HF[256+W+H],Q=Q<<6|U&HF[364+H],W===Gx)Y+=$.slice(X,G),Y+=Q<=65535?String.fromCharCode(Q):String.fromCharCode(55232+(Q>>10),56320+(Q&1023)),Q=0,X=Z+3,Z=G=$.indexOf("%",X);else if(W===w30)return null;else{if(Z+=3,Z<J&&$.charCodeAt(Z)===37)continue;return null}}return Y+$.slice(X)}var T30={"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};function Wx($,Z){var J=T30[$];return J===void 0?255:J<<Z}Kx.exports=L30});var Fx=S((zx0,zx)=>{var Ux=Vx(),Hx=/\+/g,Bx=function(){};Bx.prototype=Object.create(null);function R30($){let Z=new Bx;if(typeof $!=="string")return Z;let J=$.length,Y="",X="",Q=-1,G=-1,W=!1,K=!1,V=!1,U=!1,H=!1,B=0;for(let z=0;z<J+1;z++)if(B=z!==J?$.charCodeAt(z):38,B===38){if(H=G>Q,!H)G=z;if(Y=$.slice(Q+1,G),H||Y.length>0){if(V)Y=Y.replace(Hx," ");if(W)Y=Ux(Y)||Y;if(H){if(X=$.slice(G+1,z),U)X=X.replace(Hx," ");if(K)X=Ux(X)||X}let F=Z[Y];if(F===void 0)Z[Y]=X;else if(F.pop)F.push(X);else Z[Y]=[F,X]}X="",Q=z,G=z,W=!1,K=!1,V=!1,U=!1}else if(B===61)if(G<=Q)G=z;else K=!0;else if(B===43)if(G>Q)U=!0;else V=!0;else if(B===37)if(G>Q)K=!0;else W=!0;return Z}zx.exports=R30});var Ox=S((Fx0,Ax)=>{var _6=Array.from({length:256},($,Z)=>"%"+((Z<16?"0":"")+Z.toString(16)).toUpperCase()),P30=new Int8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0]);function I30($){let Z=$.length;if(Z===0)return"";let J="",Y=0,X=0;$:for(;X<Z;X++){let Q=$.charCodeAt(X);while(Q<128){if(P30[Q]!==1){if(Y<X)J+=$.slice(Y,X);Y=X+1,J+=_6[Q]}if(++X===Z)break $;Q=$.charCodeAt(X)}if(Y<X)J+=$.slice(Y,X);if(Q<2048){Y=X+1,J+=_6[192|Q>>6]+_6[128|Q&63];continue}if(Q<55296||Q>=57344){Y=X+1,J+=_6[224|Q>>12]+_6[128|Q>>6&63]+_6[128|Q&63];continue}if(++X,X>=Z)throw Error("URI malformed");let G=$.charCodeAt(X)&1023;Y=X+1,Q=65536+((Q&1023)<<10|G),J+=_6[240|Q>>18]+_6[128|Q>>12&63]+_6[128|Q>>6&63]+_6[128|Q&63]}if(Y===0)return $;if(Y<Z)return J+$.slice(Y);return J}Ax.exports={encodeString:I30}});var Nx=S((Ax0,jx)=>{var{encodeString:BF}=Ox();function qx($){let Z=typeof $;if(Z==="string")return BF($);else if(Z==="bigint")return $.toString();else if(Z==="boolean")return $?"true":"false";else if(Z==="number"&&Number.isFinite($))return $<1000000000000000000000?""+$:BF(""+$);return""}function C30($){let Z="";if($===null||typeof $!=="object")return Z;let J="&",Y=Object.keys($),X=Y.length,Q=0;for(let G=0;G<X;G++){let W=Y[G],K=$[W],V=BF(W)+"=";if(G)Z+=J;if(Array.isArray(K)){Q=K.length;for(let U=0;U<Q;U++){if(U)Z+=J;Z+=V,Z+=qx(K[U])}}else Z+=V,Z+=qx(K)}return Z}jx.exports=C30});var Lx=S((Ox0,bQ)=>{var Mx=Fx(),Dx=Nx(),wx={parse:Mx,stringify:Dx};bQ.exports=wx;bQ.exports.default=wx;bQ.exports.parse=Mx;bQ.exports.stringify=Dx});var Rx=S((Tx)=>{Object.defineProperty(Tx,"__esModule",{value:!0})});var Ix=S((Px)=>{Object.defineProperty(Px,"__esModule",{value:!0});Px.types=void 0;var E30;(function($){$[$.ROOT=0]="ROOT",$[$.GROUP=1]="GROUP",$[$.POSITION=2]="POSITION",$[$.SET=3]="SET",$[$.RANGE=4]="RANGE",$[$.REPETITION=5]="REPETITION",$[$.REFERENCE=6]="REFERENCE",$[$.CHAR=7]="CHAR"})(E30=Px.types||(Px.types={}))});var Ex=S((Cx)=>{Object.defineProperty(Cx,"__esModule",{value:!0})});var zZ=S((BZ)=>{var b30=BZ&&BZ.__createBinding||(Object.create?function($,Z,J,Y){if(Y===void 0)Y=J;Object.defineProperty($,Y,{enumerable:!0,get:function(){return Z[J]}})}:function($,Z,J,Y){if(Y===void 0)Y=J;$[Y]=Z[J]}),FF=BZ&&BZ.__exportStar||function($,Z){for(var J in $)if(J!=="default"&&!Object.prototype.hasOwnProperty.call(Z,J))b30(Z,$,J)};Object.defineProperty(BZ,"__esModule",{value:!0});FF(Rx(),BZ);FF(Ix(),BZ);FF(Ex(),BZ)});var CW=S((fx)=>{Object.defineProperty(fx,"__esModule",{value:!0});fx.anyChar=fx.notWhitespace=fx.whitespace=fx.notInts=fx.ints=fx.notWords=fx.words=void 0;var R1=zZ(),bx=()=>[{type:R1.types.RANGE,from:48,to:57}],_x=()=>[{type:R1.types.CHAR,value:95},{type:R1.types.RANGE,from:97,to:122},{type:R1.types.RANGE,from:65,to:90},{type:R1.types.RANGE,from:48,to:57}],Sx=()=>[{type:R1.types.CHAR,value:9},{type:R1.types.CHAR,value:10},{type:R1.types.CHAR,value:11},{type:R1.types.CHAR,value:12},{type:R1.types.CHAR,value:13},{type:R1.types.CHAR,value:32},{type:R1.types.CHAR,value:160},{type:R1.types.CHAR,value:5760},{type:R1.types.RANGE,from:8192,to:8202},{type:R1.types.CHAR,value:8232},{type:R1.types.CHAR,value:8233},{type:R1.types.CHAR,value:8239},{type:R1.types.CHAR,value:8287},{type:R1.types.CHAR,value:12288},{type:R1.types.CHAR,value:65279}],_30=()=>[{type:R1.types.CHAR,value:10},{type:R1.types.CHAR,value:13},{type:R1.types.CHAR,value:8232},{type:R1.types.CHAR,value:8233}];fx.words=()=>({type:R1.types.SET,set:_x(),not:!1});fx.notWords=()=>({type:R1.types.SET,set:_x(),not:!0});fx.ints=()=>({type:R1.types.SET,set:bx(),not:!1});fx.notInts=()=>({type:R1.types.SET,set:bx(),not:!0});fx.whitespace=()=>({type:R1.types.SET,set:Sx(),not:!1});fx.notWhitespace=()=>({type:R1.types.SET,set:Sx(),not:!0});fx.anyChar=()=>({type:R1.types.SET,set:_30(),not:!0})});var yx=S((l8)=>{var h30=l8&&l8.__createBinding||(Object.create?function($,Z,J,Y){if(Y===void 0)Y=J;Object.defineProperty($,Y,{enumerable:!0,get:function(){return Z[J]}})}:function($,Z,J,Y){if(Y===void 0)Y=J;$[Y]=Z[J]}),g30=l8&&l8.__setModuleDefault||(Object.create?function($,Z){Object.defineProperty($,"default",{enumerable:!0,value:Z})}:function($,Z){$.default=Z}),u30=l8&&l8.__importStar||function($){if($&&$.__esModule)return $;var Z={};if($!=null){for(var J in $)if(J!=="default"&&Object.prototype.hasOwnProperty.call($,J))h30(Z,$,J)}return g30(Z,$),Z};Object.defineProperty(l8,"__esModule",{value:!0});l8.tokenizeClass=l8.strToChars=void 0;var vx=zZ(),YY=u30(CW()),m30="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?";l8.strToChars=($)=>{let Z=/(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|c([@A-Z[\\\]^?])|([0tnvfr]))/g;return $.replace(Z,(J,Y,X,Q,G,W,K)=>{if(X)return J;let V=Y?8:Q?parseInt(Q,16):G?parseInt(G,16):W?m30.indexOf(W):{0:0,t:9,n:10,v:11,f:12,r:13}[K],U=String.fromCharCode(V);return/[[\]{}^$.|?*+()]/.test(U)?`\\${U}`:U})};l8.tokenizeClass=($,Z)=>{var J,Y,X,Q,G,W,K;let V=[],U,H,B=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(((?:\\)])|(((?:\\)?([^\]])))))|(\])|(?:\\)?([^])/g;while((U=B.exec($))!==null){let z=(K=(W=(G=(Q=(X=(Y=(J=U[1]&&YY.words())!==null&&J!==void 0?J:U[2]&&YY.ints())!==null&&Y!==void 0?Y:U[3]&&YY.whitespace())!==null&&X!==void 0?X:U[4]&&YY.notWords())!==null&&Q!==void 0?Q:U[5]&&YY.notInts())!==null&&G!==void 0?G:U[6]&&YY.notWhitespace())!==null&&W!==void 0?W:U[7]&&{type:vx.types.RANGE,from:(U[8]||U[9]).charCodeAt(0),to:(H=U[10]).charCodeAt(H.length-1)})!==null&&K!==void 0?K:(H=U[16])&&{type:vx.types.CHAR,value:H.charCodeAt(0)};if(z)V.push(z);else return[V,B.lastIndex]}throw SyntaxError(`Invalid regular expression: /${Z}/: Unterminated character class`)}});var AF=S((S6)=>{var l30=S6&&S6.__createBinding||(Object.create?function($,Z,J,Y){if(Y===void 0)Y=J;Object.defineProperty($,Y,{enumerable:!0,get:function(){return Z[J]}})}:function($,Z,J,Y){if(Y===void 0)Y=J;$[Y]=Z[J]}),d30=S6&&S6.__setModuleDefault||(Object.create?function($,Z){Object.defineProperty($,"default",{enumerable:!0,value:Z})}:function($,Z){$.default=Z}),gx=S6&&S6.__importStar||function($){if($&&$.__esModule)return $;var Z={};if($!=null){for(var J in $)if(J!=="default"&&Object.prototype.hasOwnProperty.call($,J))l30(Z,$,J)}return d30(Z,$),Z};Object.defineProperty(S6,"__esModule",{value:!0});S6.tokenizer=void 0;var xx=gx(yx()),k$=zZ(),U7=gx(CW()),p30=/^[a-zA-Z_$]$/i,c30=/^[a-zA-Z0-9_$]$/i,hx=/\d/;S6.tokenizer=($)=>{let Z=0,J,Y={type:k$.types.ROOT,stack:[]},X=Y,Q=Y.stack,G=[],W=[],K=0,V=(H)=>{throw SyntaxError(`Invalid regular expression: /${$}/: Nothing to repeat at column ${H-1}`)},U=xx.strToChars($);while(Z<U.length)switch(J=U[Z++]){case"\\":if(Z===U.length)throw SyntaxError(`Invalid regular expression: /${$}/: \\ at end of pattern`);switch(J=U[Z++]){case"b":Q.push({type:k$.types.POSITION,value:"b"});break;case"B":Q.push({type:k$.types.POSITION,value:"B"});break;case"w":Q.push(U7.words());break;case"W":Q.push(U7.notWords());break;case"d":Q.push(U7.ints());break;case"D":Q.push(U7.notInts());break;case"s":Q.push(U7.whitespace());break;case"S":Q.push(U7.notWhitespace());break;default:if(hx.test(J)){let H=J;while(Z<U.length&&hx.test(U[Z]))H+=U[Z++];let B=parseInt(H,10),z={type:k$.types.REFERENCE,value:B};Q.push(z),W.push({reference:z,stack:Q,index:Q.length-1})}else Q.push({type:k$.types.CHAR,value:J.charCodeAt(0)})}break;case"^":Q.push({type:k$.types.POSITION,value:"^"});break;case"$":Q.push({type:k$.types.POSITION,value:"$"});break;case"[":{let H;if(U[Z]==="^")H=!0,Z++;else H=!1;let B=xx.tokenizeClass(U.slice(Z),$);Z+=B[1],Q.push({type:k$.types.SET,set:B[0],not:H});break}case".":Q.push(U7.anyChar());break;case"(":{let H={type:k$.types.GROUP,stack:[],remember:!0};if(U[Z]==="?")if(J=U[Z+1],Z+=2,J==="=")H.followedBy=!0,H.remember=!1;else if(J==="!")H.notFollowedBy=!0,H.remember=!1;else if(J==="<"){let B="";if(p30.test(U[Z]))B+=U[Z],Z++;else throw SyntaxError(`Invalid regular expression: /${$}/: Invalid capture group name, character '${U[Z]}' after '<' at column ${Z+1}`);while(Z<U.length&&c30.test(U[Z]))B+=U[Z],Z++;if(!B)throw SyntaxError(`Invalid regular expression: /${$}/: Invalid capture group name, character '${U[Z]}' after '<' at column ${Z+1}`);if(U[Z]!==">")throw SyntaxError(`Invalid regular expression: /${$}/: Unclosed capture group name, expected '>', found '${U[Z]}' at column ${Z+1}`);H.name=B,Z++}else if(J===":")H.remember=!1;else throw SyntaxError(`Invalid regular expression: /${$}/: Invalid group, character '${J}' after '?' at column ${Z-1}`);else K+=1;Q.push(H),G.push(X),X=H,Q=H.stack;break}case")":if(G.length===0)throw SyntaxError(`Invalid regular expression: /${$}/: Unmatched ) at column ${Z-1}`);X=G.pop(),Q=X.options?X.options[X.options.length-1]:X.stack;break;case"|":{if(!X.options)X.options=[X.stack],delete X.stack;let H=[];X.options.push(H),Q=H;break}case"{":{let H=/^(\d+)(,(\d+)?)?\}/.exec(U.slice(Z)),B,z;if(H!==null){if(Q.length===0)V(Z);B=parseInt(H[1],10),z=H[2]?H[3]?parseInt(H[3],10):1/0:B,Z+=H[0].length,Q.push({type:k$.types.REPETITION,min:B,max:z,value:Q.pop()})}else Q.push({type:k$.types.CHAR,value:123});break}case"?":if(Q.length===0)V(Z);Q.push({type:k$.types.REPETITION,min:0,max:1,value:Q.pop()});break;case"+":if(Q.length===0)V(Z);Q.push({type:k$.types.REPETITION,min:1,max:1/0,value:Q.pop()});break;case"*":if(Q.length===0)V(Z);Q.push({type:k$.types.REPETITION,min:0,max:1/0,value:Q.pop()});break;default:Q.push({type:k$.types.CHAR,value:J.charCodeAt(0)})}if(G.length!==0)throw SyntaxError(`Invalid regular expression: /${$}/: Unterminated group`);return i30(W,K),Y};function i30($,Z){for(let J of $.reverse())if(Z<J.reference.value){J.reference.type=k$.types.CHAR;let Y=J.reference.value.toString();if(J.reference.value=parseInt(Y,8),!/^[0-7]+$/.test(Y)){let X=0;while(Y[X]!=="8"&&Y[X]!=="9")X+=1;if(X===0)J.reference.value=Y.charCodeAt(0),X+=1;else J.reference.value=parseInt(Y.slice(0,X),8);if(Y.length>X){let Q=J.stack.splice(J.index+1);for(let G of Y.slice(X))J.stack.push({type:k$.types.CHAR,value:G.charCodeAt(0)});J.stack.push(...Q)}}}}});var mx=S((i$)=>{var n30=i$&&i$.__createBinding||(Object.create?function($,Z,J,Y){if(Y===void 0)Y=J;Object.defineProperty($,Y,{enumerable:!0,get:function(){return Z[J]}})}:function($,Z,J,Y){if(Y===void 0)Y=J;$[Y]=Z[J]}),o30=i$&&i$.__setModuleDefault||(Object.create?function($,Z){Object.defineProperty($,"default",{enumerable:!0,value:Z})}:function($,Z){$.default=Z}),s30=i$&&i$.__importStar||function($){if($&&$.__esModule)return $;var Z={};if($!=null){for(var J in $)if(J!=="default"&&Object.prototype.hasOwnProperty.call($,J))n30(Z,$,J)}return o30(Z,$),Z};Object.defineProperty(i$,"__esModule",{value:!0});i$.NOTANYCHAR=i$.WHITESPACE=i$.WORDS=i$.INTS=void 0;var EW=s30(CW()),ux=zZ();function bW($){let Z={},J=0;for(let Y of $){if(Y.type===ux.types.CHAR)Z[Y.value]=!0;if(Y.type===ux.types.RANGE)Z[`${Y.from}-${Y.to}`]=!0;J+=1}return{lookup:()=>Object.assign({},Z),len:J}}i$.INTS=bW(EW.ints().set);i$.WORDS=bW(EW.words().set);i$.WHITESPACE=bW(EW.whitespace().set);i$.NOTANYCHAR=bW(EW.anyChar().set)});var dx=S((d8)=>{var r30=d8&&d8.__createBinding||(Object.create?function($,Z,J,Y){if(Y===void 0)Y=J;Object.defineProperty($,Y,{enumerable:!0,get:function(){return Z[J]}})}:function($,Z,J,Y){if(Y===void 0)Y=J;$[Y]=Z[J]}),a30=d8&&d8.__setModuleDefault||(Object.create?function($,Z){Object.defineProperty($,"default",{enumerable:!0,value:Z})}:function($,Z){$.default=Z}),t30=d8&&d8.__importStar||function($){if($&&$.__esModule)return $;var Z={};if($!=null){for(var J in $)if(J!=="default"&&Object.prototype.hasOwnProperty.call($,J))r30(Z,$,J)}return a30(Z,$),Z};Object.defineProperty(d8,"__esModule",{value:!0});d8.writeSetTokens=d8.setChar=void 0;var kW=zZ(),_W=t30(mx());function fW($){return $===94?"\\^":$===92?"\\\\":$===93?"\\]":$===45?"\\-":String.fromCharCode($)}d8.setChar=fW;function SW($,{lookup:Z,len:J}){if(J!==$.length)return!1;let Y=Z();for(let X of $){if(X.type===kW.types.SET)return!1;let Q=X.type===kW.types.CHAR?X.value:`${X.from}-${X.to}`;if(Y[Q])Y[Q]=!1;else return!1}return!0}function lx($,Z=!1){if(SW($.set,_W.INTS))return $.not?"\\D":"\\d";if(SW($.set,_W.WORDS))return $.not?"\\W":"\\w";if($.not&&SW($.set,_W.NOTANYCHAR))return".";if(SW($.set,_W.WHITESPACE))return $.not?"\\S":"\\s";let J="";for(let X=0;X<$.set.length;X++){let Q=$.set[X];J+=e30(Q)}let Y=`${$.not?"^":""}${J}`;return Z?Y:`[${Y}]`}d8.writeSetTokens=lx;function e30($){if($.type===kW.types.CHAR)return fW($.value);else if($.type===kW.types.RANGE)return`${fW($.from)}-${fW($.to)}`;return lx($,!0)}});var qF=S((ix)=>{Object.defineProperty(ix,"__esModule",{value:!0});ix.reconstruct=void 0;var $5=zZ(),OF=dx(),px=($)=>$.map(ix.reconstruct).join(""),cx=($)=>{if("options"in $)return $.options.map(px).join("|");else if("stack"in $)return px($.stack);else throw Error("options or stack must be Root or Group token")};ix.reconstruct=($)=>{switch($.type){case $5.types.ROOT:return cx($);case $5.types.CHAR:{let Z=String.fromCharCode($.value);return(/[[\\{}$^.|?*+()]/.test(Z)?"\\":"")+Z}case $5.types.POSITION:if($.value==="^"||$.value==="$")return $.value;else return`\\${$.value}`;case $5.types.REFERENCE:return`\\${$.value}`;case $5.types.SET:return OF.writeSetTokens($);case $5.types.GROUP:return`(${$.name?`?<${$.name}>`:$.remember?"":$.followedBy?"?=":$.notFollowedBy?"?!":"?:"}${cx($)})`;case $5.types.REPETITION:{let{min:Z,max:J}=$,Y;if(Z===0&&J===1)Y="?";else if(Z===1&&J===1/0)Y="+";else if(Z===0&&J===1/0)Y="*";else if(J===1/0)Y=`{${Z},}`;else if(Z===J)Y=`{${Z}}`;else Y=`{${Z},${J}}`;return`${ix.reconstruct($.value)}${Y}`}case $5.types.RANGE:return`${OF.setChar($.from)}-${OF.setChar($.to)}`;default:throw Error(`Invalid token type ${$}`)}}});var NF=S((p8,yW)=>{var $F0=p8&&p8.__createBinding||(Object.create?function($,Z,J,Y){if(Y===void 0)Y=J;Object.defineProperty($,Y,{enumerable:!0,get:function(){return Z[J]}})}:function($,Z,J,Y){if(Y===void 0)Y=J;$[Y]=Z[J]}),jF=p8&&p8.__exportStar||function($,Z){for(var J in $)if(J!=="default"&&!Object.prototype.hasOwnProperty.call(Z,J))$F0(Z,$,J)};Object.defineProperty(p8,"__esModule",{value:!0});p8.types=void 0;var nx=zZ();Object.defineProperty(p8,"types",{enumerable:!0,get:function(){return nx.types}});jF(AF(),p8);jF(qF(),p8);var ox=AF(),ZF0=qF();jF(zZ(),p8);p8.default=ox.tokenizer;yW.exports=ox.tokenizer;yW.exports.types=nx.types;yW.exports.reconstruct=ZF0.reconstruct});var sx=S((Ix0,xW)=>{var JF0=NF(),{types:YF0}=NF();function MF($,Z,J){let Y,X,Q;if($.type===YF0.REPETITION){if(J++,Z.reps++,J>1)return!1;if(Z.reps>Z.limit)return!1}let G=$.options||$.value?.options;if(G){for(Y=0,Q=G.length;Y<Q;Y++)if(X=MF({stack:G[Y]},Z,J),!X)return!1}let W=$.stack||$.value?.stack;if(!W)return!0;for(Y=0,Q=W.length;Y<Q;Y++)if(X=MF(W[Y],Z,J),!X)return!1;return!0}function DF($,Z){let J={reps:0,limit:Z?.limit??25};if(XF0($))$=$.source;else if(typeof $!=="string")$=String($);try{return MF(JF0($),J,0)}catch{return!1}}function XF0($){return Object.prototype.toString.call($)==="[object RegExp]"}xW.exports=DF;xW.exports.default=DF;xW.exports.safeRegex=DF});var hW=S((Cx0,rx)=>{rx.exports={name:"__fmw_internal_strategy_merged_tree_http_method__",storage:function(){let $=new Map;return{get:(Z)=>{return $.get(Z)||null},set:(Z,J)=>{$.set(Z,J)}}},deriveConstraint:($)=>$.method,mustMatchWhenDerived:!0}});var Yh=S((Ex0,Jh)=>{var ax=aX(),tx=hW(),ex=Symbol("treeData");function $h($,Z=""){let J="",Y=Object.keys($);for(let X=0;X<Y.length;X++){let Q=Y[X],G=$[Q],W=X===Y.length-1,K=W?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",V=W?" ":"\u2502 ",H=(G[ex]||"").replaceAll(`
|
|
423
|
+
`,`
|
|
424
|
+
`+Z+V);J+=Z+K+Q+H+`
|
|
425
|
+
`,J+=$h(G,Z+V)}return J}function QF0($){let Z=$.name||"";return Z=Z.replace("bound","").trim(),Z=(Z||"anonymous")+"()",Z}function Zh($){if(Array.isArray($))return $.map((Z)=>Zh(Z));if(typeof $==="symbol")return $.toString();if(typeof $==="function")return QF0($);return $}function GF0($,Z){if(!Z.includeMeta)return{};let J=Z.buildPrettyMeta($),Y={},X=Z.includeMeta;if(!Array.isArray(X))X=Reflect.ownKeys(J);for(let Q of X){if(!Object.prototype.hasOwnProperty.call(J,Q))continue;let G=Q.toString(),W=J[Q];if(W!==void 0&&W!==null){let K=JSON.stringify(Zh(W));Y[G]=K}}return Y}function WF0($){let Z="";for(let[J,Y]of Object.entries($))Z+=`
|
|
426
|
+
\u2022 (${J}) ${Y}`;return Z}function KF0($){let Z={...$.opts.constraints},J=Z[tx.name];return delete Z[tx.name],{...$,method:J,opts:{constraints:Z}}}function VF0($){let Z=` (${$.method})`,J=$.opts.constraints||{};if(Object.keys(J).length!==0)Z+=" "+JSON.stringify(J);return Z+=WF0($.metaData),Z}function UF0($){return $.reduce((Z,J)=>{for(let Y of Z)if(ax(J.opts.constraints,Y.opts.constraints)&&ax(J.metaData,Y.metaData))return Y.method+=", "+J.method,Z;return Z.push(J),Z},[])}function HF0($,Z,J){let Y=$.routes;if(J.method===void 0)Y=Y.map(KF0);if(Y=Y.map((X)=>{return X.metaData=GF0(X,J),X}),J.method===void 0)Y=UF0(Y);return Y.map(VF0).join(`
|
|
427
|
+
${Z}`)}function gW($,Z,J,Y){if($.isLeafNode||Y.commonPrefix!==!1){if(J=J||"(empty root node)",Z=Z[J]={},$.isLeafNode)Z[ex]=HF0($,J,Y);J=""}if($.staticChildren)for(let X of Object.values($.staticChildren))gW(X,Z,J+X.prefix,Y);if($.parametricChildren)for(let X of Object.values($.parametricChildren)){let Q=Array.from(X.nodePaths).join("|");gW(X,Z,J+Q,Y)}if($.wildcardChild)gW($.wildcardChild,Z,"*",Y)}function BF0($,Z){let J={};return gW($,J,$.prefix,Z),$h(J)}Jh.exports={prettyPrintTree:BF0}});var Gh=S((bx0,Qh)=>{var Xh=function(){};Xh.prototype=Object.create(null);Qh.exports={NullObject:Xh}});var Vh=S((_x0,Kh)=>{var{NullObject:zF0}=Gh(),FF0=hW();class Wh{constructor(){this.unconstrainedHandler=null,this.constraints=[],this.handlers=[],this.constrainedHandlerStores=null}getMatchingHandler($){if($===void 0)return this.unconstrainedHandler;return this._getHandlerMatchingConstraints($)}addHandler($,Z){let J=Z.params,Y=Z.opts.constraints||{},X={params:J,constraints:Y,handler:Z.handler,store:Z.store||null,_createParamsObject:this._compileCreateParamsObject(J)},Q=Object.keys(Y);if(Q.length===0)this.unconstrainedHandler=X;for(let W of Q)if(!this.constraints.includes(W))if(W==="version")this.constraints.unshift(W);else this.constraints.push(W);let G=Q.includes(FF0.name);if(!G&&this.handlers.length>=31)throw Error("find-my-way supports a maximum of 31 route handlers per node when there are constraints, limit reached");if(this.handlers.push(X),this.handlers.sort((W,K)=>Object.keys(W.constraints).length-Object.keys(K.constraints).length),!G)this._compileGetHandlerMatchingConstraints($,Y)}_compileCreateParamsObject($){let Z=[];Z.push("const fn = function _createParamsObject (paramsArray) {"),Z.push("const params = new NullObject()");for(let J=0;J<$.length;J++)Z.push(`params['${$[J]}'] = paramsArray[${J}]`);return Z.push("return params"),Z.push("}"),Z.push("return fn"),Function("NullObject",Z.join(`
|
|
428
|
+
`))(zF0)}_getHandlerMatchingConstraints(){return null}_buildConstraintStore($,Z){for(let J=0;J<this.handlers.length;J++){let X=this.handlers[J].constraints[Z];if(X!==void 0){let Q=$.get(X)||0;Q|=1<<J,$.set(X,Q)}}}_constrainedIndexBitmask($){let Z=0;for(let J=0;J<this.handlers.length;J++)if(this.handlers[J].constraints[$]!==void 0)Z|=1<<J;return~Z}_compileGetHandlerMatchingConstraints($){this.constrainedHandlerStores={};for(let J of this.constraints){let Y=$.newStoreForConstraint(J);this.constrainedHandlerStores[J]=Y,this._buildConstraintStore(Y,J)}let Z=[];Z.push(`
|
|
429
|
+
let candidates = ${(1<<this.handlers.length)-1}
|
|
430
|
+
let mask, matches
|
|
431
|
+
`);for(let J of this.constraints){Z.push(`
|
|
432
|
+
mask = ${this._constrainedIndexBitmask(J)}
|
|
433
|
+
value = derivedConstraints.${J}
|
|
434
|
+
`);let X=$.strategies[J].mustMatchWhenDerived?"matches":"(matches | mask)";Z.push(`
|
|
435
|
+
if (value === undefined) {
|
|
436
|
+
candidates &= mask
|
|
437
|
+
} else {
|
|
438
|
+
matches = this.constrainedHandlerStores.${J}.get(value) || 0
|
|
439
|
+
candidates &= ${X}
|
|
440
|
+
}
|
|
441
|
+
if (candidates === 0) return null;
|
|
442
|
+
`)}for(let J in $.strategies){if(!Object.hasOwn($.strategies,J))continue;if($.strategies[J].mustMatchWhenDerived&&!this.constraints.includes(J))Z.push(`if (derivedConstraints.${J} !== undefined) return null`)}Z.push("return this.handlers[31 - Math.clz32(candidates)]"),this._getHandlerMatchingConstraints=Function("derivedConstraints",Z.join(`
|
|
443
|
+
`))}}Kh.exports=Wh});var Hh=S((Sx0,Uh)=>{var AF0=Vh(),uW={STATIC:0,PARAMETRIC:1,WILDCARD:2};class wF{constructor(){this.isLeafNode=!1,this.routes=null,this.handlerStorage=null}addRoute($,Z){if(this.routes===null)this.routes=[];if(this.handlerStorage===null)this.handlerStorage=new AF0;this.isLeafNode=!0,this.routes.push($),this.handlerStorage.addHandler(Z,$)}}class LF extends wF{constructor(){super();this.staticChildren={}}findStaticMatchingChild($,Z){let J=this.staticChildren[$.charAt(Z)];if(J===void 0||!J.matchPrefix($,Z))return null;return J}getStaticChild($,Z=0){if($.length===Z)return this;let J=this.findStaticMatchingChild($,Z);if(J)return J.getStaticChild($,Z+J.prefix.length);return null}createStaticChild($){if($.length===0)return this;let Z=this.staticChildren[$.charAt(0)];if(Z){let Y=1;for(;Y<Z.prefix.length;Y++)if($.charCodeAt(Y)!==Z.prefix.charCodeAt(Y)){Z=Z.split(this,Y);break}return Z.createStaticChild($.slice(Y))}let J=$.charAt(0);return this.staticChildren[J]=new mW($),this.staticChildren[J]}}class mW extends LF{constructor($){super();this.prefix=$,this.wildcardChild=null,this.parametricChildren=[],this.kind=uW.STATIC,this._compilePrefixMatch()}getParametricChild($){let Z=$&&$.source,J=this.parametricChildren.find((Y)=>{return(Y.regex&&Y.regex.source)===Z});if(J)return J;return null}createParametricChild($,Z,J){let Y=this.getParametricChild($);if(Y)return Y.nodePaths.add(J),Y;return Y=new TF($,Z,J),this.parametricChildren.push(Y),this.parametricChildren.sort((X,Q)=>{if(!X.isRegex)return 1;if(!Q.isRegex)return-1;if(X.staticSuffix===null)return 1;if(Q.staticSuffix===null)return-1;if(Q.staticSuffix.endsWith(X.staticSuffix))return 1;if(X.staticSuffix.endsWith(Q.staticSuffix))return-1;return 0}),Y}getWildcardChild(){return this.wildcardChild}createWildcardChild(){return this.wildcardChild=this.getWildcardChild()||new RF,this.wildcardChild}split($,Z){let J=this.prefix.slice(0,Z),Y=this.prefix.slice(Z);this.prefix=Y,this._compilePrefixMatch();let X=new mW(J);return X.staticChildren[Y.charAt(0)]=this,$.staticChildren[J.charAt(0)]=X,X}getNextNode($,Z,J,Y){let X=this.findStaticMatchingChild($,Z),Q=0;if(X===null){if(this.parametricChildren.length===0)return this.wildcardChild;X=this.parametricChildren[0],Q=1}if(this.wildcardChild!==null)J.push({paramsCount:Y,brotherPathIndex:Z,brotherNode:this.wildcardChild});for(let G=this.parametricChildren.length-1;G>=Q;G--)J.push({paramsCount:Y,brotherPathIndex:Z,brotherNode:this.parametricChildren[G]});return X}_compilePrefixMatch(){if(this.prefix.length===1){this.matchPrefix=()=>!0;return}let $=[];for(let Z=1;Z<this.prefix.length;Z++){let J=this.prefix.charCodeAt(Z);$.push(`path.charCodeAt(i + ${Z}) === ${J}`)}this.matchPrefix=Function("path","i",`return ${$.join(" && ")}`)}}class TF extends LF{constructor($,Z,J){super();this.isRegex=!!$,this.regex=$||null,this.staticSuffix=Z||null,this.kind=uW.PARAMETRIC,this.nodePaths=new Set([J])}getNextNode($,Z){return this.findStaticMatchingChild($,Z)}}class RF extends wF{constructor(){super();this.kind=uW.WILDCARD}getNextNode(){return null}}Uh.exports={StaticNode:mW,ParametricNode:TF,WildcardNode:RF,NODE_TYPES:uW}});var zh=S((fx0,Bh)=>{var OF0=Y0("assert");function _Q(){if(!(this instanceof _Q))return new _Q;this.store=new Map,this.maxMajor=0,this.maxMinors={},this.maxPatches={}}_Q.prototype.set=function($,Z){if(typeof $!=="string")throw TypeError("Version should be a string");let[J,Y,X]=$.split(".",3);if(isNaN(J))throw TypeError("Major version must be a numeric value");if(J=Number(J),Y=Number(Y)||0,X=Number(X)||0,J>=this.maxMajor)this.maxMajor=J,this.store.set("x",Z),this.store.set("*",Z),this.store.set("x.x",Z),this.store.set("x.x.x",Z);if(Y>=(this.maxMinors[J]||0))this.maxMinors[J]=Y,this.store.set(`${J}.x`,Z),this.store.set(`${J}.x.x`,Z);if(X>=(this.maxPatches[`${J}.${Y}`]||0))this.maxPatches[`${J}.${Y}`]=X,this.store.set(`${J}.${Y}.x`,Z);return this.store.set(`${J}.${Y}.${X}`,Z),this};_Q.prototype.get=function($){return this.store.get($)};Bh.exports={name:"version",mustMatchWhenDerived:!0,storage:_Q,validate($){OF0(typeof $==="string","Version should be a string")}}});var Ah=S((kx0,Fh)=>{var qF0=Y0("assert");function jF0(){let $=new Map,Z=[];return{get:(J)=>{let Y=$.get(J);if(Y)return Y;for(let X of Z)if(X.host.test(J))return X.value},set:(J,Y)=>{if(J instanceof RegExp)Z.push({host:J,value:Y});else $.set(J,Y)}}}Fh.exports={name:"host",mustMatchWhenDerived:!1,storage:jF0,validate($){qF0(typeof $==="string"||Object.prototype.toString.call($)==="[object RegExp]","Host should be a string or a RegExp")}}});var jh=S((vx0,qh)=>{var NF0=zh(),MF0=Ah(),PF=Y0("assert");class Oh{constructor($){if(this.strategies={version:NF0,host:MF0},this.strategiesInUse=new Set,this.asyncStrategiesInUse=new Set,$)for(let Z of Object.values($))this.addConstraintStrategy(Z)}isStrategyUsed($){return this.strategiesInUse.has($)||this.asyncStrategiesInUse.has($)}hasConstraintStrategy($){let Z=this.strategies[$];if(Z!==void 0)return Z.isCustom||this.isStrategyUsed($);return!1}addConstraintStrategy($){if(PF(typeof $.name==="string"&&$.name!=="","strategy.name is required."),PF($.storage&&typeof $.storage==="function","strategy.storage function is required."),PF($.deriveConstraint&&typeof $.deriveConstraint==="function","strategy.deriveConstraint function is required."),this.strategies[$.name]&&this.strategies[$.name].isCustom)throw Error(`There already exists a custom constraint with the name ${$.name}.`);if(this.isStrategyUsed($.name))throw Error(`There already exists a route with ${$.name} constraint.`);if($.isCustom=!0,$.isAsync=$.deriveConstraint.length===3,this.strategies[$.name]=$,$.mustMatchWhenDerived)this.noteUsage({[$.name]:$})}deriveConstraints($,Z,J){let Y=this.deriveSyncConstraints($,Z);if(J===void 0)return Y;this.deriveAsyncConstraints(Y,$,Z,J)}deriveSyncConstraints($,Z){return}noteUsage($){if($){let Z=this.strategiesInUse.size;for(let J in $){if(!Object.hasOwn($,J))continue;if(this.strategies[J].isAsync)this.asyncStrategiesInUse.add(J);else this.strategiesInUse.add(J)}if(Z!==this.strategiesInUse.size)this._buildDeriveConstraints()}}newStoreForConstraint($){if(!this.strategies[$])throw Error(`No strategy registered for constraint key ${$}`);return this.strategies[$].storage()}validateConstraints($){for(let Z in $){if(!Object.hasOwn($,Z))continue;let J=$[Z];if(typeof J>"u")throw Error("Can't pass an undefined constraint value, must pass null or no key at all");let Y=this.strategies[Z];if(!Y)throw Error(`No strategy registered for constraint key ${Z}`);if(Y.validate)Y.validate(J)}}deriveAsyncConstraints($,Z,J,Y){let X=this.asyncStrategiesInUse.size;if(X===0){Y(null,$);return}$=$||{};for(let Q of this.asyncStrategiesInUse)this.strategies[Q].deriveConstraint(Z,J,(W,K)=>{if(W!==null){Y(W);return}if($[Q]=K,--X===0)Y(null,$)})}_buildDeriveConstraints(){if(this.strategiesInUse.size===0)return;let $=["return {"];for(let Z of this.strategiesInUse){let J=this.strategies[Z];if(!J.isCustom)if(Z==="version")$.push(" version: req.headers['accept-version'],");else $.push(" host: req.headers.host || req.headers[':authority'],");else $.push(` ${J.name}: this.strategies.${Z}.deriveConstraint(req, ctx),`)}$.push("}"),this.deriveSyncConstraints=Function("req","ctx",$.join(`
|
|
444
|
+
`)).bind(this)}}qh.exports=Oh});var Mh=S((yx0,Nh)=>{var DF0=["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","QUERY","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE"];Nh.exports=DF0});var Lh=S((xx0,wh)=>{function Dh($,Z){if($===50){if(Z===53)return"%";if(Z===51)return"#";if(Z===52)return"$";if(Z===54)return"&";if(Z===66)return"+";if(Z===98)return"+";if(Z===67)return",";if(Z===99)return",";if(Z===70)return"/";if(Z===102)return"/";return null}if($===51){if(Z===65)return":";if(Z===97)return":";if(Z===66)return";";if(Z===98)return";";if(Z===68)return"=";if(Z===100)return"=";if(Z===70)return"?";if(Z===102)return"?";return null}if($===52&&Z===48)return"@";return null}function wF0($,Z){let J=!1,Y=!1,X="";for(let G=1;G<$.length;G++){let W=$.charCodeAt(G);if(W===37){let K=$.charCodeAt(G+1),V=$.charCodeAt(G+2);if(Dh(K,V)===null)J=!0;else{if(Y=!0,K===50&&V===53)J=!0,$=$.slice(0,G+1)+"25"+$.slice(G+1),G+=2;G+=2}}else if(W===63||W===35||W===59&&Z){X=$.slice(G+1),$=$.slice(0,G);break}}return{path:J?decodeURI($):$,querystring:X,shouldDecodeParam:Y}}function LF0($){let Z=$.indexOf("%");if(Z===-1)return $;let J="",Y=Z;for(let X=Z;X<$.length;X++)if($.charCodeAt(X)===37){let Q=$.charCodeAt(X+1),G=$.charCodeAt(X+2),W=Dh(Q,G);J+=$.slice(Y,X)+W,Y=X+3}return $.slice(0,Z)+J+$.slice(Y)}wh.exports={safeDecodeURI:wF0,safeDecodeURIComponent:LF0}});var bF=S((hx0,fh)=>{var K$=Y0("assert"),TF0=Lx(),QY=sx(),EF=aX(),{prettyPrintTree:RF0}=Yh(),{StaticNode:Th,NODE_TYPES:Rh}=Hh(),PF0=jh(),XY=Mh(),IF=hW(),{safeDecodeURI:Ph,safeDecodeURIComponent:CF}=Lh(),Ih=/^https?:\/\/.*?\//,H7=/(\/:[^/()]*?)\?(\/?)/,Ch=/[.*+?^${}()|[\]\\]/g,Eh=/\/\/+/g;if(!QY(Ih))throw Error("the FULL_PATH_REGEXP is not safe, update this module");if(!QY(H7))throw Error("the OPTIONAL_PARAM_REGEXP is not safe, update this module");if(!QY(Ch))throw Error("the ESCAPE_REGEXP is not safe, update this module");if(!QY(Eh))throw Error("the REMOVE_DUPLICATE_SLASHES_REGEXP is not safe, update this module");function u1($){if(!(this instanceof u1))return new u1($);if($=$||{},this._opts=$,$.defaultRoute)K$(typeof $.defaultRoute==="function","The default route must be a function"),this.defaultRoute=$.defaultRoute;else this.defaultRoute=null;if($.onBadUrl)K$(typeof $.onBadUrl==="function","The bad url handler must be a function"),this.onBadUrl=$.onBadUrl;else this.onBadUrl=null;if($.buildPrettyMeta)K$(typeof $.buildPrettyMeta==="function","buildPrettyMeta must be a function"),this.buildPrettyMeta=$.buildPrettyMeta;else this.buildPrettyMeta=IF0;if($.querystringParser)K$(typeof $.querystringParser==="function","querystringParser must be a function"),this.querystringParser=$.querystringParser;else this.querystringParser=(Z)=>Z.length===0?{}:TF0.parse(Z);this.caseSensitive=$.caseSensitive===void 0?!0:$.caseSensitive,this.ignoreTrailingSlash=$.ignoreTrailingSlash||!1,this.ignoreDuplicateSlashes=$.ignoreDuplicateSlashes||!1,this.maxParamLength=$.maxParamLength||100,this.onMaxParamLength=$.onMaxParamLength||null,this.allowUnsafeRegex=$.allowUnsafeRegex||!1,this.constrainer=new PF0($.constraints),this.useSemicolonDelimiter=$.useSemicolonDelimiter||!1,this.routes=[],this.trees={}}u1.prototype.on=function(Z,J,Y,X,Q){if(typeof Y==="function"){if(X!==void 0)Q=X;X=Y,Y={}}K$(typeof J==="string","Path should be a string"),K$(J.length>0,"The path could not be empty"),K$(J[0]==="/"||J[0]==="*","The first character of a path should be `/` or `*`"),K$(typeof X==="function","Handler should be a function");let G=J.match(H7);if(G){K$(J.length===G.index+G[0].length,"Optional Parameter needs to be the last parameter of the path");let V=J.replace(H7,"$1$2"),U=J.replace(H7,"$2")||"/";this.on(Z,V,Y,X,Q),this.on(Z,U,Y,X,Q);return}let W=J;if(this.ignoreDuplicateSlashes)J=lW(J);if(this.ignoreTrailingSlash)J=dW(J);let K=Array.isArray(Z)?Z:[Z];for(let V of K)K$(typeof V==="string","Method should be a string"),K$(XY.includes(V),`Method '${V}' is not an http method.`),this._on(V,J,Y,X,Q,W)};u1.prototype._on=function(Z,J,Y,X,Q){let G={};if(Y.constraints!==void 0){if(K$(typeof Y.constraints==="object"&&Y.constraints!==null,"Constraints should be an object"),Object.keys(Y.constraints).length!==0)G=Y.constraints}if(this.constrainer.validateConstraints(G),this.constrainer.noteUsage(G),this.trees[Z]===void 0)this.trees[Z]=new Th("/");let W=J;if(W==="*"&&this.trees[Z].prefix.length!==0){let B=this.trees[Z];this.trees[Z]=new Th(""),this.trees[Z].staticChildren["/"]=B}let K=this.trees[Z],V=K.prefix.length,U=[];for(let B=0;B<=W.length;B++){if(W.charCodeAt(B)===58&&W.charCodeAt(B+1)===58){B++;continue}let z=W.charCodeAt(B)===58&&W.charCodeAt(B+1)!==58,F=W.charCodeAt(B)===42;if(z||F||B===W.length&&B!==V){let A=W.slice(V,B);if(!this.caseSensitive)A=A.toLowerCase();A=A.replaceAll("::",":"),A=A.replaceAll("%","%25"),K=K.createStaticChild(A)}if(z){let A=!1,j=!0,N="",w=[],q=B+1;for(let M=q;;M++){let C=W.charCodeAt(M),R=C===40,T=C===45||C===46,I=C===47||M===W.length;if(R||T||I){let _=W.slice(q,M);if(U.push(_),A=A||R||T,R){let b=Sh(W,M),y=W.slice(M,b+1);if(!this.allowUnsafeRegex)K$(QY(new RegExp(y)),`The regex '${y}' is not safe!`);w.push(_h(y)),M=b+1,j=!0}else w.push(j?"(.*?)":`(${N}|(?:(?!${N}).)*)`),j=!1;let E=M;for(;M<W.length;M++){let b=W.charCodeAt(M);if(b===47)break;if(b===58)if(W.charCodeAt(M+1)===58)M++;else break}let f=W.slice(E,M);if(f)f=f.replaceAll("::",":"),f=f.replaceAll("%","%25"),w.push(N=bh(f));if(q=M+1,I||W.charCodeAt(M)===47||M===W.length){let b=A?"()"+f:f,y=W.slice(B,M);W=W.slice(0,B+1)+b+W.slice(M),B+=b.length;let k=A?new RegExp("^"+w.join("")+"$"):null;K=K.createParametricChild(k,f||null,y),V=B+1;break}}}}else if(F){if(U.push("*"),K=K.createWildcardChild(),V=B+1,B!==W.length-1)throw Error("Wildcard must be the last character in the route")}}if(!this.caseSensitive)W=W.toLowerCase();if(W==="*")W="/*";for(let B of this.routes){let z=B.opts.constraints||{};if(B.method===Z&&B.pattern===W&&EF(z,G))throw Error(`Method '${Z}' already declared for route '${W}' with constraints '${JSON.stringify(G)}'`)}let H={method:Z,path:J,pattern:W,params:U,opts:Y,handler:X,store:Q};this.routes.push(H),K.addRoute(H,this.constrainer)};u1.prototype.hasRoute=function(Z,J,Y){return this.findRoute(Z,J,Y)!==null};u1.prototype.findRoute=function(Z,J,Y={}){if(this.trees[Z]===void 0)return null;let X=J,Q=this.trees[Z],G=Q.prefix.length,W=[];for(let K=0;K<=X.length;K++){if(X.charCodeAt(K)===58&&X.charCodeAt(K+1)===58){K++;continue}let V=X.charCodeAt(K)===58&&X.charCodeAt(K+1)!==58,U=X.charCodeAt(K)===42;if(V||U||K===X.length&&K!==G){let H=X.slice(G,K);if(!this.caseSensitive)H=H.toLowerCase();if(H=H.replaceAll("::",":"),H=H.replaceAll("%","%25"),Q=Q.getStaticChild(H),Q===null)return null}if(V){let H=!1,B=!0,z="",F=[],A=K+1;for(let j=A;;j++){let N=X.charCodeAt(j),w=N===40,q=N===45||N===46,M=N===47||j===X.length;if(w||q||M){let C=X.slice(A,j);if(W.push(C),H=H||w||q,w){let I=Sh(X,j),_=X.slice(j,I+1);if(!this.allowUnsafeRegex)K$(QY(new RegExp(_)),`The regex '${_}' is not safe!`);F.push(_h(_)),j=I+1,B=!1}else F.push(B?"(.*?)":`(${z}|(?:(?!${z}).)*)`),B=!1;let R=j;for(;j<X.length;j++){let I=X.charCodeAt(j);if(I===47)break;if(I===58)if(X.charCodeAt(j+1)===58)j++;else break}let T=X.slice(R,j);if(T)T=T.replaceAll("::",":"),T=T.replaceAll("%","%25"),F.push(z=bh(T));if(A=j+1,M||X.charCodeAt(j)===47||j===X.length){let I=H?"()"+T:T,_=X.slice(K,j);X=X.slice(0,K+1)+I+X.slice(j),K+=I.length;let E=H?new RegExp("^"+F.join("")+"$"):null;if(Q=Q.getParametricChild(E,T||null,_),Q===null)return null;G=K+1;break}}}}else if(U){if(W.push("*"),Q=Q.getWildcardChild(),G=K+1,K!==X.length-1)throw Error("Wildcard must be the last character in the route")}}if(!this.caseSensitive)X=X.toLowerCase();for(let K of this.routes){let V=K.opts.constraints||{};if(K.method===Z&&K.pattern===X&&EF(V,Y))return{handler:K.handler,store:K.store,params:K.params}}return null};u1.prototype.hasConstraintStrategy=function($){return this.constrainer.hasConstraintStrategy($)};u1.prototype.addConstraintStrategy=function($){this.constrainer.addConstraintStrategy($),this._rebuild(this.routes)};u1.prototype.reset=function(){this.trees={},this.routes=[]};u1.prototype.off=function(Z,J,Y){K$(typeof J==="string","Path should be a string"),K$(J.length>0,"The path could not be empty"),K$(J[0]==="/"||J[0]==="*","The first character of a path should be `/` or `*`"),K$(typeof Y>"u"||typeof Y==="object"&&!Array.isArray(Y)&&Y!==null,"Constraints should be an object or undefined.");let X=J.match(H7);if(X){K$(J.length===X.index+X[0].length,"Optional Parameter needs to be the last parameter of the path");let G=J.replace(H7,"$1$2"),W=J.replace(H7,"$2");this.off(Z,G,Y),this.off(Z,W,Y);return}if(this.ignoreDuplicateSlashes)J=lW(J);if(this.ignoreTrailingSlash)J=dW(J);let Q=Array.isArray(Z)?Z:[Z];for(let G of Q)this._off(G,J,Y)};u1.prototype._off=function(Z,J,Y){K$(typeof Z==="string","Method should be a string"),K$(XY.includes(Z),`Method '${Z}' is not an http method.`);function X(K){return Z!==K.method||J!==K.path}function Q(K){return X(K)||!EF(Y,K.opts.constraints||{})}let G=Y?Q:X,W=this.routes.filter(G);this._rebuild(W)};u1.prototype.lookup=function(Z,J,Y,X){if(typeof Y==="function")X=Y,Y=void 0;if(X===void 0){let Q=this.constrainer.deriveConstraints(Z,Y),G=this.find(Z.method,Z.url,Q);return this.callHandler(G,Z,J,Y)}this.constrainer.deriveConstraints(Z,Y,(Q,G)=>{if(Q!==null){X(Q);return}try{let W=this.find(Z.method,Z.url,G),K=this.callHandler(W,Z,J,Y);X(null,K)}catch(W){X(W)}})};u1.prototype.callHandler=function(Z,J,Y,X){if(Z===null)return this._defaultRoute(J,Y,X);return X===void 0?Z.handler(J,Y,Z.params,Z.store,Z.searchParams):Z.handler.call(X,J,Y,Z.params,Z.store,Z.searchParams)};u1.prototype.find=function(Z,J,Y){let X=this.trees[Z];if(X===void 0)return null;if(J.charCodeAt(0)!==47)J=J.replace(Ih,"/");if(this.ignoreDuplicateSlashes)J=lW(J);let Q,G,W;try{Q=Ph(J,this.useSemicolonDelimiter),J=Q.path,G=Q.querystring,W=Q.shouldDecodeParam}catch(A){return this._onBadUrl(J)}if(this.ignoreTrailingSlash)J=dW(J);let K=J;if(this.caseSensitive===!1)J=J.toLowerCase();let V=this.maxParamLength,U=X.prefix.length,H=[],B=J.length,z=[],F=!1;while(!0){if(U===B&&X.isLeafNode){let w=X.handlerStorage.getMatchingHandler(Y);if(w!==null)return{handler:w.handler,store:w.store,params:w._createParamsObject(H),searchParams:this.querystringParser(G)}}let A=X.getNextNode(J,U,z,H.length);if(A===null){if(z.length===0){if(F&&this.onMaxParamLength)return this._onMaxParamLength(K);return null}let w=z.pop();U=w.brotherPathIndex,H.splice(w.paramsCount),A=w.brotherNode}if(X=A,X.kind===Rh.STATIC){U+=X.prefix.length;continue}if(X.kind===Rh.WILDCARD){let w=K.slice(U);if(W)w=CF(w);H.push(w),U=B;continue}let j=K.indexOf("/",U);if(j===-1)j=B;let N=K.slice(U,j);if(W)N=CF(N);if(X.isRegex){let w=X.regex.exec(N);if(w===null){A=null;continue}let q=!1;for(let M=1;M<w.length;M++)if(w[M].length>V){q=!0;break}if(q){F=!0,A=null;continue}for(let M=1;M<w.length;M++)H.push(w[M])}else{if(N.length>V){F=!0,A=null;continue}H.push(N)}U=j}};u1.prototype._rebuild=function($){this.reset();for(let Z of $){let{method:J,path:Y,opts:X,handler:Q,store:G}=Z;this._on(J,Y,X,Q,G)}};u1.prototype._defaultRoute=function($,Z,J){if(this.defaultRoute!==null)return J===void 0?this.defaultRoute($,Z):this.defaultRoute.call(J,$,Z);else Z.statusCode=404,Z.end()};u1.prototype._onBadUrl=function($){if(this.onBadUrl===null)return null;let Z=this.onBadUrl;return{handler:(J,Y,X)=>Z($,J,Y),params:{},store:null}};u1.prototype._onMaxParamLength=function($){if(this.onMaxParamLength===null)return null;let Z=this.onMaxParamLength;return{handler:(J,Y,X)=>Z($,J,Y),params:{},store:null}};u1.prototype.prettyPrint=function($={}){let Z=$.method;$.buildPrettyMeta=this.buildPrettyMeta.bind(this);let J=null;if(Z===void 0){let{version:Y,host:X,...Q}=this.constrainer.strategies;Q[IF.name]=IF;let G=new u1({...this._opts,constraints:Q}),W=this.routes.map((K)=>{let V={...K.opts.constraints,[IF.name]:K.method};return{...K,method:"MERGED",opts:{constraints:V}}});G._rebuild(W),J=G.trees.MERGED}else J=this.trees[Z];if(J==null)return"(empty tree)";return RF0(J,$)};for(let $ in XY){if(!XY.hasOwnProperty($))continue;let Z=XY[$],J=Z.toLowerCase();u1.prototype[J]=function(Y,X,Q){return this.on(Z,Y,X,Q)}}u1.prototype.all=function($,Z,J){this.on(XY,$,Z,J)};u1.sanitizeUrlPath=function(Z,J){let Y=Ph(Z,J);if(Y.shouldDecodeParam)return CF(Y.path);return Y.path};u1.removeDuplicateSlashes=lW;u1.trimLastSlash=dW;fh.exports=u1;function bh($){return $.replace(Ch,"\\$&")}function lW($){return $.indexOf("//")!==-1?$.replace(Eh,"/"):$}function dW($){if($.length>1&&$.charCodeAt($.length-1)===47)return $.slice(0,-1);return $}function _h($){if($.charCodeAt(1)===94)$=$.slice(0,1)+$.slice(2);if($.charCodeAt($.length-2)===36)$=$.slice(0,$.length-2)+$.slice($.length-1);return $}function Sh($,Z){let J=1;while(Z<$.length){if(Z++,$.charCodeAt(Z)===92){Z++;continue}if($.charCodeAt(Z)===41)J--;else if($.charCodeAt(Z)===40)J++;if(!J)return Z}throw TypeError('Invalid regexp expression in "'+$+'"')}function IF0($){if(!$)return{};if(!$.store)return{};return Object.assign({},$.store)}});var vh=S((gx0,kh)=>{function _F($,Z,J,Y){if(J===void 0){Z.header("content-length","0"),Y(null,null);return}if(typeof J.resume==="function"){J.on("error",(Q)=>{Z.log.error({err:Q},"Error on Stream found for HEAD route")}),J.resume(),Y(null,null);return}if(typeof J.getReader==="function"){J.cancel("Stream cancelled by HEAD route").catch((Q)=>{Z.log.error({err:Q},"Error on Stream found for HEAD route")}),Y(null,null);return}let X=""+Buffer.byteLength(J);Z.header("content-length",X),Y(null,null)}function CF0($){if($==null)return _F;return Array.isArray($)?[...$,_F]:[$,_F]}kh.exports={parseHeadOnSendHandlers:CF0}});var Zg=S((ux0,$g)=>{var EF0=bF(),bF0=IG(),yh=rH(),{onRequestAbortHookRunner:_F0,lifecycleHooks:xh,preParsingHookRunner:SF0,onTimeoutHookRunner:fF0,onRequestHookRunner:kF0}=uZ(),{normalizeSchema:vF0}=xX(),{parseHeadOnSendHandlers:yF0}=vh(),{compileSchemasForValidation:xF0,compileSchemasForSerialization:hF0}=iH(),{FST_ERR_SCH_VALIDATION_BUILD:gF0,FST_ERR_SCH_SERIALIZATION_BUILD:uF0,FST_ERR_DUPLICATED_ROUTE:mF0,FST_ERR_INVALID_URL:lF0,FST_ERR_HOOK_INVALID_HANDLER:hh,FST_ERR_ROUTE_OPTIONS_NOT_OBJ:dF0,FST_ERR_ROUTE_DUPLICATED_HANDLER:pF0,FST_ERR_ROUTE_HANDLER_NOT_FN:gh,FST_ERR_ROUTE_MISSING_HANDLER:cF0,FST_ERR_ROUTE_METHOD_NOT_SUPPORTED:iF0,FST_ERR_ROUTE_METHOD_INVALID:nF0,FST_ERR_ROUTE_BODY_VALIDATION_SCHEMA_NOT_SUPPORTED:oF0,FST_ERR_ROUTE_BODY_LIMIT_OPTION_NOT_INT:sF0,FST_ERR_ROUTE_HANDLER_TIMEOUT_OPTION_NOT_INT:rF0,FST_ERR_HANDLER_TIMEOUT:aF0,FST_ERR_HOOK_INVALID_ASYNC_HANDLER:SF}=w$(),{kRoutePrefix:tF0,kSupportedHTTPMethods:vF,kLogLevel:eF0,kLogSerializers:uh,kHooks:mh,kSchemaController:$A0,kOptions:lh,kReplySerializerDefault:fF,kReplyIsError:th,kRequestPayloadStream:ZA0,kDisableRequestLogging:dh,kSchemaErrorFormatter:JA0,kErrorHandler:ph,kHasBeenDecorated:ch,kRequestAcceptVersion:kF,kRouteByFastify:YA0,kRouteContext:ih,kRequestSignal:XA0,kTimeoutTimer:nh,kOnAbort:QA0}=H$(),{buildErrorHandler:GA0}=hX(),{createChildLogger:WA0}=yX(),{getGenReqId:KA0}=IW(),{FSTDEP022:VA0}=wJ(),oh=["allowUnsafeRegex","buildPrettyMeta","caseSensitive","constraints","defaultRoute","ignoreDuplicateSlashes","ignoreTrailingSlash","maxParamLength","onBadUrl","querystringParser","useSemicolonDelimiter"];function UA0($){let Z=EF0($),J,Y,X,Q,G,W,K,V,U,H,B,z,F,A=!1;return{setup(I,_){if(J=_.avvio,Y=_.fourOhFour,X=I.logger,Q=_.hasLogger,G=_.setupResponseListeners,W=_.throwIfAlreadyStarted,z=I.exposeHeadRoutes,K=I.disableRequestLogging,typeof K==="function")V=I.disableRequestLogging;U=I.routerOptions.ignoreTrailingSlash,H=I.routerOptions.ignoreDuplicateSlashes,B=Object.hasOwn(I,"return503OnClosing")?I.return503OnClosing:!0,F=_.keepAliveConnections},routing:Z.lookup.bind(Z),route:R,hasRoute:M,prepareRoute:q,routeHandler:T,closeRoutes:()=>{A=!0},printRoutes:Z.prettyPrint.bind(Z),addConstraintStrategy:j,hasConstraintStrategy:N,isAsyncConstraint:w,findRoute:C};function j(I){return W("Cannot add constraint strategy!"),Z.addConstraintStrategy(I)}function N(I){return Z.hasConstraintStrategy(I)}function w(){return Z.constrainer.asyncStrategiesInUse.size>0}function q({method:I,url:_,options:E,handler:f,isFastify:b}){if(typeof _!=="string")throw new lF0(typeof _);if(!f&&typeof E==="function")f=E,E={};else if(f&&typeof f==="function"){if(Object.prototype.toString.call(E)!=="[object Object]")throw new dF0(I,_);else if(E.handler)if(typeof E.handler==="function")throw new pF0(I,_);else throw new gh(I,_)}return E=Object.assign({},E,{method:I,url:_,path:_,handler:f||E&&E.handler}),R.call(this,{options:E,isFastify:b})}function M({options:I}){let _=I.method?.toUpperCase()??"";return Z.hasRoute(_,I.url||"",I.constraints)}function C(I){let _=Z.find(I.method,I.url||"",I.constraints);if(_)return{handler:_.handler,params:_.params,searchParams:_.searchParams};else return null}function R({options:I,isFastify:_}){W("Cannot add route!");let E={...I},f=E.url||E.path||"";if(!E.handler)throw new cF0(E.method,f);if(E.errorHandler!==void 0&&typeof E.errorHandler!=="function")throw new gh(E.method,f);eh(E.bodyLimit),zA0(E.handlerTimeout);let b=E.exposeHeadRoute??z,y=!1,k=!1;if(Array.isArray(E.method))for(let t=0;t<E.method.length;++t)E.method[t]=sh.call(this,E.method[t]),rh.call(this,E.method[t],f,E.schema),y=E.method.includes("GET"),k=E.method.includes("HEAD");else E.method=sh.call(this,E.method),rh.call(this,E.method,f,E.schema),y=E.method==="GET",k=E.method==="HEAD";let g=b&&y?{...I}:null,d=this[tF0];if(f==="/"&&d.length>0&&E.method!=="HEAD")switch(E.prefixTrailingSlash){case"slash":p.call(this,{path:f,isFastify:_});break;case"no-slash":p.call(this,{path:"",isFastify:_});break;case"both":default:if(p.call(this,{path:"",isFastify:_}),U!==!0&&(H!==!0||!d.endsWith("/")))p.call(this,{path:f,prefixing:!0,isFastify:_})}else if(f[0]==="/"&&d.endsWith("/"))p.call(this,{path:f.slice(1),isFastify:_});else p.call(this,{path:f,isFastify:_});return this;function p({path:t,prefixing:r=!1,isFastify:G0=!1}){let O0=d+t;if(E.url=O0,E.path=O0,E.routePath=t,E.prefix=d,E.logLevel=E.logLevel||this[eF0],this[uh]||E.logSerializers)E.logSerializers=Object.assign(Object.create(this[uh]),E.logSerializers);if(E.attachValidation==null)E.attachValidation=!1;if(r===!1)for(let h of this[mh].onRoute)h.call(this,E);for(let h of xh)if(E&&h in E){if(Array.isArray(E[h]))for(let c of E[h]){if(typeof c!=="function")throw new hh(h,Object.prototype.toString.call(c));if(h==="onSend"||h==="preSerialization"||h==="onError"||h==="preParsing"){if(c.constructor.name==="AsyncFunction"&&c.length===4)throw new SF}else if(h==="onRequestAbort"){if(c.constructor.name==="AsyncFunction"&&c.length!==1)throw new SF}else if(c.constructor.name==="AsyncFunction"&&c.length===3)throw new SF}else if(E[h]!==void 0&&typeof E[h]!=="function")throw new hh(h,Object.prototype.toString.call(E[h]))}let h0=E.constraints||{},u={...E.config,url:O0,method:E.method},l=new bF0({schema:E.schema,handler:E.handler.bind(this),config:u,errorHandler:E.errorHandler,childLoggerFactory:E.childLoggerFactory,bodyLimit:E.bodyLimit,logLevel:E.logLevel,logSerializers:E.logSerializers,attachValidation:E.attachValidation,schemaErrorFormatter:E.schemaErrorFormatter,replySerializer:this[fF],validatorCompiler:E.validatorCompiler,serializerCompiler:E.serializerCompiler,exposeHeadRoute:b,prefixTrailingSlash:E.prefixTrailingSlash||"both",server:this,isFastify:G0,handlerTimeout:E.handlerTimeout}),v=Z.findRoute("HEAD",E.url,h0)!==null;try{Z.on(E.method,E.url,{constraints:h0},T,l)}catch(h){if(!l[YA0]){if(h.message.includes(`Method '${E.method}' already declared for route`))throw new mF0(E.method,E.url);throw h}}if(this.after((h,c)=>{l.errorHandler=E.errorHandler?GA0(this[ph],E.errorHandler):this[ph],l._parserOptions.limit=E.bodyLimit||null,l.logLevel=E.logLevel,l.logSerializers=E.logSerializers,l.attachValidation=E.attachValidation,l[fF]=this[fF],l.schemaErrorFormatter=E.schemaErrorFormatter||this[JA0]||l.schemaErrorFormatter,J.once("preReady",()=>{for(let m of xh){let a=this[mh][m].concat(E[m]||[]).map((e)=>e.bind(this));l[m]=a.length?a:null}while(!l.Request[ch]&&l.Request.parent)l.Request=l.Request.parent;while(!l.Reply[ch]&&l.Reply.parent)l.Reply=l.Reply.parent;if(Y.setContext(this,l),E.schema){l.schema=vF0(l.schema,this.initialConfig);let m=this[$A0],a=E.schema.body||E.schema.headers||E.schema.querystring||E.schema.params;if(!E.validatorCompiler&&a)m.setupValidator(this[lh]);try{let e=typeof E?.validatorCompiler==="function"||m.isCustomValidatorCompiler;xF0(l,E.validatorCompiler||m.validatorCompiler,e)}catch(e){throw new gF0(E.method,O0,e.message)}if(E.schema.response&&!E.serializerCompiler)m.setupSerializer(this[lh]);try{hF0(l,E.serializerCompiler||m.serializerCompiler)}catch(e){throw new uF0(E.method,O0,e.message)}}}),c(h)}),b&&y&&!k&&!v){let h=yF0(g.onSend);q.call(this,{method:"HEAD",url:t,options:{...g,onSend:h},isFastify:!0})}}}function T(I,_,E,f,b){let y=KA0(f.server,I),k={level:f.logLevel};if(f.logSerializers)k.serializers=f.logSerializers;let g=WA0(f,X,I,y,k);if(g[dh]=V?!1:K,A===!0){if(I.httpVersionMajor!==2)_.setHeader("Connection","close");if(B){let O0={"Content-Type":"application/json","Content-Length":"80"};_.writeHead(503,O0),_.end('{"error":"Service Unavailable","message":"Service Unavailable","statusCode":503}'),g.info({res:{statusCode:503}},"request aborted - refusing to accept new requests as server is closing");return}}if(String.prototype.toLowerCase.call(I.headers.connection||"")==="keep-alive"){if(F.has(I.socket)===!1)F.add(I.socket),I.socket.on("close",AA0.bind({keepAliveConnections:F,socket:I.socket}))}if(I.headers[kF]!==void 0)I.headers["accept-version"]=I.headers[kF],I.headers[kF]=void 0;let p=new f.Request(y,E,I,b,g,f),t=new f.Reply(_,p,g),r=V?V(p):K;if(g[dh]=r,r===!1)g.info({req:p},"incoming request");let G0=f.handlerTimeout;if(G0>0){let O0=new AbortController;p[XA0]=O0,p[nh]=setTimeout(()=>{if(!t.sent){let u=new aF0(G0,f.config?.url);O0.abort(u),t[th]=!0,t.send(u)}},G0);let h0=()=>{if(!O0.signal.aborted)O0.abort();clearTimeout(p[nh])};I.on("close",h0),p[QA0]=h0}if(Q===!0||f.onResponse!==null||G0>0)G(t);if(f.onRequest!==null)kF0(f.onRequest,p,t,ah);else ah(null,p,t);if(f.onRequestAbort!==null)I.on("close",()=>{if(I.aborted)_F0(f.onRequestAbort,p,HA0.bind(null,t))});if(f.onTimeout!==null){if(!p.raw.socket._meta)p.raw.socket.on("timeout",BA0);p.raw.socket._meta={context:f,request:p,reply:t}}}}function HA0($,Z){if(Z)$.log.error({err:Z},"onRequestAborted hook failed")}function BA0(){let{context:$,request:Z,reply:J}=this._meta;fF0($.onTimeout,Z,J,OA0)}function sh($){if(typeof $!=="string")throw new nF0;if($=$.toUpperCase(),!this[vF].bodyless.has($)&&!this[vF].bodywith.has($))throw new iF0($);return $}function rh($,Z,J){if(this[vF].bodyless.has($)&&J?.body)throw new oF0($,Z)}function eh($){if($===void 0)return;if(!Number.isInteger($)||$<=0)throw new sF0($)}function zA0($){if($===void 0)return;if(!Number.isInteger($)||$<=0)throw new rF0($)}function ah($,Z,J){if(J.sent===!0)return;if($!=null){J[th]=!0,J.send($);return}if(Z[ZA0]=Z.raw,Z[ih].preParsing!==null)SF0(Z[ih].preParsing,Z,J,yh.bind(Z.server));else yh.call(Z.server,null,Z,J)}function FA0($,Z){let J=$.routerOptions==null?Object.create(null):Object.assign(Object.create(null),$.routerOptions),Y=oh.filter((X)=>Object.hasOwn($,X));if(Y.length>0)VA0(Y.join(", "));for(let X of oh)if(!Object.hasOwn(J,X))J[X]=$[X]??Z[X];return J}function AA0(){this.keepAliveConnections.delete(this.socket)}function OA0(){}$g.exports={buildRouting:UA0,validateBodyLimitOption:eh,buildRouterOptions:FA0}});var Kg=S((mx0,Wg)=>{var qA0=bF(),Jg=MG(),Yg=PG(),jA0=IG(),{kRoutePrefix:NA0,kCanSetNotFoundHandler:SQ,kFourOhFourLevelInstance:fQ,kFourOhFourContext:f6,kHooks:MA0,kErrorHandler:Xg}=H$(),{lifecycleHooks:DA0}=uZ(),{buildErrorHandler:wA0}=hX(),{FST_ERR_NOT_FOUND:LA0}=w$(),{createChildLogger:Qg}=yX(),{getGenReqId:Gg}=IW();function TA0($){let{logger:Z,disableRequestLogging:J}=$,Y=qA0({onBadUrl:W(),defaultRoute:H}),X=null;return{router:Y,setNotFoundHandler:V,setContext:K,arrange404:Q};function Q(B){B[fQ]=B,B[SQ]=!0,Y.onBadUrl=Y.onBadUrl.bind(B),Y.defaultRoute=Y.defaultRoute.bind(B)}function G(B,z){let{url:F,method:A}=B.raw,j=`Route ${A}:${F} not found`;if(!(typeof J==="function"?J(B.raw):J))B.log.info(j);z.code(404).send({message:j,error:"Not Found",statusCode:404})}function W(){return function(z,F,A){let j=this[fQ][f6],N=Gg(j.server,F),w=Qg(j,Z,F,N),q=new Yg(N,null,F,null,w,j),M=new Jg(A,q,w);X(q,M)}}function K(B,z){let F=Object.assign({},B[f6]);F.onSend=z.onSend,z[f6]=F}function V(B,z,F,A){if(this[SQ]===void 0)this[SQ]=!0;if(this[f6]===void 0)this[f6]=null;let j=this,N=this[NA0]||"/";if(this[SQ]===!1)throw Error(`Not found handler already set for Fastify instance with prefix: '${N}'`);if(typeof B==="object"){if(B.preHandler)if(Array.isArray(B.preHandler))B.preHandler=B.preHandler.map((w)=>w.bind(j));else B.preHandler=B.preHandler.bind(j);if(B.preValidation)if(Array.isArray(B.preValidation))B.preValidation=B.preValidation.map((w)=>w.bind(j));else B.preValidation=B.preValidation.bind(j)}if(typeof B==="function")z=B,B=void 0;if(B=B||{},z)this[fQ][SQ]=!1,z=z.bind(this),X=z;else z=G,X=G;this.after((w,q)=>{U.call(this,N,B,z,F,A),q(w)})}function U(B,z,F,A,j){let N=new jA0({schema:z.schema,handler:F,config:z.config||{},server:this});if(A.once("preReady",()=>{let w=this[f6];for(let q of DA0){let M=this[MA0][q].concat(z[q]||[]).map((C)=>C.bind(this));w[q]=M.length?M:null}w.errorHandler=z.errorHandler?wA0(this[Xg],z.errorHandler):this[Xg]}),this[f6]!==null&&B==="/"){Object.assign(this[f6],N);return}this[fQ][f6]=N,Y.all(B+(B.endsWith("/")?"*":"/*"),j,N),Y.all(B,j,N)}function H(B,z){let F=this[fQ][f6],A=Gg(F.server,B),j=Qg(F,Z,B,A);j.info({req:B},"incoming request");let N=new Yg(A,null,B,null,j,F),w=new Jg(z,N,j);N.log.warn("the default handler for 404 did not catch this, this is likely a fastify bug, please report it"),N.log.warn(Y.prettyPrint()),w.code(404).send(new LA0)}}Wg.exports=TA0});var Vg=S((lx0,pW)=>{pW.exports=B1;pW.exports.default=B1;var RA0={type:"object",additionalProperties:!1,properties:{connectionTimeout:{type:"integer",default:0},keepAliveTimeout:{type:"integer",default:72000},forceCloseConnections:{oneOf:[{type:"string",pattern:"idle"},{type:"boolean"}]},maxRequestsPerSocket:{type:"integer",default:0,nullable:!0},requestTimeout:{type:"integer",default:0},handlerTimeout:{type:"integer",default:0},bodyLimit:{type:"integer",default:1048576},caseSensitive:{type:"boolean",default:!0},allowUnsafeRegex:{type:"boolean",default:!1},http2:{type:"boolean"},https:{if:{not:{oneOf:[{type:"boolean"},{type:"null"},{type:"object",additionalProperties:!1,required:["allowHTTP1"],properties:{allowHTTP1:{type:"boolean"}}}]}},then:{setDefaultValue:!0}},ignoreTrailingSlash:{type:"boolean",default:!1},ignoreDuplicateSlashes:{type:"boolean",default:!1},disableRequestLogging:{default:!1},maxParamLength:{type:"integer",default:100},onProtoPoisoning:{type:"string",default:"error"},onConstructorPoisoning:{type:"string",default:"error"},pluginTimeout:{type:"integer",default:1e4},requestIdHeader:{anyOf:[{type:"boolean"},{type:"string"}],default:!1},requestIdLogLabel:{type:"string",default:"reqId"},http2SessionTimeout:{type:"integer",default:72000},exposeHeadRoutes:{type:"boolean",default:!0},useSemicolonDelimiter:{type:"boolean",default:!1},routerOptions:{type:"object",additionalProperties:!0,properties:{ignoreTrailingSlash:{type:"boolean",default:!1},ignoreDuplicateSlashes:{type:"boolean",default:!1},maxParamLength:{type:"integer",default:100},allowUnsafeRegex:{type:"boolean",default:!1},useSemicolonDelimiter:{type:"boolean",default:!1}}},constraints:{type:"object",additionalProperties:{type:"object",required:["name","storage","validate","deriveConstraint"],additionalProperties:!0,properties:{name:{type:"string"},storage:{},validate:{},deriveConstraint:{}}}}}},PA0=Object.prototype.hasOwnProperty,IA0=new RegExp("idle","u");function B1($,{instancePath:Z="",parentData:J,parentDataProperty:Y,rootData:X=$}={}){let Q=null,G=0;if(G===0)if($&&typeof $=="object"&&!Array.isArray($)){if($.connectionTimeout===void 0)$.connectionTimeout=0;if($.keepAliveTimeout===void 0)$.keepAliveTimeout=72000;if($.maxRequestsPerSocket===void 0)$.maxRequestsPerSocket=0;if($.requestTimeout===void 0)$.requestTimeout=0;if($.handlerTimeout===void 0)$.handlerTimeout=0;if($.bodyLimit===void 0)$.bodyLimit=1048576;if($.caseSensitive===void 0)$.caseSensitive=!0;if($.allowUnsafeRegex===void 0)$.allowUnsafeRegex=!1;if($.ignoreTrailingSlash===void 0)$.ignoreTrailingSlash=!1;if($.ignoreDuplicateSlashes===void 0)$.ignoreDuplicateSlashes=!1;if($.disableRequestLogging===void 0)$.disableRequestLogging=!1;if($.maxParamLength===void 0)$.maxParamLength=100;if($.onProtoPoisoning===void 0)$.onProtoPoisoning="error";if($.onConstructorPoisoning===void 0)$.onConstructorPoisoning="error";if($.pluginTimeout===void 0)$.pluginTimeout=1e4;if($.requestIdHeader===void 0)$.requestIdHeader=!1;if($.requestIdLogLabel===void 0)$.requestIdLogLabel="reqId";if($.http2SessionTimeout===void 0)$.http2SessionTimeout=72000;if($.exposeHeadRoutes===void 0)$.exposeHeadRoutes=!0;if($.useSemicolonDelimiter===void 0)$.useSemicolonDelimiter=!1;let A=G;for(let j in $)if(!PA0.call(RA0.properties,j))delete $[j];if(A===G){let j=$.connectionTimeout,N=G;if(!(typeof j=="number"&&(!(j%1)&&!isNaN(j))&&isFinite(j))){let w=typeof j,q=void 0;if(q===void 0)if(w==="boolean"||j===null||w==="string"&&j&&j==+j&&!(j%1))q=+j;else return B1.errors=[{instancePath:Z+"/connectionTimeout",schemaPath:"#/properties/connectionTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(q!==void 0){if(j=q,$!==void 0)$.connectionTimeout=q}}var W=N===G;if(W){let w=$.keepAliveTimeout,q=G;if(!(typeof w=="number"&&(!(w%1)&&!isNaN(w))&&isFinite(w))){let C=typeof w,R=void 0;if(R===void 0)if(C==="boolean"||w===null||C==="string"&&w&&w==+w&&!(w%1))R=+w;else return B1.errors=[{instancePath:Z+"/keepAliveTimeout",schemaPath:"#/properties/keepAliveTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(R!==void 0){if(w=R,$!==void 0)$.keepAliveTimeout=R}}var W=q===G;if(W){if($.forceCloseConnections!==void 0){let C=$.forceCloseConnections,R=G,T=G,I=!1,_=null,E=G;if(typeof C!=="string"){let y=typeof C,k=void 0;if(k===void 0)if(y=="number"||y=="boolean")k=""+C;else if(C===null)k="";else{let g={instancePath:Z+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/0/type",keyword:"type",params:{type:"string"},message:"must be string"};if(Q===null)Q=[g];else Q.push(g);G++}if(k!==void 0){if(C=k,$!==void 0)$.forceCloseConnections=k}}if(G===E){if(typeof C==="string"){if(!IA0.test(C)){let y={instancePath:Z+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/0/pattern",keyword:"pattern",params:{pattern:"idle"},message:'must match pattern "idle"'};if(Q===null)Q=[y];else Q.push(y);G++}}}var K=E===G;if(K)I=!0,_=0;let f=G;if(typeof C!=="boolean"){let y=void 0;if(y===void 0)if(C==="false"||C===0||C===null)y=!1;else if(C==="true"||C===1)y=!0;else{let k={instancePath:Z+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/1/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"};if(Q===null)Q=[k];else Q.push(k);G++}if(y!==void 0){if(C=y,$!==void 0)$.forceCloseConnections=y}}var K=f===G;if(K&&I)I=!1,_=[_,1];else if(K)I=!0,_=1;if(!I){let y={instancePath:Z+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf",keyword:"oneOf",params:{passingSchemas:_},message:"must match exactly one schema in oneOf"};if(Q===null)Q=[y];else Q.push(y);return G++,B1.errors=Q,!1}else if(G=T,Q!==null)if(T)Q.length=T;else Q=null;var W=R===G}else var W=!0;if(W){let C=$.maxRequestsPerSocket,R=G;if(!(typeof C=="number"&&(!(C%1)&&!isNaN(C))&&isFinite(C))&&C!==null){let I=typeof C,_=void 0;if(_===void 0)if(I==="boolean"||C===null||I==="string"&&C&&C==+C&&!(C%1))_=+C;else if(C===""||C===0||C===!1)_=null;else return B1.errors=[{instancePath:Z+"/maxRequestsPerSocket",schemaPath:"#/properties/maxRequestsPerSocket/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(_!==void 0){if(C=_,$!==void 0)$.maxRequestsPerSocket=_}}var W=R===G;if(W){let I=$.requestTimeout,_=G;if(!(typeof I=="number"&&(!(I%1)&&!isNaN(I))&&isFinite(I))){let f=typeof I,b=void 0;if(b===void 0)if(f==="boolean"||I===null||f==="string"&&I&&I==+I&&!(I%1))b=+I;else return B1.errors=[{instancePath:Z+"/requestTimeout",schemaPath:"#/properties/requestTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(b!==void 0){if(I=b,$!==void 0)$.requestTimeout=b}}var W=_===G;if(W){let f=$.handlerTimeout,b=G;if(!(typeof f=="number"&&(!(f%1)&&!isNaN(f))&&isFinite(f))){let k=typeof f,g=void 0;if(g===void 0)if(k==="boolean"||f===null||k==="string"&&f&&f==+f&&!(f%1))g=+f;else return B1.errors=[{instancePath:Z+"/handlerTimeout",schemaPath:"#/properties/handlerTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(g!==void 0){if(f=g,$!==void 0)$.handlerTimeout=g}}var W=b===G;if(W){let k=$.bodyLimit,g=G;if(!(typeof k=="number"&&(!(k%1)&&!isNaN(k))&&isFinite(k))){let p=typeof k,t=void 0;if(t===void 0)if(p==="boolean"||k===null||p==="string"&&k&&k==+k&&!(k%1))t=+k;else return B1.errors=[{instancePath:Z+"/bodyLimit",schemaPath:"#/properties/bodyLimit/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(t!==void 0){if(k=t,$!==void 0)$.bodyLimit=t}}var W=g===G;if(W){let p=$.caseSensitive,t=G;if(typeof p!=="boolean"){let G0=void 0;if(G0===void 0)if(p==="false"||p===0||p===null)G0=!1;else if(p==="true"||p===1)G0=!0;else return B1.errors=[{instancePath:Z+"/caseSensitive",schemaPath:"#/properties/caseSensitive/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(G0!==void 0){if(p=G0,$!==void 0)$.caseSensitive=G0}}var W=t===G;if(W){let G0=$.allowUnsafeRegex,O0=G;if(typeof G0!=="boolean"){let u=void 0;if(u===void 0)if(G0==="false"||G0===0||G0===null)u=!1;else if(G0==="true"||G0===1)u=!0;else return B1.errors=[{instancePath:Z+"/allowUnsafeRegex",schemaPath:"#/properties/allowUnsafeRegex/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(u!==void 0){if(G0=u,$!==void 0)$.allowUnsafeRegex=u}}var W=O0===G;if(W){if($.http2!==void 0){let u=$.http2,l=G;if(typeof u!=="boolean"){let v=void 0;if(v===void 0)if(u==="false"||u===0||u===null)v=!1;else if(u==="true"||u===1)v=!0;else return B1.errors=[{instancePath:Z+"/http2",schemaPath:"#/properties/http2/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(v!==void 0){if(u=v,$!==void 0)$.http2=v}}var W=l===G}else var W=!0;if(W){if($.https!==void 0){let u=$.https,l=G,$0=G,v=!0,h=G,c=G,m=G,a=G,e=!1,H0=null,A0=G;if(typeof u!=="boolean"){let o=void 0;if(o===void 0)if(u==="false"||u===0||u===null)o=!1;else if(u==="true"||u===1)o=!0;else{let K0={};if(Q===null)Q=[K0];else Q.push(K0);G++}if(o!==void 0){if(u=o,$!==void 0)$.https=o}}var V=A0===G;if(V)e=!0,H0=0;let P0=G;if(u!==null){let o=void 0;if(o===void 0)if(u===""||u===0||u===!1)o=null;else{let K0={};if(Q===null)Q=[K0];else Q.push(K0);G++}if(o!==void 0){if(u=o,$!==void 0)$.https=o}}var V=P0===G;if(V&&e)e=!1,H0=[H0,1];else{if(V)e=!0,H0=1;let o=G;if(G===o)if(u&&typeof u=="object"&&!Array.isArray(u)){let z0;if(u.allowHTTP1===void 0&&(z0="allowHTTP1")){let j0={};if(Q===null)Q=[j0];else Q.push(j0);G++}else{let j0=G;for(let Q1 in u)if(Q1!=="allowHTTP1")delete u[Q1];if(j0===G){if(u.allowHTTP1!==void 0){let Q1=u.allowHTTP1;if(typeof Q1!=="boolean"){let _0=void 0;if(_0===void 0)if(Q1==="false"||Q1===0||Q1===null)_0=!1;else if(Q1==="true"||Q1===1)_0=!0;else{let e0={};if(Q===null)Q=[e0];else Q.push(e0);G++}if(_0!==void 0){if(Q1=_0,u!==void 0)u.allowHTTP1=_0}}}}}}else{let z0={};if(Q===null)Q=[z0];else Q.push(z0);G++}var V=o===G;if(V&&e)e=!1,H0=[H0,2];else if(V)e=!0,H0=2}if(!e){let o={};if(Q===null)Q=[o];else Q.push(o);G++}else if(G=a,Q!==null)if(a)Q.length=a;else Q=null;var U=m===G;if(U){let o={};if(Q===null)Q=[o];else Q.push(o);G++}else if(G=c,Q!==null)if(c)Q.length=c;else Q=null;var H=h===G;if(G=$0,Q!==null)if($0)Q.length=$0;else Q=null;if(H){let o=G;$.https=!0;var H=o===G;v=H}if(!v){let o={instancePath:Z+"/https",schemaPath:"#/properties/https/if",keyword:"if",params:{failingKeyword:"then"},message:'must match "then" schema'};if(Q===null)Q=[o];else Q.push(o);return G++,B1.errors=Q,!1}var W=l===G}else var W=!0;if(W){let u=$.ignoreTrailingSlash,l=G;if(typeof u!=="boolean"){let v=void 0;if(v===void 0)if(u==="false"||u===0||u===null)v=!1;else if(u==="true"||u===1)v=!0;else return B1.errors=[{instancePath:Z+"/ignoreTrailingSlash",schemaPath:"#/properties/ignoreTrailingSlash/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(v!==void 0){if(u=v,$!==void 0)$.ignoreTrailingSlash=v}}var W=l===G;if(W){let v=$.ignoreDuplicateSlashes,h=G;if(typeof v!=="boolean"){let m=void 0;if(m===void 0)if(v==="false"||v===0||v===null)m=!1;else if(v==="true"||v===1)m=!0;else return B1.errors=[{instancePath:Z+"/ignoreDuplicateSlashes",schemaPath:"#/properties/ignoreDuplicateSlashes/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(m!==void 0){if(v=m,$!==void 0)$.ignoreDuplicateSlashes=m}}var W=h===G;if(W){let m=$.maxParamLength,a=G;if(!(typeof m=="number"&&(!(m%1)&&!isNaN(m))&&isFinite(m))){let H0=typeof m,A0=void 0;if(A0===void 0)if(H0==="boolean"||m===null||H0==="string"&&m&&m==+m&&!(m%1))A0=+m;else return B1.errors=[{instancePath:Z+"/maxParamLength",schemaPath:"#/properties/maxParamLength/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(A0!==void 0){if(m=A0,$!==void 0)$.maxParamLength=A0}}var W=a===G;if(W){let H0=$.onProtoPoisoning,A0=G;if(typeof H0!=="string"){let s0=typeof H0,o=void 0;if(o===void 0)if(s0=="number"||s0=="boolean")o=""+H0;else if(H0===null)o="";else return B1.errors=[{instancePath:Z+"/onProtoPoisoning",schemaPath:"#/properties/onProtoPoisoning/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(o!==void 0){if(H0=o,$!==void 0)$.onProtoPoisoning=o}}var W=A0===G;if(W){let s0=$.onConstructorPoisoning,o=G;if(typeof s0!=="string"){let z0=typeof s0,j0=void 0;if(j0===void 0)if(z0=="number"||z0=="boolean")j0=""+s0;else if(s0===null)j0="";else return B1.errors=[{instancePath:Z+"/onConstructorPoisoning",schemaPath:"#/properties/onConstructorPoisoning/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(j0!==void 0){if(s0=j0,$!==void 0)$.onConstructorPoisoning=j0}}var W=o===G;if(W){let z0=$.pluginTimeout,j0=G;if(!(typeof z0=="number"&&(!(z0%1)&&!isNaN(z0))&&isFinite(z0))){let _0=typeof z0,e0=void 0;if(e0===void 0)if(_0==="boolean"||z0===null||_0==="string"&&z0&&z0==+z0&&!(z0%1))e0=+z0;else return B1.errors=[{instancePath:Z+"/pluginTimeout",schemaPath:"#/properties/pluginTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(e0!==void 0){if(z0=e0,$!==void 0)$.pluginTimeout=e0}}var W=j0===G;if(W){let _0=$.requestIdHeader,e0=G,S0=G,C1=!1,n0=G;if(typeof _0!=="boolean"){let a0=void 0;if(a0===void 0)if(_0==="false"||_0===0||_0===null)a0=!1;else if(_0==="true"||_0===1)a0=!0;else{let U1={instancePath:Z+"/requestIdHeader",schemaPath:"#/properties/requestIdHeader/anyOf/0/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"};if(Q===null)Q=[U1];else Q.push(U1);G++}if(a0!==void 0){if(_0=a0,$!==void 0)$.requestIdHeader=a0}}var B=n0===G;if(C1=C1||B,!C1){let a0=G;if(typeof _0!=="string"){let x=typeof _0,i=void 0;if(i===void 0)if(x=="number"||x=="boolean")i=""+_0;else if(_0===null)i="";else{let n={instancePath:Z+"/requestIdHeader",schemaPath:"#/properties/requestIdHeader/anyOf/1/type",keyword:"type",params:{type:"string"},message:"must be string"};if(Q===null)Q=[n];else Q.push(n);G++}if(i!==void 0){if(_0=i,$!==void 0)$.requestIdHeader=i}}var B=a0===G;C1=C1||B}if(!C1){let a0={instancePath:Z+"/requestIdHeader",schemaPath:"#/properties/requestIdHeader/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(Q===null)Q=[a0];else Q.push(a0);return G++,B1.errors=Q,!1}else if(G=S0,Q!==null)if(S0)Q.length=S0;else Q=null;var W=e0===G;if(W){let a0=$.requestIdLogLabel,U1=G;if(typeof a0!=="string"){let i=typeof a0,n=void 0;if(n===void 0)if(i=="number"||i=="boolean")n=""+a0;else if(a0===null)n="";else return B1.errors=[{instancePath:Z+"/requestIdLogLabel",schemaPath:"#/properties/requestIdLogLabel/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(n!==void 0){if(a0=n,$!==void 0)$.requestIdLogLabel=n}}var W=U1===G;if(W){let i=$.http2SessionTimeout,n=G;if(!(typeof i=="number"&&(!(i%1)&&!isNaN(i))&&isFinite(i))){let C0=typeof i,M0=void 0;if(M0===void 0)if(C0==="boolean"||i===null||C0==="string"&&i&&i==+i&&!(i%1))M0=+i;else return B1.errors=[{instancePath:Z+"/http2SessionTimeout",schemaPath:"#/properties/http2SessionTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(M0!==void 0){if(i=M0,$!==void 0)$.http2SessionTimeout=M0}}var W=n===G;if(W){let C0=$.exposeHeadRoutes,M0=G;if(typeof C0!=="boolean"){let g0=void 0;if(g0===void 0)if(C0==="false"||C0===0||C0===null)g0=!1;else if(C0==="true"||C0===1)g0=!0;else return B1.errors=[{instancePath:Z+"/exposeHeadRoutes",schemaPath:"#/properties/exposeHeadRoutes/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(g0!==void 0){if(C0=g0,$!==void 0)$.exposeHeadRoutes=g0}}var W=M0===G;if(W){let g0=$.useSemicolonDelimiter,Z0=G;if(typeof g0!=="boolean"){let V0=void 0;if(V0===void 0)if(g0==="false"||g0===0||g0===null)V0=!1;else if(g0==="true"||g0===1)V0=!0;else return B1.errors=[{instancePath:Z+"/useSemicolonDelimiter",schemaPath:"#/properties/useSemicolonDelimiter/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(V0!==void 0){if(g0=V0,$!==void 0)$.useSemicolonDelimiter=V0}}var W=Z0===G;if(W){if($.routerOptions!==void 0){let V0=$.routerOptions,$1=G;if(G===$1)if(V0&&typeof V0=="object"&&!Array.isArray(V0)){if(V0.ignoreTrailingSlash===void 0)V0.ignoreTrailingSlash=!1;if(V0.ignoreDuplicateSlashes===void 0)V0.ignoreDuplicateSlashes=!1;if(V0.maxParamLength===void 0)V0.maxParamLength=100;if(V0.allowUnsafeRegex===void 0)V0.allowUnsafeRegex=!1;if(V0.useSemicolonDelimiter===void 0)V0.useSemicolonDelimiter=!1;let H1=V0.ignoreTrailingSlash,P1=G;if(typeof H1!=="boolean"){let E1=void 0;if(E1===void 0)if(H1==="false"||H1===0||H1===null)E1=!1;else if(H1==="true"||H1===1)E1=!0;else return B1.errors=[{instancePath:Z+"/routerOptions/ignoreTrailingSlash",schemaPath:"#/properties/routerOptions/properties/ignoreTrailingSlash/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(E1!==void 0){if(H1=E1,V0!==void 0)V0.ignoreTrailingSlash=E1}}var z=P1===G;if(z){let E1=V0.ignoreDuplicateSlashes,b1=G;if(typeof E1!=="boolean"){let m1=void 0;if(m1===void 0)if(E1==="false"||E1===0||E1===null)m1=!1;else if(E1==="true"||E1===1)m1=!0;else return B1.errors=[{instancePath:Z+"/routerOptions/ignoreDuplicateSlashes",schemaPath:"#/properties/routerOptions/properties/ignoreDuplicateSlashes/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(m1!==void 0){if(E1=m1,V0!==void 0)V0.ignoreDuplicateSlashes=m1}}var z=b1===G;if(z){let m1=V0.maxParamLength,i8=G;if(!(typeof m1=="number"&&(!(m1%1)&&!isNaN(m1))&&isFinite(m1))){let A8=typeof m1,O6=void 0;if(O6===void 0)if(A8==="boolean"||m1===null||A8==="string"&&m1&&m1==+m1&&!(m1%1))O6=+m1;else return B1.errors=[{instancePath:Z+"/routerOptions/maxParamLength",schemaPath:"#/properties/routerOptions/properties/maxParamLength/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(O6!==void 0){if(m1=O6,V0!==void 0)V0.maxParamLength=O6}}var z=i8===G;if(z){let A8=V0.allowUnsafeRegex,O6=G;if(typeof A8!=="boolean"){let y$=void 0;if(y$===void 0)if(A8==="false"||A8===0||A8===null)y$=!1;else if(A8==="true"||A8===1)y$=!0;else return B1.errors=[{instancePath:Z+"/routerOptions/allowUnsafeRegex",schemaPath:"#/properties/routerOptions/properties/allowUnsafeRegex/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(y$!==void 0){if(A8=y$,V0!==void 0)V0.allowUnsafeRegex=y$}}var z=O6===G;if(z){let y$=V0.useSemicolonDelimiter,U9=G;if(typeof y$!=="boolean"){let O8=void 0;if(O8===void 0)if(y$==="false"||y$===0||y$===null)O8=!1;else if(y$==="true"||y$===1)O8=!0;else return B1.errors=[{instancePath:Z+"/routerOptions/useSemicolonDelimiter",schemaPath:"#/properties/routerOptions/properties/useSemicolonDelimiter/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(O8!==void 0){if(y$=O8,V0!==void 0)V0.useSemicolonDelimiter=O8}}var z=U9===G}}}}}else return B1.errors=[{instancePath:Z+"/routerOptions",schemaPath:"#/properties/routerOptions/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var W=$1===G}else var W=!0;if(W)if($.constraints!==void 0){let V0=$.constraints,$1=G;if(G===$1)if(V0&&typeof V0=="object"&&!Array.isArray(V0))for(let H1 in V0){let P1=V0[H1],E1=G;if(G===E1)if(P1&&typeof P1=="object"&&!Array.isArray(P1)){let b1;if(P1.name===void 0&&(b1="name")||P1.storage===void 0&&(b1="storage")||P1.validate===void 0&&(b1="validate")||P1.deriveConstraint===void 0&&(b1="deriveConstraint"))return B1.errors=[{instancePath:Z+"/constraints/"+H1.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/constraints/additionalProperties/required",keyword:"required",params:{missingProperty:b1},message:"must have required property '"+b1+"'"}],!1;else if(P1.name!==void 0){let A6=P1.name;if(typeof A6!=="string"){let m1=typeof A6,i8=void 0;if(i8===void 0)if(m1=="number"||m1=="boolean")i8=""+A6;else if(A6===null)i8="";else return B1.errors=[{instancePath:Z+"/constraints/"+H1.replace(/~/g,"~0").replace(/\//g,"~1")+"/name",schemaPath:"#/properties/constraints/additionalProperties/properties/name/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(i8!==void 0){if(A6=i8,P1!==void 0)P1.name=i8}}}}else return B1.errors=[{instancePath:Z+"/constraints/"+H1.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/constraints/additionalProperties/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var F=E1===G;if(!F)break}else return B1.errors=[{instancePath:Z+"/constraints",schemaPath:"#/properties/constraints/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var W=$1===G}else var W=!0}}}}}}}}}}}}}}}}}}}}}}}}else return B1.errors=[{instancePath:Z,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return B1.errors=Q,G===0}pW.exports.defaultInitOptions={connectionTimeout:0,keepAliveTimeout:72000,maxRequestsPerSocket:0,requestTimeout:0,handlerTimeout:0,bodyLimit:1048576,caseSensitive:!0,allowUnsafeRegex:!1,disableRequestLogging:!1,ignoreTrailingSlash:!1,ignoreDuplicateSlashes:!1,maxParamLength:100,onProtoPoisoning:"error",onConstructorPoisoning:"error",pluginTimeout:1e4,requestIdHeader:!1,requestIdLogLabel:"reqId",http2SessionTimeout:72000,exposeHeadRoutes:!0,useSemicolonDelimiter:!1,allowErrorHandlerOverride:!0,routerOptions:{ignoreTrailingSlash:!1,ignoreDuplicateSlashes:!1,maxParamLength:100,allowUnsafeRegex:!1,useSemicolonDelimiter:!1}}});var Ug=S((dx0,iW)=>{var cW=Vg(),CA0=WG()({circles:!0,proto:!1}),{FST_ERR_INIT_OPTS_INVALID:EA0}=w$();function bA0($){let Z=CA0($);if(!cW(Z)){let J=new EA0(JSON.stringify(cW.errors.map((Y)=>Y.message)));throw J.errors=cW.errors,J}return yF(Z)}function yF($){let Z=Object.getOwnPropertyNames($);for(let J of Z){let Y=$[J];if(ArrayBuffer.isView(Y)&&!(Y instanceof DataView))continue;$[J]=Y&&typeof Y==="object"?yF(Y):Y}return Object.freeze($)}iW.exports=bA0;iW.exports.defaultInitOptions=cW.defaultInitOptions;iW.exports.utils={deepFreezeObject:yF}});var Ng=S((px0,jg)=>{var{kAvvioBoot:_A0,kChildren:Hg,kRoutePrefix:Bg,kLogLevel:zg,kLogSerializers:xF,kHooks:hF,kSchemaController:GY,kContentTypeParser:Fg,kReply:Ag,kRequest:Og,kFourOhFour:SA0,kPluginNameChain:qg,kErrorHandlerAlreadySet:fA0}=H$(),kA0=MG(),vA0=PG(),yA0=XF(),xA0=jz(),{buildHooks:hA0}=uZ(),kQ=UF();jg.exports=function(Z,J,Y){let X=kQ.registerPlugin.call(Z,J),Q=kQ.getPluginName(J)||kQ.getFuncPreview(J);if(X)return Z[qg].push(Q),Z;let G=Object.create(Z);if(Z[Hg].push(G),G.ready=Z[_A0].bind(G),G[Hg]=[],G[Ag]=kA0.buildReply(G[Ag]),G[Og]=vA0.buildRequest(G[Og]),G[Fg]=xA0.helpers.buildContentTypeParser(G[Fg]),G[hF]=hA0(G[hF]),G[Bg]=gA0(G[Bg],Y.prefix),G[zg]=Y.logLevel||G[zg],G[GY]=yA0.buildSchemaController(Z[GY]),G.getSchema=G[GY].getSchema.bind(G[GY]),G.getSchemas=G[GY].getSchemas.bind(G[GY]),G[kQ.kRegisteredPlugins]=Object.create(G[kQ.kRegisteredPlugins]),G[qg]=[Q],G[fA0]=!1,G[xF]||Y.logSerializers)G[xF]=Object.assign(Object.create(G[xF]),Y.logSerializers);if(Y.prefix)G[SA0].arrange404(G);for(let W of G[hF].onRegister)W.call(Z,G,Y);return G};function gA0($,Z){if(!Z)return $;if($.endsWith("/")&&Z[0]==="/")Z=Z.slice(1);else if(Z[0]!=="/")Z="/"+Z;return $+Z}});var Ig=S((Tg)=>{Object.defineProperty(Tg,"__esModule",{value:!0});Tg.parseCookie=wg;Tg.parse=wg;Tg.stringifyCookie=cA0;Tg.stringifySetCookie=nW;Tg.serialize=nW;Tg.parseSetCookie=iA0;Tg.stringifySetCookie=nW;Tg.serialize=nW;var Mg=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,Dg=/^[\u0021-\u003A\u003C-\u007E]*$/,uA0=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,mA0=/^[\u0020-\u003A\u003D-\u007E]*$/,lA0=/^-?\d+$/,dA0=Object.prototype.toString,pA0=(()=>{let $=function(){};return $.prototype=Object.create(null),$})();function wg($,Z){let J=new pA0,Y=$.length;if(Y<2)return J;let X=Z?.decode||Lg,Q=0;do{let G=uF($,Q,Y);if(G===-1)break;let W=gF($,Q,Y);if(G>W){Q=$.lastIndexOf(";",G-1)+1;continue}let K=Z5($,Q,G);if(J[K]===void 0)J[K]=X(Z5($,G+1,W));Q=W+1}while(Q<Y);return J}function cA0($,Z){let J=Z?.encode||encodeURIComponent,Y=[];for(let X of Object.keys($)){let Q=$[X];if(Q===void 0)continue;if(!Mg.test(X))throw TypeError(`cookie name is invalid: ${X}`);let G=J(Q);if(!Dg.test(G))throw TypeError(`cookie val is invalid: ${Q}`);Y.push(`${X}=${G}`)}return Y.join("; ")}function nW($,Z,J){let Y=typeof $==="object"?$:{...J,name:$,value:String(Z)},Q=(typeof Z==="object"?Z:J)?.encode||encodeURIComponent;if(!Mg.test(Y.name))throw TypeError(`argument name is invalid: ${Y.name}`);let G=Y.value?Q(Y.value):"";if(!Dg.test(G))throw TypeError(`argument val is invalid: ${Y.value}`);let W=Y.name+"="+G;if(Y.maxAge!==void 0){if(!Number.isInteger(Y.maxAge))throw TypeError(`option maxAge is invalid: ${Y.maxAge}`);W+="; Max-Age="+Y.maxAge}if(Y.domain){if(!uA0.test(Y.domain))throw TypeError(`option domain is invalid: ${Y.domain}`);W+="; Domain="+Y.domain}if(Y.path){if(!mA0.test(Y.path))throw TypeError(`option path is invalid: ${Y.path}`);W+="; Path="+Y.path}if(Y.expires){if(!nA0(Y.expires)||!Number.isFinite(Y.expires.valueOf()))throw TypeError(`option expires is invalid: ${Y.expires}`);W+="; Expires="+Y.expires.toUTCString()}if(Y.httpOnly)W+="; HttpOnly";if(Y.secure)W+="; Secure";if(Y.partitioned)W+="; Partitioned";if(Y.priority)switch(typeof Y.priority==="string"?Y.priority.toLowerCase():void 0){case"low":W+="; Priority=Low";break;case"medium":W+="; Priority=Medium";break;case"high":W+="; Priority=High";break;default:throw TypeError(`option priority is invalid: ${Y.priority}`)}if(Y.sameSite)switch(typeof Y.sameSite==="string"?Y.sameSite.toLowerCase():Y.sameSite){case!0:case"strict":W+="; SameSite=Strict";break;case"lax":W+="; SameSite=Lax";break;case"none":W+="; SameSite=None";break;default:throw TypeError(`option sameSite is invalid: ${Y.sameSite}`)}return W}function iA0($,Z){let J=Z?.decode||Lg,Y=$.length,X=gF($,0,Y),Q=uF($,0,X),G=Q===-1?{name:"",value:J(Z5($,0,X))}:{name:Z5($,0,Q),value:J(Z5($,Q+1,X))},W=X+1;while(W<Y){let K=gF($,W,Y),V=uF($,W,K),U=V===-1?Z5($,W,K):Z5($,W,V),H=V===-1?void 0:Z5($,V+1,K);switch(U.toLowerCase()){case"httponly":G.httpOnly=!0;break;case"secure":G.secure=!0;break;case"partitioned":G.partitioned=!0;break;case"domain":G.domain=H;break;case"path":G.path=H;break;case"max-age":if(H&&lA0.test(H))G.maxAge=Number(H);break;case"expires":if(!H)break;let B=new Date(H);if(Number.isFinite(B.valueOf()))G.expires=B;break;case"priority":if(!H)break;let z=H.toLowerCase();if(z==="low"||z==="medium"||z==="high")G.priority=z;break;case"samesite":if(!H)break;let F=H.toLowerCase();if(F==="lax"||F==="strict"||F==="none")G.sameSite=F;break}W=K+1}return G}function gF($,Z,J){let Y=$.indexOf(";",Z);return Y===-1?J:Y}function uF($,Z,J){let Y=$.indexOf("=",Z);return Y<J?Y:-1}function Z5($,Z,J){let Y=Z,X=J;do{let Q=$.charCodeAt(Y);if(Q!==32&&Q!==9)break}while(++Y<X);while(X>Y){let Q=$.charCodeAt(X-1);if(Q!==32&&Q!==9)break;X--}return $.slice(Y,X)}function Lg($){if($.indexOf("%")===-1)return $;try{return decodeURIComponent($)}catch(Z){return $}}function nA0($){return dA0.call($)==="[object Date]"}});var Eg=S((ix0,oW)=>{var{format:mF}=Y0("util");function tA0($){return Cg({...$,name:"DeprecationWarning"})}function Cg({name:$,code:Z,message:J,unlimited:Y=!1}={}){if(!$)throw Error("Warning name must not be empty");if(!Z)throw Error("Warning code must not be empty");if(!J)throw Error("Warning message must not be empty");if(typeof Y!=="boolean")throw Error("Warning opts.unlimited must be a boolean");Z=Z.toUpperCase();let X={[$]:function(G,W,K){if(Q.emitted===!0&&Q.unlimited!==!0)return;Q.emitted=!0,process.emitWarning(Q.format(G,W,K),Q.name,Q.code)}};if(Y)X={[$]:function(G,W,K){Q.emitted=!0,process.emitWarning(Q.format(G,W,K),Q.name,Q.code)}};let Q=X[$];return Q.emitted=!1,Q.message=J,Q.unlimited=Y,Q.code=Z,Q.format=function(G,W,K){let V;if(G&&W&&K)V=mF(J,G,W,K);else if(G&&W)V=mF(J,G,W);else if(G)V=mF(J,G);else V=J;return V},Q}var lF={createWarning:Cg,createDeprecation:tA0};oW.exports=lF;oW.exports.default=lF;oW.exports.processWarning=lF});var Sg=S((nx0,_g)=>{var{URL:bg}=Y0("url");_g.exports=function(Z,J){if((typeof Z==="string"||Object.prototype.toString.call(Z)==="[object String]")&&Z.startsWith("//"))Z="http://localhost"+Z;let Y=typeof Z==="object"?Object.assign(new bg("http://localhost"),Z):new bg(Z,"http://localhost");if(typeof J==="string"){J=new URLSearchParams(J);for(let X of J.keys()){Y.searchParams.delete(X);for(let Q of J.getAll(X))Y.searchParams.append(X,Q)}}else{let X=Object.assign({},Z.query,J);for(let Q in X){let G=X[Q];if(Array.isArray(G)){Y.searchParams.delete(Q);for(let W of G)Y.searchParams.append(Q,W)}else Y.searchParams.set(Q,G)}}return Y}});var fg=S((YO0,dF)=>{var{randomUUID:eA0}=Y0("crypto"),{Readable:$O0}=Y0("stream"),WY;function ZO0($){return $&&typeof $==="object"&&typeof $.append==="function"&&typeof $.delete==="function"&&typeof $.get==="function"&&typeof $.getAll==="function"&&typeof $.has==="function"&&typeof $.set==="function"&&$[Symbol.toStringTag]==="FormData"}function JO0($){WY=WY??new TextEncoder;let Z=`----formdata-${eA0()}`,J=`--${Z}\r
|
|
445
|
+
Content-Disposition: form-data`;/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */let Y=(K)=>K.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),X=(K)=>K.replace(/\r?\n|\r/g,`\r
|
|
446
|
+
`),Q=new Uint8Array([13,10]);async function*G(){for(let[K,V]of $)if(typeof V==="string")yield WY.encode(`${J}; name="${Y(X(K))}"\r
|
|
447
|
+
\r
|
|
448
|
+
`),yield WY.encode(`${X(V)}\r
|
|
449
|
+
`);else{let U=`${J}; name="${Y(X(K))}"`;if(V.name&&(U+=`; filename="${Y(V.name)}"`),U+=`\r
|
|
450
|
+
Content-Type: ${V.type||"application/octet-stream"}\r
|
|
451
|
+
\r
|
|
452
|
+
`,yield WY.encode(U),V.stream)yield*V.stream();else yield V;yield Q}yield WY.encode(`--${Z}--`)}return{stream:$O0.from(G()),contentType:`multipart/form-data; boundary=${Z}`}}YO0.isFormDataLike=ZO0;YO0.formDataToStream=JO0});var xg=S((ox0,sW)=>{var{Readable:kg,addAbortSignal:GO0}=Y0("stream"),pF=Y0("util"),WO0=Ig(),KO0=Y0("assert"),{createDeprecation:VO0}=Eg(),UO0=Sg(),{isFormDataLike:HO0,formDataToStream:BO0}=fg(),{EventEmitter:zO0}=Y0("events"),FO0=VO0({name:"FastifyDeprecationLightMyRequest",code:"FST_LIGHTMYREQUEST_DEP01",message:'You are accessing "request.connection", use "request.socket" instead.'});function AO0($){return $.port?$.host:$.hostname+($.protocol==="https:"?":443":":80")}class vg extends zO0{constructor($){super();this.remoteAddress=$}}function yg($){return new Z(this);function Z(J){J5.call(J,{...$,Request:void 0}),Object.assign(this,J);for(let Y of Object.keys(J5.prototype))this.constructor.prototype[Y]=J5.prototype[Y];return pF.inherits(this.constructor,$.Request),this}}function J5($){kg.call(this,{autoDestroy:!1});let Z=UO0($.url||$.path,$.query);this.url=Z.pathname+Z.search,this.aborted=!1,this.httpVersionMajor=1,this.httpVersionMinor=1,this.httpVersion="1.1",this.method=$.method?$.method.toUpperCase():"GET",this.headers={},this.rawHeaders=[];let J=$.headers||{};for(let G in J){let W=G.toLowerCase();if((W==="user-agent"||W==="content-type")&&J[G]===void 0){this.headers[W]=void 0;continue}let K=J[G];KO0(K!==void 0,'invalid value "undefined" for header '+G),this.headers[W]=""+K}if("user-agent"in this.headers===!1)this.headers["user-agent"]="lightMyRequest";if(this.headers.host=this.headers.host||$.authority||AO0(Z),$.cookies){let{cookies:G}=$,W=Object.keys(G).map((K)=>WO0.serialize(K,G[K]));if(this.headers.cookie)W.unshift(this.headers.cookie);this.headers.cookie=W.join("; ")}this.socket=new vg($.remoteAddress||"127.0.0.1"),Object.defineProperty(this,"connection",{get(){return FO0(),this.socket},configurable:!0});let Y=$.payload||$.body||null,X=Y&&typeof Y.resume==="function";if(HO0(Y)){let G=BO0(Y);Y=G.stream,X=!0,this.headers["content-type"]=G.contentType,this.headers["transfer-encoding"]="chunked"}if(Y&&typeof Y!=="string"&&!X&&!Buffer.isBuffer(Y)){if(Y=JSON.stringify(Y),"content-type"in this.headers===!1)this.headers["content-type"]="application/json"}if(Y&&!X&&!Object.hasOwn(this.headers,"content-length"))this.headers["content-length"]=(Buffer.isBuffer(Y)?Y.length:Buffer.byteLength(Y)).toString();for(let G of Object.keys(this.headers))this.rawHeaders.push(G,this.headers[G]);this._lightMyRequest={payload:Y,isDone:!1,simulate:$.simulate||{},payloadAsStream:$.payloadAsStream,signal:$.signal};let Q=$.signal;if(Q)GO0(Q,this);{let G=this._lightMyRequest.payload;if(G?._readableState)this._read=OO0,G.on("error",(W)=>{this.destroy(W)}),G.on("end",()=>{this.push(null)});else this._read=qO0}return this}function OO0(){let $=this._lightMyRequest.payload,Z=!0,J=!1,Y;while(Z&&(Y=$.read()))J=!0,Z=this.push(Y);if(Z&&!J)this._lightMyRequest.payload.once("readable",this._read.bind(this))}function qO0(){setImmediate(()=>{if(this._lightMyRequest.isDone){if(this._lightMyRequest.simulate.end!==!1)this.push(null);return}if(this._lightMyRequest.isDone=!0,this._lightMyRequest.payload)if(this._lightMyRequest.simulate.split)this.push(this._lightMyRequest.payload.slice(0,1)),this.push(this._lightMyRequest.payload.slice(1));else this.push(this._lightMyRequest.payload);if(this._lightMyRequest.simulate.error)this.emit("error",Error("Simulated"));if(this._lightMyRequest.simulate.close)this.emit("close");if(this._lightMyRequest.simulate.end!==!1)this.push(null)})}pF.inherits(J5,kg);pF.inherits(yg,J5);J5.prototype.destroy=function($){if(this.destroyed||this._lightMyRequest.isDone)return;if(this.destroyed=!0,$)this._error=!0,process.nextTick(()=>this.emit("error",$));process.nextTick(()=>this.emit("close"))};sW.exports=J5;sW.exports.Request=J5;sW.exports.CustomRequest=yg});var gg=S((sx0,vQ)=>{var rW={decodeValues:!0,map:!1,silent:!1};function cF($){return typeof $!=="string"||$ in{}}function iF(){return Object.create(null)}function nF($){return typeof $==="string"&&!!$.trim()}function oF($,Z){var J=$.split(";").filter(nF),Y=J.shift(),X=jO0(Y),Q=X.name,G=X.value;if(Z=Z?Object.assign({},rW,Z):rW,cF(Q))return null;try{G=Z.decodeValues?decodeURIComponent(G):G}catch(K){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",K)}var W=iF();return W.name=Q,W.value=G,J.forEach(function(K){var V=K.split("="),U=V.shift().trimLeft().toLowerCase();if(cF(U))return;var H=V.join("=");if(U==="expires")W.expires=new Date(H);else if(U==="max-age"){var B=parseInt(H,10);if(!Number.isNaN(B))W.maxAge=B}else if(U==="secure")W.secure=!0;else if(U==="httponly")W.httpOnly=!0;else if(U==="samesite")W.sameSite=H;else if(U==="partitioned")W.partitioned=!0;else if(U)W[U]=H}),W}function jO0($){var Z="",J="",Y=$.split("=");if(Y.length>1)Z=Y.shift(),J=Y.join("=");else J=$;return{name:Z,value:J}}function hg($,Z){if(Z=Z?Object.assign({},rW,Z):rW,!$)if(!Z.map)return[];else return iF();if($.headers)if(typeof $.headers.getSetCookie==="function")$=$.headers.getSetCookie();else if($.headers["set-cookie"])$=$.headers["set-cookie"];else{var J=$.headers[Object.keys($.headers).find(function(X){return X.toLowerCase()==="set-cookie"})];if(!J&&$.headers.cookie&&!Z.silent)console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning.");$=J}if(!Array.isArray($))$=[$];if(!Z.map)return $.filter(nF).map(function(X){return oF(X,Z)}).filter(Boolean);else{var Y=iF();return $.filter(nF).reduce(function(X,Q){var G=oF(Q,Z);if(G&&!cF(G.name))X[G.name]=G;return X},Y)}}function NO0($){if(Array.isArray($))return $;if(typeof $!=="string")return[];var Z=[],J=0,Y,X,Q,G,W;function K(){while(J<$.length&&/\s/.test($.charAt(J)))J+=1;return J<$.length}function V(){return X=$.charAt(J),X!=="="&&X!==";"&&X!==","}while(J<$.length){Y=J,W=!1;while(K())if(X=$.charAt(J),X===","){Q=J,J+=1,K(),G=J;while(J<$.length&&V())J+=1;if(J<$.length&&$.charAt(J)==="=")W=!0,J=G,Z.push($.substring(Y,Q)),Y=J;else J=Q+1}else J+=1;if(!W||J>=$.length)Z.push($.substring(Y,$.length))}return Z}vQ.exports=hg;vQ.exports.parse=hg;vQ.exports.parseString=oF;vQ.exports.splitCookiesString=NO0});var pg=S((rx0,dg)=>{var yQ=Y0("http"),{Writable:MO0,Readable:ug,addAbortSignal:DO0}=Y0("stream"),wO0=Y0("util"),LO0=gg();function Y5($,Z,J){if(yQ.ServerResponse.call(this,$),$._lightMyRequest?.payloadAsStream){let W=this.emit.bind(this,"drain");this._lightMyRequest={headers:null,trailers:{},stream:new ug({read:W})};let K=$._lightMyRequest.signal;if(K)DO0(K,this._lightMyRequest.stream)}else this._lightMyRequest={headers:null,trailers:{},payloadChunks:[]};this.setHeader("foo","bar"),this.removeHeader("foo"),this.assignSocket(TO0()),this._promiseCallback=typeof J==="function";let Y=!1,X=(W)=>{if(Y)return;if(Y=!0,this._promiseCallback)return process.nextTick(()=>Z(W));process.nextTick(()=>Z(null,W))};this._lightMyRequest.onEndSuccess=X;let Q=!1,G=(W)=>{if(Y){if(this._lightMyRequest.stream&&!Q){if(!W)W=Error("response destroyed before completion"),W.code="LIGHT_ECONNRESET";this._lightMyRequest.stream.destroy(W),this._lightMyRequest.stream.on("error",()=>{})}return}if(Y=!0,!W)W=Error("response destroyed before completion"),W.code="LIGHT_ECONNRESET";if(this._promiseCallback)return process.nextTick(()=>J(W));process.nextTick(()=>Z(W,null))};if(this._lightMyRequest.stream)this.once("finish",()=>{Q=!0,this._lightMyRequest.stream.push(null)});else this.once("finish",()=>{let W=mg(this);W.raw.req=$,X(W)});this.connection.once("error",G),this.once("error",G),this.once("close",G)}wO0.inherits(Y5,yQ.ServerResponse);Y5.prototype.setTimeout=function($,Z){return this.timeoutHandle=setTimeout(()=>{this.emit("timeout")},$),this.on("timeout",Z),this};Y5.prototype.writeHead=function(){let $=yQ.ServerResponse.prototype.writeHead.apply(this,arguments);if(lg(this),this._lightMyRequest.stream)this._lightMyRequest.onEndSuccess(mg(this));return $};Y5.prototype.write=function($,Z,J){if(this.timeoutHandle)clearTimeout(this.timeoutHandle);if(yQ.ServerResponse.prototype.write.call(this,$,Z,J),this._lightMyRequest.stream)return this._lightMyRequest.stream.push(Buffer.from($,Z));else return this._lightMyRequest.payloadChunks.push(Buffer.from($,Z)),!0};Y5.prototype.end=function($,Z,J){if($)this.write($,Z);yQ.ServerResponse.prototype.end.call(this,J),this.emit("finish"),this.destroy()};Y5.prototype.destroy=function($){if(this.destroyed)return;if(this.destroyed=!0,$)process.nextTick(()=>this.emit("error",$));process.nextTick(()=>this.emit("close"))};Y5.prototype.addTrailers=function($){for(let Z in $)this._lightMyRequest.trailers[Z.toLowerCase().trim()]=$[Z].toString().trim()};function mg($){if($._lightMyRequest.headers===null)lg($);RO0($);let Z={raw:{res:$},headers:$._lightMyRequest.headers,statusCode:$.statusCode,statusMessage:$.statusMessage,trailers:{},get cookies(){return LO0.parse(this)}};if(Z.trailers=$._lightMyRequest.trailers,$._lightMyRequest.payloadChunks){let J=Buffer.concat($._lightMyRequest.payloadChunks);Z.rawPayload=J,Z.payload=J.toString(),Z.body=Z.payload,Z.json=function(){return JSON.parse(Z.payload)}}else Z.json=function(){throw Error("Response payload is not available with payloadAsStream: true")};return Z.stream=function(){if($._lightMyRequest.stream)return $._lightMyRequest.stream;return ug.from($._lightMyRequest.payloadChunks)},Z}function TO0(){return new MO0({write($,Z,J){setImmediate(J)}})}function RO0($){let Z=$._lightMyRequest.headers;for(let J of Object.keys(Z)){let Y=Z[J];if(Array.isArray(Y))Z[J]=Y.map((X)=>""+X);else Z[J]=""+Y}}function lg($){$._lightMyRequest.headers=Object.assign({},$.getHeaders()),["Date","Connection","Transfer-Encoding"].forEach((Z)=>{let J=new RegExp("\\r\\n"+Z+": ([^\\r]*)\\r\\n"),Y=$._header?.match(J);if(Y)$._lightMyRequest.headers[Z.toLowerCase()]=Y[1]})}dg.exports=Y5});var cg=S((ax0,sF)=>{sF.exports=B$;sF.exports.default=B$;var PO0={type:"object",properties:{url:{oneOf:[{type:"string"},{type:"object",properties:{protocol:{type:"string"},hostname:{type:"string"},pathname:{type:"string"}},additionalProperties:!0,required:["pathname"]}]},path:{oneOf:[{type:"string"},{type:"object",properties:{protocol:{type:"string"},hostname:{type:"string"},pathname:{type:"string"}},additionalProperties:!0,required:["pathname"]}]},cookies:{type:"object",additionalProperties:!0},headers:{type:"object",additionalProperties:!0},query:{anyOf:[{type:"object",additionalProperties:!0},{type:"string"}]},simulate:{type:"object",properties:{end:{type:"boolean"},split:{type:"boolean"},error:{type:"boolean"},close:{type:"boolean"}}},authority:{type:"string"},remoteAddress:{type:"string"},method:{type:"string",enum:["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","QUERY","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE","acl","bind","checkout","connect","copy","delete","get","head","link","lock","m-search","merge","mkactivity","mkcalendar","mkcol","move","notify","options","patch","post","propfind","proppatch","purge","put","query","rebind","report","search","source","subscribe","trace","unbind","unlink","unlock","unsubscribe"]},validate:{type:"boolean"}},additionalProperties:!0,oneOf:[{required:["url"]},{required:["path"]}]};function B$($,{instancePath:Z="",parentData:J,parentDataProperty:Y,rootData:X=$}={}){let Q=null,G=0,W=G,K=!1,V=null,U=G;if($&&typeof $=="object"&&!Array.isArray($)){let M;if($.url===void 0&&(M="url")){let C={instancePath:Z,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:M},message:"must have required property '"+M+"'"};if(Q===null)Q=[C];else Q.push(C);G++}}var B=U===G;if(B)K=!0,V=0;let H=G;if($&&typeof $=="object"&&!Array.isArray($)){let M;if($.path===void 0&&(M="path")){let C={instancePath:Z,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty:M},message:"must have required property '"+M+"'"};if(Q===null)Q=[C];else Q.push(C);G++}}var B=H===G;if(B&&K)K=!1,V=[V,1];else if(B)K=!0,V=1;if(!K){let M={instancePath:Z,schemaPath:"#/oneOf",keyword:"oneOf",params:{passingSchemas:V},message:"must match exactly one schema in oneOf"};if(Q===null)Q=[M];else Q.push(M);return G++,B$.errors=Q,!1}else if(G=W,Q!==null)if(W)Q.length=W;else Q=null;if(G===0)if($&&typeof $=="object"&&!Array.isArray($)){if($.url!==void 0){let M=$.url,C=G,R=G,T=!1,I=null,_=G;if(typeof M!=="string"){let f=typeof M,b=void 0;if(b===void 0)if(f=="number"||f=="boolean")b=""+M;else if(M===null)b="";else{let y={instancePath:Z+"/url",schemaPath:"#/properties/url/oneOf/0/type",keyword:"type",params:{type:"string"},message:"must be string"};if(Q===null)Q=[y];else Q.push(y);G++}if(b!==void 0){if(M=b,$!==void 0)$.url=b}}var F=_===G;if(F)T=!0,I=0;let E=G;if(G===E)if(M&&typeof M=="object"&&!Array.isArray(M)){let f;if(M.pathname===void 0&&(f="pathname")){let b={instancePath:Z+"/url",schemaPath:"#/properties/url/oneOf/1/required",keyword:"required",params:{missingProperty:f},message:"must have required property '"+f+"'"};if(Q===null)Q=[b];else Q.push(b);G++}else{if(M.protocol!==void 0){let b=M.protocol,y=G;if(typeof b!=="string"){let k=typeof b,g=void 0;if(g===void 0)if(k=="number"||k=="boolean")g=""+b;else if(b===null)g="";else{let d={instancePath:Z+"/url/protocol",schemaPath:"#/properties/url/oneOf/1/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};if(Q===null)Q=[d];else Q.push(d);G++}if(g!==void 0){if(b=g,M!==void 0)M.protocol=g}}var z=y===G}else var z=!0;if(z){if(M.hostname!==void 0){let b=M.hostname,y=G;if(typeof b!=="string"){let g=typeof b,d=void 0;if(d===void 0)if(g=="number"||g=="boolean")d=""+b;else if(b===null)d="";else{let p={instancePath:Z+"/url/hostname",schemaPath:"#/properties/url/oneOf/1/properties/hostname/type",keyword:"type",params:{type:"string"},message:"must be string"};if(Q===null)Q=[p];else Q.push(p);G++}if(d!==void 0){if(b=d,M!==void 0)M.hostname=d}}var z=y===G}else var z=!0;if(z)if(M.pathname!==void 0){let b=M.pathname,y=G;if(typeof b!=="string"){let g=typeof b,d=void 0;if(d===void 0)if(g=="number"||g=="boolean")d=""+b;else if(b===null)d="";else{let p={instancePath:Z+"/url/pathname",schemaPath:"#/properties/url/oneOf/1/properties/pathname/type",keyword:"type",params:{type:"string"},message:"must be string"};if(Q===null)Q=[p];else Q.push(p);G++}if(d!==void 0){if(b=d,M!==void 0)M.pathname=d}}var z=y===G}else var z=!0}}}else{let f={instancePath:Z+"/url",schemaPath:"#/properties/url/oneOf/1/type",keyword:"type",params:{type:"object"},message:"must be object"};if(Q===null)Q=[f];else Q.push(f);G++}var F=E===G;if(F&&T)T=!1,I=[I,1];else if(F)T=!0,I=1;if(!T){let f={instancePath:Z+"/url",schemaPath:"#/properties/url/oneOf",keyword:"oneOf",params:{passingSchemas:I},message:"must match exactly one schema in oneOf"};if(Q===null)Q=[f];else Q.push(f);return G++,B$.errors=Q,!1}else if(G=R,Q!==null)if(R)Q.length=R;else Q=null;var A=C===G}else var A=!0;if(A){if($.path!==void 0){let M=$.path,C=G,R=G,T=!1,I=null,_=G;if(typeof M!=="string"){let b=typeof M,y=void 0;if(y===void 0)if(b=="number"||b=="boolean")y=""+M;else if(M===null)y="";else{let k={instancePath:Z+"/path",schemaPath:"#/properties/path/oneOf/0/type",keyword:"type",params:{type:"string"},message:"must be string"};if(Q===null)Q=[k];else Q.push(k);G++}if(y!==void 0){if(M=y,$!==void 0)$.path=y}}var N=_===G;if(N)T=!0,I=0;let E=G;if(G===E)if(M&&typeof M=="object"&&!Array.isArray(M)){let b;if(M.pathname===void 0&&(b="pathname")){let y={instancePath:Z+"/path",schemaPath:"#/properties/path/oneOf/1/required",keyword:"required",params:{missingProperty:b},message:"must have required property '"+b+"'"};if(Q===null)Q=[y];else Q.push(y);G++}else{if(M.protocol!==void 0){let y=M.protocol,k=G;if(typeof y!=="string"){let g=typeof y,d=void 0;if(d===void 0)if(g=="number"||g=="boolean")d=""+y;else if(y===null)d="";else{let p={instancePath:Z+"/path/protocol",schemaPath:"#/properties/path/oneOf/1/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};if(Q===null)Q=[p];else Q.push(p);G++}if(d!==void 0){if(y=d,M!==void 0)M.protocol=d}}var j=k===G}else var j=!0;if(j){if(M.hostname!==void 0){let y=M.hostname,k=G;if(typeof y!=="string"){let d=typeof y,p=void 0;if(p===void 0)if(d=="number"||d=="boolean")p=""+y;else if(y===null)p="";else{let t={instancePath:Z+"/path/hostname",schemaPath:"#/properties/path/oneOf/1/properties/hostname/type",keyword:"type",params:{type:"string"},message:"must be string"};if(Q===null)Q=[t];else Q.push(t);G++}if(p!==void 0){if(y=p,M!==void 0)M.hostname=p}}var j=k===G}else var j=!0;if(j)if(M.pathname!==void 0){let y=M.pathname,k=G;if(typeof y!=="string"){let d=typeof y,p=void 0;if(p===void 0)if(d=="number"||d=="boolean")p=""+y;else if(y===null)p="";else{let t={instancePath:Z+"/path/pathname",schemaPath:"#/properties/path/oneOf/1/properties/pathname/type",keyword:"type",params:{type:"string"},message:"must be string"};if(Q===null)Q=[t];else Q.push(t);G++}if(p!==void 0){if(y=p,M!==void 0)M.pathname=p}}var j=k===G}else var j=!0}}}else{let b={instancePath:Z+"/path",schemaPath:"#/properties/path/oneOf/1/type",keyword:"type",params:{type:"object"},message:"must be object"};if(Q===null)Q=[b];else Q.push(b);G++}var N=E===G;if(N&&T)T=!1,I=[I,1];else if(N)T=!0,I=1;if(!T){let b={instancePath:Z+"/path",schemaPath:"#/properties/path/oneOf",keyword:"oneOf",params:{passingSchemas:I},message:"must match exactly one schema in oneOf"};if(Q===null)Q=[b];else Q.push(b);return G++,B$.errors=Q,!1}else if(G=R,Q!==null)if(R)Q.length=R;else Q=null;var A=C===G}else var A=!0;if(A){if($.cookies!==void 0){let M=$.cookies,C=G;if(G===C){if(!(M&&typeof M=="object"&&!Array.isArray(M)))return B$.errors=[{instancePath:Z+"/cookies",schemaPath:"#/properties/cookies/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1}var A=C===G}else var A=!0;if(A){if($.headers!==void 0){let M=$.headers,C=G;if(G===C){if(!(M&&typeof M=="object"&&!Array.isArray(M)))return B$.errors=[{instancePath:Z+"/headers",schemaPath:"#/properties/headers/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1}var A=C===G}else var A=!0;if(A){if($.query!==void 0){let M=$.query,C=G,R=G,T=!1,I=G;if(G===I){if(!(M&&typeof M=="object"&&!Array.isArray(M))){let E={instancePath:Z+"/query",schemaPath:"#/properties/query/anyOf/0/type",keyword:"type",params:{type:"object"},message:"must be object"};if(Q===null)Q=[E];else Q.push(E);G++}}var w=I===G;if(T=T||w,!T){let E=G;if(typeof M!=="string"){let b=typeof M,y=void 0;if(y===void 0)if(b=="number"||b=="boolean")y=""+M;else if(M===null)y="";else{let k={instancePath:Z+"/query",schemaPath:"#/properties/query/anyOf/1/type",keyword:"type",params:{type:"string"},message:"must be string"};if(Q===null)Q=[k];else Q.push(k);G++}if(y!==void 0){if(M=y,$!==void 0)$.query=y}}var w=E===G;T=T||w}if(!T){let E={instancePath:Z+"/query",schemaPath:"#/properties/query/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(Q===null)Q=[E];else Q.push(E);return G++,B$.errors=Q,!1}else if(G=R,Q!==null)if(R)Q.length=R;else Q=null;var A=C===G}else var A=!0;if(A){if($.simulate!==void 0){let M=$.simulate,C=G;if(G===C)if(M&&typeof M=="object"&&!Array.isArray(M)){if(M.end!==void 0){let T=M.end,I=G;if(typeof T!=="boolean"){let _=void 0;if(_===void 0)if(T==="false"||T===0||T===null)_=!1;else if(T==="true"||T===1)_=!0;else return B$.errors=[{instancePath:Z+"/simulate/end",schemaPath:"#/properties/simulate/properties/end/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(_!==void 0){if(T=_,M!==void 0)M.end=_}}var q=I===G}else var q=!0;if(q){if(M.split!==void 0){let T=M.split,I=G;if(typeof T!=="boolean"){let E=void 0;if(E===void 0)if(T==="false"||T===0||T===null)E=!1;else if(T==="true"||T===1)E=!0;else return B$.errors=[{instancePath:Z+"/simulate/split",schemaPath:"#/properties/simulate/properties/split/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(E!==void 0){if(T=E,M!==void 0)M.split=E}}var q=I===G}else var q=!0;if(q){if(M.error!==void 0){let T=M.error,I=G;if(typeof T!=="boolean"){let E=void 0;if(E===void 0)if(T==="false"||T===0||T===null)E=!1;else if(T==="true"||T===1)E=!0;else return B$.errors=[{instancePath:Z+"/simulate/error",schemaPath:"#/properties/simulate/properties/error/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(E!==void 0){if(T=E,M!==void 0)M.error=E}}var q=I===G}else var q=!0;if(q)if(M.close!==void 0){let T=M.close,I=G;if(typeof T!=="boolean"){let E=void 0;if(E===void 0)if(T==="false"||T===0||T===null)E=!1;else if(T==="true"||T===1)E=!0;else return B$.errors=[{instancePath:Z+"/simulate/close",schemaPath:"#/properties/simulate/properties/close/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(E!==void 0){if(T=E,M!==void 0)M.close=E}}var q=I===G}else var q=!0}}}else return B$.errors=[{instancePath:Z+"/simulate",schemaPath:"#/properties/simulate/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var A=C===G}else var A=!0;if(A){if($.authority!==void 0){let M=$.authority,C=G;if(typeof M!=="string"){let T=typeof M,I=void 0;if(I===void 0)if(T=="number"||T=="boolean")I=""+M;else if(M===null)I="";else return B$.errors=[{instancePath:Z+"/authority",schemaPath:"#/properties/authority/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(I!==void 0){if(M=I,$!==void 0)$.authority=I}}var A=C===G}else var A=!0;if(A){if($.remoteAddress!==void 0){let M=$.remoteAddress,C=G;if(typeof M!=="string"){let T=typeof M,I=void 0;if(I===void 0)if(T=="number"||T=="boolean")I=""+M;else if(M===null)I="";else return B$.errors=[{instancePath:Z+"/remoteAddress",schemaPath:"#/properties/remoteAddress/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(I!==void 0){if(M=I,$!==void 0)$.remoteAddress=I}}var A=C===G}else var A=!0;if(A){if($.method!==void 0){let M=$.method,C=G;if(typeof M!=="string"){let T=typeof M,I=void 0;if(I===void 0)if(T=="number"||T=="boolean")I=""+M;else if(M===null)I="";else return B$.errors=[{instancePath:Z+"/method",schemaPath:"#/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(I!==void 0){if(M=I,$!==void 0)$.method=I}}if(!(M==="ACL"||M==="BIND"||M==="CHECKOUT"||M==="CONNECT"||M==="COPY"||M==="DELETE"||M==="GET"||M==="HEAD"||M==="LINK"||M==="LOCK"||M==="M-SEARCH"||M==="MERGE"||M==="MKACTIVITY"||M==="MKCALENDAR"||M==="MKCOL"||M==="MOVE"||M==="NOTIFY"||M==="OPTIONS"||M==="PATCH"||M==="POST"||M==="PROPFIND"||M==="PROPPATCH"||M==="PURGE"||M==="PUT"||M==="QUERY"||M==="REBIND"||M==="REPORT"||M==="SEARCH"||M==="SOURCE"||M==="SUBSCRIBE"||M==="TRACE"||M==="UNBIND"||M==="UNLINK"||M==="UNLOCK"||M==="UNSUBSCRIBE"||M==="acl"||M==="bind"||M==="checkout"||M==="connect"||M==="copy"||M==="delete"||M==="get"||M==="head"||M==="link"||M==="lock"||M==="m-search"||M==="merge"||M==="mkactivity"||M==="mkcalendar"||M==="mkcol"||M==="move"||M==="notify"||M==="options"||M==="patch"||M==="post"||M==="propfind"||M==="proppatch"||M==="purge"||M==="put"||M==="query"||M==="rebind"||M==="report"||M==="search"||M==="source"||M==="subscribe"||M==="trace"||M==="unbind"||M==="unlink"||M==="unlock"||M==="unsubscribe"))return B$.errors=[{instancePath:Z+"/method",schemaPath:"#/properties/method/enum",keyword:"enum",params:{allowedValues:PO0.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var A=C===G}else var A=!0;if(A)if($.validate!==void 0){let M=$.validate,C=G;if(typeof M!=="boolean"){let T=void 0;if(T===void 0)if(M==="false"||M===0||M===null)T=!1;else if(M==="true"||M===1)T=!0;else return B$.errors=[{instancePath:Z+"/validate",schemaPath:"#/properties/validate/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;if(T!==void 0){if(M=T,$!==void 0)$.validate=T}}var A=C===G}else var A=!0}}}}}}}}}else return B$.errors=[{instancePath:Z,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return B$.errors=Q,G===0}});var og=S((tx0,hQ)=>{var IO0=Y0("assert"),rF=xg(),aW=pg(),ig=cg();function aF($,Z,J){if(J===void 0)return new xQ($,Z);else return tW($,Z,J)}function CO0($,Z){let J=$._lightMyRequest.payload;if(!J||J._readableState||typeof J.resume!=="function")return Z();let Y=[];J.on("data",(X)=>Y.push(Buffer.from(X))),J.on("end",()=>{let X=Buffer.concat(Y);return $.headers["content-length"]=$.headers["content-length"]||""+X.length,delete $.headers["transfer-encoding"],$._lightMyRequest.payload=X,Z()}),J.resume()}function ng($,Z,J,Y){return J.once("error",function(X){if(this.destroyed)Y.destroy(X)}),J.once("close",function(){if(this.destroyed&&!this._error)Y.destroy()}),CO0(J,()=>$.call(Z,J,Y))}function tW($,Z,J){if(Z=typeof Z==="string"?{url:Z}:Z,Z.validate!==!1){if(IO0(typeof $==="function","dispatchFunc should be a function"),!ig(Z))throw Error(ig.errors.map((G)=>G.message))}let Y=Z.server||{},X=Z.Request?rF.CustomRequest:rF;if($.request&&$.request.app===$)Object.setPrototypeOf(Object.getPrototypeOf($.request),X.prototype),Object.setPrototypeOf(Object.getPrototypeOf($.response),aW.prototype);if(typeof J==="function"){let Q=new X(Z),G=new aW(Q,J);return ng($,Y,Q,G)}else return new Promise((Q,G)=>{let W=new X(Z),K=new aW(W,Q,G);ng($,Y,W,K)})}function xQ($,Z){if(typeof Z==="string")this.option={url:Z};else this.option=Object.assign({},Z);if(this.dispatch=$,this._hasInvoked=!1,this._promise=null,this.option.autoStart!==!1)process.nextTick(()=>{if(!this._hasInvoked)this.end()})}var EO0=["delete","get","head","options","patch","post","put","trace"];EO0.forEach(($)=>{xQ.prototype[$]=function(Z){if(this._hasInvoked===!0||this._promise)throw Error("The dispatch function has already been invoked");return this.option.url=Z,this.option.method=$.toUpperCase(),this}});var bO0=["body","cookies","headers","payload","query"];bO0.forEach(($)=>{xQ.prototype[$]=function(Z){if(this._hasInvoked===!0||this._promise)throw Error("The dispatch function has already been invoked");return this.option[$]=Z,this}});xQ.prototype.end=function($){if(this._hasInvoked===!0||this._promise)throw Error("The dispatch function has already been invoked");if(this._hasInvoked=!0,typeof $==="function")tW(this.dispatch,this.option,$);else return this._promise=tW(this.dispatch,this.option),this._promise};Object.getOwnPropertyNames(Promise.prototype).forEach(($)=>{if($==="constructor")return;xQ.prototype[$]=function(...Z){if(!this._promise){if(this._hasInvoked===!0)throw Error("The dispatch function has already been invoked");this._hasInvoked=!0,this._promise=tW(this.dispatch,this.option)}return this._promise[$](...Z)}});function _O0($){return $ instanceof rF||$ instanceof aW||$?.constructor?.name==="_CustomLMRRequest"}hQ.exports=aF;hQ.exports.default=aF;hQ.exports.inject=aF;hQ.exports.isInjection=_O0});var Uu=S((ex0,dQ)=>{var SO0=hR(),JK=Y0("http"),fO0=Y0("diagnostics_channel"),gQ,{kAvvioBoot:uQ,kChildren:tF,kServerBindings:sg,kBodyLimit:kO0,kSupportedHTTPMethods:B7,kRoutePrefix:rg,kLogLevel:vO0,kLogSerializers:yO0,kHooks:eF,kSchemaController:X5,kRequestAcceptVersion:xO0,kReplySerializerDefault:ag,kContentTypeParser:hO0,kReply:gO0,kRequest:uO0,kFourOhFour:mO0,kState:$$,kOptions:$A,kPluginNameChain:mQ,kSchemaErrorFormatter:ZA,kErrorHandler:eW,kKeepAliveConnections:JA,kChildLoggerFactory:YA,kGenReqId:XA,kErrorHandlerAlreadySet:$K,kHandlerTimeout:lO0}=H$(),{createServer:dO0}=BP(),lQ=MG(),ZK=PG(),pO0=IG(),z7=mX(),F7=jz(),tg=XF(),{Hooks:cO0,hookRunnerApplication:eg,supportedHooks:QA}=uZ(),{createChildLogger:$u,defaultChildLoggerFactory:iO0,createLogger:nO0}=yX(),Zu=UF(),{getGenReqId:Ju,reqIdGenFactory:Ku}=IW(),{buildRouting:oO0,validateBodyLimitOption:sO0,buildRouterOptions:rO0}=Zg(),aO0=Kg(),Vu=Ug(),tO0=Ng(),{appendStackTrace:eO0,AVVIO_ERRORS_MAP:Yu,...A7}=w$(),$q0=uH(),{defaultInitOptions:z8}=Vu,{FST_ERR_ASYNC_CONSTRAINT:Zq0,FST_ERR_BAD_URL:Jq0,FST_ERR_OPTIONS_NOT_OBJ:Yq0,FST_ERR_QSP_NOT_FN:Xq0,FST_ERR_SCHEMA_CONTROLLER_BUCKET_OPT_NOT_FN:Qq0,FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_OBJ:Gq0,FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_ARR:Wq0,FST_ERR_INSTANCE_ALREADY_LISTENING:Kq0,FST_ERR_REOPENED_CLOSE_SERVER:Vq0,FST_ERR_ROUTE_REWRITE_NOT_STR:Uq0,FST_ERR_SCHEMA_ERROR_FORMATTER_NOT_FN:Xu,FST_ERR_ERROR_HANDLER_NOT_FN:Hq0,FST_ERR_ERROR_HANDLER_ALREADY_SET:Bq0,FST_ERR_ROUTE_METHOD_INVALID:zq0}=A7,{buildErrorHandler:Qu}=hX(),{FSTWRN004:Fq0}=wJ(),Gu=fO0.channel("fastify.initialization");function GA($){let{options:Z,genReqId:J,disableRequestLogging:Y,hasLogger:X,initialConfig:Q}=Aq0($,f,b),G=oO0(Z.routerOptions),W=aO0(Z),K=u(G,Z),{server:V,listen:U,forceCloseConnections:H,serverHasCloseAllConnections:B,serverHasCloseHttp2Sessions:z,keepAliveConnections:F}=dO0(Z,K),A=lQ.setupResponseListeners,j=tg.buildSchemaController(null,Z.schemaController),N={[$$]:{listening:!1,closing:!1,started:!1,ready:!1,booting:!1,aborted:!1,readyResolver:null},[JA]:F,[B7]:{bodyless:new Set(["GET","HEAD","TRACE"]),bodywith:new Set(["DELETE","OPTIONS","PATCH","PUT","POST"])},[$A]:Z,[tF]:[],[sg]:[],[kO0]:Z.bodyLimit,[lO0]:Z.handlerTimeout,[rg]:"",[vO0]:"",[yO0]:null,[eF]:new cO0,[X5]:j,[ZA]:null,[eW]:Qu(),[$K]:!1,[YA]:Z.childLoggerFactory||iO0,[ag]:null,[hO0]:new F7(Z.bodyLimit,Z.onProtoPoisoning||z8.onProtoPoisoning,Z.onConstructorPoisoning||z8.onConstructorPoisoning),[gO0]:lQ.buildReply(lQ),[uO0]:ZK.buildRequest(ZK,Z.trustProxy),[mO0]:W,[Zu.kRegisteredPlugins]:[],[mQ]:["fastify"],[uQ]:null,[XA]:J,routing:K,delete:function(h,c,m){return G.prepareRoute.call(this,{method:"DELETE",url:h,options:c,handler:m})},get:function(h,c,m){return G.prepareRoute.call(this,{method:"GET",url:h,options:c,handler:m})},head:function(h,c,m){return G.prepareRoute.call(this,{method:"HEAD",url:h,options:c,handler:m})},trace:function(h,c,m){return G.prepareRoute.call(this,{method:"TRACE",url:h,options:c,handler:m})},patch:function(h,c,m){return G.prepareRoute.call(this,{method:"PATCH",url:h,options:c,handler:m})},post:function(h,c,m){return G.prepareRoute.call(this,{method:"POST",url:h,options:c,handler:m})},put:function(h,c,m){return G.prepareRoute.call(this,{method:"PUT",url:h,options:c,handler:m})},options:function(h,c,m){return G.prepareRoute.call(this,{method:"OPTIONS",url:h,options:c,handler:m})},all:function(h,c,m){return G.prepareRoute.call(this,{method:this.supportedMethods,url:h,options:c,handler:m})},route:function(h){return G.route.call(this,{options:h})},hasRoute:function(h){return G.hasRoute.call(this,{options:h})},findRoute:function(h){return G.findRoute(h)},log:Z.logger,withTypeProvider:I,addHook:_,addSchema:E,getSchema:j.getSchema.bind(j),getSchemas:j.getSchemas.bind(j),setValidatorCompiler:g,setSerializerCompiler:p,setSchemaController:t,setReplySerializer:r,setSchemaErrorFormatter:d,setGenReqId:l,addContentTypeParser:F7.helpers.addContentTypeParser,hasContentTypeParser:F7.helpers.hasContentTypeParser,getDefaultJsonParser:F7.defaultParsers.getDefaultJsonParser,defaultTextParser:F7.defaultParsers.defaultTextParser,removeContentTypeParser:F7.helpers.removeContentTypeParser,removeAllContentTypeParsers:F7.helpers.removeAllContentTypeParsers,register:null,after:null,ready:null,onClose:null,close:null,printPlugins:null,hasPlugin:function(v){return this[Zu.kRegisteredPlugins].includes(v)||this[mQ].includes(v)},listen:U,server:V,addresses:function(){let v=this[sg].map((h)=>h.address());return v.push(this.server.address()),v.filter((h)=>h)},decorate:z7.add,hasDecorator:z7.exist,decorateReply:z7.decorateReply,decorateRequest:z7.decorateRequest,hasRequestDecorator:z7.existRequest,hasReplyDecorator:z7.existReply,getDecorator:z7.getInstanceDecorator,addHttpMethod:$0,inject:R,printRoutes:h0,setNotFoundHandler:k,setErrorHandler:G0,setChildLoggerFactory:O0,initialConfig:Q,addConstraintStrategy:G.addConstraintStrategy.bind(G),hasConstraintStrategy:G.hasConstraintStrategy.bind(G)};if(Object.defineProperties(N,{listeningOrigin:{get(){let v=this.addresses().slice(-1).pop();if(typeof v==="string")return v;let h=v.family==="IPv6"?`[${v.address}]`:v.address;return`${this[$A].https?"https":"http"}://${h}:${v.port}`}},pluginName:{configurable:!0,get(){if(this[mQ].length>1)return this[mQ].join(" -> ");return this[mQ][0]}},prefix:{configurable:!0,get(){return this[rg]}},validatorCompiler:{configurable:!0,get(){return this[X5].getValidatorCompiler()}},serializerCompiler:{configurable:!0,get(){return this[X5].getSerializerCompiler()}},childLoggerFactory:{configurable:!0,get(){return this[YA]}},version:{configurable:!0,get(){return"5.8.5"}},errorHandler:{configurable:!0,get(){return this[eW].func}},genReqId:{configurable:!0,get(){return this[XA]}},supportedMethods:{configurable:!1,get(){return[...this[B7].bodyless,...this[B7].bodywith]}}}),Z.schemaErrorFormatter)Wu(Z.schemaErrorFormatter),N[ZA]=Z.schemaErrorFormatter.bind(N);let w=Number(Z.pluginTimeout),q=SO0(N,{autostart:!1,timeout:isNaN(w)===!1?w:z8.pluginTimeout,expose:{use:"register"}});q.override=tO0,q.on("start",()=>N[$$].started=!0),N[uQ]=N.ready,N.ready=T,N.printPlugins=q.prettyPrint.bind(q),q.once("preReady",()=>{N.onClose((v,h)=>{N[$$].closing=!0,G.closeRoutes(),eg("preClose",N[uQ],N,function(){if(N[$$].listening){if(H==="idle")v.server.closeIdleConnections();else if(B&&H)v.server.closeAllConnections();else if(H===!0)for(let c of N[JA])c.destroy(),N[JA].delete(c)}if(z)v.server.closeHttp2Sessions();if(!Z.serverFactory||N[$$].listening)v.server.close(function(c){if(c&&c.code!=="ERR_SERVER_NOT_RUNNING")h(null);else h()});else process.nextTick(h,null)})})});let M=new pO0({server:N,config:{}});if(N.setNotFoundHandler(),W.arrange404(N),G.setup(Z,{avvio:q,fourOhFour:W,hasLogger:X,setupResponseListeners:A,throwIfAlreadyStarted:C,keepAliveConnections:F}),V.on("clientError",Z.clientErrorHandler.bind(N)),Gu.hasSubscribers)Gu.publish({fastify:N});if("asyncDispose"in Symbol)N[Symbol.asyncDispose]=function(){return N.close()};return N;function C(v){if(N[$$].started)throw new Kq0(v)}function R(v,h){if(gQ===void 0)gQ=og();if(N[$$].started){if(N[$$].closing){let c=new Vq0;if(h){h(c);return}else return Promise.reject(c)}return gQ(K,v,h)}if(h)this.ready((c)=>{if(c)h(c,null);else gQ(K,v,h)});else return gQ((c,m)=>{this.ready(function(a){if(a){m.emit("error",a);return}K(c,m)})},v)}function T(v){if(this[$$].readyResolver!==null){if(v!=null){this[$$].readyResolver.promise.then(()=>v(null,N),v);return}return this[$$].readyResolver.promise}if(process.nextTick(h),this[$$].readyResolver=$q0.withResolvers(),!v)return this[$$].readyResolver.promise;else this[$$].readyResolver.promise.then(()=>v(null,N),v);function h(){N[uQ]((m,a)=>{if(m||N[$$].started||N[$$].ready||N[$$].booting)c(m);else N[$$].booting=!0,eg("onReady",N[uQ],N,c);a()})}function c(m){if(m=m!=null&&Yu[m.code]!=null?eO0(m,new Yu[m.code](m.message)):m,m)return N[$$].readyResolver.reject(m);N[$$].readyResolver.resolve(N),N[$$].booting=!1,N[$$].ready=!0,N[$$].readyResolver=null}}function I(){return this}function _(v,h){if(C('Cannot call "addHook"!'),h==null)throw new A7.FST_ERR_HOOK_INVALID_HANDLER(v,h);if(v==="onSend"||v==="preSerialization"||v==="onError"||v==="preParsing"){if(h.constructor.name==="AsyncFunction"&&h.length===4)throw new A7.FST_ERR_HOOK_INVALID_ASYNC_HANDLER}else if(v==="onReady"||v==="onListen"){if(h.constructor.name==="AsyncFunction"&&h.length!==0)throw new A7.FST_ERR_HOOK_INVALID_ASYNC_HANDLER}else if(v==="onRequestAbort"){if(h.constructor.name==="AsyncFunction"&&h.length!==1)throw new A7.FST_ERR_HOOK_INVALID_ASYNC_HANDLER}else if(h.constructor.name==="AsyncFunction"&&h.length===3)throw new A7.FST_ERR_HOOK_INVALID_ASYNC_HANDLER;if(v==="onClose")this.onClose(h.bind(this));else if(v==="onReady"||v==="onListen"||v==="onRoute")this[eF].add(v,h);else this.after((m,a)=>{try{c.call(this,v,h),a(m)}catch(e){a(e)}});return this;function c(m,a){this[eF].add(m,a),this[tF].forEach((e)=>c.call(e,m,a))}}function E(v){return C('Cannot call "addSchema"!'),this[X5].add(v),this[tF].forEach((h)=>h.addSchema(v)),this}function f(v,h){if(v.headers["accept-version"]!==void 0)v.headers[xO0]=v.headers["accept-version"],v.headers["accept-version"]=void 0;W.router.lookup(v,h)}function b(v,h,c){if(Z.frameworkErrors){let a=Ju(M.server,h),e=$u(M,Z.logger,h,a),H0=new ZK(a,null,h,null,e,M),A0=new lQ(c,H0,e);if((typeof Y==="function"?Y(h):Y)===!1)e.info({req:H0},"incoming request");return Z.frameworkErrors(new Jq0(v),H0,A0)}let m=JSON.stringify({error:"Bad Request",code:"FST_ERR_BAD_URL",message:`'${v}' is not a valid url component`,statusCode:400});c.writeHead(400,{"Content-Type":"application/json","Content-Length":Buffer.byteLength(m)}),c.end(m)}function y(v,h,c){if(v===!1)return;return function(a){if(a){if(Z.frameworkErrors){let H0=Ju(M.server,h),A0=$u(M,Z.logger,h,H0),P0=new ZK(H0,null,h,null,A0,M),s0=new lQ(c,P0,A0);if((typeof Y==="function"?Y(h):Y)===!1)A0.info({req:P0},"incoming request");return Z.frameworkErrors(new Zq0,P0,s0)}let e='{"error":"Internal Server Error","message":"Unexpected error from async constraint","statusCode":500}';c.writeHead(500,{"Content-Type":"application/json","Content-Length":e.length}),c.end(e)}}}function k(v,h){return C('Cannot call "setNotFoundHandler"!'),W.setNotFoundHandler.call(this,v,h,q,G.routeHandler),this}function g(v){return C('Cannot call "setValidatorCompiler"!'),this[X5].setValidatorCompiler(v),this}function d(v){return C('Cannot call "setSchemaErrorFormatter"!'),Wu(v),this[ZA]=v.bind(this),this}function p(v){return C('Cannot call "setSerializerCompiler"!'),this[X5].setSerializerCompiler(v),this}function t(v){C('Cannot call "setSchemaController"!');let h=this[X5],c=tg.buildSchemaController(h,Object.assign({},h.opts,v));return this[X5]=c,this.getSchema=c.getSchema.bind(c),this.getSchemas=c.getSchemas.bind(c),this}function r(v){return C('Cannot call "setReplySerializer"!'),this[ag]=v,this}function G0(v){if(C('Cannot call "setErrorHandler"!'),typeof v!=="function")throw new Hq0;if(!Z.allowErrorHandlerOverride&&this[$K])throw new Bq0;else if(this[$K])Fq0("To disable this behavior, set 'allowErrorHandlerOverride' to false or ignore this message. For more information, visit: https://fastify.dev/docs/latest/Reference/Server/#allowerrorhandleroverride");return this[$K]=!0,this[eW]=Qu(this[eW],v.bind(this)),this}function O0(v){return C('Cannot call "setChildLoggerFactory"!'),this[YA]=v,this}function h0(v={}){return v.includeMeta=v.includeHooks?v.includeMeta?QA.concat(v.includeMeta):QA:v.includeMeta,G.printRoutes(v)}function u(v,{rewriteUrl:h,logger:c}){let m;return function(e,H0){if(m===void 0)m=v.isAsyncConstraint();if(h){e.originalUrl=e.url;let A0=h.call(N,e);if(typeof A0==="string")e.url=A0;else{let P0=new Uq0(e.url,typeof A0);e.destroy(P0)}}v.routing(e,H0,y(m,e,H0))}}function l(v){return C('Cannot call "setGenReqId"!'),this[XA]=Ku(this[$A].requestIdHeader,v),this}function $0(v,{hasBody:h=!1}={}){if(typeof v!=="string"||JK.METHODS.indexOf(v)===-1)throw new zq0;if(h===!0)this[B7].bodywith.add(v),this[B7].bodyless.delete(v);else this[B7].bodywith.delete(v),this[B7].bodyless.add(v);let c=v.toLowerCase();if(!this.hasDecorator(c))this.decorate(c,function(m,a,e){return G.prepareRoute.call(this,{method:v,url:m,options:a,handler:e})});return this}}function Aq0($,Z,J){if($&&typeof $!=="object")throw new Yq0;else $=Object.assign({},$);if($.querystringParser&&typeof $.querystringParser!=="function"||$.routerOptions?.querystringParser&&typeof $.routerOptions.querystringParser!=="function")throw new Xq0(typeof($.querystringParser??$.routerOptions.querystringParser));if($.schemaController&&$.schemaController.bucket&&typeof $.schemaController.bucket!=="function")throw new Qq0(typeof $.schemaController.bucket);sO0($.bodyLimit);let Y=typeof $.requestIdHeader==="string"&&$.requestIdHeader.length!==0?$.requestIdHeader.toLowerCase():$.requestIdHeader===!0&&"request-id",X=Ku(Y,$.genReqId),Q=$.requestIdLogLabel||"reqId";$.bodyLimit=$.bodyLimit||z8.bodyLimit;let G=$.disableRequestLogging||!1,W=Object.assign({customOptions:{},plugins:[]},$.ajv);if(!W.customOptions||Object.prototype.toString.call(W.customOptions)!=="[object Object]")throw new Gq0(typeof W.customOptions);if(!W.plugins||!Array.isArray(W.plugins))throw new Wq0(typeof W.plugins);let{logger:K,hasLogger:V}=nO0($);$.connectionTimeout=$.connectionTimeout||z8.connectionTimeout,$.keepAliveTimeout=$.keepAliveTimeout||z8.keepAliveTimeout,$.maxRequestsPerSocket=$.maxRequestsPerSocket||z8.maxRequestsPerSocket,$.requestTimeout=$.requestTimeout||z8.requestTimeout,$.logger=K,$.requestIdHeader=Y,$.requestIdLogLabel=Q,$.disableRequestLogging=G,$.ajv=W,$.clientErrorHandler=$.clientErrorHandler||qq0,$.allowErrorHandlerOverride=$.allowErrorHandlerOverride??z8.allowErrorHandlerOverride;let U=Vu($);return $.exposeHeadRoutes=U.exposeHeadRoutes,$.http2SessionTimeout=U.http2SessionTimeout,$.routerOptions=rO0($,{defaultRoute:Z,onBadUrl:J,ignoreTrailingSlash:z8.ignoreTrailingSlash,ignoreDuplicateSlashes:z8.ignoreDuplicateSlashes,maxParamLength:z8.maxParamLength,allowUnsafeRegex:z8.allowUnsafeRegex,buildPrettyMeta:Oq0,useSemicolonDelimiter:z8.useSemicolonDelimiter}),{options:$,genReqId:X,disableRequestLogging:G,hasLogger:V,initialConfig:U}}function Oq0($){let Z={};return["errorHandler","logLevel","logSerializers"].concat(QA).forEach((Y)=>{Z[Y]=$.store[Y]}),Object.assign({},Z)}function qq0($,Z){if($.code==="ECONNRESET"||Z.destroyed)return;let J,Y,X,Q;if($.code==="ERR_HTTP_REQUEST_TIMEOUT")Y="408",X=JK.STATUS_CODES[Y],J=`{"error":"${X}","message":"Client Timeout","statusCode":408}`,Q="timeout";else if($.code==="HPE_HEADER_OVERFLOW")Y="431",X=JK.STATUS_CODES[Y],J=`{"error":"${X}","message":"Exceeded maximum allowed HTTP header size","statusCode":431}`,Q="header_overflow";else Y="400",X=JK.STATUS_CODES[Y],J=`{"error":"${X}","message":"Client Error","statusCode":400}`,Q="error";if(this.log.trace({err:$},`client ${Q}`),Z.writable)Z.write(`HTTP/1.1 ${Y} ${X}\r
|
|
453
|
+
Content-Length: ${J.length}\r
|
|
454
|
+
Content-Type: application/json\r
|
|
455
|
+
\r
|
|
456
|
+
${J}`);Z.destroy($)}function Wu($){if(typeof $!=="function")throw new Xu(typeof $);else if($.constructor.name==="AsyncFunction")throw new Xu("AsyncFunction")}dQ.exports=GA;dQ.exports.errorCodes=A7;dQ.exports.fastify=GA;dQ.exports.default=GA});var Bu=S(($h0,WA)=>{var jq0=/at\s(?:.*\.)?plugin\s.*\n\s*(.*)/,Nq0=/(\w*(\.\w*)*)\..*/;WA.exports=function(Z){if(Z.name.length>0)return Z.name;let J=Error.stackTraceLimit;Error.stackTraceLimit=10;try{throw Error("anonymous function")}catch(Y){return Error.stackTraceLimit=J,Hu(Y.stack)}};function Hu($){let Z=$.match(jq0);return Z?Z[1].split(/[/\\]/).slice(-1)[0].match(Nq0)[1]:"anonymous"}WA.exports.extractPluginName=Hu});var Fu=S((Zh0,zu)=>{zu.exports=function(Z){if(Z[0]==="@")Z=Z.slice(1).replace("/","-");return Z.replace(/-(.)/g,function(J,Y){return Y.toUpperCase()})}});var Au=S((Jh0,YK)=>{var Mq0=Bu(),Dq0=Fu(),wq0=0;function KA($,Z={}){let J=!1;if($.default!==void 0)$=$.default;if(typeof $!=="function")throw TypeError(`fastify-plugin expects a function, instead got a '${typeof $}'`);if(typeof Z==="string")Z={fastify:Z};if(typeof Z!=="object"||Array.isArray(Z)||Z===null)throw TypeError("The options object should be an object");if(Z.fastify!==void 0&&typeof Z.fastify!=="string")throw TypeError(`fastify-plugin expects a version string, instead got '${typeof Z.fastify}'`);if(!Z.name)J=!0,Z.name=Mq0($)+"-auto-"+wq0++;if($[Symbol.for("skip-override")]=Z.encapsulate!==!0,$[Symbol.for("fastify.display-name")]=Z.name,$[Symbol.for("plugin-meta")]=Z,!$.default)$.default=$;let Y=Dq0(Z.name);if(!J&&!$[Y])$[Y]=$;return $}YK.exports=KA;YK.exports.default=KA;YK.exports.fastifyPlugin=KA});var Ou=S((Pq0)=>{var Lq0=/^(-?(?:\d+)?\.?\d+) *(m(?:illiseconds?|s(?:ecs?)?))?(s(?:ec(?:onds?|s)?)?)?(m(?:in(?:utes?|s)?)?)?(h(?:ours?|rs?)?)?(d(?:ays?)?)?(w(?:eeks?|ks?)?)?(y(?:ears?|rs?)?)?$/,XK=1000,QK=XK*60,GK=QK*60,cQ=GK*24,VA=cQ*365.25;function Tq0($){var Z,J=$.toLowerCase().match(Lq0);if(J!=null&&(Z=parseFloat(J[1]))){if(J[3]!=null)return Z*XK;if(J[4]!=null)return Z*QK;if(J[5]!=null)return Z*GK;if(J[6]!=null)return Z*cQ;if(J[7]!=null)return Z*cQ*7;if(J[8]!=null)return Z*VA;return Z}}function pQ($,Z,J,Y){var X=($|0)===$?$:~~($+0.5);return Z+X+(Y?" "+J+(X!=1?"s":""):J[0])}function Rq0($,Z){var J=$<0?"-":"",Y=$<0?-$:$;if(Y<XK)return $+(Z?" ms":"ms");if(Y<QK)return pQ(Y/XK,J,"second",Z);if(Y<GK)return pQ(Y/QK,J,"minute",Z);if(Y<cQ)return pQ(Y/GK,J,"hour",Z);if(Y<VA)return pQ(Y/cQ,J,"day",Z);return pQ(Y/VA,J,"year",Z)}Pq0.format=Rq0;Pq0.parse=Tq0});var ju=S((Xh0,qu)=>{var{LruMap:Eq0}=Bz();function WK($,Z,J=5000){this.continueExceeding=$,this.exponentialBackoff=Z,this.lru=new Eq0(J)}WK.prototype.incr=function($,Z,J,Y){let X=Date.now(),Q=this.lru.get($);if(!Q)Q={current:1,ttl:J,iterationStartMs:X};else if(Q.iterationStartMs+J<=X)Q.current=1,Q.ttl=J,Q.iterationStartMs=X;else if(++Q.current,this.continueExceeding&&Q.current>Y)Q.ttl=J,Q.iterationStartMs=X;else if(this.exponentialBackoff&&Q.current>Y){let G=Q.current-Y-1,W=J*2**G;Q.ttl=Number.isSafeInteger(W)?W:Number.MAX_SAFE_INTEGER,Q.iterationStartMs=X}else Q.ttl=J-(X-Q.iterationStartMs);this.lru.set($,Q),Z(null,Q)};WK.prototype.child=function($){return new WK($.continueExceeding,$.exponentialBackoff,$.cache)};qu.exports=WK});var Mu=S((Qh0,Nu)=>{function KK($,Z,J,Y="fastify-rate-limit-"){if(this.continueExceeding=$,this.exponentialBackoff=Z,this.redis=J,this.key=Y,!this.redis.rateLimit)this.redis.defineCommand("rateLimit",{numberOfKeys:1,lua:`
|
|
457
|
+
-- Key to operate on
|
|
458
|
+
local key = KEYS[1]
|
|
459
|
+
-- Time window for the TTL
|
|
460
|
+
local timeWindow = tonumber(ARGV[1])
|
|
461
|
+
-- Max requests
|
|
462
|
+
local max = tonumber(ARGV[2])
|
|
463
|
+
-- Flag to determine if TTL should be reset after exceeding
|
|
464
|
+
local continueExceeding = ARGV[3] == 'true'
|
|
465
|
+
--Flag to determine if exponential backoff should be applied
|
|
466
|
+
local exponentialBackoff = ARGV[4] == 'true'
|
|
467
|
+
|
|
468
|
+
--Max safe integer
|
|
469
|
+
local MAX_SAFE_INTEGER = (2^53) - 1
|
|
470
|
+
|
|
471
|
+
-- Increment the key's value
|
|
472
|
+
local current = redis.call('INCR', key)
|
|
473
|
+
|
|
474
|
+
if current == 1 or (continueExceeding and current > max) then
|
|
475
|
+
redis.call('PEXPIRE', key, timeWindow)
|
|
476
|
+
elseif exponentialBackoff and current > max then
|
|
477
|
+
local backoffExponent = current - max - 1
|
|
478
|
+
timeWindow = math.min(timeWindow * (2 ^ backoffExponent), MAX_SAFE_INTEGER)
|
|
479
|
+
redis.call('PEXPIRE', key, timeWindow)
|
|
480
|
+
else
|
|
481
|
+
timeWindow = redis.call('PTTL', key)
|
|
482
|
+
end
|
|
483
|
+
|
|
484
|
+
return {current, timeWindow}
|
|
485
|
+
`})}KK.prototype.incr=function($,Z,J,Y){this.redis.rateLimit(this.key+$,J,Y,this.continueExceeding,this.exponentialBackoff,(X,Q)=>{X?Z(X,null):Z(null,{current:Q[0],ttl:Q[1]})})};KK.prototype.child=function($){return new KK($.continueExceeding,$.exponentialBackoff,this.redis,`${this.key}${$.routeInfo.method}${$.routeInfo.url}-`)};Nu.exports=KK});var Iu=S((Gh0,VK)=>{var bq0=Au(),{parse:Lu,format:_q0}=Ou(),Sq0=ju(),fq0=Mu(),kq0={rateLimit:"x-ratelimit-limit",rateRemaining:"x-ratelimit-remaining",rateReset:"x-ratelimit-reset",retryAfter:"retry-after"},vq0={rateLimit:"ratelimit-limit",rateRemaining:"ratelimit-remaining",rateReset:"ratelimit-reset",retryAfter:"retry-after"},UA=()=>{},yq0=($)=>$.ip,xq0=($,Z)=>{let J=Error(`Rate limit exceeded, retry in ${Z.after}`);return J.statusCode=Z.statusCode,J};async function HA($,Z){let J={global:typeof Z.global==="boolean"?Z.global:!0};if(typeof Z.enableDraftSpec==="boolean"&&Z.enableDraftSpec)J.enableDraftSpec=!0,J.labels=vq0;else J.enableDraftSpec=!1,J.labels=kq0;if(J.addHeaders=Object.assign({[J.labels.rateLimit]:!0,[J.labels.rateRemaining]:!0,[J.labels.rateReset]:!0,[J.labels.retryAfter]:!0},Z.addHeaders),J.addHeadersOnExceeding=Object.assign({[J.labels.rateLimit]:!0,[J.labels.rateRemaining]:!0,[J.labels.rateReset]:!0},Z.addHeadersOnExceeding),Number.isFinite(Z.max)&&Z.max>=0)J.max=Math.trunc(Z.max);else if(typeof Z.max==="function")J.max=Z.max;else J.max=1000;if(Number.isFinite(Z.timeWindow)&&Z.timeWindow>=0)J.timeWindow=Math.trunc(Z.timeWindow);else if(typeof Z.timeWindow==="string")J.timeWindow=Lu(Z.timeWindow);else if(typeof Z.timeWindow==="function")J.timeWindow=Z.timeWindow;else J.timeWindow=60000;if(J.hook=Z.hook||"onRequest",J.allowList=Z.allowList||Z.whitelist||null,J.ban=Number.isFinite(Z.ban)&&Z.ban>=0?Math.trunc(Z.ban):-1,J.onBanReach=typeof Z.onBanReach==="function"?Z.onBanReach:UA,J.onExceeding=typeof Z.onExceeding==="function"?Z.onExceeding:UA,J.onExceeded=typeof Z.onExceeded==="function"?Z.onExceeded:UA,J.continueExceeding=typeof Z.continueExceeding==="boolean"?Z.continueExceeding:!1,J.exponentialBackoff=typeof Z.exponentialBackoff==="boolean"?Z.exponentialBackoff:!1,J.keyGenerator=typeof Z.keyGenerator==="function"?Z.keyGenerator:yq0,typeof Z.errorResponseBuilder==="function")J.errorResponseBuilder=Z.errorResponseBuilder,J.isCustomErrorMessage=!0;else J.errorResponseBuilder=xq0,J.isCustomErrorMessage=!1;J.skipOnError=typeof Z.skipOnError==="boolean"?Z.skipOnError:!1;let Y={rateLimitRan:Symbol("fastify.request.rateLimitRan"),store:null};if(Z.store){let X=Z.store;Y.store=new X(J)}else if(Z.redis)Y.store=new fq0(J.continueExceeding,J.exponentialBackoff,Z.redis,Z.nameSpace);else Y.store=new Sq0(J.continueExceeding,J.exponentialBackoff,Z.cache);if($.decorateRequest(Y.rateLimitRan,!1),!$.hasDecorator("createRateLimit"))$.decorate("createRateLimit",(X)=>{let Q=Du(Y,J,X);return(G)=>Ru.apply(this,Q.concat(G))});if(!$.hasDecorator("rateLimit"))$.decorate("rateLimit",(X)=>{let Q=Du(Y,J,X);return Pu(...Q)});$.addHook("onRoute",(X)=>{if(X.config?.rateLimit!=null){if(typeof X.config.rateLimit==="object"){let Q=Object.create(Y),G=Tu(J,X.config.rateLimit,{routeInfo:X});Q.store=Y.store.child(G),wu(Q,G,X)}else if(X.config.rateLimit!==!1)throw Error("Unknown value for route rate-limit configuration")}else if(J.global)wu(Y,J,X)})}function Tu(...$){let Z=Object.assign({},...$);if(Number.isFinite(Z.timeWindow)&&Z.timeWindow>=0)Z.timeWindow=Math.trunc(Z.timeWindow);else if(typeof Z.timeWindow==="string")Z.timeWindow=Lu(Z.timeWindow);else if(typeof Z.timeWindow!=="function")Z.timeWindow=60000;if(Number.isFinite(Z.max)&&Z.max>=0)Z.max=Math.trunc(Z.max);else if(typeof Z.max!=="function")Z.max=1000;if(Number.isFinite(Z.ban)&&Z.ban>=0)Z.ban=Math.trunc(Z.ban);else Z.ban=-1;if(Z.groupId!==void 0&&typeof Z.groupId!=="string")throw Error("groupId must be a string");return Z}function Du($,Z,J){if(typeof J==="object"){let Y=Object.create($),X=Tu(Z,J,{routeInfo:{}});return Y.store=Y.store.child(X),[Y,X]}return[$,Z]}function wu($,Z,J){let Y=Z.hook,X=Pu($,Z);if(Array.isArray(J[Y]))J[Y].push(X);else if(typeof J[Y]==="function")J[Y]=[J[Y],X];else J[Y]=[X]}async function Ru($,Z,J){let{store:Y}=$,X=await Z.keyGenerator(J),Q=J.routeOptions.config?.rateLimit?.groupId;if(Q)X+=Q;if(Z.allowList){if(typeof Z.allowList==="function"){if(await Z.allowList(J,X))return{isAllowed:!0,key:X}}else if(Z.allowList.indexOf(X)!==-1)return{isAllowed:!0,key:X}}let G=typeof Z.max==="number"?Z.max:await Z.max(J,X),W=typeof Z.timeWindow==="number"?Z.timeWindow:await Z.timeWindow(J,X),K=0,V=0,U=0;try{let H=await new Promise((B,z)=>{Y.incr(X,(F,A)=>{F?z(F):B(A)},W,G)});K=H.current,V=H.ttl,U=Math.ceil(H.ttl/1000)}catch(H){if(!Z.skipOnError)throw H}return{isAllowed:!1,key:X,max:G,timeWindow:W,remaining:Math.max(0,G-K),ttl:V,ttlInSeconds:U,isExceeded:K>G,isBanned:Z.ban!==-1&&K-G>Z.ban}}function Pu($,Z){let{rateLimitRan:J}=$;return async(Y,X)=>{if(Y[J])return;Y[J]=!0;let Q=await Ru($,Z,Y);if(Q.isAllowed)return;let{key:G,max:W,remaining:K,ttl:V,ttlInSeconds:U,isExceeded:H,isBanned:B}=Q;if(!H){if(Z.addHeadersOnExceeding[Z.labels.rateLimit])X.header(Z.labels.rateLimit,W);if(Z.addHeadersOnExceeding[Z.labels.rateRemaining])X.header(Z.labels.rateRemaining,K);if(Z.addHeadersOnExceeding[Z.labels.rateReset])X.header(Z.labels.rateReset,U);Z.onExceeding(Y,G);return}if(Z.onExceeded(Y,G),Z.addHeaders[Z.labels.rateLimit])X.header(Z.labels.rateLimit,W);if(Z.addHeaders[Z.labels.rateRemaining])X.header(Z.labels.rateRemaining,0);if(Z.addHeaders[Z.labels.rateReset])X.header(Z.labels.rateReset,U);if(Z.addHeaders[Z.labels.retryAfter])X.header(Z.labels.retryAfter,U);let z={statusCode:429,ban:!1,max:W,ttl:V,after:_q0(U*1000,!0)};if(B)z.statusCode=403,z.ban=!0,Z.onBanReach(Y,G);throw Z.errorResponseBuilder(Y,z)}}VK.exports=bq0(HA,{fastify:"5.x",name:"@fastify/rate-limit"});VK.exports.default=HA;VK.exports.fastifyRateLimit=HA});var fm=S((Sm,jK)=>{(($,Z)=>{if(typeof define==="function"&&define.amd)define([],Z);else if(typeof jK==="object"&&jK.exports)jK.exports=Z();else $.fuzzysort=Z()})(Sm,($)=>{var Z=(u,l)=>{if(!u||!l)return r;var $0=z(u);if(!g(l))l=B(l);var v=$0.bitflags;if((v&l._bitflags)!==v)return r;return A($0,l)},J=(u,l,$0)=>{if(!u)return $0?.all?F(l,$0):t;var v=z(u),h=v.bitflags,c=v.containsSpace,m=U($0?.threshold||0),a=$0?.limit||d,e=0,H0=0,A0=l.length;function P0(x){if(e<a)h0.add(x),++e;else if(++H0,x._score>h0.peek()._score)h0.replaceTop(x)}if($0?.key){var s0=$0.key;for(var o=0;o<A0;++o){var K0=l[o],z0=k(K0,s0);if(!z0)continue;if(!g(z0))z0=B(z0);if((h&z0._bitflags)!==h)continue;var j0=A(v,z0);if(j0===r)continue;if(j0._score<m)continue;j0.obj=K0,P0(j0)}}else if($0?.keys){var Q1=$0.keys,_0=Q1.length;$:for(var o=0;o<A0;++o){var K0=l[o];{var e0=0;for(var S0=0;S0<_0;++S0){var s0=Q1[S0],z0=k(K0,s0);if(!z0){b[S0]=G0;continue}if(!g(z0))z0=B(z0);b[S0]=z0,e0|=z0._bitflags}if((h&e0)!==h)continue}if(c)for(let n=0;n<v.spaceSearches.length;n++)E[n]=p;for(var S0=0;S0<_0;++S0){if(z0=b[S0],z0===G0){y[S0]=G0;continue}if(y[S0]=A(v,z0,!1,c),y[S0]===r){y[S0]=G0;continue}if(c)for(let J0=0;J0<v.spaceSearches.length;J0++){if(f[J0]>-1000){if(E[J0]>p){var C1=(E[J0]+f[J0])/4;if(C1>E[J0])E[J0]=C1}}if(f[J0]>E[J0])E[J0]=f[J0]}}if(c){for(let n=0;n<v.spaceSearches.length;n++)if(E[n]===p)continue $}else{var n0=!1;for(let n=0;n<_0;n++)if(y[n]._score!==p){n0=!0;break}if(!n0)continue}var z1=new W(_0);for(let n=0;n<_0;n++)z1[n]=y[n];if(c){var a0=0;for(let n=0;n<v.spaceSearches.length;n++)a0+=E[n]}else{var a0=p;for(let J0=0;J0<_0;J0++){var j0=z1[J0];if(j0._score>-1000){if(a0>p){var C1=(a0+j0._score)/4;if(C1>a0)a0=C1}}if(j0._score>a0)a0=j0._score}}if(z1.obj=K0,z1._score=a0,$0?.scoreFn){if(a0=$0.scoreFn(z1),!a0)continue;a0=U(a0),z1._score=a0}if(a0<m)continue;P0(z1)}}else for(var o=0;o<A0;++o){var z0=l[o];if(!z0)continue;if(!g(z0))z0=B(z0);if((h&z0._bitflags)!==h)continue;var j0=A(v,z0);if(j0===r)continue;if(j0._score<m)continue;P0(j0)}if(e===0)return t;var U1=Array(e);for(var o=e-1;o>=0;--o)U1[o]=h0.poll();return U1.total=e+H0,U1},Y=(u,l="<b>",$0="</b>")=>{var v=typeof l==="function"?l:void 0,h=u.target,c=h.length,m=u.indexes,a="",e=0,H0=0,A0=!1,P0=[];for(var s0=0;s0<c;++s0){var o=h[s0];if(m[H0]===s0){if(++H0,!A0)if(A0=!0,v)P0.push(a),a="";else a+=l;if(H0===m.length){if(v)a+=o,P0.push(v(a,e++)),a="",P0.push(h.substr(s0+1));else a+=o+$0+h.substr(s0+1);break}}else if(A0)if(A0=!1,v)P0.push(v(a,e++)),a="";else a+=$0;a+=o}return v?P0:a},X=(u)=>{if(typeof u==="number")u=""+u;else if(typeof u!=="string")u="";var l=w(u);return K(u,{_targetLower:l._lower,_targetLowerCodes:l.lowerCodes,_bitflags:l.bitflags})},Q=()=>{C.clear(),R.clear()};class G{get["indexes"](){return this._indexes.slice(0,this._indexes.len).sort((u,l)=>u-l)}set["indexes"](u){return this._indexes=u}["highlight"](u,l){return Y(this,u,l)}get["score"](){return V(this._score)}set["score"](u){this._score=U(u)}}class W extends Array{get["score"](){return V(this._score)}set["score"](u){this._score=U(u)}}var K=(u,l)=>{let $0=new G;return $0.target=u,$0.obj=l.obj??r,$0._score=l._score??p,$0._indexes=l._indexes??[],$0._targetLower=l._targetLower??"",$0._targetLowerCodes=l._targetLowerCodes??r,$0._nextBeginningIndexes=l._nextBeginningIndexes??r,$0._bitflags=l._bitflags??0,$0},V=(u)=>{if(u===p)return 0;if(u>1)return u;return Math.E**(((-u+1)**0.04307-1)*-2)},U=(u)=>{if(u===0)return p;if(u>1)return u;return 1-Math.pow(Math.log(u)/-2+1,23.218017181332716)},H=(u)=>{if(typeof u==="number")u=""+u;else if(typeof u!=="string")u="";u=u.trim();var l=w(u),$0=[];if(l.containsSpace){var v=u.split(/\s+/);v=[...new Set(v)];for(var h=0;h<v.length;h++){if(v[h]==="")continue;var c=w(v[h]);$0.push({lowerCodes:c.lowerCodes,_lower:v[h].toLowerCase(),containsSpace:!1})}}return{lowerCodes:l.lowerCodes,_lower:l._lower,containsSpace:l.containsSpace,bitflags:l.bitflags,spaceSearches:$0}},B=(u)=>{if(u.length>999)return X(u);var l=C.get(u);if(l!==void 0)return l;return l=X(u),C.set(u,l),l},z=(u)=>{if(u.length>999)return H(u);var l=R.get(u);if(l!==void 0)return l;return l=H(u),R.set(u,l),l},F=(u,l)=>{var $0=[];$0.total=u.length;var v=l?.limit||d;if(l?.key)for(var h=0;h<u.length;h++){var c=u[h],m=k(c,l.key);if(m==r)continue;if(!g(m))m=B(m);var a=K(m.target,{_score:m._score,obj:c});if($0.push(a),$0.length>=v)return $0}else if(l?.keys)for(var h=0;h<u.length;h++){var c=u[h],e=new W(l.keys.length);for(var H0=l.keys.length-1;H0>=0;--H0){var m=k(c,l.keys[H0]);if(!m){e[H0]=G0;continue}if(!g(m))m=B(m);m._score=p,m._indexes.len=0,e[H0]=m}if(e.obj=c,e._score=p,$0.push(e),$0.length>=v)return $0}else for(var h=0;h<u.length;h++){var m=u[h];if(m==r)continue;if(!g(m))m=B(m);if(m._score=p,m._indexes.len=0,$0.push(m),$0.length>=v)return $0}return $0},A=(u,l,$0=!1,v=!1)=>{if($0===!1&&u.containsSpace)return j(u,l,v);var{_lower:h,lowerCodes:c}=u,m=c[0],a=l._targetLowerCodes,e=c.length,H0=a.length,o=0,A0=0,P0=0;for(;;){var s0=m===a[A0];if(s0){if(T[P0++]=A0,++o,o===e)break;m=c[o]}if(++A0,A0>=H0)return r}var o=0,K0=!1,z0=0,j0=l._nextBeginningIndexes;if(j0===r)j0=l._nextBeginningIndexes=M(l.target);A0=T[0]===0?0:j0[T[0]-1];var Q1=0;if(A0!==H0)for(;;)if(A0>=H0){if(o<=0)break;if(++Q1,Q1>200)break;--o;var _0=I[--z0];A0=j0[_0]}else{var s0=c[o]===a[A0];if(s0){if(I[z0++]=A0,++o,o===e){K0=!0;break}++A0}else A0=j0[A0]}var e0=e<=1?-1:l._targetLower.indexOf(h,T[0]),S0=!!~e0,C1=!S0?!1:e0===0||l._nextBeginningIndexes[e0-1]===e0;if(S0&&!C1)for(var n0=0;n0<j0.length;n0=j0[n0]){if(n0<=e0)continue;for(var z1=0;z1<e;z1++)if(c[z1]!==l._targetLowerCodes[n0+z1])break;if(z1===e){e0=n0,C1=!0;break}}var a0=(n)=>{var J0=0,C0=0;for(var M0=1;M0<e;++M0)if(n[M0]-n[M0-1]!==1)J0-=n[M0],++C0;var D1=n[e-1]-n[0]-(e-1);if(J0-=(12+D1)*C0,n[0]!==0)J0-=n[0]*n[0]*0.2;if(!K0)J0*=1000;else{var g0=1;for(var M0=j0[0];M0<H0;M0=j0[M0])++g0;if(g0>24)J0*=(g0-24)*10}if(J0-=(H0-e)/2,S0)J0/=1+e*e*1;if(C1)J0/=1+e*e*1;return J0-=(H0-e)/2,J0};if(!K0){if(S0)for(var n0=0;n0<e;++n0)T[n0]=e0+n0;var U1=T,x=a0(U1)}else if(C1){for(var n0=0;n0<e;++n0)T[n0]=e0+n0;var U1=T,x=a0(T)}else var U1=I,x=a0(I);l._score=x;for(var n0=0;n0<e;++n0)l._indexes[n0]=U1[n0];l._indexes.len=e;let i=new G;return i.target=l.target,i._score=l._score,i._indexes=l._indexes,i},j=(u,l,$0)=>{var v=new Set,h=0,c=r,m=0,a=u.spaceSearches,e=a.length,H0=0,A0=()=>{for(let C1=H0-1;C1>=0;C1--)l._nextBeginningIndexes[_[C1*2+0]]=_[C1*2+1]},P0=!1;for(var S0=0;S0<e;++S0){f[S0]=p;var s0=a[S0];if(c=A(s0,l),$0){if(c===r)continue;P0=!0}else if(c===r)return A0(),r;var o=S0===e-1;if(!o){var K0=c._indexes,z0=!0;for(let n0=0;n0<K0.len-1;n0++)if(K0[n0+1]-K0[n0]!==1){z0=!1;break}if(z0){var j0=K0[K0.len-1]+1,Q1=l._nextBeginningIndexes[j0-1];for(let n0=j0-1;n0>=0;n0--){if(Q1!==l._nextBeginningIndexes[n0])break;l._nextBeginningIndexes[n0]=j0,_[H0*2+0]=n0,_[H0*2+1]=Q1,H0++}}}if(h+=c._score/e,f[S0]=c._score/e,c._indexes[0]<m)h-=(m-c._indexes[0])*2;m=c._indexes[0];for(var _0=0;_0<c._indexes.len;++_0)v.add(c._indexes[_0])}if($0&&!P0)return r;A0();var e0=A(u,l,!0);if(e0!==r&&e0._score>h){if($0)for(var S0=0;S0<e;++S0)f[S0]=e0._score/e;return e0}if($0)c=l;c._score=h;var S0=0;for(let C1 of v)c._indexes[S0++]=C1;return c._indexes.len=S0,c},N=(u)=>u.replace(/\p{Script=Latin}+/gu,(l)=>l.normalize("NFD")).replace(/[\u0300-\u036f]/g,""),w=(u)=>{u=N(u);var l=u.length,$0=u.toLowerCase(),v=[],h=0,c=!1;for(var m=0;m<l;++m){var a=v[m]=$0.charCodeAt(m);if(a===32){c=!0;continue}var e=a>=97&&a<=122?a-97:a>=48&&a<=57?26:a<=127?30:31;h|=1<<e}return{lowerCodes:v,bitflags:h,containsSpace:c,_lower:$0}},q=(u)=>{var l=u.length,$0=[],v=0,h=!1,c=!1;for(var m=0;m<l;++m){var a=u.charCodeAt(m),e=a>=65&&a<=90,H0=e||a>=97&&a<=122||a>=48&&a<=57,A0=e&&!h||!c||!H0;if(h=e,c=H0,A0)$0[v++]=m}return $0},M=(u)=>{u=N(u);var l=u.length,$0=q(u),v=[],h=$0[0],c=0;for(var m=0;m<l;++m)if(h>m)v[m]=h;else h=$0[++c],v[m]=h===void 0?l:h;return v},C=new Map,R=new Map,T=[],I=[],_=[],E=[],f=[],b=[],y=[],k=(u,l)=>{var $0=u[l];if($0!==void 0)return $0;if(typeof l==="function")return l(u);var v=l;if(!Array.isArray(l))v=l.split(".");var h=v.length,c=-1;while(u&&++c<h)u=u[v[c]];return u},g=(u)=>{return typeof u==="object"&&typeof u._bitflags==="number"},d=1/0,p=-d,t=[];t.total=0;var r=null,G0=X(""),O0=(u)=>{var l=[],$0=0,v={},h=(c)=>{for(var m=0,a=l[m],e=1;e<$0;){var H0=e+1;m=e,H0<$0&&l[H0]._score<l[e]._score&&(m=H0),l[m-1>>1]=l[m],e=1+(m<<1)}for(var A0=m-1>>1;m>0&&a._score<l[A0]._score;A0=(m=A0)-1>>1)l[m]=l[A0];l[m]=a};return v.add=(c)=>{var m=$0;l[$0++]=c;for(var a=m-1>>1;m>0&&c._score<l[a]._score;a=(m=a)-1>>1)l[m]=l[a];l[m]=c},v.poll=(c)=>{if($0!==0){var m=l[0];return l[0]=l[--$0],h(),m}},v.peek=(c)=>{if($0!==0)return l[0]},v.replaceTop=(c)=>{l[0]=c,h()},v},h0=O0();return{single:Z,go:J,prepare:X,cleanup:Q}})});var Y9={};F1(Y9,{toRow:()=>CM0,plan:()=>uM0,listGlobal:()=>dM0,list:()=>lM0,layer:()=>wd,isDefaultTitle:()=>IM0,getUsage:()=>mM0,fromRow:()=>OY,defaultLayer:()=>oM0,SetTitleInput:()=>vM0,SetRevertInput:()=>hM0,SetPermissionInput:()=>xM0,SetArchivedInput:()=>yM0,Service:()=>nK,RemoveInput:()=>kM0,ProjectInfo:()=>Nd,MessagesInput:()=>gM0,Info:()=>F6,GlobalInfo:()=>EM0,GetInput:()=>SM0,ForkInput:()=>_M0,Event:()=>qY,CreateInput:()=>bM0,ChildrenInput:()=>fM0,BusyError:()=>Dd});var JV;((rM0)=>{let $=["brave","calm","clever","cosmic","crisp","curious","eager","gentle","glowing","happy","hidden","jolly","kind","lucky","mighty","misty","neon","nimble","playful","proud","quick","quiet","shiny","silent","stellar","sunny","swift","tidy","witty"],Z=["cabin","cactus","canyon","circuit","comet","eagle","engine","falcon","forest","garden","harbor","island","knight","lagoon","meadow","moon","mountain","nebula","orchid","otter","panda","pixel","planet","river","rocket","sailor","squid","star","tiger","wizard","wolf"];function J(){return[$[Math.floor(Math.random()*$.length)],Z[Math.floor(Math.random()*Z.length)]].join("-")}rM0.create=J})(JV||={});var l1={};F1(l1,{subscribeAll:()=>kd,subscribe:()=>fd,publish:()=>Sd,layer:()=>YV,defaultLayer:()=>bd,Service:()=>IY,InstanceDisposed:()=>UO,Bus:()=>l1});var NZ=E0.create({service:"bus"}),UO=L1.define("server.instance.disposed",P.object({directory:P.string()}));class IY extends S1.Service()("@qitqode/Bus"){}var YV=T0.effect(IY,L.gen(function*(){let $=yield*B0.make(L.fn("Bus.state")(function*(K){let V=yield*h6.unbounded(),U=new Map;return yield*L.addFinalizer(()=>L.gen(function*(){yield*h6.publish(V,{type:UO.type,properties:{directory:K.directory}}),yield*h6.shutdown(V);for(let H of U.values())yield*h6.shutdown(H)})),{wildcard:V,typed:U}}));function Z(K,V){return L.gen(function*(){let U=K.typed.get(V.type);if(!U)U=yield*h6.unbounded(),K.typed.set(V.type,U);return U})}function J(K,V){return L.gen(function*(){let U=yield*B0.get($),H={type:K.type,properties:V};NZ.debug("publishing",{type:K.type});let B=U.typed.get(K.type);if(B)yield*h6.publish(B,H);yield*h6.publish(U.wildcard,H);let z=yield*B0.directory,F=yield*B0.context,A=yield*B0.workspaceID;L7.emit("event",{directory:z,project:F.project.id,workspace:A,payload:H})})}function Y(K){return NZ.info("subscribing",{type:K.type}),P$.unwrap(L.gen(function*(){let V=yield*B0.get($),U=yield*Z(V,K);return P$.fromPubSub(U)})).pipe(P$.ensuring(L.sync(()=>NZ.info("unsubscribing",{type:K.type}))))}function X(){return NZ.info("subscribing",{type:"*"}),P$.unwrap(L.gen(function*(){let K=yield*B0.get($);return P$.fromPubSub(K.wildcard)})).pipe(P$.ensuring(L.sync(()=>NZ.info("unsubscribing",{type:"*"}))))}function Q(K,V,U){return L.gen(function*(){NZ.info("subscribing",{type:V});let H=yield*T7.make(),B=yield*PY.make(),z=yield*PY.provide(B)(h6.subscribe(K));return yield*PY.provide(B)(P$.fromSubscription(z).pipe(P$.runForEach((F)=>L.tryPromise({try:()=>Promise.resolve().then(()=>U(F)),catch:(A)=>{NZ.error("subscriber failed",{type:V,cause:A})}}).pipe(L.ignore)),L.forkScoped)),()=>{NZ.info("unsubscribing",{type:V}),H.fork(PY.close(B,B9.void))}})}let G=L.fn("Bus.subscribeCallback")(function*(K,V){let U=yield*B0.get($),H=yield*Z(U,K);return yield*Q(H,K.type,V)}),W=L.fn("Bus.subscribeAllCallback")(function*(K){let V=yield*B0.get($);return yield*Q(V.wildcard,"*",K)});return IY.of({publish:J,subscribe:Y,subscribeAll:X,subscribeCallback:G,subscribeAllCallback:W})})),bd=YV,{runPromise:_d,runSync:HO}=VO(IY,YV);async function Sd($,Z){return _d((J)=>J.publish($,Z))}function fd($,Z){return HO((J)=>J.subscribeCallback($,Z))}function kd($){return HO((Z)=>Z.subscribeAllCallback($))}var X$={};F1(X$,{versionedType:()=>CY,run:()=>sd,reset:()=>pd,replayAll:()=>od,replay:()=>qO,remove:()=>rd,registry:()=>EY,project:()=>nd,payloads:()=>ad,init:()=>cd,define:()=>id,SyncEvent:()=>X$});var _8=g6("event_sequence",{aggregate_id:w1().notNull().primaryKey(),seq:q8().notNull()}),z9=g6("event",{id:w1().primaryKey(),aggregate_id:w1().notNull().references(()=>_8.aggregate_id,{onDelete:"cascade"}),seq:q8().notNull(),type:w1().notNull(),data:w1({mode:"json"}).$type().notNull()});var d1={};F1(d1,{timestamp:()=>dd,schema:()=>hd,descending:()=>ld,create:()=>zO,ascending:()=>md,Identifier:()=>d1});import{randomBytes as vd}from"crypto";var yd="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function XV($){let Z="",J=vd($);for(let Y=0;Y<$;Y++)Z+=yd[J[Y]%62];return Z}function QV(){let $=0,Z=0;return(J)=>{if(J!==void 0)return BigInt(J)*BigInt(4096);let Y=Date.now();if(Y>$)$=Y,Z=0;if(Z++,Z>4095)$++,Z=1;return BigInt($)*BigInt(4096)+BigInt(Z)}}function GV($){let Z=Buffer.alloc(6);for(let J=0;J<6;J++)Z[J]=Number($>>BigInt(40-8*J)&BigInt(255));return Z.toString("hex")}var xd;((VD0)=>{let Z=QV();function J(){return X(!1)}VD0.ascending=J;function Y(){return X(!0)}VD0.descending=Y;function X(Q,G){let W=Z(G);return W=Q?~W:W,GV(W)+XV(14)}VD0.create=X})(xd||={});var F9={event:"evt",session:"ses",message:"msg",permission:"per",question:"que",user:"usr",part:"prt",pty:"pty",tool:"tool",workspace:"wrk",entry:"ent",workflow:"wf"};function hd($){return P.string().startsWith(F9[$])}var gd=26,ud=QV();function md($,Z){return BO($,"ascending",Z)}function ld($,Z){return BO($,"descending",Z)}function BO($,Z,J){if(!J)return zO(F9[$],Z);if(!J.startsWith(F9[$]))throw Error(`ID ${J} does not start with ${F9[$]}`);return J}function zO($,Z,J){let Y=ud(J);return Y=Z==="descending"?~Y:Y,$+"_"+GV(Y)+XV(gd-12)}function dd($){let Z=$.split("_")[0],J=$.slice(Z.length+1,Z.length+13),Y=BigInt("0x"+J);return Number(Y/BigInt(4096))}var FO=O.String.annotate({[F$]:d1.schema("event")}).pipe(O.brand("EventID"),u0(($)=>({ascending:(Z)=>$.make(d1.ascending("event",Z)),zod:d1.schema("event").pipe(P.custom())})));var EY=new Map,A9,O9=new Map,WV=!1,KV;function pd(){WV=!1,A9=void 0,KV=($,Z)=>Z}function cd($){A9=new Map($.projectors);for(let[Z,J]of O9.entries()){let Y=EY.get(CY(Z,J));L1.define(Y.type,Y.properties||Y.schema)}WV=!0,KV=$.convertEvent||((Z,J)=>J)}function CY($,Z){return Z?`${$}.${Z}`:$}function id($){if(WV)throw Error("Error defining sync event: sync system has been frozen");let Z={type:$.type,version:$.version,aggregate:$.aggregate,schema:$.schema,properties:$.busSchema?$.busSchema:$.schema};return O9.set(Z.type,Math.max(Z.version,O9.get(Z.type)||0)),EY.set(CY(Z.type,Z.version),Z),Z}function nd($,Z){return[$,Z]}function OO($,Z,J){if(A9==null)throw Error("No projectors available. Call `SyncEvent.init` to install projectors");let Y=A9.get($);if(!Y)throw Error(`Projector not found for event: ${$.type}`);W1.transaction((X)=>{if(Y(X,Z.data),b0.QITQODE_EXPERIMENTAL_WORKSPACES)X.insert(_8).values({aggregate_id:Z.aggregateID,seq:Z.seq}).onConflictDoUpdate({target:_8.aggregate_id,set:{seq:Z.seq}}).run(),X.insert(z9).values({id:Z.id,seq:Z.seq,aggregate_id:Z.aggregateID,type:CY($.type,$.version),data:Z.data}).run();W1.effect(()=>{if(J?.publish){let Q=KV($.type,Z.data);if(Q instanceof Promise)Q.then((G)=>{l1.publish({type:$.type,properties:$.schema},G)});else l1.publish({type:$.type,properties:$.schema},Q);L7.emit("event",{directory:S8.directory,project:S8.project.id,workspace:AO.workspaceID,payload:{type:"sync",syncEvent:{type:CY($.type,$.version),...Z}}})}})})}function qO($,Z){let J=EY.get($.type);if(!J)throw Error(`Unknown event type: ${$.type}`);let X=W1.use((G)=>G.select({seq:_8.seq}).from(_8).where(m0(_8.aggregate_id,$.aggregateID)).get())?.seq??-1;if($.seq<=X)return;let Q=X+1;if($.seq!==Q)throw Error(`Sequence mismatch for aggregate "${$.aggregateID}": expected ${Q}, got ${$.seq}`);OO(J,$,{publish:!!Z?.publish})}function od($,Z){let J=$[0]?.aggregateID;if(!J)return;if($.some((X)=>X.aggregateID!==J))throw Error("Replay events must belong to the same session");let Y=$[0].seq;for(let[X,Q]of $.entries()){let G=Y+X;if(Q.seq!==G)throw Error(`Replay sequence mismatch at index ${X}: expected ${G}, got ${Q.seq}`)}for(let X of $)qO(X,Z);return J}function sd($,Z,J){let Y=Z[$.aggregate];if(Y==null)throw Error(`SyncEvent.run: "${$.aggregate}" required but not found: ${JSON.stringify(Z)}`);if($.version!==O9.get($.type))throw Error(`SyncEvent.run: running old versions of events is not allowed: ${$.type}`);let{publish:X=!0}=J||{};W1.transaction((Q)=>{let G=FO.ascending(),W=Q.select({seq:_8.seq}).from(_8).where(m0(_8.aggregate_id,Y)).get(),K=W?.seq!=null?W.seq+1:0;OO($,{id:G,seq:K,aggregateID:Y,data:Z},{publish:X})},{behavior:"immediate"})}function rd($){W1.transaction((Z)=>{Z.delete(_8).where(m0(_8.aggregate_id,$)).run(),Z.delete(z9).where(m0(z9.aggregate_id,$)).run()})}function ad(){return EY.entries().map(([$,Z])=>{return P.object({type:P.literal("sync"),name:P.literal($),id:P.string(),seq:P.number(),aggregateID:P.literal(Z.aggregate),data:Z.schema}).meta({ref:`SyncEvent.${Z.type}`})}).toArray()}var b$={};F1(b$,{toModelMessagesEffect:()=>W2,toModelMessages:()=>oe,stream:()=>pU,parts:()=>RL,page:()=>TL,isMedia:()=>NX,get:()=>Pa,fromError:()=>xA,fingerprint:()=>OH,filterCompactedEffect:()=>Ia,filterCompacted:()=>cU,cursor:()=>dU,WithParts:()=>wa,User:()=>NL,ToolStateRunning:()=>BL,ToolStatePending:()=>HL,ToolStateError:()=>FL,ToolStateCompleted:()=>zL,ToolState:()=>AL,ToolPart:()=>OL,TextPart:()=>aw,SymbolSource:()=>$L,SubtaskPart:()=>QL,StructuredOutputError:()=>lw,StepStartPart:()=>KL,StepFinishPart:()=>UL,SnapshotPart:()=>sw,SYNTHETIC_ATTACHMENT_PROMPT:()=>G2,RetryPart:()=>WL,ResourceSource:()=>ZL,ReasoningPart:()=>tw,Provenance:()=>jL,PatchPart:()=>rw,Part:()=>mU,OutputLengthError:()=>U4,OutputFormatText:()=>iw,OutputFormatJsonSchema:()=>nw,ModelError:()=>cw,MessageV2:()=>b$,InvalidOutputError:()=>dw,Info:()=>lU,Format:()=>ow,FileSource:()=>ew,FilePartSource:()=>JL,FilePart:()=>uU,Event:()=>Da,ErrorDiagnostic:()=>mw,ContextOverflowError:()=>GX,ContentFilterError:()=>pw,CompactionPart:()=>GL,CheckpointPart:()=>XL,AuthError:()=>H4,Assistant:()=>ML,AgentPart:()=>YL,AbortedError:()=>f5,APIError:()=>T6});var r0=O.String.annotate({[F$]:d1.schema("session")}).pipe(O.brand("SessionID"),u0(($)=>({descending:(Z)=>$.make(d1.descending("session",Z)),zod:d1.schema("session").pipe(P.custom())}))),i1=O.String.annotate({[F$]:d1.schema("message")}).pipe(O.brand("MessageID"),u0(($)=>({ascending:(Z)=>$.make(d1.ascending("message",Z)),zod:d1.schema("message").pipe(P.custom())}))),MZ=O.String.annotate({[F$]:d1.schema("part")}).pipe(O.brand("PartID"),u0(($)=>({ascending:(Z)=>$.make(d1.ascending("part",Z)),zod:d1.schema("part").pipe(P.custom())})));var X4={};F1(X4,{layer:()=>Pw,defaultLayer:()=>Va,Symbol:()=>Xa,Status:()=>Ga,Service:()=>Y4,Range:()=>J4,Event:()=>Rw,DocumentSymbol:()=>Qa,Diagnostic:()=>XX});var S7=m6(Kj(),1);import yY from"path";import{pathToFileURL as F5,fileURLToPath as gc}from"url";var Vj={".abap":"abap",".bat":"bat",".bib":"bibtex",".bibtex":"bibtex",".clj":"clojure",".cljs":"clojure",".cljc":"clojure",".edn":"clojure",".coffee":"coffeescript",".c":"c",".cpp":"cpp",".cxx":"cpp",".cc":"cpp",".c++":"cpp",".cs":"csharp",".css":"css",".d":"d",".pas":"pascal",".pascal":"pascal",".diff":"diff",".patch":"diff",".dart":"dart",".dockerfile":"dockerfile",".ex":"elixir",".exs":"elixir",".erl":"erlang",".ets":"typescript",".hrl":"erlang",".fs":"fsharp",".fsi":"fsharp",".fsx":"fsharp",".fsscript":"fsharp",".gitcommit":"git-commit",".gitrebase":"git-rebase",".go":"go",".groovy":"groovy",".gleam":"gleam",".hbs":"handlebars",".handlebars":"handlebars",".hs":"haskell",".lhs":"haskell",".html":"html",".htm":"html",".ini":"ini",".java":"java",".jl":"julia",".js":"javascript",".kt":"kotlin",".kts":"kotlin",".jsx":"javascriptreact",".json":"json",".tex":"latex",".latex":"latex",".less":"less",".lua":"lua",".makefile":"makefile",makefile:"makefile",".md":"markdown",".markdown":"markdown",".m":"objective-c",".mm":"objective-cpp",".pl":"perl",".pm":"perl",".pm6":"perl6",".php":"php",".ps1":"powershell",".psm1":"powershell",".pug":"jade",".jade":"jade",".py":"python",".r":"r",".cshtml":"razor",".razor":"razor",".rb":"ruby",".rake":"ruby",".gemspec":"ruby",".ru":"ruby",".erb":"erb",".html.erb":"erb",".js.erb":"erb",".css.erb":"erb",".json.erb":"erb",".rs":"rust",".scss":"scss",".sass":"sass",".scala":"scala",".shader":"shaderlab",".sh":"shellscript",".bash":"shellscript",".zsh":"shellscript",".ksh":"shellscript",".sql":"sql",".svelte":"svelte",".swift":"swift",".ts":"typescript",".tsx":"typescriptreact",".mts":"typescript",".cts":"typescript",".mtsx":"typescriptreact",".ctsx":"typescriptreact",".xml":"xml",".xsl":"xsl",".yaml":"yaml",".yml":"yaml",".mjs":"javascript",".cjs":"javascript",".vue":"vue",".zig":"zig",".zon":"zig",".astro":"astro",".ml":"ocaml",".mli":"ocaml",".tf":"terraform",".tfvars":"terraform-vars",".hcl":"hcl",".nix":"nix",".typ":"typst",".typc":"typst"};function xV($,Z){let J;return Promise.race([$,new Promise((X,Q)=>{J=setTimeout(()=>{Q(Error(`Operation timed out after ${Z}ms`))},Z)})]).finally(()=>clearTimeout(J))}var uc=150,A5=E0.create({service:"lsp.client"}),mc=j1.create("LSPInitializeError",P.object({serverID:P.string()})),Uj={Diagnostics:L1.define("lsp.client.diagnostics",P.object({serverID:P.string(),path:P.string()}))};async function Hj($){let Z=A5.clone().tag("serverID",$.serverID);Z.info("starting client");let J=S7.createMessageConnection(new S7.StreamMessageReader($.server.process.stdout),new S7.StreamMessageWriter($.server.process.stdin)),Y=new Map;if(J.onNotification("textDocument/publishDiagnostics",(G)=>{let W=o0.normalizePath(gc(G.uri));Z.info("textDocument/publishDiagnostics",{path:W,count:G.diagnostics.length});let K=Y.has(W);if(Y.set(W,G.diagnostics),!K&&$.serverID==="typescript")return;l1.publish(Uj.Diagnostics,{path:W,serverID:$.serverID})}),J.onRequest("window/workDoneProgress/create",(G)=>{return Z.info("window/workDoneProgress/create",G),null}),J.onRequest("workspace/configuration",async()=>{return[$.server.initialization??{}]}),J.onRequest("client/registerCapability",async()=>{}),J.onRequest("client/unregisterCapability",async()=>{}),J.onRequest("workspace/workspaceFolders",async()=>[{name:"workspace",uri:F5($.root).href}]),J.listen(),Z.info("sending initialize"),await xV(J.sendRequest("initialize",{rootUri:F5($.root).href,processId:$.server.process.pid,workspaceFolders:[{name:"workspace",uri:F5($.root).href}],initializationOptions:{...$.server.initialization},capabilities:{window:{workDoneProgress:!0},workspace:{configuration:!0,didChangeWatchedFiles:{dynamicRegistration:!0}},textDocument:{synchronization:{didOpen:!0,didChange:!0},publishDiagnostics:{versionSupport:!0}}}}),45000).catch((G)=>{throw Z.error("initialize error",{error:G}),new mc({serverID:$.serverID},{cause:G})}),await J.sendNotification("initialized",{}),$.server.initialization)await J.sendNotification("workspace/didChangeConfiguration",{settings:$.server.initialization});let X={},Q={root:$.root,get serverID(){return $.serverID},get connection(){return J},notify:{async open(G){G.path=yY.isAbsolute(G.path)?G.path:yY.resolve($.directory,G.path);let W=await o0.readText(G.path),K=yY.extname(G.path),V=Vj[K]??"plaintext",U=X[G.path];if(U!==void 0){A5.info("workspace/didChangeWatchedFiles",G),await J.sendNotification("workspace/didChangeWatchedFiles",{changes:[{uri:F5(G.path).href,type:2}]});let H=U+1;X[G.path]=H,A5.info("textDocument/didChange",{path:G.path,version:H}),await J.sendNotification("textDocument/didChange",{textDocument:{uri:F5(G.path).href,version:H},contentChanges:[{text:W}]});return}A5.info("workspace/didChangeWatchedFiles",G),await J.sendNotification("workspace/didChangeWatchedFiles",{changes:[{uri:F5(G.path).href,type:1}]}),A5.info("textDocument/didOpen",G),Y.delete(G.path),await J.sendNotification("textDocument/didOpen",{textDocument:{uri:F5(G.path).href,languageId:V,version:0,text:W}}),X[G.path]=0;return}},get diagnostics(){return Y},async waitForDiagnostics(G){let W=o0.normalizePath(yY.isAbsolute(G.path)?G.path:yY.resolve($.directory,G.path));A5.info("waiting for diagnostics",{path:W});let K,V;return await xV(new Promise((U)=>{K=l1.subscribe(Uj.Diagnostics,(H)=>{if(H.properties.path===W&&H.properties.serverID===Q.serverID){if(V)clearTimeout(V);V=setTimeout(()=>{A5.info("got diagnostics",{path:W}),K?.(),U()},uc)}})}),3000).catch(()=>{}).finally(()=>{if(V)clearTimeout(V);K?.()})},async shutdown(){Z.info("shutting down"),J.end(),J.dispose(),await f1.stop($.server.process),Z.info("shutdown")}};return Z.info("initialized"),Q}import Lw from"path";import{pathToFileURL as Tw,fileURLToPath as Ya}from"url";var f7={};F1(f7,{Zls:()=>xj,YamlLS:()=>wj,Vue:()=>Oj,Typescript:()=>Aj,Ty:()=>gj,Tinymist:()=>ij,TexLab:()=>oj,TerraformLS:()=>nj,Svelte:()=>Mj,SourceKit:()=>Ej,RustAnalyzer:()=>bj,Rubocop:()=>hj,Pyright:()=>uj,Prisma:()=>Tj,PHPIntelephense:()=>lj,Oxlint:()=>jj,Ocaml:()=>vj,Nixd:()=>cj,LuaLS:()=>Lj,KotlinLS:()=>fj,JuliaLS:()=>dj,JDTLS:()=>Sj,HLS:()=>pj,Gopls:()=>Pj,Gleam:()=>yj,FSharp:()=>Cj,ElixirLS:()=>mj,ESLint:()=>qj,DockerfileLS:()=>sj,Deno:()=>Fj,Dart:()=>kj,Clojure:()=>rj,Clangd:()=>_j,CSharp:()=>Ij,Biome:()=>Nj,BashLS:()=>Rj,Astro:()=>Dj});function Z1($,Z,J){let Y=Array.isArray(Z)?[...Z]:[],X=Array.isArray(Z)?J:Z,Q=f1.spawn([$,...Y],{...X,stdin:"pipe",stdout:"pipe",stderr:"pipe"});if(!Q.stdin||!Q.stdout||!Q.stderr)throw Error("Process output not available");return Q}import lc from"fs/promises";import hV from"path";var Q0=E0.create({service:"lsp.server"}),gV=async($)=>lc.stat($).then(()=>!0).catch(()=>!1),N6=($,Z={})=>f1.run($,{...Z,nothrow:!0}),zj=($,Z={})=>f1.text($,{...Z,nothrow:!0});async function M6($,Z){if($)return $;if(b0.QITQODE_DISABLE_LSP_DOWNLOAD)return;return j6.which(Z)}var D6=($,Z,J)=>Z1($,Z,{cwd:J,env:{...o8()}}),t0=($,Z)=>{return async(J,Y)=>{if(Z){let G=o0.up({targets:Z,start:hV.dirname(J),stop:Y.directory}),W=await G.next();if(await G.return(),W.value)return}let X=o0.up({targets:$,start:hV.dirname(J),stop:Y.directory}),Q=await X.next();if(await X.return(),!Q.value)return Y.directory;return hV.dirname(Q.value)}};import{createRequire as dc}from"module";import pc from"path";var wZ;((PL0)=>{function $(Z,J){try{return dc(pc.join(J,"package.json")).resolve(Z)}catch{}}PL0.resolve=$})(wZ||={});import cc from"path";async function LZ($,Z,J){let Y=await fetch($);if(!Y.ok){Q0.error(`Failed to download ${J}`);return}let X=cc.join(F0.Path.bin,Z);if(Y.body)await o0.writeStream(X,Y.body);return X}async function TZ($,Z){return M8.extractZip($,F0.Path.bin).then(()=>!0).catch((J)=>{return Q0.error(`Failed to extract ${Z} archive`,{error:J}),!1})}import w6 from"fs/promises";import{text as ic}from"stream/consumers";import D8 from"path";var Fj={id:"deno",root:async($,Z)=>{let J=o0.up({targets:["deno.json","deno.jsonc"],start:D8.dirname($),stop:Z.directory}),Y=await J.next();if(await J.return(),!Y.value)return;return D8.dirname(Y.value)},extensions:[".ts",".tsx",".js",".jsx",".mjs"],async spawn($){let Z=d0("deno");if(!Z){Q0.info("deno not found, please install deno first");return}return{process:Z1(Z,["lsp"],{cwd:$})}}},Aj={id:"typescript",root:t0(["package-lock.json","bun.lockb","bun.lock","pnpm-lock.yaml","yarn.lock"],["deno.json","deno.jsonc"]),extensions:[".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts"],async spawn($,Z){let J=wZ.resolve("typescript/lib/tsserver.js",Z.directory);if(Q0.info("typescript server",{tsserver:J}),!J)return;let Y=await j6.which("typescript-language-server");if(!Y)return;return{process:Z1(Y,["--stdio"],{cwd:$,env:{...o8()}}),initialization:{tsserver:{path:J}}}}},Oj={id:"vue",extensions:[".vue"],root:t0(["package-lock.json","bun.lockb","bun.lock","pnpm-lock.yaml","yarn.lock"]),async spawn($){let Z=await M6(d0("vue-language-server"),"@vue/language-server");if(!Z)return;return{process:D6(Z,["--stdio"],$),initialization:{}}}},qj={id:"eslint",root:t0(["package-lock.json","bun.lockb","bun.lock","pnpm-lock.yaml","yarn.lock"]),extensions:[".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts",".vue"],async spawn($,Z){if(!wZ.resolve("eslint",Z.directory))return;Q0.info("spawning eslint server");let Y=D8.join(F0.Path.bin,"vscode-eslint","server","out","eslintServer.js");if(!await o0.exists(Y)){if(b0.QITQODE_DISABLE_LSP_DOWNLOAD)return;Q0.info("downloading and building VS Code ESLint server");let Q=await LZ("https://github.com/microsoft/vscode-eslint/archive/refs/heads/main.zip","vscode-eslint.zip","vscode-eslint");if(!Q)return;if(!await TZ(Q,"vscode-eslint"))return;await w6.rm(Q,{force:!0});let W=D8.join(F0.Path.bin,"vscode-eslint-main"),K=D8.join(F0.Path.bin,"vscode-eslint");if(await w6.stat(K).catch(()=>{return}))Q0.info("removing old eslint installation",{path:K}),await w6.rm(K,{force:!0,recursive:!0});await w6.rename(W,K);let U=process.platform==="win32"?"npm.cmd":"npm";await f1.run([U,"install"],{cwd:K}),await f1.run([U,"run","compile"],{cwd:K}),Q0.info("installed VS Code ESLint server",{serverPath:Y})}return{process:Z1("node",[Y,"--stdio"],{cwd:$,env:{...o8()}})}}},jj={id:"oxlint",root:t0([".oxlintrc.json","package-lock.json","bun.lockb","bun.lock","pnpm-lock.yaml","yarn.lock","package.json"]),extensions:[".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts",".vue",".astro",".svelte"],async spawn($,Z){let J=process.platform==="win32"?".cmd":"",Y=D8.join("node_modules",".bin","oxc_language_server"+J),X=D8.join("node_modules",".bin","oxlint"+J),Q=async(K)=>{let V=D8.join($,K);if(await o0.exists(V))return V;let U=o0.up({targets:[K],start:$,stop:Z.worktree}),H=await U.next();if(await U.return(),H.value)return H.value;return},G=await Q(X);if(!G){let K=d0("oxlint");if(K)G=K}if(G){let K=Z1(G,["--help"]);if(await K.exited,K.stdout){if((await ic(K.stdout)).includes("--lsp"))return{process:Z1(G,["--lsp"],{cwd:$})}}}let W=await Q(Y);if(!W){let K=d0("oxc_language_server");if(K)W=K}if(W)return{process:Z1(W,[],{cwd:$})};Q0.info("oxlint not found, please install oxlint");return}},Nj={id:"biome",root:t0(["biome.json","biome.jsonc","package-lock.json","bun.lockb","bun.lock","pnpm-lock.yaml","yarn.lock"]),extensions:[".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts",".json",".jsonc",".vue",".astro",".svelte",".css",".graphql",".gql",".html"],async spawn($){let Z=D8.join($,"node_modules",".bin","biome"),J;if(await o0.exists(Z))J=Z;if(!J){let Q=d0("biome");if(Q)J=Q}let Y=["lsp-proxy","--stdio"];if(!J){if(!wZ.resolve("biome",$))return;if(J=await j6.which("biome"),!J)return;Y=["lsp-proxy","--stdio"]}return{process:Z1(J,Y,{cwd:$,env:{...o8()}})}}},Mj={id:"svelte",extensions:[".svelte"],root:t0(["package-lock.json","bun.lockb","bun.lock","pnpm-lock.yaml","yarn.lock"]),async spawn($){let Z=await M6(d0("svelteserver"),"svelte-language-server");if(!Z)return;return{process:D6(Z,["--stdio"],$),initialization:{}}}},Dj={id:"astro",extensions:[".astro"],root:t0(["package-lock.json","bun.lockb","bun.lock","pnpm-lock.yaml","yarn.lock"]),async spawn($,Z){let J=wZ.resolve("typescript/lib/tsserver.js",Z.directory);if(!J){Q0.info("typescript not found, required for Astro language server");return}let Y=D8.dirname(J),X=await M6(d0("astro-ls"),"@astrojs/language-server");if(!X)return;return{process:D6(X,["--stdio"],$),initialization:{typescript:{tsdk:Y}}}}},wj={id:"yaml-ls",extensions:[".yaml",".yml"],root:t0(["package-lock.json","bun.lockb","bun.lock","pnpm-lock.yaml","yarn.lock"]),async spawn($){let Z=await M6(d0("yaml-language-server"),"yaml-language-server");if(!Z)return;return{process:D6(Z,["--stdio"],$)}}},Lj={id:"lua-ls",root:t0([".luarc.json",".luarc.jsonc",".luacheckrc",".stylua.toml","stylua.toml","selene.toml","selene.yml"]),extensions:[".lua"],async spawn($){let Z=d0("lua-language-server");if(!Z){if(b0.QITQODE_DISABLE_LSP_DOWNLOAD)return;Q0.info("downloading lua-language-server from GitHub releases");let J=await fetch("https://api.github.com/repos/LuaLS/lua-language-server/releases/latest");if(!J.ok){Q0.error("Failed to fetch lua-language-server release info");return}let Y=await J.json(),X=process.platform,Q=process.arch,G="",W=Q;if(Q==="arm64")W="arm64";else if(Q==="x64")W="x64";else if(Q==="ia32")W="ia32";let K=X;if(X==="darwin")K="darwin";else if(X==="linux")K="linux";else if(X==="win32")K="win32";let V=X==="win32"?"zip":"tar.gz";G=`lua-language-server-${Y.tag_name}-${K}-${W}.${V}`;let U=["darwin-arm64.tar.gz","darwin-x64.tar.gz","linux-x64.tar.gz","linux-arm64.tar.gz","win32-x64.zip","win32-ia32.zip"],H=`${K}-${W}.${V}`;if(!U.includes(H)){Q0.error(`Platform ${X} and architecture ${Q} is not supported by lua-language-server`);return}let B=Y.assets.find((w)=>w.name===G);if(!B){Q0.error(`Could not find asset ${G} in latest lua-language-server release`);return}let z=B.browser_download_url,F=await fetch(z);if(!F.ok){Q0.error("Failed to download lua-language-server");return}let A=D8.join(F0.Path.bin,G);if(F.body)await o0.writeStream(A,F.body);let j=D8.join(F0.Path.bin,`lua-language-server-${W}-${K}`);if(await w6.stat(j).catch(()=>{return}))await w6.rm(j,{force:!0,recursive:!0});if(await w6.mkdir(j,{recursive:!0}),V==="zip"){if(!await M8.extractZip(A,j).then(()=>!0).catch((q)=>{return Q0.error("Failed to extract lua-language-server archive",{error:q}),!1}))return}else if(!await N6(["tar","-xzf",A,"-C",j]).then((q)=>q.code===0).catch((q)=>{return Q0.error("Failed to extract lua-language-server archive",{error:q}),!1}))return;if(await w6.rm(A,{force:!0}),Z=D8.join(j,"bin","lua-language-server"+(X==="win32"?".exe":"")),!await o0.exists(Z)){Q0.error("Failed to extract lua-language-server binary");return}if(X!=="win32"){if(!await w6.chmod(Z,493).then(()=>!0).catch((q)=>{return Q0.error("Failed to set executable permission for lua-language-server binary",{error:q}),!1}))return}Q0.info("installed lua-language-server",{bin:Z})}return{process:Z1(Z,{cwd:$})}}},Tj={id:"prisma",extensions:[".prisma"],root:t0(["schema.prisma","prisma/schema.prisma","prisma"],["package.json"]),async spawn($){let Z=d0("prisma");if(!Z){Q0.info("prisma not found, please install prisma");return}return{process:Z1(Z,["language-server"],{cwd:$})}}},Rj={id:"bash",extensions:[".sh",".bash",".zsh",".ksh"],root:async($,Z)=>Z.directory,async spawn($){let Z=await M6(d0("bash-language-server"),"bash-language-server");if(!Z)return;return{process:D6(Z,["start"],$)}}};import $8 from"fs/promises";import o1 from"path";import nc from"os";var Pj={id:"gopls",root:async($,Z)=>{let J=await t0(["go.work"])($,Z);if(J)return J;return t0(["go.mod","go.sum"])($,Z)},extensions:[".go"],async spawn($){let Z=d0("gopls");if(!Z){if(!d0("go"))return;if(b0.QITQODE_DISABLE_LSP_DOWNLOAD)return;if(Q0.info("installing gopls"),await f1.spawn(["go","install","golang.org/x/tools/gopls@latest"],{env:{GOBIN:F0.Path.bin},stdout:"pipe",stderr:"pipe",stdin:"pipe"}).exited!==0){Q0.error("Failed to install gopls");return}Z=o1.join(F0.Path.bin,"gopls"+(process.platform==="win32"?".exe":"")),Q0.info("installed gopls",{bin:Z})}return{process:Z1(Z,{cwd:$})}}},Ij={id:"csharp",root:t0([".slnx",".sln",".csproj","global.json"]),extensions:[".cs"],async spawn($){let Z=d0("csharp-ls");if(!Z){if(!d0("dotnet")){Q0.error(".NET SDK is required to install csharp-ls");return}if(b0.QITQODE_DISABLE_LSP_DOWNLOAD)return;if(Q0.info("installing csharp-ls via dotnet tool"),await f1.spawn(["dotnet","tool","install","csharp-ls","--tool-path",F0.Path.bin],{stdout:"pipe",stderr:"pipe",stdin:"pipe"}).exited!==0){Q0.error("Failed to install csharp-ls");return}Z=o1.join(F0.Path.bin,"csharp-ls"+(process.platform==="win32"?".exe":"")),Q0.info("installed csharp-ls",{bin:Z})}return{process:Z1(Z,{cwd:$})}}},Cj={id:"fsharp",root:t0([".slnx",".sln",".fsproj","global.json"]),extensions:[".fs",".fsi",".fsx",".fsscript"],async spawn($){let Z=d0("fsautocomplete");if(!Z){if(!d0("dotnet")){Q0.error(".NET SDK is required to install fsautocomplete");return}if(b0.QITQODE_DISABLE_LSP_DOWNLOAD)return;if(Q0.info("installing fsautocomplete via dotnet tool"),await f1.spawn(["dotnet","tool","install","fsautocomplete","--tool-path",F0.Path.bin],{stdout:"pipe",stderr:"pipe",stdin:"pipe"}).exited!==0){Q0.error("Failed to install fsautocomplete");return}Z=o1.join(F0.Path.bin,"fsautocomplete"+(process.platform==="win32"?".exe":"")),Q0.info("installed fsautocomplete",{bin:Z})}return{process:Z1(Z,{cwd:$})}}},Ej={id:"sourcekit-lsp",extensions:[".swift",".objc","objcpp"],root:t0(["Package.swift","*.xcodeproj","*.xcworkspace"]),async spawn($){let Z=d0("sourcekit-lsp");if(Z)return{process:Z1(Z,{cwd:$})};if(!d0("xcrun"))return;let J=await zj(["xcrun","--find","sourcekit-lsp"]);if(J.code!==0)return;let Y=J.text.trim();return{process:Z1(Y,{cwd:$})}}},bj={id:"rust",root:async($,Z)=>{let J=await t0(["Cargo.toml","Cargo.lock"])($,Z);if(J===void 0)return;let Y=J;while(Y!==o1.dirname(Y)){let X=o1.join(Y,"Cargo.toml");try{if((await o0.readText(X)).includes("[workspace]"))return Y}catch{}let Q=o1.dirname(Y);if(Q===Y||!o0.contains(Z.worktree,Q))break;Y=Q}return J},extensions:[".rs"],async spawn($){let Z=d0("rust-analyzer");if(!Z){Q0.info("rust-analyzer not found in path, please install it");return}return{process:Z1(Z,{cwd:$})}}},_j={id:"clangd",root:t0(["compile_commands.json","compile_flags.txt",".clangd"]),extensions:[".c",".cpp",".cc",".cxx",".c++",".h",".hpp",".hh",".hxx",".h++"],async spawn($){let Z=["--background-index","--clang-tidy"],J=d0("clangd");if(J)return{process:Z1(J,Z,{cwd:$})};let Y=process.platform==="win32"?".exe":"",X=o1.join(F0.Path.bin,"clangd"+Y);if(await o0.exists(X))return{process:Z1(X,Z,{cwd:$})};let Q=await $8.readdir(F0.Path.bin,{withFileTypes:!0}).catch(()=>[]);for(let R of Q){if(!R.isDirectory())continue;if(!R.name.startsWith("clangd_"))continue;let T=o1.join(F0.Path.bin,R.name,"bin","clangd"+Y);if(await o0.exists(T))return{process:Z1(T,Z,{cwd:$})}}if(b0.QITQODE_DISABLE_LSP_DOWNLOAD)return;Q0.info("downloading clangd from GitHub releases");let G=await fetch("https://api.github.com/repos/clangd/clangd/releases/latest");if(!G.ok){Q0.error("Failed to fetch clangd release info");return}let W=await G.json(),K=W.tag_name;if(!K){Q0.error("clangd release did not include a tag name");return}let V=process.platform,H={darwin:"mac",linux:"linux",win32:"windows"}[V];if(!H){Q0.error(`Platform ${V} is not supported by clangd auto-download`);return}let B=W.assets??[],z=(R)=>{if(!R.name)return!1;if(!R.browser_download_url)return!1;if(!R.name.includes(H))return!1;return R.name.includes(K)},F=B.find((R)=>z(R)&&R.name?.endsWith(".zip"))??B.find((R)=>z(R)&&R.name?.endsWith(".tar.xz"))??B.find((R)=>z(R));if(!F?.name||!F.browser_download_url){Q0.error("clangd could not match release asset",{tag:K,platform:V});return}let A=F.name,j=await fetch(F.browser_download_url);if(!j.ok){Q0.error("Failed to download clangd");return}let N=o1.join(F0.Path.bin,A),w=await j.arrayBuffer();if(w.byteLength===0){Q0.error("Failed to write clangd archive");return}await o0.write(N,Buffer.from(w));let q=A.endsWith(".zip"),M=A.endsWith(".tar.xz");if(!q&&!M){Q0.error("clangd encountered unsupported asset",{asset:A});return}if(q){if(!await M8.extractZip(N,F0.Path.bin).then(()=>!0).catch((T)=>{return Q0.error("Failed to extract clangd archive",{error:T}),!1}))return}if(M)await N6(["tar","-xf",N],{cwd:F0.Path.bin});await $8.rm(N,{force:!0});let C=o1.join(F0.Path.bin,"clangd_"+K,"bin","clangd"+Y);if(!await o0.exists(C)){Q0.error("Failed to extract clangd binary");return}if(V!=="win32")await $8.chmod(C,493).catch(()=>{});return await $8.unlink(o1.join(F0.Path.bin,"clangd")).catch(()=>{}),await $8.symlink(C,o1.join(F0.Path.bin,"clangd")).catch(()=>{}),Q0.info("installed clangd",{bin:C}),{process:Z1(C,Z,{cwd:$})}}},Sj={id:"jdtls",root:async($,Z)=>{let J=["settings.gradle","settings.gradle.kts"],Y=["gradlew","gradlew.bat"],X=Y.concat(J),[Q,G,W]=await Promise.all([t0(["pom.xml","build.gradle","build.gradle.kts",".project",".classpath"],X)($,Z),t0(Y,J)($,Z),t0(J)($,Z)]);if(Q)return Q;if(G)return G;if(W)return W},extensions:[".java"],async spawn($){let Z=d0("java");if(!Z){Q0.error("Java 21 or newer is required to run the JDTLS. Please install it first.");return}let J=await N6(["java","-version"]).then((U)=>{let H=/"(\d+)\.\d+\.\d+"/.exec(U.stderr.toString());return!H?void 0:parseInt(H[1])});if(J==null||J<21){Q0.error("JDTLS requires at least Java 21.");return}let Y=o1.join(F0.Path.bin,"jdtls"),X=o1.join(Y,"plugins");if(!await gV(X)){if(b0.QITQODE_DISABLE_LSP_DOWNLOAD)return;Q0.info("Downloading JDTLS LSP server."),await $8.mkdir(Y,{recursive:!0});let U="https://www.eclipse.org/downloads/download.php?file=/jdtls/snapshots/jdt-language-server-latest.tar.gz",H="release.tar.gz";Q0.info("Downloading JDTLS archive",{url:U,dest:Y});let B=await fetch(U);if(!B.ok||!B.body){Q0.error("Failed to download JDTLS",{status:B.status,statusText:B.statusText});return}await o0.writeStream(o1.join(Y,H),B.body),Q0.info("Extracting JDTLS archive");let z=await N6(["tar","-xzf",H],{cwd:Y});if(z.code!==0){Q0.error("Failed to extract JDTLS",{exitCode:z.code,stderr:z.stderr.toString()});return}await $8.rm(o1.join(Y,H),{force:!0}),Q0.info("JDTLS download and extraction completed")}let G=(await $8.readdir(X).catch(()=>[])).find((U)=>/^org\.eclipse\.equinox\.launcher_.*\.jar$/.test(U))?.trim()??"",W=o1.join(X,G);if(!await gV(W)){Q0.error(`Failed to locate the JDTLS launcher module in the installed directory: ${Y}.`);return}let K=o1.join(Y,(()=>{switch(process.platform){case"darwin":return"config_mac";case"linux":return"config_linux";case"win32":return"config_win";default:return"config_linux"}})()),V=await $8.mkdtemp(o1.join(nc.tmpdir(),"qitqode-jdtls-data"));return{process:Z1(Z,["-jar",W,"-configuration",K,"-data",V,"-Declipse.application=org.eclipse.jdt.ls.core.id1","-Dosgi.bundles.defaultStartLevel=4","-Declipse.product=org.eclipse.jdt.ls.core.product","-Dlog.level=ALL","--add-modules=ALL-SYSTEM","--add-opens java.base/java.util=ALL-UNNAMED","--add-opens java.base/java.lang=ALL-UNNAMED"],{cwd:$})}}},fj={id:"kotlin-ls",extensions:[".kt",".kts"],root:async($,Z)=>{let J=await t0(["settings.gradle.kts","settings.gradle"])($,Z);if(J)return J;let Y=await t0(["gradlew","gradlew.bat"])($,Z);if(Y)return Y;let X=await t0(["build.gradle.kts","build.gradle"])($,Z);if(X)return X;return t0(["pom.xml"])($,Z)},async spawn($){let Z=o1.join(F0.Path.bin,"kotlin-ls"),J=process.platform==="win32"?o1.join(Z,"kotlin-lsp.cmd"):o1.join(Z,"kotlin-lsp.sh");if(!await o0.exists(J)){if(b0.QITQODE_DISABLE_LSP_DOWNLOAD)return;Q0.info("Downloading Kotlin Language Server from GitHub.");let X=await fetch("https://api.github.com/repos/Kotlin/kotlin-lsp/releases/latest");if(!X.ok){Q0.error("Failed to fetch kotlin-lsp release info");return}let G=(await X.json()).name?.replace(/^v/,"");if(!G){Q0.error("Could not determine Kotlin LSP version from release");return}let{platform:W,arch:K}=process,V=K;if(K==="arm64")V="aarch64";else if(K==="x64")V="x64";let U=W;if(W==="darwin")U="mac";else if(W==="linux")U="linux";else if(W==="win32")U="win";let H=["mac-x64","mac-aarch64","linux-x64","linux-aarch64","win-x64","win-aarch64"],B=`${U}-${V}`;if(!H.includes(B)){Q0.error(`Platform ${W}/${K} is not supported by Kotlin LSP`);return}let z=`kotlin-lsp-${G}-${U}-${V}.zip`,F=`https://download-cdn.jetbrains.com/kotlin-lsp/${G}/${z}`;await $8.mkdir(Z,{recursive:!0});let A=o1.join(Z,"kotlin-ls.zip"),j=await fetch(F);if(!j.ok||!j.body){Q0.error("Failed to download Kotlin Language Server",{status:j.status,statusText:j.statusText});return}if(await o0.writeStream(A,j.body),!await M8.extractZip(A,Z).then(()=>!0).catch((w)=>{return Q0.error("Failed to extract Kotlin LS archive",{error:w}),!1}))return;if(await $8.rm(A,{force:!0}),process.platform!=="win32")await $8.chmod(J,493).catch(()=>{});Q0.info("Installed Kotlin Language Server",{path:J})}if(!await o0.exists(J)){Q0.error(`Failed to locate the Kotlin LS launcher script in the installed directory: ${Z}.`);return}return{process:Z1(J,["--stdio"],{cwd:$})}}},kj={id:"dart",extensions:[".dart"],root:t0(["pubspec.yaml","analysis_options.yaml"]),async spawn($){let Z=d0("dart");if(!Z){Q0.info("dart not found, please install dart first");return}return{process:Z1(Z,["language-server","--lsp"],{cwd:$})}}},vj={id:"ocaml-lsp",extensions:[".ml",".mli"],root:t0(["dune-project","dune-workspace",".merlin","opam"]),async spawn($){let Z=d0("ocamllsp");if(!Z){Q0.info("ocamllsp not found, please install ocaml-lsp-server");return}return{process:Z1(Z,{cwd:$})}}},yj={id:"gleam",extensions:[".gleam"],root:t0(["gleam.toml"]),async spawn($){let Z=d0("gleam");if(!Z){Q0.info("gleam not found, please install gleam first");return}return{process:Z1(Z,["lsp"],{cwd:$})}}},xj={id:"zls",extensions:[".zig",".zon"],root:t0(["build.zig"]),async spawn($){let Z=d0("zls");if(!Z){if(!d0("zig")){Q0.error("Zig is required to use zls. Please install Zig first.");return}if(b0.QITQODE_DISABLE_LSP_DOWNLOAD)return;Q0.info("downloading zls from GitHub releases");let Y=await fetch("https://api.github.com/repos/zigtools/zls/releases/latest");if(!Y.ok){Q0.error("Failed to fetch zls release info");return}let X=await Y.json(),Q=process.platform,G=process.arch,W="",K=G;if(G==="arm64")K="aarch64";else if(G==="x64")K="x86_64";else if(G==="ia32")K="x86";let V=Q;if(Q==="darwin")V="macos";else if(Q==="win32")V="windows";let U=Q==="win32"?"zip":"tar.xz";if(W=`zls-${K}-${V}.${U}`,!["zls-x86_64-linux.tar.xz","zls-x86_64-macos.tar.xz","zls-x86_64-windows.zip","zls-aarch64-linux.tar.xz","zls-aarch64-macos.tar.xz","zls-aarch64-windows.zip","zls-x86-linux.tar.xz","zls-x86-windows.zip"].includes(W)){Q0.error(`Platform ${Q} and architecture ${G} is not supported by zls`);return}let B=X.assets?.find((F)=>F.name===W);if(!B?.browser_download_url){Q0.error(`Could not find asset ${W} in latest zls release`);return}let z=await LZ(B.browser_download_url,W,"zls");if(!z)return;if(U==="zip"){if(!await TZ(z,"zls"))return}else await N6(["tar","-xf",z],{cwd:F0.Path.bin});if(await $8.rm(z,{force:!0}),Z=o1.join(F0.Path.bin,"zls"+(Q==="win32"?".exe":"")),!await o0.exists(Z)){Q0.error("Failed to extract zls binary");return}if(Q!=="win32")await $8.chmod(Z,493).catch(()=>{});Q0.info("installed zls",{bin:Z})}return{process:Z1(Z,{cwd:$})}}};import O5 from"fs/promises";import f8 from"path";function oc($){return[process.env.VIRTUAL_ENV,f8.join($,".venv"),f8.join($,"venv")].filter((Z)=>Z!==void 0)}async function uV($,Z){let J=process.platform==="win32";for(let Y of oc($)){let X=J?f8.join(Y,"Scripts",`${Z}.exe`):f8.join(Y,"bin",Z);if(await o0.exists(X))return X}return}var hj={id:"ruby-lsp",root:t0(["Gemfile"]),extensions:[".rb",".rake",".gemspec",".ru"],async spawn($){let Z=d0("rubocop");if(!Z){let J=d0("ruby"),Y=d0("gem");if(!J||!Y){Q0.info("Ruby not found, please install Ruby first");return}if(b0.QITQODE_DISABLE_LSP_DOWNLOAD)return;if(Q0.info("installing rubocop"),await f1.spawn(["gem","install","rubocop","--bindir",F0.Path.bin],{stdout:"pipe",stderr:"pipe",stdin:"pipe"}).exited!==0){Q0.error("Failed to install rubocop");return}Z=f8.join(F0.Path.bin,"rubocop"+(process.platform==="win32"?".exe":"")),Q0.info("installed rubocop",{bin:Z})}return{process:Z1(Z,["--lsp"],{cwd:$})}}},gj={id:"ty",extensions:[".py",".pyi"],root:t0(["pyproject.toml","ty.toml","setup.py","setup.cfg","requirements.txt","Pipfile","pyrightconfig.json"]),async spawn($){if(!b0.QITQODE_EXPERIMENTAL_LSP_TY)return;let Z=d0("ty"),J={},Y=await uV($,"python");if(Y)J.pythonPath=Y;if(!Z)Z=await uV($,"ty")??null;if(!Z){Q0.error("ty not found, please install ty first");return}return{process:Z1(Z,["server"],{cwd:$}),initialization:J}}},uj={id:"pyright",extensions:[".py",".pyi"],root:t0(["pyproject.toml","setup.py","setup.cfg","requirements.txt","Pipfile","pyrightconfig.json"]),async spawn($){let Z=await M6(d0("pyright-langserver"),"pyright");if(!Z)return;let J=["--stdio"],Y={},X=await uV($,"python");if(X)Y.pythonPath=X;return{process:D6(Z,J,$),initialization:Y}}},mj={id:"elixir-ls",extensions:[".ex",".exs"],root:t0(["mix.exs","mix.lock"]),async spawn($){let Z=d0("elixir-ls");if(!Z){let J=f8.join(F0.Path.bin,"elixir-ls");if(Z=f8.join(F0.Path.bin,"elixir-ls-master","release",process.platform==="win32"?"language_server.bat":"language_server.sh"),!await o0.exists(Z)){if(!d0("elixir")){Q0.error("elixir is required to run elixir-ls");return}if(b0.QITQODE_DISABLE_LSP_DOWNLOAD)return;Q0.info("downloading elixir-ls from GitHub releases");let X=await LZ("https://github.com/elixir-lsp/elixir-ls/archive/refs/heads/master.zip","elixir-ls.zip","elixir-ls");if(!X)return;if(!await TZ(X,"elixir-ls"))return;await O5.rm(X,{force:!0,recursive:!0});let G=f8.join(F0.Path.bin,"elixir-ls-master"),W={MIX_ENV:"prod",...o8()};await f1.run(["mix","deps.get"],{cwd:G,env:W}),await f1.run(["mix","compile"],{cwd:G,env:W}),await f1.run(["mix","elixir_ls.release2","-o","release"],{cwd:G,env:W}),Q0.info("installed elixir-ls",{path:J})}}return{process:Z1(Z,{cwd:$})}}},lj={id:"php intelephense",extensions:[".php"],root:t0(["composer.json","composer.lock",".php-version"]),async spawn($){let Z=await M6(d0("intelephense"),"intelephense");if(!Z)return;return{process:D6(Z,["--stdio"],$),initialization:{telemetry:{enabled:!1}}}}},dj={id:"julials",extensions:[".jl"],root:t0(["Project.toml","Manifest.toml","*.jl"]),async spawn($){let Z=d0("julia");if(!Z){Q0.info("julia not found, please install julia first (https://julialang.org/downloads/)");return}return{process:Z1(Z,["--startup-file=no","--history-file=no","-e","using LanguageServer; runserver()"],{cwd:$})}}},pj={id:"haskell-language-server",extensions:[".hs",".lhs"],root:t0(["stack.yaml","cabal.project","hie.yaml","*.cabal"]),async spawn($){let Z=d0("haskell-language-server-wrapper");if(!Z){Q0.info("haskell-language-server-wrapper not found, please install haskell-language-server");return}return{process:Z1(Z,["--lsp"],{cwd:$})}}},cj={id:"nixd",extensions:[".nix"],root:async($,Z)=>{let J=await t0(["flake.nix"])($,Z);if(J&&J!==Z.directory)return J;if(Z.worktree&&Z.worktree!==Z.directory)return Z.worktree;return Z.directory},async spawn($){let Z=d0("nixd");if(!Z){Q0.info("nixd not found, please install nixd first");return}return{process:Z1(Z,[],{cwd:$,env:{...o8()}})}}},ij={id:"tinymist",extensions:[".typ",".typc"],root:t0(["typst.toml"]),async spawn($){let Z=d0("tinymist");if(!Z){if(b0.QITQODE_DISABLE_LSP_DOWNLOAD)return;Q0.info("downloading tinymist from GitHub releases");let J=await fetch("https://api.github.com/repos/Myriad-Dreamin/tinymist/releases/latest");if(!J.ok){Q0.error("Failed to fetch tinymist release info");return}let Y=await J.json(),X=process.platform,G=process.arch==="arm64"?"aarch64":"x86_64",W,K;if(X==="darwin")W="apple-darwin",K="tar.gz";else if(X==="win32")W="pc-windows-msvc",K="zip";else W="unknown-linux-gnu",K="tar.gz";let V=`tinymist-${G}-${W}.${K}`,H=(Y.assets??[]).find((z)=>z.name===V);if(!H?.browser_download_url){Q0.error(`Could not find asset ${V} in tinymist release`);return}let B=await LZ(H.browser_download_url,V,"tinymist");if(!B)return;if(K==="zip"){if(!await TZ(B,"tinymist"))return}else await N6(["tar","-xzf",B,"--strip-components=1"],{cwd:F0.Path.bin});if(await O5.rm(B,{force:!0}),Z=f8.join(F0.Path.bin,"tinymist"+(X==="win32"?".exe":"")),!await o0.exists(Z)){Q0.error("Failed to extract tinymist binary");return}if(X!=="win32")await O5.chmod(Z,493).catch(()=>{});Q0.info("installed tinymist",{bin:Z})}return{process:Z1(Z,{cwd:$})}}},nj={id:"terraform",extensions:[".tf",".tfvars"],root:t0([".terraform.lock.hcl","terraform.tfstate","*.tf"]),async spawn($){let Z=d0("terraform-ls");if(!Z){if(b0.QITQODE_DISABLE_LSP_DOWNLOAD)return;Q0.info("downloading terraform-ls from HashiCorp releases");let J=await fetch("https://api.releases.hashicorp.com/v1/releases/terraform-ls/latest");if(!J.ok){Q0.error("Failed to fetch terraform-ls release info");return}let Y=await J.json(),X=process.platform,G=process.arch==="arm64"?"arm64":"amd64",W=X==="win32"?"windows":X,V=(Y.builds??[]).find((z)=>z.arch===G&&z.os===W);if(!V?.url){Q0.error(`Could not find build for ${W}/${G} terraform-ls release version ${Y.version}`);return}let U=await fetch(V.url);if(!U.ok){Q0.error("Failed to download terraform-ls");return}let H=f8.join(F0.Path.bin,"terraform-ls.zip");if(U.body)await o0.writeStream(H,U.body);if(!await M8.extractZip(H,F0.Path.bin).then(()=>!0).catch((z)=>{return Q0.error("Failed to extract terraform-ls archive",{error:z}),!1}))return;if(await O5.rm(H,{force:!0}),Z=f8.join(F0.Path.bin,"terraform-ls"+(X==="win32"?".exe":"")),!await o0.exists(Z)){Q0.error("Failed to extract terraform-ls binary");return}if(X!=="win32")await O5.chmod(Z,493).catch(()=>{});Q0.info("installed terraform-ls",{bin:Z})}return{process:Z1(Z,["serve"],{cwd:$}),initialization:{experimentalFeatures:{prefillRequiredFields:!0,validateOnSave:!0}}}}},oj={id:"texlab",extensions:[".tex",".bib"],root:t0([".latexmkrc","latexmkrc",".texlabroot","texlabroot"]),async spawn($){let Z=d0("texlab");if(!Z){if(b0.QITQODE_DISABLE_LSP_DOWNLOAD)return;Q0.info("downloading texlab from GitHub releases");let J=await fetch("https://api.github.com/repos/latex-lsp/texlab/releases/latest");if(!J.ok){Q0.error("Failed to fetch texlab release info");return}let Y=await J.json();if(!Y.tag_name?.replace("v","")){Q0.error("texlab release did not include a version tag");return}let Q=process.platform,W=process.arch==="arm64"?"aarch64":"x86_64",K=Q==="darwin"?"macos":Q==="win32"?"windows":"linux",V=Q==="win32"?"zip":"tar.gz",U=`texlab-${W}-${K}.${V}`,B=(Y.assets??[]).find((F)=>F.name===U);if(!B?.browser_download_url){Q0.error(`Could not find asset ${U} in texlab release`);return}let z=await LZ(B.browser_download_url,U,"texlab");if(!z)return;if(V==="zip"){if(!await TZ(z,"texlab"))return}if(V==="tar.gz")await N6(["tar","-xzf",z],{cwd:F0.Path.bin});if(await O5.rm(z,{force:!0}),Z=f8.join(F0.Path.bin,"texlab"+(Q==="win32"?".exe":"")),!await o0.exists(Z)){Q0.error("Failed to extract texlab binary");return}if(Q!=="win32")await O5.chmod(Z,493).catch(()=>{});Q0.info("installed texlab",{bin:Z})}return{process:Z1(Z,{cwd:$})}}},sj={id:"dockerfile",extensions:[".dockerfile","Dockerfile"],root:async($,Z)=>Z.directory,async spawn($){let Z=await M6(d0("docker-langserver"),"dockerfile-language-server-nodejs");if(!Z)return;return{process:D6(Z,["--stdio"],$)}}},rj={id:"clojure-lsp",extensions:[".clj",".cljs",".cljc",".edn"],root:t0(["deps.edn","project.clj","shadow-cljs.edn","bb.edn","build.boot"]),async spawn($){let Z=d0("clojure-lsp");if(!Z&&process.platform==="win32")Z=d0("clojure-lsp.exe");if(!Z){Q0.info("clojure-lsp not found, please install clojure-lsp first");return}return{process:Z1(Z,["listen"],{cwd:$})}}};var X8={};F1(X8,{layer:()=>Mw,defaultLayer:()=>Za,Service:()=>Z4,Server:()=>tr,Layout:()=>er,Info:()=>E5,ConfigDirectoryTypoError:()=>$a});import rr from"path";var k8={};F1(k8,{sweepStaleAuthTmp:()=>tj,layer:()=>$N,defaultLayer:()=>ac,WellKnown:()=>cV,Service:()=>_9,Oauth:()=>dV,OAUTH_DUMMY_KEY:()=>lV,Info:()=>ej,AuthError:()=>S9,Auth:()=>k8,Api:()=>pV});import sc from"path";var lV="qitqode-oauth-dummy-key",b9=sc.join(F0.Path.data,"auth.json"),rc=60000;async function tj(){let $=b9+".tmp";try{let{stat:Z,unlink:J}=await import("fs/promises"),Y=await Z($);if(Date.now()-Y.mtimeMs>=rc)await J($).catch(()=>{return})}catch{}}var E9=($)=>(Z)=>new S9({message:$,cause:Z});class dV extends O.Class("OAuth")({type:O.Literal("oauth"),refresh:O.String,access:O.String,expires:O.Number,accountId:O.optional(O.String),enterpriseUrl:O.optional(O.String)}){}class pV extends O.Class("ApiAuth")({type:O.Literal("api"),key:O.String,metadata:O.optional(O.Record(O.String,O.String))}){}class cV extends O.Class("WellKnownAuth")({type:O.Literal("wellknown"),key:O.String,token:O.String}){}var aj=O.Union([dV,pV,cV]).annotate({discriminator:"type",identifier:"Auth"}),ej=Object.assign(aj,{zod:w0(aj)});class S9 extends O.TaggedErrorClass()("AuthError",{message:O.String,cause:O.optional(O.Defect)}){}class _9 extends S1.Service()("@qitqode/Auth"){}var $N=T0.effect(_9,L.gen(function*(){let $=yield*C$.Service,Z=O.decodeUnknownOption(ej);yield*L.promise(()=>tj());let J=L.fn("Auth.readFile")(function*(){let V=yield*$.readJson(b9).pipe(L.orElseSucceed(()=>({})));if(!k7.isEnvelope(V))return V;let U=yield*L.promise(()=>k7.encryptionKey());if(!U)return yield*L.fail(new S9({message:"auth.json is encrypted but the OS keyring is unavailable. Restore keyring access or delete auth.json and log in again."}));return yield*L.try({try:()=>JSON.parse(k7.decrypt(V,U)),catch:E9("Failed to decrypt auth data (keyring key mismatch?)")})}),Y=L.fn("Auth.writeFile")(function*(V){let U=yield*L.promise(()=>k7.encryptionKey()),H=U?k7.encrypt(JSON.stringify(V),U):V,B=b9+".tmp";yield*$.writeJson(B,H).pipe(L.mapError(E9("Failed to write auth data"))),yield*$.chmod(B,384).pipe(L.mapError(E9("Failed to set auth file permissions"))),yield*$.rename(B,b9).pipe(L.mapError(E9("Failed to atomically replace auth data")))}),X=L.fn("Auth.all")(function*(){let V=yield*J(),U=y7.filterMap(V,(H)=>v7.fromOption(Z(H),()=>{return}));if(process.env.QITQODE_AUTH_CONTENT)try{let H=JSON.parse(process.env.QITQODE_AUTH_CONTENT);return{...y7.filterMap(H,(z)=>v7.fromOption(Z(z),()=>{return})),...U}}catch(H){console.error("[Auth] Failed to parse QITQODE_AUTH_CONTENT env var:",H)}return U}),Q=L.fn("Auth.get")(function*(V){return(yield*X())[V]}),G="auth-file",W=L.fn("Auth.set")(function*(V,U){yield*L.scoped(L.gen(function*(){yield*mV.effect(G);let H=V.replace(/\/+$/,""),B=yield*X();if(H!==V)delete B[V];delete B[H+"/"],yield*Y({...B,[H]:U})}))}),K=L.fn("Auth.remove")(function*(V){yield*L.scoped(L.gen(function*(){yield*mV.effect(G);let U=V.replace(/\/+$/,""),H=yield*X();delete H[V],delete H[U],yield*Y(H)}))});return _9.of({get:Q,all:X,set:W,remove:K})})),ac=$N.pipe(T0.provide(C$.defaultLayer));var l6={};F1(l6,{layer:()=>ZN,defaultLayer:()=>tc,Service:()=>f9,Env:()=>l6});class f9 extends S1.Service()("@qitqode/Env"){}var ZN=T0.effect(f9,L.gen(function*(){let $=yield*B0.make(L.fn("Env.state")(()=>L.succeed({...process.env}))),Z=L.fn("Env.get")((Q)=>B0.use($,(G)=>G[Q])),J=L.fn("Env.all")(()=>B0.get($)),Y=L.fn("Env.set")(function*(Q,G){let W=yield*B0.get($);W[Q]=G}),X=L.fn("Env.remove")(function*(Q){let G=yield*B0.get($);delete G[Q]});return f9.of({get:Z,all:J,set:Y,remove:X})})),tc=ZN;var JN={Connected:L1.define("server.connected",P.object({})),Heartbeat:L1.define("server.heartbeat",P.object({})),Disposed:L1.define("global.disposed",P.object({}))};var o7={};F1(o7,{layer:()=>FN,defaultLayer:()=>Xi,UserCode:()=>uY,Service:()=>u9,RefreshToken:()=>x7,PollSuccess:()=>u7,PollSlow:()=>l7,PollResult:()=>YN,PollPending:()=>m7,PollExpired:()=>d7,PollError:()=>c7,PollDenied:()=>p7,OrgID:()=>v9,Org:()=>lY,Login:()=>dY,Info:()=>mY,DeviceCode:()=>h7,AccountTransportError:()=>j5,AccountServiceError:()=>RZ,AccountRepoError:()=>g7,AccountID:()=>hY,Account:()=>o7,AccessToken:()=>gY});var i7={};F1(i7,{layer:()=>ec,Service:()=>x9,AccountRepo:()=>i7});var w8=g6("account",{id:w1().$type().primaryKey(),email:w1().notNull(),url:w1().notNull(),access_token:w1().$type().notNull(),refresh_token:w1().$type().notNull(),token_expiry:q8(),...xY}),q5=g6("account_state",{id:q8().primaryKey(),active_account_id:w1().$type().references(()=>w8.id,{onDelete:"set null"}),active_org_id:w1().$type()}),ST0=g6("control_account",{email:w1().notNull(),url:w1().notNull(),access_token:w1().$type().notNull(),refresh_token:w1().$type().notNull(),token_expiry:q8(),active:q8({mode:"boolean"}).notNull().$default(()=>!1),...xY},($)=>[k9({columns:[$.email,$.url]})]);var hY=O.String.pipe(O.brand("AccountID")),v9=O.String.pipe(O.brand("OrgID")),gY=O.String.pipe(O.brand("AccessToken")),x7=O.String.pipe(O.brand("RefreshToken")),h7=O.String.pipe(O.brand("DeviceCode")),uY=O.String.pipe(O.brand("UserCode"));class mY extends O.Class("Account")({id:hY,email:O.String,url:O.String,active_org_id:O.NullOr(v9)}){}class lY extends O.Class("Org")({id:v9,name:O.String}){}class g7 extends O.TaggedErrorClass()("AccountRepoError",{message:O.String,cause:O.optional(O.Defect)}){}class RZ extends O.TaggedErrorClass()("AccountServiceError",{message:O.String,cause:O.optional(O.Defect)}){}class j5 extends O.TaggedErrorClass()("AccountTransportError",{method:O.String,url:O.String,description:O.optional(O.String),cause:O.optional(O.Defect)}){static fromHttpClientError($){return new j5({method:$.request.method,url:$.request.url,description:$.description,cause:$.cause})}get message(){return[`Could not reach ${this.method} ${this.url}.`,"This failed before the server returned an HTTP response.",this.description,"Check your network, proxy, or VPN configuration and try again."].filter(Boolean).join(`
|
|
486
|
+
`)}}class dY extends O.Class("Login")({code:h7,user:uY,url:O.String,server:O.String,expiry:O.Duration,interval:O.Duration}){}class u7 extends O.TaggedClass()("PollSuccess",{email:O.String}){}class m7 extends O.TaggedClass()("PollPending",{}){}class l7 extends O.TaggedClass()("PollSlow",{}){}class d7 extends O.TaggedClass()("PollExpired",{}){}class p7 extends O.TaggedClass()("PollDenied",{}){}class c7 extends O.TaggedClass()("PollError",{cause:O.Defect}){}var YN=O.Union([u7,m7,l7,d7,p7,c7]);var y9=($)=>{let Z=new URL($);Z.search="",Z.hash="";let J=Z.pathname.replace(/\/+$/,"");return J.length===0?Z.origin:`${Z.origin}${J}`};var XN=1;class x9 extends S1.Service()("@qitqode/AccountRepo"){}var ec=T0.effect(x9,L.gen(function*(){let $=O.decodeUnknownSync(mY),Z=(B)=>L.try({try:()=>W1.use(B),catch:(z)=>new g7({message:"Database operation failed",cause:z})}),J=(B)=>L.try({try:()=>W1.transaction(B),catch:(z)=>new g7({message:"Database operation failed",cause:z})}),Y=(B)=>{let z=B.select().from(q5).where(m0(q5.id,XN)).get();if(!z?.active_account_id)return;let F=B.select().from(w8).where(m0(w8.id,z.active_account_id)).get();if(!F)return;return{...F,active_org_id:z.active_org_id??null}},X=(B,z,F)=>{let A=O1.getOrNull(F);return B.insert(q5).values({id:XN,active_account_id:z,active_org_id:A}).onConflictDoUpdate({target:q5.id,set:{active_account_id:z,active_org_id:A}}).run()},Q=L.fn("AccountRepo.active")(()=>Z((B)=>Y(B)).pipe(L.map((B)=>B?O1.some($(B)):O1.none()))),G=L.fn("AccountRepo.list")(()=>Z((B)=>B.select().from(w8).all().map((z)=>$({...z,active_org_id:null})))),W=L.fn("AccountRepo.remove")((B)=>J((z)=>{z.update(q5).set({active_account_id:null,active_org_id:null}).where(m0(q5.active_account_id,B)).run(),z.delete(w8).where(m0(w8.id,B)).run()}).pipe(L.asVoid)),K=L.fn("AccountRepo.use")((B,z)=>Z((F)=>X(F,B,z)).pipe(L.asVoid)),V=L.fn("AccountRepo.getRow")((B)=>Z((z)=>z.select().from(w8).where(m0(w8.id,B)).get()).pipe(L.map(O1.fromNullishOr))),U=L.fn("AccountRepo.persistToken")((B)=>Z((z)=>z.update(w8).set({access_token:B.accessToken,refresh_token:B.refreshToken,token_expiry:O1.getOrNull(B.expiry)}).where(m0(w8.id,B.accountID)).run()).pipe(L.asVoid)),H=L.fn("AccountRepo.persistAccount")((B)=>J((z)=>{let F=y9(B.url);z.insert(w8).values({id:B.id,email:B.email,url:F,access_token:B.accessToken,refresh_token:B.refreshToken,token_expiry:B.expiry}).onConflictDoUpdate({target:w8.id,set:{email:B.email,url:F,access_token:B.accessToken,refresh_token:B.refreshToken,token_expiry:B.expiry}}).run(),X(z,B.id,B.orgID)}).pipe(L.asVoid));return x9.of({active:Q,list:G,remove:W,use:K,getRow:V,persistToken:U,persistAccount:H})}));class VN extends O.Class("RemoteConfig")({config:O.Record(O.String,O.Json)}){}var g9=O.Number.pipe(O.decodeTo(O.Duration,{decode:nV.transform(($)=>Z8.seconds($)),encode:nV.transform(($)=>Z8.toSeconds($))}));class UN extends O.Class("TokenRefresh")({access_token:gY,refresh_token:x7,expires_in:g9}){}class HN extends O.Class("DeviceAuth")({device_code:h7,user_code:uY,verification_uri_complete:O.String,expires_in:g9,interval:g9}){}class BN extends O.Class("DeviceTokenSuccess")({access_token:gY,refresh_token:x7,token_type:O.Literal("Bearer"),expires_in:g9}){}class tV extends O.Class("DeviceTokenError")({error:O.String,error_description:O.String}){toPollResult(){if(this.error==="authorization_pending")return new m7;if(this.error==="slow_down")return new l7;if(this.error==="expired_token")return new d7;if(this.error==="access_denied")return new p7;return new c7({cause:this.error})}}var $i=O.Union([BN,tV]);class zN extends O.Class("User")({id:hY,email:O.String}){}class sV extends O.Class("ClientId")({client_id:O.String}){}class rV extends O.Class("DeviceTokenRequest")({grant_type:O.String,device_code:h7,client_id:O.String}){}class aV extends O.Class("TokenRefreshRequest")({grant_type:O.String,refresh_token:x7,client_id:O.String}){}var iV="opencode-cli",Zi=Z8.minutes(5),Ji=Z8.toMillis(Zi),QN=($,Z)=>$!=null&&$>Z+Ji,s8=($="Account service operation failed")=>(Z)=>Z.pipe(L.mapError((J)=>Yi(J,$))),Yi=($,Z)=>{if($ instanceof RZ||$ instanceof j5)return $;if(GN.isHttpClientError($))switch($.reason._tag){case"TransportError":return j5.fromHttpClientError($.reason);default:return new RZ({message:Z,cause:$})}return new RZ({message:Z,cause:$})};class u9 extends S1.Service()("@qitqode/Account"){}var FN=T0.effect(u9,L.gen(function*(){let $=yield*i7.Service,Z=yield*h9.HttpClient,J=KN(Z),Y=h9.filterStatusOk(Z),X=h9.filterStatusOk(J),Q=(R)=>J.execute(R).pipe(s8("HTTP request failed")),G=(R)=>X.execute(R).pipe(s8("HTTP request failed")),W=(R)=>R.pipe(L.flatMap((T)=>Y.execute(T)),s8("HTTP request failed")),K=(R)=>R.pipe(L.flatMap((T)=>Z.execute(T)),s8("HTTP request failed")),V=L.fnUntraced(function*(R){let T=yield*n7.currentTimeMillis,I=yield*W(V$.post(`${R.url}/auth/device/token`).pipe(V$.acceptJson,V$.schemaBodyJson(aV)(new aV({grant_type:"refresh_token",refresh_token:R.refresh_token,client_id:iV})))),_=yield*PZ.schemaBodyJson(UN)(I).pipe(s8("Failed to decode response")),E=O1.some(T+Z8.toMillis(_.expires_in));return yield*$.persistToken({accountID:R.id,accessToken:_.access_token,refreshToken:_.refresh_token,expiry:E}),_.access_token}),U=yield*oV.make({capacity:Number.POSITIVE_INFINITY,timeToLive:Z8.zero,lookup:L.fnUntraced(function*(R){let T=yield*$.getRow(R);if(O1.isNone(T))return yield*L.fail(new RZ({message:"Account not found during token refresh"}));let I=T.value,_=yield*n7.currentTimeMillis;if(QN(I.token_expiry,_))return I.access_token;return yield*V(I)})}),H=L.fnUntraced(function*(R){let T=yield*n7.currentTimeMillis;if(QN(R.token_expiry,T))return R.access_token;return yield*oV.get(U,R.id)}),B=L.fnUntraced(function*(R){let T=yield*$.getRow(R);if(O1.isNone(T))return O1.none();let I=T.value,_=yield*H(I);return O1.some({account:I,accessToken:_})}),z=L.fnUntraced(function*(R,T){let I=yield*G(V$.get(`${R}/api/orgs`).pipe(V$.acceptJson,V$.bearerToken(T)));return yield*PZ.schemaBodyJson(O.Array(lY))(I).pipe(s8("Failed to decode response"))}),F=L.fnUntraced(function*(R,T){let I=yield*G(V$.get(`${R}/api/user`).pipe(V$.acceptJson,V$.bearerToken(T)));return yield*PZ.schemaBodyJson(zN)(I).pipe(s8("Failed to decode response"))}),A=L.fn("Account.token")((R)=>B(R).pipe(L.map(O1.map((T)=>T.accessToken)))),j=L.fn("Account.activeOrg")(function*(){let R=yield*$.active();if(O1.isNone(R))return O1.none();let T=R.value;if(!T.active_org_id)return O1.none();let _=(yield*w(T.id)).find((E)=>E.id===T.active_org_id);if(!_)return O1.none();return O1.some({account:T,org:_})}),N=L.fn("Account.orgsByAccount")(function*(){let R=yield*$.list();return yield*L.forEach(R,(T)=>w(T.id).pipe(L.catch(()=>L.succeed([])),L.map((I)=>({account:T,orgs:I}))),{concurrency:3})}),w=L.fn("Account.orgs")(function*(R){let T=yield*B(R);if(O1.isNone(T))return[];let{account:I,accessToken:_}=T.value;return yield*z(I.url,_)}),q=L.fn("Account.config")(function*(R,T){let I=yield*B(R);if(O1.isNone(I))return O1.none();let{account:_,accessToken:E}=I.value,f=yield*Q(V$.get(`${_.url}/api/config`).pipe(V$.acceptJson,V$.bearerToken(E),V$.setHeaders({"x-org-id":T})));if(f.status===404)return O1.none();let b=yield*PZ.filterStatusOk(f).pipe(s8()),y=yield*PZ.schemaBodyJson(VN)(b).pipe(s8("Failed to decode response"));return O1.some(y.config)}),M=L.fn("Account.login")(function*(R){let T=y9(R),I=yield*W(V$.post(`${T}/auth/device/code`).pipe(V$.acceptJson,V$.schemaBodyJson(sV)(new sV({client_id:iV})))),_=yield*PZ.schemaBodyJson(HN)(I).pipe(s8("Failed to decode response"));return new dY({code:_.device_code,user:_.user_code,url:`${T}${_.verification_uri_complete}`,server:T,expiry:_.expires_in,interval:_.interval})}),C=L.fn("Account.poll")(function*(R){let T=yield*K(V$.post(`${R.server}/auth/device/token`).pipe(V$.acceptJson,V$.schemaBodyJson(rV)(new rV({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:R.code,client_id:iV})))),I=yield*PZ.schemaBodyJson($i)(T).pipe(s8("Failed to decode response"));if(I instanceof tV)return I.toPollResult();let _=I.access_token,E=F(R.server,_),f=z(R.server,_),[b,y]=yield*L.all([E,f],{concurrency:2}),k=y.length>0?O1.some(y[0].id):O1.none(),d=(yield*n7.currentTimeMillis)+Z8.toMillis(I.expires_in),p=I.refresh_token;return yield*$.persistAccount({id:b.id,email:b.email,url:R.server,accessToken:_,refreshToken:p,expiry:d,orgID:k}),new u7({email:b.email})});return u9.of({active:$.active,activeOrg:j,list:$.list,orgsByAccount:N,remove:$.remove,use:$.use,orgs:w,config:q,token:A,login:M,poll:C})})),Xi=FN.pipe(T0.provide(i7.layer),T0.provide(WN.layer));import Qi from"path";async function qN(){let $=["qitqode.jsonc","qitqode.json","config.json"].map((Z)=>Qi.join(F0.Path.config,Z));for(let Z of $)if(await o0.exists(Z))return Z;return $[0]}function eV($,Z,J=[]){if(!J8(Z)){let Y=AN($,J,Z,{formattingOptions:{insertSpaces:!0,tabSize:2}});return ON($,Y)}return Object.entries(Z).reduce((Y,[X,Q])=>{if(Q===void 0)return Y;return eV(Y,Q,[...J,X])},$)}function s7($){let{plugin_origins:Z,mcp_origins:J,...Y}=$;return Y}var Gi=E0.create({service:"config.sources"});function jN($,Z){if(!J8($))return $;let J={...$};if(!(("theme"in J)||("keybinds"in J)||("tui"in J)))return J;return delete J.theme,delete J.keybinds,delete J.tui,Gi.warn("tui keys in qitqode config are deprecated; move them to tui.json",{path:Z}),J}async function NN($,Z){if(!$.plugin)return $;for(let J=0;J<$.plugin.length;J++)$.plugin[J]=await r8.resolvePluginSpec($.plugin[J],Z);return $}var Wi=E0.create({service:"config.loader"});function MN($){let Z=L.fnUntraced(function*(X){return yield*$.fs.readFileString(X).pipe(L.catchIf((Q)=>Q.reason._tag==="NotFound",()=>L.succeed(void 0)),L.orDie)}),J=L.fnUntraced(function*(X,Q){let G="path"in Q?Q.path:Q.source,W=yield*L.promise(()=>$U.substitute("path"in Q?{text:X,type:"path",path:Q.path}:{text:X,type:"virtual",...Q})),K=a8.jsonc(W,G),V=a8.schema($.info,jN(K,G),G);if(!("path"in Q))return V;if(yield*L.promise(()=>NN(V,Q.path)),!V.$schema){V.$schema="https://opencode.ai/config.json";let U=X.replace(/^\s*\{/,`{
|
|
487
|
+
"$schema": "https://opencode.ai/config.json",`);yield*$.fs.writeFileString(Q.path,U).pipe(L.catch(()=>L.void))}return V}),Y=L.fnUntraced(function*(X){Wi.info("loading",{path:X});let Q=yield*Z(X);if(!Q)return{};return yield*J(Q,{path:X})});return{readConfigFile:Z,loadConfig:J,loadFile:Y}}import pY from"path";import{pathToFileURL as Ki}from"url";import ZU from"fs/promises";function wN($){return L.fnUntraced(function*(){let Z=DN({},N1(yield*$(pY.join(F0.Path.config,"config.json"))),N1(yield*$(pY.join(F0.Path.config,"qitqode.json"))),N1(yield*$(pY.join(F0.Path.config,"qitqode.jsonc")))),J=pY.join(F0.Path.config,"config");if(!(yield*L.promise(()=>ZU.access(J).then(()=>!0,()=>!1))))return Z;return yield*L.promise(()=>import(Ki(J).href,{with:{type:"toml"}}).then(async(X)=>{let{provider:Q,model:G,...W}=X.default;if(Q&&G)Z.model=`${Q}/${G}`;Z.$schema="https://opencode.ai/config.json",Z=N1(Z,W),await ZU.writeFile(pY.join(F0.Path.config,"config.json"),JSON.stringify(Z,null,2)),await ZU.unlink(J)}).catch(()=>{})),Z})}import SZ from"path";import mr from"os";function m9($,Z){let J=N1($,Z);if($.instructions&&Z.instructions)J.instructions=Array.from(new Set([...$.instructions,...Z.instructions]));return J}var IZ={};F1(IZ,{redactString:()=>RN,redactCommand:()=>Fi,fromClaude:()=>zi,Remote:()=>QU,OAuth:()=>XU,Local:()=>YU,Info:()=>Vi,ConfigMCP:()=>IZ});class YU extends O.Class("McpLocalConfig")({type:O.Literal("local").annotate({description:"Type of MCP server connection"}),command:O.mutable(O.Array(O.String)).annotate({description:"Command and arguments to run the MCP server"}),environment:O.optional(O.Record(O.String,O.String)).annotate({description:"Environment variables to set when running the MCP server"}),enabled:O.optional(O.Boolean).annotate({description:"Enable or disable the MCP server on startup"}),timeout:O.optional(O.Number).annotate({description:"Timeout in ms for MCP server requests. Defaults to 5000 (5 seconds) if not specified."})}){static zod=w0(this)}class XU extends O.Class("McpOAuthConfig")({clientId:O.optional(O.String).annotate({description:"OAuth client ID. If not provided, dynamic client registration (RFC 7591) will be attempted."}),clientSecret:O.optional(O.String).annotate({description:"OAuth client secret (if required by the authorization server)"}),scope:O.optional(O.String).annotate({description:"OAuth scopes to request during authorization"}),redirectUri:O.optional(O.String).annotate({description:"OAuth redirect URI (default: http://127.0.0.1:19876/mcp/oauth/callback)."})}){static zod=w0(this)}class QU extends O.Class("McpRemoteConfig")({type:O.Literal("remote").annotate({description:"Type of MCP server connection"}),url:O.String.annotate({description:"URL of the remote MCP server"}),enabled:O.optional(O.Boolean).annotate({description:"Enable or disable the MCP server on startup"}),headers:O.optional(O.Record(O.String,O.String)).annotate({description:"Headers to send with the request"}),oauth:O.optional(O.Union([XU,O.Literal(!1)])).annotate({description:"OAuth authentication configuration for the MCP server. Set to false to disable OAuth auto-detection."}),timeout:O.optional(O.Number).annotate({description:"Timeout in ms for MCP server requests. Defaults to 5000 (5 seconds) if not specified."})}){static zod=w0(this)}var Vi=O.Union([YU,QU]).annotate({discriminator:"type"}).pipe(u0(($)=>({zod:w0($)}))),LN=new Set(["http","streamable-http","remote"]),TN=new Set(["stdio","local"]),Ui=["authorization","token","api_key","apikey","key","secret","password","credential"];function JU($){if(!J8($))return;return Object.fromEntries(Object.entries($).filter((Z)=>typeof Z[1]==="string"))}function Hi($){return Ui.some((Z)=>$.toLowerCase().includes(Z))}function Bi($){if($===!1)return!1;if(!J8($))return;let Z={...typeof $.clientId==="string"&&{clientId:$.clientId},...typeof $.clientSecret==="string"&&{clientSecret:$.clientSecret},...typeof $.scope==="string"&&{scope:$.scope},...typeof $.redirectUri==="string"&&{redirectUri:$.redirectUri}};return Object.keys(Z).length>0?Z:void 0}function zi($,Z){if(!J8(Z))return{warning:`skipped Claude Code MCP server "${$}"; server config is not an object.`};if(Z.type==="sse")return{warning:`skipped Claude Code MCP server "${$}"; unsupported transport "sse".`};if(Z.args!==void 0&&!Array.isArray(Z.args))return{warning:`skipped Claude Code MCP server "${$}"; args is not an array.`};let J=Array.isArray(Z.args)?Z.args:[];if(!J.every((W)=>typeof W==="string"))return{warning:`skipped Claude Code MCP server "${$}"; args must contain only strings.`};let Y=Z.disabled===!0?!1:Z.enabled===!1?!1:!0,X=JU(Z.environment)??JU(Z.env),Q=typeof Z.timeout==="number"?Z.timeout:void 0,G=typeof Z.type==="string"?Z.type:void 0;if(typeof Z.command==="string"&&(!G||TN.has(G)))return{config:{type:"local",command:[Z.command,...J],...X&&{environment:X},enabled:Y,...Q!==void 0&&{timeout:Q}}};if(Z.command!==void 0)return{warning:`skipped Claude Code MCP server "${$}"; command is not a string.`};if(typeof Z.url==="string"&&(!G||LN.has(G))){let W=JU(Z.headers),K=Bi(Z.oauth);return{config:{type:"remote",url:Z.url,enabled:Y,...W&&{headers:W},...K!==void 0&&{oauth:K},...Q!==void 0&&{timeout:Q}}}}if(Z.url!==void 0)return{warning:`skipped Claude Code MCP server "${$}"; url is not a string.`};if(G&&!TN.has(G)&&!LN.has(G))return{warning:`skipped Claude Code MCP server "${$}"; unsupported transport "${G}".`};return{warning:`skipped Claude Code MCP server "${$}"; missing command or url.`}}function RN($){return $.replace(/(Bearer\s+)[^\s]+/gi,"$1****").replace(/([?&][^=\s&]*(?:authorization|token|api[_-]?key|apikey|key|secret|password|credential)[^=\s&]*=)[^&\s]+/gi,"$1****").replace(/((?:authorization|token|api[_-]?key|apikey|key|secret|password|credential)=)[^\s]+/gi,"$1****")}function Fi($){return $.map((Z,J)=>{if(J>0&&Hi($[J-1]))return"****";return RN(Z)})}var GU=E0.create({service:"config.sources"});function PN($){let Z=(G,W,K,V)=>{if(!K.mcp)return G;return{...G,mcp_origins:{...G.mcp_origins??{},...Object.fromEntries(Object.keys(K.mcp).map((U)=>[U,{type:V,source:W}]))}}},J=L.fnUntraced(function*(G,W,K,V){if(!K?.length)return G;let U=V??(yield*$.resolvePluginScope(W)),H=r8.deduplicatePluginOrigins([...G.plugin_origins??[],...K.map((B)=>({spec:B,source:W,scope:U}))]);return{...G,plugin:H.map((B)=>B.spec),plugin_origins:H}}),Y=L.fnUntraced(function*(G,W,K,V){let U=m9(G,K),H=Z(U,W,K,"qitqode");return yield*J(H,W,K.plugin,V)}),X=L.fnUntraced(function*(G){let W=yield*$.readConfigFile(G);if(!W)return;return yield*L.try({try:()=>JSON.parse(W),catch:()=>Error(`failed to parse ${G}; Claude Code MCP compatibility skipped.`)}).pipe(L.tapError((K)=>L.sync(()=>GU.warn(K.message))),L.option,L.map(O1.getOrUndefined))}),Q=L.fnUntraced(function*(G,W){let K=yield*X(W);if(!J8(K)||!J8(K.mcpServers))return G;let V=G;for(let[U,H]of Object.entries(K.mcpServers)){if(V.mcp?.[U]&&V.mcp_origins?.[U]?.type!=="claude"){GU.info(`skipped Claude Code MCP server "${U}"; native qitqode MCP with same name already exists.`);continue}let z=IZ.fromClaude(U,H);if("warning"in z){GU.warn(z.warning);continue}let F=a8.schema($.info,{mcp:{[U]:z.config}},W);V={...V,mcp:{...V.mcp??{},[U]:F.mcp[U]},mcp_origins:{...V.mcp_origins??{},[U]:{type:"claude",source:W}}}}return V});return{merge:Y,mergeMcpOrigins:Z,mergePluginOrigins:J,mergeClaudeMcp:Q}}function IN($,Z){let J=$;for(let[Y,X]of Object.entries(J.mode??{}))J.agent=N1(J.agent??{},{[Y]:{...X,mode:"primary"}});if(Z.permissionOverride)J.permission=N1(J.permission??{},JSON.parse(Z.permissionOverride));if(J.tools){let Y={};for(let[X,Q]of Object.entries(J.tools)){let G=Q?"allow":"deny";if(X==="write"||X==="edit"||X==="patch"||X==="multiedit"){Y.edit=G;continue}Y[X]=G}J.permission=N1(Y,J.permission??{})}if(!J.username)J.username=Z.username;if(J.autoshare===!0&&!J.share)J.share="auto";if(Z.disableAutoCompact)J.compaction={...J.compaction,auto:!1};if(Z.disablePrune)J.compaction={...J.compaction,prune:!1};return J}var c6={};F1(c6,{loadMode:()=>fr,load:()=>Sr,Info:()=>_U,ConfigAgent:()=>c6});import CN from"path";function Ai($,Z){let J=$.replaceAll("\\","/");for(let Y of Z){let X=J.indexOf(Y);if(X===-1)continue;return J.slice(X+Y.length)}}function EN($,Z){let J=Ai($,Z)??CN.basename($),Y=CN.extname(J);return Y.length?J.slice(0,-Y.length):J}var bU={};F1(bU,{shell:()=>Mr,parse:()=>EU,files:()=>Nr,fallbackSanitization:()=>rD,SHELL_REGEX:()=>sD,FrontmatterError:()=>eY,FILE_REGEX:()=>oD});var CU=m6(nD(),1);var oD=/(?<![\w`])@(\.?[^\s`,.]*(?:\.[^\s`,.]+)*)/g,sD=/!`([^`]+)`/g;function Nr($){return Array.from($.matchAll(oD))}function Mr($){return Array.from($.matchAll(sD))}function rD($){let Z=$.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!Z)return $;let J=Z[1],Y=J.split(/\r?\n/),X=[];for(let G of Y){if(G.trim().startsWith("#")||G.trim()===""){X.push(G);continue}if(G.match(/^\s+/)){X.push(G);continue}let W=G.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\s*:\s*(.*)$/);if(!W){X.push(G);continue}let K=W[1],V=W[2].trim();if(V===""||V===">"||V==="|"||V.startsWith('"')||V.startsWith("'")){X.push(G);continue}if(V.includes(":")){X.push(`${K}: |-`),X.push(` ${V}`);continue}X.push(G)}let Q=X.join(`
|
|
488
|
+
`);return $.replace(J,()=>Q)}async function EU($){let Z=await o0.readText($);try{return CU.default(Z,{})}catch(J){let Y=rD(Z);if(Y===Z)throw new eY({path:$,message:`${$}: Failed to parse YAML frontmatter: ${J instanceof Error?J.message:String(J)}`},{cause:J});try{return CU.default(Y,{})}catch(X){throw new eY({path:$,message:`${$}: Failed to parse YAML frontmatter: ${X instanceof Error?X.message:String(X)}`},{cause:X})}}}var eY=j1.create("ConfigFrontmatterError",D.object({path:D.string(),message:D.string()}));var Dr=E0.create({service:"config"});function $X($,Z,J,Y){let X=$.safeParse(Z);if(X.success)return X.data;if(Y?.ignoreInvalid)return;throw new aD({path:J,issues:X.error.issues},{cause:X.error})}async function ZX($){for(let Z of await $4.scan($.glob,{cwd:$.dir,absolute:!0,dot:!0,symlink:!0})){let J=await EU(Z).catch(async(Q)=>{let G=eY.isInstance(Q)?Q.data.message:`Failed to parse ${$.entity} ${Z}`,{Session:W}=await import("./chunk-0j6dhrew.js");l1.publish(W.Event.Error,{error:new j1.Unknown({message:G}).toObject()}),Dr.error(`failed to load ${$.entity}`,{[$.entity]:Z,err:Q});return});if(!J)continue;let X={name:EN(Z,$.namePatterns),...J.data,[$.contentKey]:J.content.trim()};$.store(X,Z)}}var L8=O.String.annotate({[F$]:P.string().meta({$ref:"https://models.dev/model-schema.json#/$defs/Model"})}).pipe(u0(($)=>({zod:w0($)})));var _Z={};F1(_Z,{Rule:()=>T8,Object:()=>eD,Info:()=>Pr,ConfigPermission:()=>_Z,Action:()=>p6});var p6=O.Literals(["ask","allow","deny"]).annotate({identifier:"PermissionActionConfig"}).pipe(u0(($)=>({zod:w0($)}))),eD=O.Record(O.String,p6).annotate({identifier:"PermissionObjectConfig"}).pipe(u0(($)=>({zod:w0($)}))),T8=O.Union([p6,eD]).annotate({identifier:"PermissionRuleConfig"}).pipe(u0(($)=>({zod:w0($)}))),wr=($)=>{if(typeof $==="object"&&$!==null&&!Array.isArray($))return{__originalKeys:globalThis.Object.keys($),...$};return $},Lr=O.StructWithRest(O.Struct({__originalKeys:O.optional(O.mutable(O.Array(O.String))),read:O.optional(T8),edit:O.optional(T8),glob:O.optional(T8),grep:O.optional(T8),list:O.optional(T8),bash:O.optional(T8),task:O.optional(T8),actor:O.optional(T8),external_directory:O.optional(T8),question:O.optional(p6),webfetch:O.optional(p6),websearch:O.optional(p6),codesearch:O.optional(p6),lsp:O.optional(T8),doom_loop:O.optional(p6),skill:O.optional(T8)}),[O.Record(O.String,T8)]),Tr=O.Union([Lr,p6]).annotate({[tD]:wr}),Rr=($)=>{if(typeof $==="string")return{"*":$};let Z=$,{__originalKeys:J,...Y}=Z;if(!J)return Y;let X={};for(let Q of J)if(Q in Y)X[Q]=Y[Q];return X},Pr=w0(Tr).transform(Rr).meta({ref:"PermissionConfig"});var $w=O.Number.check(O.isInt()).check(O.isGreaterThan(0)),Ir=O.Union([O.String.check(O.isPattern(/^#[0-9a-fA-F]{6}$/)),O.Literals(["primary","secondary","accent","success","warning","error","info"])]),Cr=O.Any.annotate({[F$]:_Z.Info}),Er=O.StructWithRest(O.Struct({model:O.optional(L8).annotate({description:"Model for this agent: a literal provider/model (e.g. anthropic/claude-opus-4-8) or a tier/group name (e.g. fast/economical/default/power). Names without a '/' are resolved as model groups, provider-aware, at spawn time."}),variant:O.optional(O.String).annotate({description:"Default model variant for this agent (applies only when using the agent's configured model)."}),temperature:O.optional(O.Number),top_p:O.optional(O.Number),prompt:O.optional(O.String),tools:O.optional(O.Record(O.String,O.Boolean)).annotate({description:"@deprecated Use 'permission' field instead"}),disable:O.optional(O.Boolean),description:O.optional(O.String).annotate({description:"Description of when to use the agent"}),mode:O.optional(O.Literals(["subagent","primary","all"])),hidden:O.optional(O.Boolean).annotate({description:"Hide this subagent from the @ autocomplete menu (default: false, only applies to mode: subagent)"}),options:O.optional(O.Record(O.String,O.Any)),color:O.optional(Ir).annotate({description:"Hex color code (e.g., #FF5733) or theme color (e.g., primary)"}),steps:O.optional($w).annotate({description:"Maximum number of agentic iterations before forcing text-only response"}),tool_allowlist:O.optional(O.Array(O.String)).annotate({description:"Optional list of tool IDs allowed for this agent. When set, only these tools are available."}),maxSteps:O.optional($w).annotate({description:"@deprecated Use 'steps' field instead."}),permission:O.optional(Cr)}),[O.Record(O.String,O.Any)]),br=new Set(["name","model","variant","prompt","description","temperature","top_p","mode","hidden","color","steps","maxSteps","options","permission","disable","tools","tool_allowlist"]),_r=($)=>{let Z={...$.options};for(let[Y,X]of Object.entries($))if(!br.has(Y))Z[Y]=X;let J={};for(let[Y,X]of Object.entries($.tools??{})){let Q=X?"allow":"deny";if(Y==="write"||Y==="edit"||Y==="patch"||Y==="multiedit"){J.edit=Q;continue}if(Y==="task"){J.actor=Q;continue}J[Y]=Q}return globalThis.Object.assign(J,$.permission),{...$,options:Z,permission:J,steps:$.steps??$.maxSteps}},_U=w0(Er).transform(_r).meta({ref:"AgentConfig"});async function Sr($){let Z={};return await ZX({dir:$,glob:"{agent,agents}/**/*.md",entity:"agent",namePatterns:["/.qitqode/agent/","/.qitqode/agents/","/agent/","/agents/"],contentKey:"prompt",store:(J,Y)=>{Z[J.name]=$X(_U,J,Y)}}),Z}async function fr($){let Z={};return await ZX({dir:$,glob:"{mode,modes}/*.md",entity:"mode",namePatterns:[],contentKey:"prompt",store:(J,Y)=>{let X=$X(_U,J,Y,{ignoreInvalid:!0});if(X)Z[J.name]={...X,mode:"primary"}}}),Z}var i6={};F1(i6,{load:()=>kr,Info:()=>Zw,ConfigCommand:()=>i6});var Zw=O.Struct({template:O.String,description:O.optional(O.String),agent:O.optional(O.String),model:O.optional(L8),subtask:O.optional(O.Boolean)}).pipe(u0(($)=>({zod:w0($)})));async function kr($){let Z={};return await ZX({dir:$,glob:"{command,commands}/**/*.md",entity:"command",namePatterns:["/.qitqode/command/","/.qitqode/commands/","/.claude/command/","/.claude/commands/","/command/","/commands/"],contentKey:"template",store:(J,Y)=>{Z[J.name]=$X(Zw.zod,J,Y)}}),Z}var R5={};F1(R5,{readManagedPreferences:()=>ur,parseManagedPlist:()=>Qw,managedConfigDirs:()=>Xw,managedConfigDir:()=>gr,ConfigManaged:()=>R5});import vr from"os";import SU from"path";var Jw=E0.create({service:"config"}),yr="ai.qitqode.managed",xr="ai.opencode.managed",hr=new Set(["PayloadDisplayName","PayloadIdentifier","PayloadType","PayloadUUID","PayloadVersion","_manualProfile"]);function Yw($="qitqode"){switch(process.platform){case"darwin":return`/Library/Application Support/${$}`;case"win32":return SU.join(process.env.ProgramData||"C:\\ProgramData",$);default:return`/etc/${$}`}}function gr(){return Xw().at(-1)}function Xw(){let $=process.env.QITQODE_TEST_MANAGED_CONFIG_DIR;if($)return[$];return[Yw("opencode"),Yw()]}function Qw($){let Z=JSON.parse($);for(let J of Object.keys(Z))if(hr.has(J))delete Z[J];return JSON.stringify(Z)}async function ur(){if(process.platform!=="darwin")return;let $=vr.userInfo().username,Z=[xr,yr].flatMap((J)=>[SU.join("/Library/Managed Preferences",$,`${J}.plist`),SU.join("/Library/Managed Preferences",`${J}.plist`)]);for(let J of Z){if(!await o0.exists(J))continue;Jw.info("reading macOS managed preferences",{path:J});let Y=await f1.run(["plutil","-convert","json","-o","-",J],{nothrow:!0});if(Y.code!==0){Jw.warn("failed to convert managed preferences plist",{path:J});continue}return{source:`mobileconfig:${J}`,text:Qw(Y.stdout.toString())}}return}var fZ=E0.create({service:"config"});function Kw($){let{fs:Z,authSvc:J,accountSvc:Y,env:X,npmSvc:Q,readConfigFile:G,loadConfig:W,loadFile:K,getGlobal:V}=$,U=L.fn("Config.ensureGitignore")(function*(B){let z=SZ.join(B,".gitignore");if(!(yield*Z.existsSafe(z)))yield*Z.writeFileString(z,["node_modules","package.json","package-lock.json","bun.lock",".gitignore"].join(`
|
|
489
|
+
`)).pipe(L.catchIf((A)=>A.reason._tag==="PermissionDenied",()=>L.void))});return{loadInstanceState:L.fn("Config.loadInstanceState")(function*(B){let z=yield*J.all().pipe(L.orDie),F={},A=new Set,j,N=L.fnUntraced(function*(I){if(I.startsWith("http://")||I.startsWith("https://"))return"global";if(I==="QITQODE_CONFIG_CONTENT")return"local";if(yield*Gw.use((_)=>L.succeed(S8.containsPath(I,_))))return"local";return"global"}),w=PN({info:$.info,readConfigFile:G,resolvePluginScope:N});for(let[I,_]of Object.entries(z))if(_.type==="wellknown"){let E=I.replace(/\/+$/,"");process.env[_.key]=_.token,fZ.debug("fetching remote config",{url:`${E}/.well-known/opencode`});let f=yield*L.promise(()=>fetch(`${E}/.well-known/opencode`,{signal:AbortSignal.timeout(1000)}));if(!f.ok)throw Error(`failed to fetch remote config from ${E}: ${f.status}`);let y=(yield*L.promise(()=>f.json())).config??{};if(!y.$schema)y.$schema="https://opencode.ai/config.json";let k=`${E}/.well-known/opencode`,g=yield*W(JSON.stringify(y),{dir:SZ.dirname(k),source:k});F=yield*w.merge(F,k,g,"global"),fZ.debug("loaded remote config from well-known",{url:E})}let q=yield*V();if(F=yield*w.merge(F,F0.Path.config,q,"global"),b0.QITQODE_CONFIG)F=yield*w.merge(F,b0.QITQODE_CONFIG,yield*K(b0.QITQODE_CONFIG)),fZ.debug("loaded custom config",{path:b0.QITQODE_CONFIG});if(!b0.QITQODE_DISABLE_PROJECT_CONFIG)for(let I of yield*JX.files("qitqode",B.directory,B.worktree).pipe(L.orDie))F=yield*w.merge(F,I,yield*K(I),"local");F.agent=F.agent||{},F.mode=F.mode||{},F.plugin=F.plugin||[];let M=yield*JX.directories(B.directory,B.worktree);if(b0.QITQODE_CONFIG_DIR)fZ.debug("loading config from QITQODE_CONFIG_DIR",{path:b0.QITQODE_CONFIG_DIR});let C=[];for(let I of yield*JX.claudeCommandDirectories(B.directory,B.worktree))F.command=N1(F.command??{},yield*L.promise(()=>i6.load(I)));for(let I of M){if(I.endsWith(".qitqode")||I===b0.QITQODE_CONFIG_DIR)for(let f of["qitqode.json","qitqode.jsonc"]){let b=SZ.join(I,f);fZ.debug(`loading config from ${b}`),F=yield*w.merge(F,b,yield*K(b)),F.agent??={},F.mode??={},F.plugin??=[]}yield*U(I).pipe(L.orDie);let _=yield*Ww.install({fs:Z,npm:Q,dir:I}).pipe(L.exit,L.tap((f)=>B9.isFailure(f)?L.sync(()=>{fZ.warn("background dependency install failed",{dir:I,error:String(f.cause)})}):L.void),L.asVoid,L.forkDetach);C.push(_),F.command=N1(F.command??{},yield*L.promise(()=>i6.load(I))),F.agent=N1(F.agent??{},yield*L.promise(()=>c6.load(I))),F.agent=N1(F.agent??{},yield*L.promise(()=>c6.loadMode(I)));let E=yield*L.promise(()=>r8.load(I));F=yield*w.mergePluginOrigins(F,I,E)}if(process.env.QITQODE_CONFIG_CONTENT){let _=yield*W(process.env.QITQODE_CONFIG_CONTENT,{dir:B.directory,source:"QITQODE_CONFIG_CONTENT"});F=yield*w.merge(F,"QITQODE_CONFIG_CONTENT",_,"local"),fZ.debug("loaded custom config from QITQODE_CONFIG_CONTENT")}let R=O1.getOrUndefined(yield*Y.active().pipe(L.catch(()=>L.succeed(O1.none()))));if(R?.active_org_id){let{id:I,active_org_id:_,url:E}=R;yield*L.gen(function*(){let[f,b]=yield*L.all([Y.config(I,_),Y.token(I)],{concurrency:2});if(O1.isSome(b))process.env.QITQODE_CONSOLE_TOKEN=b.value,yield*X.set("QITQODE_CONSOLE_TOKEN",b.value);if(O1.isSome(f)){let y=`${E}/api/config`,k=yield*W(JSON.stringify(f.value),{dir:SZ.dirname(y),source:y});for(let g of Object.keys(k.provider??{}))A.add(g);F=yield*w.merge(F,y,k,"global")}}).pipe(L.withSpan("Config.loadActiveOrgConfig"),L.catch((f)=>{return fZ.debug("failed to fetch remote account config",{error:f instanceof Error?f.message:String(f)}),L.void}))}for(let I of R5.managedConfigDirs()){if(!(yield*L.promise(()=>o0.exists(I))))continue;for(let _ of["qitqode.json","qitqode.jsonc"]){let E=SZ.join(I,_);F=yield*w.merge(F,E,yield*K(E),"global")}}let T=yield*L.promise(()=>R5.readManagedPreferences());if(T){let I=yield*W(T.text,{dir:SZ.dirname(T.source),source:T.source});F=w.mergeMcpOrigins(m9(F,I),T.source,I,"qitqode")}if(!b0.QITQODE_DISABLE_CLAUDE_CODE_MCP)F=yield*w.mergeClaudeMcp(F,SZ.join(F0.Path.home,".claude.json")),F=yield*w.mergeClaudeMcp(F,SZ.join(B.directory,".claude.json"));return F=IN(F,{username:mr.userInfo().username,permissionOverride:b0.QITQODE_PERMISSION,disableAutoCompact:b0.QITQODE_DISABLE_AUTOCOMPACT,disablePrune:b0.QITQODE_DISABLE_PRUNE}),{config:F,directories:M,deps:C,consoleState:{consoleManagedProviders:Array.from(A),activeOrgName:j,switchableOrgCount:0}}},L.provideService(C$.Service,Z)),ensureGitignore:U}}var P5={};F1(P5,{Layout:()=>lr,ConfigLayout:()=>P5});var lr=O.Literals(["auto","stretch"]).annotate({identifier:"LayoutConfig"}).pipe(u0(($)=>({zod:w0($)})));var I5={};F1(I5,{Server:()=>Vw,ConfigServer:()=>I5});class Vw extends O.Class("ServerConfig")({port:O.optional(O.Number.check(O.isInt()).check(O.isGreaterThan(0))).annotate({description:"Port to listen on"}),hostname:O.optional(O.String).annotate({description:"Hostname to listen on"}),mdns:O.optional(O.Boolean).annotate({description:"Enable mDNS service discovery"}),mdnsDomain:O.optional(O.String).annotate({description:"Custom domain name for mDNS service (default: qitqode.local)"}),cors:O.optional(O.mutable(O.Array(O.String))).annotate({description:"Additional domains to allow for CORS"})}){static zod=w0(this)}var QJ={};F1(QJ,{Info:()=>dr,Entry:()=>Uw,ConfigFormatter:()=>QJ});var Uw=O.Struct({disabled:O.optional(O.Boolean),command:O.optional(O.mutable(O.Array(O.String))),environment:O.optional(O.Record(O.String,O.String)),extensions:O.optional(O.mutable(O.Array(O.String)))}).pipe(u0(($)=>({zod:w0($)}))),dr=O.Union([O.Boolean,O.Record(O.String,Uw)]).pipe(u0(($)=>({zod:w0($)})));var YX={};F1(YX,{Kind:()=>Hw,Info:()=>pr,ConfigHistory:()=>YX});var Hw=O.Literals(["user_text","assistant_text","tool_input","tool_error","reasoning","tool_output"]),pr=O.Struct({kinds:O.optional(O.Array(Hw)).annotate({description:"Which part kinds the history FTS index should cover. Defaults to text (user/assistant) + tool input + tool errors. Add 'reasoning' or 'tool_output' to grow recall at the cost of database size. Note: enabling 'tool_output' reclassifies completed tools from kind='tool_input' to kind='tool_output' (input remains searchable in the body, but kind:['tool_input'] filter will then only match pending/error tools)."})});var GJ={};F1(GJ,{requiresExtensionsForCustomServers:()=>Fw,Info:()=>cr,Entry:()=>zw,Disabled:()=>Bw,ConfigLSP:()=>GJ});var Bw=O.Struct({disabled:O.Literal(!0)}).pipe(u0(($)=>({zod:w0($)}))),zw=O.Union([Bw,O.Struct({command:O.mutable(O.Array(O.String)),extensions:O.optional(O.mutable(O.Array(O.String))),disabled:O.optional(O.Boolean),env:O.optional(O.Record(O.String,O.String)),initialization:O.optional(O.Record(O.String,O.Unknown))})]).pipe(u0(($)=>({zod:w0($)}))),Fw=O.makeFilter(($)=>{if(typeof $==="boolean")return;let Z=new Set(Object.values(f7).map((Y)=>Y.id));return Object.entries($).every(([Y,X])=>{if("disabled"in X&&X.disabled)return!0;if(Z.has(Y))return!0;return"extensions"in X&&Boolean(X.extensions)})?void 0:"For custom LSP servers, 'extensions' array is required."}),cr=O.Union([O.Boolean,O.Record(O.String,zw)]).check(Fw).pipe(u0(($)=>({zod:w0($)})));var WJ={};F1(WJ,{Model:()=>Ow,Info:()=>qw,ConfigProvider:()=>WJ});var Aw=O.Number.check(O.isInt()).check(O.isGreaterThan(0)),Ow=O.Struct({id:O.optional(O.String),name:O.optional(O.String),family:O.optional(O.String),release_date:O.optional(O.String),attachment:O.optional(O.Boolean),reasoning:O.optional(O.Boolean),temperature:O.optional(O.Boolean),tool_call:O.optional(O.Boolean),interleaved:O.optional(O.Union([O.Literal(!0),O.Struct({field:O.Literals(["reasoning_content","reasoning_details"])})])),cost:O.optional(O.Struct({input:O.Number,output:O.Number,cache_read:O.optional(O.Number),cache_write:O.optional(O.Number),context_over_200k:O.optional(O.Struct({input:O.Number,output:O.Number,cache_read:O.optional(O.Number),cache_write:O.optional(O.Number)}))})),limit:O.optional(O.Struct({context:O.Number,input:O.optional(O.Number),output:O.Number})),modalities:O.optional(O.Struct({input:O.mutable(O.Array(O.Literals(["text","audio","image","video","pdf"]))),output:O.mutable(O.Array(O.Literals(["text","audio","image","video","pdf"])))})),experimental:O.optional(O.Boolean),status:O.optional(O.Literals(["alpha","beta","deprecated"])),cachePromptTTL:O.optional(O.Literals(["5m","1h"])).annotate({description:"Prompt-cache breakpoint TTL for Anthropic/OpenRouter. '1h' keeps the cached prefix alive for one hour (2x write cost) instead of the 5m default. Ignored by providers whose SDK doesn't support a cache TTL."}),provider:O.optional(O.Struct({npm:O.optional(O.String),api:O.optional(O.String)})),options:O.optional(O.Record(O.String,O.Any)),headers:O.optional(O.Record(O.String,O.String)),variants:O.optional(O.Record(O.String,O.StructWithRest(O.Struct({disabled:O.optional(O.Boolean).annotate({description:"Disable this variant for the model"})}),[O.Record(O.String,O.Any)])).annotate({description:"Variant-specific configuration"}))}).pipe(u0(($)=>({zod:w0($)})));class qw extends O.Class("ProviderConfig")({api:O.optional(O.String),name:O.optional(O.String),env:O.optional(O.mutable(O.Array(O.String))),id:O.optional(O.String),npm:O.optional(O.String),whitelist:O.optional(O.mutable(O.Array(O.String))),blacklist:O.optional(O.mutable(O.Array(O.String))),options:O.optional(O.StructWithRest(O.Struct({apiKey:O.optional(O.String),baseURL:O.optional(O.String),enterpriseUrl:O.optional(O.String).annotate({description:"GitHub Enterprise URL for copilot authentication"}),setCacheKey:O.optional(O.Boolean).annotate({description:"Enable promptCacheKey for this provider (default false)"}),timeout:O.optional(O.Union([Aw,O.Literal(!1)]).annotate({description:"Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout."})).annotate({description:"Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout."}),chunkTimeout:O.optional(Aw).annotate({description:"Timeout in milliseconds between streamed SSE chunks for this provider. If no chunk arrives within this window, the request is aborted."})}),[O.Record(O.String,O.Any)])),models:O.optional(O.Record(O.String,Ow))}){static zod=w0(this)}var KJ={};F1(KJ,{Info:()=>ir,ConfigSkills:()=>KJ});var ir=O.Struct({paths:O.optional(O.Array(O.String)).annotate({description:"Additional paths to skill folders"}),urls:O.optional(O.Array(O.String)).annotate({description:"URLs to fetch skills from (e.g., https://example.com/.well-known/skills/)"})}).pipe(u0(($)=>({zod:w0($)})));var t8=O.Any.annotate({[F$]:c6.Info}),nr=O.Any.annotate({[F$]:_Z.Info}),or=O.Any.annotate({[F$]:E0.Level}),m$=O.Number.check(O.isInt()).check(O.isGreaterThan(0)),C5=O.Number.check(O.isInt()).check(O.isGreaterThanOrEqualTo(0)),sr=O.Struct({$schema:O.optional(O.String).annotate({description:"JSON schema reference for configuration validation"}),logLevel:O.optional(or).annotate({description:"Log level"}),server:O.optional(I5.Server).annotate({description:"Server configuration for qitqode serve and web commands"}),command:O.optional(O.Record(O.String,i6.Info)).annotate({description:"Command configuration, see https://opencode.ai/docs/commands"}),skills:O.optional(KJ.Info).annotate({description:"Additional skill folder paths"}),watcher:O.optional(O.Struct({ignore:O.optional(O.mutable(O.Array(O.String)))})),snapshot:O.optional(O.Boolean).annotate({description:"Enable or disable snapshot tracking. When false, filesystem snapshots are not recorded and undoing or reverting will not undo/redo file changes. Defaults to true."}),plugin:O.optional(O.mutable(O.Array(r8.Spec))),share:O.optional(O.Literals(["manual","auto","disabled"])).annotate({description:"Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing"}),autoshare:O.optional(O.Boolean).annotate({description:"@deprecated Use 'share' field instead. Share newly created sessions automatically"}),autoupdate:O.optional(O.Union([O.Boolean,O.Literal("notify")])).annotate({description:"Update behavior. Defaults to notifications only; set true to auto-install patch updates, false to disable checks, or 'notify' to show notifications"}),disabled_providers:O.optional(O.mutable(O.Array(O.String))).annotate({description:"Disable providers that are loaded automatically"}),enabled_providers:O.optional(O.mutable(O.Array(O.String))).annotate({description:"When set, ONLY these providers will be enabled. All other providers will be ignored"}),model:O.optional(L8).annotate({description:"Model to use in the format of provider/model, eg anthropic/claude-2"}),small_model:O.optional(L8).annotate({description:"Small model to use for tasks like title generation in the format of provider/model"}),model_groups:O.optional(O.Record(O.String,O.Union([L8,O.Struct({default:L8,models:O.optional(O.mutable(O.Array(L8)))})]))).annotate({description:"Named model groups (capability tiers, e.g. fast/economical/default/power). Each group has a default model and optional member models. A group name can be used anywhere a provider/model string is accepted."}),default_agent:O.optional(O.String).annotate({description:"Default agent to use when none is specified. Must be a primary agent. Falls back to 'build' if not set or if the specified agent is invalid."}),username:O.optional(O.String).annotate({description:"Custom username to display in conversations instead of system username"}),mode:O.optional(O.StructWithRest(O.Struct({build:O.optional(t8),plan:O.optional(t8)}),[O.Record(O.String,t8)])).annotate({description:"@deprecated Use `agent` field instead."}),agent:O.optional(O.StructWithRest(O.Struct({plan:O.optional(t8),build:O.optional(t8),general:O.optional(t8),explore:O.optional(t8),title:O.optional(t8),summary:O.optional(t8),compaction:O.optional(t8)}),[O.Record(O.String,t8)])).annotate({description:"Agent configuration, see https://opencode.ai/docs/agents"}),provider:O.optional(O.Record(O.String,WJ.Info)).annotate({description:"Custom provider configurations and model overrides"}),mcp:O.optional(O.Record(O.String,O.Union([IZ.Info,O.Any.annotate({[F$]:P.object({enabled:P.boolean()}).strict()})]))).annotate({description:"MCP (Model Context Protocol) server configurations"}),formatter:O.optional(QJ.Info),lsp:O.optional(GJ.Info),instructions:O.optional(O.mutable(O.Array(O.String))).annotate({description:"Additional instruction files or patterns to include"}),layout:O.optional(P5.Layout).annotate({description:"@deprecated Always uses stretch layout."}),permission:O.optional(nr),tools:O.optional(O.Record(O.String,O.Boolean)),tool:O.optional(O.Struct({invocation_style:O.optional(O.Literals(["json","shell"])).annotate({description:"Default invocation style for all tools. 'json' (default) exposes the original Zod schema; 'shell' exposes a single `script` parameter and uses the tool's shell.parse mapping."}),invocation_style_by_tool:O.optional(O.Record(O.String,O.Literals(["json","shell"]))).annotate({description:"Per-tool override of invocation_style. Keys are tool IDs. A tool without a `shell` field falls back to JSON regardless of this setting."})})).annotate({description:"Tool invocation style configuration (JSON vs shell-style)."}),enterprise:O.optional(O.Struct({url:O.optional(O.String).annotate({description:"Enterprise URL"})})),compaction:O.optional(O.Struct({auto:O.optional(O.Boolean).annotate({description:"Enable automatic compaction when context is full (default: true)"}),prune:O.optional(O.Boolean).annotate({description:"Enable pruning of old tool outputs (default: true)"}),tail_turns:O.optional(C5).annotate({description:"Number of recent user turns, including their following assistant/tool responses, to keep verbatim during compaction (default: 2)"}),preserve_recent_tokens:O.optional(C5).annotate({description:"Maximum number of tokens from recent turns to preserve verbatim after compaction"}),reserved:O.optional(C5).annotate({description:"Token buffer for compaction. Leaves enough window to avoid overflow during compaction."})})),checkpoint:O.optional(O.Struct({thresholds:O.optional(O.Array(O.String)).annotate({description:'Context fill thresholds that trigger checkpoint writes. Strings may be percentages ("40%"), absolute tokens ("100K", "1.5M"), or mixed ("100K", "50%"). Each threshold must be <= window - 20K reserved. Default: ["40%", "60%", "80%"].'}),reserved:O.optional(C5).annotate({description:"Token buffer reserved for checkpoint operations. Default: 20000."}),max_writer_failures:O.optional(m$).annotate({description:"Maximum consecutive writer failures per session before checkpointing stops retrying until process restart. Default: 3."}),fork:O.optional(O.Boolean).annotate({description:"Whether to fork the parent agent's message prefix into the writer session for prefix-cache reuse. Requires provider cache-breakpoint support. Default: false."}),push_caps:O.optional(O.Struct({tasks_ledger:O.optional(m$).annotate({description:"Token cap for the tasks ledger section of rebuild context. Default: 2000."}),focus_task:O.optional(m$).annotate({description:"Token cap for the focus task body in rebuild context. Default: 4000."}),actor_ledger:O.optional(m$).annotate({description:"Token cap for the actor ledger section of rebuild context. Default: 500."}),memory_titles:O.optional(m$).annotate({description:"Token cap for memory titles in rebuild context. Default: 500."}),global:O.optional(m$).annotate({description:"Token cap for the global memory section (global/MEMORY.md) of rebuild context. Default: 6000."}),checkpoint:O.optional(m$).annotate({description:"Token cap for the session checkpoint section (checkpoint.md) of rebuild context. Default: 11000."}),memory:O.optional(m$).annotate({description:"Token cap for the project memory section (MEMORY.md) of rebuild context. Default: 10000."}),notes:O.optional(m$).annotate({description:"Token cap for the session notes (notes.md) of rebuild context. Default: 6000."}),design_decisions:O.optional(m$).annotate({description:"Token cap for \xA710 Design decisions section of checkpoint.md (writer-side budget validation). Default: 3000."}),open_notes:O.optional(m$).annotate({description:"Token cap for \xA711 Open notes section of checkpoint.md (writer-side budget validation). Default: 800."}),recent_user:O.optional(C5).annotate({description:"Token cap for the recent user input section (verbatim user messages from the live DB, FIFO eviction). Default: 16000. Set 0 to disable."}),recent_user_per_msg:O.optional(m$).annotate({description:"Per-message cap inside recent user input section; oversized messages get head/tail truncation with messageID elision marker. Default: 2000."})})).annotate({description:"Per-section token caps for rebuild context (renderRebuildContext). Each section is loaded up to its cap so the rebuild stays within a predictable budget."}),task_archive_days:O.optional(m$).annotate({description:"Number of days after task done/abandoned before it's filtered out of `list({include_archived: false})`. Rows are NOT deleted \u2014 see v9 for true GC. Default: 7."}),task_cleanup_days:O.optional(m$).annotate({description:"[deprecated] Alias for task_archive_days. Will be removed in v9."}),memory_reconcile_on_search:O.optional(O.Boolean).annotate({description:"Whether to reconcile memory state on search operations. Default: true."}),memory_search_score_floor:O.optional(O.Number).annotate({description:"Relative BM25 floor for memory.search (OR-joined query): keep results scoring >= this fraction of the top hit, dropping common-word-only noise. The #1 result is always kept. Default: 0.15. Set 0 to keep all matches."})})),memory:O.optional(O.Struct({cc_index:O.optional(O.Boolean).annotate({description:"Index Claude Code memory (~/.claude/projects/<slug>/memory) and expose under scope='cc'. Default: false. Note: when enabled, every qitqode agent (build/explore/subagents) can search these memories via the builtin `memory` tool \u2014 including CC's `type: user` (your role/preferences) and `type: feedback` (your guidance) categories. CC originally writes them for future CC sessions; flipping this on widens the consumer set to qitqode agents on the same machine. Leave disabled (default) if you don't want personal context recallable from a prompt-injection-vulnerable agent."})})),history:O.optional(YX.Info).annotate({description:"Trajectory (conversation history) FTS index configuration."}),dream:O.optional(O.Struct({auto:O.optional(O.Boolean).annotate({description:"Auto-trigger dream memory consolidation on new session start. Default: true."}),interval_days:O.optional(C5).annotate({description:"Minimum days between automatic dream runs. Set to 0 to trigger on every new session. Default: 7."})})),distill:O.optional(O.Struct({auto:O.optional(O.Boolean).annotate({description:"Auto-trigger distill workflow packaging on new session start. Default: true."}),interval_days:O.optional(C5).annotate({description:"Minimum days between automatic distill runs. Default: 30."})})),voice:O.optional(O.Struct({asr_model:O.optional(L8).annotate({description:"Model to use for voice ASR transcription in provider/model format, e.g. openai/whisper-1."}),control_model:O.optional(L8).annotate({description:"Model to use for voice control (multimodal) in provider/model format, e.g. openai/gpt-4o."})})).annotate({description:"Voice input provider and model configuration."}),experimental:O.optional(O.Struct({disable_paste_summary:O.optional(O.Boolean),batch_tool:O.optional(O.Boolean).annotate({description:"Enable the batch tool"}),openTelemetry:O.optional(O.Boolean).annotate({description:"Enable OpenTelemetry spans for AI SDK calls (using the 'experimental_telemetry' flag)"}),primary_tools:O.optional(O.mutable(O.Array(O.String))).annotate({description:"Tools that should only be available to primary agents."}),continue_loop_on_deny:O.optional(O.Boolean).annotate({description:"Continue the agent loop when a tool call is denied"}),mcp_timeout:O.optional(m$).annotate({description:"Timeout in milliseconds for model context protocol (MCP) requests"}),predict_next_prompt:O.optional(O.Boolean).annotate({description:"Predict the user's likely next prompt after each turn and show it as inline ghost text (Tab to accept). Enabled by default; set to false to disable."}),maxMode:O.optional(O.Struct({candidates:O.optional(m$).annotate({description:"Number of parallel reasoning candidates per step in max mode (default 5)."})})).annotate({description:"Max mode (experimental): the 'max' agent runs N parallel reasoning candidates each step, picks the best via a judge call, and executes only the winner."})})),workflow:O.optional(O.Struct({maxConcurrentAgents:O.optional(O.Number).annotate({description:"Process-wide ceiling on subagents running concurrently across ALL workflow runs (including nested children). Default min(16, 2x CPU cores). No upper clamp: the previous 2x-cores hard cap was removed so an operator can match real provider capacity \u2014 but that also means a misconfigured value (e.g. an extra zero) can exhaust provider rate limits or host memory. This is the only concurrency ceiling, so set it deliberately."}),maxDepth:O.optional(O.Number).annotate({description:"Max nesting depth for workflow()-calls-workflow. Default 8. Exceeding it fails the run."}),maxLifecycleAgents:O.optional(O.Number).annotate({description:"Hard ceiling on total agents a single workflow run may spawn over its life. Default 1000. Over-cap agent() calls return null (graceful degradation). PER-RUN, not tree-wide: each child workflow has its own independent budget, so a deep nesting can spawn maxDepth \xD7 this over the whole tree (concurrent in-flight is still bounded by maxConcurrentAgents)."}),scriptDeadlineMs:O.optional(O.Number).annotate({description:"Wall-clock budget for a whole workflow script, in milliseconds. Default 12h. The sandbox interrupt handler enforces this as a hard kill-switch."})})).annotate({description:"Dynamic workflow runtime settings."})}),E5=w0(sr).strict().meta({ref:"Config"});var ar=E0.create({service:"config"}),tr=I5.Server.zod,er=P5.Layout.zod;class Z4 extends S1.Service()("@qitqode/Config"){}var $a=j1.create("ConfigDirectoryTypoError",P.object({path:P.string(),dir:P.string(),suggestion:P.string()})),Mw=T0.effect(Z4,L.gen(function*(){let $=yield*C$.Service,Z=yield*k8.Service,J=yield*o7.Service,Y=yield*l6.Service,X=yield*j6.Service,{readConfigFile:Q,loadConfig:G,loadFile:W}=MN({fs:$,info:E5}),K=wN(W),[V,U]=yield*L.cachedInvalidateWithTTL(K().pipe(L.tapError((C)=>L.sync(()=>ar.error("failed to load global config, using defaults",{error:String(C)}))),L.orElseSucceed(()=>({}))),Z8.infinity),H=L.fn("Config.getGlobal")(function*(){return yield*V}),{loadInstanceState:B}=Kw({fs:$,authSvc:Z,accountSvc:J,env:Y,npmSvc:X,info:E5,readConfigFile:Q,loadConfig:G,loadFile:W,getGlobal:H}),z=yield*B0.make(L.fn("Config.state")(function*(C){return yield*B(C).pipe(L.orDie)})),F=L.fn("Config.get")(function*(){return yield*B0.use(z,(C)=>C.config)}),A=L.fn("Config.directories")(function*(){return yield*B0.use(z,(C)=>C.directories)}),j=L.fn("Config.getConsoleState")(function*(){return yield*B0.use(z,(C)=>C.consoleState)}),N=L.fn("Config.waitForDependencies")(function*(){yield*B0.useEffect(z,(C)=>L.forEach(C.deps,jw.join,{concurrency:"unbounded"}).pipe(L.asVoid))}),w=L.fn("Config.update")(function*(C){let R=yield*B0.directory,T=rr.join(R,"config.json"),I=yield*W(T);yield*$.writeFileString(T,JSON.stringify(N1(s7(I),s7(C)),null,2)).pipe(L.orDie),yield*L.promise(()=>S8.dispose())}),q=L.fn("Config.invalidate")(function*(C){yield*U;let R=S8.disposeAll().catch(()=>{return}).finally(()=>L7.emit("event",{directory:"global",payload:{type:JN.Disposed.type,properties:{}}}));if(C)yield*L.promise(()=>R)}),M=L.fn("Config.updateGlobal")(function*(C){let R=yield*L.promise(()=>qN()),T=(yield*Q(R))??"{}",I;if(!R.endsWith(".jsonc")){let _=a8.schema(E5,a8.jsonc(T,R),R),E=N1(s7(_),s7(C));yield*$.writeFileString(R,JSON.stringify(E,null,2)).pipe(L.orDie),I=E}else{let _=eV(T,s7(C));I=a8.schema(E5,a8.jsonc(_,R),R),yield*$.writeFileString(R,_).pipe(L.orDie)}return yield*q(),I});return Z4.of({get:F,getGlobal:H,getConsoleState:j,update:w,updateGlobal:M,invalidate:q,directories:A,waitForDependencies:N})})),Za=Mw.pipe(T0.provide(Nw.defaultLayer),T0.provide(C$.defaultLayer),T0.provide(l6.defaultLayer),T0.provide(k8.defaultLayer),T0.provide(o7.defaultLayer),T0.provide(j6.defaultLayer));var XX={};F1(XX,{report:()=>Ja,pretty:()=>ww,Diagnostic:()=>XX});var Dw=20;function ww($){let J={1:"ERROR",2:"WARN",3:"INFO",4:"HINT"}[$.severity||1],Y=$.range.start.line+1,X=$.range.start.character+1;return`${J} [${Y}:${X}] ${$.message}`}function Ja($,Z){let J=Z.filter((G)=>G.severity===1);if(J.length===0)return"";let Y=J.slice(0,Dw),X=J.length-Dw,Q=X>0?`
|
|
490
|
+
... and ${X} more`:"";return`<diagnostics file="${$}">
|
|
491
|
+
${Y.map(ww).join(`
|
|
492
|
+
`)}${Q}
|
|
493
|
+
</diagnostics>`}var n6=E0.create({service:"lsp"}),Rw={Updated:L1.define("lsp.updated",P.object({}))},J4=P.object({start:P.object({line:P.number(),character:P.number()}),end:P.object({line:P.number(),character:P.number()})}).meta({ref:"Range"}),Xa=P.object({name:P.string(),kind:P.number(),location:P.object({uri:P.string(),range:J4})}).meta({ref:"Symbol"}),Qa=P.object({name:P.string(),detail:P.string().optional(),kind:P.number(),range:J4,selectionRange:J4}).meta({ref:"DocumentSymbol"}),Ga=P.object({id:P.string(),name:P.string(),root:P.string(),status:P.union([P.literal("connected"),P.literal("error")])}).meta({ref:"LSPStatus"});var Wa=[5,12,6,11,13,14,23,10],Ka=($)=>{if(b0.QITQODE_EXPERIMENTAL_LSP_TY){if($.pyright)n6.info("LSP server pyright is disabled because QITQODE_EXPERIMENTAL_LSP_TY is enabled"),delete $.pyright}else if($.ty)delete $.ty};class Y4 extends S1.Service()("@qitqode/LSP"){}var Pw=T0.effect(Y4,L.gen(function*(){let $=yield*X8.Service,Z=yield*B0.make(L.fn("LSP.state")(function*(R){let T=yield*$.get(),I={};if(!T.lsp)n6.info("all LSPs are disabled");else{for(let E of Object.values(f7))I[E.id]=E;if(Ka(I),T.lsp!==!0)for(let[E,f]of Object.entries(T.lsp)){let b=I[E];if(f.disabled){n6.info(`LSP server ${E} is disabled`),delete I[E];continue}I[E]={...b,id:E,root:b?.root??(async(y,k)=>k.directory),extensions:f.extensions??b?.extensions??[],spawn:async(y)=>({process:Z1(f.command[0],f.command.slice(1),{cwd:y,env:{...o8(),...f.env}}),initialization:f.initialization})}}n6.info("enabled LSP servers",{serverIds:Object.values(I).map((E)=>E.id).join(", ")})}let _={clients:[],servers:I,broken:new Set,spawning:new Map};return yield*L.addFinalizer(()=>L.promise(async()=>{await Promise.all(_.clients.map((E)=>E.shutdown()))})),_}));async function J(R,T,I,_=!1){let E=Lw.parse(R).ext||R,f=[];for(let b of Object.values(I.servers)){if(b.extensions.length&&!b.extensions.includes(E))continue;let y=await b.root(R,T);if(!y)continue;if(I.broken.has(y+b.id))continue;if(f.push({server:b,root:y}),_)break}return f}let Y=L.fnUntraced(function*(R){let T=yield*B0.context;if(!C$.contains(T.directory,R)&&(T.worktree==="/"||!C$.contains(T.worktree,R)))return[];let I=yield*B0.get(Z);return yield*L.promise(async()=>{let _=[];async function E(f,b,y){let k=await f.spawn(b,T).then((p)=>{if(!p)I.broken.add(y);return p}).catch((p)=>{I.broken.add(y),n6.error(`Failed to spawn LSP server ${f.id}`,{error:p});return});if(!k)return;n6.info("spawned lsp server",{serverID:f.id,root:b});let g=await Hj({serverID:f.id,server:k,root:b,directory:T.directory}).catch(async(p)=>{I.broken.add(y),await f1.stop(k.process),n6.error(`Failed to initialize LSP client ${f.id}`,{error:p});return});if(!g)return;let d=I.clients.find((p)=>p.root===b&&p.serverID===f.id);if(d)return await f1.stop(k.process),d;return I.clients.push(g),g}for(let{server:f,root:b}of await J(R,T,I)){let y=I.clients.find((p)=>p.root===b&&p.serverID===f.id);if(y){_.push(y);continue}let k=I.spawning.get(b+f.id);if(k){let p=await k;if(!p)continue;_.push(p);continue}let g=E(f,b,b+f.id);I.spawning.set(b+f.id,g),g.finally(()=>{if(I.spawning.get(b+f.id)===g)I.spawning.delete(b+f.id)});let d=await g;if(!d)continue;_.push(d),l1.publish(Rw.Updated,{})}return _})}),X=L.fnUntraced(function*(R,T){let I=yield*Y(R);return yield*L.promise(()=>Promise.all(I.map((_)=>T(_))))}),Q=L.fnUntraced(function*(R){let T=yield*B0.get(Z);return yield*L.promise(()=>Promise.all(T.clients.map((I)=>R(I))))}),G=L.fn("LSP.init")(function*(){yield*B0.get(Z)}),W=L.fn("LSP.status")(function*(){let R=yield*B0.context,T=yield*B0.get(Z),I=[];for(let _ of T.clients)I.push({id:_.serverID,name:T.servers[_.serverID].id,root:Lw.relative(R.directory,_.root),status:"connected"});return I}),K=L.fn("LSP.hasClients")(function*(R){let T=yield*B0.context,I=yield*B0.get(Z);return yield*L.promise(async()=>{return(await J(R,T,I,!0)).length>0})}),V=L.fn("LSP.touchFile")(function*(R,T){n6.info("touching file",{file:R});let I=yield*Y(R);yield*L.promise(()=>Promise.all(I.map(async(_)=>{let E=T?_.waitForDiagnostics({path:R}):Promise.resolve();return await _.notify.open({path:R}),E})).catch((_)=>{n6.error("failed to touch file",{err:_,file:R})}))}),U=L.fn("LSP.diagnostics")(function*(){let R={},T=yield*Q(async(I)=>I.diagnostics);for(let I of T)for(let[_,E]of I.entries()){let f=R[_]||[];f.push(...E),R[_]=f}return R}),H=L.fnUntraced(function*(R,T,I,_){return yield*X(R.file,(E)=>E.connection.sendRequest(T,{textDocument:{uri:Tw(R.file).href},position:{line:R.line,character:R.character},..._}).catch(()=>I))}),B=L.fn("LSP.hover")(function*(R){return yield*H(R,"textDocument/hover",null)}),z=L.fn("LSP.definition")(function*(R){return(yield*H(R,"textDocument/definition",null)).flat().filter(Boolean)}),F=L.fn("LSP.references")(function*(R){return(yield*H(R,"textDocument/references",[],{context:{includeDeclaration:!0}})).flat().filter(Boolean)}),A=L.fn("LSP.implementation")(function*(R){return(yield*H(R,"textDocument/implementation",null)).flat().filter(Boolean)}),j=L.fn("LSP.documentSymbol")(function*(R){let T=Ya(R);return(yield*X(T,(_)=>_.connection.sendRequest("textDocument/documentSymbol",{textDocument:{uri:R}}).catch(()=>[]))).flat().filter(Boolean)}),N=L.fn("LSP.workspaceSymbol")(function*(R){return(yield*Q((I)=>I.connection.sendRequest("workspace/symbol",{query:R}).then((_)=>_.filter((E)=>Wa.includes(E.kind)).slice(0,10)).catch(()=>[]))).flat()}),w=L.fn("LSP.prepareCallHierarchy")(function*(R){return(yield*H(R,"textDocument/prepareCallHierarchy",[])).flat().filter(Boolean)}),q=L.fnUntraced(function*(R,T){return(yield*X(R.file,async(_)=>{let E=await _.connection.sendRequest("textDocument/prepareCallHierarchy",{textDocument:{uri:Tw(R.file).href},position:{line:R.line,character:R.character}}).catch(()=>[]);if(!E?.length)return[];return _.connection.sendRequest(T,{item:E[0]}).catch(()=>[])})).flat().filter(Boolean)}),M=L.fn("LSP.incomingCalls")(function*(R){return yield*q(R,"callHierarchy/incomingCalls")}),C=L.fn("LSP.outgoingCalls")(function*(R){return yield*q(R,"callHierarchy/outgoingCalls")});return Y4.of({init:G,status:W,hasClients:K,touchFile:V,diagnostics:U,hover:B,definition:z,references:F,implementation:A,documentSymbol:j,workspaceSymbol:N,prepareCallHierarchy:w,incomingCalls:M,outgoingCalls:C})})),Va=Pw.pipe(T0.provide(X8.defaultLayer));var vZ={};F1(vZ,{layer:()=>uw,defaultLayer:()=>ja,Snapshot:()=>vZ,Service:()=>K4,Patch:()=>Aa,FileDiff:()=>Oa});class Q4{diff($,Z,J={}){let Y;if(typeof J==="function")Y=J,J={};else if("callback"in J)Y=J.callback;let X=this.castInput($,J),Q=this.castInput(Z,J),G=this.removeEmpty(this.tokenize(X,J)),W=this.removeEmpty(this.tokenize(Q,J));return this.diffWithOptionsObj(G,W,J,Y)}diffWithOptionsObj($,Z,J,Y){var X;let Q=(N)=>{if(N=this.postProcess(N,J),Y){setTimeout(function(){Y(N)},0);return}else return N},G=Z.length,W=$.length,K=1,V=G+W;if(J.maxEditLength!=null)V=Math.min(V,J.maxEditLength);let U=(X=J.timeout)!==null&&X!==void 0?X:1/0,H=Date.now()+U,B=[{oldPos:-1,lastComponent:void 0}],z=this.extractCommon(B[0],Z,$,0,J);if(B[0].oldPos+1>=W&&z+1>=G)return Q(this.buildValues(B[0].lastComponent,Z,$));let F=-1/0,A=1/0,j=()=>{for(let N=Math.max(F,-K);N<=Math.min(A,K);N+=2){let w,q=B[N-1],M=B[N+1];if(q)B[N-1]=void 0;let C=!1;if(M){let T=M.oldPos-N;C=M&&0<=T&&T<G}let R=q&&q.oldPos+1<W;if(!C&&!R){B[N]=void 0;continue}if(!R||C&&q.oldPos<M.oldPos)w=this.addToPath(M,!0,!1,0,J);else w=this.addToPath(q,!1,!0,1,J);if(z=this.extractCommon(w,Z,$,N,J),w.oldPos+1>=W&&z+1>=G)return Q(this.buildValues(w.lastComponent,Z,$))||!0;else{if(B[N]=w,w.oldPos+1>=W)A=Math.min(A,N-1);if(z+1>=G)F=Math.max(F,N+1)}}K++};if(Y)(function N(){setTimeout(function(){if(K>V||Date.now()>H)return Y(void 0);if(!j())N()},0)})();else while(K<=V&&Date.now()<=H){let N=j();if(N)return N}}addToPath($,Z,J,Y,X){let Q=$.lastComponent;if(Q&&!X.oneChangePerToken&&Q.added===Z&&Q.removed===J)return{oldPos:$.oldPos+Y,lastComponent:{count:Q.count+1,added:Z,removed:J,previousComponent:Q.previousComponent}};else return{oldPos:$.oldPos+Y,lastComponent:{count:1,added:Z,removed:J,previousComponent:Q}}}extractCommon($,Z,J,Y,X){let Q=Z.length,G=J.length,W=$.oldPos,K=W-Y,V=0;while(K+1<Q&&W+1<G&&this.equals(J[W+1],Z[K+1],X))if(K++,W++,V++,X.oneChangePerToken)$.lastComponent={count:1,previousComponent:$.lastComponent,added:!1,removed:!1};if(V&&!X.oneChangePerToken)$.lastComponent={count:V,previousComponent:$.lastComponent,added:!1,removed:!1};return $.oldPos=W,K}equals($,Z,J){if(J.comparator)return J.comparator($,Z);else return $===Z||!!J.ignoreCase&&$.toLowerCase()===Z.toLowerCase()}removeEmpty($){let Z=[];for(let J=0;J<$.length;J++)if($[J])Z.push($[J]);return Z}castInput($,Z){return $}tokenize($,Z){return Array.from($)}join($){return $.join("")}postProcess($,Z){return $}get useLongestToken(){return!1}buildValues($,Z,J){let Y=[],X;while($)Y.push($),X=$.previousComponent,delete $.previousComponent,$=X;Y.reverse();let Q=Y.length,G=0,W=0,K=0;for(;G<Q;G++){let V=Y[G];if(!V.removed){if(!V.added&&this.useLongestToken){let U=Z.slice(W,W+V.count);U=U.map(function(H,B){let z=J[K+B];return z.length>H.length?z:H}),V.value=this.join(U)}else V.value=this.join(Z.slice(W,W+V.count));if(W+=V.count,!V.added)K+=V.count}else V.value=this.join(J.slice(K,K+V.count)),K+=V.count}return Y}}class Iw extends Q4{constructor(){super(...arguments);this.tokenize=Ua}equals($,Z,J){if(J.ignoreWhitespace){if(!J.newlineIsToken||!$.includes(`
|
|
494
|
+
`))$=$.trim();if(!J.newlineIsToken||!Z.includes(`
|
|
495
|
+
`))Z=Z.trim()}else if(J.ignoreNewlineAtEof&&!J.newlineIsToken){if($.endsWith(`
|
|
496
|
+
`))$=$.slice(0,-1);if(Z.endsWith(`
|
|
497
|
+
`))Z=Z.slice(0,-1)}return super.equals($,Z,J)}}var Cw=new Iw;function G4($,Z,J){return Cw.diff($,Z,J)}function Ua($,Z){if(Z.stripTrailingCr)$=$.replace(/\r\n/g,`
|
|
498
|
+
`);let J=[],Y=$.split(/(\n|\r\n)/);if(!Y[Y.length-1])Y.pop();for(let X=0;X<Y.length;X++){let Q=Y[X];if(X%2&&!Z.newlineIsToken)J[J.length-1]+=Q;else J.push(Q)}return J}function Ew($){return $.includes(`\r
|
|
499
|
+
`)&&!$.startsWith(`
|
|
500
|
+
`)&&!$.match(/[^\r]\n/)}function bw($){return!$.includes(`\r
|
|
501
|
+
`)&&$.includes(`
|
|
502
|
+
`)}function fU($){if(Array.isArray($))return $.map((Z)=>fU(Z));return Object.assign(Object.assign({},$),{hunks:$.hunks.map((Z)=>Object.assign(Object.assign({},Z),{lines:Z.lines.map((J,Y)=>{var X;return J.startsWith("\\")||J.endsWith("\r")||((X=Z.lines[Y+1])===null||X===void 0?void 0:X.startsWith("\\"))?J:J+"\r"})}))})}function kU($){if(Array.isArray($))return $.map((Z)=>kU(Z));return Object.assign(Object.assign({},$),{hunks:$.hunks.map((Z)=>Object.assign(Object.assign({},Z),{lines:Z.lines.map((J)=>J.endsWith("\r")?J.substring(0,J.length-1):J)}))})}function _w($){if(!Array.isArray($))$=[$];return!$.some((Z)=>Z.hunks.some((J)=>J.lines.some((Y)=>!Y.startsWith("\\")&&Y.endsWith("\r"))))}function Sw($){if(!Array.isArray($))$=[$];return $.some((Z)=>Z.hunks.some((J)=>J.lines.some((Y)=>Y.endsWith("\r"))))&&$.every((Z)=>Z.hunks.every((J)=>J.lines.every((Y,X)=>{var Q;return Y.startsWith("\\")||Y.endsWith("\r")||((Q=J.lines[X+1])===null||Q===void 0?void 0:Q.startsWith("\\"))})))}function vU($){let Z=$.split(/\n/),J=[],Y=0;function X(){let W={};J.push(W);while(Y<Z.length){let K=Z[Y];if(/^(---|\+\+\+|@@)\s/.test(K))break;let V=/^(?:Index:|diff(?: -r \w+)+)\s+/.exec(K);if(V)W.index=K.substring(V[0].length).trim();Y++}Q(W),Q(W),W.hunks=[];while(Y<Z.length){let K=Z[Y];if(/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/.test(K))break;else if(/^@@/.test(K))W.hunks.push(G());else if(K)throw Error("Unknown line "+(Y+1)+" "+JSON.stringify(K));else Y++}}function Q(W){let K=/^(---|\+\+\+)\s+/.exec(Z[Y]);if(K){let V=K[1],U=Z[Y].substring(3).trim().split("\t",2),H=(U[1]||"").trim(),B=U[0].replace(/\\\\/g,"\\");if(B.startsWith('"')&&B.endsWith('"'))B=B.substr(1,B.length-2);if(V==="---")W.oldFileName=B,W.oldHeader=H;else W.newFileName=B,W.newHeader=H;Y++}}function G(){var W;let K=Y,V=Z[Y++],U=V.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/),H={oldStart:+U[1],oldLines:typeof U[2]>"u"?1:+U[2],newStart:+U[3],newLines:typeof U[4]>"u"?1:+U[4],lines:[]};if(H.oldLines===0)H.oldStart+=1;if(H.newLines===0)H.newStart+=1;let B=0,z=0;for(;Y<Z.length&&(z<H.oldLines||B<H.newLines||((W=Z[Y])===null||W===void 0?void 0:W.startsWith("\\")));Y++){let F=Z[Y].length==0&&Y!=Z.length-1?" ":Z[Y][0];if(F==="+"||F==="-"||F===" "||F==="\\"){if(H.lines.push(Z[Y]),F==="+")B++;else if(F==="-")z++;else if(F===" ")B++,z++}else throw Error(`Hunk at line ${K+1} contained invalid line ${Z[Y]}`)}if(!B&&H.newLines===1)H.newLines=0;if(!z&&H.oldLines===1)H.oldLines=0;if(B!==H.newLines)throw Error("Added line count did not match for hunk at line "+(K+1));if(z!==H.oldLines)throw Error("Removed line count did not match for hunk at line "+(K+1));return H}while(Y<Z.length)X();return J}function yU($,Z,J){let Y=!0,X=!1,Q=!1,G=1;return function W(){if(Y&&!Q){if(X)G++;else Y=!1;if($+G<=J)return $+G;Q=!0}if(!X){if(!Q)Y=!0;if(Z<=$-G)return $-G++;return X=!0,W()}return}}function Ha($,Z,J={}){let Y;if(typeof Z==="string")Y=vU(Z);else if(Array.isArray(Z))Y=Z;else Y=[Z];if(Y.length>1)throw Error("applyPatch only works with a single input.");return Ba($,Y[0],J)}function Ba($,Z,J={}){if(J.autoConvertLineEndings||J.autoConvertLineEndings==null){if(Ew($)&&_w(Z))Z=fU(Z);else if(bw($)&&Sw(Z))Z=kU(Z)}let Y=$.split(`
|
|
503
|
+
`),X=Z.hunks,Q=J.compareLine||((F,A,j,N)=>A===N),G=J.fuzzFactor||0,W=0;if(G<0||!Number.isInteger(G))throw Error("fuzzFactor must be a non-negative integer");if(!X.length)return $;let K="",V=!1,U=!1;for(let F=0;F<X[X.length-1].lines.length;F++){let A=X[X.length-1].lines[F];if(A[0]=="\\"){if(K[0]=="+")V=!0;else if(K[0]=="-")U=!0}K=A}if(V){if(U){if(!G&&Y[Y.length-1]=="")return!1}else if(Y[Y.length-1]=="")Y.pop();else if(!G)return!1}else if(U){if(Y[Y.length-1]!="")Y.push("");else if(!G)return!1}function H(F,A,j,N=0,w=!0,q=[],M=0){let C=0,R=!1;for(;N<F.length;N++){let T=F[N],I=T.length>0?T[0]:" ",_=T.length>0?T.substr(1):T;if(I==="-")if(Q(A+1,Y[A],I,_))A++,C=0;else{if(!j||Y[A]==null)return null;return q[M]=Y[A],H(F,A+1,j-1,N,!1,q,M+1)}if(I==="+"){if(!w)return null;q[M]=_,M++,C=0,R=!0}if(I===" ")if(C++,q[M]=Y[A],Q(A+1,Y[A],I,_))M++,w=!0,R=!1,A++;else{if(R||!j)return null;return Y[A]&&(H(F,A+1,j-1,N+1,!1,q,M+1)||H(F,A+1,j-1,N,!1,q,M+1))||H(F,A,j-1,N+1,!1,q,M)}}return M-=C,A-=C,q.length=M,{patchedLines:q,oldLineLastI:A-1}}let B=[],z=0;for(let F=0;F<X.length;F++){let A=X[F],j,N=Y.length-A.oldLines+G,w;for(let q=0;q<=G;q++){w=A.oldStart+z-1;let M=yU(w,W,N);for(;w!==void 0;w=M())if(j=H(A.lines,w,q),j)break;if(j)break}if(!j)return!1;for(let q=W;q<w;q++)B.push(Y[q]);for(let q=0;q<j.patchedLines.length;q++){let M=j.patchedLines[q];B.push(M)}W=j.oldLineLastI+1,z=w+1-A.oldStart}for(let F=W;F<Y.length;F++)B.push(Y[F]);return B.join(`
|
|
504
|
+
`)}var fw={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function QX($,Z,J,Y,X,Q,G){let W;if(!G)W={};else if(typeof G==="function")W={callback:G};else W=G;if(typeof W.context>"u")W.context=4;let K=W.context;if(W.newlineIsToken)throw Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(!W.callback)return V(G4(J,Y,W));else{let{callback:U}=W;G4(J,Y,Object.assign(Object.assign({},W),{callback:(H)=>{let B=V(H);U(B)}}))}function V(U){if(!U)return;U.push({value:"",lines:[]});function H(w){return w.map(function(q){return" "+q})}let B=[],z=0,F=0,A=[],j=1,N=1;for(let w=0;w<U.length;w++){let q=U[w],M=q.lines||Fa(q.value);if(q.lines=M,q.added||q.removed){if(!z){let C=U[w-1];if(z=j,F=N,C)A=K>0?H(C.lines.slice(-K)):[],z-=A.length,F-=A.length}for(let C of M)A.push((q.added?"+":"-")+C);if(q.added)N+=M.length;else j+=M.length}else{if(z)if(M.length<=K*2&&w<U.length-2)for(let C of H(M))A.push(C);else{let C=Math.min(M.length,K);for(let T of H(M.slice(0,C)))A.push(T);let R={oldStart:z,oldLines:j-z+C,newStart:F,newLines:N-F+C,lines:A};B.push(R),z=0,F=0,A=[]}j+=M.length,N+=M.length}}for(let w of B)for(let q=0;q<w.lines.length;q++)if(w.lines[q].endsWith(`
|
|
505
|
+
`))w.lines[q]=w.lines[q].slice(0,-1);else w.lines.splice(q+1,0,"\"),q++;return{oldFileName:$,newFileName:Z,oldHeader:X,newHeader:Q,hunks:B}}}function VJ($,Z){if(!Z)Z=fw;if(Array.isArray($)){if($.length>1&&!Z.includeFileHeaders)throw Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return $.map((Y)=>VJ(Y,Z)).join(`
|
|
506
|
+
`)}let J=[];if(Z.includeIndex&&$.oldFileName==$.newFileName)J.push("Index: "+$.oldFileName);if(Z.includeUnderline)J.push("===================================================================");if(Z.includeFileHeaders)J.push("--- "+$.oldFileName+(typeof $.oldHeader>"u"?"":"\t"+$.oldHeader)),J.push("+++ "+$.newFileName+(typeof $.newHeader>"u"?"":"\t"+$.newHeader));for(let Y=0;Y<$.hunks.length;Y++){let X=$.hunks[Y];if(X.oldLines===0)X.oldStart-=1;if(X.newLines===0)X.newStart-=1;J.push("@@ -"+X.oldStart+","+X.oldLines+" +"+X.newStart+","+X.newLines+" @@");for(let Q of X.lines)J.push(Q)}return J.join(`
|
|
507
|
+
`)+`
|
|
508
|
+
`}function za($,Z,J,Y,X,Q,G){if(typeof G==="function")G={callback:G};if(!(G===null||G===void 0?void 0:G.callback)){let W=QX($,Z,J,Y,X,Q,G);if(!W)return;return VJ(W,G===null||G===void 0?void 0:G.headerOptions)}else{let{callback:W}=G;QX($,Z,J,Y,X,Q,Object.assign(Object.assign({},G),{callback:(K)=>{if(!K)W(void 0);else W(VJ(K,G.headerOptions))}}))}}function Fa($){let Z=$.endsWith(`
|
|
509
|
+
`),J=$.split(`
|
|
510
|
+
`).map((Y)=>Y+`
|
|
511
|
+
`);if(Z)J.pop();else J.push(J.pop().slice(0,-1));return J}import b5 from"path";function kw($,Z){return $.pipe(L.catchCause(Z),L.repeat(W4.spaced(Z8.hours(1))),L.delay(Z8.minutes(1)),L.forkScoped)}var Aa=P.object({hash:P.string(),files:P.string().array()}),Oa=P.object({file:P.string(),patch:P.string(),additions:P.number(),deletions:P.number(),status:P.enum(["added","deleted","modified"]).optional()}).meta({ref:"SnapshotFileDiff"});var J$=E0.create({service:"snapshot"}),vw="7.days",qa=2097152,S5=["-c","core.longpaths=true","-c","core.symlinks=true"],kZ=["-c","core.autocrlf=false",...S5],_5=[...kZ,"-c","core.quotepath=false"];class K4 extends S1.Service()("@qitqode/Snapshot"){}var uw=T0.effect(K4,L.gen(function*(){let $=yield*C$.Service,Z=yield*xU.ChildProcessSpawner,J=yield*X8.Service,Y=new Map,X=(G)=>{let W=Y.get(G);if(W)return W;let K=xw.makeUnsafe(1);return Y.set(G,K),K},Q=yield*B0.make(L.fn("Snapshot.state")(function*(G){let W={directory:G.directory,worktree:G.worktree,gitdir:b5.join(F0.Path.data,"snapshot",G.project.id,V4.fast(G.worktree)),vcs:G.project.vcs},K=(k)=>["--git-dir",W.gitdir,"--work-tree",W.worktree,...k],V=new TextEncoder,U=(k)=>P$.make(V.encode(k.join("\x00")+"\x00")),H=L.fnUntraced(function*(k,g){let d=hU.make("git",k,{cwd:g?.cwd,env:g?.env,extendEnv:!0,stdin:g?.stdin});return yield*gw(Z,d)},L.catch((k)=>L.succeed({code:xU.ExitCode(1),text:"",stderr:k instanceof Error?k.message:String(k)}))),B=L.fnUntraced(function*(k){if(!k.length)return new Set;let g=yield*H([..._5,"--git-dir",b5.join(W.worktree,".git"),"--work-tree",W.worktree,"check-ignore","--no-index","--stdin","-z"],{cwd:W.directory,stdin:U(k)});if(g.code!==0&&g.code!==1)return new Set;return new Set(g.text.split("\x00").filter(Boolean))}),z=L.fnUntraced(function*(k){if(!k.length)return;yield*H([...kZ,...K(["rm","--cached","-f","--ignore-unmatch","--pathspec-from-file=-","--pathspec-file-nul"])],{cwd:W.directory,stdin:U(k)})}),F=L.fnUntraced(function*(k){if(!k.length)return;let g=yield*H([...kZ,...K(["add","--all","--sparse","--pathspec-from-file=-","--pathspec-file-nul"])],{cwd:W.directory,stdin:U(k)});if(g.code===0)return;J$.warn("failed to add snapshot files",{exitCode:g.code,stderr:g.stderr})}),A=(k)=>$.exists(k).pipe(L.orDie),j=(k)=>$.readFileString(k).pipe(L.catch(()=>L.succeed(""))),N=(k)=>$.remove(k).pipe(L.catch(()=>L.void)),w=(k)=>X(W.gitdir).withPermits(1)(k),q=L.fnUntraced(function*(){if(W.vcs!=="git")return!1;return(yield*J.get()).snapshot!==!1}),M=L.fnUntraced(function*(){let g=(yield*H(["rev-parse","--path-format=absolute","--git-path","info/exclude"],{cwd:W.worktree})).text.trim();if(!g)return;if(!(yield*A(g)))return;return g}),C=L.fnUntraced(function*(k=[]){let g=yield*M(),d=b5.join(W.gitdir,"info","exclude"),p=[g?(yield*j(g)).trimEnd():"",...k.map((t)=>`/${t.replaceAll("\\","/")}`)].filter(Boolean).join(`
|
|
512
|
+
`);yield*$.ensureDir(b5.join(W.gitdir,"info")).pipe(L.orDie),yield*$.writeFileString(d,p?`${p}
|
|
513
|
+
`:"").pipe(L.orDie)}),R=L.fnUntraced(function*(){yield*C();let[k,g]=yield*L.all([H([..._5,...K(["diff-files","--name-only","-z","--","."])],{cwd:W.directory}),H([..._5,...K(["ls-files","--others","--exclude-standard","-z","--","."])],{cwd:W.directory})],{concurrency:2});if(k.code!==0||g.code!==0){J$.warn("failed to list snapshot files",{diffCode:k.code,diffStderr:k.stderr,otherCode:g.code,otherStderr:g.stderr});return}let d=k.text.split("\x00").filter(Boolean),p=g.text.split("\x00").filter(Boolean),t=Array.from(new Set([...d,...p]));if(!t.length)return;let r=yield*B(t);if(r.size>0){let u=Array.from(r);J$.info("removing gitignored files from snapshot",{count:u.length}),yield*z(u)}let G0=t.filter((u)=>!r.has(u));if(!G0.length)return;let O0=new Set((yield*L.all(G0.map((u)=>$.stat(b5.join(W.directory,u)).pipe(L.catch(()=>L.void)).pipe(L.map((l)=>{if(!l||l.type!=="File")return;return(typeof l.size==="bigint"?Number(l.size):l.size)>qa?u:void 0}))),{concurrency:8})).filter((u)=>Boolean(u))),h0=new Set(p.filter((u)=>O0.has(u)));yield*C(Array.from(h0)),yield*F(G0.filter((u)=>!h0.has(u)))}),T=L.fnUntraced(function*(){return yield*w(L.gen(function*(){if(!(yield*q()))return;if(!(yield*A(W.gitdir)))return;let k=yield*H(K(["gc",`--prune=${vw}`]),{cwd:W.directory});if(k.code!==0){J$.warn("cleanup failed",{exitCode:k.code,stderr:k.stderr});return}J$.info("cleanup",{prune:vw})}))}),I=L.fnUntraced(function*(){return yield*w(L.gen(function*(){if(!(yield*q()))return;let k=yield*A(W.gitdir);if(yield*$.ensureDir(W.gitdir).pipe(L.orDie),!k)yield*H(["init"],{env:{GIT_DIR:W.gitdir,GIT_WORK_TREE:W.worktree}}),yield*H(["--git-dir",W.gitdir,"config","core.autocrlf","false"]),yield*H(["--git-dir",W.gitdir,"config","core.longpaths","true"]),yield*H(["--git-dir",W.gitdir,"config","core.symlinks","true"]),yield*H(["--git-dir",W.gitdir,"config","core.fsmonitor","false"]),J$.info("initialized");yield*R();let d=(yield*H(K(["write-tree"]),{cwd:W.directory})).text.trim();return J$.info("tracking",{hash:d,cwd:W.directory,git:W.gitdir}),d}))}),_=L.fnUntraced(function*(k){return yield*w(L.gen(function*(){yield*R();let g=yield*H([..._5,...K(["diff","--cached","--no-ext-diff","--name-only",k,"--","."])],{cwd:W.directory});if(g.code!==0)return J$.warn("failed to get diff",{hash:k,exitCode:g.code}),{hash:k,files:[]};let d=g.text.trim().split(`
|
|
514
|
+
`).map((t)=>t.trim()).filter(Boolean),p=yield*B(d);return{hash:k,files:d.filter((t)=>!p.has(t)).map((t)=>b5.join(W.worktree,t).replaceAll("\\","/"))}}))}),E=L.fnUntraced(function*(k){return yield*w(L.gen(function*(){J$.info("restore",{commit:k});let g=yield*H([...S5,...K(["read-tree",k])],{cwd:W.worktree});if(g.code===0){let d=yield*H([...S5,...K(["checkout-index","-a","-f"])],{cwd:W.worktree});if(d.code===0)return;J$.error("failed to restore snapshot",{snapshot:k,exitCode:d.code,stderr:d.stderr});return}J$.error("failed to restore snapshot",{snapshot:k,exitCode:g.code,stderr:g.stderr})}))}),f=L.fnUntraced(function*(k){return yield*w(L.gen(function*(){let g=[],d=new Set;for(let r of k)for(let G0 of r.files){if(d.has(G0))continue;d.add(G0),g.push({hash:r.hash,file:G0,rel:b5.relative(W.worktree,G0).replaceAll("\\","/")})}let p=L.fnUntraced(function*(r){if(J$.info("reverting",{file:r.file,hash:r.hash}),(yield*H([...S5,...K(["checkout",r.hash,"--",r.file])],{cwd:W.worktree})).code===0)return;let O0=yield*H([...S5,...K(["ls-tree",r.hash,"--",r.rel])],{cwd:W.worktree});if(O0.code===0&&O0.text.trim()){J$.info("file existed in snapshot but checkout failed, keeping",{file:r.file,hash:r.hash});return}J$.info("file did not exist in snapshot, deleting",{file:r.file,hash:r.hash}),yield*N(r.file)}),t=(r,G0)=>r===G0||r.startsWith(`${G0}/`)||G0.startsWith(`${r}/`);for(let r=0;r<g.length;){let G0=g[r],O0=[G0],h0=r+1;while(h0<g.length&&O0.length<100){let v=g[h0];if(v.hash!==G0.hash)break;if(O0.some((h)=>t(h.rel,v.rel)))break;O0.push(v),h0+=1}if(O0.length===1){yield*p(G0),r=h0;continue}let u=yield*H([...S5,...K(["ls-tree","--name-only",G0.hash,"--",...O0.map((v)=>v.rel)])],{cwd:W.worktree});if(u.code!==0){J$.info("batched ls-tree failed, falling back to single-file revert",{hash:G0.hash,files:O0.length});for(let v of O0)yield*p(v);r=h0;continue}let l=new Set(u.text.trim().split(`
|
|
515
|
+
`).map((v)=>v.trim()).filter(Boolean)),$0=O0.filter((v)=>l.has(v.rel));if($0.length){if(J$.info("reverting",{hash:G0.hash,files:$0.length}),(yield*H([...S5,...K(["checkout",G0.hash,"--",...$0.map((h)=>h.file)])],{cwd:W.worktree})).code!==0){J$.info("batched checkout failed, falling back to single-file revert",{hash:G0.hash,files:$0.length});for(let h of O0)yield*p(h);r=h0;continue}}for(let v of O0){if(l.has(v.rel))continue;J$.info("file did not exist in snapshot, deleting",{file:v.file,hash:v.hash}),yield*N(v.file)}r=h0}}))}),b=L.fnUntraced(function*(k){return yield*w(L.gen(function*(){yield*R();let g=yield*H([..._5,...K(["diff","--cached","--no-ext-diff",k,"--","."])],{cwd:W.worktree});if(g.code!==0)return J$.warn("failed to get diff",{hash:k,exitCode:g.code,stderr:g.stderr}),"";return g.text.trim()}))}),y=L.fnUntraced(function*(k,g){return yield*w(L.gen(function*(){let d=L.fnUntraced(function*(v){if(v.binary)return["",""];if(v.status==="added")return["",yield*H([...kZ,...K(["show",`${g}:${v.file}`])]).pipe(L.map((h)=>h.text))];if(v.status==="deleted")return[yield*H([...kZ,...K(["show",`${k}:${v.file}`])]).pipe(L.map((h)=>h.text)),""];return yield*L.all([H([...kZ,...K(["show",`${k}:${v.file}`])]).pipe(L.map((h)=>h.text)),H([...kZ,...K(["show",`${g}:${v.file}`])]).pipe(L.map((h)=>h.text))],{concurrency:2})}),p=L.fnUntraced(function*(v){let h=v.flatMap((K0)=>{if(K0.binary)return[];if(K0.status==="added")return[{file:K0.file,side:"after",ref:`${g}:${K0.file}`}];if(K0.status==="deleted")return[{file:K0.file,side:"before",ref:`${k}:${K0.file}`}];return[{file:K0.file,side:"before",ref:`${k}:${K0.file}`},{file:K0.file,side:"after",ref:`${g}:${K0.file}`}]});if(!h.length)return new Map;let c=hU.make("git",[...kZ,...K(["cat-file","--batch"])],{cwd:W.directory,extendEnv:!0,stdin:P$.make(new TextEncoder().encode(h.map((K0)=>K0.ref).join(`
|
|
516
|
+
`)+`
|
|
517
|
+
`))}),m=yield*Z.spawn(c),[a,e]=yield*L.all([P$.mkUint8Array(m.stdout),P$.mkString(P$.decodeText(m.stderr))],{concurrency:2});if((yield*m.exitCode)!==0){J$.info("git cat-file --batch failed during snapshot diff, falling back to per-file git show",{stderr:e,refs:h.length});return}let A0=(K0,z0)=>{J$.info(K0,{...z0,refs:h.length});return},P0=new Map,s0=new TextDecoder,o=0;for(let K0 of h){let z0=o;while(z0<a.length&&a[z0]!==10)z0+=1;if(z0>=a.length)return A0("git cat-file --batch returned a truncated header during snapshot diff, falling back to per-file git show");let j0=s0.decode(a.slice(o,z0));o=z0+1;let Q1=P0.get(K0.file)??{before:"",after:""};if(j0.endsWith(" missing")){P0.set(K0.file,Q1);continue}let _0=j0.match(/^[0-9a-f]+ blob (\d+)$/);if(!_0)return A0("git cat-file --batch returned an unexpected header during snapshot diff, falling back to per-file git show",{head:j0});let e0=Number(_0[1]);if(!Number.isInteger(e0)||e0<0||o+e0>=a.length||a[o+e0]!==10)return A0("git cat-file --batch returned truncated content during snapshot diff, falling back to per-file git show",{head:j0});let S0=s0.decode(a.slice(o,o+e0));if(K0.side==="before")Q1.before=S0;if(K0.side==="after")Q1.after=S0;P0.set(K0.file,Q1),o+=e0+1}if(o!==a.length)return A0("git cat-file --batch returned trailing data during snapshot diff, falling back to per-file git show");return P0},L.scoped,L.catch(()=>L.succeed(void 0))),t=[],r=new Map,G0=yield*H([..._5,...K(["diff","--no-ext-diff","--name-status","--no-renames",k,g,"--","."])],{cwd:W.directory});for(let v of G0.text.trim().split(`
|
|
518
|
+
`)){if(!v)continue;let[h,c]=v.split("\t");if(!h||!c)continue;r.set(c,h.startsWith("A")?"added":h.startsWith("D")?"deleted":"modified")}let h0=(yield*H([..._5,...K(["diff","--no-ext-diff","--no-renames","--numstat",k,g,"--","."])],{cwd:W.directory})).text.trim().split(`
|
|
519
|
+
`).filter(Boolean).flatMap((v)=>{let[h,c,m]=v.split("\t");if(!m)return[];let a=h==="-"&&c==="-",e=a?0:parseInt(h),H0=a?0:parseInt(c);return[{file:m,status:r.get(m)??"modified",binary:a,additions:Number.isFinite(e)?e:0,deletions:Number.isFinite(H0)?H0:0}]}),u=yield*B(h0.map((v)=>v.file));if(u.size>0){let v=h0.filter((h)=>!u.has(h.file));h0.length=0,h0.push(...v)}let l=100,$0=(v,h,c)=>VJ(QX(v,v,h,c,"","",{context:Number.MAX_SAFE_INTEGER}));for(let v=0;v<h0.length;v+=l){let h=h0.slice(v,v+l),c=yield*p(h);for(let m of h){let a=c?.get(m.file)??{before:"",after:""},[e,H0]=m.binary?["",""]:c?[a.before,a.after]:yield*d(m);t.push({file:m.file,patch:m.binary?"":$0(m.file,e,H0),additions:m.additions,deletions:m.deletions,status:m.status})}}return t}))});return yield*kw(T(),(k)=>{return J$.error("cleanup loop failed",{cause:yw.pretty(k)}),L.void}),{cleanup:T,track:I,patch:_,restore:E,revert:f,diff:b,diffFull:y}}));return K4.of({init:L.fn("Snapshot.init")(function*(){yield*B0.get(Q)}),cleanup:L.fn("Snapshot.cleanup")(function*(){return yield*B0.useEffect(Q,(G)=>G.cleanup())}),track:L.fn("Snapshot.track")(function*(){return yield*B0.useEffect(Q,(G)=>G.track())}),patch:L.fn("Snapshot.patch")(function*(G){return yield*B0.useEffect(Q,(W)=>W.patch(G))}),restore:L.fn("Snapshot.restore")(function*(G){return yield*B0.useEffect(Q,(W)=>W.restore(G))}),revert:L.fn("Snapshot.revert")(function*(G){return yield*B0.useEffect(Q,(W)=>W.revert(G))}),diff:L.fn("Snapshot.diff")(function*(G){return yield*B0.useEffect(Q,(W)=>W.diff(G))}),diffFull:L.fn("Snapshot.diffFull")(function*(G,W){return yield*B0.useEffect(Q,(K)=>K.diffFull(G,W))})})})),ja=uw.pipe(T0.provide(hw),T0.provide(C$.defaultLayer),T0.provide(X8.defaultLayer));var Na=O.String.pipe(O.brand("ProviderID")),X1=Na.pipe(u0(($)=>({zod:P.string().pipe(P.custom()),opencode:$.make("opencode"),anthropic:$.make("anthropic"),openai:$.make("openai"),google:$.make("google"),googleVertex:$.make("google-vertex"),githubCopilot:$.make("github-copilot"),amazonBedrock:$.make("amazon-bedrock"),azure:$.make("azure"),openrouter:$.make("openrouter"),mistral:$.make("mistral"),gitlab:$.make("gitlab")}))),Ma=O.String.pipe(O.brand("ModelID")),s1=Ma.pipe(u0(($)=>({zod:P.string().pipe(P.custom())})));var mw=P.object({errorID:P.string(),errorName:P.string(),logFile:P.string()}).meta({ref:"ErrorDiagnostic"}),U4=j1.create("MessageOutputLengthError",P.object({})),f5=j1.create("MessageAbortedError",P.object({message:P.string()})),lw=j1.create("StructuredOutputError",P.object({message:P.string(),retries:P.number()})),H4=j1.create("ProviderAuthError",P.object({providerID:P.string(),message:P.string()})),T6=j1.create("APIError",P.object({message:P.string(),statusCode:P.number().optional(),isRetryable:P.boolean(),category:P.string().optional(),outputBudgetRecoveryAvailable:P.boolean().optional(),outputBudgetRecoveryTokens:P.number().int().positive().optional(),diagnostic:mw.optional(),responseHeaders:P.record(P.string(),P.string()).optional(),responseBody:P.string().optional(),metadata:P.record(P.string(),P.string()).optional()})),GX=j1.create("ContextOverflowError",P.object({message:P.string(),responseBody:P.string().optional()})),dw=j1.create("InvalidOutputError",P.object({message:P.string()})),pw=j1.create("ContentFilterError",P.object({message:P.string()})),cw=j1.create("ModelError",P.object({message:P.string()})),iw=P.object({type:P.literal("text")}).meta({ref:"OutputFormatText"}),nw=P.object({type:P.literal("json_schema"),schema:P.record(P.string(),P.any()).meta({ref:"JSONSchema"}),retryCount:P.number().int().min(0).default(2)}).meta({ref:"OutputFormatJsonSchema"}),ow=P.discriminatedUnion("type",[iw,nw]).meta({ref:"OutputFormat"}),R8=P.object({id:MZ.zod,sessionID:r0.zod,messageID:i1.zod}),sw=R8.extend({type:P.literal("snapshot"),snapshot:P.string()}).meta({ref:"SnapshotPart"}),rw=R8.extend({type:P.literal("patch"),hash:P.string(),files:P.string().array()}).meta({ref:"PatchPart"}),aw=R8.extend({type:P.literal("text"),text:P.string(),synthetic:P.boolean().optional(),ignored:P.boolean().optional(),time:P.object({start:P.number(),end:P.number().optional()}).optional(),metadata:P.record(P.string(),P.any()).optional()}).meta({ref:"TextPart"}),tw=R8.extend({type:P.literal("reasoning"),text:P.string(),metadata:P.record(P.string(),P.any()).optional(),time:P.object({start:P.number(),end:P.number().optional()})}).meta({ref:"ReasoningPart"}),gU=P.object({text:P.object({value:P.string(),start:P.number().int(),end:P.number().int()}).meta({ref:"FilePartSourceText"})}),ew=gU.extend({type:P.literal("file"),path:P.string()}).meta({ref:"FileSource"}),$L=gU.extend({type:P.literal("symbol"),path:P.string(),range:X4.Range,name:P.string(),kind:P.number().int()}).meta({ref:"SymbolSource"}),ZL=gU.extend({type:P.literal("resource"),clientName:P.string(),uri:P.string()}).meta({ref:"ResourceSource"}),JL=P.discriminatedUnion("type",[ew,$L,ZL]).meta({ref:"FilePartSource"}),uU=R8.extend({type:P.literal("file"),mime:P.string(),filename:P.string().optional(),url:P.string(),source:JL.optional()}).meta({ref:"FilePart"}),YL=R8.extend({type:P.literal("agent"),name:P.string(),source:P.object({value:P.string(),start:P.number().int(),end:P.number().int()}).optional()}).meta({ref:"AgentPart"}),XL=R8.extend({type:P.literal("checkpoint"),checkpointDir:P.string(),checkpointNumber:P.number(),coveredUpTo:i1.zod}).meta({ref:"CheckpointPart"}),QL=R8.extend({type:P.literal("subtask"),prompt:P.string(),description:P.string(),agent:P.string(),model:P.object({providerID:X1.zod,modelID:s1.zod}).optional(),command:P.string().optional()}).meta({ref:"SubtaskPart"}),GL=R8.extend({type:P.literal("compaction"),auto:P.boolean(),overflow:P.boolean().optional(),tail_start_id:i1.zod.optional()}).meta({ref:"CompactionPart"}),WL=R8.extend({type:P.literal("retry"),attempt:P.number(),error:T6.Schema,time:P.object({created:P.number()})}).meta({ref:"RetryPart"}),KL=R8.extend({type:P.literal("step-start"),snapshot:P.string().optional()}).meta({ref:"StepStartPart"}),VL=P.object({total:P.number().optional(),input:P.number(),output:P.number(),reasoning:P.number(),cache:P.object({read:P.number(),write:P.number()})}),UL=R8.extend({type:P.literal("step-finish"),reason:P.string(),snapshot:P.string().optional(),cost:P.number(),costCredits:P.number().optional(),tokens:VL,contextWindow:P.number().optional()}).meta({ref:"StepFinishPart"}),HL=P.object({status:P.literal("pending"),input:P.record(P.string(),P.any()),raw:P.string()}).meta({ref:"ToolStatePending"}),BL=P.object({status:P.literal("running"),input:P.record(P.string(),P.any()),title:P.string().optional(),metadata:P.record(P.string(),P.any()).optional(),time:P.object({start:P.number()})}).meta({ref:"ToolStateRunning"}),zL=P.object({status:P.literal("completed"),input:P.record(P.string(),P.any()),output:P.string(),title:P.string(),metadata:P.record(P.string(),P.any()),time:P.object({start:P.number(),end:P.number(),compacted:P.number().optional()}),attachments:uU.array().optional()}).meta({ref:"ToolStateCompleted"}),FL=P.object({status:P.literal("error"),input:P.record(P.string(),P.any()),error:P.string(),metadata:P.record(P.string(),P.any()).optional(),time:P.object({start:P.number(),end:P.number()})}).meta({ref:"ToolStateError"}),AL=P.discriminatedUnion("status",[HL,BL,zL,FL]).meta({ref:"ToolState"}),OL=R8.extend({type:P.literal("tool"),callID:P.string(),tool:P.string(),state:AL,metadata:P.record(P.string(),P.any()).optional()}).meta({ref:"ToolPart"}),qL=P.object({id:i1.zod,sessionID:r0.zod,agentID:P.string().optional()}),jL=P.object({hookPhase:P.enum(["pre","post"]),hookIteration:P.number().int().nonnegative(),pluginNames:P.array(P.string()),hookIDs:P.array(P.string())}).meta({ref:"Provenance"}),NL=qL.extend({role:P.literal("user"),time:P.object({created:P.number()}),format:ow.optional(),summary:P.object({title:P.string().optional(),body:P.string().optional(),diffs:vZ.FileDiff.array()}).optional(),agent:P.string(),model:P.object({providerID:X1.zod,modelID:s1.zod,variant:P.string().optional()}),system:P.string().optional(),tools:P.record(P.string(),P.boolean()).optional(),provenance:jL.optional(),outputBudgetRecoveryTokens:P.number().int().positive().optional()}).meta({ref:"UserMessage"}),mU=P.discriminatedUnion("type",[aw,QL,tw,uU,OL,KL,UL,sw,rw,YL,WL,XL,GL]).meta({ref:"Part"}),ML=qL.extend({role:P.literal("assistant"),time:P.object({created:P.number(),completed:P.number().optional()}),error:P.discriminatedUnion("name",[H4.Schema,j1.Unknown.Schema,U4.Schema,f5.Schema,lw.Schema,GX.Schema,dw.Schema,pw.Schema,cw.Schema,T6.Schema]).optional(),parentID:i1.zod,modelID:s1.zod,providerID:X1.zod,mode:P.string(),agent:P.string(),path:P.object({cwd:P.string(),root:P.string()}),summary:P.boolean().optional(),cost:P.number(),costCredits:P.number().optional(),tokens:VL,contextWindow:P.number().optional(),structured:P.any().optional(),variant:P.string().optional(),finish:P.string().optional()}).meta({ref:"AssistantMessage"}),lU=P.discriminatedUnion("role",[NL,ML]).meta({ref:"Message"}),Da={Updated:X$.define({type:"message.updated",version:1,aggregate:"sessionID",schema:P.object({sessionID:r0.zod,info:lU})}),Removed:X$.define({type:"message.removed",version:1,aggregate:"sessionID",schema:P.object({sessionID:r0.zod,messageID:i1.zod})}),PartUpdated:X$.define({type:"message.part.updated",version:1,aggregate:"sessionID",schema:P.object({sessionID:r0.zod,part:mU,time:P.number()})}),PartDelta:L1.define("message.part.delta",P.object({sessionID:r0.zod,messageID:i1.zod,partID:MZ.zod,field:P.string(),delta:P.string()})),PartRemoved:X$.define({type:"message.part.removed",version:1,aggregate:"sessionID",schema:P.object({sessionID:r0.zod,messageID:i1.zod,partID:MZ.zod})})},wa=P.object({info:lU,parts:P.array(mU)});var La=P.object({id:i1.zod,time:P.number()}),dU={encode($){return Buffer.from(JSON.stringify($)).toString("base64url")},decode($){return La.parse(JSON.parse(Buffer.from($,"base64url").toString("utf8")))}},wL=($)=>({...$.data,id:$.id,sessionID:$.session_id,agentID:$.agent_id}),LL=($)=>({...$.data,id:$.id,sessionID:$.session_id,messageID:$.message_id}),Ta=($)=>DL(WX(D$.time_created,$.time),O$(m0(D$.time_created,$.time),WX(D$.id,$.id)));function Ra($){let Z=$.map((Y)=>Y.id),J=new Map;if(Z.length>0){let Y=W1.use((X)=>X.select().from(P8).where(k5(P8.message_id,Z)).orderBy(P8.message_id,P8.id).all());for(let X of Y){let Q=LL(X),G=J.get(X.message_id);if(G)G.push(Q);else J.set(X.message_id,[Q])}}return $.map((Y)=>({info:wL(Y),parts:J.get(Y.id)??[]}))}function TL($){let Z=$.before?dU.decode($.before):void 0,J=$.agentID==="*"?void 0:m0(D$.agent_id,$.agentID??"main"),Y=O$(m0(D$.session_id,$.sessionID),...Z?[Ta(Z)]:[],...J?[J]:[]),X=W1.use((V)=>V.select().from(D$).where(Y).orderBy(o6(D$.time_created),o6(D$.id)).limit($.limit+1).all());if(X.length===0){if(!W1.use((U)=>U.select({id:I1.id}).from(I1).where(m0(I1.id,$.sessionID)).get()))throw new KX({message:`Session not found: ${$.sessionID}`});return{items:[],more:!1}}let Q=X.length>$.limit,G=Q?X.slice(0,$.limit):X,W=Ra(G);W.reverse();let K=G.at(-1);return{items:W,more:Q,cursor:Q&&K?dU.encode({id:K.id,time:K.time_created}):void 0}}function*pU($,Z){let Y;while(!0){let X=TL({sessionID:$,limit:50,before:Y,agentID:Z?.agentID});if(X.items.length===0)break;for(let Q=X.items.length-1;Q>=0;Q--)yield X.items[Q];if(!X.more||!X.cursor)break;Y=X.cursor}}function RL($){return W1.use((J)=>J.select().from(P8).where(m0(P8.message_id,$)).orderBy(P8.id).all()).map(LL)}function Pa($){let Z=W1.use((J)=>J.select().from(D$).where(O$(m0(D$.id,$.messageID),m0(D$.session_id,$.sessionID))).get());if(!Z)throw new KX({message:`Message not found: ${$.messageID}`});return{info:wL(Z),parts:RL($.messageID)}}function cU($){let Z=[];for(let J of $)if(Z.push(J),J.info.role==="user"&&J.parts.some((Y)=>Y.type==="checkpoint"||Y.type==="compaction"))break;return Z.reverse(),Z}var Ia=L.fnUntraced(function*($,Z){let J=cU(pU($,{agentID:Z?.agentID}));if(!Z?.contextFrom)return J;let Y=pU(Z.contextFrom,{agentID:"main"}),X=cU(Y);if(Z.contextWatermark){let Q=X.findIndex((G)=>G.info.id===Z.contextWatermark);if(Q>=0)return[...X.slice(0,Q+1),...J]}return[...X,...J]});var mT=m6(vL(),1),zJ=m6(vL(),1);var Ca=Object.defineProperty,Ea=($,Z)=>{for(var J in Z)Ca($,J,{get:Z[J],enumerable:!0})},cL="AI_InvalidArgumentError",iL=`vercel.ai.error.${cL}`,ba=Symbol.for(iL),nL,r1=class extends p0{constructor({parameter:$,value:Z,message:J}){super({name:cL,message:`Invalid argument for parameter ${$}: ${J}`});this[nL]=!0,this.parameter=$,this.value=Z}static isInstance($){return p0.hasMarker($,iL)}};nL=ba;var _a="AI_InvalidStreamPartError",Sa=`vercel.ai.error.${_a}`,fa=Symbol.for(Sa),ka;ka=fa;var oL="AI_InvalidToolApprovalError",sL=`vercel.ai.error.${oL}`,va=Symbol.for(sL),rL,ya=class extends p0{constructor({approvalId:$}){super({name:oL,message:`Tool approval response references unknown approvalId: "${$}". No matching tool-approval-request found in message history.`});this[rL]=!0,this.approvalId=$}static isInstance($){return p0.hasMarker($,sL)}};rL=va;var aL="AI_InvalidToolInputError",tL=`vercel.ai.error.${aL}`,xa=Symbol.for(tL),eL,GH=class extends p0{constructor({toolInput:$,toolName:Z,cause:J,message:Y=`Invalid input for tool ${Z}: ${r6(J)}`}){super({name:aL,message:Y,cause:J});this[eL]=!0,this.toolInput=$,this.toolName=Z}static isInstance($){return p0.hasMarker($,tL)}};eL=xa;var $T="AI_ToolCallNotFoundForApprovalError",ZT=`vercel.ai.error.${$T}`,ha=Symbol.for(ZT),JT,YT=class extends p0{constructor({toolCallId:$,approvalId:Z}){super({name:$T,message:`Tool call "${$}" not found for approval request "${Z}".`});this[JT]=!0,this.toolCallId=$,this.approvalId=Z}static isInstance($){return p0.hasMarker($,ZT)}};JT=ha;var XT="AI_MissingToolResultsError",QT=`vercel.ai.error.${XT}`,ga=Symbol.for(QT),GT,PL=class extends p0{constructor({toolCallIds:$}){super({name:XT,message:`Tool result${$.length>1?"s are":" is"} missing for tool call${$.length>1?"s":""} ${$.join(", ")}.`});this[GT]=!0,this.toolCallIds=$}static isInstance($){return p0.hasMarker($,QT)}};GT=ga;var ua="AI_NoImageGeneratedError",ma=`vercel.ai.error.${ua}`,la=Symbol.for(ma),da;da=la;var WT="AI_NoObjectGeneratedError",KT=`vercel.ai.error.${WT}`,pa=Symbol.for(KT),VT,C8=class extends p0{constructor({message:$="No object generated.",cause:Z,text:J,response:Y,usage:X,finishReason:Q}){super({name:WT,message:$,cause:Z});this[VT]=!0,this.text=J,this.response=Y,this.usage=X,this.finishReason=Q}static isInstance($){return p0.hasMarker($,KT)}};VT=pa;var UT="AI_NoOutputGeneratedError",HT=`vercel.ai.error.${UT}`,ca=Symbol.for(HT),BT,ia=class extends p0{constructor({message:$="No output generated.",cause:Z}={}){super({name:UT,message:$,cause:Z});this[BT]=!0}static isInstance($){return p0.hasMarker($,HT)}};BT=ca;var na="AI_NoSpeechGeneratedError",oa=`vercel.ai.error.${na}`,sa=Symbol.for(oa),ra;ra=sa;var aa="AI_NoTranscriptGeneratedError",ta=`vercel.ai.error.${aa}`,ea=Symbol.for(ta),$t;$t=ea;var Zt="AI_NoVideoGeneratedError",Jt=`vercel.ai.error.${Zt}`,Yt=Symbol.for(Jt),Xt;Xt=Yt;var zT="AI_NoSuchToolError",FT=`vercel.ai.error.${zT}`,Qt=Symbol.for(FT),AT,tU=class extends p0{constructor({toolName:$,availableTools:Z=void 0,message:J=`Model tried to call unavailable tool '${$}'. ${Z===void 0?"No tools are available.":`Available tools: ${Z.join(", ")}.`}`}){super({name:zT,message:J});this[AT]=!0,this.toolName=$,this.availableTools=Z}static isInstance($){return p0.hasMarker($,FT)}};AT=Qt;var OT="AI_ToolCallRepairError",qT=`vercel.ai.error.${OT}`,Gt=Symbol.for(qT),jT,Wt=class extends p0{constructor({cause:$,originalError:Z,message:J=`Error repairing tool call: ${r6($)}`}){super({name:OT,message:J,cause:$});this[jT]=!0,this.originalError=Z}static isInstance($){return p0.hasMarker($,qT)}};jT=Gt;var Kt=class extends p0{constructor($){super({name:"AI_UnsupportedModelVersionError",message:`Unsupported model version ${$.version} for provider "${$.provider}" and model "${$.modelId}". AI SDK 5 only supports models that implement specification version "v2".`});this.version=$.version,this.provider=$.provider,this.modelId=$.modelId}},NT="AI_UIMessageStreamError",MT=`vercel.ai.error.${NT}`,Vt=Symbol.for(MT),DT,UJ=class extends p0{constructor({chunkType:$,chunkId:Z,message:J}){super({name:NT,message:J});this[DT]=!0,this.chunkType=$,this.chunkId=Z}static isInstance($){return p0.hasMarker($,MT)}};DT=Vt;var Ut="AI_InvalidDataContentError",Ht=`vercel.ai.error.${Ut}`,Bt=Symbol.for(Ht),zt;zt=Bt;var wT="AI_InvalidMessageRoleError",LT=`vercel.ai.error.${wT}`,Ft=Symbol.for(LT),TT,At=class extends p0{constructor({role:$,message:Z=`Invalid message role: '${$}'. Must be one of: "system", "user", "assistant", "tool".`}){super({name:wT,message:Z});this[TT]=!0,this.role=$}static isInstance($){return p0.hasMarker($,LT)}};TT=Ft;var RT="AI_MessageConversionError",PT=`vercel.ai.error.${RT}`,Ot=Symbol.for(PT),IT,qt=class extends p0{constructor({originalMessage:$,message:Z}){super({name:RT,message:Z});this[IT]=!0,this.originalMessage=$}static isInstance($){return p0.hasMarker($,PT)}};IT=Ot;var CT="AI_RetryError",ET=`vercel.ai.error.${CT}`,jt=Symbol.for(ET),bT,O4=class extends p0{constructor({message:$,reason:Z,errors:J}){super({name:CT,message:$});this[bT]=!0,this.reason=Z,this.errors=J,this.lastError=J[J.length-1]}static isInstance($){return p0.hasMarker($,ET)}};bT=jt;function y5($){return $===void 0?[]:Array.isArray($)?$:[$]}async function v5($){for(let Z of y5($.callbacks)){if(Z==null)continue;try{await Z($.event)}catch(J){}}}function Nt({warning:$,provider:Z,model:J}){let Y=`AI SDK Warning (${Z} / ${J}):`;switch($.type){case"unsupported":{let X=`${Y} The feature "${$.feature}" is not supported.`;if($.details)X+=` ${$.details}`;return X}case"compatibility":{let X=`${Y} The feature "${$.feature}" is used in a compatibility mode.`;if($.details)X+=` ${$.details}`;return X}case"other":return`${Y} ${$.message}`;default:return`${Y} ${JSON.stringify($,null,2)}`}}var Mt="AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.",IL=!1,D4=($)=>{if($.warnings.length===0)return;let Z=globalThis.AI_SDK_LOG_WARNINGS;if(Z===!1)return;if(typeof Z==="function"){Z($);return}if(!IL)IL=!0,console.info(Mt);for(let J of $.warnings)console.warn(Nt({warning:J,provider:$.provider,model:$.model}))};function Dt({provider:$,modelId:Z}){D4({warnings:[{type:"compatibility",feature:"specificationVersion",details:"Using v2 specification compatibility mode. Some features may not be available."}],provider:$,model:Z})}function wt($){if($.specificationVersion==="v3")return $;return Dt({provider:$.provider,modelId:$.modelId}),new Proxy($,{get(Z,J){switch(J){case"specificationVersion":return"v3";case"doGenerate":return async(...Y)=>{let X=await Z.doGenerate(...Y);return{...X,finishReason:_T(X.finishReason),usage:ST(X.usage)}};case"doStream":return async(...Y)=>{let X=await Z.doStream(...Y);return{...X,stream:Lt(X.stream)}};default:return Z[J]}}})}function Lt($){return $.pipeThrough(new TransformStream({transform(Z,J){switch(Z.type){case"finish":J.enqueue({...Z,finishReason:_T(Z.finishReason),usage:ST(Z.usage)});break;default:J.enqueue(Z);break}}}))}function _T($){return{unified:$==="unknown"?"other":$,raw:void 0}}function ST($){return{inputTokens:{total:$.inputTokens,noCache:void 0,cacheRead:$.cachedInputTokens,cacheWrite:void 0},outputTokens:{total:$.outputTokens,text:void 0,reasoning:$.reasoningTokens}}}function w4($){if(typeof $!=="string"){if($.specificationVersion!=="v3"&&$.specificationVersion!=="v2"){let Z=$;throw new Kt({version:Z.specificationVersion,provider:Z.provider,modelId:Z.modelId})}return wt($)}return Tt().languageModel($)}function Tt(){var $;return($=globalThis.AI_SDK_DEFAULT_PROVIDER)!=null?$:pL}function fT($){if($==null)return;if(typeof $==="number")return $;return $.totalMs}function Rt($){if($==null||typeof $==="number")return;return $.stepMs}function Pt($){if($==null||typeof $==="number")return;return $.chunkMs}var It=[{mediaType:"image/gif",bytesPrefix:[71,73,70]},{mediaType:"image/png",bytesPrefix:[137,80,78,71]},{mediaType:"image/jpeg",bytesPrefix:[255,216]},{mediaType:"image/webp",bytesPrefix:[82,73,70,70,null,null,null,null,87,69,66,80]},{mediaType:"image/bmp",bytesPrefix:[66,77]},{mediaType:"image/tiff",bytesPrefix:[73,73,42,0]},{mediaType:"image/tiff",bytesPrefix:[77,77,0,42]},{mediaType:"image/avif",bytesPrefix:[0,0,0,32,102,116,121,112,97,118,105,102]},{mediaType:"image/heic",bytesPrefix:[0,0,0,32,102,116,121,112,104,101,105,99]}];var Ct=($)=>{let Z=typeof $==="string"?FJ($):$,J=(Z[6]&127)<<21|(Z[7]&127)<<14|(Z[8]&127)<<7|Z[9]&127;return Z.slice(J+10)};function Et($){return typeof $==="string"&&$.startsWith("SUQz")||typeof $!=="string"&&$.length>10&&$[0]===73&&$[1]===68&&$[2]===51?Ct($):$}function bt({data:$,signatures:Z}){let J=Et($),Y=typeof J==="string"?FJ(J.substring(0,Math.min(J.length,24))):J;for(let X of Z)if(Y.length>=X.bytesPrefix.length&&X.bytesPrefix.every((Q,G)=>Q===null||Y[G]===Q))return X.mediaType;return}var kT="6.0.168",vT=async({url:$,maxBytes:Z,abortSignal:J})=>{var Y;let X=$.toString();aU(X);try{let Q=await fetch(X,{headers:OX({},`ai-sdk/${kT}`,gL()),signal:J});if(Q.redirected)aU(Q.url);if(!Q.ok)throw new z4({url:X,statusCode:Q.status,statusText:Q.statusText});return{data:await hL({response:Q,url:X,maxBytes:Z!=null?Z:xL}),mediaType:(Y=Q.headers.get("content-type"))!=null?Y:void 0}}catch(Q){if(z4.isInstance(Q))throw Q;throw new z4({url:X,cause:Q})}},_t=($=vT)=>(Z)=>Promise.all(Z.map(async(J)=>J.isUrlSupportedByModel?null:$(J)));function St($){try{let[Z,J]=$.split(",");return{mediaType:Z.split(";")[0].split(":")[1],base64Content:J}}catch(Z){return{mediaType:void 0,base64Content:void 0}}}var yT=D.union([D.string(),D.instanceof(Uint8Array),D.instanceof(ArrayBuffer),D.custom(($)=>{var Z,J;return(J=(Z=globalThis.Buffer)==null?void 0:Z.isBuffer($))!=null?J:!1},{message:"Must be a Buffer"})]);function xT($){if($ instanceof Uint8Array)return{data:$,mediaType:void 0};if($ instanceof ArrayBuffer)return{data:new Uint8Array($),mediaType:void 0};if(typeof $==="string")try{$=new URL($)}catch(Z){}if($ instanceof URL&&$.protocol==="data:"){let{mediaType:Z,base64Content:J}=St($.toString());if(Z==null||J==null)throw new p0({name:"InvalidDataContentError",message:`Invalid data URL format in content ${$.toString()}`});return{data:J,mediaType:Z}}return{data:$,mediaType:void 0}}function ft($){if(typeof $==="string")return $;if($ instanceof ArrayBuffer)return HX(new Uint8Array($));return HX($)}async function WH({prompt:$,supportedUrls:Z,download:J=_t()}){let Y=await vt($.messages,J,Z),X=new Map;for(let V of $.messages)if(V.role==="assistant"&&Array.isArray(V.content)){for(let U of V.content)if(U.type==="tool-approval-request"&&"approvalId"in U&&"toolCallId"in U)X.set(U.approvalId,U.toolCallId)}let Q=new Set;for(let V of $.messages)if(V.role==="tool"){for(let U of V.content)if(U.type==="tool-approval-response"){let H=X.get(U.approvalId);if(H)Q.add(H)}}let G=[...$.system!=null?typeof $.system==="string"?[{role:"system",content:$.system}]:y5($.system).map((V)=>({role:"system",content:V.content,providerOptions:V.providerOptions})):[],...$.messages.map((V)=>kt({message:V,downloadedAssets:Y}))],W=[];for(let V of G){if(V.role!=="tool"){W.push(V);continue}let U=W.at(-1);if((U==null?void 0:U.role)==="tool")U.content.push(...V.content);else W.push(V)}let K=new Set;for(let V of W)switch(V.role){case"assistant":{for(let U of V.content)if(U.type==="tool-call"&&!U.providerExecuted)K.add(U.toolCallId);break}case"tool":{for(let U of V.content)if(U.type==="tool-result")K.delete(U.toolCallId);break}case"user":case"system":for(let U of Q)K.delete(U);if(K.size>0)throw new PL({toolCallIds:Array.from(K)});break}for(let V of Q)K.delete(V);if(K.size>0)throw new PL({toolCallIds:Array.from(K)});return W.filter((V)=>V.role!=="tool"||V.content.length>0)}function kt({message:$,downloadedAssets:Z}){let J=$.role;switch(J){case"system":return{role:"system",content:$.content,providerOptions:$.providerOptions};case"user":{if(typeof $.content==="string")return{role:"user",content:[{type:"text",text:$.content}],providerOptions:$.providerOptions};return{role:"user",content:$.content.map((Y)=>yt(Y,Z)).filter((Y)=>Y.type!=="text"||Y.text!==""),providerOptions:$.providerOptions}}case"assistant":{if(typeof $.content==="string")return{role:"assistant",content:[{type:"text",text:$.content}],providerOptions:$.providerOptions};return{role:"assistant",content:$.content.filter((Y)=>Y.type!=="text"||Y.text!==""||Y.providerOptions!=null).filter((Y)=>Y.type!=="tool-approval-request").map((Y)=>{let X=Y.providerOptions;switch(Y.type){case"file":{let{data:Q,mediaType:G}=xT(Y.data);return{type:"file",data:Q,filename:Y.filename,mediaType:G!=null?G:Y.mediaType,providerOptions:X}}case"reasoning":return{type:"reasoning",text:Y.text,providerOptions:X};case"text":return{type:"text",text:Y.text,providerOptions:X};case"tool-call":return{type:"tool-call",toolCallId:Y.toolCallId,toolName:Y.toolName,input:Y.input,providerExecuted:Y.providerExecuted,providerOptions:X};case"tool-result":return{type:"tool-result",toolCallId:Y.toolCallId,toolName:Y.toolName,output:CL(Y.output),providerOptions:X}}}),providerOptions:$.providerOptions}}case"tool":return{role:"tool",content:$.content.filter((Y)=>Y.type!=="tool-approval-response"||Y.providerExecuted).map((Y)=>{switch(Y.type){case"tool-result":return{type:"tool-result",toolCallId:Y.toolCallId,toolName:Y.toolName,output:CL(Y.output),providerOptions:Y.providerOptions};case"tool-approval-response":return{type:"tool-approval-response",approvalId:Y.approvalId,approved:Y.approved,reason:Y.reason}}}),providerOptions:$.providerOptions};default:throw new At({role:J})}}async function vt($,Z,J){let Y=$.filter((Q)=>Q.role==="user").map((Q)=>Q.content).filter((Q)=>Array.isArray(Q)).flat().filter((Q)=>Q.type==="image"||Q.type==="file").map((Q)=>{var G;let W=(G=Q.mediaType)!=null?G:Q.type==="image"?"image/*":void 0,K=Q.type==="image"?Q.image:Q.data;if(typeof K==="string")try{K=new URL(K)}catch(V){}return{mediaType:W,data:K}}).filter((Q)=>Q.data instanceof URL).map((Q)=>({url:Q.data,isUrlSupportedByModel:Q.mediaType!=null&&mL({url:Q.data.toString(),mediaType:Q.mediaType,supportedUrls:J})})),X=await Z(Y);return Object.fromEntries(X.map((Q,G)=>Q==null?null:[Y[G].url.toString(),{data:Q.data,mediaType:Q.mediaType}]).filter((Q)=>Q!=null))}function yt($,Z){var J;if($.type==="text")return{type:"text",text:$.text,providerOptions:$.providerOptions};let Y,X=$.type;switch(X){case"image":Y=$.image;break;case"file":Y=$.data;break;default:throw Error(`Unsupported part type: ${X}`)}let{data:Q,mediaType:G}=xT(Y),W=G!=null?G:$.mediaType,K=Q;if(K instanceof URL){let V=Z[K.toString()];if(V)K=V.data,W!=null||(W=V.mediaType)}switch(X){case"image":{if(K instanceof Uint8Array||typeof K==="string")W=(J=bt({data:K,signatures:It}))!=null?J:W;return{type:"file",mediaType:W!=null?W:"image/*",filename:void 0,data:K,providerOptions:$.providerOptions}}case"file":{if(W==null)throw Error("Media type is missing for file part");return{type:"file",mediaType:W,filename:$.filename,data:K,providerOptions:$.providerOptions}}}}function CL($){if($.type!=="content")return $;return{type:"content",value:$.value.map((Z)=>{if(Z.type!=="media")return Z;if(Z.mediaType.startsWith("image/"))return{type:"image-data",data:Z.data,mediaType:Z.mediaType};return{type:"file-data",data:Z.data,mediaType:Z.mediaType}})}}async function BJ({toolCallId:$,input:Z,output:J,tool:Y,errorMode:X}){if(X==="text")return{type:"error-text",value:r6(J)};else if(X==="json")return{type:"error-json",value:EL(J)};if(Y==null?void 0:Y.toModelOutput)return await Y.toModelOutput({toolCallId:$,input:Z,output:J});return typeof J==="string"?{type:"text",value:J}:{type:"json",value:EL(J)}}function EL($){return $===void 0?null:$}function BX({maxOutputTokens:$,temperature:Z,topP:J,topK:Y,presencePenalty:X,frequencyPenalty:Q,seed:G,stopSequences:W}){if($!=null){if(!Number.isInteger($))throw new r1({parameter:"maxOutputTokens",value:$,message:"maxOutputTokens must be an integer"});if($<1)throw new r1({parameter:"maxOutputTokens",value:$,message:"maxOutputTokens must be >= 1"})}if(Z!=null){if(typeof Z!=="number")throw new r1({parameter:"temperature",value:Z,message:"temperature must be a number"})}if(J!=null){if(typeof J!=="number")throw new r1({parameter:"topP",value:J,message:"topP must be a number"})}if(Y!=null){if(typeof Y!=="number")throw new r1({parameter:"topK",value:Y,message:"topK must be a number"})}if(X!=null){if(typeof X!=="number")throw new r1({parameter:"presencePenalty",value:X,message:"presencePenalty must be a number"})}if(Q!=null){if(typeof Q!=="number")throw new r1({parameter:"frequencyPenalty",value:Q,message:"frequencyPenalty must be a number"})}if(G!=null){if(!Number.isInteger(G))throw new r1({parameter:"seed",value:G,message:"seed must be an integer"})}return{maxOutputTokens:$,temperature:Z,topP:J,topK:Y,presencePenalty:X,frequencyPenalty:Q,stopSequences:W,seed:G}}function xt($){return $!=null&&Object.keys($).length>0}async function ht({tools:$,toolChoice:Z,activeTools:J}){if(!xt($))return{tools:void 0,toolChoice:void 0};let Y=J!=null?Object.entries($).filter(([Q])=>J.includes(Q)):Object.entries($),X=[];for(let[Q,G]of Y){let W=G.type;switch(W){case void 0:case"dynamic":case"function":X.push({type:"function",name:Q,description:G.description,inputSchema:await v8(G.inputSchema).jsonSchema,...G.inputExamples!=null?{inputExamples:G.inputExamples}:{},providerOptions:G.providerOptions,...G.strict!=null?{strict:G.strict}:{}});break;case"provider":X.push({type:"provider",name:Q,id:G.id,args:G.args});break;default:throw Error(`Unsupported tool type: ${W}`)}}return{tools:X,toolChoice:Z==null?{type:"auto"}:typeof Z==="string"?{type:Z}:{type:"tool",toolName:Z.toolName}}}var zX=D.lazy(()=>D.union([D.null(),D.string(),D.number(),D.boolean(),D.record(D.string(),zX.optional()),D.array(zX)])),N0=D.record(D.string(),D.record(D.string(),zX.optional())),hT=D.object({type:D.literal("text"),text:D.string(),providerOptions:N0.optional()}),gt=D.object({type:D.literal("image"),image:D.union([yT,D.instanceof(URL)]),mediaType:D.string().optional(),providerOptions:N0.optional()}),gT=D.object({type:D.literal("file"),data:D.union([yT,D.instanceof(URL)]),filename:D.string().optional(),mediaType:D.string(),providerOptions:N0.optional()}),ut=D.object({type:D.literal("reasoning"),text:D.string(),providerOptions:N0.optional()}),mt=D.object({type:D.literal("tool-call"),toolCallId:D.string(),toolName:D.string(),input:D.unknown(),providerOptions:N0.optional(),providerExecuted:D.boolean().optional()}),lt=D.discriminatedUnion("type",[D.object({type:D.literal("text"),value:D.string(),providerOptions:N0.optional()}),D.object({type:D.literal("json"),value:zX,providerOptions:N0.optional()}),D.object({type:D.literal("execution-denied"),reason:D.string().optional(),providerOptions:N0.optional()}),D.object({type:D.literal("error-text"),value:D.string(),providerOptions:N0.optional()}),D.object({type:D.literal("error-json"),value:zX,providerOptions:N0.optional()}),D.object({type:D.literal("content"),value:D.array(D.union([D.object({type:D.literal("text"),text:D.string(),providerOptions:N0.optional()}),D.object({type:D.literal("media"),data:D.string(),mediaType:D.string()}),D.object({type:D.literal("file-data"),data:D.string(),mediaType:D.string(),filename:D.string().optional(),providerOptions:N0.optional()}),D.object({type:D.literal("file-url"),url:D.string(),providerOptions:N0.optional()}),D.object({type:D.literal("file-id"),fileId:D.union([D.string(),D.record(D.string(),D.string())]),providerOptions:N0.optional()}),D.object({type:D.literal("image-data"),data:D.string(),mediaType:D.string(),providerOptions:N0.optional()}),D.object({type:D.literal("image-url"),url:D.string(),providerOptions:N0.optional()}),D.object({type:D.literal("image-file-id"),fileId:D.union([D.string(),D.record(D.string(),D.string())]),providerOptions:N0.optional()}),D.object({type:D.literal("custom"),providerOptions:N0.optional()})]))})]),uT=D.object({type:D.literal("tool-result"),toolCallId:D.string(),toolName:D.string(),output:lt,providerOptions:N0.optional()}),dt=D.object({type:D.literal("tool-approval-request"),approvalId:D.string(),toolCallId:D.string()}),pt=D.object({type:D.literal("tool-approval-response"),approvalId:D.string(),approved:D.boolean(),reason:D.string().optional()}),ct=D.object({role:D.literal("system"),content:D.string(),providerOptions:N0.optional()}),it=D.object({role:D.literal("user"),content:D.union([D.string(),D.array(D.union([hT,gt,gT]))]),providerOptions:N0.optional()}),nt=D.object({role:D.literal("assistant"),content:D.union([D.string(),D.array(D.union([hT,gT,ut,mt,uT,dt]))]),providerOptions:N0.optional()}),ot=D.object({role:D.literal("tool"),content:D.array(D.union([uT,pt])),providerOptions:N0.optional()}),st=D.union([ct,it,nt,ot]);async function KH($){if($.prompt==null&&$.messages==null)throw new yZ({prompt:$,message:"prompt or messages must be defined"});if($.prompt!=null&&$.messages!=null)throw new yZ({prompt:$,message:"prompt and messages cannot be defined at the same time"});if($.system!=null&&typeof $.system!=="string"&&!y5($.system).every((Y)=>typeof Y==="object"&&Y!==null&&("role"in Y)&&Y.role==="system"))throw new yZ({prompt:$,message:"system must be a string, SystemModelMessage, or array of SystemModelMessage"});let Z;if($.prompt!=null&&typeof $.prompt==="string")Z=[{role:"user",content:$.prompt}];else if($.prompt!=null&&Array.isArray($.prompt))Z=$.prompt;else if($.messages!=null)Z=$.messages;else throw new yZ({prompt:$,message:"prompt or messages must be defined"});if(Z.length===0)throw new yZ({prompt:$,message:"messages must not be empty"});let J=await y8({value:Z,schema:D.array(st)});if(!J.success)throw new yZ({prompt:$,message:"The messages do not match the ModelMessage[] schema.",cause:J.error});return{messages:Z,system:$.system}}function VH($){if(!dL.isInstance($))return $;let Z=(process==null?void 0:"development")==="production",J="https://ai-sdk.dev/unauthenticated-ai-gateway";if(Z)return new p0({name:"GatewayError",message:`Unauthenticated. Configure AI_GATEWAY_API_KEY or use a provider module. Learn more: ${J}`});return Object.assign(Error(`\x1B[1m\x1B[31mUnauthenticated request to AI Gateway.\x1B[0m
|
|
520
|
+
|
|
521
|
+
To authenticate, set the \x1B[33mAI_GATEWAY_API_KEY\x1B[0m environment variable with your API key.
|
|
522
|
+
|
|
523
|
+
Alternatively, you can use a provider module instead of the AI Gateway.
|
|
524
|
+
|
|
525
|
+
Learn more: \x1B[34m${J}\x1B[0m
|
|
526
|
+
|
|
527
|
+
`),{name:"GatewayAuthenticationError"})}function x5({operationId:$,telemetry:Z}){return{"operation.name":`${$}${(Z==null?void 0:Z.functionId)!=null?` ${Z.functionId}`:""}`,"resource.name":Z==null?void 0:Z.functionId,"ai.operationId":$,"ai.telemetry.functionId":Z==null?void 0:Z.functionId}}function UH({model:$,settings:Z,telemetry:J,headers:Y}){var X;return{"ai.model.provider":$.provider,"ai.model.id":$.modelId,...Object.entries(Z).reduce((Q,[G,W])=>{if(G==="timeout"){let K=fT(W);if(K!=null)Q[`ai.settings.${G}`]=K}else Q[`ai.settings.${G}`]=W;return Q},{}),...Object.entries((X=J==null?void 0:J.metadata)!=null?X:{}).reduce((Q,[G,W])=>{return Q[`ai.telemetry.metadata.${G}`]=W,Q},{}),...Object.entries(Y!=null?Y:{}).reduce((Q,[G,W])=>{if(W!==void 0)Q[`ai.request.headers.${G}`]=W;return Q},{})}}var rt={startSpan(){return B4},startActiveSpan($,Z,J,Y){if(typeof Z==="function")return Z(B4);if(typeof J==="function")return J(B4);if(typeof Y==="function")return Y(B4)}},B4={spanContext(){return at},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},addLink(){return this},addLinks(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return!1},recordException(){return this}},at={traceId:"",spanId:"",traceFlags:0};function HH({isEnabled:$=!1,tracer:Z}={}){if(!$)return rt;if(Z)return Z;return mT.trace.getTracer("ai")}async function h5({name:$,tracer:Z,attributes:J,fn:Y,endWhenDone:X=!0}){return Z.startActiveSpan($,{attributes:await J},async(Q)=>{let G=zJ.context.active();try{let W=await zJ.context.with(G,()=>Y(Q));if(X)Q.end();return W}catch(W){try{lT(Q,W)}finally{Q.end()}throw W}})}function lT($,Z){if(Z instanceof Error)$.recordException({name:Z.name,message:Z.message,stack:Z.stack}),$.setStatus({code:zJ.SpanStatusCode.ERROR,message:Z.message});else $.setStatus({code:zJ.SpanStatusCode.ERROR})}async function s$({telemetry:$,attributes:Z}){if(($==null?void 0:$.isEnabled)!==!0)return{};let J={};for(let[Y,X]of Object.entries(Z)){if(X==null)continue;if(typeof X==="object"&&"input"in X&&typeof X.input==="function"){if(($==null?void 0:$.recordInputs)===!1)continue;let Q=await X.input();if(Q!=null)J[Y]=Q;continue}if(typeof X==="object"&&"output"in X&&typeof X.output==="function"){if(($==null?void 0:$.recordOutputs)===!1)continue;let Q=await X.output();if(Q!=null)J[Y]=Q;continue}J[Y]=X}return J}function BH($){return JSON.stringify($.map((Z)=>({...Z,content:typeof Z.content==="string"?Z.content:Z.content.map((J)=>J.type==="file"?{...J,data:J.data instanceof Uint8Array?ft(J.data):J.data}:J)})))}function tt(){var $;return($=globalThis.AI_SDK_TELEMETRY_INTEGRATIONS)!=null?$:[]}function et(){let $=tt();return(Z)=>{let J=y5(Z),Y=[...$,...J];function X(Q){let G=Y.map(Q).filter(Boolean);return async(W)=>{for(let K of G)try{await K(W)}catch(V){}}}return{onStart:X((Q)=>Q.onStart),onStepStart:X((Q)=>Q.onStepStart),onToolCallStart:X((Q)=>Q.onToolCallStart),onToolCallFinish:X((Q)=>Q.onToolCallFinish),onStepFinish:X((Q)=>Q.onStepFinish),onFinish:X((Q)=>Q.onFinish)}}}function q4($){return{inputTokens:$.inputTokens.total,inputTokenDetails:{noCacheTokens:$.inputTokens.noCache,cacheReadTokens:$.inputTokens.cacheRead,cacheWriteTokens:$.inputTokens.cacheWrite},outputTokens:$.outputTokens.total,outputTokenDetails:{textTokens:$.outputTokens.text,reasoningTokens:$.outputTokens.reasoning},totalTokens:e8($.inputTokens.total,$.outputTokens.total),raw:$.raw,reasoningTokens:$.outputTokens.reasoning,cachedInputTokens:$.inputTokens.cacheRead}}function F4(){return{inputTokens:void 0,inputTokenDetails:{noCacheTokens:void 0,cacheReadTokens:void 0,cacheWriteTokens:void 0},outputTokens:void 0,outputTokenDetails:{textTokens:void 0,reasoningTokens:void 0},totalTokens:void 0,raw:void 0}}function $e($,Z){var J,Y,X,Q,G,W,K,V,U,H;return{inputTokens:e8($.inputTokens,Z.inputTokens),inputTokenDetails:{noCacheTokens:e8((J=$.inputTokenDetails)==null?void 0:J.noCacheTokens,(Y=Z.inputTokenDetails)==null?void 0:Y.noCacheTokens),cacheReadTokens:e8((X=$.inputTokenDetails)==null?void 0:X.cacheReadTokens,(Q=Z.inputTokenDetails)==null?void 0:Q.cacheReadTokens),cacheWriteTokens:e8((G=$.inputTokenDetails)==null?void 0:G.cacheWriteTokens,(W=Z.inputTokenDetails)==null?void 0:W.cacheWriteTokens)},outputTokens:e8($.outputTokens,Z.outputTokens),outputTokenDetails:{textTokens:e8((K=$.outputTokenDetails)==null?void 0:K.textTokens,(V=Z.outputTokenDetails)==null?void 0:V.textTokens),reasoningTokens:e8((U=$.outputTokenDetails)==null?void 0:U.reasoningTokens,(H=Z.outputTokenDetails)==null?void 0:H.reasoningTokens)},totalTokens:e8($.totalTokens,Z.totalTokens),reasoningTokens:e8($.reasoningTokens,Z.reasoningTokens),cachedInputTokens:e8($.cachedInputTokens,Z.cachedInputTokens)}}function e8($,Z){return $==null&&Z==null?void 0:($!=null?$:0)+(Z!=null?Z:0)}function zH($,Z){if($===void 0&&Z===void 0)return;if($===void 0)return Z;if(Z===void 0)return $;let J={...$};for(let Y in Z)if(Object.prototype.hasOwnProperty.call(Z,Y)){let X=Z[Y];if(X===void 0)continue;let Q=Y in $?$[Y]:void 0,G=X!==null&&typeof X==="object"&&!Array.isArray(X)&&!(X instanceof Date)&&!(X instanceof RegExp),W=Q!==null&&Q!==void 0&&typeof Q==="object"&&!Array.isArray(Q)&&!(Q instanceof Date)&&!(Q instanceof RegExp);if(G&&W)J[Y]=zH(Q,X);else J[Y]=X}return J}function Ze({error:$,exponentialBackoffDelay:Z}){let J=$.responseHeaders;if(!J)return Z;let Y,X=J["retry-after-ms"];if(X){let G=parseFloat(X);if(!Number.isNaN(G))Y=G}let Q=J["retry-after"];if(Q&&Y===void 0){let G=parseFloat(Q);if(!Number.isNaN(G))Y=G*1000;else Y=Date.parse(Q)-Date.now()}if(Y!=null&&!Number.isNaN(Y)&&0<=Y&&(Y<60000||Y<Z))return Y;return Z}var Je=({maxRetries:$=2,initialDelayInMs:Z=2000,backoffFactor:J=2,abortSignal:Y}={})=>async(X)=>dT(X,{maxRetries:$,delayInMs:Z,backoffFactor:J,abortSignal:Y});async function dT($,{maxRetries:Z,delayInMs:J,backoffFactor:Y,abortSignal:X},Q=[]){try{return await $()}catch(G){if(N4(G))throw G;if(Z===0)throw G;let W=AX(G),K=[...Q,G],V=K.length;if(V>Z)throw new O4({message:`Failed after ${V} attempts. Last error: ${W}`,reason:"maxRetriesExceeded",errors:K});if(G instanceof Error&&FX.isInstance(G)&&G.isRetryable===!0&&V<=Z)return await yL(Ze({error:G,exponentialBackoffDelay:J}),{abortSignal:X}),dT($,{maxRetries:Z,delayInMs:Y*J,backoffFactor:Y,abortSignal:X},K);if(V===1)throw G;throw new O4({message:`Failed after ${V} attempts with non-retryable error: '${W}'`,reason:"errorNotRetryable",errors:K})}}function FH({maxRetries:$,abortSignal:Z}){if($!=null){if(!Number.isInteger($))throw new r1({parameter:"maxRetries",value:$,message:"maxRetries must be an integer"});if($<0)throw new r1({parameter:"maxRetries",value:$,message:"maxRetries must be >= 0"})}let J=$!=null?$:2;return{maxRetries:J,retry:Je({maxRetries:J,abortSignal:Z})}}function Ye({messages:$}){let Z=$.at(-1);if((Z==null?void 0:Z.role)!="tool")return{approvedToolApprovals:[],deniedToolApprovals:[]};let J={};for(let K of $)if(K.role==="assistant"&&typeof K.content!=="string"){let V=K.content;for(let U of V)if(U.type==="tool-call")J[U.toolCallId]=U}let Y={};for(let K of $)if(K.role==="assistant"&&typeof K.content!=="string"){let V=K.content;for(let U of V)if(U.type==="tool-approval-request")Y[U.approvalId]=U}let X={};for(let K of Z.content)if(K.type==="tool-result")X[K.toolCallId]=K;let Q=[],G=[],W=Z.content.filter((K)=>K.type==="tool-approval-response");for(let K of W){let V=Y[K.approvalId];if(V==null)throw new ya({approvalId:K.approvalId});if(X[V.toolCallId]!=null)continue;let U=J[V.toolCallId];if(U==null)throw new YT({toolCallId:V.toolCallId,approvalId:V.approvalId});let H={approvalRequest:V,approvalResponse:K,toolCall:U};if(K.approved)Q.push(H);else G.push(H)}return{approvedToolApprovals:Q,deniedToolApprovals:G}}function VX(){var $,Z;return(Z=($=globalThis==null?void 0:globalThis.performance)==null?void 0:$.now())!=null?Z:Date.now()}async function pT({toolCall:$,tools:Z,tracer:J,telemetry:Y,messages:X,abortSignal:Q,experimental_context:G,stepNumber:W,model:K,onPreliminaryToolResult:V,onToolCallStart:U,onToolCallFinish:H}){let{toolName:B,toolCallId:z,input:F}=$,A=Z==null?void 0:Z[B];if((A==null?void 0:A.execute)==null)return;let j={stepNumber:W,model:K,toolCall:$,messages:X,abortSignal:Q,functionId:Y==null?void 0:Y.functionId,metadata:Y==null?void 0:Y.metadata,experimental_context:G};return h5({name:"ai.toolCall",attributes:s$({telemetry:Y,attributes:{...x5({operationId:"ai.toolCall",telemetry:Y}),"ai.toolCall.name":B,"ai.toolCall.id":z,"ai.toolCall.args":{output:()=>JSON.stringify(F)}}}),tracer:J,fn:async(N)=>{let w;await v5({event:j,callbacks:U});let q=VX();try{let C=lL({execute:A.execute.bind(A),input:F,options:{toolCallId:z,messages:X,abortSignal:Q,experimental_context:G}});for await(let R of C)if(R.type==="preliminary")V==null||V({...$,type:"tool-result",output:R.output,preliminary:!0});else w=R.output}catch(C){let R=VX()-q;return await v5({event:{...j,success:!1,error:C,durationMs:R},callbacks:H}),lT(N,C),{type:"tool-error",toolCallId:z,toolName:B,input:F,error:C,dynamic:A.type==="dynamic",...$.providerMetadata!=null?{providerMetadata:$.providerMetadata}:{}}}let M=VX()-q;await v5({event:{...j,success:!0,output:w,durationMs:M},callbacks:H});try{N.setAttributes(await s$({telemetry:Y,attributes:{"ai.toolCall.result":{output:()=>JSON.stringify(w)}}}))}catch(C){}return{type:"tool-result",toolCallId:z,toolName:B,input:F,output:w,dynamic:A.type==="dynamic",...$.providerMetadata!=null?{providerMetadata:$.providerMetadata}:{}}}})}function Xe($){let Z=$.filter((J)=>J.type==="reasoning");return Z.length===0?void 0:Z.map((J)=>J.text).join(`
|
|
528
|
+
`)}function Qe($){let Z=$.filter((J)=>J.type==="text");if(Z.length===0)return;return Z.map((J)=>J.text).join("")}var Ge=class{constructor({data:$,mediaType:Z}){let J=$ instanceof Uint8Array;this.base64Data=J?void 0:$,this.uint8ArrayData=J?$:void 0,this.mediaType=Z}get base64(){if(this.base64Data==null)this.base64Data=HX(this.uint8ArrayData);return this.base64Data}get uint8Array(){if(this.uint8ArrayData==null)this.uint8ArrayData=FJ(this.base64Data);return this.uint8ArrayData}},We=class extends Ge{constructor($){super($);this.type="file"}};async function Ke({tool:$,toolCall:Z,messages:J,experimental_context:Y}){if($.needsApproval==null)return!1;if(typeof $.needsApproval==="boolean")return $.needsApproval;return await $.needsApproval(Z.input,{toolCallId:Z.toolCallId,messages:J,experimental_context:Y})}var Ve={};Ea(Ve,{array:()=>Be,choice:()=>ze,json:()=>Fe,object:()=>He,text:()=>eU});function Ue($){let Z=["ROOT"],J=-1,Y=null;function X(K,V,U){switch(K){case'"':{J=V,Z.pop(),Z.push(U),Z.push("INSIDE_STRING");break}case"f":case"t":case"n":{J=V,Y=V,Z.pop(),Z.push(U),Z.push("INSIDE_LITERAL");break}case"-":{Z.pop(),Z.push(U),Z.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{J=V,Z.pop(),Z.push(U),Z.push("INSIDE_NUMBER");break}case"{":{J=V,Z.pop(),Z.push(U),Z.push("INSIDE_OBJECT_START");break}case"[":{J=V,Z.pop(),Z.push(U),Z.push("INSIDE_ARRAY_START");break}}}function Q(K,V){switch(K){case",":{Z.pop(),Z.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{J=V,Z.pop();break}}}function G(K,V){switch(K){case",":{Z.pop(),Z.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{J=V,Z.pop();break}}}for(let K=0;K<$.length;K++){let V=$[K];switch(Z[Z.length-1]){case"ROOT":X(V,K,"FINISH");break;case"INSIDE_OBJECT_START":{switch(V){case'"':{Z.pop(),Z.push("INSIDE_OBJECT_KEY");break}case"}":{J=K,Z.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{switch(V){case'"':{Z.pop(),Z.push("INSIDE_OBJECT_KEY");break}}break}case"INSIDE_OBJECT_KEY":{switch(V){case'"':{Z.pop(),Z.push("INSIDE_OBJECT_AFTER_KEY");break}}break}case"INSIDE_OBJECT_AFTER_KEY":{switch(V){case":":{Z.pop(),Z.push("INSIDE_OBJECT_BEFORE_VALUE");break}}break}case"INSIDE_OBJECT_BEFORE_VALUE":{X(V,K,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{Q(V,K);break}case"INSIDE_STRING":{switch(V){case'"':{Z.pop(),J=K;break}case"\\":{Z.push("INSIDE_STRING_ESCAPE");break}default:J=K}break}case"INSIDE_ARRAY_START":{switch(V){case"]":{J=K,Z.pop();break}default:{J=K,X(V,K,"INSIDE_ARRAY_AFTER_VALUE");break}}break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(V){case",":{Z.pop(),Z.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{J=K,Z.pop();break}default:{J=K;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{X(V,K,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{Z.pop(),J=K;break}case"INSIDE_NUMBER":{switch(V){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{J=K;break}case"e":case"E":case"-":case".":break;case",":{if(Z.pop(),Z[Z.length-1]==="INSIDE_ARRAY_AFTER_VALUE")G(V,K);if(Z[Z.length-1]==="INSIDE_OBJECT_AFTER_VALUE")Q(V,K);break}case"}":{if(Z.pop(),Z[Z.length-1]==="INSIDE_OBJECT_AFTER_VALUE")Q(V,K);break}case"]":{if(Z.pop(),Z[Z.length-1]==="INSIDE_ARRAY_AFTER_VALUE")G(V,K);break}default:{Z.pop();break}}break}case"INSIDE_LITERAL":{let H=$.substring(Y,K+1);if(!"false".startsWith(H)&&!"true".startsWith(H)&&!"null".startsWith(H)){if(Z.pop(),Z[Z.length-1]==="INSIDE_OBJECT_AFTER_VALUE")Q(V,K);else if(Z[Z.length-1]==="INSIDE_ARRAY_AFTER_VALUE")G(V,K)}else J=K;break}}}let W=$.slice(0,J+1);for(let K=Z.length-1;K>=0;K--)switch(Z[K]){case"INSIDE_STRING":{W+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{W+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{W+="]";break}case"INSIDE_LITERAL":{let U=$.substring(Y,$.length);if("true".startsWith(U))W+="true".slice(U.length);else if("false".startsWith(U))W+="false".slice(U.length);else if("null".startsWith(U))W+="null".slice(U.length)}}return W}async function AJ($){if($===void 0)return{value:void 0,state:"undefined-input"};let Z=await G8({text:$});if(Z.success)return{value:Z.value,state:"successful-parse"};if(Z=await G8({text:Ue($)}),Z.success)return{value:Z.value,state:"repaired-parse"};return{value:void 0,state:"failed-parse"}}var eU=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:$}){return $},async parsePartialOutput({text:$}){return{partial:$}},createElementStreamTransform(){return}}),He=({schema:$,name:Z,description:J})=>{let Y=v8($);return{name:"object",responseFormat:QH(Y.jsonSchema).then((X)=>({type:"json",schema:X,...Z!=null&&{name:Z},...J!=null&&{description:J}})),async parseCompleteOutput({text:X},Q){let G=await G8({text:X});if(!G.success)throw new C8({message:"No object generated: could not parse the response.",cause:G.error,text:X,response:Q.response,usage:Q.usage,finishReason:Q.finishReason});let W=await y8({value:G.value,schema:Y});if(!W.success)throw new C8({message:"No object generated: response did not match schema.",cause:W.error,text:X,response:Q.response,usage:Q.usage,finishReason:Q.finishReason});return W.value},async parsePartialOutput({text:X}){let Q=await AJ(X);switch(Q.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:Q.value}}},createElementStreamTransform(){return}}},Be=({element:$,name:Z,description:J})=>{let Y=v8($);return{name:"array",responseFormat:QH(Y.jsonSchema).then((X)=>{let{$schema:Q,...G}=X;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:G}},required:["elements"],additionalProperties:!1},...Z!=null&&{name:Z},...J!=null&&{description:J}}}),async parseCompleteOutput({text:X},Q){let G=await G8({text:X});if(!G.success)throw new C8({message:"No object generated: could not parse the response.",cause:G.error,text:X,response:Q.response,usage:Q.usage,finishReason:Q.finishReason});let W=G.value;if(W==null||typeof W!=="object"||!("elements"in W)||!Array.isArray(W.elements))throw new C8({message:"No object generated: response did not match schema.",cause:new I8({value:W,cause:"response must be an object with an elements array"}),text:X,response:Q.response,usage:Q.usage,finishReason:Q.finishReason});for(let K of W.elements){let V=await y8({value:K,schema:Y});if(!V.success)throw new C8({message:"No object generated: response did not match schema.",cause:V.error,text:X,response:Q.response,usage:Q.usage,finishReason:Q.finishReason})}return W.elements},async parsePartialOutput({text:X}){let Q=await AJ(X);switch(Q.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{let G=Q.value;if(G==null||typeof G!=="object"||!("elements"in G)||!Array.isArray(G.elements))return;let W=Q.state==="repaired-parse"&&G.elements.length>0?G.elements.slice(0,-1):G.elements,K=[];for(let V of W){let U=await y8({value:V,schema:Y});if(U.success)K.push(U.value)}return{partial:K}}}},createElementStreamTransform(){let X=0;return new TransformStream({transform({partialOutput:Q},G){if(Q!=null)for(;X<Q.length;X++)G.enqueue(Q[X])}})}}},ze=({options:$,name:Z,description:J})=>{return{name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:$}},required:["result"],additionalProperties:!1},...Z!=null&&{name:Z},...J!=null&&{description:J}}),async parseCompleteOutput({text:Y},X){let Q=await G8({text:Y});if(!Q.success)throw new C8({message:"No object generated: could not parse the response.",cause:Q.error,text:Y,response:X.response,usage:X.usage,finishReason:X.finishReason});let G=Q.value;if(G==null||typeof G!=="object"||!("result"in G)||typeof G.result!=="string"||!$.includes(G.result))throw new C8({message:"No object generated: response did not match schema.",cause:new I8({value:G,cause:"response must be an object that contains a choice value."}),text:Y,response:X.response,usage:X.usage,finishReason:X.finishReason});return G.result},async parsePartialOutput({text:Y}){let X=await AJ(Y);switch(X.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{let Q=X.value;if(Q==null||typeof Q!=="object"||!("result"in Q)||typeof Q.result!=="string")return;let G=$.filter((W)=>W.startsWith(Q.result));if(X.state==="successful-parse")return G.includes(Q.result)?{partial:Q.result}:void 0;else return G.length===1?{partial:G[0]}:void 0}}},createElementStreamTransform(){return}}},Fe=({name:$,description:Z}={})=>{return{name:"json",responseFormat:Promise.resolve({type:"json",...$!=null&&{name:$},...Z!=null&&{description:Z}}),async parseCompleteOutput({text:J},Y){let X=await G8({text:J});if(!X.success)throw new C8({message:"No object generated: could not parse the response.",cause:X.error,text:J,response:Y.response,usage:Y.usage,finishReason:Y.finishReason});return X.value},async parsePartialOutput({text:J}){let Y=await AJ(J);switch(Y.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return Y.value===void 0?void 0:{partial:Y.value}}},createElementStreamTransform(){return}}};async function Ae({toolCall:$,tools:Z,repairToolCall:J,system:Y,messages:X}){var Q;try{if(Z==null){if($.providerExecuted&&$.dynamic)return await cT($);throw new tU({toolName:$.toolName})}try{return await bL({toolCall:$,tools:Z})}catch(G){if(J==null||!(tU.isInstance(G)||GH.isInstance(G)))throw G;let W=null;try{W=await J({toolCall:$,tools:Z,inputSchema:async({toolName:K})=>{let{inputSchema:V}=Z[K];return await v8(V).jsonSchema},system:Y,messages:X,error:G})}catch(K){throw new Wt({cause:K,originalError:G})}if(W==null)throw G;return await bL({toolCall:W,tools:Z})}}catch(G){let W=await G8({text:$.input}),K=W.success?W.value:$.input;return{type:"tool-call",toolCallId:$.toolCallId,toolName:$.toolName,input:K,dynamic:!0,invalid:!0,error:G,title:(Q=Z==null?void 0:Z[$.toolName])==null?void 0:Q.title,providerExecuted:$.providerExecuted,providerMetadata:$.providerMetadata}}}async function cT($){let Z=$.input.trim()===""?{success:!0,value:{}}:await G8({text:$.input});if(Z.success===!1)throw new GH({toolName:$.toolName,toolInput:$.input,cause:Z.error});return{type:"tool-call",toolCallId:$.toolCallId,toolName:$.toolName,input:Z.value,providerExecuted:!0,dynamic:!0,providerMetadata:$.providerMetadata}}async function bL({toolCall:$,tools:Z}){let J=$.toolName,Y=Z[J];if(Y==null){if($.providerExecuted&&$.dynamic)return await cT($);throw new tU({toolName:$.toolName,availableTools:Object.keys(Z)})}let X=v8(Y.inputSchema),Q=$.input.trim()===""?await y8({value:{},schema:X}):await G8({text:$.input,schema:X});if(Q.success===!1)throw new GH({toolName:J,toolInput:$.input,cause:Q.error});return Y.type==="dynamic"?{type:"tool-call",toolCallId:$.toolCallId,toolName:$.toolName,input:Q.value,providerExecuted:$.providerExecuted,providerMetadata:$.providerMetadata,dynamic:!0,title:Y.title}:{type:"tool-call",toolCallId:$.toolCallId,toolName:J,input:Q.value,providerExecuted:$.providerExecuted,providerMetadata:$.providerMetadata,title:Y.title}}var Oe=class{constructor({stepNumber:$,model:Z,functionId:J,metadata:Y,experimental_context:X,content:Q,finishReason:G,rawFinishReason:W,usage:K,warnings:V,request:U,response:H,providerMetadata:B}){this.stepNumber=$,this.model=Z,this.functionId=J,this.metadata=Y,this.experimental_context=X,this.content=Q,this.finishReason=G,this.rawFinishReason=W,this.usage=K,this.warnings=V,this.request=U,this.response=H,this.providerMetadata=B}get text(){return this.content.filter(($)=>$.type==="text").map(($)=>$.text).join("")}get reasoning(){return this.content.filter(($)=>$.type==="reasoning")}get reasoningText(){return this.reasoning.length===0?void 0:this.reasoning.map(($)=>$.text).join("")}get files(){return this.content.filter(($)=>$.type==="file").map(($)=>$.file)}get sources(){return this.content.filter(($)=>$.type==="source")}get toolCalls(){return this.content.filter(($)=>$.type==="tool-call")}get staticToolCalls(){return this.toolCalls.filter(($)=>$.dynamic!==!0)}get dynamicToolCalls(){return this.toolCalls.filter(($)=>$.dynamic===!0)}get toolResults(){return this.content.filter(($)=>$.type==="tool-result")}get staticToolResults(){return this.toolResults.filter(($)=>$.dynamic!==!0)}get dynamicToolResults(){return this.toolResults.filter(($)=>$.dynamic===!0)}};function qe($){return({steps:Z})=>Z.length===$}async function je({stopConditions:$,steps:Z}){return(await Promise.all($.map((J)=>J({steps:Z})))).some((J)=>J)}async function _L({content:$,tools:Z}){let J=[],Y=[];for(let Q of $){if(Q.type==="source")continue;if((Q.type==="tool-result"||Q.type==="tool-error")&&!Q.providerExecuted)continue;if(Q.type==="text"&&Q.text.length===0)continue;switch(Q.type){case"text":Y.push({type:"text",text:Q.text,providerOptions:Q.providerMetadata});break;case"reasoning":Y.push({type:"reasoning",text:Q.text,providerOptions:Q.providerMetadata});break;case"file":Y.push({type:"file",data:Q.file.base64,mediaType:Q.file.mediaType,providerOptions:Q.providerMetadata});break;case"tool-call":Y.push({type:"tool-call",toolCallId:Q.toolCallId,toolName:Q.toolName,input:Q.invalid&&typeof Q.input!=="object"?{}:Q.input,providerExecuted:Q.providerExecuted,providerOptions:Q.providerMetadata});break;case"tool-result":{let G=await BJ({toolCallId:Q.toolCallId,input:Q.input,tool:Z==null?void 0:Z[Q.toolName],output:Q.output,errorMode:"none"});Y.push({type:"tool-result",toolCallId:Q.toolCallId,toolName:Q.toolName,output:G,providerOptions:Q.providerMetadata});break}case"tool-error":{let G=await BJ({toolCallId:Q.toolCallId,input:Q.input,tool:Z==null?void 0:Z[Q.toolName],output:Q.error,errorMode:"json"});Y.push({type:"tool-result",toolCallId:Q.toolCallId,toolName:Q.toolName,output:G,providerOptions:Q.providerMetadata});break}case"tool-approval-request":Y.push({type:"tool-approval-request",approvalId:Q.approvalId,toolCallId:Q.toolCall.toolCallId});break}}if(Y.length>0)J.push({role:"assistant",content:Y});let X=[];for(let Q of $){if(!(Q.type==="tool-result"||Q.type==="tool-error")||Q.providerExecuted)continue;let G=await BJ({toolCallId:Q.toolCallId,input:Q.input,tool:Z==null?void 0:Z[Q.toolName],output:Q.type==="tool-result"?Q.output:Q.error,errorMode:Q.type==="tool-error"?"text":"none"});X.push({type:"tool-result",toolCallId:Q.toolCallId,toolName:Q.toolName,output:G,...Q.providerMetadata!=null?{providerOptions:Q.providerMetadata}:{}})}if(X.length>0)J.push({role:"tool",content:X});return J}function Ne(...$){let Z=$.filter((Y)=>Y!=null);if(Z.length===0)return;if(Z.length===1)return Z[0];let J=new AbortController;for(let Y of Z){if(Y.aborted)return J.abort(Y.reason),J.signal;Y.addEventListener("abort",()=>{J.abort(Y.reason)},{once:!0})}return J.signal}var lb0=a6({prefix:"aitxt",size:24});function jX($,Z){let J=new Headers($!=null?$:{});for(let[Y,X]of Object.entries(Z))if(!J.has(Y))J.set(Y,X);return J}function iT({status:$,statusText:Z,headers:J,textStream:Y}){return new Response(Y.pipeThrough(new TextEncoderStream),{status:$!=null?$:200,statusText:Z,headers:jX(J,{"content-type":"text/plain; charset=utf-8"})})}function nT({response:$,status:Z,statusText:J,headers:Y,stream:X}){let Q=Z!=null?Z:200;if(J!==void 0)$.writeHead(Q,J,Y);else $.writeHead(Q,Y);let G=X.getReader();(async()=>{try{while(!0){let{done:K,value:V}=await G.read();if(K)break;if(!$.write(V))await new Promise((H)=>{$.once("drain",H)})}}catch(K){throw K}finally{$.end()}})()}function oT({response:$,status:Z,statusText:J,headers:Y,textStream:X}){nT({response:$,status:Z,statusText:J,headers:Object.fromEntries(jX(Y,{"content-type":"text/plain; charset=utf-8"}).entries()),stream:X.pipeThrough(new TextEncoderStream)})}var sT=class extends TransformStream{constructor(){super({transform($,Z){Z.enqueue(`data: ${JSON.stringify($)}
|
|
529
|
+
|
|
530
|
+
`)},flush($){$.enqueue(`data: [DONE]
|
|
531
|
+
|
|
532
|
+
`)}})}},rT={"content-type":"text/event-stream","cache-control":"no-cache",connection:"keep-alive","x-vercel-ai-ui-message-stream":"v1","x-accel-buffering":"no"};function Me({status:$,statusText:Z,headers:J,stream:Y,consumeSseStream:X}){let Q=Y.pipeThrough(new sT);if(X){let[G,W]=Q.tee();Q=G,X({stream:W})}return new Response(Q.pipeThrough(new TextEncoderStream),{status:$,statusText:Z,headers:jX(J,rT)})}function De({originalMessages:$,responseMessageId:Z}){if($==null)return;let J=$[$.length-1];return(J==null?void 0:J.role)==="assistant"?J.id:typeof Z==="function"?Z():Z}var ob0=M4(()=>qX(D.union([D.strictObject({type:D.literal("text-start"),id:D.string(),providerMetadata:N0.optional()}),D.strictObject({type:D.literal("text-delta"),id:D.string(),delta:D.string(),providerMetadata:N0.optional()}),D.strictObject({type:D.literal("text-end"),id:D.string(),providerMetadata:N0.optional()}),D.strictObject({type:D.literal("error"),errorText:D.string()}),D.strictObject({type:D.literal("tool-input-start"),toolCallId:D.string(),toolName:D.string(),providerExecuted:D.boolean().optional(),providerMetadata:N0.optional(),dynamic:D.boolean().optional(),title:D.string().optional()}),D.strictObject({type:D.literal("tool-input-delta"),toolCallId:D.string(),inputTextDelta:D.string()}),D.strictObject({type:D.literal("tool-input-available"),toolCallId:D.string(),toolName:D.string(),input:D.unknown(),providerExecuted:D.boolean().optional(),providerMetadata:N0.optional(),dynamic:D.boolean().optional(),title:D.string().optional()}),D.strictObject({type:D.literal("tool-input-error"),toolCallId:D.string(),toolName:D.string(),input:D.unknown(),providerExecuted:D.boolean().optional(),providerMetadata:N0.optional(),dynamic:D.boolean().optional(),errorText:D.string(),title:D.string().optional()}),D.strictObject({type:D.literal("tool-approval-request"),approvalId:D.string(),toolCallId:D.string()}),D.strictObject({type:D.literal("tool-output-available"),toolCallId:D.string(),output:D.unknown(),providerExecuted:D.boolean().optional(),providerMetadata:N0.optional(),dynamic:D.boolean().optional(),preliminary:D.boolean().optional()}),D.strictObject({type:D.literal("tool-output-error"),toolCallId:D.string(),errorText:D.string(),providerExecuted:D.boolean().optional(),providerMetadata:N0.optional(),dynamic:D.boolean().optional()}),D.strictObject({type:D.literal("tool-output-denied"),toolCallId:D.string()}),D.strictObject({type:D.literal("reasoning-start"),id:D.string(),providerMetadata:N0.optional()}),D.strictObject({type:D.literal("reasoning-delta"),id:D.string(),delta:D.string(),providerMetadata:N0.optional()}),D.strictObject({type:D.literal("reasoning-end"),id:D.string(),providerMetadata:N0.optional()}),D.strictObject({type:D.literal("source-url"),sourceId:D.string(),url:D.string(),title:D.string().optional(),providerMetadata:N0.optional()}),D.strictObject({type:D.literal("source-document"),sourceId:D.string(),mediaType:D.string(),title:D.string(),filename:D.string().optional(),providerMetadata:N0.optional()}),D.strictObject({type:D.literal("file"),url:D.string(),mediaType:D.string(),providerMetadata:N0.optional()}),D.strictObject({type:D.custom(($)=>typeof $==="string"&&$.startsWith("data-"),{message:'Type must start with "data-"'}),id:D.string().optional(),data:D.unknown(),transient:D.boolean().optional()}),D.strictObject({type:D.literal("start-step")}),D.strictObject({type:D.literal("finish-step")}),D.strictObject({type:D.literal("start"),messageId:D.string().optional(),messageMetadata:D.unknown().optional()}),D.strictObject({type:D.literal("finish"),finishReason:D.enum(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:D.unknown().optional()}),D.strictObject({type:D.literal("abort"),reason:D.string().optional()}),D.strictObject({type:D.literal("message-metadata"),messageMetadata:D.unknown()})])));function we($){return $.type.startsWith("data-")}function iU($){return $.type.startsWith("data-")}function nU($){return $.type==="text"}function oU($){return $.type==="file"}function SL($){return $.type==="reasoning"}function $H($){return $.type.startsWith("tool-")}function aT($){return $.type==="dynamic-tool"}function HJ($){return $H($)||aT($)}function ZH($){return $.type.split("-").slice(1).join("-")}function sU($){return aT($)?$.toolName:ZH($)}function Le({lastMessage:$,messageId:Z}){return{message:($==null?void 0:$.role)==="assistant"?$:{id:Z,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function Te({stream:$,messageMetadataSchema:Z,dataPartSchemas:J,runUpdateMessageJob:Y,onError:X,onToolCall:Q,onData:G}){return $.pipeThrough(new TransformStream({async transform(W,K){await Y(async({state:V,write:U})=>{var H,B,z,F;function A(q){let C=V.message.parts.filter(HJ).find((R)=>R.toolCallId===q);if(C==null)throw new UJ({chunkType:"tool-invocation",chunkId:q,message:`No tool invocation found for tool call ID "${q}".`});return C}function j(q){var M;let C=V.message.parts.find((I)=>$H(I)&&I.toolCallId===q.toolCallId),R=q,T=C;if(C!=null){if(C.state=q.state,T.input=R.input,T.output=R.output,T.errorText=R.errorText,T.rawInput=R.rawInput,T.preliminary=R.preliminary,q.title!==void 0)T.title=q.title;T.providerExecuted=(M=R.providerExecuted)!=null?M:C.providerExecuted;let I=R.providerMetadata;if(I!=null)if(q.state==="output-available"||q.state==="output-error"){let _=C;_.resultProviderMetadata=I}else C.callProviderMetadata=I}else V.message.parts.push({type:`tool-${q.toolName}`,toolCallId:q.toolCallId,state:q.state,title:q.title,input:R.input,output:R.output,rawInput:R.rawInput,errorText:R.errorText,providerExecuted:R.providerExecuted,preliminary:R.preliminary,...R.providerMetadata!=null&&(q.state==="output-available"||q.state==="output-error")?{resultProviderMetadata:R.providerMetadata}:{},...R.providerMetadata!=null&&!(q.state==="output-available"||q.state==="output-error")?{callProviderMetadata:R.providerMetadata}:{}})}function N(q){var M,C;let R=V.message.parts.find((_)=>_.type==="dynamic-tool"&&_.toolCallId===q.toolCallId),T=q,I=R;if(R!=null){if(R.state=q.state,I.toolName=q.toolName,I.input=T.input,I.output=T.output,I.errorText=T.errorText,I.rawInput=(M=T.rawInput)!=null?M:I.rawInput,I.preliminary=T.preliminary,q.title!==void 0)I.title=q.title;I.providerExecuted=(C=T.providerExecuted)!=null?C:R.providerExecuted;let _=T.providerMetadata;if(_!=null)if(q.state==="output-available"||q.state==="output-error"){let E=R;E.resultProviderMetadata=_}else R.callProviderMetadata=_}else V.message.parts.push({type:"dynamic-tool",toolName:q.toolName,toolCallId:q.toolCallId,state:q.state,input:T.input,output:T.output,errorText:T.errorText,preliminary:T.preliminary,providerExecuted:T.providerExecuted,title:q.title,...T.providerMetadata!=null&&(q.state==="output-available"||q.state==="output-error")?{resultProviderMetadata:T.providerMetadata}:{},...T.providerMetadata!=null&&!(q.state==="output-available"||q.state==="output-error")?{callProviderMetadata:T.providerMetadata}:{}})}async function w(q){if(q!=null){let M=V.message.metadata!=null?zH(V.message.metadata,q):q;if(Z!=null)await A4({value:M,schema:Z,context:{field:"message.metadata",entityId:V.message.id}});V.message.metadata=M}}switch(W.type){case"text-start":{let q={type:"text",text:"",providerMetadata:W.providerMetadata,state:"streaming"};V.activeTextParts[W.id]=q,V.message.parts.push(q),U();break}case"text-delta":{let q=V.activeTextParts[W.id];if(q==null)throw new UJ({chunkType:"text-delta",chunkId:W.id,message:`Received text-delta for missing text part with ID "${W.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});q.text+=W.delta,q.providerMetadata=(H=W.providerMetadata)!=null?H:q.providerMetadata,U();break}case"text-end":{let q=V.activeTextParts[W.id];if(q==null)throw new UJ({chunkType:"text-end",chunkId:W.id,message:`Received text-end for missing text part with ID "${W.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});q.state="done",q.providerMetadata=(B=W.providerMetadata)!=null?B:q.providerMetadata,delete V.activeTextParts[W.id],U();break}case"reasoning-start":{let q={type:"reasoning",text:"",providerMetadata:W.providerMetadata,state:"streaming"};V.activeReasoningParts[W.id]=q,V.message.parts.push(q),U();break}case"reasoning-delta":{let q=V.activeReasoningParts[W.id];if(q==null)throw new UJ({chunkType:"reasoning-delta",chunkId:W.id,message:`Received reasoning-delta for missing reasoning part with ID "${W.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});q.text+=W.delta,q.providerMetadata=(z=W.providerMetadata)!=null?z:q.providerMetadata,U();break}case"reasoning-end":{let q=V.activeReasoningParts[W.id];if(q==null)throw new UJ({chunkType:"reasoning-end",chunkId:W.id,message:`Received reasoning-end for missing reasoning part with ID "${W.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});q.providerMetadata=(F=W.providerMetadata)!=null?F:q.providerMetadata,q.state="done",delete V.activeReasoningParts[W.id],U();break}case"file":{V.message.parts.push({type:"file",mediaType:W.mediaType,url:W.url,...W.providerMetadata!=null?{providerMetadata:W.providerMetadata}:{}}),U();break}case"source-url":{V.message.parts.push({type:"source-url",sourceId:W.sourceId,url:W.url,title:W.title,providerMetadata:W.providerMetadata}),U();break}case"source-document":{V.message.parts.push({type:"source-document",sourceId:W.sourceId,mediaType:W.mediaType,title:W.title,filename:W.filename,providerMetadata:W.providerMetadata}),U();break}case"tool-input-start":{let q=V.message.parts.filter($H);if(V.partialToolCalls[W.toolCallId]={text:"",toolName:W.toolName,index:q.length,dynamic:W.dynamic,title:W.title},W.dynamic)N({toolCallId:W.toolCallId,toolName:W.toolName,state:"input-streaming",input:void 0,providerExecuted:W.providerExecuted,title:W.title,providerMetadata:W.providerMetadata});else j({toolCallId:W.toolCallId,toolName:W.toolName,state:"input-streaming",input:void 0,providerExecuted:W.providerExecuted,title:W.title,providerMetadata:W.providerMetadata});U();break}case"tool-input-delta":{let q=V.partialToolCalls[W.toolCallId];if(q==null)throw new UJ({chunkType:"tool-input-delta",chunkId:W.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${W.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});q.text+=W.inputTextDelta;let{value:M}=await AJ(q.text);if(q.dynamic)N({toolCallId:W.toolCallId,toolName:q.toolName,state:"input-streaming",input:M,title:q.title});else j({toolCallId:W.toolCallId,toolName:q.toolName,state:"input-streaming",input:M,title:q.title});U();break}case"tool-input-available":{if(W.dynamic)N({toolCallId:W.toolCallId,toolName:W.toolName,state:"input-available",input:W.input,providerExecuted:W.providerExecuted,providerMetadata:W.providerMetadata,title:W.title});else j({toolCallId:W.toolCallId,toolName:W.toolName,state:"input-available",input:W.input,providerExecuted:W.providerExecuted,providerMetadata:W.providerMetadata,title:W.title});if(U(),Q&&!W.providerExecuted)await Q({toolCall:W});break}case"tool-input-error":{let q=V.message.parts.filter(HJ).find((C)=>C.toolCallId===W.toolCallId);if(q!=null?q.type==="dynamic-tool":!!W.dynamic)N({toolCallId:W.toolCallId,toolName:W.toolName,state:"output-error",input:W.input,errorText:W.errorText,providerExecuted:W.providerExecuted,providerMetadata:W.providerMetadata});else j({toolCallId:W.toolCallId,toolName:W.toolName,state:"output-error",input:void 0,rawInput:W.input,errorText:W.errorText,providerExecuted:W.providerExecuted,providerMetadata:W.providerMetadata});U();break}case"tool-approval-request":{let q=A(W.toolCallId);q.state="approval-requested",q.approval={id:W.approvalId},U();break}case"tool-output-denied":{let q=A(W.toolCallId);q.state="output-denied",U();break}case"tool-output-available":{let q=A(W.toolCallId);if(q.type==="dynamic-tool")N({toolCallId:W.toolCallId,toolName:q.toolName,state:"output-available",input:q.input,output:W.output,preliminary:W.preliminary,providerExecuted:W.providerExecuted,providerMetadata:W.providerMetadata,title:q.title});else j({toolCallId:W.toolCallId,toolName:ZH(q),state:"output-available",input:q.input,output:W.output,providerExecuted:W.providerExecuted,preliminary:W.preliminary,providerMetadata:W.providerMetadata,title:q.title});U();break}case"tool-output-error":{let q=A(W.toolCallId);if(q.type==="dynamic-tool")N({toolCallId:W.toolCallId,toolName:q.toolName,state:"output-error",input:q.input,errorText:W.errorText,providerExecuted:W.providerExecuted,providerMetadata:W.providerMetadata,title:q.title});else j({toolCallId:W.toolCallId,toolName:ZH(q),state:"output-error",input:q.input,rawInput:q.rawInput,errorText:W.errorText,providerExecuted:W.providerExecuted,providerMetadata:W.providerMetadata,title:q.title});U();break}case"start-step":{V.message.parts.push({type:"step-start"});break}case"finish-step":{V.activeTextParts={},V.activeReasoningParts={};break}case"start":{if(W.messageId!=null)V.message.id=W.messageId;if(await w(W.messageMetadata),W.messageId!=null||W.messageMetadata!=null)U();break}case"finish":{if(W.finishReason!=null)V.finishReason=W.finishReason;if(await w(W.messageMetadata),W.messageMetadata!=null)U();break}case"message-metadata":{if(await w(W.messageMetadata),W.messageMetadata!=null)U();break}case"error":{X==null||X(Error(W.errorText));break}default:if(we(W)){if((J==null?void 0:J[W.type])!=null){let C=V.message.parts.findIndex((T)=>("id"in T)&&("data"in T)&&T.id===W.id&&T.type===W.type),R=C>=0?C:V.message.parts.length;await A4({value:W.data,schema:J[W.type],context:{field:`message.parts[${R}].data`,entityName:W.type,entityId:W.id}})}let q=W;if(q.transient){G==null||G(q);break}let M=q.id!=null?V.message.parts.find((C)=>q.type===C.type&&q.id===C.id):void 0;if(M!=null)M.data=q.data;else V.message.parts.push(q);G==null||G(q),U()}}K.enqueue(W)})}}))}function Re({messageId:$,originalMessages:Z=[],onStepFinish:J,onFinish:Y,onError:X,stream:Q}){let G=Z==null?void 0:Z[Z.length-1];if((G==null?void 0:G.role)!=="assistant")G=void 0;else $=G.id;let W=!1,K=Q.pipeThrough(new TransformStream({transform(F,A){if(F.type==="start"){let j=F;if(j.messageId==null&&$!=null)j.messageId=$}if(F.type==="abort")W=!0;A.enqueue(F)}}));if(Y==null&&J==null)return K;let V=Le({lastMessage:G?structuredClone(G):void 0,messageId:$!=null?$:""}),U=async(F)=>{await F({state:V,write:()=>{}})},H=!1,B=async()=>{if(H||!Y)return;H=!0;let F=V.message.id===(G==null?void 0:G.id);await Y({isAborted:W,isContinuation:F,responseMessage:V.message,messages:[...F?Z.slice(0,-1):Z,V.message],finishReason:V.finishReason})},z=async()=>{if(!J)return;let F=V.message.id===(G==null?void 0:G.id);try{await J({isContinuation:F,responseMessage:structuredClone(V.message),messages:[...F?Z.slice(0,-1):Z,structuredClone(V.message)]})}catch(A){X(A)}};return Te({stream:K,runUpdateMessageJob:U,onError:X}).pipeThrough(new TransformStream({async transform(F,A){if(F.type==="finish-step")await z();A.enqueue(F)},async cancel(){await B()},async flush(){await B()}}))}function Pe({response:$,status:Z,statusText:J,headers:Y,stream:X,consumeSseStream:Q}){let G=X.pipeThrough(new sT);if(Q){let[W,K]=G.tee();G=W,Q({stream:K})}nT({response:$,status:Z,statusText:J,headers:Object.fromEntries(jX(Y,rT).entries()),stream:G.pipeThrough(new TextEncoderStream)})}function s6($){let Z=$.pipeThrough(new TransformStream);return Z[Symbol.asyncIterator]=function(){let J=this.getReader(),Y=!1;async function X(Q){var G;if(Y)return;Y=!0;try{if(Q)await((G=J.cancel)==null?void 0:G.call(J))}finally{try{J.releaseLock()}catch(W){}}}return{async next(){if(Y)return{done:!0,value:void 0};let{done:Q,value:G}=await J.read();if(Q)return await X(!0),{done:!0,value:void 0};return{done:!1,value:G}},async return(){return await X(!0),{done:!0,value:void 0}},async throw(Q){throw await X(!0),Q}}},Z}async function Ie({stream:$,onError:Z}){let J=$.getReader();try{while(!0){let{done:Y}=await J.read();if(Y)break}}catch(Y){Z==null||Z(Y)}finally{J.releaseLock()}}function fL(){let $,Z;return{promise:new Promise((Y,X)=>{$=Y,Z=X}),resolve:$,reject:Z}}function tT(){let $=[],Z=null,J=!1,Y=fL(),X=()=>{J=!0,Y.resolve(),$.forEach((G)=>G.cancel()),$=[],Z==null||Z.close()},Q=async()=>{if(J&&$.length===0){Z==null||Z.close();return}if($.length===0)return Y=fL(),await Y.promise,Q();try{let{value:G,done:W}=await $[0].read();if(W)if($.shift(),$.length===0&&J)Z==null||Z.close();else await Q();else Z==null||Z.enqueue(G)}catch(G){Z==null||Z.error(G),$.shift(),X()}};return{stream:new ReadableStream({start(G){Z=G},pull:Q,async cancel(){for(let G of $)await G.cancel();$=[],J=!0}}),addStream:(G)=>{if(J)throw Error("Cannot add inner stream: outer stream is closed");$.push(G.getReader()),Y.resolve()},close:()=>{if(J=!0,Y.resolve(),$.length===0)Z==null||Z.close()},terminate:X}}function Ce({tools:$,generatorStream:Z,tracer:J,telemetry:Y,system:X,messages:Q,abortSignal:G,repairToolCall:W,experimental_context:K,generateId:V,stepNumber:U,model:H,onToolCallStart:B,onToolCallFinish:z}){let F=null,A=new ReadableStream({start(T){F=T}}),j=new Set,N=new Map,w=new Map,q=!1,M=void 0;function C(){if(q&&j.size===0){if(M!=null)F.enqueue(M);F.close()}}let R=new TransformStream({async transform(T,I){let _=T.type;switch(_){case"stream-start":case"text-start":case"text-delta":case"text-end":case"reasoning-start":case"reasoning-delta":case"reasoning-end":case"tool-input-start":case"tool-input-delta":case"tool-input-end":case"source":case"response-metadata":case"error":case"raw":{I.enqueue(T);break}case"file":{I.enqueue({type:"file",file:new We({data:T.data,mediaType:T.mediaType}),...T.providerMetadata!=null?{providerMetadata:T.providerMetadata}:{}});break}case"finish":{M={type:"finish",finishReason:T.finishReason.unified,rawFinishReason:T.finishReason.raw,usage:q4(T.usage),providerMetadata:T.providerMetadata};break}case"tool-approval-request":{let E=w.get(T.toolCallId);if(E==null){F.enqueue({type:"error",error:new YT({toolCallId:T.toolCallId,approvalId:T.approvalId})});break}I.enqueue({type:"tool-approval-request",approvalId:T.approvalId,toolCall:E});break}case"tool-call":{try{let E=await Ae({toolCall:T,tools:$,repairToolCall:W,system:X,messages:Q});if(w.set(E.toolCallId,E),I.enqueue(E),E.invalid){F.enqueue({type:"tool-error",toolCallId:E.toolCallId,toolName:E.toolName,input:E.input,error:AX(E.error),dynamic:!0,title:E.title});break}let f=$==null?void 0:$[E.toolName];if(f==null)break;if(f.onInputAvailable!=null)await f.onInputAvailable({input:E.input,toolCallId:E.toolCallId,messages:Q,abortSignal:G,experimental_context:K});if(await Ke({tool:f,toolCall:E,messages:Q,experimental_context:K})){F.enqueue({type:"tool-approval-request",approvalId:V(),toolCall:E});break}if(N.set(E.toolCallId,E.input),f.execute!=null&&E.providerExecuted!==!0){let b=V();j.add(b),pT({toolCall:E,tools:$,tracer:J,telemetry:Y,messages:Q,abortSignal:G,experimental_context:K,stepNumber:U,model:H,onToolCallStart:B,onToolCallFinish:z,onPreliminaryToolResult:(y)=>{F.enqueue(y)}}).then((y)=>{F.enqueue(y)}).catch((y)=>{F.enqueue({type:"error",error:y})}).finally(()=>{j.delete(b),C()})}}catch(E){F.enqueue({type:"error",error:E})}break}case"tool-result":{let E=T.toolName;if(T.isError)F.enqueue({type:"tool-error",toolCallId:T.toolCallId,toolName:E,input:N.get(T.toolCallId),providerExecuted:!0,error:T.result,dynamic:T.dynamic,...T.providerMetadata!=null?{providerMetadata:T.providerMetadata}:{}});else I.enqueue({type:"tool-result",toolCallId:T.toolCallId,toolName:E,input:N.get(T.toolCallId),output:T.result,providerExecuted:!0,dynamic:T.dynamic,...T.providerMetadata!=null?{providerMetadata:T.providerMetadata}:{}});break}default:throw Error(`Unhandled chunk type: ${_}`)}},flush(){q=!0,C()}});return new ReadableStream({async start(T){return Promise.all([Z.pipeThrough(R).pipeTo(new WritableStream({write(I){T.enqueue(I)},close(){}})),A.pipeTo(new WritableStream({write(I){T.enqueue(I)},close(){T.close()}}))])}})}var Ee=a6({prefix:"aitxt",size:24});function rb0({model:$,tools:Z,toolChoice:J,system:Y,prompt:X,messages:Q,maxRetries:G,abortSignal:W,timeout:K,headers:V,stopWhen:U=qe(1),experimental_output:H,output:B=H,experimental_telemetry:z,prepareStep:F,providerOptions:A,experimental_activeTools:j,activeTools:N=j,experimental_repairToolCall:w,experimental_transform:q,experimental_download:M,includeRawChunks:C=!1,onChunk:R,onError:T=({error:G0})=>{console.error(G0)},onFinish:I,onAbort:_,onStepFinish:E,experimental_onStart:f,experimental_onStepStart:b,experimental_onToolCallStart:y,experimental_onToolCallFinish:k,experimental_context:g,experimental_include:d,_internal:{now:p=VX,generateId:t=Ee}={},...r}){let G0=fT(K),O0=Rt(K),h0=Pt(K),u=O0!=null?new AbortController:void 0,l=h0!=null?new AbortController:void 0;return new _e({model:w4($),telemetry:z,headers:V,settings:r,maxRetries:G,abortSignal:Ne(W,G0!=null?AbortSignal.timeout(G0):void 0,u==null?void 0:u.signal,l==null?void 0:l.signal),stepTimeoutMs:O0,stepAbortController:u,chunkTimeoutMs:h0,chunkAbortController:l,system:Y,prompt:X,messages:Q,tools:Z,toolChoice:J,transforms:y5(q),activeTools:N,repairToolCall:w,stopConditions:y5(U),output:B,providerOptions:A,prepareStep:F,includeRawChunks:C,timeout:K,stopWhen:U,originalAbortSignal:W,onChunk:R,onError:T,onFinish:I,onAbort:_,onStepFinish:E,onStart:f,onStepStart:b,onToolCallStart:y,onToolCallFinish:k,now:p,generateId:t,experimental_context:g,download:M,include:d})}function be($){let Z=void 0,J="",Y="",X=void 0,Q="";function G({controller:W,partialOutput:K=void 0}){W.enqueue({part:{type:"text-delta",id:Z,text:Y,providerMetadata:X},partialOutput:K}),Y=""}return new TransformStream({async transform(W,K){var V;if(W.type==="finish-step"&&Y.length>0)G({controller:K});if(W.type!=="text-delta"&&W.type!=="text-start"&&W.type!=="text-end"){K.enqueue({part:W,partialOutput:void 0});return}if(Z==null)Z=W.id;else if(W.id!==Z){K.enqueue({part:W,partialOutput:void 0});return}if(W.type==="text-start"){K.enqueue({part:W,partialOutput:void 0});return}if(W.type==="text-end"){if(Y.length>0)G({controller:K});K.enqueue({part:W,partialOutput:void 0});return}J+=W.text,Y+=W.text,X=(V=W.providerMetadata)!=null?V:X;let U=await $.parsePartialOutput({text:J});if(U!==void 0){let H=typeof U.partial==="string"?U.partial:JSON.stringify(U.partial);if(H!==Q)G({controller:K,partialOutput:U.partial}),Q=H}}})}var _e=class{constructor({model:$,telemetry:Z,headers:J,settings:Y,maxRetries:X,abortSignal:Q,stepTimeoutMs:G,stepAbortController:W,chunkTimeoutMs:K,chunkAbortController:V,system:U,prompt:H,messages:B,tools:z,toolChoice:F,transforms:A,activeTools:j,repairToolCall:N,stopConditions:w,output:q,providerOptions:M,prepareStep:C,includeRawChunks:R,now:T,generateId:I,timeout:_,stopWhen:E,originalAbortSignal:f,onChunk:b,onError:y,onFinish:k,onAbort:g,onStepFinish:d,onStart:p,onStepStart:t,onToolCallStart:r,onToolCallFinish:G0,experimental_context:O0,download:h0,include:u}){this._totalUsage=new Q8,this._finishReason=new Q8,this._rawFinishReason=new Q8,this._steps=new Q8,this.outputSpecification=q,this.includeRawChunks=R,this.tools=z;let $0=et()(Z==null?void 0:Z.integrations),v,h=[],c=[],m=void 0,a=void 0,e=void 0,H0={},A0=[],P0=[],s0=new Map,o,K0={},z0={},j0=new TransformStream({async transform(n,J0){var C0,M0,D1,g0;J0.enqueue(n);let{part:Z0}=n;if(Z0.type==="text-delta"||Z0.type==="reasoning-delta"||Z0.type==="source"||Z0.type==="tool-call"||Z0.type==="tool-result"||Z0.type==="tool-input-start"||Z0.type==="tool-input-delta"||Z0.type==="raw")await(b==null?void 0:b({chunk:Z0}));if(Z0.type==="error")await y({error:VH(Z0.error)});if(Z0.type==="text-start")K0[Z0.id]={type:"text",text:"",providerMetadata:Z0.providerMetadata},h.push(K0[Z0.id]);if(Z0.type==="text-delta"){let v0=K0[Z0.id];if(v0==null){J0.enqueue({part:{type:"error",error:`text part ${Z0.id} not found`},partialOutput:void 0});return}v0.text+=Z0.text,v0.providerMetadata=(C0=Z0.providerMetadata)!=null?C0:v0.providerMetadata}if(Z0.type==="text-end"){let v0=K0[Z0.id];if(v0==null){J0.enqueue({part:{type:"error",error:`text part ${Z0.id} not found`},partialOutput:void 0});return}v0.providerMetadata=(M0=Z0.providerMetadata)!=null?M0:v0.providerMetadata,delete K0[Z0.id]}if(Z0.type==="reasoning-start")z0[Z0.id]={type:"reasoning",text:"",providerMetadata:Z0.providerMetadata},h.push(z0[Z0.id]);if(Z0.type==="reasoning-delta"){let v0=z0[Z0.id];if(v0==null){J0.enqueue({part:{type:"error",error:`reasoning part ${Z0.id} not found`},partialOutput:void 0});return}v0.text+=Z0.text,v0.providerMetadata=(D1=Z0.providerMetadata)!=null?D1:v0.providerMetadata}if(Z0.type==="reasoning-end"){let v0=z0[Z0.id];if(v0==null){J0.enqueue({part:{type:"error",error:`reasoning part ${Z0.id} not found`},partialOutput:void 0});return}v0.providerMetadata=(g0=Z0.providerMetadata)!=null?g0:v0.providerMetadata,delete z0[Z0.id]}if(Z0.type==="file")h.push({type:"file",file:Z0.file,...Z0.providerMetadata!=null?{providerMetadata:Z0.providerMetadata}:{}});if(Z0.type==="source")h.push(Z0);if(Z0.type==="tool-call")h.push(Z0);if(Z0.type==="tool-result"&&!Z0.preliminary)h.push(Z0);if(Z0.type==="tool-approval-request")h.push(Z0);if(Z0.type==="tool-error")h.push(Z0);if(Z0.type==="start-step")h=[],z0={},K0={},H0=Z0.request,A0=Z0.warnings;if(Z0.type==="finish-step"){let v0=await _L({content:h,tools:z}),V0=new Oe({stepNumber:P0.length,model:x,...i,experimental_context:O0,content:h,finishReason:Z0.finishReason,rawFinishReason:Z0.rawFinishReason,usage:Z0.usage,warnings:A0,request:H0,response:{...Z0.response,messages:[...c,...v0]},providerMetadata:Z0.providerMetadata});await v5({event:V0,callbacks:[d,$0.onStepFinish]}),D4({warnings:A0,provider:x.provider,model:x.modelId}),P0.push(V0),c.push(...v0),v.resolve()}if(Z0.type==="finish")e=Z0.totalUsage,m=Z0.finishReason,a=Z0.rawFinishReason},async flush(n){var J0,C0,M0,D1,g0,Z0,v0;try{if(P0.length===0){let H1=(Q==null?void 0:Q.aborted)?Q.reason:new ia({message:"No output generated. Check the stream for errors."});U1._finishReason.reject(H1),U1._rawFinishReason.reject(H1),U1._totalUsage.reject(H1),U1._steps.reject(H1);return}let V0=m!=null?m:"other",$1=e!=null?e:F4();U1._finishReason.resolve(V0),U1._rawFinishReason.resolve(a),U1._totalUsage.resolve($1),U1._steps.resolve(P0);let D0=P0[P0.length-1];await v5({event:{stepNumber:D0.stepNumber,model:D0.model,functionId:D0.functionId,metadata:D0.metadata,experimental_context:D0.experimental_context,finishReason:D0.finishReason,rawFinishReason:D0.rawFinishReason,totalUsage:$1,usage:D0.usage,content:D0.content,text:D0.text,reasoningText:D0.reasoningText,reasoning:D0.reasoning,files:D0.files,sources:D0.sources,toolCalls:D0.toolCalls,staticToolCalls:D0.staticToolCalls,dynamicToolCalls:D0.dynamicToolCalls,toolResults:D0.toolResults,staticToolResults:D0.staticToolResults,dynamicToolResults:D0.dynamicToolResults,request:D0.request,response:D0.response,warnings:D0.warnings,providerMetadata:D0.providerMetadata,steps:P0},callbacks:[k,$0.onFinish]}),o.setAttributes(await s$({telemetry:Z,attributes:{"ai.response.finishReason":V0,"ai.response.text":{output:()=>D0.text},"ai.response.reasoning":{output:()=>D0.reasoningText},"ai.response.toolCalls":{output:()=>{var H1;return((H1=D0.toolCalls)==null?void 0:H1.length)?JSON.stringify(D0.toolCalls):void 0}},"ai.response.providerMetadata":JSON.stringify(D0.providerMetadata),"ai.usage.inputTokens":$1.inputTokens,"ai.usage.inputTokenDetails.noCacheTokens":(J0=$1.inputTokenDetails)==null?void 0:J0.noCacheTokens,"ai.usage.inputTokenDetails.cacheReadTokens":(C0=$1.inputTokenDetails)==null?void 0:C0.cacheReadTokens,"ai.usage.inputTokenDetails.cacheWriteTokens":(M0=$1.inputTokenDetails)==null?void 0:M0.cacheWriteTokens,"ai.usage.outputTokens":$1.outputTokens,"ai.usage.outputTokenDetails.textTokens":(D1=$1.outputTokenDetails)==null?void 0:D1.textTokens,"ai.usage.outputTokenDetails.reasoningTokens":(g0=$1.outputTokenDetails)==null?void 0:g0.reasoningTokens,"ai.usage.totalTokens":$1.totalTokens,"ai.usage.reasoningTokens":(Z0=$1.outputTokenDetails)==null?void 0:Z0.reasoningTokens,"ai.usage.cachedInputTokens":(v0=$1.inputTokenDetails)==null?void 0:v0.cacheReadTokens}}))}catch(V0){n.error(V0)}finally{o.end()}}}),Q1=tT();this.addStream=Q1.addStream,this.closeStream=Q1.close;let _0=Q1.stream.getReader(),e0=new ReadableStream({async start(n){n.enqueue({type:"start"})},async pull(n){function J0(){g==null||g({steps:P0}),n.enqueue({type:"abort",...(Q==null?void 0:Q.reason)!==void 0?{reason:r6(Q.reason)}:{}}),n.close()}try{let{done:C0,value:M0}=await _0.read();if(C0){n.close();return}if(Q==null?void 0:Q.aborted){J0();return}n.enqueue(M0)}catch(C0){if(N4(C0)&&(Q==null?void 0:Q.aborted))J0();else n.error(C0)}},cancel(n){return Q1.stream.cancel(n)}});for(let n of A)e0=e0.pipeThrough(n({tools:z,stopStream(){Q1.terminate()}}));this.baseStream=e0.pipeThrough(be(q!=null?q:eU())).pipeThrough(j0);let{maxRetries:S0,retry:C1}=FH({maxRetries:X,abortSignal:Q}),n0=HH(Z),z1=BX(Y),a0=UH({model:$,telemetry:Z,headers:J,settings:{...z1,maxRetries:S0}}),U1=this,x={provider:$.provider,modelId:$.modelId},i={functionId:Z==null?void 0:Z.functionId,metadata:Z==null?void 0:Z.metadata};h5({name:"ai.streamText",attributes:s$({telemetry:Z,attributes:{...x5({operationId:"ai.streamText",telemetry:Z}),...a0,"ai.prompt":{input:()=>JSON.stringify({system:U,prompt:H,messages:B})}}}),tracer:n0,endWhenDone:!1,fn:async(n)=>{o=n;let J0=await KH({system:U,prompt:H,messages:B});await v5({event:{model:x,system:U,prompt:H,messages:B,tools:z,toolChoice:F,activeTools:j,maxOutputTokens:z1.maxOutputTokens,temperature:z1.temperature,topP:z1.topP,topK:z1.topK,presencePenalty:z1.presencePenalty,frequencyPenalty:z1.frequencyPenalty,stopSequences:z1.stopSequences,seed:z1.seed,maxRetries:S0,timeout:_,headers:J,providerOptions:M,stopWhen:E,output:q,abortSignal:f,include:u,...i,experimental_context:O0},callbacks:[p,$0.onStart]});let C0=J0.messages,M0=[],{approvedToolApprovals:D1,deniedToolApprovals:g0}=Ye({messages:C0});if(g0.length>0||D1.length>0){let v0=D1.filter((P1)=>!P1.toolCall.providerExecuted),V0=g0.filter((P1)=>!P1.toolCall.providerExecuted),$1=g0.filter((P1)=>P1.toolCall.providerExecuted),D0,H1=new ReadableStream({start(P1){D0=P1}});U1.addStream(H1);try{for(let E1 of[...V0,...$1])D0==null||D0.enqueue({type:"tool-output-denied",toolCallId:E1.toolCall.toolCallId,toolName:E1.toolCall.toolName});let P1=[];if(await Promise.all(v0.map(async(E1)=>{let b1=await pT({toolCall:E1.toolCall,tools:z,tracer:n0,telemetry:Z,messages:C0,abortSignal:Q,experimental_context:O0,stepNumber:P0.length,model:x,onToolCallStart:[r,$0.onToolCallStart],onToolCallFinish:[G0,$0.onToolCallFinish],onPreliminaryToolResult:(A6)=>{D0==null||D0.enqueue(A6)}});if(b1!=null)D0==null||D0.enqueue(b1),P1.push(b1)})),P1.length>0||V0.length>0){let E1=[];for(let b1 of P1)E1.push({type:"tool-result",toolCallId:b1.toolCallId,toolName:b1.toolName,output:await BJ({toolCallId:b1.toolCallId,input:b1.input,tool:z==null?void 0:z[b1.toolName],output:b1.type==="tool-result"?b1.output:b1.error,errorMode:b1.type==="tool-error"?"text":"none"})});for(let b1 of V0)E1.push({type:"tool-result",toolCallId:b1.toolCall.toolCallId,toolName:b1.toolCall.toolName,output:{type:"execution-denied",reason:b1.approvalResponse.reason}});M0.push({role:"tool",content:E1})}}finally{D0==null||D0.close()}}c.push(...M0);async function Z0({currentStep:v0,responseMessages:V0,usage:$1}){var D0,H1,P1,E1,b1,A6,m1,i8,tA;let A8=U1.includeRawChunks,O6=G!=null?setTimeout(()=>W.abort(),G):void 0,M7=void 0;function y$(){if(K!=null){if(M7!=null)clearTimeout(M7);M7=setTimeout(()=>V.abort(),K)}}function U9(){if(M7!=null)clearTimeout(M7),M7=void 0}function eA(){if(O6!=null)clearTimeout(O6)}try{v=new Q8;let O8=[...C0,...V0],j$=await(C==null?void 0:C({model:$,steps:P0,stepNumber:P0.length,messages:O8,experimental_context:O0})),jZ=w4((D0=j$==null?void 0:j$.model)!=null?D0:$),$O={provider:jZ.provider,modelId:jZ.modelId},ZO=await WH({prompt:{system:(H1=j$==null?void 0:j$.system)!=null?H1:J0.system,messages:(P1=j$==null?void 0:j$.messages)!=null?P1:O8},supportedUrls:await jZ.supportedUrls,download:h0}),JO=(E1=j$==null?void 0:j$.activeTools)!=null?E1:j,{toolChoice:H9,tools:oK}=await ht({tools:z,toolChoice:(b1=j$==null?void 0:j$.toolChoice)!=null?b1:F,activeTools:JO});O0=(A6=j$==null?void 0:j$.experimental_context)!=null?A6:O0;let Ld=(m1=j$==null?void 0:j$.messages)!=null?m1:O8,Td=(i8=j$==null?void 0:j$.system)!=null?i8:J0.system,YO=zH(M,j$==null?void 0:j$.providerOptions);await v5({event:{stepNumber:P0.length,model:$O,system:Td,messages:Ld,tools:z,toolChoice:H9,activeTools:JO,steps:[...P0],providerOptions:YO,timeout:_,headers:J,stopWhen:E,output:q,abortSignal:f,include:u,...i,experimental_context:O0},callbacks:[t,$0.onStepStart]});let{result:{stream:Rd,response:XO,request:sK},doStreamSpan:B5,startTimestampMs:QO}=await C1(()=>h5({name:"ai.streamText.doStream",attributes:s$({telemetry:Z,attributes:{...x5({operationId:"ai.streamText.doStream",telemetry:Z}),...a0,"ai.model.provider":jZ.provider,"ai.model.id":jZ.modelId,"ai.prompt.messages":{input:()=>BH(ZO)},"ai.prompt.tools":{input:()=>oK==null?void 0:oK.map((y0)=>JSON.stringify(y0))},"ai.prompt.toolChoice":{input:()=>H9!=null?JSON.stringify(H9):void 0},"gen_ai.system":jZ.provider,"gen_ai.request.model":jZ.modelId,"gen_ai.request.frequency_penalty":z1.frequencyPenalty,"gen_ai.request.max_tokens":z1.maxOutputTokens,"gen_ai.request.presence_penalty":z1.presencePenalty,"gen_ai.request.stop_sequences":z1.stopSequences,"gen_ai.request.temperature":z1.temperature,"gen_ai.request.top_k":z1.topK,"gen_ai.request.top_p":z1.topP}}),tracer:n0,endWhenDone:!1,fn:async(y0)=>({startTimestampMs:T(),doStreamSpan:y0,result:await jZ.doStream({...z1,tools:oK,toolChoice:H9,responseFormat:await(q==null?void 0:q.responseFormat),prompt:ZO,providerOptions:YO,abortSignal:Q,headers:J,includeRawChunks:A8})})})),Pd=Ce({tools:z,generatorStream:Rd,tracer:n0,telemetry:Z,system:U,messages:O8,repairToolCall:N,abortSignal:Q,experimental_context:O0,generateId:I,stepNumber:P0.length,model:$O,onToolCallStart:[r,$0.onToolCallStart],onToolCallFinish:[G0,$0.onToolCallFinish]}),Id=((tA=u==null?void 0:u.requestBody)!=null?tA:!0)?sK!=null?sK:{}:{...sK,body:void 0},jY=[],NY=[],rK,aK={},D7="other",tK=void 0,x$=F4(),GO,WO=!0,q6={id:I(),timestamp:new Date,modelId:x.modelId},Cd="";U1.addStream(Pd.pipeThrough(new TransformStream({async transform(y0,N$){var MY,DY,wY,LY,TY;if(y$(),y0.type==="stream-start"){rK=y0.warnings;return}if(WO){let M$=T()-QO;WO=!1,B5.addEvent("ai.stream.firstChunk",{"ai.response.msToFirstChunk":M$}),B5.setAttributes({"ai.response.msToFirstChunk":M$}),N$.enqueue({type:"start-step",request:Id,warnings:rK!=null?rK:[]})}let RY=y0.type;switch(RY){case"tool-approval-request":case"text-start":case"text-end":{N$.enqueue(y0);break}case"text-delta":{if(y0.delta.length>0)N$.enqueue({type:"text-delta",id:y0.id,text:y0.delta,providerMetadata:y0.providerMetadata}),Cd+=y0.delta;break}case"reasoning-start":case"reasoning-end":{N$.enqueue(y0);break}case"reasoning-delta":{N$.enqueue({type:"reasoning-delta",id:y0.id,text:y0.delta,providerMetadata:y0.providerMetadata});break}case"tool-call":{N$.enqueue(y0),jY.push(y0);break}case"tool-result":{if(N$.enqueue(y0),!y0.preliminary)NY.push(y0);break}case"tool-error":{N$.enqueue(y0),NY.push(y0);break}case"response-metadata":{q6={id:(MY=y0.id)!=null?MY:q6.id,timestamp:(DY=y0.timestamp)!=null?DY:q6.timestamp,modelId:(wY=y0.modelId)!=null?wY:q6.modelId};break}case"finish":{x$=y0.usage,D7=y0.finishReason,tK=y0.rawFinishReason,GO=y0.providerMetadata;let M$=T()-QO;B5.addEvent("ai.stream.finish"),B5.setAttributes({"ai.response.msToFinish":M$,"ai.response.avgOutputTokensPerSecond":1000*((LY=x$.outputTokens)!=null?LY:0)/M$});break}case"file":{N$.enqueue(y0);break}case"source":{N$.enqueue(y0);break}case"tool-input-start":{aK[y0.id]=y0.toolName;let M$=z==null?void 0:z[y0.toolName];if((M$==null?void 0:M$.onInputStart)!=null)await M$.onInputStart({toolCallId:y0.id,messages:O8,abortSignal:Q,experimental_context:O0});N$.enqueue({...y0,dynamic:(TY=y0.dynamic)!=null?TY:(M$==null?void 0:M$.type)==="dynamic",title:M$==null?void 0:M$.title});break}case"tool-input-end":{delete aK[y0.id],N$.enqueue(y0);break}case"tool-input-delta":{let M$=aK[y0.id],w7=z==null?void 0:z[M$];if((w7==null?void 0:w7.onInputDelta)!=null)await w7.onInputDelta({inputTextDelta:y0.delta,toolCallId:y0.id,messages:O8,abortSignal:Q,experimental_context:O0});N$.enqueue(y0);break}case"error":{N$.enqueue(y0),D7="error";break}case"raw":{if(A8)N$.enqueue(y0);break}default:throw Error(`Unknown chunk type: ${RY}`)}},async flush(y0){var N$,MY,DY,wY,LY,TY,RY;let M$=jY.length>0?JSON.stringify(jY):void 0;try{B5.setAttributes(await s$({telemetry:Z,attributes:{"ai.response.finishReason":D7,"ai.response.toolCalls":{output:()=>M$},"ai.response.id":q6.id,"ai.response.model":q6.modelId,"ai.response.timestamp":q6.timestamp.toISOString(),"ai.usage.inputTokens":x$.inputTokens,"ai.usage.inputTokenDetails.noCacheTokens":(N$=x$.inputTokenDetails)==null?void 0:N$.noCacheTokens,"ai.usage.inputTokenDetails.cacheReadTokens":(MY=x$.inputTokenDetails)==null?void 0:MY.cacheReadTokens,"ai.usage.inputTokenDetails.cacheWriteTokens":(DY=x$.inputTokenDetails)==null?void 0:DY.cacheWriteTokens,"ai.usage.outputTokens":x$.outputTokens,"ai.usage.outputTokenDetails.textTokens":(wY=x$.outputTokenDetails)==null?void 0:wY.textTokens,"ai.usage.outputTokenDetails.reasoningTokens":(LY=x$.outputTokenDetails)==null?void 0:LY.reasoningTokens,"ai.usage.totalTokens":x$.totalTokens,"ai.usage.reasoningTokens":(TY=x$.outputTokenDetails)==null?void 0:TY.reasoningTokens,"ai.usage.cachedInputTokens":(RY=x$.inputTokenDetails)==null?void 0:RY.cacheReadTokens,"gen_ai.response.finish_reasons":[D7],"gen_ai.response.id":q6.id,"gen_ai.response.model":q6.modelId,"gen_ai.usage.input_tokens":x$.inputTokens,"gen_ai.usage.output_tokens":x$.outputTokens}}))}catch(R$){}y0.enqueue({type:"finish-step",finishReason:D7,rawFinishReason:tK,usage:x$,providerMetadata:GO,response:{...q6,headers:XO==null?void 0:XO.headers}});let w7=$e($1,x$);await v.promise;let eK=P0[P0.length-1];try{B5.setAttributes(await s$({telemetry:Z,attributes:{"ai.response.text":{output:()=>eK.text},"ai.response.reasoning":{output:()=>eK.reasoningText},"ai.response.providerMetadata":JSON.stringify(eK.providerMetadata)}}))}catch(R$){}finally{B5.end()}let KO=jY.filter((R$)=>R$.providerExecuted!==!0),Ed=NY.filter((R$)=>R$.providerExecuted!==!0);for(let R$ of jY){if(R$.providerExecuted!==!0)continue;let $V=z==null?void 0:z[R$.toolName];if(($V==null?void 0:$V.type)==="provider"&&$V.supportsDeferredResults){if(!NY.some((ZV)=>(ZV.type==="tool-result"||ZV.type==="tool-error")&&ZV.toolCallId===R$.toolCallId))s0.set(R$.toolCallId,{toolName:R$.toolName})}}for(let R$ of NY)if(R$.type==="tool-result"||R$.type==="tool-error")s0.delete(R$.toolCallId);if(eA(),U9(),(KO.length>0&&Ed.length===KO.length||s0.size>0)&&!await je({stopConditions:w,steps:P0})){V0.push(...await _L({content:P0[P0.length-1].content,tools:z}));try{await Z0({currentStep:v0+1,responseMessages:V0,usage:w7})}catch(R$){y0.enqueue({type:"error",error:R$}),U1.closeStream()}}else y0.enqueue({type:"finish",finishReason:D7,rawFinishReason:tK,totalUsage:w7}),U1.closeStream()}})))}finally{eA(),U9()}}await Z0({currentStep:0,responseMessages:M0,usage:F4()})}}).catch((n)=>{U1.addStream(new ReadableStream({start(J0){J0.enqueue({type:"error",error:n}),J0.close()}})),U1.closeStream()})}get steps(){return this.consumeStream(),this._steps.promise}get finalStep(){return this.steps.then(($)=>$[$.length-1])}get content(){return this.finalStep.then(($)=>$.content)}get warnings(){return this.finalStep.then(($)=>$.warnings)}get providerMetadata(){return this.finalStep.then(($)=>$.providerMetadata)}get text(){return this.finalStep.then(($)=>$.text)}get reasoningText(){return this.finalStep.then(($)=>$.reasoningText)}get reasoning(){return this.finalStep.then(($)=>$.reasoning)}get sources(){return this.finalStep.then(($)=>$.sources)}get files(){return this.finalStep.then(($)=>$.files)}get toolCalls(){return this.finalStep.then(($)=>$.toolCalls)}get staticToolCalls(){return this.finalStep.then(($)=>$.staticToolCalls)}get dynamicToolCalls(){return this.finalStep.then(($)=>$.dynamicToolCalls)}get toolResults(){return this.finalStep.then(($)=>$.toolResults)}get staticToolResults(){return this.finalStep.then(($)=>$.staticToolResults)}get dynamicToolResults(){return this.finalStep.then(($)=>$.dynamicToolResults)}get usage(){return this.finalStep.then(($)=>$.usage)}get request(){return this.finalStep.then(($)=>$.request)}get response(){return this.finalStep.then(($)=>$.response)}get totalUsage(){return this.consumeStream(),this._totalUsage.promise}get finishReason(){return this.consumeStream(),this._finishReason.promise}get rawFinishReason(){return this.consumeStream(),this._rawFinishReason.promise}teeStream(){let[$,Z]=this.baseStream.tee();return this.baseStream=Z,$}get textStream(){return s6(this.teeStream().pipeThrough(new TransformStream({transform({part:$},Z){if($.type==="text-delta")Z.enqueue($.text)}})))}get fullStream(){return s6(this.teeStream().pipeThrough(new TransformStream({transform({part:$},Z){Z.enqueue($)}})))}async consumeStream($){var Z;try{await Ie({stream:this.fullStream,onError:$==null?void 0:$.onError})}catch(J){(Z=$==null?void 0:$.onError)==null||Z.call($,J)}}get experimental_partialOutputStream(){return this.partialOutputStream}get partialOutputStream(){return s6(this.teeStream().pipeThrough(new TransformStream({transform({partialOutput:$},Z){if($!=null)Z.enqueue($)}})))}get elementStream(){var $,Z,J;let Y=($=this.outputSpecification)==null?void 0:$.createElementStreamTransform();if(Y==null)throw new g5({functionality:`element streams in ${(J=(Z=this.outputSpecification)==null?void 0:Z.name)!=null?J:"text"} mode`});return s6(this.teeStream().pipeThrough(Y))}get output(){return this.finalStep.then(($)=>{var Z;return((Z=this.outputSpecification)!=null?Z:eU()).parseCompleteOutput({text:$.text},{response:$.response,usage:$.usage,finishReason:$.finishReason})})}toUIMessageStream({originalMessages:$,generateMessageId:Z,onFinish:J,messageMetadata:Y,sendReasoning:X=!0,sendSources:Q=!1,sendStart:G=!0,sendFinish:W=!0,onError:K=r6}={}){let V=Z!=null?De({originalMessages:$,responseMessageId:Z}):void 0,U=(B)=>{var z;let F=(z=this.tools)==null?void 0:z[B.toolName];if(F==null)return B.dynamic;return(F==null?void 0:F.type)==="dynamic"?!0:void 0},H=this.fullStream.pipeThrough(new TransformStream({transform:async(B,z)=>{let F=Y==null?void 0:Y({part:B}),A=B.type;switch(A){case"text-start":{z.enqueue({type:"text-start",id:B.id,...B.providerMetadata!=null?{providerMetadata:B.providerMetadata}:{}});break}case"text-delta":{z.enqueue({type:"text-delta",id:B.id,delta:B.text,...B.providerMetadata!=null?{providerMetadata:B.providerMetadata}:{}});break}case"text-end":{z.enqueue({type:"text-end",id:B.id,...B.providerMetadata!=null?{providerMetadata:B.providerMetadata}:{}});break}case"reasoning-start":case"reasoning-end":{if(X)z.enqueue({type:A,id:B.id,...B.providerMetadata!=null?{providerMetadata:B.providerMetadata}:{}});break}case"reasoning-delta":{if(X)z.enqueue({type:"reasoning-delta",id:B.id,delta:B.text,...B.providerMetadata!=null?{providerMetadata:B.providerMetadata}:{}});break}case"file":{z.enqueue({type:"file",mediaType:B.file.mediaType,url:`data:${B.file.mediaType};base64,${B.file.base64}`,...B.providerMetadata!=null?{providerMetadata:B.providerMetadata}:{}});break}case"source":{if(Q&&B.sourceType==="url")z.enqueue({type:"source-url",sourceId:B.id,url:B.url,title:B.title,...B.providerMetadata!=null?{providerMetadata:B.providerMetadata}:{}});if(Q&&B.sourceType==="document")z.enqueue({type:"source-document",sourceId:B.id,mediaType:B.mediaType,title:B.title,filename:B.filename,...B.providerMetadata!=null?{providerMetadata:B.providerMetadata}:{}});break}case"tool-input-start":{let j=U(B);z.enqueue({type:"tool-input-start",toolCallId:B.id,toolName:B.toolName,...B.providerExecuted!=null?{providerExecuted:B.providerExecuted}:{},...B.providerMetadata!=null?{providerMetadata:B.providerMetadata}:{},...j!=null?{dynamic:j}:{},...B.title!=null?{title:B.title}:{}});break}case"tool-input-delta":{z.enqueue({type:"tool-input-delta",toolCallId:B.id,inputTextDelta:B.delta});break}case"tool-call":{let j=U(B);if(B.invalid)z.enqueue({type:"tool-input-error",toolCallId:B.toolCallId,toolName:B.toolName,input:B.input,...B.providerExecuted!=null?{providerExecuted:B.providerExecuted}:{},...B.providerMetadata!=null?{providerMetadata:B.providerMetadata}:{},...j!=null?{dynamic:j}:{},errorText:K(B.error),...B.title!=null?{title:B.title}:{}});else z.enqueue({type:"tool-input-available",toolCallId:B.toolCallId,toolName:B.toolName,input:B.input,...B.providerExecuted!=null?{providerExecuted:B.providerExecuted}:{},...B.providerMetadata!=null?{providerMetadata:B.providerMetadata}:{},...j!=null?{dynamic:j}:{},...B.title!=null?{title:B.title}:{}});break}case"tool-approval-request":{z.enqueue({type:"tool-approval-request",approvalId:B.approvalId,toolCallId:B.toolCall.toolCallId});break}case"tool-result":{let j=U(B);z.enqueue({type:"tool-output-available",toolCallId:B.toolCallId,output:B.output,...B.providerExecuted!=null?{providerExecuted:B.providerExecuted}:{},...B.providerMetadata!=null?{providerMetadata:B.providerMetadata}:{},...B.preliminary!=null?{preliminary:B.preliminary}:{},...j!=null?{dynamic:j}:{}});break}case"tool-error":{let j=U(B);z.enqueue({type:"tool-output-error",toolCallId:B.toolCallId,errorText:B.providerExecuted?typeof B.error==="string"?B.error:JSON.stringify(B.error):K(B.error),...B.providerExecuted!=null?{providerExecuted:B.providerExecuted}:{},...B.providerMetadata!=null?{providerMetadata:B.providerMetadata}:{},...j!=null?{dynamic:j}:{}});break}case"tool-output-denied":{z.enqueue({type:"tool-output-denied",toolCallId:B.toolCallId});break}case"error":{z.enqueue({type:"error",errorText:K(B.error)});break}case"start-step":{z.enqueue({type:"start-step"});break}case"finish-step":{z.enqueue({type:"finish-step"});break}case"start":{if(G)z.enqueue({type:"start",...F!=null?{messageMetadata:F}:{},...V!=null?{messageId:V}:{}});break}case"finish":{if(W)z.enqueue({type:"finish",finishReason:B.finishReason,...F!=null?{messageMetadata:F}:{}});break}case"abort":{z.enqueue(B);break}case"tool-input-end":break;case"raw":break;default:throw Error(`Unknown chunk type: ${A}`)}if(F!=null&&A!=="start"&&A!=="finish")z.enqueue({type:"message-metadata",messageMetadata:F})}}));return s6(Re({stream:H,messageId:V!=null?V:Z==null?void 0:Z(),originalMessages:$,onFinish:J,onError:K}))}pipeUIMessageStreamToResponse($,{originalMessages:Z,generateMessageId:J,onFinish:Y,messageMetadata:X,sendReasoning:Q,sendSources:G,sendFinish:W,sendStart:K,onError:V,...U}={}){Pe({response:$,stream:this.toUIMessageStream({originalMessages:Z,generateMessageId:J,onFinish:Y,messageMetadata:X,sendReasoning:Q,sendSources:G,sendFinish:W,sendStart:K,onError:V}),...U})}pipeTextStreamToResponse($,Z){oT({response:$,textStream:this.textStream,...Z})}toUIMessageStreamResponse({originalMessages:$,generateMessageId:Z,onFinish:J,messageMetadata:Y,sendReasoning:X,sendSources:Q,sendFinish:G,sendStart:W,onError:K,...V}={}){return Me({stream:this.toUIMessageStream({originalMessages:$,generateMessageId:Z,onFinish:J,messageMetadata:Y,sendReasoning:X,sendSources:Q,sendFinish:G,sendStart:W,onError:K}),...V})}toTextStreamResponse($){return iT({textStream:this.textStream,...$})}};async function eT($,Z){let J=[];if(Z==null?void 0:Z.ignoreIncompleteToolCalls)$=$.map((Y)=>({...Y,parts:Y.parts.filter((X)=>!HJ(X)||X.state!=="input-streaming"&&X.state!=="input-available")}));for(let Y of $)switch(Y.role){case"system":{let X=Y.parts.filter((G)=>G.type==="text"),Q=X.reduce((G,W)=>{if(W.providerMetadata!=null)return{...G,...W.providerMetadata};return G},{});J.push({role:"system",content:X.map((G)=>G.text).join(""),...Object.keys(Q).length>0?{providerOptions:Q}:{}});break}case"user":{J.push({role:"user",content:Y.parts.map((X)=>{var Q;if(nU(X))return{type:"text",text:X.text,...X.providerMetadata!=null?{providerOptions:X.providerMetadata}:{}};if(oU(X))return{type:"file",mediaType:X.mediaType,filename:X.filename,data:X.url,...X.providerMetadata!=null?{providerOptions:X.providerMetadata}:{}};if(iU(X))return(Q=Z==null?void 0:Z.convertDataPart)==null?void 0:Q.call(Z,X)}).filter(uL)});break}case"assistant":{if(Y.parts!=null){let X=[];async function Q(){var G,W,K,V,U,H,B;if(X.length===0)return;let z=[];for(let A of X)if(nU(A))z.push({type:"text",text:A.text,...A.providerMetadata!=null?{providerOptions:A.providerMetadata}:{}});else if(oU(A))z.push({type:"file",mediaType:A.mediaType,filename:A.filename,data:A.url,...A.providerMetadata!=null?{providerOptions:A.providerMetadata}:{}});else if(SL(A))z.push({type:"reasoning",text:A.text,providerOptions:A.providerMetadata});else if(HJ(A)){let j=sU(A);if(A.state!=="input-streaming"){if(z.push({type:"tool-call",toolCallId:A.toolCallId,toolName:j,input:A.state==="output-error"?(G=A.input)!=null?G:("rawInput"in A)?A.rawInput:void 0:A.input,providerExecuted:A.providerExecuted,...A.callProviderMetadata!=null?{providerOptions:A.callProviderMetadata}:{}}),A.approval!=null)z.push({type:"tool-approval-request",approvalId:A.approval.id,toolCallId:A.toolCallId});if(A.providerExecuted===!0&&A.state!=="approval-responded"&&(A.state==="output-available"||A.state==="output-error")){let N=(W=A.resultProviderMetadata)!=null?W:A.callProviderMetadata;z.push({type:"tool-result",toolCallId:A.toolCallId,toolName:j,output:await BJ({toolCallId:A.toolCallId,input:A.input,output:A.state==="output-error"?A.errorText:A.output,tool:(K=Z==null?void 0:Z.tools)==null?void 0:K[j],errorMode:A.state==="output-error"?"json":"none"}),...N!=null?{providerOptions:N}:{}})}}}else if(iU(A)){let j=(V=Z==null?void 0:Z.convertDataPart)==null?void 0:V.call(Z,A);if(j!=null)z.push(j)}else throw Error(`Unsupported part: ${A}`);J.push({role:"assistant",content:z});let F=X.filter((A)=>{var j;return HJ(A)&&(A.providerExecuted!==!0||((j=A.approval)==null?void 0:j.approved)!=null)});if(F.length>0){let A=[];for(let j of F){if(((U=j.approval)==null?void 0:U.approved)!=null)A.push({type:"tool-approval-response",approvalId:j.approval.id,approved:j.approval.approved,reason:j.approval.reason,providerExecuted:j.providerExecuted});if(j.providerExecuted===!0)continue;switch(j.state){case"output-denied":{A.push({type:"tool-result",toolCallId:j.toolCallId,toolName:sU(j),output:{type:"error-text",value:(H=j.approval.reason)!=null?H:"Tool execution denied."},...j.callProviderMetadata!=null?{providerOptions:j.callProviderMetadata}:{}});break}case"output-error":case"output-available":{let N=sU(j);A.push({type:"tool-result",toolCallId:j.toolCallId,toolName:N,output:await BJ({toolCallId:j.toolCallId,input:j.input,output:j.state==="output-error"?j.errorText:j.output,tool:(B=Z==null?void 0:Z.tools)==null?void 0:B[N],errorMode:j.state==="output-error"?"text":"none"}),...j.callProviderMetadata!=null?{providerOptions:j.callProviderMetadata}:{}});break}}}if(A.length>0)J.push({role:"tool",content:A})}X=[]}for(let G of Y.parts)if(nU(G)||SL(G)||oU(G)||HJ(G)||iU(G))X.push(G);else if(G.type==="step-start")await Q();await Q();break}break}default:{let X=Y.role;throw new qt({originalMessage:Y,message:`Unsupported role: ${X}`})}}return J}var $_0=M4(()=>qX(D.array(D.object({id:D.string(),role:D.enum(["system","user","assistant"]),metadata:D.unknown().optional(),parts:D.array(D.union([D.object({type:D.literal("text"),text:D.string(),state:D.enum(["streaming","done"]).optional(),providerMetadata:N0.optional()}),D.object({type:D.literal("reasoning"),text:D.string(),state:D.enum(["streaming","done"]).optional(),providerMetadata:N0.optional()}),D.object({type:D.literal("source-url"),sourceId:D.string(),url:D.string(),title:D.string().optional(),providerMetadata:N0.optional()}),D.object({type:D.literal("source-document"),sourceId:D.string(),mediaType:D.string(),title:D.string(),filename:D.string().optional(),providerMetadata:N0.optional()}),D.object({type:D.literal("file"),mediaType:D.string(),filename:D.string().optional(),url:D.string(),providerMetadata:N0.optional()}),D.object({type:D.literal("step-start")}),D.object({type:D.string().startsWith("data-"),id:D.string().optional(),data:D.unknown()}),D.object({type:D.literal("dynamic-tool"),toolName:D.string(),toolCallId:D.string(),state:D.literal("input-streaming"),input:D.unknown().optional(),providerExecuted:D.boolean().optional(),callProviderMetadata:N0.optional(),output:D.never().optional(),errorText:D.never().optional(),approval:D.never().optional()}),D.object({type:D.literal("dynamic-tool"),toolName:D.string(),toolCallId:D.string(),state:D.literal("input-available"),input:D.unknown(),providerExecuted:D.boolean().optional(),output:D.never().optional(),errorText:D.never().optional(),callProviderMetadata:N0.optional(),approval:D.never().optional()}),D.object({type:D.literal("dynamic-tool"),toolName:D.string(),toolCallId:D.string(),state:D.literal("approval-requested"),input:D.unknown(),providerExecuted:D.boolean().optional(),output:D.never().optional(),errorText:D.never().optional(),callProviderMetadata:N0.optional(),approval:D.object({id:D.string(),approved:D.never().optional(),reason:D.never().optional()})}),D.object({type:D.literal("dynamic-tool"),toolName:D.string(),toolCallId:D.string(),state:D.literal("approval-responded"),input:D.unknown(),providerExecuted:D.boolean().optional(),output:D.never().optional(),errorText:D.never().optional(),callProviderMetadata:N0.optional(),approval:D.object({id:D.string(),approved:D.boolean(),reason:D.string().optional()})}),D.object({type:D.literal("dynamic-tool"),toolName:D.string(),toolCallId:D.string(),state:D.literal("output-available"),input:D.unknown(),providerExecuted:D.boolean().optional(),output:D.unknown(),errorText:D.never().optional(),callProviderMetadata:N0.optional(),resultProviderMetadata:N0.optional(),preliminary:D.boolean().optional(),approval:D.object({id:D.string(),approved:D.literal(!0),reason:D.string().optional()}).optional()}),D.object({type:D.literal("dynamic-tool"),toolName:D.string(),toolCallId:D.string(),state:D.literal("output-error"),input:D.unknown(),rawInput:D.unknown().optional(),providerExecuted:D.boolean().optional(),output:D.never().optional(),errorText:D.string(),callProviderMetadata:N0.optional(),resultProviderMetadata:N0.optional(),approval:D.object({id:D.string(),approved:D.literal(!0),reason:D.string().optional()}).optional()}),D.object({type:D.literal("dynamic-tool"),toolName:D.string(),toolCallId:D.string(),state:D.literal("output-denied"),input:D.unknown(),providerExecuted:D.boolean().optional(),output:D.never().optional(),errorText:D.never().optional(),callProviderMetadata:N0.optional(),approval:D.object({id:D.string(),approved:D.literal(!1),reason:D.string().optional()})}),D.object({type:D.string().startsWith("tool-"),toolCallId:D.string(),state:D.literal("input-streaming"),providerExecuted:D.boolean().optional(),callProviderMetadata:N0.optional(),input:D.unknown().optional(),output:D.never().optional(),errorText:D.never().optional(),approval:D.never().optional()}),D.object({type:D.string().startsWith("tool-"),toolCallId:D.string(),state:D.literal("input-available"),providerExecuted:D.boolean().optional(),input:D.unknown(),output:D.never().optional(),errorText:D.never().optional(),callProviderMetadata:N0.optional(),approval:D.never().optional()}),D.object({type:D.string().startsWith("tool-"),toolCallId:D.string(),state:D.literal("approval-requested"),input:D.unknown(),providerExecuted:D.boolean().optional(),output:D.never().optional(),errorText:D.never().optional(),callProviderMetadata:N0.optional(),approval:D.object({id:D.string(),approved:D.never().optional(),reason:D.never().optional()})}),D.object({type:D.string().startsWith("tool-"),toolCallId:D.string(),state:D.literal("approval-responded"),input:D.unknown(),providerExecuted:D.boolean().optional(),output:D.never().optional(),errorText:D.never().optional(),callProviderMetadata:N0.optional(),approval:D.object({id:D.string(),approved:D.boolean(),reason:D.string().optional()})}),D.object({type:D.string().startsWith("tool-"),toolCallId:D.string(),state:D.literal("output-available"),providerExecuted:D.boolean().optional(),input:D.unknown(),output:D.unknown(),errorText:D.never().optional(),callProviderMetadata:N0.optional(),resultProviderMetadata:N0.optional(),preliminary:D.boolean().optional(),approval:D.object({id:D.string(),approved:D.literal(!0),reason:D.string().optional()}).optional()}),D.object({type:D.string().startsWith("tool-"),toolCallId:D.string(),state:D.literal("output-error"),providerExecuted:D.boolean().optional(),input:D.unknown(),rawInput:D.unknown().optional(),output:D.never().optional(),errorText:D.string(),callProviderMetadata:N0.optional(),resultProviderMetadata:N0.optional(),approval:D.object({id:D.string(),approved:D.literal(!0),reason:D.string().optional()}).optional()}),D.object({type:D.string().startsWith("tool-"),toolCallId:D.string(),state:D.literal("output-denied"),providerExecuted:D.boolean().optional(),input:D.unknown(),output:D.never().optional(),errorText:D.never().optional(),callProviderMetadata:N0.optional(),approval:D.object({id:D.string(),approved:D.literal(!1),reason:D.string().optional()})})])).nonempty("Message must contain at least one part")})).nonempty("Messages array must not be empty")));var Se={type:"no-schema",jsonSchema:async()=>{return},async validatePartialResult({value:$,textDelta:Z}){return{success:!0,value:{partial:$,textDelta:Z}}},async validateFinalResult($,Z){return $===void 0?{success:!1,error:new C8({message:"No object generated: response did not match schema.",text:Z.text,response:Z.response,usage:Z.usage,finishReason:Z.finishReason})}:{success:!0,value:$}},createElementStream(){throw new g5({functionality:"element streams in no-schema mode"})}},fe=($)=>({type:"object",jsonSchema:async()=>await $.jsonSchema,async validatePartialResult({value:Z,textDelta:J}){return{success:!0,value:{partial:Z,textDelta:J}}},async validateFinalResult(Z){return y8({value:Z,schema:$})},createElementStream(){throw new g5({functionality:"element streams in object mode"})}}),ke=($)=>{return{type:"array",jsonSchema:async()=>{let{$schema:Z,...J}=await $.jsonSchema;return{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:J}},required:["elements"],additionalProperties:!1}},async validatePartialResult({value:Z,latestObject:J,isFirstDelta:Y,isFinalDelta:X}){var Q;if(!UX(Z)||!rU(Z.elements))return{success:!1,error:new I8({value:Z,cause:"value must be an object that contains an array of elements"})};let G=Z.elements,W=[];for(let U=0;U<G.length;U++){let H=G[U],B=await y8({value:H,schema:$});if(U===G.length-1&&!X)continue;if(!B.success)return B;W.push(B.value)}let K=(Q=J==null?void 0:J.length)!=null?Q:0,V="";if(Y)V+="[";if(K>0)V+=",";if(V+=W.slice(K).map((U)=>JSON.stringify(U)).join(","),X)V+="]";return{success:!0,value:{partial:W,textDelta:V}}},async validateFinalResult(Z){if(!UX(Z)||!rU(Z.elements))return{success:!1,error:new I8({value:Z,cause:"value must be an object that contains an array of elements"})};let J=Z.elements;for(let Y of J){let X=await y8({value:Y,schema:$});if(!X.success)return X}return{success:!0,value:J}},createElementStream(Z){let J=0;return s6(Z.pipeThrough(new TransformStream({transform(Y,X){switch(Y.type){case"object":{let Q=Y.object;for(;J<Q.length;J++)X.enqueue(Q[J]);break}case"text-delta":case"finish":case"error":break;default:throw Error(`Unsupported chunk type: ${Y}`)}}})))}}},ve=($)=>{return{type:"enum",jsonSchema:async()=>({$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:$}},required:["result"],additionalProperties:!1}),async validateFinalResult(Z){if(!UX(Z)||typeof Z.result!=="string")return{success:!1,error:new I8({value:Z,cause:'value must be an object that contains a string in the "result" property.'})};let J=Z.result;return $.includes(J)?{success:!0,value:J}:{success:!1,error:new I8({value:Z,cause:"value must be a string in the enum"})}},async validatePartialResult({value:Z,textDelta:J}){if(!UX(Z)||typeof Z.result!=="string")return{success:!1,error:new I8({value:Z,cause:'value must be an object that contains a string in the "result" property.'})};let Y=Z.result,X=$.filter((Q)=>Q.startsWith(Y));if(Z.result.length===0||X.length===0)return{success:!1,error:new I8({value:Z,cause:"value must be a string in the enum"})};return{success:!0,value:{partial:X.length>1?Y:X[0],textDelta:J}}},createElementStream(){throw new g5({functionality:"element streams in enum mode"})}}};function $2({output:$,schema:Z,enumValues:J}){switch($){case"object":return fe(v8(Z));case"array":return ke(v8(Z));case"enum":return ve(J);case"no-schema":return Se;default:throw Error(`Unsupported output: ${$}`)}}async function kL($,Z,J){let Y=await G8({text:$});if(!Y.success)throw new C8({message:"No object generated: could not parse the response.",cause:Y.error,text:$,response:J.response,usage:J.usage,finishReason:J.finishReason});let X=await Z.validateFinalResult(Y.value,{text:$,response:J.response,usage:J.usage});if(!X.success)throw new C8({message:"No object generated: response did not match schema.",cause:X.error,text:$,response:J.response,usage:J.usage,finishReason:J.finishReason});return X.value}async function Z2($,Z,J,Y){try{return await kL($,Z,Y)}catch(X){if(J!=null&&C8.isInstance(X)&&(JH.isInstance(X.cause)||I8.isInstance(X.cause))){let Q=await J({text:$,error:X.cause});if(Q===null)throw X;return await kL(Q,Z,Y)}throw X}}function J2({output:$,schema:Z,schemaName:J,schemaDescription:Y,enumValues:X}){if($!=null&&$!=="object"&&$!=="array"&&$!=="enum"&&$!=="no-schema")throw new r1({parameter:"output",value:$,message:"Invalid output type."});if($==="no-schema"){if(Z!=null)throw new r1({parameter:"schema",value:Z,message:"Schema is not supported for no-schema output."});if(Y!=null)throw new r1({parameter:"schemaDescription",value:Y,message:"Schema description is not supported for no-schema output."});if(J!=null)throw new r1({parameter:"schemaName",value:J,message:"Schema name is not supported for no-schema output."});if(X!=null)throw new r1({parameter:"enumValues",value:X,message:"Enum values are not supported for no-schema output."})}if($==="object"){if(Z==null)throw new r1({parameter:"schema",value:Z,message:"Schema is required for object output."});if(X!=null)throw new r1({parameter:"enumValues",value:X,message:"Enum values are not supported for object output."})}if($==="array"){if(Z==null)throw new r1({parameter:"schema",value:Z,message:"Element schema is required for array output."});if(X!=null)throw new r1({parameter:"enumValues",value:X,message:"Enum values are not supported for array output."})}if($==="enum"){if(Z!=null)throw new r1({parameter:"schema",value:Z,message:"Schema is not supported for enum output."});if(Y!=null)throw new r1({parameter:"schemaDescription",value:Y,message:"Schema description is not supported for enum output."});if(J!=null)throw new r1({parameter:"schemaName",value:J,message:"Schema name is not supported for enum output."});if(X==null)throw new r1({parameter:"enumValues",value:X,message:"Enum values are required for enum output."});for(let Q of X)if(typeof Q!=="string")throw new r1({parameter:"enumValues",value:Q,message:"Enum values must be strings."})}}var ye=a6({prefix:"aiobj",size:24});async function G_0($){let{model:Z,output:J="object",system:Y,prompt:X,messages:Q,maxRetries:G,abortSignal:W,headers:K,experimental_repairText:V,experimental_telemetry:U,experimental_download:H,providerOptions:B,_internal:{generateId:z=ye,currentDate:F=()=>new Date}={},...A}=$,j=w4(Z),N="enum"in $?$.enum:void 0,{schema:w,schemaDescription:q,schemaName:M}="schema"in $?$:{};J2({output:J,schema:w,schemaName:M,schemaDescription:q,enumValues:N});let{maxRetries:C,retry:R}=FH({maxRetries:G,abortSignal:W}),T=$2({output:J,schema:w,enumValues:N}),I=BX(A),_=OX(K!=null?K:{},`ai/${kT}`),E=UH({model:j,telemetry:U,headers:_,settings:{...I,maxRetries:C}}),f=HH(U),b=await T.jsonSchema();try{return await h5({name:"ai.generateObject",attributes:s$({telemetry:U,attributes:{...x5({operationId:"ai.generateObject",telemetry:U}),...E,"ai.prompt":{input:()=>JSON.stringify({system:Y,prompt:X,messages:Q})},"ai.schema":b!=null?{input:()=>JSON.stringify(b)}:void 0,"ai.schema.name":M,"ai.schema.description":q,"ai.settings.output":T.type}}),tracer:f,fn:async(y)=>{var k;let g,d,p,t,r,G0,O0,h0,u=await KH({system:Y,prompt:X,messages:Q}),l=await WH({prompt:u,supportedUrls:await j.supportedUrls,download:H}),$0=await R(()=>h5({name:"ai.generateObject.doGenerate",attributes:s$({telemetry:U,attributes:{...x5({operationId:"ai.generateObject.doGenerate",telemetry:U}),...E,"ai.prompt.messages":{input:()=>BH(l)},"gen_ai.system":j.provider,"gen_ai.request.model":j.modelId,"gen_ai.request.frequency_penalty":I.frequencyPenalty,"gen_ai.request.max_tokens":I.maxOutputTokens,"gen_ai.request.presence_penalty":I.presencePenalty,"gen_ai.request.temperature":I.temperature,"gen_ai.request.top_k":I.topK,"gen_ai.request.top_p":I.topP}}),tracer:f,fn:async(h)=>{var c,m,a,e,H0,A0,P0,s0;let o=await j.doGenerate({responseFormat:{type:"json",schema:b,name:M,description:q},...BX(A),prompt:l,providerOptions:B,abortSignal:W,headers:_}),K0={id:(m=(c=o.response)==null?void 0:c.id)!=null?m:z(),timestamp:(e=(a=o.response)==null?void 0:a.timestamp)!=null?e:F(),modelId:(A0=(H0=o.response)==null?void 0:H0.modelId)!=null?A0:j.modelId,headers:(P0=o.response)==null?void 0:P0.headers,body:(s0=o.response)==null?void 0:s0.body},z0=Qe(o.content),j0=Xe(o.content);if(z0===void 0)throw new C8({message:"No object generated: the model did not return a response.",response:K0,usage:q4(o.usage),finishReason:o.finishReason.unified});return h.setAttributes(await s$({telemetry:U,attributes:{"ai.response.finishReason":o.finishReason.unified,"ai.response.object":{output:()=>z0},"ai.response.id":K0.id,"ai.response.model":K0.modelId,"ai.response.timestamp":K0.timestamp.toISOString(),"ai.response.providerMetadata":JSON.stringify(o.providerMetadata),"ai.usage.promptTokens":o.usage.inputTokens.total,"ai.usage.completionTokens":o.usage.outputTokens.total,"gen_ai.response.finish_reasons":[o.finishReason.unified],"gen_ai.response.id":K0.id,"gen_ai.response.model":K0.modelId,"gen_ai.usage.input_tokens":o.usage.inputTokens.total,"gen_ai.usage.output_tokens":o.usage.outputTokens.total}})),{...o,objectText:z0,reasoning:j0,responseData:K0}}}));g=$0.objectText,d=$0.finishReason.unified,p=q4($0.usage),t=$0.warnings,O0=$0.providerMetadata,G0=(k=$0.request)!=null?k:{},r=$0.responseData,h0=$0.reasoning,D4({warnings:t,provider:j.provider,model:j.modelId});let v=await Z2(g,T,V,{response:r,usage:p,finishReason:d});return y.setAttributes(await s$({telemetry:U,attributes:{"ai.response.finishReason":d,"ai.response.object":{output:()=>JSON.stringify(v)},"ai.response.providerMetadata":JSON.stringify(O0),"ai.usage.promptTokens":p.inputTokens,"ai.usage.completionTokens":p.outputTokens}})),new xe({object:v,reasoning:h0,finishReason:d,usage:p,warnings:t,request:G0,response:r,providerMetadata:O0})}})}catch(y){throw VH(y)}}var xe=class{constructor($){this.object=$.object,this.finishReason=$.finishReason,this.usage=$.usage,this.warnings=$.warnings,this.providerMetadata=$.providerMetadata,this.response=$.response,this.request=$.request,this.reasoning=$.reasoning}toJsonResponse($){var Z;return new Response(JSON.stringify(this.object),{status:(Z=$==null?void 0:$.status)!=null?Z:200,headers:jX($==null?void 0:$.headers,{"content-type":"application/json; charset=utf-8"})})}};function Y2($){return({url:Z,abortSignal:J})=>vT({url:Z,maxBytes:$==null?void 0:$.maxBytes,abortSignal:J})}function j4($,Z){if($===Z)return!0;if($==null||Z==null)return!1;if(typeof $!=="object"&&typeof Z!=="object")return $===Z;if($.constructor!==Z.constructor)return!1;if($ instanceof Date&&Z instanceof Date)return $.getTime()===Z.getTime();if(Array.isArray($)){if($.length!==Z.length)return!1;for(let X=0;X<$.length;X++)if(!j4($[X],Z[X]))return!1;return!0}let J=Object.keys($),Y=Object.keys(Z);if(J.length!==Y.length)return!1;for(let X of J){if(!Y.includes(X))return!1;if(!j4($[X],Z[X]))return!1}return!0}var he=a6({prefix:"aiobj",size:24});function K_0($){let{model:Z,output:J="object",system:Y,prompt:X,messages:Q,maxRetries:G,abortSignal:W,headers:K,experimental_repairText:V,experimental_telemetry:U,experimental_download:H,providerOptions:B,onError:z=({error:I})=>{console.error(I)},onFinish:F,_internal:{generateId:A=he,currentDate:j=()=>new Date,now:N=VX}={},...w}=$,q="enum"in $&&$.enum?$.enum:void 0,{schema:M,schemaDescription:C,schemaName:R}="schema"in $?$:{};J2({output:J,schema:M,schemaName:R,schemaDescription:C,enumValues:q});let T=$2({output:J,schema:M,enumValues:q});return new ge({model:Z,telemetry:U,headers:K,settings:w,maxRetries:G,abortSignal:W,outputStrategy:T,system:Y,prompt:X,messages:Q,schemaName:R,schemaDescription:C,providerOptions:B,repairText:V,onError:z,onFinish:F,download:H,generateId:A,currentDate:j,now:N})}var ge=class{constructor({model:$,headers:Z,telemetry:J,settings:Y,maxRetries:X,abortSignal:Q,outputStrategy:G,system:W,prompt:K,messages:V,schemaName:U,schemaDescription:H,providerOptions:B,repairText:z,onError:F,onFinish:A,download:j,generateId:N,currentDate:w,now:q}){this._object=new Q8,this._usage=new Q8,this._providerMetadata=new Q8,this._warnings=new Q8,this._request=new Q8,this._response=new Q8,this._finishReason=new Q8;let M=w4($),{maxRetries:C,retry:R}=FH({maxRetries:X,abortSignal:Q}),T=BX(Y),I=UH({model:M,telemetry:J,headers:Z,settings:{...T,maxRetries:C}}),_=HH(J),E=this,f=tT(),b=new TransformStream({transform(y,k){if(k.enqueue(y),y.type==="error")F({error:VH(y.error)})}});this.baseStream=f.stream.pipeThrough(b),h5({name:"ai.streamObject",attributes:s$({telemetry:J,attributes:{...x5({operationId:"ai.streamObject",telemetry:J}),...I,"ai.prompt":{input:()=>JSON.stringify({system:W,prompt:K,messages:V})},"ai.schema":{input:async()=>JSON.stringify(await G.jsonSchema())},"ai.schema.name":U,"ai.schema.description":H,"ai.settings.output":G.type}}),tracer:_,endWhenDone:!1,fn:async(y)=>{let k=await KH({system:W,prompt:K,messages:V}),g={responseFormat:{type:"json",schema:await G.jsonSchema(),name:U,description:H},...BX(Y),prompt:await WH({prompt:k,supportedUrls:await M.supportedUrls,download:j}),providerOptions:B,abortSignal:Q,headers:Z,includeRawChunks:!1},d={transform:(o,K0)=>{switch(o.type){case"text-delta":K0.enqueue(o.delta);break;case"response-metadata":case"finish":case"error":case"stream-start":K0.enqueue(o);break}}},{result:{stream:p,response:t,request:r},doStreamSpan:G0,startTimestampMs:O0}=await R(()=>h5({name:"ai.streamObject.doStream",attributes:s$({telemetry:J,attributes:{...x5({operationId:"ai.streamObject.doStream",telemetry:J}),...I,"ai.prompt.messages":{input:()=>BH(g.prompt)},"gen_ai.system":M.provider,"gen_ai.request.model":M.modelId,"gen_ai.request.frequency_penalty":T.frequencyPenalty,"gen_ai.request.max_tokens":T.maxOutputTokens,"gen_ai.request.presence_penalty":T.presencePenalty,"gen_ai.request.temperature":T.temperature,"gen_ai.request.top_k":T.topK,"gen_ai.request.top_p":T.topP}}),tracer:_,endWhenDone:!1,fn:async(o)=>({startTimestampMs:q(),doStreamSpan:o,result:await M.doStream(g)})}));E._request.resolve(r!=null?r:{});let h0,u=F4(),l,$0,v,h,c="",m="",a={id:N(),timestamp:w(),modelId:M.modelId},e=void 0,H0=void 0,A0=!0,P0=!0,s0=p.pipeThrough(new TransformStream(d)).pipeThrough(new TransformStream({async transform(o,K0){var z0,j0,Q1;if(typeof o==="object"&&o.type==="stream-start"){h0=o.warnings;return}if(A0){let _0=q()-O0;A0=!1,G0.addEvent("ai.stream.firstChunk",{"ai.stream.msToFirstChunk":_0}),G0.setAttributes({"ai.stream.msToFirstChunk":_0})}if(typeof o==="string"){c+=o,m+=o;let{value:_0,state:e0}=await AJ(c);if(_0!==void 0&&!j4(e,_0)){let S0=await G.validatePartialResult({value:_0,textDelta:m,latestObject:H0,isFirstDelta:P0,isFinalDelta:e0==="successful-parse"});if(S0.success&&!j4(H0,S0.value.partial))e=_0,H0=S0.value.partial,K0.enqueue({type:"object",object:H0}),K0.enqueue({type:"text-delta",textDelta:S0.value.textDelta}),m="",P0=!1}return}switch(o.type){case"response-metadata":{a={id:(z0=o.id)!=null?z0:a.id,timestamp:(j0=o.timestamp)!=null?j0:a.timestamp,modelId:(Q1=o.modelId)!=null?Q1:a.modelId};break}case"finish":{if(m!=="")K0.enqueue({type:"text-delta",textDelta:m});l=o.finishReason.unified,u=q4(o.usage),$0=o.providerMetadata,K0.enqueue({...o,finishReason:o.finishReason.unified,usage:u,response:a}),D4({warnings:h0!=null?h0:[],provider:M.provider,model:M.modelId}),E._usage.resolve(u),E._providerMetadata.resolve($0),E._warnings.resolve(h0),E._response.resolve({...a,headers:t==null?void 0:t.headers}),E._finishReason.resolve(l!=null?l:"other");try{v=await Z2(c,G,z,{response:a,usage:u,finishReason:l}),E._object.resolve(v)}catch(_0){h=_0,E._object.reject(_0)}break}default:{K0.enqueue(o);break}}},async flush(o){try{let K0=u!=null?u:{promptTokens:NaN,completionTokens:NaN,totalTokens:NaN};G0.setAttributes(await s$({telemetry:J,attributes:{"ai.response.finishReason":l,"ai.response.object":{output:()=>JSON.stringify(v)},"ai.response.id":a.id,"ai.response.model":a.modelId,"ai.response.timestamp":a.timestamp.toISOString(),"ai.response.providerMetadata":JSON.stringify($0),"ai.usage.inputTokens":K0.inputTokens,"ai.usage.outputTokens":K0.outputTokens,"ai.usage.totalTokens":K0.totalTokens,"ai.usage.reasoningTokens":K0.reasoningTokens,"ai.usage.cachedInputTokens":K0.cachedInputTokens,"gen_ai.response.finish_reasons":[l],"gen_ai.response.id":a.id,"gen_ai.response.model":a.modelId,"gen_ai.usage.input_tokens":K0.inputTokens,"gen_ai.usage.output_tokens":K0.outputTokens}})),G0.end(),y.setAttributes(await s$({telemetry:J,attributes:{"ai.usage.inputTokens":K0.inputTokens,"ai.usage.outputTokens":K0.outputTokens,"ai.usage.totalTokens":K0.totalTokens,"ai.usage.reasoningTokens":K0.reasoningTokens,"ai.usage.cachedInputTokens":K0.cachedInputTokens,"ai.response.object":{output:()=>JSON.stringify(v)},"ai.response.providerMetadata":JSON.stringify($0)}})),await(A==null?void 0:A({usage:K0,object:v,error:h,response:{...a,headers:t==null?void 0:t.headers},warnings:h0,providerMetadata:$0}))}catch(K0){o.enqueue({type:"error",error:K0})}finally{y.end()}}}));f.addStream(s0)}}).catch((y)=>{f.addStream(new ReadableStream({start(k){k.enqueue({type:"error",error:y}),k.close()}}))}).finally(()=>{f.close()}),this.outputStrategy=G}get object(){return this._object.promise}get usage(){return this._usage.promise}get providerMetadata(){return this._providerMetadata.promise}get warnings(){return this._warnings.promise}get request(){return this._request.promise}get response(){return this._response.promise}get finishReason(){return this._finishReason.promise}get partialObjectStream(){return s6(this.baseStream.pipeThrough(new TransformStream({transform($,Z){switch($.type){case"object":Z.enqueue($.object);break;case"text-delta":case"finish":case"error":break;default:throw Error(`Unsupported chunk type: ${$}`)}}})))}get elementStream(){return this.outputStrategy.createElementStream(this.baseStream)}get textStream(){return s6(this.baseStream.pipeThrough(new TransformStream({transform($,Z){switch($.type){case"text-delta":Z.enqueue($.textDelta);break;case"object":case"finish":case"error":break;default:throw Error(`Unsupported chunk type: ${$}`)}}})))}get fullStream(){return s6(this.baseStream)}pipeTextStreamToResponse($,Z){oT({response:$,textStream:this.textStream,...Z})}toTextStreamResponse($){return iT({textStream:this.textStream,...$})}};var V_0=Y2();var U_0=({model:$,middleware:Z,modelId:J,providerId:Y})=>{return[...y5(Z)].reverse().reduce((X,Q)=>{return ue({model:X,middleware:Q,modelId:J,providerId:Y})},$)},ue=({model:$,middleware:{transformParams:Z,wrapGenerate:J,wrapStream:Y,overrideProvider:X,overrideModelId:Q,overrideSupportedUrls:G},modelId:W,providerId:K})=>{var V,U,H;async function B({params:z,type:F}){return Z?await Z({params:z,type:F,model:$}):z}return{specificationVersion:"v3",provider:(V=K!=null?K:X==null?void 0:X({model:$}))!=null?V:$.provider,modelId:(U=W!=null?W:Q==null?void 0:Q({model:$}))!=null?U:$.modelId,supportedUrls:(H=G==null?void 0:G({model:$}))!=null?H:$.supportedUrls,async doGenerate(z){let F=await B({params:z,type:"generate"}),A=async()=>$.doGenerate(F);return J?J({doGenerate:A,doStream:async()=>$.doStream(F),params:F,model:$}):A()},async doStream(z){let F=await B({params:z,type:"stream"}),A=async()=>$.doGenerate(F),j=async()=>$.doStream(F);return Y?Y({doGenerate:A,doStream:j,params:F,model:$}):j()}}};var me="AI_NoSuchProviderError",le=`vercel.ai.error.${me}`,de=Symbol.for(le),pe;pe=de;var H_0=Y2();var u5=($,Z)=>Z.every((J,Y)=>$[Y]===J);function ce($){return $==="application/pdf"}function NX($){return $.startsWith("image/")||ce($)}function k_0($){return $.startsWith("image/")&&$!=="image/svg+xml"&&$!=="image/vnd.fastbidsheet"}function v_0($,Z){if(u5($,[137,80,78,71,13,10,26,10]))return"image/png";if(u5($,[255,216,255]))return"image/jpeg";if(u5($,[71,73,70,56]))return"image/gif";if(u5($,[66,77]))return"image/bmp";if(u5($,[37,80,68,70,45]))return"application/pdf";if(u5($,[82,73,70,70])&&u5($.subarray(8),[87,69,66,80]))return"image/webp";return Z}var G2="Attached image(s) from tool result:";var R6=($)=>Bun.hash($).toString(36);function OH($){let Z=[$.info.id,$.info.role];if($.info.role==="assistant")Z.push($.info.providerID,$.info.modelID,$.info.error?R6(JSON.stringify($.info.error)):"");for(let J of $.parts){if(Z.push(J.id,J.type),"metadata"in J&&J.metadata)Z.push(R6(JSON.stringify(J.metadata)));switch(J.type){case"text":Z.push(J.ignored?"i":"",J.synthetic?"s":"",R6(J.text));break;case"reasoning":Z.push(R6(J.text));break;case"file":Z.push(J.mime,J.filename??"",R6(J.url));break;case"tool":{if(Z.push(J.tool,J.callID,J.state.status),"input"in J.state&&J.state.input!==void 0)Z.push(R6(JSON.stringify(J.state.input)));if(J.state.status==="completed"){Z.push(J.state.time.compacted?"c":"",R6(J.state.output));for(let Y of J.state.attachments??[])Z.push(Y.mime,Y.filename??"",R6(Y.url))}else if(J.state.status==="error"){if(Z.push(R6(J.state.error)),J.state.metadata?.interrupted===!0)Z.push(R6(String(J.state.metadata.output??"")))}break}}}return Z.join("\x00")}var ie=2000,m5=new Map;function X2($){let Z=m5.get($);if(Z===void 0)return;return m5.delete($),m5.set($,Z),Z}function AH($,Z){if(m5.size>=ie)m5.delete(m5.keys().next().value);m5.set($,Z)}function ne($){if(!$)return;let{providerExecuted:Z,...J}=$;return Object.keys(J).length>0?J:void 0}function L4($,Z,J){return{type:"tool-"+$.tool,toolCallId:$.callID,input:$.state.input,...J,...$.metadata?.providerExecuted?{providerExecuted:!0}:{},...Z?{}:{callProviderMetadata:ne($.metadata)}}}var W2=L.fnUntraced(function*($,Z,J){let Y=[],X=new Set,Q=(()=>{if(Z.api.npm==="@ai-sdk/anthropic")return!0;if(Z.api.npm==="@ai-sdk/amazon-bedrock")return!0;if(Z.api.npm==="@ai-sdk/google-vertex/anthropic")return!0;if(Z.api.npm==="@ai-sdk/google"){let V=Z.api.id.toLowerCase();return V.includes("gemini-3")&&!V.includes("gemini-2")}return!1})(),G=(V)=>{let U=V.output;if(typeof U==="string")return{type:"text",value:U};if(typeof U==="object"){let H=U,B=(H.attachments??[]).filter((z)=>{return z.url.startsWith("data:")&&z.url.includes(",")});return{type:"content",value:[{type:"text",text:H.text},...B.map((z)=>({type:"media",mediaType:z.mime,data:l$(()=>{let F=z.url.indexOf(",");return F===-1?z.url:z.url.slice(F+1)})}))]}}return{type:"json",value:U}},W=J?.stripMedia===!0;for(let V of $){if(V.parts.length===0)continue;if(V.info.role==="user"){let U=`u\x00${W?1:0}\x00${OH(V)}`,H=X2(U);if(H){Y.push(...H.messages);continue}let B={id:V.info.id,role:"user",parts:[]};Y.push(B),AH(U,{messages:[B],toolNames:[]});for(let z of V.parts){if(z.type==="text"&&!z.ignored)B.parts.push({type:"text",text:z.text});if(z.type==="file"&&z.mime!=="text/plain"&&z.mime!=="application/x-directory")if(J?.stripMedia&&NX(z.mime))B.parts.push({type:"text",text:`[Attached ${z.mime}: ${z.filename??"file"}]`});else B.parts.push({type:"file",url:z.url,mediaType:z.mime,filename:z.filename});if(z.type==="checkpoint")B.parts.push({type:"text",text:"Summary of previous conversation from checkpoint files:"});if(z.type==="compaction")B.parts.push({type:"text",text:"Summary of previous conversation:"});if(z.type==="subtask")B.parts.push({type:"text",text:"The following tool was executed by the user"})}}if(V.info.role==="assistant"){let U=`${Z.providerID}/${Z.id}`!==`${V.info.providerID}/${V.info.modelID}`,H=`a\x00${W?1:0}${U?1:0}${Q?1:0}\x00${OH(V)}`,B=X2(H);if(B){Y.push(...B.messages);for(let N of B.toolNames)X.add(N);continue}let z=[],F=[];if(V.info.error&&!(f5.isInstance(V.info.error)&&V.parts.some((N)=>N.type!=="step-start"&&N.type!=="reasoning"))){AH(H,{messages:[],toolNames:[]});continue}let A={id:V.info.id,role:"assistant",parts:[]};for(let N of V.parts){if(N.type==="text")A.parts.push({type:"text",text:N.text,...U?{}:{providerMetadata:N.metadata}});if(N.type==="step-start")A.parts.push({type:"step-start"});if(N.type==="tool"){if(X.add(N.tool),F.push(N.tool),N.state.status==="completed"){let w=N.state.time.compacted?"[Old tool result content cleared]":N.state.output,q=N.state.time.compacted||J?.stripMedia?[]:N.state.attachments??[],M=q.filter((I)=>NX(I.mime)),C=q.filter((I)=>!NX(I.mime));if(!Q&&M.length>0)z.push(...M);let R=Q?q:C,T=R.length>0?{text:w,attachments:R}:w;A.parts.push(L4(N,U,{state:"output-available",output:T}))}if(N.state.status==="error"){let w=N.state.metadata?.interrupted===!0?N.state.metadata.output:void 0;if(typeof w==="string")A.parts.push(L4(N,U,{state:"output-available",output:w}));else A.parts.push(L4(N,U,{state:"output-error",errorText:N.state.error}))}if(N.state.status==="pending"||N.state.status==="running")A.parts.push(L4(N,U,{state:"output-error",errorText:"[Tool execution was interrupted]"}))}if(N.type==="reasoning")A.parts.push({type:"reasoning",text:N.text,...U?{}:{providerMetadata:N.metadata}})}let j=[];if(A.parts.length>0){if(j.push(A),z.length>0)j.push({id:i1.ascending(),role:"user",parts:[{type:"text",text:G2},...z.map((N)=>({type:"file",url:N.url,mediaType:N.mime,filename:N.filename}))]})}Y.push(...j),AH(H,{messages:j,toolNames:F})}}let K=Object.fromEntries(Array.from(X).map((V)=>[V,{toModelOutput:G}]));return yield*L.promise(()=>eT(Y.filter((V)=>V.parts.some((U)=>U.type!=="step-start")),{tools:K}))});function oe($,Z,J){return L.runPromise(W2($,Z,J).pipe(L.provide(Q2.layer)))}var hl={};F1(hl,{sort:()=>G9,parseModel:()=>W5,loadLiveRatings:()=>yl,fromModelsDevProvider:()=>wK,defaultModelIDs:()=>Ul,defaultLayer:()=>UN0,applyLiveRatings:()=>xl,Service:()=>kK,ModelNotFoundError:()=>KY,ModelGroupNotFoundError:()=>LK,Model:()=>vA,ListResult:()=>Sl,InitError:()=>TK,Info:()=>fK,DEFAULT_CHUNK_TIMEOUT:()=>PK,ConfigProvidersResult:()=>fl});var AZ={};F1(AZ,{layer:()=>_m,defaultLayer:()=>gj0,Service:()=>qK,Plugin:()=>AZ,HookEvent:()=>EA});function se($){return $}se.schema=D;var K2=["main","general","build","explore","summary","title","checkpoint-writer","dream","distill","compaction"];var qH=($)=>K2.includes($);function V2($,Z){if(!$)return!qH(Z.agentType);if($.mode&&$.mode!==Z.mode)return!1;let J=$.agentType;if(J===void 0)return!qH(Z.agentType);if(typeof J==="string"){if(qH(Z.agentType))return!1;try{return new RegExp(J).test(Z.agentType)}catch{return!1}}if(Array.isArray(J))return J.includes(Z.agentType);if("excludeOnly"in J)return!J.excludeOnly.includes(Z.agentType);if(J.exclude?.includes(Z.agentType))return!1;return J.include.includes(Z.agentType)}var U2=({onSseError:$,onSseEvent:Z,responseTransformer:J,responseValidator:Y,fetch:X,sseDefaultRetryDelay:Q,sseMaxRetryAttempts:G,sseMaxRetryDelay:W,sseSleepFn:K,url:V,...U})=>{let H,B=(A,j)=>{if(K)return new Promise((N,w)=>{let q=!1,M=()=>{if(q)return;q=!0,j.removeEventListener("abort",M),N()},C=(R)=>{if(q)return;q=!0,j.removeEventListener("abort",M),w(R)};if(j.aborted){M();return}j.addEventListener("abort",M,{once:!0}),K(A).then(M,C)});return new Promise((N)=>{if(j.aborted){N();return}let w=()=>{clearTimeout(q),j.removeEventListener("abort",w),N()},q=setTimeout(w,A);j.addEventListener("abort",w,{once:!0})})};return{stream:async function*(){let A=Q??3000,j=0,N=U.signal??new AbortController().signal,w=X??globalThis.fetch;while(!0){if(N.aborted)break;j++;let q=U.headers instanceof Headers?U.headers:new Headers(U.headers);if(H!==void 0)q.set("Last-Event-ID",H);try{let C=await w(new Request(V,{...U,headers:q,signal:N}));if(!C.ok)throw Error(`SSE failed: ${C.status} ${C.statusText}`);if(!C.body)throw Error("No body in SSE response");let R=C.body.pipeThrough(new TextDecoderStream).getReader(),T="",I=()=>{try{R.cancel()}catch{}};if(N.addEventListener("abort",I),N.aborted)I();try{while(!0){let{done:_,value:E}=await R.read();if(_)break;T+=E,T=T.replace(/\r\n/g,`
|
|
533
|
+
`).replace(/\r/g,`
|
|
534
|
+
`);let f=T.split(`
|
|
535
|
+
|
|
536
|
+
`);T=f.pop()??"";for(let b of f){let y=b.split(`
|
|
537
|
+
`),k=[],g,d=(r)=>{let G0=r.slice(r.indexOf(":")+1);return G0.startsWith(" ")?G0.slice(1):G0};for(let r of y)if(r.startsWith("data:"))k.push(d(r));else if(r.startsWith("event:"))g=d(r);else if(r.startsWith("id:"))H=d(r);else if(r.startsWith("retry:")){let G0=d(r),O0=Number(G0);if(/^\d+$/.test(G0)&&Number.isFinite(O0))A=O0}if(!k.length)continue;let p,t=!1;if(k.length){let r=k.join(`
|
|
538
|
+
`);try{p=JSON.parse(r),t=!0}catch{p=r}}if(t){if(Y)await Y(p);if(J)p=await J(p)}Z?.({data:p,event:g,id:H,retry:A}),yield p}}}finally{N.removeEventListener("abort",I),R.releaseLock()}}catch(C){if($?.(C),G!==void 0&&j>=G)break}if(G!==void 0&&j>=G)break;let M=Math.min(A*2**(j-1),W??30000);await B(M,N)}}()}};var H2=async($,Z)=>{let J=typeof Z==="function"?await Z($):Z;if(!J)return;if($.scheme==="bearer")return`Bearer ${J}`;if($.scheme==="basic")return`Basic ${btoa(J)}`;return J};var jH={bodySerializer:($)=>JSON.stringify($,(Z,J)=>typeof J==="bigint"?J.toString():J)};var re=($)=>{switch($){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},ae=($)=>{switch($){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},te=($)=>{switch($){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},T4=({allowReserved:$,explode:Z,name:J,style:Y,value:X})=>{if(!Z){let W=($?X:X.map((K)=>encodeURIComponent(K))).join(ae(Y));switch(Y){case"label":return`.${W}`;case"matrix":return`;${J}=${W}`;case"simple":return W;default:return`${J}=${W}`}}let Q=re(Y),G=X.map((W)=>{if(Y==="label"||Y==="simple")return $?W:encodeURIComponent(W);return OJ({allowReserved:$,name:J,value:W})}).join(Q);return Y==="label"||Y==="matrix"?Q+G:G},OJ=({allowReserved:$,name:Z,value:J})=>{if(J===void 0||J===null)return"";if(typeof J==="object")throw Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return`${Z}=${$?J:encodeURIComponent(J)}`},R4=({allowReserved:$,explode:Z,name:J,style:Y,value:X,valueOnly:Q})=>{if(X instanceof Date)return Q?X.toISOString():`${J}=${X.toISOString()}`;if(Y!=="deepObject"&&!Z){let K=[];Object.entries(X).forEach(([U,H])=>{K=[...K,U,$?H:encodeURIComponent(H)]});let V=K.join(",");switch(Y){case"form":return`${J}=${V}`;case"label":return`.${V}`;case"matrix":return`;${J}=${V}`;default:return V}}let G=te(Y),W=Object.entries(X).map(([K,V])=>OJ({allowReserved:$,name:Y==="deepObject"?`${J}[${K}]`:K,value:V})).join(G);return Y==="label"||Y==="matrix"?G+W:W};var ee=/\{[^{}]+\}/g,$00=({path:$,url:Z})=>{let J=Z,Y=Z.match(ee);if(Y)for(let X of Y){let Q=!1,G=X.substring(1,X.length-1),W="simple";if(G.endsWith("*"))Q=!0,G=G.substring(0,G.length-1);if(G.startsWith("."))G=G.substring(1),W="label";else if(G.startsWith(";"))G=G.substring(1),W="matrix";let K=$[G];if(K===void 0||K===null)continue;if(Array.isArray(K)){J=J.replace(X,T4({explode:Q,name:G,style:W,value:K}));continue}if(typeof K==="object"){J=J.replace(X,R4({explode:Q,name:G,style:W,value:K,valueOnly:!0}));continue}if(W==="matrix"){J=J.replace(X,`;${OJ({name:G,value:K})}`);continue}let V=encodeURIComponent(W==="label"?`.${K}`:K);J=J.replace(X,V)}return J},B2=({baseUrl:$,path:Z,query:J,querySerializer:Y,url:X})=>{let Q=X.startsWith("/")?X:`/${X}`,G=($??"")+Q;if(Z)G=$00({path:Z,url:G});let W=J?Y(J):"";if(W.startsWith("?"))W=W.substring(1);if(W)G+=`?${W}`;return G};var z2=({allowReserved:$,array:Z,object:J}={})=>{return(X)=>{let Q=[];if(X&&typeof X==="object")for(let G in X){let W=X[G];if(W===void 0||W===null)continue;if(Array.isArray(W)){let K=T4({allowReserved:$,explode:!0,name:G,style:"form",value:W,...Z});if(K)Q.push(K)}else if(typeof W==="object"){let K=R4({allowReserved:$,explode:!0,name:G,style:"deepObject",value:W,...J});if(K)Q.push(K)}else{let K=OJ({allowReserved:$,name:G,value:W});if(K)Q.push(K)}}return Q.join("&")}},F2=($)=>{if(!$)return"stream";let Z=$.split(";")[0]?.trim();if(!Z)return;if(Z.startsWith("application/json")||Z.endsWith("+json"))return"json";if(Z==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some((J)=>Z.startsWith(J)))return"blob";if(Z.startsWith("text/"))return"text";return},Z00=($,Z)=>{if(!Z)return!1;if($.headers.has(Z)||$.query?.[Z]||$.headers.get("Cookie")?.includes(`${Z}=`))return!0;return!1},A2=async({security:$,...Z})=>{for(let J of $){if(Z00(Z,J.name))continue;let Y=await H2(J,Z.auth);if(!Y)continue;let X=J.name??"Authorization";switch(J.in){case"query":if(!Z.query)Z.query={};Z.query[X]=Y;break;case"cookie":Z.headers.append("Cookie",`${X}=${Y}`);break;case"header":default:Z.headers.set(X,Y);break}}},NH=($)=>B2({baseUrl:$.baseUrl,path:$.path,query:$.query,querySerializer:typeof $.querySerializer==="function"?$.querySerializer:z2($.querySerializer),url:$.url}),MH=($,Z)=>{let J={...$,...Z};if(J.baseUrl?.endsWith("/"))J.baseUrl=J.baseUrl.substring(0,J.baseUrl.length-1);return J.headers=I4($.headers,Z.headers),J},I4=(...$)=>{let Z=new Headers;for(let J of $){if(!J||typeof J!=="object")continue;let Y=J instanceof Headers?J.entries():Object.entries(J);for(let[X,Q]of Y)if(Q===null)Z.delete(X);else if(Array.isArray(Q))for(let G of Q)Z.append(X,G);else if(Q!==void 0)Z.set(X,typeof Q==="object"?JSON.stringify(Q):Q)}return Z};class P4{_fns;constructor(){this._fns=[]}clear(){this._fns=[]}getInterceptorIndex($){if(typeof $==="number")return this._fns[$]?$:-1;else return this._fns.indexOf($)}exists($){let Z=this.getInterceptorIndex($);return!!this._fns[Z]}eject($){let Z=this.getInterceptorIndex($);if(this._fns[Z])this._fns[Z]=null}update($,Z){let J=this.getInterceptorIndex($);if(this._fns[J])return this._fns[J]=Z,$;else return!1}use($){return this._fns=[...this._fns,$],this._fns.length-1}}var O2=()=>({error:new P4,request:new P4,response:new P4}),J00=z2({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),Y00={"Content-Type":"application/json"},MX=($={})=>({...jH,headers:Y00,parseAs:"auto",querySerializer:J00,...$});var DX=($={})=>{let Z=MH(MX(),$),J=()=>({...Z}),Y=(K)=>{return Z=MH(Z,K),J()},X=O2(),Q=async(K)=>{let V={...Z,...K,fetch:K.fetch??Z.fetch??globalThis.fetch,headers:I4(Z.headers,K.headers),serializedBody:void 0};if(V.security)await A2({...V,security:V.security});if(V.requestValidator)await V.requestValidator(V);if(V.body&&V.bodySerializer)V.serializedBody=V.bodySerializer(V.body);if(V.serializedBody===void 0||V.serializedBody==="")V.headers.delete("Content-Type");let U=NH(V);return{opts:V,url:U}},G=async(K)=>{let{opts:V,url:U}=await Q(K),H={redirect:"follow",...V,body:V.serializedBody},B=new Request(U,H);for(let M of X.request._fns)if(M)B=await M(B,V);let z=V.fetch,F=await z(B);for(let M of X.response._fns)if(M)F=await M(F,B,V);let A={request:B,response:F};if(F.ok){if(F.status===204||F.headers.get("Content-Length")==="0")return V.responseStyle==="data"?{}:{data:{},...A};let M=(V.parseAs==="auto"?F2(F.headers.get("Content-Type")):V.parseAs)??"json",C;switch(M){case"arrayBuffer":case"blob":case"formData":case"json":case"text":C=await F[M]();break;case"stream":return V.responseStyle==="data"?F.body:{data:F.body,...A}}if(M==="json"){if(V.responseValidator)await V.responseValidator(C);if(V.responseTransformer)C=await V.responseTransformer(C)}return V.responseStyle==="data"?C:{data:C,...A}}let j=await F.text(),N;try{N=JSON.parse(j)}catch{}let w=N??j,q=w;for(let M of X.error._fns)if(M)q=await M(w,F,B,V);if(q=q||{},V.throwOnError)throw q;return V.responseStyle==="data"?void 0:{error:q,...A}},W=(K)=>{let V=(U)=>G({...U,method:K});return V.sse=async(U)=>{let{opts:H,url:B}=await Q(U);return U2({...H,body:H.body,headers:H.headers,method:K,url:B})},V};return{buildUrl:NH,connect:W("CONNECT"),delete:W("DELETE"),get:W("GET"),getConfig:J,head:W("HEAD"),interceptors:X,options:W("OPTIONS"),patch:W("PATCH"),post:W("POST"),put:W("PUT"),request:G,setConfig:Y,trace:W("TRACE")}};var X00={$body_:"body",$headers_:"headers",$path_:"path",$query_:"query"},HS0=Object.entries(X00);var q2=DX(MX({baseUrl:"http://localhost:4096"}));class a1{_client=q2;constructor($){if($?.client)this._client=$.client}}class j2 extends a1{event($){return($?.client??this._client).get.sse({url:"/global/event",...$})}}class N2 extends a1{list($){return($?.client??this._client).get({url:"/project",...$})}current($){return($?.client??this._client).get({url:"/project/current",...$})}}class M2 extends a1{list($){return($?.client??this._client).get({url:"/pty",...$})}create($){return($?.client??this._client).post({url:"/pty",...$,headers:{"Content-Type":"application/json",...$?.headers}})}remove($){return($.client??this._client).delete({url:"/pty/{id}",...$})}get($){return($.client??this._client).get({url:"/pty/{id}",...$})}update($){return($.client??this._client).put({url:"/pty/{id}",...$,headers:{"Content-Type":"application/json",...$.headers}})}connect($){return($.client??this._client).get({url:"/pty/{id}/connect",...$})}}class D2 extends a1{get($){return($?.client??this._client).get({url:"/config",...$})}update($){return($?.client??this._client).patch({url:"/config",...$,headers:{"Content-Type":"application/json",...$?.headers}})}providers($){return($?.client??this._client).get({url:"/config/providers",...$})}}class w2 extends a1{ids($){return($?.client??this._client).get({url:"/experimental/tool/ids",...$})}list($){return($.client??this._client).get({url:"/experimental/tool",...$})}}class L2 extends a1{dispose($){return($?.client??this._client).post({url:"/instance/dispose",...$})}}class T2 extends a1{get($){return($?.client??this._client).get({url:"/path",...$})}}class R2 extends a1{get($){return($?.client??this._client).get({url:"/vcs",...$})}}class P2 extends a1{list($){return($?.client??this._client).get({url:"/session",...$})}create($){return($?.client??this._client).post({url:"/session",...$,headers:{"Content-Type":"application/json",...$?.headers}})}status($){return($?.client??this._client).get({url:"/session/status",...$})}delete($){return($.client??this._client).delete({url:"/session/{id}",...$})}get($){return($.client??this._client).get({url:"/session/{id}",...$})}update($){return($.client??this._client).patch({url:"/session/{id}",...$,headers:{"Content-Type":"application/json",...$.headers}})}children($){return($.client??this._client).get({url:"/session/{id}/children",...$})}todo($){return($.client??this._client).get({url:"/session/{id}/todo",...$})}init($){return($.client??this._client).post({url:"/session/{id}/init",...$,headers:{"Content-Type":"application/json",...$.headers}})}fork($){return($.client??this._client).post({url:"/session/{id}/fork",...$,headers:{"Content-Type":"application/json",...$.headers}})}abort($){return($.client??this._client).post({url:"/session/{id}/abort",...$})}unshare($){return($.client??this._client).delete({url:"/session/{id}/share",...$})}share($){return($.client??this._client).post({url:"/session/{id}/share",...$})}diff($){return($.client??this._client).get({url:"/session/{id}/diff",...$})}summarize($){return($.client??this._client).post({url:"/session/{id}/summarize",...$,headers:{"Content-Type":"application/json",...$.headers}})}messages($){return($.client??this._client).get({url:"/session/{id}/message",...$})}prompt($){return($.client??this._client).post({url:"/session/{id}/message",...$,headers:{"Content-Type":"application/json",...$.headers}})}message($){return($.client??this._client).get({url:"/session/{id}/message/{messageID}",...$})}promptAsync($){return($.client??this._client).post({url:"/session/{id}/prompt_async",...$,headers:{"Content-Type":"application/json",...$.headers}})}command($){return($.client??this._client).post({url:"/session/{id}/command",...$,headers:{"Content-Type":"application/json",...$.headers}})}shell($){return($.client??this._client).post({url:"/session/{id}/shell",...$,headers:{"Content-Type":"application/json",...$.headers}})}revert($){return($.client??this._client).post({url:"/session/{id}/revert",...$,headers:{"Content-Type":"application/json",...$.headers}})}unrevert($){return($.client??this._client).post({url:"/session/{id}/unrevert",...$})}}class I2 extends a1{list($){return($?.client??this._client).get({url:"/command",...$})}}class C2 extends a1{authorize($){return($.client??this._client).post({url:"/provider/{id}/oauth/authorize",...$,headers:{"Content-Type":"application/json",...$.headers}})}callback($){return($.client??this._client).post({url:"/provider/{id}/oauth/callback",...$,headers:{"Content-Type":"application/json",...$.headers}})}}class E2 extends a1{list($){return($?.client??this._client).get({url:"/provider",...$})}auth($){return($?.client??this._client).get({url:"/provider/auth",...$})}oauth=new C2({client:this._client})}class b2 extends a1{text($){return($.client??this._client).get({url:"/find",...$})}files($){return($.client??this._client).get({url:"/find/file",...$})}symbols($){return($.client??this._client).get({url:"/find/symbol",...$})}}class _2 extends a1{list($){return($.client??this._client).get({url:"/file",...$})}read($){return($.client??this._client).get({url:"/file/content",...$})}status($){return($?.client??this._client).get({url:"/file/status",...$})}}class S2 extends a1{log($){return($?.client??this._client).post({url:"/log",...$,headers:{"Content-Type":"application/json",...$?.headers}})}agents($){return($?.client??this._client).get({url:"/agent",...$})}}class DH extends a1{remove($){return($.client??this._client).delete({url:"/mcp/{name}/auth",...$})}start($){return($.client??this._client).post({url:"/mcp/{name}/auth",...$})}callback($){return($.client??this._client).post({url:"/mcp/{name}/auth/callback",...$,headers:{"Content-Type":"application/json",...$.headers}})}authenticate($){return($.client??this._client).post({url:"/mcp/{name}/auth/authenticate",...$})}set($){return($.client??this._client).put({url:"/auth/{id}",...$,headers:{"Content-Type":"application/json",...$.headers}})}}class f2 extends a1{status($){return($?.client??this._client).get({url:"/mcp",...$})}add($){return($?.client??this._client).post({url:"/mcp",...$,headers:{"Content-Type":"application/json",...$?.headers}})}connect($){return($.client??this._client).post({url:"/mcp/{name}/connect",...$})}disconnect($){return($.client??this._client).post({url:"/mcp/{name}/disconnect",...$})}auth=new DH({client:this._client})}class k2 extends a1{status($){return($?.client??this._client).get({url:"/lsp",...$})}}class v2 extends a1{status($){return($?.client??this._client).get({url:"/formatter",...$})}}class y2 extends a1{next($){return($?.client??this._client).get({url:"/tui/control/next",...$})}response($){return($?.client??this._client).post({url:"/tui/control/response",...$,headers:{"Content-Type":"application/json",...$?.headers}})}}class x2 extends a1{appendPrompt($){return($?.client??this._client).post({url:"/tui/append-prompt",...$,headers:{"Content-Type":"application/json",...$?.headers}})}openHelp($){return($?.client??this._client).post({url:"/tui/open-help",...$})}openSessions($){return($?.client??this._client).post({url:"/tui/open-sessions",...$})}openThemes($){return($?.client??this._client).post({url:"/tui/open-themes",...$})}openModels($){return($?.client??this._client).post({url:"/tui/open-models",...$})}submitPrompt($){return($?.client??this._client).post({url:"/tui/submit-prompt",...$})}clearPrompt($){return($?.client??this._client).post({url:"/tui/clear-prompt",...$})}executeCommand($){return($?.client??this._client).post({url:"/tui/execute-command",...$,headers:{"Content-Type":"application/json",...$?.headers}})}showToast($){return($?.client??this._client).post({url:"/tui/show-toast",...$,headers:{"Content-Type":"application/json",...$?.headers}})}publish($){return($?.client??this._client).post({url:"/tui/publish",...$,headers:{"Content-Type":"application/json",...$?.headers}})}control=new y2({client:this._client})}class h2 extends a1{subscribe($){return($?.client??this._client).get.sse({url:"/event",...$})}}class wH extends a1{postSessionIdPermissionsPermissionId($){return($.client??this._client).post({url:"/session/{id}/permissions/{permissionID}",...$,headers:{"Content-Type":"application/json",...$.headers}})}global=new j2({client:this._client});project=new N2({client:this._client});pty=new M2({client:this._client});config=new D2({client:this._client});tool=new w2({client:this._client});instance=new L2({client:this._client});path=new T2({client:this._client});vcs=new R2({client:this._client});session=new P2({client:this._client});command=new I2({client:this._client});provider=new E2({client:this._client});find=new b2({client:this._client});file=new _2({client:this._client});app=new S2({client:this._client});mcp=new f2({client:this._client});lsp=new k2({client:this._client});formatter=new v2({client:this._client});tui=new x2({client:this._client});auth=new DH({client:this._client});event=new h2({client:this._client})}function Q00($,Z){if(!$)return;if(!Z)return $;if($===Z)return Z;if($===encodeURIComponent(Z))return Z;return $}function G00($,Z){if($.method!=="GET"&&$.method!=="HEAD")return $;let J=Q00($.headers.get("x-qitqode-directory"),Z);if(!J)return $;let Y=new URL($.url);if(!Y.searchParams.has("directory"))Y.searchParams.set("directory",J);let X=new Request(Y,$);return X.headers.delete("x-qitqode-directory"),X}function LH($){$=g2($);let Z=DX($);return Z.interceptors.request.use((J)=>G00(J,$?.directory)),new wH({client:Z})}var K00=m6(W00(),1);import TH from"os";import{setTimeout as V00}from"timers/promises";import{createServer as U00}from"http";var IH=E0.create({service:"plugin.codex"}),wX="app_EMoamEEZ73f0CkXaXp7hrann",hZ="https://auth.openai.com",H00="https://chatgpt.com/backend-api/codex/responses",xZ=1455,B00=3000;async function z00(){let $=F00(43),J=new TextEncoder().encode($),Y=await crypto.subtle.digest("SHA-256",J),X=l2(Y);return{verifier:$,challenge:X}}function F00($){let J=crypto.getRandomValues(new Uint8Array($));return Array.from(J).map((Y)=>"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~"[Y%66]).join("")}function l2($){let Z=new Uint8Array($),J=String.fromCharCode(...Z);return btoa(J).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function A00(){return l2(crypto.getRandomValues(new Uint8Array(32)).buffer)}function u2($){let Z=$.split(".");if(Z.length!==3)return;try{return JSON.parse(Buffer.from(Z[1],"base64url").toString())}catch{return}}function m2($){return $.chatgpt_account_id||$["https://api.openai.com/auth"]?.chatgpt_account_id||$.organizations?.[0]?.id}function RH($){if($.id_token){let Z=u2($.id_token),J=Z&&m2(Z);if(J)return J}if($.access_token){let Z=u2($.access_token);return Z?m2(Z):void 0}return}function O00($,Z,J){let Y=new URLSearchParams({response_type:"code",client_id:wX,redirect_uri:$,scope:"openid profile email offline_access",code_challenge:Z.challenge,code_challenge_method:"S256",id_token_add_organizations:"true",codex_cli_simplified_flow:"true",state:J,originator:"qitqode"});return`${hZ}/oauth/authorize?${Y.toString()}`}async function q00($,Z,J){let Y=await fetch(`${hZ}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",code:$,redirect_uri:Z,client_id:wX,code_verifier:J.verifier}).toString()});if(!Y.ok)throw Error(`Token exchange failed: ${Y.status}`);return Y.json()}async function j00($){let Z=await fetch(`${hZ}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:$,client_id:wX}).toString()});if(!Z.ok)throw Error(`Token refresh failed: ${Z.status}`);return Z.json()}var N00=`<!doctype html>
|
|
539
|
+
<html>
|
|
540
|
+
<head>
|
|
541
|
+
<title>QitQode - Codex Authorization Successful</title>
|
|
542
|
+
<style>
|
|
543
|
+
body {
|
|
544
|
+
font-family:
|
|
545
|
+
system-ui,
|
|
546
|
+
-apple-system,
|
|
547
|
+
sans-serif;
|
|
548
|
+
display: flex;
|
|
549
|
+
justify-content: center;
|
|
550
|
+
align-items: center;
|
|
551
|
+
height: 100vh;
|
|
552
|
+
margin: 0;
|
|
553
|
+
background: #131010;
|
|
554
|
+
color: #f1ecec;
|
|
555
|
+
}
|
|
556
|
+
.container {
|
|
557
|
+
text-align: center;
|
|
558
|
+
padding: 2rem;
|
|
559
|
+
}
|
|
560
|
+
h1 {
|
|
561
|
+
color: #f1ecec;
|
|
562
|
+
margin-bottom: 1rem;
|
|
563
|
+
}
|
|
564
|
+
p {
|
|
565
|
+
color: #b7b1b1;
|
|
566
|
+
}
|
|
567
|
+
</style>
|
|
568
|
+
</head>
|
|
569
|
+
<body>
|
|
570
|
+
<div class="container">
|
|
571
|
+
<h1>Authorization Successful</h1>
|
|
572
|
+
<p>You can close this window and return to QitQode.</p>
|
|
573
|
+
</div>
|
|
574
|
+
<script>
|
|
575
|
+
setTimeout(() => window.close(), 2000)
|
|
576
|
+
</script>
|
|
577
|
+
</body>
|
|
578
|
+
</html>`,PH=($)=>`<!doctype html>
|
|
579
|
+
<html>
|
|
580
|
+
<head>
|
|
581
|
+
<title>QitQode - Codex Authorization Failed</title>
|
|
582
|
+
<style>
|
|
583
|
+
body {
|
|
584
|
+
font-family:
|
|
585
|
+
system-ui,
|
|
586
|
+
-apple-system,
|
|
587
|
+
sans-serif;
|
|
588
|
+
display: flex;
|
|
589
|
+
justify-content: center;
|
|
590
|
+
align-items: center;
|
|
591
|
+
height: 100vh;
|
|
592
|
+
margin: 0;
|
|
593
|
+
background: #131010;
|
|
594
|
+
color: #f1ecec;
|
|
595
|
+
}
|
|
596
|
+
.container {
|
|
597
|
+
text-align: center;
|
|
598
|
+
padding: 2rem;
|
|
599
|
+
}
|
|
600
|
+
h1 {
|
|
601
|
+
color: #fc533a;
|
|
602
|
+
margin-bottom: 1rem;
|
|
603
|
+
}
|
|
604
|
+
p {
|
|
605
|
+
color: #b7b1b1;
|
|
606
|
+
}
|
|
607
|
+
.error {
|
|
608
|
+
color: #ff917b;
|
|
609
|
+
font-family: monospace;
|
|
610
|
+
margin-top: 1rem;
|
|
611
|
+
padding: 1rem;
|
|
612
|
+
background: #3c140d;
|
|
613
|
+
border-radius: 0.5rem;
|
|
614
|
+
}
|
|
615
|
+
</style>
|
|
616
|
+
</head>
|
|
617
|
+
<body>
|
|
618
|
+
<div class="container">
|
|
619
|
+
<h1>Authorization Failed</h1>
|
|
620
|
+
<p>An error occurred during authorization.</p>
|
|
621
|
+
<div class="error">${$}</div>
|
|
622
|
+
</div>
|
|
623
|
+
</body>
|
|
624
|
+
</html>`,l5,r$;async function M00(){if(l5)return{port:xZ,redirectUri:`http://localhost:${xZ}/auth/callback`};return l5=U00(($,Z)=>{let J=new URL($.url||"/",`http://localhost:${xZ}`);if(J.pathname==="/auth/callback"){let Y=J.searchParams.get("code"),X=J.searchParams.get("state"),Q=J.searchParams.get("error"),G=J.searchParams.get("error_description");if(Q){let K=G||Q;r$?.reject(Error(K)),r$=void 0,Z.writeHead(200,{"Content-Type":"text/html"}),Z.end(PH(K));return}if(!Y){r$?.reject(Error("Missing authorization code")),r$=void 0,Z.writeHead(400,{"Content-Type":"text/html"}),Z.end(PH("Missing authorization code"));return}if(!r$||X!==r$.state){r$?.reject(Error("Invalid state - potential CSRF attack")),r$=void 0,Z.writeHead(400,{"Content-Type":"text/html"}),Z.end(PH("Invalid state - potential CSRF attack"));return}let W=r$;r$=void 0,q00(Y,`http://localhost:${xZ}/auth/callback`,W.pkce).then((K)=>W.resolve(K)).catch((K)=>W.reject(K)),Z.writeHead(200,{"Content-Type":"text/html"}),Z.end(N00);return}if(J.pathname==="/cancel"){r$?.reject(Error("Login cancelled")),r$=void 0,Z.writeHead(200),Z.end("Login cancelled");return}Z.writeHead(404),Z.end("Not found")}),await new Promise(($,Z)=>{l5.listen(xZ,()=>{IH.info("codex oauth server started",{port:xZ}),$()}),l5.on("error",Z)}),{port:xZ,redirectUri:`http://localhost:${xZ}/auth/callback`}}function D00(){if(l5)l5.close(()=>{IH.info("codex oauth server stopped")}),l5=void 0}function w00($,Z){return new Promise((J,Y)=>{let X=setTimeout(()=>{if(r$)r$=void 0,Y(Error("OAuth callback timeout - authorization took too long"))},300000);r$={pkce:$,state:Z,resolve:(Q)=>{clearTimeout(X),J(Q)},reject:(Q)=>{clearTimeout(X),Y(Q)}}})}async function d2($){return{auth:{provider:"openai",async loader(Z,J){if((await Z()).type!=="oauth")return{};let X=new Set(["gpt-5.1-codex","gpt-5.1-codex-max","gpt-5.1-codex-mini","gpt-5.2","gpt-5.2-codex","gpt-5.3-codex","gpt-5.4","gpt-5.4-mini"]);for(let[Q,G]of Object.entries(J.models)){if(Q.includes("codex"))continue;if(X.has(G.api.id))continue;delete J.models[Q]}for(let Q of Object.values(J.models))Q.cost={input:0,output:0,cache:{read:0,write:0}};return{apiKey:lV,async fetch(Q,G){if(G?.headers)if(G.headers instanceof Headers)G.headers.delete("authorization"),G.headers.delete("Authorization");else if(Array.isArray(G.headers))G.headers=G.headers.filter(([B])=>B.toLowerCase()!=="authorization");else delete G.headers.authorization,delete G.headers.Authorization;let W=await Z();if(W.type!=="oauth")return fetch(Q,G);let K=W;if(!W.access||W.expires<Date.now()){IH.info("refreshing codex access token");let B=await j00(W.refresh),z=RH(B)||K.accountId;await $.client.auth.set({path:{id:"openai"},body:{type:"oauth",refresh:B.refresh_token,access:B.access_token,expires:Date.now()+(B.expires_in??3600)*1000,...z&&{accountId:z}}}),W.access=B.access_token,K.accountId=z}let V=new Headers;if(G?.headers){if(G.headers instanceof Headers)G.headers.forEach((B,z)=>V.set(z,B));else if(Array.isArray(G.headers)){for(let[B,z]of G.headers)if(z!==void 0)V.set(B,String(z))}else for(let[B,z]of Object.entries(G.headers))if(z!==void 0)V.set(B,String(z))}if(V.set("authorization",`Bearer ${W.access}`),K.accountId)V.set("ChatGPT-Account-Id",K.accountId);let U=Q instanceof URL?Q:new URL(typeof Q==="string"?Q:Q.url),H=U.pathname.includes("/v1/responses")||U.pathname.includes("/chat/completions")?new URL(H00):U;return fetch(H,{...G,headers:V})}}},methods:[{label:"ChatGPT Pro/Plus (browser)",type:"oauth",authorize:async()=>{let{redirectUri:Z}=await M00(),J=await z00(),Y=A00(),X=O00(Z,J,Y),Q=w00(J,Y);return{url:X,instructions:"Complete authorization in your browser. This window will close automatically.",method:"auto",callback:async()=>{let G=await Q;D00();let W=RH(G);return{type:"success",refresh:G.refresh_token,access:G.access_token,expires:Date.now()+(G.expires_in??3600)*1000,accountId:W}}}}},{label:"ChatGPT Pro/Plus (headless)",type:"oauth",authorize:async()=>{let Z=await fetch(`${hZ}/api/accounts/deviceauth/usercode`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":`qitqode/${E$}`},body:JSON.stringify({client_id:wX})});if(!Z.ok)throw Error("Failed to initiate device authorization");let J=await Z.json(),Y=Math.max(parseInt(J.interval)||5,1)*1000;return{url:`${hZ}/codex/device`,instructions:`Enter code: ${J.user_code}`,method:"auto",async callback(){while(!0){let X=await fetch(`${hZ}/api/accounts/deviceauth/token`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":`qitqode/${E$}`},body:JSON.stringify({device_auth_id:J.device_auth_id,user_code:J.user_code})});if(X.ok){let Q=await X.json(),G=await fetch(`${hZ}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",code:Q.authorization_code,redirect_uri:`${hZ}/deviceauth/callback`,client_id:wX,code_verifier:Q.code_verifier}).toString()});if(!G.ok)throw Error(`Token exchange failed: ${G.status}`);let W=await G.json();return{type:"success",refresh:W.refresh_token,access:W.access_token,expires:Date.now()+(W.expires_in??3600)*1000,accountId:RH(W)}}if(X.status!==403&&X.status!==404)return{type:"failed"};await V00(Y+B00)}}}}},{label:"Manually enter API Key",type:"api"}]},"chat.headers":async(Z,J)=>{if(Z.model.providerID!=="openai")return;J.headers.originator="qitqode",J.headers["User-Agent"]=`qitqode/${E$} (${TH.platform()} ${TH.release()}; ${TH.arch()})`,J.headers.session_id=Z.sessionID},"chat.params":async(Z,J)=>{if(Z.model.providerID!=="openai")return;J.maxOutputTokens=void 0}}}async function p2($){return{}}async function c2($){return{auth:{provider:"anthropic",async loader(Z,J){if(!J?.options?.baseURL)return{};return{async fetch(Y,X){if(X?.headers&&typeof X.headers==="object"&&!Array.isArray(X.headers))delete X.headers["anthropic-beta"];let Q=await fetch(Y,X);if(!Q.body||!Q.headers.get("content-type")?.includes("text/event-stream"))return Q;let G=Q.body.getReader(),W=new TextDecoder,K=!1,V="",U=new ReadableStream({async pull(H){if(K){H.close();return}let B=await G.read();if(B.done){H.close();return}if(H.enqueue(B.value),V+=W.decode(B.value,{stream:!0}),V.includes(`
|
|
625
|
+
event: message_stop
|
|
626
|
+
`)||V.includes(`
|
|
627
|
+
data: {"type":"message_stop"}`))K=!0,G.cancel(),H.close();if(V.length>512)V=V.slice(-256)},cancel(){G.cancel()}});return new Response(U,{headers:Q.headers,status:Q.status})}}},methods:[]}}}import{setTimeout as CH}from"timers/promises";var LX={};F1(LX,{schema:()=>n2,get:()=>L00,CopilotModels:()=>LX});var n2=D.object({data:D.array(D.object({model_picker_enabled:D.boolean(),id:D.string(),name:D.string(),version:D.string(),supported_endpoints:D.array(D.string()).optional(),policy:D.object({state:D.string().optional()}).optional(),capabilities:D.object({family:D.string(),limits:D.object({max_context_window_tokens:D.number(),max_output_tokens:D.number(),max_prompt_tokens:D.number(),vision:D.object({max_prompt_image_size:D.number(),max_prompt_images:D.number(),supported_media_types:D.array(D.string())}).optional()}),supports:D.object({adaptive_thinking:D.boolean().optional(),max_thinking_budget:D.number().optional(),min_thinking_budget:D.number().optional(),reasoning_effort:D.array(D.string()).optional(),streaming:D.boolean(),structured_outputs:D.boolean().optional(),tool_calls:D.boolean(),vision:D.boolean().optional()})})}))});function i2($,Z,J,Y){let X=!!Z.capabilities.supports.adaptive_thinking||!!Z.capabilities.supports.reasoning_effort?.length||Z.capabilities.supports.max_thinking_budget!==void 0||Z.capabilities.supports.min_thinking_budget!==void 0,Q=(Z.capabilities.supports.vision??!1)||(Z.capabilities.limits.vision?.supported_media_types??[]).some((W)=>W.startsWith("image/")),G=Z.supported_endpoints?.includes("/v1/messages");return{id:$,providerID:"github-copilot",api:{id:Z.id,url:G?`${J}/v1`:J,npm:G?"@ai-sdk/anthropic":"@ai-sdk/github-copilot"},status:"active",limit:{context:Z.capabilities.limits.max_context_window_tokens,input:Z.capabilities.limits.max_prompt_tokens,output:Z.capabilities.limits.max_output_tokens},capabilities:{temperature:Y?.capabilities.temperature??!0,reasoning:Y?.capabilities.reasoning??X,attachment:Y?.capabilities.attachment??!0,toolcall:Z.capabilities.supports.tool_calls,input:{text:!0,audio:!1,image:Q,video:!1,pdf:!1},output:{text:!0,audio:!1,image:!1,video:!1,pdf:!1},interleaved:!1},family:Y?.family??Z.capabilities.family,name:Y?.name??Z.name,cost:{input:0,output:0,cache:{read:0,write:0}},options:Y?.options??{},headers:Y?.headers??{},release_date:Y?.release_date??(Z.version.startsWith(`${Z.id}-`)?Z.version.slice(Z.id.length+1):Z.version),variants:Y?.variants??{}}}async function L00($,Z={},J={}){let Y=await fetch(`${$}/models`,{headers:Z,signal:AbortSignal.timeout(5000)}).then(async(G)=>{if(!G.ok)throw Error(`Failed to fetch models: ${G.status}`);return n2.parse(await G.json())}),X={...J},Q=new Map(Y.data.filter((G)=>G.model_picker_enabled&&G.policy?.state!=="disabled").map((G)=>[G.id,G]));for(let[G,W]of Object.entries(X)){let K=Q.get(W.api.id);if(!K){delete X[G];continue}X[G]=i2(G,K,$,W)}for(let[G,W]of Q){if(G in X)continue;X[G]=i2(G,W,$)}return X}var T00=E0.create({service:"plugin.copilot"}),o2="Ov23li8tweQw6odWQebz",EH=3000;function r2($){return $.replace(/^https?:\/\//,"").replace(/\/$/,"")}function R00($){return{DEVICE_CODE_URL:`https://${$}/login/device/code`,ACCESS_TOKEN_URL:`https://${$}/login/oauth/access_token`}}function bH($){return $?`https://copilot-api.${r2($)}`:"https://api.githubcopilot.com"}function _H($){if($?.role!=="user")return!1;let Z=$.content;if(typeof Z==="string")return Z===b$.SYNTHETIC_ATTACHMENT_PROMPT;if(!Array.isArray(Z))return!1;return Z.some((J)=>(J?.type==="text"||J?.type==="input_text")&&J.text===b$.SYNTHETIC_ATTACHMENT_PROMPT)}function s2($,Z){return{...$,api:{...$.api,url:Z,npm:"@ai-sdk/github-copilot"}}}async function a2($){let Z=$.client;return{provider:{id:"github-copilot",async models(J,Y){if(Y.auth?.type!=="oauth")return Object.fromEntries(Object.entries(J.models).map(([Q,G])=>[Q,s2(G,bH())]));let X=Y.auth;return LX.get(bH(X.enterpriseUrl),{Authorization:`Bearer ${X.refresh}`,"User-Agent":`qitqode/${E$}`},J.models).catch((Q)=>{return T00.error("failed to fetch copilot models",{error:Q}),Object.fromEntries(Object.entries(J.models).map(([G,W])=>[G,s2(W,bH(X.enterpriseUrl))]))})}},auth:{provider:"github-copilot",async loader(J){let Y=await J();if(!Y||Y.type!=="oauth")return{};return{apiKey:"",async fetch(X,Q){let G=await J();if(G.type!=="oauth")return fetch(X,Q);let W=X instanceof URL?X.href:typeof X==="string"?X:X.url,{isVision:K,isAgent:V}=l$(()=>{try{let H=typeof Q?.body==="string"?JSON.parse(Q.body):Q?.body;if(H?.messages&&W.includes("completions")){let B=H.messages[H.messages.length-1];return{isVision:H.messages.some((z)=>Array.isArray(z.content)&&z.content.some((F)=>F.type==="image_url")),isAgent:B?.role!=="user"||_H(B)}}if(H?.input){let B=H.input[H.input.length-1];return{isVision:H.input.some((z)=>Array.isArray(z?.content)&&z.content.some((F)=>F.type==="input_image")),isAgent:B?.role!=="user"||_H(B)}}if(H?.messages){let B=H.messages[H.messages.length-1],z=Array.isArray(B?.content)&&B.content.some((F)=>F?.type!=="tool_result");return{isVision:H.messages.some((F)=>Array.isArray(F?.content)&&F.content.some((A)=>A?.type==="image"||A?.type==="tool_result"&&Array.isArray(A?.content)&&A.content.some((j)=>j?.type==="image"))),isAgent:!(B?.role==="user"&&z)||_H(B)}}}catch{}return{isVision:!1,isAgent:!1}}),U={"x-initiator":V?"agent":"user",...Q?.headers,"User-Agent":`qitqode/${E$}`,Authorization:`Bearer ${G.refresh}`,"Openai-Intent":"conversation-edits"};if(K)U["Copilot-Vision-Request"]="true";return delete U["x-api-key"],delete U.authorization,fetch(X,{...Q,headers:U})}}},methods:[{type:"oauth",label:"Login with GitHub Copilot",prompts:[{type:"select",key:"deploymentType",message:"Select GitHub deployment type",options:[{label:"GitHub.com",value:"github.com",hint:"Public"},{label:"GitHub Enterprise",value:"enterprise",hint:"Data residency or self-hosted"}]},{type:"text",key:"enterpriseUrl",message:"Enter your GitHub Enterprise URL or domain",placeholder:"company.ghe.com or https://company.ghe.com",when:{key:"deploymentType",op:"eq",value:"enterprise"},validate:(J)=>{if(!J)return"URL or domain is required";try{if(!(J.includes("://")?new URL(J):new URL(`https://${J}`)).hostname)return"Please enter a valid URL or domain";return}catch{return"Please enter a valid URL (e.g., company.ghe.com or https://company.ghe.com)"}}}],async authorize(J={}){let Y=J.deploymentType||"github.com",X="github.com";if(Y==="enterprise"){let K=J.enterpriseUrl;X=r2(K)}let Q=R00(X),G=await fetch(Q.DEVICE_CODE_URL,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","User-Agent":`qitqode/${E$}`},body:JSON.stringify({client_id:o2,scope:"read:user"})});if(!G.ok)throw Error("Failed to initiate device authorization");let W=await G.json();return{url:W.verification_uri,instructions:`Enter code: ${W.user_code}`,method:"auto",async callback(){while(!0){let K=await fetch(Q.ACCESS_TOKEN_URL,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","User-Agent":`qitqode/${E$}`},body:JSON.stringify({client_id:o2,device_code:W.device_code,grant_type:"urn:ietf:params:oauth:grant-type:device_code"})});if(!K.ok)return{type:"failed"};let V=await K.json();if(V.access_token){let U={type:"success",refresh:V.access_token,access:V.access_token,expires:0};if(Y==="enterprise")U.enterpriseUrl=X;return U}if(V.error==="authorization_pending"){await CH(W.interval*1000+EH);continue}if(V.error==="slow_down"){let U=(W.interval+5)*1000,H=V.interval;if(H&&typeof H==="number"&&H>0)U=H*1000;await CH(U+EH);continue}if(V.error)return{type:"failed"};await CH(W.interval*1000+EH);continue}}}}}]},"chat.params":async(J,Y)=>{if(!J.model.providerID.includes("github-copilot"))return;if(J.model.api.id.includes("gpt"))Y.maxOutputTokens=void 0;if(J.model.api.npm==="@ai-sdk/anthropic")Y.options.toolStreaming=!1},"chat.headers":async(J,Y)=>{if(!J.model.providerID.includes("github-copilot"))return;if(J.model.api.npm==="@ai-sdk/anthropic")Y.headers["anthropic-beta"]="interleaved-thinking-2025-05-14";let X=await Z.session.get({path:{id:J.sessionID},query:{directory:$.directory},throwOnError:!0}).catch(()=>{return});if(!X||!X.data.parentID)return;Y.headers["x-initiator"]="agent"}}}var Cu=m6(Uu(),1),Eu=m6(Iu(),1);class iQ{options;server;resolveCallback;rejectCallback;timeoutHandle;constructor($={}){this.options=$,this.server=Cu.default({logger:!1}),this.server.register(Eu.default,{max:30,timeWindow:60000}),this.server.get("/callback",async(Z,J)=>{let{code:Y,state:X,error:Q,error_description:G}=Z.query;if(Q){let W=G||Q;this.rejectCallback?.(Error(`OAuth error: ${W}`)),await J.type("text/html").send(`
|
|
628
|
+
<!DOCTYPE html>
|
|
629
|
+
<html>
|
|
630
|
+
<head><title>Authentication Failed</title></head>
|
|
631
|
+
<body>
|
|
632
|
+
<h1>Authentication Failed</h1>
|
|
633
|
+
<p>${W}</p>
|
|
634
|
+
<p>You can close this window.</p>
|
|
635
|
+
</body>
|
|
636
|
+
</html>
|
|
637
|
+
`),this.cleanup();return}if(!Y||!X){this.rejectCallback?.(Error("Missing code or state parameter")),await J.type("text/html").send(`
|
|
638
|
+
<!DOCTYPE html>
|
|
639
|
+
<html>
|
|
640
|
+
<head><title>Authentication Failed</title></head>
|
|
641
|
+
<body>
|
|
642
|
+
<h1>Authentication Failed</h1>
|
|
643
|
+
<p>Missing required parameters.</p>
|
|
644
|
+
<p>You can close this window.</p>
|
|
645
|
+
</body>
|
|
646
|
+
</html>
|
|
647
|
+
`),this.cleanup();return}this.resolveCallback?.({code:Y,state:X}),await J.type("text/html").send(`
|
|
648
|
+
<!DOCTYPE html>
|
|
649
|
+
<html>
|
|
650
|
+
<head><title>Authentication Successful</title></head>
|
|
651
|
+
<body>
|
|
652
|
+
<h1>Authentication Successful</h1>
|
|
653
|
+
<p>You can close this window and return to your terminal.</p>
|
|
654
|
+
</body>
|
|
655
|
+
</html>
|
|
656
|
+
`),this.cleanup()})}async start(){let $=this.options.host||"127.0.0.1",Z=this.options.port||0;await this.server.listen({host:$,port:Z})}async waitForCallback(){let $=this.options.timeout||60000;return this.timeoutHandle=setTimeout(()=>{this.rejectCallback?.(Error("OAuth callback timeout")),this.cleanup()},$),new Promise((Z,J)=>{this.resolveCallback=Z,this.rejectCallback=J})}getPort(){let $=this.server.server.address();if(!$||typeof $==="string")throw Error("Server not started or using Unix socket");return $.port}getCallbackUrl(){let $=this.options.host||"127.0.0.1",Z=this.getPort();return`http://${$}:${Z}/callback`}cleanup(){if(this.timeoutHandle)clearTimeout(this.timeoutHandle),this.timeoutHandle=void 0;setTimeout(()=>{this.server.close()},100)}async close(){if(this.timeoutHandle)clearTimeout(this.timeoutHandle),this.timeoutHandle=void 0;await this.server.close()}}class UK{options;constructor($){this.options=$}async authorize(){let $=BA(43),Z=bu($),J=BA(32);if(this.options.method==="auto")return this.authorizeWithCallback(Z,J,$);else return this.authorizeWithManualCode(Z,J,$)}async authorizeWithCallback($,Z,J){let Y=new iQ({port:0,host:"127.0.0.1",timeout:this.options.timeout||60000});try{let X=Y.waitForCallback(),Q=Y.getCallbackUrl(),G=this.buildAuthorizationUrl(Q,$,Z);await(await import("./chunk-w6rf2knb.js")).default(G);let K=await X;if(K.state!==Z)throw Error("State mismatch - possible CSRF attack");return{code:K.code,state:K.state,codeVerifier:J}}finally{await Y.close()}}authorizeWithManualCode($,Z,J){throw this.buildAuthorizationUrl("http://127.0.0.1/callback",$,Z),Error("Manual code entry not yet implemented - use auto method")}buildAuthorizationUrl($,Z,J){let Y=new URLSearchParams({client_id:this.options.clientId,redirect_uri:$,response_type:"code",state:J,scope:this.options.scopes.join(" "),code_challenge:Z,code_challenge_method:"S256"});return`${this.options.instanceUrl.replace(/\/$/,"")}/oauth/authorize?${Y.toString()}`}async exchangeAuthorizationCode($,Z,J){let X=`${this.options.instanceUrl.replace(/\/$/,"")}/oauth/token`,Q=new URLSearchParams({client_id:this.options.clientId,code:$,grant_type:"authorization_code",redirect_uri:J,code_verifier:Z}),G=await fetch(X,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:Q.toString()});if(!G.ok){let K=await G.text();throw Error(`Token exchange failed: ${G.status} ${G.statusText} - ${K}`)}return await G.json()}async exchangeRefreshToken($){let J=`${this.options.instanceUrl.replace(/\/$/,"")}/oauth/token`,Y=new URLSearchParams({client_id:this.options.clientId,refresh_token:$,grant_type:"refresh_token"}),X=await fetch(J,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:Y.toString()});if(!X.ok){let G=await X.text();throw Error(`Token refresh failed: ${X.status} ${X.statusText} - ${G}`)}return await X.json()}}import T$ from"fs";import O7 from"path";import _u from"os";var sQ=process.env.GITLAB_OAUTH_CLIENT_ID||"1d89f9fdb23ee96d4e603201f6861dab6e143c5c3c00469a018a2d94bdc03d4e",hq0="https://gitlab.com",zA=["api"];function nQ(){return process.env.GITLAB_INSTANCE_URL||hq0}function Y$($,Z){try{let J=_u.homedir(),Y=O7.join(J,".local","share","opencode","log");if(!T$.existsSync(Y))T$.mkdirSync(Y,{recursive:!0});let X=O7.join(Y,"gitlab-auth.log"),Q=new Date().toISOString(),G=Z?`[${Q}] ${$}: ${JSON.stringify(Z)}
|
|
657
|
+
`:`[${Q}] ${$}
|
|
658
|
+
`;T$.appendFileSync(X,G)}catch{}}function FA(){let $=_u.homedir(),Z=process.env.XDG_DATA_HOME;if(Z)return O7.join(Z,"opencode","auth.json");if(process.platform!=="win32")return O7.join($,".local","share","opencode","auth.json");return O7.join($,".opencode","auth.json")}async function Su($,Z,J,Y){let X=FA(),Q=O7.dirname(X);if(!T$.existsSync(Q))T$.mkdirSync(Q,{recursive:!0});let G={};if(T$.existsSync(X)){let W=T$.readFileSync(X,"utf-8");G=JSON.parse(W)}G.gitlab={type:"oauth",access:$,refresh:Z,expires:J,enterpriseUrl:Y},T$.writeFileSync(X,JSON.stringify(G,null,2)),T$.chmodSync(X,384)}async function gq0($,Z){let J=FA(),Y=O7.dirname(J);if(!T$.existsSync(Y))T$.mkdirSync(Y,{recursive:!0});let X={};if(T$.existsSync(J)){let Q=T$.readFileSync(J,"utf-8");X=JSON.parse(Q)}X.gitlab={type:"api",key:$,enterpriseUrl:Z},T$.writeFileSync(J,JSON.stringify(X,null,2)),T$.chmodSync(J,384)}var oQ=null;async function uq0($,Z,J){let Y=Date.now(),X=300000;if(!($.expires<=Y+300000))return Y$("Token is still valid",{expiresAt:new Date($.expires).toISOString(),expiresIn:Math.round(($.expires-Y)/1000/60)+" minutes"}),{apiKey:$.access,instanceUrl:$.enterpriseUrl||J};if(oQ){Y$("Token refresh already in progress, waiting..."),await oQ;let W=await Z();if(W&&W.type==="oauth")return{apiKey:W.access,instanceUrl:W.enterpriseUrl||J};throw Error("Failed to get refreshed auth data")}Y$("Token expired or expiring soon, refreshing...",{expiresAt:new Date($.expires).toISOString(),expired:$.expires<=Y}),oQ=(async()=>{try{let W=$.enterpriseUrl||J,K=new UK({instanceUrl:W,clientId:sQ,scopes:zA,method:"auto"});Y$("Calling exchangeRefreshToken...");let V=await K.exchangeRefreshToken($.refresh),U=Date.now()+V.expires_in*1000;Y$("Token refresh successful",{newExpiresAt:new Date(U).toISOString(),expiresIn:Math.round(V.expires_in/60)+" minutes"}),await Su(V.access_token,V.refresh_token,U,W),Y$("New tokens saved successfully")}catch(W){if(Y$("Token refresh failed",{error:W instanceof Error?W.message:String(W),stack:W instanceof Error?W.stack:void 0}),W instanceof Error&&W.message.includes("401")){Y$("Refresh token appears to be revoked (401), clearing auth data");let K=FA();if(T$.existsSync(K)){let V=T$.readFileSync(K,"utf-8"),U=JSON.parse(V);delete U.gitlab,T$.writeFileSync(K,JSON.stringify(U,null,2))}}throw W}})();try{await oQ}finally{oQ=null}let G=await Z();if(G&&G.type==="oauth")return{apiKey:G.access,instanceUrl:G.enterpriseUrl||J};throw Error("Failed to get refreshed auth data after token refresh")}var fu=async($)=>{return{auth:{provider:"gitlab",async loader(J){let Y=await J();if(!Y)return{};if(Y.type==="oauth")try{return{...await uq0(Y,J,nQ()),clientId:sQ}}catch(X){return Y$("Failed to refresh token in loader",{error:X instanceof Error?X.message:String(X)}),{apiKey:Y.access,instanceUrl:Y.enterpriseUrl||nQ(),clientId:sQ}}if(Y.type==="api"){let X=Y.enterpriseUrl||nQ();return{apiKey:Y.key,instanceUrl:X}}return{}},methods:[{type:"oauth",label:"GitLab OAuth",prompts:[],async authorize(){let J=nQ(),Y;try{let N=new URL(J);Y=`${N.protocol}//${N.host}`}catch{throw Error(`Invalid GitLab instance URL: ${J}`)}let{generateSecret:X,generateCodeChallengeFromVerifier:Q}=await import("./chunk-h9gtymfm.js"),G=X(43),W=Q(G),K=X(32),V=new iQ({port:8080,host:"127.0.0.1",timeout:120000});await V.start();let U=V.getCallbackUrl(),H=V.waitForCallback(),B=new URLSearchParams({client_id:sQ,redirect_uri:U,response_type:"code",state:K,scope:zA.join(" "),code_challenge:W,code_challenge_method:"S256"}),z=`${Y}/oauth/authorize?${B.toString()}`,{exec:F}=await import("child_process"),A=process.platform;return F(`${A==="darwin"?"open":A==="win32"?"start":"xdg-open"} "${z}"`),{method:"auto",url:z,instructions:"Your browser will open for authentication. The callback will be handled automatically.",async callback(){Y$("callback() called");try{Y$("Waiting for callback...");let N=await H;if(Y$("Received callback",{hasCode:!!N.code,hasState:!!N.state}),N.state!==K)return Y$("State mismatch",{expected:K,received:N.state}),await V.close(),{type:"failed"};Y$("State verified"),Y$("Exchanging code for tokens...");let q=await new UK({instanceUrl:Y,clientId:sQ,scopes:zA,method:"auto"}).exchangeAuthorizationCode(N.code,G,U);Y$("Token exchange successful"),await V.close();let M=Date.now()+q.expires_in*1000;return Y$("Tokens received",{expiresAt:new Date(M).toISOString()}),Y$("Saving auth data..."),await Su(q.access_token,q.refresh_token,M,Y),Y$("Auth data saved successfully"),{type:"success",provider:Y,access:q.access_token,refresh:q.refresh_token,expires:M}}catch(N){Y$("Error in callback",{error:N instanceof Error?N.message:String(N),stack:N instanceof Error?N.stack:void 0});try{await V.close()}catch(w){}return{type:"failed"}}}}}},{type:"api",label:"GitLab Personal Access Token",prompts:[{type:"text",key:"token",message:"Personal Access Token",placeholder:"glpat-xxxxxxxxxxxxxxxxxxxx",validate:(J)=>{if(!J)return"Token is required";if(!J.startsWith("glpat-"))return"Token should start with glpat-";return}}],async authorize(J){let Y=nQ(),X=J?.token;if(!X)return{type:"failed"};let Q;try{let G=new URL(Y);Q=`${G.protocol}//${G.host}`}catch{return{type:"failed"}}try{if(!(await fetch(`${Q}/api/v4/user`,{headers:{Authorization:`Bearer ${X}`}})).ok)return{type:"failed"};return Y$("Saving PAT auth data..."),await gq0(X,Q),Y$("PAT auth data saved successfully"),{type:"success",key:X,provider:Q}}catch{return{type:"failed"}}}}]}}};import mq0 from"http";function ku($){if($===null||$.length===0)return null;try{let Z=Buffer.from($,"base64url").toString("utf8"),J=JSON.parse(Z);if(J.v!==1||typeof J.n!=="string"||J.n.length===0||typeof J.i!=="string"||J.i.length===0||typeof J.r!=="boolean")return null;return{issuer:J.i,requireIssuer:J.r}}catch{return null}}async function yu($={}){let Z=$.callbackPath??"/callback",J=$.createServer?$.createServer():mq0.createServer();return{redirectUri:`http://127.0.0.1:${await lq0(J)}${Z}`,async waitForCode(Q){return dq0(J,Q,$,Z)},close(){J.closeAllConnections?.(),J.close()}}}async function lq0($){return new Promise((Z)=>{$.listen(0,"127.0.0.1",()=>{let J=$.address();Z(J.port)})})}function dq0($,Z,J,Y){let X=cq0(Z);return new Promise((Q,G)=>{let W=!1,K=(V)=>{if(!W)W=!0,V()};if($.on("request",(V,U)=>{let H=new URL(V.url??"/","http://127.0.0.1");if(H.pathname!==Y){U.writeHead(404),U.end("Not found");return}let B=H.searchParams.get("error");if(B!==null){let z=H.searchParams.get("error_description")??B;U.writeHead(400),U.end(`Authorization failed: ${z}`),K(()=>G(Error(`OAuth authorization failed: ${B} \u2014 ${z}`)));return}try{let z=vu({code:H.searchParams.get("code"),state:H.searchParams.get("state"),iss:H.searchParams.get("iss")},X);U.writeHead(200,{"Content-Type":"text/html"}),U.end(iq0(J.landingPage)),K(()=>Q(z))}catch(z){U.writeHead(400),U.end(z instanceof Error?z.message:"Invalid OAuth callback"),K(()=>G(z instanceof Error?z:Error(String(z))))}}),J.readLine!==void 0)J.readLine().then((V)=>{let U=pq0(V);if(U===null){K(()=>G(Error("OAuth callback missing authorization code")));return}try{let H=vu(U,X);K(()=>Q(H))}catch(H){K(()=>G(H instanceof Error?H:Error(String(H))))}}).catch(()=>{return});if(J.openBrowser!==void 0)J.openBrowser(Z).catch((V)=>{K(()=>G(V))})})}function pq0($){let Z=$.replaceAll("\r","").replaceAll(`
|
|
659
|
+
`,"").trim();if(Z.length===0)return null;try{let J=new URL(Z);return{code:J.searchParams.get("code"),state:J.searchParams.get("state"),iss:J.searchParams.get("iss")}}catch{return{code:Z,state:null,iss:null}}}function cq0($){let J=new URL($).searchParams.get("state"),Y=ku(J);return{state:J,issuer:Y?.issuer??null,requireIssuer:Y?.requireIssuer??!1}}function vu($,Z){if($.code===null||$.code.length===0)throw Error("OAuth callback missing authorization code");if(Z.state!==null){if($.state===null||$.state.length===0)throw Error("OAuth callback missing state");if($.state!==Z.state)throw Error("OAuth callback state mismatch")}if(Z.requireIssuer){if($.iss===null||$.iss.length===0)throw Error("OAuth callback missing issuer")}if($.iss!==null&&$.iss.length>0&&Z.issuer!==null&&$.iss!==Z.issuer)throw Error("OAuth callback issuer mismatch");return $.code}function AA($){return $.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}function iq0($){let Z=$?.title??"Connected",J=$?.body??"You can close this tab and return to your terminal.";return["<!DOCTYPE html>",`<html><head><meta charset=utf-8><title>${AA(Z)}</title></head>`,'<body style="font-family:system-ui,sans-serif;display:flex;align-items:center;justify-content:center;min-height:100vh;margin:0">','<div style="text-align:center">',`<h1>${AA(Z)}</h1>`,`<p style="color:#666">${AA(J)}</p>`,"</div></body></html>"].join("")}import xu from"crypto";function hu(){return xu.randomBytes(32).toString("base64url")}function gu($){return xu.createHash("sha256").update($).digest("base64url")}var nq0="https://poe.com/oauth/authorize",oq0="https://api.poe.com/token";function OA($){let Z=$.fetch??globalThis.fetch;return{authorize:()=>rq0($,Z)}}function sq0(){return hu()}async function rq0($,Z){let J=$.authorizationEndpoint??nq0,Y=$.tokenEndpoint??oq0,X=sq0(),Q=gu(X),G=await yu({openBrowser:$.openBrowser,readLine:$.readLine,createServer:$.createServer,landingPage:$.landingPage??{title:"Connected to Poe",body:"You can close this tab and return to your terminal."}}),W=G.redirectUri,K=aq0({endpoint:J,clientId:$.clientId,redirectUri:W,codeChallenge:Q});return{authorizationUrl:K,waitForResult:async()=>{try{let U=await G.waitForCode(K);return await tq0({tokenEndpoint:Y,code:U,codeVerifier:X,clientId:$.clientId,redirectUri:W,fetchFn:Z})}finally{G.close()}}}}function aq0($){let Z=new URL($.endpoint);return Z.searchParams.set("response_type","code"),Z.searchParams.set("client_id",$.clientId),Z.searchParams.set("scope","apikey:create"),Z.searchParams.set("code_challenge",$.codeChallenge),Z.searchParams.set("code_challenge_method","S256"),Z.searchParams.set("redirect_uri",$.redirectUri),Z.toString()}async function tq0($){let Z=new URLSearchParams({grant_type:"authorization_code",code:$.code,code_verifier:$.codeVerifier,client_id:$.clientId,redirect_uri:$.redirectUri}),J=await $.fetchFn($.tokenEndpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:Z.toString()});if(!J.ok){let X=await J.text(),Q=eq0(X);throw Error(Q??`Token exchange failed (${J.status}): ${X}`)}let Y=await J.json();if(typeof Y.api_key!=="string"||Y.api_key.length===0)throw Error("Token response missing api_key field");return{apiKey:Y.api_key,expiresIn:typeof Y.api_key_expires_in==="number"?Y.api_key_expires_in:null}}function eq0($){try{let Z=JSON.parse($);if(typeof Z.error_description==="string")return Z.error_description;if(typeof Z.error==="string")return Z.error}catch{}return null}var $j0="client_728290227fc048cc9262091a1ea197ea";function Zj0($){if($==null)return Number.MAX_SAFE_INTEGER;return Date.now()+$*1000}async function Jj0(){let Z=await OA({clientId:$j0,landingPage:{title:"Connected to Poe",body:"You can close this tab and return to OpenCode."},openBrowser:async(J)=>{await uu(J)}}).authorize();return{url:Z.authorizationUrl,instructions:"Complete authorization in your browser. This window will close automatically.",method:"auto",callback:async()=>{let J=await Z.waitForResult();return{type:"success",access:J.apiKey,refresh:J.apiKey,expires:Zj0(J.expiresIn)}}}}async function HK($){return{auth:{provider:"poe",async loader(Z){let J=await Z();if(J.type==="api")return{apiKey:J.key};if(J.type!=="oauth")return{};if(J.expires<Date.now())throw Error("Poe API key expired. Run `opencode providers login` again.");return{apiKey:J.access}},methods:[{label:"Login with Poe (browser)",type:"oauth",authorize:Jj0},{label:"Manually enter API Key",type:"api"}]}}}async function mu($){return{auth:{provider:"cloudflare-workers-ai",methods:[{type:"api",label:"API key",prompts:!process.env.CLOUDFLARE_ACCOUNT_ID?[{type:"text",key:"accountId",message:"Enter your Cloudflare Account ID",placeholder:"e.g. 1234567890abcdef1234567890abcdef"}]:[]}]}}}async function lu($){return{auth:{provider:"cloudflare-ai-gateway",methods:[{type:"api",label:"Gateway API token",prompts:[...!process.env.CLOUDFLARE_ACCOUNT_ID?[{type:"text",key:"accountId",message:"Enter your Cloudflare Account ID",placeholder:"e.g. 1234567890abcdef1234567890abcdef"}]:[],...!process.env.CLOUDFLARE_GATEWAY_ID?[{type:"text",key:"gatewayId",message:"Enter your Cloudflare AI Gateway ID",placeholder:"e.g. my-gateway"}]:[]]}]},"chat.params":async(J,Y)=>{if(J.model.providerID!=="cloudflare-ai-gateway")return;if(!J.model.api.id.toLowerCase().startsWith("openai/"))return;if(!J.model.capabilities.reasoning)return;Y.maxOutputTokens=void 0}}}import FZ from"path";import Yj0 from"fs/promises";function BK($){return FZ.join(F0.Path.data,"memory","sessions",$)}function rQ($){return FZ.join(BK($),"checkpoint.md")}function aQ($){return FZ.join(F0.Path.data,"memory","projects",$,"MEMORY.md")}function mh0(){return FZ.join(F0.Path.data,"memory","global","MEMORY.md")}async function lh0($){let Z=aQ($),J=FZ.join(FZ.dirname(Z),"memory.md");if(await Bun.file(Z).exists())return;if(await Bun.file(J).exists())await Yj0.rename(J,Z).catch((Y)=>{if(Y.code!=="ENOENT")throw Y})}function dh0($){return FZ.join(BK($),"notes.md")}function Xj0($){return FZ.join(BK($),"tasks")}function du($,Z){return FZ.join(Xj0($),Z,"progress.md")}var pu=80,Qj0=["### Execution context","### Live resources","### Session metadata"],Gj0=["### Discovered","### Dead ends"];function cu($,Z,J){let Y=[],X=$.split(`
|
|
660
|
+
`).find((K)=>K.trim().length>0)??"";if(/^# Checkpoint #\d+/.test(X))Y.push({file:Z,rule:"topic-anti-pattern-checkpoint-header",severity:"error",detail:`First line is "${X}". Replace with "Topic: <\u226480-char one-line summary>" with NO leading "#".`});let Q=$.match(/^Topic:\s*(.+?)$/m);if(!Q)Y.push({file:Z,rule:"topic-missing",severity:"error",detail:'Missing required first-line "Topic: <summary>". Add it as the first non-blank line.'});else{let K=Q[1].trim();if(K.length>pu)Y.push({file:Z,rule:"topic-too-long",severity:"warn",detail:`Topic line is ${K.length} chars (limit ${pu}). Rewrite shorter.`})}let G=J.map((K)=>({section:K,idx:$.indexOf(K)}));for(let K of G)if(K.idx===-1)Y.push({file:Z,rule:"subsection-missing",severity:"error",detail:`Missing "${K.section}" sub-section. Add the header (use "(none)" placeholder if no entries).`});let W=G.filter((K)=>K.idx!==-1);for(let K=1;K<W.length;K++)if(W[K].idx<W[K-1].idx){Y.push({file:Z,rule:"subsection-out-of-order",severity:"error",detail:`Sub-sections must appear in order: ${J.join(", ")}.`});break}return Y}function iu($,Z){return cu($,Z,Qj0)}function nu($){let Z=$.match(/^(?:Topic:.*\n+)?### discovered\s*\n([\s\S]*?)(?=\n### |$)/i);if(!Z)return[];let J=Z[1],Y=[],X=J.split(`
|
|
661
|
+
`),Q;for(let G of X){let W=G.match(/^- (.+)$/);if(W){if(Q)Y.push({title:Q.title,block:Q.lines.join(`
|
|
662
|
+
`)});Q={title:W[1].trim(),lines:[G]}}else if(Q)Q.lines.push(G)}if(Q)Y.push({title:Q.title,block:Q.lines.join(`
|
|
663
|
+
`)});return Y}function ou($){return nu($).map((Z)=>Z.title)}function su($,Z,J){let Y=cu($,Z,Gj0),X=nu($);for(let Q of X){if(J.has(Q.title))Y.push({file:Z,rule:"discovered-duplicate-title",severity:"error",detail:`Discovered title "${Q.title}" duplicates a prior checkpoint's title verbatim. Remove this entry or rephrase.`});if(!/^\s*Why:/m.test(Q.block))Y.push({file:Z,rule:"discovered-missing-why",severity:"warn",detail:`Discovered entry "${Q.title}" is missing a "Why:" line.`});if(!/^\s*How to apply:/m.test(Q.block))Y.push({file:Z,rule:"discovered-missing-how-to-apply",severity:"warn",detail:`Discovered entry "${Q.title}" is missing a "How to apply:" line.`})}return Y}function ru($,Z){let J=[];for(let Y of Z)if(!$.includes(Y.expectedText))J.push({file:"MEMORY.md",rule:"directive-not-revised",severity:"error",detail:`Directive ${Y.id} should mention "${Y.expectedText}" per a recent user instruction, but MEMORY.md does not contain that text.`});return J}function jA($,Z,J){let Y=qA.estimate($);if(Y<=Z)return[];return[{file:J,rule:"budget-exceeded",severity:"extract-required",detail:`${Y} tokens > ${Z} budget`}]}function NA($,Z,J){let Y=[],X=/^## (.+)$/gm,Q=[],G;while((G=X.exec($))!==null)Q.push({title:G[1].trim(),index:G.index});for(let W=0;W<Q.length;W++){let K=Q[W].index,V=W+1<Q.length?Q[W+1].index:$.length,U=$.slice(K,V),H=Q[W].title,B=Z[H];if(B==null)continue;let z=qA.estimate(U);if(z>B)Y.push({file:J,rule:"section-budget-exceeded",severity:"extract-required",detail:`section "${H}" is ${z} tokens (budget ${B})`})}return Y}var nh0=`# Session checkpoint
|
|
664
|
+
_Generated by checkpoint writer; structure preserved across updates. Edit only content under italic instructions._
|
|
665
|
+
|
|
666
|
+
## \xA71 Active intent
|
|
667
|
+
_User's most recent explicit request, verbatim block-quoted from the conversation. The verbatim quote is the ground truth for what to do \u2014 do not paraphrase._
|
|
668
|
+
|
|
669
|
+
(none yet)
|
|
670
|
+
|
|
671
|
+
## \xA72 Next concrete action
|
|
672
|
+
_The single next concrete step, derived from \xA71 and current state. Include verbatim quote when the user gave one._
|
|
673
|
+
|
|
674
|
+
(none yet)
|
|
675
|
+
|
|
676
|
+
## \xA73 Directives (this session)
|
|
677
|
+
_This session's specific working style. Project-level rules are in projects/<pid>/MEMORY.md \u2014 do not duplicate them here. Only put items that are session-specific._
|
|
678
|
+
|
|
679
|
+
(none)
|
|
680
|
+
|
|
681
|
+
## \xA74 Task tree
|
|
682
|
+
_Hierarchical view of tasks with current focus marked. Pulled from task tool's DB; one bullet per top-level task with status + summary. Append \` (progress: tasks/<id>/progress.md)\` so the next agent can Read the per-task journal directly. Indent sub-tasks two spaces under their parent._
|
|
683
|
+
|
|
684
|
+
(none yet)
|
|
685
|
+
|
|
686
|
+
## \xA75 Current work
|
|
687
|
+
_Description of what was being done immediately before this checkpoint. Mention specific file paths and code locations._
|
|
688
|
+
|
|
689
|
+
(none yet)
|
|
690
|
+
|
|
691
|
+
## \xA76 Files and code sections
|
|
692
|
+
_Files actively being read or modified. List with one-line purpose._
|
|
693
|
+
|
|
694
|
+
(none yet)
|
|
695
|
+
|
|
696
|
+
## \xA77 Discovered knowledge (cross-task)
|
|
697
|
+
_Facts learned during this session that may apply to future tasks. Items here are candidates for promotion to projects/<pid>/MEMORY.md if they prove durable._
|
|
698
|
+
|
|
699
|
+
(none yet)
|
|
700
|
+
|
|
701
|
+
## \xA78 Errors and fixes
|
|
702
|
+
_Errors encountered this session and how they were resolved. Newest first._
|
|
703
|
+
|
|
704
|
+
(none)
|
|
705
|
+
|
|
706
|
+
## \xA79 Live resources
|
|
707
|
+
_Runtime state: branch, uncommitted files, running processes, temp artifacts. Most volatile \u2014 don't dwell on details that change every minute._
|
|
708
|
+
|
|
709
|
+
(none yet)
|
|
710
|
+
|
|
711
|
+
## \xA710 Design decisions and discussion outcomes
|
|
712
|
+
_Decisions reached through discussion that produced no immediate code/file artifact. Captures user intent or trade-off rationale future agents need to understand "why we did it this way". Promote to MEMORY.md ## Architecture decisions when proven cross-session-durable._
|
|
713
|
+
|
|
714
|
+
(none yet)
|
|
715
|
+
|
|
716
|
+
## \xA711 Open notes
|
|
717
|
+
_Writer-curated catch-all for items that don't fit \xA71-\xA710. Quotes from conversation, unresolved questions, micro-observations, miscellaneous. Cleaner than letting orphan content pollute \xA73 or \xA77. May be empty for many checkpoints._
|
|
718
|
+
|
|
719
|
+
(none yet)
|
|
720
|
+
`,oh0=`# Project memory
|
|
721
|
+
_Durable project-level knowledge. Persists across all sessions in this project. Edit only content under italic instructions._
|
|
722
|
+
|
|
723
|
+
## Project context
|
|
724
|
+
_What is this project? What's its goal? High-level identity._
|
|
725
|
+
|
|
726
|
+
(none yet)
|
|
727
|
+
|
|
728
|
+
## Rules
|
|
729
|
+
_Hard constraints from user that every session must respect._
|
|
730
|
+
|
|
731
|
+
(none yet)
|
|
732
|
+
|
|
733
|
+
## Architecture decisions
|
|
734
|
+
_Major design choices with rationale. The "why" matters more than the "what" for future sessions._
|
|
735
|
+
|
|
736
|
+
(none yet)
|
|
737
|
+
|
|
738
|
+
## Discovered durable knowledge
|
|
739
|
+
_Cross-task facts that survive across sessions. Promoted from session checkpoints' \xA77 when proven durable._
|
|
740
|
+
|
|
741
|
+
(none yet)
|
|
742
|
+
`,au={"\xA71 Active intent":500,"\xA72 Next concrete action":1000,"\xA73 Directives (this session)":800,"\xA74 Task tree":1000,"\xA75 Current work":2000,"\xA76 Files and code sections":1500,"\xA77 Discovered knowledge (cross-task)":2000,"\xA78 Errors and fixes":1500,"\xA79 Live resources":1000,"\xA710 Design decisions and discussion outcomes":3000,"\xA711 Open notes":800},tu={"Project context":1000,Rules:2000,"Architecture decisions":3000,"Discovered durable knowledge":4000},sh0="# Session notes\n_Free-form scratchpad for the main agent. Append entries as you go; the checkpoint writer reconciles them at checkpoint events. Format each entry as `## [turn N \xB7 YYYY-MM-DDTHH:MM:SSZ]` (minute precision UTC, seconds optional) followed by free-form body. Before appending: scan existing entries \u2014 if you've already noted substantially similar content, add a short `(see entry above)` reference instead of duplicating._\n";var Q5={};F1(Q5,{merge:()=>Bj0,layer:()=>Wm,fromConfig:()=>Hj0,evaluate:()=>DA,disabled:()=>Fj0,defaultLayer:()=>Aj0,Service:()=>AK,Ruleset:()=>Xm,Rule:()=>wA,Request:()=>Z9,ReplyInput:()=>Vj0,ReplyBody:()=>Wj0,Reply:()=>LA,RejectedError:()=>j7,Permission:()=>Q5,Event:()=>tQ,DeniedError:()=>FK,CorrectedError:()=>TA,AskInput:()=>Kj0,Approval:()=>Gm,Action:()=>Ym});var eu=($,Z)=>L.addFinalizer(()=>L.gen(function*(){for(let J of $.values())yield*k6.fail(J.deferred,Z());$.clear()}));import zK from"os";function $m($,Z,...J){return c8.evaluatePermission($,Z,...J)}class q7 extends Zm()("PermissionID",O.String.annotate({[F$]:d1.schema("permission")})){static ascending($){return this.make(d1.ascending("permission",$))}static zod=d1.schema("permission")}var Jm=E0.create({service:"permission"}),Ym=O.Literals(["allow","deny","ask"]).annotate({identifier:"PermissionAction"}).pipe(u0(($)=>({zod:w0($)})));class wA extends O.Class("PermissionRule")({permission:O.String,pattern:O.String,action:Ym}){static zod=w0(this)}var Xm=O.mutable(O.Array(wA)).annotate({identifier:"PermissionRuleset"}).pipe(u0(($)=>({zod:w0($)})));class Z9 extends O.Class("PermissionRequest")({id:q7,sessionID:r0,permission:O.String,patterns:O.Array(O.String),metadata:O.Record(O.String,O.Unknown),always:O.Array(O.String),tool:O.optional(O.Struct({messageID:i1,callID:O.String}))}){static zod=w0(this)}var LA=O.Literals(["once","always","reject"]).pipe(u0(($)=>({zod:w0($)}))),Qm={reply:LA,message:O.optional(O.String)},Wj0=O.Struct(Qm).annotate({identifier:"PermissionReplyBody"}).pipe(u0(($)=>({zod:w0($)})));class Gm extends O.Class("PermissionApproval")({projectID:$9,patterns:O.Array(O.String)}){static zod=w0(this)}var tQ={Asked:L1.define("permission.asked",Z9.zod),Replied:L1.define("permission.replied",w0(O.Struct({sessionID:r0,requestID:q7,reply:LA})))};class j7 extends O.TaggedErrorClass()("PermissionRejectedError",{}){get message(){return"The user rejected permission to use this specific tool call."}}class TA extends O.TaggedErrorClass()("PermissionCorrectedError",{feedback:O.String}){get message(){return`The user rejected permission to use this specific tool call with the following feedback: ${this.feedback}`}}class FK extends O.TaggedErrorClass()("PermissionDeniedError",{ruleset:O.Any}){get message(){return`The user has specified a rule which prevents you from using this specific tool call. Here are some of the relevant rules ${JSON.stringify(this.ruleset)}`}}var Kj0=O.Struct({...Z9.fields,id:O.optional(q7),ruleset:Xm,interactive:O.optional(O.Boolean)}).annotate({identifier:"PermissionAskInput"}).pipe(u0(($)=>({zod:w0($)}))),Vj0=O.Struct({requestID:q7,...Qm}).annotate({identifier:"PermissionReplyInput"}).pipe(u0(($)=>({zod:w0($)})));function DA($,Z,...J){return $m($,Z,...J)}class AK extends S1.Service()("@qitqode/Permission"){}var Wm=T0.effect(AK,L.gen(function*(){let $=yield*l1.Service,Z=yield*B0.make(L.fn("Permission.state")(function*(Q){let G=W1.use((K)=>K.select().from(MA).where(m0(MA.project_id,Q.project.id)).get()),W={pending:new Map,approved:G?.data??[]};return yield*eu(W.pending,()=>new j7),W})),J=L.fn("Permission.ask")(function*(Q,G){let{approved:W,pending:K}=yield*B0.get(Z),{ruleset:V,...U}=Q,H=!1;for(let N of U.patterns){let w=DA(U.permission,N,V,W);if(Jm.info("evaluated",{permission:U.permission,pattern:N,action:w}),w.action==="deny")return yield*new FK({ruleset:V.filter((q)=>eQ.match(U.permission,q.permission))});if(w.action==="allow")continue;H=!0}if(H&&Q.interactive===!1)return yield*new FK({ruleset:V.filter((N)=>eQ.match(U.permission,N.permission))});if(!H)return;let B=U.id??q7.ascending(),z=O.decodeUnknownSync(Z9)({id:B,...U});Jm.info("asking",{id:B,permission:z.permission,patterns:z.patterns});let F=yield*k6.make();K.set(B,{info:z,deferred:F}),yield*$.publish(tQ.Asked,z);let A=k6.await(F),j=G?L.race(A,L.callback((N)=>{let w=()=>{L.runPromise(k6.fail(F,new j7)).catch((q)=>{console.error("permission: failed to fail deferred after abort",q)}),N(L.fail(new j7))};if(G.aborted){w();return}return G.addEventListener("abort",w,{once:!0}),L.sync(()=>{G.removeEventListener("abort",w)})})):A;return yield*L.ensuring(j,L.sync(()=>{K.delete(B)}))}),Y=L.fn("Permission.reply")(function*(Q){let{approved:G,pending:W}=yield*B0.get(Z),K=W.get(Q.requestID);if(!K)return;if(W.delete(Q.requestID),yield*$.publish(tQ.Replied,{sessionID:K.info.sessionID,requestID:K.info.id,reply:Q.reply}),Q.reply==="reject"){yield*k6.fail(K.deferred,Q.message?new TA({feedback:Q.message}):new j7);for(let[V,U]of W.entries()){if(U.info.sessionID!==K.info.sessionID)continue;W.delete(V),yield*$.publish(tQ.Replied,{sessionID:U.info.sessionID,requestID:U.info.id,reply:"reject"}),yield*k6.fail(U.deferred,new j7)}return}if(yield*k6.succeed(K.deferred,void 0),Q.reply==="once")return;for(let V of K.info.always)G.push({permission:K.info.permission,pattern:V,action:"allow"});for(let[V,U]of W.entries()){if(U.info.sessionID!==K.info.sessionID)continue;if(!U.info.patterns.every((B)=>DA(U.info.permission,B,G).action==="allow"))continue;W.delete(V),yield*$.publish(tQ.Replied,{sessionID:U.info.sessionID,requestID:U.info.id,reply:"always"}),yield*k6.succeed(U.deferred,void 0)}}),X=L.fn("Permission.list")(function*(){let Q=(yield*B0.get(Z)).pending;return Array.from(Q.values(),(G)=>G.info)});return AK.of({ask:J,reply:Y,list:X})}));function Uj0($){if($.startsWith("~/"))return zK.homedir()+$.slice(1);if($==="~")return zK.homedir();if($.startsWith("$HOME/"))return zK.homedir()+$.slice(5);if($.startsWith("$HOME"))return zK.homedir()+$.slice(5);return $}function Hj0($){let Z=[];for(let[J,Y]of Object.entries($)){if(typeof Y==="string"){Z.push({permission:J,action:Y,pattern:"*"});continue}Z.push(...Object.entries(Y).map(([X,Q])=>({permission:J,pattern:Uj0(X),action:Q})))}return Z}function Bj0(...$){return $.flat()}var zj0=["edit","write","apply_patch","multiedit"];function Fj0($,Z){let J=new Set;for(let Y of $){let X=Z.findLast((Q)=>eQ.match(Y,Q.permission)||zj0.includes(Y)&&eQ.match("edit",Q.permission));if(!X)continue;if(X.pattern==="*"&&X.action==="deny")J.add(Y)}return J}var Aj0=Wm.pipe(T0.provide(l1.layer));var Km=P.enum(["interactive-build","read-only-plan","workflow-compose","parallel-max","read-only-explore","subagent","system","custom-primary","custom"]),Rg0=P.enum(["coding","agent","research","review","chat"]),Pg0=P.string().min(1).refine(($)=>$.includes("/"),{message:"Qortex directives must be prompt-registry keys in <scope>/<name> form"});function Oj0($){let Z=$.mode==="primary",J=$.mode==="subagent",Y=$.permission===void 0||Q5.evaluate("edit","*",$.permission).action==="deny";switch($.name){case"build":return Z?"interactive-build":J?"subagent":"custom";case"plan":return Z&&Y?"read-only-plan":Z?"custom-primary":"subagent";case"compose":return Z?"workflow-compose":J?"subagent":"custom";case"max":return Z?"parallel-max":J?"subagent":"custom";case"explore":return J&&Y?"read-only-explore":J?"subagent":"custom-primary";case"general":return J?"subagent":Z?"custom-primary":"custom";case"title":case"summary":case"compaction":case"checkpoint-writer":case"dream":case"distill":return $.hidden===!0&&J?"system":J?"subagent":"custom-primary";default:return J?"subagent":Z?"custom-primary":"custom"}}function qj0($){switch(Oj0($)){case"interactive-build":return"coding";case"read-only-plan":return"review";case"workflow-compose":case"parallel-max":case"subagent":return"agent";case"read-only-explore":return"research";case"system":case"custom-primary":case"custom":return}}var jj0=new Set(["bash","shell","edit","write","apply_patch","multiedit","change_directory","actor","task"]);function Ig0($,Z){let J=qj0($);if(!J)return;let Y=(J==="coding"||J==="agent"||J==="research")&&Z.some((X)=>jj0.has(X));return{posture:J,...Y?{directive:"discipline/operational-directives"}:{}}}var Nj0=P.enum(["mode","checkpoint","goal","task-gate","recovery","never-ask","memory","tool-result"]),Mj0=P.enum(["local-policy","session-state","runtime-safety","model-guidance"]),Dj0=P.enum(["system-reminder","plain"]),wj0={mode:100,checkpoint:90,goal:80,"task-gate":80,recovery:70,"never-ask":60,memory:40,"tool-result":40},Lj0=P.object({source:Nj0,trust:Mj0,priority:P.number().int(),posture:Km.optional(),envelope:Dj0.default("system-reminder"),body:P.string().min(1)});function Tj0($){return Lj0.parse({...$,priority:$.priority??wj0[$.source]})}function Vm($){let Z=Tj0($);if(Z.envelope==="plain")return Z.body;return["<system-reminder>",Z.body,"</system-reminder>"].join(`
|
|
743
|
+
`)}async function xg0($){let Z=await Bun.file(rQ($)).text().catch(()=>"");if(!Z)return new Set;return new Set(ou(Z))}async function Um($,Z){let J=await Bun.file(rQ($)).text().catch(()=>""),Y=await Bun.file(aQ(Z.projectID)).text().catch(()=>""),X=[];if(J)X.push(...iu(J,"checkpoint.md")),X.push(...su(J,"checkpoint.md",Z.priorTitles));else X.push({file:"checkpoint.md",rule:"topic-missing",severity:"error",detail:"checkpoint file did not exist after writer finished"});if(Y&&Z.expectedRevisions.length>0)X.push(...ru(Y,Z.expectedRevisions));let Q=Z.budgets??{checkpoint:11000,memory:1e4,progress_per_task:6000};if(J)X.push(...jA(J,Q.checkpoint,"checkpoint.md"));if(Y)X.push(...jA(Y,Q.memory,"MEMORY.md"));if(J)X.push(...NA(J,au,"checkpoint.md"));if(Y)X.push(...NA(Y,tu,"MEMORY.md"));return X}function Hm($,Z){let J=new Map;for(let X of $){let Q=J.get(X.file)??[];Q.push(`- ${X.detail}`),J.set(X.file,Q)}let Y=[...J.entries()].map(([X,Q])=>`${X}:
|
|
744
|
+
${Q.join(`
|
|
745
|
+
`)}`);return Vm({source:"checkpoint",trust:"runtime-safety",posture:"system",body:["The previous attempt at this checkpoint had validation errors. Read your output at the absolute paths below, fix ONLY the issues listed, and write again. Other content may stay the same.","",Y.join(`
|
|
746
|
+
|
|
747
|
+
`),"",`CHECKPOINT_PATH = ${Z.checkpoint}`,`MEMORY_PATH = ${Z.memory}`].join(`
|
|
748
|
+
`)})}function Bm($){return`EXTRACTION REQUIRED: The following files exceed their token budget: ${$.filter((Y)=>Y.severity==="extract-required").map((Y)=>`${Y.file} (${Y.detail})`).join(", ")}.
|
|
749
|
+
|
|
750
|
+
Extract the LESS-IMPORTANT topic cluster from the over-budget file into a new spillover file:
|
|
751
|
+
- Checkpoint spillover: checkpoint-<topic>.md (sibling of checkpoint.md)
|
|
752
|
+
- Memory spillover: MEMORY-<topic>.md (sibling of MEMORY.md)
|
|
753
|
+
|
|
754
|
+
Selection criteria for "less important" (extract THESE first):
|
|
755
|
+
- Already-stable decisions unlikely to be revisited
|
|
756
|
+
- Dead ends before Discovered entries
|
|
757
|
+
- Historical / completed steps before recent / in-progress
|
|
758
|
+
- Topics not directly relevant to the current focus task
|
|
759
|
+
|
|
760
|
+
After extraction, edit the main file to:
|
|
761
|
+
- REMOVE the extracted lines
|
|
762
|
+
- INSERT an index line near the bottom:
|
|
763
|
+
"- See <spillover-filename>.md (N entries) \u2014 short summary"
|
|
764
|
+
|
|
765
|
+
Re-validation will run after this single extraction.`}var RA=new Map;function PA($,Z){return`${$}:${Z}`}function gg0($,Z,J){RA.set(PA($,Z),J)}function zm($,Z){let J=RA.get(PA($,Z));if(!J)return;return structuredClone(J)}function ug0($,Z){RA.delete(PA($,Z))}var Pj0=E0.create({service:"plugin.checkpoint-splitover"}),Ij0={priorTitles:new Set,expectedRevisions:[]};async function Fm($){let Z=$.project.id;return{"actor.preStop":{matcher:{agentType:{include:["checkpoint-writer"]}},run:async(J,Y)=>{let X=J.parentSessionID??J.sessionID,Q=zm(X,J.actorID)??Ij0;try{let G=await Um(X,{priorTitles:Q.priorTitles,expectedRevisions:Q.expectedRevisions,projectID:Z});if(G.length===0)return;let W=G.filter((V)=>V.severity==="extract-required");if(W.length>0){Y.continue=!0,Y.reason=Bm(W);return}let K=G.filter((V)=>V.severity==="error");if(K.length>0){Y.continue=!0,Y.reason=Hm(K,{checkpoint:rQ(X),memory:aQ(Z)});return}}catch(G){Pj0.error("checkpoint-splitover hook failed",{err:G,sessionID:X,actorID:J.actorID})}}}}}import Cj0 from"fs/promises";import Ej0 from"path";var bj0=E0.create({service:"plugin.subagent-progress-checker"}),_j0=["## \xA71 Task identity","## \xA72 Subagent intent","## \xA73 Files and code sections","## \xA74 Verbatim commands","## \xA75 Outcome and discoveries"],Am=`## \xA71 Task identity
|
|
766
|
+
- task_id: <TID>
|
|
767
|
+
- short summary: <one line>
|
|
768
|
+
|
|
769
|
+
## \xA72 Subagent intent
|
|
770
|
+
What this subagent was asked to do (one paragraph).
|
|
771
|
+
|
|
772
|
+
## \xA73 Files and code sections
|
|
773
|
+
- path/to/file.ext: <what you did with it>
|
|
774
|
+
|
|
775
|
+
## \xA74 Verbatim commands
|
|
776
|
+
Exact commands you ran or commands the user/task asked to be runnable later. Keep BACKTICK-FENCED for grep-ability.
|
|
777
|
+
\`\`\`
|
|
778
|
+
<command>
|
|
779
|
+
\`\`\`
|
|
780
|
+
|
|
781
|
+
## \xA75 Outcome and discoveries
|
|
782
|
+
- Outcome (success/partial/failed): <reason>
|
|
783
|
+
- Discoveries that may matter for other tasks: <bullets>
|
|
784
|
+
`;function Om($){if($.kind==="missing")return["Before terminating, write the task progress journal to:",` ${$.filePath}`,"","Required structure (5 sections, headings exact):","",Am.replace("<TID>",$.taskId),"","Write the file now using the Write tool, then terminate normally."].join(`
|
|
785
|
+
`);return[`tasks/${$.taskId}/progress.md exists but is missing required sections:`,...($.missing??[]).map((Z)=>` - ${Z}`),"","Add the missing sections. For reference, the full required template is:","",Am.replace("<TID>",$.taskId),"","Re-write the file using Write tool, then terminate normally."].join(`
|
|
786
|
+
`)}async function Sj0($,Z){let Y=`---
|
|
787
|
+
written-at: ${Date.now()}
|
|
788
|
+
---
|
|
789
|
+
`,X=Z.match(/^---\n[\s\S]*?\n---\n/),Q=X?Y+Z.slice(X[0].length):Y+Z;await Bun.write($,Q)}async function qm($){return{"actor.postStop":{matcher:{agentType:{excludeOnly:["checkpoint-writer","title","summary","dream","distill","compaction","main"]}},run:async(Z,J)=>{let Y=Z.task_id;if(!Y)return;if(Z.canWrite===!1)return;let X=Z.sessionID,Q=du(X,Y),G;try{G=await Bun.file(Q).text()}catch{G=void 0}if(G===void 0){J.continue=!0,J.reason=Om({kind:"missing",taskId:Y,filePath:Q});return}let W=_j0.filter((K)=>!G.includes(K));if(W.length>0){J.continue=!0,J.reason=Om({kind:"incomplete",taskId:Y,filePath:Q,missing:W});return}try{await Cj0.mkdir(Ej0.dirname(Q),{recursive:!0}),await Sj0(Q,G)}catch(K){bj0.error("frontmatter injection failed",{err:K,filePath:Q})}}}}}var IA;((eg0)=>{function $(Q){let G=r8.pluginSpecifier(Q);return{spec:G,options:r8.pluginOptions(Q),deprecated:jm(G)}}async function Z(Q,G){let W="";try{W=await Dm(Q.spec)}catch(V){return{ok:!1,stage:"install",error:V}}if(!W)return{ok:!1,stage:"install",error:Error(`Plugin ${Q.spec} target is empty`)};let K;try{K=await wm(Q.spec,W,G)}catch(V){return{ok:!1,stage:"entry",error:V}}if(!K.entry)return{ok:!1,stage:"missing",value:{...Q,source:K.source,target:K.target,pkg:K.pkg,message:`Plugin ${Q.spec} does not expose a ${G} entrypoint`}};if(K.source==="npm")try{await Mm(K.target,E$,K.pkg)}catch(V){return{ok:!1,stage:"compatibility",error:V}}return{ok:!0,value:{...Q,source:K.source,target:K.target,entry:K.entry,pkg:K.pkg}}}eg0.resolve=Z;async function J(Q){let G;try{G=await import(Q.entry)}catch(W){return{ok:!1,error:W}}if(!G)return{ok:!1,error:Error(`Plugin ${Q.spec} module is empty`)};return{ok:!0,value:{...Q,mod:G}}}eg0.load=J;async function Y(Q,G,W,K,V,U){let H=Q.plan;if(H.deprecated)return;U?.start?.(Q,W);let B=await Z(H,G);if(!B.ok){if(B.stage==="missing"){if(V){let F=await V(B.value,Q.origin,W);if(F!==void 0)return F}U?.missing?.(Q,W,B.value.message,B.value);return}U?.error?.(Q,W,B.stage,B.error);return}let z=await J(B.value);if(!z.ok){U?.error?.(Q,W,"load",z.error,B.value);return}if(!K)return z.value;return K(z.value,Q.origin,W)}async function X(Q){let G=Q.items.map((U)=>({origin:U,plan:$(U.spec)})),W=[];for(let U of G)W.push(Y(U,Q.kind,!1,Q.finish,Q.missing,Q.report));let K=await Promise.all(W);if(Q.wait){let U;for(let H=0;H<G.length;H++){if(K[H]!==void 0)continue;let B=G[H];if(!B||Nm(B.plan.spec)!=="file")continue;U??=Q.wait(),await U,K[H]=await Y(B,Q.kind,!0,Q.finish,Q.missing,Q.report)}}let V=[];for(let U of K)if(U!==void 0)V.push(U);return V}eg0.loadExternal=X})(IA||={});var Tm={worktree:Lm(async()=>(await import("./chunk-r0ewmh6f.js")).WorktreeAdaptor)},OK=new Map;async function Ju0($,Z){let J=OK.get($)?.get(Z);if(J)return J;let Y=Tm[Z];if(Y)return Y();throw Error(`Unknown workspace adaptor: ${Z}`)}async function Yu0($){let Z=await Promise.all(Object.entries(Tm).map(async([Y,X])=>{let Q=await X();return{type:Y,name:Q.name,description:Q.description}})),J=[...OK.get($)?.entries()??[]].map(([Y,X])=>({type:Y,name:X.name,description:X.description}));return[...Z,...J]}function Rm($,Z,J){let Y=OK.get($)??new Map;Y.set(Z,J),OK.set($,Y)}import fj0 from"fs/promises";import J9 from"path";import{pathToFileURL as Pm,fileURLToPath as kj0}from"url";var z$=E0.create({service:"plugin"}),EA={Executed:L1.define("hook.executed",D.object({event:D.enum(["actor.preStop","actor.postStop"]),hookID:D.string(),pluginName:D.string(),actorID:D.string(),agentType:D.string(),durationMs:D.number(),outcome:D.enum(["success","error","skipped"]),continueRequested:D.boolean(),reasonLength:D.number()})),ReActReentered:L1.define("hook.react.reentered",D.object({phase:D.enum(["pre","post"]),actorID:D.string(),agentType:D.string(),iteration:D.number(),triggeredByPlugins:D.array(D.string()),reasonPreview:D.string()})),ReActMaxReached:L1.define("hook.react.max_reached",D.object({phase:D.enum(["pre","post"]),actorID:D.string(),agentType:D.string()}))};class qK extends S1.Service()("@qitqode/Plugin"){}var vj0=[p2,c2,d2,a2,fu,HK,mu,lu,Fm,qm];function Im($){return typeof $==="function"}function yj0($){if(Im($))return $;if(!$||typeof $!=="object"||!("server"in $))return;if(!Im($.server))return;return $.server}function xj0($){let Z=new Set,J=[];for(let Y of Object.values($)){if(Z.has(Y))continue;Z.add(Y);let X=yj0(Y);if(!X)throw TypeError("Plugin export is not a function");J.push(X)}return J}async function hj0($,Z,J,Y){let X=Em($.mod,$.spec,"server","detect");if(X){await bm($.source,$.spec,$.target,CA(X.id,$.spec),$.pkg);let Q=CA(X.id,$.spec)??$.pkg?.pkg??$.spec,G=await X.server(Z,$.options);J.push(G),Y.push({hook:G,pluginName:Q,hookIDFor:(W)=>`${Q}#${W}`});return}for(let Q of xj0($.mod)){let G=Q.name,W=G&&G!=="default"&&G!==""?G:$.pkg?.pkg??$.spec,K=await Q(Z,$.options);J.push(K),Y.push({hook:K,pluginName:W,hookIDFor:(V)=>`${W}#${V}`})}}var _m=T0.effect(qK,L.gen(function*(){let $=yield*l1.Service,Z=yield*X8.Service,J=yield*B0.make(L.fn("Plugin.state")(function*(F){let A=[],j=[],N=yield*T7.make();function w(f){N.fork($.publish(Y9.Event.Error,{error:new j1.Unknown({message:f}).toObject()}))}let{Server:q}=yield*L.promise(()=>import("./chunk-et7kz7kx.js")),M=LH({baseUrl:"http://localhost:4096",directory:F.directory,headers:b0.QITQODE_SERVER_PASSWORD?{Authorization:`Basic ${Buffer.from(`${b0.QITQODE_SERVER_USERNAME??"qitqode"}:${b0.QITQODE_SERVER_PASSWORD}`).toString("base64")}`}:void 0,fetch:async(...f)=>(await q.Default()).app.fetch(...f)}),C=yield*Z.get(),R={client:M,project:F.project,worktree:F.worktree,directory:F.directory,experimental_workspace:{register(f,b){Rm(F.project.id,f,b)}},get serverUrl(){return q.url??new URL("http://localhost:4096")},$:typeof Bun>"u"?void 0:Bun.$};for(let f of vj0){z$.info("loading internal plugin",{name:f.name});let b=yield*L.tryPromise({try:()=>f(R),catch:(y)=>{z$.error("failed to load internal plugin",{name:f.name,error:y})}}).pipe(L.option);if(b._tag==="Some")A.push(b.value),j.push({hook:b.value,pluginName:f.name,hookIDFor:(y)=>`${f.name}#${y}`})}let T={},I=yield*L.tryPromise(()=>import("./chunk-fr75ytdr.js")).pipe(L.option);if(I._tag==="Some")Object.assign(T,I.value.modules??{});else{let f=J9.join(J9.dirname(kj0(import.meta.url)),"..","ext"),y=(yield*L.promise(()=>fj0.readdir(f).catch(()=>[]))).filter((k)=>k.endsWith(".ts")&&!k.endsWith(".d.ts")&&k!=="_manifest.ts");for(let k of y){let g=yield*L.tryPromise({try:()=>import(Pm(J9.join(f,k)).href),catch:(d)=>z$.error("failed to import extension",{name:k,error:d})}).pipe(L.option);if(g._tag==="Some")T[k.replace(/\.ts$/,"")]=g.value}}for(let[f,b]of Object.entries(T)){let y=Object.entries(b).find(([g,d])=>typeof d==="function"&&g.endsWith("Plugin"))?.[1];if(!y)continue;z$.info("loading extension",{name:f});let k=yield*L.tryPromise({try:()=>y(R),catch:(g)=>z$.error("failed to load extension",{name:f,error:g})}).pipe(L.option);if(k._tag==="Some")A.push(k.value),j.push({hook:k.value,pluginName:f,hookIDFor:(g)=>`${f}#${g}`})}let _=b0.QITQODE_PURE?[]:C.plugin_origins??[];if(b0.QITQODE_PURE&&C.plugin_origins?.length)z$.info("skipping external plugins in pure mode",{count:C.plugin_origins.length});if(_.length)yield*Z.waitForDependencies();let E=yield*L.promise(()=>IA.loadExternal({items:_,kind:"server",report:{start(f){z$.info("loading plugin",{path:f.plan.spec})},missing(f,b,y){z$.warn("plugin has no server entrypoint",{path:f.plan.spec,message:y})},error(f,b,y,k,g){let d=f.plan.spec,p=k instanceof Error?k.cause??k:k,t=y==="load"?U6(k):U6(p);if(y==="install"){let r=Cm(d);z$.error("failed to install plugin",{pkg:r.pkg,version:r.version,error:t}),w(`Failed to install plugin ${r.pkg}@${r.version}: ${t}`);return}if(y==="compatibility"){z$.warn("plugin incompatible",{path:d,error:t}),w(`Plugin ${d} skipped: ${t}`);return}if(y==="entry"){z$.error("failed to resolve plugin server entry",{path:d,error:t}),w(`Failed to load plugin ${d}: ${t}`);return}z$.error("failed to load plugin",{path:d,target:g?.entry,error:t}),w(`Failed to load plugin ${d}: ${t}`)}}}));for(let f of E){if(!f)continue;yield*L.tryPromise({try:()=>hj0(f,R,A,j),catch:(b)=>{let y=U6(b);return z$.error("failed to load plugin",{path:f.spec,error:y}),y}}).pipe(L.catch(()=>{return L.void}))}for(let f of A)yield*L.tryPromise({try:()=>Promise.resolve(f.config?.(C)),catch:(b)=>{z$.error("plugin config hook failed",{error:b})}}).pipe(L.ignore);return yield*$.subscribeAll().pipe(P$.runForEach((f)=>L.sync(()=>{for(let b of A)b.event?.({event:f})})),L.forkScoped),{hooks:A,hooksWithMeta:j}})),Y=yield*B0.make(L.fn("Plugin.fileHooks")(function*(){let F=[],A=[],j=yield*Z.get(),N=yield*Z.directories();for(let w of N){let q=$4.scanSync("{hook,hooks}/*.{js,ts}",{cwd:w,absolute:!0,dot:!0,symlink:!0});for(let M of q){let C=yield*L.tryPromise({try:()=>import(`${Pm(M).href}?v=${Date.now()}`),catch:(T)=>T}).pipe(L.catch((T)=>{return z$.error("failed to load file hook",{path:M,error:U6(T)}),L.succeed(void 0)}));if(!C)continue;let R=C.default??C;if(R&&typeof R==="object"){let T=J9.basename(M,J9.extname(M));F.push(R),A.push({hook:R,pluginName:`file:${T}`,hookIDFor:(I)=>`file:${T}#${I}`}),z$.info("loaded file hook",{path:M,name:T})}}}return{hooks:F,meta:A}})),X=(F,A)=>L.gen(function*(){let j=yield*B0.get(J),N=yield*B0.get(Y),w=[],q=[],M=[],C=!1;for(let T of[...j.hooksWithMeta,...N.meta]){let I=T.hook[A];if(!I)continue;let _=typeof I==="function"?I:I.run,E=typeof I==="function"?void 0:I.matcher;if(!V2(E,F)){yield*$.publish(EA.Executed,{event:A,hookID:T.hookIDFor(A),pluginName:T.pluginName,actorID:F.actorID,agentType:F.agentType,durationMs:0,outcome:"skipped",continueRequested:!1,reasonLength:0});continue}let f=Date.now(),b={continue:!1},y="success";yield*L.tryPromise({try:()=>_(F,b),catch:(g)=>g}).pipe(L.tapError((g)=>L.gen(function*(){y="error",z$.error(`${A} hook failed`,{pluginName:T.pluginName,hookID:T.hookIDFor(A),error:g}),yield*$.publish(Y9.Event.Error,{sessionID:F.sessionID,error:new j1.Unknown({message:`${A} hook (${T.pluginName}) failed: ${U6(g)}`}).toObject()})})),L.ignore);let k=Date.now()-f;if(yield*$.publish(EA.Executed,{event:A,hookID:T.hookIDFor(A),pluginName:T.pluginName,actorID:F.actorID,agentType:F.agentType,durationMs:k,outcome:y,continueRequested:b.continue===!0,reasonLength:b.reason?.length??0}),b.continue===!0&&b.reason&&b.reason.length>0)C=!0,w.push(b.reason),q.push(T.pluginName),M.push(T.hookIDFor(A));else if(b.continue===!0)z$.warn(`${A} hook returned continue=true without reason; ignored`,{pluginName:T.pluginName})}return{continue:C,reason:w.length>0?w.join(`
|
|
790
|
+
|
|
791
|
+
`):void 0,contributingPluginNames:q,contributingHookIDs:M}}),Q=L.fn("Plugin.triggerActorPreStop")(function*(F){return yield*X(F,"actor.preStop")}),G=L.fn("Plugin.triggerActorPostStop")(function*(F){return yield*X(F,"actor.postStop")}),W=5000,K=3,V=new Map,U=L.fn("Plugin.trigger")(function*(F,A,j){if(!F)return j;let N=yield*B0.get(J),w=yield*B0.get(Y);for(let q of N.hooksWithMeta){let M=q.hook[F];if(!M)continue;yield*L.promise(async()=>M(A,j))}for(let q of w.meta){let M=q.hook[F];if(!M)continue;let C=q.hookIDFor(F);if((V.get(C)??0)>=3){z$.warn("hook circuit-breaker open, skipping",{hook:C});continue}let R=structuredClone(j);if(!(yield*L.tryPromise({try:async()=>{await Promise.race([Promise.resolve(M(A,j)),new Promise((I,_)=>setTimeout(()=>_(Error("hook timed out after 5000ms")),5000))])},catch:(I)=>I}).pipe(L.map(()=>!1),L.catch((I)=>{Object.assign(j,R);let _=(V.get(C)??0)+1;return V.set(C,_),z$.error("file hook failed, output rolled back",{hook:C,event:F,error:U6(I),consecutiveFailures:_,circuitOpen:_>=3}),L.succeed(!0)}))))V.delete(C)}return j}),H=L.fn("Plugin.list")(function*(){return(yield*B0.get(J)).hooks}),B=L.fn("Plugin.init")(function*(){yield*B0.get(J),yield*B0.get(Y)}),z=L.fn("Plugin.reloadFileHooks")(function*(){yield*B0.invalidate(Y)});return qK.of({trigger:U,list:H,init:B,reloadFileHooks:z,triggerActorPreStop:Q,triggerActorPostStop:G})})),gj0=_m.pipe(T0.provide(l1.layer),T0.provide(X8.defaultLayer));import KN0 from"path";var RK=m6(fm(),1);var X9={};F1(X9,{variants:()=>G5,topP:()=>rm,topK:()=>am,temperature:()=>sm,smallOptions:()=>em,schema:()=>Yl,providerOptions:()=>$l,options:()=>tm,message:()=>xm,maxOutputTokens:()=>Zl,OUTPUT_TOKEN_MAX:()=>MK});var vm=32000;function uj0($){if($.startsWith("image/"))return"image";if($.startsWith("audio/"))return"audio";if($.startsWith("video/"))return"video";if($==="application/pdf")return"pdf";return}function mj0($){let Z=$.id.toLowerCase(),J=$.api.id.toLowerCase();if(Z.includes("claude")||J.includes("claude")||$.providerID==="anthropic")return!0;if(Z.includes("gpt")||J.includes("gpt"))return!0;return $.capabilities.input.image}function NK($){switch($){case"@ai-sdk/github-copilot":return"copilot";case"@ai-sdk/azure":return"azure";case"@ai-sdk/openai":return"openai";case"@ai-sdk/amazon-bedrock":return"bedrock";case"@ai-sdk/anthropic":case"@ai-sdk/google-vertex/anthropic":return"anthropic";case"@ai-sdk/google-vertex":return"vertex";case"@ai-sdk/google":return"google";case"@ai-sdk/gateway":return"gateway";case"@openrouter/ai-sdk-provider":return"openrouter"}return}function lj0($,Z,J){if(Z.api.npm==="@ai-sdk/anthropic"||Z.api.npm==="@ai-sdk/amazon-bedrock")$=$.map((Y)=>{if(typeof Y.content==="string"){if(Y.content==="")return;return Y}if(!Array.isArray(Y.content))return Y;let X=Y.content.filter((Q)=>{if(Q.type==="text"||Q.type==="reasoning")return Q.text!=="";return!0});if(X.length===0)return;return{...Y,content:X}}).filter((Y)=>Y!==void 0&&Y.content!=="");if(Z.api.id.includes("claude")){let Y=(X)=>X.replace(/[^a-zA-Z0-9_-]/g,"_");$=$.map((X)=>{if(X.role==="assistant"&&Array.isArray(X.content))return{...X,content:X.content.map((Q)=>{if(Q.type==="tool-call"||Q.type==="tool-result")return{...Q,toolCallId:Y(Q.toolCallId)};return Q})};if(X.role==="tool"&&Array.isArray(X.content))return{...X,content:X.content.map((Q)=>{if(Q.type==="tool-result")return{...Q,toolCallId:Y(Q.toolCallId)};return Q})};return X})}if(["@ai-sdk/anthropic","@ai-sdk/google-vertex/anthropic"].includes(Z.api.npm))$=$.flatMap((Y)=>{if(Y.role!=="assistant"||!Array.isArray(Y.content))return[Y];let X=Y.content,Q=X.findIndex((G)=>G.type==="tool-call");if(Q===-1)return[Y];if(!X.slice(Q).some((G)=>G.type!=="tool-call"))return[Y];return[{...Y,content:X.filter((G)=>G.type!=="tool-call")},{...Y,content:X.filter((G)=>G.type==="tool-call")}]});if(Z.providerID==="mistral"||Z.api.id.toLowerCase().includes("mistral")||Z.api.id.toLowerCase().includes("devstral")){let Y=(Q)=>{return Q.replace(/[^a-zA-Z0-9]/g,"").substring(0,9).padEnd(9,"0")},X=[];for(let Q=0;Q<$.length;Q++){let G=$[Q],W=$[Q+1];if(G.role==="assistant"&&Array.isArray(G.content))X.push({...G,content:G.content.map((K)=>{if(K.type==="tool-call"||K.type==="tool-result")return{...K,toolCallId:Y(K.toolCallId)};return K})});else if(G.role==="tool"&&Array.isArray(G.content))X.push({...G,content:G.content.map((K)=>{if(K.type==="tool-result")return{...K,toolCallId:Y(K.toolCallId)};return K})});else X.push(G);if(G.role==="tool"&&W?.role==="user")X.push({role:"assistant",content:[{type:"text",text:"Done."}]})}return X}if(typeof Z.capabilities.interleaved==="object"&&Z.capabilities.interleaved.field){let Y=Z.capabilities.interleaved.field;return $.map((X)=>{if(X.role==="assistant"&&Array.isArray(X.content)){let G=X.content.filter((K)=>K.type==="reasoning").map((K)=>K.text).join(""),W=X.content.filter((K)=>K.type!=="reasoning");if(G)return{...X,content:W,providerOptions:{...X.providerOptions,openaiCompatible:{...X.providerOptions?.openaiCompatible,[Y]:G}}};return{...X,content:W}}return X})}return $}function dj0($){if($.api.npm==="@ai-sdk/anthropic"||$.api.npm==="@ai-sdk/google-vertex/anthropic")return!0;if($.providerID==="anthropic"||$.providerID==="google-vertex-anthropic")return!0;if($.api.npm==="@ai-sdk/amazon-bedrock")return!0;if($.api.npm==="@openrouter/ai-sdk-provider"||$.api.npm==="@ai-sdk/github-copilot"||$.api.npm==="@ai-sdk/alibaba")return $.api.id.includes("claude")||$.api.id.includes("anthropic")||$.id.includes("claude")||$.id.includes("anthropic");return!1}function pj0($,Z){let J=Z.cachePromptTTL==="1h"?{ttl:"1h"}:{},Y={anthropic:{cacheControl:{type:"ephemeral",...J}},openrouter:{cacheControl:{type:"ephemeral",...J}},bedrock:{cachePoint:{type:"default"}},openaiCompatible:{cache_control:{type:"ephemeral"}},copilot:{copilot_cache_control:{type:"ephemeral"}},alibaba:{cacheControl:{type:"ephemeral"}}},X=[],Q=$.filter((K)=>K.role==="system");if(Q.length>0)X.push(Q[Q.length-1]);let G=$.filter((K)=>K.role!=="system"),W=G.findLastIndex((K)=>K.role==="user");if(W>=1){X.push(G[W-1]);let K=Math.floor(W/2);if(K>0&&K<W-1)X.push(G[K])}else if(W===0)X.push(G[0]);for(let K of km(X)){if(!(Z.providerID==="anthropic"||Z.providerID.includes("bedrock")||Z.api.npm==="@ai-sdk/amazon-bedrock")&&Array.isArray(K.content)&&K.content.length>0){let H=K.content[K.content.length-1];if(H&&typeof H==="object"&&H.type!=="tool-approval-request"&&H.type!=="tool-approval-response"){H.providerOptions=N1(H.providerOptions??{},Y);continue}}K.providerOptions=N1(K.providerOptions??{},Y)}return $}function cj0($,Z){return $.map((J)=>{if(J.role!=="user"||!Array.isArray(J.content))return J;let Y=J.content.map((X)=>{if(X.type!=="file"&&X.type!=="image")return X;if(X.type==="image"){let U=String(X.image);if(U.startsWith("data:")){let H=U.match(/^data:([^;]+);base64,(.*)$/);if(H&&(!H[2]||H[2].length===0))return{type:"text",text:"ERROR: Image file is empty or corrupted. Please provide a valid image."}}}let Q=X.type==="image"?String(X.image).split(";")[0].replace("data:",""):X.mediaType,G=X.type==="file"?X.filename:void 0,W=uj0(Q);if(!W)return X;if(W==="image"?mj0(Z):Z.capabilities.input[W])return X;return{type:"text",text:`ERROR: Cannot read ${G?`"${G}"`:W} (this model does not support ${W} input). Inform the user.`}});return{...J,content:Y}})}function ij0($){if(!$.startsWith("data:"))return;let Z=$.slice($.indexOf(",")+1);if(!Z)return 0;let J=Z.endsWith("==")?2:Z.endsWith("=")?1:0;return Math.floor(Z.length*3/4)-J}function nj0($,Z,J){if(Z===void 0&&J===void 0)return $;let Y=$.reduce((Q,G)=>G.role==="user"&&Array.isArray(G.content)?Q+G.content.filter((W)=>W.type==="image").length:Q,0),X=Z===void 0?0:Math.max(0,Y-Z);return $.map((Q)=>{if(Q.role!=="user"||!Array.isArray(Q.content))return Q;let G=Q.content.map((W)=>{if(W.type!=="image")return W;if(X>0)return X--,{type:"text",text:`[Image omitted: exceeds the configured limit of ${Z} prompt image(s).]`};if(J!==void 0){let K=ij0(String(W.image));if(K!==void 0&&K>J)return{type:"text",text:`[Image omitted: exceeds the configured ${J}-byte prompt image size limit.]`}}return W});return{...Q,content:G}})}function ym($,Z,J,Y={}){if($=cj0($,Z),$=nj0($,Y.maxImages,Y.maxSize),$=lj0($,Z,J),dj0(Z))$=pj0($,Z);let X=NK(Z.api.npm);if(X&&X!==Z.providerID){let Q=(G)=>{if(!G)return G;if(!(Z.providerID in G))return G;let W={...G};return W[X]=W[Z.providerID],delete W[Z.providerID],W};$=$.map((G)=>{if(!Array.isArray(G.content))return{...G,providerOptions:Q(G.providerOptions)};return{...G,providerOptions:Q(G.providerOptions),content:G.content.map((W)=>{if(W.type==="tool-approval-request"||W.type==="tool-approval-response")return{...W};return{...W,providerOptions:Q(W.providerOptions)}})}})}return $}var MK=b0.QITQODE_EXPERIMENTAL_OUTPUT_TOKEN_MAX||vm;function xm($,Z,J){return ym($,Z,J,{maxImages:b0.QITQODE_MAX_PROMPT_IMAGES,maxSize:b0.QITQODE_MAX_PROMPT_IMAGE_SIZE})}function hm($){return $()}var H6=["low","medium","high"],gm=["none","minimal",...H6,"xhigh"];function um($){if($)return Object.fromEntries($.map((Z)=>[Z,{thinking:{type:"adaptive"},effort:Z}]));return{high:{thinking:{type:"enabled",budgetTokens:16000}},max:{thinking:{type:"enabled",budgetTokens:31999}}}}function oj0($){if(["opus-4-7","opus-4.7","opus-4-8","opus-4.8"].some((Z)=>$.includes(Z)))return["low","medium","high","xhigh","max"];if(["opus-4-6","opus-4.6","sonnet-4-6","sonnet-4.6"].some((Z)=>$.includes(Z)))return["low","medium","high","max"];return null}function mm($){if(!$.capabilities.reasoning)return{};let Z=$.id.toLowerCase(),J=oj0($.api.id);if(Z.includes("deepseek")||Z.includes("minimax")||Z.includes("glm")||Z.includes("mistral")||Z.includes("kimi")||Z.includes("k2p5")||Z.includes("qwen")||Z.includes("big-pickle"))return{};if(Z.includes("grok")&&Z.includes("grok-3-mini")){if($.api.npm==="@openrouter/ai-sdk-provider")return{low:{reasoning:{effort:"low"}},high:{reasoning:{effort:"high"}}};return{low:{reasoningEffort:"low"},high:{reasoningEffort:"high"}}}if(Z.includes("grok"))return{};switch($.api.npm){case"@openrouter/ai-sdk-provider":if(!$.id.includes("gpt")&&!$.id.includes("gemini-3")&&!$.id.includes("claude"))return{};return Object.fromEntries(gm.map((K)=>[K,{reasoning:{effort:K}}]));case"@ai-sdk/gateway":if($.id.includes("anthropic"))return um(J);if($.id.includes("google")){if(Z.includes("2.5"))return{high:{thinkingConfig:{includeThoughts:!0,thinkingBudget:16000}},max:{thinkingConfig:{includeThoughts:!0,thinkingBudget:24576}}};return Object.fromEntries(["low","high"].map((K)=>[K,{includeThoughts:!0,thinkingLevel:K}]))}return Object.fromEntries(gm.map((K)=>[K,{reasoningEffort:K}]));case"@ai-sdk/github-copilot":if($.id.includes("gemini"))return{};if($.id.includes("claude"))return Object.fromEntries(H6.map((K)=>[K,{reasoningEffort:K}]));let Y=hm(()=>{if(Z.includes("5.1-codex-max")||Z.includes("5.2")||Z.includes("5.3"))return[...H6,"xhigh"];let K=[...H6];if(Z.includes("gpt-5")&&$.release_date>="2025-12-04")K.push("xhigh");return K});return Object.fromEntries(Y.map((K)=>[K,{reasoningEffort:K,reasoningSummary:"auto",include:["reasoning.encrypted_content"]}]));case"@ai-sdk/cerebras":case"@ai-sdk/togetherai":case"@ai-sdk/xai":case"@ai-sdk/deepinfra":case"venice-ai-sdk-provider":case"@ai-sdk/openai-compatible":return Object.fromEntries(H6.map((K)=>[K,{reasoningEffort:K}]));case"@ai-sdk/azure":if(Z==="o1-mini")return{};let X=["low","medium","high"];if(Z.includes("gpt-5-")||Z==="gpt-5")X.unshift("minimal");return Object.fromEntries(X.map((K)=>[K,{reasoningEffort:K,reasoningSummary:"auto",include:["reasoning.encrypted_content"]}]));case"@ai-sdk/openai":if(Z==="gpt-5-pro")return{};let Q=hm(()=>{if(Z.includes("codex")){if(Z.includes("5.2")||Z.includes("5.3"))return[...H6,"xhigh"];return H6}let K=[...H6];if(Z.includes("gpt-5-")||Z==="gpt-5")K.unshift("minimal");if($.release_date>="2025-11-13")K.unshift("none");if($.release_date>="2025-12-04")K.push("xhigh");return K});return Object.fromEntries(Q.map((K)=>[K,{reasoningEffort:K,reasoningSummary:"auto",include:["reasoning.encrypted_content"]}]));case"@ai-sdk/anthropic":case"@ai-sdk/google-vertex/anthropic":if($.providerID==="github-copilot"){if($.api.id.includes("opus-4.7"))return Object.fromEntries(["medium"].map((K)=>[K,{reasoningEffort:K}]))}if(J)return Object.fromEntries(J.map((K)=>[K,{thinking:{type:"adaptive",...["opus-4-7","opus-4.7","opus-4-8","opus-4.8"].some((V)=>$.api.id.includes(V))?{display:"summarized"}:{}},effort:K}]));return{high:{thinking:{type:"enabled",budgetTokens:Math.max(1,Math.min(16000,Math.floor($.limit.output/2-1)))}},max:{thinking:{type:"enabled",budgetTokens:Math.max(1,Math.min(31999,$.limit.output-1))}}};case"@ai-sdk/amazon-bedrock":if(J)return Object.fromEntries(J.map((K)=>[K,{reasoningConfig:{type:"adaptive",maxReasoningEffort:K,...["opus-4-7","opus-4.7","opus-4-8","opus-4.8"].some((V)=>$.api.id.includes(V))?{display:"summarized"}:{}}}]));if($.api.id.includes("anthropic"))return{high:{reasoningConfig:{type:"enabled",budgetTokens:16000}},max:{reasoningConfig:{type:"enabled",budgetTokens:31999}}};return Object.fromEntries(H6.map((K)=>[K,{reasoningConfig:{type:"enabled",maxReasoningEffort:K}}]));case"@ai-sdk/google-vertex":case"@ai-sdk/google":if(Z.includes("2.5"))return{high:{thinkingConfig:{includeThoughts:!0,thinkingBudget:16000}},max:{thinkingConfig:{includeThoughts:!0,thinkingBudget:24576}}};let G=["low","high"];if(Z.includes("3.1"))G=["low","medium","high"];return Object.fromEntries(G.map((K)=>[K,{thinkingConfig:{includeThoughts:!0,thinkingLevel:K}}]));case"@ai-sdk/mistral":return{};case"@ai-sdk/cohere":return{};case"@ai-sdk/groq":let W=["none",...H6];return Object.fromEntries(W.map((K)=>[K,{reasoningEffort:K}]));case"@ai-sdk/perplexity":return{};case"@jerome-benoit/sap-ai-provider-v2":if($.api.id.includes("anthropic"))return um(J);if($.api.id.includes("gemini")&&Z.includes("2.5"))return{high:{thinkingConfig:{includeThoughts:!0,thinkingBudget:16000}},max:{thinkingConfig:{includeThoughts:!0,thinkingBudget:24576}}};if($.api.id.includes("gpt")||/\bo[1-9]/.test($.api.id))return Object.fromEntries(H6.map((K)=>[K,{reasoningEffort:K}]));return{}}return{}}function G5($){return mm($)}function lm($){let Z=$.id.toLowerCase();if(Z.includes("qwen"))return 0.55;if(Z.includes("claude"))return;if(Z.includes("gemini"))return 1;if(Z.includes("glm-4.6"))return 1;if(Z.includes("glm-4.7"))return 1;if(Z.includes("minimax-m2"))return 1;if(Z.includes("kimi-k2")){if(["thinking","k2.","k2p","k2-5"].some((J)=>Z.includes(J)))return 1;return 0.6}return}function dm($){let Z=$.id.toLowerCase();if(Z.includes("qwen"))return 1;if(["minimax-m2","gemini","kimi-k2.5","kimi-k2p5","kimi-k2-5"].some((J)=>Z.includes(J)))return 0.95;return}function pm($){let Z=$.id.toLowerCase();if(Z.includes("minimax-m2")){if(["m2.","m25","m21"].some((J)=>Z.includes(J)))return 40;return 20}if(Z.includes("gemini"))return 64;return}function cm($){let Z={};if($.model.providerID==="openai"||$.model.api.npm==="@ai-sdk/openai"||$.model.api.npm==="@ai-sdk/github-copilot")Z.store=!1;if($.model.api.npm==="@ai-sdk/azure")Z.store=!0,Z.promptCacheKey=$.sessionID;if($.model.api.npm==="@openrouter/ai-sdk-provider"||$.model.api.npm==="@llmgateway/ai-sdk-provider"){if(Z.usage={include:!0},$.model.api.id.includes("gemini-3"))Z.reasoning={effort:"high"}}if($.model.providerID==="baseten"||$.model.providerID==="opencode"&&["kimi-k2-thinking","glm-4.6"].includes($.model.api.id))Z.chat_template_args={enable_thinking:!0};if(["zai","zhipuai"].some((Y)=>$.model.providerID.includes(Y))&&$.model.api.npm==="@ai-sdk/openai-compatible")Z.thinking={type:"enabled",clear_thinking:!1};if($.model.providerID==="openai"||$.providerOptions?.setCacheKey)Z.promptCacheKey=$.sessionID;if($.model.api.npm==="@ai-sdk/google"||$.model.api.npm==="@ai-sdk/google-vertex"){if($.model.capabilities.reasoning){if(Z.thinkingConfig={includeThoughts:!0},$.model.api.id.includes("gemini-3"))Z.thinkingConfig.thinkingLevel="high"}}let J=$.model.api.id.toLowerCase();if(($.model.api.npm==="@ai-sdk/anthropic"||$.model.api.npm==="@ai-sdk/google-vertex/anthropic")&&(J.includes("k2p5")||J.includes("kimi-k2.5")||J.includes("kimi-k2p5")))Z.thinking={type:"enabled",budgetTokens:Math.max(1,Math.min(16000,Math.floor($.model.limit.output/2-1)))};if($.model.providerID==="alibaba-cn"&&$.model.capabilities.reasoning&&$.model.api.npm==="@ai-sdk/openai-compatible"&&!J.includes("kimi-k2-thinking"))Z.enable_thinking=!0;if($.model.api.id.includes("gpt-5")&&!$.model.api.id.includes("gpt-5-chat")){if(!$.model.api.id.includes("gpt-5-pro")){if(Z.reasoningEffort="medium",$.model.api.npm==="@ai-sdk/openai"||$.model.api.npm==="@ai-sdk/azure"||$.model.api.npm==="@ai-sdk/github-copilot")Z.reasoningSummary="auto"}if($.model.api.id.includes("gpt-5.")&&!$.model.api.id.includes("codex")&&!$.model.api.id.includes("-chat")&&$.model.providerID!=="azure")Z.textVerbosity="low";if($.model.providerID.startsWith("opencode"))Z.promptCacheKey=$.sessionID,Z.include=["reasoning.encrypted_content"],Z.reasoningSummary="auto"}if($.model.providerID==="venice")Z.promptCacheKey=$.sessionID;if($.model.providerID==="openrouter")Z.prompt_cache_key=$.sessionID;if($.model.api.npm==="@ai-sdk/gateway")Z.gateway={caching:"auto"};return Z}function im($){if($.providerID==="openai"||$.api.npm==="@ai-sdk/openai"||$.api.npm==="@ai-sdk/github-copilot"){if($.api.id.includes("gpt-5")){if($.api.id.includes("5.")||$.api.id.includes("5-mini"))return{store:!1,reasoningEffort:"low"};return{store:!1,reasoningEffort:"minimal"}}return{store:!1}}if($.providerID==="google"){if($.api.id.includes("gemini-3"))return{thinkingConfig:{thinkingLevel:"minimal"}};return{thinkingConfig:{thinkingBudget:0}}}if($.providerID==="openrouter"||$.providerID==="llmgateway"){if($.api.id.includes("google"))return{reasoning:{enabled:!1}};return{reasoningEffort:"minimal"}}if($.providerID==="venice")return{veniceParameters:{disableThinking:!0}};return{}}var sj0={amazon:"bedrock"};function nm($,Z){if($.api.npm==="@ai-sdk/gateway"){let Y=$.api.id.indexOf("/"),X=Y>0?$.api.id.slice(0,Y):void 0,Q=X?sj0[X]??X:void 0,G=Z.gateway,W=Object.fromEntries(Object.entries(Z).filter(([U])=>U!=="gateway")),K=Object.keys(W).length>0,V={};if(G!==void 0)V.gateway=G;if(K)if(Q)V[Q]=W;else if(G&&typeof G==="object"&&!Array.isArray(G))V.gateway={...G,...W};else V.gateway=W;return V}let J=NK($.api.npm)??$.providerID;if($.api.npm==="@ai-sdk/azure")return{openai:Z,azure:Z};return{[J]:Z}}function om($,Z){return Math.min($.limit.output,Z)||Z}function sm($){return lm($)}function rm($){return dm($)}function am($){return pm($)}function tm($){return cm($)}function em($){return im($)}function $l($,Z){return nm($,Z)}function Zl($){return om($,MK)}function rj0($){let Z=$,J=Z.anyOf??Z.oneOf;if(!J?.length)return $;let Y=new Map;for(let W of J){if(!W.properties)continue;for(let[K,V]of Object.entries(W.properties))if(V&&typeof V==="object"&&"const"in V){if(!Y.has(K))Y.set(K,new Set);Y.get(K).add(V.const)}}let X;for(let[W,K]of Y)if(K.size===J.length){X=W;break}let Q={},G={};for(let W of J){if(!W.properties)continue;let K=X?W.properties[X]?.const:void 0;for(let[V,U]of Object.entries(W.properties)){if(V===X)continue;if(!(V in Q))Q[V]=U;if(K!==void 0){if(!G[V])G[V]=[];G[V].push(K)}}}if(X)for(let[W,K]of Object.entries(G)){if(K.length===J.length)continue;let V=`(only when ${X}=${K.map((H)=>JSON.stringify(H)).join("|")})`,U=Q[W].description;Q[W]={...Q[W],description:U?`${V} ${U}`:V}}if(X){let W=J[0].properties[X],K=J.map((H)=>H.properties[X]?.const),V=W?.description??"",U=J.map((H)=>{let B=H.properties[X]?.const,z=(H.required??[]).filter((F)=>F!==X);return z.length>0?`${B}: requires ${z.join(", ")}`:`${B}: no extra required fields`}).join("; ");Q[X]={type:"string",enum:K,description:V?`${V}
|
|
792
|
+
|
|
793
|
+
Per-${X}: ${U}.`:`Per-${X}: ${U}.`}}return{type:"object",properties:Q,required:X?[X]:[],additionalProperties:!1}}function Jl($,Z){if(Z=rj0(Z),$.providerID==="google"||$.api.id.includes("gemini")){let J=(G)=>typeof G==="object"&&G!==null&&!Array.isArray(G),Y=(G)=>J(G)&&(Array.isArray(G.anyOf)||Array.isArray(G.oneOf)||Array.isArray(G.allOf)),X=(G)=>{if(!J(G))return!1;if(Y(G))return!0;return["type","properties","items","prefixItems","enum","const","$ref","additionalProperties","patternProperties","required","not","if","then","else"].some((W)=>(W in G))},Q=(G)=>{if(G===null||typeof G!=="object")return G;if(Array.isArray(G))return G.map(Q);let W={};for(let[K,V]of Object.entries(G))if(K==="enum"&&Array.isArray(V)){if(W[K]=V.map((U)=>String(U)),W.type==="integer"||W.type==="number")W.type="string"}else if(typeof V==="object"&&V!==null)W[K]=Q(V);else W[K]=V;if(W.type==="object"&&W.properties&&Array.isArray(W.required))W.required=W.required.filter((K)=>(K in W.properties));if(W.type==="array"&&!Y(W)){if(W.items==null)W.items={};if(J(W.items)&&!X(W.items))W.items.type="string"}if(W.type&&W.type!=="object"&&!Y(W))delete W.properties,delete W.required;return W};Z=Q(Z)}return Z}function Yl($,Z){return Jl($,Z)}var bA=1e6,DK=new Set(c8.tiers().map(($)=>$.id)),Gl=c8.tiers(),N7=Object.fromEntries(Gl.map(($)=>[$.id,{providerID:$.providerID,modelID:$.modelID}])),b8=c8.qlexProviderMeta();function Wl($,Z){return{id:s1.make($),providerID:X1.make("qlex"),name:Z,family:b8.family,api:{id:$,url:"",npm:b8.npm},status:"active",headers:{},options:{},cost:{input:0,output:0,cache:{read:0,write:0}},limit:{context:b8.limit.context,output:b8.limit.output},capabilities:{temperature:b8.capabilities.temperature,reasoning:b8.capabilities.reasoning,attachment:b8.capabilities.attachment,toolcall:b8.capabilities.toolcall,input:{...b8.capabilities.input},output:{...b8.capabilities.output},interleaved:b8.capabilities.interleaved},release_date:b8.release_date,variants:{}}}var Q9={id:X1.make("qlex"),name:b8.name,source:"custom",env:[],options:{},models:Object.fromEntries(Gl.map(($)=>[$.id,Wl($.id,$.label)]))};function Kl(){let $=c8.tiers();DK.clear();for(let J of $)DK.add(J.id);for(let J of Object.keys(N7))delete N7[J];Object.assign(N7,Object.fromEntries($.map((J)=>[J.id,{providerID:J.providerID,modelID:J.modelID}])));let Z=Q9.models;for(let J of Object.keys(Z))delete Z[J];Object.assign(Q9.models,Object.fromEntries($.map((J)=>[J.id,Wl(J.id,J.label)])))}var _A=new Set;function Vl($){let Z={input:$?.input??0,output:$?.output??0,cache:{read:$?.cache_read??0,write:$?.cache_write??0}};if($?.context_over_200k)Z.experimentalOver200K={cache:{read:$.context_over_200k.cache_read??0,write:$.context_over_200k.cache_write??0},input:$.context_over_200k.input,output:$.context_over_200k.output};return Z}function Xl($,Z){let J={id:s1.make(Z.id),providerID:X1.make($.id),name:Z.name,family:Z.family,api:{id:Z.id,url:Z.provider?.api??$.api??"",npm:Z.provider?.npm??$.npm??"@ai-sdk/openai-compatible"},status:Z.status??"active",headers:{},options:{},cost:Vl(Z.cost),limit:{context:Z.limit.context,input:Z.limit.input,output:Z.limit.output},capabilities:{temperature:Z.temperature??!1,reasoning:Z.reasoning??!1,attachment:Z.attachment??!1,toolcall:Z.tool_call??!0,input:{text:Z.modalities?.input?.includes("text")??!1,audio:Z.modalities?.input?.includes("audio")??!1,image:Z.modalities?.input?.includes("image")??!1,video:Z.modalities?.input?.includes("video")??!1,pdf:Z.modalities?.input?.includes("pdf")??!1},output:{text:Z.modalities?.output?.includes("text")??!1,audio:Z.modalities?.output?.includes("audio")??!1,image:Z.modalities?.output?.includes("image")??!1,video:Z.modalities?.output?.includes("video")??!1,pdf:Z.modalities?.output?.includes("pdf")??!1},interleaved:Z.interleaved??!1},release_date:Z.release_date??"",variants:{}};return{...J,variants:v6(G5(J),(Y)=>Y)}}function wK($){let Z={};for(let[J,Y]of Object.entries($.models)){Z[J]=Xl($,Y);for(let[X,Q]of Object.entries(Y.experimental?.modes??{})){let G=`${Y.id}-${X}`,W=Xl($,Y);Z[G]={...W,id:s1.make(G),name:`${Y.name} ${X[0].toUpperCase()}${X.slice(1)}`,cost:Q.cost?N1(W.cost,Vl(Q.cost)):W.cost,options:Q.provider?.body?Object.fromEntries(Object.entries(Q.provider.body).map(([K,V])=>[K.replace(/_([a-z])/g,(U,H)=>H.toUpperCase()),V])):W.options,headers:Q.provider?.headers??W.headers}}}return{id:X1.make($.id),source:"custom",name:$.name,env:$.env??[],options:{},models:Z}}function Ul($){return v6($,(Z)=>G9(Object.values(Z.models))[0].id)}var aj0=["gpt-5.5","gpt-5","claude-sonnet-4","gemini-3-pro"];function G9($){return Ql($,[(Z)=>aj0.findIndex((J)=>Z.id.includes(J)),"desc"],[(Z)=>Z.id.includes("latest")?0:1,"asc"],[(Z)=>Z.id,"desc"])}function W5($){let[Z,...J]=$.split("/");return{providerID:X1.make(Z),modelID:s1.make(J.join("/"))}}var KY=j1.create("ProviderModelNotFoundError",P.object({providerID:X1.zod,modelID:s1.zod,suggestions:P.array(P.string()).optional()})),LK=j1.create("ProviderModelGroupNotFoundError",P.object({group:P.string(),suggestions:P.array(P.string()).optional()})),TK=j1.create("ProviderInitError",P.object({providerID:X1.zod}));function Hl($){let{getState:Z,config:J,readRecent:Y}=$,X=L.fn("Provider.getProvider")((U)=>Z().pipe(L.map((H)=>H.providers[U]))),Q=L.fn("Provider.getModel")(function*(U,H){let B=yield*Z(),z=B.providers[U];if(!z){let A=Object.keys(B.providers),j=RK.default.go(U,A,{limit:3,threshold:-1e4});throw new KY({providerID:U,modelID:H,suggestions:j.map((N)=>N.target)})}let F=z.models[H];if(!F){let A=Object.keys(z.models),j=RK.default.go(H,A,{limit:3,threshold:-1e4});throw new KY({providerID:U,modelID:H,suggestions:j.map((N)=>N.target)})}return F}),G=L.fn("Provider.closest")(function*(U,H){let z=(yield*Z()).providers[U];if(!z)return;for(let F of H)for(let A of Object.keys(z.models))if(A.includes(F))return{providerID:U,modelID:A};return}),W=L.fn("Provider.resolveModelRef")(function*(U,H){if(U.includes("/")){let N=W5(U);return yield*Q(N.providerID,N.modelID)}let B=yield*J.get(),z=B.model_groups?.[U];if(!z){if(DK.has(U)){let q=N7[U];if(q){let C=yield*Q(X1.make(q.providerID),s1.make(q.modelID)).pipe(L.exit);if(C._tag==="Success")return C.value}let M=yield*V();return yield*Q(M.providerID,M.modelID)}let N=Object.keys(B.model_groups??{}),w=RK.default.go(U,N,{limit:3,threshold:-1e4});throw new LK({group:U,suggestions:w.map((q)=>q.target)})}let F=typeof z==="string"?z:z.default,A=typeof z==="string"?[z]:z.models??[z.default];if(H)for(let N of A){let w=W5(N);if(w.providerID!==H)continue;let q=yield*Q(w.providerID,w.modelID).pipe(L.exit);if(q._tag==="Success")return q.value}let j=W5(F);return yield*Q(j.providerID,j.modelID)}),K=L.fn("Provider.getSmallModel")(function*(U){let H=yield*J.get();if(H.small_model){let B=W5(H.small_model);return yield*Q(B.providerID,B.modelID)}for(let B of["lite","free","economical"]){if(H.model_groups?.[B])return yield*W(B,U);let F=N7[B];if(F){let A=yield*Q(X1.make(F.providerID),s1.make(F.modelID)).pipe(L.exit);if(A._tag==="Success")return A.value}}return yield*W("economical",U)}),V=L.fn("Provider.defaultModel")(function*(){let U=yield*J.get();if(U.model)return W5(U.model);let H=yield*Z(),B=yield*Y().pipe(L.map((A)=>{if(!J8(A)||!Array.isArray(A.recent))return[];return A.recent.flatMap((j)=>{if(!J8(j))return[];if(typeof j.providerID!=="string")return[];if(typeof j.modelID!=="string")return[];return[{providerID:X1.make(j.providerID),modelID:s1.make(j.modelID)}]})}),L.catch(()=>L.succeed([])));for(let A of B){let j=H.providers[A.providerID];if(!j)continue;if(!j.models[A.modelID])continue;return{providerID:A.providerID,modelID:A.modelID}}for(let A of["default","fast","economical","power"]){let j=N7[A];if(!j)continue;let N=H.providers[X1.make(j.providerID)];if(N?.models[s1.make(j.modelID)])return{providerID:N.id,modelID:s1.make(j.modelID)}}let z=Object.values(H.providers).find((A)=>!U.provider||Object.keys(U.provider).includes(A.id));if(!z)throw Error("no providers found");let[F]=G9(Object.values(z.models));if(!F)throw Error("no models found");return{providerID:z.id,modelID:F.id}});return{getProvider:X,getModel:Q,closest:G,resolveModelRef:W,getSmallModel:K,defaultModel:V}}var PK=480000;function Bl($,Z,J){if(typeof Z!=="number"||Z<=0)return $;if(!$.body)return $;if(!$.headers.get("content-type")?.includes("text/event-stream"))return $;let Y=$.body.getReader(),X=new ReadableStream({async pull(Q){let G=await new Promise((W,K)=>{let V=setTimeout(()=>{let U=Error("SSE read timed out");J.abort(U),Y.cancel(U),K(U)},Z);Y.read().then((U)=>{clearTimeout(V),W(U)},(U)=>{clearTimeout(V),K(U)})});if(G.done){Q.close();return}Q.enqueue(G.value)},async cancel(Q){J.abort(Q),await Y.cancel(Q)}});return new Response(X,{headers:new Headers($.headers),status:$.status,statusText:$.statusText})}import OZ from"os";var VY=E0.create({service:"provider/loaders"}),IK=new Map,ql={"@qitqode/qlex-provider":()=>import("./chunk-9yakc5yv.js").then(($)=>$.createQlexProvider),"@ai-sdk/amazon-bedrock":()=>import("./chunk-xhbb8b5g.js").then(($)=>$.createAmazonBedrock),"@ai-sdk/anthropic":()=>import("./chunk-h7w35n7w.js").then(($)=>$.createAnthropic),"@ai-sdk/azure":()=>import("./chunk-x6rr6ss1.js").then(($)=>$.createAzure),"@ai-sdk/google":()=>import("./chunk-rcyhqkv5.js").then(($)=>$.createGoogleGenerativeAI),"@ai-sdk/google-vertex":()=>import("./chunk-kx2dp8ch.js").then(($)=>$.createVertex),"@ai-sdk/google-vertex/anthropic":()=>import("./chunk-cagk1sjd.js").then(($)=>$.createVertexAnthropic),"@ai-sdk/openai":()=>import("./chunk-q81m4m9z.js").then(($)=>$.createOpenAI),"@ai-sdk/openai-compatible":()=>import("./chunk-h9qn35pn.js").then(($)=>$.createOpenAICompatible),"@openrouter/ai-sdk-provider":()=>import("./chunk-te5tfq79.js").then(($)=>$.createOpenRouter),"@ai-sdk/xai":()=>import("./chunk-9zre5e54.js").then(($)=>$.createXai),"@ai-sdk/mistral":()=>import("./chunk-dgx4rq86.js").then(($)=>$.createMistral),"@ai-sdk/groq":()=>import("./chunk-dh1h513y.js").then(($)=>$.createGroq),"@ai-sdk/deepinfra":()=>import("./chunk-vgnddhdj.js").then(($)=>$.createDeepInfra),"@ai-sdk/cerebras":()=>import("./chunk-eaqfnwdj.js").then(($)=>$.createCerebras),"@ai-sdk/cohere":()=>import("./chunk-nsjp44fp.js").then(($)=>$.createCohere),"@ai-sdk/gateway":()=>import("./chunk-gw36mrg4.js").then(($)=>$.createGateway),"@ai-sdk/togetherai":()=>import("./chunk-9fkmhmh6.js").then(($)=>$.createTogetherAI),"@ai-sdk/perplexity":()=>import("./chunk-bnz0mxak.js").then(($)=>$.createPerplexity),"@ai-sdk/vercel":()=>import("./chunk-8r3410c2.js").then(($)=>$.createVercel),"@ai-sdk/alibaba":()=>import("./chunk-zbqzm65q.js").then(($)=>$.createAlibaba),"gitlab-ai-provider":()=>import("./chunk-7vftsy04.js").then(($)=>$.createGitLab),"@ai-sdk/github-copilot":()=>import("./chunk-vsys768k.js").then(($)=>$.createOpenaiCompatible),"venice-ai-sdk-provider":()=>import("./chunk-neqy8j4n.js").then(($)=>$.createVenice)};function jl($){return $.responses===void 0&&$.chat===void 0}function tj0($){let Z=/^gpt-(\d+)/.exec($);if(!Z)return!1;return Number(Z[1])>=5&&!$.startsWith("gpt-5-mini")}async function zl($,Z,J){if(jl($))return $.languageModel(Z);if(J?.useCompletionUrls)return $.chat(Z);else return $.responses(Z)}function Fl($,Z){return $.CLOUDFLARE_ACCOUNT_ID||(Z?.type==="api"?Z.metadata?.accountId:void 0)}function Nl($){return{qlex:L.fnUntraced(function*(){return{autoload:!0,options:{getToken:Al,onInvalidCredentials:async()=>{if(process.env.QITQODE_KEY)VY.error(SA),console.error(SA);try{await Ol()}catch{}}},async getModel(Y,X){return Y.languageModel(X)}}}),anthropic:()=>L.succeed({autoload:!1,options:{headers:{"anthropic-beta":"interleaved-thinking-2025-05-14,fine-grained-tool-streaming-2025-05-14"}}}),opencode:L.fnUntraced(function*(Z){let J=yield*$.env(),X=l$(()=>{if(Z.env.some((Q)=>J[Q]))return!0;return!1})||Boolean(yield*$.auth(Z.id))||Boolean((yield*$.config()).provider?.opencode?.options?.apiKey);for(let[Q,G]of Object.entries(Z.models))if(!X||G.cost.input===0)delete Z.models[Q];return{autoload:Object.keys(Z.models).length>0,options:{}}}),openai:()=>L.succeed({autoload:!1,async getModel(Z,J,Y){return Z.responses(J)},options:{}}),xai:()=>L.succeed({autoload:!1,async getModel(Z,J,Y){return Z.responses(J)},options:{}}),"github-copilot":()=>L.succeed({autoload:!1,async getModel(Z,J,Y){if(jl(Z))return Z.languageModel(J);return tj0(J)?Z.responses(J):Z.chat(J)},options:{}}),azure:L.fnUntraced(function*(Z){let J=yield*$.env(),Y=l$(()=>{let X=Z.options?.resourceName;if(typeof X==="string"&&X.trim()!=="")return X;return J.AZURE_RESOURCE_NAME});return{autoload:!1,getModel:zl,options:{},vars(X){return{...Y&&{AZURE_RESOURCE_NAME:Y}}}}}),"azure-cognitive-services":L.fnUntraced(function*(){let Z=yield*$.get("AZURE_COGNITIVE_SERVICES_RESOURCE_NAME");return{autoload:!1,getModel:zl,options:{baseURL:Z?`https://${Z}.cognitiveservices.azure.com/openai`:void 0}}}),"amazon-bedrock":L.fnUntraced(function*(){let Z=(yield*$.config()).provider?.["amazon-bedrock"],J=yield*$.auth("amazon-bedrock"),Y=yield*$.env(),X=Z?.options?.region,Q=Y.AWS_REGION,G=X??Q??"us-east-1",W=Z?.options?.profile,K=Y.AWS_PROFILE,V=W??K,U=Y.AWS_ACCESS_KEY_ID,H=l$(()=>{let N=IK.get("AWS_BEARER_TOKEN_BEDROCK");if(N)return N;if(J?.type==="api")return IK.set("AWS_BEARER_TOKEN_BEDROCK",J.key),process.env.AWS_BEARER_TOKEN_BEDROCK=J.key,J.key;return}),B=Y.AWS_WEB_IDENTITY_TOKEN_FILE,z=Boolean(process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI||process.env.AWS_CONTAINER_CREDENTIALS_FULL_URI);if(!V&&!U&&!H&&!B&&!z)return{autoload:!1};let{fromNodeProviderChain:F}=yield*L.promise(()=>import("./chunk-4fa390yr.js")),A={region:G};if(!H){let N=V?{profile:V}:{};A.credentialProvider=F(N)}let j=Z?.options?.endpoint??Z?.options?.baseURL;if(j)A.baseURL=j;return{autoload:!0,options:A,async getModel(N,w,q){if(["global.","us.","eu.","jp.","apac.","au."].some((T)=>w.startsWith(T)))return N.languageModel(w);let C=q?.region??G,R=C.split("-")[0];switch(R){case"us":{let T=["nova-micro","nova-lite","nova-pro","nova-premier","nova-2","claude","deepseek"].some((_)=>w.includes(_)),I=C.startsWith("us-gov");if(T&&!I)w=`${R}.${w}`;break}case"eu":{let T=["eu-west-1","eu-west-2","eu-west-3","eu-north-1","eu-central-1","eu-south-1","eu-south-2"].some((_)=>C.includes(_)),I=["claude","nova-lite","nova-micro","llama3","pixtral"].some((_)=>w.includes(_));if(T&&I)w=`${R}.${w}`;break}case"ap":{let T=["ap-southeast-2","ap-southeast-4"].includes(C),I=C==="ap-northeast-1";if(T&&["anthropic.claude-sonnet-4-5","anthropic.claude-haiku"].some((_)=>w.includes(_)))R="au",w=`${R}.${w}`;else if(I){if(["claude","nova-lite","nova-micro","nova-pro"].some((E)=>w.includes(E)))R="jp",w=`${R}.${w}`}else if(["claude","nova-lite","nova-micro","nova-pro"].some((E)=>w.includes(E)))R="apac",w=`${R}.${w}`;break}}return N.languageModel(w)}}}),llmgateway:()=>L.succeed({autoload:!1,options:{headers:{"X-Source":"qitqode"}}}),openrouter:()=>L.succeed({autoload:!1,options:{headers:{"X-OpenRouter-Categories":"programming,programming-app,cli-agent"}}}),nvidia:()=>L.succeed({autoload:!1,options:{}}),vercel:()=>L.succeed({autoload:!1,options:{}}),"google-vertex":L.fnUntraced(function*(Z){let J=yield*$.env(),Y=Z.options?.project??J.GOOGLE_CLOUD_PROJECT??J.GCP_PROJECT??J.GCLOUD_PROJECT,X=String(Z.options?.location??J.GOOGLE_VERTEX_LOCATION??J.GOOGLE_CLOUD_LOCATION??J.VERTEX_LOCATION??"us-central1");if(!Boolean(Y))return{autoload:!1};return{autoload:!0,vars(G){let W=X==="global"?"aiplatform.googleapis.com":`${X}-aiplatform.googleapis.com`;return{...Y&&{GOOGLE_VERTEX_PROJECT:Y},GOOGLE_VERTEX_LOCATION:X,GOOGLE_VERTEX_ENDPOINT:W}},options:{project:Y,location:X,fetch:async(G,W)=>{let{GoogleAuth:K}=await import("./chunk-aq28ejhv.js").then((m)=>m6(m.default,1)),H=await(await new K().getApplicationDefault()).credential.getAccessToken(),B=new Headers(W?.headers);return B.set("Authorization",`Bearer ${H.token}`),fetch(G,{...W,headers:B})}},async getModel(G,W){let K=String(W).trim();return G.languageModel(K)}}}),"google-vertex-anthropic":L.fnUntraced(function*(){let Z=yield*$.env(),J=Z.GOOGLE_CLOUD_PROJECT??Z.GCP_PROJECT??Z.GCLOUD_PROJECT,Y=Z.GOOGLE_CLOUD_LOCATION??Z.VERTEX_LOCATION??"global";if(!Boolean(J))return{autoload:!1};return{autoload:!0,options:{project:J,location:Y},async getModel(Q,G){let W=String(G).trim();return Q.languageModel(W)}}}),"sap-ai-core":L.fnUntraced(function*(){let Z=yield*$.auth("sap-ai-core"),J=l$(()=>{let Q=IK.get("AICORE_SERVICE_KEY");if(Q)return Q;if(Z?.type==="api")return IK.set("AICORE_SERVICE_KEY",Z.key),process.env.AICORE_SERVICE_KEY=Z.key,Z.key;return}),Y=process.env.AICORE_DEPLOYMENT_ID,X=process.env.AICORE_RESOURCE_GROUP;return{autoload:!!J,options:J?{deploymentId:Y,resourceGroup:X}:{},async getModel(Q,G){return Q(G)}}}),zenmux:()=>L.succeed({autoload:!1,options:{}}),gitlab:L.fnUntraced(function*(Z){let{VERSION:J,isWorkflowModel:Y,discoverWorkflowModels:X}=yield*L.promise(()=>import("./chunk-7vftsy04.js")),Q=(yield*$.get("GITLAB_INSTANCE_URL"))||"https://gitlab.com",G=yield*$.auth(Z.id),W=yield*L.sync(()=>{if(G?.type==="oauth")return G.access;if(G?.type==="api")return G.key;return}),K=W??(yield*$.get("GITLAB_TOKEN")),V=(yield*$.config()).provider?.gitlab,U=yield*B0.directory,H={"User-Agent":`qitqode/${E$} gitlab-ai-provider/${J} (${OZ.platform()} ${OZ.release()}; ${OZ.arch()})`,"anthropic-beta":"context-1m-2025-08-07",...V?.options?.aiGatewayHeaders},B={duo_agent_platform_agentic_chat:!0,duo_agent_platform:!0,...V?.options?.featureFlags};return{autoload:!!K,options:{instanceUrl:Q,apiKey:K,aiGatewayHeaders:H,featureFlags:B},async getModel(z,F,A){if(F.startsWith("duo-workflow-")){let j=typeof A?.workflowRef==="string"?A.workflowRef:void 0,N=Y(F)?F:"duo-workflow",w=typeof A?.workflowDefinition==="string"?A.workflowDefinition:void 0,q=z.workflowChat(N,{featureFlags:B,workflowDefinition:w});if(j)q.selectedModelRef=j;return q}return z.agenticChat(F,{aiGatewayHeaders:H,featureFlags:B})},async discoverModels(){if(!W)return VY.info("gitlab model discovery skipped: no apiKey"),{};try{let z=W,F=()=>G?.type==="api"?{"PRIVATE-TOKEN":z}:{Authorization:`Bearer ${z}`};VY.info("gitlab model discovery starting",{instanceUrl:Q});let A=await X({instanceUrl:Q,getHeaders:F},{workingDirectory:U});if(!A.models.length)return VY.info("gitlab model discovery skipped: no models found",{project:A.project?{id:A.project.id,path:A.project.pathWithNamespace}:null}),{};let j={};for(let N of A.models)if(!Z.models[N.id])j[N.id]={id:s1.make(N.id),providerID:X1.make("gitlab"),name:`Agent Platform (${N.name})`,family:"",api:{id:N.id,url:Q,npm:"gitlab-ai-provider"},status:"active",headers:{},options:{workflowRef:N.ref},cost:{input:0,output:0,cache:{read:0,write:0}},limit:{context:N.context,output:N.output},capabilities:{temperature:!1,reasoning:!0,attachment:!0,toolcall:!0,input:{text:!0,audio:!1,image:!0,video:!1,pdf:!0},output:{text:!0,audio:!1,image:!1,video:!1,pdf:!1},interleaved:!1},release_date:"",variants:{}};return VY.info("gitlab model discovery complete",{count:Object.keys(j).length,models:Object.keys(j)}),j}catch(z){return VY.warn("gitlab model discovery failed",{error:z}),{}}}}}),"cloudflare-workers-ai":L.fnUntraced(function*(Z){if(Z.options?.baseURL)return{autoload:!1};let J=yield*$.auth(Z.id),Y=yield*$.env(),X=Fl(Y,J);if(!X)return{autoload:!1,async getModel(){throw Error("CLOUDFLARE_ACCOUNT_ID is missing. Set it with: export CLOUDFLARE_ACCOUNT_ID=<your-account-id>")}};let Q=yield*L.gen(function*(){let G=Y.CLOUDFLARE_API_KEY;if(G)return G;if(J?.type==="api")return J.key;return});return{autoload:!!Q,options:{apiKey:Q,headers:{"User-Agent":`qitqode/${E$} cloudflare-workers-ai (${OZ.platform()} ${OZ.release()}; ${OZ.arch()})`}},async getModel(G,W){return G.languageModel(W)},vars(G){return{CLOUDFLARE_ACCOUNT_ID:X}}}}),"cloudflare-ai-gateway":L.fnUntraced(function*(Z){if(Z.options?.baseURL)return{autoload:!1};let J=yield*$.auth(Z.id),Y=yield*$.env(),X=Fl(Y,J),Q=Y.CLOUDFLARE_GATEWAY_ID||(J?.type==="api"?J.metadata?.gatewayId:void 0);if(!X||!Q){let z=[!X?"CLOUDFLARE_ACCOUNT_ID":void 0,!Q?"CLOUDFLARE_GATEWAY_ID":void 0].filter((F)=>Boolean(F));return{autoload:!1,async getModel(){throw Error(`${z.join(" and ")} missing. Set with: ${z.map((F)=>`export ${F}=<value>`).join(" && ")}`)}}}let G=yield*L.gen(function*(){let z=Y.CLOUDFLARE_API_TOKEN||Y.CF_AIG_TOKEN;if(z)return z;if(J?.type==="api")return J.key;return});if(!G)throw Error("CLOUDFLARE_API_TOKEN (or CF_AIG_TOKEN) is required for Cloudflare AI Gateway. Set it via environment variable or run `qitqode auth cloudflare-ai-gateway`.");let{createAiGateway:W}=yield*L.promise(()=>import("./chunk-52b1v7mn.js")),{createUnified:K}=yield*L.promise(()=>import("./chunk-eze57bty.js")),U={metadata:l$(()=>{if(Z.options?.metadata)return Z.options.metadata;try{return JSON.parse(Z.options?.headers?.["cf-aig-metadata"])}catch{return}}),cacheTtl:Z.options?.cacheTtl,cacheKey:Z.options?.cacheKey,skipCache:Z.options?.skipCache,collectLog:Z.options?.collectLog,headers:{"User-Agent":`qitqode/${E$} cloudflare-ai-gateway (${OZ.platform()} ${OZ.release()}; ${OZ.arch()})`}},H=W({accountId:X,gateway:Q,apiKey:G,...Object.values(U).some((z)=>z!==void 0)?{options:U}:{}}),B=K();return{autoload:!0,async getModel(z,F,A){return H(B(F))},options:{}}}),cerebras:()=>L.succeed({autoload:!1,options:{headers:{"X-Cerebras-3rd-Party-Integration":"qitqode"}}}),kilo:()=>L.succeed({autoload:!1,options:{}})}}import{pathToFileURL as ej0}from"url";var fA=E0.create({service:"provider.sdk-runtime"});async function Ml($,Z,J){try{let Y=[];try{const W=CK(Y,fA.time("getSDK",{providerID:$.providerID}),0);let K=Z.providers[$.providerID];let V={...K.options};if($.providerID==="google-vertex"&&!$.api.npm.includes("@ai-sdk/openai-compatible"))delete V.fetch;if($.api.npm.includes("@ai-sdk/openai-compatible")&&V.includeUsage!==!1)V.includeUsage=!0;let U=l$(()=>{let R=typeof V.baseURL==="string"&&V.baseURL!==""?V.baseURL:$.api.url;if(!R)return;let T=Z.varsLoaders[$.providerID];if(T){let I=T(V);for(let[_,E]of Object.entries(I)){let f="${"+_+"}";R=R.replaceAll(f,E)}}return R});if(U!==void 0)V.baseURL=U;if(V.apiKey===void 0&&typeof K.key==="string")V.apiKey=K.key;if($.headers)V.headers={...V.headers,...$.headers};let H=V.fetch;delete V.fetch;let B=V4.fast(JSON.stringify({providerID:$.providerID,npm:$.api.npm,options:V}));let z=Z.sdk.get(B);if(z)return z;let F=V.chunkTimeout;let A=typeof F==="number"?F:PK;delete V.chunkTimeout;V.fetch=async(R,T)=>{let I=H??fetch,_=T??{},E=typeof A==="number"&&A>0?new AbortController:void 0,f=[];if(_.signal)f.push(_.signal);if(E)f.push(E.signal);if(V.timeout!==void 0&&V.timeout!==null&&V.timeout!==!1)f.push(AbortSignal.timeout(V.timeout));let b=f.length===0?null:f.length===1?f[0]:AbortSignal.any(f);if(b)_.signal=b;if($.api.npm==="@ai-sdk/openai"&&_.body&&_.method==="POST"){let k=JSON.parse(_.body);if(!($.providerID.includes("azure")&&k.store===!0)&&Array.isArray(k.input)){for(let p of k.input)if("id"in p)delete p.id;_.body=JSON.stringify(k)}}let y=await I(R,{..._,timeout:!1});if(!E)return y;return Bl(y,A,E)};let j=ql[$.api.npm];if(j){fA.info("using bundled provider",{providerID:$.providerID,pkg:$.api.npm});let T=(await j())({name:$.providerID,...V});return Z.sdk.set(B,T),T}let N;if(!$.api.npm.startsWith("file://")){let R=await j6.add($.api.npm);if(!R.entrypoint)throw Error(`Package ${$.api.npm} has no import entrypoint`);N=R.entrypoint}else fA.info("loading local provider",{pkg:$.api.npm}),N=$.api.npm;let w=N.startsWith("file://")?N:ej0(N).href;let q=await import(w);let M=q[Object.keys(q).find((R)=>R.startsWith("create"))];let C=M({name:$.providerID,...V});Z.sdk.set(B,C);return C}catch(X){var Q=X,G=1}finally{EK(Y,Q,G)}}catch(W){throw new TK({providerID:$.providerID},{cause:W})}}function Dl($){let Z={};function J(Y,X){let Q=Z[Y];if(Q){Z[Y]=N1(Q,X);return}let G=$[Y];if(!G)return;Z[Y]=N1(G,X)}return{database:$,providers:Z,mergeProvider:J}}function wl($){if($.enabled&&!$.enabled.has($.providerID))return!1;if($.disabled.has($.providerID))return!1;return!0}function Ll($,Z){let J=$.env.map((Y)=>Z[Y]).find(Boolean);if(!J)return;return{source:"env",key:$.env.length===1?J:void 0}}function Tl($){if($.type!=="api")return;return{source:"api",key:$.key}}function kA($){return $.hasProvider?{options:$.options??{}}:{source:"custom",options:$.options??{}}}var $N0=E0.create({service:"provider.discovery.filter"});function Rl($){for(let[Z,J]of Object.entries($.providers)){let Y=X1.make(Z);if(!$.isAllowed(Y)){delete $.providers[Y];continue}let X=$.overrides[Y];for(let[Q,G]of Object.entries(J.models)){if(G.api.id=G.api.id??G.id??Q,Q==="gpt-5-chat-latest"||Y===X1.openrouter&&Q==="openai/gpt-5-chat")delete J.models[Q];if(G.status==="alpha"&&!$.experimentalModels)delete J.models[Q];if(G.status==="deprecated")delete J.models[Q];if(X?.blacklist&&X.blacklist.includes(Q)||X?.whitelist&&!X.whitelist.includes(Q))delete J.models[Q];G.variants=v6(G5(G),(K)=>K);let W=X?.models?.[Q]?.variants;if(W&&G.variants){let K=N1(G.variants,W);G.variants=v6(bK(K,(V)=>!V.disabled),(V)=>_K(V,["disabled"]))}}if(Object.keys(J.models).length===0){delete $.providers[Y];continue}$N0.info("found",{providerID:Y})}return $.providers}var ZN0=E0.create({service:"provider.discovery.config"});function Pl($){for(let[Z,J]of $.configProviders){let Y=$.database[Z],X={id:X1.make(Z),name:J.name??Y?.name??Z,env:J.env??Y?.env??[],options:N1(Y?.options??{},J.options??{}),source:"config",models:Y?.models??{}};for(let[Q,G]of Object.entries(J.models??{})){let W=X.models[G.id??Q],K=G.id??W?.api.id??Q,V=G.provider?.npm??J.npm??W?.api.npm??$.modelsDev[Z]?.npm??"@ai-sdk/openai-compatible",U=l$(()=>{if(G.name)return G.name;if(G.id&&G.id!==Q)return Q;return W?.name??Q}),H={id:s1.make(Q),api:{id:K,npm:V,url:G.provider?.api??J?.api??W?.api.url??$.modelsDev[Z]?.api??""},status:G.status??W?.status??"active",name:U,providerID:X1.make(Z),capabilities:{temperature:G.temperature??W?.capabilities.temperature??!1,reasoning:G.reasoning??W?.capabilities.reasoning??!1,attachment:G.attachment??W?.capabilities.attachment??!1,toolcall:G.tool_call??W?.capabilities.toolcall??!0,input:{text:G.modalities?.input?.includes("text")??W?.capabilities.input.text??!0,audio:G.modalities?.input?.includes("audio")??W?.capabilities.input.audio??!1,image:G.modalities?.input?.includes("image")??W?.capabilities.input.image??!1,video:G.modalities?.input?.includes("video")??W?.capabilities.input.video??!1,pdf:G.modalities?.input?.includes("pdf")??W?.capabilities.input.pdf??!1},output:{text:G.modalities?.output?.includes("text")??W?.capabilities.output.text??!0,audio:G.modalities?.output?.includes("audio")??W?.capabilities.output.audio??!1,image:G.modalities?.output?.includes("image")??W?.capabilities.output.image??!1,video:G.modalities?.output?.includes("video")??W?.capabilities.output.video??!1,pdf:G.modalities?.output?.includes("pdf")??W?.capabilities.output.pdf??!1},interleaved:G.interleaved??W?.capabilities.interleaved??(!W&&V==="@ai-sdk/openai-compatible"&&K.includes("deepseek")?{field:"reasoning_content"}:!1)},cost:{input:G?.cost?.input??W?.cost?.input??0,output:G?.cost?.output??W?.cost?.output??0,cache:{read:G?.cost?.cache_read??W?.cost?.cache.read??0,write:G?.cost?.cache_write??W?.cost?.cache.write??0}},options:N1(W?.options??{},G.options??{}),limit:{context:(()=>{let z=G.limit?.context??W?.limit?.context;if(z!==void 0)return z;let F=`${Z}/${Q}`;if(!_A.has(F))_A.add(F),ZN0.warn("limit.context not configured and not found in models.dev",{providerID:Z,modelID:Q,defaulting_to:bA,fix:`Set limit.context explicitly in qitqode.json under provider.${Z}.models.${Q}`});return bA})(),input:G.limit?.input??W?.limit?.input,output:G.limit?.output??W?.limit?.output??0},headers:N1(W?.headers??{},G.headers??{}),family:G.family??W?.family??"",release_date:G.release_date??W?.release_date??"",cachePromptTTL:G.cachePromptTTL??W?.cachePromptTTL,variants:{}},B=N1(G5(H),G.variants??{});H.variants=v6(bK(B,(z)=>!z.disabled),(z)=>_K(z,["disabled"])),X.models[Q]=H}$.database[Z]=X}}var SK=E0.create({service:"provider.discovery"});function Cl($){let{config:Z,auth:J,env:Y,plugin:X}=$;return L.gen(function*(){let E=[];try{const Q=CK(E,SK.time("state"),0);let G=yield*T7.make();let W=yield*Z.get();let K=yield*L.promise(()=>Il());let V=v6(K,wK);V[Q9.id]=Q9;let U=Dl(V);let{providers:H,mergeProvider:B}=U;let z=new Map;let F={};let A={};let j=new Map;let N={};let w={auth:(k)=>J.get(k).pipe(L.orDie),config:()=>Z.get(),env:()=>Y.all(),get:(k)=>Y.get(k)};SK.info("init");let q=yield*X.list();let M=Object.entries(W.provider??{});let C=new Set(W.disabled_providers??[]);let R=W.enabled_providers?new Set(W.enabled_providers):null;let T=(k)=>wl({providerID:k,enabled:R,disabled:C});Pl({database:V,modelsDev:K,configProviders:M});if(!b0.QITQODE_DISABLE_PROVIDER_ENV){let k=yield*Y.all();for(let[g,d]of Object.entries(V)){let p=X1.make(g);if(C.has(p))continue;let t=Ll(d,k);if(t)B(p,t)}}let I=yield*J.all().pipe(L.orDie);for(let[k,g]of Object.entries(I)){let d=X1.make(k);if(C.has(d))continue;let p=Tl(g);if(p)B(d,p)}for(let k of q){if(!k.auth)continue;let g=X1.make(k.auth.provider);if(C.has(g))continue;if(!(yield*J.get(g).pipe(L.orDie)))continue;if(!k.auth.loader)continue;let t=(yield*L.promise(()=>k.auth.loader(()=>G.promise(J.get(g).pipe(L.orDie)),V[k.auth.provider])))??{};B(g,kA({options:t,hasProvider:Boolean(H[g])}))}for(let[k,g]of Object.entries(Nl(w))){let d=X1.make(k);if(C.has(d))continue;let p=V[d];if(!p){SK.error("Provider does not exist in model list "+d);continue}let t=yield*g(p);if(t&&(t.autoload||H[d])){if(t.getModel)F[d]=t.getModel;if(t.vars)A[d]=t.vars;if(t.discoverModels)N[d]=t.discoverModels;let r=t.options??{};B(d,kA({options:r,hasProvider:Boolean(H[d])}))}}for(let[k,g]of M){let d=X1.make(k),p={source:"config"};if(g.env)p.env=g.env;if(g.name)p.name=g.name;if(g.options)p.options=g.options;B(d,p)}let _=X1.make("gitlab");if(N[_]&&H[_]&&T(_))yield*L.promise(async()=>{try{let k=await N[_]();for(let[g,d]of Object.entries(k))if(!H[_].models[g])H[_].models[g]=d}catch(k){SK.warn("state discovery error",{id:"gitlab",error:k})}});for(let k of q){let g=k.provider,d=g?.models;if(!g||!d)continue;let p=X1.make(g.id);if(C.has(p))continue;let t=H[p];if(!t)continue;let r=yield*J.get(p).pipe(L.orDie);t.models=yield*L.promise(async()=>{let G0=await d(t,{auth:r});return Object.fromEntries(Object.entries(G0).map(([O0,h0])=>[O0,{...h0,id:s1.make(O0),providerID:p}]))})}Rl({providers:H,overrides:W.provider??{},isAllowed:T,experimentalModels:b0.QITQODE_ENABLE_EXPERIMENTAL_MODELS});return{models:z,providers:H,sdk:j,modelLoaders:F,varsLoaders:A}}catch(f){var b=f,y=1}finally{EK(E,b,y)}})}var YN0=O.Struct({id:O.String,url:O.String,npm:O.String}),El=O.Struct({text:O.Boolean,audio:O.Boolean,image:O.Boolean,video:O.Boolean,pdf:O.Boolean}),XN0=O.Union([O.Boolean,O.Struct({field:O.Literals(["reasoning_content","reasoning_details"])})]),QN0=O.Struct({temperature:O.Boolean,reasoning:O.Boolean,attachment:O.Boolean,toolcall:O.Boolean,input:El,output:El,interleaved:XN0}),bl=O.Struct({read:O.Number,write:O.Number}),GN0=O.Struct({input:O.Number,output:O.Number,cache:bl,experimentalOver200K:O.optional(O.Struct({input:O.Number,output:O.Number,cache:bl}))}),WN0=O.Struct({context:O.Number,input:O.optional(O.Number),output:O.Number}),vA=O.Struct({id:s1,providerID:X1,api:YN0,name:O.String,family:O.optional(O.String),capabilities:QN0,cost:GN0,limit:WN0,status:O.Literals(["alpha","beta","deprecated","active"]),options:O.Record(O.String,O.Any),headers:O.Record(O.String,O.String),release_date:O.String,variants:O.optional(O.Record(O.String,O.Record(O.String,O.Any))),cacheTTL:O.optional(O.Number),cachePromptTTL:O.optional(O.Literals(["5m","1h"]))}).annotate({identifier:"Model"}).pipe(u0(($)=>({zod:w0($)}))),fK=O.Struct({id:X1,name:O.String,source:O.Literals(["env","config","custom","api"]),env:O.Array(O.String),key:O.optional(O.String),options:O.Record(O.String,O.Any),models:O.Record(O.String,vA)}).annotate({identifier:"Provider"}).pipe(u0(($)=>({zod:w0($)}))),_l=O.Record(O.String,O.String),Sl=O.Struct({all:O.Array(fK),default:_l,connected:O.Array(O.String)}).pipe(u0(($)=>({zod:w0($)}))),fl=O.Struct({providers:O.Array(fK),default:_l}).pipe(u0(($)=>({zod:w0($)})));async function yl($=vl){return c8.loadLiveRatings($)}function xl($){c8.mergeLiveTierRatings($)}class kK extends S1.Service()("@qitqode/Provider"){}var VN0=T0.effect(kK,L.gen(function*(){let $=yield*C$.Service,Z=yield*X8.Service,J=yield*k8.Service,Y=yield*l6.Service,X=yield*AZ.Service;c8.beginTierRatingsLoad();let[Q,G]=yield*L.promise(()=>Promise.all([kl(),yl()]));c8.mergeLiveTiers(Q),xl(G),Kl();let W=yield*B0.make(()=>Cl({config:Z,auth:J,env:Y,plugin:X})),K=L.fn("Provider.list")(()=>B0.use(W,(N)=>N.providers)),V=Hl({getState:()=>B0.get(W),config:Z,readRecent:()=>$.readJson(KN0.join(F0.Path.state,"model.json"))}),{getProvider:U,getModel:H,closest:B,getSmallModel:z,defaultModel:F,resolveModelRef:A}=V,j=L.fn("Provider.getLanguage")(function*(N){let w=yield*B0.get(W),q=yield*Y.all(),M=`${N.providerID}/${N.id}`;if(w.models.has(M))return w.models.get(M);return yield*L.promise(async()=>{let C=w.providers[N.providerID],R=await Ml(N,w,q);try{let T=w.modelLoaders[N.providerID]?await w.modelLoaders[N.providerID](R,N.api.id,{...C.options,...N.options}):R.languageModel(N.api.id);return w.models.set(M,T),T}catch(T){if(T instanceof XH)throw new KY({modelID:N.id,providerID:N.providerID},{cause:T});throw T}})});return kK.of({list:K,getProvider:U,getModel:H,getLanguage:j,closest:B,getSmallModel:z,defaultModel:F,resolveModelRef:A})})),UN0=T0.suspend(()=>VN0.pipe(T0.provide(C$.defaultLayer),T0.provide(l6.defaultLayer),T0.provide(X8.defaultLayer),T0.provide(k8.defaultLayer),T0.provide(AZ.defaultLayer)));var ol={};F1(ol,{layer:()=>nl,defaultLayer:()=>qN0,ValidationFailed:()=>il,Service:()=>vK,OauthMissing:()=>dl,OauthCodeMissing:()=>pl,OauthCallbackFailed:()=>cl,Methods:()=>ml,Method:()=>yA,CallbackInput:()=>ON0,AuthorizeInput:()=>AN0,Authorization:()=>ll});var ul=O.Struct({key:O.String,op:O.Literals(["eq","neq"]),value:O.String}),HN0=O.Struct({type:O.Literal("text"),key:O.String,message:O.String,placeholder:O.optional(O.String),when:O.optional(ul)}),BN0=O.Struct({label:O.String,value:O.String,hint:O.optional(O.String)}),zN0=O.Struct({type:O.Literal("select"),key:O.String,message:O.String,options:O.Array(BN0),when:O.optional(ul)}),FN0=O.Union([HN0,zN0]);class yA extends O.Class("ProviderAuthMethod")({type:O.Literals(["oauth","api"]),label:O.String,prompts:O.optional(O.Array(FN0))}){static zod=w0(this)}var ml=O.Record(O.String,O.Array(yA)).pipe(u0(($)=>({zod:w0($)})));class ll extends O.Class("ProviderAuthAuthorization")({url:O.String,method:O.Literals(["auto","code"]),instructions:O.String}){static zod=w0(this)}var AN0=O.Struct({method:O.Number.annotate({description:"Auth method index"}),inputs:O.optional(O.Record(O.String,O.String)).annotate({description:"Prompt inputs"})}).pipe(u0(($)=>({zod:w0($)}))),ON0=O.Struct({method:O.Number.annotate({description:"Auth method index"}),code:O.optional(O.String).annotate({description:"OAuth authorization code"})}).pipe(u0(($)=>({zod:w0($)}))),dl=j1.create("ProviderAuthOauthMissing",P.object({providerID:X1.zod})),pl=j1.create("ProviderAuthOauthCodeMissing",P.object({providerID:X1.zod})),cl=j1.create("ProviderAuthOauthCallbackFailed",P.object({})),il=j1.create("ProviderAuthValidationFailed",P.object({field:P.string(),message:P.string()}));class vK extends S1.Service()("@qitqode/ProviderAuth"){}var nl=T0.effect(vK,L.gen(function*(){let $=yield*k8.Service,Z=yield*AZ.Service,J=yield*B0.make(L.fn("ProviderAuth.state")(function*(){let W=yield*Z.list();return{hooks:y7.fromEntries(gl.filterMap(W,(K)=>K.auth?.provider!==void 0?v7.succeed([X1.make(K.auth.provider),K.auth]):v7.failVoid)),pending:new Map}})),Y=O.decodeUnknownSync(ml),X=L.fn("ProviderAuth.methods")(function*(){let W=(yield*B0.get(J)).hooks;return Y(y7.map(W,(K)=>K.methods.map((V)=>({type:V.type,label:V.label,prompts:V.prompts?.map((U)=>{if(U.type==="select")return{type:"select",key:U.key,message:U.message,options:U.options,when:U.when};return{type:"text",key:U.key,message:U.message,placeholder:U.placeholder,when:U.when}})}))))}),Q=L.fn("ProviderAuth.authorize")(function*(W){let{hooks:K,pending:V}=yield*B0.get(J),U=K[W.providerID].methods[W.method];if(U.type!=="oauth")return;if(U.prompts&&W.inputs){for(let B of U.prompts)if(B.type==="text"&&B.validate&&W.inputs[B.key]!==void 0){let z=B.validate(W.inputs[B.key]);if(z)return yield*L.fail(new il({field:B.key,message:z}))}}let H=yield*L.promise(()=>U.authorize(W.inputs));return V.set(W.providerID,H),{url:H.url,method:H.method,instructions:H.instructions}}),G=L.fn("ProviderAuth.callback")(function*(W){let V=(yield*B0.get(J)).pending.get(W.providerID);if(!V)return yield*L.fail(new dl({providerID:W.providerID}));if(V.method==="code"&&!W.code)return yield*L.fail(new pl({providerID:W.providerID}));let U=yield*L.promise(()=>V.method==="code"?V.callback(W.code):V.callback(W.code));if(!U||U.type!=="success")return yield*L.fail(new cl({}));if("key"in U)yield*$.set(W.providerID,{type:"api",key:U.key,..."metadata"in U&&U.metadata?{metadata:U.metadata}:{}});if("refresh"in U){let{type:H,provider:B,refresh:z,access:F,expires:A,...j}=U;yield*$.set(W.providerID,{type:"oauth",access:F,refresh:z,expires:A,...j})}});return vK.of({methods:X,authorize:Q,callback:G})})),qN0=T0.suspend(()=>nl.pipe(T0.provide(k8.defaultLayer),T0.provide(AZ.defaultLayer)));var W9={};F1(W9,{parseStreamError:()=>LN0,parseAPICallError:()=>TN0});import{STATUS_CODES as sl}from"http";var jN0=[/prompt is too long/i,/input is too long for requested model/i,/exceeds the context window/i,/input token count.*exceeds the maximum/i,/maximum prompt length is \d+/i,/reduce the length of the messages/i,/maximum context length is \d+ tokens/i,/exceeds the limit of \d+/i,/exceeds the available context size/i,/greater than the context length/i,/context window exceeds limit/i,/exceeded model token limit/i,/context[_ ]length[_ ]exceeded/i,/request entity too large/i,/context length is only \d+ tokens/i,/input length.*exceeds.*context length/i,/prompt too long; exceeded (?:max )?context length/i,/too large for model with \d+ maximum context length/i,/model_context_window_exceeded/i];function NN0($){let Z=$.statusCode;if(!Z)return $.isRetryable;return Z===404||$.isRetryable}function MN0($){if(jN0.some((Z)=>Z.test($)))return!0;return/^4(00|13)\s*(status code)?\s*\(no body\)/i.test($)}function DN0($){if(!$||!/^\s*[\[{]/.test($))return!1;try{return JSON.parse($),!1}catch(Z){let J=0,Y=!1,X=!1;for(let Q of $){if(Y){if(X)X=!1;else if(Q==="\\")X=!0;else if(Q==='"')Y=!1;continue}if(Q==='"')Y=!0;else if(Q==="{"||Q==="[")J++;else if(Q==="}"||Q==="]")J--;if(J<0)return!1}return Y||J>0||/unexpected end|end of json|unterminated string/i.test(String(Z))}}function wN0($,Z){return l$(()=>{let J=Z.message;if(J===""){if(Z.responseBody)return Z.responseBody;if(Z.statusCode){let X=sl[Z.statusCode];if(X)return X}return"Unknown error"}if(!Z.responseBody||Z.statusCode&&J!==sl[Z.statusCode])return J;try{let X=JSON.parse(Z.responseBody),Q=X.message||X.detail||X.error?.message||X.error;if(Q&&typeof Q==="string")return`${J}: ${Q.slice(0,300)}`;if(Array.isArray(Q)&&Q.length>0){let G=Q[0],W=typeof G?.msg==="string"?G.msg:typeof G?.message==="string"?G.message:typeof G==="string"?G:void 0;if(W)return`${J}: ${W.slice(0,300)}`}}catch{}if(/^\s*<!doctype|^\s*<html/i.test(Z.responseBody)){if(Z.statusCode===401)return"Unauthorized: request was blocked by a gateway or proxy. Your authentication token may be missing or expired \u2014 try running `qitqode auth login <your provider URL>` to re-authenticate.";if(Z.statusCode===403)return"Forbidden: request was blocked by a gateway or proxy. You may not have permission to access this resource \u2014 check your account and provider settings.";return J}let Y=Z.responseBody.length>300?Z.responseBody.slice(0,300)+"\u2026":Z.responseBody;return`${J}: ${Y}`}).trim()}function rl($){if(typeof $==="string")try{let Z=JSON.parse($);if(Z&&typeof Z==="object")return Z;return}catch{return}if(typeof $==="object"&&$!==null)return $;return}function LN0($){let Z=rl($);if(!Z)return;let J=JSON.stringify(Z);if(Z.type!=="error")return;switch(Z?.error?.code){case"context_length_exceeded":return{type:"context_overflow",message:"Input exceeds context window of this model",responseBody:J};case"insufficient_quota":return{type:"api_error",message:"Quota exceeded. Check your plan and billing details.",isRetryable:!1,responseBody:J};case"usage_not_included":return{type:"api_error",message:"To use Codex with your ChatGPT plan, upgrade to Plus: https://chatgpt.com/explore/plus.",isRetryable:!1,responseBody:J};case"invalid_prompt":return{type:"api_error",message:typeof Z?.error?.message==="string"?Z?.error?.message:"Invalid prompt.",isRetryable:!1,responseBody:J}}}function TN0($){let Z=wN0($.providerID,$.error),J=rl($.error.responseBody),Y=DN0($.error.responseBody);if(MN0(Z)||$.error.statusCode===413||J?.error?.code==="context_length_exceeded")return{type:"context_overflow",message:Z,responseBody:$.error.responseBody};let X=$.error.url?{url:$.error.url}:void 0;return{type:"api_error",message:Y?"The model connection ended before the response completed.":Z,statusCode:$.error.statusCode,isRetryable:Y||($.providerID.startsWith("openai")?NN0($.error):$.error.isRetryable),category:Y?"stream_truncated":void 0,responseHeaders:$.error.responseHeaders,responseBody:$.error.responseBody,metadata:X}}function xA($,Z){switch(!0){case($ instanceof DOMException&&$.name==="AbortError"):return new f5({message:$.message},{cause:$}).toObject();case O4.isInstance($):{let J=$.lastError??$.errors[$.errors.length-1];if(J!==void 0&&J!==$)return xA(J,Z);return new T6({message:$.message,isRetryable:!0},{cause:$}).toObject()}case U4.isInstance($):return $;case YH.isInstance($):return new H4({providerID:Z.providerID,message:$.message},{cause:$}).toObject();case $?.code==="ECONNRESET":return new T6({message:"Connection reset by server",isRetryable:!0,metadata:{code:$.code??"",syscall:$.syscall??"",message:$.message??""}},{cause:$}).toObject();case($ instanceof Error&&$.code==="ZlibError"):if(Z.aborted)return new f5({message:$.message},{cause:$}).toObject();return new T6({message:"Response decompression failed",isRetryable:!0,metadata:{code:$.code,message:$.message}},{cause:$}).toObject();case FX.isInstance($):{let J=W9.parseAPICallError({providerID:Z.providerID,error:$});if(J.type==="context_overflow")return new GX({message:J.message,responseBody:J.responseBody},{cause:$}).toObject();return new T6({message:J.message,statusCode:J.statusCode,isRetryable:J.isRetryable,category:J.category,outputBudgetRecoveryAvailable:void 0,outputBudgetRecoveryTokens:void 0,diagnostic:UY($),responseHeaders:J.responseHeaders,responseBody:J.responseBody,metadata:J.metadata},{cause:$}).toObject()}case($ instanceof Error&&(typeof $.status==="number"||typeof $.category==="string"&&typeof $.retryable==="boolean")):{let J=$.status,Y=$.retryable===!0;return new T6({message:U6($),statusCode:J,isRetryable:Y,category:$.category,outputBudgetRecoveryAvailable:$.outputBudgetRecoveryAvailable,outputBudgetRecoveryTokens:$.outputBudgetRecoveryTokens,diagnostic:UY($)},{cause:$}).toObject()}case $ instanceof Error:return new j1.Unknown({message:U6($),diagnostic:UY($)},{cause:$}).toObject();default:try{let J=W9.parseStreamError($);if(J){if(J.type==="context_overflow")return new GX({message:J.message,responseBody:J.responseBody},{cause:$}).toObject();return new T6({message:J.message,isRetryable:J.isRetryable,diagnostic:UY($),responseBody:J.responseBody},{cause:$}).toObject()}}catch{}return new j1.Unknown({message:U6($),diagnostic:UY($)},{cause:$}).toObject()}}var BY={};F1(BY,{layer:()=>Yd,defaultLayer:()=>SN0,Service:()=>yK,ActorRegistry:()=>BY});var _1=g6("actor_registry",{session_id:w1().$type().notNull().references(()=>I1.id,{onDelete:"cascade"}),actor_id:w1().notNull(),mode:w1().$type().notNull(),parent_actor_id:w1(),status:w1().$type().notNull(),last_outcome:w1().$type(),lifecycle:w1().$type().notNull(),agent:w1().notNull(),description:w1().notNull(),context_mode:w1().$type().notNull(),context_watermark:w1().$type(),background:q8({mode:"boolean"}).notNull(),tools:w1({mode:"json"}).$type(),last_turn_time:q8().notNull(),turn_count:q8().notNull().default(0),last_error:w1(),time_completed:q8(),...xY},($)=>[k9({columns:[$.session_id,$.actor_id]}),K9("actor_registry_session_agent_idx").on($.session_id,$.agent),K9("actor_registry_session_parent_idx").on($.session_id,$.parent_actor_id),K9("actor_registry_status_idx").on($.status),K9("actor_registry_status_last_turn_idx").on($.status,$.last_turn_time)]);var hA=P.enum(["pending","running","idle"]),gA=P.enum(["success","failure","cancelled"]),RN0=P.enum(["ephemeral","persistent"]),PN0=P.enum(["none","state","full"]),uA=P.enum(["peer","subagent","main"]),IN0=P.union([P.array(P.string()).readonly(),P.literal("INHERIT")]),Yd0=P.object({sessionID:r0.zod,actorID:P.string(),mode:uA,parentActorID:P.string().optional(),status:hA,lastOutcome:gA.optional(),lifecycle:RN0,agent:P.string(),description:P.string(),contextMode:PN0,contextWatermark:i1.zod.optional(),background:P.boolean(),tools:IN0.optional(),lastTurnTime:P.number(),turnCount:P.number(),lastError:P.string().optional(),time:P.object({created:P.number(),updated:P.number(),completed:P.number().optional()})}).meta({ref:"Actor"});var al=L1.define("actor.registered",P.object({sessionID:r0.zod,actorID:P.string(),mode:uA,parentActorID:P.string().optional(),description:P.string(),agent:P.string(),background:P.boolean()})),tl=L1.define("actor.status",P.object({sessionID:r0.zod,actorID:P.string(),status:hA,lastOutcome:gA.optional(),turnCount:P.number(),lastTurnTime:P.number(),error:P.string().optional()})),el=L1.define("actor.stuck",P.object({sessionID:r0.zod,actorID:P.string(),description:P.string(),lastTurnTime:P.number(),stuckDuration:P.number()})),Vd0=L1.define("writer.cache_perf",P.object({sessionID:r0.zod,writerActorID:P.string(),status:P.enum(["completed","failed"]),total_input_tokens:P.number(),cache_read_tokens:P.number(),cache_write_tokens:P.number(),cache_hit_rate:P.number(),num_llm_calls:P.number()})),Ud0=L1.define("inbox.arrived",P.object({receiverSessionID:r0.zod,receiverActorID:P.string(),senderSessionID:r0.zod.optional(),senderActorID:P.string().optional(),inboxID:P.string(),type:P.string()}));var $d=new Set(["checkpoint-writer","dream","distill"]);var EN0=E0.create({service:"actor.registry"}),bN0=300000,_N0=60000;function HY($){return{sessionID:$.session_id,actorID:$.actor_id,mode:$.mode,parentActorID:$.parent_actor_id??void 0,status:$.status,lastOutcome:$.last_outcome??void 0,lifecycle:$.lifecycle,agent:$.agent,description:$.description,contextMode:$.context_mode,contextWatermark:$.context_watermark??void 0,background:Boolean($.background),tools:$.tools??void 0,lastTurnTime:$.last_turn_time,turnCount:$.turn_count,lastError:$.last_error??void 0,time:{created:$.time_created,updated:$.time_updated,completed:$.time_completed??void 0}}}class yK extends S1.Service()("@qitqode/ActorRegistry"){}var Yd=T0.effect(yK,L.gen(function*(){let $=yield*l1.Service,Z=new Map,J=L.fn("ActorRegistry.register")(function*(A){let j=Date.now(),N={session_id:A.sessionID,actor_id:A.actorID,mode:A.mode,parent_actor_id:A.parentActorID??null,status:"pending",last_outcome:null,lifecycle:A.lifecycle,agent:A.agent,description:A.description,context_mode:A.contextMode,context_watermark:A.contextWatermark??null,background:A.background,tools:A.tools??null,last_turn_time:j,turn_count:0,last_error:null,time_completed:null,time_created:j,time_updated:j};return yield*L.sync(()=>W1.use((w)=>{try{w.insert(_1).values(N).run()}catch(q){if(typeof q==="object"&&q!==null&&"code"in q&&typeof q.code==="string"&&(q.code==="SQLITE_CONSTRAINT_PRIMARYKEY"||q.code==="SQLITE_CONSTRAINT_UNIQUE")||q instanceof Error&&q.message.toLowerCase().includes("unique constraint"))throw Error(`Actor ID collision: '${A.actorID}' already exists in session '${A.sessionID}'.`);throw q}})),yield*$.publish(al,{sessionID:A.sessionID,actorID:A.actorID,mode:A.mode,parentActorID:A.parentActorID,description:A.description,agent:A.agent,background:A.background}),HY(N)}),Y=L.fnUntraced(function*(A,j){return yield*L.sync(()=>W1.use((N)=>N.select().from(_1).where(O$(m0(_1.session_id,A),m0(_1.actor_id,j))).get()))}),X=L.fn("ActorRegistry.updateStatus")(function*(A,j,N){let w=Date.now(),q=N.status==="idle"&&N.lastOutcome!==void 0,M={status:N.status,time_updated:w,...q?{time_completed:w}:{}};if(N.lastOutcome!==void 0)M.last_outcome=N.lastOutcome;if(N.lastError!==void 0)M.last_error=N.lastError;else if(N.lastOutcome!==void 0&&N.lastOutcome!=="failure")M.last_error=null;yield*L.sync(()=>W1.use((R)=>R.update(_1).set(M).where(O$(m0(_1.session_id,A),m0(_1.actor_id,j))).run()));let C=yield*Y(A,j);if(!C)return;yield*$.publish(tl,{sessionID:A,actorID:j,status:C.status,...C.last_outcome?{lastOutcome:C.last_outcome}:{},turnCount:C.turn_count,lastTurnTime:C.last_turn_time,...C.last_error?{error:C.last_error}:{}})}),Q=L.fn("ActorRegistry.updateTurn")(function*(A,j){let N=Date.now();yield*L.sync(()=>W1.use((w)=>w.update(_1).set({last_turn_time:N,turn_count:Zd`${_1.turn_count} + 1`,time_updated:N}).where(O$(m0(_1.session_id,A),m0(_1.actor_id,j))).run()))}),G=L.fn("ActorRegistry.get")(function*(A,j){let N=yield*Y(A,j);return N?HY(N):void 0}),W=L.fn("ActorRegistry.listBySession")(function*(A){return(yield*L.sync(()=>W1.use((N)=>N.select().from(_1).where(m0(_1.session_id,A)).all()))).map(HY)}),K=L.fn("ActorRegistry.listActive")(function*(){return(yield*L.sync(()=>W1.use((j)=>j.select().from(_1).where(O$(k5(_1.status,["pending","running"]),m0(_1.background,!0))).all()))).map(HY)}),V=L.fn("ActorRegistry.listByParent")(function*(A,j){return(yield*L.sync(()=>W1.use((w)=>w.select().from(_1).where(O$(m0(_1.session_id,A),m0(_1.parent_actor_id,j))).all()))).map(HY)}),U=L.fn("ActorRegistry.renderForAgent")(function*(A){let N=(yield*W(A)).filter((M)=>M.background&&(M.status==="pending"||M.status==="running"));if(N.length===0)return"";let w=[];w.push("## Active Actors"),w.push(""),w.push(`You have ${N.length} background actor(s) registered. Interact via the \`actor\` tool.`),w.push("");let q=Date.now();for(let M of N){let C=q-M.lastTurnTime,R=C<60000?`${Math.floor(C/1000)}s`:`${Math.floor(C/60000)}m`;w.push(`- actor_id: ${M.actorID} (${M.status}, last activity ${R} ago)`),w.push(` description: ${M.description}`),w.push(` agent: ${M.agent}`)}return w.join(`
|
|
794
|
+
`)}),H=L.fn("ActorRegistry.agentTypeFor")(function*(A,j){if(j==="main")return"main";return(yield*G(A,j))?.agent??"main"}),B=L.fn("ActorRegistry.isSystemSpawned")(function*(A,j){if(j==="main")return!1;let N=yield*G(A,j);if(!N)return!1;return $d.has(N.agent)}),z=L.fn("ActorRegistry.allocateActorID")(function*(A,j){let N=`${A}:${j}`,w=`${j}-`;if(!Z.has(N)){let M=yield*L.sync(()=>W1.use((C)=>C.select({actor_id:_1.actor_id}).from(_1).where(O$(m0(_1.session_id,A),m0(_1.agent,j))).all()));if(!Z.has(N)){let C=0;for(let R of M)if(R.actor_id.startsWith(w)){let T=parseInt(R.actor_id.slice(w.length),10);if(Number.isFinite(T)&&T>C)C=T}Z.set(N,C)}}let q=(Z.get(N)??0)+1;return Z.set(N,q),`${j}-${q}`});return yield*L.sync(()=>W1.use((A)=>{let j=Date.now();A.update(_1).set({status:"idle",last_outcome:"failure",last_error:"orphaned: process restarted",time_updated:j,time_completed:j}).where(k5(_1.status,["pending","running"])).run()})),EN0.info("orphan recovery complete"),yield*L.gen(function*(){let A=Date.now()-bN0,j=yield*L.sync(()=>W1.use((N)=>N.select().from(_1).where(O$(m0(_1.status,"running"),Jd(_1.last_turn_time,A))).all()));for(let N of j){let w=HY(N);yield*$.publish(el,{sessionID:w.sessionID,actorID:w.actorID,description:w.description,lastTurnTime:w.lastTurnTime,stuckDuration:Date.now()-w.lastTurnTime})}}).pipe(L.repeat(W4.fixed(_N0)),L.ignore,L.forkScoped),yK.of({register:J,updateStatus:X,updateTurn:Q,get:G,listBySession:W,listActive:K,listByParent:V,renderForAgent:U,agentTypeFor:H,isSystemSpawned:B,allocateActorID:z})})),SN0=Yd.pipe(T0.provide(l1.layer));import nA from"path";/*!
|
|
795
|
+
* decimal.js v10.5.0
|
|
796
|
+
* An arbitrary-precision Decimal type for JavaScript.
|
|
797
|
+
* https://github.com/MikeMcl/decimal.js
|
|
798
|
+
* Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
799
|
+
* MIT Licence
|
|
800
|
+
*/var zY=9000000000000000,H5=1e9,mA="0123456789abcdef",gK="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",uK="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",lA={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-zY,maxE:zY,crypto:!1},Wd,qZ,i0=!0,lK="[DecimalError] ",U5=lK+"Invalid argument: ",Kd=lK+"Precision limit exceeded",Vd=lK+"crypto unavailable",Ud="[object Decimal]",n$=Math.floor,q$=Math.pow,fN0=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,kN0=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,vN0=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Hd=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,B6=1e7,x0=7,yN0=9007199254740991,xN0=gK.length-1,dA=uK.length-1,X0={toStringTag:Ud};X0.absoluteValue=X0.abs=function(){var $=new this.constructor(this);if($.s<0)$.s=1;return I0($)};X0.ceil=function(){return I0(new this.constructor(this),this.e+1,2)};X0.clampedTo=X0.clamp=function($,Z){var J,Y=this,X=Y.constructor;if($=new X($),Z=new X(Z),!$.s||!Z.s)return new X(NaN);if($.gt(Z))throw Error(U5+Z);return J=Y.cmp($),J<0?$:Y.cmp(Z)>0?Z:new X(Y)};X0.comparedTo=X0.cmp=function($){var Z,J,Y,X,Q=this,G=Q.d,W=($=new Q.constructor($)).d,K=Q.s,V=$.s;if(!G||!W)return!K||!V?NaN:K!==V?K:G===W?0:!G^K<0?1:-1;if(!G[0]||!W[0])return G[0]?K:W[0]?-V:0;if(K!==V)return K;if(Q.e!==$.e)return Q.e>$.e^K<0?1:-1;Y=G.length,X=W.length;for(Z=0,J=Y<X?Y:X;Z<J;++Z)if(G[Z]!==W[Z])return G[Z]>W[Z]^K<0?1:-1;return Y===X?0:Y>X^K<0?1:-1};X0.cosine=X0.cos=function(){var $,Z,J=this,Y=J.constructor;if(!J.d)return new Y(NaN);if(!J.d[0])return new Y(1);return $=Y.precision,Z=Y.rounding,Y.precision=$+Math.max(J.e,J.sd())+x0,Y.rounding=1,J=hN0(Y,Od(Y,J)),Y.precision=$,Y.rounding=Z,I0(qZ==2||qZ==3?J.neg():J,$,Z,!0)};X0.cubeRoot=X0.cbrt=function(){var $,Z,J,Y,X,Q,G,W,K,V,U=this,H=U.constructor;if(!U.isFinite()||U.isZero())return new H(U);if(i0=!1,Q=U.s*q$(U.s*U,0.3333333333333333),!Q||Math.abs(Q)==1/0){if(J=v$(U.d),$=U.e,Q=($-J.length+1)%3)J+=Q==1||Q==-2?"0":"00";if(Q=q$(J,0.3333333333333333),$=n$(($+1)/3)-($%3==($<0?-1:2)),Q==1/0)J="5e"+$;else J=Q.toExponential(),J=J.slice(0,J.indexOf("e")+1)+$;Y=new H(J),Y.s=U.s}else Y=new H(Q.toString());G=($=H.precision)+3;for(;;)if(W=Y,K=W.times(W).times(W),V=K.plus(U),Y=h1(V.plus(U).times(W),V.plus(K),G+2,1),v$(W.d).slice(0,G)===(J=v$(Y.d)).slice(0,G))if(J=J.slice(G-3,G+1),J=="9999"||!X&&J=="4999"){if(!X){if(I0(W,$+1,0),W.times(W).times(W).eq(U)){Y=W;break}}G+=4,X=1}else{if(!+J||!+J.slice(1)&&J.charAt(0)=="5")I0(Y,$+1,1),Z=!Y.times(Y).times(Y).eq(U);break}return i0=!0,I0(Y,$,H.rounding,Z)};X0.decimalPlaces=X0.dp=function(){var $,Z=this.d,J=NaN;if(Z){if($=Z.length-1,J=($-n$(this.e/x0))*x0,$=Z[$],$)for(;$%10==0;$/=10)J--;if(J<0)J=0}return J};X0.dividedBy=X0.div=function($){return h1(this,new this.constructor($))};X0.dividedToIntegerBy=X0.divToInt=function($){var Z=this,J=Z.constructor;return I0(h1(Z,new J($),0,1,1),J.precision,J.rounding)};X0.equals=X0.eq=function($){return this.cmp($)===0};X0.floor=function(){return I0(new this.constructor(this),this.e+1,3)};X0.greaterThan=X0.gt=function($){return this.cmp($)>0};X0.greaterThanOrEqualTo=X0.gte=function($){var Z=this.cmp($);return Z==1||Z===0};X0.hyperbolicCosine=X0.cosh=function(){var $,Z,J,Y,X,Q=this,G=Q.constructor,W=new G(1);if(!Q.isFinite())return new G(Q.s?1/0:NaN);if(Q.isZero())return W;if(J=G.precision,Y=G.rounding,G.precision=J+Math.max(Q.e,Q.sd())+4,G.rounding=1,X=Q.d.length,X<32)$=Math.ceil(X/3),Z=(1/pK(4,$)).toString();else $=16,Z="2.3283064365386962890625e-10";Q=FY(G,1,Q.times(Z),new G(1),!0);var K,V=$,U=new G(8);for(;V--;)K=Q.times(Q),Q=W.minus(K.times(U.minus(K.times(U))));return I0(Q,G.precision=J,G.rounding=Y,!0)};X0.hyperbolicSine=X0.sinh=function(){var $,Z,J,Y,X=this,Q=X.constructor;if(!X.isFinite()||X.isZero())return new Q(X);if(Z=Q.precision,J=Q.rounding,Q.precision=Z+Math.max(X.e,X.sd())+4,Q.rounding=1,Y=X.d.length,Y<3)X=FY(Q,2,X,X,!0);else{$=1.4*Math.sqrt(Y),$=$>16?16:$|0,X=X.times(1/pK(5,$)),X=FY(Q,2,X,X,!0);var G,W=new Q(5),K=new Q(16),V=new Q(20);for(;$--;)G=X.times(X),X=X.times(W.plus(G.times(K.times(G).plus(V))))}return Q.precision=Z,Q.rounding=J,I0(X,Z,J,!0)};X0.hyperbolicTangent=X0.tanh=function(){var $,Z,J=this,Y=J.constructor;if(!J.isFinite())return new Y(J.s);if(J.isZero())return new Y(J);return $=Y.precision,Z=Y.rounding,Y.precision=$+7,Y.rounding=1,h1(J.sinh(),J.cosh(),Y.precision=$,Y.rounding=Z)};X0.inverseCosine=X0.acos=function(){var $=this,Z=$.constructor,J=$.abs().cmp(1),Y=Z.precision,X=Z.rounding;if(J!==-1)return J===0?$.isNeg()?y6(Z,Y,X):new Z(0):new Z(NaN);if($.isZero())return y6(Z,Y+4,X).times(0.5);return Z.precision=Y+6,Z.rounding=1,$=new Z(1).minus($).div($.plus(1)).sqrt().atan(),Z.precision=Y,Z.rounding=X,$.times(2)};X0.inverseHyperbolicCosine=X0.acosh=function(){var $,Z,J=this,Y=J.constructor;if(J.lte(1))return new Y(J.eq(1)?0:NaN);if(!J.isFinite())return new Y(J);return $=Y.precision,Z=Y.rounding,Y.precision=$+Math.max(Math.abs(J.e),J.sd())+4,Y.rounding=1,i0=!1,J=J.times(J).minus(1).sqrt().plus(J),i0=!0,Y.precision=$,Y.rounding=Z,J.ln()};X0.inverseHyperbolicSine=X0.asinh=function(){var $,Z,J=this,Y=J.constructor;if(!J.isFinite()||J.isZero())return new Y(J);return $=Y.precision,Z=Y.rounding,Y.precision=$+2*Math.max(Math.abs(J.e),J.sd())+6,Y.rounding=1,i0=!1,J=J.times(J).plus(1).sqrt().plus(J),i0=!0,Y.precision=$,Y.rounding=Z,J.ln()};X0.inverseHyperbolicTangent=X0.atanh=function(){var $,Z,J,Y,X=this,Q=X.constructor;if(!X.isFinite())return new Q(NaN);if(X.e>=0)return new Q(X.abs().eq(1)?X.s/0:X.isZero()?X:NaN);if($=Q.precision,Z=Q.rounding,Y=X.sd(),Math.max(Y,$)<2*-X.e-1)return I0(new Q(X),$,Z,!0);return Q.precision=J=Y-X.e,X=h1(X.plus(1),new Q(1).minus(X),J+$,1),Q.precision=$+4,Q.rounding=1,X=X.ln(),Q.precision=$,Q.rounding=Z,X.times(0.5)};X0.inverseSine=X0.asin=function(){var $,Z,J,Y,X=this,Q=X.constructor;if(X.isZero())return new Q(X);if(Z=X.abs().cmp(1),J=Q.precision,Y=Q.rounding,Z!==-1){if(Z===0)return $=y6(Q,J+4,Y).times(0.5),$.s=X.s,$;return new Q(NaN)}return Q.precision=J+6,Q.rounding=1,X=X.div(new Q(1).minus(X.times(X)).sqrt().plus(1)).atan(),Q.precision=J,Q.rounding=Y,X.times(2)};X0.inverseTangent=X0.atan=function(){var $,Z,J,Y,X,Q,G,W,K,V=this,U=V.constructor,H=U.precision,B=U.rounding;if(!V.isFinite()){if(!V.s)return new U(NaN);if(H+4<=dA)return G=y6(U,H+4,B).times(0.5),G.s=V.s,G}else if(V.isZero())return new U(V);else if(V.abs().eq(1)&&H+4<=dA)return G=y6(U,H+4,B).times(0.25),G.s=V.s,G;U.precision=W=H+10,U.rounding=1,J=Math.min(28,W/x0+2|0);for($=J;$;--$)V=V.div(V.times(V).plus(1).sqrt().plus(1));i0=!1,Z=Math.ceil(W/x0),Y=1,K=V.times(V),G=new U(V),X=V;for(;$!==-1;)if(X=X.times(K),Q=G.minus(X.div(Y+=2)),X=X.times(K),G=Q.plus(X.div(Y+=2)),G.d[Z]!==void 0)for($=Z;G.d[$]===Q.d[$]&&$--;);if(J)G=G.times(2<<J-1);return i0=!0,I0(G,U.precision=H,U.rounding=B,!0)};X0.isFinite=function(){return!!this.d};X0.isInteger=X0.isInt=function(){return!!this.d&&n$(this.e/x0)>this.d.length-2};X0.isNaN=function(){return!this.s};X0.isNegative=X0.isNeg=function(){return this.s<0};X0.isPositive=X0.isPos=function(){return this.s>0};X0.isZero=function(){return!!this.d&&this.d[0]===0};X0.lessThan=X0.lt=function($){return this.cmp($)<0};X0.lessThanOrEqualTo=X0.lte=function($){return this.cmp($)<1};X0.logarithm=X0.log=function($){var Z,J,Y,X,Q,G,W,K,V=this,U=V.constructor,H=U.precision,B=U.rounding,z=5;if($==null)$=new U(10),Z=!0;else{if($=new U($),J=$.d,$.s<0||!J||!J[0]||$.eq(1))return new U(NaN);Z=$.eq(10)}if(J=V.d,V.s<0||!J||!J[0]||V.eq(1))return new U(J&&!J[0]?-1/0:V.s!=1?NaN:J?0:1/0);if(Z)if(J.length>1)Q=!0;else{for(X=J[0];X%10===0;)X/=10;Q=X!==1}if(i0=!1,W=H+z,G=V5(V,W),Y=Z?mK(U,W+10):V5($,W),K=h1(G,Y,W,1),V9(K.d,X=H,B))do if(W+=10,G=V5(V,W),Y=Z?mK(U,W+10):V5($,W),K=h1(G,Y,W,1),!Q){if(+v$(K.d).slice(X+1,X+15)+1==100000000000000)K=I0(K,H+1,0);break}while(V9(K.d,X+=10,B));return i0=!0,I0(K,H,B)};X0.minus=X0.sub=function($){var Z,J,Y,X,Q,G,W,K,V,U,H,B,z=this,F=z.constructor;if($=new F($),!z.d||!$.d){if(!z.s||!$.s)$=new F(NaN);else if(z.d)$.s=-$.s;else $=new F($.d||z.s!==$.s?z:NaN);return $}if(z.s!=$.s)return $.s=-$.s,z.plus($);if(V=z.d,B=$.d,W=F.precision,K=F.rounding,!V[0]||!B[0]){if(B[0])$.s=-$.s;else if(V[0])$=new F(z);else return new F(K===3?-0:0);return i0?I0($,W,K):$}if(J=n$($.e/x0),U=n$(z.e/x0),V=V.slice(),Q=U-J,Q){if(H=Q<0,H)Z=V,Q=-Q,G=B.length;else Z=B,J=U,G=V.length;if(Y=Math.max(Math.ceil(W/x0),G)+2,Q>Y)Q=Y,Z.length=1;Z.reverse();for(Y=Q;Y--;)Z.push(0);Z.reverse()}else{if(Y=V.length,G=B.length,H=Y<G,H)G=Y;for(Y=0;Y<G;Y++)if(V[Y]!=B[Y]){H=V[Y]<B[Y];break}Q=0}if(H)Z=V,V=B,B=Z,$.s=-$.s;G=V.length;for(Y=B.length-G;Y>0;--Y)V[G++]=0;for(Y=B.length;Y>Q;){if(V[--Y]<B[Y]){for(X=Y;X&&V[--X]===0;)V[X]=B6-1;--V[X],V[Y]+=B6}V[Y]-=B[Y]}for(;V[--G]===0;)V.pop();for(;V[0]===0;V.shift())--J;if(!V[0])return new F(K===3?-0:0);return $.d=V,$.e=dK(V,J),i0?I0($,W,K):$};X0.modulo=X0.mod=function($){var Z,J=this,Y=J.constructor;if($=new Y($),!J.d||!$.s||$.d&&!$.d[0])return new Y(NaN);if(!$.d||J.d&&!J.d[0])return I0(new Y(J),Y.precision,Y.rounding);if(i0=!1,Y.modulo==9)Z=h1(J,$.abs(),0,3,1),Z.s*=$.s;else Z=h1(J,$,0,Y.modulo,1);return Z=Z.times($),i0=!0,J.minus(Z)};X0.naturalExponential=X0.exp=function(){return pA(this)};X0.naturalLogarithm=X0.ln=function(){return V5(this)};X0.negated=X0.neg=function(){var $=new this.constructor(this);return $.s=-$.s,I0($)};X0.plus=X0.add=function($){var Z,J,Y,X,Q,G,W,K,V,U,H=this,B=H.constructor;if($=new B($),!H.d||!$.d){if(!H.s||!$.s)$=new B(NaN);else if(!H.d)$=new B($.d||H.s===$.s?H:NaN);return $}if(H.s!=$.s)return $.s=-$.s,H.minus($);if(V=H.d,U=$.d,W=B.precision,K=B.rounding,!V[0]||!U[0]){if(!U[0])$=new B(H);return i0?I0($,W,K):$}if(Q=n$(H.e/x0),Y=n$($.e/x0),V=V.slice(),X=Q-Y,X){if(X<0)J=V,X=-X,G=U.length;else J=U,Y=Q,G=V.length;if(Q=Math.ceil(W/x0),G=Q>G?Q+1:G+1,X>G)X=G,J.length=1;J.reverse();for(;X--;)J.push(0);J.reverse()}if(G=V.length,X=U.length,G-X<0)X=G,J=U,U=V,V=J;for(Z=0;X;)Z=(V[--X]=V[X]+U[X]+Z)/B6|0,V[X]%=B6;if(Z)V.unshift(Z),++Y;for(G=V.length;V[--G]==0;)V.pop();return $.d=V,$.e=dK(V,Y),i0?I0($,W,K):$};X0.precision=X0.sd=function($){var Z,J=this;if($!==void 0&&$!==!!$&&$!==1&&$!==0)throw Error(U5+$);if(J.d){if(Z=Bd(J.d),$&&J.e+1>Z)Z=J.e+1}else Z=NaN;return Z};X0.round=function(){var $=this,Z=$.constructor;return I0(new Z($),$.e+1,Z.rounding)};X0.sine=X0.sin=function(){var $,Z,J=this,Y=J.constructor;if(!J.isFinite())return new Y(NaN);if(J.isZero())return new Y(J);return $=Y.precision,Z=Y.rounding,Y.precision=$+Math.max(J.e,J.sd())+x0,Y.rounding=1,J=uN0(Y,Od(Y,J)),Y.precision=$,Y.rounding=Z,I0(qZ>2?J.neg():J,$,Z,!0)};X0.squareRoot=X0.sqrt=function(){var $,Z,J,Y,X,Q,G=this,W=G.d,K=G.e,V=G.s,U=G.constructor;if(V!==1||!W||!W[0])return new U(!V||V<0&&(!W||W[0])?NaN:W?G:1/0);if(i0=!1,V=Math.sqrt(+G),V==0||V==1/0){if(Z=v$(W),(Z.length+K)%2==0)Z+="0";if(V=Math.sqrt(Z),K=n$((K+1)/2)-(K<0||K%2),V==1/0)Z="5e"+K;else Z=V.toExponential(),Z=Z.slice(0,Z.indexOf("e")+1)+K;Y=new U(Z)}else Y=new U(V.toString());J=(K=U.precision)+3;for(;;)if(Q=Y,Y=Q.plus(h1(G,Q,J+2,1)).times(0.5),v$(Q.d).slice(0,J)===(Z=v$(Y.d)).slice(0,J))if(Z=Z.slice(J-3,J+1),Z=="9999"||!X&&Z=="4999"){if(!X){if(I0(Q,K+1,0),Q.times(Q).eq(G)){Y=Q;break}}J+=4,X=1}else{if(!+Z||!+Z.slice(1)&&Z.charAt(0)=="5")I0(Y,K+1,1),$=!Y.times(Y).eq(G);break}return i0=!0,I0(Y,K,U.rounding,$)};X0.tangent=X0.tan=function(){var $,Z,J=this,Y=J.constructor;if(!J.isFinite())return new Y(NaN);if(J.isZero())return new Y(J);return $=Y.precision,Z=Y.rounding,Y.precision=$+10,Y.rounding=1,J=J.sin(),J.s=1,J=h1(J,new Y(1).minus(J.times(J)).sqrt(),$+10,0),Y.precision=$,Y.rounding=Z,I0(qZ==2||qZ==4?J.neg():J,$,Z,!0)};X0.times=X0.mul=function($){var Z,J,Y,X,Q,G,W,K,V,U=this,H=U.constructor,B=U.d,z=($=new H($)).d;if($.s*=U.s,!B||!B[0]||!z||!z[0])return new H(!$.s||B&&!B[0]&&!z||z&&!z[0]&&!B?NaN:!B||!z?$.s/0:$.s*0);if(J=n$(U.e/x0)+n$($.e/x0),K=B.length,V=z.length,K<V)Q=B,B=z,z=Q,G=K,K=V,V=G;Q=[],G=K+V;for(Y=G;Y--;)Q.push(0);for(Y=V;--Y>=0;){Z=0;for(X=K+Y;X>Y;)W=Q[X]+z[Y]*B[X-Y-1]+Z,Q[X--]=W%B6|0,Z=W/B6|0;Q[X]=(Q[X]+Z)%B6|0}for(;!Q[--G];)Q.pop();if(Z)++J;else Q.shift();return $.d=Q,$.e=dK(Q,J),i0?I0($,H.precision,H.rounding):$};X0.toBinary=function($,Z){return cA(this,2,$,Z)};X0.toDecimalPlaces=X0.toDP=function($,Z){var J=this,Y=J.constructor;if(J=new Y(J),$===void 0)return J;if(F8($,0,H5),Z===void 0)Z=Y.rounding;else F8(Z,0,8);return I0(J,$+J.e+1,Z)};X0.toExponential=function($,Z){var J,Y=this,X=Y.constructor;if($===void 0)J=x6(Y,!0);else{if(F8($,0,H5),Z===void 0)Z=X.rounding;else F8(Z,0,8);Y=I0(new X(Y),$+1,Z),J=x6(Y,!0,$+1)}return Y.isNeg()&&!Y.isZero()?"-"+J:J};X0.toFixed=function($,Z){var J,Y,X=this,Q=X.constructor;if($===void 0)J=x6(X);else{if(F8($,0,H5),Z===void 0)Z=Q.rounding;else F8(Z,0,8);Y=I0(new Q(X),$+X.e+1,Z),J=x6(Y,!1,$+Y.e+1)}return X.isNeg()&&!X.isZero()?"-"+J:J};X0.toFraction=function($){var Z,J,Y,X,Q,G,W,K,V,U,H,B,z=this,F=z.d,A=z.constructor;if(!F)return new A(z);if(V=J=new A(1),Y=K=new A(0),Z=new A(Y),Q=Z.e=Bd(F)-z.e-1,G=Q%x0,Z.d[0]=q$(10,G<0?x0+G:G),$==null)$=Q>0?Z:V;else{if(W=new A($),!W.isInt()||W.lt(V))throw Error(U5+W);$=W.gt(Z)?Q>0?Z:V:W}i0=!1,W=new A(v$(F)),U=A.precision,A.precision=Q=F.length*x0*2;for(;;){if(H=h1(W,Z,0,1,1),X=J.plus(H.times(Y)),X.cmp($)==1)break;J=Y,Y=X,X=V,V=K.plus(H.times(X)),K=X,X=Z,Z=W.minus(H.times(X)),W=X}return X=h1($.minus(J),Y,0,1,1),K=K.plus(X.times(V)),J=J.plus(X.times(Y)),K.s=V.s=z.s,B=h1(V,Y,Q,1).minus(z).abs().cmp(h1(K,J,Q,1).minus(z).abs())<1?[V,Y]:[K,J],A.precision=U,i0=!0,B};X0.toHexadecimal=X0.toHex=function($,Z){return cA(this,16,$,Z)};X0.toNearest=function($,Z){var J=this,Y=J.constructor;if(J=new Y(J),$==null){if(!J.d)return J;$=new Y(1),Z=Y.rounding}else{if($=new Y($),Z===void 0)Z=Y.rounding;else F8(Z,0,8);if(!J.d)return $.s?J:$;if(!$.d){if($.s)$.s=J.s;return $}}if($.d[0])i0=!1,J=h1(J,$,0,Z,1).times($),i0=!0,I0(J);else $.s=J.s,J=$;return J};X0.toNumber=function(){return+this};X0.toOctal=function($,Z){return cA(this,8,$,Z)};X0.toPower=X0.pow=function($){var Z,J,Y,X,Q,G,W=this,K=W.constructor,V=+($=new K($));if(!W.d||!$.d||!W.d[0]||!$.d[0])return new K(q$(+W,V));if(W=new K(W),W.eq(1))return W;if(Y=K.precision,Q=K.rounding,$.eq(1))return I0(W,Y,Q);if(Z=n$($.e/x0),Z>=$.d.length-1&&(J=V<0?-V:V)<=yN0)return X=zd(K,W,J,Y),$.s<0?new K(1).div(X):I0(X,Y,Q);if(G=W.s,G<0){if(Z<$.d.length-1)return new K(NaN);if(($.d[Z]&1)==0)G=1;if(W.e==0&&W.d[0]==1&&W.d.length==1)return W.s=G,W}if(J=q$(+W,V),Z=J==0||!isFinite(J)?n$(V*(Math.log("0."+v$(W.d))/Math.LN10+W.e+1)):new K(J+"").e,Z>K.maxE+1||Z<K.minE-1)return new K(Z>0?G/0:0);if(i0=!1,K.rounding=W.s=1,J=Math.min(12,(Z+"").length),X=pA($.times(V5(W,Y+J)),Y),X.d){if(X=I0(X,Y+5,1),V9(X.d,Y,Q)){if(Z=Y+10,X=I0(pA($.times(V5(W,Z+J)),Z),Z+5,1),+v$(X.d).slice(Y+1,Y+15)+1==100000000000000)X=I0(X,Y+1,0)}}return X.s=G,i0=!0,K.rounding=Q,I0(X,Y,Q)};X0.toPrecision=function($,Z){var J,Y=this,X=Y.constructor;if($===void 0)J=x6(Y,Y.e<=X.toExpNeg||Y.e>=X.toExpPos);else{if(F8($,1,H5),Z===void 0)Z=X.rounding;else F8(Z,0,8);Y=I0(new X(Y),$,Z),J=x6(Y,$<=Y.e||Y.e<=X.toExpNeg,$)}return Y.isNeg()&&!Y.isZero()?"-"+J:J};X0.toSignificantDigits=X0.toSD=function($,Z){var J=this,Y=J.constructor;if($===void 0)$=Y.precision,Z=Y.rounding;else if(F8($,1,H5),Z===void 0)Z=Y.rounding;else F8(Z,0,8);return I0(new Y(J),$,Z)};X0.toString=function(){var $=this,Z=$.constructor,J=x6($,$.e<=Z.toExpNeg||$.e>=Z.toExpPos);return $.isNeg()&&!$.isZero()?"-"+J:J};X0.truncated=X0.trunc=function(){return I0(new this.constructor(this),this.e+1,1)};X0.valueOf=X0.toJSON=function(){var $=this,Z=$.constructor,J=x6($,$.e<=Z.toExpNeg||$.e>=Z.toExpPos);return $.isNeg()?"-"+J:J};function v$($){var Z,J,Y,X=$.length-1,Q="",G=$[0];if(X>0){Q+=G;for(Z=1;Z<X;Z++){if(Y=$[Z]+"",J=x0-Y.length,J)Q+=K5(J);Q+=Y}if(G=$[Z],Y=G+"",J=x0-Y.length,J)Q+=K5(J)}else if(G===0)return"0";for(;G%10===0;)G/=10;return Q+G}function F8($,Z,J){if($!==~~$||$<Z||$>J)throw Error(U5+$)}function V9($,Z,J,Y){var X,Q,G,W;for(Q=$[0];Q>=10;Q/=10)--Z;if(--Z<0)Z+=x0,X=0;else X=Math.ceil((Z+1)/x0),Z%=x0;if(Q=q$(10,x0-Z),W=$[X]%Q|0,Y==null)if(Z<3){if(Z==0)W=W/100|0;else if(Z==1)W=W/10|0;G=J<4&&W==99999||J>3&&W==49999||W==50000||W==0}else G=(J<4&&W+1==Q||J>3&&W+1==Q/2)&&($[X+1]/Q/100|0)==q$(10,Z-2)-1||(W==Q/2||W==0)&&($[X+1]/Q/100|0)==0;else if(Z<4){if(Z==0)W=W/1000|0;else if(Z==1)W=W/100|0;else if(Z==2)W=W/10|0;G=(Y||J<4)&&W==9999||!Y&&J>3&&W==4999}else G=((Y||J<4)&&W+1==Q||!Y&&J>3&&W+1==Q/2)&&($[X+1]/Q/1000|0)==q$(10,Z-3)-1;return G}function xK($,Z,J){var Y,X=[0],Q,G=0,W=$.length;for(;G<W;){for(Q=X.length;Q--;)X[Q]*=Z;X[0]+=mA.indexOf($.charAt(G++));for(Y=0;Y<X.length;Y++)if(X[Y]>J-1){if(X[Y+1]===void 0)X[Y+1]=0;X[Y+1]+=X[Y]/J|0,X[Y]%=J}}return X.reverse()}function hN0($,Z){var J,Y,X;if(Z.isZero())return Z;if(Y=Z.d.length,Y<32)J=Math.ceil(Y/3),X=(1/pK(4,J)).toString();else J=16,X="2.3283064365386962890625e-10";$.precision+=J,Z=FY($,1,Z.times(X),new $(1));for(var Q=J;Q--;){var G=Z.times(Z);Z=G.times(G).minus(G).times(8).plus(1)}return $.precision-=J,Z}var h1=function(){function $(Y,X,Q){var G,W=0,K=Y.length;for(Y=Y.slice();K--;)G=Y[K]*X+W,Y[K]=G%Q|0,W=G/Q|0;if(W)Y.unshift(W);return Y}function Z(Y,X,Q,G){var W,K;if(Q!=G)K=Q>G?1:-1;else for(W=K=0;W<Q;W++)if(Y[W]!=X[W]){K=Y[W]>X[W]?1:-1;break}return K}function J(Y,X,Q,G){var W=0;for(;Q--;)Y[Q]-=W,W=Y[Q]<X[Q]?1:0,Y[Q]=W*G+Y[Q]-X[Q];for(;!Y[0]&&Y.length>1;)Y.shift()}return function(Y,X,Q,G,W,K){var V,U,H,B,z,F,A,j,N,w,q,M,C,R,T,I,_,E,f,b,y=Y.constructor,k=Y.s==X.s?1:-1,g=Y.d,d=X.d;if(!g||!g[0]||!d||!d[0])return new y(!Y.s||!X.s||(g?d&&g[0]==d[0]:!d)?NaN:g&&g[0]==0||!d?k*0:k/0);if(K)z=1,U=Y.e-X.e;else K=B6,z=x0,U=n$(Y.e/z)-n$(X.e/z);f=d.length,_=g.length,N=new y(k),w=N.d=[];for(H=0;d[H]==(g[H]||0);H++);if(d[H]>(g[H]||0))U--;if(Q==null)R=Q=y.precision,G=y.rounding;else if(W)R=Q+(Y.e-X.e)+1;else R=Q;if(R<0)w.push(1),F=!0;else{if(R=R/z+2|0,H=0,f==1){B=0,d=d[0],R++;for(;(H<_||B)&&R--;H++)T=B*K+(g[H]||0),w[H]=T/d|0,B=T%d|0;F=B||H<_}else{if(B=K/(d[0]+1)|0,B>1)d=$(d,B,K),g=$(g,B,K),f=d.length,_=g.length;I=f,q=g.slice(0,f),M=q.length;for(;M<f;)q[M++]=0;if(b=d.slice(),b.unshift(0),E=d[0],d[1]>=K/2)++E;do{if(B=0,V=Z(d,q,f,M),V<0){if(C=q[0],f!=M)C=C*K+(q[1]||0);if(B=C/E|0,B>1){if(B>=K)B=K-1;if(A=$(d,B,K),j=A.length,M=q.length,V=Z(A,q,j,M),V==1)B--,J(A,f<j?b:d,j,K)}else{if(B==0)V=B=1;A=d.slice()}if(j=A.length,j<M)A.unshift(0);if(J(q,A,M,K),V==-1){if(M=q.length,V=Z(d,q,f,M),V<1)B++,J(q,f<M?b:d,M,K)}M=q.length}else if(V===0)B++,q=[0];if(w[H++]=B,V&&q[0])q[M++]=g[I]||0;else q=[g[I]],M=1}while((I++<_||q[0]!==void 0)&&R--);F=q[0]!==void 0}if(!w[0])w.shift()}if(z==1)N.e=U,Wd=F;else{for(H=1,B=w[0];B>=10;B/=10)H++;N.e=H+U*z-1,I0(N,W?Q+N.e+1:Q,G,F)}return N}}();function I0($,Z,J,Y){var X,Q,G,W,K,V,U,H,B,z=$.constructor;$:if(Z!=null){if(H=$.d,!H)return $;for(X=1,W=H[0];W>=10;W/=10)X++;if(Q=Z-X,Q<0)Q+=x0,G=Z,U=H[B=0],K=U/q$(10,X-G-1)%10|0;else if(B=Math.ceil((Q+1)/x0),W=H.length,B>=W)if(Y){for(;W++<=B;)H.push(0);U=K=0,X=1,Q%=x0,G=Q-x0+1}else break $;else{U=W=H[B];for(X=1;W>=10;W/=10)X++;Q%=x0,G=Q-x0+X,K=G<0?0:U/q$(10,X-G-1)%10|0}if(Y=Y||Z<0||H[B+1]!==void 0||(G<0?U:U%q$(10,X-G-1)),V=J<4?(K||Y)&&(J==0||J==($.s<0?3:2)):K>5||K==5&&(J==4||Y||J==6&&(Q>0?G>0?U/q$(10,X-G):0:H[B-1])%10&1||J==($.s<0?8:7)),Z<1||!H[0]){if(H.length=0,V)Z-=$.e+1,H[0]=q$(10,(x0-Z%x0)%x0),$.e=-Z||0;else H[0]=$.e=0;return $}if(Q==0)H.length=B,W=1,B--;else H.length=B+1,W=q$(10,x0-Q),H[B]=G>0?(U/q$(10,X-G)%q$(10,G)|0)*W:0;if(V)for(;;)if(B==0){for(Q=1,G=H[0];G>=10;G/=10)Q++;G=H[0]+=W;for(W=1;G>=10;G/=10)W++;if(Q!=W){if($.e++,H[0]==B6)H[0]=1}break}else{if(H[B]+=W,H[B]!=B6)break;H[B--]=0,W=1}for(Q=H.length;H[--Q]===0;)H.pop()}if(i0){if($.e>z.maxE)$.d=null,$.e=NaN;else if($.e<z.minE)$.e=0,$.d=[0]}return $}function x6($,Z,J){if(!$.isFinite())return Ad($);var Y,X=$.e,Q=v$($.d),G=Q.length;if(Z){if(J&&(Y=J-G)>0)Q=Q.charAt(0)+"."+Q.slice(1)+K5(Y);else if(G>1)Q=Q.charAt(0)+"."+Q.slice(1);Q=Q+($.e<0?"e":"e+")+$.e}else if(X<0){if(Q="0."+K5(-X-1)+Q,J&&(Y=J-G)>0)Q+=K5(Y)}else if(X>=G){if(Q+=K5(X+1-G),J&&(Y=J-X-1)>0)Q=Q+"."+K5(Y)}else{if((Y=X+1)<G)Q=Q.slice(0,Y)+"."+Q.slice(Y);if(J&&(Y=J-G)>0){if(X+1===G)Q+=".";Q+=K5(Y)}}return Q}function dK($,Z){var J=$[0];for(Z*=x0;J>=10;J/=10)Z++;return Z}function mK($,Z,J){if(Z>xN0){if(i0=!0,J)$.precision=J;throw Error(Kd)}return I0(new $(gK),Z,1,!0)}function y6($,Z,J){if(Z>dA)throw Error(Kd);return I0(new $(uK),Z,J,!0)}function Bd($){var Z=$.length-1,J=Z*x0+1;if(Z=$[Z],Z){for(;Z%10==0;Z/=10)J--;for(Z=$[0];Z>=10;Z/=10)J++}return J}function K5($){var Z="";for(;$--;)Z+="0";return Z}function zd($,Z,J,Y){var X,Q=new $(1),G=Math.ceil(Y/x0+4);i0=!1;for(;;){if(J%2){if(Q=Q.times(Z),Qd(Q.d,G))X=!0}if(J=n$(J/2),J===0){if(J=Q.d.length-1,X&&Q.d[J]===0)++Q.d[J];break}Z=Z.times(Z),Qd(Z.d,G)}return i0=!0,Q}function Xd($){return $.d[$.d.length-1]&1}function Fd($,Z,J){var Y,X,Q=new $(Z[0]),G=0;for(;++G<Z.length;){if(X=new $(Z[G]),!X.s){Q=X;break}if(Y=Q.cmp(X),Y===J||Y===0&&Q.s===J)Q=X}return Q}function pA($,Z){var J,Y,X,Q,G,W,K,V=0,U=0,H=0,B=$.constructor,z=B.rounding,F=B.precision;if(!$.d||!$.d[0]||$.e>17)return new B($.d?!$.d[0]?1:$.s<0?0:1/0:$.s?$.s<0?0:$:NaN);if(Z==null)i0=!1,K=F;else K=Z;W=new B(0.03125);while($.e>-2)$=$.times(W),H+=5;Y=Math.log(q$(2,H))/Math.LN10*2+5|0,K+=Y,J=Q=G=new B(1),B.precision=K;for(;;){if(Q=I0(Q.times($),K,1),J=J.times(++U),W=G.plus(h1(Q,J,K,1)),v$(W.d).slice(0,K)===v$(G.d).slice(0,K)){X=H;while(X--)G=I0(G.times(G),K,1);if(Z==null)if(V<3&&V9(G.d,K-Y,z,V))B.precision=K+=10,J=Q=W=new B(1),U=0,V++;else return I0(G,B.precision=F,z,i0=!0);else return B.precision=F,G}G=W}}function V5($,Z){var J,Y,X,Q,G,W,K,V,U,H,B,z=1,F=10,A=$,j=A.d,N=A.constructor,w=N.rounding,q=N.precision;if(A.s<0||!j||!j[0]||!A.e&&j[0]==1&&j.length==1)return new N(j&&!j[0]?-1/0:A.s!=1?NaN:j?0:A);if(Z==null)i0=!1,U=q;else U=Z;if(N.precision=U+=F,J=v$(j),Y=J.charAt(0),Math.abs(Q=A.e)<1500000000000000){while(Y<7&&Y!=1||Y==1&&J.charAt(1)>3)A=A.times($),J=v$(A.d),Y=J.charAt(0),z++;if(Q=A.e,Y>1)A=new N("0."+J),Q++;else A=new N(Y+"."+J.slice(1))}else return V=mK(N,U+2,q).times(Q+""),A=V5(new N(Y+"."+J.slice(1)),U-F).plus(V),N.precision=q,Z==null?I0(A,q,w,i0=!0):A;H=A,K=G=A=h1(A.minus(1),A.plus(1),U,1),B=I0(A.times(A),U,1),X=3;for(;;){if(G=I0(G.times(B),U,1),V=K.plus(h1(G,new N(X),U,1)),v$(V.d).slice(0,U)===v$(K.d).slice(0,U)){if(K=K.times(2),Q!==0)K=K.plus(mK(N,U+2,q).times(Q+""));if(K=h1(K,new N(z),U,1),Z==null)if(V9(K.d,U-F,w,W))N.precision=U+=F,V=G=A=h1(H.minus(1),H.plus(1),U,1),B=I0(A.times(A),U,1),X=W=1;else return I0(K,N.precision=q,w,i0=!0);else return N.precision=q,K}K=V,X+=2}}function Ad($){return String($.s*$.s/0)}function hK($,Z){var J,Y,X;if((J=Z.indexOf("."))>-1)Z=Z.replace(".","");if((Y=Z.search(/e/i))>0){if(J<0)J=Y;J+=+Z.slice(Y+1),Z=Z.substring(0,Y)}else if(J<0)J=Z.length;for(Y=0;Z.charCodeAt(Y)===48;Y++);for(X=Z.length;Z.charCodeAt(X-1)===48;--X);if(Z=Z.slice(Y,X),Z){if(X-=Y,$.e=J=J-Y-1,$.d=[],Y=(J+1)%x0,J<0)Y+=x0;if(Y<X){if(Y)$.d.push(+Z.slice(0,Y));for(X-=x0;Y<X;)$.d.push(+Z.slice(Y,Y+=x0));Z=Z.slice(Y),Y=x0-Z.length}else Y-=X;for(;Y--;)Z+="0";if($.d.push(+Z),i0){if($.e>$.constructor.maxE)$.d=null,$.e=NaN;else if($.e<$.constructor.minE)$.e=0,$.d=[0]}}else $.e=0,$.d=[0];return $}function gN0($,Z){var J,Y,X,Q,G,W,K,V,U;if(Z.indexOf("_")>-1){if(Z=Z.replace(/(\d)_(?=\d)/g,"$1"),Hd.test(Z))return hK($,Z)}else if(Z==="Infinity"||Z==="NaN"){if(!+Z)$.s=NaN;return $.e=NaN,$.d=null,$}if(kN0.test(Z))J=16,Z=Z.toLowerCase();else if(fN0.test(Z))J=2;else if(vN0.test(Z))J=8;else throw Error(U5+Z);if(Q=Z.search(/p/i),Q>0)K=+Z.slice(Q+1),Z=Z.substring(2,Q);else Z=Z.slice(2);if(Q=Z.indexOf("."),G=Q>=0,Y=$.constructor,G)Z=Z.replace(".",""),W=Z.length,Q=W-Q,X=zd(Y,new Y(J),Q,Q*2);V=xK(Z,J,B6),U=V.length-1;for(Q=U;V[Q]===0;--Q)V.pop();if(Q<0)return new Y($.s*0);if($.e=dK(V,U),$.d=V,i0=!1,G)$=h1($,X,W*4);if(K)$=$.times(Math.abs(K)<54?q$(2,K):z6.pow(2,K));return i0=!0,$}function uN0($,Z){var J,Y=Z.d.length;if(Y<3)return Z.isZero()?Z:FY($,2,Z,Z);J=1.4*Math.sqrt(Y),J=J>16?16:J|0,Z=Z.times(1/pK(5,J)),Z=FY($,2,Z,Z);var X,Q=new $(5),G=new $(16),W=new $(20);for(;J--;)X=Z.times(Z),Z=Z.times(Q.plus(X.times(G.times(X).minus(W))));return Z}function FY($,Z,J,Y,X){var Q,G,W,K,V=1,U=$.precision,H=Math.ceil(U/x0);i0=!1,K=J.times(J),W=new $(Y);for(;;){if(G=h1(W.times(K),new $(Z++*Z++),U,1),W=X?Y.plus(G):Y.minus(G),Y=h1(G.times(K),new $(Z++*Z++),U,1),G=W.plus(Y),G.d[H]!==void 0){for(Q=H;G.d[Q]===W.d[Q]&&Q--;);if(Q==-1)break}Q=W,W=Y,Y=G,G=Q,V++}return i0=!0,G.d.length=H+1,G}function pK($,Z){var J=$;while(--Z)J*=$;return J}function Od($,Z){var J,Y=Z.s<0,X=y6($,$.precision,1),Q=X.times(0.5);if(Z=Z.abs(),Z.lte(Q))return qZ=Y?4:1,Z;if(J=Z.divToInt(X),J.isZero())qZ=Y?3:2;else{if(Z=Z.minus(J.times(X)),Z.lte(Q))return qZ=Xd(J)?Y?2:3:Y?4:1,Z;qZ=Xd(J)?Y?1:4:Y?3:2}return Z.minus(X).abs()}function cA($,Z,J,Y){var X,Q,G,W,K,V,U,H,B,z=$.constructor,F=J!==void 0;if(F)if(F8(J,1,H5),Y===void 0)Y=z.rounding;else F8(Y,0,8);else J=z.precision,Y=z.rounding;if(!$.isFinite())U=Ad($);else{if(U=x6($),G=U.indexOf("."),F){if(X=2,Z==16)J=J*4-3;else if(Z==8)J=J*3-2}else X=Z;if(G>=0)U=U.replace(".",""),B=new z(1),B.e=U.length-G,B.d=xK(x6(B),10,X),B.e=B.d.length;H=xK(U,10,X),Q=K=H.length;for(;H[--K]==0;)H.pop();if(!H[0])U=F?"0p+0":"0";else{if(G<0)Q--;else $=new z($),$.d=H,$.e=Q,$=h1($,B,J,Y,0,X),H=$.d,Q=$.e,V=Wd;if(G=H[J],W=X/2,V=V||H[J+1]!==void 0,V=Y<4?(G!==void 0||V)&&(Y===0||Y===($.s<0?3:2)):G>W||G===W&&(Y===4||V||Y===6&&H[J-1]&1||Y===($.s<0?8:7)),H.length=J,V){for(;++H[--J]>X-1;)if(H[J]=0,!J)++Q,H.unshift(1)}for(K=H.length;!H[K-1];--K);for(G=0,U="";G<K;G++)U+=mA.charAt(H[G]);if(F){if(K>1)if(Z==16||Z==8){G=Z==16?4:3;for(--K;K%G;K++)U+="0";H=xK(U,X,Z);for(K=H.length;!H[K-1];--K);for(G=1,U="1.";G<K;G++)U+=mA.charAt(H[G])}else U=U.charAt(0)+"."+U.slice(1);U=U+(Q<0?"p":"p+")+Q}else if(Q<0){for(;++Q;)U="0"+U;U="0."+U}else if(++Q>K)for(Q-=K;Q--;)U+="0";else if(Q<K)U=U.slice(0,Q)+"."+U.slice(Q)}U=(Z==16?"0x":Z==2?"0b":Z==8?"0o":"")+U}return $.s<0?"-"+U:U}function Qd($,Z){if($.length>Z)return $.length=Z,!0}function mN0($){return new this($).abs()}function lN0($){return new this($).acos()}function dN0($){return new this($).acosh()}function pN0($,Z){return new this($).plus(Z)}function cN0($){return new this($).asin()}function iN0($){return new this($).asinh()}function nN0($){return new this($).atan()}function oN0($){return new this($).atanh()}function sN0($,Z){$=new this($),Z=new this(Z);var J,Y=this.precision,X=this.rounding,Q=Y+4;if(!$.s||!Z.s)J=new this(NaN);else if(!$.d&&!Z.d)J=y6(this,Q,1).times(Z.s>0?0.25:0.75),J.s=$.s;else if(!Z.d||$.isZero())J=Z.s<0?y6(this,Y,X):new this(0),J.s=$.s;else if(!$.d||Z.isZero())J=y6(this,Q,1).times(0.5),J.s=$.s;else if(Z.s<0)this.precision=Q,this.rounding=1,J=this.atan(h1($,Z,Q,1)),Z=y6(this,Q,1),this.precision=Y,this.rounding=X,J=$.s<0?J.minus(Z):J.plus(Z);else J=this.atan(h1($,Z,Q,1));return J}function rN0($){return new this($).cbrt()}function aN0($){return I0($=new this($),$.e+1,2)}function tN0($,Z,J){return new this($).clamp(Z,J)}function eN0($){if(!$||typeof $!=="object")throw Error(lK+"Object expected");var Z,J,Y,X=$.defaults===!0,Q=["precision",1,H5,"rounding",0,8,"toExpNeg",-zY,0,"toExpPos",0,zY,"maxE",0,zY,"minE",-zY,0,"modulo",0,9];for(Z=0;Z<Q.length;Z+=3){if(J=Q[Z],X)this[J]=lA[J];if((Y=$[J])!==void 0)if(n$(Y)===Y&&Y>=Q[Z+1]&&Y<=Q[Z+2])this[J]=Y;else throw Error(U5+J+": "+Y)}if(J="crypto",X)this[J]=lA[J];if((Y=$[J])!==void 0)if(Y===!0||Y===!1||Y===0||Y===1)if(Y)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[J]=!0;else throw Error(Vd);else this[J]=!1;else throw Error(U5+J+": "+Y);return this}function $M0($){return new this($).cos()}function ZM0($){return new this($).cosh()}function qd($){var Z,J,Y;function X(Q){var G,W,K,V=this;if(!(V instanceof X))return new X(Q);if(V.constructor=X,Gd(Q)){if(V.s=Q.s,i0)if(!Q.d||Q.e>X.maxE)V.e=NaN,V.d=null;else if(Q.e<X.minE)V.e=0,V.d=[0];else V.e=Q.e,V.d=Q.d.slice();else V.e=Q.e,V.d=Q.d?Q.d.slice():Q.d;return}if(K=typeof Q,K==="number"){if(Q===0){V.s=1/Q<0?-1:1,V.e=0,V.d=[0];return}if(Q<0)Q=-Q,V.s=-1;else V.s=1;if(Q===~~Q&&Q<1e7){for(G=0,W=Q;W>=10;W/=10)G++;if(i0)if(G>X.maxE)V.e=NaN,V.d=null;else if(G<X.minE)V.e=0,V.d=[0];else V.e=G,V.d=[Q];else V.e=G,V.d=[Q];return}if(Q*0!==0){if(!Q)V.s=NaN;V.e=NaN,V.d=null;return}return hK(V,Q.toString())}if(K==="string"){if((W=Q.charCodeAt(0))===45)Q=Q.slice(1),V.s=-1;else{if(W===43)Q=Q.slice(1);V.s=1}return Hd.test(Q)?hK(V,Q):gN0(V,Q)}if(K==="bigint"){if(Q<0)Q=-Q,V.s=-1;else V.s=1;return hK(V,Q.toString())}throw Error(U5+Q)}if(X.prototype=X0,X.ROUND_UP=0,X.ROUND_DOWN=1,X.ROUND_CEIL=2,X.ROUND_FLOOR=3,X.ROUND_HALF_UP=4,X.ROUND_HALF_DOWN=5,X.ROUND_HALF_EVEN=6,X.ROUND_HALF_CEIL=7,X.ROUND_HALF_FLOOR=8,X.EUCLID=9,X.config=X.set=eN0,X.clone=qd,X.isDecimal=Gd,X.abs=mN0,X.acos=lN0,X.acosh=dN0,X.add=pN0,X.asin=cN0,X.asinh=iN0,X.atan=nN0,X.atanh=oN0,X.atan2=sN0,X.cbrt=rN0,X.ceil=aN0,X.clamp=tN0,X.cos=$M0,X.cosh=ZM0,X.div=JM0,X.exp=YM0,X.floor=XM0,X.hypot=QM0,X.ln=GM0,X.log=WM0,X.log10=VM0,X.log2=KM0,X.max=UM0,X.min=HM0,X.mod=BM0,X.mul=zM0,X.pow=FM0,X.random=AM0,X.round=OM0,X.sign=qM0,X.sin=jM0,X.sinh=NM0,X.sqrt=MM0,X.sub=DM0,X.sum=wM0,X.tan=LM0,X.tanh=TM0,X.trunc=RM0,$===void 0)$={};if($){if($.defaults!==!0){Y=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"];for(Z=0;Z<Y.length;)if(!$.hasOwnProperty(J=Y[Z++]))$[J]=this[J]}}return X.config($),X}function JM0($,Z){return new this($).div(Z)}function YM0($){return new this($).exp()}function XM0($){return I0($=new this($),$.e+1,3)}function QM0(){var $,Z,J=new this(0);i0=!1;for($=0;$<arguments.length;)if(Z=new this(arguments[$++]),!Z.d){if(Z.s)return i0=!0,new this(1/0);J=Z}else if(J.d)J=J.plus(Z.times(Z));return i0=!0,J.sqrt()}function Gd($){return $ instanceof z6||$&&$.toStringTag===Ud||!1}function GM0($){return new this($).ln()}function WM0($,Z){return new this($).log(Z)}function KM0($){return new this($).log(2)}function VM0($){return new this($).log(10)}function UM0(){return Fd(this,arguments,-1)}function HM0(){return Fd(this,arguments,1)}function BM0($,Z){return new this($).mod(Z)}function zM0($,Z){return new this($).mul(Z)}function FM0($,Z){return new this($).pow(Z)}function AM0($){var Z,J,Y,X,Q=0,G=new this(1),W=[];if($===void 0)$=this.precision;else F8($,1,H5);if(Y=Math.ceil($/x0),!this.crypto)for(;Q<Y;)W[Q++]=Math.random()*1e7|0;else if(crypto.getRandomValues){Z=crypto.getRandomValues(new Uint32Array(Y));for(;Q<Y;)if(X=Z[Q],X>=4290000000)Z[Q]=crypto.getRandomValues(new Uint32Array(1))[0];else W[Q++]=X%1e7}else if(crypto.randomBytes){Z=crypto.randomBytes(Y*=4);for(;Q<Y;)if(X=Z[Q]+(Z[Q+1]<<8)+(Z[Q+2]<<16)+((Z[Q+3]&127)<<24),X>=2140000000)crypto.randomBytes(4).copy(Z,Q);else W.push(X%1e7),Q+=4;Q=Y/4}else throw Error(Vd);if(Y=W[--Q],$%=x0,Y&&$)X=q$(10,x0-$),W[Q]=(Y/X|0)*X;for(;W[Q]===0;Q--)W.pop();if(Q<0)J=0,W=[0];else{J=-1;for(;W[0]===0;J-=x0)W.shift();for(Y=1,X=W[0];X>=10;X/=10)Y++;if(Y<x0)J-=x0-Y}return G.e=J,G.d=W,G}function OM0($){return I0($=new this($),$.e+1,this.rounding)}function qM0($){return $=new this($),$.d?$.d[0]?$.s:0*$.s:$.s||NaN}function jM0($){return new this($).sin()}function NM0($){return new this($).sinh()}function MM0($){return new this($).sqrt()}function DM0($,Z){return new this($).sub(Z)}function wM0(){var $=0,Z=arguments,J=new this(Z[$]);i0=!1;for(;J.s&&++$<Z.length;)J=J.plus(Z[$]);return i0=!0,I0(J,this.precision,this.rounding)}function LM0($){return new this($).tan()}function TM0($){return new this($).tanh()}function RM0($){return I0($=new this($),$.e+1,1)}X0[Symbol.for("nodejs.util.inspect.custom")]=X0.toString;X0[Symbol.toStringTag]="Decimal";var z6=X0.constructor=qd(lA);gK=new z6(gK);uK=new z6(uK);var PM0=O.String.annotate({[F$]:d1.schema("workspace")}).pipe(O.brand("WorkspaceID")),iA=PM0.pipe(u0(($)=>({ascending:(Z)=>$.make(d1.ascending("workspace",Z)),zod:d1.schema("workspace").pipe(P.custom())})));function cK($){let Z={};for(let[J,Y]of Object.entries($.required().shape))Z[J]=Y.nullable();return P.object(Z)}var jd=E0.create({service:"session.usage"});function IM0($){return/^(New session - |Child session - )\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test($)}function OY($){let Z=$.summary_additions!==null||$.summary_deletions!==null||$.summary_files!==null?{additions:$.summary_additions??0,deletions:$.summary_deletions??0,files:$.summary_files??0,diffs:$.summary_diffs??void 0}:void 0,J=$.share_url?{url:$.share_url}:void 0,Y=$.revert??void 0;return{id:$.id,slug:$.slug,projectID:$.project_id,workspaceID:$.workspace_id??void 0,directory:$.directory,parentID:$.parent_id??void 0,contextFrom:$.context_from??void 0,contextWatermark:$.context_watermark??void 0,title:$.title,version:$.version,summary:Z,share:J,revert:Y,permission:$.permission??void 0,time:{created:$.time_created,updated:$.time_updated,compacting:$.time_compacting??void 0,archived:$.time_archived??void 0}}}function CM0($){return{id:$.id,project_id:$.projectID,workspace_id:$.workspaceID,parent_id:$.parentID,context_from:$.contextFrom,context_watermark:$.contextWatermark,slug:$.slug,directory:$.directory,title:$.title,version:$.version,share_url:$.share?.url,summary_additions:$.summary?.additions,summary_deletions:$.summary?.deletions,summary_files:$.summary?.files,summary_diffs:$.summary?.diffs,revert:$.revert??null,permission:$.permission,time_created:$.time.created,time_updated:$.time.updated,time_compacting:$.time.compacting,time_archived:$.time.archived}}var F6=P.object({id:r0.zod,slug:P.string(),projectID:$9.zod,workspaceID:iA.zod.optional(),directory:P.string(),parentID:r0.zod.optional(),contextFrom:r0.zod.optional(),contextWatermark:i1.zod.optional(),summary:P.object({additions:P.number(),deletions:P.number(),files:P.number(),diffs:vZ.FileDiff.array().optional()}).optional(),share:P.object({url:P.string()}).optional(),title:P.string(),version:P.string(),time:P.object({created:P.number(),updated:P.number(),compacting:P.number().optional(),archived:P.number().optional()}),permission:Q5.Ruleset.zod.optional(),revert:P.object({messageID:i1.zod,partID:MZ.zod.optional(),snapshot:P.string().optional(),diff:P.string().optional()}).optional()}).meta({ref:"Session"}),Nd=P.object({id:$9.zod,name:P.string().optional(),worktree:P.string()}).meta({ref:"ProjectSummary"}),EM0=F6.extend({project:Nd.nullable()}).meta({ref:"GlobalSession"}),bM0=P.object({parentID:r0.zod.optional(),contextFrom:r0.zod.optional(),contextWatermark:i1.zod.optional(),title:P.string().optional(),permission:F6.shape.permission,workspaceID:iA.zod.optional()}).optional(),_M0=P.object({sessionID:r0.zod,messageID:i1.zod.optional()}),SM0=r0.zod,fM0=r0.zod,kM0=r0.zod,vM0=P.object({sessionID:r0.zod,title:P.string()}),yM0=P.object({sessionID:r0.zod,time:P.number().optional()}),xM0=P.object({sessionID:r0.zod,permission:Q5.Ruleset.zod}),hM0=P.object({sessionID:r0.zod,revert:F6.shape.revert,summary:F6.shape.summary}),gM0=P.object({sessionID:r0.zod,limit:P.number().optional()}),qY={Created:X$.define({type:"session.created",version:1,aggregate:"sessionID",schema:P.object({sessionID:r0.zod,info:F6})}),Updated:X$.define({type:"session.updated",version:1,aggregate:"sessionID",schema:P.object({sessionID:r0.zod,info:cK(F6).extend({share:cK(F6.shape.share.unwrap()).optional(),time:cK(F6.shape.time).optional()})}),busSchema:P.object({sessionID:r0.zod,info:F6})}),Deleted:X$.define({type:"session.deleted",version:1,aggregate:"sessionID",schema:P.object({sessionID:r0.zod,info:F6})}),Diff:L1.define("session.diff",P.object({sessionID:r0.zod,diff:vZ.FileDiff.array()})),Error:L1.define("session.error",P.object({sessionID:r0.zod.optional(),error:P.lazy(()=>b$.Assistant.shape.error)})),RetryAttempt:L1.define("session.retry.attempt",P.object({sessionID:r0.zod,messageID:P.string(),attempt:P.number().int().min(1),maxAttempts:P.number().int().min(1),reason:P.string(),nextDelayMs:P.number().int().nonnegative()}))};function uM0($){let Z=S8.project.vcs?nA.join(S8.worktree,".qitqode","plans"):nA.join(F0.Path.data,"plans");return nA.join(Z,[$.time.created,$.slug].join("-")+".md")}var mM0=($)=>{let Z=(j)=>{if(!Number.isFinite(j))return 0;return j},J=Z($.usage.inputTokens??0),Y=Z($.usage.outputTokens??0),X=Z($.usage.outputTokenDetails?.reasoningTokens??$.usage.reasoningTokens??0),Q=Z($.usage.inputTokenDetails?.cacheReadTokens??$.usage.cachedInputTokens??0),G=Z(Number($.usage.inputTokenDetails?.cacheWriteTokens??$.metadata?.anthropic?.cacheCreationInputTokens??$.metadata?.vertex?.cacheCreationInputTokens??$.metadata?.bedrock?.usage?.cacheWriteInputTokens??$.metadata?.venice?.usage?.cacheCreationInputTokens??0)),W=Z(J-Q-G),V={total:$.usage.totalTokens,input:W,output:Z(Y-X),reasoning:X,cache:{write:G,read:Q}},U=$.usage.raw,H=typeof U?.cost_usd==="number"?U.cost_usd:void 0,B=typeof U?.cost_credits==="number"?U.cost_credits:void 0,z=typeof U?.context_window==="number"?U.context_window:void 0;if(H!==void 0){let j={cost:Z(H),costCredits:Z(B??H),tokens:V,contextWindow:z};return jd.info("usage",{provider:$.model.providerID,model:$.model.id,source:"qlex",tokens:V,cost:j.cost,costCredits:j.costCredits}),j}let F=$.model.cost?.experimentalOver200K&&V.input+V.cache.read>200000?$.model.cost.experimentalOver200K:$.model.cost,A=Z(new z6(0).add(new z6(V.input).mul(F?.input??0).div(1e6)).add(new z6(V.output).mul(F?.output??0).div(1e6)).add(new z6(V.cache.read).mul(F?.cache?.read??0).div(1e6)).add(new z6(V.cache.write).mul(F?.cache?.write??0).div(1e6)).add(new z6(V.reasoning).mul(F?.output??0).div(1e6)).toNumber());return jd.info("usage",{provider:$.model.providerID,model:$.model.id,source:"estimated",tokens:V,cost:A}),{cost:A,costCredits:void 0,tokens:V,contextWindow:z}};function*lM0($){let Z=S8.project,J=[m0(I1.project_id,Z.id)];if($?.workspaceID)J.push(m0(I1.workspace_id,$.workspaceID));if(!b0.QITQODE_EXPERIMENTAL_WORKSPACES){if($?.directory)J.push(m0(I1.directory,$.directory))}if($?.roots)J.push(iK(I1.parent_id));if($?.start)J.push(oA(I1.time_updated,$.start));if($?.search)J.push(sA(I1.title,`%${$.search}%`));let Y=$?.limit??100,X=W1.use((Q)=>Q.select().from(I1).where(O$(...J)).orderBy(o6(I1.time_updated)).limit(Y).all());for(let Q of X)yield OY(Q)}function*dM0($){let Z=[];if($?.directory)Z.push(m0(I1.directory,$.directory));if($?.roots)Z.push(iK(I1.parent_id));if($?.start)Z.push(oA(I1.time_updated,$.start));if($?.cursor)Z.push(WX(I1.time_updated,$.cursor));if($?.search)Z.push(sA(I1.title,`%${$.search}%`));if(!$?.archived)Z.push(iK(I1.time_archived));let J=$?.limit??100,Y=W1.use((G)=>{return(Z.length>0?G.select().from(I1).where(O$(...Z)):G.select().from(I1)).orderBy(o6(I1.time_updated),o6(I1.id)).limit(J).all()}),X=[...new Set(Y.map((G)=>G.project_id))],Q=new Map;if(X.length>0){let G=W1.use((W)=>W.select({id:AY.id,name:AY.name,worktree:AY.worktree}).from(AY).where(k5(AY.id,X)).all());for(let W of G)Q.set(W.id,{id:W.id,name:W.name??void 0,worktree:W.worktree})}for(let G of Y){let W=Q.get(G.project_id)??null;yield{...OY(G),project:W}}}var Md=E0.create({service:"session"}),pM0="New session - ",cM0="Child session - ";function iM0($=!1){return($?cM0:pM0)+new Date().toISOString()}function nM0($){let Z=$.match(/^(.+) \(fork #(\d+)\)$/);if(Z){let J=Z[1],Y=parseInt(Z[2],10);return`${J} (fork #${Y+1})`}return`${$} (fork #1)`}class Dd extends Error{sessionID;constructor($){super(`Session ${$} is busy`);this.sessionID=$}}class nK extends S1.Service()("@qitqode/Session"){}var rA=($)=>L.sync(()=>W1.use($)),wd=T0.effect(nK,L.gen(function*(){let $=yield*l1.Service,Z=yield*aA.Service,J=yield*BY.Service,Y=L.fn("Session.createNext")(function*(b){let y=yield*B0.context,k={id:r0.descending(b.id),slug:JV.create(),version:E$,projectID:y.project.id,directory:b.directory,workspaceID:b.workspaceID,parentID:b.parentID,contextFrom:b.contextFrom,contextWatermark:b.contextWatermark,title:b.title??iM0(!!b.parentID),permission:b.permission,time:{created:Date.now(),updated:Date.now()}};if(Md.info("created",k),yield*L.sync(()=>X$.run(qY.Created,{sessionID:k.id,info:k})),yield*J.register({sessionID:k.id,actorID:"main",mode:"main",parentActorID:void 0,agent:"main",description:"main agent",contextMode:"full",contextWatermark:void 0,background:!1,lifecycle:"persistent",tools:"INHERIT"}).pipe(L.ignore),!b0.QITQODE_EXPERIMENTAL_WORKSPACES)yield*$.publish(qY.Updated,{sessionID:k.id,info:k});return k}),X=L.fn("Session.get")(function*(b){let y=yield*rA((k)=>k.select().from(I1).where(m0(I1.id,b)).get());if(!y)throw new KX({message:`Session not found: ${b}`});return OY(y)}),Q=L.fn("Session.children")(function*(b){return(yield*rA((k)=>k.select().from(I1).where(O$(m0(I1.parent_id,b))).all())).map(OY)}),G=L.fnUntraced(function*(b){try{let y=yield*X(b),k=yield*Q(b);for(let d of k)yield*G(d.id);let g=yield*B0.directory.pipe(L.as(!0),L.catchCause(()=>L.succeed(!1)));yield*L.sync(()=>{X$.run(qY.Deleted,{sessionID:b,info:y},{publish:g}),X$.remove(b)})}catch(y){Md.error(y)}}),W=(b)=>L.gen(function*(){return yield*L.sync(()=>X$.run(b$.Event.Updated,{sessionID:b.sessionID,info:b})),b}).pipe(L.withSpan("Session.updateMessage")),K=(b)=>{let y={...b};if(y.state){if(y.state={...y.state},y.state.time)y.state.time={...y.state.time}}return y},V=(b)=>L.gen(function*(){return yield*L.sync(()=>X$.run(b$.Event.PartUpdated,{sessionID:b.sessionID,part:K(b),time:Date.now()})),b}).pipe(L.withSpan("Session.updatePart")),U=L.fn("Session.getPart")(function*(b){let y=W1.use((k)=>k.select().from(P8).where(O$(m0(P8.session_id,b.sessionID),m0(P8.message_id,b.messageID),m0(P8.id,b.partID))).get());if(!y)return;return{...y.data,id:y.id,sessionID:y.session_id,messageID:y.message_id}}),H=L.fn("Session.create")(function*(b){let y=yield*B0.directory,k=yield*B0.workspaceID;return yield*Y({parentID:b?.parentID,contextFrom:b?.contextFrom,contextWatermark:b?.contextWatermark,directory:y,title:b?.title,permission:b?.permission,workspaceID:k})}),B=L.fn("Session.fork")(function*(b){let y=yield*B0.directory,k=yield*X(b.sessionID),g=nM0(k.title),d=yield*Y({directory:y,workspaceID:k.workspaceID,title:g}),p=yield*R({sessionID:b.sessionID,agentID:"*"}),t=new Map;for(let r of p){if(b.messageID&&r.info.id>=b.messageID)break;let G0=i1.ascending();t.set(r.info.id,G0);let O0=r.info.role==="assistant"&&r.info.parentID?t.get(r.info.parentID):void 0,h0=yield*W({...r.info,sessionID:d.id,id:G0,...O0&&{parentID:O0}});for(let u of r.parts)yield*V({...u,id:MZ.ascending(),messageID:h0.id,sessionID:d.id})}return d}),z=(b,y)=>L.sync(()=>X$.run(qY.Updated,{sessionID:b,info:y})),F=L.fn("Session.touch")(function*(b){yield*z(b,{time:{updated:Date.now()}})}),A=L.fn("Session.setTitle")(function*(b){yield*z(b.sessionID,{title:b.title})}),j=L.fn("Session.setArchived")(function*(b){yield*z(b.sessionID,{time:{archived:b.time}})}),N=L.fn("Session.setPermission")(function*(b){yield*z(b.sessionID,{permission:b.permission,time:{updated:Date.now()}})}),w=L.fn("Session.setRevert")(function*(b){yield*z(b.sessionID,{summary:b.summary,time:{updated:Date.now()},revert:b.revert})}),q=L.fn("Session.clearRevert")(function*(b){yield*z(b,{time:{updated:Date.now()},revert:null})}),M=L.fn("Session.setSummary")(function*(b){yield*z(b.sessionID,{time:{updated:Date.now()},summary:b.summary})}),C=L.fn("Session.diff")(function*(b){return yield*Z.read(["session_diff",b]).pipe(L.orElseSucceed(()=>[]))}),R=L.fn("Session.messages")(function*(b){if(b.limit)return b$.page({sessionID:b.sessionID,limit:b.limit,agentID:b.agentID}).items;return Array.from(b$.stream(b.sessionID,{agentID:b.agentID})).reverse()}),T=L.fn("Session.removeMessage")(function*(b){return yield*L.sync(()=>X$.run(b$.Event.Removed,{sessionID:b.sessionID,messageID:b.messageID})),b.messageID}),I=L.fn("Session.removePart")(function*(b){return yield*L.sync(()=>X$.run(b$.Event.PartRemoved,{sessionID:b.sessionID,messageID:b.messageID,partID:b.partID})),b.partID}),_=L.fnUntraced(function*(b){yield*$.publish(b$.Event.PartDelta,b)}),E=L.fn("Session.findMessage")(function*(b,y,k){for(let g of b$.stream(b,{agentID:k?.agentID}))if(y(g))return O1.some(g);return O1.none()}),f=L.fn("Session.lastMainMessageID")(function*(b){return(yield*rA((k)=>k.select({id:D$.id}).from(D$).where(O$(m0(D$.session_id,b),m0(D$.agent_id,"main"))).orderBy(o6(D$.id)).limit(1).get()))?.id});return nK.of({create:H,fork:B,touch:F,get:X,setTitle:A,setArchived:j,setPermission:N,setRevert:w,clearRevert:q,setSummary:M,diff:C,messages:R,children:Q,remove:G,updateMessage:W,removeMessage:T,removePart:I,updatePart:V,getPart:U,updatePartDelta:_,findMessage:E,lastMainMessageID:f})})),oM0=wd.pipe(T0.provide(BY.defaultLayer),T0.provide(l1.layer),T0.provide(aA.defaultLayer));export{l1 as Lj,k8 as Mj,hY as Nj,v9 as Oj,d7 as Pj,o7 as Qj,JN as Rj,IZ as Sj,nD as Tj,rD as Uj,bU as Vj,JV as Wj,_8 as Xj,z9 as Yj,d1 as Zj,X$ as _j,r0 as $j,i1 as ak,MZ as bk,Vj as ck,xV as dk,X4 as ek,G4 as fk,vU as gk,Ha as hk,QX as ik,VJ as jk,za as kk,kw as lk,vZ as mk,X1 as nk,s1 as ok,rb0 as pk,G_0 as qk,K_0 as rk,U_0 as sk,ce as tk,k_0 as uk,v_0 as vk,UW as wk,d3 as xk,BK as yk,rQ as zk,aQ as Ak,mh0 as Bk,lh0 as Ck,dh0 as Dk,Xj0 as Ek,nh0 as Fk,oh0 as Gk,au as Hk,sh0 as Ik,eu as Jk,$m as Kk,q7 as Lk,Q5 as Mk,Km as Nk,Oj0 as Ok,Ig0 as Pk,Vm as Qk,xg0 as Rk,gg0 as Sk,ug0 as Tk,IA as Uk,fm as Vk,iA as Wk,Ju0 as Xk,Yu0 as Yk,tl as Zk,Vd0 as _k,Ud0 as $k,$d as al,BY as bl,EA as cl,AZ as dl,X9 as el,N7 as fl,hl as gl,ol as hl,b$ as il,IM0 as jl,CM0 as kl,qY as ll,uM0 as ml,mM0 as nl,Dd as ol,nK as pl,oM0 as ql,Y9 as rl,X8 as sl};
|