eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
66 lines • 431 kB
JavaScript
import"node:process";var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n&&t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const u=new Set([`https://json-schema.org/draft/2020-12/schema`,`http://json-schema.org/draft/2020-12/schema`]),d=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]),f=new Set([`https://json-schema.org/draft-07/schema`,`http://json-schema.org/draft-07/schema`]),p=new Set([`https://json-schema.org/draft-06/schema`,`http://json-schema.org/draft-06/schema`]);function m(e){return typeof e==`string`&&d.has(e.replace(/#$/,``))}function h(e,t){if(!(`$schema`in e)||typeof e.$schema!=`string`)return`2020-12`;let n=e.$schema.replace(/#$/,``);if(u.has(n))return`2020-12`;if(d.has(n))return`2019-09`;if(f.has(n)||p.has(n))return`draft-7`;throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}function g(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function _(e,t=`|`){return e.map(e=>fe(e)).join(t)}function v(e,t){return typeof t==`bigint`?t.toString():t}function y(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function b(e){return e==null}function x(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ee(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}const te=Symbol(`evaluating`);function ne(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==te)return r===void 0&&(r=te,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function S(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function C(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function re(e){return JSON.stringify(e)}function ie(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const ae=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function oe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const se=y(()=>{if(Xe.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ce(e){if(oe(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return oe(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function le(e){return ce(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const ue=new Set([`string`,`number`,`symbol`]);function de(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function w(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function T(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function fe(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function pe(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}const me={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function he(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return w(e,C(e._zod.def,{get shape(){let e={};for(let r of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,r))throw Error(`Unrecognized key: "${String(r)}"`);t[r]&&S(e,r,n.shape[r])}return S(this,`shape`,e),e},checks:[]}))}function ge(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return w(e,C(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,e))throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&delete r[e]}return S(this,`shape`,r),r},checks:[]}))}function _e(e,t){if(!ce(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return w(e,C(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return S(this,`shape`,n),n}}))}function ve(e,t){if(!ce(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return w(e,C(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return S(this,`shape`,n),n}}))}function ye(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return w(e,C(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return S(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function be(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);return w(t,C(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(r,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t of Reflect.ownKeys(r))i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return S(this,`shape`,i),i},checks:[]}))}function xe(e,t,n){return w(t,C(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(i,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t of Reflect.ownKeys(r))i[t]=new e({type:`nonoptional`,innerType:r[t]});return S(this,`shape`,i),i}}))}function Se(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Ce(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function we(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Te(e){return typeof e==`string`?e:e?.message}function Ee(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function De(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Te(e.inst?._zod.def?.error?.(e))??Te(a?.(e))??Te(t?.error?.(e))??Te(n.customError?.(e))??Te(n.localeError?.(e))??`Invalid input`,{inst:s,schema:c,continue:l,input:u,...d}=e;return d.path??=[],d.message=o,t?.reportInput&&(d.input=u),d}const Oe=/[\uD800-\uDBFF]/;function ke(e){let t=e.length;if(!Oe.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Ae(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function je(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Me(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Ne(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Ie(e,n,r.value)}}function Pe(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Fe(e,t,n){return Pe(e,t,n,!1)}function Ie(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Pe(this,t,n.bind(this))},set(e){Pe(this,t,e)}})}function Le(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let Re,ze=!1;const Be={configurable:!0,get(){ze=!0}};function E(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Re!==e._zod){Re=void 0;return}Re=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Be);let e=ze;ze=!1;try{let r=n(this);return ze?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),ze||=e,r}catch(n){throw delete this[t],ze||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Ve(e,t,n,r){let i=Le(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}function He(e){let t=()=>e;return t[`~constantCatch`]=!0,t}var Ue;const We=Object.freeze({status:`aborted`}),Ge={value:void 0,enumerable:!1};let Ke=`captureStackTrace`in Error?Error:null;function qe(e){let t=Ke;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Ke=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function D(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Ge.value=new a(r);try{Object.defineProperty(n,"_zod",Ge)}finally{Ge.value=void 0}}if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Ne(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?qe(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Je=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ye=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Ue=globalThis).__zod_globalConfig??(Ue.__zod_globalConfig={});const Xe=globalThis.__zod_globalConfig;function Ze(e){return e&&Object.assign(Xe,e),Xe}function Qe(){let e=this._zod;return e.message??=JSON.stringify(e.def,v,2),e.message}function $e(e){this._zod.message=e}const et={get:Qe,set:$e,enumerable:!0,configurable:!0},tt={value:void 0,enumerable:!1},nt={value:void 0,enumerable:!1},rt=new WeakSet([Object.prototype,Error.prototype]),it=(e,t)=>{e.name=`$ZodError`,tt.value=e._zod,Object.defineProperty(e,"_zod",tt),nt.value=t,Object.defineProperty(e,"issues",nt),tt.value=void 0,nt.value=void 0,Object.defineProperty(e,"message",et);let n=Object.getPrototypeOf(e);rt.has(n)||(rt.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},at=D(`$ZodError`,it),ot=D(`$ZodError`,it,void 0,{Parent:Error});function st(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function ct(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?st(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function lt(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function ut(e,t){return{callee:t?.callee??e,Err:t?.Err}}const dt=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Je;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>De(e,o,Ze())));throw ae(n,a?.callee??t),n}return s.value};return t},ft=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>De(e,o,Ze())));throw ae(n,a?.callee??t),n}return s.value};return t},pt=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Je;return a.issues.length?{success:!1,error:new(e??at)(a.issues.map(e=>De(e,i,Ze())))}:{success:!0,data:a.value}},mt=pt(ot),ht=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>De(e,i,Ze())))}:{success:!0,data:a.value}},gt=ht(ot),_t=e=>{let t=dt(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,ut(n,a))};return n},vt=e=>{let t=dt(e),n=(e,r,i,a)=>t(e,r,i,ut(n,a));return n},yt=e=>{let t=ft(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,ut(n,a))};return n},bt=e=>{let t=ft(e),n=async(e,r,i,a)=>await t(e,r,i,ut(n,a));return n},xt=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return pt(e)(t,n,i)},St=e=>(t,n,r)=>pt(e)(t,n,r),Ct=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ht(e)(t,n,i)},wt=e=>async(t,n,r)=>ht(e)(t,n,r),Tt=/^[cC][0-9a-z]{6,}$/,Et=/^[0-9a-z]+$/,Dt=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Ot=/^[0-9a-vA-V]{20}$/,kt=/^[A-Za-z0-9]{27}$/,At=/^[a-zA-Z0-9_-]{21}$/;function jt(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const Mt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Nt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Pt=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ft=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function It(){return RegExp(`^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,`u`)}const Lt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Rt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,zt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Bt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Vt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ht=/^[A-Za-z0-9_-]*$/,Ut=/^https?$/,Wt=/^\+[1-9]\d{6,14}$/,Gt=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Kt(e){return RegExp(`^${e}$`)}const qt=Kt(Gt);function Jt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Yt(e){return RegExp(`^${Jt(e)}$`)}function Xt(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Jt({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Jt({precision:e.precision})}`:n;return RegExp(`^${Gt}T(?:${r})$`)}const Zt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Qt=/^-?\d+$/,$t=/^-?\d+(?:\.\d+)?$/,en=/^(?:true|false)$/i,tn=/^null$/i,nn=/^[^A-Z]*$/,rn=/^[^a-z]*$/,an=D(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),on=e=>{let t=e.value;return!b(t)&&t.length!==void 0},sn={number:`number`,bigint:`bigint`,object:`date`},cn=D(`$ZodCheckLessThan`,(e,t)=>{an.init(e,t);let n=sn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:sn[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ln=D(`$ZodCheckGreaterThan`,(e,t)=>{an.init(e,t);let n=sn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:sn[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),un=D(`$ZodCheckMultipleOf`,(e,t)=>{an.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):ee(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),dn=D(`$ZodCheckNumberFormat`,(e,t)=>{an.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=me[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Qt)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),fn=D(`$ZodCheckMaxLength`,(e,t)=>{var n;an.init(e,t),(n=e._zod.def).when??(n.when=on),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?ke(r):i)<=t.maximum)return;let a=Ae(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),pn=D(`$ZodCheckMinLength`,(e,t)=>{var n;an.init(e,t),(n=e._zod.def).when??(n.when=on),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?ke(r):i)>=t.minimum)return;let a=Ae(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),mn=D(`$ZodCheckLengthEquals`,(e,t)=>{var n;an.init(e,t),(n=e._zod.def).when??(n.when=on),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?ke(r):i;if(a===t.length)return;let o=Ae(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),hn=D(`$ZodCheckStringFormat`,(e,t)=>{var n,r;an.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),gn=D(`$ZodCheckRegex`,(e,t)=>{hn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),_n=D(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=nn,hn.init(e,t)}),vn=D(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=rn,hn.init(e,t)}),yn=D(`$ZodCheckIncludes`,(e,t)=>{an.init(e,t);let n=de(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),bn=D(`$ZodCheckStartsWith`,(e,t)=>{an.init(e,t);let n=RegExp(`^${de(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),xn=D(`$ZodCheckEndsWith`,(e,t)=>{an.init(e,t);let n=RegExp(`.*${de(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Sn=D(`$ZodCheckOverwrite`,(e,t)=>{an.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Cn=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
`)}\n};`)(...Object.values(this.closed))}};const wn={major:4,minor:5,patch:4},O=D(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=wn;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=Se(t),a;for(let o of n){if(o._zod.def.when){if(Ce(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new Je;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Ee(t.issues,n,e),i||=Se(t,n))});else{if(t.issues.length===n)continue;Ee(t.issues,n,e),i||=Se(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(Se(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Je;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new Je;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Fe(this,`~standard`,En(this))},set"~standard"(e){Pe(this,`~standard`,e)}}),Tn=e=>e.success?{value:e.data}:{issues:e.error?.issues};function En(e){return{validate:t=>{try{return Tn(mt(e,t))}catch{return gt(e,t).then(Tn)}},vendor:`zod`,version:1}}const Dn=D(`$ZodString`,(e,t)=>{O.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Zt(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),k=D(`$ZodStringFormat`,(e,t)=>{hn.init(e,t),Dn.init(e,t)}),On=D(`$ZodGUID`,(e,t)=>{t.pattern??=Nt,k.init(e,t)}),kn=D(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Pt(e)}else t.pattern??=Pt();k.init(e,t)}),An=D(`$ZodEmail`,(e,t)=>{t.pattern??=Ft,k.init(e,t)});function jn(e,t){if(!t.normalize&&t.protocol?.source===Ut.source&&!/^https?:\/\//i.test(e))return 1;try{return new URL(e)}catch{return 2}}const Mn=/[\t\n\r]/g;function Nn(e){return e.replace(Mn,``)}function Pn(e,t){return t.lastIndex=0,t.test(e.hostname)}function Fn(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}const In=D(`$ZodURL`,(e,t)=>{k.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=jn(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}t.hostname&&!Pn(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Fn(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Nn(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Ln=D(`$ZodEmoji`,(e,t)=>{t.pattern??=It(),k.init(e,t)}),Rn=D(`$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.length===void 0?At:jt(t.length),k.init(e,t)}),zn=D(`$ZodCUID`,(e,t)=>{t.pattern??=Tt,k.init(e,t)}),Bn=D(`$ZodCUID2`,(e,t)=>{t.pattern??=Et,k.init(e,t)}),Vn=D(`$ZodULID`,(e,t)=>{t.pattern??=Dt,k.init(e,t)}),Hn=D(`$ZodXID`,(e,t)=>{t.pattern??=Ot,k.init(e,t)}),Un=D(`$ZodKSUID`,(e,t)=>{t.pattern??=kt,k.init(e,t)}),Wn=D(`$ZodISODateTime`,(e,t)=>{t.pattern??=Xt(t),k.init(e,t),(t.local||t.precision===-1)&&(e._zod.bag.laxFormat=!0,e._zod.onattach.push(e=>{e._zod.bag.laxFormat=!0}))}),Gn=D(`$ZodISODate`,(e,t)=>{t.pattern??=qt,k.init(e,t)}),Kn=D(`$ZodISOTime`,(e,t)=>{t.pattern??=Yt(t),k.init(e,t)}),qn=D(`$ZodISODuration`,(e,t)=>{t.pattern??=Mt,k.init(e,t)}),Jn=D(`$ZodIPv4`,(e,t)=>{t.pattern??=Lt,k.init(e,t),e._zod.bag.format=`ipv4`}),Yn=/^[0-9a-fA-F:.]+$/;function Xn(e){if(!Yn.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}const Zn=D(`$ZodIPv6`,(e,t)=>{t.pattern??=Rt,k.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{Xn(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Qn=D(`$ZodCIDRv4`,(e,t)=>{t.pattern??=zt,k.init(e,t)});function $n(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Xn(n)}const er=D(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Bt,k.init(e,t),e._zod.check=n=>{$n(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function tr(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const nr=D(`$ZodBase64`,(e,t)=>{t.pattern??=Vt,k.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{tr(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function rr(e){if(!Ht.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return tr(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const ir=D(`$ZodBase64URL`,(e,t)=>{t.pattern??=Ht,k.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{rr(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),ar=D(`$ZodE164`,(e,t)=>{t.pattern??=Wt,k.init(e,t)});function or(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}const sr=D(`$ZodJWT`,(e,t)=>{k.init(e,t),e._zod.check=n=>{or(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),cr=D(`$ZodNumber`,(e,t)=>{O.init(e,t),e._zod.pattern=e._zod.bag.pattern??$t,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),lr=D(`$ZodNumberFormat`,(e,t)=>{dn.init(e,t),cr.init(e,t)}),ur=D(`$ZodBoolean`,(e,t)=>{O.init(e,t),e._zod.pattern=en,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),dr=D(`$ZodNull`,(e,t)=>{O.init(e,t),e._zod.pattern=tn,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),fr=D(`$ZodAny`,(e,t)=>{O.init(e,t),e._zod.parse=e=>e}),pr=D(`$ZodUnknown`,(e,t)=>{O.init(e,t),e._zod.parse=e=>e}),mr=D(`$ZodNever`,(e,t)=>{O.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function hr(e,t,n){e.issues.length&&t.issues.push(...we(n,e.issues)),t.value[n]=e.value}const gr=D(`$ZodArray`,(e,t)=>{O.init(e,t);let n=Xe.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[];for(let e=0;e<a.length;e++){let n=a[e],s=t.element._zod.run({value:n,issues:[]},i);s instanceof Promise?o.push(s.then(t=>hr(t,r,e))):hr(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function _r(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...we(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}}const vr=[];function yr(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:vr,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=pe(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function br(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin,d=c.optout;for(let i in t){if(s.has(i))continue;if(i===`__proto__`){l===`never`&&o.push(i);continue}if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>_r(e,n,i,t,u,d))):_r(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const xr=new WeakMap,Sr=D(`$ZodObject`,(e,t)=>{if(O.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;xr.set(t,e),Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),xr.set(t,n),n}})}let n=y(()=>yr(t));E(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||S(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let r=oe,i=t.catchall,a,o=Xe.memoizer;o?.attach(e),e._zod.parse=(t,s)=>{a??=n.value;let c=t.value;if(!r(c))return t.issues.push({expected:`object`,code:`invalid_type`,input:c,inst:e}),t;t.value=o?o.alloc(e,t,{},s):{};let l=[],u=a.shape;for(let e of a.allKeys){if(e===`__proto__`)continue;let n=u[e],r=n._zod.optin,i=n._zod.optout,a=n._zod.run({value:c[e],issues:[]},s);a instanceof Promise?l.push(a.then(n=>_r(n,t,e,c,r,i))):_r(a,t,e,c,r,i)}return i?br(l,c,t,s,n.value,e):l.length?Promise.all(l).then(()=>t):t}}),Cr=D(`$ZodObjectJIT`,(e,t)=>{Sr.init(e,t);let n=e._zod.parse,r=y(()=>yr(t)),i=Xe.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Cn([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
for (let i = 0; i < ${e}.issues.length; i++) {
const iss = ${e}.issues[i];
iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
payload.issues.push(iss);
}`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:re(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
const ${n}_present = ${i};
if (!${n}.issues.length || ${n}_present) {
if (${n}.issues.length) {${c(n,r)}
}
if (${e}) {
newResult[${r}] = ${n}.value;
}
}
`)}else f?o.write(`
if (${n}.issues.length) {${c(n,r)}
}
if (${n}.value === undefined) {
if (${i}) {
newResult[${r}] = undefined;
}
} else {
newResult[${r}] = ${n}.value;
}
`):o.write(`
const ${n}_present = ${i};
if (${n}.issues.length) {${c(n,r)}
}
if (!${n}_present && !${n}.issues.length) {
payload.issues.push({
code: "invalid_type",
expected: "nonoptional",
input: undefined,
path: [${r}]
});
}
if (${n}_present) {
newResult[${r}] = ${n}.value;
}
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=oe,c=!Xe.jitless,l=c&&se.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?br([],p,i,f,d,e):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function wr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Se(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>De(e,r,Ze())))}),t)}const Tr=D(`$ZodUnion`,(e,t)=>{O.init(e,t),E(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),E(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),E(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),E(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>x(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>wr(t,r,e,i)):wr(o,r,e,i)}}),Er=D(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Tr.init(e,t);let n=e._zod.parse;E(e,`propValues`,e=>{let t={};for(let n of e.def.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(n)}"`);for(let[e,n]of Object.entries(r)){Object.prototype.hasOwnProperty.call(t,e)||S(t,e,new Set);for(let r of n)t[e].add(r)}}return t}),t.options.forEach((e,n)=>{let r=xr.get(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=y(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!oe(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Dr=D(`$ZodIntersection`,(e,t)=>{O.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>kr(e,t,n)):kr(e,i,a)}});function Or(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ce(e)&&ce(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Or(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Or(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function kr(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Or(t.value,n.value);if(!c.valid){if(Se(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}const Ar=D(`$ZodRecord`,(e,t)=>{O.init(e,t);let n=Xe.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!ce(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>De(e,i,Ze())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...we(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...we(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&$t.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>De(e,i,Ze())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...we(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...we(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),jr=D(`$ZodEnum`,(e,t)=>{O.init(e,t);let n=g(t.entries),r=new Set(n);e._zod.values=r;let i=n.filter(e=>ue.has(typeof e));e._zod.pattern=RegExp(i.length?`^(${i.map(e=>de(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Mr=D(`$ZodLiteral`,(e,t)=>{O.init(e,t);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(t.values.length?`^(${t.values.map(e=>typeof e==`string`?de(e):e?de(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Nr=D(`$ZodTransform`,(e,t)=>{O.init(e,t),e._zod.optin=`optional`,Xe.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ye(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Je;return n.value=i,n}});function Pr(e,t){return e.value=t.issues.length?void 0:t.value,e}const Fr=D(`$ZodOptional`,(e,t)=>{O.init(e,t),E(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,E(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),E(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${x(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Pr(e,t)):Pr(e,r)}return t.innerType._zod.run(e,n)}}),Ir=D(`$ZodExactOptional`,(e,t)=>{Fr.init(e,t),E(e,`values`,e=>e.def.innerType._zod.values),E(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Lr=D(`$ZodNullable`,(e,t)=>{O.init(e,t),E(e,`optin`,e=>e.def.innerType._zod.optin),E(e,`optout`,e=>e.def.innerType._zod.optout),E(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${x(t.source)}|null)$`):void 0}),E(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Rr=D(`$ZodDefault`,(e,t)=>{O.init(e,t),e._zod.optin=`defaulted`,E(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>zr(e,t)):zr(r,t)}});function zr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Br=D(`$ZodPrefault`,(e,t)=>{O.init(e,t),e._zod.optin=`defaulted`,E(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Vr=D(`$ZodNonOptional`,(e,t)=>{O.init(e,t),E(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Hr(t,e)):Hr(i,e)}});function Hr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Ur(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>De(e,r,Ze()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const Wr=D(`$ZodCatch`,(e,t)=>{O.init(e,t),E(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),E(e,`optout`,e=>e.def.innerType._zod.optout),E(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Ur(e,r,t,n)):Ur(e,r,t,n)}}),Gr=D(`$ZodPipe`,(e,t)=>{O.init(e,t),E(e,`values`,e=>e.def.in._zod.values),E(e,`optin`,e=>e.def.in._zod.optin),E(e,`optout`,e=>e.def.out._zod.optout),E(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Kr(e,t.in,n)):Kr(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Kr(e,t.out,n)):Kr(r,t.out,n)}});function Kr(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const qr=D(`$ZodPreprocess`,(e,t)=>{Gr.init(e,t)}),Jr=D(`$ZodReadonly`,(e,t)=>{O.init(e,t),E(e,`propValues`,e=>e.def.innerType._zod.propValues),E(e,`values`,e=>e.def.innerType._zod.values),E(e,`optin`,e=>e.def.innerType?._zod?.optin),E(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Yr):Yr(r)}});function Yr(e){return e.memo||(e.value=Object.freeze(e.value)),e}const Xr=D(`$ZodLazy`,(e,t)=>{O.init(e,t),ne(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),E(e,`pattern`,e=>e.innerType?._zod?.pattern),E(e,`propValues`,e=>e.innerType?._zod?.propValues),E(e,`optin`,e=>e.innerType?._zod?.optin??void 0),E(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Zr=D(`$ZodCustom`,(e,t)=>{an.init(e,t),O.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Qr(t,n,r,e));Qr(i,n,r,e)}});function Qr(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Me(e))}}var $r=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}};const ei=`~memo`,ti=[];function ni(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}const ri=new WeakMap;function ii(e,t){let n=ri.get(e);if(n!==void 0)return n;if(t.has(e))return!0;t.add(e);let r=!1,i=e=>{!r&&e?._zod&&ii(e,t)&&(r=!0)},a=e._zod.def;switch(a.type){case`object`:for(let e of Reflect.ownKeys(a.shape))i(a.shape[e]);i(a.catchall);break;case`array`:i(a.element);break;case`tuple`:for(let e of a.items)i(e);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 e of a.options)i(e);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`:i(e._zod.innerType);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 e in a){let t=Object.getOwnPropertyDescriptor(a,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)i(n);else if(Array.isArray(n))for(let e of n)i(e)}}}return t.delete(e),ri.set(e,r),r}function ai(e,t){let n=e.buckets.get(t);return n||(n=new Map,e.buckets.set(t,n)),n}let oi;const si=[],ci={alloc(e,t,n){let r=oi;if(!r)return n;oi=void 0;let i={value:n,issues:null};return r.set(t.value,i),si.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&ui(n,e.value))throw new $r;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,a=(o,s)=>{if(n===void 0&&(n=ii(e,new Set),!n))return e._zod.parse=t,e._zod.run===a&&(e._zod.run=t),t(o,s);let c=o.value;if(typeof c!=`object`||!c)return t(o,s);let l=s[ei];l||(l={buckets:new Map,backEdges:void 0},s[ei]=l);let u;r===s?u=i:(u=ai(l,e),r=s,i=u);let d=u.get(c);if(d)return o.value=d.value,d.issues?d.issues.length&&o.issues.push(...ni(d.issues)):(o.memo=!0,l.backEdges??(l.backEdges=new Set),l.backEdges.add(d.value)),o;oi=u;let f=si.length,p=t(o,s);oi=void 0;let m=si.length>f?si.pop():void 0;return p instanceof Promise?p.then(e=>(m&&(m.issues=e.issues.length?ni(e.issues):ti),e)):(m&&(m.issues=p.issues.length?ni(p.issues):ti),p)};e._zod.parse=a,e._zod.run===t&&(e._zod.run=a)})}};function li(){return ci}function ui(e,t){let n=e[ei]?.backEdges;return n!==void 0&&typeof t==`object`&&!!t&&n.has(t)}const di=()=>{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(t){return e[t]??null}let n={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`,credit_card:`credit card number`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(je(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${fe(e.values[0])}`:`Invalid option: expected one of ${_(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${_(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function fi(){return{localeError:di()}}var pi,mi=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function hi(){return new mi}(pi=globalThis).__zod_globalRegistry??(pi.__zod_globalRegistry=hi());const gi=globalThis.__zod_globalRegistry;function _i(e,t){return new e({type:`string`,...T(t)})}function vi(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...T(t)})}function yi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...T(t)})}function bi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...T(t)})}function xi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...T(t)})}function Si(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...T(t)})}function Ci(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...T(t)})}function wi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...T(t)})}function Ti(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...T(t)})}function Ei(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...T(t)})}function Di(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...T(t)})}function Oi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...T(t)})}function ki(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...T(t)})}function Ai(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...T(t)})}function ji(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...T(t)})}function Mi(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...T(t)})}function Ni(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...T(t)})}function Pi(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...T(t)})}function Fi(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...T(t)})}function Ii(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...T(t)})}function Li(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...T(t)})}function Ri(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...T(t)})}function zi(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...T(t)})}function Bi(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...T(t)})}function Vi(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...T(t)})}function Hi(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...T(t)})}function Ui(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...T(t)})}function Wi(e,t){return new e({type:`number`,checks:[],...T(t)})}function Gi(e,t){return new e({type:`number`,coerce:!0,checks:[],...T(t)})}function Ki(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...T(t)})}function qi(e,t){return new e({type:`boolean`,...T(t)})}function Ji(e,t){return new e({type:`null`,...T(t)})}function Yi(e){return new e({type:`any`})}function Xi(e){return new e({type:`unknown`})}function Zi(e,t){return new e({type:`never`,...T(t)})}function Qi(e,t){return new cn({check:`less_than`,...T(t),value:e,inclusive:!1})}function $i(e,t){return new cn({check:`less_than`,...T(t),value:e,inclusive:!0})}function ea(e,t){return new ln({check:`greater_than`,...T(t),value:e,inclusive:!1})}function ta(e,t){return new ln({check:`greater_than`,...T(t),value:e,inclusive:!0})}function na(e,t){return new un({check:`multiple_of`,...T(t),value:e})}function ra(e,t){return new fn({check:`max_length`,...T(t),maximum:e})}function ia(e,t){return new pn({check:`min_length`,...T(t),minimum:e})}function aa(e,t){return new mn({check:`length_equals`,...T(t),length:e})}function oa(e,t){return new gn({check:`string_format`,format:`regex`,...T(t),pattern:e})}function sa(e){return new _n({check:`string_format`,format:`lowercase`,...T(e)})}function ca(e){return new vn({check:`string_format`,format:`uppercase`,...T(e)})}function la(e,t){return new yn({check:`string_format`,format:`includes`,...T(t),includes:e})}function ua(e,t){return new bn({check:`string_format`,format:`starts_with`,...T(t),prefix:e})}function da(e,t){return new xn({check:`string_format`,format:`ends_with`,...T(t),suffix:e})}function fa(e){return new Sn({check:`overwrite`,tx:e})}function pa(e){return fa(t=>t.normalize(e))}function ma(){return fa(e=>e.trim())}function ha(){return fa(e=>e.toLowerCase())}function ga(){return fa(e=>e.toUpperCase())}function _a(){return fa(e=>ie(e))}function va(e,t,n){return new e({type:`array`,element:t,...T(n)})}function ya(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...T(n)})}function ba(e,t){let n=xa(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Me(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Me(r))}},e(t.value,t)),t);return n}function xa(e,t){let n=new an({check:`custom`,...T(t)});return n._zod.check=e,n}function Sa(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&S(e,t,n[t]);return e}function Ca(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??gi,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 wa(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function A(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,A(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Sa(o.schema,c),t.io===`input`&&Pa(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Ta(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Ea(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Ta(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Ta(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Da(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Da(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}const Oa=new Set([`type`,`properties`,`required`,`additionalProperties`]),ka=[`oneOf`,`anyOf`];function Aa(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function ja(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Oa.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Aa(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}S(n,r,e.length===1?e[0]:ja(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Aa(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Ma(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Oa)if(t in e)return;let n=t.filter(e=>ka.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=ja(t);else{let e=n[0],i=ka.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>ja([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Sa(e,r))}function Na(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Sa(i,s),Sa(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Da(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Ma(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Sa(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,S(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Ia(t,`input`,e.processors),output:Ia(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Pa(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Pa(r.element,n);if(r.type===`set`)return Pa(r.valueType,n);if(r.type===`lazy`)return Pa(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return Pa(r.innerType,n);if(r.type===`intersection`)return Pa(r.left,n)||Pa(r.right,n);if(r.type===`record`||r.type===`map`)return Pa(r.keyType,n)||Pa(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Pa(r.in,n)||Pa(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Pa(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Pa(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Pa(e,n))return!0;return!!(r.rest&&Pa(r.rest,n))}return!1}const Fa=(e,t={})=>n=>{let r=Ca({...n,processors:t});return A(e,r),Ea(r,e),Na(r,e)},Ia=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ca({...i??{},target:a,io:t,processors:n});return A(e,o),Ea(o,e),Na(o,e)},La={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Ra=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=La[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},za=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(Number.isFinite(c)&&c!==0?i.multipleOf=Math.abs(c):wa(e,t,i,r,`A multipleOf divisor of ${c} cannot be represented in JSON Schema`))},Ba=(e,t,n,r)=>{n.type=`boolean`},Va=(e,t,n,r)=>{wa(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},Ha=(e,t,n,r)=>{wa(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},Ua=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Wa=(e,t,n,r)=>{wa(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},Ga=(e,t,n,r)=>{wa(e,t,n,r,`Void cannot be represented in JSON Schema`)},Ka=(e,t,n,r)=>{n.not={}},qa=(e,t,n,r)=>{},Ja=(e,t,n,r)=>{},Ya=(e,t,n,r)=>{wa(e,t,n,r,`Date cannot be represented in JSON Schema`)},Xa=(e,t,n,r)=>{let i=e._zod.def,a=g(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Za=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(wa(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(wa(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Qa=(e,t,n,r)=>{wa(e,t,n,r,`NaN cannot be represented in JSON Schema`)},$a=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},eo=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},to=(e,t,n,r)=>{n.type=`boolean`},no=(e,t,n,r)=>{wa(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},ro=(e,t,n,r)=>{wa(e,t,n,r,`Function types cannot be represented in JSON Schema`)},io=(e,t,n,r)=>{wa(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},ao=(e,t,n,r)=>{wa(e,t,n,r,`Map cannot be represented in JSON Schema`)},oo=(e,t,n,r)=>{wa(e,t,n,r,`Set cannot be represented in JSON Schema`)},so=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=A(a.element,t,{...r,path:[...r.path,`items`]})};function co(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?co(t.out):t.type===`catch`?co(t.innerType):e._zod.optin}const lo=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&wa(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)S(i.properties,e,A(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e];return t.io===`input`?co(n)===void 0:n._zod.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=A(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},uo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>A(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},fo=(e,t,n,r)=>{let i=e._zod.def,a=A(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=A(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},po=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>A(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?A(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?co(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=e._zod.bag;typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function mo(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=mo(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>mo(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?$t:Qt).source),p):p}const ho=new WeakMap;function go(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of ho.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=mo(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}const _o=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=A(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)S(i.patternProperties,t.source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=A(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=ho.get(t);n||(n=[],ho.set(t,n),t.deferred.push(()=>go(t))),n.push(e)}i.additionalProperties=A(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&co(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},vo=(e,t,n,r)=>{let i=e._zod.def,a=A(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},yo=(e,t,n,r)=>{let i=e._zod.def;A(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},bo=Symbol();function xo(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(wa(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),bo):JSON.parse(o)}const So=(e,t,n,r)=>{let i=e._zod.def;A(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=xo(i.defaultValue,e,t,n,r);o!==bo&&(n.default=o)},Co=(e,t,n,r)=>{let i=e._zod.def;A(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=xo(i.defaultValue,e,t,n,r);o!==bo&&(n._prefault=o)},wo=(e,t,n,r)=>{let i=e._zod.def;A(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{wa(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},To=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;A(o,t,r);let s=t.seen.get(e);s.ref=o},Eo=(e,t,n,r)=>{let i=e._zod.def;A(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Do=(e,t,n,r)=>{let i=e._zod.def;A(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Oo=(e,t,n,r)=>{let i=e._zod.def;A(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ko=(e,t,n,r)=>{let i=e._zod.innerType;A(i,t,r);let a=t.seen.get(e);a.ref=i},Ao={string:Ra,number:za,boolean:Ba,bigint:Va,symbol:Ha,null:Ua,undefined:Wa,void:Ga,never:Ka,any:qa,unknown:Ja,date:Ya,enum:Xa,literal:Za,nan:Qa,template_literal:$a,file:eo,success:to,custom:no,function:ro,transform:io,map:ao,set:oo,array:so,object:lo,union:uo,intersection:fo,tuple:po,record:_o,nullable:vo,nonoptional:yo,default:So,prefault:Co,catch:wo,pipe:To,readonly:Eo,promise:Do,optional:Oo,lazy:ko};function jo(e,t){if(`_idmap`in e){let n=e,r=Ca({...t,processors:Ao}),i={};for(let e of n._idmap.entries()){let[t,n]=e;A(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;Ea(r,n),S(a,t,Na(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=Ca({...t,processors:Ao});return A(e,n),Ea(n,e),Na(n,e)}const Mo=new WeakSet([Object.prototype,Error.prototype]);function No(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}const Po=D(`ZodError`,(e,t)=>{at.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Mo.has(n)||(Mo.add(n),No(n,`format`,e=>t=>lt(e,t)),No(n,`flatten`,e=>t=>ct(e,t)),No(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,v,2)}),No(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,v,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Fo=dt(Po),Io=ft(Po),Lo=pt(Po),Ro=ht(Po),zo=_t(Po),Bo=vt(Po),Vo=yt(Po),Ho=bt(Po),Uo=xt(Po),Wo=St(Po),Go=Ct(Po),Ko=wt(Po);function qo(){Xe.localeError||Ze(fi())}function Jo(){Xe.memoizer||Ze({memoizer:li()})}const j=D(`ZodType`,(e,t)=>(qo(),O.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(C(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return w(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(fc(e,t))},superRefine(e,t){return this.check(pc(e,t))},overwrite(e){return this.check(fa(e))},optional(){return W(this)},exactOptional(){return qs(this)},nullable(){return Ys(this)},nullish(){return W(Ys(this))},nonoptional(e){return tc(this,e)},array(){return L(this)},or(e){return B([this,e])},and(e){return zs(this,e)},transform(e){return ac(this,Ws(e))},default(e){return Zs(this,e)},prefault(e){return $s(this,e)},catch(e){return rc(this,e)},pipe(e){return ac(this,e)},readonly(){return cc(this)},describe(e){let t=this.clone();return gi.add(t,{description:e}),t},meta(...e){if(e.length===0)return gi.get(this);let t=this.clone();return gi.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 Fe(this,`~standard`,{...En(this),jsonSchema:{input:Ia(this,`input`),output:Ia(this,`output`)}})},set"~standard"(e){Pe(this,`~standard`,e)},parse:function e(t,n){return Fo(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Io(this,t,n,{callee:e})},safeParse(e,t){return Lo(this,e,t)},async safeParseAsync(e,t){return Ro(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Pe(this,`spa`,e)},encode:function e(t,n){return zo(this,t,n,{callee:e})},decode:function e(t,n){return Bo(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Vo(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Ho(this,t,n,{callee:e})},safeEncode(e,t){return Uo(this,e,t)},safeDecode(e,t){return Wo(this,e,t)},async safeEncodeAsync(e,t){return Go(this,e,t)},async safeDecodeAsync(e,t){return Ko(this,e,t)},toJSONSchema(e){return Fa(this,{})(e)},get description(){return gi.get(this)?.description},get _def(){return this._zod.def}}),Yo=D(`_ZodString`,(e,t)=>{Dn.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ra(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null},{regex(...e){return this.check(oa(...e))},includes(...e){return this.check(la(...e))},startsWith(...e){return this.check(ua(...e))},endsWith(...e){return this.check(da(...e))},min(...e){return this.check(ia(...e))},max(...e){return this.check(ra(...e))},length(...e){return this.check(aa(...e))},nonempty(...e){return this.check(ia(1,...e))},lowercase(e){return this.check(sa(e))},uppercase(e){return this.check(ca(e))},trim(){return this.check(ma())},normalize(...e){return this.check(pa(...e))},toLowerCase(){return this.check(ha())},toUpperCase(){return this.check(ga())},slugify(){return this.check(_a())}}),Xo=D(`ZodString`,(e,t)=>{Dn.init(e,t),Yo.init(e,t)},{email(e){return this.check(vi(ts,e))},url(e){return this.check(wi(as,e))},jwt(e){return this.check(zi(xs,e))},emoji(e){return this.check(Ti(ss,e))},guid(e){return this.check(yi(rs,e))},uuid(e){return this.check(bi(is,e))},uuidv4(e){return this.check(xi(is,e))},uuidv6(e){return this.check(Si(is,e))},uuidv7(e){return this.check(Ci(is,e))},nanoid(e){return this.check(Ei(cs,e))},cuid(e){return this.check(Di(ls,e))},cuid2(e){return this.check(Oi(us,e))},ulid(e){return this.check(ki(ds,e))},base64(e){return this.check(Ii(vs,e))},base64url(e){return this.check(Li(ys,e))},xid(e){return this.check(Ai(fs,e))},ksuid(e){return this.check(ji(ps,e))},ipv4(e){return this.check(Mi(ms,e))},ipv6(e){return this.check(Ni(hs,e))},cidrv4(e){return this.check(Pi(gs,e))},cidrv6(e){return this.check(Fi(_s,e))},e164(e){return this.check(Ri(bs,e))},datetime(e){return this.check(Bi(Zo,e))},date(e){return this.check(Vi(Qo,e))},time(e){return this.check(Hi($o,e))},duration(e){return this.check(Ui(es,e))}});function M(e){return _i(Xo,e)}const N=D(`ZodStringFormat`,(e,t)=>{k.init(e,t),Yo.init(e,t)}),Zo=D(`ZodISODateTime`,(e,t)=>{Wn.init(e,t),N.init(e,t)}),Qo=D(`ZodISODate`,(e,t)=>{Gn.init(e,t),N.init(e,t)}),$o=D(`ZodISOTime`,(e,t)=>{Kn.init(e,t),N.init(e,t)}),es=D(`ZodISODuration`,(e,t)=>{qn.init(e,t),N.init(e,t)}),ts=D(`ZodEmail`,(e,t)=>{An.init(e,t),N.init(e,t)});function ns(e){return vi(ts,e)}const rs=D(`ZodGUID`,(e,t)=>{On.init(e,t),N.init(e,t)}),is=D(`ZodUUID`,(e,t)=>{kn.init(e,t),N.init(e,t)}),as=D(`ZodURL`,(e,t)=>{In.init(e,t),N.init(e,t)});function os(e){return wi(as,e)}const ss=D(`ZodEmoji`,(e,t)=>{Ln.init(e,t),N.init(e,t)}),cs=D(`ZodNanoID`,(e,t)=>{Rn.init(e,t),N.init(e,t)}),ls=D(`ZodCUID`,(e,t)=>{zn.init(e,t),N.init(e,t)}),us=D(`ZodCUID2`,(e,t)=>{Bn.init(e,t),N.init(e,t)}),ds=D(`ZodULID`,(e,t)=>{Vn.init(e,t),N.init(e,t)}),fs=D(`ZodXID`,(e,t)=>{Hn.init(e,t),N.init(e,t)}),ps=D(`ZodKSUID`,(e,t)=>{Un.init(e,t),N.init(e,t)}),ms=D(`ZodIPv4`,(e,t)=>{Jn.init(e,t),N.init(e,t)}),hs=D(`ZodIPv6`,(e,t)=>{Zn.init(e,t),N.init(e,t)}),gs=D(`ZodCIDRv4`,(e,t)=>{Qn.init(e,t),N.init(e,t)}),_s=D(`ZodCIDRv6`,(e,t)=>{er.init(e,t),N.init(e,t)}),vs=D(`ZodBase64`,(e,t)=>{nr.init(e,t),N.init(e,t)}),ys=D(`ZodBase64URL`,(e,t)=>{ir.init(e,t),N.init(e,t)}),bs=D(`ZodE164`,(e,t)=>{ar.init(e,t),N.init(e,t)}),xs=D(`ZodJWT`,(e,t)=>{sr.init(e,t),N.init(e,t)}),Ss=D(`ZodNumber`,(e,t)=>{cr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>za(e,t,n,r);let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null},{gt(e,t){return this.check(ea(e,t))},gte(e,t){return this.check(ta(e,t))},min(e,t){return this.check(ta(e,t))},lt(e,t){return this.check(Qi(e,t))},lte(e,t){return this.check($i(e,t))},max(e,t){return this.check($i(e,t))},int(e){return this.check(ws(e))},safe(e){return this.check(ws(e))},positive(e){return this.check(ea(0,e))},nonnegative(e){return this.check(ta(0,e))},negative(e){return this.check(Qi(0,e))},nonpositive(e){return this.check($i(0,e))},multipleOf(e,t){return this.check(na(e,t))},step(e,t){return this.check(na(e,t))},finite(){return this}});function P(e){return Wi(Ss,e)}const Cs=D(`ZodNumberFormat`,(e,t)=>{lr.init(e,t),Ss.init(e,t)});function ws(e){return Ki(Cs,e)}const Ts=D(`ZodBoolean`,(e,t)=>{ur.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ba(e,t,n,r)});function F(e){return qi(Ts,e)}const Es=D(`ZodNull`,(e,t)=>{dr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ua(e,t,n,r)});function Ds(e){return Ji(Es,e)}const Os=D(`ZodAny`,(e,t)=>{fr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function ks(){return Yi(Os)}const As=D(`ZodUnknown`,(e,t)=>{pr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function I(){return Xi(As)}const js=D(`ZodNever`,(e,t)=>{mr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ka(e,t,n,r)});function Ms(e){return Zi(js,e)}const Ns=D(`ZodArray`,(e,t)=>{Jo(),gr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r),e.element=t.element},{min(e,t){return this.check(ia(e,t))},nonempty(e){return this.check(ia(1,e))},max(e,t){return this.check(ra(e,t))},length(e,t){return this.check(aa(e,t))},unwrap(){return this.element}});function L(e,t){return va(Ns,e,t)}const Ps=D(`ZodObject`,(e,t)=>{Jo(),Cr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lo(e,t,n,r),Ve(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return H(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:I()})},loose(){return this.clone({...this._zod.def,catchall:I()})},strict(){return this.clone({...this._zod.def,catchall:Ms()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return _e(this,e)},safeExtend(e){return ve(this,e)},merge(e){return ye(this,e)},pick(e){return he(this,e)},omit(e){return ge(this,e)},partial(...e){return be(Gs,this,e[0])},exactPartial(...e){return be(Ks,this,e[0],`exactPartial`)},required(...e){return xe(ec,this,e[0])}});function R(e,t){let n={type:`object`,shape:e??{},...T(t)};return new Ps(n)}function z(e,t){return new Ps({type:`object`,shape:e,catchall:I(),...T(t)})}const Fs=D(`ZodUnion`,(e,t)=>{Tr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r),e.options=t.options});function B(e,t){return new Fs({type:`union`,options:e,...T(t)})}const Is=D(`ZodDiscriminatedUnion`,(e,t)=>{Fs.init(e,t),Er.init(e,t)});function Ls(e,t,n){return new Is({type:`union`,options:t,discriminator:e,...T(n)})}const Rs=D(`ZodIntersection`,(e,t)=>{Dr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(e,t,n,r)});function zs(e,t){return new Rs({type:`intersection`,left:e,right:t})}const Bs=D(`ZodRecord`,(e,t)=>{Jo(),Ar.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_o(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function V(e,t,n){return!t||!t._zod?new Bs({type:`record`,keyType:M(),valueType:e,...T(t)}):new Bs({type:`record`,keyType:e,valueType:t,...T(n)})}const Vs=D(`ZodEnum`,(e,t)=>{jr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xa(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Vs({...t,checks:[],...T(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Vs({...t,checks:[],...T(r),entries:i})}});function H(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Vs({type:`enum`,entries:n,...T(t)})}const Hs=D(`ZodLiteral`,(e,t)=>{Mr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Za(e,t,n,r),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 U(e,t){return new Hs({type:`literal`,values:Array.isArray(e)?e:[e],...T(t)})}const Us=D(`ZodTransform`,(e,t)=>{Jo(),Nr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ye(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Me(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Me(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Ws(e){return new Us({type:`transform`,transform:e})}const Gs=D(`ZodOptional`,(e,t)=>{Fr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function W(e){return new Gs({type:`optional`,innerType:e})}const Ks=D(`ZodExactOptional`,(e,t)=>{Ir.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function qs(e){return new Ks({type:`optional`,innerType:e})}const Js=D(`ZodNullable`,(e,t)=>{Lr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ys(e){return new Js({type:`nullable`,innerType:e})}const Xs=D(`ZodDefault`,(e,t)=>{Rr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Zs(e,t){return new Xs({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():le(t)}})}const Qs=D(`ZodPrefault`,(e,t)=>{Br.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $s(e,t){return new Qs({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():le(t)}})}const ec=D(`ZodNonOptional`,(e,t)=>{Vr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function tc(e,t){return new ec({type:`nonoptional`,innerType:e,...T(t)})}const nc=D(`ZodCatch`,(e,t)=>{Wr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function rc(e,t){return new nc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:He(t)})}const ic=D(`ZodPipe`,(e,t)=>{Gr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r),e.in=t.in,e.out=t.out});function ac(e,t){return new ic({type:`pipe`,in:e,out:t})}const oc=D(`ZodPreprocess`,(e,t)=>{ic.init(e,t),qr.init(e,t)}),sc=D(`ZodReadonly`,(e,t)=>{Jr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function cc(e){return new sc({type:`readonly`,innerType:e})}const lc=D(`ZodLazy`,(e,t)=>{Xr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function uc(e){return new lc({type:`lazy`,getter:e})}const dc=D(`ZodCustom`,(e,t)=>{Zr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(t,n,r)=>no(e,t,n,r)});function fc(e,t={}){return ya(dc,e,t)}function pc(e,t){return ba(e,t)}function mc(e,t){return new oc({type:`pipe`,in:Ws(e),out:t})}const hc={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 gc;gc||={};function _c(e){return Bi(Zo,e)}function vc(e){return Vi(Qo,e)}function yc(e){return Gi(Ss,e)}const bc=`2025-11-25`,xc=`2025-03-26`,Sc=[bc,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],Cc=`io.modelcontextprotocol/related-task`,wc=`io.modelcontextprotocol/protocolVersion`,Tc=`io.modelcontextprotocol/clientInfo`,Ec=`io.modelcontextprotocol/serverInfo`,Dc=`io.modelcontextprotocol/clientCapabilities`,Oc=`io.modelcontextprotocol/subscriptionId`,kc=`io.modelcontextprotocol/logLevel`,Ac=`traceparent`,jc=`tracestate`,Mc=`baggage`,Nc=`2.0`,Pc=-32700,Fc=-32600,Ic=-32601,Lc=-32602,Rc=-32603,zc=uc(()=>B([M(),P(),F(),Ds(),V(M(),zc),L(zc)])),G=V(M(),zc),Bc=L(zc),Vc=B([M(),P().int()]),Hc=M(),Uc=R({ttl:P().optional()}),Wc=R({taskId:M()}),Gc=z({progressToken:Vc.optional(),[Cc]:Wc.optional()}),Kc=R({_meta:Gc.optional()}),qc=Kc.extend({task:Uc.optional()}),K=R({method:M(),params:Kc.loose().optional()}),Jc=R({_meta:Gc.optional()}),Yc=R({method:M(),params:Jc.loose().optional()}),Xc=z({get[Ec](){return ul.optional().catch(void 0)}}),q=z({_meta:Xc.optional()}),Zc=B([M(),P().int()]),Qc=R({jsonrpc:U(`2.0`),id:Zc,...K.shape}).strict(),$c=R({jsonrpc:U(`2.0`),...Yc.shape}).strict(),el=R({jsonrpc:U(`2.0`),id:Zc,result:q}).strict(),tl=R({jsonrpc:U(`2.0`),id:Zc.optional(),error:R({code:P().int(),message:M(),data:I().optional()})}).strict(),nl=B([Qc,$c,el,tl]),rl=B([el,tl]),il=q.strict(),al=Jc.extend({requestId:Zc.optional(),reason:M().optional()}),ol=Yc.extend({method:U(`notifications/cancelled`),params:al}),sl=R({src:M(),mimeType:M().optional(),sizes:L(M()).optional(),theme:H([`light`,`dark`]).optional()}),cl=R({icons:L(sl).optional()}),ll=R({name:M(),title:M().optional()}),ul=ll.extend({...ll.shape,...cl.shape,version:M(),websiteUrl:M().optional(),description:M().optional()}),dl=mc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,zs(R({form:zs(R({applyDefaults:F().optional()}),G).optional(),url:G.optional()}),G.optional())),fl=z({list:G.optional(),cancel:G.optional(),requests:z({sampling:z({createMessage:G.optional()}).optional(),elicitation:z({create:G.optional()}).optional()}).optional()}),pl=z({list:G.optional(),cancel:G.optional(),requests:z({tools:z({call:G.optional()}).optional()}).optional()}),ml=R({experimental:V(M(),G).optional(),sampling:R({context:G.optional(),tools:G.optional()}).optional(),elicitation:dl.optional(),roots:R({listChanged:F().optional()}).optional(),tasks:fl.optional(),extensions:V(M(),G).optional()}),hl=Kc.extend({protocolVersion:M(),capabilities:ml,clientInfo:ul}),gl=K.extend({method:U(`initialize`),params:hl}),_l=R({experimental:V(M(),G).optional(),logging:G.optional(),completions:G.optional(),prompts:R({listChanged:F().optional()}).optional(),resources:R({subscribe:F().optional(),listChanged:F().optional()}).optional(),tools:R({listChanged:F().optional()}).optional(),tasks:pl.optional(),extensions:V(M(),G).optional()}),vl=q.extend({protocolVersion:M(),capabilities:_l,serverInfo:ul,instructions:M().optional()}),yl=Yc.extend({method:U(`notifications/initialized`),params:Jc.optional()}),bl=K.extend({method:U(`server/discover`),params:Kc.optional()}),xl=q.extend({supportedVersions:L(M()),capabilities:_l,instructions:M().optional()}),Sl=K.extend({method:U(`ping`),params:Kc.optional()}),Cl=R({progress:P(),total:W(P()),message:W(M())}),wl=R({...Jc.shape,...Cl.shape,progressToken:Vc}),Tl=Yc.extend({method:U(`notifications/progress`),params:wl}),El=Kc.extend({cursor:Hc.optional()}),Dl=K.extend({params:El.optional()}),Ol=q.extend({nextCursor:Hc.optional()}),kl=R({uri:M(),mimeType:W(M()),_meta:V(M(),I()).optional()}),Al=kl.extend({text:M()}),jl=M().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),Ml=kl.extend({blob:jl}),Nl=H([`user`,`assistant`]),Pl=R({audience:L(Nl).optional(),priority:P().min(0).max(1).optional(),lastModified:_c({offset:!0}).optional()}),Fl=R({...ll.shape,...cl.shape,uri:M(),description:W(M()),mimeType:W(M()),size:W(P()),annotations:Pl.optional(),_meta:W(z({}))}),Il=R({...ll.shape,...cl.shape,uriTemplate:M(),description:W(M()),mimeType:W(M()),annotations:Pl.optional(),_meta:W(z({}))}),Ll=Dl.extend({method:U(`resources/list`)}),Rl=Ol.extend({resources:L(Fl)}),zl=Dl.extend({method:U(`resources/templates/list`)}),Bl=Ol.extend({resourceTemplates:L(Il)}),Vl=Kc.extend({uri:M()}),Hl=Vl,Ul=K.extend({method:U(`resources/read`),params:Hl}),Wl=q.extend({contents:L(B([Al,Ml]))}),Gl=Yc.extend({method:U(`notifications/resources/list_changed`),params:Jc.optional()}),Kl=Vl,ql=K.extend({method:U(`resources/subscribe`),params:Kl}),Jl=Vl,Yl=K.extend({method:U(`resources/unsubscribe`),params:Jl}),Xl=R({toolsListChanged:F().optional(),promptsListChanged:F().optional(),resourcesListChanged:F().optional(),resourceSubscriptions:L(M()).optional()}),Zl=Kc.extend({notifications:Xl}),Ql=K.extend({method:U(`subscriptions/listen`),params:Zl}),$l=Jc.extend({notifications:Xl}),eu=Yc.extend({method:U(`notifications/subscriptions/acknowledged`),params:$l}),tu=Xc.extend({[Oc]:Zc}),nu=q.extend({_meta:tu}),ru=Jc.extend({uri:M()}),iu=Yc.extend({method:U(`notifications/resources/updated`),params:ru}),au=R({name:M(),description:W(M()),required:W(F())}),ou=R({...ll.shape,...cl.shape,description:W(M()),arguments:W(L(au)),_meta:W(z({}))}),su=Dl.extend({method:U(`prompts/list`)}),cu=Ol.extend({prompts:L(ou)}),lu=Kc.extend({name:M(),arguments:V(M(),M()).optional()}),uu=K.extend({method:U(`prompts/get`),params:lu}),du=R({type:U(`text`),text:M(),annotations:Pl.optional(),_meta:V(M(),I()).optional()}),fu=R({type:U(`image`),data:jl,mimeType:M(),annotations:Pl.optional(),_meta:V(M(),I()).optional()}),pu=R({type:U(`audio`),data:jl,mimeType:M(),annotations:Pl.optional(),_meta:V(M(),I()).optional()}),mu=R({type:U(`tool_use`),name:M(),id:M(),input:V(M(),I()),_meta:V(M(),I()).optional()}),hu=R({type:U(`resource`),resource:B([Al,Ml]),annotations:Pl.optional(),_meta:V(M(),I()).optional()}),gu=Fl.extend({type:U(`resource_link`)}),_u=B([du,fu,pu,gu,hu]),vu=R({role:Nl,content:_u}),yu=q.extend({description:M().optional(),messages:L(vu)}),bu=Yc.extend({method:U(`notifications/prompts/list_changed`),params:Jc.optional()}),xu=R({title:M().optional(),readOnlyHint:F().optional(),destructiveHint:F().optional(),idempotentHint:F().optional(),openWorldHint:F().optional()}),Su=R({taskSupport:H([`required`,`optional`,`forbidden`]).optional()}),Cu=R({...ll.shape,...cl.shape,description:M().optional(),inputSchema:R({type:U(`object`),properties:V(M(),zc).optional(),required:L(M()).optional()}).catchall(I()),outputSchema:z({$schema:M().optional()}).optional(),annotations:xu.optional(),execution:Su.optional(),_meta:V(M(),I()).optional()}),wu=Dl.extend({method:U(`tools/list`)}),Tu=Ol.extend({tools:L(Cu)}),Eu=q.extend({content:L(_u).default([]),structuredContent:I().optional(),isError:F().optional()}),Du=Eu.or(q.extend({toolResult:I()})),Ou=qc.extend({name:M(),arguments:V(M(),I()).optional()}),ku=K.extend({method:U(`tools/call`),params:Ou}),Au=Yc.extend({method:U(`notifications/tools/list_changed`),params:Jc.optional()}),ju=R({autoRefresh:F().default(!0),debounceMs:P().int().nonnegative().default(300)}),Mu=H([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),Nu=Kc.extend({level:Mu}),Pu=K.extend({method:U(`logging/setLevel`),params:Nu}),Fu=Jc.extend({level:Mu,logger:M().optional(),data:I()}),Iu=Yc.extend({method:U(`notifications/message`),params:Fu}),Lu=R({name:M().optional()}),Ru=R({hints:L(Lu).optional(),costPriority:P().min(0).max(1).optional(),speedPriority:P().min(0).max(1).optional(),intelligencePriority:P().min(0).max(1).optional()}),zu=R({mode:H([`auto`,`required`,`none`]).optional()}),Bu=R({type:U(`tool_result`),toolUseId:M().describe(`The unique identifier for the corresponding tool call.`),content:L(_u),structuredContent:I().optional(),isError:F().optional(),_meta:V(M(),I()).optional()}),Vu=Ls(`type`,[du,fu,pu]),Hu=Ls(`type`,[du,fu,pu,mu,Bu]),Uu=R({role:Nl,content:B([Hu,L(Hu)]),_meta:V(M(),I()).optional()}),Wu=qc.extend({messages:L(Uu),modelPreferences:Ru.optional(),systemPrompt:M().optional(),includeContext:H([`none`,`thisServer`,`allServers`]).optional(),temperature:P().optional(),maxTokens:P().int(),stopSequences:L(M()).optional(),metadata:G.optional(),tools:L(Cu).optional(),toolChoice:zu.optional()}),Gu=K.extend({method:U(`sampling/createMessage`),params:Wu}),Ku=q.extend({model:M(),stopReason:W(H([`endTurn`,`stopSequence`,`maxTokens`]).or(M())),role:Nl,content:Vu}),qu=q.extend({model:M(),stopReason:W(H([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(M())),role:Nl,content:B([Hu,L(Hu)])}),Ju=R({type:U(`boolean`),title:M().optional(),description:M().optional(),default:F().optional()}),Yu=R({type:U(`string`),title:M().optional(),description:M().optional(),minLength:P().optional(),maxLength:P().optional(),format:H([`email`,`uri`,`date`,`date-time`]).optional(),default:M().optional()}),Xu=R({type:H([`number`,`integer`]),title:M().optional(),description:M().optional(),minimum:P().optional(),maximum:P().optional(),default:P().optional()}),Zu=R({type:U(`string`),title:M().optional(),description:M().optional(),enum:L(M()),default:M().optional()}),Qu=R({type:U(`string`),title:M().optional(),description:M().optional(),oneOf:L(R({const:M(),title:M()})),default:M().optional()}),$u=R({type:U(`string`),title:M().optional(),description:M().optional(),enum:L(M()),enumNames:L(M()).optional(),default:M().optional()}),ed=B([Zu,Qu]),td=R({type:U(`array`),title:M().optional(),description:M().optional(),minItems:P().optional(),maxItems:P().optional(),items:R({type:U(`string`),enum:L(M())}),default:L(M()).optional()}),nd=R({type:U(`array`),title:M().optional(),description:M().optional(),minItems:P().optional(),maxItems:P().optional(),items:R({anyOf:L(R({const:M(),title:M()}))}),default:L(M()).optional()}),rd=B([td,nd]),id=B([$u,ed,rd]),ad=B([id,Ju,Yu,Xu]),od=qc.extend({mode:U(`form`).optional(),message:M(),requestedSchema:R({type:U(`object`),properties:V(M(),ad),required:L(M()).optional()}).catchall(I())}),sd=qc.extend({mode:U(`url`),message:M(),elicitationId:M(),url:M().url()}),cd=B([od,sd]),ld=K.extend({method:U(`elicitation/create`),params:cd}),ud=Jc.extend({elicitationId:M()}),dd=Yc.extend({method:U(`notifications/elicitation/complete`),params:ud}),fd=q.extend({action:H([`accept`,`decline`,`cancel`]),content:mc(e=>e===null?void 0:e,V(M(),B([M(),P(),F(),L(M())])).optional())}),pd=R({type:U(`ref/resource`),uri:M()}),md=R({type:U(`ref/prompt`),name:M()}),hd=Kc.extend({ref:B([md,pd]),argument:R({name:M(),value:M()}),context:R({arguments:V(M(),M()).optional()}).optional()}),gd=K.extend({method:U(`completion/complete`),params:hd}),_d=q.extend({completion:z({values:L(M()).max(100),total:W(P().int()),hasMore:W(F())})}),vd=R({uri:M().startsWith(`file://`),name:M().optional(),_meta:V(M(),I()).optional()}),yd=K.extend({method:U(`roots/list`),params:Kc.optional()}),bd=q.extend({roots:L(vd)}),xd=Yc.extend({method:U(`notifications/roots/list_changed`),params:Jc.optional()}),Sd=z({ttl:P().optional(),pollInterval:P().optional()}),Cd=H([`working`,`input_required`,`completed`,`failed`,`cancelled`]),wd=R({taskId:M(),status:Cd,ttl:B([P(),Ds()]),createdAt:M(),lastUpdatedAt:M(),pollInterval:W(P()),statusMessage:W(M())}),Td=q.extend({task:wd}),Ed=Jc.merge(wd),Dd=Yc.extend({method:U(`notifications/tasks/status`),params:Ed}),Od=K.extend({method:U(`tasks/get`),params:Kc.extend({taskId:M()})}),kd=q.merge(wd),Ad=K.extend({method:U(`tasks/result`),params:Kc.extend({taskId:M()})}),jd=q.loose(),Md=Dl.extend({method:U(`tasks/list`)}),Nd=Ol.extend({tasks:L(wd)}),Pd=K.extend({method:U(`tasks/cancel`),params:Kc.extend({taskId:M()})}),Fd=q.merge(wd),Id=B([Sl,gl,bl,gd,Pu,uu,su,Ll,zl,Ul,ql,Yl,Ql,ku,wu]),Ld=B([ol,Tl,yl,xd]),Rd=B([il,Ku,qu,fd,bd]),zd=B([Sl,Gu,ld,yd]),Bd=B([ol,Tl,Iu,iu,Gl,Au,bu,eu,dd]),Vd=B([il,vl,xl,_d,yu,cu,Rl,Bl,Wl,Eu,Tu,nu]),Hd=os().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:hc.custom,message:`URL must be parseable`,fatal:!0}),We}).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`}),Ud=z({resource:M().url(),authorization_servers:L(Hd).optional(),jwks_uri:M().url().optional(),scopes_supported:L(M()).optional(),bearer_methods_supported:L(M()).optional(),resource_signing_alg_values_supported:L(M()).optional(),resource_name:M().optional(),resource_documentation:M().optional(),resource_policy_uri:M().url().optional(),resource_tos_uri:M().url().optional(),tls_client_certificate_bound_access_tokens:F().optional(),authorization_details_types_supported:L(M()).optional(),dpop_signing_alg_values_supported:L(M()).optional(),dpop_bound_access_tokens_required:F().optional()}),Wd=z({issuer:M(),authorization_endpoint:Hd,token_endpoint:Hd,registration_endpoint:Hd.optional(),scopes_supported:L(M()).optional(),response_types_supported:L(M()),response_modes_supported:L(M()).optional(),grant_types_supported:L(M()).optional(),token_endpoint_auth_methods_supported:L(M()).optional(),token_endpoint_auth_signing_alg_values_supported:L(M()).optional(),service_documentation:Hd.optional(),revocation_endpoint:Hd.optional(),revocation_endpoint_auth_methods_supported:L(M()).optional(),revocation_endpoint_auth_signing_alg_values_supported:L(M()).optional(),introspection_endpoint:M().optional(),introspection_endpoint_auth_methods_supported:L(M()).optional(),introspection_endpoint_auth_signing_alg_values_supported:L(M()).optional(),code_challenge_methods_supported:L(M()).optional(),client_id_metadata_document_supported:F().optional(),authorization_response_iss_parameter_supported:F().optional().catch(void 0)}),Gd=z({issuer:M(),authorization_endpoint:Hd,token_endpoint:Hd,userinfo_endpoint:Hd.optional(),jwks_uri:Hd,registration_endpoint:Hd.optional(),scopes_supported:L(M()).optional(),response_types_supported:L(M()),response_modes_supported:L(M()).optional(),grant_types_supported:L(M()).optional(),acr_values_supported:L(M()).optional(),subject_types_supported:L(M()),id_token_signing_alg_values_supported:L(M()),id_token_encryption_alg_values_supported:L(M()).optional(),id_token_encryption_enc_values_supported:L(M()).optional(),userinfo_signing_alg_values_supported:L(M()).optional(),userinfo_encryption_alg_values_supported:L(M()).optional(),userinfo_encryption_enc_values_supported:L(M()).optional(),request_object_signing_alg_values_supported:L(M()).optional(),request_object_encryption_alg_values_supported:L(M()).optional(),request_object_encryption_enc_values_supported:L(M()).optional(),token_endpoint_auth_methods_supported:L(M()).optional(),token_endpoint_auth_signing_alg_values_supported:L(M()).optional(),display_values_supported:L(M()).optional(),claim_types_supported:L(M()).optional(),claims_supported:L(M()).optional(),service_documentation:M().optional(),claims_locales_supported:L(M()).optional(),ui_locales_supported:L(M()).optional(),claims_parameter_supported:F().optional(),request_parameter_supported:F().optional(),request_uri_parameter_supported:F().optional(),require_request_uri_registration:F().optional(),op_policy_uri:Hd.optional(),op_tos_uri:Hd.optional(),client_id_metadata_document_supported:F().optional(),authorization_response_iss_parameter_supported:F().optional().catch(void 0)}),Kd=R({...Gd.shape,...Wd.pick({code_challenge_methods_supported:!0}).shape}),qd=R({access_token:M(),id_token:M().optional(),token_type:M(),expires_in:yc().optional(),scope:M().optional(),refresh_token:M().optional()}).strip(),Jd=R({issued_token_type:U(`urn:ietf:params:oauth:token-type:id-jag`),access_token:M(),token_type:M().optional(),expires_in:P().optional(),scope:M().optional()}).strip(),Yd=R({error:M(),error_description:M().optional(),error_uri:M().optional()}),Xd=Hd.optional().or(U(``).transform(()=>void 0)),Zd=R({redirect_uris:L(Hd),token_endpoint_auth_method:M().optional(),grant_types:L(M()).optional(),response_types:L(M()).optional(),application_type:M().optional(),client_name:M().optional(),client_uri:Hd.optional(),logo_uri:Xd,scope:M().optional(),contacts:L(M()).optional(),tos_uri:Xd,policy_uri:M().optional(),jwks_uri:Hd.optional(),jwks:ks().optional(),software_id:M().optional(),software_version:M().optional(),software_statement:M().optional()}).strip(),Qd=R({client_id:M(),client_secret:M().optional(),client_id_issued_at:P().optional(),client_secret_expires_at:P().optional()}).strip(),$d=Zd.merge(Qd),ef=R({error:M(),error_description:M().optional()}).strip(),tf=R({token:M(),token_type_hint:M().optional()}).strip(),nf=Symbol.for(`mcp.sdk.errorBrands`);function rf(e,t){let n=new Set,r=t;for(;typeof r==`function`;){let e=r.mcpBrand;Object.prototype.hasOwnProperty.call(r,`mcpBrand`)&&typeof e==`string`&&n.add(e),r=Object.getPrototypeOf(r)}n.size!==0&&Object.defineProperty(e,nf,{value:n,enumerable:!1,configurable:!0})}function af(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,nf)){let n=t[nf];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}let of=function(e){return e.InvalidRequest=`invalid_request`,e.InvalidClient=`invalid_client`,e.InvalidGrant=`invalid_grant`,e.UnauthorizedClient=`unauthorized_client`,e.UnsupportedGrantType=`unsupported_grant_type`,e.InvalidScope=`invalid_scope`,e.AccessDenied=`access_denied`,e.ServerError=`server_error`,e.TemporarilyUnavailable=`temporarily_unavailable`,e.UnsupportedResponseType=`unsupported_response_type`,e.UnsupportedTokenType=`unsupported_token_type`,e.InvalidToken=`invalid_token`,e.MethodNotAllowed=`method_not_allowed`,e.TooManyRequests=`too_many_requests`,e.InvalidClientMetadata=`invalid_client_metadata`,e.InvalidRedirectUri=`invalid_redirect_uri`,e.InsufficientScope=`insufficient_scope`,e.InvalidTarget=`invalid_target`,e}({});var sf=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return af(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return af(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,rf(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}};let J=function(e){return e.NotConnected=`NOT_CONNECTED`,e.AlreadyConnected=`ALREADY_CONNECTED`,e.NotInitialized=`NOT_INITIALIZED`,e.CapabilityNotSupported=`CAPABILITY_NOT_SUPPORTED`,e.RequestTimeout=`REQUEST_TIMEOUT`,e.ConnectionClosed=`CONNECTION_CLOSED`,e.SendFailed=`SEND_FAILED`,e.InvalidResult=`INVALID_RESULT`,e.UnsupportedResultType=`UNSUPPORTED_RESULT_TYPE`,e.InputRequiredRoundsExceeded=`INPUT_REQUIRED_ROUNDS_EXCEEDED`,e.ListPaginationExceeded=`LIST_PAGINATION_EXCEEDED`,e.MethodNotSupportedByProtocolVersion=`METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION`,e.EraNegotiationFailed=`ERA_NEGOTIATION_FAILED`,e.ClientHttpNotImplemented=`CLIENT_HTTP_NOT_IMPLEMENTED`,e.ClientHttpAuthentication=`CLIENT_HTTP_AUTHENTICATION`,e.ClientHttpForbidden=`CLIENT_HTTP_FORBIDDEN`,e.ClientHttpUnexpectedContent=`CLIENT_HTTP_UNEXPECTED_CONTENT`,e.ClientHttpFailedToOpenStream=`CLIENT_HTTP_FAILED_TO_OPEN_STREAM`,e.ClientHttpFailedToTerminateSession=`CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION`,e}({});var Y=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkError`})}static[Symbol.hasInstance](e){return af(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return af(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`SdkError`,rf(this,new.target)}},cf=class extends Y{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n){super(e,t,n),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}};function lf(e){let t=typeof e==`string`?new URL(e):new URL(e.href);return t.hash=``,t}function uf({requestedResource:e,configuredResource:t}){let n=typeof e==`string`?new URL(e):new URL(e.href),r=typeof t==`string`?new URL(t):new URL(t.href);if(n.origin!==r.origin||n.pathname.length<r.pathname.length)return!1;let i=n.pathname.endsWith(`/`)?n.pathname:n.pathname+`/`,a=r.pathname.endsWith(`/`)?r.pathname:r.pathname+`/`;return i.startsWith(a)}const df={};function ff(e){return Object.hasOwn(df,e)?df[e]:void 0}function pf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function mf(e,t,n){return e===`elicitation`&&t===`form`&&n.form===void 0&&n.url===void 0}function hf(e){switch(e.method){case`elicitation/create`:return e.params?.mode===`url`?{elicitation:{url:{}}}:{elicitation:{form:{}}};case`sampling/createMessage`:{let t=e.params;return t!==void 0&&(t.tools!==void 0||t.toolChoice!==void 0)?{sampling:{tools:{}}}:{sampling:{}}}case`roots/list`:return{roots:{}};default:return}}function gf(e,t){let n={};for(let[r,i]of Object.entries(e)){if(i===void 0)continue;let e=t===void 0?void 0:t[r];if(e===void 0){n[r]=i;continue}if(pf(i)&&pf(e)){let t={};for(let[n,a]of Object.entries(i))a!==void 0&&e[n]===void 0&&!mf(r,n,e)&&(t[n]=a);Object.keys(t).length>0&&(n[r]=t)}}return Object.keys(n).length>0?n:void 0}const _f=`2026-07-28`,vf=[_f];function yf(e){return e>=_f}function bf(e){return e.filter(e=>!yf(e))}function xf(e){return e.filter(e=>yf(e))}function Sf(e){let t=e.structuredContent;return t===void 0||typeof t==`object`&&t&&!Array.isArray(t)||(e.content?.some(e=>e.type===`text`)??!1)?e:{...e,content:[...e.content??[],{type:`text`,text:JSON.stringify(t)}]}}const Cf=[`task`,`inputRequests`,`requestState`];function wf(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||Cf.some(t=>t in e)?e:{...e,content:[]}}function Tf(){let e=uc(()=>B([M(),P(),F(),Ds(),V(M(),e),L(e)])),t=V(M(),e),n=B([M(),P().int()]),r=M(),i=R({ttl:P().optional()}),a=R({taskId:M()}),o=z({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=R({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=R({method:M(),params:s.loose().optional()}),u=R({_meta:o.optional()}),d=R({method:M(),params:u.loose().optional()}),f=z({_meta:o.optional()}),p=B([M(),P().int()]),m=f.strict(),h=u.extend({requestId:p.optional(),reason:M().optional()}),g=d.extend({method:U(`notifications/cancelled`),params:h}),_=R({src:M(),mimeType:M().optional(),sizes:L(M()).optional(),theme:H([`light`,`dark`]).optional()}),v=R({icons:L(_).optional()}),y=R({name:M(),title:M().optional()}),b=y.extend({...y.shape,...v.shape,version:M(),websiteUrl:M().optional(),description:M().optional()}),x=mc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,zs(R({form:zs(R({applyDefaults:F().optional()}),t).optional(),url:t.optional()}),t.optional())),ee=z({list:t.optional(),cancel:t.optional(),requests:z({sampling:z({createMessage:t.optional()}).optional(),elicitation:z({create:t.optional()}).optional()}).optional()}),te=z({list:t.optional(),cancel:t.optional(),requests:z({tools:z({call:t.optional()}).optional()}).optional()}),ne=R({experimental:V(M(),t).optional(),sampling:R({context:t.optional(),tools:t.optional()}).optional(),elicitation:x.optional(),roots:R({listChanged:F().optional()}).optional(),tasks:ee.optional(),extensions:V(M(),t).optional()}),S=s.extend({protocolVersion:M(),capabilities:ne,clientInfo:b}),C=l.extend({method:U(`initialize`),params:S}),re=R({experimental:V(M(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:R({listChanged:F().optional()}).optional(),resources:R({subscribe:F().optional(),listChanged:F().optional()}).optional(),tools:R({listChanged:F().optional()}).optional(),tasks:te.optional(),extensions:V(M(),t).optional()}),ie=f.extend({protocolVersion:M(),capabilities:re,serverInfo:b,instructions:M().optional()}),ae=d.extend({method:U(`notifications/initialized`),params:u.optional()}),oe=l.extend({method:U(`ping`),params:s.optional()}),se=R({progress:P(),total:W(P()),message:W(M())}),ce=R({...u.shape,...se.shape,progressToken:n}),le=d.extend({method:U(`notifications/progress`),params:ce}),ue=s.extend({cursor:r.optional()}),de=l.extend({params:ue.optional()}),w=f.extend({nextCursor:r.optional()}),T=R({uri:M(),mimeType:W(M()),_meta:V(M(),I()).optional()}),fe=T.extend({text:M()}),pe=M().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),me=T.extend({blob:pe}),he=H([`user`,`assistant`]),ge=R({audience:L(he).optional(),priority:P().min(0).max(1).optional(),lastModified:_c({offset:!0}).optional()}),_e=R({...y.shape,...v.shape,uri:M(),description:W(M()),mimeType:W(M()),size:W(P()),annotations:ge.optional(),_meta:W(z({}))}),ve=R({...y.shape,...v.shape,uriTemplate:M(),description:W(M()),mimeType:W(M()),annotations:ge.optional(),_meta:W(z({}))}),ye=de.extend({method:U(`resources/list`)}),be=w.extend({resources:L(_e)}),xe=de.extend({method:U(`resources/templates/list`)}),Se=w.extend({resourceTemplates:L(ve)}),Ce=s.extend({uri:M()}),we=Ce,Te=l.extend({method:U(`resources/read`),params:we}),Ee=f.extend({contents:L(B([fe,me]))}),De=d.extend({method:U(`notifications/resources/list_changed`),params:u.optional()}),Oe=Ce,ke=l.extend({method:U(`resources/subscribe`),params:Oe}),Ae=Ce,je=l.extend({method:U(`resources/unsubscribe`),params:Ae}),Me=u.extend({uri:M()}),Ne=d.extend({method:U(`notifications/resources/updated`),params:Me}),Pe=R({name:M(),description:W(M()),required:W(F())}),Fe=R({...y.shape,...v.shape,description:W(M()),arguments:W(L(Pe)),_meta:W(z({}))}),Ie=de.extend({method:U(`prompts/list`)}),Le=w.extend({prompts:L(Fe)}),Re=s.extend({name:M(),arguments:V(M(),M()).optional()}),ze=l.extend({method:U(`prompts/get`),params:Re}),Be=R({type:U(`text`),text:M(),annotations:ge.optional(),_meta:V(M(),I()).optional()}),E=R({type:U(`image`),data:pe,mimeType:M(),annotations:ge.optional(),_meta:V(M(),I()).optional()}),Ve=R({type:U(`audio`),data:pe,mimeType:M(),annotations:ge.optional(),_meta:V(M(),I()).optional()}),He=R({type:U(`tool_use`),name:M(),id:M(),input:V(M(),I()),_meta:V(M(),I()).optional()}),Ue=R({type:U(`resource`),resource:B([fe,me]),annotations:ge.optional(),_meta:V(M(),I()).optional()}),We=_e.extend({type:U(`resource_link`)}),Ge=B([Be,E,Ve,We,Ue]),Ke=R({role:he,content:Ge}),qe=f.extend({description:M().optional(),messages:L(Ke)}),D=d.extend({method:U(`notifications/prompts/list_changed`),params:u.optional()}),Je=R({title:M().optional(),readOnlyHint:F().optional(),destructiveHint:F().optional(),idempotentHint:F().optional(),openWorldHint:F().optional()}),Ye=R({taskSupport:H([`required`,`optional`,`forbidden`]).optional()}),Xe=R({...y.shape,...v.shape,description:M().optional(),inputSchema:R({type:U(`object`),properties:V(M(),e).optional(),required:L(M()).optional()}).catchall(I()),outputSchema:R({type:U(`object`),properties:V(M(),e).optional(),required:L(M()).optional()}).catchall(I()).optional(),annotations:Je.optional(),execution:Ye.optional(),_meta:V(M(),I()).optional()}),Ze=de.extend({method:U(`tools/list`)}),Qe=w.extend({tools:L(Xe)}),$e=f.extend({content:L(Ge),structuredContent:V(M(),I()).optional(),isError:F().optional()}),et=c.extend({name:M(),arguments:V(M(),I()).optional()}),tt=l.extend({method:U(`tools/call`),params:et}),nt=d.extend({method:U(`notifications/tools/list_changed`),params:u.optional()}),rt=H([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),it=s.extend({level:rt}),at=l.extend({method:U(`logging/setLevel`),params:it}),ot=u.extend({level:rt,logger:M().optional(),data:I()}),st=d.extend({method:U(`notifications/message`),params:ot}),ct=R({name:M().optional()}),lt=R({hints:L(ct).optional(),costPriority:P().min(0).max(1).optional(),speedPriority:P().min(0).max(1).optional(),intelligencePriority:P().min(0).max(1).optional()}),ut=R({mode:H([`auto`,`required`,`none`]).optional()}),dt=R({type:U(`tool_result`),toolUseId:M().describe(`The unique identifier for the corresponding tool call.`),content:L(Ge),structuredContent:R({}).loose().optional(),isError:F().optional(),_meta:V(M(),I()).optional()}),ft=Ls(`type`,[Be,E,Ve]),pt=Ls(`type`,[Be,E,Ve,He,dt]),mt=R({role:he,content:B([pt,L(pt)]),_meta:V(M(),I()).optional()}),ht=c.extend({messages:L(mt),modelPreferences:lt.optional(),systemPrompt:M().optional(),includeContext:H([`none`,`thisServer`,`allServers`]).optional(),temperature:P().optional(),maxTokens:P().int(),stopSequences:L(M()).optional(),metadata:t.optional(),tools:L(Xe).optional(),toolChoice:ut.optional()}),gt=l.extend({method:U(`sampling/createMessage`),params:ht}),_t=f.extend({model:M(),stopReason:W(H([`endTurn`,`stopSequence`,`maxTokens`]).or(M())),role:he,content:ft}),vt=f.extend({model:M(),stopReason:W(H([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(M())),role:he,content:B([pt,L(pt)])}),yt=R({type:U(`boolean`),title:M().optional(),description:M().optional(),default:F().optional()}),bt=R({type:U(`string`),title:M().optional(),description:M().optional(),minLength:P().optional(),maxLength:P().optional(),format:H([`email`,`uri`,`date`,`date-time`]).optional(),default:M().optional()}),xt=R({type:H([`number`,`integer`]),title:M().optional(),description:M().optional(),minimum:P().optional(),maximum:P().optional(),default:P().optional()}),St=R({type:U(`string`),title:M().optional(),description:M().optional(),enum:L(M()),default:M().optional()}),Ct=R({type:U(`string`),title:M().optional(),description:M().optional(),oneOf:L(R({const:M(),title:M()})),default:M().optional()}),wt=R({type:U(`string`),title:M().optional(),description:M().optional(),enum:L(M()),enumNames:L(M()).optional(),default:M().optional()}),Tt=B([St,Ct]),Et=R({type:U(`array`),title:M().optional(),description:M().optional(),minItems:P().optional(),maxItems:P().optional(),items:R({type:U(`string`),enum:L(M())}),default:L(M()).optional()}),Dt=R({type:U(`array`),title:M().optional(),description:M().optional(),minItems:P().optional(),maxItems:P().optional(),items:R({anyOf:L(R({const:M(),title:M()}))}),default:L(M()).optional()}),Ot=B([Et,Dt]),kt=B([wt,Tt,Ot]),At=B([kt,yt,bt,xt]),jt=c.extend({mode:U(`form`).optional(),message:M(),requestedSchema:R({type:U(`object`),properties:V(M(),At),required:L(M()).optional()}).catchall(I())}),Mt=c.extend({mode:U(`url`),message:M(),elicitationId:M(),url:M().url()}),Nt=B([jt,Mt]),Pt=l.extend({method:U(`elicitation/create`),params:Nt}),Ft=u.extend({elicitationId:M()}),It=d.extend({method:U(`notifications/elicitation/complete`),params:Ft}),Lt=f.extend({action:H([`accept`,`decline`,`cancel`]),content:mc(e=>e===null?void 0:e,V(M(),B([M(),P(),F(),L(M())])).optional())}),Rt=R({type:U(`ref/resource`),uri:M()}),zt=R({type:U(`ref/prompt`),name:M()}),Bt=s.extend({ref:B([zt,Rt]),argument:R({name:M(),value:M()}),context:R({arguments:V(M(),M()).optional()}).optional()}),Vt=l.extend({method:U(`completion/complete`),params:Bt}),Ht=f.extend({completion:z({values:L(M()).max(100),total:W(P().int()),hasMore:W(F())})}),Ut=R({uri:M().startsWith(`file://`),name:M().optional(),_meta:V(M(),I()).optional()}),Wt=l.extend({method:U(`roots/list`),params:s.optional()}),Gt=f.extend({roots:L(Ut)}),Kt=d.extend({method:U(`notifications/roots/list_changed`),params:u.optional()}),qt=z({ttl:P().optional(),pollInterval:P().optional()}),Jt=H([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Yt=R({taskId:M(),status:Jt,ttl:B([P(),Ds()]),createdAt:M(),lastUpdatedAt:M(),pollInterval:W(P()),statusMessage:W(M())}),Xt=f.extend({task:Yt}),Zt=u.merge(Yt),Qt=d.extend({method:U(`notifications/tasks/status`),params:Zt}),$t=l.extend({method:U(`tasks/get`),params:s.extend({taskId:M()})}),en=f.merge(Yt),tn=l.extend({method:U(`tasks/result`),params:s.extend({taskId:M()})}),nn=f.loose(),rn=de.extend({method:U(`tasks/list`)}),an=w.extend({tasks:L(Yt)}),on=l.extend({method:U(`tasks/cancel`),params:s.extend({taskId:M()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,TaskMetadataSchema:i,RelatedTaskMetadataSchema:a,RequestMetaSchema:o,BaseRequestParamsSchema:s,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:u,NotificationSchema:d,ResultSchema:f,RequestIdSchema:p,EmptyResultSchema:m,CancelledNotificationParamsSchema:h,CancelledNotificationSchema:g,IconSchema:_,IconsSchema:v,BaseMetadataSchema:y,ImplementationSchema:b,ClientTasksCapabilitySchema:ee,ServerTasksCapabilitySchema:te,ClientCapabilitiesSchema:ne,InitializeRequestParamsSchema:S,InitializeRequestSchema:C,ServerCapabilitiesSchema:re,InitializeResultSchema:ie,InitializedNotificationSchema:ae,PingRequestSchema:oe,ProgressSchema:se,ProgressNotificationParamsSchema:ce,ProgressNotificationSchema:le,PaginatedRequestParamsSchema:ue,PaginatedRequestSchema:de,PaginatedResultSchema:w,ResourceContentsSchema:T,TextResourceContentsSchema:fe,BlobResourceContentsSchema:me,RoleSchema:he,AnnotationsSchema:ge,ResourceSchema:_e,ResourceTemplateSchema:ve,ListResourcesRequestSchema:ye,ListResourcesResultSchema:be,ListResourceTemplatesRequestSchema:xe,ListResourceTemplatesResultSchema:Se,ResourceRequestParamsSchema:Ce,ReadResourceRequestParamsSchema:we,ReadResourceRequestSchema:Te,ReadResourceResultSchema:Ee,ResourceListChangedNotificationSchema:De,SubscribeRequestParamsSchema:Oe,SubscribeRequestSchema:ke,UnsubscribeRequestParamsSchema:Ae,UnsubscribeRequestSchema:je,ResourceUpdatedNotificationParamsSchema:Me,ResourceUpdatedNotificationSchema:Ne,PromptArgumentSchema:Pe,PromptSchema:Fe,ListPromptsRequestSchema:Ie,ListPromptsResultSchema:Le,GetPromptRequestParamsSchema:Re,GetPromptRequestSchema:ze,TextContentSchema:Be,ImageContentSchema:E,AudioContentSchema:Ve,ToolUseContentSchema:He,EmbeddedResourceSchema:Ue,ResourceLinkSchema:We,ContentBlockSchema:Ge,PromptMessageSchema:Ke,GetPromptResultSchema:qe,PromptListChangedNotificationSchema:D,ToolAnnotationsSchema:Je,ToolExecutionSchema:Ye,ToolSchema:Xe,ListToolsRequestSchema:Ze,ListToolsResultSchema:Qe,CallToolResultSchema:$e,CallToolRequestParamsSchema:et,CallToolRequestSchema:tt,ToolListChangedNotificationSchema:nt,LoggingLevelSchema:rt,SetLevelRequestParamsSchema:it,SetLevelRequestSchema:at,LoggingMessageNotificationParamsSchema:ot,LoggingMessageNotificationSchema:st,ModelHintSchema:ct,ModelPreferencesSchema:lt,ToolChoiceSchema:ut,ToolResultContentSchema:dt,SamplingContentSchema:ft,SamplingMessageContentBlockSchema:pt,SamplingMessageSchema:mt,CreateMessageRequestParamsSchema:ht,CreateMessageRequestSchema:gt,CreateMessageResultSchema:_t,CreateMessageResultWithToolsSchema:vt,BooleanSchemaSchema:yt,StringSchemaSchema:bt,NumberSchemaSchema:xt,UntitledSingleSelectEnumSchemaSchema:St,TitledSingleSelectEnumSchemaSchema:Ct,LegacyTitledEnumSchemaSchema:wt,SingleSelectEnumSchemaSchema:Tt,UntitledMultiSelectEnumSchemaSchema:Et,TitledMultiSelectEnumSchemaSchema:Dt,MultiSelectEnumSchemaSchema:Ot,EnumSchemaSchema:kt,PrimitiveSchemaDefinitionSchema:At,ElicitRequestFormParamsSchema:jt,ElicitRequestURLParamsSchema:Mt,ElicitRequestParamsSchema:Nt,ElicitRequestSchema:Pt,ElicitationCompleteNotificationParamsSchema:Ft,ElicitationCompleteNotificationSchema:It,ElicitResultSchema:Lt,ResourceTemplateReferenceSchema:Rt,PromptReferenceSchema:zt,CompleteRequestParamsSchema:Bt,CompleteRequestSchema:Vt,CompleteResultSchema:Ht,RootSchema:Ut,ListRootsRequestSchema:Wt,ListRootsResultSchema:Gt,RootsListChangedNotificationSchema:Kt,TaskCreationParamsSchema:qt,TaskStatusSchema:Jt,TaskSchema:Yt,CreateTaskResultSchema:Xt,TaskStatusNotificationParamsSchema:Zt,TaskStatusNotificationSchema:Qt,GetTaskRequestSchema:$t,GetTaskResultSchema:en,GetTaskPayloadRequestSchema:tn,GetTaskPayloadResultSchema:nn,ListTasksRequestSchema:rn,ListTasksResultSchema:an,CancelTaskRequestSchema:on,CancelTaskResultSchema:f.merge(Yt),ClientRequestSchema:B([oe,C,Vt,at,ze,Ie,ye,xe,Te,ke,je,tt,Ze,$t,tn,rn,on]),ClientNotificationSchema:B([g,le,ae,Kt,Qt]),ClientResultSchema:B([m,_t,vt,Lt,Gt,en,an,Xt]),ServerRequestSchema:B([oe,gt,Pt,Wt,$t,tn,rn,on]),ServerNotificationSchema:B([g,le,st,Ne,De,nt,D,Qt,It]),ServerResultSchema:B([m,ie,Ht,qe,Le,be,Se,Ee,$e,Qe,en,an,Xt]),CallToolResultWireSchema:I().superRefine((e,t)=>{if(typeof e==`object`&&e&&!Array.isArray(e)&&e.content===void 0){for(let n of Cf)if(n in e){t.addIssue({code:`custom`,message:`content is required when the body carries '${n}' — another result family cannot default into an empty tools/call success`});return}}}).transform(wf).pipe($e)}}let Ef;function Df(){return Ef??=Tf()}function Of(e){return e.type!==`object`}const kf=new Set([`const`,`enum`,`default`,`examples`]),Af=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function jf(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function Mf(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(jf(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=m(e.$schema)&&e.$recursiveAnchor!==!0,r=(e,t)=>{if(Array.isArray(e))return e.map(e=>r(e,!1));if(typeof e!=`object`||!e||!t&&jf(e.$id))return e;let i={},a=!1;for(let[o,s]of Object.entries(e))t?i[o]=r(s,!1):(o===`$ref`||o===`$dynamicRef`)&&typeof s==`string`?i[o]=s===`#`?`#/properties/result`:s.startsWith(`#/`)?`#/properties/result${s.slice(1)}`:s:o===`$recursiveRef`&&s===`#`&&n?a=!0:i[o]=kf.has(o)?s:Af.has(o)?r(s,!0):r(s,!1);return a&&(`$ref`in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:`#/properties/result`}]:i.$ref=`#/properties/result`),i};return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:r(e,!1)},required:[`result`]}}const Nf={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Pf={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},Ff={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null};let If;function Lf(){if(If)return If;let e=Df();return If={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},If}function Rf(){Lf()}function zf(e){return Object.prototype.hasOwnProperty.call(Nf,e)}function Bf(e){return Object.prototype.hasOwnProperty.call(Pf,e)}function Vf(e){return Object.prototype.hasOwnProperty.call(Ff,e)}function Hf(e){return Vf(e)?Lf().resultSchemas[e]:void 0}function Uf(e){return zf(e)?Lf().requestSchemas[e]:void 0}function Wf(e){return Bf(e)?Lf().notificationSchemas[e]:void 0}Object.keys(Nf),Object.keys(Pf);function Gf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Kf(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}const qf={ok:!1,reason:`not-in-era`};function Jf(e){return Gf(e)&&Gf(e.outputSchema)&&Of(e.outputSchema)}function Yf(e){return e}const Xf={era:`2025-11-25`,hasRequestMethod:zf,hasNotificationMethod:Bf,validateRequest:(e,t)=>Kf(Uf(e),t),validateResult:(e,t)=>Kf(Hf(e),t),validateNotification:(e,t)=>Kf(Wf(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>qf,validateInputResponse:()=>qf,samplingResultVariant:((e,t)=>{let n=Df();return Kf(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=Sf(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&Of(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(Gf(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:Yf(e)}}return{kind:`complete`,result:Yf(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>Jf(e))?t:{...t,tools:n.map(e=>Jf(e)?{...e,outputSchema:Mf(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function Zf(){let e=uc(()=>B([M(),P(),F(),Ds(),V(M(),e),L(e)])),t=V(M(),e),n=B([M(),P().int()]),r=M(),i=B([M(),P().int()]),a=H([`user`,`assistant`]),o=H([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=M().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=R({ttl:P().optional()}),l=R({taskId:M()}),u=z({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),d=R({_meta:u.optional()}),f=d.extend({task:c.optional()}),p=R({_meta:u.optional()}),m=R({method:M(),params:p.loose().optional()}),h=R({src:M(),mimeType:M().optional(),sizes:L(M()).optional(),theme:H([`light`,`dark`]).optional()}),g=R({icons:L(h).optional()}),_=R({name:M(),title:M().optional()}),v=_.extend({..._.shape,...g.shape,version:M(),websiteUrl:M().optional(),description:M().optional()}),y=mc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,zs(R({form:zs(R({applyDefaults:F().optional()}),t).optional(),url:t.optional()}),t.optional())),b=z({list:t.optional(),cancel:t.optional(),requests:z({sampling:z({createMessage:t.optional()}).optional(),elicitation:z({create:t.optional()}).optional()}).optional()}),x=z({list:t.optional(),cancel:t.optional(),requests:z({tools:z({call:t.optional()}).optional()}).optional()}),ee=R({experimental:V(M(),t).optional(),sampling:R({context:t.optional(),tools:t.optional()}).optional(),elicitation:y.optional(),roots:R({listChanged:F().optional()}).optional(),tasks:b.optional(),extensions:V(M(),t).optional()}),te=R({experimental:V(M(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:R({listChanged:F().optional()}).optional(),resources:R({subscribe:F().optional(),listChanged:F().optional()}).optional(),tools:R({listChanged:F().optional()}).optional(),tasks:x.optional(),extensions:V(M(),t).optional()}),ne=R({progress:P(),total:W(P()),message:W(M())}),S=R({...p.shape,...ne.shape,progressToken:n}),C=m.extend({method:U(`notifications/progress`),params:S}),re=p.extend({level:o,logger:M().optional(),data:I()}),ie=m.extend({method:U(`notifications/message`),params:re}),ae=R({uri:M(),mimeType:W(M()),_meta:V(M(),I()).optional()}),oe=ae.extend({text:M()}),se=ae.extend({blob:s}),ce=R({audience:L(a).optional(),priority:P().min(0).max(1).optional(),lastModified:_c({offset:!0}).optional()}),le=R({..._.shape,...g.shape,uri:M(),description:W(M()),mimeType:W(M()),size:W(P()),annotations:ce.optional(),_meta:W(z({}))}),ue=R({..._.shape,...g.shape,uriTemplate:M(),description:W(M()),mimeType:W(M()),annotations:ce.optional(),_meta:W(z({}))}),de=m.extend({method:U(`notifications/resources/list_changed`),params:p.optional()}),w=p.extend({uri:M()}),T=m.extend({method:U(`notifications/resources/updated`),params:w}),fe=R({name:M(),description:W(M()),required:W(F())}),pe=R({..._.shape,...g.shape,description:W(M()),arguments:W(L(fe)),_meta:W(z({}))}),me=m.extend({method:U(`notifications/prompts/list_changed`),params:p.optional()}),he=R({type:U(`text`),text:M(),annotations:ce.optional(),_meta:V(M(),I()).optional()}),ge=R({type:U(`image`),data:s,mimeType:M(),annotations:ce.optional(),_meta:V(M(),I()).optional()}),_e=R({type:U(`audio`),data:s,mimeType:M(),annotations:ce.optional(),_meta:V(M(),I()).optional()}),ve=R({type:U(`tool_use`),name:M(),id:M(),input:V(M(),I()),_meta:V(M(),I()).optional()}),ye=R({type:U(`resource`),resource:B([oe,se]),annotations:ce.optional(),_meta:V(M(),I()).optional()}),be=le.extend({type:U(`resource_link`)}),xe=B([he,ge,_e,be,ye]),Se=R({role:a,content:xe}),Ce=R({title:M().optional(),readOnlyHint:F().optional(),destructiveHint:F().optional(),idempotentHint:F().optional(),openWorldHint:F().optional()}),we=m.extend({method:U(`notifications/tools/list_changed`),params:p.optional()}),Te=R({name:M().optional()}),Ee=R({hints:L(Te).optional(),costPriority:P().min(0).max(1).optional(),speedPriority:P().min(0).max(1).optional(),intelligencePriority:P().min(0).max(1).optional()}),De=R({mode:H([`auto`,`required`,`none`]).optional()}),Oe=R({type:U(`boolean`),title:M().optional(),description:M().optional(),default:F().optional()}),ke=R({type:U(`string`),title:M().optional(),description:M().optional(),minLength:P().optional(),maxLength:P().optional(),format:H([`email`,`uri`,`date`,`date-time`]).optional(),default:M().optional()}),Ae=R({type:H([`number`,`integer`]),title:M().optional(),description:M().optional(),minimum:P().optional(),maximum:P().optional(),default:P().optional()}),je=R({type:U(`string`),title:M().optional(),description:M().optional(),enum:L(M()),default:M().optional()}),Me=R({type:U(`string`),title:M().optional(),description:M().optional(),oneOf:L(R({const:M(),title:M()})),default:M().optional()}),Ne=R({type:U(`string`),title:M().optional(),description:M().optional(),enum:L(M()),enumNames:L(M()).optional(),default:M().optional()}),Pe=B([je,Me]),Fe=R({type:U(`array`),title:M().optional(),description:M().optional(),minItems:P().optional(),maxItems:P().optional(),items:R({type:U(`string`),enum:L(M())}),default:L(M()).optional()}),Ie=R({type:U(`array`),title:M().optional(),description:M().optional(),minItems:P().optional(),maxItems:P().optional(),items:R({anyOf:L(R({const:M(),title:M()}))}),default:L(M()).optional()}),Le=B([Fe,Ie]),Re=B([Ne,Pe,Le]),ze=B([Re,Oe,ke,Ae]),Be=f.extend({mode:U(`form`).optional(),message:M(),requestedSchema:R({type:U(`object`),properties:V(M(),ze),required:L(M()).optional()}).catchall(I())}),E=R({type:U(`ref/resource`),uri:M()}),Ve=R({type:U(`ref/prompt`),name:M()}),He=R({uri:M().startsWith(`file://`),name:M().optional(),_meta:V(M(),I()).optional()}),Ue=ee.shape,We=R({experimental:Ue.experimental,sampling:Ue.sampling,elicitation:Ue.elicitation,roots:Ue.roots,extensions:Ue.extensions}),Ge=te.shape,Ke=R({experimental:Ge.experimental,logging:Ge.logging,completions:Ge.completions,prompts:Ge.prompts,resources:Ge.resources,tools:Ge.tools,extensions:Ge.extensions}),qe=z({progressToken:n.optional(),[wc]:M(),[Tc]:v.optional(),[Dc]:We,[kc]:o.optional()}),D=R({..._.shape,...g.shape,description:M().optional(),inputSchema:z({$schema:M().optional(),type:U(`object`)}),outputSchema:z({$schema:M().optional()}).optional(),annotations:Ce.optional(),_meta:V(M(),I()).optional()}),Je=R({type:U(`tool_result`),toolUseId:M(),content:L(xe),structuredContent:I().optional(),isError:F().optional(),_meta:V(M(),I()).optional()}),Ye=B([he,ge,_e,ve,Je]),Xe=R({role:a,content:B([Ye,L(Ye)]),_meta:V(M(),I()).optional()}),Ze=M(),Qe=z({[Ec]:v.optional().catch(void 0)}),$e=Qe.optional();function et(e){return z({_meta:$e,resultType:Ze.default(`complete`),...e})}let tt=et({}),nt=et({nextCursor:r.optional()}),rt=et({content:L(xe),structuredContent:I().optional(),isError:F().optional()}),it=et({ttlMs:P().int().min(0),cacheScope:H([`public`,`private`]),tools:L(D),nextCursor:r.optional()}),at=et({ttlMs:P().int().min(0),cacheScope:H([`public`,`private`]),prompts:L(pe),nextCursor:r.optional()}),ot=et({description:M().optional(),messages:L(Se)}),st=et({ttlMs:P().int().min(0),cacheScope:H([`public`,`private`]),resources:L(le),nextCursor:r.optional()}),ct=et({ttlMs:P().int().min(0),cacheScope:H([`public`,`private`]),resourceTemplates:L(ue),nextCursor:r.optional()}),lt=et({ttlMs:P().int().min(0),cacheScope:H([`public`,`private`]),contents:L(B([oe,se]))}),ut=et({completion:R({values:L(M()).max(100),total:P().int().optional(),hasMore:F().optional()}).loose()}),dt=et({ttlMs:P().int().min(0),cacheScope:H([`public`,`private`])}),ft=et({ttlMs:P().int().min(0).catch(0),cacheScope:H([`public`,`private`]).catch(`private`),supportedVersions:L(M()),capabilities:Ke,instructions:M().optional()}),pt=R({messages:L(Xe),modelPreferences:Ee.optional(),systemPrompt:M().optional(),includeContext:H([`none`,`thisServer`,`allServers`]).optional(),temperature:P().optional(),maxTokens:P().int(),stopSequences:L(M()).optional(),metadata:t.optional(),tools:L(D).optional(),toolChoice:De.optional()}),mt=R({method:U(`sampling/createMessage`),params:pt}),ht=R({method:U(`roots/list`),params:R({_meta:V(M(),I()).optional()}).optional()}),gt=R({...Xe.shape,model:M(),stopReason:M().optional()}),_t=R({roots:L(He)}),vt=R({action:H([`accept`,`decline`,`cancel`]),content:V(M(),B([M(),P(),F(),L(M())])).optional()}),yt=R({mode:U(`url`),message:M(),url:M().url()}),bt=B([Be,yt]),xt=R({method:U(`elicitation/create`),params:bt}),St=B([mt,ht,xt]),Ct=B([gt,_t,vt]),wt=V(M(),St),Tt=V(M(),Ct),Et=et({inputRequests:wt.optional(),requestState:M().optional()}),Dt={inputResponses:Tt.optional(),requestState:M().optional()},Ot=R({_meta:qe,...Dt}),kt=z({progressToken:n.optional()});function At(e,t){return R({method:U(e),params:R({_meta:qe,...t})})}function jt(e,t){return R({method:U(e),params:R({_meta:kt.optional(),...t}).optional()})}let Mt={name:M(),arguments:V(M(),I()).optional(),...Dt},Nt={cursor:r.optional()},Pt=At(`tools/call`,Mt),Ft=At(`tools/list`,Nt),It=At(`prompts/list`,Nt),Lt=At(`prompts/get`,{name:M(),arguments:V(M(),M()).optional(),...Dt}),Rt=At(`resources/list`,Nt),zt=At(`resources/templates/list`,Nt),Bt=At(`resources/read`,{uri:M(),...Dt}),Vt={ref:B([Ve,E]),argument:R({name:M(),value:M()}),context:R({arguments:V(M(),M()).optional()}).optional()},Ht=At(`completion/complete`,Vt),Ut=At(`server/discover`,{}),Wt=R({toolsListChanged:F().optional(),promptsListChanged:F().optional(),resourcesListChanged:F().optional(),resourceSubscriptions:L(M()).optional()}),Gt={notifications:Wt},Kt=At(`subscriptions/listen`,Gt),qt=Qe.extend({"io.modelcontextprotocol/subscriptionId":i}),Jt=z({_meta:qt,resultType:Ze.default(`complete`)}),Yt={"tools/call":jt(`tools/call`,Mt),"tools/list":jt(`tools/list`,Nt),"prompts/get":jt(`prompts/get`,{name:M(),arguments:V(M(),M()).optional()}),"prompts/list":jt(`prompts/list`,Nt),"resources/list":jt(`resources/list`,Nt),"resources/templates/list":jt(`resources/templates/list`,Nt),"resources/read":jt(`resources/read`,{uri:M()}),"completion/complete":jt(`completion/complete`,Vt),"server/discover":jt(`server/discover`,{}),"subscriptions/listen":jt(`subscriptions/listen`,Gt)};function Xt(e){return z({_meta:$e,...e})}let Zt={"tools/call":Xt({content:L(xe),structuredContent:I().optional(),isError:F().optional()}),"tools/list":Xt({ttlMs:P().int().min(0),cacheScope:H([`public`,`private`]),tools:L(D),nextCursor:r.optional()}),"prompts/get":Xt({description:M().optional(),messages:L(Se)}),"prompts/list":Xt({ttlMs:P().int().min(0),cacheScope:H([`public`,`private`]),prompts:L(pe),nextCursor:r.optional()}),"resources/list":Xt({ttlMs:P().int().min(0),cacheScope:H([`public`,`private`]),resources:L(le),nextCursor:r.optional()}),"resources/templates/list":Xt({ttlMs:P().int().min(0),cacheScope:H([`public`,`private`]),resourceTemplates:L(ue),nextCursor:r.optional()}),"resources/read":Xt({ttlMs:P().int().min(0),cacheScope:H([`public`,`private`]),contents:L(B([oe,se]))}),"completion/complete":Xt({completion:R({values:L(M()).max(100),total:P().int().optional(),hasMore:F().optional()}).loose()}),"server/discover":Xt({ttlMs:P().int().min(0).catch(0),cacheScope:H([`public`,`private`]).catch(`private`),supportedVersions:L(M()),capabilities:Ke,instructions:M().optional()}),"subscriptions/listen":Xt({})},Qt=z({"io.modelcontextprotocol/subscriptionId":i.optional()}),$t=R({method:U(`notifications/subscriptions/acknowledged`),params:R({_meta:Qt.optional(),notifications:Wt})}),en=R({_meta:Qt.optional(),requestId:i,reason:M().optional()}),tn=R({method:U(`notifications/cancelled`),params:en}),nn={"notifications/cancelled":tn,"notifications/progress":C,"notifications/message":ie,"notifications/resources/updated":T,"notifications/resources/list_changed":de,"notifications/tools/list_changed":we,"notifications/prompts/list_changed":me,"notifications/subscriptions/acknowledged":$t},rn=e=>R({jsonrpc:U(`2.0`),id:B([M(),P().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,RequestIdSchema:i,RoleSchema:a,LoggingLevelSchema:o,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:p,NotificationSchema:m,IconSchema:h,IconsSchema:g,BaseMetadataSchema:_,ImplementationSchema:v,ClientTasksCapabilitySchema:b,ServerTasksCapabilitySchema:x,ClientCapabilitiesSchema:ee,ServerCapabilitiesSchema:te,ProgressSchema:ne,ProgressNotificationParamsSchema:S,ProgressNotificationSchema:C,LoggingMessageNotificationParamsSchema:re,LoggingMessageNotificationSchema:ie,ResourceContentsSchema:ae,TextResourceContentsSchema:oe,BlobResourceContentsSchema:se,AnnotationsSchema:ce,ResourceSchema:le,ResourceTemplateSchema:ue,ResourceListChangedNotificationSchema:de,ResourceUpdatedNotificationParamsSchema:w,ResourceUpdatedNotificationSchema:T,PromptArgumentSchema:fe,PromptSchema:pe,PromptListChangedNotificationSchema:me,TextContentSchema:he,ImageContentSchema:ge,AudioContentSchema:_e,ToolUseContentSchema:ve,EmbeddedResourceSchema:ye,ResourceLinkSchema:be,ContentBlockSchema:xe,PromptMessageSchema:Se,ToolAnnotationsSchema:Ce,ToolListChangedNotificationSchema:we,ModelHintSchema:Te,ModelPreferencesSchema:Ee,ToolChoiceSchema:De,BooleanSchemaSchema:Oe,StringSchemaSchema:ke,NumberSchemaSchema:Ae,UntitledSingleSelectEnumSchemaSchema:je,TitledSingleSelectEnumSchemaSchema:Me,LegacyTitledEnumSchemaSchema:Ne,SingleSelectEnumSchemaSchema:Pe,UntitledMultiSelectEnumSchemaSchema:Fe,TitledMultiSelectEnumSchemaSchema:Ie,MultiSelectEnumSchemaSchema:Le,EnumSchemaSchema:Re,PrimitiveSchemaDefinitionSchema:ze,ElicitRequestFormParamsSchema:Be,ResourceTemplateReferenceSchema:E,PromptReferenceSchema:Ve,RootSchema:He,ClientCapabilities2026Schema:We,ServerCapabilities2026Schema:Ke,RequestMetaEnvelopeSchema:qe,ToolSchema:D,ToolResultContentSchema:Je,SamplingMessageContentBlockSchema:Ye,SamplingMessageSchema:Xe,ResultTypeSchema:Ze,ResultMetaSchema:Qe,ResultSchema:tt,PaginatedResultSchema:nt,CallToolResultSchema:rt,ListToolsResultSchema:it,ListPromptsResultSchema:at,GetPromptResultSchema:ot,ListResourcesResultSchema:st,ListResourceTemplatesResultSchema:ct,ReadResourceResultSchema:lt,CompleteResultSchema:ut,CacheableResultSchema:dt,DiscoverResultSchema:ft,CreateMessageRequestParamsSchema:pt,CreateMessageRequestSchema:mt,ListRootsRequestSchema:ht,CreateMessageResultSchema:gt,ListRootsResultSchema:_t,ElicitResultSchema:vt,ElicitRequestURLParamsSchema:yt,ElicitRequestParamsSchema:bt,ElicitRequestSchema:xt,InputRequestSchema:St,InputResponseSchema:Ct,InputRequestsSchema:wt,InputResponsesSchema:Tt,InputRequiredResultSchema:Et,InputResponseRequestParamsSchema:Ot,CallToolRequestSchema:Pt,ListToolsRequestSchema:Ft,ListPromptsRequestSchema:It,GetPromptRequestSchema:Lt,ListResourcesRequestSchema:Rt,ListResourceTemplatesRequestSchema:zt,ReadResourceRequestSchema:Bt,CompleteRequestSchema:Ht,DiscoverRequestSchema:Ut,SubscriptionFilterSchema:Wt,SubscriptionsListenRequestSchema:Kt,SubscriptionsListenResultMetaSchema:qt,SubscriptionsListenResultSchema:Jt,dispatchRequestSchemas:Yt,dispatchResultSchemas:Zt,NotificationMetaSchema:Qt,SubscriptionsAcknowledgedNotificationSchema:$t,CancelledNotificationParamsSchema:en,CancelledNotificationSchema:tn,notificationSchemas2026:nn,JSONRPCResultResponseSchema:rn(tt),CallToolResultResponseSchema:rn(B([rt,Et])),ListToolsResultResponseSchema:rn(it),ListPromptsResultResponseSchema:rn(at),GetPromptResultResponseSchema:rn(B([ot,Et])),ListResourcesResultResponseSchema:rn(st),ListResourceTemplatesResultResponseSchema:rn(ct),ReadResourceResultResponseSchema:rn(B([lt,Et])),CompleteResultResponseSchema:rn(ut),DiscoverResultResponseSchema:rn(ft)}}let Qf;function $f(){return Qf??=Zf()}const ep=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function tp(e){return ep.includes(e)}const np=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function rp(e,t){if(t===void 0)return e;let n=e[np];if(n===void 0)return{...e,[np]:t};let r={},i=n.ttlMs??t.ttlMs;i!==void 0&&(r.ttlMs=i);let a=n.cacheScope??t.cacheScope;return a!==void 0&&(r.cacheScope=a),{...e,[np]:r}}function ip(e){return e[np]}function ap(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function op(e){return e===`public`||e===`private`}function sp(e,t){if(e.ttlMs!==void 0&&!ap(e.ttlMs))throw RangeError(`Invalid cache hint for ${t}: ttlMs must be a non-negative safe integer (got ${String(e.ttlMs)})`);if(e.cacheScope!==void 0&&!op(e.cacheScope))throw RangeError(`Invalid cache hint for ${t}: cacheScope must be 'public' or 'private' (got ${String(e.cacheScope)})`)}let X=function(e){return 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.ResourceNotFound=-32002]=`ResourceNotFound`,e[e.MissingRequiredClientCapability=-32021]=`MissingRequiredClientCapability`,e[e.UnsupportedProtocolVersion=-32022]=`UnsupportedProtocolVersion`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`,e}({});var Z=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ProtocolError`})}static[Symbol.hasInstance](e){return af(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return af(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,rf(this,new.target)}static fromError(t,n,r){if(t===X.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new lp(e.elicitations,n)}if(t===X.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new up({supported:e.supported,requested:e.requested},n)}if(t===X.InvalidParams||t===X.ResourceNotFound){let e=r;if(typeof e?.uri==`string`&&(t===X.ResourceNotFound||Object.keys(e).length===1))return new cp(e.uri,n)}if(t===X.MissingRequiredClientCapability&&r){let e=r;if(e.requiredCapabilities!==null&&typeof e.requiredCapabilities==`object`&&!Array.isArray(e.requiredCapabilities))return new dp({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},cp=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ResourceNotFoundError`})}constructor(e,t=`Resource not found: ${e}`){super(X.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},lp=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UrlElicitationRequiredError`})}constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(X.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},up=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnsupportedProtocolVersionError`})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(X.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},dp=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.MissingRequiredClientCapabilityError`})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(`, `)}`){super(X.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}};const fp=[`tools/call`,`prompts/get`,`resources/read`];function pp(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||fp.includes(e))return t;throw new Z(X.InternalError,`Handler for ${e} returned resultType '${String(n)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function mp(e,t){let n=ip(t);if(t.resultType!==`complete`||!tp(e))return n===void 0?t:yp(t);let r=t,i=ap(r.ttlMs)?r.ttlMs:_p(n),a=op(r.cacheScope)?r.cacheScope:vp(n),o={...r,ttlMs:i,cacheScope:a};return delete o[np],o}function hp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function gp(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[Ec]:t}}:!hp(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[Ec]:t}}}function _p(e){return e!==void 0&&ap(e.ttlMs)?e.ttlMs:0}function vp(e){return e!==void 0&&op(e.cacheScope)?e.cacheScope:`private`}function yp(e){let t={...e};return delete t[np],t}const bp=[`elicitation/create`,`sampling/createMessage`,`roots/list`];let xp;function Sp(){if(xp)return xp;let e=$f();return xp={request:{"elicitation/create":R({method:U(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":R({method:U(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":R({method:U(`roots/list`),params:z({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},xp}function Cp(){Sp()}function wp(e){return bp.includes(e)}function Tp(e){return wp(e)?Sp().request[e]:void 0}function Ep(e){return wp(e)?Sp().response[e]:void 0}const Dp={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},Op={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function kp(e){return Object.prototype.hasOwnProperty.call(Dp,e)}function Ap(e){return Object.prototype.hasOwnProperty.call(Op,e)}function jp(e){return Object.prototype.hasOwnProperty.call(Dp,e)}function Mp(e){return kp(e)?$f().dispatchRequestSchemas[e]:void 0}function Np(e){return jp(e)?$f().dispatchResultSchemas[e]:void 0}function Pp(e){return Ap(e)?$f().notificationSchemas2026[e]:void 0}Object.keys(Dp),Object.keys(Op);function Fp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ip(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}const Lp={ok:!1,reason:`not-in-era`},Rp=[wc,Dc];function zp(e,t){let n=t,r=!1,i=()=>(r||=(n={...n},!0),n),a=t.tools;e===`tools/list`&&Array.isArray(a)&&a.some(e=>Fp(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!Fp(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(Fp(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}const Bp={era:`2026-07-28`,hasRequestMethod:kp,hasNotificationMethod:Ap,hasInputRequestMethod:e=>Tp(e)!==void 0,validateRequest:(e,t)=>Ip(Mp(e),t),validateResult:(e,t)=>Ip(Np(e),t),validateNotification:(e,t)=>Ip(Pp(e),t),validateInputRequest:(e,t)=>Ip(Tp(e),t),validateInputResponse:(e,t)=>Ip(Ep(e),t),samplingResultVariant:()=>Lp,outboundEnvelope(e){return{[wc]:e.protocolVersion,[Tc]:e.clientInfo,[Dc]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of Rp)n in e||t.push({key:n,problem:`missing`});let n=$f().RequestMetaEnvelopeSchema.safeParse(e);if(!n.success)for(let e of n.error.issues){let n=e.path.map(String),r=n.length>0?n.join(`.`):`_meta`;n.length===1&&t.some(e=>e.key===r&&e.problem===`missing`)||t.push({key:r,problem:e.message})}return t},projectCallToolResult:e=>Sf(e),inputRequestSchema:Tp,decodeResult(e,t){if(!Fp(t))return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let n=t.resultType;if(n===void 0)return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:`missing-resultType`})};if(typeof n!=`string`)return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:n})};if(n===`input_required`){let n=t.inputRequests,r=Fp(n)?n:{},i=t.requestState;return Object.keys(r).length===0&&typeof i!=`string`?{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:`input-required-missing-both`})}:{kind:`input_required`,inputRequests:r,...typeof i==`string`&&{requestState:i}}}if(n!==`complete`)return{kind:`invalid`,error:new Y(J.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=Hp(),i=Object.hasOwn(r,e)?r[e]:void 0;if(i!==void 0){let n=i.safeParse(t);if(!n.success)return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: ${n.error}`,{method:e})}}let a={...t};return delete a.resultType,{kind:`complete`,result:a}},encodeResult(e,t,n){return gp(mp(e,pp(e,zp(e,t))),n)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return`Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)`;let t=$f().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join(`; `)}`}};let Vp;function Hp(){if(Vp)return Vp;let e=$f();return Vp={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},Vp}function Up(){Hp()}const Wp=`2026-07-28`;function Gp(e){return e!==void 0&&yf(e)?Bp:Xf}function Kp(e){return e.revision===void 0?e.era===`modern`?Bp.era:Xf.era:Gp(e.revision).era}function qp(e){return Yp.some(t=>t.hasRequestMethod(e))}function Jp(e){return Yp.some(t=>t.hasNotificationMethod(e))}const Yp=[Xf,Bp];function Xp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Zp(e){if(!Xp(e))return;let t=e._meta;return Xp(t)?t:void 0}function Qp(e){let t=Zp(e);return t!==void 0&&`io.modelcontextprotocol/protocolVersion`in t}function $p(e){let t=Zp(e)?.[wc];return typeof t==`string`?t:void 0}function em(e){return Gp(Wp).validateEnvelopeMeta(e)}var tm=s({AnnotationsSchema:()=>Pl,AudioContentSchema:()=>pu,BaseMetadataSchema:()=>ll,BaseRequestParamsSchema:()=>Kc,BlobResourceContentsSchema:()=>Ml,BooleanSchemaSchema:()=>Ju,CallToolRequestParamsSchema:()=>Ou,CallToolRequestSchema:()=>ku,CallToolResultSchema:()=>Eu,CancelTaskRequestSchema:()=>Pd,CancelTaskResultSchema:()=>Fd,CancelledNotificationParamsSchema:()=>al,CancelledNotificationSchema:()=>ol,ClientCapabilitiesSchema:()=>ml,ClientNotificationSchema:()=>Ld,ClientRequestSchema:()=>Id,ClientResultSchema:()=>Rd,ClientTasksCapabilitySchema:()=>fl,CompatibilityCallToolResultSchema:()=>Du,CompleteRequestParamsSchema:()=>hd,CompleteRequestSchema:()=>gd,CompleteResultSchema:()=>_d,ContentBlockSchema:()=>_u,CreateMessageRequestParamsSchema:()=>Wu,CreateMessageRequestSchema:()=>Gu,CreateMessageResultSchema:()=>Ku,CreateMessageResultWithToolsSchema:()=>qu,CreateTaskResultSchema:()=>Td,CursorSchema:()=>Hc,DiscoverRequestSchema:()=>bl,DiscoverResultSchema:()=>xl,ElicitRequestFormParamsSchema:()=>od,ElicitRequestParamsSchema:()=>cd,ElicitRequestSchema:()=>ld,ElicitRequestURLParamsSchema:()=>sd,ElicitResultSchema:()=>fd,ElicitationCompleteNotificationParamsSchema:()=>ud,ElicitationCompleteNotificationSchema:()=>dd,EmbeddedResourceSchema:()=>hu,EmptyResultSchema:()=>il,EnumSchemaSchema:()=>id,GetPromptRequestParamsSchema:()=>lu,GetPromptRequestSchema:()=>uu,GetPromptResultSchema:()=>yu,GetTaskPayloadRequestSchema:()=>Ad,GetTaskPayloadResultSchema:()=>jd,GetTaskRequestSchema:()=>Od,GetTaskResultSchema:()=>kd,IconSchema:()=>sl,IconsSchema:()=>cl,ImageContentSchema:()=>fu,ImplementationSchema:()=>ul,InitializeRequestParamsSchema:()=>hl,InitializeRequestSchema:()=>gl,InitializeResultSchema:()=>vl,InitializedNotificationSchema:()=>yl,JSONArraySchema:()=>Bc,JSONObjectSchema:()=>G,JSONRPCErrorResponseSchema:()=>tl,JSONRPCMessageSchema:()=>nl,JSONRPCNotificationSchema:()=>$c,JSONRPCRequestSchema:()=>Qc,JSONRPCResponseSchema:()=>rl,JSONRPCResultResponseSchema:()=>el,JSONValueSchema:()=>zc,LegacyTitledEnumSchemaSchema:()=>$u,ListChangedOptionsBaseSchema:()=>ju,ListPromptsRequestSchema:()=>su,ListPromptsResultSchema:()=>cu,ListResourceTemplatesRequestSchema:()=>zl,ListResourceTemplatesResultSchema:()=>Bl,ListResourcesRequestSchema:()=>Ll,ListResourcesResultSchema:()=>Rl,ListRootsRequestSchema:()=>yd,ListRootsResultSchema:()=>bd,ListTasksRequestSchema:()=>Md,ListTasksResultSchema:()=>Nd,ListToolsRequestSchema:()=>wu,ListToolsResultSchema:()=>Tu,LoggingLevelSchema:()=>Mu,LoggingMessageNotificationParamsSchema:()=>Fu,LoggingMessageNotificationSchema:()=>Iu,ModelHintSchema:()=>Lu,ModelPreferencesSchema:()=>Ru,MultiSelectEnumSchemaSchema:()=>rd,NotificationSchema:()=>Yc,NotificationsParamsSchema:()=>Jc,NumberSchemaSchema:()=>Xu,PaginatedRequestParamsSchema:()=>El,PaginatedRequestSchema:()=>Dl,PaginatedResultSchema:()=>Ol,PingRequestSchema:()=>Sl,PrimitiveSchemaDefinitionSchema:()=>ad,ProgressNotificationParamsSchema:()=>wl,ProgressNotificationSchema:()=>Tl,ProgressSchema:()=>Cl,ProgressTokenSchema:()=>Vc,PromptArgumentSchema:()=>au,PromptListChangedNotificationSchema:()=>bu,PromptMessageSchema:()=>vu,PromptReferenceSchema:()=>md,PromptSchema:()=>ou,ReadResourceRequestParamsSchema:()=>Hl,ReadResourceRequestSchema:()=>Ul,ReadResourceResultSchema:()=>Wl,RelatedTaskMetadataSchema:()=>Wc,RequestIdSchema:()=>Zc,RequestMetaSchema:()=>Gc,RequestSchema:()=>K,ResourceContentsSchema:()=>kl,ResourceLinkSchema:()=>gu,ResourceListChangedNotificationSchema:()=>Gl,ResourceRequestParamsSchema:()=>Vl,ResourceSchema:()=>Fl,ResourceTemplateReferenceSchema:()=>pd,ResourceTemplateSchema:()=>Il,ResourceUpdatedNotificationParamsSchema:()=>ru,ResourceUpdatedNotificationSchema:()=>iu,ResultMetaObjectSchema:()=>Xc,ResultSchema:()=>q,RoleSchema:()=>Nl,RootSchema:()=>vd,RootsListChangedNotificationSchema:()=>xd,SamplingContentSchema:()=>Vu,SamplingMessageContentBlockSchema:()=>Hu,SamplingMessageSchema:()=>Uu,ServerCapabilitiesSchema:()=>_l,ServerNotificationSchema:()=>Bd,ServerRequestSchema:()=>zd,ServerResultSchema:()=>Vd,ServerTasksCapabilitySchema:()=>pl,SetLevelRequestParamsSchema:()=>Nu,SetLevelRequestSchema:()=>Pu,SingleSelectEnumSchemaSchema:()=>ed,StringSchemaSchema:()=>Yu,SubscribeRequestParamsSchema:()=>Kl,SubscribeRequestSchema:()=>ql,SubscriptionFilterSchema:()=>Xl,SubscriptionsAcknowledgedNotificationParamsSchema:()=>$l,SubscriptionsAcknowledgedNotificationSchema:()=>eu,SubscriptionsListenRequestParamsSchema:()=>Zl,SubscriptionsListenRequestSchema:()=>Ql,SubscriptionsListenResultMetaSchema:()=>tu,SubscriptionsListenResultSchema:()=>nu,TaskAugmentedRequestParamsSchema:()=>qc,TaskCreationParamsSchema:()=>Sd,TaskMetadataSchema:()=>Uc,TaskSchema:()=>wd,TaskStatusNotificationParamsSchema:()=>Ed,TaskStatusNotificationSchema:()=>Dd,TaskStatusSchema:()=>Cd,TextContentSchema:()=>du,TextResourceContentsSchema:()=>Al,TitledMultiSelectEnumSchemaSchema:()=>nd,TitledSingleSelectEnumSchemaSchema:()=>Qu,ToolAnnotationsSchema:()=>xu,ToolChoiceSchema:()=>zu,ToolExecutionSchema:()=>Su,ToolListChangedNotificationSchema:()=>Au,ToolResultContentSchema:()=>Bu,ToolSchema:()=>Cu,ToolUseContentSchema:()=>mu,UnsubscribeRequestParamsSchema:()=>Jl,UnsubscribeRequestSchema:()=>Yl,UntitledMultiSelectEnumSchemaSchema:()=>td,UntitledSingleSelectEnumSchemaSchema:()=>Zu});function nm(e){return nl.parse(e)}const rm=e=>Qc.safeParse(e).success,im=e=>$c.safeParse(e).success,am=e=>el.safeParse(e).success,om=e=>tl.safeParse(e).success,sm=e=>rl.safeParse(e).success,cm=e=>typeof e!=`object`||!e||e.content===void 0?!1:Eu.safeParse(e).success,lm=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&e.resultType===`input_required`,um=e=>qc.safeParse(e).success,dm=e=>gl.safeParse(e).success,fm=e=>yl.safeParse(e).success;function pm(e){if(e.params.ref.type!==`ref/prompt`)throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function mm(e){if(e.params.ref.type!==`ref/resource`)throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}const hm=`x-mcp-header`,gm=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,_m=new Set([`string`,`integer`,`boolean`,`number`]);function vm(e){let t=[],n=new Map,r=(e,i,a)=>{if(typeof e!=`object`||!e)return;let o=e;if(hm in o){if(!a||i.length===0)return`${xm(i)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let e=o[hm];if(typeof e!=`string`||e.length===0)return`${xm(i)}: x-mcp-header MUST be a non-empty string`;if(!gm.test(e))return`${xm(i)}: x-mcp-header '${e}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let r=typeof o.type==`string`?o.type:void 0;if(r===void 0||!_m.has(r))return`${xm(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${r??`<none>`}`;let s=e.toLowerCase(),c=n.get(s);if(c!==void 0)return`x-mcp-header '${e}' is not case-insensitively unique (also declared as '${c}')`;n.set(s,e),t.push({path:i,headerName:e,type:r})}let s=o.properties;if(typeof s==`object`&&s)for(let[e,t]of Object.entries(s)){let n=r(t,[...i,e],a);if(n!==void 0)return n}for(let e of ym){let t=o[e];if(t===void 0)continue;let n=Array.isArray(t)?t:typeof t==`object`&&t&&bm.has(e)?Object.values(t):[t];for(let t of n){let n=r(t,[...i,`<${e}>`],!1);if(n!==void 0)return n}}},i=r(e,[],!0);return i===void 0?{valid:!0,declarations:t}:{valid:!1,reason:i}}const ym=[`items`,`prefixItems`,`contains`,`additionalProperties`,`unevaluatedProperties`,`unevaluatedItems`,`propertyNames`,`patternProperties`,`dependentSchemas`,`oneOf`,`anyOf`,`allOf`,`not`,`if`,`then`,`else`,`$defs`,`definitions`],bm=new Set([`patternProperties`,`dependentSchemas`,`$defs`,`definitions`]);function xm(e){return e.length===0?`<root>`:e.join(`.`)}const Sm=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,Cm=/^-?\d+(\.\d+)?$/;function wm(e){if(typeof e==`string`)return e;if(typeof e==`boolean`)return e?`true`:`false`;if(typeof e==`number`)return!Number.isFinite(e)||Number.isInteger(e)&&!Number.isSafeInteger(e)?void 0:String(e)}function Tm(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.codePointAt(e);return new TextDecoder(`utf-8`,{fatal:!0}).decode(n)}function Em(e){if(!(e.startsWith(`=?base64?`)&&e.endsWith(`?=`)))return e;let t=e.slice(9,e.length-2);if(Sm.test(t))try{return Tm(t)}catch{return}}function Dm(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n)return;n=n[e]}return n}function Om(e,t,n){for(let r of e){let e=`Mcp-Param-${r.headerName}`,i=n.get(e),a=Dm(t,r.path);if(a==null)continue;let o=wm(a);if(o===void 0)continue;if(i===null)return km(`param-header-missing`,e,`the body carries ${xm(r.path)}=${JSON.stringify(a)} but the ${e} header is absent`);let s=Em(i);if(s===void 0)return km(`param-header-invalid-encoding`,e,`the ${e} header carries an invalid Base64 sentinel value`);if(!((r.type===`integer`||r.type===`number`)&&Cm.test(s)&&typeof a==`number`?Number(s)===a:s===o))return km(`param-header-mismatch`,e,`the ${e} header decodes to ${JSON.stringify(s)} but the body carries ${xm(r.path)}=${JSON.stringify(a)}`)}}function km(e,t,n){return{kind:`reject`,rung:`param-header-validation`,cell:e,httpStatus:400,code:Am,message:`Bad Request: the request headers and body disagree: ${n}`,data:{mismatch:{header:t,body:n}},settled:!0}}const Am=-32020;X.InvalidRequest,X.UnsupportedProtocolVersion,X.InvalidParams,X.MethodNotFound,X.InvalidParams,X.MissingRequiredClientCapability;const jm={[X.ParseError]:400,[X.InvalidRequest]:400,[X.MethodNotFound]:404,[X.UnsupportedProtocolVersion]:400,[X.MissingRequiredClientCapability]:400,[Am]:400};function Mm(e,t){return t===`in-band`?e===X.MissingRequiredClientCapability?400:200:jm[e]??400}function Nm(e,t,n,r,i){return{kind:`reject`,rung:e,cell:t,httpStatus:n,code:r.code,message:r.message,...r.data!==void 0&&{data:r.data},settled:i}}function Pm(e,t,n,r=`era-classification`){return Nm(r,e,400,new Z(Am,`Bad Request: the request headers and body disagree: ${n}`,{mismatch:{header:t,body:n}}),!0)}const Fm={"tools/call":`name`,"prompts/get":`name`,"resources/read":`uri`};function Im(e){let t=0;for(;t<e.length;){let n=e.codePointAt(t);if(n!==9&&n!==32)break;t+=1}let n=e.length;for(;n>t;){let t=e.codePointAt(n-1);if(t!==9&&t!==32)break;--n}return t===0&&n===e.length?e:e.slice(t,n)}function Lm(e,t){if(t.messageKind!==`request`)return;let n=t.message.method;if(e.mcpMethodHeader===void 0)return Pm(`method-header-missing`,`(missing)`,`the body names method ${n} but the required Mcp-Method header is absent`,`standard-header-validation`);let r=Object.hasOwn(Fm,n)?Fm[n]:void 0;if(r===void 0)return;let i=t.message.params?.[r],a=typeof i==`string`?i:void 0;if(e.mcpNameHeader===void 0)return a===void 0?void 0:Pm(`name-header-missing`,`(missing)`,`the body carries params.${r}="${a}" but the required Mcp-Name header is absent`,`standard-header-validation`);let o=Im(e.mcpNameHeader),s=Em(o);if(s===void 0)return Pm(`name-header-invalid-encoding`,o,`the Mcp-Name header carries an invalid Base64 sentinel value`,`standard-header-validation`);if(a!==void 0&&s!==a)return Pm(`name-header-mismatch`,o,`the body carries params.${r}="${a}" but the Mcp-Name header names "${s}"`,`standard-header-validation`)}function Rm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function zm(e){return e===void 0?{era:`modern`}:{era:yf(e)?`modern`:`legacy`,revision:e}}function Bm(e){if(!Qp(e))return!1;let t=$p(e);if(t===void 0||!yf(t))return!1;let n=Zp(e);return n!==void 0&&em(n).length===0}function Vm(e){if(e.length===0)return Nm(`jsonrpc-shape`,`empty-batch`,400,new Z(X.InvalidRequest,`Bad Request: empty JSON-RPC batch`),!0);for(let t of e){if(Qp(Rm(t)?t.params:void 0))return Nm(`jsonrpc-shape`,`batch-with-modern-element`,400,new Z(X.InvalidRequest,`Bad Request: JSON-RPC batches may not contain requests for protocol revision 2026-07-28 or later`),!0);if(!(rm(t)||im(t)||am(t)||om(t)))return Nm(`jsonrpc-shape`,`batch-with-invalid-element`,400,new Z(X.InvalidRequest,`Bad Request: JSON-RPC batch contains an invalid message`),!0)}return{kind:`legacy`,reason:`batch`}}function Hm(e,t){let n=t.params,r=t.method,i=e.protocolVersionHeader,a=i!==void 0&&yf(i);if(r===`initialize`&&!Bm(n)){if(a)return Pm(`initialize-with-modern-header`,i,`an initialize request (legacy handshake) was sent with a modern MCP-Protocol-Version header`);let e=Rm(n)&&typeof n.protocolVersion==`string`?n.protocolVersion:void 0;return{kind:`legacy`,reason:`initialize`,...e!==void 0&&{requestedVersion:e}}}if(Qp(n)){let a=Zp(n),o=(a===void 0?[]:em(a))[0];if(o!==void 0)return Nm(`envelope`,`envelope-invalid`,400,new Z(X.InvalidParams,`Invalid _meta envelope for protocol revision 2026-07-28: ${o.key}: ${o.problem}`,{envelope:o}),!0);let s=$p(n);return i!==void 0&&s!==void 0&&i!==s?Pm(`header-body-version-mismatch`,i,`the body envelope names protocol version ${s} but the MCP-Protocol-Version header names ${i}`):e.mcpMethodHeader!==void 0&&e.mcpMethodHeader!==r?Pm(`method-header-mismatch`,e.mcpMethodHeader,`the body names method ${r} but the Mcp-Method header names ${e.mcpMethodHeader}`):{kind:`modern`,messageKind:`request`,message:t,classification:zm(s)}}if(a){let e=Zp(n),t=em(e??{}).filter(e=>e.problem===`missing`).map(e=>e.key),r=e===void 0?[`_meta`]:t.length>0?t:[wc];return Nm(`envelope`,`modern-header-without-claim`,400,new Z(X.InvalidParams,`Invalid params: the MCP-Protocol-Version header names protocol revision ${i}, but the request is missing the required per-request envelope key(s): ${r.join(`, `)}`,{envelope:{missing:r}}),!0)}return{kind:`legacy`,reason:`no-claim`,...i!==void 0&&{requestedVersion:i}}}function Um(e,t){let n=t.params,r=t.method,i=e.protocolVersionHeader,a=i!==void 0&&yf(i);if(Qp(n)){let a=$p(n);if(a===void 0){let e=Zp(n),t=(e===void 0?[]:em(e)).find(e=>e.key===`io.modelcontextprotocol/protocolVersion`)??{key:`io.modelcontextprotocol/protocolVersion`,problem:`expected a protocol version string`};return Nm(`envelope`,`notification-envelope-invalid`,400,new Z(X.InvalidParams,`Invalid _meta envelope for protocol revision 2026-07-28: ${t.key}: ${t.problem}`,{envelope:t}),!0)}if(i!==void 0&&i!==a)return Pm(`notification-header-body-version-mismatch`,i,`the notification envelope names protocol version ${a} but the MCP-Protocol-Version header names ${i}`);let o=zm(a);return o.era===`modern`&&e.mcpMethodHeader!==void 0&&e.mcpMethodHeader!==r?Pm(`notification-method-header-mismatch`,e.mcpMethodHeader,`the notification body names method ${r} but the Mcp-Method header names ${e.mcpMethodHeader}`):{kind:`modern`,messageKind:`notification`,message:t,classification:o}}return a?e.mcpMethodHeader!==void 0&&e.mcpMethodHeader!==r?Pm(`notification-method-header-mismatch`,e.mcpMethodHeader,`the notification body names method ${r} but the Mcp-Method header names ${e.mcpMethodHeader}`):{kind:`modern`,messageKind:`notification`,message:t,classification:{era:`modern`,revision:i}}:{kind:`legacy`,reason:`notification`,...i!==void 0&&{requestedVersion:i}}}function Wm(e){if(e={...e,...e.protocolVersionHeader!==void 0&&{protocolVersionHeader:Im(e.protocolVersionHeader)},...e.mcpMethodHeader!==void 0&&{mcpMethodHeader:Im(e.mcpMethodHeader)},...e.mcpNameHeader!==void 0&&{mcpNameHeader:Im(e.mcpNameHeader)}},e.httpMethod.toUpperCase()!==`POST`)return{kind:`legacy`,reason:`http-method`};let t=e.body;return Array.isArray(t)?Vm(t):am(t)||om(t)?{kind:`legacy`,reason:`response`}:Rm(t)&&rm(t)?Hm(e,t):Rm(t)&&im(t)?Um(e,t):Nm(`jsonrpc-shape`,`invalid-json-rpc-body`,400,new Z(X.InvalidRequest,`Bad Request: the request body is not a valid JSON-RPC message`),!0)}function Gm(e,t){switch(e.reason){case`http-method`:return Nm(`http-method`,`modern-only-method-not-allowed`,405,new Z(-32e3,`Method not allowed.`),!0);case`batch`:return Nm(`jsonrpc-shape`,`modern-only-batch-not-supported`,400,new Z(X.InvalidRequest,`Bad Request: JSON-RPC batches are not supported by this endpoint`),!0);case`response`:return Nm(`jsonrpc-shape`,`modern-only-response-post`,400,new Z(X.InvalidRequest,`Bad Request: JSON-RPC responses cannot be posted to this endpoint`),!0);case`notification`:return;case`initialize`:case`no-claim`:{let n=e.requestedVersion;return Nm(`era-classification`,`modern-only-missing-envelope`,400,n===void 0?new Z(X.UnsupportedProtocolVersion,`Unsupported protocol version: the request did not name a protocol version`,{supported:[...t]}):new up({supported:[...t],requested:n}),!0)}}}function Km(e,t){return Lo(e,t)}function qm(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function Jm(e){if(e==null)return!1;let t=typeof e;return t!==`object`&&t!==`function`||!(`~standard`in e)?!1:typeof e[`~standard`]?.validate==`function`}let Ym=!1;const Xm=`draft-2020-12`;function Zm(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:Xm});else if(n.vendor===`zod`){if(!(`_zod`in e))throw Error(`Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().`);Ym||(Ym=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=jo(e,{target:Xm,io:t})}else throw Error(`Schema library "${n.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t===`output`)return r.type===void 0&&Qm(r)?{type:`object`,...r}:r;if(r.type!==void 0&&r.type!==`object`)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:`object`,...r}}function Qm(e){if(`properties`in e||`patternProperties`in e||`additionalProperties`in e||`required`in e)return!0;for(let t of[`oneOf`,`anyOf`,`allOf`]){let n=e[t];if(Array.isArray(n)&&n.length>0)return n.every(e=>typeof e==`object`&&!!e&&(e.type===`object`||Qm(e)))}return!1}function $m(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function eh(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>$m(e)).join(`, `)}:{success:!0,data:n.value}}function th(e){let t=jo(e,{target:Xm,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}const nh=/\\\.\\d\{(\d+)\}/;function rh(e){let t=nh.exec(e),n=[void 0,-1,0];return t&&n.push(Number(t[1])),[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>n.map(n=>_c({local:e,offset:t,precision:n}))))}function ih(e,t){let n;switch(e){case`email`:n=[ns()];break;case`uri`:n=[os()];break;case`date`:n=[vc()];break;case`date-time`:n=rh(t)}return new Set(n.map(e=>th(e)).filter(e=>e!==void 0))}function ah(e,t,n){return n!==`zod`||ih(e,t).has(t)}function oh(e){let t=Zm(e,`input`),n=t.properties||{},r=t.required||[];return Object.entries(n).map(([e,t])=>({name:e,description:t?.description,required:r.includes(e)}))}function sh(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ch(e){try{return Zm(e,`input`)}catch(e){let t=e instanceof Error?e.message:String(e);throw new Z(X.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}const lh=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function uh(e){return lh.has(e)||e.startsWith(`x-`)}const dh=new Set([`$schema`,...Object.keys(od.shape.requestedSchema.shape)]),fh={string:qm([Yu,Zu,Qu,$u]),number:qm([Xu]),integer:qm([Xu]),boolean:qm([Ju]),array:qm([td,nd])},ph=new Set(Yu.shape.format.unwrap().options);function mh(e,t,n,r){if(!sh(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(fh,e.type)?fh[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||uh(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?ph.has(e.format)?(typeof s!=`string`||!ah(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function hh(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&sh(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,mh(n,`properties.${e}`,t,r)])):dh.has(i)?n[i]=a:uh(i)||r.push(i);if(r.length>0)throw new Z(X.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(`, `)}`);return n}function gh(e,t){if(!sh(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!Km(ad,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function _h(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>_h(e,t[r],`${n}[${r}]`)):!sh(e)||!sh(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?_h(r,t[e],i):uh(e)?[]:[i]})}function vh(e){if(!Jm(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=hh(ch(e.requestedSchema),t),r=Km(od.shape.requestedSchema,n);if(!r.success)throw new Z(X.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${gh(n,r.error.message)}`);let i=_h(n,r.data);if(i.length>0)throw new Z(X.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(`, `)}`);let a=(r.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(r.data.properties,e));if(a.length>0)throw new Z(X.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(`, `)}`);return{...e,mode:`form`,requestedSchema:r.data}}function yh(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,n=typeof e.requestState==`string`;if(!t&&!n)throw TypeError(`inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)`);return{resultType:`input_required`,...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}const bh=Object.assign(yh,{elicit(e){try{return{method:`elicitation/create`,params:vh(e)}}catch(e){throw e instanceof Z?TypeError(e.message,{cause:e}):e}},elicitUrl(e){return{method:`elicitation/create`,params:{...e,mode:`url`}}},createMessage(e){return{method:`sampling/createMessage`,params:e}},listRoots(){return{method:`roots/list`}}});function xh(e,t,n){let r=Sh(e,t);if(r.kind!==`elicit`||r.action!==`accept`||r.content===void 0)return;if(n===void 0)return r.content;let i=n[`~standard`].validate(r.content);if(i instanceof Promise)throw TypeError(`acceptedContent(responses, key, schema) requires a synchronously-validating schema`);return i.issues===void 0?i.value:void 0}function Sh(e,t){if(e===void 0||typeof e!=`object`||!e)return{kind:`missing`};let n=e[t];if(typeof n!=`object`||!n||Array.isArray(n))return{kind:`missing`};let r=n;if(r.action===`accept`||r.action===`decline`||r.action===`cancel`){let e=r.content;return{kind:`elicit`,action:r.action,...typeof e==`object`&&!!e&&!Array.isArray(e)&&{content:e}}}return Array.isArray(r.roots)?{kind:`roots`,roots:r.roots}:typeof r.role==`string`&&r.content!==void 0?{kind:`sampling`,result:r}:{kind:`missing`}}function Ch(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function wh(e,t){return new Promise((n,r)=>{if(t?.aborted){r(t.reason instanceof Y?t.reason:new Y(J.RequestTimeout,String(t.reason)));return}let i=setTimeout(()=>{t?.removeEventListener(`abort`,a),n()},e),a=()=>{clearTimeout(i),r(t?.reason instanceof Y?t.reason:new Y(J.RequestTimeout,String(t?.reason)))};t?.addEventListener(`abort`,a,{once:!0})})}function Th(e){let t=new AbortController,n=()=>t.abort(e?.reason);return e?.addEventListener(`abort`,n,{once:!0}),e?.aborted&&t.abort(e.reason),{signal:t.signal,abort:e=>t.abort(e),dispose:()=>e?.removeEventListener(`abort`,n)}}const Eh=`AnnotationsSchema.AudioContentSchema.BaseMetadataSchema.BlobResourceContentsSchema.BooleanSchemaSchema.CallToolRequestSchema.CallToolRequestParamsSchema.CallToolResultSchema.CancelledNotificationSchema.CancelledNotificationParamsSchema.CancelTaskRequestSchema.CancelTaskResultSchema.ClientCapabilitiesSchema.ClientNotificationSchema.ClientRequestSchema.ClientResultSchema.CompatibilityCallToolResultSchema.CompleteRequestSchema.CompleteRequestParamsSchema.CompleteResultSchema.ContentBlockSchema.CreateMessageRequestSchema.CreateMessageRequestParamsSchema.CreateMessageResultSchema.CreateMessageResultWithToolsSchema.CreateTaskResultSchema.CursorSchema.DiscoverRequestSchema.DiscoverResultSchema.ElicitationCompleteNotificationSchema.ElicitationCompleteNotificationParamsSchema.ElicitRequestSchema.ElicitRequestFormParamsSchema.ElicitRequestParamsSchema.ElicitRequestURLParamsSchema.ElicitResultSchema.EmbeddedResourceSchema.EmptyResultSchema.EnumSchemaSchema.GetPromptRequestSchema.GetPromptRequestParamsSchema.GetPromptResultSchema.GetTaskPayloadRequestSchema.GetTaskPayloadResultSchema.GetTaskRequestSchema.GetTaskResultSchema.IconSchema.IconsSchema.ImageContentSchema.ImplementationSchema.InitializedNotificationSchema.InitializeRequestSchema.InitializeRequestParamsSchema.InitializeResultSchema.JSONArraySchema.JSONObjectSchema.JSONRPCErrorResponseSchema.JSONRPCMessageSchema.JSONRPCNotificationSchema.JSONRPCRequestSchema.JSONRPCResponseSchema.JSONRPCResultResponseSchema.JSONValueSchema.LegacyTitledEnumSchemaSchema.ListPromptsRequestSchema.ListPromptsResultSchema.ListResourcesRequestSchema.ListResourcesResultSchema.ListResourceTemplatesRequestSchema.ListResourceTemplatesResultSchema.ListRootsRequestSchema.ListRootsResultSchema.ListTasksRequestSchema.ListTasksResultSchema.ListToolsRequestSchema.ListToolsResultSchema.LoggingLevelSchema.LoggingMessageNotificationSchema.LoggingMessageNotificationParamsSchema.ModelHintSchema.ModelPreferencesSchema.MultiSelectEnumSchemaSchema.NotificationSchema.NumberSchemaSchema.PaginatedRequestSchema.PaginatedRequestParamsSchema.PaginatedResultSchema.PingRequestSchema.PrimitiveSchemaDefinitionSchema.ProgressSchema.ProgressNotificationSchema.ProgressNotificationParamsSchema.ProgressTokenSchema.PromptSchema.PromptArgumentSchema.PromptListChangedNotificationSchema.PromptMessageSchema.PromptReferenceSchema.ReadResourceRequestSchema.ReadResourceRequestParamsSchema.ReadResourceResultSchema.RelatedTaskMetadataSchema.RequestSchema.RequestIdSchema.RequestMetaSchema.ResourceSchema.ResourceContentsSchema.ResourceLinkSchema.ResourceListChangedNotificationSchema.ResourceRequestParamsSchema.ResourceTemplateSchema.ResourceTemplateReferenceSchema.ResourceUpdatedNotificationSchema.ResourceUpdatedNotificationParamsSchema.ResultMetaObjectSchema.ResultSchema.RoleSchema.RootSchema.RootsListChangedNotificationSchema.SamplingContentSchema.SamplingMessageSchema.SamplingMessageContentBlockSchema.ServerCapabilitiesSchema.ServerNotificationSchema.ServerRequestSchema.ServerResultSchema.SetLevelRequestSchema.SetLevelRequestParamsSchema.SingleSelectEnumSchemaSchema.StringSchemaSchema.SubscribeRequestSchema.SubscribeRequestParamsSchema.SubscriptionFilterSchema.SubscriptionsAcknowledgedNotificationSchema.SubscriptionsAcknowledgedNotificationParamsSchema.SubscriptionsListenRequestSchema.SubscriptionsListenRequestParamsSchema.SubscriptionsListenResultSchema.SubscriptionsListenResultMetaSchema.TaskAugmentedRequestParamsSchema.TaskCreationParamsSchema.TaskMetadataSchema.TaskSchema.TaskStatusSchema.TaskStatusNotificationSchema.TaskStatusNotificationParamsSchema.TextContentSchema.TextResourceContentsSchema.TitledMultiSelectEnumSchemaSchema.TitledSingleSelectEnumSchemaSchema.ToolSchema.ToolAnnotationsSchema.ToolChoiceSchema.ToolExecutionSchema.ToolListChangedNotificationSchema.ToolResultContentSchema.ToolUseContentSchema.UnsubscribeRequestSchema.UnsubscribeRequestParamsSchema.UntitledMultiSelectEnumSchemaSchema.UntitledSingleSelectEnumSchemaSchema`.split(`.`),Dh={IdJagTokenExchangeResponseSchema:Jd,OAuthClientInformationFullSchema:$d,OAuthClientInformationSchema:Qd,OAuthClientMetadataSchema:Zd,OAuthClientRegistrationErrorSchema:ef,OAuthErrorResponseSchema:Yd,OAuthMetadataSchema:Wd,OAuthProtectedResourceMetadataSchema:Ud,OAuthTokenRevocationRequestSchema:tf,OAuthTokensSchema:qd,OpenIdProviderDiscoveryMetadataSchema:Kd,OpenIdProviderMetadataSchema:Gd},Oh={},kh={};function Ah(e,t){let n=e.slice(0,-6);Oh[n]=t,kh[n]=e=>t.safeParse(e).success}for(let e of Eh)Ah(e,tm[e]);for(let[e,t]of Object.entries(Dh))Ah(e,t);const jh=Object.freeze(Oh),Mh=Object.freeze(kh);function Nh(e){switch(e){case`initialize`:case`notifications/initialized`:return Gp(void 0);case`server/discover`:return Gp(Wp);default:return}}const Ph=6e4,Fh=[wc,Tc,Dc,kc],Ih=[`inputResponses`,`requestState`];function Lh(e,t){let n=e.params;if(!Gh(n))return{message:e,lifted:{}};let r=n._meta,i=Gh(r)?Fh.filter(e=>e in r):[],a=t===`request`?Ih.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&Gh(r)){let e={},t={...r};for(let n of i)e[n]=r[n],delete t[n];o.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of a)e===`inputResponses`&&(o.inputResponses=s[e]),e===`requestState`&&(o.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:o}}function Rh(e,t){let n=e.validateResult(t,void 0);if(n.ok||n.reason!==`not-in-era`)return{"~standard":{version:1,vendor:`mcp-wire-codec`,validate(n){let r=e.validateResult(t,n);return r.ok?{value:r.value}:{issues:[{message:r.reason===`invalid`?r.message:`not-in-era: ${t}`}]}}}}}function zh(e){return()=>e}const Bh=zh(void 0);function Vh(e,t){return{...e,mcpReq:{...e.mcpReq,requestState:zh(t)}}}let Hh;function Uh(e,t){Hh(e,t)}var Wh=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{Hh=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??Sc,this.setNotificationHandler(`notifications/cancelled`,e=>{this._oncancel(e)}),this.setNotificationHandler(`notifications/progress`,e=>{this._onprogress(e)}),this.setRequestHandler(`ping`,e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let n=e.params??{};return{...e,params:{...n,_meta:{...t,...n._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new Y(J.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Y(J.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),am(e)||om(e)?this._onresponse(e):rm(e)?this._onrequest(e,t):im(e)?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let n=new Y(J.ConnectionClosed,`Connection closed`);this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(n);for(let e of t.values())e.abort(n)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:n}=Lh(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=Kp(t.classification);if(e!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${n.method}': classified as ${e} but this instance serves ${r.era}`));return}}if(Jp(n.method)&&!r.hasNotificationMethod(n.method))return;let i=this._notificationHandlers.get(n.method),a=this.fallbackNotificationHandler;(i!==void 0||a!==void 0)&&Promise.resolve().then(()=>i===void 0?a(n):i(n,r)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let{message:n,lifted:r}=Lh(e,`request`),i=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let a=this._transport,o=(e,t,r)=>{let i={jsonrpc:`2.0`,id:n.id,error:{code:e,message:t,...r!==void 0&&{data:r}}};a?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=Kp(t.classification);if(e!==i.era){this._onerror(Error(`Era mismatch on inbound request '${n.method}': classified as ${e} but this instance serves ${i.era}`));let r=t.classification.revision??e;o(X.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(qp(n.method)&&!i.hasRequestMethod(n.method)){o(X.MethodNotFound,`Method not found`);return}let s=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(s===void 0){o(X.MethodNotFound,`Method not found`);return}let c=i.checkInboundEnvelope(r);if(c!==void 0){o(X.InvalidParams,c);return}let l=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:n.id}),u=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:n.id}),d=new AbortController;this._requestHandlerAbortControllers.set(n.id,d);let f=r.inputResponses===void 0?void 0:Jh(r.inputResponses),p={sessionId:a?.sessionId,mcpReq:{id:n.id,method:n.method,_meta:n.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:r.requestState===void 0?Bh:zh(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),Jm(t))return u(e,t,n);let i=Rh(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return u(e,i,t)}),notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},m=this.buildContext(p,t);Promise.resolve().then(()=>s(n,m)).then(async e=>{if(d.signal.aborted)return;let t;try{t=i.encodeResult(n.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${n.method}: ${e}`)),o(X.InternalError,`Internal error`);return}let r={result:t,jsonrpc:`2.0`,id:n.id};await a?.send(r)},async e=>{if(d.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:X.InternalError,r={jsonrpc:`2.0`,id:n.id,error:{code:i.encodeErrorCode(t),message:e.message??`Internal error`,...e.data!==void 0&&{data:e.data}}};await a?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===d&&this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._responseHandlers.get(t);if(n===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),am(e)?n(e):n(Z.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,n){let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),Jm(t))return this._requestWithSchemaViaCodec(r,e,t,n);let i=Rh(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,i,t)}_negotiatedWireCodec(){return Gp(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=Nh(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(qp(t)&&!e.hasRequestMethod(t))throw new Y(J.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,n){let r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n)}_requestWithSchemaViaCodec(e,t,n,r){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s}=r??{},c=Date.now(),l,u;return new Promise((d,f)=>{let p=e=>{f(e)};if(!this._transport){p(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){p(e);return}if(r?.signal?.aborted){let e=r.signal.reason;throw e instanceof Y?e:new Y(J.RequestTimeout,String(e))}let m=e.era===`2026-07-28`&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,h=this._requestMessageId++;u=h;let g={...t,jsonrpc:`2.0`,id:h};r?.onprogress&&(this._progressHandlers.set(h,r.onprogress),g.params={...t.params,_meta:{...t.params?._meta,progressToken:h}});let _=this._envelopeOutbound(g),v=!1,y=e=>{v||(this._progressHandlers.delete(h),m===void 0?this._transport?.send(this._envelopeOutbound({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:h,reason:String(e)}}),{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),f(e instanceof Y?e:new Y(J.RequestTimeout,String(e))))};this._responseHandlers.set(h,i=>{if(r?.signal?.aborted)return;if(v=!0,i instanceof Error)return f(i);let a;try{a=e.decodeResult(t.method,i.result)}catch(e){return f(e instanceof Error?e:Error(String(e)))}if(a.kind===`invalid`)return f(a.error);if(a.kind===`input_required`){if(r?.allowInputRequired===!0)return d(Yh(a));let i={codec:e,request:t,resultSchema:n,options:r,flowStartedAt:c,retry:(r,i)=>this._requestWithSchemaViaCodec(e,r===void 0?{method:t.method}:{method:t.method,params:r},n,i)};return d(this._resolveNonCompleteResult(a,i))}let o=a.result;eh(n,o).then(e=>{e.success?d(e.data):f(new Y(J.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},f)}),l=()=>y(r?.signal?.reason),r?.signal?.addEventListener(`abort`,l,{once:!0});let b=r?.timeout??6e4;this._setupTimeout(h,b,r?.maxTotalTimeout,()=>y(new Y(J.RequestTimeout,`Request timed out`,{timeout:b})),r?.resetTimeoutOnProgress??!1),this._transport.send(_,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(h),f(e)})}).finally(()=>{l&&r?.signal?.removeEventListener(`abort`,l),u!==void 0&&(this._responseHandlers.delete(u),this._cleanupTimeout(u))})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new Y(J.NotConnected,`Not connected`);if(Jp(t.method)&&!e.hasNotificationMethod(t.method))throw new Y(J.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let r=this._envelopeOutbound({jsonrpc:`2.0`,...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!n?.relatedRequestId){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(r,n).catch(e=>this._onerror(e))});return}await this._transport.send(r,n)}setRequestHandler(e,t,n){this.assertRequestHandlerCapability(e);let r;if(typeof t==`function`){if(!qp(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,r)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason===`not-in-era`&&(a=i.validateInputRequest(e,n)),!a.ok)throw a.reason===`not-in-era`?new Z(X.InternalError,`No wire schema for ${e} in the resolved era`):Error(a.message);return Promise.resolve(t(a.value,r))}}else if(n)r=async(r,i)=>{let a=await eh(t.params,{...r.params});if(!a.success)throw new Z(X.InvalidParams,`Invalid params for ${e}: ${a.error}`);return n(a.data,i)};else throw TypeError(`setRequestHandler: handler is required`);this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,n){if(typeof t==`function`){if(!Jp(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,r)=>{let i=r.validateNotification(e,n);if(!i.ok)throw i.reason===`not-in-era`?new Z(X.InternalError,`No wire schema for ${e} in the resolved era`):Error(i.message);return Promise.resolve(t(i.value))});return}if(!n)throw TypeError(`setNotificationHandler: handler is required`);this._notificationHandlers.set(e,async r=>{let i=await eh(t.params,{...r.params});if(!i.success)throw new Z(X.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await n(i.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Gh(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Kh(e,t){let n={...e};for(let e in t){let r=e,i=t[r];if(i===void 0)continue;let a=n[r];n[r]=Gh(a)&&Gh(i)?{...a,...i}:i}return n}function qh(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Jh(e){let t={},n=[];if(!qh(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e)){if(!qh(i)||`method`in i||`result`in i){n.push(r);continue}t[r]=i}return{accepted:t,droppedKeys:n}}function Yh(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState}}}var Xh=l(o((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=i;function i(e){if(!e)throw TypeError(`argument string is required`);var i=typeof e==`object`?a(e):e;if(typeof i!=`string`)throw TypeError(`argument string is required to be a string`);var s=i.indexOf(`;`),c=s===-1?i.trim():i.slice(0,s).trim();if(!r.test(c))throw TypeError(`invalid media type`);var l=new o(c.toLowerCase());if(s!==-1){var u,d,f;for(t.lastIndex=s;d=t.exec(i);){if(d.index!==s)throw TypeError(`invalid parameter format`);s+=d[0].length,u=d[1].toLowerCase(),f=d[2],f.charCodeAt(0)===34&&(f=f.slice(1,-1),f.indexOf(`\\`)!==-1&&(f=f.replace(n,`$1`))),l.parameters[u]=f}if(s!==i.length)throw TypeError(`invalid parameter format`)}return l}function a(e){var t;if(typeof e.getHeader==`function`?t=e.getHeader(`content-type`):typeof e.headers==`object`&&(t=e.headers&&e.headers[`content-type`]),typeof t!=`string`)throw TypeError(`content-type header is missing from object`);return t}function o(e){this.parameters=Object.create(null),this.type=e}}))(),1);function Zh(e){if(e)try{return Xh.parse(e).type}catch{let t=(e.split(`;`,1)[0]??``).trim().toLowerCase();return t===``||e.slice(t.length).includes(`,`)?void 0:t}}function Qh(e){return e===`application/json`||Zh(e)===`application/json`}function $h(e){return e.title!==void 0&&e.title!==``?e.title:`annotations`in e&&e.annotations?.title?e.annotations.title:e.name}const eg=10485760;var tg=class{_buffer;_maxBufferSize;constructor(e){this._maxBufferSize=e?.maxBufferSize??10485760}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){for(;this._buffer;){let e=this._buffer.indexOf(`
`);if(e===-1)return null;let t=this._buffer.toString(`utf8`,0,e).replace(/\r$/,``);this._buffer=this._buffer.subarray(e+1);try{return ng(t)}catch(e){if(e instanceof SyntaxError)continue;throw e}}return null}clear(){this._buffer=void 0}};function ng(e){return nl.parse(JSON.parse(e))}function rg(e){return JSON.stringify(e)+`
`}const ig=/^[A-Za-z0-9._-]{1,128}$/;function ag(e){let t=[];if(e.length===0)return{isValid:!1,warnings:[`Tool name cannot be empty`]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(` `)&&t.push(`Tool name contains spaces, which may cause parsing issues`),e.includes(`,`)&&t.push(`Tool name contains commas, which may cause parsing issues`),(e.startsWith(`-`)||e.endsWith(`-`))&&t.push(`Tool name starts or ends with a dash, which may cause parsing issues in some contexts`),(e.startsWith(`.`)||e.endsWith(`.`))&&t.push(`Tool name starts or ends with a dot, which may cause parsing issues in some contexts`),!ig.test(e)){let n=[...e].filter(e=>!/[A-Za-z0-9._-]/.test(e)).filter((e,t,n)=>n.indexOf(e)===t);return t.push(`Tool name contains invalid characters: ${n.map(e=>`"${e}"`).join(`, `)}`,`Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)`),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function og(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let e of t)console.warn(` - ${e}`);console.warn(`Tool registration will proceed, but this may cause compatibility issues.`),console.warn(`Consider updating the tool name to conform to the MCP tool naming standard.`),console.warn(`See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.`)}}function sg(e){let t=ag(e);return og(e,t.warnings),t.isValid}function cg(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function lg(e=fetch,t){return t?async(n,r)=>e(n,{...t,...r,headers:r?.headers?{...cg(t.headers),...cg(r.headers)}:t.headers}):e}const ug=1e6,dg=1e6,fg=1e4;var pg=class e{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,t,n){if(e.length>t)throw Error(`${n} exceeds maximum length of ${t} characters (got ${e.length})`)}template;parts;get variableNames(){return this.parts.flatMap(e=>typeof e==`string`?[]:e.names)}constructor(t){e.validateLength(t,ug,`Template`),this.template=t,this.parts=this.parse(t)}toString(){return this.template}parse(t){let n=[],r=``,i=0,a=0;for(;i<t.length;)if(t[i]===`{`){r&&=(n.push(r),``);let o=t.indexOf(`}`,i);if(o===-1)throw Error(`Unclosed template expression`);if(a++,a>fg)throw Error(`Template contains too many expressions (max ${fg})`);let s=t.slice(i+1,o),c=this.getOperator(s),l=s.includes(`*`),u=this.getNames(s),d=u[0];for(let t of u)e.validateLength(t,dg,`Variable name`);n.push({name:d,operator:c,names:u,exploded:l}),i=o+1}else r+=t[i],i++;return r&&n.push(r),n}getOperator(e){return[`+`,`#`,`.`,`/`,`?`,`&`].find(t=>e.startsWith(t))||``}getNames(e){let t=this.getOperator(e);return e.slice(t.length).split(`,`).map(e=>e.replace(`*`,``).trim()).filter(e=>e.length>0)}encodeValue(t,n){return e.validateLength(t,dg,`Variable value`),n===`+`||n===`#`?encodeURI(t):encodeURIComponent(t)}expandPart(e,t){if(e.operator===`?`||e.operator===`&`){let n=e.names.map(n=>{let r=t[n];return r===void 0?``:`${n}=${Array.isArray(r)?r.map(t=>this.encodeValue(t,e.operator)).join(`,`):this.encodeValue(r.toString(),e.operator)}`}).filter(e=>e.length>0);return n.length===0?``:(e.operator===`?`?`?`:`&`)+n.join(`&`)}if(e.names.length>1){let n=e.names.map(e=>t[e]).filter(e=>e!==void 0);return n.length===0?``:n.map(e=>Array.isArray(e)?e[0]:e).join(`,`)}let n=t[e.name];if(n===void 0)return``;let r=(Array.isArray(n)?n:[n]).map(t=>this.encodeValue(t,e.operator));switch(e.operator){case``:return r.join(`,`);case`+`:return r.join(`,`);case`#`:return`#`+r.join(`,`);case`.`:return`.`+r.join(`.`);case`/`:return`/`+r.join(`/`);default:return r.join(`,`)}}expand(e){let t=``,n=!1;for(let r of this.parts){if(typeof r==`string`){t+=r;continue}let i=this.expandPart(r,e);i&&(t+=(r.operator===`?`||r.operator===`&`)&&n?i.replace(`?`,`&`):i,(r.operator===`?`||r.operator===`&`)&&(n=!0))}return t}escapeRegExp(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}partToRegExp(t){let n=[];for(let n of t.names)e.validateLength(n,dg,`Variable name`);if(t.operator===`?`||t.operator===`&`){for(let e=0;e<t.names.length;e++){let r=t.names[e],i=e===0?`\\`+t.operator:`&`;n.push({pattern:i+this.escapeRegExp(r)+`=([^&]+)`,name:r})}return n}let r,i=t.name;switch(t.operator){case``:r=t.exploded?`([^/,]+(?:,[^/,]+)*)`:`([^/,]+)`;break;case`+`:case`#`:r=`(.+)`;break;case`.`:r=String.raw`\.([^/,]+)`;break;case`/`:r=`/`+(t.exploded?`([^/,]+(?:,[^/,]+)*)`:`([^/,]+)`);break;default:r=`([^/]+)`}return n.push({pattern:r,name:i}),n}match(t){e.validateLength(t,ug,`URI`);let n=`^`,r=[];for(let e of this.parts)if(typeof e==`string`)n+=this.escapeRegExp(e);else{let t=this.partToRegExp(e);for(let{pattern:i,name:a}of t)n+=i,r.push({name:a,exploded:e.exploded})}n+=`$`,e.validateLength(n,1e6,`Generated regex pattern`);let i=new RegExp(n),a=t.match(i);if(!a)return null;let o={};for(let[e,t]of r.entries()){let{name:n,exploded:r}=t,i=a[e+1],s=n.replace(`*`,``);o[s]=r&&i.includes(`,`)?i.split(`,`):i}return o}},mg=class e{_otherTransport;_messageQueue=[];_closed=!1;onclose;onerror;onmessage;sessionId;static createLinkedPair(){let t=new e,n=new e;return t._otherTransport=n,n._otherTransport=t,[t,n]}async start(){for(;this._messageQueue.length>0;){let e=this._messageQueue.shift();this.onmessage?.(e.message,e.extra)}}async close(){if(this._closed)return;this._closed=!0;let e=this._otherTransport;this._otherTransport=void 0;try{await e?.close()}finally{this.onclose?.()}}async send(e,t){if(!this._otherTransport)throw new Y(J.NotConnected,`Not connected`);this._otherTransport.onmessage?this._otherTransport.onmessage(e,{authInfo:t?.authInfo}):this._otherTransport._messageQueue.push({message:e,extra:{authInfo:t?.authInfo}})}};function hg(e){return typeof e==`object`&&!!e&&`_zod`in e}function gg(e){return typeof e==`object`&&!!e&&!(`_zod`in e)&&`_def`in e&&typeof e._def?.typeName==`string`}function _g(e){if(typeof e!=`object`||!e||Jm(e))return!1;let t=Object.getPrototypeOf(e);return t!==Object.prototype&&t!==null?!1:Object.values(e).every(e=>hg(e))}function vg(e){if(e!==void 0){if(_g(e))return R(e);if(typeof e==`object`&&e&&!Jm(e)&&Object.values(e).some(e=>gg(e)))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!Jm(e))throw TypeError(`inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).`);return e}}function yg(){Df(),$f(),Rf(),Cp(),Up()}function bg(e,t){let n=t.getValidator(e);return{"~standard":{version:1,vendor:`mcp`,jsonSchema:{input:()=>e,output:()=>e},validate:e=>{let t=n(e);return t.valid?{value:t.data}:{issues:[{message:t.errorMessage}]}}}}}var xg=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;let a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),Sg=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=xg();var n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;let o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),Q=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=xg(),n=Sg();var r=xg();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}});var i=Sg();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=ae(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=ae(this.rhs,e,n),this}get names(){return ie(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=ae(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(oe(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>re(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(se(t),n instanceof e?[n]:n.nodes);if(t!==!1&&this.nodes.length)return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=ae(this.condition,e,t),this}get names(){let e=super.names;return ie(e,this.condition),this.else&&re(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=ae(this.iteration,e,t),this}get names(){return re(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return ie(ie(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=ae(this.iterable,e,t),this}get names(){return re(super.names,this.iterable.names)}},ee=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};ee.kind=`func`;var te=class extends p{render(e){return`return `+super.render(e)}};te.kind=`return`;var ne=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&re(e,this.catch.names),this.finally&&re(e,this.finally.names),e}},S=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};S.kind=`catch`;var C=class extends m{render(e){return`finally`+super.render(e)}};C.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
`:``},this._extScope=e,this._scope=new n.Scope({parent:e}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let i=this._scope.toName(t);return n!==void 0&&r&&(this._constants[i.str]=n),this._leafNode(new o(e,i,n)),i}const(e,t,r){return this._def(n.varKinds.const,e,t,r)}let(e,t,r){return this._def(n.varKinds.let,e,t,r)}var(e,t,r){return this._def(n.varKinds.var,e,t,r)}assign(e,t,n){return this._leafNode(new s(e,t,n))}add(t,n){return this._leafNode(new c(t,e.operators.ADD,n))}code(e){return typeof e==`function`?e():e!==t.nil&&this._leafNode(new f(e)),this}object(...e){let n=[`{`];for(let[r,i]of e)n.length>1&&n.push(`,`),n.push(r),(r!==i||this.opts.es5)&&(n.push(`:`),(0,t.addCodeArg)(n,i));return n.push(`}`),new t._Code(n)}if(e,t,n){if(this._blockNode(new _(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error(`CodeGen: "else" body without "then" body`);return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(_,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new y(e),t)}forRange(e,t,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.let){let o=this._scope.toName(e);return this._for(new b(a,o,t,r),()=>i(o))}forOf(e,r,i,a=n.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=r instanceof t.Name?r:this.var(`_arr`,r);return this.forRange(`_i`,0,(0,t._)`${e}.length`,n=>{this.var(o,(0,t._)`${e}[${n}]`),i(o)})}return this._for(new x(`of`,a,o,r),()=>i(o))}forIn(e,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${r})`,i);let o=this._scope.toName(e);return this._for(new x(`in`,a,o,r),()=>i(o))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new te;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error(`CodeGen: "return" should have one node`);return this._endBlockNode(te)}try(e,t,n){if(!t&&!n)throw Error(`CodeGen: "try" without "catch" and "finally"`);let r=new ne;if(this._blockNode(r),this.code(e),t){let e=this.name(`e`);this._currNode=r.catch=new S(e),t(e)}return n&&(this._currNode=r.finally=new C,this.code(n)),this._endBlockNode(S,C)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error(`CodeGen: not in self-balancing block`);let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,n=t.nil,r,i){return this._blockNode(new ee(e,n,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(ee)}optimize(e=1){for(;e-->0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error(`CodeGen: "else" without "if"`);return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function re(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function ie(e,n){return n instanceof t._CodeOrName?re(e,n.names):e}function ae(e,n,r){return e instanceof t.Name?i(e):a(e)?new t._Code(e._items.reduce((e,n)=>(n instanceof t.Name&&(n=i(n)),n instanceof t._Code?e.push(...n._items):e.push(n),e),[])):e;function i(e){let t=r[e.str];return t===void 0||n[e.str]!==1?e:(delete n[e.str],t)}function a(e){return e instanceof t._Code&&e._items.some(e=>e instanceof t.Name&&n[e.str]===1&&r[e.str]!==void 0)}}function oe(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function se(e){return typeof e==`boolean`||typeof e==`number`||e===null?!e:(0,t._)`!${T(e)}`}e.not=se;let ce=w(e.operators.AND);function le(...e){return e.reduce(ce)}e.and=le;let ue=w(e.operators.OR);function de(...e){return e.reduce(ue)}e.or=de;function w(e){return(n,r)=>n===t.nil?r:r===t.nil?n:(0,t._)`${T(n)} ${e} ${T(r)}`}function T(e){return e instanceof t.Name?e:(0,t._)`(${e})`}})),$=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let t=Q(),n=xg();function r(e){let t={};for(let n of e)t[n]=!0;return t}e.toHash=r;function i(e,t){return typeof t==`boolean`?t:Object.keys(t).length===0||(a(e,t),!o(t,e.self.RULES.all))}e.alwaysValidSchema=i;function a(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema||typeof t==`boolean`)return;let i=r.RULES.keywords;for(let n in t)i[n]||x(e,`unknown keyword: "${n}"`)}e.checkUnknownRules=a;function o(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(t[n])return!0;return!1}e.schemaHasRules=o;function s(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(n!==`$ref`&&t.all[n])return!0;return!1}e.schemaHasRulesButRef=s;function c({topSchemaRef:e,schemaPath:n},r,i,a){if(!a){if(typeof r==`number`||typeof r==`boolean`)return r;if(typeof r==`string`)return(0,t._)`${r}`}return(0,t._)`${e}${n}${(0,t.getProperty)(i)}`}e.schemaRefOrVal=c;function l(e){return f(decodeURIComponent(e))}e.unescapeFragment=l;function u(e){return encodeURIComponent(d(e))}e.escapeFragment=u;function d(e){return typeof e==`number`?`${e}`:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.escapeJsonPointer=d;function f(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}e.unescapeJsonPointer=f;function p(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}e.eachItem=p;function m({mergeNames:e,mergeToName:n,mergeValues:r,resultToName:i}){return(a,o,s,c)=>{let l=s===void 0?o:s instanceof t.Name?(o instanceof t.Name?e(a,o,s):n(a,o,s),s):o instanceof t.Name?(n(a,s,o),o):r(o,s);return c===t.Name&&!(l instanceof t.Name)?i(a,l):l}}e.mergeEvaluated={props:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>{e.if((0,t._)`${n} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,t._)`${r} || {}`).code((0,t._)`Object.assign(${r}, ${n})`))}),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>{n===!0?e.assign(r,!0):(e.assign(r,(0,t._)`${r} || {}`),g(e,r,n))}),mergeValues:(e,t)=>e===!0||{...e,...t},resultToName:h}),items:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>e.assign(r,(0,t._)`${n} === true ? true : ${r} > ${n} ? ${r} : ${n}`)),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>e.assign(r,n===!0||(0,t._)`${r} > ${n} ? ${r} : ${n}`)),mergeValues:(e,t)=>e===!0||Math.max(e,t),resultToName:(e,t)=>e.var(`items`,t)})};function h(e,n){if(n===!0)return e.var(`props`,!0);let r=e.var(`props`,(0,t._)`{}`);return n!==void 0&&g(e,r,n),r}e.evaluatedPropsToName=h;function g(e,n,r){Object.keys(r).forEach(r=>e.assign((0,t._)`${n}${(0,t.getProperty)(r)}`,!0))}e.setEvaluated=g;let _={};function v(e,t){return e.scopeValue(`func`,{ref:t,code:_[t.code]||(_[t.code]=new n._Code(t.code))})}e.useFunc=v;var y;(function(e){e[e.Num=0]=`Num`,e[e.Str=1]=`Str`})(y||(e.Type=y={}));function b(e,n,r){if(e instanceof t.Name){let i=n===y.Num;return r?i?(0,t._)`"[" + ${e} + "]"`:(0,t._)`"['" + ${e} + "']"`:i?(0,t._)`"/" + ${e}`:(0,t._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,t.getProperty)(e).toString():`/`+d(e)}e.getErrorPath=b;function x(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}}e.checkStrictMode=x})),Cg=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Q();e.default={data:new t.Name(`data`),valCxt:new t.Name(`valCxt`),instancePath:new t.Name(`instancePath`),parentData:new t.Name(`parentData`),parentDataProperty:new t.Name(`parentDataProperty`),rootData:new t.Name(`rootData`),dynamicAnchors:new t.Name(`dynamicAnchors`),vErrors:new t.Name(`vErrors`),errors:new t.Name(`errors`),this:new t.Name(`this`),self:new t.Name(`self`),scope:new t.Name(`scope`),json:new t.Name(`json`),jsonPos:new t.Name(`jsonPos`),jsonLen:new t.Name(`jsonLen`),jsonPart:new t.Name(`jsonPart`)}})),wg=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=Q(),n=$(),r=Cg();e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,t.str)`"${e}" keyword must be ${n} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`};function i(n,r=e.keywordError,i,a){let{it:o}=n,{gen:s,compositeRule:u,allErrors:f}=o,p=d(n,r,i);a??(u||f)?c(s,p):l(o,(0,t._)`[${p}]`)}e.reportError=i;function a(t,n=e.keywordError,i){let{it:a}=t,{gen:o,compositeRule:s,allErrors:u}=a;c(o,d(t,n,i)),s||u||l(a,r.default.vErrors)}e.reportExtraError=a;function o(e,n){e.assign(r.default.errors,n),e.if((0,t._)`${r.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,t._)`${r.default.vErrors}.length`,n),()=>e.assign(r.default.vErrors,null)))}e.resetErrorsCount=o;function s({gen:e,keyword:n,schemaValue:i,data:a,errsCount:o,it:s}){if(o===void 0)throw Error(`ajv implementation error`);let c=e.name(`err`);e.forRange(`i`,o,r.default.errors,o=>{e.const(c,(0,t._)`${r.default.vErrors}[${o}]`),e.if((0,t._)`${c}.instancePath === undefined`,()=>e.assign((0,t._)`${c}.instancePath`,(0,t.strConcat)(r.default.instancePath,s.errorPath))),e.assign((0,t._)`${c}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${n}`),s.opts.verbose&&(e.assign((0,t._)`${c}.schema`,i),e.assign((0,t._)`${c}.data`,a))})}e.extendErrors=s;function c(e,n){let i=e.const(`err`,n);e.if((0,t._)`${r.default.vErrors} === null`,()=>e.assign(r.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${r.default.vErrors}.push(${i})`),e.code((0,t._)`${r.default.errors}++`)}function l(e,n){let{gen:r,validateName:i,schemaEnv:a}=e;a.$async?r.throw((0,t._)`new ${e.ValidationError}(${n})`):(r.assign((0,t._)`${i}.errors`,n),r.return(!1))}let u={keyword:new t.Name(`keyword`),schemaPath:new t.Name(`schemaPath`),params:new t.Name(`params`),propertyName:new t.Name(`propertyName`),message:new t.Name(`message`),schema:new t.Name(`schema`),parentSchema:new t.Name(`parentSchema`)};function d(e,n,r){let{createErrors:i}=e.it;return i===!1?(0,t._)`{}`:f(e,n,r)}function f(e,t,n={}){let{gen:r,it:i}=e,a=[p(i,n),m(e,n)];return h(e,t,a),r.object(...a)}function p({errorPath:e},{instancePath:i}){let a=i?(0,t.str)`${e}${(0,n.getErrorPath)(i,n.Type.Str)}`:e;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,a)]}function m({keyword:e,it:{errSchemaPath:r}},{schemaPath:i,parentSchema:a}){let o=a?r:(0,t.str)`${r}/${e}`;return i&&(o=(0,t.str)`${o}${(0,n.getErrorPath)(i,n.Type.Str)}`),[u.schemaPath,o]}function h(e,{params:n,message:i},a){let{keyword:o,data:s,schemaValue:c,it:l}=e,{opts:d,propertyName:f,topSchemaRef:p,schemaPath:m}=l;a.push([u.keyword,o],[u.params,typeof n==`function`?n(e):n||(0,t._)`{}`]),d.messages&&a.push([u.message,typeof i==`function`?i(e):i]),d.verbose&&a.push([u.schema,c],[u.parentSchema,(0,t._)`${p}${m}`],[r.default.data,s]),f&&a.push([u.propertyName,f])}})),Tg=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=wg(),n=Q(),r=Cg(),i={message:`boolean schema is false`};function a(e){let{gen:t,schema:i,validateName:a}=e;i===!1?s(e,!1):typeof i==`object`&&i.$async===!0?t.return(r.default.data):(t.assign((0,n._)`${a}.errors`,null),t.return(!0))}e.topBoolOrEmptySchema=a;function o(e,t){let{gen:n,schema:r}=e;r===!1?(n.var(t,!1),s(e)):n.var(t,!0)}e.boolOrEmptySchema=o;function s(e,n){let{gen:r,data:a}=e,o={gen:r,keyword:`false schema`,data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,t.reportError)(o,i,void 0,n)}})),Eg=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set([`string`,`number`,`integer`,`boolean`,`null`,`object`,`array`]);function n(e){return typeof e==`string`&&t.has(e)}e.isJSONType=n;function r(){let e={number:{type:`number`,rules:[]},string:{type:`string`,rules:[]},array:{type:`array`,rules:[]},object:{type:`object`,rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=r})),Dg=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&n(e,i)}e.schemaHasRulesForType=t;function n(e,t){return t.rules.some(t=>r(e,t))}e.shouldUseGroup=n;function r(e,t){return e[t.keyword]!==void 0||t.definition.implements?.some(t=>e[t]!==void 0)}e.shouldUseRule=r})),Og=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let t=Eg(),n=Dg(),r=wg(),i=Q(),a=$();var o;(function(e){e[e.Correct=0]=`Correct`,e[e.Wrong=1]=`Wrong`})(o||(e.DataType=o={}));function s(e){let t=c(e.type);if(t.includes(`null`)){if(e.nullable===!1)throw Error(`type: null contradicts nullable: false`)}else{if(!t.length&&e.nullable!==void 0)throw Error(`"nullable" cannot be used without "type"`);e.nullable===!0&&t.push(`null`)}return t}e.getSchemaTypes=s;function c(e){let n=Array.isArray(e)?e:e?[e]:[];if(n.every(t.isJSONType))return n;throw Error(`type must be JSONType or JSONType[]: `+n.join(`,`))}e.getJSONTypes=c;function l(e,t){let{gen:r,data:i,opts:a}=e,s=d(t,a.coerceTypes),c=t.length>0&&!(s.length===0&&t.length===1&&(0,n.schemaHasRulesForType)(e,t[0]));if(c){let n=h(t,i,a.strictNumbers,o.Wrong);r.if(n,()=>{s.length?f(e,t,s):_(e)})}return c}e.coerceAndCheckDataType=l;let u=new Set([`string`,`number`,`integer`,`boolean`,`null`]);function d(e,t){return t?e.filter(e=>u.has(e)||t===`array`&&e===`array`):[]}function f(e,t,n){let{gen:r,data:a,opts:o}=e,s=r.let(`dataType`,(0,i._)`typeof ${a}`),c=r.let(`coerced`,(0,i._)`undefined`);o.coerceTypes===`array`&&r.if((0,i._)`${s} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>r.assign(a,(0,i._)`${a}[0]`).assign(s,(0,i._)`typeof ${a}`).if(h(t,a,o.strictNumbers),()=>r.assign(c,a))),r.if((0,i._)`${c} !== undefined`);for(let e of n)(u.has(e)||e===`array`&&o.coerceTypes===`array`)&&l(e);r.else(),_(e),r.endIf(),r.if((0,i._)`${c} !== undefined`,()=>{r.assign(a,c),p(e,c)});function l(e){switch(e){case`string`:r.elseIf((0,i._)`${s} == "number" || ${s} == "boolean"`).assign(c,(0,i._)`"" + ${a}`).elseIf((0,i._)`${a} === null`).assign(c,(0,i._)`""`);return;case`number`:r.elseIf((0,i._)`${s} == "boolean" || ${a} === null
|| (${s} == "string" && ${a} && ${a} == +${a})`).assign(c,(0,i._)`+${a}`);return;case`integer`:r.elseIf((0,i._)`${s} === "boolean" || ${a} === null
|| (${s} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(c,(0,i._)`+${a}`);return;case`boolean`:r.elseIf((0,i._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(c,!1).elseIf((0,i._)`${a} === "true" || ${a} === 1`).assign(c,!0);return;case`null`:r.elseIf((0,i._)`${a} === "" || ${a} === 0 || ${a} === false`),r.assign(c,null);return;case`array`:r.elseIf((0,i._)`${s} === "string" || ${s} === "number"
|| ${s} === "boolean" || ${a} === null`).assign(c,(0,i._)`[${a}]`)}}}function p({gen:e,parentData:t,parentDataProperty:n},r){e.if((0,i._)`${t} !== undefined`,()=>e.assign((0,i._)`${t}[${n}]`,r))}function m(e,t,n,r=o.Correct){let a=r===o.Correct?i.operators.EQ:i.operators.NEQ,s;switch(e){case`null`:return(0,i._)`${t} ${a} null`;case`array`:s=(0,i._)`Array.isArray(${t})`;break;case`object`:s=(0,i._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case`integer`:s=c((0,i._)`!(${t} % 1) && !isNaN(${t})`);break;case`number`:s=c();break;default:return(0,i._)`typeof ${t} ${a} ${e}`}return r===o.Correct?s:(0,i.not)(s);function c(e=i.nil){return(0,i.and)((0,i._)`typeof ${t} == "number"`,e,n?(0,i._)`isFinite(${t})`:i.nil)}}e.checkDataType=m;function h(e,t,n,r){if(e.length===1)return m(e[0],t,n,r);let o,s=(0,a.toHash)(e);if(s.array&&s.object){let e=(0,i._)`typeof ${t} != "object"`;o=s.null?e:(0,i._)`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else o=i.nil;s.number&&delete s.integer;for(let e in s)o=(0,i.and)(o,m(e,t,n,r));return o}e.checkDataTypes=h;let g={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e==`string`?(0,i._)`{type: ${e}}`:(0,i._)`{type: ${t}}`};function _(e){let t=v(e);(0,r.reportError)(t,g)}e.reportTypeError=_;function v(e){let{gen:t,data:n,schema:r}=e,i=(0,a.schemaRefOrVal)(e,r,`type`);return{gen:t,keyword:`type`,data:n,schema:r.type,schemaCode:i,schemaValue:i,parentSchema:r,params:{},it:e}}})),kg=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=Q(),n=$();function r(e,t){let{properties:n,items:r}=e.schema;if(t===`object`&&n)for(let t in n)i(e,t,n[t].default);else t===`array`&&Array.isArray(r)&&r.forEach((t,n)=>i(e,n,t.default))}e.assignDefaults=r;function i(e,r,i){let{gen:a,compositeRule:o,data:s,opts:c}=e;if(i===void 0)return;let l=(0,t._)`${s}${(0,t.getProperty)(r)}`;if(o){(0,n.checkStrictMode)(e,`default is ignored for: ${l}`);return}let u=(0,t._)`${l} === undefined`;c.useDefaults===`empty`&&(u=(0,t._)`${u} || ${l} === null || ${l} === ""`),a.if(u,(0,t._)`${l} = ${(0,t.stringify)(i)}`)}})),Ag=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;let t=Q(),n=$(),r=Cg(),i=$();function a(e,n){let{gen:r,data:i,it:a}=e;r.if(d(r,i,n,a.opts.ownProperties),()=>{e.setParams({missingProperty:(0,t._)`${n}`},!0),e.error()})}e.checkReportMissingProp=a;function o({gen:e,data:n,it:{opts:r}},i,a){return(0,t.or)(...i.map(i=>(0,t.and)(d(e,n,i,r.ownProperties),(0,t._)`${a} = ${i}`)))}e.checkMissingProp=o;function s(e,t){e.setParams({missingProperty:t},!0),e.error()}e.reportMissingProp=s;function c(e){return e.scopeValue(`func`,{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}e.hasPropFunc=c;function l(e,n,r){return(0,t._)`${c(e)}.call(${n}, ${r})`}e.isOwnProperty=l;function u(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} !== undefined`;return i?(0,t._)`${a} && ${l(e,n,r)}`:a}e.propertyInData=u;function d(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} === undefined`;return i?(0,t.or)(a,(0,t.not)(l(e,n,r))):a}e.noPropertyInData=d;function f(e){return e?Object.keys(e).filter(e=>e!==`__proto__`):[]}e.allSchemaProperties=f;function p(e,t){return f(t).filter(r=>!(0,n.alwaysValidSchema)(e,t[r]))}e.schemaProperties=p;function m({schemaCode:e,data:n,it:{gen:i,topSchemaRef:a,schemaPath:o,errorPath:s},it:c},l,u,d){let f=d?(0,t._)`${e}, ${n}, ${a}${o}`:n,p=[[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,s)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&p.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);let m=(0,t._)`${f}, ${i.object(...p)}`;return u===t.nil?(0,t._)`${l}(${m})`:(0,t._)`${l}.call(${u}, ${m})`}e.callValidateCode=m;let h=(0,t._)`new RegExp`;function g({gen:e,it:{opts:n}},r){let a=n.unicodeRegExp?`u`:``,{regExp:o}=n.code,s=o(r,a);return e.scopeValue(`pattern`,{key:s.toString(),ref:s,code:(0,t._)`${o.code===`new RegExp`?h:(0,i.useFunc)(e,o)}(${r}, ${a})`})}e.usePattern=g;function _(e){let{gen:r,data:i,keyword:a,it:o}=e,s=r.name(`valid`);if(o.allErrors){let e=r.let(`valid`,!0);return c(()=>r.assign(e,!1)),e}return r.var(s,!0),c(()=>r.break()),s;function c(o){let c=r.const(`len`,(0,t._)`${i}.length`);r.forRange(`i`,0,c,i=>{e.subschema({keyword:a,dataProp:i,dataPropType:n.Type.Num},s),r.if((0,t.not)(s),o)})}}e.validateArray=_;function v(e){let{gen:r,schema:i,keyword:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(i.some(e=>(0,n.alwaysValidSchema)(o,e))&&!o.opts.unevaluated)return;let s=r.let(`valid`,!1),c=r.name(`_valid`);r.block(()=>i.forEach((n,i)=>{let o=e.subschema({keyword:a,schemaProp:i,compositeRule:!0},c);r.assign(s,(0,t._)`${s} || ${c}`),e.mergeValidEvaluated(o,c)||r.if((0,t.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}e.validateUnion=v})),jg=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=Q(),n=Cg(),r=Ag(),i=wg();function a(e,n){let{gen:r,keyword:i,schema:a,parentSchema:o,it:s}=e,c=n.macro.call(s.self,a,o,s),l=u(r,i,c);s.opts.validateSchema!==!1&&s.self.validateSchema(c,!0);let d=r.name(`valid`);e.subschema({schema:c,schemaPath:t.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:l,compositeRule:!0},d),e.pass(d,()=>e.error(!0))}e.macroKeywordCode=a;function o(e,i){let{gen:a,keyword:o,schema:d,parentSchema:f,$data:p,it:m}=e;l(m,i);let h=u(a,o,!p&&i.compile?i.compile.call(m.self,d,f,m):i.validate),g=a.let(`valid`);e.block$data(g,_),e.ok(i.valid??g);function _(){if(i.errors===!1)b(),i.modifying&&s(e),x(()=>e.error());else{let t=i.async?v():y();i.modifying&&s(e),x(()=>c(e,t))}}function v(){let e=a.let(`ruleErrs`,null);return a.try(()=>b((0,t._)`await `),n=>a.assign(g,!1).if((0,t._)`${n} instanceof ${m.ValidationError}`,()=>a.assign(e,(0,t._)`${n}.errors`),()=>a.throw(n))),e}function y(){let e=(0,t._)`${h}.errors`;return a.assign(e,null),b(t.nil),e}function b(o=i.async?(0,t._)`await `:t.nil){let s=m.opts.passContext?n.default.this:n.default.self,c=!(`compile`in i&&!p||i.schema===!1);a.assign(g,(0,t._)`${o}${(0,r.callValidateCode)(e,h,s,c)}`,i.modifying)}function x(e){a.if((0,t.not)(i.valid??g),e)}}e.funcKeywordCode=o;function s(e){let{gen:n,data:r,it:i}=e;n.if(i.parentData,()=>n.assign(r,(0,t._)`${i.parentData}[${i.parentDataProperty}]`))}function c(e,r){let{gen:a}=e;a.if((0,t._)`Array.isArray(${r})`,()=>{a.assign(n.default.vErrors,(0,t._)`${n.default.vErrors} === null ? ${r} : ${n.default.vErrors}.concat(${r})`).assign(n.default.errors,(0,t._)`${n.default.vErrors}.length`),(0,i.extendErrors)(e)},()=>e.error())}function l({schemaEnv:e},t){if(t.async&&!e.$async)throw Error(`async keyword in sync schema`)}function u(e,n,r){if(r===void 0)throw Error(`keyword "${n}" failed to compile`);return e.scopeValue(`keyword`,typeof r==`function`?{ref:r}:{ref:r,code:(0,t.stringify)(r)})}function d(e,t,n=!1){return!t.length||t.some(t=>t===`array`?Array.isArray(e):t===`object`?e&&typeof e==`object`&&!Array.isArray(e):typeof e==t||n&&e===void 0)}e.validSchemaType=d;function f({schema:e,opts:t,self:n,errSchemaPath:r},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw Error(`ajv implementation error`);let o=i.dependencies;if(o?.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${a}: ${o.join(`,`)}`);if(i.validateSchema&&!i.validateSchema(e[a])){let e=`keyword "${a}" value is invalid at path "${r}": `+n.errorsText(i.validateSchema.errors);if(t.validateSchema===`log`)n.logger.error(e);else throw Error(e)}}e.validateKeywordUsage=f})),Mg=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=Q(),n=$();function r(e,{keyword:r,schemaProp:i,schema:a,schemaPath:o,errSchemaPath:s,topSchemaRef:c}){if(r!==void 0&&a!==void 0)throw Error(`both "keyword" and "schema" passed, only one allowed`);if(r!==void 0){let a=e.schema[r];return i===void 0?{schema:a,schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${r}`}:{schema:a[i],schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}${(0,t.getProperty)(i)}`,errSchemaPath:`${e.errSchemaPath}/${r}/${(0,n.escapeFragment)(i)}`}}if(a!==void 0){if(o===void 0||s===void 0||c===void 0)throw Error(`"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"`);return{schema:a,schemaPath:o,topSchemaRef:c,errSchemaPath:s}}throw Error(`either "keyword" or "schema" must be passed`)}e.getSubschema=r;function i(e,r,{dataProp:i,dataPropType:a,data:o,dataTypes:s,propertyName:c}){if(o!==void 0&&i!==void 0)throw Error(`both "data" and "dataProp" passed, only one allowed`);let{gen:l}=r;if(i!==void 0){let{errorPath:o,dataPathArr:s,opts:c}=r;u(l.let(`data`,(0,t._)`${r.data}${(0,t.getProperty)(i)}`,!0)),e.errorPath=(0,t.str)`${o}${(0,n.getErrorPath)(i,a,c.jsPropertySyntax)}`,e.parentDataProperty=(0,t._)`${i}`,e.dataPathArr=[...s,e.parentDataProperty]}o!==void 0&&(u(o instanceof t.Name?o:l.let(`data`,o,!0)),c!==void 0&&(e.propertyName=c)),s&&(e.dataTypes=s);function u(t){e.data=t,e.dataLevel=r.dataLevel+1,e.dataTypes=[],r.definedProperties=new Set,e.parentData=r.data,e.dataNames=[...r.dataNames,t]}}e.extendSubschemaData=i;function a(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:i,allErrors:a}){r!==void 0&&(e.compositeRule=r),i!==void 0&&(e.createErrors=i),a!==void 0&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=n}e.extendSubschemaMode=a})),Ng=o(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}})),Pg=o(((e,t)=>{var n=t.exports=function(e,t,n){typeof t==`function`&&(n=t,t={}),n=t.cb||n;var i=typeof n==`function`?n:n.pre||function(){},a=n.post||function(){};r(t,i,a,e,``,e)};n.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},n.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},n.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},n.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function r(e,t,a,o,s,c,l,u,d,f){if(o&&typeof o==`object`&&!Array.isArray(o)){for(var p in t(o,s,c,l,u,d,f),o){var m=o[p];if(Array.isArray(m)){if(p in n.arrayKeywords)for(var h=0;h<m.length;h++)r(e,t,a,m[h],s+`/`+p+`/`+h,c,s,p,o,h)}else if(p in n.propsKeywords){if(m&&typeof m==`object`)for(var g in m)r(e,t,a,m[g],s+`/`+p+`/`+i(g),c,s,p,o,g)}else(p in n.keywords||e.allKeys&&!(p in n.skipKeywords))&&r(e,t,a,m,s+`/`+p,c,s,p,o)}a(o,s,c,l,u,d,f)}}function i(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}})),Fg=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=$(),n=Ng(),r=Pg(),i=new Set([`type`,`format`,`pattern`,`maxLength`,`minLength`,`maxProperties`,`minProperties`,`maxItems`,`minItems`,`maximum`,`minimum`,`uniqueItems`,`multipleOf`,`required`,`enum`,`const`]);function a(e,t=!0){return typeof e==`boolean`?!0:t===!0?!s(e):t?c(e)<=t:!1}e.inlineRef=a;let o=new Set([`$ref`,`$recursiveRef`,`$recursiveAnchor`,`$dynamicRef`,`$dynamicAnchor`]);function s(e){for(let t in e){if(o.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(s)||typeof n==`object`&&s(n))return!0}return!1}function c(e){let n=0;for(let r in e)if(r===`$ref`||(n++,!i.has(r)&&(typeof e[r]==`object`&&(0,t.eachItem)(e[r],e=>n+=c(e)),n===1/0)))return 1/0;return n}function l(e,t=``,n){return n!==!1&&(t=f(t)),u(e,e.parse(t))}e.getFullPath=l;function u(e,t){return e.serialize(t).split(`#`)[0]+`#`}e._getFullPath=u;let d=/#\/?$/;function f(e){return e?e.replace(d,``):``}e.normalizeId=f;function p(e,t,n){return n=f(n),e.resolve(t,n)}e.resolveUrl=p;let m=/^[a-z_][-a-z0-9._]*$/i;function h(e,t){if(typeof e==`boolean`)return{};let{schemaId:i,uriResolver:a}=this.opts,o=f(e[i]||t),s={"":o},c=l(a,o,!1),u={},d=new Set;return r(e,{allKeys:!0},(e,t,n,r)=>{if(r===void 0)return;let a=c+t,o=s[r];typeof e[i]==`string`&&(o=l.call(this,e[i])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),s[t]=o;function l(t){let n=this.opts.uriResolver.resolve;if(t=f(o?n(o,t):t),d.has(t))throw h(t);d.add(t);let r=this.refs[t];return typeof r==`string`&&(r=this.refs[r]),typeof r==`object`?p(e,r.schema,t):t!==f(a)&&(t[0]===`#`?(p(e,u[t],t),u[t]=e):this.refs[t]=a),t}function g(e){if(typeof e==`string`){if(!m.test(e))throw Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}}),u;function p(e,t,r){if(t!==void 0&&!n(e,t))throw h(r)}function h(e){return Error(`reference "${e}" resolves to more than one schema`)}}e.getSchemaRefs=h})),Ig=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=Tg(),n=Og(),r=Dg(),i=Og(),a=kg(),o=jg(),s=Mg(),c=Q(),l=Cg(),u=Fg(),d=$(),f=wg();function p(e){if(ee(e)&&(ne(e),x(e))){_(e);return}m(e,()=>(0,t.topBoolOrEmptySchema)(e))}e.validateFunctionCode=p;function m({gen:e,validateName:t,schema:n,schemaEnv:r,opts:i},a){i.code.es5?e.func(t,(0,c._)`${l.default.data}, ${l.default.valCxt}`,r.$async,()=>{e.code((0,c._)`"use strict"; ${y(n,i)}`),g(e,i),e.code(a)}):e.func(t,(0,c._)`${l.default.data}, ${h(i)}`,r.$async,()=>e.code(y(n,i)).code(a))}function h(e){return(0,c._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${e.dynamicRef?(0,c._)`, ${l.default.dynamicAnchors}={}`:c.nil}}={}`}function g(e,t){e.if(l.default.valCxt,()=>{e.var(l.default.instancePath,(0,c._)`${l.default.valCxt}.${l.default.instancePath}`),e.var(l.default.parentData,(0,c._)`${l.default.valCxt}.${l.default.parentData}`),e.var(l.default.parentDataProperty,(0,c._)`${l.default.valCxt}.${l.default.parentDataProperty}`),e.var(l.default.rootData,(0,c._)`${l.default.valCxt}.${l.default.rootData}`),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{e.var(l.default.instancePath,(0,c._)`""`),e.var(l.default.parentData,(0,c._)`undefined`),e.var(l.default.parentDataProperty,(0,c._)`undefined`),e.var(l.default.rootData,l.default.data),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`{}`)})}function _(e){let{schema:t,opts:n,gen:r}=e;m(e,()=>{n.$comment&&t.$comment&&oe(e),re(e),r.let(l.default.vErrors,null),r.let(l.default.errors,0),n.unevaluated&&v(e),S(e),se(e)})}function v(e){let{gen:t,validateName:n}=e;e.evaluated=t.const(`evaluated`,(0,c._)`${n}.evaluated`),t.if((0,c._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,c._)`${e.evaluated}.props`,(0,c._)`undefined`)),t.if((0,c._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,c._)`${e.evaluated}.items`,(0,c._)`undefined`))}function y(e,t){let n=typeof e==`object`&&e[t.schemaId];return n&&(t.code.source||t.code.process)?(0,c._)`/*# sourceURL=${n} */`:c.nil}function b(e,n){if(ee(e)&&(ne(e),x(e))){te(e,n);return}(0,t.boolOrEmptySchema)(e,n)}function x({schema:e,self:t}){if(typeof e==`boolean`)return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function ee(e){return typeof e.schema!=`boolean`}function te(e,t){let{schema:n,gen:r,opts:i}=e;i.$comment&&n.$comment&&oe(e),ie(e),ae(e);let a=r.const(`_errs`,l.default.errors);S(e,a),r.var(t,(0,c._)`${a} === ${l.default.errors}`)}function ne(e){(0,d.checkUnknownRules)(e),C(e)}function S(e,t){if(e.opts.jtd)return le(e,[],!1,t);let r=(0,n.getSchemaTypes)(e.schema);le(e,r,!(0,n.coerceAndCheckDataType)(e,r),t)}function C(e){let{schema:t,errSchemaPath:n,opts:r,self:i}=e;t.$ref&&r.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function re(e){let{schema:t,opts:n}=e;t.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,d.checkStrictMode)(e,`default is ignored in the schema root`)}function ie(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,u.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function ae(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error(`async schema in sync schema`)}function oe({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:i}){let a=n.$comment;if(i.$comment===!0)e.code((0,c._)`${l.default.self}.logger.log(${a})`);else if(typeof i.$comment==`function`){let n=(0,c.str)`${r}/$comment`,i=e.scopeValue(`root`,{ref:t.root});e.code((0,c._)`${l.default.self}.opts.$comment(${a}, ${n}, ${i}.schema)`)}}function se(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:i,opts:a}=e;n.$async?t.if((0,c._)`${l.default.errors} === 0`,()=>t.return(l.default.data),()=>t.throw((0,c._)`new ${i}(${l.default.vErrors})`)):(t.assign((0,c._)`${r}.errors`,l.default.vErrors),a.unevaluated&&ce(e),t.return((0,c._)`${l.default.errors} === 0`))}function ce({gen:e,evaluated:t,props:n,items:r}){n instanceof c.Name&&e.assign((0,c._)`${t}.props`,n),r instanceof c.Name&&e.assign((0,c._)`${t}.items`,r)}function le(e,t,n,a){let{gen:o,schema:s,data:u,allErrors:f,opts:p,self:m}=e,{RULES:h}=m;if(s.$ref&&(p.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(s,h))){o.block(()=>ve(e,`$ref`,h.all.$ref.definition));return}p.jtd||de(e,t),o.block(()=>{for(let e of h.rules)g(e);g(h.post)});function g(d){(0,r.shouldUseGroup)(s,d)&&(d.type?(o.if((0,i.checkDataType)(d.type,u,p.strictNumbers)),ue(e,d),t.length===1&&t[0]===d.type&&n&&(o.else(),(0,i.reportTypeError)(e)),o.endIf()):ue(e,d),f||o.if((0,c._)`${l.default.errors} === ${a||0}`))}}function ue(e,t){let{gen:n,schema:i,opts:{useDefaults:o}}=e;o&&(0,a.assignDefaults)(e,t.type),n.block(()=>{for(let n of t.rules)(0,r.shouldUseRule)(i,n)&&ve(e,n.keyword,n.definition,t.type)})}function de(e,t){!e.schemaEnv.meta&&e.opts.strictTypes&&(w(e,t),e.opts.allowUnionTypes||T(e,t),fe(e,e.dataTypes))}function w(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{me(e.dataTypes,t)||ge(e,`type "${t}" not allowed by context "${e.dataTypes.join(`,`)}"`)}),he(e,t)}}function T(e,t){t.length>1&&!(t.length===2&&t.includes(`null`))&&ge(e,`use allowUnionTypes to allow union type keyword`)}function fe(e,t){let n=e.self.RULES.all;for(let i in n){let a=n[i];if(typeof a==`object`&&(0,r.shouldUseRule)(e.schema,a)){let{type:n}=a.definition;n.length&&!n.some(e=>pe(t,e))&&ge(e,`missing type "${n.join(`,`)}" for keyword "${i}"`)}}}function pe(e,t){return e.includes(t)||t===`number`&&e.includes(`integer`)}function me(e,t){return e.includes(t)||t===`integer`&&e.includes(`number`)}function he(e,t){let n=[];for(let r of e.dataTypes)me(t,r)?n.push(r):t.includes(`integer`)&&r===`number`&&n.push(`integer`);e.dataTypes=n}function ge(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}var _e=class{constructor(e,t,n){if((0,o.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const(`vSchema`,xe(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,o.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);(`code`in t?t.trackErrors:t.errors!==!1)&&(this.errsCount=e.gen.const(`_errs`,l.default.errors))}result(e,t,n){this.failResult((0,c.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,c.not)(e),void 0,t)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,c._)`${t} !== undefined && (${(0,c.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t){this.setParams(t),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,t){(e?f.reportExtraError:f.reportError)(this,this.def.error,t)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error(`add "trackErrors" to keyword definition`);(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,n=c.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=c.nil,t=c.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:i,def:a}=this;n.if((0,c.or)((0,c._)`${r} === undefined`,t)),e!==c.nil&&n.assign(e,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==c.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:a}=this;return(0,c.or)(o(),s());function o(){if(n.length){if(!(t instanceof c.Name))throw Error(`ajv implementation error`);let e=Array.isArray(n)?n:[n];return(0,c._)`${(0,i.checkDataTypes)(e,t,a.opts.strictNumbers,i.DataType.Wrong)}`}return c.nil}function s(){if(r.validateSchema){let n=e.scopeValue(`validate$data`,{ref:r.validateSchema});return(0,c._)`!${n}(${t})`}return c.nil}}subschema(e,t){let n=(0,s.getSubschema)(this.it,e);(0,s.extendSubschemaData)(n,this.it,e),(0,s.extendSubschemaMode)(n,e);let r={...this.it,...n,items:void 0,props:void 0};return b(r,t),r}mergeEvaluated(e,t){let{it:n,gen:r}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=d.mergeEvaluated.props(r,e.props,n.props,t)),n.items!==!0&&e.items!==void 0&&(n.items=d.mergeEvaluated.items(r,e.items,n.items,t)))}mergeValidEvaluated(e,t){let{it:n,gen:r}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return r.if(t,()=>this.mergeEvaluated(e,c.Name)),!0}};e.KeywordCxt=_e;function ve(e,t,n,r){let i=new _e(e,n,t);`code`in n?n.code(i,r):i.$data&&n.validate?(0,o.funcKeywordCode)(i,n):`macro`in n?(0,o.macroKeywordCode)(i,n):(n.compile||n.validate)&&(0,o.funcKeywordCode)(i,n)}let ye=/^\/(?:[^~]|~0|~1)*$/,be=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function xe(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let i,a;if(e===``)return l.default.rootData;if(e[0]===`/`){if(!ye.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,a=l.default.rootData}else{let o=be.exec(e);if(!o)throw Error(`Invalid JSON-pointer: ${e}`);let s=+o[1];if(i=o[2],i===`#`){if(s>=t)throw Error(u(`property/index`,s));return r[t-s]}if(s>t)throw Error(u(`data`,s));if(a=n[t-s],!i)return a}let o=a,s=i.split(`/`);for(let e of s)e&&(a=(0,c._)`${a}${(0,c.getProperty)((0,d.unescapeJsonPointer)(e))}`,o=(0,c._)`${o} && ${a}`);return o;function u(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}e.getData=xe})),Lg=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=class extends Error{constructor(e){super(`validation failed`),this.errors=e,this.ajv=this.validation=!0}}})),Rg=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Fg();e.default=class extends Error{constructor(e,n,r,i){super(i||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,t.resolveUrl)(e,n,r),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}}})),zg=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=Q(),n=Lg(),r=Cg(),i=Fg(),a=$(),o=Ig();var s=class{constructor(e){this.refs={},this.dynamicAnchors={};let t;typeof e.schema==`object`&&(t=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=e.baseId??(0,i.normalizeId)(t?.[e.schemaId||`$id`]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=t?.$async,this.refs={}}};e.SchemaEnv=s;function c(e){let a=d.call(this,e);if(a)return a;let s=(0,i.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:c,lines:l}=this.opts.code,{ownProperties:u}=this.opts,f=new t.CodeGen(this.scope,{es5:c,lines:l,ownProperties:u}),p;e.$async&&(p=f.scopeValue(`Error`,{ref:n.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let m=f.scopeName(`validate`);e.validateName=m;let h={gen:f,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue(`schema`,this.opts.code.source===!0?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:p,schema:e.schema,schemaEnv:e,rootId:s,baseId:e.baseId||s,schemaPath:t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?``:`#`),errorPath:(0,t._)`""`,opts:this.opts,self:this},g;try{this._compilations.add(e),(0,o.validateFunctionCode)(h),f.optimize(this.opts.code.optimize);let n=f.toString();g=`${f.scopeRefs(r.default.scope)}return ${n}`,this.opts.code.process&&(g=this.opts.code.process(g,e));let i=Function(`${r.default.self}`,`${r.default.scope}`,g)(this,this.scope.get());if(this.scope.value(m,{ref:i}),i.errors=null,i.schema=e.schema,i.schemaEnv=e,e.$async&&(i.$async=!0),this.opts.code.source===!0&&(i.source={validateName:m,validateCode:n,scopeValues:f._values}),this.opts.unevaluated){let{props:e,items:n}=h;i.evaluated={props:e instanceof t.Name?void 0:e,items:n instanceof t.Name?void 0:n,dynamicProps:e instanceof t.Name,dynamicItems:n instanceof t.Name},i.source&&(i.source.evaluated=(0,t.stringify)(i.evaluated))}return e.validate=i,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error(`Error compiling schema, function code:`,g),t}finally{this._compilations.delete(e)}}e.compileSchema=c;function l(e,t,n){n=(0,i.resolveUrl)(this.opts.uriResolver,t,n);let r=e.refs[n];if(r)return r;let a=p.call(this,e,n);if(a===void 0){let r=e.localRefs?.[n],{schemaId:i}=this.opts;r&&(a=new s({schema:r,schemaId:i,root:e,baseId:t}))}if(a!==void 0)return e.refs[n]=u.call(this,a)}e.resolveRef=l;function u(e){return(0,i.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:c.call(this,e)}function d(e){for(let t of this._compilations)if(f(t,e))return t}e.getCompilingSchema=d;function f(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function p(e,t){let n;for(;typeof(n=this.refs[t])==`string`;)t=n;return n||this.schemas[t]||m.call(this,e,t)}function m(e,t){let n=this.opts.uriResolver.parse(t),r=(0,i._getFullPath)(this.opts.uriResolver,n),a=(0,i.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===a)return g.call(this,n,e);let o=(0,i.normalizeId)(r),l=this.refs[o]||this.schemas[o];if(typeof l==`string`){let t=m.call(this,e,l);return typeof t?.schema==`object`?g.call(this,n,t):void 0}if(typeof l?.schema==`object`){if(l.validate||c.call(this,l),o===(0,i.normalizeId)(t)){let{schema:t}=l,{schemaId:n}=this.opts,r=t[n];return r&&(a=(0,i.resolveUrl)(this.opts.uriResolver,a,r)),new s({schema:t,schemaId:n,root:e,baseId:a})}return g.call(this,n,l)}}e.resolveSchema=m;let h=new Set([`properties`,`patternProperties`,`enum`,`dependencies`,`definitions`]);function g(e,{baseId:t,schema:n,root:r}){if(e.fragment?.[0]!==`/`)return;for(let r of e.fragment.slice(1).split(`/`)){if(typeof n==`boolean`)return;let e=n[(0,a.unescapeFragment)(r)];if(e===void 0)return;n=e;let o=typeof n==`object`&&n[this.opts.schemaId];!h.has(r)&&o&&(t=(0,i.resolveUrl)(this.opts.uriResolver,t,o))}let o;if(typeof n!=`boolean`&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){let e=(0,i.resolveUrl)(this.opts.uriResolver,t,n.$ref);o=m.call(this,r,e)}let{schemaId:c}=this.opts;if(o||=new s({schema:n,schemaId:c,root:r,baseId:t}),o.schema!==o.root.schema)return o}})),Bg=o(((e,t)=>{t.exports={$id:`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`,description:`Meta-schema for $data reference (JSON AnySchema extension proposal)`,type:`object`,required:[`$data`],properties:{$data:{type:`string`,anyOf:[{format:`relative-json-pointer`},{format:`json-pointer`}]}},additionalProperties:!1}})),Vg=o(((e,t)=>{let n=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function i(e){let t=``,n=0,r=0;for(r=0;r<e.length;r++)if(n=e[r].charCodeAt(0),n!==48){if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r]}return t}let a=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function o(e){return e.length=0,!0}function s(e,t,n){if(e.length){let r=i(e);if(r!==``)t.push(r);else return n.error=!0,!1;e.length=0}return!0}function c(e){let t=0,n={error:!1,address:``,zone:``},r=[],a=[],c=!1,l=!1,u=s;for(let i=0;i<e.length;i++){let s=e[i];if(s!==`[`&&s!==`]`){if(s===`:`){if(c===!0&&(l=!0),!u(a,r,n))break;if(++t>7){n.error=!0;break}i>0&&e[i-1]===`:`&&(c=!0),r.push(`:`);continue}if(s===`%`){if(!u(a,r,n))break;u=o}else{a.push(s);continue}}}return a.length&&(u===o?n.zone=a.join(``):l?r.push(a.join(``)):r.push(i(a))),n.address=r.join(``),n}function l(e){if(u(e,`:`)<2)return{host:e,isIPV6:!1};let t=c(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,n=t.address;return t.zone&&(e+=`%`+t.zone,n+=`%25`+t.zone),{host:e,isIPV6:!0,escapedHost:n}}}function u(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}function d(e){let t=e,n=[],r=-1,i=0;for(;i=t.length;){if(i===1){if(t===`.`)break;if(t===`/`){n.push(`/`);break}n.push(t);break}if(i===2){if(t[0]===`.`){if(t[1]===`.`)break;if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&(t[1]===`.`||t[1]===`/`)){n.push(`/`);break}}else if(i===3&&t===`/..`){n.length!==0&&n.pop(),n.push(`/`);break}if(t[0]===`.`){if(t[1]===`.`){if(t[2]===`/`){t=t.slice(3);continue}}else if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&t[1]===`.`){if(t[2]===`/`){t=t.slice(2);continue}if(t[2]===`.`&&t[3]===`/`){t=t.slice(3),n.length!==0&&n.pop();continue}}if((r=t.indexOf(`/`,1))===-1){n.push(t);break}n.push(t.slice(0,r)),t=t.slice(r)}return n.join(``)}function f(e,t){let n=t===!0?unescape:escape;return e.scheme!==void 0&&(e.scheme=n(e.scheme)),e.userinfo!==void 0&&(e.userinfo=n(e.userinfo)),e.host!==void 0&&(e.host=n(e.host)),e.path!==void 0&&(e.path=n(e.path)),e.query!==void 0&&(e.query=n(e.query)),e.fragment!==void 0&&(e.fragment=n(e.fragment)),e}function p(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push(`@`)),e.host!==void 0){let n=unescape(e.host);if(!r(n)){let t=l(n);n=t.isIPV6===!0?`[${t.escapedHost}]`:e.host}t.push(n)}return(typeof e.port==`number`||typeof e.port==`string`)&&(t.push(`:`),t.push(String(e.port))),t.length?t.join(``):void 0}t.exports={nonSimpleDomain:a,recomposeAuthority:p,normalizeComponentEncoding:f,removeDotSegments:d,isIPv4:r,isUUID:n,normalizeIPv6:l,stringArrayToHexStripped:i}})),Hg=o(((e,t)=>{let{isUUID:n}=Vg(),r=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,i=[`http`,`https`,`ws`,`wss`,`urn`,`urn:uuid`];function a(e){return i.indexOf(e)!==-1}function o(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]===`w`||e.scheme[0]===`W`)&&(e.scheme[1]===`s`||e.scheme[1]===`S`)&&(e.scheme[2]===`s`||e.scheme[2]===`S`):!1}function s(e){return e.host||(e.error=e.error||`HTTP URIs must have a host.`),e}function c(e){let t=String(e.scheme).toLowerCase()===`https`;return(e.port===(t?443:80)||e.port===``)&&(e.port=void 0),e.path||=`/`,e}function l(e){return e.secure=o(e),e.resourceName=(e.path||`/`)+(e.query?`?`+e.query:``),e.path=void 0,e.query=void 0,e}function u(e){if((e.port===(o(e)?443:80)||e.port===``)&&(e.port=void 0),typeof e.secure==`boolean`&&(e.scheme=e.secure?`wss`:`ws`,e.secure=void 0),e.resourceName){let[t,n]=e.resourceName.split(`?`);e.path=t&&t!==`/`?t:void 0,e.query=n,e.resourceName=void 0}return e.fragment=void 0,e}function d(e,t){if(!e.path)return e.error=`URN can not be parsed`,e;let n=e.path.match(r);if(n){let r=t.scheme||e.scheme||`urn`;e.nid=n[1].toLowerCase(),e.nss=n[2];let i=y(`${r}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||`URN can not be parsed.`;return e}function f(e,t){if(e.nid===void 0)throw Error(`URN without nid cannot be serialized`);let n=t.scheme||e.scheme||`urn`,r=e.nid.toLowerCase(),i=y(`${n}:${t.nid||r}`);i&&(e=i.serialize(e,t));let a=e,o=e.nss;return a.path=`${r||t.nid}:${o}`,t.skipEscape=!0,a}function p(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!n(r.uuid))&&(r.error=r.error||`UUID is not valid.`),r}function m(e){let t=e;return t.nss=(e.uuid||``).toLowerCase(),t}let h={scheme:`http`,domainHost:!0,parse:s,serialize:c},g={scheme:`https`,domainHost:h.domainHost,parse:s,serialize:c},_={scheme:`ws`,domainHost:!0,parse:l,serialize:u},v={http:h,https:g,ws:_,wss:{scheme:`wss`,domainHost:_.domainHost,parse:_.parse,serialize:_.serialize},urn:{scheme:`urn`,parse:d,serialize:f,skipNormalize:!0},"urn:uuid":{scheme:`urn:uuid`,parse:p,serialize:m,skipNormalize:!0}};Object.setPrototypeOf(v,null);function y(e){return e&&(v[e]||v[e.toLowerCase()])||void 0}t.exports={wsIsSecure:o,SCHEMES:v,isValidSchemeName:a,getSchemeHandler:y}})),Ug=o(((e,t)=>{let{normalizeIPv6:n,removeDotSegments:r,recomposeAuthority:i,normalizeComponentEncoding:a,isIPv4:o,nonSimpleDomain:s}=Vg(),{SCHEMES:c,getSchemeHandler:l}=Hg();function u(e,t){return typeof e==`string`?e=m(g(e,t),t):typeof e==`object`&&(e=g(m(e,t),t)),e}function d(e,t,n){let r=n?Object.assign({scheme:`null`},n):{scheme:`null`},i=f(g(e,r),g(t,r),r,!0);return r.skipEscape=!0,m(i,r)}function f(e,t,n,i){let a={};return i||(e=g(m(e,n),n),t=g(m(t,n),n)),n||={},!n.tolerant&&t.scheme?(a.scheme=t.scheme,a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.path?(t.path[0]===`/`?a.path=r(t.path):(a.path=(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?`/`+t.path:e.path?e.path.slice(0,e.path.lastIndexOf(`/`)+1)+t.path:t.path,a.path=r(a.path)),a.query=t.query):(a.path=e.path,a.query=t.query===void 0?e.query:t.query),a.userinfo=e.userinfo,a.host=e.host,a.port=e.port),a.scheme=e.scheme),a.fragment=t.fragment,a}function p(e,t,n){return typeof e==`string`?(e=unescape(e),e=m(a(g(e,n),!0),{...n,skipEscape:!0})):typeof e==`object`&&(e=m(a(e,!0),{...n,skipEscape:!0})),typeof t==`string`?(t=unescape(t),t=m(a(g(t,n),!0),{...n,skipEscape:!0})):typeof t==`object`&&(t=m(a(t,!0),{...n,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function m(e,t){let n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:``},a=Object.assign({},t),o=[],s=l(a.scheme||n.scheme);s&&s.serialize&&s.serialize(n,a),n.path!==void 0&&(a.skipEscape?n.path=unescape(n.path):(n.path=escape(n.path),n.scheme!==void 0&&(n.path=n.path.split(`%3A`).join(`:`)))),a.reference!==`suffix`&&n.scheme&&o.push(n.scheme,`:`);let c=i(n);if(c!==void 0&&(a.reference!==`suffix`&&o.push(`//`),o.push(c),n.path&&n.path[0]!==`/`&&o.push(`/`)),n.path!==void 0){let e=n.path;!a.absolutePath&&(!s||!s.absolutePath)&&(e=r(e)),c===void 0&&e[0]===`/`&&e[1]===`/`&&(e=`/%2F`+e.slice(2)),o.push(e)}return n.query!==void 0&&o.push(`?`,n.query),n.fragment!==void 0&&o.push(`#`,n.fragment),o.join(``)}let h=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function g(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:``,port:void 0,path:``,query:void 0,fragment:void 0},a=!1;r.reference===`suffix`&&(e=r.scheme?r.scheme+`:`+e:`//`+e);let c=e.match(h);if(c){if(i.scheme=c[1],i.userinfo=c[3],i.host=c[4],i.port=parseInt(c[5],10),i.path=c[6]||``,i.query=c[7],i.fragment=c[8],isNaN(i.port)&&(i.port=c[5]),i.host){if(o(i.host)===!1){let e=n(i.host);i.host=e.host.toLowerCase(),a=e.isIPV6}else a=!0}i.reference=i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path?`same-document`:i.scheme===void 0?`relative`:i.fragment===void 0?`absolute`:`uri`,r.reference&&r.reference!==`suffix`&&r.reference!==i.reference&&(i.error=i.error||`URI is not a `+r.reference+` reference.`);let t=l(r.scheme||i.scheme);if(!r.unicodeSupport&&(!t||!t.unicodeSupport)&&i.host&&(r.domainHost||t&&t.domainHost)&&a===!1&&s(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(e){i.error=i.error||`Host's domain name can not be converted to ASCII: `+e}(!t||t&&!t.skipNormalize)&&(e.indexOf(`%`)!==-1&&(i.scheme!==void 0&&(i.scheme=unescape(i.scheme)),i.host!==void 0&&(i.host=unescape(i.host))),i.path&&=escape(unescape(i.path)),i.fragment&&=encodeURI(decodeURIComponent(i.fragment))),t&&t.parse&&t.parse(i,r)}else i.error=i.error||`URI can not be parsed.`;return i}let _={SCHEMES:c,normalize:u,resolve:d,resolveComponent:f,equal:p,serialize:m,parse:g};t.exports=_,t.exports.default=_,t.exports.fastUri=_})),Wg=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ug();t.code=`require("ajv/dist/runtime/uri").default`,e.default=t})),Gg=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=Ig();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var n=Q();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return n.CodeGen}});let r=Lg(),i=Rg(),a=Eg(),o=zg(),s=Q(),c=Fg(),l=Og(),u=$(),d=Bg(),f=Wg(),p=(e,t)=>new RegExp(e,t);p.code=`new RegExp`;let m=[`removeAdditional`,`useDefaults`,`coerceTypes`],h=new Set([`validate`,`serialize`,`parse`,`wrapper`,`root`,`schema`,`keyword`,`pattern`,`formats`,`validate$data`,`func`,`obj`,`Error`]),g={errorDataPath:``,format:"`validateFormats: false` can be used instead.",nullable:`"nullable" keyword is supported by default.`,jsonPointers:`Deprecated jsPropertySyntax can be used instead.`,extendRefs:`Deprecated ignoreKeywordsWithRef can be used instead.`,missingRefs:`Pass empty schema with $id that should be ignored to ajv.addSchema.`,processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:`"uniqueItems" keyword is always validated.`,unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:`Map is used as cache, schema object as key.`,serialize:`Map is used as cache, schema object as key.`,ajvErrors:`It is default now.`},_={ignoreKeywordsWithRef:``,jsPropertySyntax:``,unicode:`"minLength"/"maxLength" account for unicode characters by default.`};function v(e){let t=e.strict,n=e.code?.optimize,r=n===!0||n===void 0?1:n||0,i=e.code?.regExp??p,a=e.uriResolver??f.default;return{strictSchema:e.strictSchema??t??!0,strictNumbers:e.strictNumbers??t??!0,strictTypes:e.strictTypes??t??`log`,strictTuples:e.strictTuples??t??`log`,strictRequired:e.strictRequired??t??!1,code:e.code?{...e.code,optimize:r,regExp:i}:{optimize:r,regExp:i},loopRequired:e.loopRequired??200,loopEnum:e.loopEnum??200,meta:e.meta??!0,messages:e.messages??!0,inlineRefs:e.inlineRefs??!0,schemaId:e.schemaId??`$id`,addUsedSchema:e.addUsedSchema??!0,validateSchema:e.validateSchema??!0,validateFormats:e.validateFormats??!0,unicodeRegExp:e.unicodeRegExp??!0,int32range:e.int32range??!0,uriResolver:a}}var y=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...v(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new s.ValueScope({scope:{},prefixes:h,es5:t,lines:n}),this.logger=re(e.logger);let r=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),b.call(this,g,e,`NOT SUPPORTED`),b.call(this,_,e,`DEPRECATED`,`warn`),this._metaOpts=S.call(this),e.formats&&te.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&ne.call(this,e.keywords),typeof e.meta==`object`&&this.addMetaSchema(e.meta),ee.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword(`$async`)}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=d;n===`id`&&(r={...d},r.id=r.$id,delete r.$id),t&&e&&this.addMetaSchema(r,r[n],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e==`object`?e[t]||e:void 0}validate(e,t){let n;if(typeof e==`string`){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let r=n(t);return`$async`in n||(this.errors=n.errors),r}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if(typeof this.opts.loadSchema!=`function`)throw Error(`options.loadSchema should be a function`);let{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(e,t){await a.call(this,e.$schema);let n=this._addSchema(e,t);return n.validate||o.call(this,n)}async function a(e){e&&!this.getSchema(e)&&await r.call(this,{$ref:e},!0)}async function o(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof i.default))throw t;return s.call(this,t),await c.call(this,t.missingSchema),o.call(this,e)}}function s({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){let n=await l.call(this,e);this.refs[e]||await a.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function l(e){let t=this._loading[e];if(t)return t;try{return await(this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,n,r);return this}let i;if(typeof e==`object`){let{schemaId:t}=this.opts;if(i=e[t],i!==void 0&&typeof i!=`string`)throw Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if(typeof e==`boolean`)return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!=`string`)throw Error(`$schema must be a string`);if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn(`meta-schema not available`),this.errors=null,!0;let r=this.validate(n,e);if(!r&&t){let e=`schema is invalid: `+this.errorsText();if(this.opts.validateSchema===`log`)this.logger.error(e);else throw Error(e)}return r}getSchema(e){let t;for(;typeof(t=x.call(this,e))==`string`;)e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new o.SchemaEnv({schema:{},schemaId:n});if(t=o.resolveSchema.call(this,r,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case`undefined`:return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case`string`:{let t=x.call(this,e);return typeof t==`object`&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case`object`:{let t=e;this._cache.delete(t);let n=e[this.opts.schemaId];return n&&(n=(0,c.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw Error(`ajv.removeSchema: invalid parameter`)}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if(typeof e==`string`)n=e,typeof t==`object`&&(this.logger.warn(`these parameters are deprecated, see docs for addKeyword`),t.keyword=n);else if(typeof e==`object`&&t===void 0){if(t=e,n=t.keyword,Array.isArray(n)&&!n.length)throw Error(`addKeywords: keyword must be string or non-empty array`)}else throw Error(`invalid addKeywords parameters`);if(ae.call(this,n,t),!t)return(0,u.eachItem)(n,e=>oe.call(this,e)),this;ce.call(this,t);let r={...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)};return(0,u.eachItem)(n,r.type.length===0?e=>oe.call(this,e,r):e=>r.type.forEach(t=>oe.call(this,e,r,t))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t==`object`?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let n of t.rules){let t=n.rules.findIndex(t=>t.keyword===e);t>=0&&n.rules.splice(t,1)}return this}addFormat(e,t){return typeof t==`string`&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=`, `,dataVar:n=`data`}={}){return!e||e.length===0?`No errors`:e.map(e=>`${n}${e.instancePath} ${e.message}`).reduce((e,n)=>e+t+n)}$dataMetaSchema(e,t){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let r of t){let t=r.split(`/`).slice(1),i=e;for(let e of t)i=i[e];for(let e in n){let t=n[e];if(typeof t!=`object`)continue;let{$data:r}=t.definition,a=i[e];r&&a&&(i[e]=ue(a))}}return e}_removeAllSchemas(e,t){for(let n in e){let r=e[n];(!t||t.test(n))&&(typeof r==`string`?delete e[n]:r&&!r.meta&&(this._cache.delete(r.schema),delete e[n]))}}_addSchema(e,t,n,r=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof e==`object`)a=e[s];else if(this.opts.jtd)throw Error(`schema must be object`);else if(typeof e!=`boolean`)throw Error(`schema must be object or boolean`);let l=this._cache.get(e);if(l!==void 0)return l;n=(0,c.normalizeId)(a||n);let u=c.getSchemaRefs.call(this,e,n);return l=new o.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:n,localRefs:u}),this._cache.set(l.schema,l),i&&!n.startsWith(`#`)&&(n&&this._checkUnique(n),this.refs[n]=l),r&&this.validateSchema(e,!0),l}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):o.compileSchema.call(this,e),!e.validate)throw Error(`ajv implementation error`);return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,e)}finally{this.opts=t}}};y.ValidationError=r.default,y.MissingRefError=i.default,e.default=y;function b(e,t,n,r=`error`){for(let i in e){let a=i;a in t&&this.logger[r](`${n}: option ${i}. ${e[a]}`)}}function x(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function ee(){let e=this.opts.schemas;if(e){if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}}function te(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function ne(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn(`keywords option as map is deprecated, pass array`);for(let t in e){let n=e[t];n.keyword||=t,this.addKeyword(n)}}function S(){let e={...this.opts};for(let t of m)delete e[t];return e}let C={log(){},warn(){},error(){}};function re(e){if(e===!1)return C;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error(`logger must implement log, warn and error methods`)}let ie=/^[a-z_$][a-z0-9_$:-]*$/i;function ae(e,t){let{RULES:n}=this;if((0,u.eachItem)(e,e=>{if(n.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!ie.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!(`code`in t||`validate`in t))throw Error(`$data keyword must have "code" or "validate" function`)}function oe(e,t,n){var r;let i=t?.post;if(n&&i)throw Error(`keyword with "post" flag cannot have "type"`);let{RULES:a}=this,o=i?a.post:a.rules.find(({type:e})=>e===n);if(o||(o={type:n,rules:[]},a.rules.push(o)),a.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)}};t.before?se.call(this,o,s,t.before):o.rules.push(s),a.all[e]=s,(r=t.implements)==null||r.forEach(e=>this.addKeyword(e))}function se(e,t,n){let r=e.rules.findIndex(e=>e.keyword===n);r>=0?e.rules.splice(r,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function ce(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=ue(t)),e.validateSchema=this.compile(t,!0))}let le={$ref:`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`};function ue(e){return{anyOf:[e,le]}}})),Kg=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:`id`,code(){throw Error(`NOT SUPPORTED: keyword "id", use "$id" for schema ID`)}}})),qg=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=Rg(),n=Ag(),r=Q(),i=Cg(),a=zg(),o=$(),s={keyword:`$ref`,schemaType:`string`,code(e){let{gen:n,schema:i,it:o}=e,{baseId:s,schemaEnv:u,validateName:d,opts:f,self:p}=o,{root:m}=u;if((i===`#`||i===`#/`)&&s===m.baseId)return g();let h=a.resolveRef.call(p,m,s,i);if(h===void 0)throw new t.default(o.opts.uriResolver,s,i);return h instanceof a.SchemaEnv?_(h):v(h);function g(){if(u===m)return l(e,d,u,u.$async);let t=n.scopeValue(`root`,{ref:m});return l(e,(0,r._)`${t}.validate`,m,m.$async)}function _(t){l(e,c(e,t),t,t.$async)}function v(t){let a=n.scopeValue(`schema`,f.code.source===!0?{ref:t,code:(0,r.stringify)(t)}:{ref:t}),o=n.name(`valid`),s=e.subschema({schema:t,dataTypes:[],schemaPath:r.nil,topSchemaRef:a,errSchemaPath:i},o);e.mergeEvaluated(s),e.ok(o)}}};function c(e,t){let{gen:n}=e;return t.validate?n.scopeValue(`validate`,{ref:t.validate}):(0,r._)`${n.scopeValue(`wrapper`,{ref:t})}.validate`}e.getValidate=c;function l(e,t,a,s){let{gen:c,it:l}=e,{allErrors:u,schemaEnv:d,opts:f}=l,p=f.passContext?i.default.this:r.nil;s?m():h();function m(){if(!d.$async)throw Error(`async schema referenced by sync schema`);let i=c.let(`valid`);c.try(()=>{c.code((0,r._)`await ${(0,n.callValidateCode)(e,t,p)}`),_(t),u||c.assign(i,!0)},e=>{c.if((0,r._)`!(${e} instanceof ${l.ValidationError})`,()=>c.throw(e)),g(e),u||c.assign(i,!1)}),e.ok(i)}function h(){e.result((0,n.callValidateCode)(e,t,p),()=>_(t),()=>g(t))}function g(e){let t=(0,r._)`${e}.errors`;c.assign(i.default.vErrors,(0,r._)`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`),c.assign(i.default.errors,(0,r._)`${i.default.vErrors}.length`)}function _(e){if(!l.opts.unevaluated)return;let t=a?.validate?.evaluated;if(l.props!==!0){if(t&&!t.dynamicProps)t.props!==void 0&&(l.props=o.mergeEvaluated.props(c,t.props,l.props));else{let t=c.var(`props`,(0,r._)`${e}.evaluated.props`);l.props=o.mergeEvaluated.props(c,t,l.props,r.Name)}}if(l.items!==!0){if(t&&!t.dynamicItems)t.items!==void 0&&(l.items=o.mergeEvaluated.items(c,t.items,l.items));else{let t=c.var(`items`,(0,r._)`${e}.evaluated.items`);l.items=o.mergeEvaluated.items(c,t,l.items,r.Name)}}}}e.callRef=l,e.default=s})),Jg=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Kg(),n=qg();e.default=[`$schema`,`$id`,`$defs`,`$vocabulary`,{keyword:`$comment`},`definitions`,t.default,n.default]})),Yg=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Q(),n=t.operators,r={maximum:{okStr:`<=`,ok:n.LTE,fail:n.GT},minimum:{okStr:`>=`,ok:n.GTE,fail:n.LT},exclusiveMaximum:{okStr:`<`,ok:n.LT,fail:n.GTE},exclusiveMinimum:{okStr:`>`,ok:n.GT,fail:n.LTE}};e.default={keyword:Object.keys(r),type:`number`,schemaType:`number`,$data:!0,error:{message:({keyword:e,schemaCode:n})=>(0,t.str)`must be ${r[e].okStr} ${n}`,params:({keyword:e,schemaCode:n})=>(0,t._)`{comparison: ${r[e].okStr}, limit: ${n}}`},code(e){let{keyword:n,data:i,schemaCode:a}=e;e.fail$data((0,t._)`${i} ${r[n].fail} ${a} || isNaN(${i})`)}}})),Xg=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Q();e.default={keyword:`multipleOf`,type:`number`,schemaType:`number`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,t._)`{multipleOf: ${e}}`},code(e){let{gen:n,data:r,schemaCode:i,it:a}=e,o=a.opts.multipleOfPrecision,s=n.let(`res`),c=o?(0,t._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,t._)`${s} !== parseInt(${s})`;e.fail$data((0,t._)`(${i} === 0 || (${s} = ${r}/${i}, ${c}))`)}}})),Zg=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){let t=e.length,n=0,r=0,i;for(;r<t;)n++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return n}e.default=t,t.code=`require("ajv/dist/runtime/ucs2length").default`})),Qg=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Q(),n=$(),r=Zg();e.default={keyword:[`maxLength`,`minLength`],type:`string`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxLength`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} characters`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:i,data:a,schemaCode:o,it:s}=e,c=i===`maxLength`?t.operators.GT:t.operators.LT,l=s.opts.unicode===!1?(0,t._)`${a}.length`:(0,t._)`${(0,n.useFunc)(e.gen,r.default)}(${a})`;e.fail$data((0,t._)`${l} ${c} ${o}`)}}})),$g=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ag(),n=$(),r=Q();e.default={keyword:`pattern`,type:`string`,schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,r.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,r._)`{pattern: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e,u=l.opts.unicodeRegExp?`u`:``;if(o){let{regExp:t}=l.opts.code,o=t.code===`new RegExp`?(0,r._)`new RegExp`:(0,n.useFunc)(i,t),s=i.let(`valid`);i.try(()=>i.assign(s,(0,r._)`${o}(${c}, ${u}).test(${a})`),()=>i.assign(s,!1)),e.fail$data((0,r._)`!${s}`)}else{let n=(0,t.usePattern)(e,s);e.fail$data((0,r._)`!${n}.test(${a})`)}}}})),e_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Q();e.default={keyword:[`maxProperties`,`minProperties`],type:`object`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxProperties`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} properties`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxProperties`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`Object.keys(${r}).length ${a} ${i}`)}}})),t_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ag(),n=Q(),r=$();e.default={keyword:`required`,type:`object`,schemaType:`array`,$data:!0,error:{message:({params:{missingProperty:e}})=>(0,n.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,n._)`{missingProperty: ${e}}`},code(e){let{gen:i,schema:a,schemaCode:o,data:s,$data:c,it:l}=e,{opts:u}=l;if(!c&&a.length===0)return;let d=a.length>=u.loopRequired;if(l.allErrors?f():p(),u.strictRequired){let t=e.parentSchema.properties,{definedProperties:n}=e.it;for(let e of a)if(t?.[e]===void 0&&!n.has(e)){let t=`required property "${e}" is not defined at "${l.schemaEnv.baseId+l.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(l,t,l.opts.strictRequired)}}function f(){if(d||c)e.block$data(n.nil,m);else for(let n of a)(0,t.checkReportMissingProp)(e,n)}function p(){let n=i.let(`missing`);if(d||c){let t=i.let(`valid`,!0);e.block$data(t,()=>h(n,t)),e.ok(t)}else i.if((0,t.checkMissingProp)(e,a,n)),(0,t.reportMissingProp)(e,n),i.else()}function m(){i.forOf(`prop`,o,n=>{e.setParams({missingProperty:n}),i.if((0,t.noPropertyInData)(i,s,n,u.ownProperties),()=>e.error())})}function h(r,a){e.setParams({missingProperty:r}),i.forOf(r,o,()=>{i.assign(a,(0,t.propertyInData)(i,s,r,u.ownProperties)),i.if((0,n.not)(a),()=>{e.error(),i.break()})},n.nil)}}}})),n_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Q();e.default={keyword:[`maxItems`,`minItems`],type:`array`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxItems`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} items`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxItems`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`${r}.length ${a} ${i}`)}}})),r_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ng();t.code=`require("ajv/dist/runtime/equal").default`,e.default=t})),i_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Og(),n=Q(),r=$(),i=r_();e.default={keyword:`uniqueItems`,type:`array`,schemaType:`boolean`,$data:!0,error:{message:({params:{i:e,j:t}})=>(0,n.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,n._)`{i: ${e}, j: ${t}}`},code(e){let{gen:a,data:o,$data:s,schema:c,parentSchema:l,schemaCode:u,it:d}=e;if(!s&&!c)return;let f=a.let(`valid`),p=l.items?(0,t.getSchemaTypes)(l.items):[];e.block$data(f,m,(0,n._)`${u} === false`),e.ok(f);function m(){let t=a.let(`i`,(0,n._)`${o}.length`),r=a.let(`j`);e.setParams({i:t,j:r}),a.assign(f,!0),a.if((0,n._)`${t} > 1`,()=>(h()?g:_)(t,r))}function h(){return p.length>0&&!p.some(e=>e===`object`||e===`array`)}function g(r,i){let s=a.name(`item`),c=(0,t.checkDataTypes)(p,s,d.opts.strictNumbers,t.DataType.Wrong),l=a.const(`indices`,(0,n._)`{}`);a.for((0,n._)`;${r}--;`,()=>{a.let(s,(0,n._)`${o}[${r}]`),a.if(c,(0,n._)`continue`),p.length>1&&a.if((0,n._)`typeof ${s} == "string"`,(0,n._)`${s} += "_"`),a.if((0,n._)`typeof ${l}[${s}] == "number"`,()=>{a.assign(i,(0,n._)`${l}[${s}]`),e.error(),a.assign(f,!1).break()}).code((0,n._)`${l}[${s}] = ${r}`)})}function _(t,s){let c=(0,r.useFunc)(a,i.default),l=a.name(`outer`);a.label(l).for((0,n._)`;${t}--;`,()=>a.for((0,n._)`${s} = ${t}; ${s}--;`,()=>a.if((0,n._)`${c}(${o}[${t}], ${o}[${s}])`,()=>{e.error(),a.assign(f,!1).break(l)})))}}}})),a_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Q(),n=$(),r=r_();e.default={keyword:`const`,$data:!0,error:{message:`must be equal to constant`,params:({schemaCode:e})=>(0,t._)`{allowedValue: ${e}}`},code(e){let{gen:i,data:a,$data:o,schemaCode:s,schema:c}=e;o||c&&typeof c==`object`?e.fail$data((0,t._)`!${(0,n.useFunc)(i,r.default)}(${a}, ${s})`):e.fail((0,t._)`${c} !== ${a}`)}}})),o_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Q(),n=$(),r=r_();e.default={keyword:`enum`,schemaType:`array`,$data:!0,error:{message:`must be equal to one of the allowed values`,params:({schemaCode:e})=>(0,t._)`{allowedValues: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e;if(!o&&s.length===0)throw Error(`enum must have non-empty array`);let u=s.length>=l.opts.loopEnum,d,f=()=>d??=(0,n.useFunc)(i,r.default),p;if(u||o)p=i.let(`valid`),e.block$data(p,m);else{if(!Array.isArray(s))throw Error(`ajv implementation error`);let e=i.const(`vSchema`,c);p=(0,t.or)(...s.map((t,n)=>h(e,n)))}e.pass(p);function m(){i.assign(p,!1),i.forOf(`v`,c,e=>i.if((0,t._)`${f()}(${a}, ${e})`,()=>i.assign(p,!0).break()))}function h(e,n){let r=s[n];return typeof r==`object`&&r?(0,t._)`${f()}(${a}, ${e}[${n}])`:(0,t._)`${a} === ${r}`}}}})),s_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Yg(),n=Xg(),r=Qg(),i=$g(),a=e_(),o=t_(),s=n_(),c=i_(),l=a_(),u=o_();e.default=[t.default,n.default,r.default,i.default,a.default,o.default,s.default,c.default,{keyword:`type`,schemaType:[`string`,`array`]},{keyword:`nullable`,schemaType:`boolean`},l.default,u.default]})),c_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=Q(),n=$(),r={keyword:`additionalItems`,type:`array`,schemaType:[`boolean`,`object`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:r}=e,{items:a}=t;if(!Array.isArray(a)){(0,n.checkStrictMode)(r,`"additionalItems" is ignored when "items" is not an array of schemas`);return}i(e,a)}};function i(e,r){let{gen:i,schema:a,data:o,keyword:s,it:c}=e;c.items=!0;let l=i.const(`len`,(0,t._)`${o}.length`);if(a===!1)e.setParams({len:r.length}),e.pass((0,t._)`${l} <= ${r.length}`);else if(typeof a==`object`&&!(0,n.alwaysValidSchema)(c,a)){let n=i.var(`valid`,(0,t._)`${l} <= ${r.length}`);i.if((0,t.not)(n),()=>u(n)),e.ok(n)}function u(a){i.forRange(`i`,r.length,l,r=>{e.subschema({keyword:s,dataProp:r,dataPropType:n.Type.Num},a),c.allErrors||i.if((0,t.not)(a),()=>i.break())})}}e.validateAdditionalItems=i,e.default=r})),l_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=Q(),n=$(),r=Ag(),i={keyword:`items`,type:`array`,schemaType:[`object`,`array`,`boolean`],before:`uniqueItems`,code(e){let{schema:t,it:i}=e;if(Array.isArray(t))return a(e,`additionalItems`,t);i.items=!0,!(0,n.alwaysValidSchema)(i,t)&&e.ok((0,r.validateArray)(e))}};function a(e,r,i=e.schema){let{gen:a,parentSchema:o,data:s,keyword:c,it:l}=e;f(o),l.opts.unevaluated&&i.length&&l.items!==!0&&(l.items=n.mergeEvaluated.items(a,i.length,l.items));let u=a.name(`valid`),d=a.const(`len`,(0,t._)`${s}.length`);i.forEach((r,i)=>{(0,n.alwaysValidSchema)(l,r)||(a.if((0,t._)`${d} > ${i}`,()=>e.subschema({keyword:c,schemaProp:i,dataProp:i},u)),e.ok(u))});function f(e){let{opts:t,errSchemaPath:a}=l,o=i.length,s=o===e.minItems&&(o===e.maxItems||e[r]===!1);if(t.strictTuples&&!s){let e=`"${c}" is ${o}-tuple, but minItems or maxItems/${r} are not specified or different at path "${a}"`;(0,n.checkStrictMode)(l,e,t.strictTuples)}}}e.validateTuple=a,e.default=i})),u_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l_();e.default={keyword:`prefixItems`,type:`array`,schemaType:[`array`],before:`uniqueItems`,code:e=>(0,t.validateTuple)(e,`items`)}})),d_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Q(),n=$(),r=Ag(),i=c_();e.default={keyword:`items`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:a,it:o}=e,{prefixItems:s}=a;o.items=!0,!(0,n.alwaysValidSchema)(o,t)&&(s?(0,i.validateAdditionalItems)(e,s):e.ok((0,r.validateArray)(e)))}}})),f_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Q(),n=$();e.default={keyword:`contains`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,trackErrors:!0,error:{message:({params:{min:e,max:n}})=>n===void 0?(0,t.str)`must contain at least ${e} valid item(s)`:(0,t.str)`must contain at least ${e} and no more than ${n} valid item(s)`,params:({params:{min:e,max:n}})=>n===void 0?(0,t._)`{minContains: ${e}}`:(0,t._)`{minContains: ${e}, maxContains: ${n}}`},code(e){let{gen:r,schema:i,parentSchema:a,data:o,it:s}=e,c,l,{minContains:u,maxContains:d}=a;s.opts.next?(c=u===void 0?1:u,l=d):c=1;let f=r.const(`len`,(0,t._)`${o}.length`);if(e.setParams({min:c,max:l}),l===void 0&&c===0){(0,n.checkStrictMode)(s,`"minContains" == 0 without "maxContains": "contains" keyword ignored`);return}if(l!==void 0&&c>l){(0,n.checkStrictMode)(s,`"minContains" > "maxContains" is always invalid`),e.fail();return}if((0,n.alwaysValidSchema)(s,i)){let n=(0,t._)`${f} >= ${c}`;l!==void 0&&(n=(0,t._)`${n} && ${f} <= ${l}`),e.pass(n);return}s.items=!0;let p=r.name(`valid`);l===void 0&&c===1?h(p,()=>r.if(p,()=>r.break())):c===0?(r.let(p,!0),l!==void 0&&r.if((0,t._)`${o}.length > 0`,m)):(r.let(p,!1),m()),e.result(p,()=>e.reset());function m(){let e=r.name(`_valid`),t=r.let(`count`,0);h(e,()=>r.if(e,()=>g(t)))}function h(t,i){r.forRange(`i`,0,f,r=>{e.subschema({keyword:`contains`,dataProp:r,dataPropType:n.Type.Num,compositeRule:!0},t),i()})}function g(e){r.code((0,t._)`${e}++`),l===void 0?r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0).break()):(r.if((0,t._)`${e} > ${l}`,()=>r.assign(p,!1).break()),c===1?r.assign(p,!0):r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0)))}}}})),p_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=Q(),n=$(),r=Ag();e.error={message:({params:{property:e,depsCount:n,deps:r}})=>{let i=n===1?`property`:`properties`;return(0,t.str)`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:n,deps:r,missingProperty:i}})=>(0,t._)`{property: ${e},
missingProperty: ${i},
depsCount: ${n},
deps: ${r}}`};let i={keyword:`dependencies`,type:`object`,schemaType:`object`,error:e.error,code(e){let[t,n]=a(e);o(e,t),s(e,n)}};function a({schema:e}){let t={},n={};for(let r in e){if(r===`__proto__`)continue;let i=Array.isArray(e[r])?t:n;i[r]=e[r]}return[t,n]}function o(e,n=e.schema){let{gen:i,data:a,it:o}=e;if(Object.keys(n).length===0)return;let s=i.let(`missing`);for(let c in n){let l=n[c];if(l.length===0)continue;let u=(0,r.propertyInData)(i,a,c,o.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(`, `)}),o.allErrors?i.if(u,()=>{for(let t of l)(0,r.checkReportMissingProp)(e,t)}):(i.if((0,t._)`${u} && (${(0,r.checkMissingProp)(e,l,s)})`),(0,r.reportMissingProp)(e,s),i.else())}}e.validatePropertyDeps=o;function s(e,t=e.schema){let{gen:i,data:a,keyword:o,it:s}=e,c=i.name(`valid`);for(let l in t)(0,n.alwaysValidSchema)(s,t[l])||(i.if((0,r.propertyInData)(i,a,l,s.opts.ownProperties),()=>{let t=e.subschema({keyword:o,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validateSchemaDeps=s,e.default=i})),m_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Q(),n=$();e.default={keyword:`propertyNames`,type:`object`,schemaType:[`object`,`boolean`],error:{message:`property name must be valid`,params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:r,schema:i,data:a,it:o}=e;if((0,n.alwaysValidSchema)(o,i))return;let s=r.name(`valid`);r.forIn(`key`,a,n=>{e.setParams({propertyName:n}),e.subschema({keyword:`propertyNames`,data:n,dataTypes:[`string`],propertyName:n,compositeRule:!0},s),r.if((0,t.not)(s),()=>{e.error(!0),o.allErrors||r.break()})}),e.ok(s)}}})),h_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ag(),n=Q(),r=Cg(),i=$();e.default={keyword:`additionalProperties`,type:[`object`],schemaType:[`boolean`,`object`],allowUndefined:!0,trackErrors:!0,error:{message:`must NOT have additional properties`,params:({params:e})=>(0,n._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:a,schema:o,parentSchema:s,data:c,errsCount:l,it:u}=e;if(!l)throw Error(`ajv implementation error`);let{allErrors:d,opts:f}=u;if(u.props=!0,f.removeAdditional!==`all`&&(0,i.alwaysValidSchema)(u,o))return;let p=(0,t.allSchemaProperties)(s.properties),m=(0,t.allSchemaProperties)(s.patternProperties);h(),e.ok((0,n._)`${l} === ${r.default.errors}`);function h(){a.forIn(`key`,c,e=>{!p.length&&!m.length?v(e):a.if(g(e),()=>v(e))})}function g(r){let o;if(p.length>8){let e=(0,i.schemaRefOrVal)(u,s.properties,`properties`);o=(0,t.isOwnProperty)(a,e,r)}else o=p.length?(0,n.or)(...p.map(e=>(0,n._)`${r} === ${e}`)):n.nil;return m.length&&(o=(0,n.or)(o,...m.map(i=>(0,n._)`${(0,t.usePattern)(e,i)}.test(${r})`))),(0,n.not)(o)}function _(e){a.code((0,n._)`delete ${c}[${e}]`)}function v(t){if(f.removeAdditional===`all`||f.removeAdditional&&o===!1){_(t);return}if(o===!1){e.setParams({additionalProperty:t}),e.error(),d||a.break();return}if(typeof o==`object`&&!(0,i.alwaysValidSchema)(u,o)){let r=a.name(`valid`);f.removeAdditional===`failing`?(y(t,r,!1),a.if((0,n.not)(r),()=>{e.reset(),_(t)})):(y(t,r),d||a.if((0,n.not)(r),()=>a.break()))}}function y(t,n,r){let a={keyword:`additionalProperties`,dataProp:t,dataPropType:i.Type.Str};r===!1&&Object.assign(a,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(a,n)}}}})),g_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ig(),n=Ag(),r=$(),i=h_();e.default={keyword:`properties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,parentSchema:s,data:c,it:l}=e;l.opts.removeAdditional===`all`&&s.additionalProperties===void 0&&i.default.code(new t.KeywordCxt(l,i.default,`additionalProperties`));let u=(0,n.allSchemaProperties)(o);for(let e of u)l.definedProperties.add(e);l.opts.unevaluated&&u.length&&l.props!==!0&&(l.props=r.mergeEvaluated.props(a,(0,r.toHash)(u),l.props));let d=u.filter(e=>!(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0)return;let f=a.name(`valid`);for(let t of d)p(t)?m(t):(a.if((0,n.propertyInData)(a,c,t,l.opts.ownProperties)),m(t),l.allErrors||a.else().var(f,!0),a.endIf()),e.it.definedProperties.add(t),e.ok(f);function p(e){return l.opts.useDefaults&&!l.compositeRule&&o[e].default!==void 0}function m(t){e.subschema({keyword:`properties`,schemaProp:t,dataProp:t},f)}}}})),__=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ag(),n=Q(),r=$(),i=$();e.default={keyword:`patternProperties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,data:s,parentSchema:c,it:l}=e,{opts:u}=l,d=(0,t.allSchemaProperties)(o),f=d.filter(e=>(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0||f.length===d.length&&(!l.opts.unevaluated||l.props===!0))return;let p=u.strictSchema&&!u.allowMatchingProperties&&c.properties,m=a.name(`valid`);l.props!==!0&&!(l.props instanceof n.Name)&&(l.props=(0,i.evaluatedPropsToName)(a,l.props));let{props:h}=l;g();function g(){for(let e of d)p&&_(e),l.allErrors?v(e):(a.var(m,!0),v(e),a.if(m))}function _(e){for(let t in p)new RegExp(e).test(t)&&(0,r.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(r){a.forIn(`key`,s,o=>{a.if((0,n._)`${(0,t.usePattern)(e,r)}.test(${o})`,()=>{let t=f.includes(r);t||e.subschema({keyword:`patternProperties`,schemaProp:r,dataProp:o,dataPropType:i.Type.Str},m),l.opts.unevaluated&&h!==!0?a.assign((0,n._)`${h}[${o}]`,!0):!t&&!l.allErrors&&a.if((0,n.not)(m),()=>a.break())})})}}}})),v_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=$();e.default={keyword:`not`,schemaType:[`object`,`boolean`],trackErrors:!0,code(e){let{gen:n,schema:r,it:i}=e;if((0,t.alwaysValidSchema)(i,r)){e.fail();return}let a=n.name(`valid`);e.subschema({keyword:`not`,compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:`must NOT be valid`}}})),y_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:`anyOf`,schemaType:`array`,trackErrors:!0,code:Ag().validateUnion,error:{message:`must match a schema in anyOf`}}})),b_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Q(),n=$();e.default={keyword:`oneOf`,schemaType:`array`,trackErrors:!0,error:{message:`must match exactly one schema in oneOf`,params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:r,schema:i,parentSchema:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(o.opts.discriminator&&a.discriminator)return;let s=i,c=r.let(`valid`,!1),l=r.let(`passing`,null),u=r.name(`_valid`);e.setParams({passing:l}),r.block(d),e.result(c,()=>e.reset(),()=>e.error(!0));function d(){s.forEach((i,a)=>{let s;(0,n.alwaysValidSchema)(o,i)?r.var(u,!0):s=e.subschema({keyword:`oneOf`,schemaProp:a,compositeRule:!0},u),a>0&&r.if((0,t._)`${u} && ${c}`).assign(c,!1).assign(l,(0,t._)`[${l}, ${a}]`).else(),r.if(u,()=>{r.assign(c,!0),r.assign(l,a),s&&e.mergeEvaluated(s,t.Name)})})}}}})),x_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=$();e.default={keyword:`allOf`,schemaType:`array`,code(e){let{gen:n,schema:r,it:i}=e;if(!Array.isArray(r))throw Error(`ajv implementation error`);let a=n.name(`valid`);r.forEach((n,r)=>{if((0,t.alwaysValidSchema)(i,n))return;let o=e.subschema({keyword:`allOf`,schemaProp:r},a);e.ok(a),e.mergeEvaluated(o)})}}})),S_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Q(),n=$(),r={keyword:`if`,schemaType:[`object`,`boolean`],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let{gen:r,parentSchema:a,it:o}=e;a.then===void 0&&a.else===void 0&&(0,n.checkStrictMode)(o,`"if" without "then" and "else" is ignored`);let s=i(o,`then`),c=i(o,`else`);if(!s&&!c)return;let l=r.let(`valid`,!0),u=r.name(`_valid`);if(d(),e.reset(),s&&c){let t=r.let(`ifClause`);e.setParams({ifClause:t}),r.if(u,f(`then`,t),f(`else`,t))}else s?r.if(u,f(`then`)):r.if((0,t.not)(u),f(`else`));e.pass(l,()=>e.error(!0));function d(){let t=e.subschema({keyword:`if`,compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}function f(n,i){return()=>{let a=e.subschema({keyword:n},u);r.assign(l,u),e.mergeValidEvaluated(a,l),i?r.assign(i,(0,t._)`${n}`):e.setParams({ifClause:n})}}}};function i(e,t){let r=e.schema[t];return r!==void 0&&!(0,n.alwaysValidSchema)(e,r)}e.default=r})),C_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=$();e.default={keyword:[`then`,`else`],schemaType:[`object`,`boolean`],code({keyword:e,parentSchema:n,it:r}){n.if===void 0&&(0,t.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}})),w_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=c_(),n=u_(),r=l_(),i=d_(),a=f_(),o=p_(),s=m_(),c=h_(),l=g_(),u=__(),d=v_(),f=y_(),p=b_(),m=x_(),h=S_(),g=C_();function _(e=!1){let _=[d.default,f.default,p.default,m.default,h.default,g.default,s.default,c.default,o.default,l.default,u.default];return e?_.push(n.default,i.default):_.push(t.default,r.default),_.push(a.default),_}e.default=_})),T_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Q();e.default={keyword:`format`,type:[`number`,`string`],schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,n){let{gen:r,data:i,$data:a,schema:o,schemaCode:s,it:c}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:f}=c;if(!l.validateFormats)return;a?p():m();function p(){let a=r.scopeValue(`formats`,{ref:f.formats,code:l.code.formats}),o=r.const(`fDef`,(0,t._)`${a}[${s}]`),c=r.let(`fType`),u=r.let(`format`);r.if((0,t._)`typeof ${o} == "object" && !(${o} instanceof RegExp)`,()=>r.assign(c,(0,t._)`${o}.type || "string"`).assign(u,(0,t._)`${o}.validate`),()=>r.assign(c,(0,t._)`"string"`).assign(u,o)),e.fail$data((0,t.or)(p(),m()));function p(){return l.strictSchema===!1?t.nil:(0,t._)`${s} && !${u}`}function m(){let e=d.$async?(0,t._)`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:(0,t._)`${u}(${i})`,r=(0,t._)`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return(0,t._)`${u} && ${u} !== true && ${c} === ${n} && !${r}`}}function m(){let a=f.formats[o];if(!a){m();return}if(a===!0)return;let[s,c,p]=h(a);s===n&&e.pass(g());function m(){if(l.strictSchema===!1){f.logger.warn(e());return}throw Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function h(e){let n=e instanceof RegExp?(0,t.regexpCode)(e):l.code.formats?(0,t._)`${l.code.formats}${(0,t.getProperty)(o)}`:void 0,i=r.scopeValue(`formats`,{key:o,ref:e,code:n});return typeof e==`object`&&!(e instanceof RegExp)?[e.type||`string`,e.validate,(0,t._)`${i}.validate`]:[`string`,e,i]}function g(){if(typeof a==`object`&&!(a instanceof RegExp)&&a.async){if(!d.$async)throw Error(`async format in sync schema`);return(0,t._)`await ${p}(${i})`}return typeof c==`function`?(0,t._)`${p}(${i})`:(0,t._)`${p}.test(${i})`}}}}})),E_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=[T_().default]})),D_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=[`title`,`description`,`default`,`deprecated`,`readOnly`,`writeOnly`,`examples`],e.contentVocabulary=[`contentMediaType`,`contentEncoding`,`contentSchema`]})),O_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Jg(),n=s_(),r=w_(),i=E_(),a=D_();e.default=[t.default,n.default,(0,r.default)(),i.default,a.metadataVocabulary,a.contentVocabulary]})),k_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(e){e.Tag=`tag`,e.Mapping=`mapping`})(t||(e.DiscrError=t={}))})),A_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Q(),n=k_(),r=zg(),i=Rg(),a=$();e.default={keyword:`discriminator`,type:`object`,schemaType:`object`,error:{message:({params:{discrError:e,tagName:t}})=>e===n.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:n,tagName:r}})=>(0,t._)`{error: ${e}, tag: ${r}, tagValue: ${n}}`},code(e){let{gen:o,data:s,schema:c,parentSchema:l,it:u}=e,{oneOf:d}=l;if(!u.opts.discriminator)throw Error(`discriminator: requires discriminator option`);let f=c.propertyName;if(typeof f!=`string`)throw Error(`discriminator: requires propertyName`);if(c.mapping)throw Error(`discriminator: mapping is not supported`);if(!d)throw Error(`discriminator: requires oneOf keyword`);let p=o.let(`valid`,!1),m=o.const(`tag`,(0,t._)`${s}${(0,t.getProperty)(f)}`);o.if((0,t._)`typeof ${m} == "string"`,()=>h(),()=>e.error(!1,{discrError:n.DiscrError.Tag,tag:m,tagName:f})),e.ok(p);function h(){let r=_();o.if(!1);for(let e in r)o.elseIf((0,t._)`${m} === ${e}`),o.assign(p,g(r[e]));o.else(),e.error(!1,{discrError:n.DiscrError.Mapping,tag:m,tagName:f}),o.endIf()}function g(n){let r=o.name(`valid`),i=e.subschema({keyword:`oneOf`,schemaProp:n},r);return e.mergeEvaluated(i,t.Name),r}function _(){let e={},t=o(l),n=!0;for(let e=0;e<d.length;e++){let c=d[e];if(c?.$ref&&!(0,a.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if(c=r.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),c instanceof r.SchemaEnv&&(c=c.schema),c===void 0)throw new i.default(u.opts.uriResolver,u.baseId,e)}let l=c?.properties?.[f];if(typeof l!=`object`)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);n&&=t||o(c),s(l,e)}if(!n)throw Error(`discriminator: "${f}" must be required`);return e;function o({required:e}){return Array.isArray(e)&&e.includes(f)}function s(e,t){if(e.const)c(e.const,t);else if(e.enum)for(let n of e.enum)c(n,t);else throw Error(`discriminator: "properties/${f}" must have "const" or "enum"`)}function c(t,n){if(typeof t!=`string`||t in e)throw Error(`discriminator: "${f}" values must be unique strings`);e[t]=n}}}}})),j_=o(((e,t)=>{t.exports={$schema:`http://json-schema.org/draft-07/schema#`,$id:`http://json-schema.org/draft-07/schema#`,title:`Core schema meta-schema`,definitions:{schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:`#/definitions/nonNegativeInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},type:[`object`,`boolean`],properties:{$id:{type:`string`,format:`uri-reference`},$schema:{type:`string`,format:`uri`},$ref:{type:`string`,format:`uri-reference`},$comment:{type:`string`},title:{type:`string`},description:{type:`string`},default:!0,readOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/definitions/nonNegativeInteger`},minLength:{$ref:`#/definitions/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{$ref:`#`},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:!0},maxItems:{$ref:`#/definitions/nonNegativeInteger`},minItems:{$ref:`#/definitions/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},contains:{$ref:`#`},maxProperties:{$ref:`#/definitions/nonNegativeInteger`},minProperties:{$ref:`#/definitions/nonNegativeIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{$ref:`#`},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},propertyNames:{format:`regex`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},propertyNames:{$ref:`#`},const:!0,enum:{type:`array`,items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},contentMediaType:{type:`string`},contentEncoding:{type:`string`},if:{$ref:`#`},then:{$ref:`#`},else:{$ref:`#`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},default:!0}})),M_=o(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let n=Gg(),r=O_(),i=A_(),a=j_(),o=[`/properties`],s=`http://json-schema.org/draft-07/schema`;var c=class extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(a,o):a;this.addMetaSchema(e,s,!1),this.refs[`http://json-schema.org/schema`]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var l=Ig();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var u=Q();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=Lg();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var f=Rg();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return f.default}})})),N_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=Q(),n=Cg(),r=zg(),i=qg(),a={keyword:`$dynamicAnchor`,schemaType:`string`,code:e=>o(e,e.schema)};function o(e,r){let{gen:i,it:a}=e;a.schemaEnv.root.dynamicAnchors[r]=!0;let o=(0,t._)`${n.default.dynamicAnchors}${(0,t.getProperty)(r)}`,c=a.errSchemaPath===`#`?a.validateName:s(e);i.if((0,t._)`!${o}`,()=>i.assign(o,c))}e.dynamicAnchor=o;function s(e){let{schemaEnv:t,schema:n,self:a}=e.it,{root:o,baseId:s,localRefs:c,meta:l}=t.root,{schemaId:u}=a.opts,d=new r.SchemaEnv({schema:n,schemaId:u,root:o,baseId:s,localRefs:c,meta:l});return r.compileSchema.call(a,d),(0,i.getValidate)(e,d)}e.default=a})),P_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=Q(),n=Cg(),r=qg(),i={keyword:`$dynamicRef`,schemaType:`string`,code:e=>a(e,e.schema)};function a(e,i){let{gen:a,keyword:o,it:s}=e;if(i[0]!==`#`)throw Error(`"${o}" only supports hash fragment reference`);let c=i.slice(1);if(s.allErrors)l();else{let t=a.let(`valid`,!1);l(t),e.ok(t)}function l(e){if(s.schemaEnv.root.dynamicAnchors[c]){let r=a.let(`_v`,(0,t._)`${n.default.dynamicAnchors}${(0,t.getProperty)(c)}`);a.if(r,u(r,e),u(s.validateName,e))}else u(s.validateName,e)()}function u(t,n){return n?()=>a.block(()=>{(0,r.callRef)(e,t),a.let(n,!0)}):()=>(0,r.callRef)(e,t)}}e.dynamicRef=a,e.default=i})),F_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=N_(),n=$();e.default={keyword:`$recursiveAnchor`,schemaType:`boolean`,code(e){e.schema?(0,t.dynamicAnchor)(e,``):(0,n.checkStrictMode)(e.it,`$recursiveAnchor: false is ignored`)}}})),I_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=P_();e.default={keyword:`$recursiveRef`,schemaType:`string`,code:e=>(0,t.dynamicRef)(e,e.schema)}})),L_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=N_(),n=P_(),r=F_(),i=I_();e.default=[t.default,n.default,r.default,i.default]})),R_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=p_();e.default={keyword:`dependentRequired`,type:`object`,schemaType:`object`,error:t.error,code:e=>(0,t.validatePropertyDeps)(e)}})),z_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=p_();e.default={keyword:`dependentSchemas`,type:`object`,schemaType:`object`,code:e=>(0,t.validateSchemaDeps)(e)}})),B_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=$();e.default={keyword:[`maxContains`,`minContains`],type:`array`,schemaType:`number`,code({keyword:e,parentSchema:n,it:r}){n.contains===void 0&&(0,t.checkStrictMode)(r,`"${e}" without "contains" is ignored`)}}})),V_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=R_(),n=z_(),r=B_();e.default=[t.default,n.default,r.default]})),H_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Q(),n=$(),r=Cg();e.default={keyword:`unevaluatedProperties`,type:`object`,schemaType:[`boolean`,`object`],trackErrors:!0,error:{message:`must NOT have unevaluated properties`,params:({params:e})=>(0,t._)`{unevaluatedProperty: ${e.unevaluatedProperty}}`},code(e){let{gen:i,schema:a,data:o,errsCount:s,it:c}=e;if(!s)throw Error(`ajv implementation error`);let{allErrors:l,props:u}=c;u instanceof t.Name?i.if((0,t._)`${u} !== true`,()=>i.forIn(`key`,o,e=>i.if(f(u,e),()=>d(e)))):u!==!0&&i.forIn(`key`,o,e=>u===void 0?d(e):i.if(p(u,e),()=>d(e))),c.props=!0,e.ok((0,t._)`${s} === ${r.default.errors}`);function d(r){if(a===!1){e.setParams({unevaluatedProperty:r}),e.error(),l||i.break();return}if(!(0,n.alwaysValidSchema)(c,a)){let a=i.name(`valid`);e.subschema({keyword:`unevaluatedProperties`,dataProp:r,dataPropType:n.Type.Str},a),l||i.if((0,t.not)(a),()=>i.break())}}function f(e,n){return(0,t._)`!${e} || !${e}[${n}]`}function p(e,n){let r=[];for(let i in e)e[i]===!0&&r.push((0,t._)`${n} !== ${i}`);return(0,t.and)(...r)}}}})),U_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Q(),n=$();e.default={keyword:`unevaluatedItems`,type:`array`,schemaType:[`boolean`,`object`],error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{gen:r,schema:i,data:a,it:o}=e,s=o.items||0;if(s===!0)return;let c=r.const(`len`,(0,t._)`${a}.length`);if(i===!1)e.setParams({len:s}),e.fail((0,t._)`${c} > ${s}`);else if(typeof i==`object`&&!(0,n.alwaysValidSchema)(o,i)){let n=r.var(`valid`,(0,t._)`${c} <= ${s}`);r.if((0,t.not)(n),()=>l(n,s)),e.ok(n)}o.items=!0;function l(i,a){r.forRange(`i`,a,c,a=>{e.subschema({keyword:`unevaluatedItems`,dataProp:a,dataPropType:n.Type.Num},i),o.allErrors||r.if((0,t.not)(i),()=>r.break())})}}}})),W_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=H_(),n=U_();e.default=[t.default,n.default]})),G_=o(((e,t)=>{t.exports={$schema:`https://json-schema.org/draft/2019-09/schema`,$id:`https://json-schema.org/draft/2019-09/schema`,$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:`Core and Validation specifications meta-schema`,allOf:[{$ref:`meta/core`},{$ref:`meta/applicator`},{$ref:`meta/validation`},{$ref:`meta/meta-data`},{$ref:`meta/format`},{$ref:`meta/content`}],type:[`object`,`boolean`],properties:{definitions:{$comment:`While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.`,type:`object`,additionalProperties:{$recursiveRef:`#`},default:{}},dependencies:{$comment:`"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"`,type:`object`,additionalProperties:{anyOf:[{$recursiveRef:`#`},{$ref:`meta/validation#/$defs/stringArray`}]}}}}})),K_=o(((e,t)=>{t.exports={$schema:`https://json-schema.org/draft/2019-09/schema`,$id:`https://json-schema.org/draft/2019-09/meta/applicator`,$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:`Applicator vocabulary meta-schema`,type:[`object`,`boolean`],properties:{additionalItems:{$recursiveRef:`#`},unevaluatedItems:{$recursiveRef:`#`},items:{anyOf:[{$recursiveRef:`#`},{$ref:`#/$defs/schemaArray`}]},contains:{$recursiveRef:`#`},additionalProperties:{$recursiveRef:`#`},unevaluatedProperties:{$recursiveRef:`#`},properties:{type:`object`,additionalProperties:{$recursiveRef:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$recursiveRef:`#`},propertyNames:{format:`regex`},default:{}},dependentSchemas:{type:`object`,additionalProperties:{$recursiveRef:`#`}},propertyNames:{$recursiveRef:`#`},if:{$recursiveRef:`#`},then:{$recursiveRef:`#`},else:{$recursiveRef:`#`},allOf:{$ref:`#/$defs/schemaArray`},anyOf:{$ref:`#/$defs/schemaArray`},oneOf:{$ref:`#/$defs/schemaArray`},not:{$recursiveRef:`#`}},$defs:{schemaArray:{type:`array`,minItems:1,items:{$recursiveRef:`#`}}}}})),q_=o(((e,t)=>{t.exports={$schema:`https://json-schema.org/draft/2019-09/schema`,$id:`https://json-schema.org/draft/2019-09/meta/content`,$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:`Content vocabulary meta-schema`,type:[`object`,`boolean`],properties:{contentMediaType:{type:`string`},contentEncoding:{type:`string`},contentSchema:{$recursiveRef:`#`}}}})),J_=o(((e,t)=>{t.exports={$schema:`https://json-schema.org/draft/2019-09/schema`,$id:`https://json-schema.org/draft/2019-09/meta/core`,$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:`Core vocabulary meta-schema`,type:[`object`,`boolean`],properties:{$id:{type:`string`,format:`uri-reference`,$comment:`Non-empty fragments not allowed.`,pattern:`^[^#]*#?$`},$schema:{type:`string`,format:`uri`},$anchor:{type:`string`,pattern:`^[A-Za-z][-A-Za-z0-9.:_]*$`},$ref:{type:`string`,format:`uri-reference`},$recursiveRef:{type:`string`,format:`uri-reference`},$recursiveAnchor:{type:`boolean`,default:!1},$vocabulary:{type:`object`,propertyNames:{type:`string`,format:`uri`},additionalProperties:{type:`boolean`}},$comment:{type:`string`},$defs:{type:`object`,additionalProperties:{$recursiveRef:`#`},default:{}}}}})),Y_=o(((e,t)=>{t.exports={$schema:`https://json-schema.org/draft/2019-09/schema`,$id:`https://json-schema.org/draft/2019-09/meta/format`,$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:`Format vocabulary meta-schema`,type:[`object`,`boolean`],properties:{format:{type:`string`}}}})),X_=o(((e,t)=>{t.exports={$schema:`https://json-schema.org/draft/2019-09/schema`,$id:`https://json-schema.org/draft/2019-09/meta/meta-data`,$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:`Meta-data vocabulary meta-schema`,type:[`object`,`boolean`],properties:{title:{type:`string`},description:{type:`string`},default:!0,deprecated:{type:`boolean`,default:!1},readOnly:{type:`boolean`,default:!1},writeOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0}}}})),Z_=o(((e,t)=>{t.exports={$schema:`https://json-schema.org/draft/2019-09/schema`,$id:`https://json-schema.org/draft/2019-09/meta/validation`,$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:`Validation vocabulary meta-schema`,type:[`object`,`boolean`],properties:{multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/$defs/nonNegativeInteger`},minLength:{$ref:`#/$defs/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},maxItems:{$ref:`#/$defs/nonNegativeInteger`},minItems:{$ref:`#/$defs/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},maxContains:{$ref:`#/$defs/nonNegativeInteger`},minContains:{$ref:`#/$defs/nonNegativeInteger`,default:1},maxProperties:{$ref:`#/$defs/nonNegativeInteger`},minProperties:{$ref:`#/$defs/nonNegativeIntegerDefault0`},required:{$ref:`#/$defs/stringArray`},dependentRequired:{type:`object`,additionalProperties:{$ref:`#/$defs/stringArray`}},const:!0,enum:{type:`array`,items:!0},type:{anyOf:[{$ref:`#/$defs/simpleTypes`},{type:`array`,items:{$ref:`#/$defs/simpleTypes`},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{$ref:`#/$defs/nonNegativeInteger`,default:0},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}}}})),Q_=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=G_(),n=K_(),r=q_(),i=J_(),a=Y_(),o=X_(),s=Z_(),c=[`/properties`];function l(e){return[t,n,r,i,l(this,a),o,l(this,s)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function l(t,n){return e?t.$dataMetaSchema(n,c):n}}e.default=l})),$_=o(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2019=void 0;let n=Gg(),r=O_(),i=L_(),a=V_(),o=W_(),s=A_(),c=Q_(),l=`https://json-schema.org/draft/2019-09/schema`;var u=class extends n.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(i.default),r.default.forEach(e=>this.addVocabulary(e)),this.addVocabulary(a.default),this.addVocabulary(o.default),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;t&&(c.default.call(this,e),this.refs[`http://json-schema.org/schema`]=l)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}};e.Ajv2019=u,t.exports=e=u,t.exports.Ajv2019=u,Object.defineProperty(e,"__esModule",{value:!0}),e.default=u;var d=Ig();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var f=Q();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return f._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return f.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return f.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return f.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return f.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return f.CodeGen}});var p=Lg();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return p.default}});var m=Rg();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return m.default}})})),ev=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Jg(),n=s_(),r=w_(),i=L_(),a=V_(),o=W_(),s=E_(),c=D_();e.default=[i.default,t.default,n.default,(0,r.default)(!0),s.default,c.metadataVocabulary,c.contentVocabulary,a.default,o.default]})),tv=o(((e,t)=>{t.exports={$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/schema`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:`meta`,title:`Core and Validation specifications meta-schema`,allOf:[{$ref:`meta/core`},{$ref:`meta/applicator`},{$ref:`meta/unevaluated`},{$ref:`meta/validation`},{$ref:`meta/meta-data`},{$ref:`meta/format-annotation`},{$ref:`meta/content`}],type:[`object`,`boolean`],$comment:`This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.`,properties:{definitions:{$comment:`"definitions" has been replaced by "$defs".`,type:`object`,additionalProperties:{$dynamicRef:`#meta`},deprecated:!0,default:{}},dependencies:{$comment:`"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.`,type:`object`,additionalProperties:{anyOf:[{$dynamicRef:`#meta`},{$ref:`meta/validation#/$defs/stringArray`}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:`"$recursiveAnchor" has been replaced by "$dynamicAnchor".`,$ref:`meta/core#/$defs/anchorString`,deprecated:!0},$recursiveRef:{$comment:`"$recursiveRef" has been replaced by "$dynamicRef".`,$ref:`meta/core#/$defs/uriReferenceString`,deprecated:!0}}}})),nv=o(((e,t)=>{t.exports={$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/applicator`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:`meta`,title:`Applicator vocabulary meta-schema`,type:[`object`,`boolean`],properties:{prefixItems:{$ref:`#/$defs/schemaArray`},items:{$dynamicRef:`#meta`},contains:{$dynamicRef:`#meta`},additionalProperties:{$dynamicRef:`#meta`},properties:{type:`object`,additionalProperties:{$dynamicRef:`#meta`},default:{}},patternProperties:{type:`object`,additionalProperties:{$dynamicRef:`#meta`},propertyNames:{format:`regex`},default:{}},dependentSchemas:{type:`object`,additionalProperties:{$dynamicRef:`#meta`},default:{}},propertyNames:{$dynamicRef:`#meta`},if:{$dynamicRef:`#meta`},then:{$dynamicRef:`#meta`},else:{$dynamicRef:`#meta`},allOf:{$ref:`#/$defs/schemaArray`},anyOf:{$ref:`#/$defs/schemaArray`},oneOf:{$ref:`#/$defs/schemaArray`},not:{$dynamicRef:`#meta`}},$defs:{schemaArray:{type:`array`,minItems:1,items:{$dynamicRef:`#meta`}}}}})),rv=o(((e,t)=>{t.exports={$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/unevaluated`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:`meta`,title:`Unevaluated applicator vocabulary meta-schema`,type:[`object`,`boolean`],properties:{unevaluatedItems:{$dynamicRef:`#meta`},unevaluatedProperties:{$dynamicRef:`#meta`}}}})),iv=o(((e,t)=>{t.exports={$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/content`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:`meta`,title:`Content vocabulary meta-schema`,type:[`object`,`boolean`],properties:{contentEncoding:{type:`string`},contentMediaType:{type:`string`},contentSchema:{$dynamicRef:`#meta`}}}})),av=o(((e,t)=>{t.exports={$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/core`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:`meta`,title:`Core vocabulary meta-schema`,type:[`object`,`boolean`],properties:{$id:{$ref:`#/$defs/uriReferenceString`,$comment:`Non-empty fragments not allowed.`,pattern:`^[^#]*#?$`},$schema:{$ref:`#/$defs/uriString`},$ref:{$ref:`#/$defs/uriReferenceString`},$anchor:{$ref:`#/$defs/anchorString`},$dynamicRef:{$ref:`#/$defs/uriReferenceString`},$dynamicAnchor:{$ref:`#/$defs/anchorString`},$vocabulary:{type:`object`,propertyNames:{$ref:`#/$defs/uriString`},additionalProperties:{type:`boolean`}},$comment:{type:`string`},$defs:{type:`object`,additionalProperties:{$dynamicRef:`#meta`}}},$defs:{anchorString:{type:`string`,pattern:`^[A-Za-z_][-A-Za-z0-9._]*$`},uriString:{type:`string`,format:`uri`},uriReferenceString:{type:`string`,format:`uri-reference`}}}})),ov=o(((e,t)=>{t.exports={$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/format-annotation`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:`meta`,title:`Format vocabulary meta-schema for annotation results`,type:[`object`,`boolean`],properties:{format:{type:`string`}}}})),sv=o(((e,t)=>{t.exports={$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/meta-data`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:`meta`,title:`Meta-data vocabulary meta-schema`,type:[`object`,`boolean`],properties:{title:{type:`string`},description:{type:`string`},default:!0,deprecated:{type:`boolean`,default:!1},readOnly:{type:`boolean`,default:!1},writeOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0}}}})),cv=o(((e,t)=>{t.exports={$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/validation`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:`meta`,title:`Validation vocabulary meta-schema`,type:[`object`,`boolean`],properties:{type:{anyOf:[{$ref:`#/$defs/simpleTypes`},{type:`array`,items:{$ref:`#/$defs/simpleTypes`},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/$defs/nonNegativeInteger`},minLength:{$ref:`#/$defs/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},maxItems:{$ref:`#/$defs/nonNegativeInteger`},minItems:{$ref:`#/$defs/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},maxContains:{$ref:`#/$defs/nonNegativeInteger`},minContains:{$ref:`#/$defs/nonNegativeInteger`,default:1},maxProperties:{$ref:`#/$defs/nonNegativeInteger`},minProperties:{$ref:`#/$defs/nonNegativeIntegerDefault0`},required:{$ref:`#/$defs/stringArray`},dependentRequired:{type:`object`,additionalProperties:{$ref:`#/$defs/stringArray`}}},$defs:{nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{$ref:`#/$defs/nonNegativeInteger`,default:0},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}}}})),lv=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=tv(),n=nv(),r=rv(),i=iv(),a=av(),o=ov(),s=sv(),c=cv(),l=[`/properties`];function u(e){return[t,n,r,i,a,u(this,o),s,u(this,c)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function u(t,n){return e?t.$dataMetaSchema(n,l):n}}e.default=u})),uv=o(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;let n=Gg(),r=ev(),i=A_(),a=lv(),o=`https://json-schema.org/draft/2020-12/schema`;var s=class extends n.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),r.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;t&&(a.default.call(this,e),this.refs[`http://json-schema.org/schema`]=o)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(o)?o:void 0)}};e.Ajv2020=s,t.exports=e=s,t.exports.Ajv2020=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s;var c=Ig();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var l=Q();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var u=Lg();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return u.default}});var d=Rg();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return d.default}})})),dv=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(e,t){return{validate:e,compare:t}}e.fullFormats={date:t(a,o),time:t(c(!0),l),"date-time":t(f(!0),p),"iso-time":t(c(),u),"iso-date-time":t(f(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:_,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:C,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:y,int32:{type:`number`,validate:ee},int64:{type:`number`,validate:te},float:{type:`number`,validate:ne},double:{type:`number`,validate:ne},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,p),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(e){return e%4==0&&(e%100!=0||e%400==0)}let r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){let t=r.exec(e);if(!t)return!1;let a=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(o===2&&n(a)?29:i[o])}function o(e,t){if(e&&t)return e>t?1:e<t?-1:0}let s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(e){return function(t){let n=s.exec(t);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=n[4],c=n[5]===`-`?-1:1,l=+(n[6]||0),u=+(n[7]||0);if(l>23||u>59||e&&!o)return!1;if(r<=23&&i<=59&&a<60)return!0;let d=i-u*c,f=r-l*c-+(d<0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function l(e,t){if(!(e&&t))return;let n=new Date(`2020-01-01T`+e).valueOf(),r=new Date(`2020-01-01T`+t).valueOf();if(n&&r)return n-r}function u(e,t){if(!(e&&t))return;let n=s.exec(e),r=s.exec(t);if(n&&r)return e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t?1:e<t?-1:0}let d=/t|\s/i;function f(e){let t=c(e);return function(e){let n=e.split(d);return n.length===2&&a(n[0])&&t(n[1])}}function p(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(n&&r)return n-r}function m(e,t){if(!(e&&t))return;let[n,r]=e.split(d),[i,a]=t.split(d),s=o(n,i);if(s!==void 0)return s||l(r,a)}let h=/\/|:/,g=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function _(e){return h.test(e)&&g.test(e)}let v=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function y(e){return v.lastIndex=0,v.test(e)}let b=-(2**31),x=2**31-1;function ee(e){return Number.isInteger(e)&&e<=x&&e>=b}function te(e){return Number.isInteger(e)}function ne(){return!0}let S=/[^\\]\\Z/;function C(e){if(S.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}})),fv=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=M_(),n=Q(),r=n.operators,i={formatMaximum:{okStr:`<=`,ok:r.LTE,fail:r.GT},formatMinimum:{okStr:`>=`,ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:`<`,ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:`>`,ok:r.GT,fail:r.LTE}};e.formatLimitDefinition={keyword:Object.keys(i),type:`string`,schemaType:`string`,$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,n.str)`should be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,n._)`{comparison: ${i[e].okStr}, limit: ${t}}`},code(e){let{gen:r,data:a,schemaCode:o,keyword:s,it:c}=e,{opts:l,self:u}=c;if(!l.validateFormats)return;let d=new t.KeywordCxt(c,u.RULES.all.format.definition,`format`);d.$data?f():p();function f(){let t=r.scopeValue(`formats`,{ref:u.formats,code:l.code.formats}),i=r.const(`fmt`,(0,n._)`${t}[${d.schemaCode}]`);e.fail$data((0,n.or)((0,n._)`typeof ${i} != "object"`,(0,n._)`${i} instanceof RegExp`,(0,n._)`typeof ${i}.compare != "function"`,m(i)))}function p(){let t=d.schema,i=u.formats[t];if(!i||i===!0)return;if(typeof i!=`object`||i instanceof RegExp||typeof i.compare!=`function`)throw Error(`"${s}": format "${t}" does not define "compare" function`);let a=r.scopeValue(`formats`,{key:t,ref:i,code:l.code.formats?(0,n._)`${l.code.formats}${(0,n.getProperty)(t)}`:void 0});e.fail$data(m(a))}function m(e){return(0,n._)`${e}.compare(${a}, ${o}) ${i[s].fail} 0`}},dependencies:[`format`]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)})),pv=o(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let n=dv(),r=fv(),i=Q(),a=new i.Name(`fullFormats`),o=new i.Name(`fastFormats`),s=(e,t={keywords:!0})=>{if(Array.isArray(t))return c(e,t,n.fullFormats,a),e;let[i,s]=t.mode===`fast`?[n.fastFormats,o]:[n.fullFormats,a];return c(e,t.formats||n.formatNames,i,s),t.keywords&&(0,r.default)(e),e};s.get=(e,t=`full`)=>{let r=(t===`fast`?n.fastFormats:n.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function c(e,t,n,r){var a;(a=e.opts.code).formats??(a.formats=(0,i._)`require("ajv-formats/dist/formats").${r}`);for(let r of t)e.addFormat(r,n[r])}t.exports=e=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s})),mv=M_(),hv=$_(),gv=uv();const _v=l(pv(),1).default;function vv(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return _v(t),t}var yv=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=e!==void 0,this._ajv=e}get ajv(){return this._ajv??=vv(gv.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=h(e,`pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.`);return t===`2020-12`?this.ajv:t===`2019-09`?this._ajv2019??=vv(hv.Ajv2019):this._ajvDraft7??=vv(mv.Ajv)}getValidator(e){let t=this._engineFor(e),n=`$id`in e&&typeof e.$id==`string`?t.getSchema(e.$id)??t.compile(e):t.compile(e);return e=>n(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:t.errorsText(n.errors)}}};mv.Ajv;const bv=Symbol.for(`mcp.completable`);function xv(e,t){return Object.defineProperty(e,bv,{value:{complete:t},enumerable:!1,writable:!1,configurable:!1}),e}function Sv(e){return!!e&&typeof e==`object`&&bv in e}function Cv(e){return e[bv]?.complete}const wv=2**31-1;function Tv(e,t){if(!Number.isFinite(e)||e<1)return;let n=setInterval(t,Math.min(e,wv));return n.unref?.(),n}var Ev=class{_listeners=new Set;constructor(e){this.onerror=e}publish(e){for(let t of this._listeners)try{t(e)}catch(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}}subscribe(e){this._listeners.add(e);let t=!0;return()=>{t&&(t=!1,this._listeners.delete(e))}}get listenerCount(){return this._listeners.size}};function Dv(e){return{toolsChanged:()=>e.publish({kind:`tools_list_changed`}),promptsChanged:()=>e.publish({kind:`prompts_list_changed`}),resourcesChanged:()=>e.publish({kind:`resources_list_changed`}),resourceUpdated:t=>e.publish({kind:`resource_updated`,uri:t})}}function Ov(e,t){switch(t.kind){case`tools_list_changed`:return e.toolsListChanged===!0;case`prompts_list_changed`:return e.promptsListChanged===!0;case`resources_list_changed`:return e.resourcesListChanged===!0;case`resource_updated`:return e.resourceSubscriptions!==void 0&&e.resourceSubscriptions.includes(t.uri)}}function kv(e,t){let n={},r=e=>t===void 0||e===!0;return e.toolsListChanged===!0&&r(t?.tools?.listChanged)&&(n.toolsListChanged=!0),e.promptsListChanged===!0&&r(t?.prompts?.listChanged)&&(n.promptsListChanged=!0),e.resourcesListChanged===!0&&r(t?.resources?.listChanged)&&(n.resourcesListChanged=!0),e.resourceSubscriptions!==void 0&&e.resourceSubscriptions.length>0&&r(t?.resources?.subscribe)&&(n.resourceSubscriptions=[...e.resourceSubscriptions]),n}function Av(e){switch(e.kind){case`tools_list_changed`:return{method:`notifications/tools/list_changed`};case`prompts_list_changed`:return{method:`notifications/prompts/list_changed`};case`resources_list_changed`:return{method:`notifications/resources/list_changed`};case`resource_updated`:return{method:`notifications/resources/updated`,params:{uri:e.uri}}}}function jv(e,t,n){return Response.json({jsonrpc:`2.0`,error:{code:t,message:n},id:e},{status:200})}function Mv(e,t){return{method:e.method,params:{...e.params,_meta:{...e.params?._meta,[Oc]:t}}}}function Nv(e){let t=Gp(Wp).validateRequest(`subscriptions/listen`,e);return t.ok?t.value.params?.notifications:void 0}function Pv(e){let{bus:t,onerror:n}=e,r=e.maxSubscriptions??1024,i=e.keepAliveMs??15e3,a=new Set;function o(e,o,s,c){if(a.size>=r)return n?.(Error(`subscriptions/listen refused: subscription limit reached (${r})`)),jv(e.id,-32603,`Subscription limit reached`);let l=Nv(e);if(l===void 0)return jv(e.id,-32602,`Invalid params: 'notifications' is required and must be a valid SubscriptionFilter`);let u=kv(l,s),d=e.id,f=new TextEncoder,p,m=!1,h,g,_,v=e=>{if(!m)try{p.enqueue(f.encode(e))}catch(e){n?.(e instanceof Error?e:Error(String(e)))}},y=(e,t)=>{v(`event: message\ndata: ${JSON.stringify({jsonrpc:`2.0`,method:e,params:t})}\n\n`)},b=e=>{if(!m){e&&v(`event: message\ndata: ${JSON.stringify({jsonrpc:`2.0`,id:d,result:{resultType:`complete`,_meta:{[Oc]:d,[Ec]:c}}})}\n\n`),m=!0;try{h?.()}catch(e){n?.(e instanceof Error?e:Error(String(e)))}g!==void 0&&clearInterval(g),_?.(),a.delete(b);try{p.close()}catch{}}},x=new ReadableStream({start(e){p=e;let n=Mv({method:`notifications/subscriptions/acknowledged`,params:{notifications:u}},d);y(n.method,n.params),h=t.subscribe(e=>{if(m||!Ov(u,e))return;let t=Mv(Av(e),d);y(t.method,t.params)}),g=Tv(i,()=>v(`: keepalive
`)),a.add(b)},cancel(){b(!1)}});if(o!==void 0){if(o.aborted)b(!1);else{let e=()=>b(!1);o.addEventListener(`abort`,e,{once:!0}),_=()=>o.removeEventListener(`abort`,e)}}return new Response(x,{status:200,headers:{"Content-Type":`text/event-stream`,"Cache-Control":`no-cache, no-transform`,Connection:`keep-alive`,"X-Accel-Buffering":`no`}})}return{serve:o,closeAll(){for(let e of a)e(!0)},get openCount(){return a.size}}}function Fv(e){if(e?.maxRounds!==void 0&&(!Number.isInteger(e.maxRounds)||e.maxRounds<1))throw RangeError(`inputRequired.maxRounds must be a positive integer (got ${e.maxRounds})`);if(e?.roundTimeoutMs!==void 0&&(!Number.isFinite(e.roundTimeoutMs)||e.roundTimeoutMs<=0))throw RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${e.roundTimeoutMs})`);return{maxRounds:e?.maxRounds??8,roundTimeoutMs:e?.roundTimeoutMs??6e5,legacyShim:e?.legacyShim??!0}}function Iv(e,t,n){if(typeof n!=`object`||!n||typeof n.method!=`string`)throw new Z(X.InternalError,`Handler for ${e} returned an invalid input request '${t}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let r=n,i=hf(r);if(i===void 0)throw new Z(X.InternalError,`Handler for ${e} returned an input request '${t}' of kind '${r.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:r,required:i}}function Lv(){let e=globalThis.crypto;if(e?.randomUUID!==void 0)return e.randomUUID();let t=new Uint8Array(16);e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=[...t].map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function Rv(e,t){if(e===`tools/call`)return{content:[{type:`text`,text:t}],isError:!0};throw new Z(X.InternalError,t)}var zv=class{constructor(e){this._host=e}async fulfill(e,t,n,r,i){let{maxRounds:a,roundTimeoutMs:o}=this._host,s=r.mcpReq.signal,c=i,l=0;for(;;){if(l+=1,l>a)return Rv(e,Ch(e,a));let i=c.inputRequests,u=i!=null&&Object.keys(i).length>0,d=typeof c.requestState==`string`?c.requestState:void 0;if(!u&&d===void 0)throw new Z(X.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);let f;if(u){let t=this._host.resolvedClientCapabilities(r),n=[];for(let[r,a]of Object.entries(i)){let{embedded:i,required:o}=Iv(e,r,a);if(i.method!==`roots/list`&&i.params===void 0)throw new Z(X.InternalError,`Handler for ${e} returned an input request '${r}' of kind '${i.method}' without params`);if(gf(o,t)!==void 0)return Rv(e,`Cannot request input '${r}' (${i.method}): the client on this 2025-era connection did not declare the required capability${t===void 0?` (no client capabilities are available on this connection — per-request legacy serving cannot receive server-to-client requests)`:``}`);n.push([r,i])}let a=Th(s);try{let e={relatedRequestId:r.mcpReq.id,timeout:o,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:a.signal},t=await Promise.all(n.map(async([t,n])=>{try{return[t,await this._dispatchLeg(n,e)]}catch(e){throw a.abort(e),e}}));f=Object.fromEntries(t)}catch(t){if(s.aborted)throw t;return Rv(e,`Fulfilling input required by '${e}' failed: ${t instanceof Error?t.message:String(t)}`)}finally{a.dispose()}}else await wh(250,s);let p={...r,mcpReq:{...r.mcpReq,inputResponses:f,droppedInputResponseKeys:void 0,requestState:zh(d)}};if(d!==void 0){let t=await this._host.verifyRequestState(d,p,e);t!==void 0&&(p=Vh(p,t))}let m=await t(n,p);if(!lm(m))return m;c=m}}async _dispatchLeg(e,t){switch(e.method){case`elicitation/create`:{let n=e.params;return n.mode===`url`&&n.elicitationId===void 0&&(n={...n,elicitationId:Lv()}),await this._host.sendElicitation(n,t)}case`sampling/createMessage`:return await this._host.sendSampling(e.params,t);case`roots/list`:return await this._host.listRoots(e.params,t)}}};const Bv=new Set([`tools/call`,`prompts/get`,`resources/read`]);let Vv,Hv,Uv;function Wv(e,t){Vv(e,t)}function Gv(e,t){Hv(e,t)}function Kv(e){return Uv(e)}var qv=class extends Wh{_clientCapabilities;_clientVersion;static{Vv=(e,t)=>{t.clientCapabilities!==void 0&&(e._clientCapabilities=t.clientCapabilities),t.clientInfo!==void 0&&(e._clientVersion=t.clientInfo)},Hv=(e,t)=>{let n=t.filter(t=>!e._supportedProtocolVersions.includes(t));n.length>0&&(e._supportedProtocolVersions=[...e._supportedProtocolVersions,...n]),e.setRequestHandler(`server/discover`,()=>e._ondiscover())},Uv=e=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new zv({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:e=>this._inputRequestCapabilityView(e),verifyRequestState:(e,t,n)=>this._verifyRequestState(e,t,n),sendElicitation:(e,t)=>this._sendElicitationLeg(e,t,{validateAcceptedContent:!1}),sendSampling:(e,t)=>this.createMessage(e,t),listRoots:(e,t)=>this.listRoots(e,t)})}oninitialized;constructor(e,t){if(super(t),this._serverInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new yv,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=Fv(t?.inputRequired),t?.cacheHints!==void 0){for(let[e,n]of Object.entries(t.cacheHints))n!==void 0&&sp(n,`cacheHints['${e}']`);this._cacheHints=t.cacheHints}this.setRequestHandler(`initialize`,e=>this._oninitialize(e)),this.setNotificationHandler(`notifications/initialized`,()=>this.oninitialized?.()),xf(this._supportedProtocolVersions).length>0&&this.setRequestHandler(`server/discover`,()=>this._ondiscover()),this._capabilities.logging&&this._registerLoggingHandler()}_registerLoggingHandler(){this.setRequestHandler(`logging/setLevel`,async(e,t)=>{let n=t.sessionId||t.http?.req?.headers.get(`mcp-session-id`)||void 0,{level:r}=e.params,i=Km(Mu,r);return i.success&&this._loggingLevels.set(n,i.data),{}})}buildContext(e,t){let n=e.http||t?.request||t?.closeSSEStream||t?.closeStandaloneSSEStream;return{...e,mcpReq:{...e.mcpReq,log:(t,n,r)=>{if(!this._capabilities.logging)return Promise.resolve();let i;if(this._servedModernEra()){if(i=e.mcpReq.envelope?.[kc],i===void 0)return Promise.resolve()}else i=this._loggingLevels.get(e.sessionId)??this._loggingLevels.get(void 0);return i!==void 0&&this.LOG_LEVEL_SEVERITY.get(t)<this.LOG_LEVEL_SEVERITY.get(i)?Promise.resolve():e.mcpReq.notify({method:`notifications/message`,params:{level:t,data:n,logger:r}})},elicitInput:(e,t)=>this.elicitInput(e,t),requestSampling:(e,t)=>this.createMessage(e,t)},http:n?{...e.http,req:t?.request,closeSSE:t?.closeSSEStream,closeStandaloneSSE:t?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(Mu.options.map((e,t)=>[e,t]));isMessageIgnored=(e,t)=>{let n=this._loggingLevels.get(t);return n?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(n):!1};registerCapabilities(e){if(this.transport)throw new Y(J.AlreadyConnected,`Cannot register capabilities after connecting to transport`);let t=!!this._capabilities.logging;this._capabilities=Kh(this._capabilities,e),!t&&this._capabilities.logging&&this._registerLoggingHandler()}_wrapHandler(e,t){if(e!==`tools/call`){let n=this._cacheHints?.[e],r=Bv.has(e);return n===void 0&&!r?async(n,r)=>{let i=await t(n,r);if(lm(i))throw new Z(X.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return i}:async(i,a)=>{let o=r?await this._invokeInputRequiredCapableHandler(e,t,i,a):await t(i,a);if(lm(o)){if(!r)throw new Z(X.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return o}return n===void 0?o:rp(o,n)}}return async(e,n)=>{let r=Gp(this._negotiatedProtocolVersion),i=r.validateRequest(`tools/call`,e);if(!i.ok)throw new Z(i.reason===`not-in-era`?X.InternalError:X.InvalidParams,i.reason===`not-in-era`?`No wire schema for tools/call in the resolved era`:`Invalid tools/call request: ${i.message}`);let a=await this._invokeInputRequiredCapableHandler(`tools/call`,t,e,n);if(lm(a))return a;let o=wf(a),s=r.validateResult(`tools/call`,o);if(!s.ok)throw new Z(s.reason===`not-in-era`?X.InternalError:X.InvalidParams,s.reason===`not-in-era`?`No wire schema for tools/call in the resolved era`:`Invalid tools/call result: ${s.message}`);return s.value}}_servedModernEra(){return this._negotiatedProtocolVersion!==void 0&&yf(this._negotiatedProtocolVersion)}async _invokeInputRequiredCapableHandler(e,t,n,r){let i=this._servedModernEra(),a=r.mcpReq.requestState();if(a!==void 0&&typeof a!=`string`)throw new Z(X.InvalidParams,`Invalid or expired requestState`,{reason:`invalid_request_state`});let o=r;if(typeof a==`string`){let t=await this._verifyRequestState(a,r,e);t!==void 0&&(o=Vh(r,t))}let s;try{s=await t(n,o)}catch(e){throw e instanceof Z&&e.code===X.UrlElicitationRequired&&i?new Z(X.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { …: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`):e}if(!lm(s))return s;if(!i){if(!this._inputRequiredServing.legacyShim)throw new Z(X.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??`2025-11-25`}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(e,t,n,o,s)}let c=s.inputRequests,l=c!=null&&Object.keys(c).length>0,u=typeof s.requestState==`string`;if(!l&&!u)throw new Z(X.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(l){let t=this._inputRequestCapabilityView(r);for(let[n,r]of Object.entries(c)){let{embedded:i,required:a}=Iv(e,n,r),o=gf(a,t);if(o!==void 0)throw new dp({requiredCapabilities:o},`Cannot request input '${n}' (${i.method}): the request's client capabilities do not declare the required capability`)}}return s}async _verifyRequestState(e,t,n){if(this._requestStateVerify!==void 0)try{return await this._requestStateVerify(e,t)}catch(e){throw this.onerror?.(Error(`requestState verification rejected ${n}: ${e instanceof Error?e.message:String(e)}`)),new Z(X.InvalidParams,`Invalid or expired requestState`,{reason:`invalid_request_state`})}}_inputRequestCapabilityView(e){return this._servedModernEra()?e.mcpReq.envelope?.[Dc]:this._clientCapabilities}_assertPushApiInServedEra(e){if(this._servedModernEra())throw new Y(J.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${e}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead — the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:e,era:`2026-07-28`})}assertCapabilityForMethod(e){switch(e){case`sampling/createMessage`:if(!this._clientCapabilities?.sampling)throw new Y(J.CapabilityNotSupported,`Client does not support sampling (required for ${e})`);break;case`elicitation/create`:if(!this._clientCapabilities?.elicitation)throw new Y(J.CapabilityNotSupported,`Client does not support elicitation (required for ${e})`);break;case`roots/list`:if(!this._clientCapabilities?.roots)throw new Y(J.CapabilityNotSupported,`Client does not support listing roots (required for ${e})`)}}assertNotificationCapability(e){switch(e){case`notifications/message`:if(!this._capabilities.logging)throw new Y(J.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case`notifications/resources/updated`:case`notifications/resources/list_changed`:if(!this._capabilities.resources)throw new Y(J.CapabilityNotSupported,`Server does not support notifying about resources (required for ${e})`);break;case`notifications/tools/list_changed`:if(!this._capabilities.tools)throw new Y(J.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${e})`);break;case`notifications/prompts/list_changed`:if(!this._capabilities.prompts)throw new Y(J.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${e})`);break;case`notifications/elicitation/complete`:if(!this._clientCapabilities?.elicitation?.url)throw new Y(J.CapabilityNotSupported,`Client does not support URL elicitation (required for ${e})`)}}assertRequestHandlerCapability(e){switch(e){case`completion/complete`:if(!this._capabilities.completions)throw new Y(J.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case`logging/setLevel`:if(!this._capabilities.logging)throw new Y(J.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case`prompts/get`:case`prompts/list`:if(!this._capabilities.prompts)throw new Y(J.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case`resources/list`:case`resources/templates/list`:case`resources/read`:if(!this._capabilities.resources)throw new Y(J.CapabilityNotSupported,`Server does not support resources (required for ${e})`);break;case`tools/call`:case`tools/list`:if(!this._capabilities.tools)throw new Y(J.CapabilityNotSupported,`Server does not support tools (required for ${e})`)}}async _oninitialize(e){let t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;let n=bf(this._supportedProtocolVersions),r=n.includes(t)?t:n[0]??`2025-11-25`;return this._negotiatedProtocolVersion=r,this.transport?.setProtocolVersion?.(r),{protocolVersion:r,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:xf(this._supportedProtocolVersions),capabilities:Jv(this.getCapabilities()),...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(e,t){return this._wireCodec().projectCallToolResult(e,t)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra(`ping`),this.request({method:`ping`})}async createMessage(e,t){if(this._assertPushApiInServedEra(`sampling/createMessage`),(e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Y(J.CapabilityNotSupported,`Client does not support sampling tools capability.`);if(e.messages.length>0){let t=e.messages.at(-1),n=Array.isArray(t.content)?t.content:[t.content],r=n.some(e=>e.type===`tool_result`),i=e.messages.length>1?e.messages.at(-2):void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],o=a.some(e=>e.type===`tool_use`);if(r){if(n.some(e=>e.type!==`tool_result`))throw new Z(X.InvalidParams,`The last message must contain only tool_result content if any is present`);if(!o)throw new Z(X.InvalidParams,`tool_result blocks are not matching any tool_use from the previous message`)}if(o){let e=new Set(a.filter(e=>e.type===`tool_use`).map(e=>e.id)),t=new Set(n.filter(e=>e.type===`tool_result`).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw new Z(X.InvalidParams,`ids of tool_result blocks and tool_use blocks from previous message do not match`)}}let n=!!(e.tools||e.toolChoice),r=await this.request({method:`sampling/createMessage`,params:e},t),i=this._wireCodec().samplingResultVariant(n,r);if(!i.ok)throw new Y(J.InvalidResult,`Invalid sampling/createMessage result: ${i.reason===`invalid`?i.message:i.reason}`);return i.value}async elicitInput(e,t){switch(this._assertPushApiInServedEra(`elicitation/create`),e.mode??`form`){case`url`:if(!this._clientCapabilities?.elicitation?.url)throw new Y(J.CapabilityNotSupported,`Client does not support url elicitation.`);break;case`form`:if(!this._clientCapabilities?.elicitation?.form)throw new Y(J.CapabilityNotSupported,`Client does not support form elicitation.`)}return this._sendElicitationLeg(e,t)}async _sendElicitationLeg(e,t,n){let r=e.mode??`form`,i=n?.validateAcceptedContent??!0;switch(r){case`url`:{let n=e;return this.request({method:`elicitation/create`,params:n},t)}case`form`:{let n=e.mode===`form`?e:{...e,mode:`form`},r=await this.request({method:`elicitation/create`,params:n},t);if(i&&r.action===`accept`&&r.content&&n.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(n.requestedSchema)(r.content);if(!e.valid)throw new Z(X.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){throw e instanceof Z?e:new Z(X.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return r}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new Y(J.CapabilityNotSupported,`Client does not support URL elicitation (required for notifications/elicitation/complete)`);return()=>this.notification({method:`notifications/elicitation/complete`,params:{elicitationId:e}},t)}async listRoots(e,t){return this._assertPushApiInServedEra(`roots/list`),this.request({method:`roots/list`,params:e},t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:`notifications/message`,params:e})}async sendResourceUpdated(e){return this.notification({method:`notifications/resources/updated`,params:e})}async sendResourceListChanged(){return this.notification({method:`notifications/resources/list_changed`})}async sendToolListChanged(){return this.notification({method:`notifications/tools/list_changed`})}async sendPromptListChanged(){return this.notification({method:`notifications/prompts/list_changed`})}};function Jv(e){return{...e}}var Yv=class{server;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(e){let t=this._registeredTools[e];if(t!==void 0&&t.enabled){if(Object.hasOwn(this._toolInputSchemaJson,e))return this._toolInputSchemaJson[e];if(t.inputSchema===void 0)return Qv;try{let n=Zm(t.inputSchema,`input`);return this._toolInputSchemaJson[e]=n,n}catch{return}}}constructor(e,t){this.server=new qv(e,t),t?.capabilities?.tools&&this.setToolRequestHandlers(),t?.capabilities?.resources&&this.setResourceRequestHandlers(),t?.capabilities?.prompts&&this.setPromptRequestHandlers()}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}_toolHandlersInitialized=!1;setToolRequestHandlers(){this._toolHandlersInitialized||=(this.server.assertCanSetRequestHandler(`tools/list`),this.server.assertCanSetRequestHandler(`tools/call`),this.server.registerCapabilities({tools:{listChanged:this.server.getCapabilities().tools?.listChanged??!0}}),this.server.setRequestHandler(`tools/list`,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let n={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?Zm(t.inputSchema,`input`):Qv,annotations:t.annotations,icons:t.icons,execution:t.execution,_meta:t._meta};return t.outputSchema&&(n.outputSchema=Zm(t.outputSchema,`output`)),n})})),this.server.setRequestHandler(`tools/call`,async(e,t)=>{let n=this._registeredTools[e.params.name];if(!n)throw new Z(X.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new Z(X.InvalidParams,`Tool ${e.params.name} disabled`);try{let r=await this.validateToolInput(n,e.params.arguments,e.params.name),i=await this.executeToolHandler(n,r,t);return await this.validateToolOutput(n,i,e.params.name),lm(i)?i:this.server.projectCallToolResult(i,n.outputSchemaJson)}catch(e){if(e instanceof Z&&e.code===X.UrlElicitationRequired)throw e;return this.createToolError(e instanceof Error?e.message:String(e))}}),!0)}createToolError(e){return{content:[{type:`text`,text:e}],isError:!0}}async validateToolInput(e,t,n){if(!e.inputSchema)return;let r=await eh(e.inputSchema,t??{});if(!r.success)throw new Z(X.InvalidParams,`Input validation error: Invalid arguments for tool ${n}: ${r.error}`);return r.data}async validateToolOutput(e,t,n){if(!e.outputSchema||lm(t)||t.isError)return;if(t.structuredContent===void 0)throw new Z(X.InvalidParams,`Output validation error: Tool ${n} has an output schema but no structured content was provided`);let r=await eh(e.outputSchema,t.structuredContent);if(!r.success)throw new Z(X.InvalidParams,`Output validation error: Invalid structured content for tool ${n}: ${r.error}`)}async executeToolHandler(e,t,n){return e.executor(t,n)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){this._completionHandlerInitialized||=(this.server.assertCanSetRequestHandler(`completion/complete`),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(`completion/complete`,async e=>{switch(e.params.ref.type){case`ref/prompt`:return pm(e),this.handlePromptCompletion(e,e.params.ref);case`ref/resource`:return mm(e),this.handleResourceCompletion(e,e.params.ref);default:throw new Z(X.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),!0)}async handlePromptCompletion(e,t){let n=this._registeredPrompts[t.name];if(!n)throw new Z(X.InvalidParams,`Prompt ${t.name} not found`);if(!n.enabled)throw new Z(X.InvalidParams,`Prompt ${t.name} disabled`);if(!n.argsSchema)return ny;let r=ay(ry(n.argsSchema)?.[e.params.argument.name]);if(!Sv(r))return ny;let i=Cv(r);return i?ty(await i(e.params.argument.value,e.params.context)):ny}async handleResourceCompletion(e,t){let n=Object.values(this._registeredResourceTemplates).find(e=>e.resourceTemplate.uriTemplate.toString()===t.uri);if(!n){if(this._registeredResources[t.uri])return ny;throw new Z(X.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let r=n.resourceTemplate.completeCallback(e.params.argument.name);return r?ty(await r(e.params.argument.value,e.params.context)):ny}_resourceHandlersInitialized=!1;setResourceRequestHandlers(){this._resourceHandlersInitialized||=(this.server.assertCanSetRequestHandler(`resources/list`),this.server.assertCanSetRequestHandler(`resources/templates/list`),this.server.assertCanSetRequestHandler(`resources/read`),this.server.registerCapabilities({resources:{listChanged:this.server.getCapabilities().resources?.listChanged??!0}}),this.server.setRequestHandler(`resources/list`,async(e,t)=>{let n=Object.entries(this._registeredResources).filter(([e,t])=>t.enabled).map(([e,t])=>({uri:e,name:t.name,...t.metadata})),r=[];for(let e of Object.values(this._registeredResourceTemplates)){if(!e.resourceTemplate.listCallback)continue;let n=await e.resourceTemplate.listCallback(t);for(let t of n.resources)r.push({...e.metadata,...t})}return{resources:[...n,...r]}}),this.server.setRequestHandler(`resources/templates/list`,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler(`resources/read`,async(e,t)=>{let n;try{n=new URL(e.params.uri)}catch{throw new Z(X.InvalidParams,`Resource URI ${e.params.uri} is invalid`,{uri:e.params.uri,reason:`invalid_uri`})}let r=this._registeredResources[n.toString()];if(r){if(!r.enabled)throw new Z(X.InvalidParams,`Resource ${n} disabled`);return rp(await r.readCallback(n,t),r.cacheHint)}for(let e of Object.values(this._registeredResourceTemplates)){let r=e.resourceTemplate.uriTemplate.match(n.toString());if(r)return rp(await e.readCallback(n,r,t),e.cacheHint)}throw new cp(e.params.uri)}),!0)}_promptHandlersInitialized=!1;setPromptRequestHandlers(){this._promptHandlersInitialized||=(this.server.assertCanSetRequestHandler(`prompts/list`),this.server.assertCanSetRequestHandler(`prompts/get`),this.server.registerCapabilities({prompts:{listChanged:this.server.getCapabilities().prompts?.listChanged??!0}}),this.server.setRequestHandler(`prompts/list`,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?oh(t.argsSchema):void 0,icons:t.icons,_meta:t._meta}))})),this.server.setRequestHandler(`prompts/get`,async(e,t)=>{let n=this._registeredPrompts[e.params.name];if(!n)throw new Z(X.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new Z(X.InvalidParams,`Prompt ${e.params.name} disabled`);return n.handler(e.params.arguments,t)}),!0)}registerResource(e,t,n,r){let i=n.cacheHint,a=n;if(i!==void 0){sp(i,`resource ${e}`);let t={...n};delete t.cacheHint,a=t}if(typeof t==`string`){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let o=this._createRegisteredResource(e,n.title,t,a,r);return i!==void 0&&(o.cacheHint=i),this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,n.title,t,a,r);return i!==void 0&&(o.cacheHint=i),this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(e,t,n,r,i){let a={name:e,title:t,metadata:r,readCallback:i,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({uri:null}),update:e=>{e.uri!==void 0&&e.uri!==n&&(delete this._registeredResources[n],e.uri&&(this._registeredResources[e.uri]=a)),e.name!==void 0&&(a.name=e.name),e.title!==void 0&&(a.title=e.title),e.metadata!==void 0&&(a.metadata=e.metadata),e.callback!==void 0&&(a.readCallback=e.callback),e.enabled!==void 0&&(a.enabled=e.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=a,a}_createRegisteredResourceTemplate(e,t,n,r,i){let a={resourceTemplate:n,title:t,metadata:r,readCallback:i,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({name:null}),update:t=>{t.name!==void 0&&t.name!==e&&(delete this._registeredResourceTemplates[e],t.name&&(this._registeredResourceTemplates[t.name]=a)),t.title!==void 0&&(a.title=t.title),t.template!==void 0&&(a.resourceTemplate=t.template),t.metadata!==void 0&&(a.metadata=t.metadata),t.callback!==void 0&&(a.readCallback=t.callback),t.enabled!==void 0&&(a.enabled=t.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=a;let o=n.uriTemplate.variableNames;return Array.isArray(o)&&o.some(e=>!!n.completeCallback(e))&&this.setCompletionRequestHandler(),a}_createRegisteredPrompt(e,t,n,r,i,a,o){let s=r,c=i,l={title:t,description:n,argsSchema:r,icons:a,_meta:o,handler:ey(e,r,i),enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:t=>{t.name!==void 0&&t.name!==e&&(delete this._registeredPrompts[e],t.name&&(this._registeredPrompts[t.name]=l)),t.title!==void 0&&(l.title=t.title),t.description!==void 0&&(l.description=t.description),t.icons!==void 0&&(l.icons=t.icons),t._meta!==void 0&&(l._meta=t._meta);let n=!1;t.argsSchema!==void 0&&(l.argsSchema=t.argsSchema,s=t.argsSchema,n=!0),t.callback!==void 0&&(c=t.callback,n=!0),n&&(l.handler=ey(e,s,c)),t.enabled!==void 0&&(l.enabled=t.enabled),this.sendPromptListChanged()}};if(this._registeredPrompts[e]=l,r){let e=ry(r);e&&Object.values(e).some(e=>Sv(ay(e)))&&this.setCompletionRequestHandler()}return l}_createRegisteredTool(e,t,n,r,i,a,o,s,c,l){if(sg(e),r!==void 0)try{let t=Zm(r,`input`);this._toolInputSchemaJson[e]=t;let n=vm(t);n.valid||console.warn(`[mcp-sdk] tool '${e}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${n.reason}`)}catch{}let u=l,d={title:t,description:n,inputSchema:r,outputSchema:i,outputSchemaJson:$v(i),annotations:a,icons:o,execution:s,_meta:c,handler:l,executor:Zv(r,l),enabled:!0,disable:()=>d.update({enabled:!1}),enable:()=>d.update({enabled:!0}),remove:()=>d.update({name:null}),update:t=>{t.name!==void 0&&t.name!==e&&(typeof t.name==`string`&&sg(t.name),delete this._registeredTools[e],delete this._toolInputSchemaJson[e],t.name&&(delete this._toolInputSchemaJson[t.name],this._registeredTools[t.name]=d,e=t.name)),t.title!==void 0&&(d.title=t.title),t.description!==void 0&&(d.description=t.description);let n=!1;t.paramsSchema!==void 0&&(d.inputSchema=t.paramsSchema,delete this._toolInputSchemaJson[e],n=!0),t.callback!==void 0&&(d.handler=t.callback,u=t.callback,n=!0),n&&(d.executor=Zv(d.inputSchema,u)),t.outputSchema!==void 0&&(d.outputSchema=t.outputSchema,d.outputSchemaJson=$v(t.outputSchema)),t.annotations!==void 0&&(d.annotations=t.annotations),t.icons!==void 0&&(d.icons=t.icons),t._meta!==void 0&&(d._meta=t._meta),t.enabled!==void 0&&(d.enabled=t.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=d,this.setToolRequestHandlers(),this.sendToolListChanged(),d}registerTool(e,t,n){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:r,description:i,inputSchema:a,outputSchema:o,annotations:s,icons:c,_meta:l}=t;return this._createRegisteredTool(e,r,i,vg(a),vg(o),s,c,void 0,l,n)}registerPrompt(e,t,n){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:r,description:i,argsSchema:a,icons:o,_meta:s}=t,c=this._createRegisteredPrompt(e,r,i,vg(a),n,o,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),c}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},Xv=class{_uriTemplate;constructor(e,t){this._callbacks=t,this._uriTemplate=typeof e==`string`?new pg(e):e}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(e){return this._callbacks.complete?.[e]}};function Zv(e,t){if(e){let e=t;return async(t,n)=>e(t,n)}let n=t;return async(e,t)=>n(t)}const Qv={type:`object`,properties:{}};function $v(e){if(e!==void 0)try{return Zm(e,`output`)}catch{return}}function ey(e,t,n){if(t){let r=n;return async(n,i)=>{let a=await eh(t,n);if(!a.success)throw new Z(X.InvalidParams,`Invalid arguments for prompt ${e}: ${a.error}`);return r(a.data,i)}}{let e=n;return async(t,n)=>e(n)}}function ty(e){return{completion:{values:e.map(String).slice(0,100),total:e.length,hasMore:e.length>100}}}const ny={completion:{values:[],hasMore:!1}};function ry(e){let t=e;if(t.shape&&typeof t.shape==`object`)return t.shape}function iy(e){return e?.type===`optional`}function ay(e){return iy(e)?e.def?.innerType??e:e}var oy=class{onclose;onerror;onmessage;_classification;_responseMode;_started=!1;_used=!1;_closed=!1;_terminalDelivered=!1;_dispatchWindowOpen=!1;_requestId;_deferredResponse;_sse;_abortCleanup;_keepAliveMs;constructor(e){this._classification=e.classification,this._responseMode=e.responseMode??`auto`,this._keepAliveMs=e.keepAliveMs??15e3}async start(){if(this._started)throw Error(`PerRequestHTTPServerTransport is already started`);this._started=!0}async handleMessage(e,t){if(this._used)throw Error(`PerRequestHTTPServerTransport serves exactly one exchange; construct a new transport per request`);if(!this._started||this.onmessage===void 0)throw Error(`PerRequestHTTPServerTransport is not connected: connect a server to this transport before handling a message`);if(this._closed)throw Error(`PerRequestHTTPServerTransport is closed`);this._used=!0;let n=t?.request?.signal;if(n?.aborted)throw await this.close(),new Y(J.ConnectionClosed,`The request was aborted before it could be handled`);let r={classification:this._classification,...t?.request!==void 0&&{request:t.request},...t?.authInfo!==void 0&&{authInfo:t.authInfo}};if(rm(e)){this._requestId=e.id;let t,i,a=new Promise((e,n)=>{t=e,i=n});if(this._deferredResponse={promise:a,resolve:t,reject:i,settled:!1},n!==void 0){let e=()=>void this.close();n.addEventListener(`abort`,e,{once:!0}),this._abortCleanup=()=>n.removeEventListener(`abort`,e)}this._dispatchWindowOpen=!0;try{this.onmessage(e,r)}finally{this._dispatchWindowOpen=!1}return this._responseMode===`sse`&&!this._closed&&!this._deferredResponse.settled&&this.upgradeToSse(),a}return this.onmessage(e,r),new Response(null,{status:202})}async send(e,t){if(this._closed)return;let n=am(e)||om(e),r=n?e.id:t?.relatedRequestId;if(this._requestId===void 0||r===void 0||r!==this._requestId){n&&this.onerror?.(Error(`Received a response for an unknown request id: ${String(e.id)}`));return}if(n){if(this._terminalDelivered)return;this._terminalDelivered=!0;let t=om(e)?e.error.code:void 0,n=t!==void 0&&(this._dispatchWindowOpen||t===X.MissingRequiredClientCapability)?jm[t]:void 0;if(n!==void 0&&this._sse===void 0){this.settleResponse(Response.json(e,{status:n,headers:{"Content-Type":`application/json`}})),queueMicrotask(()=>void this.close());return}if(this._sse!==void 0||this._responseMode===`sse`){this._sse===void 0&&this.upgradeToSse(),this.writeMessageFrame(e),this.finalizeStream();return}this.settleResponse(Response.json(e,{status:200,headers:{"Content-Type":`application/json`}})),queueMicrotask(()=>void this.close());return}this._responseMode!==`json`&&(this._sse===void 0&&this.upgradeToSse(),this.writeMessageFrame(e))}writeCommentFrame(e){if(this._closed||this._sse===void 0||this._sse.closed)return;let t=e.split(`
`).map(e=>`: ${e}`).join(`
`);this.writeFrame(`${t}\n\n`)}async close(){if(!this._closed){if(this._closed=!0,this._abortCleanup?.(),this._abortCleanup=void 0,this._sse?.keepAliveTimer!==void 0&&clearInterval(this._sse.keepAliveTimer),this._sse!==void 0&&!this._sse.closed){this._sse.closed=!0;try{this._sse.controller.close()}catch{}}this._deferredResponse!==void 0&&!this._deferredResponse.settled&&(this._deferredResponse.settled=!0,this._deferredResponse.reject(new Y(J.ConnectionClosed,`Connection closed before a response was produced`))),this.onclose?.()}}settleResponse(e){this._deferredResponse===void 0||this._deferredResponse.settled||(this._deferredResponse.settled=!0,this._deferredResponse.resolve(e))}upgradeToSse(){let e,t=new ReadableStream({start:t=>{e=t},cancel:()=>{this.close()}});this._sse={controller:e,encoder:new TextEncoder,closed:!1},this._sse.keepAliveTimer=Tv(this._keepAliveMs,()=>this.writeCommentFrame(`keepalive`)),this.settleResponse(new Response(t,{status:200,headers:{"Content-Type":`text/event-stream`,"Cache-Control":`no-cache, no-transform`,Connection:`keep-alive`,"X-Accel-Buffering":`no`}}))}finalizeStream(){if(this._sse?.keepAliveTimer!==void 0&&clearInterval(this._sse.keepAliveTimer),this._sse!==void 0&&!this._sse.closed){this._sse.closed=!0;try{this._sse.controller.close()}catch{}}queueMicrotask(()=>void this.close())}writeMessageFrame(e){this.writeFrame(`event: message\ndata: ${JSON.stringify(e)}\n\n`)}writeFrame(e){if(!(this._sse===void 0||this._sse.closed))try{this._sse.controller.enqueue(this._sse.encoder.encode(e))}catch(e){this.onerror?.(Error(`Failed to write to the response stream: ${e}`))}}};async function sy(e,t,n){let r=new oy({classification:n.classification,...n.responseMode!==void 0&&{responseMode:n.responseMode},...n.keepAliveMs!==void 0&&{keepAliveMs:n.keepAliveMs}});return await e.connect(r),r.handleMessage(t,{...n.request!==void 0&&{request:n.request},...n.authInfo!==void 0&&{authInfo:n.authInfo}})}var cy=class{sessionIdGenerator;_started=!1;_closed=!1;_streamMapping=new Map;_requestToStreamMapping=new Map;_requestResponseMap=new Map;_initialized=!1;_enableJsonResponse=!1;_standaloneSseStreamId=`_GET_stream`;_eventStore;_onsessioninitialized;_onsessionclosed;_allowedHosts;_allowedOrigins;_enableDnsRebindingProtection;_retryInterval;_supportedProtocolVersions;_keepAliveMs;sessionId;onclose;onerror;onmessage;constructor(e={}){this.sessionIdGenerator=e.sessionIdGenerator,this._enableJsonResponse=e.enableJsonResponse??!1,this._eventStore=e.eventStore,this._onsessioninitialized=e.onsessioninitialized,this._onsessionclosed=e.onsessionclosed,this._allowedHosts=e.allowedHosts,this._allowedOrigins=e.allowedOrigins,this._enableDnsRebindingProtection=e.enableDnsRebindingProtection??!1,this._retryInterval=e.retryInterval,this._supportedProtocolVersions=e.supportedProtocolVersions??Sc,this._keepAliveMs=e.keepAliveMs??15e3}startKeepAlive(e,t){if(this._closed)return;let n=Tv(this._keepAliveMs,()=>{try{e.enqueue(t.encode(`: keepalive
`))}catch{n!==void 0&&clearInterval(n)}});return n}async start(){if(this._started)throw Error(`Transport already started`);this._started=!0}setSupportedProtocolVersions(e){this._supportedProtocolVersions=e}createJsonErrorResponse(e,t,n,r){let i={code:t,message:n};return r?.data!==void 0&&(i.data=r.data),Response.json({jsonrpc:`2.0`,error:i,id:null},{status:e,headers:{"Content-Type":`application/json`,...r?.headers}})}validateRequestHeaders(e){if(this._enableDnsRebindingProtection){if(this._allowedHosts&&this._allowedHosts.length>0){let t=e.headers.get(`host`);if(!t||!this._allowedHosts.includes(t)){let e=`Invalid Host header: ${t}`;return this.onerror?.(Error(e)),this.createJsonErrorResponse(403,-32e3,e)}}if(this._allowedOrigins&&this._allowedOrigins.length>0){let t=e.headers.get(`origin`);if(t&&!this._allowedOrigins.includes(t)){let e=`Invalid Origin header: ${t}`;return this.onerror?.(Error(e)),this.createJsonErrorResponse(403,-32e3,e)}}}}async handleRequest(e,t){if(this._closed)return this.createJsonErrorResponse(404,-32001,`Session not found`);let n=this.validateRequestHeaders(e);if(n)return n;switch(e.method){case`POST`:return this.handlePostRequest(e,t);case`GET`:return this.handleGetRequest(e);case`DELETE`:return this.handleDeleteRequest(e);default:return this.handleUnsupportedRequest()}}supportsEmptySSEData(e){return this._supportedProtocolVersions.includes(e)&&e>=`2025-11-25`}async writePrimingEvent(e,t,n,r){if(!this._eventStore||!this.supportsEmptySSEData(r))return;let i=await this._eventStore.storeEvent(n,{}),a=`id: ${i}\ndata: \n\n`;this._retryInterval!==void 0&&(a=`id: ${i}\nretry: ${this._retryInterval}\ndata: \n\n`),e.enqueue(t.encode(a))}async handleGetRequest(e){if(!e.headers.get(`accept`)?.includes(`text/event-stream`))return this.onerror?.(Error(`Not Acceptable: Client must accept text/event-stream`)),this.createJsonErrorResponse(406,-32e3,`Not Acceptable: Client must accept text/event-stream`);let t=this.validateSession(e);if(t)return t;let n=this.validateProtocolVersion(e);if(n)return n;if(this._eventStore){let t=e.headers.get(`last-event-id`);if(t)return this.replayEvents(t)}if(this._streamMapping.get(this._standaloneSseStreamId)!==void 0)return this.onerror?.(Error(`Conflict: Only one SSE stream is allowed per session`)),this.createJsonErrorResponse(409,-32e3,`Conflict: Only one SSE stream is allowed per session`);let r=new TextEncoder,i,a,o=new ReadableStream({start:e=>{i=e},cancel:()=>{a!==void 0&&clearInterval(a),this._streamMapping.get(this._standaloneSseStreamId)?.controller===i&&this._streamMapping.delete(this._standaloneSseStreamId)}}),s={"Content-Type":`text/event-stream`,"Cache-Control":`no-cache, no-transform`,Connection:`keep-alive`,"X-Accel-Buffering":`no`};return this.sessionId!==void 0&&(s[`mcp-session-id`]=this.sessionId),this._streamMapping.set(this._standaloneSseStreamId,{controller:i,encoder:r,cleanup:()=>{a!==void 0&&clearInterval(a),this._streamMapping.delete(this._standaloneSseStreamId);try{i.close()}catch{}}}),a=this.startKeepAlive(i,r),new Response(o,{headers:s})}async replayEvents(e){if(!this._eventStore)return this.onerror?.(Error(`Event store not configured`)),this.createJsonErrorResponse(400,-32e3,`Event store not configured`);try{let t;if(this._eventStore.getStreamIdForEventId){if(t=await this._eventStore.getStreamIdForEventId(e),!t)return this.onerror?.(Error(`Invalid event ID format`)),this.createJsonErrorResponse(400,-32e3,`Invalid event ID format`);if(this._streamMapping.get(t)!==void 0)return this.onerror?.(Error(`Conflict: Stream already has an active connection`)),this.createJsonErrorResponse(409,-32e3,`Conflict: Stream already has an active connection`)}let n={"Content-Type":`text/event-stream`,"Cache-Control":`no-cache, no-transform`,Connection:`keep-alive`,"X-Accel-Buffering":`no`};this.sessionId!==void 0&&(n[`mcp-session-id`]=this.sessionId);let r=new TextEncoder,i,a,o=!1,s,c=new ReadableStream({start:e=>{i=e},cancel:()=>{o=!0,a!==void 0&&clearInterval(a),s!==void 0&&this._streamMapping.get(s)?.controller===i&&this._streamMapping.delete(s)}}),l=new Set;if(s=await this._eventStore.replayEventsAfter(e,{send:async(e,t)=>{if(l.add(e),!this.writeSSEEvent(i,r,t,e))try{i.close()}catch{}}}),this._closed||o){try{i.close()}catch{}return this.createJsonErrorResponse(404,-32001,`Session not found`)}if(this._streamMapping.get(s)?.cleanup(),this._streamMapping.set(s,{controller:i,encoder:r,replayedEventIds:l,cleanup:()=>{a!==void 0&&clearInterval(a),this._streamMapping.delete(s);try{i.close()}catch{}}}),s!==this._standaloneSseStreamId&&![...this._requestToStreamMapping.values()].includes(s)){this._streamMapping.delete(s);try{i.close()}catch{}}return this._streamMapping.get(s)?.controller===i&&(a=this.startKeepAlive(i,r)),new Response(c,{headers:n})}catch(e){return this.onerror?.(e),this.createJsonErrorResponse(500,-32e3,`Error replaying events`)}}writeSSEEvent(e,t,n,r){try{let i=`event: message
`;return r&&(i+=`id: ${r}\n`),i+=`data: ${JSON.stringify(n)}\n\n`,e.enqueue(t.encode(i)),!0}catch(e){return this.onerror?.(e),!1}}handleUnsupportedRequest(){return this.onerror?.(Error(`Method not allowed.`)),Response.json({jsonrpc:`2.0`,error:{code:-32e3,message:`Method not allowed.`},id:null},{status:405,headers:{Allow:`GET, POST, DELETE`,"Content-Type":`application/json`}})}async handlePostRequest(e,t){try{let n=e.headers.get(`accept`);if(!n?.includes(`application/json`)||!n.includes(`text/event-stream`))return this.onerror?.(Error(`Not Acceptable: Client must accept both application/json and text/event-stream`)),this.createJsonErrorResponse(406,-32e3,`Not Acceptable: Client must accept both application/json and text/event-stream`);if(!Qh(e.headers.get(`content-type`)))return this.onerror?.(Error(`Unsupported Media Type: Content-Type must be application/json`)),this.createJsonErrorResponse(415,-32e3,`Unsupported Media Type: Content-Type must be application/json`);let r=e,i;if(t?.parsedBody===void 0)try{i=await e.json()}catch(e){return this.onerror?.(e),this.createJsonErrorResponse(400,-32700,`Parse error: Invalid JSON`)}else i=t.parsedBody;let a;try{a=Array.isArray(i)?i.map(e=>nl.parse(e)):[nl.parse(i)]}catch(e){return this.onerror?.(e),this.createJsonErrorResponse(400,-32700,`Parse error: Invalid JSON-RPC message`)}if(this._closed)return this.createJsonErrorResponse(404,-32001,`Session not found`);let o=a.some(e=>dm(e));if(o){if(this._initialized&&this.sessionId!==void 0)return this.onerror?.(Error(`Invalid Request: Server already initialized`)),this.createJsonErrorResponse(400,-32600,`Invalid Request: Server already initialized`);if(a.length>1)return this.onerror?.(Error(`Invalid Request: Only one initialization request is allowed`)),this.createJsonErrorResponse(400,-32600,`Invalid Request: Only one initialization request is allowed`);this.sessionId=this.sessionIdGenerator?.(),this._initialized=!0,this.sessionId&&this._onsessioninitialized&&await Promise.resolve(this._onsessioninitialized(this.sessionId))}if(!o){let t=this.validateSession(e);if(t)return t;let n=this.validateProtocolVersion(e);if(n)return n}if(this._closed)return this.createJsonErrorResponse(404,-32001,`Session not found`);if(!a.some(e=>rm(e))){for(let e of a)this.onmessage?.(e,{authInfo:t?.authInfo,request:r});return new Response(null,{status:202})}let s=crypto.randomUUID(),c=a.find(e=>dm(e)),l=c?c.params.protocolVersion:e.headers.get(`mcp-protocol-version`)??`2025-03-26`;if(this._enableJsonResponse)return new Promise(e=>{this._streamMapping.set(s,{resolveJson:e,cleanup:()=>{this._streamMapping.delete(s)}});for(let e of a)rm(e)&&this._requestToStreamMapping.set(e.id,s);for(let e of a)this.onmessage?.(e,{authInfo:t?.authInfo,request:r})});let u=new TextEncoder,d,f,p=new ReadableStream({start:e=>{d=e},cancel:()=>{f!==void 0&&clearInterval(f),this._streamMapping.get(s)?.controller===d&&this._streamMapping.delete(s)}}),m={"Content-Type":`text/event-stream`,"Cache-Control":`no-cache, no-transform`,Connection:`keep-alive`,"X-Accel-Buffering":`no`};this.sessionId!==void 0&&(m[`mcp-session-id`]=this.sessionId);for(let e of a)rm(e)&&(this._streamMapping.set(s,{controller:d,encoder:u,cleanup:()=>{f!==void 0&&clearInterval(f),this._streamMapping.delete(s);try{d.close()}catch{}}}),this._requestToStreamMapping.set(e.id,s));await this.writePrimingEvent(d,u,s,l);for(let e of a){let n,i;rm(e)&&this._eventStore&&this.supportsEmptySSEData(l)&&(n=()=>{this.closeSSEStream(e.id)},i=()=>{this.closeStandaloneSSEStream()}),this.onmessage?.(e,{authInfo:t?.authInfo,request:r,closeSSEStream:n,closeStandaloneSSEStream:i})}return this._streamMapping.get(s)?.controller===d&&(f=this.startKeepAlive(d,u)),new Response(p,{status:200,headers:m})}catch(e){return this.onerror?.(e),this.createJsonErrorResponse(400,-32700,`Parse error`,{data:String(e)})}}async handleDeleteRequest(e){let t=this.validateSession(e);if(t)return t;let n=this.validateProtocolVersion(e);if(n)return n;try{return await Promise.resolve(this._onsessionclosed?.(this.sessionId)),new Response(null,{status:200})}finally{await this.close()}}validateSession(e){if(this.sessionIdGenerator===void 0)return;if(!this._initialized)return this.onerror?.(Error(`Bad Request: Server not initialized`)),this.createJsonErrorResponse(400,-32e3,`Bad Request: Server not initialized`);let t=e.headers.get(`mcp-session-id`);if(!t)return this.onerror?.(Error(`Bad Request: Mcp-Session-Id header is required`)),this.createJsonErrorResponse(400,-32e3,`Bad Request: Mcp-Session-Id header is required`);if(t!==this.sessionId)return this.onerror?.(Error(`Session not found`)),this.createJsonErrorResponse(404,-32001,`Session not found`)}validateProtocolVersion(e){let t=e.headers.get(`mcp-protocol-version`);if(t!==null&&!this._supportedProtocolVersions.includes(t)){let e=`Bad Request: Unsupported protocol version: ${t} (supported versions: ${this._supportedProtocolVersions.join(`, `)})`;return this.onerror?.(Error(e)),this.createJsonErrorResponse(400,-32e3,e)}}async close(){if(!this._closed){this._closed=!0;for(let{cleanup:e}of this._streamMapping.values())e();this._streamMapping.clear(),this._requestResponseMap.clear(),this.onclose?.()}}closeSSEStream(e){let t=this._requestToStreamMapping.get(e);if(!t)return;let n=this._streamMapping.get(t);n&&n.cleanup()}closeStandaloneSSEStream(){let e=this._streamMapping.get(this._standaloneSseStreamId);e&&e.cleanup()}async send(e,t){let n=t?.relatedRequestId;if((am(e)||om(e))&&(n=e.id),n===void 0){if(am(e)||om(e))throw Error(`Cannot send a response on a standalone SSE stream unless resuming a previous client request`);let t;this._eventStore&&(t=await this._eventStore.storeEvent(this._standaloneSseStreamId,e));let n=this._streamMapping.get(this._standaloneSseStreamId);if(n===void 0)return;n.controller&&n.encoder&&(t===void 0||!n.replayedEventIds?.has(t))&&this.writeSSEEvent(n.controller,n.encoder,e,t);return}let r=this._requestToStreamMapping.get(n);if(!r)throw Error(`No connection established for request ID: ${String(n)}`);let i=this._streamMapping.get(r);if(!this._enableJsonResponse){let t;this._eventStore&&(t=await this._eventStore.storeEvent(r,e),i=this._streamMapping.get(r)),i?.controller&&i?.encoder&&(t===void 0||!i.replayedEventIds?.has(t))&&this.writeSSEEvent(i.controller,i.encoder,e,t)}if(am(e)||om(e)){this._requestResponseMap.set(n,e);let t=[...this._requestToStreamMapping.entries()].filter(([e,t])=>t===r).map(([e])=>e);if(t.every(e=>this._requestResponseMap.has(e))){if(!i){if(this._enableJsonResponse)throw Error(`No connection established for request ID: ${String(n)}`);if(!this._eventStore){this.onerror?.(Error(`Response for request ID ${String(n)} is undeliverable: per-request stream is disconnected and no eventStore is configured`));for(let e of t)this._requestResponseMap.delete(e),this._requestToStreamMapping.delete(e);return}for(let e of t)this._requestResponseMap.delete(e),this._requestToStreamMapping.delete(e);return}if(this._enableJsonResponse&&i.resolveJson){let e={"Content-Type":`application/json`};this.sessionId!==void 0&&(e[`mcp-session-id`]=this.sessionId);let n=t.map(e=>this._requestResponseMap.get(e));n.length===1?i.resolveJson(Response.json(n[0],{status:200,headers:e})):i.resolveJson(Response.json(n,{status:200,headers:e})),i.cleanup()}else i.cleanup();for(let e of t)this._requestResponseMap.delete(e),this._requestToStreamMapping.delete(e)}}}};function ly(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let{method:t,id:n}=e;return typeof t==`string`&&(typeof n==`string`||typeof n==`number`)?n:null}function uy(e,t,n,r,i=null){return Response.json({jsonrpc:`2.0`,error:{code:t,message:n,...r!==void 0&&{data:r}},id:i},{status:e})}function dy(e,t=null){return uy(e.httpStatus,e.code,e.message,e.data,t)}function fy(e){return e instanceof Error?e:Error(String(e))}function py(e=null){return uy(500,-32603,`Internal server error`,void 0,e)}function my(e,t,n){return async(r,i)=>{if(r.method.toUpperCase()!==`POST`)return uy(405,-32e3,`Method not allowed.`);try{let t=await e({era:`legacy`,...i?.authInfo!==void 0&&{authInfo:i.authInfo},requestInfo:r}),a=new cy({sessionIdGenerator:void 0,...n!==void 0&&{keepAliveMs:n}});await t.connect(a);let o=()=>{a.close().catch(()=>{}),t.close().catch(()=>{})};r.signal?.addEventListener(`abort`,o,{once:!0});let s=await a.handleRequest(r,{...i?.authInfo!==void 0&&{authInfo:i.authInfo},...i?.parsedBody!==void 0&&{parsedBody:i.parsedBody}});if(s.body===null||Zh(s.headers.get(`content-type`))!==`text/event-stream`)return o(),s;let c=s.body.getReader(),l=!1,u=()=>{l||(l=!0,o())},d=new ReadableStream({pull:async e=>{try{let{done:t,value:n}=await c.read();if(t){u(),e.close();return}n!==void 0&&e.enqueue(n)}catch(t){u(),e.error(t)}},cancel:e=>(u(),c.cancel(e).catch(()=>{}))});return new Response(d,{status:s.status,statusText:s.statusText,headers:s.headers})}catch(e){try{t?.(fy(e))}catch{}return py(ly(i?.parsedBody))}}}function hy(e,t){return my(e,t)}async function gy(e,t,n=!0){let r=e.method.toUpperCase(),i,a=t,o=e,s=!1;if(r===`POST`){if(a===void 0){n&&(o=e.clone());let t;try{t=await e.text()}catch{return{step:`unreadable-body`}}try{i=t.length===0?void 0:JSON.parse(t)}catch{s=!0}!s&&i!==void 0&&(a=i)}else i=a;if(s||i===void 0)return{step:`no-json-body`,forwardRequest:o}}return{step:`classified`,outcome:Wm({httpMethod:r,protocolVersionHeader:e.headers.get(`mcp-protocol-version`)??void 0,mcpMethodHeader:e.headers.get(`mcp-method`)??void 0,mcpNameHeader:e.headers.get(`mcp-name`)??void 0,...i!==void 0&&{body:i}}),body:i,parsedBody:a,forwardRequest:o}}async function _y(e,t){let n=await gy(t===void 0&&e.method.toUpperCase()===`POST`?e.clone():e,t,!1);return n.step===`no-json-body`||n.step===`classified`&&n.outcome.kind===`legacy`}function vy(e,t={}){let{legacy:n,onerror:r,responseMode:i}=t;if(typeof n==`function`)throw TypeError(`The 'legacy' option only accepts 'stateless' or 'reject', not a handler function. To serve 2025-era traffic with your own handler, route in user land with the exported isLegacyRequest(request) predicate in front of a strict (legacy: 'reject') handler.`);let a=new Set,o=!1,s=e=>{try{r?.(e)}catch{}},c=t.bus??new Ev(s),l=Dv(c),u=Pv({bus:c,maxSubscriptions:t.maxSubscriptions??1024,keepAliveMs:t.keepAliveMs??15e3,onerror:s});i===`json`&&console.warn(`responseMode: 'json' drops mid-call notifications. subscriptions/listen streams are always served over SSE regardless; other notifications emitted before a result are dropped.`);let d=n===`reject`?void 0:my(e,s,t.keepAliveMs);async function f(n,r,o){let c=n.classification.revision;if(c===void 0||!vf.includes(c)){let e=new up({supported:[...vf],requested:c??`unknown`});return s(e),uy(400,e.code,e.message,e.data,ly(n.message))}let l=Lm({httpMethod:r.method,mcpMethodHeader:r.headers.get(`mcp-method`)??void 0,mcpNameHeader:r.headers.get(`mcp-name`)??void 0},n);if(l!==void 0)return s(Error(`Rejected inbound request (${l.cell}): ${l.message}`)),dy(l,ly(n.message));let d=n.messageKind===`request`?Zp(n.message.params):void 0,f=d?.[Dc];if(n.messageKind===`request`){let e=ff(n.message.method);if(e!==void 0){let t=gf(e,f);if(t!==void 0){let e=new dp({requiredCapabilities:t});return s(e),uy(Mm(e.code,`ladder`),e.code,e.message,e.data,n.message.id)}}}let p=await e({era:`modern`,...o!==void 0&&{authInfo:o},requestInfo:r}),m=p instanceof Yv?p.server:p;if(n.messageKind===`request`&&n.message.method===`subscriptions/listen`){let e=m.getCapabilities(),t=Kv(m);return p.close().catch(s),u.serve(n.message,r.signal,e,t)}if(n.messageKind===`request`&&n.message.method===`tools/call`&&p instanceof Yv){let e=n.message.params,t=typeof e?.name==`string`?e.name:void 0,i=t===void 0?void 0:p.toolInputSchemaJson(t);if(i!==void 0){let t=vm(i);if(t.valid&&t.declarations.length>0){let i=Om(t.declarations,e?.arguments,r.headers);if(i!==void 0)return p.close().catch(s),s(Error(`Rejected inbound request (${i.cell}): ${i.message}`)),dy(i,n.message.id)}}}Uh(m,c),Gv(m,vf),d!==void 0&&Wv(m,{clientInfo:d[Tc],clientCapabilities:f});let h=m.onclose;a.add(m),m.onclose=()=>{a.delete(m),h?.()};try{let e=await sy(p,n.message,{classification:n.classification,request:r,...o!==void 0&&{authInfo:o},...i!==void 0&&{responseMode:i},...t.keepAliveMs!==void 0&&{keepAliveMs:t.keepAliveMs}});return n.messageKind===`notification`&&queueMicrotask(()=>void m.close().catch(()=>{})),e}catch(e){return e instanceof Y&&e.code===J.ConnectionClosed?new Response(null,{status:499}):(await m.close().catch(()=>{}),a.delete(m),s(fy(e)),py(ly(n.message)))}}async function p(e,t,n,r){if(d!==void 0)return d(t,{...n!==void 0&&{authInfo:n},...r!==void 0&&{parsedBody:r}});let i=Gm(e,vf);return i===void 0?new Response(null,{status:202}):(s(Error(`Rejected 2025-era request on a modern-only endpoint (${i.cell}): ${i.message}`)),dy(i,ly(r)))}async function m(e,t){let n=t?.authInfo;if(e.method.toUpperCase()===`POST`&&!Qh(e.headers.get(`content-type`)))return s(Error(`Unsupported Media Type: Content-Type must be application/json`)),uy(415,-32e3,`Unsupported Media Type: Content-Type must be application/json`);let r=await gy(e,t?.parsedBody);if(r.step===`unreadable-body`)return uy(400,-32700,`Parse error: the request body could not be read`);if(r.step===`no-json-body`)return d===void 0?uy(400,-32700,`Parse error: the request body is not valid JSON`):d(r.forwardRequest,{...n!==void 0&&{authInfo:n}});let{outcome:i,body:a,parsedBody:o,forwardRequest:c}=r;try{switch(i.kind){case`reject`:return s(Error(`Rejected inbound request (${i.cell}): ${i.message}`)),dy(i,ly(a));case`modern`:return await f(i,e,n);case`legacy`:return await p(i,c,n,o)}}catch(e){return s(fy(e)),py(ly(a))}}return{fetch:async(e,t)=>{if(o)throw Error(`This MCP handler has been closed`);try{return await m(e,t)}catch(e){return s(fy(e)),py(ly(t?.parsedBody))}},notify:l,bus:c,close:async()=>{o=!0,u.closeAll();let e=[...a].map(e=>e.close().catch(()=>{}));a.clear(),await Promise.all(e)}}}function yy(e){return e.replaceAll(/[\\"]/g,String.raw`\$&`).replaceAll(/[^\u0020-\u007E]/g,` `)}function by(e,t,n,r){let i=`Bearer error="${yy(e)}", error_description="${yy(t)}"`;return n.length>0&&(i+=`, scope="${n.join(` `)}"`),r&&(i+=`, resource_metadata="${r}"`),i}async function xy(e,t){let{verifier:n,requiredScopes:r=[]}=t;if(!e)throw new sf(of.InvalidToken,`Missing Authorization header`);let[i,a]=e.split(` `);if(i?.toLowerCase()!==`bearer`||!a)throw new sf(of.InvalidToken,`Invalid Authorization header format, expected 'Bearer TOKEN'`);let o=await n.verifyAccessToken(a);if(r.length>0&&!r.every(e=>o.scopes.includes(e)))throw new sf(of.InsufficientScope,`Insufficient scope`);if(typeof o.expiresAt!=`number`||Number.isNaN(o.expiresAt))throw new sf(of.InvalidToken,`Token has no expiration time`);if(o.expiresAt<Date.now()/1e3)throw new sf(of.InvalidToken,`Token has expired`);return o}function Sy(e,t){let{requiredScopes:n=[],resourceMetadataUrl:r}=t??{};if(!(e instanceof sf)){let e=new sf(of.ServerError,`Internal Server Error`);return Response.json(e.toResponseObject(),{status:500})}switch(e.code){case of.InvalidToken:{let t=by(e.code,e.message,n,r);return Response.json(e.toResponseObject(),{status:401,headers:{"WWW-Authenticate":t}})}case of.InsufficientScope:{let t=by(e.code,e.message,n,r);return Response.json(e.toResponseObject(),{status:403,headers:{"WWW-Authenticate":t}})}case of.ServerError:return Response.json(e.toResponseObject(),{status:500});default:return Response.json(e.toResponseObject(),{status:400})}}function Cy(e){let{verifier:t,requiredScopes:n=[],resourceMetadataUrl:r}=e,i={verifier:t,requiredScopes:n,resourceMetadataUrl:r};return async e=>{let[t]=(e.headers.get(`authorization`)??``).split(`,`);try{return await xy(t||void 0,i)}catch(e){return Sy(e,i)}}}function wy(e,t){if(!e)return{ok:!1,errorCode:`missing_host`,message:`Missing Host header`};let n;try{n=new URL(`http://${e}`).hostname}catch{return{ok:!1,errorCode:`invalid_host_header`,message:`Invalid Host header: ${e}`,hostHeader:e}}return t.includes(n)?{ok:!0,hostname:n}:{ok:!1,errorCode:`invalid_host`,message:`Invalid Host: ${n}`,hostHeader:e,hostname:n}}function Ty(){return[`localhost`,`127.0.0.1`,`[::1]`]}function Ey(e,t){let n=wy(e.headers.get(`host`),t);if(!n.ok)return Response.json({jsonrpc:`2.0`,error:{code:-32e3,message:n.message},id:null},{status:403,headers:{"Content-Type":`application/json`}})}function Dy(e,t){if(e.protocol!==`https:`&&e.hostname!==`localhost`&&e.hostname!==`127.0.0.1`&&!t)throw Error(`Issuer URL must be HTTPS`);if(e.hash)throw Error(`Issuer URL must not have a fragment: ${e}`);if(e.search)throw Error(`Issuer URL must not have a query string: ${e}`)}function Oy(e){return Dy(new URL(e.oauthMetadata.issuer),e.dangerouslyAllowInsecureIssuerUrl),{resource:e.resourceServerUrl.href,authorization_servers:[e.oauthMetadata.issuer],scopes_supported:e.scopesSupported,resource_name:e.resourceName,resource_documentation:e.serviceDocumentationUrl?.href}}function ky(e){return new URL(Ay(e),e).href}function Ay(e){let t=jy(e.pathname);return`/.well-known/oauth-protected-resource${t===`/`?``:t}`}function jy(e){return e.length>1&&e.endsWith(`/`)?e.slice(0,-1):e}const My=`GET, HEAD, OPTIONS`;function Ny(e,t){if(e.method===`OPTIONS`){let t=e.headers.get(`access-control-request-headers`);return new Response(null,{status:204,headers:{"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":My,...t===null?{}:{"Access-Control-Allow-Headers":t,Vary:`Access-Control-Request-Headers`}}})}if(e.method!==`GET`&&e.method!==`HEAD`){let t=new sf(of.MethodNotAllowed,`The method ${e.method} is not allowed for this endpoint`);return Response.json(t.toResponseObject(),{status:405,headers:{Allow:My,"Access-Control-Allow-Origin":`*`}})}let n=Response.json(t,{headers:{"Access-Control-Allow-Origin":`*`}});return e.method===`HEAD`?new Response(null,{status:n.status,headers:n.headers}):n}function Py(e,t){let n=jy(new URL(e.url).pathname);if(n===Ay(t.resourceServerUrl))return Ny(e,Oy(t));if(n===`/.well-known/oauth-authorization-server`)return Oy(t),Ny(e,t.oauthMetadata)}function Fy(e,t){if(e==null||e===``)return{ok:!0};let n;try{n=new URL(e).hostname}catch{return{ok:!1,errorCode:`invalid_origin_header`,message:`Invalid Origin header: ${e}`,originHeader:e}}return n===``?{ok:!1,errorCode:`invalid_origin_header`,message:`Invalid Origin header: ${e}`,originHeader:e}:t.includes(n)?{ok:!0,origin:e,hostname:n}:{ok:!1,errorCode:`invalid_origin`,message:`Invalid Origin: ${n}`,originHeader:e,hostname:n}}function Iy(){return[`localhost`,`127.0.0.1`,`[::1]`]}function Ly(e,t){let n=Fy(e.headers.get(`origin`),t);if(!n.ok)return Response.json({jsonrpc:`2.0`,error:{code:-32e3,message:n.message},id:null},{status:403,headers:{"Content-Type":`application/json`}})}function Ry(e){let t=``;for(let n of e)t+=String.fromCodePoint(n);return btoa(t).replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/,``)}function zy(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e.codePointAt(r)^t.codePointAt(r);return n===0}function By(e){let t=e.replaceAll(`-`,`+`).replaceAll(`_`,`/`),n=atob(t),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.codePointAt(e);return r}function Vy(e){let t=globalThis.crypto?.subtle;if(t===void 0)throw TypeError(`createRequestStateCodec requires the Web Crypto API (globalThis.crypto.subtle); see https://ts.sdk.modelcontextprotocol.io/v2/troubleshooting for the Node.js polyfill instructions`);let n=typeof e.key==`string`?new TextEncoder().encode(e.key):Uint8Array.from(e.key);if(n.byteLength<32)throw RangeError(`createRequestStateCodec: key must be at least 32 bytes (got ${n.byteLength})`);let r=e.ttlSeconds??600;if(!Number.isFinite(r))throw RangeError(`createRequestStateCodec: ttlSeconds must be a finite number`);let i=e.bind,a,o=()=>a??=t.importKey(`raw`,n,{name:`HMAC`,hash:`SHA-256`},!1,[`sign`,`verify`]),s=new TextEncoder,c=async e=>Ry(new Uint8Array(await t.sign(`HMAC`,await o(),s.encode(`mcp.requestState.bind:`+e))).slice(0,16));return{async mint(e,n){let a={p:e,exp:Math.floor(Date.now()/1e3)+r};if(i!==void 0){if(n===void 0)throw TypeError(`createRequestStateCodec: mint() requires ctx when a bind callback is configured`);a.b=await c(i(n))}let l=Ry(s.encode(JSON.stringify(a)));return`v1.${l}.${Ry(new Uint8Array(await t.sign(`HMAC`,await o(),s.encode(`v1.`+l))))}`},async verify(e,n){let r=e.lastIndexOf(`.`);if(!e.startsWith(`v1.`)||r<=3)throw Error(`malformed`);let a=e.slice(3,r),l;try{l=By(e.slice(r+1))}catch{throw Error(`malformed`)}if(!await t.verify(`HMAC`,await o(),l,s.encode(`v1.`+a)))throw Error(`mac`);let u;try{u=JSON.parse(new TextDecoder(`utf-8`,{fatal:!0}).decode(By(a)))}catch{throw Error(`malformed`)}if(typeof u.exp!=`number`||u.exp<Math.floor(Date.now()/1e3))throw Error(`expired`);if(i!==void 0){let e=await c(i(n));if(u.b===void 0||!zy(u.b,e))throw Error(`bind`)}else if(u.b!==void 0)throw Error(`bind`);return u.p}}}let Hy;function Uy(e,t){return bg(e,t??(Hy??=new yv))}export{Mc as BAGGAGE_META_KEY,Dc as CLIENT_CAPABILITIES_META_KEY,Tc as CLIENT_INFO_META_KEY,xc as DEFAULT_NEGOTIATED_PROTOCOL_VERSION,Ph as DEFAULT_REQUEST_TIMEOUT_MSEC,Rc as INTERNAL_ERROR,Lc as INVALID_PARAMS,Fc as INVALID_REQUEST,Ev as InMemoryServerEventBus,mg as InMemoryTransport,Nc as JSONRPC_VERSION,bc as LATEST_PROTOCOL_VERSION,kc as LOG_LEVEL_META_KEY,Ic as METHOD_NOT_FOUND,Yv as McpServer,dp as MissingRequiredClientCapabilityError,sf as OAuthError,of as OAuthErrorCode,Pc as PARSE_ERROR,wc as PROTOCOL_VERSION_META_KEY,oy as PerRequestHTTPServerTransport,Wh as Protocol,Z as ProtocolError,X as ProtocolErrorCode,Cc as RELATED_TASK_META_KEY,tg as ReadBuffer,cp as ResourceNotFoundError,Xv as ResourceTemplate,Ec as SERVER_INFO_META_KEY,eg as STDIO_DEFAULT_MAX_BUFFER_SIZE,Oc as SUBSCRIPTION_ID_META_KEY,Sc as SUPPORTED_PROTOCOL_VERSIONS,Y as SdkError,J as SdkErrorCode,cf as SdkHttpError,qv as Server,Ac as TRACEPARENT_META_KEY,jc as TRACESTATE_META_KEY,up as UnsupportedProtocolVersionError,pg as UriTemplate,lp as UrlElicitationRequiredError,cy as WebStandardStreamableHTTPServerTransport,xh as acceptedContent,pm as assertCompleteRequestPrompt,mm as assertCompleteRequestResourceTemplate,Sy as bearerAuthChallengeResponse,Oy as buildOAuthProtectedResourceMetadata,uf as checkResourceAllowed,Wm as classifyInboundRequest,xv as completable,lg as createFetchWithInit,vy as createMcpHandler,Vy as createRequestStateCodec,ng as deserializeMessage,Uy as fromJsonSchema,$h as getDisplayName,ky as getOAuthProtectedResourceMetadataUrl,Ey as hostHeaderValidationResponse,bh as inputRequired,Sh as inputResponse,cm as isCallToolResult,Sv as isCompletable,dm as isInitializeRequest,fm as isInitializedNotification,lm as isInputRequiredResult,om as isJSONRPCErrorResponse,im as isJSONRPCNotification,rm as isJSONRPCRequest,sm as isJSONRPCResponse,am as isJSONRPCResultResponse,Qh as isJsonContentType,_y as isLegacyRequest,Mh as isSpecType,um as isTaskAugmentedRequestParams,hy as legacyStatelessFallback,Ty as localhostAllowedHostnames,Iy as localhostAllowedOrigins,Kh as mergeCapabilities,Py as oauthMetadataResponse,Ly as originValidationResponse,nm as parseJSONRPCMessage,yg as preloadSchemas,Cy as requireBearerAuth,lf as resourceUrlFromServerUrl,rg as serializeMessage,jh as specTypeSchemas,wy as validateHostHeader,Fy as validateOriginHeader,xy as verifyBearerToken};