@onyxsecurity/mcp-gateway 2.1.39 → 2.1.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/mcp-gateway.js +2 -2
- package/dist/{cli-CmbQVMhl.js → cli-iLlbNqMw.js} +2 -2
- package/dist/cli-iLlbNqMw.js.map +1 -0
- package/dist/env-BYymL5qu.js +1 -0
- package/dist/env-DvKbtn5P.js +2 -0
- package/dist/env-DvKbtn5P.js.map +1 -0
- package/dist/{helpers-BrpBfS5F.js → helpers-BLNSu673.js} +4 -4
- package/dist/{helpers-BrpBfS5F.js.map → helpers-BLNSu673.js.map} +1 -1
- package/dist/index.d.ts +4 -9
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/logger-C9UQmiLF.js +5 -0
- package/dist/{logger-BKIQpGtw.js.map → logger-C9UQmiLF.js.map} +1 -1
- package/dist/main-Cw-GpTlP.js +6 -0
- package/dist/main-Cw-GpTlP.js.map +1 -0
- package/dist/normalizeUrl-DoppHGlo.js +64 -0
- package/dist/normalizeUrl-DoppHGlo.js.map +1 -0
- package/dist/oauthProvidersClient-BPHPTMIw.js +1 -0
- package/dist/{oauthProvidersClient-CSfC0nnU.js → oauthProvidersClient-DBwig3Kv.js} +2 -2
- package/dist/{oauthProvidersClient-CSfC0nnU.js.map → oauthProvidersClient-DBwig3Kv.js.map} +1 -1
- package/dist/{providers-BDjtjNUA.js → providers-ITwJPvLY.js} +2 -2
- package/dist/{providers-BDjtjNUA.js.map → providers-ITwJPvLY.js.map} +1 -1
- package/dist/transportDetection-di7mtGu9.js +136 -0
- package/dist/transportDetection-di7mtGu9.js.map +1 -0
- package/dist/upstreamNegotiation-DXOdQ605.js +15 -0
- package/dist/upstreamNegotiation-DXOdQ605.js.map +1 -0
- package/package.json +5 -2
- package/dist/cli-CmbQVMhl.js.map +0 -1
- package/dist/env-Bq3tPJX9.js +0 -2
- package/dist/env-Bq3tPJX9.js.map +0 -1
- package/dist/env-Bto2CEy8.js +0 -1
- package/dist/logger-BKIQpGtw.js +0 -5
- package/dist/main-DURKDydM.js +0 -6
- package/dist/main-DURKDydM.js.map +0 -1
- package/dist/normalizeUrl-BrUSzVK4.js +0 -31
- package/dist/normalizeUrl-BrUSzVK4.js.map +0 -1
- package/dist/oauthProvidersClient-DTav_fHE.js +0 -1
- package/dist/stdio-D3je2hIR.js +0 -31
- package/dist/stdio-D3je2hIR.js.map +0 -1
- package/dist/transportDetection-BW8OoLyM.js +0 -136
- package/dist/transportDetection-BW8OoLyM.js.map +0 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
function e(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 t(e,t=`|`){return e.map(e=>ee(e)).join(t)}function n(e,t){return typeof t==`bigint`?t.toString():t}function r(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function i(e){return e==null}function a(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function o(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 s=Symbol(`evaluating`);function c(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==s)return r===void 0&&(r=s,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function l(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function u(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function d(e){return JSON.stringify(e)}function f(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const p=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function m(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const h=r(()=>{if(Le.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function g(e){if(m(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(m(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function _(e){return g(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const v=new Set([`string`,`number`,`symbol`]);function y(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function b(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function x(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 ee(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function te(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}const ne=(()=>({safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))();function re(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`);let i=u(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)}"`);if(!t[r])continue;l(e,r,n.shape[r])}return l(this,`shape`,e),e},checks:[]});return b(e,i)}function ie(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`);let i=u(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)}"`);if(!t[e])continue;delete r[e]}return l(this,`shape`,r),r},checks:[]});return b(e,i)}function ae(e,t){if(!g(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.")}let r=u(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return l(this,`shape`,n),n}});return b(e,r)}function oe(e,t){if(!g(t))throw Error(`Invalid input to safeExtend: expected a plain object`);let n=u(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return l(this,`shape`,n),n}});return b(e,n)}function se(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.`);let n=u(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return l(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return b(e,n)}function ce(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`);let a=u(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)}"`);if(!n[t])continue;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 l(this,`shape`,i),i},checks:[]});return b(t,a)}function le(e,t,n){let r=u(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)}"`);if(!n[t])continue;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 l(this,`shape`,i),i}});return b(t,r)}function ue(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 de(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 fe(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function pe(e){return typeof e==`string`?e:e?.message}function me(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function S(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:pe(e.inst?._zod.def?.error?.(e))??pe(a?.(e))??pe(t?.error?.(e))??pe(n.customError?.(e))??pe(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 he=/[\uD800-\uDBFF]/;function ge(e){let t=e.length;if(!he.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 _e(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function ve(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 ye(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function be(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Ce(e,n,r.value)}}function xe(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Se(e,t,n){return xe(e,t,n,!1)}function Ce(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:xe(this,t,n.bind(this))},set(e){xe(this,t,e)}})}function we(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let Te,Ee=!1;const De={configurable:!0,get(){Ee=!0}};function C(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Te!==e._zod){Te=void 0;return}Te=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,De);let e=Ee;Ee=!1;try{let r=n(this);return Ee?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Ee||=e,r}catch(n){throw delete this[t],Ee||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Oe(e,t,n,r){let i=we(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 ke(e){let t=()=>e;return t[`~constantCatch`]=!0,t}var Ae;const je=Object.freeze({status:`aborted`}),Me={value:void 0,enumerable:!1};let Ne=`captureStackTrace`in Error?Error:null;function Pe(e){let t=Ne;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Ne=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function w(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){Me.value=new a(r);try{Object.defineProperty(n,`_zod`,Me)}finally{Me.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),be(i,o))}let i=d.prototype;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;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?Pe(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 Fe=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ie=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Ae=globalThis).__zod_globalConfig??(Ae.__zod_globalConfig={});const Le=globalThis.__zod_globalConfig;function Re(e){return e&&Object.assign(Le,e),Le}function ze(){let e=this._zod;return e.message??=JSON.stringify(e.def,n,2),e.message}function Be(e){this._zod.message=e}const Ve={get:ze,set:Be,enumerable:!0,configurable:!0},He={value:void 0,enumerable:!1},Ue={value:void 0,enumerable:!1},We=new WeakSet([Object.prototype,Error.prototype]),Ge=(e,t)=>{e.name=`$ZodError`,He.value=e._zod,Object.defineProperty(e,`_zod`,He),Ue.value=t,Object.defineProperty(e,`issues`,Ue),He.value=void 0,Ue.value=void 0,Object.defineProperty(e,`message`,Ve);let n=Object.getPrototypeOf(e);We.has(n)||(We.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})}}))},Ke=w(`$ZodError`,Ge),qe=w(`$ZodError`,Ge,void 0,{Parent:Error});function Je(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 Ye(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Je(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Xe(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 Ze(e,t){return{callee:t?.callee??e,Err:t?.Err}}const Qe=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 Fe;if(s.issues.length){let n=new(a?.Err??e)(s.issues.map(e=>S(e,o,Re())));throw p(n,a?.callee??t),n}return s.value};return t},$e=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=>S(e,o,Re())));throw p(n,a?.callee??t),n}return s.value};return t},et=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 Fe;return a.issues.length?{success:!1,error:new(e??Ke)(a.issues.map(e=>S(e,i,Re())))}:{success:!0,data:a.value}},tt=et(qe),nt=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=>S(e,i,Re())))}:{success:!0,data:a.value}},rt=nt(qe),it=e=>{let t=Qe(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Ze(n,a))};return n},at=e=>{let t=Qe(e),n=(e,r,i,a)=>t(e,r,i,Ze(n,a));return n},ot=e=>{let t=$e(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Ze(n,a))};return n},st=e=>{let t=$e(e),n=async(e,r,i,a)=>await t(e,r,i,Ze(n,a));return n},ct=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return et(e)(t,n,i)},lt=e=>(t,n,r)=>et(e)(t,n,r),ut=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return nt(e)(t,n,i)},dt=e=>async(t,n,r)=>nt(e)(t,n,r),ft=/^[cC][0-9a-z]{6,}$/,pt=/^[0-9a-z]+$/,mt=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,ht=/^[0-9a-vA-V]{20}$/,gt=/^[A-Za-z0-9]{27}$/,_t=/^[a-zA-Z0-9_-]{21}$/;function vt(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const yt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,bt=/^([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})$/,xt=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)$/,St=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Ct(){return RegExp(`^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,`u`)}const wt=/^(?:(?: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])$/,Tt=/^(([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}|:))$/,Et=/^((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])$/,Dt=/^(([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])$/,Ot=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,kt=/^[A-Za-z0-9_-]*$/,At=/^https?$/,jt=/^\+[1-9]\d{6,14}$/,Mt=`(?:(?:\\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 Nt(e){return RegExp(`^${e}$`)}const Pt=Nt(Mt);function Ft(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 It(e){return RegExp(`^${Ft(e)}$`)}function Lt(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Ft({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Ft({precision:e.precision})}`:n;return RegExp(`^${Mt}T(?:${r})$`)}const Rt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},zt=/^-?\d+$/,Bt=/^-?\d+(?:\.\d+)?$/,Vt=/^(?:true|false)$/i,Ht=/^null$/i,Ut=/^[^A-Z]*$/,Wt=/^[^a-z]*$/,Gt=w(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Kt=e=>{let t=e.value;return!i(t)&&t.length!==void 0},qt={number:`number`,bigint:`bigint`,object:`date`},Jt=w(`$ZodCheckLessThan`,(e,t)=>{Gt.init(e,t);let n=qt[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:qt[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})}}),Yt=w(`$ZodCheckGreaterThan`,(e,t)=>{Gt.init(e,t);let n=qt[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:qt[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})}}),Xt=w(`$ZodCheckMultipleOf`,(e,t)=>{Gt.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):o(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})}}),Zt=w(`$ZodCheckNumberFormat`,(e,t)=>{Gt.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ne[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=zt)}),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})}}),Qt=w(`$ZodCheckMaxLength`,(e,t)=>{var n;Gt.init(e,t),(n=e._zod.def).when??(n.when=Kt),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?ge(r):i)<=t.maximum)return;let a=_e(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),$t=w(`$ZodCheckMinLength`,(e,t)=>{var n;Gt.init(e,t),(n=e._zod.def).when??(n.when=Kt),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?ge(r):i)>=t.minimum)return;let a=_e(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),en=w(`$ZodCheckLengthEquals`,(e,t)=>{var n;Gt.init(e,t),(n=e._zod.def).when??(n.when=Kt),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?ge(r):i;if(a===t.length)return;let o=_e(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})}}),tn=w(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Gt.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=()=>{})}),nn=w(`$ZodCheckRegex`,(e,t)=>{tn.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})}}),rn=w(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Ut,tn.init(e,t)}),an=w(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Wt,tn.init(e,t)}),on=w(`$ZodCheckIncludes`,(e,t)=>{Gt.init(e,t);let n=y(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})}}),sn=w(`$ZodCheckStartsWith`,(e,t)=>{Gt.init(e,t);let n=RegExp(`^${y(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})}}),cn=w(`$ZodCheckEndsWith`,(e,t)=>{Gt.init(e,t);let n=RegExp(`.*${y(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})}}),ln=w(`$ZodCheckOverwrite`,(e,t)=>{Gt.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var un=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(`
|
|
2
|
+
`).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(`
|
|
3
|
+
`)}\n};`)(...Object.values(this.closed))}};const dn={major:4,minor:5,patch:4},T=w(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=dn;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=ue(t),a;for(let o of n){if(o._zod.def.when){if(de(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 Fe;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(me(t.issues,n,e),i||=ue(t,n))});else{if(t.issues.length===n)continue;me(t.issues,n,e),i||=ue(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(ue(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Fe;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 Fe;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Se(this,`~standard`,pn(this))},set"~standard"(e){xe(this,`~standard`,e)}}),fn=e=>e.success?{value:e.data}:{issues:e.error?.issues};function pn(e){return{validate:t=>{try{return fn(tt(e,t))}catch{return rt(e,t).then(fn)}},vendor:`zod`,version:1}}const mn=w(`$ZodString`,(e,t)=>{T.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Rt(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}}),E=w(`$ZodStringFormat`,(e,t)=>{tn.init(e,t),mn.init(e,t)}),hn=w(`$ZodGUID`,(e,t)=>{t.pattern??=bt,E.init(e,t)}),gn=w(`$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??=xt(e)}else t.pattern??=xt();E.init(e,t)}),_n=w(`$ZodEmail`,(e,t)=>{t.pattern??=St,E.init(e,t)});function vn(e,t){if(!t.normalize&&t.protocol?.source===At.source&&!/^https?:\/\//i.test(e))return 1;try{return new URL(e)}catch{return 2}}const yn=/[\t\n\r]/g;function bn(e){return e.replace(yn,``)}function xn(e,t){return t.lastIndex=0,t.test(e.hostname)}function Sn(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}const Cn=w(`$ZodURL`,(e,t)=>{E.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=vn(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&&!xn(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&&!Sn(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:bn(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),wn=w(`$ZodEmoji`,(e,t)=>{t.pattern??=Ct(),E.init(e,t)}),Tn=w(`$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?_t:vt(t.length),E.init(e,t)}),En=w(`$ZodCUID`,(e,t)=>{t.pattern??=ft,E.init(e,t)}),Dn=w(`$ZodCUID2`,(e,t)=>{t.pattern??=pt,E.init(e,t)}),On=w(`$ZodULID`,(e,t)=>{t.pattern??=mt,E.init(e,t)}),kn=w(`$ZodXID`,(e,t)=>{t.pattern??=ht,E.init(e,t)}),An=w(`$ZodKSUID`,(e,t)=>{t.pattern??=gt,E.init(e,t)}),jn=w(`$ZodISODateTime`,(e,t)=>{t.pattern??=Lt(t),E.init(e,t),(t.local||t.precision===-1)&&(e._zod.bag.laxFormat=!0,e._zod.onattach.push(e=>{e._zod.bag.laxFormat=!0}))}),Mn=w(`$ZodISODate`,(e,t)=>{t.pattern??=Pt,E.init(e,t)}),Nn=w(`$ZodISOTime`,(e,t)=>{t.pattern??=It(t),E.init(e,t)}),Pn=w(`$ZodISODuration`,(e,t)=>{t.pattern??=yt,E.init(e,t)}),Fn=w(`$ZodIPv4`,(e,t)=>{t.pattern??=wt,E.init(e,t),e._zod.bag.format=`ipv4`}),In=/^[0-9a-fA-F:.]+$/;function Ln(e){if(!In.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}const Rn=w(`$ZodIPv6`,(e,t)=>{t.pattern??=Tt,E.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{Ln(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),zn=w(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Et,E.init(e,t)});function Bn(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:Ln(n)}const Vn=w(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Dt,E.init(e,t),e._zod.check=n=>{Bn(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Hn(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Un=w(`$ZodBase64`,(e,t)=>{t.pattern??=Ot,E.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Hn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Wn(e){if(!kt.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`),n=t.padEnd(Math.ceil(t.length/4)*4,`=`);return Hn(n)}const Gn=w(`$ZodBase64URL`,(e,t)=>{t.pattern??=kt,E.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Wn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Kn=w(`$ZodE164`,(e,t)=>{t.pattern??=jt,E.init(e,t)});function qn(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 Jn=w(`$ZodJWT`,(e,t)=>{E.init(e,t),e._zod.check=n=>{qn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Yn=w(`$ZodNumber`,(e,t)=>{T.init(e,t),e._zod.pattern=e._zod.bag.pattern??Bt,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}}),Xn=w(`$ZodNumberFormat`,(e,t)=>{Zt.init(e,t),Yn.init(e,t)}),Zn=w(`$ZodBoolean`,(e,t)=>{T.init(e,t),e._zod.pattern=Vt,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}}),Qn=w(`$ZodNull`,(e,t)=>{T.init(e,t),e._zod.pattern=Ht,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}}),$n=w(`$ZodAny`,(e,t)=>{T.init(e,t),e._zod.parse=e=>e}),er=w(`$ZodUnknown`,(e,t)=>{T.init(e,t),e._zod.parse=e=>e}),tr=w(`$ZodNever`,(e,t)=>{T.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function nr(e,t,n){e.issues.length&&t.issues.push(...fe(n,e.issues)),t.value[n]=e.value}const rr=w(`$ZodArray`,(e,t)=>{T.init(e,t);let n=Le.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=>nr(t,r,e))):nr(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function ir(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(...fe(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 ar=[];function or(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:ar,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=te(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function sr(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=>ir(e,n,i,t,u,d))):ir(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 cr=new WeakMap,lr=w(`$ZodObject`,(e,t)=>{if(T.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;cr.set(t,e),Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),cr.set(t,n),n}})}let n=r(()=>or(t));C(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)||l(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 i=m,a=t.catchall,o,s=Le.memoizer;s?.attach(e),e._zod.parse=(t,r)=>{o??=n.value;let c=t.value;if(!i(c))return t.issues.push({expected:`object`,code:`invalid_type`,input:c,inst:e}),t;t.value=s?s.alloc(e,t,{},r):{};let l=[],u=o.shape;for(let e of o.allKeys){if(e===`__proto__`)continue;let n=u[e],i=n._zod.optin,a=n._zod.optout,o=n._zod.run({value:c[e],issues:[]},r);o instanceof Promise?l.push(o.then(n=>ir(n,t,e,c,i,a))):ir(o,t,e,c,i,a)}return a?sr(l,c,t,r,n.value,e):l.length?Promise.all(l).then(()=>t):t}}),ur=w(`$ZodObjectJIT`,(e,t)=>{lr.init(e,t);let n=e._zod.parse,i=r(()=>or(t)),a=Le.memoizer,o=t=>{let n=i.value,r=n.symbolKeys,o=new un([`payload`,`ctx`],{shape:t,inst:e,memo:a,syms:r}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
4
|
+
for (let i = 0; i < ${e}.issues.length; i++) {
|
|
5
|
+
const iss = ${e}.issues[i];
|
|
6
|
+
iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
|
|
7
|
+
payload.issues.push(iss);
|
|
8
|
+
}`;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(a?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],i=typeof e==`symbol`?`syms[${r.indexOf(e)}]`:d(e),a=`${i} in input`,u=t[e],f=u?._zod?.optin,p=f!==void 0,m=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(i)};`),p&&m){let e=f===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
|
|
9
|
+
const ${n}_present = ${a};
|
|
10
|
+
if (!${n}.issues.length || ${n}_present) {
|
|
11
|
+
if (${n}.issues.length) {${c(n,i)}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (${e}) {
|
|
15
|
+
newResult[${i}] = ${n}.value;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
`)}else p?o.write(`
|
|
20
|
+
if (${n}.issues.length) {${c(n,i)}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (${n}.value === undefined) {
|
|
24
|
+
if (${a}) {
|
|
25
|
+
newResult[${i}] = undefined;
|
|
26
|
+
}
|
|
27
|
+
} else {
|
|
28
|
+
newResult[${i}] = ${n}.value;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
`):o.write(`
|
|
32
|
+
const ${n}_present = ${a};
|
|
33
|
+
if (${n}.issues.length) {${c(n,i)}
|
|
34
|
+
}
|
|
35
|
+
if (!${n}_present && !${n}.issues.length) {
|
|
36
|
+
payload.issues.push({
|
|
37
|
+
code: "invalid_type",
|
|
38
|
+
expected: "nonoptional",
|
|
39
|
+
input: undefined,
|
|
40
|
+
path: [${i}]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (${n}_present) {
|
|
45
|
+
newResult[${i}] = ${n}.value;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},s,c=m,l=!Le.jitless,u=l&&h.value,f=t.catchall,p;e._zod.parse=(r,a)=>{p??=i.value;let d=r.value;return c(d)?l&&u&&a?.async===!1&&a.jitless!==!0?(s||=o(t.shape),r=s(r,a),f?sr([],d,r,a,p,e):r):n(r,a):(r.issues.push({expected:`object`,code:`invalid_type`,input:d,inst:e}),r)}});function dr(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=>!ue(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=>S(e,r,Re())))}),t)}const fr=w(`$ZodUnion`,(e,t)=>{T.init(e,t),C(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),C(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),C(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)))}),C(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=>a(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=>dr(t,r,e,i)):dr(o,r,e,i)}}),pr=w(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,fr.init(e,t);let n=e._zod.parse;C(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)||l(t,e,new Set);for(let r of n)t[e].add(r)}}return t}),t.options.forEach((e,n)=>{let r=cr.get(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let i=r(()=>{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=(r,a)=>{let o=r.value;if(!m(o))return r.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),r;let s=i.value.get(o?.[t.discriminator]);return s?s._zod.run(r,a):t.unionFallback||a.direction===`backward`?n(r,a):(r.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(i.value.keys()),input:o,path:[t.discriminator],inst:e}),r)}}),mr=w(`$ZodIntersection`,(e,t)=>{T.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])=>gr(e,t,n)):gr(e,i,a)}});function hr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(g(e)&&g(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=hr(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=hr(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 gr(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=hr(t.value,n.value);if(!c.valid){if(ue(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}const _r=w(`$ZodRecord`,(e,t)=>{T.init(e,t);let n=Le.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!g(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=>S(e,i,Re())),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(...fe(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...fe(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`&&Bt.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=>S(e,i,Re())),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(...fe(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...fe(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}}),vr=w(`$ZodEnum`,(t,n)=>{T.init(t,n);let r=e(n.entries),i=new Set(r);t._zod.values=i;let a=r.filter(e=>v.has(typeof e));t._zod.pattern=RegExp(a.length?`^(${a.map(e=>y(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`),t._zod.parse=(e,n)=>{let a=e.value;return i.has(a)||e.issues.push({code:`invalid_value`,values:r,input:a,inst:t}),e}}),yr=w(`$ZodLiteral`,(e,t)=>{T.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`?y(e):e?y(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}}),br=w(`$ZodTransform`,(e,t)=>{T.init(e,t),e._zod.optin=`optional`,Le.memoizer.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ie(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 Fe;return n.value=i,n}});function xr(e,t){return e.value=t.issues.length?void 0:t.value,e}const Sr=w(`$ZodOptional`,(e,t)=>{T.init(e,t),C(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,C(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),C(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${a(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=>xr(e,t)):xr(e,r)}return t.innerType._zod.run(e,n)}}),Cr=w(`$ZodExactOptional`,(e,t)=>{Sr.init(e,t),C(e,`values`,e=>e.def.innerType._zod.values),C(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),wr=w(`$ZodNullable`,(e,t)=>{T.init(e,t),C(e,`optin`,e=>e.def.innerType._zod.optin),C(e,`optout`,e=>e.def.innerType._zod.optout),C(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${a(t.source)}|null)$`):void 0}),C(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)}),Tr=w(`$ZodDefault`,(e,t)=>{T.init(e,t),e._zod.optin=`defaulted`,C(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=>Er(e,t)):Er(r,t)}});function Er(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Dr=w(`$ZodPrefault`,(e,t)=>{T.init(e,t),e._zod.optin=`defaulted`,C(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))}),Or=w(`$ZodNonOptional`,(e,t)=>{T.init(e,t),C(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=>kr(t,e)):kr(i,e)}});function kr(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 Ar(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>S(e,r,Re()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const jr=w(`$ZodCatch`,(e,t)=>{T.init(e,t),C(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),C(e,`optout`,e=>e.def.innerType._zod.optout),C(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=>Ar(e,r,t,n)):Ar(e,r,t,n)}}),Mr=w(`$ZodPipe`,(e,t)=>{T.init(e,t),C(e,`values`,e=>e.def.in._zod.values),C(e,`optin`,e=>e.def.in._zod.optin),C(e,`optout`,e=>e.def.out._zod.optout),C(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=>Nr(e,t.in,n)):Nr(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Nr(e,t.out,n)):Nr(r,t.out,n)}});function Nr(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 Pr=w(`$ZodPreprocess`,(e,t)=>{Mr.init(e,t)}),Fr=w(`$ZodReadonly`,(e,t)=>{T.init(e,t),C(e,`propValues`,e=>e.def.innerType._zod.propValues),C(e,`values`,e=>e.def.innerType._zod.values),C(e,`optin`,e=>e.def.innerType?._zod?.optin),C(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(Ir):Ir(r)}});function Ir(e){return e.memo||(e.value=Object.freeze(e.value)),e}const Lr=w(`$ZodLazy`,(e,t)=>{T.init(e,t),c(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),C(e,`pattern`,e=>e.innerType?._zod?.pattern),C(e,`propValues`,e=>e.innerType?._zod?.propValues),C(e,`optin`,e=>e.innerType?._zod?.optin??void 0),C(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Rr=w(`$ZodCustom`,(e,t)=>{Gt.init(e,t),T.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=>zr(t,n,r,e));zr(i,n,r,e)}});function zr(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(ye(e))}}var Br=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}};const Vr=`~memo`,Hr=[];function Ur(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}const Wr=new WeakMap;function Gr(e,t){let n=Wr.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&&Gr(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`)continue;if(n._zod)i(n);else if(Array.isArray(n))for(let e of n)i(e)}}return t.delete(e),Wr.set(e,r),r}function Kr(e,t){let n=e.buckets.get(t);return n||(n=new Map,e.buckets.set(t,n)),n}let qr;const Jr=[],Yr={alloc(e,t,n){let r=qr;if(!r)return n;qr=void 0;let i={value:n,issues:null};return r.set(t.value,i),Jr.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`&&Zr(n,e.value))throw new Br;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=Gr(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[Vr];l||(l={buckets:new Map,backEdges:void 0},s[Vr]=l);let u;r===s?u=i:(u=Kr(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(...Ur(d.issues)):(o.memo=!0,l.backEdges??=new Set,l.backEdges.add(d.value)),o;qr=u;let f=Jr.length,p=t(o,s);qr=void 0;let m=Jr.length>f?Jr.pop():void 0;return p instanceof Promise?p.then(e=>(m&&(m.issues=e.issues.length?Ur(e.issues):Hr),e)):(m&&(m.issues=p.issues.length?Ur(p.issues):Hr),p)};e._zod.parse=a,e._zod.run===t&&(e._zod.run=a)})}};function Xr(){return Yr}function Zr(e,t){let n=e[Vr]?.backEdges;return n!==void 0&&typeof t==`object`&&!!t&&n.has(t)}const Qr=()=>{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 n(t){return e[t]??null}let r={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,credit_card:`credit card number`,jwt:`JWT`,template_literal:`input`},i={nan:`NaN`};function a(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):i[e]??e}return e=>{switch(e.code){case`invalid_type`:{let t=a(e.expected),n=ve(e.input),r=a(n,e.input);return`Invalid input: expected ${t}, received ${r}`}case`invalid_value`:return e.values.length===1?`Invalid input: expected ${ee(e.values[0])}`:`Invalid option: expected one of ${t(e.values,`|`)}`;case`too_big`:{let t=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=n(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${t}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${t}${e.maximum.toString()}`}case`too_small`:{let t=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=n(e.origin);return r?`Too small: expected ${e.origin} to have ${t}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${t}${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 ${r[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`:``}: ${t(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 $r(){return{localeError:Qr()}}var ei,ti=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 ni(){return new ti}(ei=globalThis).__zod_globalRegistry??(ei.__zod_globalRegistry=ni());const ri=globalThis.__zod_globalRegistry;function ii(e,t){return new e({type:`string`,...x(t)})}function ai(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...x(t)})}function oi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...x(t)})}function si(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...x(t)})}function ci(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...x(t)})}function li(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...x(t)})}function ui(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...x(t)})}function di(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...x(t)})}function fi(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...x(t)})}function pi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...x(t)})}function mi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...x(t)})}function hi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...x(t)})}function gi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...x(t)})}function _i(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...x(t)})}function vi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...x(t)})}function yi(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...x(t)})}function bi(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...x(t)})}function xi(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...x(t)})}function Si(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...x(t)})}function Ci(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...x(t)})}function wi(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...x(t)})}function Ti(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...x(t)})}function Ei(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...x(t)})}function Di(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...x(t)})}function Oi(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...x(t)})}function ki(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...x(t)})}function Ai(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...x(t)})}function ji(e,t){return new e({type:`number`,checks:[],...x(t)})}function Mi(e,t){return new e({type:`number`,coerce:!0,checks:[],...x(t)})}function Ni(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...x(t)})}function Pi(e,t){return new e({type:`boolean`,...x(t)})}function Fi(e,t){return new e({type:`null`,...x(t)})}function Ii(e){return new e({type:`any`})}function Li(e){return new e({type:`unknown`})}function Ri(e,t){return new e({type:`never`,...x(t)})}function zi(e,t){return new Jt({check:`less_than`,...x(t),value:e,inclusive:!1})}function Bi(e,t){return new Jt({check:`less_than`,...x(t),value:e,inclusive:!0})}function Vi(e,t){return new Yt({check:`greater_than`,...x(t),value:e,inclusive:!1})}function Hi(e,t){return new Yt({check:`greater_than`,...x(t),value:e,inclusive:!0})}function Ui(e,t){return new Xt({check:`multiple_of`,...x(t),value:e})}function Wi(e,t){return new Qt({check:`max_length`,...x(t),maximum:e})}function Gi(e,t){return new $t({check:`min_length`,...x(t),minimum:e})}function Ki(e,t){return new en({check:`length_equals`,...x(t),length:e})}function qi(e,t){return new nn({check:`string_format`,format:`regex`,...x(t),pattern:e})}function Ji(e){return new rn({check:`string_format`,format:`lowercase`,...x(e)})}function Yi(e){return new an({check:`string_format`,format:`uppercase`,...x(e)})}function Xi(e,t){return new on({check:`string_format`,format:`includes`,...x(t),includes:e})}function Zi(e,t){return new sn({check:`string_format`,format:`starts_with`,...x(t),prefix:e})}function Qi(e,t){return new cn({check:`string_format`,format:`ends_with`,...x(t),suffix:e})}function $i(e){return new ln({check:`overwrite`,tx:e})}function ea(e){return $i(t=>t.normalize(e))}function ta(){return $i(e=>e.trim())}function na(){return $i(e=>e.toLowerCase())}function ra(){return $i(e=>e.toUpperCase())}function ia(){return $i(e=>f(e))}function aa(e,t,n){return new e({type:`array`,element:t,...x(n)})}function oa(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...x(n)})}function sa(e,t){let n=ca(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(ye(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(ye(r))}},e(t.value,t)),t);return n}function ca(e,t){let n=new Gt({check:`custom`,...x(t)});return n._zod.check=e,n}function la(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&l(e,t,n[t]);return e}function ua(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??ri,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 da(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 D(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,D(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&la(o.schema,c),t.io===`input`&&xa(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 fa(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function pa(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}/${fa(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+fa(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>
|
|
49
|
+
|
|
50
|
+
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 ma(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;ma(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 ha=new Set([`type`,`properties`,`required`,`additionalProperties`]),ga=[`oneOf`,`anyOf`];function _a(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function va(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!ha.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]??_a(n);if(t==null)continue;e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t)}let i=e.length===1?e[0]:va(e)??{allOf:e};l(n,r,i)}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=_a(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 ya(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of ha)if(t in e)return;let n=t.filter(e=>ga.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=va(t);else{let e=n[0],i=ga.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=>va([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,la(e,r))}function ba(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)):la(i,s),la(i,a),t._zod.parent===o)for(let e in i){if(e===`$ref`||e===`allOf`)continue;e in a||delete i[e]}if(s.$ref&&n.def)for(let e in i){if(e===`$ref`||e===`allOf`)continue;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){if(e===`$ref`||e===`allOf`)continue;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())ma(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)??[])ya(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)}la(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,l(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:Ca(t,`input`,e.processors),output:Ca(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function xa(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 xa(r.element,n);if(r.type===`set`)return xa(r.valueType,n);if(r.type===`lazy`)return xa(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 xa(r.innerType,n);if(r.type===`intersection`)return xa(r.left,n)||xa(r.right,n);if(r.type===`record`||r.type===`map`)return xa(r.keyType,n)||xa(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:xa(r.in,n)||xa(r.out,n);if(r.type===`object`){for(let e in r.shape)if(xa(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(xa(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(xa(e,n))return!0;return!!(r.rest&&xa(r.rest,n))}return!1}const Sa=(e,t={})=>n=>{let r=ua({...n,processors:t});return D(e,r),pa(r,e),ba(r,e)},Ca=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ua({...i??{},target:a,io:t,processors:n});return D(e,o),pa(o,e),ba(o,e)},wa={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Ta=(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=wa[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}))])}},Ea=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`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):da(e,t,i,r,`A multipleOf divisor of ${c} cannot be represented in JSON Schema`))},Da=(e,t,n,r)=>{n.type=`boolean`},Oa=(e,t,n,r)=>{da(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},ka=(e,t,n,r)=>{da(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},Aa=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},ja=(e,t,n,r)=>{da(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},Ma=(e,t,n,r)=>{da(e,t,n,r,`Void cannot be represented in JSON Schema`)},Na=(e,t,n,r)=>{n.not={}},Pa=(e,t,n,r)=>{},Fa=(e,t,n,r)=>{},Ia=(e,t,n,r)=>{da(e,t,n,r,`Date cannot be represented in JSON Schema`)},La=(t,n,r,i)=>{let a=t._zod.def,o=e(a.entries);if(o.length===0){r.not={};return}o.every(e=>typeof e==`number`)&&(r.type=`number`),o.every(e=>typeof e==`string`)&&(r.type=`string`),r.enum=o},Ra=(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(da(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(da(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},za=(e,t,n,r)=>{da(e,t,n,r,`NaN cannot be represented in JSON Schema`)},Ba=(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},Va=(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)},Ha=(e,t,n,r)=>{n.type=`boolean`},Ua=(e,t,n,r)=>{da(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Wa=(e,t,n,r)=>{da(e,t,n,r,`Function types cannot be represented in JSON Schema`)},Ga=(e,t,n,r)=>{da(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Ka=(e,t,n,r)=>{da(e,t,n,r,`Map cannot be represented in JSON Schema`)},qa=(e,t,n,r)=>{da(e,t,n,r,`Set cannot be represented in JSON Schema`)},Ja=(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=D(a.element,t,{...r,path:[...r.path,`items`]})};function Ya(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Ya(t.out):t.type===`catch`?Ya(t.innerType):e._zod.optin}const Xa=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&da(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;for(let e in i.type=`object`,i.properties={},o)l(i.properties,e,D(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`?Ya(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=D(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Za=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>D(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Qa=(e,t,n,r)=>{let i=e._zod.def,a=D(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=D(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)},$a=(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)=>D(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?D(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`?Ya(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 eo(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=eo(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=>eo(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`)?Bt:zt).source),p):p}const to=new WeakMap;function no(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 to.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=eo(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 ro=(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=D(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)l(i.patternProperties,t.source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=D(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=to.get(t);n||(n=[],to.set(t,n),t.deferred.push(()=>no(t))),n.push(e)}i.additionalProperties=D(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,u=t.io===`input`&&Ya(a.valueType)!==void 0;if(c&&!a.partial&&!u){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},io=(e,t,n,r)=>{let i=e._zod.def,a=D(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`}]},ao=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},oo=Symbol();function so(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(da(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),oo):JSON.parse(o)}const co=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=so(i.defaultValue,e,t,n,r);o!==oo&&(n.default=o)},lo=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=so(i.defaultValue,e,t,n,r);o!==oo&&(n._prefault=o)},uo=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{da(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},fo=(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;D(o,t,r);let s=t.seen.get(e);s.ref=o},po=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},mo=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ho=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},go=(e,t,n,r)=>{let i=e._zod.innerType;D(i,t,r);let a=t.seen.get(e);a.ref=i},_o={string:Ta,number:Ea,boolean:Da,bigint:Oa,symbol:ka,null:Aa,undefined:ja,void:Ma,never:Na,any:Pa,unknown:Fa,date:Ia,enum:La,literal:Ra,nan:za,template_literal:Ba,file:Va,success:Ha,custom:Ua,function:Wa,transform:Ga,map:Ka,set:qa,array:Ja,object:Xa,union:Za,intersection:Qa,tuple:$a,record:ro,nullable:io,nonoptional:ao,default:co,prefault:lo,catch:uo,pipe:fo,readonly:po,promise:mo,optional:ho,lazy:go};function vo(e,t){if(`_idmap`in e){let n=e,r=ua({...t,processors:_o}),i={};for(let e of n._idmap.entries()){let[t,n]=e;D(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;pa(r,n),l(a,t,ba(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=ua({...t,processors:_o});return D(e,n),pa(n,e),ba(n,e)}const yo=new WeakSet([Object.prototype,Error.prototype]);function bo(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 xo=w(`ZodError`,(e,t)=>{Ke.init(e,t),e.name=`ZodError`;let r=Object.getPrototypeOf(e);yo.has(r)||(yo.add(r),bo(r,`format`,e=>t=>Xe(e,t)),bo(r,`flatten`,e=>t=>Ye(e,t)),bo(r,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,n,2)}),bo(r,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,n,2)}),Object.defineProperty(r,`isEmpty`,{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),So=Qe(xo),Co=$e(xo),wo=et(xo),To=nt(xo),Eo=it(xo),Do=at(xo),Oo=ot(xo),ko=st(xo),Ao=ct(xo),jo=lt(xo),Mo=ut(xo),No=dt(xo);function Po(){Le.localeError||Re($r())}function Fo(){Le.memoizer||Re({memoizer:Xr()})}const O=w(`ZodType`,(e,t)=>(Po(),T.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(u(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 b(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(tc(e,t))},superRefine(e,t){return this.check(nc(e,t))},overwrite(e){return this.check($i(e))},optional(){return V(this)},exactOptional(){return Is(this)},nullable(){return Rs(this)},nullish(){return V(Rs(this))},nonoptional(e){return Ws(this,e)},array(){return P(this)},or(e){return L([this,e])},and(e){return Os(this,e)},transform(e){return Js(this,Ns(e))},default(e){return Bs(this,e)},prefault(e){return Hs(this,e)},catch(e){return Ks(this,e)},pipe(e){return Js(this,e)},readonly(){return Zs(this)},describe(e){let t=this.clone();return ri.add(t,{description:e}),t},meta(...e){if(e.length===0)return ri.get(this);let t=this.clone();return ri.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 Se(this,`~standard`,{...pn(this),jsonSchema:{input:Ca(this,`input`),output:Ca(this,`output`)}})},set"~standard"(e){xe(this,`~standard`,e)},parse:function e(t,n){return So(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Co(this,t,n,{callee:e})},safeParse(e,t){return wo(this,e,t)},async safeParseAsync(e,t){return To(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){xe(this,`spa`,e)},encode:function e(t,n){return Eo(this,t,n,{callee:e})},decode:function e(t,n){return Do(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Oo(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await ko(this,t,n,{callee:e})},safeEncode(e,t){return Ao(this,e,t)},safeDecode(e,t){return jo(this,e,t)},async safeEncodeAsync(e,t){return Mo(this,e,t)},async safeDecodeAsync(e,t){return No(this,e,t)},toJSONSchema(e){return Sa(this,{})(e)},get description(){return ri.get(this)?.description},get _def(){return this._zod.def}}),Io=w(`_ZodString`,(e,t)=>{mn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ta(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(qi(...e))},includes(...e){return this.check(Xi(...e))},startsWith(...e){return this.check(Zi(...e))},endsWith(...e){return this.check(Qi(...e))},min(...e){return this.check(Gi(...e))},max(...e){return this.check(Wi(...e))},length(...e){return this.check(Ki(...e))},nonempty(...e){return this.check(Gi(1,...e))},lowercase(e){return this.check(Ji(e))},uppercase(e){return this.check(Yi(e))},trim(){return this.check(ta())},normalize(...e){return this.check(ea(...e))},toLowerCase(){return this.check(na())},toUpperCase(){return this.check(ra())},slugify(){return this.check(ia())}}),Lo=w(`ZodString`,(e,t)=>{mn.init(e,t),Io.init(e,t)},{email(e){return this.check(ai(Ho,e))},url(e){return this.check(di(Ko,e))},jwt(e){return this.check(Ei(us,e))},emoji(e){return this.check(fi(Jo,e))},guid(e){return this.check(oi(Wo,e))},uuid(e){return this.check(si(Go,e))},uuidv4(e){return this.check(ci(Go,e))},uuidv6(e){return this.check(li(Go,e))},uuidv7(e){return this.check(ui(Go,e))},nanoid(e){return this.check(pi(Yo,e))},cuid(e){return this.check(mi(Xo,e))},cuid2(e){return this.check(hi(Zo,e))},ulid(e){return this.check(gi(Qo,e))},base64(e){return this.check(Ci(ss,e))},base64url(e){return this.check(wi(cs,e))},xid(e){return this.check(_i($o,e))},ksuid(e){return this.check(vi(es,e))},ipv4(e){return this.check(yi(ts,e))},ipv6(e){return this.check(bi(ns,e))},cidrv4(e){return this.check(xi(rs,e))},cidrv6(e){return this.check(Si(os,e))},e164(e){return this.check(Ti(ls,e))},datetime(e){return this.check(Di(Ro,e))},date(e){return this.check(Oi(zo,e))},time(e){return this.check(ki(Bo,e))},duration(e){return this.check(Ai(Vo,e))}});function k(e){return ii(Lo,e)}const A=w(`ZodStringFormat`,(e,t)=>{E.init(e,t),Io.init(e,t)}),Ro=w(`ZodISODateTime`,(e,t)=>{jn.init(e,t),A.init(e,t)}),zo=w(`ZodISODate`,(e,t)=>{Mn.init(e,t),A.init(e,t)}),Bo=w(`ZodISOTime`,(e,t)=>{Nn.init(e,t),A.init(e,t)}),Vo=w(`ZodISODuration`,(e,t)=>{Pn.init(e,t),A.init(e,t)}),Ho=w(`ZodEmail`,(e,t)=>{_n.init(e,t),A.init(e,t)});function Uo(e){return ai(Ho,e)}const Wo=w(`ZodGUID`,(e,t)=>{hn.init(e,t),A.init(e,t)}),Go=w(`ZodUUID`,(e,t)=>{gn.init(e,t),A.init(e,t)}),Ko=w(`ZodURL`,(e,t)=>{Cn.init(e,t),A.init(e,t)});function qo(e){return di(Ko,e)}const Jo=w(`ZodEmoji`,(e,t)=>{wn.init(e,t),A.init(e,t)}),Yo=w(`ZodNanoID`,(e,t)=>{Tn.init(e,t),A.init(e,t)}),Xo=w(`ZodCUID`,(e,t)=>{En.init(e,t),A.init(e,t)}),Zo=w(`ZodCUID2`,(e,t)=>{Dn.init(e,t),A.init(e,t)}),Qo=w(`ZodULID`,(e,t)=>{On.init(e,t),A.init(e,t)}),$o=w(`ZodXID`,(e,t)=>{kn.init(e,t),A.init(e,t)}),es=w(`ZodKSUID`,(e,t)=>{An.init(e,t),A.init(e,t)}),ts=w(`ZodIPv4`,(e,t)=>{Fn.init(e,t),A.init(e,t)}),ns=w(`ZodIPv6`,(e,t)=>{Rn.init(e,t),A.init(e,t)}),rs=w(`ZodCIDRv4`,(e,t)=>{zn.init(e,t),A.init(e,t)}),os=w(`ZodCIDRv6`,(e,t)=>{Vn.init(e,t),A.init(e,t)}),ss=w(`ZodBase64`,(e,t)=>{Un.init(e,t),A.init(e,t)}),cs=w(`ZodBase64URL`,(e,t)=>{Gn.init(e,t),A.init(e,t)}),ls=w(`ZodE164`,(e,t)=>{Kn.init(e,t),A.init(e,t)}),us=w(`ZodJWT`,(e,t)=>{Jn.init(e,t),A.init(e,t)}),ds=w(`ZodNumber`,(e,t)=>{Yn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ea(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(Vi(e,t))},gte(e,t){return this.check(Hi(e,t))},min(e,t){return this.check(Hi(e,t))},lt(e,t){return this.check(zi(e,t))},lte(e,t){return this.check(Bi(e,t))},max(e,t){return this.check(Bi(e,t))},int(e){return this.check(ps(e))},safe(e){return this.check(ps(e))},positive(e){return this.check(Vi(0,e))},nonnegative(e){return this.check(Hi(0,e))},negative(e){return this.check(zi(0,e))},nonpositive(e){return this.check(Bi(0,e))},multipleOf(e,t){return this.check(Ui(e,t))},step(e,t){return this.check(Ui(e,t))},finite(){return this}});function j(e){return ji(ds,e)}const fs=w(`ZodNumberFormat`,(e,t)=>{Xn.init(e,t),ds.init(e,t)});function ps(e){return Ni(fs,e)}const ms=w(`ZodBoolean`,(e,t)=>{Zn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Da(e,t,n,r)});function M(e){return Pi(ms,e)}const hs=w(`ZodNull`,(e,t)=>{Qn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Aa(e,t,n,r)});function gs(e){return Fi(hs,e)}const _s=w(`ZodAny`,(e,t)=>{$n.init(e,t),O.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function vs(){return Ii(_s)}const ys=w(`ZodUnknown`,(e,t)=>{er.init(e,t),O.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function N(){return Li(ys)}const bs=w(`ZodNever`,(e,t)=>{tr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Na(e,t,n,r)});function xs(e){return Ri(bs,e)}const Ss=w(`ZodArray`,(e,t)=>{Fo(),rr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ja(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Gi(e,t))},nonempty(e){return this.check(Gi(1,e))},max(e,t){return this.check(Wi(e,t))},length(e,t){return this.check(Ki(e,t))},unwrap(){return this.element}});function P(e,t){return aa(Ss,e,t)}const Cs=w(`ZodObject`,(e,t)=>{Fo(),ur.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xa(e,t,n,r),Oe(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return z(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:N()})},loose(){return this.clone({...this._zod.def,catchall:N()})},strict(){return this.clone({...this._zod.def,catchall:xs()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return ae(this,e)},safeExtend(e){return oe(this,e)},merge(e){return se(this,e)},pick(e){return re(this,e)},omit(e){return ie(this,e)},partial(...e){return ce(Ps,this,e[0])},exactPartial(...e){return ce(Fs,this,e[0],`exactPartial`)},required(...e){return le(Us,this,e[0])}});function F(e,t){let n={type:`object`,shape:e??{},...x(t)};return new Cs(n)}function I(e,t){return new Cs({type:`object`,shape:e,catchall:N(),...x(t)})}const ws=w(`ZodUnion`,(e,t)=>{fr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Za(e,t,n,r),e.options=t.options});function L(e,t){return new ws({type:`union`,options:e,...x(t)})}const Ts=w(`ZodDiscriminatedUnion`,(e,t)=>{ws.init(e,t),pr.init(e,t)});function Es(e,t,n){return new Ts({type:`union`,options:t,discriminator:e,...x(n)})}const Ds=w(`ZodIntersection`,(e,t)=>{mr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qa(e,t,n,r)});function Os(e,t){return new Ds({type:`intersection`,left:e,right:t})}const ks=w(`ZodRecord`,(e,t)=>{Fo(),_r.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ro(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function R(e,t,n){return!t||!t._zod?new ks({type:`record`,keyType:k(),valueType:e,...x(t)}):new ks({type:`record`,keyType:e,valueType:t,...x(n)})}const As=w(`ZodEnum`,(e,t)=>{vr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>La(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 As({...t,checks:[],...x(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 As({...t,checks:[],...x(r),entries:i})}});function z(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new As({type:`enum`,entries:n,...x(t)})}const js=w(`ZodLiteral`,(e,t)=>{yr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ra(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 B(e,t){return new js({type:`literal`,values:Array.isArray(e)?e:[e],...x(t)})}const Ms=w(`ZodTransform`,(e,t)=>{Fo(),br.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ga(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ie(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(ye(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(ye(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Ns(e){return new Ms({type:`transform`,transform:e})}const Ps=w(`ZodOptional`,(e,t)=>{Sr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function V(e){return new Ps({type:`optional`,innerType:e})}const Fs=w(`ZodExactOptional`,(e,t)=>{Cr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Is(e){return new Fs({type:`optional`,innerType:e})}const Ls=w(`ZodNullable`,(e,t)=>{wr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Rs(e){return new Ls({type:`nullable`,innerType:e})}const zs=w(`ZodDefault`,(e,t)=>{Tr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Bs(e,t){return new zs({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():_(t)}})}const Vs=w(`ZodPrefault`,(e,t)=>{Dr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Hs(e,t){return new Vs({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():_(t)}})}const Us=w(`ZodNonOptional`,(e,t)=>{Or.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ao(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ws(e,t){return new Us({type:`nonoptional`,innerType:e,...x(t)})}const Gs=w(`ZodCatch`,(e,t)=>{jr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ks(e,t){return new Gs({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:ke(t)})}const qs=w(`ZodPipe`,(e,t)=>{Mr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(e,t,n,r),e.in=t.in,e.out=t.out});function Js(e,t){return new qs({type:`pipe`,in:e,out:t})}const Ys=w(`ZodPreprocess`,(e,t)=>{qs.init(e,t),Pr.init(e,t)}),Xs=w(`ZodReadonly`,(e,t)=>{Fr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Zs(e){return new Xs({type:`readonly`,innerType:e})}const Qs=w(`ZodLazy`,(e,t)=>{Lr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function $s(e){return new Qs({type:`lazy`,getter:e})}const ec=w(`ZodCustom`,(e,t)=>{Rr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ua(e,t,n,r)});function tc(e,t={}){return oa(ec,e,t)}function nc(e,t){return sa(e,t)}function rc(e,t){return new Ys({type:`pipe`,in:Ns(e),out:t})}const ic={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 ac;(function(e){})(ac||={});function oc(e){return Di(Ro,e)}function sc(e){return Oi(zo,e)}function cc(e){return Mi(ds,e)}const lc=`2025-11-25`,uc=`2025-03-26`,dc=[lc,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],fc=`io.modelcontextprotocol/protocolVersion`,pc=`io.modelcontextprotocol/clientInfo`,mc=`io.modelcontextprotocol/serverInfo`,hc=`io.modelcontextprotocol/clientCapabilities`,gc=`io.modelcontextprotocol/subscriptionId`,_c=`io.modelcontextprotocol/logLevel`,vc=$s(()=>L([k(),j(),M(),gs(),R(k(),vc),P(vc)])),H=R(k(),vc),yc=P(vc),bc=L([k(),j().int()]),xc=k(),Sc=F({ttl:j().optional()}),Cc=F({taskId:k()}),wc=I({progressToken:bc.optional(),"io.modelcontextprotocol/related-task":Cc.optional()}),Tc=F({_meta:wc.optional()}),Ec=Tc.extend({task:Sc.optional()}),U=F({method:k(),params:Tc.loose().optional()}),Dc=F({_meta:wc.optional()}),Oc=F({method:k(),params:Dc.loose().optional()}),kc=I({get[mc](){return Uc.optional().catch(void 0)}}),W=I({_meta:kc.optional()}),Ac=L([k(),j().int()]),jc=F({jsonrpc:B(`2.0`),id:Ac,...U.shape}).strict(),Mc=F({jsonrpc:B(`2.0`),...Oc.shape}).strict(),Nc=F({jsonrpc:B(`2.0`),id:Ac,result:W}).strict(),Pc=F({jsonrpc:B(`2.0`),id:Ac.optional(),error:F({code:j().int(),message:k(),data:N().optional()})}).strict(),Fc=L([jc,Mc,Nc,Pc]),Ic=L([Nc,Pc]),Lc=W.strict(),Rc=Dc.extend({requestId:Ac.optional(),reason:k().optional()}),zc=Oc.extend({method:B(`notifications/cancelled`),params:Rc}),Bc=F({src:k(),mimeType:k().optional(),sizes:P(k()).optional(),theme:z([`light`,`dark`]).optional()}),Vc=F({icons:P(Bc).optional()}),Hc=F({name:k(),title:k().optional()}),Uc=Hc.extend({...Hc.shape,...Vc.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),Wc=Os(F({applyDefaults:M().optional()}),H),Gc=rc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Os(F({form:Wc.optional(),url:H.optional()}),H.optional())),Kc=I({list:H.optional(),cancel:H.optional(),requests:I({sampling:I({createMessage:H.optional()}).optional(),elicitation:I({create:H.optional()}).optional()}).optional()}),qc=I({list:H.optional(),cancel:H.optional(),requests:I({tools:I({call:H.optional()}).optional()}).optional()}),Jc=F({experimental:R(k(),H).optional(),sampling:F({context:H.optional(),tools:H.optional()}).optional(),elicitation:Gc.optional(),roots:F({listChanged:M().optional()}).optional(),tasks:Kc.optional(),extensions:R(k(),H).optional()}),Yc=Tc.extend({protocolVersion:k(),capabilities:Jc,clientInfo:Uc}),Xc=U.extend({method:B(`initialize`),params:Yc}),Zc=F({experimental:R(k(),H).optional(),logging:H.optional(),completions:H.optional(),prompts:F({listChanged:M().optional()}).optional(),resources:F({subscribe:M().optional(),listChanged:M().optional()}).optional(),tools:F({listChanged:M().optional()}).optional(),tasks:qc.optional(),extensions:R(k(),H).optional()}),Qc=W.extend({protocolVersion:k(),capabilities:Zc,serverInfo:Uc,instructions:k().optional()}),$c=Oc.extend({method:B(`notifications/initialized`),params:Dc.optional()}),el=U.extend({method:B(`server/discover`),params:Tc.optional()}),tl=W.extend({supportedVersions:P(k()),capabilities:Zc,instructions:k().optional()}),nl=U.extend({method:B(`ping`),params:Tc.optional()}),rl=F({progress:j(),total:V(j()),message:V(k())}),il=F({...Dc.shape,...rl.shape,progressToken:bc}),al=Oc.extend({method:B(`notifications/progress`),params:il}),ol=Tc.extend({cursor:xc.optional()}),sl=U.extend({params:ol.optional()}),cl=W.extend({nextCursor:xc.optional()}),ll=F({uri:k(),mimeType:V(k()),_meta:R(k(),N()).optional()}),ul=ll.extend({text:k()}),dl=k().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),fl=ll.extend({blob:dl}),pl=z([`user`,`assistant`]),ml=F({audience:P(pl).optional(),priority:j().min(0).max(1).optional(),lastModified:oc({offset:!0}).optional()}),hl=F({...Hc.shape,...Vc.shape,uri:k(),description:V(k()),mimeType:V(k()),size:V(j()),annotations:ml.optional(),_meta:V(I({}))}),gl=F({...Hc.shape,...Vc.shape,uriTemplate:k(),description:V(k()),mimeType:V(k()),annotations:ml.optional(),_meta:V(I({}))}),_l=sl.extend({method:B(`resources/list`)}),vl=cl.extend({resources:P(hl)}),yl=sl.extend({method:B(`resources/templates/list`)}),bl=cl.extend({resourceTemplates:P(gl)}),xl=Tc.extend({uri:k()}),Sl=xl,Cl=U.extend({method:B(`resources/read`),params:Sl}),wl=W.extend({contents:P(L([ul,fl]))}),Tl=Oc.extend({method:B(`notifications/resources/list_changed`),params:Dc.optional()}),El=xl,Dl=U.extend({method:B(`resources/subscribe`),params:El}),Ol=xl,kl=U.extend({method:B(`resources/unsubscribe`),params:Ol}),Al=F({toolsListChanged:M().optional(),promptsListChanged:M().optional(),resourcesListChanged:M().optional(),resourceSubscriptions:P(k()).optional()}),jl=Tc.extend({notifications:Al}),Ml=U.extend({method:B(`subscriptions/listen`),params:jl}),Nl=Dc.extend({notifications:Al}),Pl=Oc.extend({method:B(`notifications/subscriptions/acknowledged`),params:Nl}),Fl=kc.extend({[gc]:Ac}),Il=W.extend({_meta:Fl}),Ll=Dc.extend({uri:k()}),Rl=Oc.extend({method:B(`notifications/resources/updated`),params:Ll}),zl=F({name:k(),description:V(k()),required:V(M())}),Bl=F({...Hc.shape,...Vc.shape,description:V(k()),arguments:V(P(zl)),_meta:V(I({}))}),Vl=sl.extend({method:B(`prompts/list`)}),Hl=cl.extend({prompts:P(Bl)}),Ul=Tc.extend({name:k(),arguments:R(k(),k()).optional()}),Wl=U.extend({method:B(`prompts/get`),params:Ul}),Gl=F({type:B(`text`),text:k(),annotations:ml.optional(),_meta:R(k(),N()).optional()}),Kl=F({type:B(`image`),data:dl,mimeType:k(),annotations:ml.optional(),_meta:R(k(),N()).optional()}),ql=F({type:B(`audio`),data:dl,mimeType:k(),annotations:ml.optional(),_meta:R(k(),N()).optional()}),Jl=F({type:B(`tool_use`),name:k(),id:k(),input:R(k(),N()),_meta:R(k(),N()).optional()}),Yl=F({type:B(`resource`),resource:L([ul,fl]),annotations:ml.optional(),_meta:R(k(),N()).optional()}),Xl=hl.extend({type:B(`resource_link`)}),Zl=L([Gl,Kl,ql,Xl,Yl]),Ql=F({role:pl,content:Zl}),$l=W.extend({description:k().optional(),messages:P(Ql)}),eu=Oc.extend({method:B(`notifications/prompts/list_changed`),params:Dc.optional()}),tu=F({title:k().optional(),readOnlyHint:M().optional(),destructiveHint:M().optional(),idempotentHint:M().optional(),openWorldHint:M().optional()}),nu=F({taskSupport:z([`required`,`optional`,`forbidden`]).optional()}),ru=F({...Hc.shape,...Vc.shape,description:k().optional(),inputSchema:F({type:B(`object`),properties:R(k(),vc).optional(),required:P(k()).optional()}).catchall(N()),outputSchema:I({$schema:k().optional()}).optional(),annotations:tu.optional(),execution:nu.optional(),_meta:R(k(),N()).optional()}),iu=sl.extend({method:B(`tools/list`)}),au=cl.extend({tools:P(ru)}),ou=W.extend({content:P(Zl).default([]),structuredContent:N().optional(),isError:M().optional()}),su=ou.or(W.extend({toolResult:N()})),cu=Ec.extend({name:k(),arguments:R(k(),N()).optional()}),lu=U.extend({method:B(`tools/call`),params:cu}),uu=Oc.extend({method:B(`notifications/tools/list_changed`),params:Dc.optional()}),du=F({autoRefresh:M().default(!0),debounceMs:j().int().nonnegative().default(300)}),fu=z([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),pu=Tc.extend({level:fu}),mu=U.extend({method:B(`logging/setLevel`),params:pu}),hu=Dc.extend({level:fu,logger:k().optional(),data:N()}),gu=Oc.extend({method:B(`notifications/message`),params:hu}),_u=F({name:k().optional()}),vu=F({hints:P(_u).optional(),costPriority:j().min(0).max(1).optional(),speedPriority:j().min(0).max(1).optional(),intelligencePriority:j().min(0).max(1).optional()}),yu=F({mode:z([`auto`,`required`,`none`]).optional()}),bu=F({type:B(`tool_result`),toolUseId:k().describe(`The unique identifier for the corresponding tool call.`),content:P(Zl),structuredContent:N().optional(),isError:M().optional(),_meta:R(k(),N()).optional()}),xu=Es(`type`,[Gl,Kl,ql]),Su=Es(`type`,[Gl,Kl,ql,Jl,bu]),Cu=F({role:pl,content:L([Su,P(Su)]),_meta:R(k(),N()).optional()}),wu=Ec.extend({messages:P(Cu),modelPreferences:vu.optional(),systemPrompt:k().optional(),includeContext:z([`none`,`thisServer`,`allServers`]).optional(),temperature:j().optional(),maxTokens:j().int(),stopSequences:P(k()).optional(),metadata:H.optional(),tools:P(ru).optional(),toolChoice:yu.optional()}),Tu=U.extend({method:B(`sampling/createMessage`),params:wu}),Eu=W.extend({model:k(),stopReason:V(z([`endTurn`,`stopSequence`,`maxTokens`]).or(k())),role:pl,content:xu}),Du=W.extend({model:k(),stopReason:V(z([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(k())),role:pl,content:L([Su,P(Su)])}),Ou=F({type:B(`boolean`),title:k().optional(),description:k().optional(),default:M().optional()}),ku=F({type:B(`string`),title:k().optional(),description:k().optional(),minLength:j().optional(),maxLength:j().optional(),format:z([`email`,`uri`,`date`,`date-time`]).optional(),default:k().optional()}),Au=F({type:z([`number`,`integer`]),title:k().optional(),description:k().optional(),minimum:j().optional(),maximum:j().optional(),default:j().optional()}),ju=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),default:k().optional()}),Mu=F({type:B(`string`),title:k().optional(),description:k().optional(),oneOf:P(F({const:k(),title:k()})),default:k().optional()}),Nu=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),enumNames:P(k()).optional(),default:k().optional()}),Pu=L([ju,Mu]),Fu=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({type:B(`string`),enum:P(k())}),default:P(k()).optional()}),Iu=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({anyOf:P(F({const:k(),title:k()}))}),default:P(k()).optional()}),Lu=L([Fu,Iu]),Ru=L([Nu,Pu,Lu]),zu=L([Ru,Ou,ku,Au]),Bu=Ec.extend({mode:B(`form`).optional(),message:k(),requestedSchema:F({type:B(`object`),properties:R(k(),zu),required:P(k()).optional()}).catchall(N())}),Vu=Ec.extend({mode:B(`url`),message:k(),elicitationId:k(),url:k().url()}),Hu=L([Bu,Vu]),Uu=U.extend({method:B(`elicitation/create`),params:Hu}),Wu=Dc.extend({elicitationId:k()}),Gu=Oc.extend({method:B(`notifications/elicitation/complete`),params:Wu}),Ku=W.extend({action:z([`accept`,`decline`,`cancel`]),content:rc(e=>e===null?void 0:e,R(k(),L([k(),j(),M(),P(k())])).optional())}),qu=F({type:B(`ref/resource`),uri:k()}),Ju=F({type:B(`ref/prompt`),name:k()}),Yu=Tc.extend({ref:L([Ju,qu]),argument:F({name:k(),value:k()}),context:F({arguments:R(k(),k()).optional()}).optional()}),Xu=U.extend({method:B(`completion/complete`),params:Yu}),Zu=W.extend({completion:I({values:P(k()).max(100),total:V(j().int()),hasMore:V(M())})}),Qu=F({uri:k().startsWith(`file://`),name:k().optional(),_meta:R(k(),N()).optional()}),$u=U.extend({method:B(`roots/list`),params:Tc.optional()}),ed=W.extend({roots:P(Qu)}),td=Oc.extend({method:B(`notifications/roots/list_changed`),params:Dc.optional()}),nd=I({ttl:j().optional(),pollInterval:j().optional()}),rd=z([`working`,`input_required`,`completed`,`failed`,`cancelled`]),id=F({taskId:k(),status:rd,ttl:L([j(),gs()]),createdAt:k(),lastUpdatedAt:k(),pollInterval:V(j()),statusMessage:V(k())}),ad=W.extend({task:id}),od=Dc.merge(id),sd=Oc.extend({method:B(`notifications/tasks/status`),params:od}),cd=U.extend({method:B(`tasks/get`),params:Tc.extend({taskId:k()})}),ld=W.merge(id),ud=U.extend({method:B(`tasks/result`),params:Tc.extend({taskId:k()})}),dd=W.loose(),fd=sl.extend({method:B(`tasks/list`)}),pd=cl.extend({tasks:P(id)}),md=U.extend({method:B(`tasks/cancel`),params:Tc.extend({taskId:k()})}),hd=W.merge(id),gd=L([nl,Xc,el,Xu,mu,Wl,Vl,_l,yl,Cl,Dl,kl,Ml,lu,iu]),_d=L([zc,al,$c,td]),vd=L([Lc,Eu,Du,Ku,ed]),yd=L([nl,Tu,Uu,$u]),bd=L([zc,al,gu,Rl,Tl,uu,eu,Pl,Gu]),xd=L([Lc,Qc,tl,Zu,$l,Hl,vl,bl,wl,ou,au,Il]),Sd=qo().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:ic.custom,message:`URL must be parseable`,fatal:!0}),je}).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`}),Cd=I({resource:k().url(),authorization_servers:P(Sd).optional(),jwks_uri:k().url().optional(),scopes_supported:P(k()).optional(),bearer_methods_supported:P(k()).optional(),resource_signing_alg_values_supported:P(k()).optional(),resource_name:k().optional(),resource_documentation:k().optional(),resource_policy_uri:k().url().optional(),resource_tos_uri:k().url().optional(),tls_client_certificate_bound_access_tokens:M().optional(),authorization_details_types_supported:P(k()).optional(),dpop_signing_alg_values_supported:P(k()).optional(),dpop_bound_access_tokens_required:M().optional()}),wd=I({issuer:k(),authorization_endpoint:Sd,token_endpoint:Sd,registration_endpoint:Sd.optional(),scopes_supported:P(k()).optional(),response_types_supported:P(k()),response_modes_supported:P(k()).optional(),grant_types_supported:P(k()).optional(),token_endpoint_auth_methods_supported:P(k()).optional(),token_endpoint_auth_signing_alg_values_supported:P(k()).optional(),service_documentation:Sd.optional(),revocation_endpoint:Sd.optional(),revocation_endpoint_auth_methods_supported:P(k()).optional(),revocation_endpoint_auth_signing_alg_values_supported:P(k()).optional(),introspection_endpoint:k().optional(),introspection_endpoint_auth_methods_supported:P(k()).optional(),introspection_endpoint_auth_signing_alg_values_supported:P(k()).optional(),code_challenge_methods_supported:P(k()).optional(),client_id_metadata_document_supported:M().optional(),authorization_response_iss_parameter_supported:M().optional().catch(void 0)}),Td=I({issuer:k(),authorization_endpoint:Sd,token_endpoint:Sd,userinfo_endpoint:Sd.optional(),jwks_uri:Sd,registration_endpoint:Sd.optional(),scopes_supported:P(k()).optional(),response_types_supported:P(k()),response_modes_supported:P(k()).optional(),grant_types_supported:P(k()).optional(),acr_values_supported:P(k()).optional(),subject_types_supported:P(k()),id_token_signing_alg_values_supported:P(k()),id_token_encryption_alg_values_supported:P(k()).optional(),id_token_encryption_enc_values_supported:P(k()).optional(),userinfo_signing_alg_values_supported:P(k()).optional(),userinfo_encryption_alg_values_supported:P(k()).optional(),userinfo_encryption_enc_values_supported:P(k()).optional(),request_object_signing_alg_values_supported:P(k()).optional(),request_object_encryption_alg_values_supported:P(k()).optional(),request_object_encryption_enc_values_supported:P(k()).optional(),token_endpoint_auth_methods_supported:P(k()).optional(),token_endpoint_auth_signing_alg_values_supported:P(k()).optional(),display_values_supported:P(k()).optional(),claim_types_supported:P(k()).optional(),claims_supported:P(k()).optional(),service_documentation:k().optional(),claims_locales_supported:P(k()).optional(),ui_locales_supported:P(k()).optional(),claims_parameter_supported:M().optional(),request_parameter_supported:M().optional(),request_uri_parameter_supported:M().optional(),require_request_uri_registration:M().optional(),op_policy_uri:Sd.optional(),op_tos_uri:Sd.optional(),client_id_metadata_document_supported:M().optional(),authorization_response_iss_parameter_supported:M().optional().catch(void 0)}),Ed=F({...Td.shape,...wd.pick({code_challenge_methods_supported:!0}).shape}),Dd=F({access_token:k(),id_token:k().optional(),token_type:k(),expires_in:cc().optional(),scope:k().optional(),refresh_token:k().optional()}).strip(),Od=F({issued_token_type:B(`urn:ietf:params:oauth:token-type:id-jag`),access_token:k(),token_type:k().optional(),expires_in:j().optional(),scope:k().optional()}).strip(),kd=F({error:k(),error_description:k().optional(),error_uri:k().optional()}),Ad=Sd.optional().or(B(``).transform(()=>void 0)),jd=F({redirect_uris:P(Sd),token_endpoint_auth_method:k().optional(),grant_types:P(k()).optional(),response_types:P(k()).optional(),application_type:k().optional(),client_name:k().optional(),client_uri:Sd.optional(),logo_uri:Ad,scope:k().optional(),contacts:P(k()).optional(),tos_uri:Ad,policy_uri:k().optional(),jwks_uri:Sd.optional(),jwks:vs().optional(),software_id:k().optional(),software_version:k().optional(),software_statement:k().optional()}).strip(),Md=F({client_id:k(),client_secret:k().optional(),client_id_issued_at:j().optional(),client_secret_expires_at:j().optional()}).strip(),Nd=jd.merge(Md),Pd=F({error:k(),error_description:k().optional()}).strip(),Fd=F({token:k(),token_type_hint:k().optional()}).strip();var Id=Object.create,Ld=Object.defineProperty,Rd=Object.getOwnPropertyDescriptor,zd=Object.getOwnPropertyNames,Bd=Object.getPrototypeOf,Vd=Object.prototype.hasOwnProperty,G=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Hd=(e,t)=>{let n={};for(var r in e)Ld(n,r,{get:e[r],enumerable:!0});return t&&Ld(n,Symbol.toStringTag,{value:`Module`}),n},Ud=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=zd(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Vd.call(e,s)&&s!==n&&Ld(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Rd(t,s))||r.enumerable});return e},Wd=(e,t,n)=>(n=e==null?{}:Id(Bd(e)),Ud(t||!e||!e.__esModule?Ld(n,`default`,{value:e,enumerable:!0}):n,e));const Gd=new Set([`https://json-schema.org/draft/2020-12/schema`,`http://json-schema.org/draft/2020-12/schema`]),Kd=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]),qd=new Set([`https://json-schema.org/draft-07/schema`,`http://json-schema.org/draft-07/schema`]),Jd=new Set([`https://json-schema.org/draft-06/schema`,`http://json-schema.org/draft-06/schema`]);function Yd(e){return typeof e==`string`&&Kd.has(e.replace(/#$/,``))}function Xd(e,t){if(!(`$schema`in e)||typeof e.$schema!=`string`)return`2020-12`;let n=e.$schema.replace(/#$/,``);if(Gd.has(n))return`2020-12`;if(Kd.has(n))return`2019-09`;if(qd.has(n)||Jd.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}`)}const Zd=Symbol.for(`mcp.sdk.errorBrands`);function Qd(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,Zd,{value:n,enumerable:!1,configurable:!0})}function $d(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,Zd)){let n=t[Zd];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}let ef=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 tf=class e extends Error{static{Object.defineProperty(this,`mcpBrand`,{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return $d(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 $d(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,Qd(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 K=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 q=class extends Error{static{Object.defineProperty(this,`mcpBrand`,{value:`mcp.SdkError`})}static[Symbol.hasInstance](e){return $d(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 $d(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`SdkError`,Qd(this,new.target)}},nf=class extends q{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 rf(e){let t=typeof e==`string`?new URL(e):new URL(e.href);return t.hash=``,t}function af({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 sf=`2026-07-28`,cf=[sf];function lf(e){return e>=sf}function uf(e){return e.filter(e=>!lf(e))}function df(e){return e.filter(e=>lf(e))}function ff(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 pf=[`task`,`inputRequests`,`requestState`];function mf(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||pf.some(t=>t in e)?e:{...e,content:[]}}function hf(){let e=$s(()=>L([k(),j(),M(),gs(),R(k(),e),P(e)])),t=R(k(),e),n=L([k(),j().int()]),r=k(),i=F({ttl:j().optional()}),a=F({taskId:k()}),o=I({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=F({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=F({method:k(),params:s.loose().optional()}),u=F({_meta:o.optional()}),d=F({method:k(),params:u.loose().optional()}),f=I({_meta:o.optional()}),p=L([k(),j().int()]),m=f.strict(),h=u.extend({requestId:p.optional(),reason:k().optional()}),g=d.extend({method:B(`notifications/cancelled`),params:h}),_=F({src:k(),mimeType:k().optional(),sizes:P(k()).optional(),theme:z([`light`,`dark`]).optional()}),v=F({icons:P(_).optional()}),y=F({name:k(),title:k().optional()}),b=y.extend({...y.shape,...v.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),x=Os(F({applyDefaults:M().optional()}),t),ee=rc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Os(F({form:x.optional(),url:t.optional()}),t.optional())),te=I({list:t.optional(),cancel:t.optional(),requests:I({sampling:I({createMessage:t.optional()}).optional(),elicitation:I({create:t.optional()}).optional()}).optional()}),ne=I({list:t.optional(),cancel:t.optional(),requests:I({tools:I({call:t.optional()}).optional()}).optional()}),re=F({experimental:R(k(),t).optional(),sampling:F({context:t.optional(),tools:t.optional()}).optional(),elicitation:ee.optional(),roots:F({listChanged:M().optional()}).optional(),tasks:te.optional(),extensions:R(k(),t).optional()}),ie=s.extend({protocolVersion:k(),capabilities:re,clientInfo:b}),ae=l.extend({method:B(`initialize`),params:ie}),oe=F({experimental:R(k(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:F({listChanged:M().optional()}).optional(),resources:F({subscribe:M().optional(),listChanged:M().optional()}).optional(),tools:F({listChanged:M().optional()}).optional(),tasks:ne.optional(),extensions:R(k(),t).optional()}),se=f.extend({protocolVersion:k(),capabilities:oe,serverInfo:b,instructions:k().optional()}),ce=d.extend({method:B(`notifications/initialized`),params:u.optional()}),le=l.extend({method:B(`ping`),params:s.optional()}),ue=F({progress:j(),total:V(j()),message:V(k())}),de=F({...u.shape,...ue.shape,progressToken:n}),fe=d.extend({method:B(`notifications/progress`),params:de}),pe=s.extend({cursor:r.optional()}),me=l.extend({params:pe.optional()}),S=f.extend({nextCursor:r.optional()}),he=F({uri:k(),mimeType:V(k()),_meta:R(k(),N()).optional()}),ge=he.extend({text:k()}),_e=k().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),ve=he.extend({blob:_e}),ye=z([`user`,`assistant`]),be=F({audience:P(ye).optional(),priority:j().min(0).max(1).optional(),lastModified:oc({offset:!0}).optional()}),xe=F({...y.shape,...v.shape,uri:k(),description:V(k()),mimeType:V(k()),size:V(j()),annotations:be.optional(),_meta:V(I({}))}),Se=F({...y.shape,...v.shape,uriTemplate:k(),description:V(k()),mimeType:V(k()),annotations:be.optional(),_meta:V(I({}))}),Ce=me.extend({method:B(`resources/list`)}),we=S.extend({resources:P(xe)}),Te=me.extend({method:B(`resources/templates/list`)}),Ee=S.extend({resourceTemplates:P(Se)}),De=s.extend({uri:k()}),C=De,Oe=l.extend({method:B(`resources/read`),params:C}),ke=f.extend({contents:P(L([ge,ve]))}),Ae=d.extend({method:B(`notifications/resources/list_changed`),params:u.optional()}),je=De,Me=l.extend({method:B(`resources/subscribe`),params:je}),Ne=De,Pe=l.extend({method:B(`resources/unsubscribe`),params:Ne}),w=u.extend({uri:k()}),Fe=d.extend({method:B(`notifications/resources/updated`),params:w}),Ie=F({name:k(),description:V(k()),required:V(M())}),Le=F({...y.shape,...v.shape,description:V(k()),arguments:V(P(Ie)),_meta:V(I({}))}),Re=me.extend({method:B(`prompts/list`)}),ze=S.extend({prompts:P(Le)}),Be=s.extend({name:k(),arguments:R(k(),k()).optional()}),Ve=l.extend({method:B(`prompts/get`),params:Be}),He=F({type:B(`text`),text:k(),annotations:be.optional(),_meta:R(k(),N()).optional()}),Ue=F({type:B(`image`),data:_e,mimeType:k(),annotations:be.optional(),_meta:R(k(),N()).optional()}),We=F({type:B(`audio`),data:_e,mimeType:k(),annotations:be.optional(),_meta:R(k(),N()).optional()}),Ge=F({type:B(`tool_use`),name:k(),id:k(),input:R(k(),N()),_meta:R(k(),N()).optional()}),Ke=F({type:B(`resource`),resource:L([ge,ve]),annotations:be.optional(),_meta:R(k(),N()).optional()}),qe=xe.extend({type:B(`resource_link`)}),Je=L([He,Ue,We,qe,Ke]),Ye=F({role:ye,content:Je}),Xe=f.extend({description:k().optional(),messages:P(Ye)}),Ze=d.extend({method:B(`notifications/prompts/list_changed`),params:u.optional()}),Qe=F({title:k().optional(),readOnlyHint:M().optional(),destructiveHint:M().optional(),idempotentHint:M().optional(),openWorldHint:M().optional()}),$e=F({taskSupport:z([`required`,`optional`,`forbidden`]).optional()}),et=F({...y.shape,...v.shape,description:k().optional(),inputSchema:F({type:B(`object`),properties:R(k(),e).optional(),required:P(k()).optional()}).catchall(N()),outputSchema:F({type:B(`object`),properties:R(k(),e).optional(),required:P(k()).optional()}).catchall(N()).optional(),annotations:Qe.optional(),execution:$e.optional(),_meta:R(k(),N()).optional()}),tt=me.extend({method:B(`tools/list`)}),nt=S.extend({tools:P(et)}),rt=f.extend({content:P(Je),structuredContent:R(k(),N()).optional(),isError:M().optional()}),it=c.extend({name:k(),arguments:R(k(),N()).optional()}),at=l.extend({method:B(`tools/call`),params:it}),ot=d.extend({method:B(`notifications/tools/list_changed`),params:u.optional()}),st=z([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),ct=s.extend({level:st}),lt=l.extend({method:B(`logging/setLevel`),params:ct}),ut=u.extend({level:st,logger:k().optional(),data:N()}),dt=d.extend({method:B(`notifications/message`),params:ut}),ft=F({name:k().optional()}),pt=F({hints:P(ft).optional(),costPriority:j().min(0).max(1).optional(),speedPriority:j().min(0).max(1).optional(),intelligencePriority:j().min(0).max(1).optional()}),mt=F({mode:z([`auto`,`required`,`none`]).optional()}),ht=F({type:B(`tool_result`),toolUseId:k().describe(`The unique identifier for the corresponding tool call.`),content:P(Je),structuredContent:F({}).loose().optional(),isError:M().optional(),_meta:R(k(),N()).optional()}),gt=Es(`type`,[He,Ue,We]),_t=Es(`type`,[He,Ue,We,Ge,ht]),vt=F({role:ye,content:L([_t,P(_t)]),_meta:R(k(),N()).optional()}),yt=c.extend({messages:P(vt),modelPreferences:pt.optional(),systemPrompt:k().optional(),includeContext:z([`none`,`thisServer`,`allServers`]).optional(),temperature:j().optional(),maxTokens:j().int(),stopSequences:P(k()).optional(),metadata:t.optional(),tools:P(et).optional(),toolChoice:mt.optional()}),bt=l.extend({method:B(`sampling/createMessage`),params:yt}),xt=f.extend({model:k(),stopReason:V(z([`endTurn`,`stopSequence`,`maxTokens`]).or(k())),role:ye,content:gt}),St=f.extend({model:k(),stopReason:V(z([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(k())),role:ye,content:L([_t,P(_t)])}),Ct=F({type:B(`boolean`),title:k().optional(),description:k().optional(),default:M().optional()}),wt=F({type:B(`string`),title:k().optional(),description:k().optional(),minLength:j().optional(),maxLength:j().optional(),format:z([`email`,`uri`,`date`,`date-time`]).optional(),default:k().optional()}),Tt=F({type:z([`number`,`integer`]),title:k().optional(),description:k().optional(),minimum:j().optional(),maximum:j().optional(),default:j().optional()}),Et=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),default:k().optional()}),Dt=F({type:B(`string`),title:k().optional(),description:k().optional(),oneOf:P(F({const:k(),title:k()})),default:k().optional()}),Ot=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),enumNames:P(k()).optional(),default:k().optional()}),kt=L([Et,Dt]),At=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({type:B(`string`),enum:P(k())}),default:P(k()).optional()}),jt=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({anyOf:P(F({const:k(),title:k()}))}),default:P(k()).optional()}),Mt=L([At,jt]),Nt=L([Ot,kt,Mt]),Pt=L([Nt,Ct,wt,Tt]),Ft=c.extend({mode:B(`form`).optional(),message:k(),requestedSchema:F({type:B(`object`),properties:R(k(),Pt),required:P(k()).optional()}).catchall(N())}),It=c.extend({mode:B(`url`),message:k(),elicitationId:k(),url:k().url()}),Lt=L([Ft,It]),Rt=l.extend({method:B(`elicitation/create`),params:Lt}),zt=u.extend({elicitationId:k()}),Bt=d.extend({method:B(`notifications/elicitation/complete`),params:zt}),Vt=f.extend({action:z([`accept`,`decline`,`cancel`]),content:rc(e=>e===null?void 0:e,R(k(),L([k(),j(),M(),P(k())])).optional())}),Ht=F({type:B(`ref/resource`),uri:k()}),Ut=F({type:B(`ref/prompt`),name:k()}),Wt=s.extend({ref:L([Ut,Ht]),argument:F({name:k(),value:k()}),context:F({arguments:R(k(),k()).optional()}).optional()}),Gt=l.extend({method:B(`completion/complete`),params:Wt}),Kt=f.extend({completion:I({values:P(k()).max(100),total:V(j().int()),hasMore:V(M())})}),qt=F({uri:k().startsWith(`file://`),name:k().optional(),_meta:R(k(),N()).optional()}),Jt=l.extend({method:B(`roots/list`),params:s.optional()}),Yt=f.extend({roots:P(qt)}),Xt=d.extend({method:B(`notifications/roots/list_changed`),params:u.optional()}),Zt=I({ttl:j().optional(),pollInterval:j().optional()}),Qt=z([`working`,`input_required`,`completed`,`failed`,`cancelled`]),$t=F({taskId:k(),status:Qt,ttl:L([j(),gs()]),createdAt:k(),lastUpdatedAt:k(),pollInterval:V(j()),statusMessage:V(k())}),en=f.extend({task:$t}),tn=u.merge($t),nn=d.extend({method:B(`notifications/tasks/status`),params:tn}),rn=l.extend({method:B(`tasks/get`),params:s.extend({taskId:k()})}),an=f.merge($t),on=l.extend({method:B(`tasks/result`),params:s.extend({taskId:k()})}),sn=f.loose(),cn=me.extend({method:B(`tasks/list`)}),ln=S.extend({tasks:P($t)}),un=l.extend({method:B(`tasks/cancel`),params:s.extend({taskId:k()})});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:te,ServerTasksCapabilitySchema:ne,ClientCapabilitiesSchema:re,InitializeRequestParamsSchema:ie,InitializeRequestSchema:ae,ServerCapabilitiesSchema:oe,InitializeResultSchema:se,InitializedNotificationSchema:ce,PingRequestSchema:le,ProgressSchema:ue,ProgressNotificationParamsSchema:de,ProgressNotificationSchema:fe,PaginatedRequestParamsSchema:pe,PaginatedRequestSchema:me,PaginatedResultSchema:S,ResourceContentsSchema:he,TextResourceContentsSchema:ge,BlobResourceContentsSchema:ve,RoleSchema:ye,AnnotationsSchema:be,ResourceSchema:xe,ResourceTemplateSchema:Se,ListResourcesRequestSchema:Ce,ListResourcesResultSchema:we,ListResourceTemplatesRequestSchema:Te,ListResourceTemplatesResultSchema:Ee,ResourceRequestParamsSchema:De,ReadResourceRequestParamsSchema:C,ReadResourceRequestSchema:Oe,ReadResourceResultSchema:ke,ResourceListChangedNotificationSchema:Ae,SubscribeRequestParamsSchema:je,SubscribeRequestSchema:Me,UnsubscribeRequestParamsSchema:Ne,UnsubscribeRequestSchema:Pe,ResourceUpdatedNotificationParamsSchema:w,ResourceUpdatedNotificationSchema:Fe,PromptArgumentSchema:Ie,PromptSchema:Le,ListPromptsRequestSchema:Re,ListPromptsResultSchema:ze,GetPromptRequestParamsSchema:Be,GetPromptRequestSchema:Ve,TextContentSchema:He,ImageContentSchema:Ue,AudioContentSchema:We,ToolUseContentSchema:Ge,EmbeddedResourceSchema:Ke,ResourceLinkSchema:qe,ContentBlockSchema:Je,PromptMessageSchema:Ye,GetPromptResultSchema:Xe,PromptListChangedNotificationSchema:Ze,ToolAnnotationsSchema:Qe,ToolExecutionSchema:$e,ToolSchema:et,ListToolsRequestSchema:tt,ListToolsResultSchema:nt,CallToolResultSchema:rt,CallToolRequestParamsSchema:it,CallToolRequestSchema:at,ToolListChangedNotificationSchema:ot,LoggingLevelSchema:st,SetLevelRequestParamsSchema:ct,SetLevelRequestSchema:lt,LoggingMessageNotificationParamsSchema:ut,LoggingMessageNotificationSchema:dt,ModelHintSchema:ft,ModelPreferencesSchema:pt,ToolChoiceSchema:mt,ToolResultContentSchema:ht,SamplingContentSchema:gt,SamplingMessageContentBlockSchema:_t,SamplingMessageSchema:vt,CreateMessageRequestParamsSchema:yt,CreateMessageRequestSchema:bt,CreateMessageResultSchema:xt,CreateMessageResultWithToolsSchema:St,BooleanSchemaSchema:Ct,StringSchemaSchema:wt,NumberSchemaSchema:Tt,UntitledSingleSelectEnumSchemaSchema:Et,TitledSingleSelectEnumSchemaSchema:Dt,LegacyTitledEnumSchemaSchema:Ot,SingleSelectEnumSchemaSchema:kt,UntitledMultiSelectEnumSchemaSchema:At,TitledMultiSelectEnumSchemaSchema:jt,MultiSelectEnumSchemaSchema:Mt,EnumSchemaSchema:Nt,PrimitiveSchemaDefinitionSchema:Pt,ElicitRequestFormParamsSchema:Ft,ElicitRequestURLParamsSchema:It,ElicitRequestParamsSchema:Lt,ElicitRequestSchema:Rt,ElicitationCompleteNotificationParamsSchema:zt,ElicitationCompleteNotificationSchema:Bt,ElicitResultSchema:Vt,ResourceTemplateReferenceSchema:Ht,PromptReferenceSchema:Ut,CompleteRequestParamsSchema:Wt,CompleteRequestSchema:Gt,CompleteResultSchema:Kt,RootSchema:qt,ListRootsRequestSchema:Jt,ListRootsResultSchema:Yt,RootsListChangedNotificationSchema:Xt,TaskCreationParamsSchema:Zt,TaskStatusSchema:Qt,TaskSchema:$t,CreateTaskResultSchema:en,TaskStatusNotificationParamsSchema:tn,TaskStatusNotificationSchema:nn,GetTaskRequestSchema:rn,GetTaskResultSchema:an,GetTaskPayloadRequestSchema:on,GetTaskPayloadResultSchema:sn,ListTasksRequestSchema:cn,ListTasksResultSchema:ln,CancelTaskRequestSchema:un,CancelTaskResultSchema:f.merge($t),ClientRequestSchema:L([le,ae,Gt,lt,Ve,Re,Ce,Te,Oe,Me,Pe,at,tt,rn,on,cn,un]),ClientNotificationSchema:L([g,fe,ce,Xt,nn]),ClientResultSchema:L([m,xt,St,Vt,Yt,an,ln,en]),ServerRequestSchema:L([le,bt,Rt,Jt,rn,on,cn,un]),ServerNotificationSchema:L([g,fe,dt,Fe,Ae,ot,Ze,nn,Bt]),ServerResultSchema:L([m,se,Kt,Xe,ze,we,Ee,ke,rt,nt,an,ln,en]),CallToolResultWireSchema:N().superRefine((e,t)=>{if(!(typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0)){for(let n of pf)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(mf).pipe(rt)}}let gf;function _f(){return gf??=hf()}function vf(e){return e.type!==`object`}const yf=new Set([`const`,`enum`,`default`,`examples`]),bf=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function xf(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function Sf(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(xf(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=Yd(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&&xf(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:yf.has(o)?i[o]=s:bf.has(o)?i[o]=r(s,!0):i[o]=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 Cf={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},wf={"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},Tf={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 Ef;function Df(){if(Ef)return Ef;let e=_f();return Ef={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}},Ef}function Of(e){return Object.prototype.hasOwnProperty.call(Cf,e)}function kf(e){return Object.prototype.hasOwnProperty.call(wf,e)}function Af(e){return Object.prototype.hasOwnProperty.call(Tf,e)}function jf(e){return Af(e)?Df().resultSchemas[e]:void 0}function Mf(e){return Of(e)?Df().requestSchemas[e]:void 0}function Nf(e){return kf(e)?Df().notificationSchemas[e]:void 0}function Pf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ff(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 If={ok:!1,reason:`not-in-era`};function Lf(e){return Pf(e)&&Pf(e.outputSchema)&&vf(e.outputSchema)}function Rf(e){return e}const zf={era:`2025-11-25`,hasRequestMethod:Of,hasNotificationMethod:kf,validateRequest:(e,t)=>Ff(Mf(e),t),validateResult:(e,t)=>Ff(jf(e),t),validateNotification:(e,t)=>Ff(Nf(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>If,validateInputResponse:()=>If,samplingResultVariant:((e,t)=>{let n=_f();return Ff(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=ff(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&vf(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(Pf(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:Rf(e)}}return{kind:`complete`,result:Rf(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>Lf(e))?t:{...t,tools:n.map(e=>Lf(e)?{...e,outputSchema:Sf(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function Bf(){let e=$s(()=>L([k(),j(),M(),gs(),R(k(),e),P(e)])),t=R(k(),e),n=L([k(),j().int()]),r=k(),i=L([k(),j().int()]),a=z([`user`,`assistant`]),o=z([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=k().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=F({ttl:j().optional()}),l=F({taskId:k()}),u=I({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),d=F({_meta:u.optional()}),f=d.extend({task:c.optional()}),p=F({_meta:u.optional()}),m=F({method:k(),params:p.loose().optional()}),h=F({src:k(),mimeType:k().optional(),sizes:P(k()).optional(),theme:z([`light`,`dark`]).optional()}),g=F({icons:P(h).optional()}),_=F({name:k(),title:k().optional()}),v=_.extend({..._.shape,...g.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),y=Os(F({applyDefaults:M().optional()}),t),b=rc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Os(F({form:y.optional(),url:t.optional()}),t.optional())),x=I({list:t.optional(),cancel:t.optional(),requests:I({sampling:I({createMessage:t.optional()}).optional(),elicitation:I({create:t.optional()}).optional()}).optional()}),ee=I({list:t.optional(),cancel:t.optional(),requests:I({tools:I({call:t.optional()}).optional()}).optional()}),te=F({experimental:R(k(),t).optional(),sampling:F({context:t.optional(),tools:t.optional()}).optional(),elicitation:b.optional(),roots:F({listChanged:M().optional()}).optional(),tasks:x.optional(),extensions:R(k(),t).optional()}),ne=F({experimental:R(k(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:F({listChanged:M().optional()}).optional(),resources:F({subscribe:M().optional(),listChanged:M().optional()}).optional(),tools:F({listChanged:M().optional()}).optional(),tasks:ee.optional(),extensions:R(k(),t).optional()}),re=F({progress:j(),total:V(j()),message:V(k())}),ie=F({...p.shape,...re.shape,progressToken:n}),ae=m.extend({method:B(`notifications/progress`),params:ie}),oe=p.extend({level:o,logger:k().optional(),data:N()}),se=m.extend({method:B(`notifications/message`),params:oe}),ce=F({uri:k(),mimeType:V(k()),_meta:R(k(),N()).optional()}),le=ce.extend({text:k()}),ue=ce.extend({blob:s}),de=F({audience:P(a).optional(),priority:j().min(0).max(1).optional(),lastModified:oc({offset:!0}).optional()}),fe=F({..._.shape,...g.shape,uri:k(),description:V(k()),mimeType:V(k()),size:V(j()),annotations:de.optional(),_meta:V(I({}))}),pe=F({..._.shape,...g.shape,uriTemplate:k(),description:V(k()),mimeType:V(k()),annotations:de.optional(),_meta:V(I({}))}),me=m.extend({method:B(`notifications/resources/list_changed`),params:p.optional()}),S=p.extend({uri:k()}),he=m.extend({method:B(`notifications/resources/updated`),params:S}),ge=F({name:k(),description:V(k()),required:V(M())}),_e=F({..._.shape,...g.shape,description:V(k()),arguments:V(P(ge)),_meta:V(I({}))}),ve=m.extend({method:B(`notifications/prompts/list_changed`),params:p.optional()}),ye=F({type:B(`text`),text:k(),annotations:de.optional(),_meta:R(k(),N()).optional()}),be=F({type:B(`image`),data:s,mimeType:k(),annotations:de.optional(),_meta:R(k(),N()).optional()}),xe=F({type:B(`audio`),data:s,mimeType:k(),annotations:de.optional(),_meta:R(k(),N()).optional()}),Se=F({type:B(`tool_use`),name:k(),id:k(),input:R(k(),N()),_meta:R(k(),N()).optional()}),Ce=F({type:B(`resource`),resource:L([le,ue]),annotations:de.optional(),_meta:R(k(),N()).optional()}),we=fe.extend({type:B(`resource_link`)}),Te=L([ye,be,xe,we,Ce]),Ee=F({role:a,content:Te}),De=F({title:k().optional(),readOnlyHint:M().optional(),destructiveHint:M().optional(),idempotentHint:M().optional(),openWorldHint:M().optional()}),C=m.extend({method:B(`notifications/tools/list_changed`),params:p.optional()}),Oe=F({name:k().optional()}),ke=F({hints:P(Oe).optional(),costPriority:j().min(0).max(1).optional(),speedPriority:j().min(0).max(1).optional(),intelligencePriority:j().min(0).max(1).optional()}),Ae=F({mode:z([`auto`,`required`,`none`]).optional()}),je=F({type:B(`boolean`),title:k().optional(),description:k().optional(),default:M().optional()}),Me=F({type:B(`string`),title:k().optional(),description:k().optional(),minLength:j().optional(),maxLength:j().optional(),format:z([`email`,`uri`,`date`,`date-time`]).optional(),default:k().optional()}),Ne=F({type:z([`number`,`integer`]),title:k().optional(),description:k().optional(),minimum:j().optional(),maximum:j().optional(),default:j().optional()}),Pe=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),default:k().optional()}),w=F({type:B(`string`),title:k().optional(),description:k().optional(),oneOf:P(F({const:k(),title:k()})),default:k().optional()}),Fe=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),enumNames:P(k()).optional(),default:k().optional()}),Ie=L([Pe,w]),Le=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({type:B(`string`),enum:P(k())}),default:P(k()).optional()}),Re=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({anyOf:P(F({const:k(),title:k()}))}),default:P(k()).optional()}),ze=L([Le,Re]),Be=L([Fe,Ie,ze]),Ve=L([Be,je,Me,Ne]),He=f.extend({mode:B(`form`).optional(),message:k(),requestedSchema:F({type:B(`object`),properties:R(k(),Ve),required:P(k()).optional()}).catchall(N())}),Ue=F({type:B(`ref/resource`),uri:k()}),We=F({type:B(`ref/prompt`),name:k()}),Ge=F({uri:k().startsWith(`file://`),name:k().optional(),_meta:R(k(),N()).optional()}),Ke=te.shape,qe=F({experimental:Ke.experimental,sampling:Ke.sampling,elicitation:Ke.elicitation,roots:Ke.roots,extensions:Ke.extensions}),Je=ne.shape,Ye=F({experimental:Je.experimental,logging:Je.logging,completions:Je.completions,prompts:Je.prompts,resources:Je.resources,tools:Je.tools,extensions:Je.extensions}),Xe=I({progressToken:n.optional(),[fc]:k(),[pc]:v.optional(),[hc]:qe,[_c]:o.optional()}),Ze=F({..._.shape,...g.shape,description:k().optional(),inputSchema:I({$schema:k().optional(),type:B(`object`)}),outputSchema:I({$schema:k().optional()}).optional(),annotations:De.optional(),_meta:R(k(),N()).optional()}),Qe=F({type:B(`tool_result`),toolUseId:k(),content:P(Te),structuredContent:N().optional(),isError:M().optional(),_meta:R(k(),N()).optional()}),$e=L([ye,be,xe,Se,Qe]),et=F({role:a,content:L([$e,P($e)]),_meta:R(k(),N()).optional()}),tt=k(),nt=I({[mc]:v.optional().catch(void 0)}),rt=nt.optional();function it(e){return I({_meta:rt,resultType:tt.default(`complete`),...e})}let at=it({}),ot=it({nextCursor:r.optional()}),st=it({content:P(Te),structuredContent:N().optional(),isError:M().optional()}),ct=it({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),tools:P(Ze),nextCursor:r.optional()}),lt=it({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),prompts:P(_e),nextCursor:r.optional()}),ut=it({description:k().optional(),messages:P(Ee)}),dt=it({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),resources:P(fe),nextCursor:r.optional()}),ft=it({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),resourceTemplates:P(pe),nextCursor:r.optional()}),pt=it({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),contents:P(L([le,ue]))}),mt=it({completion:F({values:P(k()).max(100),total:j().int().optional(),hasMore:M().optional()}).loose()}),ht=it({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`])}),gt=it({ttlMs:j().int().min(0).catch(0),cacheScope:z([`public`,`private`]).catch(`private`),supportedVersions:P(k()),capabilities:Ye,instructions:k().optional()}),_t=F({messages:P(et),modelPreferences:ke.optional(),systemPrompt:k().optional(),includeContext:z([`none`,`thisServer`,`allServers`]).optional(),temperature:j().optional(),maxTokens:j().int(),stopSequences:P(k()).optional(),metadata:t.optional(),tools:P(Ze).optional(),toolChoice:Ae.optional()}),vt=F({method:B(`sampling/createMessage`),params:_t}),yt=F({method:B(`roots/list`),params:F({_meta:R(k(),N()).optional()}).optional()}),bt=F({...et.shape,model:k(),stopReason:k().optional()}),xt=F({roots:P(Ge)}),St=F({action:z([`accept`,`decline`,`cancel`]),content:R(k(),L([k(),j(),M(),P(k())])).optional()}),Ct=F({mode:B(`url`),message:k(),url:k().url()}),wt=L([He,Ct]),Tt=F({method:B(`elicitation/create`),params:wt}),Et=L([vt,yt,Tt]),Dt=L([bt,xt,St]),Ot=R(k(),Et),kt=R(k(),Dt),At=it({inputRequests:Ot.optional(),requestState:k().optional()}),jt={inputResponses:kt.optional(),requestState:k().optional()},Mt=F({_meta:Xe,...jt}),Nt=I({progressToken:n.optional()});function Pt(e,t){return F({method:B(e),params:F({_meta:Xe,...t})})}function Ft(e,t){return F({method:B(e),params:F({_meta:Nt.optional(),...t}).optional()})}let It={name:k(),arguments:R(k(),N()).optional(),...jt},Lt={cursor:r.optional()},Rt=Pt(`tools/call`,It),zt=Pt(`tools/list`,Lt),Bt=Pt(`prompts/list`,Lt),Vt=Pt(`prompts/get`,{name:k(),arguments:R(k(),k()).optional(),...jt}),Ht=Pt(`resources/list`,Lt),Ut=Pt(`resources/templates/list`,Lt),Wt=Pt(`resources/read`,{uri:k(),...jt}),Gt={ref:L([We,Ue]),argument:F({name:k(),value:k()}),context:F({arguments:R(k(),k()).optional()}).optional()},Kt=Pt(`completion/complete`,Gt),qt=Pt(`server/discover`,{}),Jt=F({toolsListChanged:M().optional(),promptsListChanged:M().optional(),resourcesListChanged:M().optional(),resourceSubscriptions:P(k()).optional()}),Yt={notifications:Jt},Xt=Pt(`subscriptions/listen`,Yt),Zt=nt.extend({"io.modelcontextprotocol/subscriptionId":i}),Qt=I({_meta:Zt,resultType:tt.default(`complete`)}),$t={"tools/call":Ft(`tools/call`,It),"tools/list":Ft(`tools/list`,Lt),"prompts/get":Ft(`prompts/get`,{name:k(),arguments:R(k(),k()).optional()}),"prompts/list":Ft(`prompts/list`,Lt),"resources/list":Ft(`resources/list`,Lt),"resources/templates/list":Ft(`resources/templates/list`,Lt),"resources/read":Ft(`resources/read`,{uri:k()}),"completion/complete":Ft(`completion/complete`,Gt),"server/discover":Ft(`server/discover`,{}),"subscriptions/listen":Ft(`subscriptions/listen`,Yt)};function en(e){return I({_meta:rt,...e})}let tn={"tools/call":en({content:P(Te),structuredContent:N().optional(),isError:M().optional()}),"tools/list":en({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),tools:P(Ze),nextCursor:r.optional()}),"prompts/get":en({description:k().optional(),messages:P(Ee)}),"prompts/list":en({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),prompts:P(_e),nextCursor:r.optional()}),"resources/list":en({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),resources:P(fe),nextCursor:r.optional()}),"resources/templates/list":en({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),resourceTemplates:P(pe),nextCursor:r.optional()}),"resources/read":en({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),contents:P(L([le,ue]))}),"completion/complete":en({completion:F({values:P(k()).max(100),total:j().int().optional(),hasMore:M().optional()}).loose()}),"server/discover":en({ttlMs:j().int().min(0).catch(0),cacheScope:z([`public`,`private`]).catch(`private`),supportedVersions:P(k()),capabilities:Ye,instructions:k().optional()}),"subscriptions/listen":en({})},nn=I({"io.modelcontextprotocol/subscriptionId":i.optional()}),rn=F({method:B(`notifications/subscriptions/acknowledged`),params:F({_meta:nn.optional(),notifications:Jt})}),an=F({_meta:nn.optional(),requestId:i,reason:k().optional()}),on=F({method:B(`notifications/cancelled`),params:an}),sn={"notifications/cancelled":on,"notifications/progress":ae,"notifications/message":se,"notifications/resources/updated":he,"notifications/resources/list_changed":me,"notifications/tools/list_changed":C,"notifications/prompts/list_changed":ve,"notifications/subscriptions/acknowledged":rn},cn=e=>F({jsonrpc:B(`2.0`),id:L([k(),j().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:x,ServerTasksCapabilitySchema:ee,ClientCapabilitiesSchema:te,ServerCapabilitiesSchema:ne,ProgressSchema:re,ProgressNotificationParamsSchema:ie,ProgressNotificationSchema:ae,LoggingMessageNotificationParamsSchema:oe,LoggingMessageNotificationSchema:se,ResourceContentsSchema:ce,TextResourceContentsSchema:le,BlobResourceContentsSchema:ue,AnnotationsSchema:de,ResourceSchema:fe,ResourceTemplateSchema:pe,ResourceListChangedNotificationSchema:me,ResourceUpdatedNotificationParamsSchema:S,ResourceUpdatedNotificationSchema:he,PromptArgumentSchema:ge,PromptSchema:_e,PromptListChangedNotificationSchema:ve,TextContentSchema:ye,ImageContentSchema:be,AudioContentSchema:xe,ToolUseContentSchema:Se,EmbeddedResourceSchema:Ce,ResourceLinkSchema:we,ContentBlockSchema:Te,PromptMessageSchema:Ee,ToolAnnotationsSchema:De,ToolListChangedNotificationSchema:C,ModelHintSchema:Oe,ModelPreferencesSchema:ke,ToolChoiceSchema:Ae,BooleanSchemaSchema:je,StringSchemaSchema:Me,NumberSchemaSchema:Ne,UntitledSingleSelectEnumSchemaSchema:Pe,TitledSingleSelectEnumSchemaSchema:w,LegacyTitledEnumSchemaSchema:Fe,SingleSelectEnumSchemaSchema:Ie,UntitledMultiSelectEnumSchemaSchema:Le,TitledMultiSelectEnumSchemaSchema:Re,MultiSelectEnumSchemaSchema:ze,EnumSchemaSchema:Be,PrimitiveSchemaDefinitionSchema:Ve,ElicitRequestFormParamsSchema:He,ResourceTemplateReferenceSchema:Ue,PromptReferenceSchema:We,RootSchema:Ge,ClientCapabilities2026Schema:qe,ServerCapabilities2026Schema:Ye,RequestMetaEnvelopeSchema:Xe,ToolSchema:Ze,ToolResultContentSchema:Qe,SamplingMessageContentBlockSchema:$e,SamplingMessageSchema:et,ResultTypeSchema:tt,ResultMetaSchema:nt,ResultSchema:at,PaginatedResultSchema:ot,CallToolResultSchema:st,ListToolsResultSchema:ct,ListPromptsResultSchema:lt,GetPromptResultSchema:ut,ListResourcesResultSchema:dt,ListResourceTemplatesResultSchema:ft,ReadResourceResultSchema:pt,CompleteResultSchema:mt,CacheableResultSchema:ht,DiscoverResultSchema:gt,CreateMessageRequestParamsSchema:_t,CreateMessageRequestSchema:vt,ListRootsRequestSchema:yt,CreateMessageResultSchema:bt,ListRootsResultSchema:xt,ElicitResultSchema:St,ElicitRequestURLParamsSchema:Ct,ElicitRequestParamsSchema:wt,ElicitRequestSchema:Tt,InputRequestSchema:Et,InputResponseSchema:Dt,InputRequestsSchema:Ot,InputResponsesSchema:kt,InputRequiredResultSchema:At,InputResponseRequestParamsSchema:Mt,CallToolRequestSchema:Rt,ListToolsRequestSchema:zt,ListPromptsRequestSchema:Bt,GetPromptRequestSchema:Vt,ListResourcesRequestSchema:Ht,ListResourceTemplatesRequestSchema:Ut,ReadResourceRequestSchema:Wt,CompleteRequestSchema:Kt,DiscoverRequestSchema:qt,SubscriptionFilterSchema:Jt,SubscriptionsListenRequestSchema:Xt,SubscriptionsListenResultMetaSchema:Zt,SubscriptionsListenResultSchema:Qt,dispatchRequestSchemas:$t,dispatchResultSchemas:tn,NotificationMetaSchema:nn,SubscriptionsAcknowledgedNotificationSchema:rn,CancelledNotificationParamsSchema:an,CancelledNotificationSchema:on,notificationSchemas2026:sn,JSONRPCResultResponseSchema:cn(at),CallToolResultResponseSchema:cn(L([st,At])),ListToolsResultResponseSchema:cn(ct),ListPromptsResultResponseSchema:cn(lt),GetPromptResultResponseSchema:cn(L([ut,At])),ListResourcesResultResponseSchema:cn(dt),ListResourceTemplatesResultResponseSchema:cn(ft),ReadResourceResultResponseSchema:cn(L([pt,At])),CompleteResultResponseSchema:cn(mt),DiscoverResultResponseSchema:cn(gt)}}let Vf;function Hf(){return Vf??=Bf()}const Uf=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function Wf(e){return Uf.includes(e)}const Gf=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function Kf(e){return e[Gf]}function qf(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function Jf(e){return e===`public`||e===`private`}let J=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 Y=class e extends Error{static{Object.defineProperty(this,`mcpBrand`,{value:`mcp.ProtocolError`})}static[Symbol.hasInstance](e){return $d(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 $d(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,Qd(this,new.target)}static fromError(t,n,r){if(t===J.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new Xf(e.elicitations,n)}if(t===J.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new Zf({supported:e.supported,requested:e.requested},n)}if(t===J.InvalidParams||t===J.ResourceNotFound){let e=r;if(typeof e?.uri==`string`&&(t===J.ResourceNotFound||Object.keys(e).length===1))return new Yf(e.uri,n)}if(t===J.MissingRequiredClientCapability&&r){let e=r;if(e.requiredCapabilities!==null&&typeof e.requiredCapabilities==`object`&&!Array.isArray(e.requiredCapabilities))return new Qf({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},Yf=class extends Y{static{Object.defineProperty(this,`mcpBrand`,{value:`mcp.ResourceNotFoundError`})}constructor(e,t=`Resource not found: ${e}`){super(J.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Xf=class extends Y{static{Object.defineProperty(this,`mcpBrand`,{value:`mcp.UrlElicitationRequiredError`})}constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(J.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Zf=class extends Y{static{Object.defineProperty(this,`mcpBrand`,{value:`mcp.UnsupportedProtocolVersionError`})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(J.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Qf=class extends Y{static{Object.defineProperty(this,`mcpBrand`,{value:`mcp.MissingRequiredClientCapabilityError`})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(`, `)}`){super(J.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}};const $f=[`tools/call`,`prompts/get`,`resources/read`];function ep(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||$f.includes(e))return t;throw new Y(J.InternalError,`Handler for ${e} returned resultType '${String(n)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function tp(e,t){let n=Kf(t);if(t.resultType!==`complete`||!Wf(e))return n===void 0?t:op(t);let r=t,i=qf(r.ttlMs)?r.ttlMs:ip(n),a=Jf(r.cacheScope)?r.cacheScope:ap(n),o={...r,ttlMs:i,cacheScope:a};return delete o[Gf],o}function np(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function rp(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[mc]:t}}:!np(n)||n[mc]!==void 0?e:{...e,_meta:{...n,[mc]:t}}}function ip(e){return e!==void 0&&qf(e.ttlMs)?e.ttlMs:0}function ap(e){return e!==void 0&&Jf(e.cacheScope)?e.cacheScope:`private`}function op(e){let t={...e};return delete t[Gf],t}const sp=[`elicitation/create`,`sampling/createMessage`,`roots/list`];let cp;function lp(){if(cp)return cp;let e=Hf();return cp={request:{"elicitation/create":F({method:B(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":F({method:B(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":F({method:B(`roots/list`),params:I({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},cp}function up(e){return sp.includes(e)}function dp(e){return up(e)?lp().request[e]:void 0}function fp(e){return up(e)?lp().response[e]:void 0}const pp={"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},mp={"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 hp(e){return Object.prototype.hasOwnProperty.call(pp,e)}function gp(e){return Object.prototype.hasOwnProperty.call(mp,e)}function _p(e){return Object.prototype.hasOwnProperty.call(pp,e)}function vp(e){return hp(e)?Hf().dispatchRequestSchemas[e]:void 0}function yp(e){return _p(e)?Hf().dispatchResultSchemas[e]:void 0}function bp(e){return gp(e)?Hf().notificationSchemas2026[e]:void 0}function xp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Sp(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 Cp={ok:!1,reason:`not-in-era`},wp=[fc,hc];function Tp(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=>xp(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!xp(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(xp(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}const Ep={era:`2026-07-28`,hasRequestMethod:hp,hasNotificationMethod:gp,hasInputRequestMethod:e=>dp(e)!==void 0,validateRequest:(e,t)=>Sp(vp(e),t),validateResult:(e,t)=>Sp(yp(e),t),validateNotification:(e,t)=>Sp(bp(e),t),validateInputRequest:(e,t)=>Sp(dp(e),t),validateInputResponse:(e,t)=>Sp(fp(e),t),samplingResultVariant:()=>Cp,outboundEnvelope(e){return{[fc]:e.protocolVersion,[pc]:e.clientInfo,[hc]:e.clientCapabilities,...e.logLevel!==void 0&&{[_c]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of wp)n in e||t.push({key:n,problem:`missing`});let n=Hf().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`;if(n.length===1&&t.some(e=>e.key===r&&e.problem===`missing`))continue;t.push({key:r,problem:e.message})}return t},projectCallToolResult:e=>ff(e),inputRequestSchema:dp,decodeResult(e,t){if(!xp(t))return{kind:`invalid`,error:new q(K.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let n=t.resultType;if(n===void 0)return{kind:`invalid`,error:new q(K.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 q(K.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:n})};if(n===`input_required`){let n=t.inputRequests,r=xp(n)?n:{},i=t.requestState;return Object.keys(r).length===0&&typeof i!=`string`?{kind:`invalid`,error:new q(K.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 q(K.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=Op(),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 q(K.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 rp(tp(e,ep(e,Tp(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=Hf().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 Dp;function Op(){if(Dp)return Dp;let e=Hf();return Dp={"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},Dp}const kp=`2026-07-28`;function Ap(e){return e!==void 0&&lf(e)?Ep:zf}function jp(e){return e.revision===void 0?e.era===`modern`?Ep.era:zf.era:Ap(e.revision).era}function Mp(e){return Pp.some(t=>t.hasRequestMethod(e))}function Np(e){return Pp.some(t=>t.hasNotificationMethod(e))}const Pp=[zf,Ep];var Fp=Hd({AnnotationsSchema:()=>ml,AudioContentSchema:()=>ql,BaseMetadataSchema:()=>Hc,BaseRequestParamsSchema:()=>Tc,BlobResourceContentsSchema:()=>fl,BooleanSchemaSchema:()=>Ou,CallToolRequestParamsSchema:()=>cu,CallToolRequestSchema:()=>lu,CallToolResultSchema:()=>ou,CancelTaskRequestSchema:()=>md,CancelTaskResultSchema:()=>hd,CancelledNotificationParamsSchema:()=>Rc,CancelledNotificationSchema:()=>zc,ClientCapabilitiesSchema:()=>Jc,ClientNotificationSchema:()=>_d,ClientRequestSchema:()=>gd,ClientResultSchema:()=>vd,ClientTasksCapabilitySchema:()=>Kc,CompatibilityCallToolResultSchema:()=>su,CompleteRequestParamsSchema:()=>Yu,CompleteRequestSchema:()=>Xu,CompleteResultSchema:()=>Zu,ContentBlockSchema:()=>Zl,CreateMessageRequestParamsSchema:()=>wu,CreateMessageRequestSchema:()=>Tu,CreateMessageResultSchema:()=>Eu,CreateMessageResultWithToolsSchema:()=>Du,CreateTaskResultSchema:()=>ad,CursorSchema:()=>xc,DiscoverRequestSchema:()=>el,DiscoverResultSchema:()=>tl,ElicitRequestFormParamsSchema:()=>Bu,ElicitRequestParamsSchema:()=>Hu,ElicitRequestSchema:()=>Uu,ElicitRequestURLParamsSchema:()=>Vu,ElicitResultSchema:()=>Ku,ElicitationCompleteNotificationParamsSchema:()=>Wu,ElicitationCompleteNotificationSchema:()=>Gu,EmbeddedResourceSchema:()=>Yl,EmptyResultSchema:()=>Lc,EnumSchemaSchema:()=>Ru,GetPromptRequestParamsSchema:()=>Ul,GetPromptRequestSchema:()=>Wl,GetPromptResultSchema:()=>$l,GetTaskPayloadRequestSchema:()=>ud,GetTaskPayloadResultSchema:()=>dd,GetTaskRequestSchema:()=>cd,GetTaskResultSchema:()=>ld,IconSchema:()=>Bc,IconsSchema:()=>Vc,ImageContentSchema:()=>Kl,ImplementationSchema:()=>Uc,InitializeRequestParamsSchema:()=>Yc,InitializeRequestSchema:()=>Xc,InitializeResultSchema:()=>Qc,InitializedNotificationSchema:()=>$c,JSONArraySchema:()=>yc,JSONObjectSchema:()=>H,JSONRPCErrorResponseSchema:()=>Pc,JSONRPCMessageSchema:()=>Fc,JSONRPCNotificationSchema:()=>Mc,JSONRPCRequestSchema:()=>jc,JSONRPCResponseSchema:()=>Ic,JSONRPCResultResponseSchema:()=>Nc,JSONValueSchema:()=>vc,LegacyTitledEnumSchemaSchema:()=>Nu,ListChangedOptionsBaseSchema:()=>du,ListPromptsRequestSchema:()=>Vl,ListPromptsResultSchema:()=>Hl,ListResourceTemplatesRequestSchema:()=>yl,ListResourceTemplatesResultSchema:()=>bl,ListResourcesRequestSchema:()=>_l,ListResourcesResultSchema:()=>vl,ListRootsRequestSchema:()=>$u,ListRootsResultSchema:()=>ed,ListTasksRequestSchema:()=>fd,ListTasksResultSchema:()=>pd,ListToolsRequestSchema:()=>iu,ListToolsResultSchema:()=>au,LoggingLevelSchema:()=>fu,LoggingMessageNotificationParamsSchema:()=>hu,LoggingMessageNotificationSchema:()=>gu,ModelHintSchema:()=>_u,ModelPreferencesSchema:()=>vu,MultiSelectEnumSchemaSchema:()=>Lu,NotificationSchema:()=>Oc,NotificationsParamsSchema:()=>Dc,NumberSchemaSchema:()=>Au,PaginatedRequestParamsSchema:()=>ol,PaginatedRequestSchema:()=>sl,PaginatedResultSchema:()=>cl,PingRequestSchema:()=>nl,PrimitiveSchemaDefinitionSchema:()=>zu,ProgressNotificationParamsSchema:()=>il,ProgressNotificationSchema:()=>al,ProgressSchema:()=>rl,ProgressTokenSchema:()=>bc,PromptArgumentSchema:()=>zl,PromptListChangedNotificationSchema:()=>eu,PromptMessageSchema:()=>Ql,PromptReferenceSchema:()=>Ju,PromptSchema:()=>Bl,ReadResourceRequestParamsSchema:()=>Sl,ReadResourceRequestSchema:()=>Cl,ReadResourceResultSchema:()=>wl,RelatedTaskMetadataSchema:()=>Cc,RequestIdSchema:()=>Ac,RequestMetaSchema:()=>wc,RequestSchema:()=>U,ResourceContentsSchema:()=>ll,ResourceLinkSchema:()=>Xl,ResourceListChangedNotificationSchema:()=>Tl,ResourceRequestParamsSchema:()=>xl,ResourceSchema:()=>hl,ResourceTemplateReferenceSchema:()=>qu,ResourceTemplateSchema:()=>gl,ResourceUpdatedNotificationParamsSchema:()=>Ll,ResourceUpdatedNotificationSchema:()=>Rl,ResultMetaObjectSchema:()=>kc,ResultSchema:()=>W,RoleSchema:()=>pl,RootSchema:()=>Qu,RootsListChangedNotificationSchema:()=>td,SamplingContentSchema:()=>xu,SamplingMessageContentBlockSchema:()=>Su,SamplingMessageSchema:()=>Cu,ServerCapabilitiesSchema:()=>Zc,ServerNotificationSchema:()=>bd,ServerRequestSchema:()=>yd,ServerResultSchema:()=>xd,ServerTasksCapabilitySchema:()=>qc,SetLevelRequestParamsSchema:()=>pu,SetLevelRequestSchema:()=>mu,SingleSelectEnumSchemaSchema:()=>Pu,StringSchemaSchema:()=>ku,SubscribeRequestParamsSchema:()=>El,SubscribeRequestSchema:()=>Dl,SubscriptionFilterSchema:()=>Al,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Nl,SubscriptionsAcknowledgedNotificationSchema:()=>Pl,SubscriptionsListenRequestParamsSchema:()=>jl,SubscriptionsListenRequestSchema:()=>Ml,SubscriptionsListenResultMetaSchema:()=>Fl,SubscriptionsListenResultSchema:()=>Il,TaskAugmentedRequestParamsSchema:()=>Ec,TaskCreationParamsSchema:()=>nd,TaskMetadataSchema:()=>Sc,TaskSchema:()=>id,TaskStatusNotificationParamsSchema:()=>od,TaskStatusNotificationSchema:()=>sd,TaskStatusSchema:()=>rd,TextContentSchema:()=>Gl,TextResourceContentsSchema:()=>ul,TitledMultiSelectEnumSchemaSchema:()=>Iu,TitledSingleSelectEnumSchemaSchema:()=>Mu,ToolAnnotationsSchema:()=>tu,ToolChoiceSchema:()=>yu,ToolExecutionSchema:()=>nu,ToolListChangedNotificationSchema:()=>uu,ToolResultContentSchema:()=>bu,ToolSchema:()=>ru,ToolUseContentSchema:()=>Jl,UnsubscribeRequestParamsSchema:()=>Ol,UnsubscribeRequestSchema:()=>kl,UntitledMultiSelectEnumSchemaSchema:()=>Fu,UntitledSingleSelectEnumSchemaSchema:()=>ju});const Ip=e=>jc.safeParse(e).success,Lp=e=>Mc.safeParse(e).success,Rp=e=>Nc.safeParse(e).success,zp=e=>Pc.safeParse(e).success,Bp=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&e.resultType===`input_required`,Vp=e=>Xc.safeParse(e).success,Hp=e=>$c.safeParse(e).success,Up=`x-mcp-header`,Wp=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Gp=new Set([`string`,`integer`,`boolean`,`number`]);function Kp(e){let t=[],n=new Map,r=(e,i,a)=>{if(typeof e!=`object`||!e)return;let o=e;if(Up in o){if(!a||i.length===0)return`${Yp(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[Up];if(typeof e!=`string`||e.length===0)return`${Yp(i)}: x-mcp-header MUST be a non-empty string`;if(!Wp.test(e))return`${Yp(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||!Gp.has(r))return`${Yp(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 qp){let t=o[e];if(t===void 0)continue;let n=Array.isArray(t)?t:typeof t==`object`&&t&&Jp.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 qp=[`items`,`prefixItems`,`contains`,`additionalProperties`,`unevaluatedProperties`,`unevaluatedItems`,`propertyNames`,`patternProperties`,`dependentSchemas`,`oneOf`,`anyOf`,`allOf`,`not`,`if`,`then`,`else`,`$defs`,`definitions`],Jp=new Set([`patternProperties`,`dependentSchemas`,`$defs`,`definitions`]);function Yp(e){return e.length===0?`<root>`:e.join(`.`)}const Xp=`=?base64?`;function Zp(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 Qp(e){if(e.length===0||e.startsWith(Xp)&&e.endsWith(`?=`)||e!==e.trim())return!0;for(let t=0;t<e.length;t++){let n=e.codePointAt(t);if(!(n===9||n>=32&&n<=126))return!0}return!1}function $p(e){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCodePoint(e);return btoa(n)}function em(e){return Qp(e)?`${Xp}${$p(e)}?=`:e}function tm(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n)return;n=n[e]}return n}function nm(e,t){let n={};for(let r of e){let e=tm(t,r.path);if(e==null)continue;let i=Zp(e);if(i===void 0)continue;n[`Mcp-Param-${r.headerName}`]=em(i)}return n}J.InvalidRequest,J.UnsupportedProtocolVersion,J.InvalidParams,J.MethodNotFound,J.InvalidParams,J.MissingRequiredClientCapability,J.ParseError,J.InvalidRequest,J.MethodNotFound,J.UnsupportedProtocolVersion,J.MissingRequiredClientCapability;function rm(e,t){return wo(e,t)}function im(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function am(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 om=!1;const sm=`draft-2020-12`;function cm(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:sm});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().`);om||(om=!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=vo(e,{target:sm,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&&lm(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 lm(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`||lm(e)))}return!1}function um(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function dm(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>um(e)).join(`, `)}:{success:!0,data:n.value}}function fm(e){let t=vo(e,{target:sm,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}const pm=/\\\.\\d\{(\d+)\}/;function mm(e){let t=pm.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=>oc({local:e,offset:t,precision:n}))))}function hm(e,t){let n;switch(e){case`email`:n=[Uo()];break;case`uri`:n=[qo()];break;case`date`:n=[sc()];break;case`date-time`:n=mm(t);break}return new Set(n.map(e=>fm(e)).filter(e=>e!==void 0))}function gm(e,t,n){return n===`zod`?hm(e,t).has(t):!0}function _m(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function vm(e){try{return cm(e,`input`)}catch(e){let t=e instanceof Error?e.message:String(e);throw new Y(J.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}const ym=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function bm(e){return ym.has(e)||e.startsWith(`x-`)}const xm=new Set([`$schema`,...Object.keys(Bu.shape.requestedSchema.shape)]),Sm={string:im([ku,ju,Mu,Nu]),number:im([Au]),integer:im([Au]),boolean:im([Ou]),array:im([Fu,Iu])},Cm=new Set(ku.shape.format.unwrap().options);function wm(e,t,n,r){if(!_m(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(Sm,e.type)?Sm[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||bm(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?Cm.has(e.format)?(typeof s!=`string`||!gm(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function Tm(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&_m(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,wm(n,`properties.${e}`,t,r)])):xm.has(i)?n[i]=a:bm(i)||r.push(i);if(r.length>0)throw new Y(J.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(`, `)}`);return n}function Em(e,t){if(!_m(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!rm(zu,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function Dm(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>Dm(e,t[r],`${n}[${r}]`)):!_m(e)||!_m(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?Dm(r,t[e],i):bm(e)?[]:[i]})}function Om(e){if(!am(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=Tm(vm(e.requestedSchema),t),r=rm(Bu.shape.requestedSchema,n);if(!r.success)throw new Y(J.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Em(n,r.error.message)}`);let i=Dm(n,r.data);if(i.length>0)throw new Y(J.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 Y(J.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(`, `)}`);return{...e,mode:`form`,requestedSchema:r.data}}function km(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}}}Object.assign(km,{elicit(e){try{return{method:`elicitation/create`,params:Om(e)}}catch(e){throw e instanceof Y?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 Am(e){return{autoFulfill:e?.autoFulfill??!0,maxRounds:e?.maxRounds??10}}function jm(e,t,n){let r=t!==void 0&&Object.keys(t).length>0;return!r&&n===void 0?e:{...e,...r&&{inputResponses:t},...n!==void 0&&{requestState:n}}}function Mm(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function Nm(e,t){return new Promise((n,r)=>{if(t?.aborted){r(t.reason instanceof q?t.reason:new q(K.RequestTimeout,String(t.reason)));return}let i=setTimeout(()=>{t?.removeEventListener(`abort`,a),n()},e),a=()=>{clearTimeout(i),r(t?.reason instanceof q?t.reason:new q(K.RequestTimeout,String(t?.reason)))};t?.addEventListener(`abort`,a,{once:!0})})}function Pm(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)}}async function Fm(e){let{config:t,method:n,originalParams:r,requestOptions:i,hooks:a,signal:o}=e,s=e.flowStartedAt??Date.now(),c=e.firstPayload,l=0;for(;;){if(l+=1,l>t.maxRounds)throw new q(K.InputRequiredRoundsExceeded,Mm(n,t.maxRounds),{rounds:t.maxRounds,lastResult:{inputRequests:c.inputRequests,...c.requestState!==void 0&&{requestState:c.requestState}}});i.onprogress?.({progress:l,message:`Fulfilling input required by '${n}' (round ${l})`});let e=Object.entries(c.inputRequests??{}),u;if(e.length>0){let t=Pm(o);try{let n=await Promise.all(e.map(async([e,n])=>{try{return[e,await a.dispatchInputRequest(e,n,t.signal)]}catch(e){throw t.abort(e),e}}));u=Object.fromEntries(n)}finally{t.dispose()}}else await Nm(250,o);let d={...i.timeout!==void 0&&{timeout:i.timeout}};if(i.maxTotalTimeout!==void 0){let e=Date.now()-s,t=i.maxTotalTimeout-e;if(t<=0)throw new q(K.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:i.maxTotalTimeout,totalElapsed:e});d.maxTotalTimeout=t}let f=await a.retry(jm(r,u,c.requestState),d);if(Bp(f)){c={inputRequests:f.inputRequests??{},...f.requestState!==void 0&&{requestState:f.requestState}};continue}return f}}const Im=`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(`.`),Lm={IdJagTokenExchangeResponseSchema:Od,OAuthClientInformationFullSchema:Nd,OAuthClientInformationSchema:Md,OAuthClientMetadataSchema:jd,OAuthClientRegistrationErrorSchema:Pd,OAuthErrorResponseSchema:kd,OAuthMetadataSchema:wd,OAuthProtectedResourceMetadataSchema:Cd,OAuthTokenRevocationRequestSchema:Fd,OAuthTokensSchema:Dd,OpenIdProviderDiscoveryMetadataSchema:Ed,OpenIdProviderMetadataSchema:Td},Rm={},zm={};function Bm(e,t){let n=e.slice(0,-6);Rm[n]=t,zm[n]=e=>t.safeParse(e).success}for(let e of Im)Bm(e,Fp[e]);for(let[e,t]of Object.entries(Lm))Bm(e,t);Object.freeze(Rm);const Vm=Object.freeze(zm);function Hm(e){switch(e){case`initialize`:case`notifications/initialized`:return Ap(void 0);case`server/discover`:return Ap(kp);default:return}}const Um=6e4,Wm=[fc,pc,hc,_c],Gm=[`inputResponses`,`requestState`];function Km(e,t){let n=e.params;if(!Zm(n))return{message:e,lifted:{}};let r=n._meta,i=Zm(r)?Wm.filter(e=>e in r):[],a=t===`request`?Gm.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&Zm(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 qm(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 Jm(e){return()=>e}const Ym=Jm(void 0);var Xm=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;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??dc,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 q(K.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 q(K.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),Rp(e)||zp(e)?this._onresponse(e):Ip(e)?this._onrequest(e,t):Lp(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 q(K.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}=Km(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=jp(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(Np(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}=Km(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=jp(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(J.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(Mp(n.method)&&!i.hasRequestMethod(n.method)){o(J.MethodNotFound,`Method not found`);return}let s=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(s===void 0){o(J.MethodNotFound,`Method not found`);return}let c=i.checkInboundEnvelope(r);if(c!==void 0){o(J.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:eh(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?Ym:Jm(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),am(t))return u(e,t,n);let i=qm(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(J.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:J.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),Rp(e)?n(e):n(Y.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),am(t))return this._requestWithSchemaViaCodec(r,e,t,n);let i=qm(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 Ap(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=Hm(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Mp(t)&&!e.hasRequestMethod(t))throw new q(K.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 q?e:new q(K.RequestTimeout,String(e))}let m=e.era===kp&&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 q?e:new q(K.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(oh(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;dm(n,o).then(e=>{e.success?d(e.data):f(new q(K.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??Um;this._setupTimeout(h,b,r?.maxTotalTimeout,()=>y(new q(K.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 q(K.NotConnected,`Not connected`);if(Np(t.method)&&!e.hasNotificationMethod(t.method))throw new q(K.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(!Mp(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 Y(J.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 dm(t.params,{...r.params});if(!a.success)throw new Y(J.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(!Np(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 Y(J.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 dm(t.params,{...r.params});if(!i.success)throw new Y(J.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await n(i.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Zm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Qm(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]=Zm(a)&&Zm(i)?{...a,...i}:i}return n}function $m(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function eh(e){let t={},n=[];if(!$m(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e)){if(!$m(i)||`method`in i||`result`in i){n.push(r);continue}t[r]=i}return{accepted:t,droppedKeys:n}}function th(e){throw new q(K.SendFailed,`ctx.mcpReq.${e} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}function nh(e,t,n,r,i){return{sessionId:i,mcpReq:{id:e,method:t,_meta:n?._meta,requestState:Jm(void 0),signal:r,send:(()=>th(`send`)),notify:()=>th(`notify`)}}}async function rh(e,t,n,r,i){if(!$m(r)||typeof r.method!=`string`)throw new q(K.InvalidResult,`Invalid input request '${n}': each inputRequests entry must be an embedded request object with a method`,{key:n});let a=r.method;if(!t.hasInputRequestMethod(a))throw new q(K.InvalidResult,`Invalid input request '${n}': '${a}' is not an embedded request the ${t.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:n,method:a});let o=e.getRequestHandler(a);if(o===void 0)throw new q(K.CapabilityNotSupported,`Cannot fulfil input request '${n}': no handler is registered for '${a}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:n,method:a});let s=$m(r.params)?r.params:void 0;return await o({jsonrpc:`2.0`,id:n,method:a,...s!==void 0&&{params:s}},e.buildContext(nh(n,a,s,i,e.sessionId)))}function ih(e,t){return{...e?.signal!==void 0&&{signal:e.signal},...e?.onprogress!==void 0&&{onprogress:e.onprogress},...e?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:e.resetTimeoutOnProgress},...e?.headers!==void 0&&{headers:e.headers},...t.timeout!==void 0&&{timeout:t.timeout},...t.maxTotalTimeout!==void 0&&{maxTotalTimeout:t.maxTotalTimeout},allowInputRequired:!0}}function ah(e,t,n,r){let{codec:i,request:a,options:o,flowStartedAt:s}=r,c={inputRequests:n.inputRequests,...n.requestState!==void 0&&{requestState:n.requestState}},l={dispatchInputRequest:(t,n,r)=>rh(e,i,t,n,r),retry:(e,t)=>r.retry(e,ih(o,t))};return Fm({config:t,method:a.method,originalParams:a.params,firstPayload:c,flowStartedAt:s,signal:o?.signal,requestOptions:{...o?.timeout!==void 0&&{timeout:o.timeout},...o?.maxTotalTimeout!==void 0&&{maxTotalTimeout:o.maxTotalTimeout},...o?.onprogress!==void 0&&{onprogress:o.onprogress}},hooks:l})}function oh(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState}}}var sh=Wd(G((exports=>{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-]+$/;exports.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 ch(e){if(e)try{return sh.parse(e).type}catch{let t=(e.split(`;`,1)[0]??``).trim().toLowerCase();return t===``||e.slice(t.length).includes(`,`)?void 0:t}}var lh=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(`
|
|
51
|
+
`);if(e===-1)return null;let t=this._buffer.toString(`utf8`,0,e).replace(/\r$/,``);this._buffer=this._buffer.subarray(e+1);try{return uh(t)}catch(e){if(e instanceof SyntaxError)continue;throw e}}return null}clear(){this._buffer=void 0}};function uh(e){return Fc.parse(JSON.parse(e))}function dh(e){return JSON.stringify(e)+`
|
|
52
|
+
`}function fh(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function ph(e=fetch,t){return t?async(n,r)=>e(n,{...t,...r,headers:r?.headers?{...fh(t.headers),...fh(r.headers)}:t.headers}):e}var mh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.regexpCode=exports.getEsmExportName=exports.getProperty=exports.safeStringify=exports.stringify=exports.strConcat=exports.addCodeArg=exports.str=exports._=exports.nil=exports._Code=exports.Name=exports.IDENTIFIER=exports._CodeOrName=void 0;var t=class{};exports._CodeOrName=t,exports.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!exports.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}}};exports.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),{})}};exports._Code=r,exports.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)}exports._=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)}exports.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}exports.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}`}exports.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))}exports.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}exports.safeStringify=p;function m(t){return typeof t==`string`&&exports.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}exports.getProperty=m;function h(t){if(typeof t==`string`&&exports.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}exports.getEsmExportName=h;function g(e){return new r(e.toString())}exports.regexpCode=g})),hh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.ValueScope=exports.ValueScopeName=exports.Scope=exports.varKinds=exports.UsedValueState=void 0;let t=mh();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||(exports.UsedValueState=r={})),exports.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}}};exports.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}]`}};exports.ValueScopeName=a;let o=(0,t._)`\n`;exports.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?exports.varKinds.var:exports.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}}})),X=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.or=exports.and=exports.not=exports.CodeGen=exports.operators=exports.varKinds=exports.ValueScopeName=exports.ValueScope=exports.Scope=exports.Name=exports.regexpCode=exports.stringify=exports.getProperty=exports.nil=exports.strConcat=exports.str=exports._=void 0;let t=mh(),n=hh();var r=mh();Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return r._}}),Object.defineProperty(exports,`str`,{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(exports,`strConcat`,{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(exports,`nil`,{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(exports,`getProperty`,{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(exports,`stringify`,{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(exports,`regexpCode`,{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(exports,`Name`,{enumerable:!0,get:function(){return r.Name}});var i=hh();Object.defineProperty(exports,`Scope`,{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(exports,`ValueScope`,{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(exports,`ValueScopeName`,{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(exports,`varKinds`,{enumerable:!0,get:function(){return i.varKinds}}),exports.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&&=se(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=se(this.rhs,e,n),this}get names(){return oe(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=se(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)||(ce(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>ae(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(le(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=se(this.condition,e,t),this}get names(){let e=super.names;return oe(e,this.condition),this.else&&ae(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=se(this.iteration,e,t),this}get names(){return ae(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 oe(oe(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=se(this.iterable,e,t),this}get names(){return ae(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&&ae(e,this.catch.names),this.finally&&ae(e,this.finally.names),e}},re=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};re.kind=`catch`;var ie=class extends m{render(e){return`finally`+super.render(e)}};ie.kind=`finally`,exports.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
53
|
+
`:``},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,exports.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 re(e),t(e)}return n&&(this._currNode=r.finally=new ie,this.code(n)),this._endBlockNode(re,ie)}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 ae(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function oe(e,n){return n instanceof t._CodeOrName?ae(e,n.names):e}function se(e,n,r){if(e instanceof t.Name)return i(e);if(!a(e))return e;return 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),[]));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 ce(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function le(e){return typeof e==`boolean`||typeof e==`number`||e===null?!e:(0,t._)`!${S(e)}`}exports.not=le;let ue=me(exports.operators.AND);function de(...e){return e.reduce(ue)}exports.and=de;let fe=me(exports.operators.OR);function pe(...e){return e.reduce(fe)}exports.or=pe;function me(e){return(n,r)=>n===t.nil?r:r===t.nil?n:(0,t._)`${S(n)} ${e} ${S(r)}`}function S(e){return e instanceof t.Name?e:(0,t._)`(${e})`}})),Z=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.checkStrictMode=exports.getErrorPath=exports.Type=exports.useFunc=exports.setEvaluated=exports.evaluatedPropsToName=exports.mergeEvaluated=exports.eachItem=exports.unescapeJsonPointer=exports.escapeJsonPointer=exports.escapeFragment=exports.unescapeFragment=exports.schemaRefOrVal=exports.schemaHasRulesButRef=exports.schemaHasRules=exports.checkUnknownRules=exports.alwaysValidSchema=exports.toHash=void 0;let t=X(),n=mh();function r(e){let t={};for(let n of e)t[n]=!0;return t}exports.toHash=r;function i(e,t){return typeof t==`boolean`?t:Object.keys(t).length===0?!0:(a(e,t),!o(t,e.self.RULES.all))}exports.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}"`)}exports.checkUnknownRules=a;function o(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(t[n])return!0;return!1}exports.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}exports.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)}`}exports.schemaRefOrVal=c;function l(e){return f(decodeURIComponent(e))}exports.unescapeFragment=l;function u(e){return encodeURIComponent(d(e))}exports.escapeFragment=u;function d(e){return typeof e==`number`?`${e}`:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}exports.escapeJsonPointer=d;function f(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}exports.unescapeJsonPointer=f;function p(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}exports.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}}exports.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?!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:(0,t._)`${r} > ${n} ? ${r} : ${n}`)),mergeValues:(e,t)=>e===!0?!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}exports.evaluatedPropsToName=h;function g(e,n,r){Object.keys(r).forEach(r=>e.assign((0,t._)`${n}${(0,t.getProperty)(r)}`,!0))}exports.setEvaluated=g;let _={};function v(e,t){return e.scopeValue(`func`,{ref:t,code:_[t.code]||(_[t.code]=new n._Code(t.code))})}exports.useFunc=v;var y;(function(e){e[e.Num=0]=`Num`,e[e.Str=1]=`Str`})(y||(exports.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)}exports.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)}}exports.checkStrictMode=x})),gh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=X();exports.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`)}})),_h=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.extendErrors=exports.resetErrorsCount=exports.reportExtraError=exports.reportError=exports.keyword$DataError=exports.keywordError=void 0;let t=X(),n=Z(),r=gh();exports.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},exports.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=exports.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}]`)}exports.reportError=i;function a(t,n=exports.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)}exports.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)))}exports.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))})}exports.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])}})),vh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.boolOrEmptySchema=exports.topBoolOrEmptySchema=void 0;let t=_h(),n=X(),r=gh(),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))}exports.topBoolOrEmptySchema=a;function o(e,t){let{gen:n,schema:r}=e;r===!1?(n.var(t,!1),s(e)):n.var(t,!0)}exports.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)}})),yh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.getRules=exports.isJSONType=void 0;let t=new Set([`string`,`number`,`integer`,`boolean`,`null`,`object`,`array`]);function n(e){return typeof e==`string`&&t.has(e)}exports.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:{}}}exports.getRules=r})),bh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.shouldUseRule=exports.shouldUseGroup=exports.schemaHasRulesForType=void 0;function t({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&n(e,i)}exports.schemaHasRulesForType=t;function n(e,t){return t.rules.some(t=>r(e,t))}exports.shouldUseGroup=n;function r(e,t){return e[t.keyword]!==void 0||t.definition.implements?.some(t=>e[t]!==void 0)}exports.shouldUseRule=r})),xh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.reportTypeError=exports.checkDataTypes=exports.checkDataType=exports.coerceAndCheckDataType=exports.getJSONTypes=exports.getSchemaTypes=exports.DataType=void 0;let t=yh(),n=bh(),r=_h(),i=X(),a=Z();var o;(function(e){e[e.Correct=0]=`Correct`,e[e.Wrong=1]=`Wrong`})(o||(exports.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}exports.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(`,`))}exports.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}exports.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
|
|
54
|
+
|| (${s} == "string" && ${a} && ${a} == +${a})`).assign(c,(0,i._)`+${a}`);return;case`integer`:r.elseIf((0,i._)`${s} === "boolean" || ${a} === null
|
|
55
|
+
|| (${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"
|
|
56
|
+
|| ${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)}}exports.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;for(let e in s.number&&delete s.integer,s)o=(0,i.and)(o,m(e,t,n,r));return o}exports.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)}exports.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}}})),Sh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.assignDefaults=void 0;let t=X(),n=Z();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))}exports.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)}`)}})),Ch=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.validateUnion=exports.validateArray=exports.usePattern=exports.callValidateCode=exports.schemaProperties=exports.allSchemaProperties=exports.noPropertyInData=exports.propertyInData=exports.isOwnProperty=exports.hasPropFunc=exports.reportMissingProp=exports.checkMissingProp=exports.checkReportMissingProp=void 0;let t=X(),n=Z(),r=gh(),i=Z();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()})}exports.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}`)))}exports.checkMissingProp=o;function s(e,t){e.setParams({missingProperty:t},!0),e.error()}exports.reportMissingProp=s;function c(e){return e.scopeValue(`func`,{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}exports.hasPropFunc=c;function l(e,n,r){return(0,t._)`${c(e)}.call(${n}, ${r})`}exports.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}exports.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}exports.noPropertyInData=d;function f(e){return e?Object.keys(e).filter(e=>e!==`__proto__`):[]}exports.allSchemaProperties=f;function p(e,t){return f(t).filter(r=>!(0,n.alwaysValidSchema)(e,t[r]))}exports.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})`}exports.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})`})}exports.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)})}}exports.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))}exports.validateUnion=v})),wh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.validateKeywordUsage=exports.validSchemaType=exports.funcKeywordCode=exports.macroKeywordCode=void 0;let t=X(),n=gh(),r=Ch(),i=_h();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))}exports.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)}}exports.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)}exports.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)}}exports.validateKeywordUsage=f})),Th=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.extendSubschemaMode=exports.extendSubschemaData=exports.getSubschema=void 0;let t=X(),n=Z();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`)}exports.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]}}exports.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}exports.extendSubschemaMode=a})),Eh=G(((exports,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}})),Dh=G(((exports,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`)}})),Oh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.getSchemaRefs=exports.resolveUrl=exports.normalizeId=exports._getFullPath=exports.getFullPath=exports.inlineRef=void 0;let t=Z(),n=Eh(),r=Dh(),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}exports.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`)return 1/0;if(n++,i.has(r))continue;if(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))}exports.getFullPath=l;function u(e,t){return e.serialize(t).split(`#`)[0]+`#`}exports._getFullPath=u;let d=/#\/?$/;function f(e){return e?e.replace(d,``):``}exports.normalizeId=f;function p(e,t,n){return n=f(n),e.resolve(t,n)}exports.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`)}}exports.getSchemaRefs=h})),kh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.getData=exports.KeywordCxt=exports.validateFunctionCode=void 0;let t=vh(),n=xh(),r=bh(),i=xh(),a=Sh(),o=wh(),s=Th(),c=X(),l=gh(),u=Oh(),d=Z(),f=_h();function p(e){if(ee(e)&&(ne(e),x(e))){_(e);return}m(e,()=>(0,t.topBoolOrEmptySchema)(e))}exports.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&&ce(e),ae(e),r.let(l.default.vErrors,null),r.let(l.default.errors,0),n.unevaluated&&v(e),re(e),le(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&&ce(e),oe(e),se(e);let a=r.const(`_errs`,l.default.errors);re(e,a),r.var(t,(0,c._)`${a} === ${l.default.errors}`)}function ne(e){(0,d.checkUnknownRules)(e),ie(e)}function re(e,t){if(e.opts.jtd)return de(e,[],!1,t);let r=(0,n.getSchemaTypes)(e.schema);de(e,r,!(0,n.coerceAndCheckDataType)(e,r),t)}function ie(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 ae(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 oe(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,u.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function se(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error(`async schema in sync schema`)}function ce({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 le(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&&ue(e),t.return((0,c._)`${l.default.errors} === 0`))}function ue({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 de(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(()=>xe(e,`$ref`,h.all.$ref.definition));return}p.jtd||pe(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)),fe(e,d),t.length===1&&t[0]===d.type&&n&&(o.else(),(0,i.reportTypeError)(e)),o.endIf()):fe(e,d),f||o.if((0,c._)`${l.default.errors} === ${a||0}`))}}function fe(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)&&xe(e,n.keyword,n.definition,t.type)})}function pe(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(me(e,t),e.opts.allowUnionTypes||S(e,t),he(e,e.dataTypes))}function me(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{_e(e.dataTypes,t)||ye(e,`type "${t}" not allowed by context "${e.dataTypes.join(`,`)}"`)}),ve(e,t)}}function S(e,t){t.length>1&&!(t.length===2&&t.includes(`null`))&&ye(e,`use allowUnionTypes to allow union type keyword`)}function he(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=>ge(t,e))&&ye(e,`missing type "${n.join(`,`)}" for keyword "${i}"`)}}}function ge(e,t){return e.includes(t)||t===`number`&&e.includes(`integer`)}function _e(e,t){return e.includes(t)||t===`integer`&&e.includes(`number`)}function ve(e,t){let n=[];for(let r of e.dataTypes)_e(t,r)?n.push(r):t.includes(`integer`)&&r===`number`&&n.push(`integer`);e.dataTypes=n}function ye(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}var be=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`,we(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}};exports.KeywordCxt=be;function xe(e,t,n,r){let i=new be(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 Se=/^\/(?:[^~]|~0|~1)*$/,Ce=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function we(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let i,a;if(e===``)return l.default.rootData;if(e[0]===`/`){if(!Se.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,a=l.default.rootData}else{let o=Ce.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}`}}exports.getData=we})),Ah=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.default=class extends Error{constructor(e){super(`validation failed`),this.errors=e,this.ajv=this.validation=!0}}})),jh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=Oh();exports.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))}}})),Mh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.resolveSchema=exports.getCompilingSchema=exports.resolveRef=exports.compileSchema=exports.SchemaEnv=void 0;let t=X(),n=Ah(),r=gh(),i=Oh(),a=Z(),o=kh();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={}}};exports.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)}}exports.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)}exports.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}exports.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)}}exports.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}})),Nh=G(((exports,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}})),Ph=G(((exports,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}else 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}else{n.push(t);break}}else 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}else 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}else 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}})),Fh=G(((exports,t)=>{let{isUUID:n}=Ph(),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=ee(`${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=ee(`${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={scheme:`wss`,domainHost:_.domainHost,parse:_.parse,serialize:_.serialize},y={scheme:`urn`,parse:d,serialize:f,skipNormalize:!0},b={scheme:`urn:uuid`,parse:p,serialize:m,skipNormalize:!0},x={http:h,https:g,ws:_,wss:v,urn:y,"urn:uuid":b};Object.setPrototypeOf(x,null);function ee(e){return e&&(x[e]||x[e.toLowerCase()])||void 0}t.exports={wsIsSecure:o,SCHEMES:x,isValidSchemeName:a,getSchemeHandler:ee}})),Ih=G(((exports,t)=>{let{normalizeIPv6:n,removeDotSegments:r,recomposeAuthority:i,normalizeComponentEncoding:a,isIPv4:o,nonSimpleDomain:s}=Ph(),{SCHEMES:c,getSchemeHandler:l}=Fh();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):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?a.path=`/`+t.path:e.path?a.path=e.path.slice(0,e.path.lastIndexOf(`/`)+1)+t.path:a.path=t.path,a.path=r(a.path)),a.query=t.query):(a.path=e.path,t.query===void 0?a.query=e.query:a.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.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path?i.reference=`same-document`:i.scheme===void 0?i.reference=`relative`:i.fragment===void 0?i.reference=`absolute`:i.reference=`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=_})),Lh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=Ih();t.code=`require("ajv/dist/runtime/uri").default`,exports.default=t})),Rh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.CodeGen=exports.Name=exports.nil=exports.stringify=exports.str=exports._=exports.KeywordCxt=void 0;var t=kh();Object.defineProperty(exports,`KeywordCxt`,{enumerable:!0,get:function(){return t.KeywordCxt}});var n=X();Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return n._}}),Object.defineProperty(exports,`str`,{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(exports,`stringify`,{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(exports,`nil`,{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(exports,`Name`,{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(exports,`CodeGen`,{enumerable:!0,get:function(){return n.CodeGen}});let r=Ah(),i=jh(),a=yh(),o=Mh(),s=X(),c=Oh(),l=xh(),u=Z(),d=Nh(),f=Lh(),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=ae(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=re.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(se.call(this,n,t),!t)return(0,u.eachItem)(n,e=>ce.call(this,e)),this;ue.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=>ce.call(this,e,r):e=>r.type.forEach(t=>ce.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]=fe(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,exports.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}for(let t in this.logger.warn(`keywords option as map is deprecated, pass array`),e){let n=e[t];n.keyword||=t,this.addKeyword(n)}}function re(){let e={...this.opts};for(let t of m)delete e[t];return e}let ie={log(){},warn(){},error(){}};function ae(e){if(e===!1)return ie;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 oe=/^[a-z_$][a-z0-9_$:-]*$/i;function se(e,t){let{RULES:n}=this;if((0,u.eachItem)(e,e=>{if(n.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!oe.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 ce(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?le.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 le(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 ue(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=fe(t)),e.validateSchema=this.compile(t,!0))}let de={$ref:`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`};function fe(e){return{anyOf:[e,de]}}})),zh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.default={keyword:`id`,code(){throw Error(`NOT SUPPORTED: keyword "id", use "$id" for schema ID`)}}})),Bh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.callRef=exports.getValidate=void 0;let t=jh(),n=Ch(),r=X(),i=gh(),a=Mh(),o=Z(),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);if(h instanceof a.SchemaEnv)return _(h);return 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`}exports.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)}}}exports.callRef=l,exports.default=s})),Vh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=zh(),n=Bh();exports.default=[`$schema`,`$id`,`$defs`,`$vocabulary`,{keyword:`$comment`},`definitions`,t.default,n.default]})),Hh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=X(),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}};exports.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})`)}}})),Uh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=X();exports.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}))`)}}})),Wh=G((exports=>{Object.defineProperty(exports,`__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}exports.default=t,t.code=`require("ajv/dist/runtime/ucs2length").default`})),Gh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=X(),n=Z(),r=Wh();exports.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}`)}}})),Kh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=Ch(),n=Z(),r=X();exports.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})`)}}}})),qh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=X();exports.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}`)}}})),Jh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=Ch(),n=X(),r=Z();exports.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)}}}})),Yh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=X();exports.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}`)}}})),Xh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=Eh();t.code=`require("ajv/dist/runtime/equal").default`,exports.default=t})),Zh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=xh(),n=X(),r=Z(),i=Xh();exports.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)})))}}}})),Qh=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=X(),n=Z(),r=Xh();exports.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}`)}}})),$h=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=X(),n=Z(),r=Xh();exports.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}`}}}})),eg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=Hh(),n=Uh(),r=Gh(),i=Kh(),a=qh(),o=Jh(),s=Yh(),c=Zh(),l=Qh(),u=$h();exports.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]})),tg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.validateAdditionalItems=void 0;let t=X(),n=Z(),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())})}}exports.validateAdditionalItems=i,exports.default=r})),ng=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.validateTuple=void 0;let t=X(),n=Z(),r=Ch(),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)}}}exports.validateTuple=a,exports.default=i})),rg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=ng();exports.default={keyword:`prefixItems`,type:`array`,schemaType:[`array`],before:`uniqueItems`,code:e=>(0,t.validateTuple)(e,`items`)}})),ig=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=X(),n=Z(),r=Ch(),i=tg();exports.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)))}}})),ag=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=X(),n=Z();exports.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)))}}}})),og=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.validateSchemaDeps=exports.validatePropertyDeps=exports.error=void 0;let t=X(),n=Z(),r=Ch();exports.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},
|
|
57
|
+
missingProperty: ${i},
|
|
58
|
+
depsCount: ${n},
|
|
59
|
+
deps: ${r}}`};let i={keyword:`dependencies`,type:`object`,schemaType:`object`,error:exports.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())}}exports.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){if((0,n.alwaysValidSchema)(s,t[l]))continue;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)}}exports.validateSchemaDeps=s,exports.default=i})),sg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=X(),n=Z();exports.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)}}})),cg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=Ch(),n=X(),r=gh(),i=Z();exports.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)}}}})),lg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=kh(),n=Ch(),r=Z(),i=cg();exports.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)}}}})),ug=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=Ch(),n=X(),r=Z(),i=Z();exports.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())})})}}}})),dg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=Z();exports.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`}}})),fg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.default={keyword:`anyOf`,schemaType:`array`,trackErrors:!0,code:Ch().validateUnion,error:{message:`must match a schema in anyOf`}}})),pg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=X(),n=Z();exports.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)})})}}}})),mg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=Z();exports.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)})}}})),hg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=X(),n=Z(),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)}exports.default=r})),gg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=Z();exports.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`)}}})),_g=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=tg(),n=rg(),r=ng(),i=ig(),a=ag(),o=og(),s=sg(),c=cg(),l=lg(),u=ug(),d=dg(),f=fg(),p=pg(),m=mg(),h=hg(),g=gg();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),_}exports.default=_})),vg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=X();exports.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})`}}}}})),yg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.default=[vg().default]})),bg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.contentVocabulary=exports.metadataVocabulary=void 0,exports.metadataVocabulary=[`title`,`description`,`default`,`deprecated`,`readOnly`,`writeOnly`,`examples`],exports.contentVocabulary=[`contentMediaType`,`contentEncoding`,`contentSchema`]})),xg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=Vh(),n=eg(),r=_g(),i=yg(),a=bg();exports.default=[t.default,n.default,(0,r.default)(),i.default,a.metadataVocabulary,a.contentVocabulary]})),Sg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.DiscrError=void 0;var t;(function(e){e.Tag=`tag`,e.Mapping=`mapping`})(t||(exports.DiscrError=t={}))})),Cg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=X(),n=Sg(),r=Mh(),i=jh(),a=Z();exports.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=_();for(let e in o.if(!1),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}}}}})),wg=G(((exports,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}})),Tg=G(((exports,t)=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.MissingRefError=exports.ValidationError=exports.CodeGen=exports.Name=exports.nil=exports.stringify=exports.str=exports._=exports.KeywordCxt=exports.Ajv=void 0;let n=Rh(),r=xg(),i=Cg(),a=wg(),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)}};exports.Ajv=c,t.exports=exports=c,t.exports.Ajv=c,Object.defineProperty(exports,`__esModule`,{value:!0}),exports.default=c;var l=kh();Object.defineProperty(exports,`KeywordCxt`,{enumerable:!0,get:function(){return l.KeywordCxt}});var u=X();Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return u._}}),Object.defineProperty(exports,`str`,{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(exports,`stringify`,{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(exports,`nil`,{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(exports,`Name`,{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(exports,`CodeGen`,{enumerable:!0,get:function(){return u.CodeGen}});var d=Ah();Object.defineProperty(exports,`ValidationError`,{enumerable:!0,get:function(){return d.default}});var f=jh();Object.defineProperty(exports,`MissingRefError`,{enumerable:!0,get:function(){return f.default}})})),Eg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.dynamicAnchor=void 0;let t=X(),n=gh(),r=Mh(),i=Bh(),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))}exports.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)}exports.default=a})),Dg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.dynamicRef=void 0;let t=X(),n=gh(),r=Bh(),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)}}exports.dynamicRef=a,exports.default=i})),Og=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=Eg(),n=Z();exports.default={keyword:`$recursiveAnchor`,schemaType:`boolean`,code(e){e.schema?(0,t.dynamicAnchor)(e,``):(0,n.checkStrictMode)(e.it,`$recursiveAnchor: false is ignored`)}}})),kg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=Dg();exports.default={keyword:`$recursiveRef`,schemaType:`string`,code:e=>(0,t.dynamicRef)(e,e.schema)}})),Ag=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=Eg(),n=Dg(),r=Og(),i=kg();exports.default=[t.default,n.default,r.default,i.default]})),jg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=og();exports.default={keyword:`dependentRequired`,type:`object`,schemaType:`object`,error:t.error,code:e=>(0,t.validatePropertyDeps)(e)}})),Mg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=og();exports.default={keyword:`dependentSchemas`,type:`object`,schemaType:`object`,code:e=>(0,t.validateSchemaDeps)(e)}})),Ng=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=Z();exports.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`)}}})),Pg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=jg(),n=Mg(),r=Ng();exports.default=[t.default,n.default,r.default]})),Fg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=X(),n=Z(),r=gh();exports.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)}}}})),Ig=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=X(),n=Z();exports.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())})}}}})),Lg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=Fg(),n=Ig();exports.default=[t.default,n.default]})),Rg=G(((exports,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`}]}}}}})),zg=G(((exports,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:`#`}}}}})),Bg=G(((exports,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:`#`}}}})),Vg=G(((exports,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:{}}}}})),Hg=G(((exports,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`}}}})),Ug=G(((exports,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}}}})),Wg=G(((exports,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:[]}}}})),Gg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=Rg(),n=zg(),r=Bg(),i=Vg(),a=Hg(),o=Ug(),s=Wg(),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}}exports.default=l})),Kg=G(((exports,t)=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.MissingRefError=exports.ValidationError=exports.CodeGen=exports.Name=exports.nil=exports.stringify=exports.str=exports._=exports.KeywordCxt=exports.Ajv2019=void 0;let n=Rh(),r=xg(),i=Ag(),a=Pg(),o=Lg(),s=Cg(),c=Gg(),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)}};exports.Ajv2019=u,t.exports=exports=u,t.exports.Ajv2019=u,Object.defineProperty(exports,`__esModule`,{value:!0}),exports.default=u;var d=kh();Object.defineProperty(exports,`KeywordCxt`,{enumerable:!0,get:function(){return d.KeywordCxt}});var f=X();Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return f._}}),Object.defineProperty(exports,`str`,{enumerable:!0,get:function(){return f.str}}),Object.defineProperty(exports,`stringify`,{enumerable:!0,get:function(){return f.stringify}}),Object.defineProperty(exports,`nil`,{enumerable:!0,get:function(){return f.nil}}),Object.defineProperty(exports,`Name`,{enumerable:!0,get:function(){return f.Name}}),Object.defineProperty(exports,`CodeGen`,{enumerable:!0,get:function(){return f.CodeGen}});var p=Ah();Object.defineProperty(exports,`ValidationError`,{enumerable:!0,get:function(){return p.default}});var m=jh();Object.defineProperty(exports,`MissingRefError`,{enumerable:!0,get:function(){return m.default}})})),qg=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=Vh(),n=eg(),r=_g(),i=Ag(),a=Pg(),o=Lg(),s=yg(),c=bg();exports.default=[i.default,t.default,n.default,(0,r.default)(!0),s.default,c.metadataVocabulary,c.contentVocabulary,a.default,o.default]})),Jg=G(((exports,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}}}})),Yg=G(((exports,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`}}}}})),Xg=G(((exports,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`}}}})),Zg=G(((exports,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`}}}})),Qg=G(((exports,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`}}}})),$g=G(((exports,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`}}}})),e_=G(((exports,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}}}})),t_=G(((exports,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:[]}}}})),n_=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0});let t=Jg(),n=Yg(),r=Xg(),i=Zg(),a=Qg(),o=$g(),s=e_(),c=t_(),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}}exports.default=u})),r_=G(((exports,t)=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.MissingRefError=exports.ValidationError=exports.CodeGen=exports.Name=exports.nil=exports.stringify=exports.str=exports._=exports.KeywordCxt=exports.Ajv2020=void 0;let n=Rh(),r=qg(),i=Cg(),a=n_(),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)}};exports.Ajv2020=s,t.exports=exports=s,t.exports.Ajv2020=s,Object.defineProperty(exports,`__esModule`,{value:!0}),exports.default=s;var c=kh();Object.defineProperty(exports,`KeywordCxt`,{enumerable:!0,get:function(){return c.KeywordCxt}});var l=X();Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return l._}}),Object.defineProperty(exports,`str`,{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(exports,`stringify`,{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(exports,`nil`,{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(exports,`Name`,{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(exports,`CodeGen`,{enumerable:!0,get:function(){return l.CodeGen}});var u=Ah();Object.defineProperty(exports,`ValidationError`,{enumerable:!0,get:function(){return u.default}});var d=jh();Object.defineProperty(exports,`MissingRefError`,{enumerable:!0,get:function(){return d.default}})})),i_=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.formatNames=exports.fastFormats=exports.fullFormats=void 0;function t(e,t){return{validate:e,compare:t}}exports.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:ie,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},exports.fastFormats={...exports.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},exports.formatNames=Object.keys(exports.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?1: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 re=/[^\\]\\Z/;function ie(e){if(re.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}})),a_=G((exports=>{Object.defineProperty(exports,`__esModule`,{value:!0}),exports.formatLimitDefinition=void 0;let t=Tg(),n=X(),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}};exports.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`]},exports.default=t=>(t.addKeyword(exports.formatLimitDefinition),t)})),o_=G(((exports,t)=>{Object.defineProperty(exports,`__esModule`,{value:!0});let n=i_(),r=a_(),i=X(),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=exports=s,Object.defineProperty(exports,`__esModule`,{value:!0}),exports.default=s})),s_=Tg(),c_=Kg(),l_=r_();const u_=Wd(o_(),1).default;function d_(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return u_(t),t}var f_=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=e!==void 0,this._ajv=e}get ajv(){return this._ajv??=d_(l_.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=Xd(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??=d_(c_.Ajv2019):this._ajvDraft7??=d_(s_.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)}}};s_.Ajv;let p_;p_=globalThis.crypto?.webcrypto??globalThis.crypto??import(`node:crypto`).then(e=>e.webcrypto);async function m_(e){return(await p_).getRandomValues(new Uint8Array(e))}async function h_(e){let t=``,n=await m_(e);for(let r=0;r<e;r++){let e=n[r]%66;t+=`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~`[e]}return t}async function g_(e){return await h_(e)}async function __(e){let t=await(await p_).subtle.digest(`SHA-256`,new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,`_`).replace(/\+/g,`-`).replace(/=/g,``)}async function v_(e){if(e||=43,e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await g_(e),n=await __(t);return{code_verifier:t,code_challenge:n}}var y_=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}};function b_(e){}function x_(e){if(typeof e==`function`)throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=b_,onError:n=b_,onRetry:r=b_,onComment:i}=e,a=``,o=!0,s,c=``,l=``;function u(e){let t=o?e.replace(/^\xEF\xBB\xBF/,``):e,[n,r]=S_(`${a}${t}`);for(let e of n)d(e);a=r,o=!1}function d(e){if(e===``){p();return}if(e.startsWith(`:`)){i&&i(e.slice(e.startsWith(`: `)?2:1));return}let t=e.indexOf(`:`);if(t!==-1){let n=e.slice(0,t),r=e[t+1]===` `?2:1,i=e.slice(t+r);f(n,i,e);return}f(e,``,e)}function f(e,t,i){switch(e){case`event`:l=t;break;case`data`:c=`${c}${t}
|
|
60
|
+
`;break;case`id`:s=t.includes(`\0`)?void 0:t;break;case`retry`:/^\d+$/.test(t)?r(parseInt(t,10)):n(new y_(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:i}));break;default:n(new y_(`Unknown field "${e.length>20?`${e.slice(0,20)}\u2026`:e}"`,{type:`unknown-field`,field:e,value:t,line:i}));break}}function p(){c.length>0&&t({id:s,event:l||void 0,data:c.endsWith(`
|
|
61
|
+
`)?c.slice(0,-1):c}),s=void 0,c=``,l=``}function m(e={}){a&&e.consume&&d(a),o=!0,s=void 0,c=``,l=``,a=``}return{feed:u,reset:m}}function S_(e){let t=[],n=``,r=0;for(;r<e.length;){let i=e.indexOf(`\r`,r),a=e.indexOf(`
|
|
62
|
+
`,r),o=-1;if(i!==-1&&a!==-1?o=Math.min(i,a):i===-1?a!==-1&&(o=a):o=i===e.length-1?-1:i,o===-1){n=e.slice(r);break}else{let n=e.slice(r,o);t.push(n),r=o+1,e[r-1]===`\r`&&e[r]===`
|
|
63
|
+
`&&r++}}return[t,n]}var C_=class extends Event{constructor(e,t){super(e),this.code=t?.code??void 0,this.message=t?.message??void 0}[Symbol.for(`nodejs.util.inspect.custom`)](e,t,n){return n(E_(this),t)}[Symbol.for(`Deno.customInspect`)](e,t){return e(E_(this),t)}};function w_(e){let t=globalThis.DOMException;return typeof t==`function`?new t(e,`SyntaxError`):SyntaxError(e)}function T_(e){return e instanceof Error?`errors`in e&&Array.isArray(e.errors)?e.errors.map(T_).join(`, `):`cause`in e&&e.cause instanceof Error?`${e}: ${T_(e.cause)}`:e.message:`${e}`}function E_(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var D_=e=>{throw TypeError(e)},O_=(e,t,n)=>t.has(e)||D_(`Cannot `+n),Q=(e,t,n)=>(O_(e,t,`read from private field`),n?n.call(e):t.get(e)),k_=(e,t,n)=>t.has(e)?D_(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),$=(e,t,n,r)=>(O_(e,t,`write to private field`),t.set(e,n),n),A_=(e,t,n)=>(O_(e,t,`access private method`),n),j_,M_,N_,P_,F_,I_,L_,R_,z_,B_,V_,H_,U_,W_,G_,K_,q_,J_,Y_,X_,Z_,Q_,$_,ev=class extends EventTarget{constructor(e,t){super(),k_(this,W_),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,k_(this,j_),k_(this,M_),k_(this,N_),k_(this,P_),k_(this,F_),k_(this,I_),k_(this,L_),k_(this,R_,null),k_(this,z_),k_(this,B_),k_(this,V_,null),k_(this,H_,null),k_(this,U_,null),k_(this,K_,async e=>{var t;Q(this,B_).reset();let{body:n,redirected:r,status:i,headers:a}=e;if(i===204){A_(this,W_,Z_).call(this,`Server sent HTTP 204, not reconnecting`,204),this.close();return}if(r?$(this,N_,new URL(e.url)):$(this,N_,void 0),i!==200){A_(this,W_,Z_).call(this,`Non-200 status code (${i})`,i);return}if(!(a.get(`content-type`)||``).startsWith(`text/event-stream`)){A_(this,W_,Z_).call(this,`Invalid content type, expected "text/event-stream"`,i);return}if(Q(this,j_)===this.CLOSED)return;$(this,j_,this.OPEN);let o=new Event(`open`);if((t=Q(this,U_))==null||t.call(this,o),this.dispatchEvent(o),typeof n!=`object`||!n||!(`getReader`in n)){A_(this,W_,Z_).call(this,`Invalid response body, expected a web ReadableStream`,i),this.close();return}let s=new TextDecoder,c=n.getReader(),l=!0;do{let{done:e,value:t}=await c.read();t&&Q(this,B_).feed(s.decode(t,{stream:!e})),e&&(l=!1,Q(this,B_).reset(),A_(this,W_,Q_).call(this))}while(l)}),k_(this,q_,e=>{$(this,z_,void 0),!(e.name===`AbortError`||e.type===`aborted`)&&A_(this,W_,Q_).call(this,T_(e))}),k_(this,Y_,e=>{typeof e.id==`string`&&$(this,R_,e.id);let t=new MessageEvent(e.event||`message`,{data:e.data,origin:Q(this,N_)?Q(this,N_).origin:Q(this,M_).origin,lastEventId:e.id||``});Q(this,H_)&&(!e.event||e.event===`message`)&&Q(this,H_).call(this,t),this.dispatchEvent(t)}),k_(this,X_,e=>{$(this,I_,e)}),k_(this,$_,()=>{$(this,L_,void 0),Q(this,j_)===this.CONNECTING&&A_(this,W_,G_).call(this)});try{if(e instanceof URL)$(this,M_,e);else if(typeof e==`string`)$(this,M_,new URL(e,tv()));else throw Error(`Invalid URL`)}catch{throw w_(`An invalid or illegal string was specified`)}$(this,B_,x_({onEvent:Q(this,Y_),onRetry:Q(this,X_)})),$(this,j_,this.CONNECTING),$(this,I_,3e3),$(this,F_,t?.fetch??globalThis.fetch),$(this,P_,t?.withCredentials??!1),A_(this,W_,G_).call(this)}get readyState(){return Q(this,j_)}get url(){return Q(this,M_).href}get withCredentials(){return Q(this,P_)}get onerror(){return Q(this,V_)}set onerror(e){$(this,V_,e)}get onmessage(){return Q(this,H_)}set onmessage(e){$(this,H_,e)}get onopen(){return Q(this,U_)}set onopen(e){$(this,U_,e)}addEventListener(e,t,n){let r=t;super.addEventListener(e,r,n)}removeEventListener(e,t,n){let r=t;super.removeEventListener(e,r,n)}close(){Q(this,L_)&&clearTimeout(Q(this,L_)),Q(this,j_)!==this.CLOSED&&(Q(this,z_)&&Q(this,z_).abort(),$(this,j_,this.CLOSED),$(this,z_,void 0))}};j_=new WeakMap,M_=new WeakMap,N_=new WeakMap,P_=new WeakMap,F_=new WeakMap,I_=new WeakMap,L_=new WeakMap,R_=new WeakMap,z_=new WeakMap,B_=new WeakMap,V_=new WeakMap,H_=new WeakMap,U_=new WeakMap,W_=new WeakSet,G_=function(){$(this,j_,this.CONNECTING),$(this,z_,new AbortController),Q(this,F_)(Q(this,M_),A_(this,W_,J_).call(this)).then(Q(this,K_)).catch(Q(this,q_))},K_=new WeakMap,q_=new WeakMap,J_=function(){let e={mode:`cors`,redirect:`follow`,headers:{Accept:`text/event-stream`,...Q(this,R_)?{"Last-Event-ID":Q(this,R_)}:void 0},cache:`no-store`,signal:Q(this,z_)?.signal};return`window`in globalThis&&(e.credentials=this.withCredentials?`include`:`same-origin`),e},Y_=new WeakMap,X_=new WeakMap,Z_=function(e,t){var n;Q(this,j_)!==this.CLOSED&&$(this,j_,this.CLOSED);let r=new C_(`error`,{code:t,message:e});(n=Q(this,V_))==null||n.call(this,r),this.dispatchEvent(r)},Q_=function(e,t){var n;if(Q(this,j_)===this.CLOSED)return;$(this,j_,this.CONNECTING);let r=new C_(`error`,{code:t,message:e});(n=Q(this,V_))==null||n.call(this,r),this.dispatchEvent(r),$(this,L_,setTimeout(Q(this,$_),Q(this,I_)))},$_=new WeakMap,ev.CONNECTING=0,ev.OPEN=1,ev.CLOSED=2;function tv(){let e=`document`in globalThis?globalThis.document:void 0;return e&&typeof e==`object`&&`baseURI`in e&&typeof e.baseURI==`string`?e.baseURI:void 0}var nv=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:n}={}){let r;super({start(i){r=x_({onEvent:e=>{i.enqueue(e)},onError(t){e===`terminate`?i.error(t):typeof e==`function`&&e(t)},onRetry:t,onComment:n})},transform(e){r.feed(e)}})}},rv=class extends Error{static{Object.defineProperty(this,`mcpBrand`,{value:`mcp.OAuthClientFlowError`})}static[Symbol.hasInstance](e){return $d(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 $d(this,e)}constructor(e){super(e),this.name=new.target.name,Qd(this,new.target)}},iv=class extends rv{static{Object.defineProperty(this,`mcpBrand`,{value:`mcp.IssuerMismatchError`})}kind;expected;received;constructor(e,t,n){super(`Issuer mismatch in ${e===`metadata`?`authorization server metadata (RFC 8414 §3.3)`:`authorization response (RFC 9207)`}: expected ${JSON.stringify(t)}, received ${JSON.stringify(n)}`),this.kind=e,this.expected=t,this.received=n}},av=class extends rv{static{Object.defineProperty(this,`mcpBrand`,{value:`mcp.RegistrationRejectedError`})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`),this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},ov=class extends rv{static{Object.defineProperty(this,`mcpBrand`,{value:`mcp.InsecureTokenEndpointError`})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},sv=class extends rv{static{Object.defineProperty(this,`mcpBrand`,{value:`mcp.AuthorizationServerMismatchError`})}constructor(e,t){super(`Authorization server changed between redirect and callback (redirected to ${JSON.stringify(e)}, callback resolved ${JSON.stringify(t)}); refusing to send authorization_code/code_verifier to a different token endpoint`),this.recordedIssuer=e,this.currentIssuer=t}},cv=class extends rv{static{Object.defineProperty(this,`mcpBrand`,{value:`mcp.InsufficientScopeError`})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:``}`),this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}};function lv(e,t,n){if(e!==void 0)return e.issuer===void 0?(n?.canPersistStamp!==!1&&console.warn(`[mcp-sdk] SEP-2352: stored OAuth credential has no 'issuer' stamp (pre-upgrade storage or provider not round-tripping the value). SEP-2352 isolation is inactive for this read; ensure your provider round-trips the issuer field.`),e):uv(e.issuer,t)?e:void 0}function uv(e,t){return e===t||e.endsWith(`/`)&&e.slice(0,-1)===t||t.endsWith(`/`)&&t.slice(0,-1)===e}function dv(e){if(e==null)return!1;let t=e;return typeof t.tokens==`function`&&typeof t.clientInformation==`function`}async function fv(e,t,n){let{resourceMetadataUrl:r,scope:i}=Rv(t.response);if(await Nv(e,{serverUrl:t.serverUrl,resourceMetadataUrl:r,scope:i,fetchFn:t.fetchFn,...n})!==`AUTHORIZED`)throw new mv}function pv(e,t){return{token:async()=>(await e.tokens())?.access_token,onUnauthorized:async n=>fv(e,n,t)}}var mv=class extends Error{static{Object.defineProperty(this,`mcpBrand`,{value:`mcp.UnauthorizedError`})}static[Symbol.hasInstance](e){return $d(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 $d(this,e)}constructor(e){super(e??`Unauthorized`),this.name=`UnauthorizedError`,Qd(this,new.target)}};function hv(e){return e?.authorization_response_iss_parameter_supported===!0}function gv({iss:e,expectedIssuer:t,issParameterSupported:n}){if(t!==void 0){if(e===void 0){if(n)throw new iv(`authorization_response`,t,void 0);return}if(e!==t)throw new iv(`authorization_response`,t,e)}}function _v(...e){let t=new Set;for(let n of e){if(!n)continue;for(let e of n.split(/\s+/))e&&t.add(e)}return t.size>0?[...t].join(` `):void 0}function vv(e,t){if(!e)return!1;let n=new Set((t??``).split(/\s+/).filter(Boolean));for(let t of e.split(/\s+/))if(t&&!n.has(t))return!0;return!1}async function yv(e,t,n,r,i){if(typeof e==`string`)return{authorizationCode:e,iss:t};let a=e.get(`iss`)??void 0,o=e.get(`code`);if(o)return{authorizationCode:o,iss:a};let s=(await n.discoveryState?.())?.authorizationServerMetadata;if(!s)try{s=(await Jv(r,i)).authorizationServerMetadata}catch{s=void 0}if(!s)throw new mv(`Authorization callback failed and the issuer could not be verified`);gv({iss:a,expectedIssuer:s.issuer,issParameterSupported:hv(s)});let c=e.get(`error`);throw c?new tf(c,e.get(`error_description`)??c,e.get(`error_uri`)??void 0):new mv("Authorization callback contained neither `code` nor `error`")}function bv(e){return[`client_secret_basic`,`client_secret_post`,`none`].includes(e)}const xv=`code`,Sv=`S256`;function Cv(e,t){let n=e.client_secret!==void 0;return`token_endpoint_auth_method`in e&&e.token_endpoint_auth_method&&bv(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method))?e.token_endpoint_auth_method:t.length===0?n?`client_secret_basic`:`none`:n&&t.includes(`client_secret_basic`)?`client_secret_basic`:n&&t.includes(`client_secret_post`)?`client_secret_post`:t.includes(`none`)?`none`:n?`client_secret_post`:`none`}function wv(e,t,n,r){let{client_id:i,client_secret:a}=t;switch(e){case`client_secret_basic`:Tv(i,a,n);return;case`client_secret_post`:Ev(i,a,r);return;case`none`:Dv(i,r);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}function Tv(e,t,n){if(!t)throw Error(`client_secret_basic authentication requires a client_secret`);let r=btoa(`${e}:${t}`);n.set(`Authorization`,`Basic ${r}`)}function Ev(e,t,n){n.set(`client_id`,e),t&&n.set(`client_secret`,t)}function Dv(e,t){t.set(`client_id`,e)}function Ov(e){return e===`localhost`||e===`127.0.0.1`||e===`[::1]`||e===`::1`}function kv(e){let t=new URL(String(e));if(t.protocol!==`https:`&&!Ov(t.hostname))throw new ov(t.href);return t}function Av(e){for(let t of e??[]){let e;try{e=new URL(t)}catch{continue}if(e.protocol!==`http:`&&e.protocol!==`https:`||Ov(e.hostname))return`native`}return`web`}function jv(e){let t=e.clientMetadata;return{...t,grant_types:t.grant_types??(e.redirectUrl===void 0?void 0:[`authorization_code`,`refresh_token`]),application_type:t.application_type??Av(t.redirect_uris)}}async function Mv(e){let t=e instanceof Response?e.status:void 0,n=e instanceof Response?await e.text():e;try{let e=kd.parse(JSON.parse(n));return tf.fromResponse(e)}catch(e){let r=`${t?`HTTP ${t}: `:``}Invalid OAuth error response: ${e}. Raw body: ${n}`;return new tf(ef.ServerError,r)}}async function Nv(e,t){try{return await Fv(e,t)}catch(n){if(n instanceof tf){if(n.code===ef.InvalidClient||n.code===ef.UnauthorizedClient)return await e.invalidateCredentials?.(`client`),await e.invalidateCredentials?.(`tokens`),await Fv(e,t);if(n.code===ef.InvalidGrant)return await e.invalidateCredentials?.(`tokens`),await Fv(e,t)}throw n}}function Pv(e){let{requestedScope:t,resourceMetadata:n,authServerMetadata:r,clientMetadata:i}=e,a=t||n?.scopes_supported?.join(` `)||i.scope;return a&&r?.scopes_supported?.includes(`offline_access`)&&!a.split(` `).includes(`offline_access`)&&i.grant_types?.includes(`refresh_token`)&&(a=`${a} offline_access`),a}async function Fv(e,{serverUrl:t,authorizationCode:n,iss:r,scope:i,resourceMetadataUrl:a,fetchFn:o,skipIssuerMetadataValidation:s,forceReauthorization:c}){let l=jv(e),u=await e.discoveryState?.(),d,f,p,m,h=a;if(!h&&u?.resourceMetadataUrl&&(h=new URL(u.resourceMetadataUrl)),u?.authorizationServerUrl){if(f=u.authorizationServerUrl,d=u.resourceMetadata,p=u.authorizationServerMetadata??await qv(f,{fetchFn:o,skipIssuerValidation:s}),!d)try{d=await Bv(t,{resourceMetadataUrl:h},o)}catch(e){if(e instanceof TypeError)throw e}(p!==u.authorizationServerMetadata||d!==u.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(f),resourceMetadataUrl:h?.toString(),resourceMetadata:d,authorizationServerMetadata:p})}else{let e=await Jv(t,{resourceMetadataUrl:h,fetchFn:o,skipIssuerMetadataValidation:s});f=e.authorizationServerUrl,p=e.authorizationServerMetadata,d=e.resourceMetadata,m={authorizationServerUrl:String(f),resourceMetadataUrl:h?.toString(),resourceMetadata:d,authorizationServerMetadata:p}}let g=p?.issuer??String(f),_={issuer:g};if(await e.saveAuthorizationServerUrl?.(g),n!==void 0){let t=u?.authorizationServerMetadata?.issuer??u?.authorizationServerUrl;if(t===void 0){if(e.saveDiscoveryState!==void 0)throw new sv(`discoveryState was not available on the callback leg; ensure your provider persists discoveryState alongside codeVerifier`,g);console.warn(`[mcp-sdk] OAuthClientProvider does not implement saveDiscoveryState()/discoveryState(); the SEP-2352 callback-leg authorization-server binding cannot be checked. Implement discoveryState (persist alongside codeVerifier) — see docs/migration/upgrade-to-v2.md §SEP-2352.`)}else if(!uv(t,g))throw new sv(t,g)}m&&await e.saveDiscoveryState?.(m);let v=await Lv(t,e,d);v&&await e.saveResourceUrl?.(String(v));let y=Pv({requestedScope:i,resourceMetadata:d,authServerMetadata:p,clientMetadata:e.clientMetadata}),b=await Promise.resolve(e.clientInformation(_)),x=lv(b,g,{canPersistStamp:e.saveClientInformation!==void 0});if(x===void 0&&b?.issuer&&e.saveClientInformation===void 0)throw new sv(b.issuer,g);if(x&&x.issuer===void 0&&(x={...x,issuer:g},await e.saveClientInformation?.(x,_)),!x){if(n!==void 0)throw Error(`Existing OAuth client information is required when exchanging an authorization code`);let t=p?.client_id_metadata_document_supported===!0,r=e.clientMetadataUrl;if(r&&!Iv(r))throw new tf(ef.InvalidClientMetadata,`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${r}`);if(t&&r)x={client_id:r,issuer:g},await e.saveClientInformation?.(x,_);else{if(!e.saveClientInformation)throw Error(`OAuth client information must be saveable for dynamic registration`);x={...await ty(f,{metadata:p,clientMetadata:l,scope:y,fetchFn:o}),issuer:g},await e.saveClientInformation(x,_)}}let ee=!e.redirectUrl;if(n!==void 0||ee){n!==void 0&&gv({iss:r,expectedIssuer:p?.issuer,issParameterSupported:hv(p)});let t=await ey(e,f,{metadata:p,resource:v,authorizationCode:n,iss:r,scope:y,fetchFn:o});return await e.saveTokens({...t,issuer:g},_),`AUTHORIZED`}let te=lv(await e.tokens(_),g);if(te&&te.issuer===void 0&&(te={...te,issuer:g},await e.saveTokens(te,_)),te?.refresh_token&&!c)try{let t=await $v(f,{metadata:p,clientInformation:x,refreshToken:te.refresh_token,resource:v,addClientAuthentication:e.addClientAuthentication,fetchFn:o});return await e.saveTokens({...t,issuer:g},_),`AUTHORIZED`}catch(e){if(e instanceof ov||!(!(e instanceof tf)||e.code===ef.ServerError))throw e}let ne=e.state?await e.state():void 0,{authorizationUrl:re,codeVerifier:ie}=await Yv(f,{metadata:p,clientInformation:x,state:ne,redirectUrl:e.redirectUrl,scope:y,resource:v});return await e.saveCodeVerifier(ie),await e.redirectToAuthorization(re),`REDIRECT`}function Iv(e){if(!e)return!1;try{let t=new URL(e);return t.protocol===`https:`&&t.pathname!==`/`}catch{return!1}}async function Lv(e,t,n){let r=rf(e);if(t.validateResourceURL)return await t.validateResourceURL(r,n?.resource);if(n){if(!af({requestedResource:r,configuredResource:n.resource}))throw Error(`Protected resource ${n.resource} does not match expected ${r} (or origin)`);return new URL(n.resource)}}function Rv(e){let t=e.headers.get(`WWW-Authenticate`);if(!t)return{};let[n,r]=t.split(` `);if(n?.toLowerCase()!==`bearer`||!r)return{};let i=zv(e,`resource_metadata`)||void 0,a;if(i)try{a=new URL(i)}catch{}let o=zv(e,`scope`)||void 0,s=zv(e,`error`)||void 0,c=zv(e,`error_description`)||void 0;return{resourceMetadataUrl:a,scope:o,error:s,errorDescription:c}}function zv(e,t){let n=e.headers.get(`WWW-Authenticate`);if(!n)return null;let r=new RegExp(String.raw`${t}=(?:"([^"]+)"|([^\s,]+))`),i=n.match(r);if(i){let e=i[1]||i[2];if(e)return e}return null}async function Bv(e,t,n=fetch){let r=await Gv(e,`oauth-protected-resource`,n,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!r||r.status===404)throw await r?.text?.().catch(()=>{}),Error(`Resource server does not implement OAuth 2.0 Protected Resource Metadata.`);if(!r.ok)throw await r.text?.().catch(()=>{}),Error(`HTTP ${r.status} trying to load well-known OAuth protected resource metadata.`);return Cd.parse(await r.json())}async function Vv(e,t,n=fetch){try{return await n(e,{headers:t})}catch(r){if(!(r instanceof TypeError)||!0)throw r;if(t)try{return await n(e,{})}catch(e){if(!(e instanceof TypeError))throw e;return}return}}function Hv(e,t=``,n={}){return t.endsWith(`/`)&&(t=t.slice(0,-1)),n.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function Uv(e,t,n=fetch){return await Vv(e,{"MCP-Protocol-Version":t},n)}function Wv(e,t){return e?t===`/`?!1:e.status>=400&&e.status<500||e.status===502:!0}async function Gv(e,t,n,r){let i=new URL(e),a=r?.protocolVersion??lc,o;if(r?.metadataUrl)o=new URL(r.metadataUrl);else{let e=Hv(t,i.pathname);o=new URL(e,r?.metadataServerUrl??i),o.search=i.search}let s=await Uv(o,a,n);return!r?.metadataUrl&&Wv(s,i.pathname)&&(s=await Uv(new URL(`/.well-known/${t}`,i),a,n)),s}function Kv(e){let t=typeof e==`string`?new URL(e):e,n=t.pathname!==`/`,r=[];if(!n)return r.push({url:new URL(`/.well-known/oauth-authorization-server`,t.origin),type:`oauth`},{url:new URL(`/.well-known/openid-configuration`,t.origin),type:`oidc`}),r;let i=t.pathname;return i.endsWith(`/`)&&(i=i.slice(0,-1)),r.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,t.origin),type:`oauth`},{url:new URL(`/.well-known/openid-configuration${i}`,t.origin),type:`oidc`},{url:new URL(`${i}/.well-known/openid-configuration`,t.origin),type:`oidc`}),r}async function qv(e,{fetchFn:t=fetch,protocolVersion:n=lc,skipIssuerValidation:r=!1}={}){let i={"MCP-Protocol-Version":n,Accept:`application/json`},a=Kv(e);for(let{url:n,type:o}of a){let a=await Vv(n,i,t);if(!a)continue;if(!a.ok){if(await a.text?.().catch(()=>{}),a.status>=400&&a.status<500||a.status===502)continue;throw Error(`HTTP ${a.status} trying to load ${o===`oauth`?`OAuth`:`OpenID provider`} metadata from ${n}`)}let s=o===`oauth`?wd.parse(await a.json()):Ed.parse(await a.json());if(!r){let t=typeof e==`string`?e:e.href;if(!(s.issuer===t||t.endsWith(`/`)&&s.issuer===t.slice(0,-1)))throw new iv(`metadata`,t,s.issuer)}return s}}async function Jv(e,t){let n,r;try{n=await Bv(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),n.authorization_servers&&n.authorization_servers.length>0&&(r=n.authorization_servers[0])}catch(e){if(e instanceof TypeError)throw e}r||=String(new URL(`/`,e));let i=await qv(r,{fetchFn:t?.fetchFn,skipIssuerValidation:t?.skipIssuerMetadataValidation});return{authorizationServerUrl:r,authorizationServerMetadata:i,resourceMetadata:n}}async function Yv(e,{metadata:t,clientInformation:n,redirectUrl:r,scope:i,state:a,resource:o}){let s;if(t){if(s=new URL(t.authorization_endpoint),!t.response_types_supported.includes(xv))throw Error(`Incompatible auth server: does not support response type ${xv}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(Sv))throw Error(`Incompatible auth server: does not support code challenge method ${Sv}`)}else s=new URL(`/authorize`,e);let c=await v_(),l=c.code_verifier,u=c.code_challenge;return s.searchParams.set(`response_type`,xv),s.searchParams.set(`client_id`,n.client_id),s.searchParams.set(`code_challenge`,u),s.searchParams.set(`code_challenge_method`,Sv),s.searchParams.set(`redirect_uri`,String(r)),a&&s.searchParams.set(`state`,a),i&&s.searchParams.set(`scope`,i),i?.split(` `).includes(`offline_access`)&&s.searchParams.append(`prompt`,`consent`),o&&s.searchParams.set(`resource`,o.href),{authorizationUrl:s,codeVerifier:l}}function Xv(e,t,n){return new URLSearchParams({grant_type:`authorization_code`,code:e,code_verifier:t,redirect_uri:String(n)})}async function Zv(e,{metadata:t,tokenRequestParams:n,clientInformation:r,addClientAuthentication:i,resource:a,fetchFn:o}){let s=kv(t?.token_endpoint??new URL(`/token`,e)),c=new Headers({"Content-Type":`application/x-www-form-urlencoded`,Accept:`application/json`});a&&n.set(`resource`,a.href),i?await i(c,n,s,t):r&&wv(Cv(r,t?.token_endpoint_auth_methods_supported??[]),r,c,n);let l=await(o??fetch)(s,{method:`POST`,headers:c,body:n});if(!l.ok)throw await Mv(l);let u=await l.json();try{return Dd.parse(u)}catch(e){throw typeof u==`object`&&u&&`error`in u?await Mv(JSON.stringify(u)):e}}async function Qv(e,{metadata:t,clientInformation:n,authorizationCode:r,iss:i,codeVerifier:a,redirectUri:o,resource:s,addClientAuthentication:c,fetchFn:l}){return gv({iss:i,expectedIssuer:t?.issuer,issParameterSupported:hv(t)}),Zv(e,{metadata:t,tokenRequestParams:Xv(r,a,o),clientInformation:n,addClientAuthentication:c,resource:s,fetchFn:l})}async function $v(e,{metadata:t,clientInformation:n,refreshToken:r,resource:i,addClientAuthentication:a,fetchFn:o}){return{refresh_token:r,...await Zv(e,{metadata:t,tokenRequestParams:new URLSearchParams({grant_type:`refresh_token`,refresh_token:r}),clientInformation:n,addClientAuthentication:a,resource:i,fetchFn:o})}}async function ey(e,t,{metadata:n,resource:r,authorizationCode:i,iss:a,scope:o,fetchFn:s}={}){i!==void 0&&gv({iss:a,expectedIssuer:n?.issuer,issParameterSupported:hv(n)});let c=o??e.clientMetadata.scope,l;if(e.prepareTokenRequest&&(l=await e.prepareTokenRequest(c)),!l){if(!i)throw Error(`Either provider.prepareTokenRequest() or authorizationCode is required`);if(!e.redirectUrl)throw Error(`redirectUrl is required for authorization_code flow`);l=Xv(i,await e.codeVerifier(),e.redirectUrl)}let u=await e.clientInformation({issuer:n?.issuer??String(t)});return Zv(t,{metadata:n,tokenRequestParams:l,clientInformation:u??void 0,addClientAuthentication:e.addClientAuthentication,resource:r,fetchFn:s})}async function ty(e,{metadata:t,clientMetadata:n,scope:r,fetchFn:i}){let a;if(t){if(!t.registration_endpoint)throw Error(`Incompatible auth server: does not support dynamic client registration`);a=new URL(t.registration_endpoint)}else a=new URL(`/register`,e);let o={...n,...r===void 0?{}:{scope:r}},s=await(i??fetch)(a,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(o)});if(!s.ok)throw new av({status:s.status,body:await s.text(),submittedMetadata:o});return Nd.parse(await s.json())}const ny=new Set([`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`server/discover`]);var ry=class{_entries=new Map;_maxEntries;_stamp=0;_cappedSize=0;constructor(e){this._maxEntries=e?.maxEntries??512}get size(){return this._entries.size}get(e){return this._entries.get(iy(e))}set(e,t){let n=iy(e),r=ny.has(e.method),i=!this._entries.has(n);if(!r&&i&&this._maxEntries>0&&this._cappedSize>=this._maxEntries){for(let e of this._entries.keys())if(!ny.has(e.slice(0,e.indexOf(`\0`)))){this._entries.delete(e),this._cappedSize--;break}}let a=++this._stamp;return this._entries.set(n,{...t,stamp:a}),i&&!r&&this._cappedSize++,a}delete(e){this._entries.delete(iy(e))&&!ny.has(e.method)&&this._cappedSize--}evict(e){let t=`${e}\0`,n=ny.has(e);for(let e of this._entries.keys())e.startsWith(t)&&(this._entries.delete(e),n||this._cappedSize--)}clear(){this._entries.clear(),this._cappedSize=0}};function iy(e){return`${e.method}\0${JSON.stringify([e.partition??``,e.params??``])}`}function ay(e,t){return t===void 0?e:`${e}\0${t}`}var oy=class{_evictionGeneration=new Map;_toolIndex;_toolOutputValidatorIndex;_serverIdentity=``;constructor(e,t,n=()=>{},r=``,i=Date.now){this._store=e,this._isUserSupplied=t,this._reportError=n,this._cachePartition=r,this._now=i}now(){return this._now()}setServerIdentity(e){this._serverIdentity=e}_partitionFor(e){return JSON.stringify([this._serverIdentity,e===`public`?``:this._cachePartition])}async _probe(e,t){let n={method:e,params:t??``},r=this._partitionFor(`private`),i=await this._store.get({...n,partition:r});if(i!==void 0)return i;let a=this._partitionFor(`public`);if(a===r)return;let o=await this._store.get({...n,partition:a});return o?.scope===`public`?o:void 0}async evict(e){this._evictionGeneration.set(e,(this._evictionGeneration.get(e)??0)+1),await this._deleteBoth(e,``)}async _deleteBoth(e,t){let n=this._partitionFor(`private`),r=this._partitionFor(`public`);try{await this._store.delete({method:e,params:t,partition:n})}catch(e){this._reportError(e)}if(r!==n)try{await this._store.delete({method:e,params:t,partition:r})}catch(e){this._reportError(e)}}async evictKey(e,t){let n=ay(e,t),r=this._evictionGeneration.get(n);r!==void 0&&this._evictionGeneration.set(n,r+1),await this._deleteBoth(e,t)}captureGeneration(e,t){let n=ay(e,t),r=this._evictionGeneration.get(n)??0;return this._evictionGeneration.set(n,r),r}async write(e,t,n,r){if((this._evictionGeneration.get(ay(e,r?.params))??0)!==n)return;let i=r?.params??``,a=this._partitionFor(`private`),o=this._partitionFor(`public`),s=(r?.scope??`private`)===`public`?o:a;try{await this._store.set({method:e,params:i,partition:s},{value:sy(t),expiresAt:r?.expiresAt,scope:r?.scope})}catch(e){this._reportError(e)}if(o!==a)try{await this._store.delete({method:e,params:i,partition:s===a?o:a})}catch(e){this._reportError(e)}}async read(e,t){let n=await this._probe(e,t);if(!(n?.expiresAt===void 0||!(n.expiresAt>this.now())))try{let e=JSON.parse(n.value);if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError(`cached document is not an object`);return{value:e}}catch(n){this._reportError(n),await this._deleteBoth(e,t??``);return}}resetForReconnect(){this._isUserSupplied||this._store.clear(),this._evictionGeneration.clear(),this._toolIndex=void 0,this._toolOutputValidatorIndex=void 0,this._serverIdentity=``}async toolDefinition(e){let t=await this._probe(`tools/list`);if(t===void 0){this._toolIndex=void 0;return}if(this._toolIndex?.stamp!==t.stamp){let e=this._decodeListTools(t),n=new Map;if(e!==void 0)for(let t of e.tools)n.set(t.name,t);this._toolIndex={stamp:t.stamp,byName:n}}return this._toolIndex.byName.get(e)}async outputValidator(e,t){let n=await this._probe(`tools/list`);if(n===void 0){this._toolOutputValidatorIndex=void 0;return}if(this._toolOutputValidatorIndex?.stamp!==n.stamp){let e=this._decodeListTools(n)??{tools:[]},r=new Map;for(let n of e.tools){let e=t(n);e!==void 0&&r.set(n.name,e)}this._toolOutputValidatorIndex={stamp:n.stamp,byName:r}}return this._toolOutputValidatorIndex.byName.get(e)}_decodeListTools(e){try{let t=JSON.parse(e.value);if(!Array.isArray(t?.tools)||!t.tools.every(e=>typeof e==`object`&&!!e))throw TypeError(`cached tools/list document has a malformed tools array`);return t}catch(e){this._reportError(e);return}}};function sy(e){let t;try{t=JSON.stringify(e)}catch(e){throw TypeError(`cache value is not JSON-serializable: ${e instanceof Error?e.message:String(e)}`)}if(typeof t!=`string`)throw TypeError(`cache value is not JSON-serializable: it has no JSON representation`);return t}const cy=Symbol.for(`mcp.authSeamEscape`);function ly(e){if(typeof e==`object`&&e||typeof e==`function`)try{Object.defineProperty(e,cy,{value:!0,configurable:!0})}catch{}return e}function uy(e){return(typeof e==`object`&&!!e||typeof e==`function`)&&e[cy]===!0}const dy=new Set([-32001,-32020,-32021]);function fy(e,t){switch(e.kind){case`result`:return py(e.result,t);case`rpc-error`:return my(e,t);case`http-error`:return hy(e,t);case`network-error`:return gy(e.error,t);case`auth-required`:return{kind:`error`,error:e.error};case`closed`:return t.transportKind===`stdio`?{kind:`legacy`}:gy(Error(`Connection closed during the version negotiation probe`),t);case`timeout`:return t.transportKind===`stdio`?{kind:`legacy`}:{kind:`error`,error:new q(K.RequestTimeout,`Version negotiation probe timed out after ${e.timeoutMs}ms`,{timeout:e.timeoutMs})}}}function py(e,t){let n=Ap(kp).validateResult(`server/discover`,e);if(!n.ok)return{kind:`legacy`};let r=n.value.supportedVersions,i=t.clientModernVersions.find(e=>r.includes(e));return i===void 0?t.fallbackAvailable?{kind:`legacy`}:{kind:`error`,error:new Zf({supported:[...r],requested:t.requestedVersion})}:{kind:`modern`,version:i,discover:n.value}}function my(e,t){let{code:n,message:r,data:i}=e;if(n===-32022){let e=yy(i);if(e===void 0)return{kind:`legacy`};let n=new Zf({supported:e,requested:by(i)??t.requestedVersion},r),a=df(e),o=t.clientModernVersions.find(e=>a.includes(e));return o===void 0?a.length>0?{kind:`error`,error:n}:t.fallbackAvailable?{kind:`legacy`}:{kind:`error`,error:n}:{kind:`corrective`,version:o,error:n}}return dy.has(n),{kind:`legacy`}}function hy(e,t){if(e.status===401||e.status===403){let t=e.status===403;return{kind:`error`,error:new nf(t?K.ClientHttpForbidden:K.ClientHttpAuthentication,`Version negotiation failed: ${t?`the server denied access (HTTP 403)`:`the server requires authorization (HTTP 401)`}`,{status:e.status,statusText:e.statusText,text:e.body})}}if(e.status>=500)return{kind:`error`,error:new nf(K.EraNegotiationFailed,`Version negotiation failed: the server answered the probe with HTTP ${e.status}`,{status:e.status,statusText:e.statusText,text:e.body})};let n=xy(e.body);return n===void 0?{kind:`legacy`}:my(n,t)}function gy(e,t){return t.environment===`browser`&&_y(e)?{kind:`legacy`}:{kind:`error`,error:new q(K.EraNegotiationFailed,`Version negotiation probe failed: ${vy(e)}`,{cause:e})}}function _y(e){return e instanceof TypeError||e instanceof Error&&e.name===`TypeError`}function vy(e){return e instanceof Error?e.message:String(e)}function yy(e){if(typeof e!=`object`||!e)return;let t=e.supported;if(!(!Array.isArray(t)||t.length===0||!t.every(e=>typeof e==`string`)))return t}function by(e){if(typeof e!=`object`||!e)return;let t=e.requested;return typeof t==`string`?t:void 0}function xy(e){if(e===void 0||e===``)return;let t;try{t=JSON.parse(e)}catch{return}if(typeof t!=`object`||!t)return;let n=t.error;if(typeof n!=`object`||!n)return;let{code:r,message:i,data:a}=n;if(typeof r==`number`)return{code:r,message:typeof i==`string`?i:``,data:a}}function Sy(e,t){let n=e?.mode??`legacy`;if(n===`legacy`)return{kind:`legacy`};let r=e?.probe??{};if(typeof n==`object`){if(!lf(n.pin))throw TypeError(`versionNegotiation: { pin: '${n.pin}' } is not a modern protocol revision — pinning is for 2026-07-28 and later; omit versionNegotiation (or use mode: 'legacy') for 2025-era servers.`);return{kind:`pin`,version:n.pin,probe:r}}let i=t?df(t):[];return{kind:`auto`,modernVersions:i.length>0?i:[...cf],fallbackAvailable:t?uf(t).length>0:!0,probe:r}}function Cy(){let e=globalThis;return e.window!==void 0&&e.document!==void 0?`browser`:`node`}function wy(e){return`stderr`in e&&`pid`in e?`stdio`:`http`}var Ty=class e{_pending;_probeCounter=0;_savedOnMessage;_savedOnError;_savedOnClose;_closeDelivered=!1;constructor(e){this._transport=e,this._savedOnMessage=e.onmessage,this._savedOnError=e.onerror,this._savedOnClose=e.onclose}static async open(t){let n=new e(t);t.onmessage=e=>{let t=n._pending;if(t!==void 0&&(Rp(e)||zp(e))&&e.id===t.id){n._pending=void 0,Rp(e)?t.resolve({kind:`response`,result:e.result}):t.resolve({kind:`response`,error:e.error});return}},t.onerror=e=>{n._savedOnError?.(e)},t.onclose=()=>{let e=n._pending;e!==void 0&&(n._pending=void 0,e.resolve({kind:`closed`})),n._closeDelivered=!0,n._savedOnClose?.()};try{await t.start()}catch(e){throw n.detach(),e}return n}async exchange(e,t){let n=`server-discover-probe-${++this._probeCounter}`;return new Promise(r=>{let i=!1,a=e=>{i||(i=!0,clearTimeout(o),this._pending?.id===n&&(this._pending=void 0),r(e))},o=setTimeout(()=>a({kind:`timeout`}),t);this._pending={id:n,resolve:a},this._transport.send(e(n)).catch(e=>a({kind:`send-error`,error:e}))})}detach(){if(this._pending=void 0,this._transport.onmessage=this._savedOnMessage,this._transport.onerror=this._savedOnError,this._closeDelivered&&this._savedOnClose!==void 0){let e=this._savedOnClose,t=this._transport,n=!1,r=()=>{if(!n){n=!0;return}e()};t.onclose=r,Ey.set(t,()=>{t.onclose===r&&(t.onclose=e)})}else this._transport.onclose=this._savedOnClose}release(){this.detach();let e=this._transport,t=e.start,n=!0;e.start=async function(){if(n){n=!1,e.start=t;return}return t.call(e)}}};const Ey=new WeakMap;function Dy(e){let t=Ey.get(e);Ey.delete(e),t?.()}function Oy(e,t,n,r){return{jsonrpc:`2.0`,id:e,method:`server/discover`,params:{_meta:Ap(t).outboundEnvelope({protocolVersion:t,clientInfo:n,clientCapabilities:r})}}}function ky(e,t){switch(e.kind){case`response`:return e.error===void 0?{kind:`result`,result:e.result}:{kind:`rpc-error`,...e.error};case`send-error`:{let t=e.error;if(uy(t)||t instanceof mv||t instanceof Error&&t.name===`UnauthorizedError`)return{kind:`auth-required`,error:t};if(t instanceof nf){let e=t.data?.text;return{kind:`http-error`,status:t.data.status,body:typeof e==`string`?e:void 0,statusText:t.data.statusText}}return{kind:`network-error`,error:t}}case`closed`:return{kind:`closed`};case`timeout`:return{kind:`timeout`,timeoutMs:t}}}async function Ay(e,t){let n=e.probe.timeoutMs??t.defaultTimeoutMs,r=Math.max(0,e.probe.maxRetries??0),i=e.kind===`pin`?[e.version]:e.modernVersions,a=e.kind===`auto`&&e.fallbackAvailable,o=await Ty.open(t.transport),s=async()=>{let s=i[0],c=!1,l=r;for(;;){let r=await o.exchange(e=>Oy(e,s,t.clientInfo,t.capabilities),n);if(r.kind===`timeout`&&l>0){l--;continue}let u=ky(r,n),d=fy(u,{clientModernVersions:i,requestedVersion:s,fallbackAvailable:a,environment:t.environment,transportKind:t.transportKind});switch(d.kind){case`modern`:return{era:`modern`,version:d.version,discover:d.discover};case`corrective`:if(c)throw d.error;c=!0,s=d.version;continue;case`legacy`:{let n=u.kind===`closed`?`the connection closed during the server/discover probe`:void 0;if(e.kind===`pin`)throw new q(K.EraNegotiationFailed,n===void 0?`Version negotiation failed: the server did not offer pinned protocol version ${e.version} via server/discover (no fallback in pin mode)`:`Version negotiation failed: ${n} before the server offered pinned protocol version ${e.version} (no fallback in pin mode)`);if(!e.fallbackAvailable)throw new q(K.EraNegotiationFailed,n===void 0?`Version negotiation failed: the server gave no modern evidence and this client supports no pre-2026-07-28 protocol version to fall back to`:`Version negotiation failed: ${n} and this client supports no pre-2026-07-28 protocol version to fall back to`);if(n!==void 0&&t.disposableProbe!==!0)throw new q(K.EraNegotiationFailed,`Version negotiation failed: ${n} (this transport probed in place — the disposable sibling probe requires the SDK's base StdioClientTransport)`);return{era:`legacy`}}case`error`:throw d.error}}},c;try{c=await s()}catch(e){throw o.detach(),e}return o.release(),c}function jy(e){let t=Object.getPrototypeOf(e);if(t===null||!Object.prototype.hasOwnProperty.call(t,`_dispose`))return;let n=e._serverParams;return typeof n==`object`&&n&&typeof n.command==`string`?n:void 0}async function My(e,t,n,r){let i=t.constructor,a=new i({...n,stderr:`ignore`}),o=t.close,s=!1,c,l=new Promise((e,t)=>{c=()=>t(Ny())});t.close=async function(){return s=!0,c?.(),o.call(t)};let u;try{let t=Ay(e,{...r,transport:a,transportKind:`stdio`,disposableProbe:!0});t.catch(()=>{}),u=await Promise.race([t,l])}finally{await Py(a),t.close=o}if(s)throw Ny();return u}function Ny(){return new q(K.EraNegotiationFailed,`Version negotiation failed: the transport was closed during the server/discover probe`)}async function Py(e){try{let t=e._dispose;await(typeof t==`function`?t.call(e):e.close())}catch{}}function Fy(e){let t=e._meta?.[mc];return Vm.Implementation(t)?t:void 0}function Iy(e,t){if(!(!e||typeof t!=`object`||!t)){if(e.type===`object`&&e.properties&&typeof e.properties==`object`){let n=t,r=e.properties;for(let e of Object.keys(r)){let t=r[e];n[e]===void 0&&Object.prototype.hasOwnProperty.call(t,`default`)&&(n[e]=t.default),n[e]!==void 0&&Iy(t,n[e])}}if(Array.isArray(e.anyOf))for(let n of e.anyOf)typeof n!=`boolean`&&Iy(n,t);if(Array.isArray(e.oneOf))for(let n of e.oneOf)typeof n!=`boolean`&&Iy(n,t)}}function Ly(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,n=e.url!==void 0;return{supportsFormMode:t||!t&&!n,supportsUrlMode:n}}function Ry(e){if(typeof e==`object`&&e&&(e.kind===`legacy`&&!(`supportedVersions`in e)&&!(`discover`in e)||e.kind===`modern`&&tl.safeParse(e.discover).success))return e;throw new q(K.EraNegotiationFailed,`connect({ prior }): unrecognized prior — expected { kind: 'modern', discover } or { kind: 'legacy' }`)}const zy={"notifications/tools/list_changed":[`tools/list`],"notifications/prompts/list_changed":[`prompts/list`],"notifications/resources/list_changed":[`resources/list`,`resources/templates/list`]};var By=class extends Xm{_serverCapabilities;_serverVersion;_capabilities;_instructions;_jsonSchemaValidator;_cache;_defaultCacheTtlMs;_listMaxPages;_listChangedDebounceTimers=new Map;_listChangedConfig;_enforceStrictCapabilities;_versionNegotiation;_supportedProtocolVersionsOption;_inputRequiredDriverConfig;_listenState=new Map;_nextListenId=0;_autoOpenedSubscription;_discoverResult;_resetConnectionState(){if(this._negotiatedProtocolVersion=void 0,this._serverCapabilities=void 0,this._serverVersion=void 0,this._instructions=void 0,this._discoverResult=void 0,this._autoOpenedSubscription=void 0,this._listenState.size>0){let e=new q(K.ConnectionClosed,`subscriptions/listen: client reconnected or closed; subscription state from the previous connection was reset`);for(let t of this._listenState.values())t.settle({cause:`remote`,error:e})}this._listenState.clear();for(let e of this._listChangedDebounceTimers.values())clearTimeout(e);this._listChangedDebounceTimers.clear(),this._cache.resetForReconnect()}async close(){try{await super.close()}finally{this._resetConnectionState()}}constructor(e,t){super(t),this._clientInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new f_,this._enforceStrictCapabilities=t?.enforceStrictCapabilities??!1,this._versionNegotiation=t?.versionNegotiation,this._supportedProtocolVersionsOption=t?.supportedProtocolVersions,this._inputRequiredDriverConfig=Am(t?.inputRequired),this._cache=new oy(t?.responseCacheStore??new ry,t?.responseCacheStore!==void 0,e=>this._reportStoreError(e),t?.cachePartition??``),this._defaultCacheTtlMs=t?.defaultCacheTtlMs??0,this._listMaxPages=t?.listMaxPages??64,t?.listChanged&&(this._listChangedConfig=t.listChanged)}buildContext(e,t){return e}_shouldDropInbound(e){if(this._negotiatedProtocolVersion!==void 0&&lf(this._negotiatedProtocolVersion)&&Ip(e))return`drop`}_outboundMetaEnvelope(){let e=this._negotiatedProtocolVersion;if(e!==void 0)return this._wireCodec().outboundEnvelope({protocolVersion:e,clientInfo:this._clientInfo,clientCapabilities:this._capabilities})}_resolveNonCompleteResult(e,t){return this._inputRequiredDriverConfig.autoFulfill?ah({getRequestHandler:e=>this._getRequestHandler(e),buildContext:e=>this.buildContext(e,void 0),sessionId:this.transport?.sessionId},this._inputRequiredDriverConfig,e,t):Promise.reject(new q(K.UnsupportedResultType,`Unsupported result type 'input_required' for ${t.request.method}: multi-round-trip auto-fulfilment is not enabled on this instance — pass allowInputRequired: true to handle it manually, or enable inputRequired.autoFulfill`,{resultType:`input_required`,method:t.request.method}))}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler(`tools`,`notifications/tools/list_changed`,e.tools,async()=>(await this.listTools(void 0,{cacheMode:`refresh`})).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler(`prompts`,`notifications/prompts/list_changed`,e.prompts,async()=>(await this.listPrompts(void 0,{cacheMode:`refresh`})).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler(`resources`,`notifications/resources/list_changed`,e.resources,async()=>(await this.listResources(void 0,{cacheMode:`refresh`})).resources)}registerCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after connecting to transport`);this._capabilities=Qm(this._capabilities,e)}setVersionNegotiation(e){if(this.transport)throw Error(`Cannot configure version negotiation after connecting to transport`);this._versionNegotiation=e}_wrapHandler(e,t){return e===`elicitation/create`?async(e,n)=>{let r=Ap(this._negotiatedProtocolVersion),i=r.validateRequest(`elicitation/create`,e);if(!i.ok&&i.reason===`not-in-era`&&(i=r.validateInputRequest(`elicitation/create`,e)),!i.ok)throw new Y(i.reason===`not-in-era`?J.InternalError:J.InvalidParams,i.reason===`not-in-era`?`No wire schema for elicitation/create in the resolved era`:`Invalid elicitation request: ${i.message}`);let{params:a}=i.value;a.mode=a.mode??`form`;let{supportsFormMode:o,supportsUrlMode:s}=Ly(this._capabilities.elicitation);if(a.mode===`form`&&!o)throw new Y(J.InvalidParams,`Client does not support form-mode elicitation requests`);if(a.mode===`url`&&!s)throw new Y(J.InvalidParams,`Client does not support URL-mode elicitation requests`);let c=await t(e,n),l=r.validateResult(`elicitation/create`,c);if(!l.ok&&l.reason===`not-in-era`&&(l=r.validateInputResponse(`elicitation/create`,c)),!l.ok)throw new Y(l.reason===`not-in-era`?J.InternalError:J.InvalidParams,l.reason===`not-in-era`?`No wire schema for elicitation/create in the resolved era`:`Invalid elicitation result: ${l.message}`);let u=l.value,d=a.mode===`form`?a.requestedSchema:void 0;if(a.mode===`form`&&u.action===`accept`&&u.content&&d&&this._capabilities.elicitation?.form?.applyDefaults)try{Iy(d,u.content)}catch{}return u}:e===`sampling/createMessage`?async(e,n)=>{let r=Ap(this._negotiatedProtocolVersion),i=r.validateRequest(`sampling/createMessage`,e);if(!i.ok&&i.reason===`not-in-era`&&(i=r.validateInputRequest(`sampling/createMessage`,e)),!i.ok)throw new Y(i.reason===`not-in-era`?J.InternalError:J.InvalidParams,i.reason===`not-in-era`?`No wire schema for sampling/createMessage in the resolved era`:`Invalid sampling request: ${i.message}`);let{params:a}=i.value,o=await t(e,n),s=!!(a.tools||a.toolChoice),c=r.samplingResultVariant(s,o);if(!c.ok&&c.reason===`not-in-era`&&(c=r.validateInputResponse(`sampling/createMessage`,o)),!c.ok)throw new Y(c.reason===`not-in-era`?J.InternalError:J.InvalidParams,c.reason===`not-in-era`?`No result schema for sampling/createMessage in the resolved era`:`Invalid sampling result: ${c.message}`);return c.value}:t}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new q(K.CapabilityNotSupported,`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(t?.prior!=null)return this._connectFromPrior(e,Ry(t.prior),t);let n=Sy(this._versionNegotiation,this._supportedProtocolVersionsOption);return n.kind===`legacy`?this._connectPlainLegacy(e,t):this._connectNegotiated(e,n,t)}async _connectPlainLegacy(e,t){if(await super.connect(e),e.sessionId!==void 0){let t=this._negotiatedProtocolVersion;t!==void 0&&e.setProtocolVersion?.(t);return}this._resetConnectionState(),await this._legacyHandshake(e,t)}async _legacyHandshake(e,t){let n=uf(this._supportedProtocolVersions);try{let r=n[0];if(r===void 0)throw new q(K.EraNegotiationFailed,`Cannot run the initialize handshake: supportedProtocolVersions contains no pre-2026-07-28 protocol version`);let i=await this.request({method:`initialize`,params:{protocolVersion:r,capabilities:this._capabilities,clientInfo:this._clientInfo}},t);if(i===void 0)throw Error(`Server sent invalid initialize result: ${i}`);if(!n.includes(i.protocolVersion))throw Error(`Server's protocol version is not supported: ${i.protocolVersion}`);this._serverCapabilities=i.capabilities,this._serverVersion=i.serverInfo,this._cache.setServerIdentity(this._deriveServerIdentity(e)),e.setProtocolVersion&&e.setProtocolVersion(i.protocolVersion),this._instructions=i.instructions,await this.notification({method:`notifications/initialized`}),this._negotiatedProtocolVersion=i.protocolVersion,this._listChangedConfig&&this._setupListChangedHandlers(this._listChangedConfig)}catch(e){throw this.close(),e}}async _connectNegotiated(e,t,n){if(e.sessionId!==void 0){await super.connect(e);let t=this._negotiatedProtocolVersion;t!==void 0&&e.setProtocolVersion&&e.setProtocolVersion(t);return}this._resetConnectionState();let r;try{let i=wy(e),a={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:Cy(),defaultTimeoutMs:n?.timeout??Um},o=i===`stdio`?jy(e):void 0;r=o===void 0?await Ay(t,{...a,transport:e,transportKind:i}):await My(t,e,o,a)}catch(t){throw await e.close().catch(()=>{}),Dy(e),t}if(Dy(e),await super.connect(e),r.era===`legacy`){await this._legacyHandshake(e,n);return}if(this._serverCapabilities=r.discover.capabilities,this._serverVersion=Fy(r.discover),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=r.discover.instructions,this._discoverResult=r.discover,this._negotiatedProtocolVersion=r.version,e.setProtocolVersion&&e.setProtocolVersion(r.version),this._listChangedConfig){let e=this._listChangedConfig,t=this._serverCapabilities,r={...e.tools&&t?.tools?.listChanged&&{tools:e.tools},...e.prompts&&t?.prompts?.listChanged&&{prompts:e.prompts},...e.resources&&t?.resources?.listChanged&&{resources:e.resources}},i=!0;try{this._setupListChangedHandlers(r)}catch(e){i=!1,this.onerror?.(e instanceof Error?e:Error(String(e)))}let a=i?{...r.tools&&{toolsListChanged:!0},...r.prompts&&{promptsListChanged:!0},...r.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(a).length>0){let e=new AbortController,t=()=>e.abort(n?.signal?.reason);n?.signal?.aborted&&t(),n?.signal?.addEventListener(`abort`,t);try{this._autoOpenedSubscription=await this.listen(a,{timeout:n?.timeout,signal:e.signal})}catch(e){if(n?.signal?.aborted)throw await this.close().catch(()=>{}),e;this.onerror?.(e instanceof Error?e:Error(String(e)))}finally{n?.signal?.removeEventListener(`abort`,t)}}}}async _connectFromPrior(e,t,n){if(t.kind===`legacy`)return this._connectPlainLegacy(e,n);let r=t.discover;this._resetConnectionState();let i=this._supportedProtocolVersionsOption,a=(i&&df(i).length>0?df(i):cf).find(e=>r.supportedVersions.includes(e));if(a===void 0)throw new q(K.EraNegotiationFailed,`connect({ prior }) with a modern verdict requires a 2026-07-28+ mutual protocol version; the supplied DiscoverResult and this client's supportedProtocolVersions have no modern overlap. For a server known to be legacy, pass prior: { kind: 'legacy' } to skip the probe and initialize directly, or use versionNegotiation: { mode: 'auto' } to re-probe with legacy fallback.`);if(await super.connect(e),this._discoverResult=r,this._serverCapabilities=r.capabilities,this._serverVersion=Fy(r),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=r.instructions,this._negotiatedProtocolVersion=a,e.setProtocolVersion?.(a),this._listChangedConfig)try{this._setupListChangedHandlers(this._listChangedConfig)}catch(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}_deriveServerIdentity(e){let t=this._serverVersion;return t===void 0?e.sessionId??`anonymous:${Date.now()}-${Math.random().toString(36).slice(2)}`:`${t.name}@${t.version}`}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}getProtocolEra(){let e=this._negotiatedProtocolVersion;if(e!==void 0)return lf(e)?`modern`:`legacy`}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(e){switch(e){case`logging/setLevel`:if(!this._serverCapabilities?.logging)throw new q(K.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case`prompts/get`:case`prompts/list`:if(!this._serverCapabilities?.prompts)throw new q(K.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case`resources/list`:case`resources/templates/list`:case`resources/read`:case`resources/subscribe`:case`resources/unsubscribe`:if(!this._serverCapabilities?.resources)throw new q(K.CapabilityNotSupported,`Server does not support resources (required for ${e})`);if(e===`resources/subscribe`&&!this._serverCapabilities.resources.subscribe)throw new q(K.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${e})`);break;case`tools/call`:case`tools/list`:if(!this._serverCapabilities?.tools)throw new q(K.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case`completion/complete`:if(!this._serverCapabilities?.completions)throw new q(K.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case`initialize`:break;case`server/discover`:break;case`ping`:break}}assertNotificationCapability(e){switch(e){case`notifications/roots/list_changed`:if(!this._capabilities.roots?.listChanged)throw new q(K.CapabilityNotSupported,`Client does not support roots list changed notifications (required for ${e})`);break;case`notifications/initialized`:break;case`notifications/cancelled`:break;case`notifications/progress`:break}}assertRequestHandlerCapability(e){switch(e){case`sampling/createMessage`:if(!this._capabilities.sampling)throw new q(K.CapabilityNotSupported,`Client does not support sampling capability (required for ${e})`);break;case`elicitation/create`:if(!this._capabilities.elicitation)throw new q(K.CapabilityNotSupported,`Client does not support elicitation capability (required for ${e})`);break;case`roots/list`:if(!this._capabilities.roots)throw new q(K.CapabilityNotSupported,`Client does not support roots capability (required for ${e})`);break;case`ping`:break}}async ping(e){return this.request({method:`ping`},e)}async discover(e){let t=await this._requestWithSchema({method:`server/discover`},tl,e);return this._discoverResult=t,t}async complete(e,t){return this.request({method:`completion/complete`,params:e},t)}async setLoggingLevel(e,t){return this.request({method:`logging/setLevel`,params:{level:e}},t)}async getPrompt(e,t){return this.request({method:`prompts/get`,params:e},t)}async listPrompts(e,t){if(!this._serverCapabilities?.prompts&&!this._enforceStrictCapabilities)return console.debug(`Client.listPrompts() called but server does not advertise prompts capability - returning empty list`),{prompts:[]};if(e?.cursor!==void 0)return this.request({method:`prompts/list`,params:e},t);let n=await this._serveFromCache(`prompts/list`,void 0,t);return n===void 0?this._listAllPages(`prompts/list`,e,t,(e,t)=>e.prompts.push(...t.prompts)):n}async listResources(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug(`Client.listResources() called but server does not advertise resources capability - returning empty list`),{resources:[]};if(e?.cursor!==void 0)return this.request({method:`resources/list`,params:e},t);let n=await this._serveFromCache(`resources/list`,void 0,t);return n===void 0?this._listAllPages(`resources/list`,e,t,(e,t)=>e.resources.push(...t.resources)):n}async listResourceTemplates(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug(`Client.listResourceTemplates() called but server does not advertise resources capability - returning empty list`),{resourceTemplates:[]};if(e?.cursor!==void 0)return this.request({method:`resources/templates/list`,params:e},t);let n=await this._serveFromCache(`resources/templates/list`,void 0,t);return n===void 0?this._listAllPages(`resources/templates/list`,e,t,(e,t)=>e.resourceTemplates.push(...t.resourceTemplates)):n}async _listAllPages(e,t,n,r,i){let a=n?.cacheMode===`bypass`,o=this._cache.captureGeneration(e),s=await this.request({method:e,...t&&{params:{...t}}},n),c=s.nextCursor,l=new Set,u=1;for(;c!==void 0&&!l.has(c);){if(this._listMaxPages!==0&&u>=this._listMaxPages)throw new q(K.ListPaginationExceeded,`${e}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:e,listMaxPages:this._listMaxPages});l.add(c);let i=await this.request({method:e,params:{...t,cursor:c}},n);r(s,i),c=i.nextCursor,u++}return delete s.nextCursor,i?.(s),a||await this._cache.write(e,s,o,this._freshness(s)),s}_freshness(e,t){let n=e,r=typeof n.ttlMs==`number`?n.ttlMs:this._defaultCacheTtlMs,i=n.cacheScope===`public`?`public`:`private`;return{expiresAt:this._cache.now()+Math.min(Math.max(0,r),864e5),scope:i,params:t}}async _serveFromCache(e,t,n){if(n?.cacheMode===`bypass`||n?.cacheMode===`refresh`)return;let r=await this._cache.read(e,t).catch(e=>void this._reportStoreError(e));if(r!==void 0){if(n?.signal?.aborted){let e=n.signal.reason;throw e instanceof q?e:new q(K.RequestTimeout,String(e))}return r.value}}_reportStoreError(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}_compileOutputValidator(e){if(e.outputSchema)try{return{ok:!0,validator:this._jsonSchemaValidator.getValidator(e.outputSchema)}}catch(e){return{ok:!1,compileError:e}}}async _resolveXMcpHeaderScan(e,t){let n=t??await this._cache.toolDefinition(e);return n===void 0?void 0:Kp(n.inputSchema)}async readResource(e,t){let n=await this._serveFromCache(`resources/read`,e.uri,t);if(n!==void 0)return n;let r=this._cache.captureGeneration(`resources/read`,e.uri),i=await this.request({method:`resources/read`,params:e},t);if(t?.cacheMode!==`bypass`){let n=this._freshness(i,e.uri);n.expiresAt>this._cache.now()?await this._cache.write(`resources/read`,i,r,n):t?.cacheMode===`refresh`&&await this._cache.evictKey(`resources/read`,e.uri)}return i}async subscribeResource(e,t){return this.request({method:`resources/subscribe`,params:e},t)}async unsubscribeResource(e,t){return this.request({method:`resources/unsubscribe`,params:e},t)}async listen(e,t){if(this.transport===void 0)throw new q(K.NotConnected,`Not connected`);let n=this._negotiatedProtocolVersion;if(n===void 0||!lf(n))throw new q(K.MethodNotSupportedByProtocolVersion,`subscriptions/listen requires a 2026-07-28-era connection (negotiated: ${n??`none`}). On a 2025-era connection, change notifications are delivered unsolicited: use ClientOptions.listChanged and resources/subscribe instead.`,{method:`subscriptions/listen`,protocolVersion:n});if(t?.signal?.aborted){let e=t.signal.reason;throw e instanceof q?e:new q(K.RequestTimeout,String(e))}let r=new AbortController,i=`listen:${this._nextListenId++}`,a=`opening`,o,s,c,l,u=new Promise((e,t)=>{c=e,l=t}),d,f=new Promise(e=>{d=e}),p=e=>{if(a===`closed`)return;let n=a===`opening`;if(o!==void 0&&(clearTimeout(o),o=void 0),`ack`in e){a=`open`,c(e.ack);return}a=`closed`,s!==void 0&&t?.signal?.removeEventListener(`abort`,s),this._listenState.delete(i),r.abort(),d(e.cause),n&&l(e.error??new q(K.ConnectionClosed,`subscriptions/listen closed before the server acknowledged`))},m=async()=>{r.abort(),await this.notification({method:`notifications/cancelled`,params:{requestId:i}}).catch(()=>{})},h=async()=>{a!==`closed`&&(p({cause:`local`}),await m())};this._listenState.set(i,{settle:p});let g=t?.timeout??Um;if(o=setTimeout(()=>{p({cause:`remote`,error:new q(K.RequestTimeout,`subscriptions/listen ack timed out`,{timeout:g})}),m().catch(()=>{})},g),t?.signal){let e=t.signal;s=()=>{if(a===`closed`)return;let t=e.reason;p({cause:`local`,error:t instanceof Error?t:Error(String(t??`Aborted`))}),m().catch(()=>{})},e.addEventListener(`abort`,s,{once:!0})}let _={jsonrpc:`2.0`,id:i,method:`subscriptions/listen`,params:{_meta:{...this._outboundMetaEnvelope()},notifications:e}};try{await this.transport.send(_,{requestSignal:r.signal,onRequestStreamEnd:()=>p({cause:`remote`,error:Error(`subscriptions/listen: stream ended`)})})}catch(e){p({cause:`remote`,error:e instanceof Error?e:Error(String(e))})}return{honoredFilter:await u,close:h,closed:f}}get autoOpenedSubscription(){return this._autoOpenedSubscription}_onnotification(e,t){let n=Object.hasOwn(zy,e.method)?zy[e.method]:void 0;if(e.method===`notifications/resources/updated`){let t=e.params?.uri;typeof t==`string`&&this._cache.evictKey(`resources/read`,t)}else if(n!==void 0)for(let e of n)this._cache.evict(e);if(e.method===`notifications/subscriptions/acknowledged`){let t=e.params?._meta?.[gc],n=typeof t==`string`?this._listenState.get(t):void 0;if(n!==void 0){let t=this._wireCodec().validateNotification(`notifications/subscriptions/acknowledged`,e);n.settle({ack:t.ok?t.value.params.notifications:{}});return}}if(e.method===`notifications/cancelled`){let t=e.params?.requestId,n=typeof t==`string`?this._listenState.get(t):void 0;if(n!==void 0){n.settle({cause:`remote`,error:Error(`subscriptions/listen: server cancelled the subscription`)});return}}super._onnotification(e,t)}_onresponse(e){let t=e.id,n=typeof t==`string`?this._listenState.get(t):void 0;if(n!==void 0){zp(e)?n.settle({cause:`remote`,error:Y.fromError(e.error.code,e.error.message,e.error.data)}):n.settle({cause:`graceful`,error:new q(K.ConnectionClosed,`subscriptions/listen: server closed the subscription gracefully before acknowledging`)});return}super._onresponse(e)}_onclose(){if(this._listenState.size>0){let e=new q(K.ConnectionClosed,`Connection closed`);for(let t of this._listenState.values())t.settle({cause:`remote`,error:e});this._listenState.clear()}super._onclose()}async callTool(e,t){let n=this.getProtocolEra()===`modern`&&Cy()!==`browser`,r=async()=>{if(!n)return t;let r;try{r=await this._resolveXMcpHeaderScan(e.name,t?.toolDefinition)}catch(e){this._reportStoreError(e)}if(!r?.valid||r.declarations.length===0)return t;let i=nm(r.declarations,e.arguments);return Object.keys(i).length===0?t:{...t,headers:{...t?.headers,...i}}},i=t?.toolDefinition===void 0?await this._cache.outputValidator(e.name,e=>this._compileOutputValidator(e)).catch(e=>void this._reportStoreError(e)):this._compileOutputValidator(t.toolDefinition),a=()=>{if(i===void 0||i.ok)return;let t=i.compileError,n=(t instanceof Error?t.message:String(t)).slice(0,200);throw new Y(J.InvalidParams,`Tool '${e.name}' has an invalid outputSchema: ${n}`)};a();let o;try{o=await this.request({method:`tools/call`,params:e},await r())}catch(s){let c=s instanceof Y&&s.code===-32020;if(!n||!c||t?.toolDefinition!==void 0)throw s;let l={signal:t?.signal,timeout:t?.timeout,cacheMode:`refresh`};await this._cache.evict(`tools/list`),await this.listTools(void 0,l).catch(e=>this._reportStoreError(e)),i=await this._cache.outputValidator(e.name,e=>this._compileOutputValidator(e)).catch(e=>void this._reportStoreError(e)),a(),o=await this.request({method:`tools/call`,params:e},await r())}let s=i!==void 0&&i.ok?i.validator:void 0;if(s){if(o.structuredContent===void 0&&!o.isError)throw new Y(J.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(o.structuredContent!==void 0&&!o.isError)try{let e=s(o.structuredContent);if(!e.valid)throw new Y(J.InvalidParams,`Structured content does not match the tool's output schema: ${e.errorMessage}`)}catch(e){throw e instanceof Y?e:new Y(J.InvalidParams,`Failed to validate structured content: ${e instanceof Error?e.message:String(e)}`)}}return o}async listTools(e,t){if(!this._serverCapabilities?.tools&&!this._enforceStrictCapabilities)return console.debug(`Client.listTools() called but server does not advertise tools capability - returning empty list`),{tools:[]};if(e?.cursor!==void 0){let n=await this.request({method:`tools/list`,params:e},t);return this._excludeInvalidXMcpHeaderTools(n),n}let n=await this._serveFromCache(`tools/list`,void 0,t);return n===void 0?this._listAllPages(`tools/list`,e,t,(e,t)=>e.tools.push(...t.tools),e=>this._excludeInvalidXMcpHeaderTools(e)):n}_excludeInvalidXMcpHeaderTools(e){if(this.getProtocolEra()!==`modern`||!this.transport||wy(this.transport)===`stdio`)return;let t=e.tools.filter(e=>{let t=Kp(e.inputSchema);return t.valid?!0:(console.warn(`[mcp-sdk] excluding tool '${e.name}' from tools/list: invalid x-mcp-header declaration — ${t.reason}`),!1)});t.length!==e.tools.length&&(e.tools=t)}_setupListChangedHandler(e,t,n,r){let i=rm(du,n);if(!i.success)throw Error(`Invalid ${e} listChanged options: ${i.error.message}`);if(typeof n.onChanged!=`function`)throw TypeError(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:a,debounceMs:o}=i.data,{onChanged:s}=n,c=async()=>{if(!a){s(null,null);return}try{s(null,await r())}catch(e){s(e instanceof Error?e:Error(String(e)),null)}};this.setNotificationHandler(t,()=>{if(o){let t=this._listChangedDebounceTimers.get(e);t&&clearTimeout(t);let n=setTimeout(c,o);this._listChangedDebounceTimers.set(e,n)}else c()})}async sendRootsListChanged(){return this.notification({method:`notifications/roots/list_changed`})}},Vy=class extends Error{static{Object.defineProperty(this,`mcpBrand`,{value:`mcp.SseError`})}static[Symbol.hasInstance](e){return $d(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 $d(this,e)}constructor(e,t,n){super(`SSE error: ${t}`),this.code=e,this.event=n,Qd(this,new.target)}},Hy=class{_eventSource;_endpoint;_abortController;_url;_resourceMetadataUrl;_scope;_eventSourceInit;_requestInit;_authProvider;_oauthProvider;_skipIssuerMetadataValidation;_fetch;_fetchWithInit;_protocolVersion;onclose;onerror;onmessage;constructor(e,t){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=t?.eventSourceInit,this._requestInit=t?.requestInit,this._skipIssuerMetadataValidation=t?.skipIssuerMetadataValidation,dv(t?.authProvider)?(this._oauthProvider=t.authProvider,this._authProvider=pv(t.authProvider,{skipIssuerMetadataValidation:t.skipIssuerMetadataValidation})):this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=ph(t?.fetch,t?.requestInit)}_last401Response;async _commonHeaders(){let e={},t;try{t=await this._authProvider?.token()}catch(e){throw ly(e)}t&&(e.Authorization=`Bearer ${t}`),this._protocolVersion&&(e[`mcp-protocol-version`]=this._protocolVersion);let n=fh(this._requestInit?.headers);return new Headers({...e,...n})}_startOrAuth(){let e=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((t,n)=>{this._eventSource=new ev(this._url.href,{...this._eventSourceInit,fetch:async(t,n)=>{let r=await this._commonHeaders();r.set(`Accept`,`text/event-stream`);let i=await e(t,{...n,headers:r});if(i.status===401&&(this._last401Response=i,i.headers.has(`www-authenticate`))){let{resourceMetadataUrl:e,scope:t}=Rv(i);this._resourceMetadataUrl=e,this._scope=t}return i}}),this._abortController=new AbortController,this._eventSource.onerror=e=>{if(e.code===401&&this._authProvider){if(this._authProvider.onUnauthorized&&this._last401Response){let e=this._last401Response;this._last401Response=void 0,this._eventSource?.close(),this._authProvider.onUnauthorized({response:e,serverUrl:this._url,fetchFn:this._fetchWithInit}).then(()=>this._startOrAuth().then(t,n),e=>{ly(e),this.onerror?.(e),n(e)});return}let e=ly(new mv);n(e),this.onerror?.(e);return}let r=new Vy(e.code,e.message,e);n(r),this.onerror?.(r)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener(`endpoint`,e=>{let r=e;try{if(this._endpoint=new URL(r.data,this._url),this._endpoint.origin!==this._url.origin)throw Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(e){n(e),this.onerror?.(e),this.close();return}t()}),this._eventSource.onmessage=e=>{let t=e,n;try{n=Fc.parse(JSON.parse(t.data))}catch(e){this.onerror?.(e);return}this.onmessage?.(n)}})}async start(){if(this._eventSource)throw Error(`SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.`);return await this._startOrAuth()}async finishAuth(e,t){if(!this._oauthProvider)throw new mv(`finishAuth requires an OAuthClientProvider`);let{authorizationCode:n,iss:r}=await yv(e,t,this._oauthProvider,this._url,{fetchFn:this._fetchWithInit,resourceMetadataUrl:this._resourceMetadataUrl});if(await Nv(this._oauthProvider,{serverUrl:this._url,authorizationCode:n,iss:r,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})!==`AUTHORIZED`)throw new mv(`Failed to authorize`)}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send(e){return this._send(e,!1)}async _send(e,t){if(!this._endpoint)throw new q(K.NotConnected,`Not connected`);try{let n=await this._commonHeaders();n.set(`content-type`,`application/json`);let r={...this._requestInit,method:`POST`,headers:n,body:JSON.stringify(e),signal:this._abortController?.signal},i=await(this._fetch??fetch)(this._endpoint,r);if(!i.ok){if(i.status===401&&this._authProvider){if(i.headers.has(`www-authenticate`)){let{resourceMetadataUrl:e,scope:t}=Rv(i);this._resourceMetadataUrl=e,this._scope=t}if(this._authProvider.onUnauthorized&&!t){try{await this._authProvider.onUnauthorized({response:i,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(e){throw ly(e)}return await i.text?.().catch(()=>{}),this._send(e,!0)}throw await i.text?.().catch(()=>{}),ly(t?new nf(K.ClientHttpAuthentication,`Server returned 401 after re-authentication`,{status:401,statusText:i.statusText}):new mv)}let n=await i.text?.().catch(()=>null);throw Error(`Error POSTing to endpoint (HTTP ${i.status}): ${n}`)}await i.text?.().catch(()=>{})}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}};const Uy={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},Wy=new Set([`authorization`,`content-type`,`mcp-protocol-version`,`mcp-method`,`mcp-name`,`mcp-session-id`]);function Gy(e,t){if(typeof AbortSignal.any==`function`)return AbortSignal.any([e,t]);let n=new AbortController;if(e.aborted)return n.abort(e.reason),n.signal;if(t.aborted)return n.abort(t.reason),n.signal;let r=()=>{e.removeEventListener(`abort`,i),t.removeEventListener(`abort`,a)};function i(){r(),n.abort(e.reason)}function a(){r(),n.abort(t.reason)}return e.addEventListener(`abort`,i,{once:!0}),t.addEventListener(`abort`,a,{once:!0}),n.signal}var Ky=class{_abortController;_url;_resourceMetadataUrl;_scope;_requestInit;_authProvider;_oauthProvider;_skipIssuerMetadataValidation;_fetch;_fetchWithInit;_sessionId;_reconnectionOptions;_protocolVersion;_onInsufficientScope;_maxStepUpRetries;_serverRetryMs;_reconnectionScheduler;_cancelReconnection;onclose;onerror;onmessage;hasPerRequestStream=!0;constructor(e,t){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._skipIssuerMetadataValidation=t?.skipIssuerMetadataValidation,dv(t?.authProvider)?(this._oauthProvider=t.authProvider,this._authProvider=pv(t.authProvider,{skipIssuerMetadataValidation:t.skipIssuerMetadataValidation})):this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=ph(t?.fetch,t?.requestInit),this._sessionId=t?.sessionId,this._protocolVersion=t?.protocolVersion,this._reconnectionOptions=t?.reconnectionOptions??Uy,this._reconnectionScheduler=t?.reconnectionScheduler,this._onInsufficientScope=t?.onInsufficientScope??`reauthorize`,this._maxStepUpRetries=Math.max(0,t?.maxStepUpRetries??1)}async _stepUpAuthorize(e,t){try{return await this._stepUpAuthorizeInner(e,t)}catch(e){throw ly(e)}}async _stepUpAuthorizeInner(e,t){if(this._onInsufficientScope===`throw`||!this._oauthProvider)throw new cv({requiredScope:e.scope,resourceMetadataUrl:e.resourceMetadataUrl,errorDescription:e.errorDescription});if(t>=this._maxStepUpRetries)throw new nf(K.ClientHttpForbidden,`Server returned 403 insufficient_scope after step-up re-authorization (retry limit ${this._maxStepUpRetries} reached)`,{status:403,statusText:e.statusText??`Forbidden`,text:e.text});e.resourceMetadataUrl&&(this._resourceMetadataUrl=e.resourceMetadataUrl);let n=await this._oauthProvider.tokens(),r=_v(this._scope,n?.scope,e.scope);this._scope=r;let i=vv(r,n?.scope);return Nv(this._oauthProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:r,forceReauthorization:i,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})}async _commonHeaders(){let e={},t;try{t=await this._authProvider?.token()}catch(e){throw ly(e)}t&&(e.Authorization=`Bearer ${t}`),this._sessionId&&(e[`mcp-session-id`]=this._sessionId),this._protocolVersion&&(e[`mcp-protocol-version`]=this._protocolVersion);let n=fh(this._requestInit?.headers);return new Headers({...e,...n})}_applyBodyDerivedHeaders(e,t){if(Array.isArray(t)||!Ip(t))return;let n=t.params?._meta?.[fc];if(typeof n!=`string`)return;e.set(`mcp-protocol-version`,n),e.set(`mcp-method`,t.method);let r=t.params,i=t.method===`resources/read`?typeof r?.uri==`string`?r.uri:void 0:typeof r?.name==`string`?r.name:void 0;i!==void 0&&e.set(`mcp-name`,em(i))}_isModernEnvelopedRequest(e){if(Array.isArray(e)||!Ip(e))return!1;let t=e.params?._meta?.[fc];return typeof t==`string`&&lf(t)}async _startOrAuthSse(e,t=!1,n=0){let{resumptionToken:r,requestSignal:i}=e,a=()=>this._abortController?.signal.aborted===!0||i?.aborted===!0;try{let a=await this._commonHeaders(),o=[...a.get(`accept`)?.split(`,`).map(e=>e.trim().toLowerCase())??[],`text/event-stream`];a.set(`accept`,[...new Set(o)].join(`, `)),r&&a.set(`last-event-id`,r);let s=this._abortController?.signal,c=i!==void 0&&s!==void 0?Gy(s,i):i??s,l=await(this._fetch??fetch)(this._url,{...this._requestInit,method:`GET`,headers:a,signal:c});if(!l.ok){if(l.status===401&&this._authProvider){if(l.headers.has(`www-authenticate`)){let{resourceMetadataUrl:e,scope:t}=Rv(l);this._resourceMetadataUrl=e,this._scope=_v(this._scope,t)}if(this._authProvider.onUnauthorized&&!t){try{await this._authProvider.onUnauthorized({response:l,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(e){throw ly(e)}return await l.text?.().catch(()=>{}),this._startOrAuthSse(e,!0,n)}throw await l.text?.().catch(()=>{}),ly(t?new nf(K.ClientHttpAuthentication,`Server returned 401 after re-authentication`,{status:401,statusText:l.statusText}):new mv)}if(l.status===403){let{resourceMetadataUrl:r,scope:i,error:a,errorDescription:o}=Rv(l);if(a===`insufficient_scope`){let a=await l.text?.().catch(()=>null);if(await this._stepUpAuthorize({scope:i,resourceMetadataUrl:r,errorDescription:o,statusText:l.statusText,text:a},n)!==`AUTHORIZED`)throw ly(new mv);return this._startOrAuthSse(e,t,n+1)}}if(await l.text?.().catch(()=>{}),l.status===405){e.onRequestStreamEnd?.();return}throw new nf(K.ClientHttpFailedToOpenStream,`Failed to open SSE stream: ${l.statusText}`,{status:l.status,statusText:l.statusText})}this._handleSseStream(l.body,e,!0)}catch(e){throw a()||this.onerror?.(e),e}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let t=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,r=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*n**+e,r)}_scheduleReconnection(e,t=0){let n=this._reconnectionOptions.maxRetries;if(t>=n){this.onerror?.(Error(`Maximum reconnection attempts (${n}) exceeded.`)),e.onRequestStreamEnd?.();return}let r=this._getNextReconnectionDelay(t),i=()=>{this._cancelReconnection=void 0,!(this._abortController?.signal.aborted||e.requestSignal?.aborted)&&this._startOrAuthSse(e).catch(n=>{if(!(this._abortController?.signal.aborted||e.requestSignal?.aborted)){this.onerror?.(Error(`Failed to reconnect SSE stream: ${n instanceof Error?n.message:String(n)}`));try{this._scheduleReconnection(e,t+1)}catch(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}}})};if(this._reconnectionScheduler){let e=this._reconnectionScheduler(i,r,t);this._cancelReconnection=typeof e==`function`?e:void 0}else{let e=setTimeout(i,r);this._cancelReconnection=()=>clearTimeout(e)}}_handleSseStream(e,t,n){if(!e){t.onRequestStreamEnd?.();return}let{onresumptiontoken:r,replayMessageId:i,requestSignal:a,onRequestStreamEnd:o}=t,s=()=>this._abortController?.signal.aborted===!0||a?.aborted===!0,c,l=!1,u=!1;(async()=>{try{let t=e.pipeThrough(new TextDecoderStream).pipeThrough(new nv({onRetry:e=>{this._serverRetryMs=e}})).getReader();for(;;){let{value:e,done:n}=await t.read();if(n)break;if(e.id&&(c=e.id,l=!0,r?.(e.id)),e.data&&(!e.event||e.event===`message`))try{let t=Fc.parse(JSON.parse(e.data));(Rp(t)||zp(t))&&(u=!0,i!==void 0&&(t.id=i)),this.onmessage?.(t)}catch(e){this.onerror?.(e)}}(n||l)&&!u&&this._abortController&&!s()?this._scheduleReconnection({resumptionToken:c,onresumptiontoken:r,replayMessageId:i,requestSignal:a,onRequestStreamEnd:o},0):s()||o?.()}catch(e){if(s())return;if(this.onerror?.(Error(`SSE stream disconnected: ${e}`)),(n||l)&&!u&&this._abortController&&!s())try{this._scheduleReconnection({resumptionToken:c,onresumptiontoken:r,replayMessageId:i,requestSignal:a,onRequestStreamEnd:o},0)}catch(e){this.onerror?.(Error(`Failed to reconnect: ${e instanceof Error?e.message:String(e)}`)),o?.()}else o?.()}})()}async start(){if(this._abortController)throw Error(`StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.`);this._abortController=new AbortController}async finishAuth(e,t){if(!this._oauthProvider)throw new mv(`finishAuth requires an OAuthClientProvider`);let{authorizationCode:n,iss:r}=await yv(e,t,this._oauthProvider,this._url,{fetchFn:this._fetchWithInit,resourceMetadataUrl:this._resourceMetadataUrl});if(await Nv(this._oauthProvider,{serverUrl:this._url,authorizationCode:n,iss:r,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})!==`AUTHORIZED`)throw new mv(`Failed to authorize`)}async close(){try{this._cancelReconnection?.()}finally{this._cancelReconnection=void 0,this._abortController?.abort(),this.onclose?.()}}async send(e,t){return this._send(e,t,!1)}async _send(e,t,n,r=0){try{let{resumptionToken:i,onresumptiontoken:a}=t||{};if(i){this._startOrAuthSse({resumptionToken:i,replayMessageId:Ip(e)?e.id:void 0,requestSignal:t?.requestSignal}).catch(e=>this.onerror?.(e));return}let o=await this._commonHeaders();this._applyBodyDerivedHeaders(o,e);let s=Array.isArray(e)?e.some(e=>Vp(e)):Vp(e);if(s&&o.delete(`mcp-session-id`),t?.headers!==void 0)for(let[e,n]of Object.entries(t.headers)){if(Wy.has(e.toLowerCase()))continue;o.set(e,n)}o.set(`content-type`,`application/json`);let c=[...o.get(`accept`)?.split(`,`).map(e=>e.trim().toLowerCase())??[],`application/json`,`text/event-stream`];o.set(`accept`,[...new Set(c)].join(`, `));let l=this._abortController?.signal,u=t?.requestSignal!==void 0&&l!==void 0?Gy(l,t.requestSignal):t?.requestSignal??l,d={...this._requestInit,method:`POST`,headers:o,body:JSON.stringify(e),signal:u},f=await(this._fetch??fetch)(this._url,d);if(s&&f.ok&&(this._sessionId=f.headers.get(`mcp-session-id`)||void 0),!f.ok){if(f.status===401&&this._authProvider){if(f.headers.has(`www-authenticate`)){let{resourceMetadataUrl:e,scope:t}=Rv(f);this._resourceMetadataUrl=e,this._scope=_v(this._scope,t)}if(this._authProvider.onUnauthorized&&!n){try{await this._authProvider.onUnauthorized({response:f,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(e){throw ly(e)}return await f.text?.().catch(()=>{}),this._send(e,t,!0,r)}throw await f.text?.().catch(()=>{}),ly(n?new nf(K.ClientHttpAuthentication,`Server returned 401 after re-authentication`,{status:401,statusText:f.statusText}):new mv)}let i=await f.text?.().catch(()=>null);if(f.status===403){let{resourceMetadataUrl:a,scope:o,error:s,errorDescription:c}=Rv(f);if(s===`insufficient_scope`){if(await this._stepUpAuthorize({scope:o,resourceMetadataUrl:a,errorDescription:c,statusText:f.statusText,text:i},r)!==`AUTHORIZED`)throw ly(new mv);return this._send(e,t,n,r+1)}}if(f.status===400&&typeof i==`string`&&this._isModernEnvelopedRequest(e))try{let t=Fc.parse(JSON.parse(i)),n=(Array.isArray(e)?e:[e]).filter(e=>Ip(e));if(zp(t)&&n.some(e=>e.id===t.id)){this.onmessage?.(t);return}}catch{}throw new nf(K.ClientHttpNotImplemented,`Error POSTing to endpoint: ${i}`,{status:f.status,statusText:f.statusText,text:i})}if(f.status===202){await f.text?.().catch(()=>{}),Hp(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(e=>this.onerror?.(e));return}let p=(Array.isArray(e)?e:[e]).some(e=>`method`in e&&`id`in e&&e.id!==void 0),m=f.headers.get(`content-type`),h=ch(m);if(p)if(h===`text/event-stream`)this._handleSseStream(f.body,{onresumptiontoken:a,requestSignal:t?.requestSignal,onRequestStreamEnd:t?.onRequestStreamEnd},!1);else if(h===`application/json`){let e=await f.json(),t=Array.isArray(e)?e.map(e=>Fc.parse(e)):[Fc.parse(e)];for(let e of t)this.onmessage?.(e)}else throw await f.text?.().catch(()=>{}),new q(K.ClientHttpUnexpectedContent,`Unexpected content type: ${m}`,{contentType:m});else await f.text?.().catch(()=>{})}catch(e){throw t?.requestSignal?.aborted!==!0&&this.onerror?.(e),e}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),t={...this._requestInit,method:`DELETE`,headers:e,signal:this._abortController?.signal},n=await(this._fetch??fetch)(this._url,t);if(await n.text?.().catch(()=>{}),!n.ok&&n.status!==405)throw new nf(K.ClientHttpFailedToTerminateSession,`Failed to terminate session: ${n.statusText}`,{status:n.status,statusText:n.statusText});this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}};function qy(e){let t=typeof e==`string`?new URL(e):new URL(e.toString());return t.pathname.length>1&&t.pathname.endsWith(`/`)&&(t.pathname=t.pathname.slice(0,-1)),t.toString()}export{ml as AnnotationsSchema,ql as AudioContentSchema,Hc as BaseMetadataSchema,Tc as BaseRequestParamsSchema,fl as BlobResourceContentsSchema,Ou as BooleanSchemaSchema,hc as CLIENT_CAPABILITIES_META_KEY,pc as CLIENT_INFO_META_KEY,cu as CallToolRequestParamsSchema,lu as CallToolRequestSchema,ou as CallToolResultSchema,md as CancelTaskRequestSchema,hd as CancelTaskResultSchema,Rc as CancelledNotificationParamsSchema,zc as CancelledNotificationSchema,By as Client,Jc as ClientCapabilitiesSchema,_d as ClientNotificationSchema,gd as ClientRequestSchema,vd as ClientResultSchema,Kc as ClientTasksCapabilitySchema,su as CompatibilityCallToolResultSchema,Yu as CompleteRequestParamsSchema,Xu as CompleteRequestSchema,Zu as CompleteResultSchema,Zl as ContentBlockSchema,wu as CreateMessageRequestParamsSchema,Tu as CreateMessageRequestSchema,Eu as CreateMessageResultSchema,Du as CreateMessageResultWithToolsSchema,ad as CreateTaskResultSchema,xc as CursorSchema,uc as DEFAULT_NEGOTIATED_PROTOCOL_VERSION,el as DiscoverRequestSchema,tl as DiscoverResultSchema,Bu as ElicitRequestFormParamsSchema,Hu as ElicitRequestParamsSchema,Uu as ElicitRequestSchema,Vu as ElicitRequestURLParamsSchema,Ku as ElicitResultSchema,Wu as ElicitationCompleteNotificationParamsSchema,Gu as ElicitationCompleteNotificationSchema,Yl as EmbeddedResourceSchema,Lc as EmptyResultSchema,Ru as EnumSchemaSchema,Ul as GetPromptRequestParamsSchema,Wl as GetPromptRequestSchema,$l as GetPromptResultSchema,ud as GetTaskPayloadRequestSchema,dd as GetTaskPayloadResultSchema,cd as GetTaskRequestSchema,ld as GetTaskResultSchema,Bc as IconSchema,Vc as IconsSchema,Od as IdJagTokenExchangeResponseSchema,Kl as ImageContentSchema,Uc as ImplementationSchema,Yc as InitializeRequestParamsSchema,Xc as InitializeRequestSchema,Qc as InitializeResultSchema,$c as InitializedNotificationSchema,yc as JSONArraySchema,H as JSONObjectSchema,Pc as JSONRPCErrorResponseSchema,Fc as JSONRPCMessageSchema,Mc as JSONRPCNotificationSchema,jc as JSONRPCRequestSchema,Ic as JSONRPCResponseSchema,Nc as JSONRPCResultResponseSchema,vc as JSONValueSchema,lc as LATEST_PROTOCOL_VERSION,_c as LOG_LEVEL_META_KEY,Nu as LegacyTitledEnumSchemaSchema,du as ListChangedOptionsBaseSchema,Vl as ListPromptsRequestSchema,Hl as ListPromptsResultSchema,yl as ListResourceTemplatesRequestSchema,bl as ListResourceTemplatesResultSchema,_l as ListResourcesRequestSchema,vl as ListResourcesResultSchema,$u as ListRootsRequestSchema,ed as ListRootsResultSchema,fd as ListTasksRequestSchema,pd as ListTasksResultSchema,iu as ListToolsRequestSchema,au as ListToolsResultSchema,fu as LoggingLevelSchema,hu as LoggingMessageNotificationParamsSchema,gu as LoggingMessageNotificationSchema,_u as ModelHintSchema,vu as ModelPreferencesSchema,Lu as MultiSelectEnumSchemaSchema,Oc as NotificationSchema,Dc as NotificationsParamsSchema,Au as NumberSchemaSchema,Nd as OAuthClientInformationFullSchema,Md as OAuthClientInformationSchema,jd as OAuthClientMetadataSchema,Pd as OAuthClientRegistrationErrorSchema,tf as OAuthError,ef as OAuthErrorCode,kd as OAuthErrorResponseSchema,wd as OAuthMetadataSchema,Cd as OAuthProtectedResourceMetadataSchema,Fd as OAuthTokenRevocationRequestSchema,Dd as OAuthTokensSchema,Ed as OpenIdProviderDiscoveryMetadataSchema,Td as OpenIdProviderMetadataSchema,fc as PROTOCOL_VERSION_META_KEY,ol as PaginatedRequestParamsSchema,sl as PaginatedRequestSchema,cl as PaginatedResultSchema,nl as PingRequestSchema,zu as PrimitiveSchemaDefinitionSchema,il as ProgressNotificationParamsSchema,al as ProgressNotificationSchema,rl as ProgressSchema,bc as ProgressTokenSchema,zl as PromptArgumentSchema,eu as PromptListChangedNotificationSchema,Ql as PromptMessageSchema,Ju as PromptReferenceSchema,Bl as PromptSchema,Y as ProtocolError,lh as ReadBuffer,Sl as ReadResourceRequestParamsSchema,Cl as ReadResourceRequestSchema,wl as ReadResourceResultSchema,Cc as RelatedTaskMetadataSchema,Ac as RequestIdSchema,wc as RequestMetaSchema,U as RequestSchema,ll as ResourceContentsSchema,Xl as ResourceLinkSchema,Tl as ResourceListChangedNotificationSchema,xl as ResourceRequestParamsSchema,hl as ResourceSchema,qu as ResourceTemplateReferenceSchema,gl as ResourceTemplateSchema,Ll as ResourceUpdatedNotificationParamsSchema,Rl as ResourceUpdatedNotificationSchema,kc as ResultMetaObjectSchema,W as ResultSchema,pl as RoleSchema,Qu as RootSchema,td as RootsListChangedNotificationSchema,mc as SERVER_INFO_META_KEY,Hy as SSEClientTransport,gc as SUBSCRIPTION_ID_META_KEY,dc as SUPPORTED_PROTOCOL_VERSIONS,xu as SamplingContentSchema,Su as SamplingMessageContentBlockSchema,Cu as SamplingMessageSchema,Zc as ServerCapabilitiesSchema,bd as ServerNotificationSchema,yd as ServerRequestSchema,xd as ServerResultSchema,qc as ServerTasksCapabilitySchema,pu as SetLevelRequestParamsSchema,mu as SetLevelRequestSchema,Pu as SingleSelectEnumSchemaSchema,Ky as StreamableHTTPClientTransport,ku as StringSchemaSchema,El as SubscribeRequestParamsSchema,Dl as SubscribeRequestSchema,Al as SubscriptionFilterSchema,Nl as SubscriptionsAcknowledgedNotificationParamsSchema,Pl as SubscriptionsAcknowledgedNotificationSchema,jl as SubscriptionsListenRequestParamsSchema,Ml as SubscriptionsListenRequestSchema,Fl as SubscriptionsListenResultMetaSchema,Il as SubscriptionsListenResultSchema,Ec as TaskAugmentedRequestParamsSchema,nd as TaskCreationParamsSchema,Sc as TaskMetadataSchema,id as TaskSchema,od as TaskStatusNotificationParamsSchema,sd as TaskStatusNotificationSchema,rd as TaskStatusSchema,Gl as TextContentSchema,ul as TextResourceContentsSchema,Iu as TitledMultiSelectEnumSchemaSchema,Mu as TitledSingleSelectEnumSchemaSchema,tu as ToolAnnotationsSchema,yu as ToolChoiceSchema,nu as ToolExecutionSchema,uu as ToolListChangedNotificationSchema,bu as ToolResultContentSchema,ru as ToolSchema,Jl as ToolUseContentSchema,mv as UnauthorizedError,Ol as UnsubscribeRequestParamsSchema,kl as UnsubscribeRequestSchema,Fu as UntitledMultiSelectEnumSchemaSchema,ju as UntitledSingleSelectEnumSchemaSchema,z as _enum,gs as _null,P as array,M as boolean,x_ as createParser,sc as date,oc as datetime,qv as discoverAuthorizationServerMetadata,Bv as discoverOAuthProtectedResourceMetadata,Es as discriminatedUnion,Uo as email,Qv as exchangeAuthorization,Os as intersection,$s as lazy,B as literal,I as looseObject,qy as normalizeUrl,j as number,F as object,V as optional,rc as preprocess,R as record,$v as refreshAuthorization,ty as registerClient,wo as safeParse,dh as serializeMessage,Yv as startAuthorization,k as string,vo as toJSONSchema,L as union,N as unknown,qo as url};
|
|
64
|
+
//# sourceMappingURL=normalizeUrl-DoppHGlo.js.map
|