@bkm016/basalt 0.1.5 → 0.1.7
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/README.md +12 -10
- package/{chunk-gw05p4g3.js → chunk-053vb71h.js} +1 -1
- package/{chunk-3c330qna.js → chunk-063vbmtp.js} +2 -2
- package/{chunk-bgkegf0k.js → chunk-0javrjcm.js} +4 -4
- package/{chunk-pjr91g6k.js → chunk-10p3mb40.js} +1 -1
- package/{chunk-mkp28k1x.js → chunk-39vwrg8n.js} +2 -2
- package/{chunk-dddsrff6.js → chunk-654cny9a.js} +123 -121
- package/{chunk-8xb636vr.js → chunk-6kdgk70p.js} +2 -2
- package/{chunk-9z7sdh5e.js → chunk-6ptv4g5e.js} +1 -1
- package/{chunk-zzwjt7fp.js → chunk-75434aay.js} +1 -1
- package/{chunk-ar3dbfp9.js → chunk-7hr6zw2m.js} +1 -1
- package/{chunk-h1rypb99.js → chunk-8gw5bvh3.js} +4 -4
- package/{chunk-a4b75ekk.js → chunk-8saewt61.js} +2 -2
- package/{chunk-sqaam5ak.js → chunk-8wj32837.js} +1 -1
- package/{chunk-539ekagy.js → chunk-8wv5t0w6.js} +5 -5
- package/{chunk-aw65h276.js → chunk-8x21n7y9.js} +1 -1
- package/{chunk-0n99m9m4.js → chunk-a0c989ky.js} +1 -1
- package/{chunk-srjgvdvs.js → chunk-a5apjjcn.js} +6 -6
- package/chunk-a81p46j7.js +2 -0
- package/chunk-agsfy9w7.js +2 -0
- package/{chunk-2qcpq99g.js → chunk-arcqjt91.js} +1 -1
- package/{chunk-rxj6tct8.js → chunk-bdy4jksd.js} +1 -1
- package/{chunk-zrkh5dw7.js → chunk-benrzwea.js} +1 -1
- package/chunk-bpw6q7g0.js +3 -0
- package/{chunk-36cqq0ga.js → chunk-c7rcw9fb.js} +5 -5
- package/{chunk-x89em726.js → chunk-ca982n62.js} +1 -1
- package/chunk-d20p02ny.js +2 -0
- package/{chunk-5v4g21rw.js → chunk-d6p2hgxh.js} +1 -1
- package/{chunk-t7sc0wwc.js → chunk-dnx91jrd.js} +2 -2
- package/{chunk-mat08ab1.js → chunk-dpz4hwqb.js} +2 -2
- package/{chunk-zn0g0859.js → chunk-ebpyvs1d.js} +2 -2
- package/{chunk-00gwse5r.js → chunk-ecf896fz.js} +1 -1
- package/{chunk-0stvywr8.js → chunk-ejsneb6f.js} +1 -1
- package/{chunk-7as47pcw.js → chunk-ey15ye2h.js} +1 -1
- package/{chunk-v4k3qmdm.js → chunk-f156y565.js} +1 -1
- package/{chunk-7tgqhveh.js → chunk-f544p9rh.js} +1 -1
- package/chunk-fmq3zwzk.js +2 -0
- package/{chunk-ebzkckyw.js → chunk-fx7f4m3c.js} +1 -1
- package/{chunk-3k7ejpkc.js → chunk-g0t9c3gv.js} +1 -1
- package/{chunk-7w0mefgk.js → chunk-gv7wqkey.js} +2 -2
- package/{chunk-1xa7d5mh.js → chunk-j7yvh0ae.js} +1 -1
- package/{chunk-0j0qggej.js → chunk-n85qs7cs.js} +1 -1
- package/{chunk-7qq99360.js → chunk-n981vx1t.js} +4 -4
- package/{chunk-0fwdxd45.js → chunk-peja51xv.js} +1 -1
- package/{chunk-6dsq0fns.js → chunk-pg5nkf1y.js} +1 -1
- package/{chunk-jyrwk08p.js → chunk-prgm07j4.js} +1 -1
- package/{chunk-jvwg4rn1.js → chunk-q9dd6fhj.js} +4 -4
- package/{chunk-nxkmd29x.js → chunk-r8vvcp6c.js} +1 -1
- package/{chunk-stj493dn.js → chunk-r9aatvwm.js} +2 -2
- package/chunk-rfb85nj7.js +2 -0
- package/{chunk-980drajf.js → chunk-rfdt992v.js} +12 -12
- package/{chunk-e63c1186.js → chunk-s6dejhfj.js} +1 -1
- package/{chunk-wfyrfvfn.js → chunk-s7skpgm2.js} +1 -1
- package/{chunk-2nkfxhef.js → chunk-sjjtxpg2.js} +247 -230
- package/{chunk-r0jc8e7t.js → chunk-w67dvqtb.js} +2 -2
- package/{chunk-b9fqretv.js → chunk-whj87h4r.js} +2 -2
- package/{chunk-vt1anydc.js → chunk-y8dkfpmj.js} +3 -3
- package/{chunk-nx3jnbv8.js → chunk-z02sj1je.js} +2 -2
- package/{chunk-hq5ke1yp.js → chunk-zxkq9m8e.js} +1 -1
- package/compiled.js +3 -3
- package/package.json +1 -1
- package/ui-test-worker.js +27 -27
- package/web/{chunk-7znyd1mj.js → chunk-079091ar.js} +1 -1
- package/web/{chunk-65nwc4cf.js → chunk-083r4f80.js} +1 -1
- package/web/{chunk-h2ag4kvz.js → chunk-0cng7r2x.js} +1 -1
- package/web/chunk-0k0ande6.js +1 -0
- package/web/{chunk-14bad871.js → chunk-14deqqhr.js} +1 -1
- package/web/{chunk-pyg1mr80.js → chunk-1s53190z.js} +20 -20
- package/web/{chunk-1pasbxwh.js → chunk-2b63adsj.js} +1 -1
- package/web/{chunk-zc1mk10n.js → chunk-2cem4sv7.js} +2 -2
- package/web/{chunk-y7jq61nv.js → chunk-30b33r2w.js} +2 -2
- package/web/{chunk-xsrvw7dt.js → chunk-3baypnwn.js} +3 -3
- package/web/{chunk-s24qs1bn.js → chunk-4067nwjp.js} +6 -6
- package/web/{chunk-paywgcf7.js → chunk-4fm55fgb.js} +2 -2
- package/web/{chunk-yvgs6bm3.js → chunk-4q7wf0wd.js} +1 -1
- package/web/{chunk-g5jxwkdh.js → chunk-4sve9xrj.js} +1 -1
- package/web/{chunk-56krfj3b.js → chunk-4vjnrz87.js} +1 -1
- package/web/chunk-59678wmg.js +1 -0
- package/web/chunk-5k8sv4f5.js +1 -0
- package/web/{chunk-tcp77cp2.js → chunk-5vjhvw1m.js} +1 -1
- package/web/{chunk-f9k3xrwb.js → chunk-5wbnjjhg.js} +1 -1
- package/web/chunk-6ft5pz3c.js +1 -0
- package/web/chunk-7c8rwqtx.js +1 -0
- package/web/chunk-7qzz025k.js +1 -0
- package/web/chunk-7xbaqqd7.css +1 -0
- package/web/chunk-80eyv2mk.js +1 -0
- package/web/chunk-89paytbk.js +4 -0
- package/web/chunk-8ceej2g7.js +1 -0
- package/web/chunk-8nyhy122.js +1 -0
- package/web/{chunk-01hcjafh.js → chunk-989jq2h8.js} +1 -1
- package/web/{chunk-bnb9xhgw.js → chunk-aangfjqc.js} +6 -6
- package/web/{chunk-1cfh0e2e.js → chunk-bdydzbqk.js} +7 -7
- package/web/chunk-cpwtt6ny.js +1 -0
- package/web/{chunk-dzg1pv80.js → chunk-czjk218p.js} +3 -3
- package/web/{chunk-m8knte9z.js → chunk-dg3p8db5.js} +1 -1
- package/web/chunk-dsw5t58p.js +1 -0
- package/web/{chunk-j34q5jn6.js → chunk-dv72fat3.js} +1 -1
- package/web/{chunk-affear07.js → chunk-dvvs1jjq.js} +1 -1
- package/web/{chunk-g9sqbafw.js → chunk-e131rg6p.js} +1 -1
- package/web/{chunk-4m3zdd41.js → chunk-e8yj05t1.js} +1 -1
- package/web/chunk-ekw54h1q.js +1 -0
- package/web/{chunk-0k9aec1s.js → chunk-femhej5w.js} +3 -3
- package/web/chunk-fmthkpff.js +1 -0
- package/web/{chunk-d60dpf69.js → chunk-geh05ghh.js} +1 -1
- package/web/{chunk-892nf39p.js → chunk-gksf7cek.js} +7 -7
- package/web/{chunk-abhad4zj.js → chunk-ht4mx2dt.js} +4 -4
- package/web/chunk-hwsvhst3.js +1 -0
- package/web/{chunk-d6ddkh6e.js → chunk-k02b36g1.js} +1 -1
- package/web/{chunk-2nht58dc.js → chunk-kjacapzd.js} +1 -1
- package/web/{chunk-zz397b0v.js → chunk-kkfrs7d1.js} +1 -1
- package/web/{chunk-aqt7kc3s.js → chunk-kkyn8yhj.js} +1 -1
- package/web/chunk-mh4rx5cf.js +1 -0
- package/web/{chunk-4a4j030b.js → chunk-n448vaba.js} +1 -1
- package/web/{chunk-k67v6dyg.js → chunk-n754s8xd.js} +2 -2
- package/web/chunk-n8j88qxy.js +1 -0
- package/web/{chunk-kza0t0gj.js → chunk-nfvqjzz5.js} +1 -1
- package/web/chunk-nmpbsvwb.js +2 -0
- package/web/chunk-nws1s56b.js +1 -0
- package/web/{chunk-12z7d0hp.js → chunk-p7126wwy.js} +2 -2
- package/web/chunk-phnqnhj9.js +1 -0
- package/web/{chunk-5shygfgb.js → chunk-pjz30xcp.js} +2 -2
- package/web/{chunk-vhzys0rr.js → chunk-q3jevm51.js} +1 -1
- package/web/{chunk-advfpyb9.js → chunk-q97hn4j5.js} +4 -4
- package/web/chunk-qg31p6cn.js +1 -0
- package/web/{chunk-jcdw85mv.js → chunk-qhm3cfq9.js} +1 -1
- package/web/chunk-qsd595b9.js +1 -0
- package/web/{chunk-9xgspn75.js → chunk-r7frwjqx.js} +2 -2
- package/web/chunk-rddft5ce.js +1139 -0
- package/web/{chunk-x7sb3bwf.js → chunk-rgbdf2m9.js} +22 -22
- package/web/{chunk-fnnrrzqa.js → chunk-rsbkbg6x.js} +1 -1
- package/web/chunk-s2bs5vxh.js +2 -0
- package/web/{chunk-sd22cnjy.js → chunk-sgwccs54.js} +1 -1
- package/web/{chunk-c53xmf48.js → chunk-sjh8gtm9.js} +1 -1
- package/web/{chunk-zqht0jzx.js → chunk-sn3tkwme.js} +1 -1
- package/web/{chunk-gcv91974.js → chunk-svh4n157.js} +1 -1
- package/web/{chunk-7a3c137d.js → chunk-sy7e4dmq.js} +1 -1
- package/web/{chunk-vttgyb5v.js → chunk-t3658ehb.js} +1 -1
- package/web/{chunk-h6gh63xj.js → chunk-t6sq85s6.js} +1 -1
- package/web/{chunk-z4aj066q.js → chunk-t81p4wqc.js} +1 -1
- package/web/{chunk-qq5gh5zr.js → chunk-tewmsd7t.js} +1 -1
- package/web/chunk-tf57s7ry.js +1 -0
- package/web/{chunk-gxqaa4sv.js → chunk-tfn0rqg9.js} +5 -5
- package/web/{chunk-0qr891eq.js → chunk-tmndcktk.js} +1 -1
- package/web/chunk-tqr80b5w.js +2 -0
- package/web/{chunk-mnzramhc.js → chunk-twdy2f67.js} +1 -1
- package/web/chunk-tz4twwmw.js +2 -0
- package/web/{chunk-crzseqbx.js → chunk-v282r683.js} +1 -1
- package/web/chunk-v4vjjtn7.js +1 -0
- package/web/chunk-vbwdwcdp.js +1 -0
- package/web/{chunk-6enn8p66.js → chunk-vjngfh0q.js} +1 -1
- package/web/{chunk-g8kkc6vz.js → chunk-wbgkwxrc.js} +1 -1
- package/web/{chunk-ybw6vgf6.js → chunk-wjbk50hn.js} +1 -1
- package/web/chunk-wjy848e2.js +1 -0
- package/web/{chunk-3hkgdw6f.js → chunk-wqsczy57.js} +3 -3
- package/web/chunk-wvfmmw1v.js +8 -0
- package/web/chunk-x1jm4zsg.js +1 -0
- package/web/{chunk-26bwh1sb.js → chunk-xbpc6x9m.js} +6 -6
- package/web/{chunk-xk1t58c4.js → chunk-xckxtfp8.js} +4 -4
- package/web/{chunk-qrdh9j62.js → chunk-xmsb2g71.js} +1 -1
- package/web/{chunk-ka7c5rhx.js → chunk-y99ed8rd.js} +6 -6
- package/web/{chunk-0p1nmj5n.js → chunk-z1geewdf.js} +1 -1
- package/web/index.html +1 -1
- package/worker.js +1 -1
- package/chunk-2nb3d92s.js +0 -2
- package/chunk-2pa1z37c.js +0 -2
- package/chunk-4g5f43ea.js +0 -3
- package/chunk-eegztdzb.js +0 -2
- package/chunk-wd3z74av.js +0 -2
- package/chunk-yna8bwqc.js +0 -2
- package/web/chunk-0ytga215.js +0 -1
- package/web/chunk-1amzv4ha.js +0 -1
- package/web/chunk-1s2hp6h1.js +0 -1
- package/web/chunk-2y0rc1fe.js +0 -1
- package/web/chunk-4w298aqs.js +0 -1
- package/web/chunk-6stt9d18.js +0 -1
- package/web/chunk-7e47b1sn.js +0 -1
- package/web/chunk-7pypx5h8.js +0 -2
- package/web/chunk-9dy7z3ej.js +0 -2
- package/web/chunk-9mq2cdtq.js +0 -1
- package/web/chunk-b5hah4mf.js +0 -1
- package/web/chunk-b8tfetd8.js +0 -1
- package/web/chunk-ckgpy4r4.js +0 -1
- package/web/chunk-dbnrfxt1.js +0 -8
- package/web/chunk-ddxf8e84.js +0 -1
- package/web/chunk-e8h45nyr.js +0 -1
- package/web/chunk-ej9vb61c.js +0 -1
- package/web/chunk-fjag6yg8.js +0 -2
- package/web/chunk-gxsb5tx3.js +0 -1
- package/web/chunk-jg6fmz2d.js +0 -1
- package/web/chunk-mpfgr049.js +0 -1
- package/web/chunk-mz1dabxh.js +0 -1
- package/web/chunk-p53n0hwr.js +0 -1
- package/web/chunk-pfcnr9tw.js +0 -1
- package/web/chunk-q7xkscc5.js +0 -1
- package/web/chunk-qmbgb79a.js +0 -1139
- package/web/chunk-sfq6cw45.js +0 -2
- package/web/chunk-svqj4az8.js +0 -1
- package/web/chunk-t7jwyvvr.js +0 -1
- package/web/chunk-tf18d2dk.css +0 -1
- package/web/chunk-v0g4cqc1.js +0 -4
- package/web/chunk-vqfz99ff.js +0 -1
- package/web/chunk-zazs8p6c.js +0 -1
|
@@ -3,7 +3,7 @@ var pr;pr=globalThis.crypto?.webcrypto??globalThis.crypto??import("crypto").then
|
|
|
3
3
|
`).filter((i)=>i),o=Math.min(...r.map((i)=>i.length-i.trimStart().length)),n=r.map((i)=>i.slice(o)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of n)this.content.push(i)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
4
4
|
${t.join(`
|
|
5
5
|
`)}
|
|
6
|
-
};`)(...Object.values(this.closed))}}var Di={major:4,minor:6,patch:7};var C=f("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Di;let o=e._zod.def.checks,n=e._zod.traits.has("$ZodCheck")?[e,...o??[]]:o?.length?[...o]:[];for(let i of n)for(let s of i._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(c,a,l)=>{if(c.memo)return c;let p=pe(c),d;for(let h of a){if(h._zod.def.when){if(On(c))continue;if(!h._zod.def.when(c))continue}else if(p)continue;let m=c.issues.length,g=h._zod.check(c);if(g instanceof Promise&&l?.async===!1)throw new me;if(d||g instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await g,c.issues.length===m)return;if(pt(c.issues,m,e),!p)p=pe(c,m)});else{if(c.issues.length===m)continue;if(pt(c.issues,m,e),!p)p=pe(c,m)}}if(d)return d.then(()=>c);return c},s=(c,a,l)=>{if(pe(c))return c.aborted=!0,c;let p=i(a,n,l);if(p instanceof Promise){if(l.async===!1)throw new me;return p.then((d)=>e._zod.parse(d,l))}return e._zod.parse(p,l)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){let p=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});if(p instanceof Promise)return p.then((d)=>s(d,c,a));return s(p,c,a)}let l=e._zod.parse(c,a);if(l instanceof Promise){if(a.async===!1)throw new me;return l.then((p)=>i(p,n,a))}return i(l,n,a)}}},{get "~standard"(){return mt(this,"~standard",Ur(this))},set "~standard"(e){ge(this,"~standard",e)}}),Hi=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>fe(r,t,Y()))}:{value:e.value};async function ll(e,t){let r={async:!0};return Hi(await e._zod.run({value:t,issues:[]},r),r)}function Ur(e){return{validate:(t)=>{let r={async:!1};try{let o=e._zod.run({value:t,issues:[]},r);if(!(o instanceof Promise))return Hi(o,r)}catch(o){}return ll(e,t)},vendor:"zod",version:1}}var St=f("$ZodString",(e,t)=>{C.init(e,t),e._zod.pattern=t.pattern??bi,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),T=f("$ZodStringFormat",(e,t)=>{We.init(e,t),St.init(e,t)}),Xi=f("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=si),T.init(e,t)}),Yi=f("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ir(o))}else t.pattern??(t.pattern=Ir());T.init(e,t)}),Qi=f("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ci),T.init(e,t)}),es=1,wt=2;function ts(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function pl(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return ts(e)||wt;return fl(e,t)}function fl(e,t){if(!t.normalize&&t.protocol?.source===hi.source&&!/^https?:\/\//i.test(e))return es;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??wt}return new URL(e)}catch{return wt}}var dl=/[\t\n\r]/g;function Ui(e){return e.replace(dl,"")}function ml(e,t){return t.lastIndex=0,t.test(e.hostname)}function hl(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var rs=f("$ZodURL",(e,t)=>{T.init(e,t),e._zod.check=(r)=>{try{let o=r.value.trim(),n=pl(o,t);if(n===es){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(n===wt){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(n===!0){r.value=Ui(o);return}if(t.hostname&&!ml(n,t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!hl(n,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?n.href:Ui(o);return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),os=f("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ai()),T.init(e,t)}),ns=f("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?oi:ni(t.length)),T.init(e,t)}),is=f("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Gn),T.init(e,t)}),ss=f("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Hn),T.init(e,t)}),cs=f("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Xn),T.init(e,t)}),as=f("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Yn),T.init(e,t)}),us=f("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Qn),T.init(e,t)}),ls=f("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=yi(t)),T.init(e,t)}),ps=f("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=zi),T.init(e,t)}),fs=f("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=xi(t)),T.init(e,t)}),ds=f("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ii),T.init(e,t)}),ms=f("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ui),T.init(e,t)}),gl=/^[0-9a-fA-F:.]+$/;function hs(e){if(!gl.test(e))return!1;return ts(`http://[${e}]`)}var gs=f("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=li),T.init(e,t),e._zod.check=(r)=>{if(!hs(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var _s=f("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=pi),T.init(e,t)});function _l(e){let t=e.split("/");if(t.length!==2)return!1;let[r,o]=t;if(!o)return!1;let n=Number(o);if(`${n}`!==o)return!1;if(n<0||n>128)return!1;return hs(r)}var zs=f("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=fi),T.init(e,t),e._zod.check=(r)=>{if(!_l(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function xs(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Mr=/^[0-9a-zA-Z+/]*={0,2}$/,ys=f("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Mr),T.init(e,t),e._zod.check=(r)=>{if(xs(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),kt=/^[A-Za-z0-9_-]*$/;function zl(e){if(!kt.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return xs(r)}var bs=f("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=kt),T.init(e,t),e._zod.check=(r)=>{if(zl(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),vs=f("$ZodE164",(e,t)=>{t.pattern??(t.pattern=gi),T.init(e,t)});function xl(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}var ws=f("$ZodJWT",(e,t)=>{T.init(e,t),e._zod.check=(r)=>{if(xl(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Fr=f("$ZodNumber",(e,t)=>{C.init(e,t),e._zod.pattern=Ke,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let n=r.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let i=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?String(n):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...i?{received:i}:{}}),r}}),$s=f("$ZodNumberFormat",(e,t)=>{Pi.init(e,t),Fr.init(e,t)}),Ss=f("$ZodBoolean",(e,t)=>{C.init(e,t),e._zod.pattern=vi,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(i){}let n=r.value;if(typeof n==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}});var ks=f("$ZodNull",(e,t)=>{C.init(e,t),e._zod.pattern=wi,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;if(n===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),Ps=f("$ZodAny",(e,t)=>{C.init(e,t),e._zod.parse=(r)=>r}),Zs=f("$ZodUnknown",(e,t)=>{C.init(e,t),e._zod.parse=(r)=>r}),Os=f("$ZodNever",(e,t)=>{C.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function yl(e,t){let r=xr(e._zod.def.checks);if(!r.length)return;let o=Math.min(...r.map((i)=>i[0])),n=e._zod.parse;e._zod.parse=(i,s)=>{let c=t(i.value);if(c>o&&!s?.skipChecks&&s?.direction!=="backward"){for(let[a,l]of xr(e._zod.def.checks))if(c>a&&l._zod.def.when(i)){let p=i.issues.length;return l._zod.check(i),i.issues[p].continue=!1,pt(i.issues,p,e),i}}return n(i,s)}}var bl=(e)=>Array.isArray(e)?e.length:-1;function Mi(e,t,r){if(e.issues.length)t.issues.push(...ye(r,e.issues));t.value[r]=e.value}var Rs=f("$ZodArray",(e,t)=>{C.init(e,t);let r=X.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let i=o.value;if(!Array.isArray(i))return o.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),o;o.value=r?r.alloc(e,o,Array(i.length),n):Array(i.length);let s=[],c=n?.abortEarly;for(let a=0;a<i.length;a++){let l=i[a],p=t.element._zod.run({value:l,issues:[]},n);if(p instanceof Promise)s.push(p.then((d)=>Mi(d,o,a)));else if(Mi(p,o,a),c&&p.issues.length!==0&&pe(p))break}if(s.length)return Promise.all(s).then(()=>o);return o},yl(e,bl)});function $t(e,t,r,o,n,i){let s=r in o,c=i==="optional";if(!s&&c&&n==="optional")return;if(e.issues.length){if(n!==void 0&&c&&!s)return;t.issues.push(...ye(r,e.issues))}if(!s&&n===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(s||n==="defaulted"&&!c)t.value[r]=void 0}else t.value[r]=e.value}var vl=[];function Cs(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),o=r.length?r:vl,n=o.length?[...t,...o]:t;for(let s of n)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=Sn(e.shape);return{...e,allKeys:n,symbolKeys:o,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Is(e,t,r,o,n,i,s){let c=[],a=n.keySet,l=n.catchall._zod,p=l.def.type,{optin:d,optout:h}=l,m=0;for(let g in t){if(s&&r.issues.length!==m){if(pe(r,m))break;m=r.issues.length}if(a.has(g))continue;if(g==="__proto__"){if(p==="never")c.push(g);continue}if(p==="never"){c.push(g);continue}let v=l.run({value:t[g],issues:[]},o);if(v instanceof Promise)e.push(v.then((w)=>$t(w,r,g,t,d,h)));else $t(v,r,g,t,d,h)}if(c.length)r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var wl=f("$ZodObject",(e,t)=>{C.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),o=r?.get?r.get.raw:t.shape??{};if(o){let l=()=>{let p={...o};return Object.defineProperty(t,"shape",{value:p}),l.raw=p,p};l.raw=o,Object.defineProperty(t,"shape",{get:l})}let n=Be(()=>Cs(t));P(e,"propValues",(l)=>{let p=l.def.shape,d={};for(let h in p){let m=p[h]._zod;if(m.values){if(!Object.prototype.hasOwnProperty.call(d,h))oe(d,h,new Set);for(let g of m.values)d[h].add(g);if(m.optin!==void 0)d[h].add(void 0)}}return d});let i=Pe,s=t.catchall,c,a=X.memoizer;a?.attach(e),e._zod.parse=(l,p)=>{c??(c=n.value);let d=l.value;if(!i(d))return l.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),l;l.value=a?a.alloc(e,l,{},p):{};let h=[],m=c.shape,g=p?.abortEarly,v=l.issues.length;for(let w of c.allKeys){if(g&&l.issues.length!==v){if(pe(l,v))break;v=l.issues.length}if(w==="__proto__")continue;let Z=m[w],H=Z._zod.optin,F=Z._zod.optout,ae=Z._zod.run({value:d[w],issues:[]},p);if(ae instanceof Promise)h.push(ae.then((U)=>$t(U,l,w,d,H,F)));else $t(ae,l,w,d,H,F)}if(!s)return h.length?Promise.all(h).then(()=>l):l;return Is(h,d,l,p,n.value,e,g===!0)}}),Ts=f("$ZodObjectJIT",(e,t)=>{wl.init(e,t);let r=e._zod.parse,o=Be(()=>Cs(t)),n=X.memoizer,i=(m)=>{let g=o.value,v=g.symbolKeys,w=new Lr(["payload","ctx"],{shape:m,inst:e,memo:n,syms:v}),Z=(U)=>`shape[${U}]._zod.run({ value: input[${U}], issues: [] }, ctx)`,H=(U,O)=>`
|
|
6
|
+
};`)(...Object.values(this.closed))}}var Di={major:4,minor:6,patch:7};var C=f("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Di;let o=e._zod.def.checks,n=e._zod.traits.has("$ZodCheck")?[e,...o??[]]:o?.length?[...o]:[];for(let i of n)for(let s of i._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(c,a,l)=>{if(c.memo)return c;let p=pe(c),d;for(let h of a){if(h._zod.def.when){if(On(c))continue;if(!h._zod.def.when(c))continue}else if(p)continue;let m=c.issues.length,g=h._zod.check(c);if(g instanceof Promise&&l?.async===!1)throw new me;if(d||g instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await g,c.issues.length===m)return;if(pt(c.issues,m,e),!p)p=pe(c,m)});else{if(c.issues.length===m)continue;if(pt(c.issues,m,e),!p)p=pe(c,m)}}if(d)return d.then(()=>c);return c},s=(c,a,l)=>{if(pe(c))return c.aborted=!0,c;let p=i(a,n,l);if(p instanceof Promise){if(l.async===!1)throw new me;return p.then((d)=>e._zod.parse(d,l))}return e._zod.parse(p,l)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){let p=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});if(p instanceof Promise)return p.then((d)=>s(d,c,a));return s(p,c,a)}let l=e._zod.parse(c,a);if(l instanceof Promise){if(a.async===!1)throw new me;return l.then((p)=>i(p,n,a))}return i(l,n,a)}}},{get "~standard"(){return mt(this,"~standard",Ur(this))},set "~standard"(e){ge(this,"~standard",e)}}),Hi=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>fe(r,t,Y()))}:{value:e.value};async function ll(e,t){let r={async:!0};return Hi(await e._zod.run({value:t,issues:[]},r),r)}function Ur(e){return{validate:(t)=>{let r={async:!1};try{let o=e._zod.run({value:t,issues:[]},r);if(!(o instanceof Promise))return Hi(o,r)}catch(o){}return ll(e,t)},vendor:"zod",version:1}}var $t=f("$ZodString",(e,t)=>{C.init(e,t),e._zod.pattern=t.pattern??bi,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),T=f("$ZodStringFormat",(e,t)=>{We.init(e,t),$t.init(e,t)}),Xi=f("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=si),T.init(e,t)}),Yi=f("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ir(o))}else t.pattern??(t.pattern=Ir());T.init(e,t)}),Qi=f("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ci),T.init(e,t)}),es=1,vt=2;function ts(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function pl(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return ts(e)||vt;return fl(e,t)}function fl(e,t){if(!t.normalize&&t.protocol?.source===hi.source&&!/^https?:\/\//i.test(e))return es;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??vt}return new URL(e)}catch{return vt}}var dl=/[\t\n\r]/g;function Ui(e){return e.replace(dl,"")}function ml(e,t){return t.lastIndex=0,t.test(e.hostname)}function hl(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var rs=f("$ZodURL",(e,t)=>{T.init(e,t),e._zod.check=(r)=>{try{let o=r.value.trim(),n=pl(o,t);if(n===es){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(n===vt){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(n===!0){r.value=Ui(o);return}if(t.hostname&&!ml(n,t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!hl(n,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?n.href:Ui(o);return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),os=f("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ai()),T.init(e,t)}),ns=f("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?oi:ni(t.length)),T.init(e,t)}),is=f("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Gn),T.init(e,t)}),ss=f("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Hn),T.init(e,t)}),cs=f("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Xn),T.init(e,t)}),as=f("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Yn),T.init(e,t)}),us=f("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Qn),T.init(e,t)}),ls=f("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=yi(t)),T.init(e,t)}),ps=f("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=zi),T.init(e,t)}),fs=f("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=xi(t)),T.init(e,t)}),ds=f("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ii),T.init(e,t)}),ms=f("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ui),T.init(e,t)}),gl=/^[0-9a-fA-F:.]+$/;function hs(e){if(!gl.test(e))return!1;return ts(`http://[${e}]`)}var gs=f("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=li),T.init(e,t),e._zod.check=(r)=>{if(!hs(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var _s=f("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=pi),T.init(e,t)});function _l(e){let t=e.split("/");if(t.length!==2)return!1;let[r,o]=t;if(!o)return!1;let n=Number(o);if(`${n}`!==o)return!1;if(n<0||n>128)return!1;return hs(r)}var zs=f("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=fi),T.init(e,t),e._zod.check=(r)=>{if(!_l(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function xs(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Mr=/^[0-9a-zA-Z+/]*={0,2}$/,ys=f("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Mr),T.init(e,t),e._zod.check=(r)=>{if(xs(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),kt=/^[A-Za-z0-9_-]*$/;function zl(e){if(!kt.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return xs(r)}var bs=f("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=kt),T.init(e,t),e._zod.check=(r)=>{if(zl(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),vs=f("$ZodE164",(e,t)=>{t.pattern??(t.pattern=gi),T.init(e,t)});function xl(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}var ws=f("$ZodJWT",(e,t)=>{T.init(e,t),e._zod.check=(r)=>{if(xl(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Fr=f("$ZodNumber",(e,t)=>{C.init(e,t),e._zod.pattern=Ke,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let n=r.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let i=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?String(n):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...i?{received:i}:{}}),r}}),$s=f("$ZodNumberFormat",(e,t)=>{Pi.init(e,t),Fr.init(e,t)}),Ss=f("$ZodBoolean",(e,t)=>{C.init(e,t),e._zod.pattern=vi,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(i){}let n=r.value;if(typeof n==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}});var ks=f("$ZodNull",(e,t)=>{C.init(e,t),e._zod.pattern=wi,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;if(n===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),Ps=f("$ZodAny",(e,t)=>{C.init(e,t),e._zod.parse=(r)=>r}),Zs=f("$ZodUnknown",(e,t)=>{C.init(e,t),e._zod.parse=(r)=>r}),Os=f("$ZodNever",(e,t)=>{C.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function yl(e,t){let r=xr(e._zod.def.checks);if(!r.length)return;let o=Math.min(...r.map((i)=>i[0])),n=e._zod.parse;e._zod.parse=(i,s)=>{let c=t(i.value);if(c>o&&!s?.skipChecks&&s?.direction!=="backward"){for(let[a,l]of xr(e._zod.def.checks))if(c>a&&l._zod.def.when(i)){let p=i.issues.length;return l._zod.check(i),i.issues[p].continue=!1,pt(i.issues,p,e),i}}return n(i,s)}}var bl=(e)=>Array.isArray(e)?e.length:-1;function Mi(e,t,r){if(e.issues.length)t.issues.push(...ye(r,e.issues));t.value[r]=e.value}var Rs=f("$ZodArray",(e,t)=>{C.init(e,t);let r=X.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let i=o.value;if(!Array.isArray(i))return o.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),o;o.value=r?r.alloc(e,o,Array(i.length),n):Array(i.length);let s=[],c=n?.abortEarly;for(let a=0;a<i.length;a++){let l=i[a],p=t.element._zod.run({value:l,issues:[]},n);if(p instanceof Promise)s.push(p.then((d)=>Mi(d,o,a)));else if(Mi(p,o,a),c&&p.issues.length!==0&&pe(p))break}if(s.length)return Promise.all(s).then(()=>o);return o},yl(e,bl)});function wt(e,t,r,o,n,i){let s=r in o,c=i==="optional";if(!s&&c&&n==="optional")return;if(e.issues.length){if(n!==void 0&&c&&!s)return;t.issues.push(...ye(r,e.issues))}if(!s&&n===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(s||n==="defaulted"&&!c)t.value[r]=void 0}else t.value[r]=e.value}var vl=[];function Cs(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),o=r.length?r:vl,n=o.length?[...t,...o]:t;for(let s of n)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=Sn(e.shape);return{...e,allKeys:n,symbolKeys:o,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Is(e,t,r,o,n,i,s){let c=[],a=n.keySet,l=n.catchall._zod,p=l.def.type,{optin:d,optout:h}=l,m=0;for(let g in t){if(s&&r.issues.length!==m){if(pe(r,m))break;m=r.issues.length}if(a.has(g))continue;if(g==="__proto__"){if(p==="never")c.push(g);continue}if(p==="never"){c.push(g);continue}let v=l.run({value:t[g],issues:[]},o);if(v instanceof Promise)e.push(v.then((w)=>wt(w,r,g,t,d,h)));else wt(v,r,g,t,d,h)}if(c.length)r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var wl=f("$ZodObject",(e,t)=>{C.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),o=r?.get?r.get.raw:t.shape??{};if(o){let l=()=>{let p={...o};return Object.defineProperty(t,"shape",{value:p}),l.raw=p,p};l.raw=o,Object.defineProperty(t,"shape",{get:l})}let n=Be(()=>Cs(t));P(e,"propValues",(l)=>{let p=l.def.shape,d={};for(let h in p){let m=p[h]._zod;if(m.values){if(!Object.prototype.hasOwnProperty.call(d,h))oe(d,h,new Set);for(let g of m.values)d[h].add(g);if(m.optin!==void 0)d[h].add(void 0)}}return d});let i=Pe,s=t.catchall,c,a=X.memoizer;a?.attach(e),e._zod.parse=(l,p)=>{c??(c=n.value);let d=l.value;if(!i(d))return l.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),l;l.value=a?a.alloc(e,l,{},p):{};let h=[],m=c.shape,g=p?.abortEarly,v=l.issues.length;for(let w of c.allKeys){if(g&&l.issues.length!==v){if(pe(l,v))break;v=l.issues.length}if(w==="__proto__")continue;let Z=m[w],H=Z._zod.optin,F=Z._zod.optout,ae=Z._zod.run({value:d[w],issues:[]},p);if(ae instanceof Promise)h.push(ae.then((U)=>wt(U,l,w,d,H,F)));else wt(ae,l,w,d,H,F)}if(!s)return h.length?Promise.all(h).then(()=>l):l;return Is(h,d,l,p,n.value,e,g===!0)}}),Ts=f("$ZodObjectJIT",(e,t)=>{wl.init(e,t);let r=e._zod.parse,o=Be(()=>Cs(t)),n=X.memoizer,i=(m)=>{let g=o.value,v=g.symbolKeys,w=new Lr(["payload","ctx"],{shape:m,inst:e,memo:n,syms:v}),Z=(U)=>`shape[${U}]._zod.run({ value: input[${U}], issues: [] }, ctx)`,H=(U,O)=>`
|
|
7
7
|
let ${U}_ab = false;
|
|
8
8
|
for (let i = 0; i < ${U}.issues.length; i++) {
|
|
9
9
|
const iss = ${U}.issues[i];
|
|
@@ -53,7 +53,7 @@ ${t.join(`
|
|
|
53
53
|
if (${O}.value !== undefined || ${ur}) {
|
|
54
54
|
newResult[${le}] = ${O}.value;
|
|
55
55
|
}
|
|
56
|
-
`)}return w.write("payload.value = newResult;"),w.write("return payload;"),w.compile()},s,c=Pe,a=!X.jitless,p=a&&wn.value,d=t.catchall,h;e._zod.parse=(m,g)=>{h??(h=o.value);let v=m.value;if(!c(v))return m.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),m;if(a&&p&&g?.async===!1&&g.jitless!==!0){if(!s)s=i(t.shape);if(m=s(m,g),!d)return m;return Is([],v,m,g,h,e,g?.abortEarly===!0)}return r(m,g)}});function Fi(e,t,r,o){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let n=e.filter((i)=>!pe(i));if(n.length===1)return t.value=n[0].value,n[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>fe(s,o,Y())))}),t}var Br=f("$ZodUnion",(e,t)=>{C.init(e,t),P(e,"optin",(o)=>o.def.options.some((n)=>n._zod.optin==="defaulted")?"defaulted":o.def.options.some((n)=>n._zod.optin!==void 0)?"optional":void 0),P(e,"optout",(o)=>o.def.options.some((n)=>n._zod.optout==="optional")?"optional":void 0),P(e,"values",(o)=>{if(o.def.options.every((n)=>n._zod.values))return new Set(o.def.options.flatMap((n)=>Array.from(n._zod.values)));return}),P(e,"pattern",(o)=>{if(o.def.options.every((n)=>n._zod.pattern)){let n=o.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${n.map((i)=>at(i.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let i=!1,s=[];for(let c of t.options){let a=c._zod.run({value:o.value,issues:[]},n);if(a instanceof Promise)s.push(a),i=!0;else{if(a.issues.length===0)return a;s.push(a)}}if(!i)return Fi(s,o,e,n);return Promise.all(s).then((c)=>Fi(c,o,e,n))}});function $l(e){let t=new Map;for(let r of e.options){let o=r._zod.propValues?.[e.discriminator];if(!o||o.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let n of o)if(t.has(n)){if(n!==void 0)throw Error(`Duplicate discriminator value "${String(n)}"`);t.set(n,null)}else t.set(n,r)}return t}var As=f("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Br.init(e,t);let r=e._zod.parse;P(e,"propValues",(n)=>{let i={},s=0;for(let c of n.def.options){let a=c._zod.propValues;if(!a||Object.keys(a).length===0)throw Error(`Invalid discriminated union option at index "${n.def.options.indexOf(c)}"`);if(a[n.def.discriminator]?.has(void 0))s++;for(let[l,p]of Object.entries(a)){if(!Object.prototype.hasOwnProperty.call(i,l))oe(i,l,new Set);for(let d of p)i[l].add(d)}}if(!n.def.unionFallback&&s>1)i[n.def.discriminator]?.delete(void 0);return i}),t.options.forEach((n,i)=>{let s=Je(n._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let o=Be(()=>$l(t));e._zod.parse=(n,i)=>{let s=n.value;if(!Pe(s))return n.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),n;let c=s?.[t.discriminator],a=o.value.get(c);if(a&&(c!==void 0||i.direction!=="backward"))return a._zod.run(n,i);if(t.unionFallback||i.direction==="backward")return r(n,i);return n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()).filter((l)=>o.value.get(l)!==null),input:s,path:[t.discriminator],inst:e}),n}}),Es=f("$ZodIntersection",(e,t)=>{C.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,i=t.left._zod.run({value:n,issues:[]},o),s=t.right._zod.run({value:n,issues:[]},o);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([a,l])=>Bi(r,a,l));return Bi(r,i,s)}});function Dr(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Se(e)&&Se(t)){let r=Object.keys(t),o=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),n={...e,...t};if(Object.prototype.hasOwnProperty.call(n,"__proto__"))delete n.__proto__;for(let i of o){if(i==="__proto__")continue;let s=Dr(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n[i]=s.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],i=t[o],s=Dr(n,i);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Bi(e,t,r){let o=new Map,n,i=new Map,s=(l,p)=>{let d;if(l.code==="unrecognized_keys"&&!l.path?.length)n??(n=l),d=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let h=String(l.path[0]);if(!i.has(h))i.set(h,l);d=[h]}else return!1;for(let h of d){if(!o.has(h))o.set(h,{});o.get(h)[p]=!0}return!0};for(let l of t.issues)if(!s(l,"l"))e.issues.push(l);for(let l of r.issues)if(!s(l,"r"))e.issues.push(l);let c=[...o].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(c.length){let l=n?c.filter((p)=>n.keys.includes(p)):[];if(l.length)e.issues.push({...n,keys:l});for(let p of c)if(!l.includes(p)&&i.has(p))e.issues.push(i.get(p))}let a=Dr(t.value,r.value);if(!a.valid){if(pe(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}var Ns=f("$ZodRecord",(e,t)=>{C.init(e,t);let r=X.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let i=o.value;if(!Se(i))return o.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),o;let s=[],c=t.keyType._zod.values;if(c&&!t.partial){o.value=r?r.alloc(e,o,{},n):{};let a=new Set;for(let p of c)if(typeof p==="string"||typeof p==="number"||typeof p==="symbol"){if(a.add(typeof p==="number"?p.toString():p),p==="__proto__")continue;let d=t.keyType._zod.run({value:p,issues:[]},n);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(d.issues.length){o.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((g)=>fe(g,n,Y())),input:p,path:[p],inst:e});continue}let h=d.value;if(h==="__proto__")continue;let m=t.valueType._zod.run({value:i[p],issues:[]},n);if(m instanceof Promise)s.push(m.then((g)=>{if(g.issues.length)o.issues.push(...ye(p,g.issues));o.value[h]=g.value}));else{if(m.issues.length)o.issues.push(...ye(p,m.issues));o.value[h]=m.value}}let l;for(let p in i)if(!a.has(p))if(t.mode==="loose"){if(p==="__proto__")continue;o.value[p]=i[p]}else l=l??[],l.push(p);if(l&&l.length>0)o.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:!0})}else{o.value=r?r.alloc(e,o,{},n):{};let a;for(let l of Reflect.ownKeys(i)){if(l==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,l))continue;let p=t.keyType._zod.run({value:l,issues:[]},n);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof l==="string"&&Ke.test(l)&&p.issues.length){let g=t.keyType._zod.run({value:Number(l),issues:[]},n);if(g instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(g.issues.length===0)p=g}if(p.issues.length){if(t.mode==="loose")o.value[l]=i[l];else if(c)a=a??[],a.push(l);else o.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map((g)=>fe(g,n,Y())),input:l,path:[l],inst:e});continue}let h=p.value;if(h==="__proto__")continue;let m=t.valueType._zod.run({value:i[l],issues:[]},n);if(m instanceof Promise)s.push(m.then((g)=>{if(g.issues.length)o.issues.push(...ye(l,g.issues));o.value[h]=g.value}));else{if(m.issues.length)o.issues.push(...ye(l,m.issues));o.value[h]=m.value}}if(a&&a.length>0)o.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a,continue:!0})}if(s.length)return Promise.all(s).then(()=>o);return o}});var js=f("$ZodEnum",(e,t)=>{C.init(e,t);let r=Ue(t.entries),o=new Set(r);e._zod.values=o,P(e,"pattern",(n)=>{let i=Ue(n.def.entries).filter((s)=>$n.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>xe(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,i)=>{let s=n.value;if(o.has(s))return n;return n.issues.push({code:"invalid_value",values:r,input:s,inst:e}),n}}),Ls=f("$ZodLiteral",(e,t)=>{C.init(e,t);let r=new Set(t.values);e._zod.values=r,P(e,"pattern",(o)=>{let n=o.def.values;return new RegExp(n.length?`^(${n.map((i)=>typeof i==="string"?xe(i):i?xe(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,n)=>{let i=o.value;if(r.has(i))return o;return o.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),o}});var Ds=f("$ZodTransform",(e,t)=>{C.init(e,t),e._zod.optin="optional",X.memoizer?.guard(e),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new qe(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then((s)=>(r.value=s,r));if(n instanceof Promise)throw new me;return r.value=n,r}});function Ji(e,t){return e.value=t.issues.length?void 0:t.value,e}var Jr=f("$ZodOptional",(e,t)=>{C.init(e,t),P(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",P(e,"values",(r)=>{let o=r.def.innerType._zod.values;return o?new Set([...o,void 0]):void 0}),P(e,"pattern",(r)=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${at(o.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let n=t.innerType._zod.run({value:r.value,issues:[]},o);if(n instanceof Promise)return n.then((i)=>Ji(r,i));return Ji(r,n)}return t.innerType._zod.run(r,o)}}),Us=f("$ZodExactOptional",(e,t)=>{Jr.init(e,t),P(e,"values",(r)=>r.def.innerType._zod.values),P(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),Ms=f("$ZodNullable",(e,t)=>{C.init(e,t),P(e,"optin",(r)=>r.def.innerType._zod.optin),P(e,"optout",(r)=>r.def.innerType._zod.optout),P(e,"pattern",(r)=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${at(o.source)}|null)$`):void 0}),P(e,"values",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),Fs=f("$ZodDefault",(e,t)=>{C.init(e,t),e._zod.optin="defaulted",P(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>qi(i,t));return qi(n,t)}});function qi(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Bs=f("$ZodPrefault",(e,t)=>{C.init(e,t),e._zod.optin="defaulted",P(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),Js=f("$ZodNonOptional",(e,t)=>{C.init(e,t),P(e,"values",(r)=>{let o=r.def.innerType._zod.values;return o?new Set([...o].filter((n)=>n!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>Vi(i,e));return Vi(n,e)}});function Vi(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function Ki(e,t,r,o){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((n)=>fe(n,o,Y()))},input:e.value}),e}var qs=f("$ZodCatch",(e,t)=>{C.init(e,t),P(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),P(e,"optout",(r)=>r.def.innerType._zod.optout),P(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run({value:r.value,issues:[]},o);if(n instanceof Promise)return n.then((i)=>Ki(r,i,t,o));return Ki(r,n,t,o)}});var qr=f("$ZodPipe",(e,t)=>{C.init(e,t),P(e,"values",(r)=>r.def.in._zod.values),P(e,"optin",(r)=>r.def.in._zod.optin),P(e,"optout",(r)=>r.def.out._zod.optout),P(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let i=t.out._zod.run(r,o);if(i instanceof Promise)return i.then((s)=>vt(s,t.in,o));return vt(i,t.in,o)}let n=t.in._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>vt(i,t.out,o));return vt(n,t.out,o)}});function vt(e,t,r){if(e.issues.some((o)=>o.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var Vs=f("$ZodPreprocess",(e,t)=>{qr.init(e,t)}),Ks=f("$ZodReadonly",(e,t)=>{C.init(e,t),P(e,"propValues",(r)=>r.def.innerType._zod.propValues),P(e,"values",(r)=>r.def.innerType._zod.values),P(e,"optin",(r)=>r.def.innerType?._zod?.optin),P(e,"optout",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then(Wi);return Wi(n)}});function Wi(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var Ws=f("$ZodCustom",(e,t)=>{q.init(e,t),C.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=(r)=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then((i)=>Gi(i,r,o,e));Gi(n,r,o,e);return}});function Gi(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)n.params=o._zod.def.params;t.issues.push(ke(n))}}class Hs extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Kr="~memo",Gs=[];function Xs(e){return e!==null&&typeof e==="object"}function Vr(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var Ys=new WeakMap,Ge=0,Ot=1,He=2;function Rt(e,t,r){let o=Ys.get(e);if(o!==void 0)return o?He:Ge;if(t.has(e))return He;t.add(e);let n=Ge,i=(p)=>{if(n!==He&&p?._zod){let d=Rt(p,t,r);if(d>n)n=d}},s=(p,d)=>{let h=Ge;for(let m of Reflect.ownKeys(p)){let g=Object.getOwnPropertyDescriptor(p,m);if(d&&!g.enumerable)continue;let v=g.get?Ot:g.value?._zod?Rt(g.value,t,r):Ge;if(v>h)h=v}return h},c=(p)=>{if(p>n)n=p},a=e._zod.def,l=a.type;switch(l){case"object":{let p=Je(a);c(p?s(p,!0):Ot),i(a.catchall);break}case"array":i(a.element);break;case"tuple":for(let p of a.items)i(p);i(a.rest);break;case"record":case"map":i(a.keyType),i(a.valueType);break;case"set":i(a.valueType);break;case"union":for(let p of a.options)i(p);break;case"intersection":i(a.left),i(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(a.innerType);break;case"pipe":i(a.in),i(a.out);break;case"function":i(a.input),i(a.output);break;case"lazy":{let p=a._cachedInner??(r?e._zod.innerType:void 0);c(p?Rt(p,t,!1):Ot);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let p in a){let d=Object.getOwnPropertyDescriptor(a,p);if(!d||d.get)continue;let h=d.value;if(!h||typeof h!=="object")continue;if(h._zod)i(h);else if(Array.isArray(h))for(let m of h)i(m)}}return t.delete(e),Sl(e,n)}function Sl(e,t){if(t!==Ot)Ys.set(e,t===He);return t}function kl(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var Pt,Zt=[],Pl={alloc(e,t,r){let o=Pt;if(!o)return r;Pt=void 0;let n={value:r,issues:null};return o.set(t.value,n),Zt.push(n),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,o=(n,i)=>{if(i.direction!=="backward"&&Zl(i,n.value))throw new Hs;return r(n,i)};if(e._zod.parse=o,e._zod.run===r)e._zod.run=o})},attach(e){var t;let r,o=!1,n,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,c=(a,l)=>{if(r===void 0){let Z=Rt(e,new Set,!1);if(Z===Ge){if(e._zod.parse=s,e._zod.run===c)e._zod.run=s;return s(a,l)}if(Z===He||o)r=!0;else o=!0}let p=a.value;if(!Xs(p))return s(a,l);let d=l[Kr];if(!d)d={buckets:new WeakMap,backEdges:void 0},l[Kr]=d;let h;if(n===l)h=i;else h=kl(d,e),n=l,i=h;let m=h.get(p);if(m){if(a.value=m.value,m.issues){if(m.issues.length)a.issues.push(...Vr(m.issues))}else a.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(m.value);return a}Pt=h;let g=Zt.length,v=s(a,l);Pt=void 0;let w=Zt.length>g?Zt.pop():void 0;if(v instanceof Promise)return v.then((Z)=>{if(w)w.issues=Z.issues.length?Vr(Z.issues):Gs;return Z});if(w)w.issues=v.issues.length?Vr(v.issues):Gs;return v};if(e._zod.parse=c,e._zod.run===s)e._zod.run=c})}};function Wr(){return Pl}function Zl(e,t){let r=e[Kr]?.backEdges;return r!==void 0&&Xs(t)&&r.has(t)}var Ol=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};function n(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return o[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=n(i.expected),c=Rn(i.input),a=n(c,i.input);return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${_r(i.values[0])}`;return`Invalid option: expected one of ${mr(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);if(c)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${c.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);if(c)return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${c.unit}`;return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${mr(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0)return`Invalid discriminator value. Expected ${i.options.map((c)=>`'${c}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function Gr(){return{localeError:Ol()}}var Qs;class ec{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let o={...r,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function tc(){return new ec}(Qs=globalThis).__zod_globalRegistry??(Qs.__zod_globalRegistry=tc());var be=globalThis.__zod_globalRegistry;function Hr(e){if(e.checks)e.checks=[...e.checks];return e}function rc(e,t){return new e(Hr({type:"string",...y(t)}))}function oc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...y(t)})}function nc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...y(t)})}function ic(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...y(t)})}function sc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...y(t)})}function cc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...y(t)})}function ac(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...y(t)})}function Xr(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...y(t)})}function uc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...y(t)})}function lc(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...y(t)})}function pc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...y(t)})}function fc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...y(t)})}function dc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...y(t)})}function mc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...y(t)})}function hc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...y(t)})}function gc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...y(t)})}function _c(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...y(t)})}function zc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...y(t)})}function xc(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...y(t)})}function yc(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...y(t)})}function bc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...y(t)})}function vc(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...y(t)})}function wc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...y(t)})}function Tt(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...y(t)})}function Qr(e,t){return new e({type:"string",format:"date",check:"string_format",...y(t)})}function go(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...y(t)})}function _o(e,t){return new e({type:"string",format:"duration",check:"string_format",...y(t)})}function $c(e,t){return new e(Hr({type:"number",checks:[],...y(t)}))}function Sc(e,t){return new e(Hr({type:"number",coerce:!0,checks:[],...y(t)}))}function kc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...y(t)})}function Pc(e,t){return new e({type:"boolean",...y(t)})}function Zc(e,t){return new e({type:"null",...y(t)})}function Oc(e){return new e({type:"any"})}function Rc(e){return new e({type:"unknown"})}function Cc(e,t){return new e({type:"never",...y(t)})}function At(e,t){return new Nr({check:"less_than",...y(t),value:e,inclusive:!1})}function Xe(e,t){return new Nr({check:"less_than",...y(t),value:e,inclusive:!0})}function Et(e,t){return new jr({check:"greater_than",...y(t),value:e,inclusive:!1})}function Ye(e,t){return new jr({check:"greater_than",...y(t),value:e,inclusive:!0})}function Nt(e,t){return new ki({check:"multiple_of",...y(t),value:e})}function jt(e,t){return new Zi({check:"max_length",...y(t),maximum:e})}function Oe(e,t){return new Oi({check:"min_length",...y(t),minimum:e})}function Dt(e,t){return new Ri({check:"length_equals",...y(t),length:e})}function zo(e,t){return new Ci({check:"string_format",format:"regex",...y(t),pattern:e})}function xo(e){return new Ii({check:"string_format",format:"lowercase",...y(e)})}function yo(e){return new Ti({check:"string_format",format:"uppercase",...y(e)})}function bo(e,t){return new Ai({check:"string_format",format:"includes",...y(t),includes:e})}function vo(e,t){return new Ei({check:"string_format",format:"starts_with",...y(t),prefix:e})}function wo(e,t){return new Ni({check:"string_format",format:"ends_with",...y(t),suffix:e})}function ve(e){return new ji({check:"overwrite",tx:e})}function $o(e){return ve((t)=>t.normalize(e))}function So(){return ve((e)=>e.trim())}function ko(){return ve((e)=>e.toLowerCase())}function Po(){return ve((e)=>e.toUpperCase())}function Oo(){return ve((e)=>vn(e))}function Ic(e,t,r){return new e({type:"array",element:t,...y(r)})}function Tc(e,t,r){let o=y(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function Ac(e,t,r){return new e({type:"custom",check:"custom",fn:t,...y(r)})}function Ec(e,t){let r=Rl((o)=>(o.addIssue=(n)=>{if(typeof n==="string")o.issues.push(ke(n,o.value,r._zod.def));else{let i=n;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=o.value;i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),o.issues.push(ke(i))}},e(o.value,o)),t);return r}function Rl(e,t){let r=new q({check:"custom",...y(t)});return r._zod.check=e,r}function Qe(e,...t){for(let r of t)for(let o of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,o))oe(e,o,r[o]);return e}function Co(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??be,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function _e(e,t,r,o,n){let i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:o.path,message:n}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(n);return Object.assign(r,i),!0}function D(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let p={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,p);else{let h=s.schema,m=t.processors[n.type];if(!m)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);m(e,t,h,p)}let d=e._zod.parent;if(d){if(!s.ref)s.ref=d;D(d,t,p),t.seen.get(d).isParent=!0}}let a=t.metadataRegistry.get(e);if(a)Qe(s.schema,a);if(t.io==="input"&&G(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(o=s.schema).default??(o.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function Nc(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Io(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let o=new Map;for(let s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let a=o.get(c);if(a&&a!==s[0])throw Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(c,s[0])}}let n=(s)=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(s[0])?.id,h=e.external.uri??((g)=>g);if(d)return{ref:h(d)};let m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=m,{defId:m,ref:`${h("__shared")}#/${c}/${Nc(m)}`}}let a="#",l=`${a}/${c}/`;if(s[1]===r&&!s[1].schema.id)return{ref:a};let p=s[1].schema.id??`__schema${e.counter++}`;return{defId:p,ref:l+Nc(p)}},i=(s)=>{if(s[1].schema.$ref)return;let c=s[1],{ref:a,defId:l}=n(s);if(c.def={...c.schema},l)c.defId=l;let p=c.schema;for(let d in p)delete p[d];p.$ref=a};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
56
|
+
`)}return w.write("payload.value = newResult;"),w.write("return payload;"),w.compile()},s,c=Pe,a=!X.jitless,p=a&&wn.value,d=t.catchall,h;e._zod.parse=(m,g)=>{h??(h=o.value);let v=m.value;if(!c(v))return m.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),m;if(a&&p&&g?.async===!1&&g.jitless!==!0){if(!s)s=i(t.shape);if(m=s(m,g),!d)return m;return Is([],v,m,g,h,e,g?.abortEarly===!0)}return r(m,g)}});function Fi(e,t,r,o){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let n=e.filter((i)=>!pe(i));if(n.length===1)return t.value=n[0].value,n[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>fe(s,o,Y())))}),t}var Br=f("$ZodUnion",(e,t)=>{C.init(e,t),P(e,"optin",(o)=>o.def.options.some((n)=>n._zod.optin==="defaulted")?"defaulted":o.def.options.some((n)=>n._zod.optin!==void 0)?"optional":void 0),P(e,"optout",(o)=>o.def.options.some((n)=>n._zod.optout==="optional")?"optional":void 0),P(e,"values",(o)=>{if(o.def.options.every((n)=>n._zod.values))return new Set(o.def.options.flatMap((n)=>Array.from(n._zod.values)));return}),P(e,"pattern",(o)=>{if(o.def.options.every((n)=>n._zod.pattern)){let n=o.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${n.map((i)=>at(i.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let i=!1,s=[];for(let c of t.options){let a=c._zod.run({value:o.value,issues:[]},n);if(a instanceof Promise)s.push(a),i=!0;else{if(a.issues.length===0)return a;s.push(a)}}if(!i)return Fi(s,o,e,n);return Promise.all(s).then((c)=>Fi(c,o,e,n))}});function $l(e){let t=new Map;for(let r of e.options){let o=r._zod.propValues?.[e.discriminator];if(!o||o.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let n of o)if(t.has(n)){if(n!==void 0)throw Error(`Duplicate discriminator value "${String(n)}"`);t.set(n,null)}else t.set(n,r)}return t}var As=f("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Br.init(e,t);let r=e._zod.parse;P(e,"propValues",(n)=>{let i={},s=0;for(let c of n.def.options){let a=c._zod.propValues;if(!a||Object.keys(a).length===0)throw Error(`Invalid discriminated union option at index "${n.def.options.indexOf(c)}"`);if(a[n.def.discriminator]?.has(void 0))s++;for(let[l,p]of Object.entries(a)){if(!Object.prototype.hasOwnProperty.call(i,l))oe(i,l,new Set);for(let d of p)i[l].add(d)}}if(!n.def.unionFallback&&s>1)i[n.def.discriminator]?.delete(void 0);return i}),t.options.forEach((n,i)=>{let s=Je(n._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let o=Be(()=>$l(t));e._zod.parse=(n,i)=>{let s=n.value;if(!Pe(s))return n.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),n;let c=s?.[t.discriminator],a=o.value.get(c);if(a&&(c!==void 0||i.direction!=="backward"))return a._zod.run(n,i);if(t.unionFallback||i.direction==="backward")return r(n,i);return n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()).filter((l)=>o.value.get(l)!==null),input:s,path:[t.discriminator],inst:e}),n}}),Es=f("$ZodIntersection",(e,t)=>{C.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,i=t.left._zod.run({value:n,issues:[]},o),s=t.right._zod.run({value:n,issues:[]},o);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([a,l])=>Bi(r,a,l));return Bi(r,i,s)}});function Dr(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Se(e)&&Se(t)){let r=Object.keys(t),o=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),n={...e,...t};if(Object.prototype.hasOwnProperty.call(n,"__proto__"))delete n.__proto__;for(let i of o){if(i==="__proto__")continue;let s=Dr(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n[i]=s.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],i=t[o],s=Dr(n,i);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Bi(e,t,r){let o=new Map,n,i=new Map,s=(l,p)=>{let d;if(l.code==="unrecognized_keys"&&!l.path?.length)n??(n=l),d=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let h=String(l.path[0]);if(!i.has(h))i.set(h,l);d=[h]}else return!1;for(let h of d){if(!o.has(h))o.set(h,{});o.get(h)[p]=!0}return!0};for(let l of t.issues)if(!s(l,"l"))e.issues.push(l);for(let l of r.issues)if(!s(l,"r"))e.issues.push(l);let c=[...o].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(c.length){let l=n?c.filter((p)=>n.keys.includes(p)):[];if(l.length)e.issues.push({...n,keys:l});for(let p of c)if(!l.includes(p)&&i.has(p))e.issues.push(i.get(p))}let a=Dr(t.value,r.value);if(!a.valid){if(pe(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}var Ns=f("$ZodRecord",(e,t)=>{C.init(e,t);let r=X.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let i=o.value;if(!Se(i))return o.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),o;let s=[],c=t.keyType._zod.values;if(c&&!t.partial){o.value=r?r.alloc(e,o,{},n):{};let a=new Set;for(let p of c)if(typeof p==="string"||typeof p==="number"||typeof p==="symbol"){if(a.add(typeof p==="number"?p.toString():p),p==="__proto__")continue;let d=t.keyType._zod.run({value:p,issues:[]},n);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(d.issues.length){o.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((g)=>fe(g,n,Y())),input:p,path:[p],inst:e});continue}let h=d.value;if(h==="__proto__")continue;let m=t.valueType._zod.run({value:i[p],issues:[]},n);if(m instanceof Promise)s.push(m.then((g)=>{if(g.issues.length)o.issues.push(...ye(p,g.issues));o.value[h]=g.value}));else{if(m.issues.length)o.issues.push(...ye(p,m.issues));o.value[h]=m.value}}let l;for(let p in i)if(!a.has(p))if(t.mode==="loose"){if(p==="__proto__")continue;o.value[p]=i[p]}else l=l??[],l.push(p);if(l&&l.length>0)o.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:!0})}else{o.value=r?r.alloc(e,o,{},n):{};let a;for(let l of Reflect.ownKeys(i)){if(l==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,l))continue;let p=t.keyType._zod.run({value:l,issues:[]},n);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof l==="string"&&Ke.test(l)&&p.issues.length){let g=t.keyType._zod.run({value:Number(l),issues:[]},n);if(g instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(g.issues.length===0)p=g}if(p.issues.length){if(t.mode==="loose")o.value[l]=i[l];else if(c)a=a??[],a.push(l);else o.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map((g)=>fe(g,n,Y())),input:l,path:[l],inst:e});continue}let h=p.value;if(h==="__proto__")continue;let m=t.valueType._zod.run({value:i[l],issues:[]},n);if(m instanceof Promise)s.push(m.then((g)=>{if(g.issues.length)o.issues.push(...ye(l,g.issues));o.value[h]=g.value}));else{if(m.issues.length)o.issues.push(...ye(l,m.issues));o.value[h]=m.value}}if(a&&a.length>0)o.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a,continue:!0})}if(s.length)return Promise.all(s).then(()=>o);return o}});var js=f("$ZodEnum",(e,t)=>{C.init(e,t);let r=Ue(t.entries),o=new Set(r);e._zod.values=o,P(e,"pattern",(n)=>{let i=Ue(n.def.entries).filter((s)=>$n.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>xe(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,i)=>{let s=n.value;if(o.has(s))return n;return n.issues.push({code:"invalid_value",values:r,input:s,inst:e}),n}}),Ls=f("$ZodLiteral",(e,t)=>{C.init(e,t);let r=new Set(t.values);e._zod.values=r,P(e,"pattern",(o)=>{let n=o.def.values;return new RegExp(n.length?`^(${n.map((i)=>typeof i==="string"?xe(i):i?xe(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,n)=>{let i=o.value;if(r.has(i))return o;return o.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),o}});var Ds=f("$ZodTransform",(e,t)=>{C.init(e,t),e._zod.optin="optional",X.memoizer?.guard(e),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new qe(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then((s)=>(r.value=s,r));if(n instanceof Promise)throw new me;return r.value=n,r}});function Ji(e,t){return e.value=t.issues.length?void 0:t.value,e}var Jr=f("$ZodOptional",(e,t)=>{C.init(e,t),P(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",P(e,"values",(r)=>{let o=r.def.innerType._zod.values;return o?new Set([...o,void 0]):void 0}),P(e,"pattern",(r)=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${at(o.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let n=t.innerType._zod.run({value:r.value,issues:[]},o);if(n instanceof Promise)return n.then((i)=>Ji(r,i));return Ji(r,n)}return t.innerType._zod.run(r,o)}}),Us=f("$ZodExactOptional",(e,t)=>{Jr.init(e,t),P(e,"values",(r)=>r.def.innerType._zod.values),P(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),Ms=f("$ZodNullable",(e,t)=>{C.init(e,t),P(e,"optin",(r)=>r.def.innerType._zod.optin),P(e,"optout",(r)=>r.def.innerType._zod.optout),P(e,"pattern",(r)=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${at(o.source)}|null)$`):void 0}),P(e,"values",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),Fs=f("$ZodDefault",(e,t)=>{C.init(e,t),e._zod.optin="defaulted",P(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>qi(i,t));return qi(n,t)}});function qi(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Bs=f("$ZodPrefault",(e,t)=>{C.init(e,t),e._zod.optin="defaulted",P(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),Js=f("$ZodNonOptional",(e,t)=>{C.init(e,t),P(e,"values",(r)=>{let o=r.def.innerType._zod.values;return o?new Set([...o].filter((n)=>n!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>Vi(i,e));return Vi(n,e)}});function Vi(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function Ki(e,t,r,o){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((n)=>fe(n,o,Y()))},input:e.value}),e}var qs=f("$ZodCatch",(e,t)=>{C.init(e,t),P(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),P(e,"optout",(r)=>r.def.innerType._zod.optout),P(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run({value:r.value,issues:[]},o);if(n instanceof Promise)return n.then((i)=>Ki(r,i,t,o));return Ki(r,n,t,o)}});var qr=f("$ZodPipe",(e,t)=>{C.init(e,t),P(e,"values",(r)=>r.def.in._zod.values),P(e,"optin",(r)=>r.def.in._zod.optin),P(e,"optout",(r)=>r.def.out._zod.optout),P(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let i=t.out._zod.run(r,o);if(i instanceof Promise)return i.then((s)=>yt(s,t.in,o));return yt(i,t.in,o)}let n=t.in._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>yt(i,t.out,o));return yt(n,t.out,o)}});function yt(e,t,r){if(e.issues.some((o)=>o.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var Vs=f("$ZodPreprocess",(e,t)=>{qr.init(e,t)}),Ks=f("$ZodReadonly",(e,t)=>{C.init(e,t),P(e,"propValues",(r)=>r.def.innerType._zod.propValues),P(e,"values",(r)=>r.def.innerType._zod.values),P(e,"optin",(r)=>r.def.innerType?._zod?.optin),P(e,"optout",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then(Wi);return Wi(n)}});function Wi(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var Ws=f("$ZodCustom",(e,t)=>{q.init(e,t),C.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=(r)=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then((i)=>Gi(i,r,o,e));Gi(n,r,o,e);return}});function Gi(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)n.params=o._zod.def.params;t.issues.push(ke(n))}}class Hs extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Kr="~memo",Gs=[];function Xs(e){return e!==null&&typeof e==="object"}function Vr(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var Ys=new WeakMap,Ge=0,Ot=1,He=2;function Rt(e,t,r){let o=Ys.get(e);if(o!==void 0)return o?He:Ge;if(t.has(e))return He;t.add(e);let n=Ge,i=(p)=>{if(n!==He&&p?._zod){let d=Rt(p,t,r);if(d>n)n=d}},s=(p,d)=>{let h=Ge;for(let m of Reflect.ownKeys(p)){let g=Object.getOwnPropertyDescriptor(p,m);if(d&&!g.enumerable)continue;let v=g.get?Ot:g.value?._zod?Rt(g.value,t,r):Ge;if(v>h)h=v}return h},c=(p)=>{if(p>n)n=p},a=e._zod.def,l=a.type;switch(l){case"object":{let p=Je(a);c(p?s(p,!0):Ot),i(a.catchall);break}case"array":i(a.element);break;case"tuple":for(let p of a.items)i(p);i(a.rest);break;case"record":case"map":i(a.keyType),i(a.valueType);break;case"set":i(a.valueType);break;case"union":for(let p of a.options)i(p);break;case"intersection":i(a.left),i(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(a.innerType);break;case"pipe":i(a.in),i(a.out);break;case"function":i(a.input),i(a.output);break;case"lazy":{let p=a._cachedInner??(r?e._zod.innerType:void 0);c(p?Rt(p,t,!1):Ot);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let p in a){let d=Object.getOwnPropertyDescriptor(a,p);if(!d||d.get)continue;let h=d.value;if(!h||typeof h!=="object")continue;if(h._zod)i(h);else if(Array.isArray(h))for(let m of h)i(m)}}return t.delete(e),Sl(e,n)}function Sl(e,t){if(t!==Ot)Ys.set(e,t===He);return t}function kl(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var Pt,Zt=[],Pl={alloc(e,t,r){let o=Pt;if(!o)return r;Pt=void 0;let n={value:r,issues:null};return o.set(t.value,n),Zt.push(n),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,o=(n,i)=>{if(i.direction!=="backward"&&Zl(i,n.value))throw new Hs;return r(n,i)};if(e._zod.parse=o,e._zod.run===r)e._zod.run=o})},attach(e){var t;let r,o=!1,n,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,c=(a,l)=>{if(r===void 0){let Z=Rt(e,new Set,!1);if(Z===Ge){if(e._zod.parse=s,e._zod.run===c)e._zod.run=s;return s(a,l)}if(Z===He||o)r=!0;else o=!0}let p=a.value;if(!Xs(p))return s(a,l);let d=l[Kr];if(!d)d={buckets:new WeakMap,backEdges:void 0},l[Kr]=d;let h;if(n===l)h=i;else h=kl(d,e),n=l,i=h;let m=h.get(p);if(m){if(a.value=m.value,m.issues){if(m.issues.length)a.issues.push(...Vr(m.issues))}else a.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(m.value);return a}Pt=h;let g=Zt.length,v=s(a,l);Pt=void 0;let w=Zt.length>g?Zt.pop():void 0;if(v instanceof Promise)return v.then((Z)=>{if(w)w.issues=Z.issues.length?Vr(Z.issues):Gs;return Z});if(w)w.issues=v.issues.length?Vr(v.issues):Gs;return v};if(e._zod.parse=c,e._zod.run===s)e._zod.run=c})}};function Wr(){return Pl}function Zl(e,t){let r=e[Kr]?.backEdges;return r!==void 0&&Xs(t)&&r.has(t)}var Ol=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};function n(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return o[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=n(i.expected),c=Rn(i.input),a=n(c,i.input);return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${_r(i.values[0])}`;return`Invalid option: expected one of ${mr(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);if(c)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${c.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);if(c)return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${c.unit}`;return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${mr(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0)return`Invalid discriminator value. Expected ${i.options.map((c)=>`'${c}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function Gr(){return{localeError:Ol()}}var Qs;class ec{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let o={...r,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function tc(){return new ec}(Qs=globalThis).__zod_globalRegistry??(Qs.__zod_globalRegistry=tc());var be=globalThis.__zod_globalRegistry;function Hr(e){if(e.checks)e.checks=[...e.checks];return e}function rc(e,t){return new e(Hr({type:"string",...y(t)}))}function oc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...y(t)})}function nc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...y(t)})}function ic(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...y(t)})}function sc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...y(t)})}function cc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...y(t)})}function ac(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...y(t)})}function Xr(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...y(t)})}function uc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...y(t)})}function lc(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...y(t)})}function pc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...y(t)})}function fc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...y(t)})}function dc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...y(t)})}function mc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...y(t)})}function hc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...y(t)})}function gc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...y(t)})}function _c(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...y(t)})}function zc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...y(t)})}function xc(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...y(t)})}function yc(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...y(t)})}function bc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...y(t)})}function vc(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...y(t)})}function wc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...y(t)})}function Tt(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...y(t)})}function Yr(e,t){return new e({type:"string",format:"date",check:"string_format",...y(t)})}function Qr(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...y(t)})}function go(e,t){return new e({type:"string",format:"duration",check:"string_format",...y(t)})}function $c(e,t){return new e(Hr({type:"number",checks:[],...y(t)}))}function Sc(e,t){return new e(Hr({type:"number",coerce:!0,checks:[],...y(t)}))}function kc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...y(t)})}function Pc(e,t){return new e({type:"boolean",...y(t)})}function Zc(e,t){return new e({type:"null",...y(t)})}function Oc(e){return new e({type:"any"})}function Rc(e){return new e({type:"unknown"})}function Cc(e,t){return new e({type:"never",...y(t)})}function At(e,t){return new Nr({check:"less_than",...y(t),value:e,inclusive:!1})}function Xe(e,t){return new Nr({check:"less_than",...y(t),value:e,inclusive:!0})}function Et(e,t){return new jr({check:"greater_than",...y(t),value:e,inclusive:!1})}function Ye(e,t){return new jr({check:"greater_than",...y(t),value:e,inclusive:!0})}function Nt(e,t){return new ki({check:"multiple_of",...y(t),value:e})}function jt(e,t){return new Zi({check:"max_length",...y(t),maximum:e})}function Oe(e,t){return new Oi({check:"min_length",...y(t),minimum:e})}function Dt(e,t){return new Ri({check:"length_equals",...y(t),length:e})}function _o(e,t){return new Ci({check:"string_format",format:"regex",...y(t),pattern:e})}function zo(e){return new Ii({check:"string_format",format:"lowercase",...y(e)})}function xo(e){return new Ti({check:"string_format",format:"uppercase",...y(e)})}function yo(e,t){return new Ai({check:"string_format",format:"includes",...y(t),includes:e})}function bo(e,t){return new Ei({check:"string_format",format:"starts_with",...y(t),prefix:e})}function vo(e,t){return new Ni({check:"string_format",format:"ends_with",...y(t),suffix:e})}function ve(e){return new ji({check:"overwrite",tx:e})}function wo(e){return ve((t)=>t.normalize(e))}function $o(){return ve((e)=>e.trim())}function So(){return ve((e)=>e.toLowerCase())}function ko(){return ve((e)=>e.toUpperCase())}function Po(){return ve((e)=>vn(e))}function Ic(e,t,r){return new e({type:"array",element:t,...y(r)})}function Tc(e,t,r){let o=y(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function Ac(e,t,r){return new e({type:"custom",check:"custom",fn:t,...y(r)})}function Ec(e,t){let r=Rl((o)=>(o.addIssue=(n)=>{if(typeof n==="string")o.issues.push(ke(n,o.value,r._zod.def));else{let i=n;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=o.value;i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),o.issues.push(ke(i))}},e(o.value,o)),t);return r}function Rl(e,t){let r=new q({check:"custom",...y(t)});return r._zod.check=e,r}function Qe(e,...t){for(let r of t)for(let o of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,o))oe(e,o,r[o]);return e}function Ro(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??be,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function _e(e,t,r,o,n){let i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:o.path,message:n}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(n);return Object.assign(r,i),!0}function D(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let p={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,p);else{let h=s.schema,m=t.processors[n.type];if(!m)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);m(e,t,h,p)}let d=e._zod.parent;if(d){if(!s.ref)s.ref=d;D(d,t,p),t.seen.get(d).isParent=!0}}let a=t.metadataRegistry.get(e);if(a)Qe(s.schema,a);if(t.io==="input"&&G(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(o=s.schema).default??(o.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function Nc(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Co(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let o=new Map;for(let s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let a=o.get(c);if(a&&a!==s[0])throw Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(c,s[0])}}let n=(s)=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(s[0])?.id,h=e.external.uri??((g)=>g);if(d)return{ref:h(d)};let m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=m,{defId:m,ref:`${h("__shared")}#/${c}/${Nc(m)}`}}let a="#",l=`${a}/${c}/`;if(s[1]===r&&!s[1].schema.id)return{ref:a};let p=s[1].schema.id??`__schema${e.counter++}`;return{defId:p,ref:l+Nc(p)}},i=(s)=>{if(s[1].schema.$ref)return;let c=s[1],{ref:a,defId:l}=n(s);if(c.def={...c.schema},l)c.defId=l;let p=c.schema;for(let d in p)delete p[d];p.$ref=a};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
57
57
|
|
|
58
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let l=e.external.registry.get(s[0])?.id;if(t!==s[0]&&l){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}if(c.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function Dc(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let o of t){if(!o||typeof o!=="object")return;Dc(o);let n=Object.keys(o);if(n.length!==1||n[0]!=="type")return;let i=o.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!r.includes(s))r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var Uc=new Set(["type","properties","required","additionalProperties"]),jc=["oneOf","anyOf"];function Lc(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function Ro(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!Uc.has(s))return null;t.push(i)}let r={},o=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let c=[];for(let l of t){let p=l.properties?.[s]??Lc(l);if(p===null||p===void 0)continue;if(!c.some((d)=>JSON.stringify(d)===JSON.stringify(p)))c.push(p)}let a=c.length===1?c[0]:Ro(c)??{allOf:c};oe(r,s,a)}for(let s of i.required??[])o.add(s)}let n={type:"object",properties:r};if(o.size)n.required=[...o];if(t.every((i)=>i.additionalProperties===!1))n.additionalProperties=!1;else{let i=[];for(let s of t){let c=Lc(s);if(c&&!i.some((a)=>JSON.stringify(a)===JSON.stringify(c)))i.push(c)}if(i.length===1)n.additionalProperties=i[0];else if(i.length>1)n.additionalProperties={allOf:i}}return n}function Cl(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let n of Uc)if(n in e)return;let r=t.filter((n)=>jc.some((i)=>Array.isArray(n[i]))),o=null;if(!r.length)o=Ro(t);else{let n=r[0],i=jc.find((a)=>Array.isArray(n[a]));if(Object.keys(n).length!==1)return;let s=t.filter((a)=>a!==n),c=n[i].map((a)=>Ro([...s,a]));if(c.some((a)=>!a))return;o={[i]:c}}if(!o)return;delete e.allOf,Qe(e,o)}function To(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(c)=>{let a=e.seen.get(c);if(a.ref===null)return;let l=a.def??a.schema,p={...l},d=a.ref;if(a.ref=null,d){o(d);let m=e.seen.get(d),g=m.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(g);else Qe(l,g);if(Qe(l,p),c._zod.parent===d)for(let w in l){if(w==="$ref"||w==="allOf")continue;if(!(w in p))delete l[w]}if(g.$ref&&m.def)for(let w in l){if(w==="$ref"||w==="allOf")continue;if(w in m.def&&JSON.stringify(l[w])===JSON.stringify(m.def[w]))delete l[w]}}let h=c._zod.parent;if(h&&h!==d){o(h);let m=e.seen.get(h);if(m?.schema.$ref){if(l.$ref=m.schema.$ref,m.def)for(let g in l){if(g==="$ref"||g==="allOf")continue;if(g in m.def&&JSON.stringify(l[g])===JSON.stringify(m.def[g]))delete l[g]}}}e.override({zodSchema:c,jsonSchema:l,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())o(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())Dc(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let l of[a.schema,a.def]){let p=l?.allOf;if(!Array.isArray(p))continue;let d=c.get(p);if(d)d.push(l);else c.set(p,[l])}for(let a of e.intersections)for(let l of c.get(a)??[])Cl(l)}}let n={};if(e.target==="draft-2020-12")n.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")n.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")n.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(c)}Qe(n,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&n.id===i)delete n.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];if(a.def&&a.defId){if(a.def.id===a.defId)delete a.def.id;oe(s,a.defId,a.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")n.$defs=s;else n.definitions=s;try{let c=JSON.parse(JSON.stringify(n));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:et(t,"input",e.processors),output:et(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error("Error converting schema to JSON.")}}function G(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return G(o.element,r);if(o.type==="set")return G(o.valueType,r);if(o.type==="lazy")return G(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return G(o.innerType,r);if(o.type==="intersection")return G(o.left,r)||G(o.right,r);if(o.type==="record"||o.type==="map")return G(o.keyType,r)||G(o.valueType,r);if(o.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return G(o.in,r)||G(o.out,r)}if(o.type==="object"){for(let n in o.shape)if(G(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(G(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(G(n,r))return!0;if(o.rest&&G(o.rest,r))return!0;return!1}return!1}var Mc=(e,t={})=>(r)=>{let o=Co({...r,processors:t});return D(e,o),Io(o,e),To(o,e)},et=(e,t,r={})=>(o)=>{let{libraryOptions:n,target:i}=o??{},s=Co({...n??{},target:i,io:t,processors:r});return D(e,s),Io(s,e),To(s,e)};var Re=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},Ce=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},Fc=(e,t)=>{Re(e,"minimum",t),Ce(e,"maximum",t)},Vc=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Kc=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Wc=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},Gc=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Bc=(e,t)=>Re(e,"minimum",t.minimum),Jc=(e,t)=>Ce(e,"maximum",t.maximum),qc=(e)=>(t,r)=>{Gc(t,r.format);let[o,n]=e[r.format];Re(t,"minimum",o),Ce(t,"maximum",n)},Il={greater_than:(e,t)=>Re(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Ce(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Vc(e,t.value),number_format:qc(ut),bigint_format:qc(zr),min_length:Bc,max_length:Jc,length_equals:(e,t)=>Fc(e,t.length),min_size:Bc,max_size:Jc,size_equals:(e,t)=>Fc(e,t.size),string_format:(e,t)=>{if(Gc(e,t.format),t.pattern)Kc(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>Wc(e,t.mime)};function ie(e){let t={},r=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of o)Il[i._zod.def.check]?.(t,i._zod.def);let n=e._zod.bag;if(n.minimum!==void 0)Re(t,"minimum",n.minimum);if(n.exclusiveMinimum!==void 0)Re(t,"exclusiveMinimum",n.exclusiveMinimum);if(n.maximum!==void 0)Ce(t,"maximum",n.maximum);if(n.exclusiveMaximum!==void 0)Ce(t,"exclusiveMaximum",n.exclusiveMaximum);if(n.multipleOf!==void 0)Vc(t,n.multipleOf);if(n.format!==void 0){if(t.format??(t.format=n.format),n.format.includes("int"))t.isInt=!0}if(n.mime)Wc(t,n.mime);for(let i of n.patterns??[])Kc(t,i);return t}var Tl={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Al=new Map([[Mr,di],[kt,mi]]),Hc=(e)=>Al.get(e)??e,Xc=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:i,maximum:s,format:c,patterns:a,contentEncoding:l,laxFormat:p}=ie(e);if(typeof i==="number")n.minLength=i;if(typeof s==="number")n.maxLength=s;if(c){if(n.format=Tl[c]??c,n.format==="")delete n.format;if(c==="time"||p)delete n.format}if(l)n.contentEncoding=l;if(a&&a.size>0){let d=[...a].map(Hc);if(d.length===1)n.pattern=d[0].source;else if(d.length>1)n.allOf=[...d.map((h)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))]}},Yc=(e,t,r,o)=>{let n=r,{minimum:i,maximum:s,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:l,isInt:p}=ie(e);n.type=p?"integer":"number";let d=typeof l==="number"&&l>=(i??Number.NEGATIVE_INFINITY),h=typeof a==="number"&&a<=(s??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(d)if(m)n.minimum=l,n.exclusiveMinimum=!0;else n.exclusiveMinimum=l;else if(typeof i==="number")n.minimum=i;if(h)if(m)n.maximum=a,n.exclusiveMaximum=!0;else n.exclusiveMaximum=a;else if(typeof s==="number")n.maximum=s;if(c){let g=new Set;for(let Z of c)if(Number.isFinite(Z)&&Z!==0)g.add(Math.abs(Z));else _e(e,t,n,o,`A multipleOf divisor of ${Z} cannot be represented in JSON Schema`);let[v,...w]=g;if(v!==void 0)n.multipleOf=v;if(w.length)n.allOf=[...n.allOf??[],...w.map((Z)=>({multipleOf:Z}))]}},Qc=(e,t,r,o)=>{r.type="boolean"};var ea=(e,t,r,o)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"};var ta=(e,t,r,o)=>{r.not={}},ra=(e,t,r,o)=>{},oa=(e,t,r,o)=>{};var na=(e,t,r,o)=>{let n=e._zod.def,i=Ue(n.entries);if(i.length===0){r.not={};return}if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";r.enum=i},ia=(e,t,r,o)=>{let n=e._zod.def;if(n.values.length===0){r.not={};return}let i=[];for(let s of n.values)if(s===void 0){if(_e(e,t,r,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(_e(e,t,r,o,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[s];else r.const=s}else{if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";if(i.every((s)=>typeof s==="boolean"))r.type="boolean";if(i.every((s)=>s===null))r.type="null";r.enum=i}};var sa=(e,t,r,o)=>{_e(e,t,r,o,"Custom types cannot be represented in JSON Schema")};var ca=(e,t,r,o)=>{_e(e,t,r,o,"Transforms cannot be represented in JSON Schema")};var aa=(e,t,r,o)=>{let n=r,i=e._zod.def,{minimum:s,maximum:c}=ie(e);if(typeof s==="number")n.minItems=s;if(typeof c==="number")n.maxItems=c;n.type="array",n.items=D(i.element,t,{...o,path:[...o.path,"items"]})};function Ut(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return Ut(t.out);if(t.type==="catch")return Ut(t.innerType);return e._zod.optin}var ua=(e,t,r,o)=>{let n=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&_e(e,t,n,o,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let l in s)oe(n.properties,l,D(s[l],t,{...o,path:[...o.path,"properties",l]}));let a=[];for(let l of Object.keys(s)){let p=i.shape[l];if(t.io==="input"?Ut(p)===void 0:p._zod.optout===void 0)a.push(l)}if(a.length>0)n.required=a;if(i.catchall?._zod.def.type==="never")n.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")n.additionalProperties=!1}else if(i.catchall)n.additionalProperties=D(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})},la=(e,t,r,o)=>{let n=e._zod.def,i=n.inclusive===!1,s=n.options.map((c,a)=>D(c,t,{...o,path:[...o.path,i?"oneOf":"anyOf",a]}));if(i)r.oneOf=s;else r.anyOf=s},pa=(e,t,r,o)=>{let n=e._zod.def,i=D(n.left,t,{...o,path:[...o.path,"allOf",0]}),s=D(n.right,t,{...o,path:[...o.path,"allOf",1]}),c=(l)=>("allOf"in l)&&Object.keys(l).length===1,a=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=a,t.intersections.push(a)};function Ao(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let g=e.get(t)?.def;if(!g)return t;let v=Ao(e,g,r);return v===g?t:v}for(let g of["anyOf","oneOf"]){let v=t[g];if(!Array.isArray(v))continue;let w=v.map((Z)=>Ao(e,Z,r));if(w.some((Z,H)=>Z!==v[H]))t={...t,[g]:w}}let o=Array.isArray(t.type)?t.type:[t.type],n=!o.includes("string")&&o.some((g)=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!n&&!i?.some((g)=>typeof g==="number"))return t;let{minimum:s,maximum:c,exclusiveMinimum:a,exclusiveMaximum:l,multipleOf:p,format:d,id:h,...m}=t;if(m.enum)m.enum=m.enum.map((g)=>typeof g==="number"?String(g):g);else if(typeof m.const==="number")m.const=String(m.const);if(!n)return m;if(m.type="string",!i)m.pattern=(o.includes("number")?Ke:Ar).source;return m}var Eo=new WeakMap;function El(e){let t=new Map;for(let o of e.seen.values())if(o.def&&!t.has(o.schema))t.set(o.schema,o);let r=new Map;for(let o of Eo.get(e)??[]){let n=e.seen.get(o),i=(n?.def??n?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=Ao(t,i,new Set);if(s!==i)r.set(i,s)}if(!r.size)return;for(let o of e.seen.values())for(let n of[o.schema,o.def]){let i=n&&r.get(n.propertyNames);if(i)n.propertyNames=i}}var fa=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object";let s=i.keyType,c=ie(s).patterns;if(i.mode==="loose"&&c&&c.size>0){let p=D(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let d of c)oe(n.patternProperties,Hc(d).source,p)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){n.propertyNames=D(i.keyType,t,{...o,path:[...o.path,"propertyNames"]});let p=Eo.get(t);if(!p)p=[],Eo.set(t,p),t.deferred.push(()=>El(t));p.push(e)}n.additionalProperties=D(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let a=s._zod.values,l=t.io==="input"&&Ut(i.valueType)!==void 0;if(a&&!i.partial&&!l){let p=[...a].filter((d)=>typeof d==="string"||typeof d==="number");if(p.length>0)n.required=p.map(String)}},da=(e,t,r,o)=>{let n=e._zod.def,i=D(n.innerType,t,o),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=n.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},ma=(e,t,r,o)=>{let n=e._zod.def;D(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},No=Symbol();function ha(e,t,r,o,n){let i=!1,s=JSON.stringify(e,(c,a)=>{if(typeof a!=="bigint")return a;return i=!0,null});if(!i)return JSON.parse(s);return _e(t,r,o,n,"BigInt defaults cannot be represented in JSON Schema"),No}var ga=(e,t,r,o)=>{let n=e._zod.def;D(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let s=ha(n.defaultValue,e,t,r,o);if(s!==No)r.default=s},_a=(e,t,r,o)=>{let n=e._zod.def;D(n.innerType,t,o);let i=t.seen.get(e);if(i.ref=n.innerType,t.io!=="input")return;let s=ha(n.defaultValue,e,t,r,o);if(s!==No)r._prefault=s},za=(e,t,r,o)=>{let n=e._zod.def;D(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let s;try{s=n.catchValue(void 0)}catch{_e(e,t,r,o,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},xa=(e,t,r,o)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?n.out:n.in:n.out;D(s,t,o);let c=t.seen.get(e);c.ref=s},ya=(e,t,r,o)=>{let n=e._zod.def;D(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0};var jo=(e,t,r,o)=>{let n=e._zod.def;D(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType};var ba=new WeakSet([Object.prototype,Error.prototype]);function Ft(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let o=r(this);return Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0})}})}var Jl=(e,t)=>{Ln.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(ba.has(r))return;ba.add(r),Ft(r,"format",(o)=>(n)=>Sr(o,n)),Ft(r,"flatten",(o)=>(n)=>$r(o,n)),Ft(r,"addIssue",(o)=>(n)=>{o.issues.push(n),o.message=JSON.stringify(o.issues,Me,2)}),Ft(r,"addIssues",(o)=>(n)=>{o.issues.push(...n),o.message=JSON.stringify(o.issues,Me,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var te=f("ZodError",Jl,void 0,{Parent:Error});var va=gt(te),wa=_t(te),$a=Ve(te),Sa=zt(te),ka=Mn(te),Pa=Fn(te),Za=Bn(te),Oa=Jn(te),Ra=qn(te),Ca=Vn(te),Ia=Kn(te),Ta=Wn(te);function Vl(){if(!X.localeError)Y(Gr())}function Jt(){if(!X.memoizer)Y({memoizer:Wr()})}var A=f("ZodType",(e,t)=>(Vl(),C.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(ee(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ue(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Tp(e,t))},superRefine(e,t){return this.check(Ap(e,t))},overwrite(e){return this.check(ve(e))},optional(){return j(this)},exactOptional(){return bp(this)},nullable(){return Na(this)},nullish(){return j(Na(this))},nonoptional(e){return Pp(this,e)},array(){return z(this)},or(e){return E([this,e])},and(e){return Vt(this,e)},transform(e){return ja(this,Ha(e))},default(e){return $p(this,e)},prefault(e){return kp(this,e)},catch(e){return Op(this,e)},pipe(e){return ja(this,e)},readonly(){return Ip(this)},describe(e){let t=this.clone();return be.add(t,{description:e}),t},meta(...e){if(e.length===0)return be.get(this);let t=this.clone();return be.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return mt(this,"~standard",{...Ur(this),jsonSchema:{input:et(this,"input"),output:et(this,"output")}})},set "~standard"(e){ge(this,"~standard",e)},parse:function e(t,r){return va(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await wa(this,t,r,{callee:e})},safeParse(e,t){return $a(this,e,t)},async safeParseAsync(e,t){return Sa(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){ge(this,"spa",e)},validate(e,t){return Pr(this,e,t)},validateAsync(e,t){return Or(this,e,t)},encode:function e(t,r){return ka(this,t,r,{callee:e})},decode:function e(t,r){return Pa(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Za(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Oa(this,t,r,{callee:e})},safeEncode(e,t){return Ra(this,e,t)},safeDecode(e,t){return Ca(this,e,t)},async safeEncodeAsync(e,t){return Ia(this,e,t)},async safeDecodeAsync(e,t){return Ta(this,e,t)},toJSONSchema(e){return Mc(this,{})(e)},get description(){return be.get(this)?.description},get _def(){return this._zod.def}}),La=f("_ZodString",(e,t)=>{St.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Xc(e,r,o,n)},In({format:(e)=>ie(e).format??null,minLength:(e)=>ie(e).minimum??null,maxLength:(e)=>ie(e).maximum??null},{regex(...e){return this.check(zo(...e))},includes(...e){return this.check(bo(...e))},startsWith(...e){return this.check(vo(...e))},endsWith(...e){return this.check(wo(...e))},min(...e){return this.check(Oe(...e))},max(...e){return this.check(jt(...e))},length(...e){return this.check(Dt(...e))},nonempty(...e){return this.check(Oe(1,...e))},lowercase(e){return this.check(xo(e))},uppercase(e){return this.check(yo(e))},trim(){return this.check(So())},normalize(...e){return this.check($o(...e))},toLowerCase(){return this.check(ko())},toUpperCase(){return this.check(Po())},slugify(){return this.check(Oo())}})),Da=f("ZodString",(e,t)=>{St.init(e,t),La.init(e,t)},{email(e){return this.check(oc(Kl,e))},url(e){return this.check(Xr(Ba,e))},jwt(e){return this.check(wc(up,e))},emoji(e){return this.check(uc(Gl,e))},guid(e){return this.check(nc(Wl,e))},uuid(e){return this.check(ic(Bt,e))},uuidv4(e){return this.check(sc(Bt,e))},uuidv6(e){return this.check(cc(Bt,e))},uuidv7(e){return this.check(ac(Bt,e))},nanoid(e){return this.check(lc(Hl,e))},cuid(e){return this.check(pc(Xl,e))},cuid2(e){return this.check(fc(Yl,e))},ulid(e){return this.check(dc(Ql,e))},base64(e){return this.check(yc(sp,e))},base64url(e){return this.check(bc(cp,e))},xid(e){return this.check(mc(ep,e))},ksuid(e){return this.check(hc(tp,e))},ipv4(e){return this.check(gc(rp,e))},ipv6(e){return this.check(_c(op,e))},cidrv4(e){return this.check(zc(np,e))},cidrv6(e){return this.check(xc(ip,e))},e164(e){return this.check(vc(ap,e))},datetime(e){return this.check(Tt(Do,e))},date(e){return this.check(Qr(Ua,e))},time(e){return this.check(go(Ma,e))},duration(e){return this.check(_o(Fa,e))}});function u(e){return rc(Da,e)}var L=f("ZodStringFormat",(e,t)=>{T.init(e,t),La.init(e,t)}),Do=f("ZodISODateTime",(e,t)=>{ls.init(e,t),L.init(e,t)}),Ua=f("ZodISODate",(e,t)=>{ps.init(e,t),L.init(e,t)}),Ma=f("ZodISOTime",(e,t)=>{fs.init(e,t),L.init(e,t)}),Fa=f("ZodISODuration",(e,t)=>{ds.init(e,t),L.init(e,t)}),Kl=f("ZodEmail",(e,t)=>{Qi.init(e,t),L.init(e,t)});var Wl=f("ZodGUID",(e,t)=>{Xi.init(e,t),L.init(e,t)});var Bt=f("ZodUUID",(e,t)=>{Yi.init(e,t),L.init(e,t)});var Ba=f("ZodURL",(e,t)=>{rs.init(e,t),L.init(e,t)});function Ja(e){return Xr(Ba,e)}var Gl=f("ZodEmoji",(e,t)=>{os.init(e,t),L.init(e,t)});var Hl=f("ZodNanoID",(e,t)=>{ns.init(e,t),L.init(e,t)});var Xl=f("ZodCUID",(e,t)=>{is.init(e,t),L.init(e,t)});var Yl=f("ZodCUID2",(e,t)=>{ss.init(e,t),L.init(e,t)});var Ql=f("ZodULID",(e,t)=>{cs.init(e,t),L.init(e,t)});var ep=f("ZodXID",(e,t)=>{as.init(e,t),L.init(e,t)});var tp=f("ZodKSUID",(e,t)=>{us.init(e,t),L.init(e,t)});var rp=f("ZodIPv4",(e,t)=>{ms.init(e,t),L.init(e,t)});var op=f("ZodIPv6",(e,t)=>{gs.init(e,t),L.init(e,t)});var np=f("ZodCIDRv4",(e,t)=>{_s.init(e,t),L.init(e,t)});var ip=f("ZodCIDRv6",(e,t)=>{zs.init(e,t),L.init(e,t)});var sp=f("ZodBase64",(e,t)=>{ys.init(e,t),L.init(e,t)});var cp=f("ZodBase64URL",(e,t)=>{bs.init(e,t),L.init(e,t)});var ap=f("ZodE164",(e,t)=>{vs.init(e,t),L.init(e,t)});var up=f("ZodJWT",(e,t)=>{ws.init(e,t),L.init(e,t)});var qt=f("ZodNumber",(e,t)=>{Fr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yc(e,r,o,n),e.isFinite=!0},In({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=ie(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=ie(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=ie(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>ie(e).format??null},{gt(e,t){return this.check(Et(e,t))},gte(e,t){return this.check(Ye(e,t))},min(e,t){return this.check(Ye(e,t))},lt(e,t){return this.check(At(e,t))},lte(e,t){return this.check(Xe(e,t))},max(e,t){return this.check(Xe(e,t))},int(e){return this.check(Aa(e))},safe(e){return this.check(Aa(e))},positive(e){return this.check(Et(0,e))},nonnegative(e){return this.check(Ye(0,e))},negative(e){return this.check(At(0,e))},nonpositive(e){return this.check(Xe(0,e))},multipleOf(e,t){return this.check(Nt(e,t))},step(e,t){return this.check(Nt(e,t))},finite(){return this}}));function k(e){return $c(qt,e)}var lp=f("ZodNumberFormat",(e,t)=>{$s.init(e,t),qt.init(e,t)});function Aa(e){return kc(lp,e)}var qa=f("ZodBoolean",(e,t)=>{Ss.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Qc(e,r,o,n)});function R(e){return Pc(qa,e)}var pp=f("ZodNull",(e,t)=>{ks.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ea(e,r,o,n)});function Va(e){return Zc(pp,e)}var fp=f("ZodAny",(e,t)=>{Ps.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ra(e,r,o,n)});function Ka(){return Oc(fp)}var dp=f("ZodUnknown",(e,t)=>{Zs.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>oa(e,r,o,n)});function N(){return Rc(dp)}var mp=f("ZodNever",(e,t)=>{Os.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ta(e,r,o,n)});function hp(e){return Cc(mp,e)}var gp=f("ZodArray",(e,t)=>{Jt(),Rs.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>aa(e,r,o,n),e.element=t.element},{min(e,t){return this.check(Oe(e,t))},nonempty(e){return this.check(Oe(1,e))},max(e,t){return this.check(jt(e,t))},length(e,t){return this.check(Dt(e,t))},unwrap(){return this.element}});function z(e,t){return Ic(gp,e,t)}var Wa=f("ZodObject",(e,t)=>{Jt(),Ts.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ua(e,r,o,n),Xu(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return Q(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(ee(this._zod.def,{catchall:e}))},passthrough(){return this.clone(ee(this._zod.def,{catchall:N()}))},loose(){return this.clone(ee(this._zod.def,{catchall:N()}))},strict(){return this.clone(ee(this._zod.def,{catchall:hp()}))},strip(){return this.clone(ee(this._zod.def,{catchall:void 0}))},extend(e){return Bu(this,e)},safeExtend(e){return Ju(this,e)},merge(e){return qu(this,e)},pick(e){return Mu(this,e)},omit(e){return Fu(this,e)},partial(...e){return Pn(Xa,this,e[0])},exactPartial(...e){return Pn(Ya,this,e[0],"exactPartial")},required(...e){return Vu(Qa,this,e[0])}});function x(e,t){let r={type:"object",shape:e??{},...y(t)};return new Wa(r)}function B(e,t){return new Wa({type:"object",shape:e,catchall:N(),...y(t)})}var Ga=f("ZodUnion",(e,t)=>{Br.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>la(e,r,o,n),e.options=t.options});function E(e,t){return new Ga({type:"union",options:e,...y(t)})}var _p=f("ZodDiscriminatedUnion",(e,t)=>{Ga.init(e,t),As.init(e,t)});function Uo(e,t,r){return new _p({type:"union",options:t,discriminator:e,...y(r)})}var zp=f("ZodIntersection",(e,t)=>{Es.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>pa(e,r,o,n)});function Vt(e,t){return new zp({type:"intersection",left:e,right:t})}var Ea=f("ZodRecord",(e,t)=>{Jt(),Ns.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>fa(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function I(e,t,r){if(!t||!t._zod)return new Ea({type:"record",keyType:u(),valueType:e,...y(t)});return new Ea({type:"record",keyType:e,valueType:t,...y(r)})}var Lo=f("ZodEnum",(e,t)=>{js.init(e,t),A.init(e,t),e._zod.processJSONSchema=(o,n,i)=>na(e,o,n,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let i={};for(let s of o)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new Lo({...t,checks:[],...y(n),entries:i})},e.exclude=(o,n)=>{let i={...t.entries};for(let s of o)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new Lo({...t,checks:[],...y(n),entries:i})}});function Q(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new Lo({type:"enum",entries:r,...y(t)})}var xp=f("ZodLiteral",(e,t)=>{Ls.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ia(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function b(e,t){return new xp({type:"literal",values:Array.isArray(e)?e:[e],...y(t)})}var yp=f("ZodTransform",(e,t)=>{Jt(),Ds.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ca(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new qe(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(ke(i,r.value,t));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=r.value;s.inst??(s.inst=e),r.issues.push(ke(s))}};let n=t.transform(r.value,r);if(n instanceof Promise)return n.then((i)=>(r.value=i,r));return r.value=n,r}});function Ha(e){return new yp({type:"transform",transform:e})}var Xa=f("ZodOptional",(e,t)=>{Jr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>jo(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function j(e){return new Xa({type:"optional",innerType:e})}var Ya=f("ZodExactOptional",(e,t)=>{Us.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>jo(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function bp(e){return new Ya({type:"optional",innerType:e})}var vp=f("ZodNullable",(e,t)=>{Ms.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>da(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Na(e){return new vp({type:"nullable",innerType:e})}var wp=f("ZodDefault",(e,t)=>{Fs.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ga(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function $p(e,t){return new wp({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():gr(t)}})}var Sp=f("ZodPrefault",(e,t)=>{Bs.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>_a(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function kp(e,t){return new Sp({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():gr(t)}})}var Qa=f("ZodNonOptional",(e,t)=>{Js.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ma(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Pp(e,t){return new Qa({type:"nonoptional",innerType:e,...y(t)})}var Zp=f("ZodCatch",(e,t)=>{qs.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>za(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Op(e,t){return new Zp({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Tn(t)})}var eu=f("ZodPipe",(e,t)=>{qr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>xa(e,r,o,n),e.in=t.in,e.out=t.out});function ja(e,t){return new eu({type:"pipe",in:e,out:t})}var Rp=f("ZodPreprocess",(e,t)=>{eu.init(e,t),Vs.init(e,t)}),Cp=f("ZodReadonly",(e,t)=>{Ks.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ya(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Ip(e){return new Cp({type:"readonly",innerType:e})}var tu=f("ZodCustom",(e,t)=>{Ws.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>sa(e,r,o,n)});function ru(e,t){return Tc(tu,e??(()=>!0),t)}function Tp(e,t={}){return Ac(tu,e,t)}function Ap(e,t){return Ec(e,t)}function Mo(e,t){return new Rp({type:"pipe",in:Ha(e),out:t})}var nu={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var ou;(function(e){})(ou||(ou={}));function Np(e){return Tt(Do,e)}function jp(e){return Sc(qt,e)}var Qt="2025-11-25";var Xo=[Qt,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],yt="io.modelcontextprotocol/related-task",Wt="2.0",J=ru((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),cu=E([u(),k().int()]),au=u(),_g=B({ttl:k().optional(),pollInterval:k().optional()}),Dp=x({ttl:k().optional()}),Up=x({taskId:u()}),Fo=B({progressToken:cu.optional(),[yt]:Up.optional()}),re=x({_meta:Fo.optional()}),tt=re.extend({task:Dp.optional()}),Jo=(e)=>tt.safeParse(e).success,V=x({method:u(),params:re.loose().optional()}),se=x({_meta:Fo.optional()}),ce=x({method:u(),params:se.loose().optional()}),K=B({_meta:Fo.optional()}),Gt=E([u(),k().int()]),uu=x({jsonrpc:b(Wt),id:Gt,...V.shape}).strict(),Tr=(e)=>uu.safeParse(e).success,lu=x({jsonrpc:b(Wt),...ce.shape}).strict(),Yo=(e)=>lu.safeParse(e).success,Bo=x({jsonrpc:b(Wt),id:Gt,result:K}).strict(),Ct=(e)=>Bo.safeParse(e).success;var _;(function(e){e[e.ConnectionClosed=-32000]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(_||(_={}));var qo=x({jsonrpc:b(Wt),id:Gt.optional(),error:x({code:k().int(),message:u(),data:N().optional()})}).strict();var Zo=(e)=>qo.safeParse(e).success;var bt=E([uu,lu,Bo,qo]),zg=E([Bo,qo]),It=K.strict(),Mp=se.extend({requestId:Gt.optional(),reason:u().optional()}),Yr=ce.extend({method:b("notifications/cancelled"),params:Mp}),Fp=x({src:u(),mimeType:u().optional(),sizes:z(u()).optional(),theme:Q(["light","dark"]).optional()}),rt=x({icons:z(Fp).optional()}),Te=x({name:u(),title:u().optional()}),pu=Te.extend({...Te.shape,...rt.shape,version:u(),websiteUrl:u().optional(),description:u().optional()}),Bp=Vt(x({applyDefaults:R().optional()}),I(u(),N())),Jp=Mo((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},Vt(x({form:Bp.optional(),url:J.optional()}),I(u(),N()).optional())),qp=B({list:J.optional(),cancel:J.optional(),requests:B({sampling:B({createMessage:J.optional()}).optional(),elicitation:B({create:J.optional()}).optional()}).optional()}),Vp=B({list:J.optional(),cancel:J.optional(),requests:B({tools:B({call:J.optional()}).optional()}).optional()}),Kp=x({experimental:I(u(),J).optional(),sampling:x({context:J.optional(),tools:J.optional()}).optional(),elicitation:Jp.optional(),roots:x({listChanged:R().optional()}).optional(),tasks:qp.optional(),extensions:I(u(),J).optional()}),Wp=re.extend({protocolVersion:u(),capabilities:Kp,clientInfo:pu}),Gp=V.extend({method:b("initialize"),params:Wp});var Hp=x({experimental:I(u(),J).optional(),logging:J.optional(),completions:J.optional(),prompts:x({listChanged:R().optional()}).optional(),resources:x({subscribe:R().optional(),listChanged:R().optional()}).optional(),tools:x({listChanged:R().optional()}).optional(),tasks:Vp.optional(),extensions:I(u(),J).optional()}),eo=K.extend({protocolVersion:u(),capabilities:Hp,serverInfo:pu,instructions:u().optional()}),fu=ce.extend({method:b("notifications/initialized"),params:se.optional()}),ei=(e)=>fu.safeParse(e).success,Zr=V.extend({method:b("ping"),params:re.optional()}),Xp=x({progress:k(),total:j(k()),message:j(u())}),Yp=x({...se.shape,...Xp.shape,progressToken:cu}),en=ce.extend({method:b("notifications/progress"),params:Yp}),Qp=re.extend({cursor:au.optional()}),ot=V.extend({params:Qp.optional()}),nt=K.extend({nextCursor:au.optional()}),ef=Q(["working","input_required","completed","failed","cancelled"]),st=x({taskId:u(),status:ef,ttl:E([k(),Va()]),createdAt:u(),lastUpdatedAt:u(),pollInterval:j(k()),statusMessage:j(u())}),Mt=K.extend({task:st}),tf=se.merge(st),kr=ce.extend({method:b("notifications/tasks/status"),params:tf}),tn=V.extend({method:b("tasks/get"),params:re.extend({taskId:u()})}),rn=K.merge(st),nn=V.extend({method:b("tasks/result"),params:re.extend({taskId:u()})}),xg=K.loose(),on=ot.extend({method:b("tasks/list")}),sn=nt.extend({tasks:z(st)}),an=V.extend({method:b("tasks/cancel"),params:re.extend({taskId:u()})}),ti=K.merge(st),du=x({uri:u(),mimeType:j(u()),_meta:I(u(),N()).optional()}),mu=du.extend({text:u()}),Vo=u().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),hu=du.extend({blob:Vo}),ct=Q(["user","assistant"]),Ae=x({audience:z(ct).optional(),priority:k().min(0).max(1).optional(),lastModified:Np({offset:!0}).optional()}),gu=x({...Te.shape,...rt.shape,uri:u(),description:j(u()),mimeType:j(u()),size:j(k()),annotations:Ae.optional(),_meta:j(B({}))}),rf=x({...Te.shape,...rt.shape,uriTemplate:u(),description:j(u()),mimeType:j(u()),annotations:Ae.optional(),_meta:j(B({}))}),of=ot.extend({method:b("resources/list")}),to=nt.extend({resources:z(gu)}),nf=ot.extend({method:b("resources/templates/list")}),ro=nt.extend({resourceTemplates:z(rf)}),Ko=re.extend({uri:u()}),sf=Ko,cf=V.extend({method:b("resources/read"),params:sf}),no=K.extend({contents:z(E([mu,hu]))}),oo=ce.extend({method:b("notifications/resources/list_changed"),params:se.optional()}),af=Ko,uf=V.extend({method:b("resources/subscribe"),params:af}),lf=Ko,pf=V.extend({method:b("resources/unsubscribe"),params:lf}),ff=se.extend({uri:u()}),df=ce.extend({method:b("notifications/resources/updated"),params:ff}),mf=x({name:u(),description:j(u()),required:j(R())}),hf=x({...Te.shape,...rt.shape,description:j(u()),arguments:j(z(mf)),_meta:j(B({}))}),gf=ot.extend({method:b("prompts/list")}),io=nt.extend({prompts:z(hf)}),_f=re.extend({name:u(),arguments:I(u(),u()).optional()}),zf=V.extend({method:b("prompts/get"),params:_f}),Wo=x({type:b("text"),text:u(),annotations:Ae.optional(),_meta:I(u(),N()).optional()}),Go=x({type:b("image"),data:Vo,mimeType:u(),annotations:Ae.optional(),_meta:I(u(),N()).optional()}),Ho=x({type:b("audio"),data:Vo,mimeType:u(),annotations:Ae.optional(),_meta:I(u(),N()).optional()}),xf=x({type:b("tool_use"),name:u(),id:u(),input:I(u(),N()),_meta:I(u(),N()).optional()}),yf=x({type:b("resource"),resource:E([mu,hu]),annotations:Ae.optional(),_meta:I(u(),N()).optional()}),bf=gu.extend({type:b("resource_link")}),Qo=E([Wo,Go,Ho,bf,yf]),vf=x({role:ct,content:Qo}),so=K.extend({description:u().optional(),messages:z(vf)}),ao=ce.extend({method:b("notifications/prompts/list_changed"),params:se.optional()}),wf=x({title:u().optional(),readOnlyHint:R().optional(),destructiveHint:R().optional(),idempotentHint:R().optional(),openWorldHint:R().optional()}),$f=x({taskSupport:Q(["required","optional","forbidden"]).optional()}),_u=x({...Te.shape,...rt.shape,description:u().optional(),inputSchema:x({type:b("object"),properties:I(u(),J).optional(),required:z(u()).optional()}).catchall(N()),outputSchema:x({type:b("object"),properties:I(u(),J).optional(),required:z(u()).optional()}).catchall(N()).optional(),annotations:wf.optional(),execution:$f.optional(),_meta:I(u(),N()).optional()}),Sf=ot.extend({method:b("tools/list")}),lo=nt.extend({tools:z(_u)}),it=K.extend({content:z(Qo).default([]),structuredContent:I(u(),N()).optional(),isError:R().optional()}),yg=it.or(K.extend({toolResult:N()})),kf=tt.extend({name:u(),arguments:I(u(),N()).optional()}),Pf=V.extend({method:b("tools/call"),params:kf}),Rr=ce.extend({method:b("notifications/tools/list_changed"),params:se.optional()}),ri=x({autoRefresh:R().default(!0),debounceMs:k().int().nonnegative().default(300)}),zu=Q(["debug","info","notice","warning","error","critical","alert","emergency"]),Zf=re.extend({level:zu}),Of=V.extend({method:b("logging/setLevel"),params:Zf}),Rf=se.extend({level:zu,logger:u().optional(),data:N()}),Cf=ce.extend({method:b("notifications/message"),params:Rf}),If=x({name:u().optional()}),Tf=x({hints:z(If).optional(),costPriority:k().min(0).max(1).optional(),speedPriority:k().min(0).max(1).optional(),intelligencePriority:k().min(0).max(1).optional()}),Af=x({mode:Q(["auto","required","none"]).optional()}),Ef=x({type:b("tool_result"),toolUseId:u().describe("The unique identifier for the corresponding tool call."),content:z(Qo).default([]),structuredContent:x({}).loose().optional(),isError:R().optional(),_meta:I(u(),N()).optional()}),Nf=Uo("type",[Wo,Go,Ho]),Kt=Uo("type",[Wo,Go,Ho,xf,Ef]),jf=x({role:ct,content:E([Kt,z(Kt)]),_meta:I(u(),N()).optional()}),Lf=tt.extend({messages:z(jf),modelPreferences:Tf.optional(),systemPrompt:u().optional(),includeContext:Q(["none","thisServer","allServers"]).optional(),temperature:k().optional(),maxTokens:k().int(),stopSequences:z(u()).optional(),metadata:J.optional(),tools:z(_u).optional(),toolChoice:Af.optional()}),co=V.extend({method:b("sampling/createMessage"),params:Lf}),uo=K.extend({model:u(),stopReason:j(Q(["endTurn","stopSequence","maxTokens"]).or(u())),role:ct,content:Nf}),po=K.extend({model:u(),stopReason:j(Q(["endTurn","stopSequence","maxTokens","toolUse"]).or(u())),role:ct,content:E([Kt,z(Kt)])}),Df=x({type:b("boolean"),title:u().optional(),description:u().optional(),default:R().optional()}),Uf=x({type:b("string"),title:u().optional(),description:u().optional(),minLength:k().optional(),maxLength:k().optional(),format:Q(["email","uri","date","date-time"]).optional(),default:u().optional()}),Mf=x({type:Q(["number","integer"]),title:u().optional(),description:u().optional(),minimum:k().optional(),maximum:k().optional(),default:k().optional()}),Ff=x({type:b("string"),title:u().optional(),description:u().optional(),enum:z(u()),default:u().optional()}),Bf=x({type:b("string"),title:u().optional(),description:u().optional(),oneOf:z(x({const:u(),title:u()})),default:u().optional()}),Jf=x({type:b("string"),title:u().optional(),description:u().optional(),enum:z(u()),enumNames:z(u()).optional(),default:u().optional()}),qf=E([Ff,Bf]),Vf=x({type:b("array"),title:u().optional(),description:u().optional(),minItems:k().optional(),maxItems:k().optional(),items:x({type:b("string"),enum:z(u())}),default:z(u()).optional()}),Kf=x({type:b("array"),title:u().optional(),description:u().optional(),minItems:k().optional(),maxItems:k().optional(),items:x({anyOf:z(x({const:u(),title:u()}))}),default:z(u()).optional()}),Wf=E([Vf,Kf]),Gf=E([Jf,qf,Wf]),Hf=E([Gf,Df,Uf,Mf]),Xf=tt.extend({mode:b("form").optional(),message:u(),requestedSchema:x({type:b("object"),properties:I(u(),Hf),required:z(u()).optional()})}),Yf=tt.extend({mode:b("url"),message:u(),elicitationId:u(),url:u().url()}),Qf=E([Xf,Yf]),mo=V.extend({method:b("elicitation/create"),params:Qf}),ed=se.extend({elicitationId:u()}),td=ce.extend({method:b("notifications/elicitation/complete"),params:ed}),ho=K.extend({action:Q(["accept","decline","cancel"]),content:Mo((e)=>e===null?void 0:e,I(u(),E([u(),k(),R(),z(u())])).optional())}),rd=x({type:b("ref/resource"),uri:u()});var od=x({type:b("ref/prompt"),name:u()}),nd=re.extend({ref:E([od,rd]),argument:x({name:u(),value:u()}),context:x({arguments:I(u(),u()).optional()}).optional()}),id=V.extend({method:b("completion/complete"),params:nd});var fo=K.extend({completion:B({values:z(u()).max(100),total:j(k().int()),hasMore:j(R())})}),sd=x({uri:u().startsWith("file://"),name:u().optional(),_meta:I(u(),N()).optional()}),cd=V.extend({method:b("roots/list"),params:re.optional()}),ad=K.extend({roots:z(sd)}),ud=ce.extend({method:b("notifications/roots/list_changed"),params:se.optional()}),bg=E([Zr,Gp,id,Of,zf,gf,of,nf,cf,uf,pf,Pf,Sf,tn,nn,on,an]),vg=E([Yr,en,fu,ud,kr]),wg=E([It,uo,po,ho,ad,rn,sn,Mt]),$g=E([Zr,co,mo,cd,tn,nn,on,an]),Sg=E([Yr,en,Cf,df,oo,Rr,ao,kr,td]),kg=E([It,eo,fo,so,io,to,ro,no,it,lo,rn,sn,Mt]);class S extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`);this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===_.UrlElicitationRequired&&r){let o=r;if(o.elicitations)return new xu(o.elicitations,t)}return new S(e,t,r)}}class xu extends S{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(_.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}var W=Ja().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:nu.custom,message:"URL must be parseable",fatal:!0}),br}).refine((e)=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),bu=B({resource:u().url(),authorization_servers:z(W).optional(),jwks_uri:u().url().optional(),scopes_supported:z(u()).optional(),bearer_methods_supported:z(u()).optional(),resource_signing_alg_values_supported:z(u()).optional(),resource_name:u().optional(),resource_documentation:u().optional(),resource_policy_uri:u().url().optional(),resource_tos_uri:u().url().optional(),tls_client_certificate_bound_access_tokens:R().optional(),authorization_details_types_supported:z(u()).optional(),dpop_signing_alg_values_supported:z(u()).optional(),dpop_bound_access_tokens_required:R().optional()}),cn=B({issuer:u(),authorization_endpoint:W,token_endpoint:W,registration_endpoint:W.optional(),scopes_supported:z(u()).optional(),response_types_supported:z(u()),response_modes_supported:z(u()).optional(),grant_types_supported:z(u()).optional(),token_endpoint_auth_methods_supported:z(u()).optional(),token_endpoint_auth_signing_alg_values_supported:z(u()).optional(),service_documentation:W.optional(),revocation_endpoint:W.optional(),revocation_endpoint_auth_methods_supported:z(u()).optional(),revocation_endpoint_auth_signing_alg_values_supported:z(u()).optional(),introspection_endpoint:u().optional(),introspection_endpoint_auth_methods_supported:z(u()).optional(),introspection_endpoint_auth_signing_alg_values_supported:z(u()).optional(),code_challenge_methods_supported:z(u()).optional(),client_id_metadata_document_supported:R().optional()}),ld=B({issuer:u(),authorization_endpoint:W,token_endpoint:W,userinfo_endpoint:W.optional(),jwks_uri:W,registration_endpoint:W.optional(),scopes_supported:z(u()).optional(),response_types_supported:z(u()),response_modes_supported:z(u()).optional(),grant_types_supported:z(u()).optional(),acr_values_supported:z(u()).optional(),subject_types_supported:z(u()),id_token_signing_alg_values_supported:z(u()),id_token_encryption_alg_values_supported:z(u()).optional(),id_token_encryption_enc_values_supported:z(u()).optional(),userinfo_signing_alg_values_supported:z(u()).optional(),userinfo_encryption_alg_values_supported:z(u()).optional(),userinfo_encryption_enc_values_supported:z(u()).optional(),request_object_signing_alg_values_supported:z(u()).optional(),request_object_encryption_alg_values_supported:z(u()).optional(),request_object_encryption_enc_values_supported:z(u()).optional(),token_endpoint_auth_methods_supported:z(u()).optional(),token_endpoint_auth_signing_alg_values_supported:z(u()).optional(),display_values_supported:z(u()).optional(),claim_types_supported:z(u()).optional(),claims_supported:z(u()).optional(),service_documentation:u().optional(),claims_locales_supported:z(u()).optional(),ui_locales_supported:z(u()).optional(),claims_parameter_supported:R().optional(),request_parameter_supported:R().optional(),request_uri_parameter_supported:R().optional(),require_request_uri_registration:R().optional(),op_policy_uri:W.optional(),op_tos_uri:W.optional(),client_id_metadata_document_supported:R().optional()}),vu=x({...ld.shape,...cn.pick({code_challenge_methods_supported:!0}).shape}),wu=x({access_token:u(),id_token:u().optional(),token_type:u(),expires_in:jp().optional(),scope:u().optional(),refresh_token:u().optional()}).strip(),$u=x({error:u(),error_description:u().optional(),error_uri:u().optional()}),yu=W.optional().or(b("").transform(()=>{return})),pd=x({redirect_uris:z(W),token_endpoint_auth_method:u().optional(),grant_types:z(u()).optional(),response_types:z(u()).optional(),client_name:u().optional(),client_uri:W.optional(),logo_uri:yu,scope:u().optional(),contacts:z(u()).optional(),tos_uri:yu,policy_uri:u().optional(),jwks_uri:W.optional(),jwks:Ka().optional(),software_id:u().optional(),software_version:u().optional(),software_statement:u().optional()}).strip(),fd=x({client_id:u(),client_secret:u().optional(),client_id_issued_at:k().optional(),client_secret_expires_at:k().optional()}).strip(),Su=pd.merge(fd),Zg=x({error:u(),error_description:u().optional()}).strip(),Og=x({token:u(),token_type_hint:u().optional()}).strip();function ku(e){let t=typeof e==="string"?new URL(e):new URL(e.href);return t.hash="",t}function Pu({requestedResource:e,configuredResource:t}){let r=typeof e==="string"?new URL(e):new URL(e.href),o=typeof t==="string"?new URL(t):new URL(t.href);if(r.origin!==o.origin)return!1;if(r.pathname.length<o.pathname.length)return!1;let n=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",i=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";return n.startsWith(i)}class M extends Error{constructor(e,t){super(e);this.errorUri=t,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};if(this.errorUri)e.error_uri=this.errorUri;return e}get errorCode(){return this.constructor.errorCode}}class Ht extends M{}Ht.errorCode="invalid_request";class Ee extends M{}Ee.errorCode="invalid_client";class Ne extends M{}Ne.errorCode="invalid_grant";class je extends M{}je.errorCode="unauthorized_client";class Xt extends M{}Xt.errorCode="unsupported_grant_type";class Yt extends M{}Yt.errorCode="invalid_scope";class er extends M{}er.errorCode="access_denied";class we extends M{}we.errorCode="server_error";class tr extends M{}tr.errorCode="temporarily_unavailable";class rr extends M{}rr.errorCode="unsupported_response_type";class or extends M{}or.errorCode="unsupported_token_type";class nr extends M{}nr.errorCode="invalid_token";class ir extends M{}ir.errorCode="method_not_allowed";class sr extends M{}sr.errorCode="too_many_requests";class Le extends M{}Le.errorCode="invalid_client_metadata";class cr extends M{}cr.errorCode="insufficient_scope";class ar extends M{}ar.errorCode="invalid_target";var Zu={[Ht.errorCode]:Ht,[Ee.errorCode]:Ee,[Ne.errorCode]:Ne,[je.errorCode]:je,[Xt.errorCode]:Xt,[Yt.errorCode]:Yt,[er.errorCode]:er,[we.errorCode]:we,[tr.errorCode]:tr,[rr.errorCode]:rr,[or.errorCode]:or,[nr.errorCode]:nr,[ir.errorCode]:ir,[sr.errorCode]:sr,[Le.errorCode]:Le,[cr.errorCode]:cr,[ar.errorCode]:ar};class de extends Error{constructor(e){super(e??"Unauthorized")}}function dd(e){return["client_secret_basic","client_secret_post","none"].includes(e)}var un="code",ln="S256";function md(e,t){let r=e.client_secret!==void 0;if("token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&dd(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method)))return e.token_endpoint_auth_method;if(t.length===0)return r?"client_secret_basic":"none";if(r&&t.includes("client_secret_basic"))return"client_secret_basic";if(r&&t.includes("client_secret_post"))return"client_secret_post";if(t.includes("none"))return"none";return r?"client_secret_post":"none"}function hd(e,t,r,o){let{client_id:n,client_secret:i}=t;switch(e){case"client_secret_basic":gd(n,i,r);return;case"client_secret_post":_d(n,i,o);return;case"none":zd(n,o);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}function gd(e,t,r){if(!t)throw Error("client_secret_basic authentication requires a client_secret");let o=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${o}`)}function _d(e,t,r){if(r.set("client_id",e),t)r.set("client_secret",t)}function zd(e,t){t.set("client_id",e)}async function Ru(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let o=$u.parse(JSON.parse(r)),{error:n,error_description:i,error_uri:s}=o;return new(Zu[n]||we)(i||"",s)}catch(o){let n=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${o}. Raw body: ${r}`;return new we(n)}}async function Fe(e,t){try{return await pn(e,t)}catch(r){if(r instanceof Ee||r instanceof je)return await e.invalidateCredentials?.("all"),await pn(e,t);else if(r instanceof Ne)return await e.invalidateCredentials?.("tokens"),await pn(e,t);throw r}}async function pn(e,{serverUrl:t,authorizationCode:r,scope:o,resourceMetadataUrl:n,fetchFn:i}){let s=await e.discoveryState?.(),c,a,l,p=n;if(!p&&s?.resourceMetadataUrl)p=new URL(s.resourceMetadataUrl);if(s?.authorizationServerUrl){if(a=s.authorizationServerUrl,c=s.resourceMetadata,l=s.authorizationServerMetadata??await Iu(a,{fetchFn:i}),!c)try{c=await Cu(t,{resourceMetadataUrl:p},i)}catch{}if(l!==s.authorizationServerMetadata||c!==s.resourceMetadata)await e.saveDiscoveryState?.({authorizationServerUrl:String(a),resourceMetadataUrl:p?.toString(),resourceMetadata:c,authorizationServerMetadata:l})}else{let F=await Sd(t,{resourceMetadataUrl:p,fetchFn:i});a=F.authorizationServerUrl,l=F.authorizationServerMetadata,c=F.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(a),resourceMetadataUrl:p?.toString(),resourceMetadata:c,authorizationServerMetadata:l})}let d=await yd(t,e,c),h=o||c?.scopes_supported?.join(" ")||e.clientMetadata.scope,m=await Promise.resolve(e.clientInformation());if(!m){if(r!==void 0)throw Error("Existing OAuth client information is required when exchanging an authorization code");let F=l?.client_id_metadata_document_supported===!0,ae=e.clientMetadataUrl;if(ae&&!xd(ae))throw new Le(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${ae}`);if(F&&ae)m={client_id:ae},await e.saveClientInformation?.(m);else{if(!e.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");let O=await Rd(a,{metadata:l,clientMetadata:e.clientMetadata,scope:h,fetchFn:i});await e.saveClientInformation(O),m=O}}let g=!e.redirectUrl;if(r!==void 0||g){let F=await Od(e,a,{metadata:l,resource:d,authorizationCode:r,fetchFn:i});return await e.saveTokens(F),"AUTHORIZED"}let v=await e.tokens();if(v?.refresh_token)try{let F=await Zd(a,{metadata:l,clientInformation:m,refreshToken:v.refresh_token,resource:d,addClientAuthentication:e.addClientAuthentication,fetchFn:i});return await e.saveTokens(F),"AUTHORIZED"}catch(F){if(!(F instanceof M)||F instanceof we);else throw F}let w=e.state?await e.state():void 0,{authorizationUrl:Z,codeVerifier:H}=await kd(a,{metadata:l,clientInformation:m,state:w,redirectUrl:e.redirectUrl,scope:h,resource:d});return await e.saveCodeVerifier(H),await e.redirectToAuthorization(Z),"REDIRECT"}function xd(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function yd(e,t,r){let o=ku(e);if(t.validateResourceURL)return await t.validateResourceURL(o,r?.resource);if(!r)return;if(!Pu({requestedResource:o,configuredResource:r.resource}))throw Error(`Protected resource ${r.resource} does not match expected ${o} (or origin)`);return new URL(r.resource)}function Lt(e){let t=e.headers.get("WWW-Authenticate");if(!t)return{};let[r,o]=t.split(" ");if(r.toLowerCase()!=="bearer"||!o)return{};let n=fn(e,"resource_metadata")||void 0,i;if(n)try{i=new URL(n)}catch{}let s=fn(e,"scope")||void 0,c=fn(e,"error")||void 0;return{resourceMetadataUrl:i,scope:s,error:c}}function fn(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let o=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),n=r.match(o);if(n)return n[1]||n[2];return null}async function Cu(e,t,r=fetch){let o=await wd(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!o||o.status===404)throw await o?.body?.cancel(),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!o.ok)throw await o.body?.cancel(),Error(`HTTP ${o.status} trying to load well-known OAuth protected resource metadata.`);return bu.parse(await o.json())}async function dn(e,t,r=fetch){try{return await r(e,{headers:t})}catch(o){if(o instanceof TypeError)if(t)return dn(e,void 0,r);else return;throw o}}function bd(e,t="",r={}){if(t.endsWith("/"))t=t.slice(0,-1);return r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function Ou(e,t,r=fetch){return await dn(e,{"MCP-Protocol-Version":t},r)}function vd(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function wd(e,t,r,o){let n=new URL(e),i=o?.protocolVersion??Qt,s;if(o?.metadataUrl)s=new URL(o.metadataUrl);else{let a=bd(t,n.pathname);s=new URL(a,o?.metadataServerUrl??n),s.search=n.search}let c=await Ou(s,i,r);if(!o?.metadataUrl&&vd(c,n.pathname)){let a=new URL(`/.well-known/${t}`,n);c=await Ou(a,i,r)}return c}function $d(e){let t=typeof e==="string"?new URL(e):e,r=t.pathname!=="/",o=[];if(!r)return o.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),o.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),o;let n=t.pathname;if(n.endsWith("/"))n=n.slice(0,-1);return o.push({url:new URL(`/.well-known/oauth-authorization-server${n}`,t.origin),type:"oauth"}),o.push({url:new URL(`/.well-known/openid-configuration${n}`,t.origin),type:"oidc"}),o.push({url:new URL(`${n}/.well-known/openid-configuration`,t.origin),type:"oidc"}),o}async function Iu(e,{fetchFn:t=fetch,protocolVersion:r=Qt}={}){let o={"MCP-Protocol-Version":r,Accept:"application/json"},n=$d(e);for(let{url:i,type:s}of n){let c=await dn(i,o,t);if(!c)continue;if(!c.ok){if(await c.body?.cancel(),c.status>=400&&c.status<500)continue;throw Error(`HTTP ${c.status} trying to load ${s==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}if(s==="oauth")return cn.parse(await c.json());else return vu.parse(await c.json())}return}async function Sd(e,t){let r,o;try{if(r=await Cu(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0)o=r.authorization_servers[0]}catch{}if(!o)o=String(new URL("/",e));let n=await Iu(o,{fetchFn:t?.fetchFn});return{authorizationServerUrl:o,authorizationServerMetadata:n,resourceMetadata:r}}async function kd(e,{metadata:t,clientInformation:r,redirectUrl:o,scope:n,state:i,resource:s}){let c;if(t){if(c=new URL(t.authorization_endpoint),!t.response_types_supported.includes(un))throw Error(`Incompatible auth server: does not support response type ${un}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(ln))throw Error(`Incompatible auth server: does not support code challenge method ${ln}`)}else c=new URL("/authorize",e);let a=await fr(),{code_verifier:l,code_challenge:p}=a;if(c.searchParams.set("response_type",un),c.searchParams.set("client_id",r.client_id),c.searchParams.set("code_challenge",p),c.searchParams.set("code_challenge_method",ln),c.searchParams.set("redirect_uri",String(o)),i)c.searchParams.set("state",i);if(n)c.searchParams.set("scope",n);if(n?.includes("offline_access"))c.searchParams.append("prompt","consent");if(s)c.searchParams.set("resource",s.href);return{authorizationUrl:c,codeVerifier:l}}function Pd(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function Tu(e,{metadata:t,tokenRequestParams:r,clientInformation:o,addClientAuthentication:n,resource:i,fetchFn:s}){let c=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),a=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(i)r.set("resource",i.href);if(n)await n(a,r,c,t);else if(o){let p=t?.token_endpoint_auth_methods_supported??[],d=md(o,p);hd(d,o,a,r)}let l=await(s??fetch)(c,{method:"POST",headers:a,body:r});if(!l.ok)throw await Ru(l);return wu.parse(await l.json())}async function Zd(e,{metadata:t,clientInformation:r,refreshToken:o,resource:n,addClientAuthentication:i,fetchFn:s}){let c=new URLSearchParams({grant_type:"refresh_token",refresh_token:o}),a=await Tu(e,{metadata:t,tokenRequestParams:c,clientInformation:r,addClientAuthentication:i,resource:n,fetchFn:s});return{refresh_token:o,...a}}async function Od(e,t,{metadata:r,resource:o,authorizationCode:n,fetchFn:i}={}){let s=e.clientMetadata.scope,c;if(e.prepareTokenRequest)c=await e.prepareTokenRequest(s);if(!c){if(!n)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");let l=await e.codeVerifier();c=Pd(n,l,e.redirectUrl)}let a=await e.clientInformation();return Tu(t,{metadata:r,tokenRequestParams:c,clientInformation:a??void 0,addClientAuthentication:e.addClientAuthentication,resource:o,fetchFn:i})}async function Rd(e,{metadata:t,clientMetadata:r,scope:o,fetchFn:n}){let i;if(t){if(!t.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");i=new URL(t.registration_endpoint)}else i=new URL("/register",e);let s=await(n??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,...o!==void 0?{scope:o}:{}})});if(!s.ok)throw await Ru(s);return Su.parse(await s.json())}
|
|
59
|
-
export{Zn,Qt,Xo,
|
|
58
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let l=e.external.registry.get(s[0])?.id;if(t!==s[0]&&l){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}if(c.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function Dc(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let o of t){if(!o||typeof o!=="object")return;Dc(o);let n=Object.keys(o);if(n.length!==1||n[0]!=="type")return;let i=o.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!r.includes(s))r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var Uc=new Set(["type","properties","required","additionalProperties"]),jc=["oneOf","anyOf"];function Lc(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function Oo(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!Uc.has(s))return null;t.push(i)}let r={},o=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let c=[];for(let l of t){let p=l.properties?.[s]??Lc(l);if(p===null||p===void 0)continue;if(!c.some((d)=>JSON.stringify(d)===JSON.stringify(p)))c.push(p)}let a=c.length===1?c[0]:Oo(c)??{allOf:c};oe(r,s,a)}for(let s of i.required??[])o.add(s)}let n={type:"object",properties:r};if(o.size)n.required=[...o];if(t.every((i)=>i.additionalProperties===!1))n.additionalProperties=!1;else{let i=[];for(let s of t){let c=Lc(s);if(c&&!i.some((a)=>JSON.stringify(a)===JSON.stringify(c)))i.push(c)}if(i.length===1)n.additionalProperties=i[0];else if(i.length>1)n.additionalProperties={allOf:i}}return n}function Cl(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let n of Uc)if(n in e)return;let r=t.filter((n)=>jc.some((i)=>Array.isArray(n[i]))),o=null;if(!r.length)o=Oo(t);else{let n=r[0],i=jc.find((a)=>Array.isArray(n[a]));if(Object.keys(n).length!==1)return;let s=t.filter((a)=>a!==n),c=n[i].map((a)=>Oo([...s,a]));if(c.some((a)=>!a))return;o={[i]:c}}if(!o)return;delete e.allOf,Qe(e,o)}function Io(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(c)=>{let a=e.seen.get(c);if(a.ref===null)return;let l=a.def??a.schema,p={...l},d=a.ref;if(a.ref=null,d){o(d);let m=e.seen.get(d),g=m.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(g);else Qe(l,g);if(Qe(l,p),c._zod.parent===d)for(let w in l){if(w==="$ref"||w==="allOf")continue;if(!(w in p))delete l[w]}if(g.$ref&&m.def)for(let w in l){if(w==="$ref"||w==="allOf")continue;if(w in m.def&&JSON.stringify(l[w])===JSON.stringify(m.def[w]))delete l[w]}}let h=c._zod.parent;if(h&&h!==d){o(h);let m=e.seen.get(h);if(m?.schema.$ref){if(l.$ref=m.schema.$ref,m.def)for(let g in l){if(g==="$ref"||g==="allOf")continue;if(g in m.def&&JSON.stringify(l[g])===JSON.stringify(m.def[g]))delete l[g]}}}e.override({zodSchema:c,jsonSchema:l,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())o(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())Dc(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let l of[a.schema,a.def]){let p=l?.allOf;if(!Array.isArray(p))continue;let d=c.get(p);if(d)d.push(l);else c.set(p,[l])}for(let a of e.intersections)for(let l of c.get(a)??[])Cl(l)}}let n={};if(e.target==="draft-2020-12")n.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")n.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")n.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(c)}Qe(n,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&n.id===i)delete n.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];if(a.def&&a.defId){if(a.def.id===a.defId)delete a.def.id;oe(s,a.defId,a.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")n.$defs=s;else n.definitions=s;try{let c=JSON.parse(JSON.stringify(n));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:et(t,"input",e.processors),output:et(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error("Error converting schema to JSON.")}}function G(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return G(o.element,r);if(o.type==="set")return G(o.valueType,r);if(o.type==="lazy")return G(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return G(o.innerType,r);if(o.type==="intersection")return G(o.left,r)||G(o.right,r);if(o.type==="record"||o.type==="map")return G(o.keyType,r)||G(o.valueType,r);if(o.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return G(o.in,r)||G(o.out,r)}if(o.type==="object"){for(let n in o.shape)if(G(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(G(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(G(n,r))return!0;if(o.rest&&G(o.rest,r))return!0;return!1}return!1}var Mc=(e,t={})=>(r)=>{let o=Ro({...r,processors:t});return D(e,o),Co(o,e),Io(o,e)},et=(e,t,r={})=>(o)=>{let{libraryOptions:n,target:i}=o??{},s=Ro({...n??{},target:i,io:t,processors:r});return D(e,s),Co(s,e),Io(s,e)};var Re=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},Ce=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},Fc=(e,t)=>{Re(e,"minimum",t),Ce(e,"maximum",t)},Vc=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Kc=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Wc=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},Gc=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Bc=(e,t)=>Re(e,"minimum",t.minimum),Jc=(e,t)=>Ce(e,"maximum",t.maximum),qc=(e)=>(t,r)=>{Gc(t,r.format);let[o,n]=e[r.format];Re(t,"minimum",o),Ce(t,"maximum",n)},Il={greater_than:(e,t)=>Re(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Ce(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Vc(e,t.value),number_format:qc(ut),bigint_format:qc(zr),min_length:Bc,max_length:Jc,length_equals:(e,t)=>Fc(e,t.length),min_size:Bc,max_size:Jc,size_equals:(e,t)=>Fc(e,t.size),string_format:(e,t)=>{if(Gc(e,t.format),t.pattern)Kc(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>Wc(e,t.mime)};function ie(e){let t={},r=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of o)Il[i._zod.def.check]?.(t,i._zod.def);let n=e._zod.bag;if(n.minimum!==void 0)Re(t,"minimum",n.minimum);if(n.exclusiveMinimum!==void 0)Re(t,"exclusiveMinimum",n.exclusiveMinimum);if(n.maximum!==void 0)Ce(t,"maximum",n.maximum);if(n.exclusiveMaximum!==void 0)Ce(t,"exclusiveMaximum",n.exclusiveMaximum);if(n.multipleOf!==void 0)Vc(t,n.multipleOf);if(n.format!==void 0){if(t.format??(t.format=n.format),n.format.includes("int"))t.isInt=!0}if(n.mime)Wc(t,n.mime);for(let i of n.patterns??[])Kc(t,i);return t}var Tl={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Al=new Map([[Mr,di],[kt,mi]]),Hc=(e)=>Al.get(e)??e,Xc=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:i,maximum:s,format:c,patterns:a,contentEncoding:l,laxFormat:p}=ie(e);if(typeof i==="number")n.minLength=i;if(typeof s==="number")n.maxLength=s;if(c){if(n.format=Tl[c]??c,n.format==="")delete n.format;if(c==="time"||p)delete n.format}if(l)n.contentEncoding=l;if(a&&a.size>0){let d=[...a].map(Hc);if(d.length===1)n.pattern=d[0].source;else if(d.length>1)n.allOf=[...d.map((h)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))]}},Yc=(e,t,r,o)=>{let n=r,{minimum:i,maximum:s,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:l,isInt:p}=ie(e);n.type=p?"integer":"number";let d=typeof l==="number"&&l>=(i??Number.NEGATIVE_INFINITY),h=typeof a==="number"&&a<=(s??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(d)if(m)n.minimum=l,n.exclusiveMinimum=!0;else n.exclusiveMinimum=l;else if(typeof i==="number")n.minimum=i;if(h)if(m)n.maximum=a,n.exclusiveMaximum=!0;else n.exclusiveMaximum=a;else if(typeof s==="number")n.maximum=s;if(c){let g=new Set;for(let Z of c)if(Number.isFinite(Z)&&Z!==0)g.add(Math.abs(Z));else _e(e,t,n,o,`A multipleOf divisor of ${Z} cannot be represented in JSON Schema`);let[v,...w]=g;if(v!==void 0)n.multipleOf=v;if(w.length)n.allOf=[...n.allOf??[],...w.map((Z)=>({multipleOf:Z}))]}},Qc=(e,t,r,o)=>{r.type="boolean"};var ea=(e,t,r,o)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"};var ta=(e,t,r,o)=>{r.not={}},ra=(e,t,r,o)=>{},oa=(e,t,r,o)=>{};var na=(e,t,r,o)=>{let n=e._zod.def,i=Ue(n.entries);if(i.length===0){r.not={};return}if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";r.enum=i},ia=(e,t,r,o)=>{let n=e._zod.def;if(n.values.length===0){r.not={};return}let i=[];for(let s of n.values)if(s===void 0){if(_e(e,t,r,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(_e(e,t,r,o,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[s];else r.const=s}else{if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";if(i.every((s)=>typeof s==="boolean"))r.type="boolean";if(i.every((s)=>s===null))r.type="null";r.enum=i}};var sa=(e,t,r,o)=>{_e(e,t,r,o,"Custom types cannot be represented in JSON Schema")};var ca=(e,t,r,o)=>{_e(e,t,r,o,"Transforms cannot be represented in JSON Schema")};var aa=(e,t,r,o)=>{let n=r,i=e._zod.def,{minimum:s,maximum:c}=ie(e);if(typeof s==="number")n.minItems=s;if(typeof c==="number")n.maxItems=c;n.type="array",n.items=D(i.element,t,{...o,path:[...o.path,"items"]})};function Ut(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return Ut(t.out);if(t.type==="catch")return Ut(t.innerType);return e._zod.optin}var ua=(e,t,r,o)=>{let n=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&_e(e,t,n,o,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let l in s)oe(n.properties,l,D(s[l],t,{...o,path:[...o.path,"properties",l]}));let a=[];for(let l of Object.keys(s)){let p=i.shape[l];if(t.io==="input"?Ut(p)===void 0:p._zod.optout===void 0)a.push(l)}if(a.length>0)n.required=a;if(i.catchall?._zod.def.type==="never")n.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")n.additionalProperties=!1}else if(i.catchall)n.additionalProperties=D(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})},la=(e,t,r,o)=>{let n=e._zod.def,i=n.inclusive===!1,s=n.options.map((c,a)=>D(c,t,{...o,path:[...o.path,i?"oneOf":"anyOf",a]}));if(i)r.oneOf=s;else r.anyOf=s},pa=(e,t,r,o)=>{let n=e._zod.def,i=D(n.left,t,{...o,path:[...o.path,"allOf",0]}),s=D(n.right,t,{...o,path:[...o.path,"allOf",1]}),c=(l)=>("allOf"in l)&&Object.keys(l).length===1,a=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=a,t.intersections.push(a)};function To(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let g=e.get(t)?.def;if(!g)return t;let v=To(e,g,r);return v===g?t:v}for(let g of["anyOf","oneOf"]){let v=t[g];if(!Array.isArray(v))continue;let w=v.map((Z)=>To(e,Z,r));if(w.some((Z,H)=>Z!==v[H]))t={...t,[g]:w}}let o=Array.isArray(t.type)?t.type:[t.type],n=!o.includes("string")&&o.some((g)=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!n&&!i?.some((g)=>typeof g==="number"))return t;let{minimum:s,maximum:c,exclusiveMinimum:a,exclusiveMaximum:l,multipleOf:p,format:d,id:h,...m}=t;if(m.enum)m.enum=m.enum.map((g)=>typeof g==="number"?String(g):g);else if(typeof m.const==="number")m.const=String(m.const);if(!n)return m;if(m.type="string",!i)m.pattern=(o.includes("number")?Ke:Ar).source;return m}var Ao=new WeakMap;function El(e){let t=new Map;for(let o of e.seen.values())if(o.def&&!t.has(o.schema))t.set(o.schema,o);let r=new Map;for(let o of Ao.get(e)??[]){let n=e.seen.get(o),i=(n?.def??n?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=To(t,i,new Set);if(s!==i)r.set(i,s)}if(!r.size)return;for(let o of e.seen.values())for(let n of[o.schema,o.def]){let i=n&&r.get(n.propertyNames);if(i)n.propertyNames=i}}var fa=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object";let s=i.keyType,c=ie(s).patterns;if(i.mode==="loose"&&c&&c.size>0){let p=D(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let d of c)oe(n.patternProperties,Hc(d).source,p)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){n.propertyNames=D(i.keyType,t,{...o,path:[...o.path,"propertyNames"]});let p=Ao.get(t);if(!p)p=[],Ao.set(t,p),t.deferred.push(()=>El(t));p.push(e)}n.additionalProperties=D(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let a=s._zod.values,l=t.io==="input"&&Ut(i.valueType)!==void 0;if(a&&!i.partial&&!l){let p=[...a].filter((d)=>typeof d==="string"||typeof d==="number");if(p.length>0)n.required=p.map(String)}},da=(e,t,r,o)=>{let n=e._zod.def,i=D(n.innerType,t,o),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=n.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},ma=(e,t,r,o)=>{let n=e._zod.def;D(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},Eo=Symbol();function ha(e,t,r,o,n){let i=!1,s=JSON.stringify(e,(c,a)=>{if(typeof a!=="bigint")return a;return i=!0,null});if(!i)return JSON.parse(s);return _e(t,r,o,n,"BigInt defaults cannot be represented in JSON Schema"),Eo}var ga=(e,t,r,o)=>{let n=e._zod.def;D(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let s=ha(n.defaultValue,e,t,r,o);if(s!==Eo)r.default=s},_a=(e,t,r,o)=>{let n=e._zod.def;D(n.innerType,t,o);let i=t.seen.get(e);if(i.ref=n.innerType,t.io!=="input")return;let s=ha(n.defaultValue,e,t,r,o);if(s!==Eo)r._prefault=s},za=(e,t,r,o)=>{let n=e._zod.def;D(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let s;try{s=n.catchValue(void 0)}catch{_e(e,t,r,o,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},xa=(e,t,r,o)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?n.out:n.in:n.out;D(s,t,o);let c=t.seen.get(e);c.ref=s},ya=(e,t,r,o)=>{let n=e._zod.def;D(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0};var No=(e,t,r,o)=>{let n=e._zod.def;D(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType};var ba=new WeakSet([Object.prototype,Error.prototype]);function Ft(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let o=r(this);return Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0})}})}var Jl=(e,t)=>{Ln.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(ba.has(r))return;ba.add(r),Ft(r,"format",(o)=>(n)=>Sr(o,n)),Ft(r,"flatten",(o)=>(n)=>$r(o,n)),Ft(r,"addIssue",(o)=>(n)=>{o.issues.push(n),o.message=JSON.stringify(o.issues,Me,2)}),Ft(r,"addIssues",(o)=>(n)=>{o.issues.push(...n),o.message=JSON.stringify(o.issues,Me,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var te=f("ZodError",Jl,void 0,{Parent:Error});var va=gt(te),wa=_t(te),$a=Ve(te),Sa=zt(te),ka=Mn(te),Pa=Fn(te),Za=Bn(te),Oa=Jn(te),Ra=qn(te),Ca=Vn(te),Ia=Kn(te),Ta=Wn(te);function Vl(){if(!X.localeError)Y(Gr())}function Jt(){if(!X.memoizer)Y({memoizer:Wr()})}var A=f("ZodType",(e,t)=>(Vl(),C.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(ee(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ue(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Tp(e,t))},superRefine(e,t){return this.check(Ap(e,t))},overwrite(e){return this.check(ve(e))},optional(){return j(this)},exactOptional(){return bp(this)},nullable(){return Na(this)},nullish(){return j(Na(this))},nonoptional(e){return Pp(this,e)},array(){return z(this)},or(e){return E([this,e])},and(e){return Vt(this,e)},transform(e){return ja(this,Ha(e))},default(e){return $p(this,e)},prefault(e){return kp(this,e)},catch(e){return Op(this,e)},pipe(e){return ja(this,e)},readonly(){return Ip(this)},describe(e){let t=this.clone();return be.add(t,{description:e}),t},meta(...e){if(e.length===0)return be.get(this);let t=this.clone();return be.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return mt(this,"~standard",{...Ur(this),jsonSchema:{input:et(this,"input"),output:et(this,"output")}})},set "~standard"(e){ge(this,"~standard",e)},parse:function e(t,r){return va(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await wa(this,t,r,{callee:e})},safeParse(e,t){return $a(this,e,t)},async safeParseAsync(e,t){return Sa(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){ge(this,"spa",e)},validate(e,t){return Pr(this,e,t)},validateAsync(e,t){return Or(this,e,t)},encode:function e(t,r){return ka(this,t,r,{callee:e})},decode:function e(t,r){return Pa(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Za(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Oa(this,t,r,{callee:e})},safeEncode(e,t){return Ra(this,e,t)},safeDecode(e,t){return Ca(this,e,t)},async safeEncodeAsync(e,t){return Ia(this,e,t)},async safeDecodeAsync(e,t){return Ta(this,e,t)},toJSONSchema(e){return Mc(this,{})(e)},get description(){return be.get(this)?.description},get _def(){return this._zod.def}}),La=f("_ZodString",(e,t)=>{$t.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Xc(e,r,o,n)},In({format:(e)=>ie(e).format??null,minLength:(e)=>ie(e).minimum??null,maxLength:(e)=>ie(e).maximum??null},{regex(...e){return this.check(_o(...e))},includes(...e){return this.check(yo(...e))},startsWith(...e){return this.check(bo(...e))},endsWith(...e){return this.check(vo(...e))},min(...e){return this.check(Oe(...e))},max(...e){return this.check(jt(...e))},length(...e){return this.check(Dt(...e))},nonempty(...e){return this.check(Oe(1,...e))},lowercase(e){return this.check(zo(e))},uppercase(e){return this.check(xo(e))},trim(){return this.check($o())},normalize(...e){return this.check(wo(...e))},toLowerCase(){return this.check(So())},toUpperCase(){return this.check(ko())},slugify(){return this.check(Po())}})),Da=f("ZodString",(e,t)=>{$t.init(e,t),La.init(e,t)},{email(e){return this.check(oc(Kl,e))},url(e){return this.check(Xr(Ba,e))},jwt(e){return this.check(wc(up,e))},emoji(e){return this.check(uc(Gl,e))},guid(e){return this.check(nc(Wl,e))},uuid(e){return this.check(ic(Bt,e))},uuidv4(e){return this.check(sc(Bt,e))},uuidv6(e){return this.check(cc(Bt,e))},uuidv7(e){return this.check(ac(Bt,e))},nanoid(e){return this.check(lc(Hl,e))},cuid(e){return this.check(pc(Xl,e))},cuid2(e){return this.check(fc(Yl,e))},ulid(e){return this.check(dc(Ql,e))},base64(e){return this.check(yc(sp,e))},base64url(e){return this.check(bc(cp,e))},xid(e){return this.check(mc(ep,e))},ksuid(e){return this.check(hc(tp,e))},ipv4(e){return this.check(gc(rp,e))},ipv6(e){return this.check(_c(op,e))},cidrv4(e){return this.check(zc(np,e))},cidrv6(e){return this.check(xc(ip,e))},e164(e){return this.check(vc(ap,e))},datetime(e){return this.check(Tt(Lo,e))},date(e){return this.check(Yr(Ua,e))},time(e){return this.check(Qr(Ma,e))},duration(e){return this.check(go(Fa,e))}});function u(e){return rc(Da,e)}var L=f("ZodStringFormat",(e,t)=>{T.init(e,t),La.init(e,t)}),Lo=f("ZodISODateTime",(e,t)=>{ls.init(e,t),L.init(e,t)}),Ua=f("ZodISODate",(e,t)=>{ps.init(e,t),L.init(e,t)}),Ma=f("ZodISOTime",(e,t)=>{fs.init(e,t),L.init(e,t)}),Fa=f("ZodISODuration",(e,t)=>{ds.init(e,t),L.init(e,t)}),Kl=f("ZodEmail",(e,t)=>{Qi.init(e,t),L.init(e,t)});var Wl=f("ZodGUID",(e,t)=>{Xi.init(e,t),L.init(e,t)});var Bt=f("ZodUUID",(e,t)=>{Yi.init(e,t),L.init(e,t)});var Ba=f("ZodURL",(e,t)=>{rs.init(e,t),L.init(e,t)});function Ja(e){return Xr(Ba,e)}var Gl=f("ZodEmoji",(e,t)=>{os.init(e,t),L.init(e,t)});var Hl=f("ZodNanoID",(e,t)=>{ns.init(e,t),L.init(e,t)});var Xl=f("ZodCUID",(e,t)=>{is.init(e,t),L.init(e,t)});var Yl=f("ZodCUID2",(e,t)=>{ss.init(e,t),L.init(e,t)});var Ql=f("ZodULID",(e,t)=>{cs.init(e,t),L.init(e,t)});var ep=f("ZodXID",(e,t)=>{as.init(e,t),L.init(e,t)});var tp=f("ZodKSUID",(e,t)=>{us.init(e,t),L.init(e,t)});var rp=f("ZodIPv4",(e,t)=>{ms.init(e,t),L.init(e,t)});var op=f("ZodIPv6",(e,t)=>{gs.init(e,t),L.init(e,t)});var np=f("ZodCIDRv4",(e,t)=>{_s.init(e,t),L.init(e,t)});var ip=f("ZodCIDRv6",(e,t)=>{zs.init(e,t),L.init(e,t)});var sp=f("ZodBase64",(e,t)=>{ys.init(e,t),L.init(e,t)});var cp=f("ZodBase64URL",(e,t)=>{bs.init(e,t),L.init(e,t)});var ap=f("ZodE164",(e,t)=>{vs.init(e,t),L.init(e,t)});var up=f("ZodJWT",(e,t)=>{ws.init(e,t),L.init(e,t)});var qt=f("ZodNumber",(e,t)=>{Fr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yc(e,r,o,n),e.isFinite=!0},In({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=ie(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=ie(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=ie(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>ie(e).format??null},{gt(e,t){return this.check(Et(e,t))},gte(e,t){return this.check(Ye(e,t))},min(e,t){return this.check(Ye(e,t))},lt(e,t){return this.check(At(e,t))},lte(e,t){return this.check(Xe(e,t))},max(e,t){return this.check(Xe(e,t))},int(e){return this.check(Aa(e))},safe(e){return this.check(Aa(e))},positive(e){return this.check(Et(0,e))},nonnegative(e){return this.check(Ye(0,e))},negative(e){return this.check(At(0,e))},nonpositive(e){return this.check(Xe(0,e))},multipleOf(e,t){return this.check(Nt(e,t))},step(e,t){return this.check(Nt(e,t))},finite(){return this}}));function k(e){return $c(qt,e)}var lp=f("ZodNumberFormat",(e,t)=>{$s.init(e,t),qt.init(e,t)});function Aa(e){return kc(lp,e)}var qa=f("ZodBoolean",(e,t)=>{Ss.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Qc(e,r,o,n)});function R(e){return Pc(qa,e)}var pp=f("ZodNull",(e,t)=>{ks.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ea(e,r,o,n)});function Va(e){return Zc(pp,e)}var fp=f("ZodAny",(e,t)=>{Ps.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ra(e,r,o,n)});function Ka(){return Oc(fp)}var dp=f("ZodUnknown",(e,t)=>{Zs.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>oa(e,r,o,n)});function N(){return Rc(dp)}var mp=f("ZodNever",(e,t)=>{Os.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ta(e,r,o,n)});function hp(e){return Cc(mp,e)}var gp=f("ZodArray",(e,t)=>{Jt(),Rs.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>aa(e,r,o,n),e.element=t.element},{min(e,t){return this.check(Oe(e,t))},nonempty(e){return this.check(Oe(1,e))},max(e,t){return this.check(jt(e,t))},length(e,t){return this.check(Dt(e,t))},unwrap(){return this.element}});function z(e,t){return Ic(gp,e,t)}var Wa=f("ZodObject",(e,t)=>{Jt(),Ts.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ua(e,r,o,n),Xu(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return Q(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(ee(this._zod.def,{catchall:e}))},passthrough(){return this.clone(ee(this._zod.def,{catchall:N()}))},loose(){return this.clone(ee(this._zod.def,{catchall:N()}))},strict(){return this.clone(ee(this._zod.def,{catchall:hp()}))},strip(){return this.clone(ee(this._zod.def,{catchall:void 0}))},extend(e){return Bu(this,e)},safeExtend(e){return Ju(this,e)},merge(e){return qu(this,e)},pick(e){return Mu(this,e)},omit(e){return Fu(this,e)},partial(...e){return Pn(Xa,this,e[0])},exactPartial(...e){return Pn(Ya,this,e[0],"exactPartial")},required(...e){return Vu(Qa,this,e[0])}});function x(e,t){let r={type:"object",shape:e??{},...y(t)};return new Wa(r)}function B(e,t){return new Wa({type:"object",shape:e,catchall:N(),...y(t)})}var Ga=f("ZodUnion",(e,t)=>{Br.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>la(e,r,o,n),e.options=t.options});function E(e,t){return new Ga({type:"union",options:e,...y(t)})}var _p=f("ZodDiscriminatedUnion",(e,t)=>{Ga.init(e,t),As.init(e,t)});function Do(e,t,r){return new _p({type:"union",options:t,discriminator:e,...y(r)})}var zp=f("ZodIntersection",(e,t)=>{Es.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>pa(e,r,o,n)});function Vt(e,t){return new zp({type:"intersection",left:e,right:t})}var Ea=f("ZodRecord",(e,t)=>{Jt(),Ns.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>fa(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function I(e,t,r){if(!t||!t._zod)return new Ea({type:"record",keyType:u(),valueType:e,...y(t)});return new Ea({type:"record",keyType:e,valueType:t,...y(r)})}var jo=f("ZodEnum",(e,t)=>{js.init(e,t),A.init(e,t),e._zod.processJSONSchema=(o,n,i)=>na(e,o,n,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let i={};for(let s of o)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new jo({...t,checks:[],...y(n),entries:i})},e.exclude=(o,n)=>{let i={...t.entries};for(let s of o)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new jo({...t,checks:[],...y(n),entries:i})}});function Q(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new jo({type:"enum",entries:r,...y(t)})}var xp=f("ZodLiteral",(e,t)=>{Ls.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ia(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function b(e,t){return new xp({type:"literal",values:Array.isArray(e)?e:[e],...y(t)})}var yp=f("ZodTransform",(e,t)=>{Jt(),Ds.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ca(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new qe(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(ke(i,r.value,t));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=r.value;s.inst??(s.inst=e),r.issues.push(ke(s))}};let n=t.transform(r.value,r);if(n instanceof Promise)return n.then((i)=>(r.value=i,r));return r.value=n,r}});function Ha(e){return new yp({type:"transform",transform:e})}var Xa=f("ZodOptional",(e,t)=>{Jr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>No(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function j(e){return new Xa({type:"optional",innerType:e})}var Ya=f("ZodExactOptional",(e,t)=>{Us.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>No(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function bp(e){return new Ya({type:"optional",innerType:e})}var vp=f("ZodNullable",(e,t)=>{Ms.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>da(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Na(e){return new vp({type:"nullable",innerType:e})}var wp=f("ZodDefault",(e,t)=>{Fs.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ga(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function $p(e,t){return new wp({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():gr(t)}})}var Sp=f("ZodPrefault",(e,t)=>{Bs.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>_a(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function kp(e,t){return new Sp({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():gr(t)}})}var Qa=f("ZodNonOptional",(e,t)=>{Js.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ma(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Pp(e,t){return new Qa({type:"nonoptional",innerType:e,...y(t)})}var Zp=f("ZodCatch",(e,t)=>{qs.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>za(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Op(e,t){return new Zp({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Tn(t)})}var eu=f("ZodPipe",(e,t)=>{qr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>xa(e,r,o,n),e.in=t.in,e.out=t.out});function ja(e,t){return new eu({type:"pipe",in:e,out:t})}var Rp=f("ZodPreprocess",(e,t)=>{eu.init(e,t),Vs.init(e,t)}),Cp=f("ZodReadonly",(e,t)=>{Ks.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ya(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Ip(e){return new Cp({type:"readonly",innerType:e})}var tu=f("ZodCustom",(e,t)=>{Ws.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,o,n)=>sa(e,r,o,n)});function ru(e,t){return Tc(tu,e??(()=>!0),t)}function Tp(e,t={}){return Ac(tu,e,t)}function Ap(e,t){return Ec(e,t)}function Uo(e,t){return new Rp({type:"pipe",in:Ha(e),out:t})}var nu={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var ou;(function(e){})(ou||(ou={}));function Np(e){return Tt(Lo,e)}function jp(e){return Sc(qt,e)}var Qt="2025-11-25";var Xo=[Qt,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],bt="io.modelcontextprotocol/related-task",Wt="2.0",J=ru((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),cu=E([u(),k().int()]),au=u(),_g=B({ttl:k().optional(),pollInterval:k().optional()}),Dp=x({ttl:k().optional()}),Up=x({taskId:u()}),Mo=B({progressToken:cu.optional(),[bt]:Up.optional()}),re=x({_meta:Mo.optional()}),tt=re.extend({task:Dp.optional()}),Jo=(e)=>tt.safeParse(e).success,V=x({method:u(),params:re.loose().optional()}),se=x({_meta:Mo.optional()}),ce=x({method:u(),params:se.loose().optional()}),K=B({_meta:Mo.optional()}),Gt=E([u(),k().int()]),uu=x({jsonrpc:b(Wt),id:Gt,...V.shape}).strict(),Tr=(e)=>uu.safeParse(e).success,lu=x({jsonrpc:b(Wt),...ce.shape}).strict(),Yo=(e)=>lu.safeParse(e).success,Fo=x({jsonrpc:b(Wt),id:Gt,result:K}).strict(),Ct=(e)=>Fo.safeParse(e).success;var _;(function(e){e[e.ConnectionClosed=-32000]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(_||(_={}));var Bo=x({jsonrpc:b(Wt),id:Gt.optional(),error:x({code:k().int(),message:u(),data:N().optional()})}).strict();var Zo=(e)=>Bo.safeParse(e).success;var St=E([uu,lu,Fo,Bo]),zg=E([Fo,Bo]),It=K.strict(),Mp=se.extend({requestId:Gt.optional(),reason:u().optional()}),Zr=ce.extend({method:b("notifications/cancelled"),params:Mp}),Fp=x({src:u(),mimeType:u().optional(),sizes:z(u()).optional(),theme:Q(["light","dark"]).optional()}),rt=x({icons:z(Fp).optional()}),Te=x({name:u(),title:u().optional()}),pu=Te.extend({...Te.shape,...rt.shape,version:u(),websiteUrl:u().optional(),description:u().optional()}),Bp=Vt(x({applyDefaults:R().optional()}),I(u(),N())),Jp=Uo((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},Vt(x({form:Bp.optional(),url:J.optional()}),I(u(),N()).optional())),qp=B({list:J.optional(),cancel:J.optional(),requests:B({sampling:B({createMessage:J.optional()}).optional(),elicitation:B({create:J.optional()}).optional()}).optional()}),Vp=B({list:J.optional(),cancel:J.optional(),requests:B({tools:B({call:J.optional()}).optional()}).optional()}),Kp=x({experimental:I(u(),J).optional(),sampling:x({context:J.optional(),tools:J.optional()}).optional(),elicitation:Jp.optional(),roots:x({listChanged:R().optional()}).optional(),tasks:qp.optional(),extensions:I(u(),J).optional()}),Wp=re.extend({protocolVersion:u(),capabilities:Kp,clientInfo:pu}),Gp=V.extend({method:b("initialize"),params:Wp});var Hp=x({experimental:I(u(),J).optional(),logging:J.optional(),completions:J.optional(),prompts:x({listChanged:R().optional()}).optional(),resources:x({subscribe:R().optional(),listChanged:R().optional()}).optional(),tools:x({listChanged:R().optional()}).optional(),tasks:Vp.optional(),extensions:I(u(),J).optional()}),eo=K.extend({protocolVersion:u(),capabilities:Hp,serverInfo:pu,instructions:u().optional()}),fu=ce.extend({method:b("notifications/initialized"),params:se.optional()}),ei=(e)=>fu.safeParse(e).success,en=V.extend({method:b("ping"),params:re.optional()}),Xp=x({progress:k(),total:j(k()),message:j(u())}),Yp=x({...se.shape,...Xp.shape,progressToken:cu}),tn=ce.extend({method:b("notifications/progress"),params:Yp}),Qp=re.extend({cursor:au.optional()}),ot=V.extend({params:Qp.optional()}),nt=K.extend({nextCursor:au.optional()}),ef=Q(["working","input_required","completed","failed","cancelled"]),it=x({taskId:u(),status:ef,ttl:E([k(),Va()]),createdAt:u(),lastUpdatedAt:u(),pollInterval:j(k()),statusMessage:j(u())}),Mt=K.extend({task:it}),tf=se.merge(it),kr=ce.extend({method:b("notifications/tasks/status"),params:tf}),rn=V.extend({method:b("tasks/get"),params:re.extend({taskId:u()})}),nn=K.merge(it),on=V.extend({method:b("tasks/result"),params:re.extend({taskId:u()})}),xg=K.loose(),sn=ot.extend({method:b("tasks/list")}),an=nt.extend({tasks:z(it)}),ln=V.extend({method:b("tasks/cancel"),params:re.extend({taskId:u()})}),ti=K.merge(it),du=x({uri:u(),mimeType:j(u()),_meta:I(u(),N()).optional()}),mu=du.extend({text:u()}),qo=u().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),hu=du.extend({blob:qo}),ct=Q(["user","assistant"]),Ae=x({audience:z(ct).optional(),priority:k().min(0).max(1).optional(),lastModified:Np({offset:!0}).optional()}),gu=x({...Te.shape,...rt.shape,uri:u(),description:j(u()),mimeType:j(u()),size:j(k()),annotations:Ae.optional(),_meta:j(B({}))}),rf=x({...Te.shape,...rt.shape,uriTemplate:u(),description:j(u()),mimeType:j(u()),annotations:Ae.optional(),_meta:j(B({}))}),of=ot.extend({method:b("resources/list")}),to=nt.extend({resources:z(gu)}),nf=ot.extend({method:b("resources/templates/list")}),ro=nt.extend({resourceTemplates:z(rf)}),Vo=re.extend({uri:u()}),sf=Vo,cf=V.extend({method:b("resources/read"),params:sf}),no=K.extend({contents:z(E([mu,hu]))}),oo=ce.extend({method:b("notifications/resources/list_changed"),params:se.optional()}),af=Vo,uf=V.extend({method:b("resources/subscribe"),params:af}),lf=Vo,pf=V.extend({method:b("resources/unsubscribe"),params:lf}),ff=se.extend({uri:u()}),df=ce.extend({method:b("notifications/resources/updated"),params:ff}),mf=x({name:u(),description:j(u()),required:j(R())}),hf=x({...Te.shape,...rt.shape,description:j(u()),arguments:j(z(mf)),_meta:j(B({}))}),gf=ot.extend({method:b("prompts/list")}),io=nt.extend({prompts:z(hf)}),_f=re.extend({name:u(),arguments:I(u(),u()).optional()}),zf=V.extend({method:b("prompts/get"),params:_f}),Ko=x({type:b("text"),text:u(),annotations:Ae.optional(),_meta:I(u(),N()).optional()}),Wo=x({type:b("image"),data:qo,mimeType:u(),annotations:Ae.optional(),_meta:I(u(),N()).optional()}),Go=x({type:b("audio"),data:qo,mimeType:u(),annotations:Ae.optional(),_meta:I(u(),N()).optional()}),xf=x({type:b("tool_use"),name:u(),id:u(),input:I(u(),N()),_meta:I(u(),N()).optional()}),yf=x({type:b("resource"),resource:E([mu,hu]),annotations:Ae.optional(),_meta:I(u(),N()).optional()}),bf=gu.extend({type:b("resource_link")}),Ho=E([Ko,Wo,Go,bf,yf]),vf=x({role:ct,content:Ho}),so=K.extend({description:u().optional(),messages:z(vf)}),ao=ce.extend({method:b("notifications/prompts/list_changed"),params:se.optional()}),wf=x({title:u().optional(),readOnlyHint:R().optional(),destructiveHint:R().optional(),idempotentHint:R().optional(),openWorldHint:R().optional()}),$f=x({taskSupport:Q(["required","optional","forbidden"]).optional()}),_u=x({...Te.shape,...rt.shape,description:u().optional(),inputSchema:x({type:b("object"),properties:I(u(),J).optional(),required:z(u()).optional()}).catchall(N()),outputSchema:x({type:b("object"),properties:I(u(),J).optional(),required:z(u()).optional()}).catchall(N()).optional(),annotations:wf.optional(),execution:$f.optional(),_meta:I(u(),N()).optional()}),Sf=ot.extend({method:b("tools/list")}),lo=nt.extend({tools:z(_u)}),st=K.extend({content:z(Ho).default([]),structuredContent:I(u(),N()).optional(),isError:R().optional()}),yg=st.or(K.extend({toolResult:N()})),kf=tt.extend({name:u(),arguments:I(u(),N()).optional()}),Pf=V.extend({method:b("tools/call"),params:kf}),Rr=ce.extend({method:b("notifications/tools/list_changed"),params:se.optional()}),ri=x({autoRefresh:R().default(!0),debounceMs:k().int().nonnegative().default(300)}),zu=Q(["debug","info","notice","warning","error","critical","alert","emergency"]),Zf=re.extend({level:zu}),Of=V.extend({method:b("logging/setLevel"),params:Zf}),Rf=se.extend({level:zu,logger:u().optional(),data:N()}),Cf=ce.extend({method:b("notifications/message"),params:Rf}),If=x({name:u().optional()}),Tf=x({hints:z(If).optional(),costPriority:k().min(0).max(1).optional(),speedPriority:k().min(0).max(1).optional(),intelligencePriority:k().min(0).max(1).optional()}),Af=x({mode:Q(["auto","required","none"]).optional()}),Ef=x({type:b("tool_result"),toolUseId:u().describe("The unique identifier for the corresponding tool call."),content:z(Ho).default([]),structuredContent:x({}).loose().optional(),isError:R().optional(),_meta:I(u(),N()).optional()}),Nf=Do("type",[Ko,Wo,Go]),Kt=Do("type",[Ko,Wo,Go,xf,Ef]),jf=x({role:ct,content:E([Kt,z(Kt)]),_meta:I(u(),N()).optional()}),Lf=tt.extend({messages:z(jf),modelPreferences:Tf.optional(),systemPrompt:u().optional(),includeContext:Q(["none","thisServer","allServers"]).optional(),temperature:k().optional(),maxTokens:k().int(),stopSequences:z(u()).optional(),metadata:J.optional(),tools:z(_u).optional(),toolChoice:Af.optional()}),co=V.extend({method:b("sampling/createMessage"),params:Lf}),uo=K.extend({model:u(),stopReason:j(Q(["endTurn","stopSequence","maxTokens"]).or(u())),role:ct,content:Nf}),po=K.extend({model:u(),stopReason:j(Q(["endTurn","stopSequence","maxTokens","toolUse"]).or(u())),role:ct,content:E([Kt,z(Kt)])}),Df=x({type:b("boolean"),title:u().optional(),description:u().optional(),default:R().optional()}),Uf=x({type:b("string"),title:u().optional(),description:u().optional(),minLength:k().optional(),maxLength:k().optional(),format:Q(["email","uri","date","date-time"]).optional(),default:u().optional()}),Mf=x({type:Q(["number","integer"]),title:u().optional(),description:u().optional(),minimum:k().optional(),maximum:k().optional(),default:k().optional()}),Ff=x({type:b("string"),title:u().optional(),description:u().optional(),enum:z(u()),default:u().optional()}),Bf=x({type:b("string"),title:u().optional(),description:u().optional(),oneOf:z(x({const:u(),title:u()})),default:u().optional()}),Jf=x({type:b("string"),title:u().optional(),description:u().optional(),enum:z(u()),enumNames:z(u()).optional(),default:u().optional()}),qf=E([Ff,Bf]),Vf=x({type:b("array"),title:u().optional(),description:u().optional(),minItems:k().optional(),maxItems:k().optional(),items:x({type:b("string"),enum:z(u())}),default:z(u()).optional()}),Kf=x({type:b("array"),title:u().optional(),description:u().optional(),minItems:k().optional(),maxItems:k().optional(),items:x({anyOf:z(x({const:u(),title:u()}))}),default:z(u()).optional()}),Wf=E([Vf,Kf]),Gf=E([Jf,qf,Wf]),Hf=E([Gf,Df,Uf,Mf]),Xf=tt.extend({mode:b("form").optional(),message:u(),requestedSchema:x({type:b("object"),properties:I(u(),Hf),required:z(u()).optional()})}),Yf=tt.extend({mode:b("url"),message:u(),elicitationId:u(),url:u().url()}),Qf=E([Xf,Yf]),mo=V.extend({method:b("elicitation/create"),params:Qf}),ed=se.extend({elicitationId:u()}),td=ce.extend({method:b("notifications/elicitation/complete"),params:ed}),ho=K.extend({action:Q(["accept","decline","cancel"]),content:Uo((e)=>e===null?void 0:e,I(u(),E([u(),k(),R(),z(u())])).optional())}),rd=x({type:b("ref/resource"),uri:u()});var od=x({type:b("ref/prompt"),name:u()}),nd=re.extend({ref:E([od,rd]),argument:x({name:u(),value:u()}),context:x({arguments:I(u(),u()).optional()}).optional()}),id=V.extend({method:b("completion/complete"),params:nd});var fo=K.extend({completion:B({values:z(u()).max(100),total:j(k().int()),hasMore:j(R())})}),sd=x({uri:u().startsWith("file://"),name:u().optional(),_meta:I(u(),N()).optional()}),cd=V.extend({method:b("roots/list"),params:re.optional()}),ad=K.extend({roots:z(sd)}),ud=ce.extend({method:b("notifications/roots/list_changed"),params:se.optional()}),bg=E([en,Gp,id,Of,zf,gf,of,nf,cf,uf,pf,Pf,Sf,rn,on,sn,ln]),vg=E([Zr,tn,fu,ud,kr]),wg=E([It,uo,po,ho,ad,nn,an,Mt]),$g=E([en,co,mo,cd,rn,on,sn,ln]),Sg=E([Zr,tn,Cf,df,oo,Rr,ao,kr,td]),kg=E([It,eo,fo,so,io,to,ro,no,st,lo,nn,an,Mt]);class S extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`);this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===_.UrlElicitationRequired&&r){let o=r;if(o.elicitations)return new xu(o.elicitations,t)}return new S(e,t,r)}}class xu extends S{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(_.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}var W=Ja().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:nu.custom,message:"URL must be parseable",fatal:!0}),br}).refine((e)=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),bu=B({resource:u().url(),authorization_servers:z(W).optional(),jwks_uri:u().url().optional(),scopes_supported:z(u()).optional(),bearer_methods_supported:z(u()).optional(),resource_signing_alg_values_supported:z(u()).optional(),resource_name:u().optional(),resource_documentation:u().optional(),resource_policy_uri:u().url().optional(),resource_tos_uri:u().url().optional(),tls_client_certificate_bound_access_tokens:R().optional(),authorization_details_types_supported:z(u()).optional(),dpop_signing_alg_values_supported:z(u()).optional(),dpop_bound_access_tokens_required:R().optional()}),Qo=B({issuer:u(),authorization_endpoint:W,token_endpoint:W,registration_endpoint:W.optional(),scopes_supported:z(u()).optional(),response_types_supported:z(u()),response_modes_supported:z(u()).optional(),grant_types_supported:z(u()).optional(),token_endpoint_auth_methods_supported:z(u()).optional(),token_endpoint_auth_signing_alg_values_supported:z(u()).optional(),service_documentation:W.optional(),revocation_endpoint:W.optional(),revocation_endpoint_auth_methods_supported:z(u()).optional(),revocation_endpoint_auth_signing_alg_values_supported:z(u()).optional(),introspection_endpoint:u().optional(),introspection_endpoint_auth_methods_supported:z(u()).optional(),introspection_endpoint_auth_signing_alg_values_supported:z(u()).optional(),code_challenge_methods_supported:z(u()).optional(),client_id_metadata_document_supported:R().optional()}),ld=B({issuer:u(),authorization_endpoint:W,token_endpoint:W,userinfo_endpoint:W.optional(),jwks_uri:W,registration_endpoint:W.optional(),scopes_supported:z(u()).optional(),response_types_supported:z(u()),response_modes_supported:z(u()).optional(),grant_types_supported:z(u()).optional(),acr_values_supported:z(u()).optional(),subject_types_supported:z(u()),id_token_signing_alg_values_supported:z(u()),id_token_encryption_alg_values_supported:z(u()).optional(),id_token_encryption_enc_values_supported:z(u()).optional(),userinfo_signing_alg_values_supported:z(u()).optional(),userinfo_encryption_alg_values_supported:z(u()).optional(),userinfo_encryption_enc_values_supported:z(u()).optional(),request_object_signing_alg_values_supported:z(u()).optional(),request_object_encryption_alg_values_supported:z(u()).optional(),request_object_encryption_enc_values_supported:z(u()).optional(),token_endpoint_auth_methods_supported:z(u()).optional(),token_endpoint_auth_signing_alg_values_supported:z(u()).optional(),display_values_supported:z(u()).optional(),claim_types_supported:z(u()).optional(),claims_supported:z(u()).optional(),service_documentation:u().optional(),claims_locales_supported:z(u()).optional(),ui_locales_supported:z(u()).optional(),claims_parameter_supported:R().optional(),request_parameter_supported:R().optional(),request_uri_parameter_supported:R().optional(),require_request_uri_registration:R().optional(),op_policy_uri:W.optional(),op_tos_uri:W.optional(),client_id_metadata_document_supported:R().optional()}),vu=x({...ld.shape,...Qo.pick({code_challenge_methods_supported:!0}).shape}),wu=x({access_token:u(),id_token:u().optional(),token_type:u(),expires_in:jp().optional(),scope:u().optional(),refresh_token:u().optional()}).strip(),$u=x({error:u(),error_description:u().optional(),error_uri:u().optional()}),yu=W.optional().or(b("").transform(()=>{return})),pd=x({redirect_uris:z(W),token_endpoint_auth_method:u().optional(),grant_types:z(u()).optional(),response_types:z(u()).optional(),client_name:u().optional(),client_uri:W.optional(),logo_uri:yu,scope:u().optional(),contacts:z(u()).optional(),tos_uri:yu,policy_uri:u().optional(),jwks_uri:W.optional(),jwks:Ka().optional(),software_id:u().optional(),software_version:u().optional(),software_statement:u().optional()}).strip(),fd=x({client_id:u(),client_secret:u().optional(),client_id_issued_at:k().optional(),client_secret_expires_at:k().optional()}).strip(),Su=pd.merge(fd),Zg=x({error:u(),error_description:u().optional()}).strip(),Og=x({token:u(),token_type_hint:u().optional()}).strip();function ku(e){let t=typeof e==="string"?new URL(e):new URL(e.href);return t.hash="",t}function Pu({requestedResource:e,configuredResource:t}){let r=typeof e==="string"?new URL(e):new URL(e.href),o=typeof t==="string"?new URL(t):new URL(t.href);if(r.origin!==o.origin)return!1;if(r.pathname.length<o.pathname.length)return!1;let n=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",i=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";return n.startsWith(i)}class M extends Error{constructor(e,t){super(e);this.errorUri=t,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};if(this.errorUri)e.error_uri=this.errorUri;return e}get errorCode(){return this.constructor.errorCode}}class Ht extends M{}Ht.errorCode="invalid_request";class Ee extends M{}Ee.errorCode="invalid_client";class Ne extends M{}Ne.errorCode="invalid_grant";class je extends M{}je.errorCode="unauthorized_client";class Xt extends M{}Xt.errorCode="unsupported_grant_type";class Yt extends M{}Yt.errorCode="invalid_scope";class er extends M{}er.errorCode="access_denied";class we extends M{}we.errorCode="server_error";class tr extends M{}tr.errorCode="temporarily_unavailable";class rr extends M{}rr.errorCode="unsupported_response_type";class or extends M{}or.errorCode="unsupported_token_type";class nr extends M{}nr.errorCode="invalid_token";class ir extends M{}ir.errorCode="method_not_allowed";class sr extends M{}sr.errorCode="too_many_requests";class Le extends M{}Le.errorCode="invalid_client_metadata";class cr extends M{}cr.errorCode="insufficient_scope";class ar extends M{}ar.errorCode="invalid_target";var Zu={[Ht.errorCode]:Ht,[Ee.errorCode]:Ee,[Ne.errorCode]:Ne,[je.errorCode]:je,[Xt.errorCode]:Xt,[Yt.errorCode]:Yt,[er.errorCode]:er,[we.errorCode]:we,[tr.errorCode]:tr,[rr.errorCode]:rr,[or.errorCode]:or,[nr.errorCode]:nr,[ir.errorCode]:ir,[sr.errorCode]:sr,[Le.errorCode]:Le,[cr.errorCode]:cr,[ar.errorCode]:ar};class de extends Error{constructor(e){super(e??"Unauthorized")}}function dd(e){return["client_secret_basic","client_secret_post","none"].includes(e)}var cn="code",un="S256";function md(e,t){let r=e.client_secret!==void 0;if("token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&dd(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method)))return e.token_endpoint_auth_method;if(t.length===0)return r?"client_secret_basic":"none";if(r&&t.includes("client_secret_basic"))return"client_secret_basic";if(r&&t.includes("client_secret_post"))return"client_secret_post";if(t.includes("none"))return"none";return r?"client_secret_post":"none"}function hd(e,t,r,o){let{client_id:n,client_secret:i}=t;switch(e){case"client_secret_basic":gd(n,i,r);return;case"client_secret_post":_d(n,i,o);return;case"none":zd(n,o);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}function gd(e,t,r){if(!t)throw Error("client_secret_basic authentication requires a client_secret");let o=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${o}`)}function _d(e,t,r){if(r.set("client_id",e),t)r.set("client_secret",t)}function zd(e,t){t.set("client_id",e)}async function Ru(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let o=$u.parse(JSON.parse(r)),{error:n,error_description:i,error_uri:s}=o;return new(Zu[n]||we)(i||"",s)}catch(o){let n=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${o}. Raw body: ${r}`;return new we(n)}}async function Fe(e,t){try{return await pn(e,t)}catch(r){if(r instanceof Ee||r instanceof je)return await e.invalidateCredentials?.("all"),await pn(e,t);else if(r instanceof Ne)return await e.invalidateCredentials?.("tokens"),await pn(e,t);throw r}}async function pn(e,{serverUrl:t,authorizationCode:r,scope:o,resourceMetadataUrl:n,fetchFn:i}){let s=await e.discoveryState?.(),c,a,l,p=n;if(!p&&s?.resourceMetadataUrl)p=new URL(s.resourceMetadataUrl);if(s?.authorizationServerUrl){if(a=s.authorizationServerUrl,c=s.resourceMetadata,l=s.authorizationServerMetadata??await Iu(a,{fetchFn:i}),!c)try{c=await Cu(t,{resourceMetadataUrl:p},i)}catch{}if(l!==s.authorizationServerMetadata||c!==s.resourceMetadata)await e.saveDiscoveryState?.({authorizationServerUrl:String(a),resourceMetadataUrl:p?.toString(),resourceMetadata:c,authorizationServerMetadata:l})}else{let F=await Sd(t,{resourceMetadataUrl:p,fetchFn:i});a=F.authorizationServerUrl,l=F.authorizationServerMetadata,c=F.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(a),resourceMetadataUrl:p?.toString(),resourceMetadata:c,authorizationServerMetadata:l})}let d=await yd(t,e,c),h=o||c?.scopes_supported?.join(" ")||e.clientMetadata.scope,m=await Promise.resolve(e.clientInformation());if(!m){if(r!==void 0)throw Error("Existing OAuth client information is required when exchanging an authorization code");let F=l?.client_id_metadata_document_supported===!0,ae=e.clientMetadataUrl;if(ae&&!xd(ae))throw new Le(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${ae}`);if(F&&ae)m={client_id:ae},await e.saveClientInformation?.(m);else{if(!e.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");let O=await Rd(a,{metadata:l,clientMetadata:e.clientMetadata,scope:h,fetchFn:i});await e.saveClientInformation(O),m=O}}let g=!e.redirectUrl;if(r!==void 0||g){let F=await Od(e,a,{metadata:l,resource:d,authorizationCode:r,fetchFn:i});return await e.saveTokens(F),"AUTHORIZED"}let v=await e.tokens();if(v?.refresh_token)try{let F=await Zd(a,{metadata:l,clientInformation:m,refreshToken:v.refresh_token,resource:d,addClientAuthentication:e.addClientAuthentication,fetchFn:i});return await e.saveTokens(F),"AUTHORIZED"}catch(F){if(!(F instanceof M)||F instanceof we);else throw F}let w=e.state?await e.state():void 0,{authorizationUrl:Z,codeVerifier:H}=await kd(a,{metadata:l,clientInformation:m,state:w,redirectUrl:e.redirectUrl,scope:h,resource:d});return await e.saveCodeVerifier(H),await e.redirectToAuthorization(Z),"REDIRECT"}function xd(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function yd(e,t,r){let o=ku(e);if(t.validateResourceURL)return await t.validateResourceURL(o,r?.resource);if(!r)return;if(!Pu({requestedResource:o,configuredResource:r.resource}))throw Error(`Protected resource ${r.resource} does not match expected ${o} (or origin)`);return new URL(r.resource)}function Lt(e){let t=e.headers.get("WWW-Authenticate");if(!t)return{};let[r,o]=t.split(" ");if(r.toLowerCase()!=="bearer"||!o)return{};let n=fn(e,"resource_metadata")||void 0,i;if(n)try{i=new URL(n)}catch{}let s=fn(e,"scope")||void 0,c=fn(e,"error")||void 0;return{resourceMetadataUrl:i,scope:s,error:c}}function fn(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let o=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),n=r.match(o);if(n)return n[1]||n[2];return null}async function Cu(e,t,r=fetch){let o=await wd(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!o||o.status===404)throw await o?.body?.cancel(),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!o.ok)throw await o.body?.cancel(),Error(`HTTP ${o.status} trying to load well-known OAuth protected resource metadata.`);return bu.parse(await o.json())}async function dn(e,t,r=fetch){try{return await r(e,{headers:t})}catch(o){if(o instanceof TypeError)if(t)return dn(e,void 0,r);else return;throw o}}function bd(e,t="",r={}){if(t.endsWith("/"))t=t.slice(0,-1);return r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function Ou(e,t,r=fetch){return await dn(e,{"MCP-Protocol-Version":t},r)}function vd(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function wd(e,t,r,o){let n=new URL(e),i=o?.protocolVersion??Qt,s;if(o?.metadataUrl)s=new URL(o.metadataUrl);else{let a=bd(t,n.pathname);s=new URL(a,o?.metadataServerUrl??n),s.search=n.search}let c=await Ou(s,i,r);if(!o?.metadataUrl&&vd(c,n.pathname)){let a=new URL(`/.well-known/${t}`,n);c=await Ou(a,i,r)}return c}function $d(e){let t=typeof e==="string"?new URL(e):e,r=t.pathname!=="/",o=[];if(!r)return o.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),o.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),o;let n=t.pathname;if(n.endsWith("/"))n=n.slice(0,-1);return o.push({url:new URL(`/.well-known/oauth-authorization-server${n}`,t.origin),type:"oauth"}),o.push({url:new URL(`/.well-known/openid-configuration${n}`,t.origin),type:"oidc"}),o.push({url:new URL(`${n}/.well-known/openid-configuration`,t.origin),type:"oidc"}),o}async function Iu(e,{fetchFn:t=fetch,protocolVersion:r=Qt}={}){let o={"MCP-Protocol-Version":r,Accept:"application/json"},n=$d(e);for(let{url:i,type:s}of n){let c=await dn(i,o,t);if(!c)continue;if(!c.ok){if(await c.body?.cancel(),c.status>=400&&c.status<500)continue;throw Error(`HTTP ${c.status} trying to load ${s==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}if(s==="oauth")return Qo.parse(await c.json());else return vu.parse(await c.json())}return}async function Sd(e,t){let r,o;try{if(r=await Cu(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0)o=r.authorization_servers[0]}catch{}if(!o)o=String(new URL("/",e));let n=await Iu(o,{fetchFn:t?.fetchFn});return{authorizationServerUrl:o,authorizationServerMetadata:n,resourceMetadata:r}}async function kd(e,{metadata:t,clientInformation:r,redirectUrl:o,scope:n,state:i,resource:s}){let c;if(t){if(c=new URL(t.authorization_endpoint),!t.response_types_supported.includes(cn))throw Error(`Incompatible auth server: does not support response type ${cn}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(un))throw Error(`Incompatible auth server: does not support code challenge method ${un}`)}else c=new URL("/authorize",e);let a=await fr(),{code_verifier:l,code_challenge:p}=a;if(c.searchParams.set("response_type",cn),c.searchParams.set("client_id",r.client_id),c.searchParams.set("code_challenge",p),c.searchParams.set("code_challenge_method",un),c.searchParams.set("redirect_uri",String(o)),i)c.searchParams.set("state",i);if(n)c.searchParams.set("scope",n);if(n?.includes("offline_access"))c.searchParams.append("prompt","consent");if(s)c.searchParams.set("resource",s.href);return{authorizationUrl:c,codeVerifier:l}}function Pd(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function Tu(e,{metadata:t,tokenRequestParams:r,clientInformation:o,addClientAuthentication:n,resource:i,fetchFn:s}){let c=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),a=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(i)r.set("resource",i.href);if(n)await n(a,r,c,t);else if(o){let p=t?.token_endpoint_auth_methods_supported??[],d=md(o,p);hd(d,o,a,r)}let l=await(s??fetch)(c,{method:"POST",headers:a,body:r});if(!l.ok)throw await Ru(l);return wu.parse(await l.json())}async function Zd(e,{metadata:t,clientInformation:r,refreshToken:o,resource:n,addClientAuthentication:i,fetchFn:s}){let c=new URLSearchParams({grant_type:"refresh_token",refresh_token:o}),a=await Tu(e,{metadata:t,tokenRequestParams:c,clientInformation:r,addClientAuthentication:i,resource:n,fetchFn:s});return{refresh_token:o,...a}}async function Od(e,t,{metadata:r,resource:o,authorizationCode:n,fetchFn:i}={}){let s=e.clientMetadata.scope,c;if(e.prepareTokenRequest)c=await e.prepareTokenRequest(s);if(!c){if(!n)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");let l=await e.codeVerifier();c=Pd(n,l,e.redirectUrl)}let a=await e.clientInformation();return Tu(t,{metadata:r,tokenRequestParams:c,clientInformation:a??void 0,addClientAuthentication:e.addClientAuthentication,resource:o,fetchFn:i})}async function Rd(e,{metadata:t,clientMetadata:r,scope:o,fetchFn:n}){let i;if(t){if(!t.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");i=new URL(t.registration_endpoint)}else i=new URL("/register",e);let s=await(n??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,...o!==void 0?{scope:o}:{}})});if(!s.ok)throw await Ru(s);return Su.parse(await s.json())}
|
|
59
|
+
export{Zn,Qt,Xo,bt,Jo,Tr,Yo,Ct,_,Zo,St,It,Zr,eo,ei,en,tn,Mt,kr,rn,nn,on,sn,an,ln,ti,to,ro,no,oo,io,so,ao,lo,st,Rr,ri,co,uo,po,mo,ho,fo,S,de,Fe,Lt};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{b,H}from"./chunk-
|
|
2
|
+
import{b,H}from"./chunk-c7rcw9fb.js";import{i}from"./chunk-bwawt15q.js";var I=i(b());var h=(e)=>Boolean(e)&&typeof e==="object"&&typeof e.AccessKeyId==="string"&&typeof e.SecretAccessKey==="string"&&typeof e.Token==="string"&&typeof e.Expiration==="string",C=(e)=>({accessKeyId:e.AccessKeyId,secretAccessKey:e.SecretAccessKey,sessionToken:e.Token,expiration:new Date(e.Expiration),...e.AccountId&&{accountId:e.AccountId}});var v=({maxRetries:e=0,timeout:t=1000})=>({maxRetries:e,timeout:t});var g=i(b());import y from"http";function _(e){return new Promise((t,n)=>{let o=y.request({method:"GET",...e,hostname:e.hostname?.replace(/^\[(.+)\]$/,"$1")});o.on("error",(r)=>{n(Object.assign(new g.ProviderError("Unable to connect to instance metadata service"),r)),o.destroy()}),o.on("timeout",()=>{n(new g.ProviderError("TimeoutError from instance metadata service")),o.destroy()}),o.on("response",(r)=>{let{statusCode:a=400}=r;if(a<200||300<=a)n(Object.assign(new g.ProviderError("Error response received from instance metadata service"),{statusCode:a})),o.destroy();let m=[];r.on("data",(s)=>{m.push(s)}),r.on("end",()=>{t(Buffer.concat(m)),o.destroy()})}),o.end()})}var A=(e,t)=>{let n=e();for(let o=0;o<t;o++)n=n.catch(e);return n};var S="AWS_CONTAINER_CREDENTIALS_FULL_URI",O="AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",w="AWS_CONTAINER_AUTHORIZATION_TOKEN",Y=(e={})=>{let{timeout:t,maxRetries:n}=v(e);return()=>A(async()=>{let o=await Z({logger:e.logger}),r=JSON.parse(await j(t,o));if(!h(r))throw new I.CredentialsProviderError("Invalid response received from instance metadata service.",{logger:e.logger});return C(r)},n)},j=async(e,t)=>{if(process.env[w])t.headers={...t.headers,Authorization:process.env[w]};return(await _({...t,timeout:e})).toString()},J="169.254.170.2",X=new Set(["localhost","127.0.0.1"]),z=new Set(["http:","https:"]),Z=async({logger:e})=>{if(process.env[O])return{hostname:J,path:process.env[O]};if(process.env[S]){let t;try{t=new URL(process.env[S])}catch{throw new I.CredentialsProviderError(`${process.env[S]} is not a valid container metadata service URL`,{tryNextLink:!1,logger:e})}if(!t.hostname||!X.has(t.hostname))throw new I.CredentialsProviderError(`${t.hostname} is not a valid container metadata service hostname`,{tryNextLink:!1,logger:e});if(!t.protocol||!z.has(t.protocol))throw new I.CredentialsProviderError(`${t.protocol} is not a valid container metadata service protocol`,{tryNextLink:!1,logger:e});return{protocol:t.protocol,hostname:t.hostname,path:t.pathname+t.search,port:t.port?parseInt(t.port,10):void 0}}throw new I.CredentialsProviderError(`The container metadata credential provider cannot be used unless the ${O} or ${S} environment variable is set`,{tryNextLink:!1,logger:e})};var N=i(b());var P=i(b());class D extends P.CredentialsProviderError{tryNextLink;name="InstanceMetadataV1FallbackError";constructor(e,t=!0){super(e,t);this.tryNextLink=t,Object.setPrototypeOf(this,D.prototype)}}var M=i(b()),V=i(H());var u;(function(e){e.IPv4="http://169.254.169.254",e.IPv6="http://[fd00:ec2::254]"})(u||(u={}));var L={environmentVariableSelector:(e)=>e.AWS_EC2_METADATA_SERVICE_ENDPOINT,configFileSelector:(e)=>e.ec2_metadata_service_endpoint,default:void 0};var p;(function(e){e.IPv4="IPv4",e.IPv6="IPv6"})(p||(p={}));var Q="AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE",ee="ec2_metadata_service_endpoint_mode",F={environmentVariableSelector:(e)=>e[Q],configFileSelector:(e)=>e[ee],default:p.IPv4};var k=async()=>V.parseUrl(await te()||await oe()),te=async()=>M.loadConfig(L)(),oe=async()=>{let e=await M.loadConfig(F)();switch(e){case p.IPv4:return u.IPv4;case p.IPv6:return u.IPv6;default:throw Error(`Unsupported endpoint mode: ${e}. Select from ${Object.values(p)}`)}};var x=(e,t)=>{let n=300+Math.floor(Math.random()*300),o=new Date(Date.now()+n*1000);t.warn(`Attempting credential expiration extension due to a credential service availability issue. A refresh of these credentials will be attempted after ${new Date(o)}.
|
|
3
3
|
For more information, please visit: https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html`);let r=e.originalExpiration??e.expiration;return{...e,...r?{originalExpiration:r}:{},expiration:o}};var U=(e,t={})=>{let n=t?.logger||console,o;return async()=>{let r;try{if(r=await e(),r.expiration&&r.expiration.getTime()<Date.now())r=x(r,n)}catch(a){if(o)n.warn("Credential renew failed: ",a),r=x(o,n);else throw a}return o=r,r}};var B="/latest/meta-data/iam/security-credentials/",re="/latest/api/token",R="AWS_EC2_METADATA_V1_DISABLED",W="ec2_metadata_v1_disabled",K="x-aws-ec2-metadata-token",ne=(e={})=>U(ae(e),{logger:e.logger}),ae=(e={})=>{let t=!1,{logger:n,profile:o}=e,{timeout:r,maxRetries:a}=v(e),m=async(s,f)=>{if(t||f.headers?.[K]==null){let c=!1,d=!1,q=await N.loadConfig({environmentVariableSelector:(l)=>{let E=l[R];if(d=!!E&&E!=="false",E===void 0)throw new N.CredentialsProviderError(`${R} not set in env, checking config file next.`,{logger:e.logger});return d},configFileSelector:(l)=>{let E=l[W];return c=!!E&&E!=="false",c},default:!1},{profile:o})();if(e.ec2MetadataV1Disabled||q){let l=[];if(e.ec2MetadataV1Disabled)l.push("credential provider initialization (runtime option ec2MetadataV1Disabled)");if(c)l.push(`config file profile (${W})`);if(d)l.push(`process environment variable (${R})`);throw new D(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${l.join(", ")}].`)}}let G=(await A(async()=>{let c;try{c=await ie(f)}catch(d){if(d.statusCode===401)t=!1;throw d}return c},s)).trim();return A(async()=>{let c;try{c=await ce(G,f,e)}catch(d){if(d.statusCode===401)t=!1;throw d}return c},s)};return async()=>{let s=await k();if(t)return n?.debug("AWS SDK Instance Metadata","using v1 fallback (no token fetch)"),m(a,{...s,timeout:r});else{let f;try{f=(await se({...s,timeout:r})).toString()}catch(T){if(T?.statusCode===400)throw Object.assign(T,{message:"EC2 Metadata token request returned error"});else if(T.message==="TimeoutError"||[403,404,405].includes(T.statusCode))t=!0;return n?.debug("AWS SDK Instance Metadata","using v1 fallback (initial)"),m(a,{...s,timeout:r})}return m(a,{...s,headers:{[K]:f},timeout:r})}}},se=async(e)=>_({...e,path:re,method:"PUT",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"21600"}}),ie=async(e)=>(await _({...e,path:B})).toString(),ce=async(e,t,n)=>{let o=JSON.parse((await _({...t,path:B+e})).toString());if(!h(o))throw new N.CredentialsProviderError("Invalid response received from instance metadata service.",{logger:n.logger});return C(o)};export{S as ENV_CMDS_FULL_URI,O as ENV_CMDS_RELATIVE_URI,Y as fromContainerMetadata,ne as fromInstanceMetadata};
|