@mcpcloud/runtime 0.15.0 → 0.15.1

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/stdio.js CHANGED
@@ -1,12 +1,12 @@
1
- /*! @mcpcloud/runtime v0.15.0 — (c) MCPCloud.sh. All rights reserved. SEE LICENSE: https://www.npmjs.com/package/@mcpcloud/runtime */
2
- var sg=Object.create;var{getPrototypeOf:ig,defineProperty:ga,getOwnPropertyNames:ag}=Object;var cg=Object.prototype.hasOwnProperty;function ug(e){return this[e]}var lg,dg,mg=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var o=t?lg??=new WeakMap:dg??=new WeakMap,s=o.get(e);if(s)return s}r=e!=null?sg(ig(e)):{};let a=t||!e||!e.__esModule?ga(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let i of ag(e))if(!cg.call(a,i))ga(a,i,{get:ug.bind(e,i),enumerable:!0})}if(n)o.set(e,a);return a};var pg=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var hg=(e)=>e;function fg(e,t){this[e]=hg.bind(null,t)}var Uo=(e,t)=>{for(var r in t)ga(e,r,{get:t[r],enumerable:!0,configurable:!0,set:fg.bind(t,r)})};var _a=(e,t)=>()=>(e&&(t=e(e=0)),t);var ir,Ku,la,ar,Ro;var da=_a(()=>{ir={JS_EVAL_TYPE_GLOBAL:0,JS_EVAL_TYPE_MODULE:1,JS_EVAL_TYPE_DIRECT:2,JS_EVAL_TYPE_INDIRECT:3,JS_EVAL_TYPE_MASK:3,JS_EVAL_FLAG_STRICT:8,JS_EVAL_FLAG_STRIP:16,JS_EVAL_FLAG_COMPILE_ONLY:32,JS_EVAL_FLAG_BACKTRACE_BARRIER:64},Ku={BaseObjects:1,Date:2,Eval:4,StringNormalize:8,RegExp:16,RegExpCompiler:32,JSON:64,Proxy:128,MapSet:256,TypedArrays:512,Promise:1024,BigInt:2048,BigFloat:4096,BigDecimal:8192,OperatorOverloading:16384,BignumExt:32768},la={Pending:0,Fulfilled:1,Rejected:2},ar={JS_GPN_STRING_MASK:1,JS_GPN_SYMBOL_MASK:2,JS_GPN_PRIVATE_MASK:4,JS_GPN_ENUM_ONLY:16,JS_GPN_SET_ENUM:32,QTS_GPN_NUMBER_MASK:64,QTS_STANDARD_COMPLIANT_NUMBER:128},Ro={IsStrictlyEqual:0,IsSameValue:1,IsSameValueZero:2}});function zo(...e){Xu&&console.log("quickjs-emscripten:",...e)}function*Zf(e){return yield e}function mb(e){return Zf(tl(e))}function kf(e,t){return(...r)=>{let n=t.call(e,el,...r);return tl(n)}}function pb(e,t){let r=t.call(e,el);return tl(r)}function tl(e){function t(r){return r.done?r.value:r.value instanceof Promise?r.value.then((n)=>t(e.next(n)),(n)=>t(e.throw(n))):t(e.next(r.value))}return t(e.next())}function Bu(e,t){let r;try{e.dispose()}catch(n){r=n}if(t&&r)throw Object.assign(t,{message:`${t.message}
3
- Then, failed to dispose scope: ${r.message}`,disposeError:r}),t;if(t||r)throw t||r}function hb(e){let t=e?Array.from(e):[];function r(){return t.forEach((o)=>o.alive?o.dispose():void 0)}function n(){return t.some((o)=>o.alive)}return Object.defineProperty(t,Wu,{configurable:!0,enumerable:!1,value:r}),Object.defineProperty(t,"dispose",{configurable:!0,enumerable:!1,value:r}),Object.defineProperty(t,"alive",{configurable:!0,enumerable:!1,get:n}),t}function pa(e){return!!(e&&(typeof e=="object"||typeof e=="function")&&("alive"in e)&&typeof e.alive=="boolean"&&("dispose"in e)&&typeof e.dispose=="function")}function Sb(e){if(!e)return 0;let t=0;for(let[r,n]of Object.entries(e)){if(!(r in Ku))throw new Lf(r);n&&(t|=Ku[r])}return t}function yb(e){if(typeof e=="number")return e;if(e===void 0)return 0;let{type:t,strict:r,strip:n,compileOnly:o,backtraceBarrier:s}=e,a=0;return t==="global"&&(a|=ir.JS_EVAL_TYPE_GLOBAL),t==="module"&&(a|=ir.JS_EVAL_TYPE_MODULE),r&&(a|=ir.JS_EVAL_FLAG_STRICT),n&&(a|=ir.JS_EVAL_FLAG_STRIP),o&&(a|=ir.JS_EVAL_FLAG_COMPILE_ONLY),s&&(a|=ir.JS_EVAL_FLAG_BACKTRACE_BARRIER),a}function vb(e){if(typeof e=="number")return e;if(e===void 0)return 0;let{strings:t,symbols:r,quickjsPrivate:n,onlyEnumerable:o,numbers:s,numbersAsStrings:a}=e,i=0;return t&&(i|=ar.JS_GPN_STRING_MASK),r&&(i|=ar.JS_GPN_SYMBOL_MASK),n&&(i|=ar.JS_GPN_PRIVATE_MASK),o&&(i|=ar.JS_GPN_ENUM_ONLY),s&&(i|=ar.QTS_GPN_NUMBER_MASK),a&&(i|=ar.QTS_STANDARD_COMPLIANT_NUMBER),i}function bb(...e){let t=[];for(let r of e)r!==void 0&&(t=t.concat(r));return t}function Yu(e){return e>>8}function ol(e,t){t.interruptHandler&&e.setInterruptHandler(t.interruptHandler),t.maxStackSizeBytes!==void 0&&e.setMaxStackSize(t.maxStackSizeBytes),t.memoryLimitBytes!==void 0&&e.setMemoryLimit(t.memoryLimitBytes)}function sl(e,t){t.moduleLoader&&e.setModuleLoader(t.moduleLoader),t.shouldInterrupt&&e.setInterruptHandler(t.shouldInterrupt),t.memoryLimitBytes!==void 0&&e.setMemoryLimit(t.memoryLimitBytes),t.maxStackSizeBytes!==void 0&&e.setMaxStackSize(t.maxStackSizeBytes)}var ab,cb=(e,t)=>{for(var r in t)ab(e,r,{get:t[r],enumerable:!0})},Xu=!1,ub,Gu,Af,Qu,jf,Mf,qf,lb,db,Lf,Df,Uf,Ff,Ft,el,bt,Wu,Of,Ye,cr,Cf,mt,rl,fb,gb,Yr,_b,Vf=class{constructor(e){this.module=e}toPointerArray(e){let t=new Int32Array(e.map((o)=>o.value)),r=t.length*t.BYTES_PER_ELEMENT,n=this.module._malloc(r);return new Uint8Array(this.module.HEAPU8.buffer,n,r).set(new Uint8Array(t.buffer)),new Ye(n,void 0,(o)=>this.module._free(o))}newTypedArray(e,t){let r=new e(Array(t).fill(0)),n=r.length*r.BYTES_PER_ELEMENT,o=this.module._malloc(n),s=new e(this.module.HEAPU8.buffer,o,t);return s.set(r),new Ye({typedArray:s,ptr:o},void 0,(a)=>this.module._free(a.ptr))}newMutablePointerArray(e){return this.newTypedArray(Int32Array,e)}newHeapCharPointer(e){let t=this.module.lengthBytesUTF8(e),r=t+1,n=this.module._malloc(r);return this.module.stringToUTF8(e,n,r),new Ye({ptr:n,strlen:t},void 0,(o)=>this.module._free(o.ptr))}newHeapBufferPointer(e){let t=e.byteLength,r=this.module._malloc(t);return this.module.HEAPU8.set(e,r),new Ye({pointer:r,numBytes:t},void 0,(n)=>this.module._free(n.pointer))}consumeHeapCharPointer(e){let t=this.module.UTF8ToString(e);return this.module._free(e),t}},Cw,Nw,Rb,Nf=-2147483648,xf=2147483647,ma=0,zb=class{constructor(){this.nextId=Nf,this.freelist=[],this.groups=new Map}put(e){let t=this.allocateId(),r=Yu(t),n=this.groups.get(r);return n||(n=new Map,this.groups.set(r,n)),n.set(t,e),t}get(e){if(e===ma)throw new Ft("no host reference id defined");let t=Yu(e),r=this.groups.get(t);if(!r)throw new Ft(`host reference id ${e} is not defined`);let n=r.get(e);if(!n)throw new Ft(`host reference id ${e} is not defined`);return n}delete(e){if(e===ma)throw new Ft("no host reference id defined");let t=Yu(e),r=this.groups.get(t);if(!r)throw new Ft(`host reference id ${e} is not defined`);r.delete(e),r.size===0&&this.groups.delete(t),this.freelist.push(e)}allocateId(){if(this.freelist.length>0)return this.freelist.shift();if(this.nextId===ma&&this.nextId++,this.nextId>xf)throw new Ff(`HostRefMap: too many host refs created without disposing. Max simultaneous host refs: ${xf-Nf}`);return this.nextId++}},If,wb,$b,Eb,Tb=class{constructor(e){this.freeHostRef=e.freeHostRef,this.callFunction=e.callFunction,this.shouldInterrupt=e.shouldInterrupt,this.loadModuleSource=e.loadModuleSource,this.normalizeModule=e.normalizeModule}},nl=class{constructor(e){this.contextCallbacks=new Map,this.runtimeCallbacks=new Map,this.suspendedCount=0,this.cToHostCallbacks=new Tb({freeHostRef:(t,r,n)=>{let o=this.runtimeCallbacks.get(r);if(!o)throw Error(`QuickJSRuntime(rt = ${r}) not found when trying to free HostRef(id = ${n})`);o.freeHostRef(r,n)},callFunction:(t,r,n,o,s,a)=>this.handleAsyncify(t,()=>{try{let i=this.contextCallbacks.get(r);if(!i)throw Error(`QuickJSContext(ctx = ${r}) not found for C function call "${a}"`);return i.callFunction(r,n,o,s,a)}catch(i){return console.error("[C to host error: returning null]",i),0}}),shouldInterrupt:(t,r)=>this.handleAsyncify(t,()=>{try{let n=this.runtimeCallbacks.get(r);if(!n)throw Error(`QuickJSRuntime(rt = ${r}) not found for C interrupt`);return n.shouldInterrupt(r)}catch(n){return console.error("[C to host interrupt: returning error]",n),1}}),loadModuleSource:(t,r,n,o)=>this.handleAsyncify(t,()=>{try{let s=this.runtimeCallbacks.get(r);if(!s)throw Error(`QuickJSRuntime(rt = ${r}) not found for C module loader`);let a=s.loadModuleSource;if(!a)throw Error(`QuickJSRuntime(rt = ${r}) does not support module loading`);return a(r,n,o)}catch(s){return console.error("[C to host module loader error: returning null]",s),0}}),normalizeModule:(t,r,n,o,s)=>this.handleAsyncify(t,()=>{try{let a=this.runtimeCallbacks.get(r);if(!a)throw Error(`QuickJSRuntime(rt = ${r}) not found for C module loader`);let i=a.normalizeModule;if(!i)throw Error(`QuickJSRuntime(rt = ${r}) does not support module loading`);return i(r,n,o,s)}catch(a){return console.error("[C to host module loader error: returning null]",a),0}})}),this.module=e,this.module.callbacks=this.cToHostCallbacks}setRuntimeCallbacks(e,t){this.runtimeCallbacks.set(e,t)}deleteRuntime(e){this.runtimeCallbacks.delete(e)}setContextCallbacks(e,t){this.contextCallbacks.set(e,t)}deleteContext(e){this.contextCallbacks.delete(e)}handleAsyncify(e,t){if(e)return e.handleSleep((n)=>{try{let o=t();if(!(o instanceof Promise)){zo("asyncify.handleSleep: not suspending:",o),n(o);return}if(this.suspended)throw new Mf(`Already suspended at: ${this.suspended.stack}
4
- Attempted to suspend at:`);this.suspended=new qf(`(${this.suspendedCount++})`),zo("asyncify.handleSleep: suspending:",this.suspended),o.then((s)=>{this.suspended=void 0,zo("asyncify.handleSleep: resolved:",s),n(s)},(s)=>{zo("asyncify.handleSleep: rejected:",s),console.error("QuickJS: cannot handle error in suspended function",s),this.suspended=void 0})}catch(o){throw zo("asyncify.handleSleep: error:",o),this.suspended=void 0,o}});let r=t();if(r instanceof Promise)throw Error("Promise return value not supported in non-asyncify context.");return r}},Jf=class{constructor(e,t){this.module=e,this.ffi=t,this.callbacks=new nl(e)}newRuntime(e={}){let t=new Ye(this.ffi.QTS_NewRuntime(),void 0,(n)=>{this.ffi.QTS_FreeRuntime(n),this.callbacks.deleteRuntime(n)}),r=new Eb({module:this.module,callbacks:this.callbacks,ffi:this.ffi,rt:t});return ol(r,e),e.moduleLoader&&r.setModuleLoader(e.moduleLoader),r}newContext(e={}){let t=this.newRuntime(),r=t.newContext({...e,ownedLifetimes:bb(t,e.ownedLifetimes)});return t.context=r,r}evalCode(e,t={}){return mt.withScope((r)=>{let n=r.manage(this.newContext());sl(n.runtime,t);let o=n.evalCode(e,"eval.js");if(t.memoryLimitBytes!==void 0&&n.runtime.setMemoryLimit(-1),o.error)throw n.dump(r.manage(o.error));return n.dump(r.manage(o.value))})}getWasmMemory(){let e=this.module.quickjsEmscriptenInit?.(()=>{})?.getWasmMemory?.();if(!e)throw Error("Variant does not support getting WebAssembly.Memory");return e}getFFI(){return this.ffi}};var Hf=_a(()=>{da();da();ab=Object.defineProperty;ub={};cb(ub,{QuickJSAsyncifyError:()=>Mf,QuickJSAsyncifySuspended:()=>qf,QuickJSEmptyGetOwnPropertyNames:()=>Uf,QuickJSEmscriptenModuleError:()=>db,QuickJSHostRefInvalid:()=>Ft,QuickJSHostRefRangeExceeded:()=>Ff,QuickJSMemoryLeakDetected:()=>lb,QuickJSNotImplemented:()=>jf,QuickJSPromisePending:()=>Df,QuickJSUnknownIntrinsic:()=>Lf,QuickJSUnwrapError:()=>Gu,QuickJSUseAfterFree:()=>Qu,QuickJSWrongOwner:()=>Af});Gu=class extends Error{constructor(e,t){let r=typeof e=="object"&&e&&"message"in e?String(e.message):String(e);super(r);this.cause=e,this.context=t,this.name="QuickJSUnwrapError"}},Af=class extends Error{constructor(){super(...arguments);this.name="QuickJSWrongOwner"}},Qu=class extends Error{constructor(){super(...arguments);this.name="QuickJSUseAfterFree"}},jf=class extends Error{constructor(){super(...arguments);this.name="QuickJSNotImplemented"}},Mf=class extends Error{constructor(){super(...arguments);this.name="QuickJSAsyncifyError"}},qf=class extends Error{constructor(){super(...arguments);this.name="QuickJSAsyncifySuspended"}},lb=class extends Error{constructor(){super(...arguments);this.name="QuickJSMemoryLeakDetected"}},db=class extends Error{constructor(){super(...arguments);this.name="QuickJSEmscriptenModuleError"}},Lf=class extends TypeError{constructor(){super(...arguments);this.name="QuickJSUnknownIntrinsic"}},Df=class extends Error{constructor(){super(...arguments);this.name="QuickJSPromisePending"}},Uf=class extends Error{constructor(){super(...arguments);this.name="QuickJSEmptyGetOwnPropertyNames"}},Ff=class extends Error{constructor(){super(...arguments);this.name="QuickJSHostRefRangeExceeded"}},Ft=class extends Error{constructor(){super(...arguments);this.name="QuickJSHostRefInvalid"}};el=Zf;el.of=mb;bt=class{[Symbol.dispose](){return this.dispose()}},Wu=Symbol.dispose??Symbol.for("Symbol.dispose"),Of=bt.prototype;Of[Wu]||(Of[Wu]=function(){return this.dispose()});Ye=class e extends bt{constructor(t,r,n,o){super();this._value=t,this.copier=r,this.disposer=n,this._owner=o,this._alive=!0,this._constructorStack=Xu?Error("Lifetime constructed").stack:void 0}get alive(){return this._alive}get value(){return this.assertAlive(),this._value}get owner(){return this._owner}get dupable(){return!!this.copier}dup(){if(this.assertAlive(),!this.copier)throw Error("Non-dupable lifetime");return new e(this.copier(this._value),this.copier,this.disposer,this._owner)}consume(t){this.assertAlive();let r=t(this);return this.dispose(),r}map(t){return this.assertAlive(),t(this)}tap(t){return t(this),this}dispose(){this.assertAlive(),this.disposer&&this.disposer(this._value),this._alive=!1}assertAlive(){if(!this.alive)throw this._constructorStack?new Qu(`Lifetime not alive
1
+ /*! @mcpcloud/runtime v0.15.1 — (c) MCPCloud.sh. All rights reserved. SEE LICENSE: https://www.npmjs.com/package/@mcpcloud/runtime */
2
+ var Df=Object.create;var{getPrototypeOf:Uf,defineProperty:la,getOwnPropertyNames:Ff}=Object;var Ku=Object.prototype.hasOwnProperty;function Zf(e){return this[e]}var Vf,Jf,Hf=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var o=t?Vf??=new WeakMap:Jf??=new WeakMap,i=o.get(e);if(i)return i}r=e!=null?Df(Uf(e)):{};let a=t||!e||!e.__esModule||!Ku.call(e,"default")?la(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let s of Ff(e))if(!Ku.call(a,s))la(a,s,{get:Zf.bind(e,s),enumerable:!0})}if(n)o.set(e,a);return a};var Kf=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Bf=(e)=>e;function Yf(e,t){this[e]=Bf.bind(null,t)}var Gf=(e,t)=>{for(var r in t)la(e,r,{get:t[r],enumerable:!0,configurable:!0,set:Yf.bind(t,r)})};var da=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};var nr,Nu,oa,or,ho;var sa=da(()=>{nr={JS_EVAL_TYPE_GLOBAL:0,JS_EVAL_TYPE_MODULE:1,JS_EVAL_TYPE_DIRECT:2,JS_EVAL_TYPE_INDIRECT:3,JS_EVAL_TYPE_MASK:3,JS_EVAL_FLAG_STRICT:8,JS_EVAL_FLAG_STRIP:16,JS_EVAL_FLAG_COMPILE_ONLY:32,JS_EVAL_FLAG_BACKTRACE_BARRIER:64},Nu={BaseObjects:1,Date:2,Eval:4,StringNormalize:8,RegExp:16,RegExpCompiler:32,JSON:64,Proxy:128,MapSet:256,TypedArrays:512,Promise:1024,BigInt:2048,BigFloat:4096,BigDecimal:8192,OperatorOverloading:16384,BignumExt:32768},oa={Pending:0,Fulfilled:1,Rejected:2},or={JS_GPN_STRING_MASK:1,JS_GPN_SYMBOL_MASK:2,JS_GPN_PRIVATE_MASK:4,JS_GPN_ENUM_ONLY:16,JS_GPN_SET_ENUM:32,QTS_GPN_NUMBER_MASK:64,QTS_STANDARD_COMPLIANT_NUMBER:128},ho={IsStrictlyEqual:0,IsSameValue:1,IsSameValueZero:2}});function fo(...e){qu&&console.log("quickjs-emscripten:",...e)}function*wf(e){return yield e}function kv(e){return wf(Du(e))}function lf(e,t){return(...r)=>{let n=t.call(e,Lu,...r);return Du(n)}}function Ov(e,t){let r=t.call(e,Lu);return Du(r)}function Du(e){function t(r){return r.done?r.value:r.value instanceof Promise?r.value.then((n)=>t(e.next(n)),(n)=>t(e.throw(n))):t(e.next(r.value))}return t(e.next())}function xu(e,t){let r;try{e.dispose()}catch(n){r=n}if(t&&r)throw Object.assign(t,{message:`${t.message}
3
+ Then, failed to dispose scope: ${r.message}`,disposeError:r}),t;if(t||r)throw t||r}function Cv(e){let t=e?Array.from(e):[];function r(){return t.forEach((o)=>o.alive?o.dispose():void 0)}function n(){return t.some((o)=>o.alive)}return Object.defineProperty(t,Mu,{configurable:!0,enumerable:!1,value:r}),Object.defineProperty(t,"dispose",{configurable:!0,enumerable:!1,value:r}),Object.defineProperty(t,"alive",{configurable:!0,enumerable:!1,get:n}),t}function aa(e){return!!(e&&(typeof e=="object"||typeof e=="function")&&("alive"in e)&&typeof e.alive=="boolean"&&("dispose"in e)&&typeof e.dispose=="function")}function Av(e){if(!e)return 0;let t=0;for(let[r,n]of Object.entries(e)){if(!(r in Nu))throw new vf(r);n&&(t|=Nu[r])}return t}function jv(e){if(typeof e=="number")return e;if(e===void 0)return 0;let{type:t,strict:r,strip:n,compileOnly:o,backtraceBarrier:i}=e,a=0;return t==="global"&&(a|=nr.JS_EVAL_TYPE_GLOBAL),t==="module"&&(a|=nr.JS_EVAL_TYPE_MODULE),r&&(a|=nr.JS_EVAL_FLAG_STRICT),n&&(a|=nr.JS_EVAL_FLAG_STRIP),o&&(a|=nr.JS_EVAL_FLAG_COMPILE_ONLY),i&&(a|=nr.JS_EVAL_FLAG_BACKTRACE_BARRIER),a}function Mv(e){if(typeof e=="number")return e;if(e===void 0)return 0;let{strings:t,symbols:r,quickjsPrivate:n,onlyEnumerable:o,numbers:i,numbersAsStrings:a}=e,s=0;return t&&(s|=or.JS_GPN_STRING_MASK),r&&(s|=or.JS_GPN_SYMBOL_MASK),n&&(s|=or.JS_GPN_PRIVATE_MASK),o&&(s|=or.JS_GPN_ENUM_ONLY),i&&(s|=or.QTS_GPN_NUMBER_MASK),a&&(s|=or.QTS_STANDARD_COMPLIANT_NUMBER),s}function qv(...e){let t=[];for(let r of e)r!==void 0&&(t=t.concat(r));return t}function Iu(e){return e>>8}function Zu(e,t){t.interruptHandler&&e.setInterruptHandler(t.interruptHandler),t.maxStackSizeBytes!==void 0&&e.setMaxStackSize(t.maxStackSizeBytes),t.memoryLimitBytes!==void 0&&e.setMemoryLimit(t.memoryLimitBytes)}function Vu(e,t){t.moduleLoader&&e.setModuleLoader(t.moduleLoader),t.shouldInterrupt&&e.setInterruptHandler(t.shouldInterrupt),t.memoryLimitBytes!==void 0&&e.setMemoryLimit(t.memoryLimitBytes),t.maxStackSizeBytes!==void 0&&e.setMaxStackSize(t.maxStackSizeBytes)}var wv,$v=(e,t)=>{for(var r in t)wv(e,r,{get:t[r],enumerable:!0})},qu=!1,Ev,Au,gf,ju,_f,Sf,yf,Tv,Pv,vf,bf,Rf,zf,jt,Lu,ft,Mu,df,Be,sr,mf,lt,Uu,Nv,xv,Zr,Iv,$f=class{constructor(e){this.module=e}toPointerArray(e){let t=new Int32Array(e.map((o)=>o.value)),r=t.length*t.BYTES_PER_ELEMENT,n=this.module._malloc(r);return new Uint8Array(this.module.HEAPU8.buffer,n,r).set(new Uint8Array(t.buffer)),new Be(n,void 0,(o)=>this.module._free(o))}newTypedArray(e,t){let r=new e(Array(t).fill(0)),n=r.length*r.BYTES_PER_ELEMENT,o=this.module._malloc(n),i=new e(this.module.HEAPU8.buffer,o,t);return i.set(r),new Be({typedArray:i,ptr:o},void 0,(a)=>this.module._free(a.ptr))}newMutablePointerArray(e){return this.newTypedArray(Int32Array,e)}newHeapCharPointer(e){let t=this.module.lengthBytesUTF8(e),r=t+1,n=this.module._malloc(r);return this.module.stringToUTF8(e,n,r),new Be({ptr:n,strlen:t},void 0,(o)=>this.module._free(o.ptr))}newHeapBufferPointer(e){let t=e.byteLength,r=this.module._malloc(t);return this.module.HEAPU8.set(e,r),new Be({pointer:r,numBytes:t},void 0,(n)=>this.module._free(n.pointer))}consumeHeapCharPointer(e){let t=this.module.UTF8ToString(e);return this.module._free(e),t}},iw,aw,Lv,pf=-2147483648,hf=2147483647,ia=0,Dv=class{constructor(){this.nextId=pf,this.freelist=[],this.groups=new Map}put(e){let t=this.allocateId(),r=Iu(t),n=this.groups.get(r);return n||(n=new Map,this.groups.set(r,n)),n.set(t,e),t}get(e){if(e===ia)throw new jt("no host reference id defined");let t=Iu(e),r=this.groups.get(t);if(!r)throw new jt(`host reference id ${e} is not defined`);let n=r.get(e);if(!n)throw new jt(`host reference id ${e} is not defined`);return n}delete(e){if(e===ia)throw new jt("no host reference id defined");let t=Iu(e),r=this.groups.get(t);if(!r)throw new jt(`host reference id ${e} is not defined`);r.delete(e),r.size===0&&this.groups.delete(t),this.freelist.push(e)}allocateId(){if(this.freelist.length>0)return this.freelist.shift();if(this.nextId===ia&&this.nextId++,this.nextId>hf)throw new zf(`HostRefMap: too many host refs created without disposing. Max simultaneous host refs: ${hf-pf}`);return this.nextId++}},ff,Uv,Fv,Zv,Vv=class{constructor(e){this.freeHostRef=e.freeHostRef,this.callFunction=e.callFunction,this.shouldInterrupt=e.shouldInterrupt,this.loadModuleSource=e.loadModuleSource,this.normalizeModule=e.normalizeModule}},Fu=class{constructor(e){this.contextCallbacks=new Map,this.runtimeCallbacks=new Map,this.suspendedCount=0,this.cToHostCallbacks=new Vv({freeHostRef:(t,r,n)=>{let o=this.runtimeCallbacks.get(r);if(!o)throw Error(`QuickJSRuntime(rt = ${r}) not found when trying to free HostRef(id = ${n})`);o.freeHostRef(r,n)},callFunction:(t,r,n,o,i,a)=>this.handleAsyncify(t,()=>{try{let s=this.contextCallbacks.get(r);if(!s)throw Error(`QuickJSContext(ctx = ${r}) not found for C function call "${a}"`);return s.callFunction(r,n,o,i,a)}catch(s){return console.error("[C to host error: returning null]",s),0}}),shouldInterrupt:(t,r)=>this.handleAsyncify(t,()=>{try{let n=this.runtimeCallbacks.get(r);if(!n)throw Error(`QuickJSRuntime(rt = ${r}) not found for C interrupt`);return n.shouldInterrupt(r)}catch(n){return console.error("[C to host interrupt: returning error]",n),1}}),loadModuleSource:(t,r,n,o)=>this.handleAsyncify(t,()=>{try{let i=this.runtimeCallbacks.get(r);if(!i)throw Error(`QuickJSRuntime(rt = ${r}) not found for C module loader`);let a=i.loadModuleSource;if(!a)throw Error(`QuickJSRuntime(rt = ${r}) does not support module loading`);return a(r,n,o)}catch(i){return console.error("[C to host module loader error: returning null]",i),0}}),normalizeModule:(t,r,n,o,i)=>this.handleAsyncify(t,()=>{try{let a=this.runtimeCallbacks.get(r);if(!a)throw Error(`QuickJSRuntime(rt = ${r}) not found for C module loader`);let s=a.normalizeModule;if(!s)throw Error(`QuickJSRuntime(rt = ${r}) does not support module loading`);return s(r,n,o,i)}catch(a){return console.error("[C to host module loader error: returning null]",a),0}})}),this.module=e,this.module.callbacks=this.cToHostCallbacks}setRuntimeCallbacks(e,t){this.runtimeCallbacks.set(e,t)}deleteRuntime(e){this.runtimeCallbacks.delete(e)}setContextCallbacks(e,t){this.contextCallbacks.set(e,t)}deleteContext(e){this.contextCallbacks.delete(e)}handleAsyncify(e,t){if(e)return e.handleSleep((n)=>{try{let o=t();if(!(o instanceof Promise)){fo("asyncify.handleSleep: not suspending:",o),n(o);return}if(this.suspended)throw new Sf(`Already suspended at: ${this.suspended.stack}
4
+ Attempted to suspend at:`);this.suspended=new yf(`(${this.suspendedCount++})`),fo("asyncify.handleSleep: suspending:",this.suspended),o.then((i)=>{this.suspended=void 0,fo("asyncify.handleSleep: resolved:",i),n(i)},(i)=>{fo("asyncify.handleSleep: rejected:",i),console.error("QuickJS: cannot handle error in suspended function",i),this.suspended=void 0})}catch(o){throw fo("asyncify.handleSleep: error:",o),this.suspended=void 0,o}});let r=t();if(r instanceof Promise)throw Error("Promise return value not supported in non-asyncify context.");return r}},Ef=class{constructor(e,t){this.module=e,this.ffi=t,this.callbacks=new Fu(e)}newRuntime(e={}){let t=new Be(this.ffi.QTS_NewRuntime(),void 0,(n)=>{this.ffi.QTS_FreeRuntime(n),this.callbacks.deleteRuntime(n)}),r=new Zv({module:this.module,callbacks:this.callbacks,ffi:this.ffi,rt:t});return Zu(r,e),e.moduleLoader&&r.setModuleLoader(e.moduleLoader),r}newContext(e={}){let t=this.newRuntime(),r=t.newContext({...e,ownedLifetimes:qv(t,e.ownedLifetimes)});return t.context=r,r}evalCode(e,t={}){return lt.withScope((r)=>{let n=r.manage(this.newContext());Vu(n.runtime,t);let o=n.evalCode(e,"eval.js");if(t.memoryLimitBytes!==void 0&&n.runtime.setMemoryLimit(-1),o.error)throw n.dump(r.manage(o.error));return n.dump(r.manage(o.value))})}getWasmMemory(){let e=this.module.quickjsEmscriptenInit?.(()=>{})?.getWasmMemory?.();if(!e)throw Error("Variant does not support getting WebAssembly.Memory");return e}getFFI(){return this.ffi}};var Tf=da(()=>{sa();sa();wv=Object.defineProperty;Ev={};$v(Ev,{QuickJSAsyncifyError:()=>Sf,QuickJSAsyncifySuspended:()=>yf,QuickJSEmptyGetOwnPropertyNames:()=>Rf,QuickJSEmscriptenModuleError:()=>Pv,QuickJSHostRefInvalid:()=>jt,QuickJSHostRefRangeExceeded:()=>zf,QuickJSMemoryLeakDetected:()=>Tv,QuickJSNotImplemented:()=>_f,QuickJSPromisePending:()=>bf,QuickJSUnknownIntrinsic:()=>vf,QuickJSUnwrapError:()=>Au,QuickJSUseAfterFree:()=>ju,QuickJSWrongOwner:()=>gf});Au=class extends Error{constructor(e,t){let r=typeof e=="object"&&e&&"message"in e?String(e.message):String(e);super(r);this.cause=e,this.context=t,this.name="QuickJSUnwrapError"}},gf=class extends Error{constructor(){super(...arguments);this.name="QuickJSWrongOwner"}},ju=class extends Error{constructor(){super(...arguments);this.name="QuickJSUseAfterFree"}},_f=class extends Error{constructor(){super(...arguments);this.name="QuickJSNotImplemented"}},Sf=class extends Error{constructor(){super(...arguments);this.name="QuickJSAsyncifyError"}},yf=class extends Error{constructor(){super(...arguments);this.name="QuickJSAsyncifySuspended"}},Tv=class extends Error{constructor(){super(...arguments);this.name="QuickJSMemoryLeakDetected"}},Pv=class extends Error{constructor(){super(...arguments);this.name="QuickJSEmscriptenModuleError"}},vf=class extends TypeError{constructor(){super(...arguments);this.name="QuickJSUnknownIntrinsic"}},bf=class extends Error{constructor(){super(...arguments);this.name="QuickJSPromisePending"}},Rf=class extends Error{constructor(){super(...arguments);this.name="QuickJSEmptyGetOwnPropertyNames"}},zf=class extends Error{constructor(){super(...arguments);this.name="QuickJSHostRefRangeExceeded"}},jt=class extends Error{constructor(){super(...arguments);this.name="QuickJSHostRefInvalid"}};Lu=wf;Lu.of=kv;ft=class{[Symbol.dispose](){return this.dispose()}},Mu=Symbol.dispose??Symbol.for("Symbol.dispose"),df=ft.prototype;df[Mu]||(df[Mu]=function(){return this.dispose()});Be=class e extends ft{constructor(t,r,n,o){super();this._value=t,this.copier=r,this.disposer=n,this._owner=o,this._alive=!0,this._constructorStack=qu?Error("Lifetime constructed").stack:void 0}get alive(){return this._alive}get value(){return this.assertAlive(),this._value}get owner(){return this._owner}get dupable(){return!!this.copier}dup(){if(this.assertAlive(),!this.copier)throw Error("Non-dupable lifetime");return new e(this.copier(this._value),this.copier,this.disposer,this._owner)}consume(t){this.assertAlive();let r=t(this);return this.dispose(),r}map(t){return this.assertAlive(),t(this)}tap(t){return t(this),this}dispose(){this.assertAlive(),this.disposer&&this.disposer(this._value),this._alive=!1}assertAlive(){if(!this.alive)throw this._constructorStack?new ju(`Lifetime not alive
5
5
  ${this._constructorStack}
6
- Lifetime used`):new Qu("Lifetime not alive")}},cr=class extends Ye{constructor(e,t){super(e,void 0,void 0,t)}get dupable(){return!0}dup(){return this}dispose(){}},Cf=class extends Ye{constructor(e,t,r,n){super(e,t,r,n)}dispose(){this._alive=!1}};mt=class e extends bt{constructor(){super(...arguments);this._disposables=new Ye(new Set),this.manage=(t)=>(this._disposables.value.add(t),t)}static withScope(t){let r=new e,n;try{return t(r)}catch(o){throw n=o,o}finally{Bu(r,n)}}static withScopeMaybeAsync(t,r){return pb(void 0,function*(n){let o=new e,s;try{return yield*n.of(r.call(t,n,o))}catch(a){throw s=a,a}finally{Bu(o,s)}})}static async withScopeAsync(t){let r=new e,n;try{return await t(r)}catch(o){throw n=o,o}finally{Bu(r,n)}}get alive(){return this._disposables.alive}dispose(){let t=Array.from(this._disposables.value.values()).reverse();for(let r of t)r.alive&&r.dispose();this._disposables.dispose()}};rl=class e extends bt{static success(t){return new fb(t)}static fail(t,r){return new gb(t,r)}static is(t){return t instanceof e}},fb=class extends rl{constructor(e){super();this.value=e}get alive(){return pa(this.value)?this.value.alive:!0}dispose(){pa(this.value)&&this.value.dispose()}unwrap(){return this.value}unwrapOr(e){return this.value}},gb=class extends rl{constructor(e,t){super();this.error=e,this.onUnwrap=t}get alive(){return pa(this.error)?this.error.alive:!0}dispose(){pa(this.error)&&this.error.dispose()}unwrap(){throw this.onUnwrap(this),this.error}unwrapOr(e){return e}},Yr=rl,_b=class extends bt{constructor(e){super();this.resolve=(t)=>{this.resolveHandle.alive&&(this.context.unwrapResult(this.context.callFunction(this.resolveHandle,this.context.undefined,t||this.context.undefined)).dispose(),this.disposeResolvers(),this.onSettled())},this.reject=(t)=>{this.rejectHandle.alive&&(this.context.unwrapResult(this.context.callFunction(this.rejectHandle,this.context.undefined,t||this.context.undefined)).dispose(),this.disposeResolvers(),this.onSettled())},this.dispose=()=>{this.handle.alive&&this.handle.dispose(),this.disposeResolvers()},this.context=e.context,this.owner=e.context.runtime,this.handle=e.promiseHandle,this.settled=new Promise((t)=>{this.onSettled=t}),this.resolveHandle=e.resolveHandle,this.rejectHandle=e.rejectHandle}get alive(){return this.handle.alive||this.resolveHandle.alive||this.rejectHandle.alive}disposeResolvers(){this.resolveHandle.alive&&this.resolveHandle.dispose(),this.rejectHandle.alive&&this.rejectHandle.dispose()}},Cw=Symbol("Unstable"),Nw=Object.freeze({BaseObjects:!0,Date:!0,Eval:!0,StringNormalize:!0,RegExp:!0,JSON:!0,Proxy:!0,MapSet:!0,TypedArrays:!0,Promise:!0});Rb=class extends bt{constructor(e,t){super();this.handle=e,this.context=t,this._isDone=!1,this.owner=t.runtime}[Symbol.iterator](){return this}next(e){if(!this.alive||this._isDone)return{done:!0,value:void 0};let t=this._next??(this._next=this.context.getProp(this.handle,"next"));return this.callIteratorMethod(t,e)}return(e){if(!this.alive)return{done:!0,value:void 0};let t=this.context.getProp(this.handle,"return");if(t===this.context.undefined&&e===void 0)return this.dispose(),{done:!0,value:void 0};let r=this.callIteratorMethod(t,e);return t.dispose(),this.dispose(),r}throw(e){if(!this.alive)return{done:!0,value:void 0};let t=e instanceof Ye?e:this.context.newError(e),r=this.context.getProp(this.handle,"throw"),n=this.callIteratorMethod(r,e);return t.alive&&t.dispose(),r.dispose(),this.dispose(),n}get alive(){return this.handle.alive}dispose(){this._isDone=!0,this.handle.dispose(),this._next?.dispose()}callIteratorMethod(e,t){let r=t?this.context.callFunction(e,this.handle,t):this.context.callFunction(e,this.handle);if(r.error)return this.dispose(),{value:r};let n=this.context.getProp(r.value,"done").consume((s)=>this.context.dump(s)),o=this.context.getProp(r.value,"value");return r.value.dispose(),n&&this.dispose(),{value:Yr.success(o),done:n}}};If=class extends bt{constructor(e,t,r){if(r===ma)throw new Ft("cannot create HostRef with undefined id");super();this.runtime=e,this.handle=t,this.id=r}get alive(){return this.handle.alive}dispose(){this.handle.dispose()}get value(){return this.runtime.hostRefs.get(this.id)}},wb=class extends Vf{constructor(e){super(e.module);this.scope=new mt,this.copyJSValue=(t)=>this.ffi.QTS_DupValuePointer(this.ctx.value,t),this.freeJSValue=(t)=>{this.ffi.QTS_FreeValuePointer(this.ctx.value,t)},e.ownedLifetimes?.forEach((t)=>this.scope.manage(t)),this.owner=e.owner,this.module=e.module,this.ffi=e.ffi,this.rt=e.rt,this.ctx=this.scope.manage(e.ctx)}get alive(){return this.scope.alive}dispose(){return this.scope.dispose()}[Symbol.dispose](){return this.dispose()}manage(e){return this.scope.manage(e)}consumeJSCharPointer(e){let t=this.module.UTF8ToString(e);return this.ffi.QTS_FreeCString(this.ctx.value,e),t}heapValueHandle(e,t){let r=t?(n)=>{t(),this.freeJSValue(n)}:this.freeJSValue;return new Ye(e,this.copyJSValue,r,this.owner)}staticHeapValueHandle(e){return this.manage(this.heapValueHandle(e)),new cr(e,this.owner)}},$b=class extends bt{constructor(e){super();this._undefined=void 0,this._null=void 0,this._false=void 0,this._true=void 0,this._global=void 0,this._BigInt=void 0,this._Symbol=void 0,this._SymbolIterator=void 0,this._SymbolAsyncIterator=void 0,this.cToHostCallbacks={callFunction:(t,r,n,o,s)=>{if(t!==this.ctx.value)throw Error("QuickJSContext instance received C -> JS call with mismatched ctx");let a=this.getFunction(s);return mt.withScopeMaybeAsync(this,function*(i,c){let u=c.manage(new Cf(r,this.memory.copyJSValue,this.memory.freeJSValue,this.runtime)),f=Array(n);for(let _=0;_<n;_++){let E=this.ffi.QTS_ArgvGetJSValueConstPointer(o,_);f[_]=c.manage(new Cf(E,this.memory.copyJSValue,this.memory.freeJSValue,this.runtime))}try{let _=yield*i(a.apply(u,f));if(_){if("error"in _&&_.error)throw this.runtime.debugLog("throw error",_.error),_.error;let E=c.manage(_ instanceof Ye?_:_.value);return this.ffi.QTS_DupValuePointer(this.ctx.value,E.value)}return 0}catch(_){return this.errorToHandle(_).consume((E)=>this.ffi.QTS_Throw(this.ctx.value,E.value))}})}},this.runtime=e.runtime,this.module=e.module,this.ffi=e.ffi,this.rt=e.rt,this.ctx=e.ctx,this.memory=new wb({...e,owner:this.runtime}),e.callbacks.setContextCallbacks(this.ctx.value,this.cToHostCallbacks),this.dump=this.dump.bind(this),this.getString=this.getString.bind(this),this.getNumber=this.getNumber.bind(this),this.resolvePromise=this.resolvePromise.bind(this),this.uint32Out=this.memory.manage(this.memory.newTypedArray(Uint32Array,1))}get alive(){return this.memory.alive}dispose(){this.memory.dispose()}get undefined(){if(this._undefined)return this._undefined;let e=this.ffi.QTS_GetUndefined();return this._undefined=new cr(e)}get null(){if(this._null)return this._null;let e=this.ffi.QTS_GetNull();return this._null=new cr(e)}get true(){if(this._true)return this._true;let e=this.ffi.QTS_GetTrue();return this._true=new cr(e)}get false(){if(this._false)return this._false;let e=this.ffi.QTS_GetFalse();return this._false=new cr(e)}get global(){if(this._global)return this._global;let e=this.ffi.QTS_GetGlobalObject(this.ctx.value);return this._global=this.memory.staticHeapValueHandle(e),this._global}newNumber(e){return this.memory.heapValueHandle(this.ffi.QTS_NewFloat64(this.ctx.value,e))}newString(e){let t=this.memory.newHeapCharPointer(e).consume((r)=>this.ffi.QTS_NewString(this.ctx.value,r.value.ptr));return this.memory.heapValueHandle(t)}newUniqueSymbol(e){let t=(typeof e=="symbol"?e.description:e)??"",r=this.memory.newHeapCharPointer(t).consume((n)=>this.ffi.QTS_NewSymbol(this.ctx.value,n.value.ptr,0));return this.memory.heapValueHandle(r)}newSymbolFor(e){let t=(typeof e=="symbol"?e.description:e)??"",r=this.memory.newHeapCharPointer(t).consume((n)=>this.ffi.QTS_NewSymbol(this.ctx.value,n.value.ptr,1));return this.memory.heapValueHandle(r)}getWellKnownSymbol(e){return this._Symbol??(this._Symbol=this.memory.manage(this.getProp(this.global,"Symbol"))),this.getProp(this._Symbol,e)}newBigInt(e){if(!this._BigInt){let n=this.getProp(this.global,"BigInt");this.memory.manage(n),this._BigInt=new cr(n.value,this.runtime)}let t=this._BigInt,r=String(e);return this.newString(r).consume((n)=>this.unwrapResult(this.callFunction(t,this.undefined,n)))}newObject(e){e&&this.runtime.assertOwned(e);let t=e?this.ffi.QTS_NewObjectProto(this.ctx.value,e.value):this.ffi.QTS_NewObject(this.ctx.value);return this.memory.heapValueHandle(t)}newArray(){let e=this.ffi.QTS_NewArray(this.ctx.value);return this.memory.heapValueHandle(e)}newArrayBuffer(e){let t=new Uint8Array(e),r=this.memory.newHeapBufferPointer(t),n=this.ffi.QTS_NewArrayBuffer(this.ctx.value,r.value.pointer,t.length);return this.memory.heapValueHandle(n)}newPromise(e){let t=mt.withScope((r)=>{let n=r.manage(this.memory.newMutablePointerArray(2)),o=this.ffi.QTS_NewPromiseCapability(this.ctx.value,n.value.ptr),s=this.memory.heapValueHandle(o),[a,i]=Array.from(n.value.typedArray).map((c)=>this.memory.heapValueHandle(c));return new _b({context:this,promiseHandle:s,resolveHandle:a,rejectHandle:i})});return e&&typeof e=="function"&&(e=new Promise(e)),e&&Promise.resolve(e).then(t.resolve,(r)=>r instanceof Ye?t.reject(r):this.newError(r).consume(t.reject)),t}newFunction(e,t){let r=typeof e=="function"?e:t;if(!r)throw TypeError("Expected a function");return this.newFunctionWithOptions({name:typeof e=="string"?e:void 0,length:r.length,isConstructor:!1,fn:r})}newConstructorFunction(e,t){let r=typeof e=="function"?e:t;if(!r)throw TypeError("Expected a function");return this.newFunctionWithOptions({name:typeof e=="string"?e:void 0,length:r.length,isConstructor:!0,fn:r})}newFunctionWithOptions(e){let{name:t,length:r,isConstructor:n,fn:o}=e,s=this.runtime.hostRefs.put(o);try{return this.memory.heapValueHandle(this.ffi.QTS_NewFunction(this.ctx.value,t??"",r,n,s))}catch(a){throw this.runtime.hostRefs.delete(s),a}}newError(e){let t=this.memory.heapValueHandle(this.ffi.QTS_NewError(this.ctx.value));return e&&typeof e=="object"?(e.name!==void 0&&this.newString(e.name).consume((r)=>this.setProp(t,"name",r)),e.message!==void 0&&this.newString(e.message).consume((r)=>this.setProp(t,"message",r))):typeof e=="string"?this.newString(e).consume((r)=>this.setProp(t,"message",r)):e!==void 0&&this.newString(String(e)).consume((r)=>this.setProp(t,"message",r)),t}newHostRef(e){let t=this.runtime.hostRefs.put(e);try{let r=this.memory.heapValueHandle(this.ffi.QTS_NewHostRef(this.ctx.value,t));return new If(this.runtime,r,t)}catch(r){throw this.runtime.hostRefs.delete(t),r}}toHostRef(e){let t=this.ffi.QTS_GetHostRefId(e.value);if(t!==0)return this.runtime.hostRefs.get(t),new If(this.runtime,e.dup(),t)}unwrapHostRef(e){let t=this.ffi.QTS_GetHostRefId(e.value);if(t===0)throw new Ft("handle is not a HostRef");return this.runtime.hostRefs.get(t)}typeof(e){return this.runtime.assertOwned(e),this.memory.consumeHeapCharPointer(this.ffi.QTS_Typeof(this.ctx.value,e.value))}getNumber(e){return this.runtime.assertOwned(e),this.ffi.QTS_GetFloat64(this.ctx.value,e.value)}getString(e){return this.runtime.assertOwned(e),this.memory.consumeJSCharPointer(this.ffi.QTS_GetString(this.ctx.value,e.value))}getSymbol(e){this.runtime.assertOwned(e);let t=this.memory.consumeJSCharPointer(this.ffi.QTS_GetSymbolDescriptionOrKey(this.ctx.value,e.value));return this.ffi.QTS_IsGlobalSymbol(this.ctx.value,e.value)?Symbol.for(t):Symbol(t)}getBigInt(e){this.runtime.assertOwned(e);let t=this.getString(e);return BigInt(t)}getArrayBuffer(e){this.runtime.assertOwned(e);let t=this.ffi.QTS_GetArrayBufferLength(this.ctx.value,e.value),r=this.ffi.QTS_GetArrayBuffer(this.ctx.value,e.value);if(!r)throw Error("Couldn't allocate memory to get ArrayBuffer");return new Ye(this.module.HEAPU8.subarray(r,r+t),void 0,()=>this.module._free(r))}getPromiseState(e){this.runtime.assertOwned(e);let t=this.ffi.QTS_PromiseState(this.ctx.value,e.value);if(t<0)return{type:"fulfilled",value:e,notAPromise:!0};if(t===la.Pending)return{type:"pending",get error(){return new Df("Cannot unwrap a pending promise")}};let r=this.ffi.QTS_PromiseResult(this.ctx.value,e.value),n=this.memory.heapValueHandle(r);if(t===la.Fulfilled)return{type:"fulfilled",value:n};if(t===la.Rejected)return{type:"rejected",error:n};throw n.dispose(),Error(`Unknown JSPromiseStateEnum: ${t}`)}resolvePromise(e){this.runtime.assertOwned(e);let t=mt.withScope((r)=>{let n=r.manage(this.getProp(this.global,"Promise")),o=r.manage(this.getProp(n,"resolve"));return this.callFunction(o,n,e)});return t.error?Promise.resolve(t):new Promise((r)=>{mt.withScope((n)=>{let o=n.manage(this.newFunction("resolve",(c)=>{r(this.success(c&&c.dup()))})),s=n.manage(this.newFunction("reject",(c)=>{r(this.fail(c&&c.dup()))})),a=n.manage(t.value),i=n.manage(this.getProp(a,"then"));this.callFunction(i,a,o,s).unwrap().dispose()})})}isEqual(e,t,r=Ro.IsStrictlyEqual){if(e===t)return!0;this.runtime.assertOwned(e),this.runtime.assertOwned(t);let n=this.ffi.QTS_IsEqual(this.ctx.value,e.value,t.value,r);if(n===-1)throw new jf("WASM variant does not expose equality");return!!n}eq(e,t){return this.isEqual(e,t,Ro.IsStrictlyEqual)}sameValue(e,t){return this.isEqual(e,t,Ro.IsSameValue)}sameValueZero(e,t){return this.isEqual(e,t,Ro.IsSameValueZero)}getProp(e,t){this.runtime.assertOwned(e);let r;return typeof t=="number"&&t>=0?r=this.ffi.QTS_GetPropNumber(this.ctx.value,e.value,t):r=this.borrowPropertyKey(t).consume((n)=>this.ffi.QTS_GetProp(this.ctx.value,e.value,n.value)),this.memory.heapValueHandle(r)}getLength(e){if(this.runtime.assertOwned(e),!(this.ffi.QTS_GetLength(this.ctx.value,this.uint32Out.value.ptr,e.value)<0))return this.uint32Out.value.typedArray[0]}getOwnPropertyNames(e,t={strings:!0,numbersAsStrings:!0}){this.runtime.assertOwned(e),e.value;let r=vb(t);if(r===0)throw new Uf("No options set, will return an empty array");return mt.withScope((n)=>{let o=n.manage(this.memory.newMutablePointerArray(1)),s=this.ffi.QTS_GetOwnPropertyNames(this.ctx.value,o.value.ptr,this.uint32Out.value.ptr,e.value,r);if(s)return this.fail(this.memory.heapValueHandle(s));let a=this.uint32Out.value.typedArray[0],i=o.value.typedArray[0],c=new Uint32Array(this.module.HEAP8.buffer,i,a),u=Array.from(c).map((f)=>this.memory.heapValueHandle(f));return this.ffi.QTS_FreeVoidPointer(this.ctx.value,i),this.success(hb(u))})}getIterator(e){let t=this._SymbolIterator??(this._SymbolIterator=this.memory.manage(this.getWellKnownSymbol("iterator")));return mt.withScope((r)=>{let n=r.manage(this.getProp(e,t)),o=this.callFunction(n,e);return o.error?o:this.success(new Rb(o.value,this))})}setProp(e,t,r){this.runtime.assertOwned(e),this.borrowPropertyKey(t).consume((n)=>this.ffi.QTS_SetProp(this.ctx.value,e.value,n.value,r.value))}defineProp(e,t,r){this.runtime.assertOwned(e),mt.withScope((n)=>{let o=n.manage(this.borrowPropertyKey(t)),s=r.value||this.undefined,a=!!r.configurable,i=!!r.enumerable,c=!!r.value,u=r.get?n.manage(this.newFunction(r.get.name,r.get)):this.undefined,f=r.set?n.manage(this.newFunction(r.set.name,r.set)):this.undefined;this.ffi.QTS_DefineProp(this.ctx.value,e.value,o.value,s.value,u.value,f.value,a,i,c)})}callFunction(e,t,...r){this.runtime.assertOwned(e);let n,o=r[0];o===void 0||Array.isArray(o)?n=o??[]:n=r;let s=this.memory.toPointerArray(n).consume((i)=>this.ffi.QTS_Call(this.ctx.value,e.value,t.value,n.length,i.value)),a=this.ffi.QTS_ResolveException(this.ctx.value,s);return a?(this.ffi.QTS_FreeValuePointer(this.ctx.value,s),this.fail(this.memory.heapValueHandle(a))):this.success(this.memory.heapValueHandle(s))}callMethod(e,t,r=[]){return this.getProp(e,t).consume((n)=>this.callFunction(n,e,r))}evalCode(e,t="eval.js",r){let n=r===void 0?1:0,o=yb(r),s=this.memory.newHeapCharPointer(e).consume((i)=>this.ffi.QTS_Eval(this.ctx.value,i.value.ptr,i.value.strlen,t,n,o)),a=this.ffi.QTS_ResolveException(this.ctx.value,s);return a?(this.ffi.QTS_FreeValuePointer(this.ctx.value,s),this.fail(this.memory.heapValueHandle(a))):this.success(this.memory.heapValueHandle(s))}throw(e){return this.errorToHandle(e).consume((t)=>this.ffi.QTS_Throw(this.ctx.value,t.value))}borrowPropertyKey(e){return typeof e=="number"?this.newNumber(e):typeof e=="string"?this.newString(e):new cr(e.value,this.runtime)}getMemory(e){if(e===this.rt.value)return this.memory;throw Error("Private API. Cannot get memory from a different runtime")}dump(e){this.runtime.assertOwned(e);let t=this.typeof(e);if(t==="string")return this.getString(e);if(t==="number")return this.getNumber(e);if(t==="bigint")return this.getBigInt(e);if(t==="undefined")return;if(t==="symbol")return this.getSymbol(e);let r=this.getPromiseState(e);if(r.type==="fulfilled"&&!r.notAPromise)return e.dispose(),{type:r.type,value:r.value.consume(this.dump)};if(r.type==="pending")return e.dispose(),{type:r.type};if(r.type==="rejected")return e.dispose(),{type:r.type,error:r.error.consume(this.dump)};let n=this.memory.consumeJSCharPointer(this.ffi.QTS_Dump(this.ctx.value,e.value));try{return JSON.parse(n)}catch{return n}}unwrapResult(e){if(e.error){let t="context"in e.error?e.error.context:this,r=e.error.consume((n)=>this.dump(n));if(r&&typeof r=="object"&&typeof r.message=="string"){let{message:n,name:o,stack:s,...a}=r,i=new Gu(r,t);typeof o=="string"&&(i.name=r.name),i.message=n;let c=i.stack;throw typeof s=="string"&&(i.stack=`${o}: ${n}
7
- ${r.stack}Host: ${c}`),Object.assign(i,a),i}throw new Gu(r)}return e.value}[Symbol.for("nodejs.util.inspect.custom")](){return this.alive?`${this.constructor.name} { ctx: ${this.ctx.value} rt: ${this.rt.value} }`:`${this.constructor.name} { disposed }`}getFunction(e){let t=this.runtime.hostRefs.get(e);if(typeof t!="function")throw Error(`Host reference ${e} is not a function`);return t}errorToHandle(e){return e instanceof Ye?e:this.newError(e)}encodeBinaryJSON(e){let t=this.ffi.QTS_bjson_encode(this.ctx.value,e.value);return this.memory.heapValueHandle(t)}decodeBinaryJSON(e){let t=this.ffi.QTS_bjson_decode(this.ctx.value,e.value);return this.memory.heapValueHandle(t)}success(e){return Yr.success(e)}fail(e){return Yr.fail(e,(t)=>this.unwrapResult(t))}},Eb=class extends bt{constructor(e){super();this.scope=new mt,this.contextMap=new Map,this.hostRefs=new zb,this._debugMode=!1,this.cToHostCallbacks={freeHostRef:(t,r)=>{if(t!==this.rt.value)throw Error("Runtime pointer mismatch");this.hostRefs.delete(r)},shouldInterrupt:(t)=>{if(t!==this.rt.value)throw Error("QuickJSContext instance received C -> JS interrupt with mismatched rt");let r=this.interruptHandler;if(!r)throw Error("QuickJSContext had no interrupt handler");return r(this)?1:0},loadModuleSource:kf(this,function*(t,r,n,o){let s=this.moduleLoader;if(!s)throw Error("Runtime has no module loader");if(r!==this.rt.value)throw Error("Runtime pointer mismatch");let a=this.contextMap.get(n)??this.newContext({contextPointer:n});try{let i=yield*t(s(o,a));if(typeof i=="object"&&"error"in i&&i.error)throw this.debugLog("cToHostLoadModule: loader returned error",i.error),i.error;let c=typeof i=="string"?i:("value"in i)?i.value:i;return this.memory.newHeapCharPointer(c).value.ptr}catch(i){return this.debugLog("cToHostLoadModule: caught error",i),a.throw(i),0}}),normalizeModule:kf(this,function*(t,r,n,o,s){let a=this.moduleNormalizer;if(!a)throw Error("Runtime has no module normalizer");if(r!==this.rt.value)throw Error("Runtime pointer mismatch");let i=this.contextMap.get(n)??this.newContext({contextPointer:n});try{let c=yield*t(a(o,s,i));if(typeof c=="object"&&"error"in c&&c.error)throw this.debugLog("cToHostNormalizeModule: normalizer returned error",c.error),c.error;let u=typeof c=="string"?c:c.value;return i.getMemory(this.rt.value).newHeapCharPointer(u).value.ptr}catch(c){return this.debugLog("normalizeModule: caught error",c),i.throw(c),0}})},e.ownedLifetimes?.forEach((t)=>this.scope.manage(t)),this.module=e.module,this.memory=new Vf(this.module),this.ffi=e.ffi,this.rt=e.rt,this.callbacks=e.callbacks,this.scope.manage(this.rt),this.callbacks.setRuntimeCallbacks(this.rt.value,this.cToHostCallbacks),this.executePendingJobs=this.executePendingJobs.bind(this),Xu&&this.setDebugMode(!0)}get alive(){return this.scope.alive}dispose(){return this.scope.dispose()}newContext(e={}){let t=Sb(e.intrinsics),r=new Ye(e.contextPointer||this.ffi.QTS_NewContext(this.rt.value,t),void 0,(o)=>{this.contextMap.delete(o),this.callbacks.deleteContext(o),this.ffi.QTS_FreeContext(o)}),n=new $b({module:this.module,ctx:r,ffi:this.ffi,rt:this.rt,ownedLifetimes:e.ownedLifetimes,runtime:this,callbacks:this.callbacks});return this.contextMap.set(r.value,n),n}setModuleLoader(e,t){this.moduleLoader=e,this.moduleNormalizer=t,this.ffi.QTS_RuntimeEnableModuleLoader(this.rt.value,this.moduleNormalizer?1:0)}removeModuleLoader(){this.moduleLoader=void 0,this.ffi.QTS_RuntimeDisableModuleLoader(this.rt.value)}hasPendingJob(){return!!this.ffi.QTS_IsJobPending(this.rt.value)}setInterruptHandler(e){let t=this.interruptHandler;this.interruptHandler=e,t||this.ffi.QTS_RuntimeEnableInterruptHandler(this.rt.value)}removeInterruptHandler(){this.interruptHandler&&(this.ffi.QTS_RuntimeDisableInterruptHandler(this.rt.value),this.interruptHandler=void 0)}executePendingJobs(e=-1){let t=this.memory.newMutablePointerArray(1),r=this.ffi.QTS_ExecutePendingJob(this.rt.value,e??-1,t.value.ptr),n=t.value.typedArray[0];if(t.dispose(),n===0)return this.ffi.QTS_FreeValuePointerRuntime(this.rt.value,r),Yr.success(0);let o=this.contextMap.get(n)??this.newContext({contextPointer:n}),s=o.getMemory(this.rt.value).heapValueHandle(r);if(o.typeof(s)==="number"){let a=o.getNumber(s);return s.dispose(),Yr.success(a)}else{let a=Object.assign(s,{context:o});return Yr.fail(a,(i)=>o.unwrapResult(i))}}setMemoryLimit(e){if(e<0&&e!==-1)throw Error("Cannot set memory limit to negative number. To unset, pass -1");this.ffi.QTS_RuntimeSetMemoryLimit(this.rt.value,e)}computeMemoryUsage(){let e=this.getSystemContext().getMemory(this.rt.value);return e.heapValueHandle(this.ffi.QTS_RuntimeComputeMemoryUsage(this.rt.value,e.ctx.value))}dumpMemoryUsage(){return this.memory.consumeHeapCharPointer(this.ffi.QTS_RuntimeDumpMemoryUsage(this.rt.value))}setMaxStackSize(e){if(e<0)throw Error("Cannot set memory limit to negative number. To unset, pass 0.");this.ffi.QTS_RuntimeSetMaxStackSize(this.rt.value,e)}assertOwned(e){if(e.owner&&e.owner.rt!==this.rt)throw new Af(`Handle is not owned by this runtime: ${e.owner.rt.value} != ${this.rt.value}`)}setDebugMode(e){this._debugMode=e,this.ffi.DEBUG&&this.rt.alive&&this.ffi.QTS_SetDebugLogEnabled(this.rt.value,e?1:0)}isDebugMode(){return this._debugMode}debugLog(...e){this._debugMode&&console.log("quickjs-emscripten:",...e)}[Symbol.for("nodejs.util.inspect.custom")](){return this.alive?`${this.constructor.name} { rt: ${this.rt.value} }`:`${this.constructor.name} { disposed }`}getSystemContext(){return this.context||(this.context=this.scope.manage(this.newContext())),this.context}}});var Kf={};Uo(Kf,{QuickJSModuleCallbacks:()=>nl,QuickJSWASMModule:()=>Jf,applyBaseRuntimeOptions:()=>ol,applyModuleEvalRuntimeOptions:()=>sl});var Bf=_a(()=>{Hf()});var eg=pg(function(ha,Xf){(function(e,t){typeof ha==="object"&&typeof Xf<"u"?t(ha):typeof define==="function"&&define.amd?define(["exports"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.jmespath={}))})(ha,function(e){let t=(l)=>l!==null&&Object.prototype.toString.call(l)==="[object Object]",r=(l,h)=>{if(l===h)return!0;if(typeof l!==typeof h)return!1;if(Array.isArray(l)&&Array.isArray(h)){if(l.length!==h.length)return!1;for(let k=0;k<l.length;k+=1)if(!r(l[k],h[k]))return!1;return!0}if(t(l)&&t(h)){let k=Object.entries(l),p=new Set(Object.keys(h));if(k.length!==p.size)return!1;for(let[T,x]of k){if(!r(x,h[T]))return!1;p.delete(T)}return p.size===0}return!1},n=(l)=>{if(l===""||l===!1||l===null||l===void 0)return!0;if(Array.isArray(l)&&l.length===0)return!0;if(t(l)){for(let h in l)if(l.hasOwnProperty(h))return!1;return!0}return!1},o=(l)=>l>="a"&&l<="z"||l>="A"&&l<="Z"||l==="_",s=(l)=>l>="0"&&l<="9"||l==="-",a=(l)=>l>="a"&&l<="z"||l>="A"&&l<="Z"||l>="0"&&l<="9"||l==="_";var i;(function(l){l.TOK_EOF="EOF",l.TOK_UNQUOTEDIDENTIFIER="UnquotedIdentifier",l.TOK_QUOTEDIDENTIFIER="QuotedIdentifier",l.TOK_RBRACKET="Rbracket",l.TOK_RPAREN="Rparen",l.TOK_COMMA="Comma",l.TOK_COLON="Colon",l.TOK_RBRACE="Rbrace",l.TOK_NUMBER="Number",l.TOK_CURRENT="Current",l.TOK_ROOT="Root",l.TOK_EXPREF="Expref",l.TOK_PIPE="Pipe",l.TOK_OR="Or",l.TOK_AND="And",l.TOK_EQ="EQ",l.TOK_GT="GT",l.TOK_LT="LT",l.TOK_GTE="GTE",l.TOK_LTE="LTE",l.TOK_NE="NE",l.TOK_FLATTEN="Flatten",l.TOK_STAR="Star",l.TOK_FILTER="Filter",l.TOK_DOT="Dot",l.TOK_NOT="Not",l.TOK_LBRACE="Lbrace",l.TOK_LBRACKET="Lbracket",l.TOK_LPAREN="Lparen",l.TOK_LITERAL="Literal"})(i||(i={}));let c={"(":i.TOK_LPAREN,")":i.TOK_RPAREN,"*":i.TOK_STAR,",":i.TOK_COMMA,".":i.TOK_DOT,":":i.TOK_COLON,"@":i.TOK_CURRENT,["$"]:i.TOK_ROOT,"]":i.TOK_RBRACKET,"{":i.TOK_LBRACE,"}":i.TOK_RBRACE},u={"!":!0,"<":!0,"=":!0,">":!0},f={"\t":!0,"\n":!0,"\r":!0," ":!0};class _{constructor(){this._current=0}tokenize(l){let h=[];this._current=0;let k,p,T;while(this._current<l.length)if(o(l[this._current]))k=this._current,p=this.consumeUnquotedIdentifier(l),h.push({start:k,type:i.TOK_UNQUOTEDIDENTIFIER,value:p});else if(c[l[this._current]]!==void 0)h.push({start:this._current,type:c[l[this._current]],value:l[this._current]}),this._current+=1;else if(s(l[this._current]))T=this.consumeNumber(l),h.push(T);else if(l[this._current]==="[")T=this.consumeLBracket(l),h.push(T);else if(l[this._current]==='"')k=this._current,p=this.consumeQuotedIdentifier(l),h.push({start:k,type:i.TOK_QUOTEDIDENTIFIER,value:p});else if(l[this._current]==="'")k=this._current,p=this.consumeRawStringLiteral(l),h.push({start:k,type:i.TOK_LITERAL,value:p});else if(l[this._current]==="`"){k=this._current;let x=this.consumeLiteral(l);h.push({start:k,type:i.TOK_LITERAL,value:x})}else if(u[l[this._current]]!==void 0)T=this.consumeOperator(l),T&&h.push(T);else if(f[l[this._current]]!==void 0)this._current+=1;else if(l[this._current]==="&")if(k=this._current,this._current+=1,l[this._current]==="&")this._current+=1,h.push({start:k,type:i.TOK_AND,value:"&&"});else h.push({start:k,type:i.TOK_EXPREF,value:"&"});else if(l[this._current]==="|")if(k=this._current,this._current+=1,l[this._current]==="|")this._current+=1,h.push({start:k,type:i.TOK_OR,value:"||"});else h.push({start:k,type:i.TOK_PIPE,value:"|"});else{let x=Error(`Unknown character: ${l[this._current]}`);throw x.name="LexerError",x}return h}consumeUnquotedIdentifier(l){let h=this._current;this._current+=1;while(this._current<l.length&&a(l[this._current]))this._current+=1;return l.slice(h,this._current)}consumeQuotedIdentifier(l){let h=this._current;this._current+=1;let k=l.length;while(l[this._current]!=='"'&&this._current<k){let p=this._current;if(l[p]==="\\"&&(l[p+1]==="\\"||l[p+1]==='"'))p+=2;else p+=1;this._current=p}return this._current+=1,JSON.parse(l.slice(h,this._current))}consumeRawStringLiteral(l){let h=this._current;this._current+=1;let k=l.length;while(l[this._current]!=="'"&&this._current<k){let T=this._current;if(l[T]==="\\"&&(l[T+1]==="\\"||l[T+1]==="'"))T+=2;else T+=1;this._current=T}return this._current+=1,l.slice(h+1,this._current-1).replace("\\'","'")}consumeNumber(l){let h=this._current;this._current+=1;let k=l.length;while(s(l[this._current])&&this._current<k)this._current+=1;let p=parseInt(l.slice(h,this._current),10);return{start:h,value:p,type:i.TOK_NUMBER}}consumeLBracket(l){let h=this._current;if(this._current+=1,l[this._current]==="?")return this._current+=1,{start:h,type:i.TOK_FILTER,value:"[?"};if(l[this._current]==="]")return this._current+=1,{start:h,type:i.TOK_FLATTEN,value:"[]"};return{start:h,type:i.TOK_LBRACKET,value:"["}}consumeOperator(l){let h=this._current,k=l[h];if(this._current+=1,k==="!"){if(l[this._current]==="=")return this._current+=1,{start:h,type:i.TOK_NE,value:"!="};return{start:h,type:i.TOK_NOT,value:"!"}}if(k==="<"){if(l[this._current]==="=")return this._current+=1,{start:h,type:i.TOK_LTE,value:"<="};return{start:h,type:i.TOK_LT,value:"<"}}if(k===">"){if(l[this._current]==="=")return this._current+=1,{start:h,type:i.TOK_GTE,value:">="};return{start:h,type:i.TOK_GT,value:">"}}if(k==="="&&l[this._current]==="=")return this._current+=1,{start:h,type:i.TOK_EQ,value:"=="}}consumeLiteral(l){this._current+=1;let h=this._current,k=l.length;while(l[this._current]!=="`"&&this._current<k){let x=this._current;if(l[x]==="\\"&&(l[x+1]==="\\"||l[x+1]==="`"))x+=2;else x+=1;this._current=x}let p=l.slice(h,this._current).trimLeft();p=p.replace("\\`","`");let T=this.looksLikeJSON(p)?JSON.parse(p):JSON.parse(`"${p}"`);return this._current+=1,T}looksLikeJSON(l){let k=["true","false","null"],p="-0123456789";if(l==="")return!1;if('[{"'.includes(l[0]))return!0;if(k.includes(l))return!0;if("-0123456789".includes(l[0]))try{return JSON.parse(l),!0}catch(T){return!1}return!1}}let E=new _,P={[i.TOK_EOF]:0,[i.TOK_UNQUOTEDIDENTIFIER]:0,[i.TOK_QUOTEDIDENTIFIER]:0,[i.TOK_RBRACKET]:0,[i.TOK_RPAREN]:0,[i.TOK_COMMA]:0,[i.TOK_RBRACE]:0,[i.TOK_NUMBER]:0,[i.TOK_CURRENT]:0,[i.TOK_EXPREF]:0,[i.TOK_ROOT]:0,[i.TOK_PIPE]:1,[i.TOK_OR]:2,[i.TOK_AND]:3,[i.TOK_EQ]:5,[i.TOK_GT]:5,[i.TOK_LT]:5,[i.TOK_GTE]:5,[i.TOK_LTE]:5,[i.TOK_NE]:5,[i.TOK_FLATTEN]:9,[i.TOK_STAR]:20,[i.TOK_FILTER]:21,[i.TOK_DOT]:40,[i.TOK_NOT]:45,[i.TOK_LBRACE]:50,[i.TOK_LBRACKET]:55,[i.TOK_LPAREN]:60};class v{constructor(){this.index=0,this.tokens=[]}parse(l){this.loadTokens(l),this.index=0;let h=this.expression(0);if(this.lookahead(0)!==i.TOK_EOF){let k=this.lookaheadToken(0);this.errorToken(k,`Unexpected token type: ${k.type}, value: ${k.value}`)}return h}loadTokens(l){this.tokens=[...E.tokenize(l),{type:i.TOK_EOF,value:"",start:l.length}]}expression(l){let h=this.lookaheadToken(0);this.advance();let k=this.nud(h),p=this.lookahead(0);while(l<P[p])this.advance(),k=this.led(p,k),p=this.lookahead(0);return k}lookahead(l){return this.tokens[this.index+l].type}lookaheadToken(l){return this.tokens[this.index+l]}advance(){this.index+=1}nud(l){let h,k,p;switch(l.type){case i.TOK_LITERAL:return{type:"Literal",value:l.value};case i.TOK_UNQUOTEDIDENTIFIER:return{type:"Field",name:l.value};case i.TOK_QUOTEDIDENTIFIER:let T={type:"Field",name:l.value};if(this.lookahead(0)===i.TOK_LPAREN)throw Error("Quoted identifier not allowed for function names.");else return T;case i.TOK_NOT:return k=this.expression(P.Not),{type:"NotExpression",children:[k]};case i.TOK_STAR:return h={type:"Identity"},k=this.lookahead(0)===i.TOK_RBRACKET&&{type:"Identity"}||this.parseProjectionRHS(P.Star),{type:"ValueProjection",children:[h,k]};case i.TOK_FILTER:return this.led(l.type,{type:"Identity"});case i.TOK_LBRACE:return this.parseMultiselectHash();case i.TOK_FLATTEN:return h={type:i.TOK_FLATTEN,children:[{type:"Identity"}]},k=this.parseProjectionRHS(P.Flatten),{type:"Projection",children:[h,k]};case i.TOK_LBRACKET:if(this.lookahead(0)===i.TOK_NUMBER||this.lookahead(0)===i.TOK_COLON)return k=this.parseIndexExpression(),this.projectIfSlice({type:"Identity"},k);if(this.lookahead(0)===i.TOK_STAR&&this.lookahead(1)===i.TOK_RBRACKET)return this.advance(),this.advance(),k=this.parseProjectionRHS(P.Star),{children:[{type:"Identity"},k],type:"Projection"};return this.parseMultiselectList();case i.TOK_CURRENT:return{type:i.TOK_CURRENT};case i.TOK_ROOT:return{type:i.TOK_ROOT};case i.TOK_EXPREF:return p=this.expression(P.Expref),{type:"ExpressionReference",children:[p]};case i.TOK_LPAREN:let x=[];while(this.lookahead(0)!==i.TOK_RPAREN){if(this.lookahead(0)===i.TOK_CURRENT)p={type:i.TOK_CURRENT},this.advance();else p=this.expression(0);x.push(p)}return this.match(i.TOK_RPAREN),x[0];default:this.errorToken(l)}}led(l,h){let k;switch(l){case i.TOK_DOT:let p=P.Dot;if(this.lookahead(0)!==i.TOK_STAR)return k=this.parseDotRHS(p),{type:"Subexpression",children:[h,k]};return this.advance(),k=this.parseProjectionRHS(p),{type:"ValueProjection",children:[h,k]};case i.TOK_PIPE:return k=this.expression(P.Pipe),{type:i.TOK_PIPE,children:[h,k]};case i.TOK_OR:return k=this.expression(P.Or),{type:"OrExpression",children:[h,k]};case i.TOK_AND:return k=this.expression(P.And),{type:"AndExpression",children:[h,k]};case i.TOK_LPAREN:let T=h.name,x=[],F;while(this.lookahead(0)!==i.TOK_RPAREN){if(this.lookahead(0)===i.TOK_CURRENT)F={type:i.TOK_CURRENT},this.advance();else F=this.expression(0);if(this.lookahead(0)===i.TOK_COMMA)this.match(i.TOK_COMMA);x.push(F)}return this.match(i.TOK_RPAREN),{name:T,type:"Function",children:x};case i.TOK_FILTER:let X=this.expression(0);return this.match(i.TOK_RBRACKET),k=this.lookahead(0)===i.TOK_FLATTEN&&{type:"Identity"}||this.parseProjectionRHS(P.Filter),{type:"FilterProjection",children:[h,k,X]};case i.TOK_FLATTEN:let te={type:i.TOK_FLATTEN,children:[h]},le=this.parseProjectionRHS(P.Flatten);return{type:"Projection",children:[te,le]};case i.TOK_EQ:case i.TOK_NE:case i.TOK_GT:case i.TOK_GTE:case i.TOK_LT:case i.TOK_LTE:return this.parseComparator(h,l);case i.TOK_LBRACKET:let oe=this.lookaheadToken(0);if(oe.type===i.TOK_NUMBER||oe.type===i.TOK_COLON)return k=this.parseIndexExpression(),this.projectIfSlice(h,k);return this.match(i.TOK_STAR),this.match(i.TOK_RBRACKET),k=this.parseProjectionRHS(P.Star),{type:"Projection",children:[h,k]};default:return this.errorToken(this.lookaheadToken(0))}}match(l){if(this.lookahead(0)===l){this.advance();return}else{let h=this.lookaheadToken(0);this.errorToken(h,`Expected ${l}, got: ${h.type}`)}}errorToken(l,h=""){let k=Error(h||`Invalid token (${l.type}): "${l.value}"`);throw k.name="ParserError",k}parseIndexExpression(){if(this.lookahead(0)===i.TOK_COLON||this.lookahead(1)===i.TOK_COLON)return this.parseSliceExpression();let l={type:"Index",value:this.lookaheadToken(0).value};return this.advance(),this.match(i.TOK_RBRACKET),l}projectIfSlice(l,h){let k={type:"IndexExpression",children:[l,h]};if(h.type==="Slice")return{children:[k,this.parseProjectionRHS(P.Star)],type:"Projection"};return k}parseSliceExpression(){let l=[null,null,null],h=0,k=this.lookahead(0);while(k!==i.TOK_RBRACKET&&h<3){if(k===i.TOK_COLON)h+=1,this.advance();else if(k===i.TOK_NUMBER)l[h]=this.lookaheadToken(0).value,this.advance();else{let p=this.lookaheadToken(0);this.errorToken(p,`Syntax error, unexpected token: ${p.value}(${p.type})`)}k=this.lookahead(0)}return this.match(i.TOK_RBRACKET),{children:l,type:"Slice"}}parseComparator(l,h){let k=this.expression(P[h]);return{type:"Comparator",name:h,children:[l,k]}}parseDotRHS(l){let h=this.lookahead(0);if([i.TOK_UNQUOTEDIDENTIFIER,i.TOK_QUOTEDIDENTIFIER,i.TOK_STAR].includes(h))return this.expression(l);if(h===i.TOK_LBRACKET)return this.match(i.TOK_LBRACKET),this.parseMultiselectList();if(h===i.TOK_LBRACE)return this.match(i.TOK_LBRACE),this.parseMultiselectHash();let p=this.lookaheadToken(0);this.errorToken(p,`Syntax error, unexpected token: ${p.value}(${p.type})`)}parseProjectionRHS(l){if(P[this.lookahead(0)]<10)return{type:"Identity"};if(this.lookahead(0)===i.TOK_LBRACKET)return this.expression(l);if(this.lookahead(0)===i.TOK_FILTER)return this.expression(l);if(this.lookahead(0)===i.TOK_DOT)return this.match(i.TOK_DOT),this.parseDotRHS(l);let h=this.lookaheadToken(0);this.errorToken(h,`Syntax error, unexpected token: ${h.value}(${h.type})`)}parseMultiselectList(){let l=[];while(this.lookahead(0)!==i.TOK_RBRACKET){let h=this.expression(0);if(l.push(h),this.lookahead(0)===i.TOK_COMMA){if(this.match(i.TOK_COMMA),this.lookahead(0)===i.TOK_RBRACKET)throw Error("Unexpected token Rbracket")}}return this.match(i.TOK_RBRACKET),{type:"MultiSelectList",children:l}}parseMultiselectHash(){let l=[],h=[i.TOK_UNQUOTEDIDENTIFIER,i.TOK_QUOTEDIDENTIFIER],k,p,T;for(;;){if(k=this.lookaheadToken(0),!h.includes(k.type))throw Error(`Expecting an identifier token, got: ${k.type}`);if(p=k.value,this.advance(),this.match(i.TOK_COLON),T=this.expression(0),l.push({value:T,type:"KeyValuePair",name:p}),this.lookahead(0)===i.TOK_COMMA)this.match(i.TOK_COMMA);else if(this.lookahead(0)===i.TOK_RBRACE){this.match(i.TOK_RBRACE);break}}return{type:"MultiSelectHash",children:l}}}let w=new v;var m;(function(l){l[l.TYPE_NUMBER=0]="TYPE_NUMBER",l[l.TYPE_ANY=1]="TYPE_ANY",l[l.TYPE_STRING=2]="TYPE_STRING",l[l.TYPE_ARRAY=3]="TYPE_ARRAY",l[l.TYPE_OBJECT=4]="TYPE_OBJECT",l[l.TYPE_BOOLEAN=5]="TYPE_BOOLEAN",l[l.TYPE_EXPREF=6]="TYPE_EXPREF",l[l.TYPE_NULL=7]="TYPE_NULL",l[l.TYPE_ARRAY_NUMBER=8]="TYPE_ARRAY_NUMBER",l[l.TYPE_ARRAY_STRING=9]="TYPE_ARRAY_STRING"})(m||(m={}));class g{constructor(l){this.TYPE_NAME_TABLE={[m.TYPE_NUMBER]:"number",[m.TYPE_ANY]:"any",[m.TYPE_STRING]:"string",[m.TYPE_ARRAY]:"array",[m.TYPE_OBJECT]:"object",[m.TYPE_BOOLEAN]:"boolean",[m.TYPE_EXPREF]:"expression",[m.TYPE_NULL]:"null",[m.TYPE_ARRAY_NUMBER]:"Array<number>",[m.TYPE_ARRAY_STRING]:"Array<string>"},this.functionAbs=([h])=>Math.abs(h),this.functionAvg=([h])=>{let k=0;for(let p=0;p<h.length;p+=1)k+=h[p];return k/h.length},this.functionCeil=([h])=>Math.ceil(h),this.functionContains=(h)=>{let[k,p]=h;return k.includes(p)},this.functionEndsWith=(h)=>{let[k,p]=h;return k.includes(p,k.length-p.length)},this.functionFloor=([h])=>Math.floor(h),this.functionJoin=(h)=>{let[k,p]=h;return p.join(k)},this.functionKeys=([h])=>Object.keys(h),this.functionLength=([h])=>{if(!t(h))return h.length;return Object.keys(h).length},this.functionMap=(h)=>{if(!this._interpreter)return[];let k=[],p=this._interpreter,T=h[0],x=h[1];for(let F=0;F<x.length;F+=1)k.push(p.visit(T,x[F]));return k},this.functionMax=([h])=>{if(!h.length)return null;if(this.getTypeName(h[0])===m.TYPE_NUMBER)return Math.max(...h);let p=h,T=p[0];for(let x=1;x<p.length;x+=1)if(T.localeCompare(p[x])<0)T=p[x];return T},this.functionMaxBy=(h)=>{let k=h[1],p=h[0],T=this.createKeyFunction(k,[m.TYPE_NUMBER,m.TYPE_STRING]),x=-1/0,F,K;for(let X=0;X<p.length;X+=1)if(K=T&&T(p[X]),K!==void 0&&K>x)x=K,F=p[X];return F},this.functionMerge=(h)=>{let k={};for(let p=0;p<h.length;p+=1){let T=h[p];k=Object.assign(k,T)}return k},this.functionMin=([h])=>{if(!h.length)return null;if(this.getTypeName(h[0])===m.TYPE_NUMBER)return Math.min(...h);let p=h,T=p[0];for(let x=1;x<p.length;x+=1)if(p[x].localeCompare(T)<0)T=p[x];return T},this.functionMinBy=(h)=>{let k=h[1],p=h[0],T=this.createKeyFunction(k,[m.TYPE_NUMBER,m.TYPE_STRING]),x=1/0,F,K;for(let X=0;X<p.length;X+=1)if(K=T&&T(p[X]),K!==void 0&&K<x)x=K,F=p[X];return F},this.functionNotNull=(h)=>{for(let k=0;k<h.length;k+=1)if(this.getTypeName(h[k])!==m.TYPE_NULL)return h[k];return null},this.functionReverse=([h])=>{if(this.getTypeName(h)===m.TYPE_STRING){let T=h,x="";for(let F=T.length-1;F>=0;F-=1)x+=T[F];return x}let p=h.slice(0);return p.reverse(),p},this.functionSort=([h])=>[...h].sort(),this.functionSortBy=(h)=>{if(!this._interpreter)return[];let k=h[0].slice(0);if(k.length===0)return k;let p=this._interpreter,T=h[1],x=this.getTypeName(p.visit(T,k[0]));if(x!==void 0&&![m.TYPE_NUMBER,m.TYPE_STRING].includes(x))throw Error(`TypeError: unexpected type (${this.TYPE_NAME_TABLE[x]})`);let F=[];for(let K=0;K<k.length;K+=1)F.push([K,k[K]]);F.sort((K,X)=>{let te=p.visit(T,K[1]),le=p.visit(T,X[1]);if(this.getTypeName(te)!==x)throw Error(`TypeError: expected (${this.TYPE_NAME_TABLE[x]}), received ${this.TYPE_NAME_TABLE[this.getTypeName(te)]}`);else if(this.getTypeName(le)!==x)throw Error(`TypeError: expected (${this.TYPE_NAME_TABLE[x]}), received ${this.TYPE_NAME_TABLE[this.getTypeName(le)]}`);if(te>le)return 1;return te<le?-1:K[0]-X[0]});for(let K=0;K<F.length;K+=1)k[K]=F[K][1];return k},this.functionStartsWith=([h,k])=>h.startsWith(k),this.functionSum=([h])=>h.reduce((k,p)=>k+p,0),this.functionToArray=([h])=>{if(this.getTypeName(h)===m.TYPE_ARRAY)return h;return[h]},this.functionToNumber=([h])=>{let k=this.getTypeName(h),p;if(k===m.TYPE_NUMBER)return h;if(k===m.TYPE_STRING){if(p=+h,!isNaN(p))return p}return null},this.functionToString=([h])=>{if(this.getTypeName(h)===m.TYPE_STRING)return h;return JSON.stringify(h)},this.functionType=([h])=>{switch(this.getTypeName(h)){case m.TYPE_NUMBER:return"number";case m.TYPE_STRING:return"string";case m.TYPE_ARRAY:return"array";case m.TYPE_OBJECT:return"object";case m.TYPE_BOOLEAN:return"boolean";case m.TYPE_EXPREF:return"expref";case m.TYPE_NULL:return"null";default:return}},this.functionValues=([h])=>Object.values(h),this.functionTable={abs:{_func:this.functionAbs,_signature:[{types:[m.TYPE_NUMBER]}]},avg:{_func:this.functionAvg,_signature:[{types:[m.TYPE_ARRAY_NUMBER]}]},ceil:{_func:this.functionCeil,_signature:[{types:[m.TYPE_NUMBER]}]},contains:{_func:this.functionContains,_signature:[{types:[m.TYPE_STRING,m.TYPE_ARRAY]},{types:[m.TYPE_ANY]}]},ends_with:{_func:this.functionEndsWith,_signature:[{types:[m.TYPE_STRING]},{types:[m.TYPE_STRING]}]},floor:{_func:this.functionFloor,_signature:[{types:[m.TYPE_NUMBER]}]},join:{_func:this.functionJoin,_signature:[{types:[m.TYPE_STRING]},{types:[m.TYPE_ARRAY_STRING]}]},keys:{_func:this.functionKeys,_signature:[{types:[m.TYPE_OBJECT]}]},length:{_func:this.functionLength,_signature:[{types:[m.TYPE_STRING,m.TYPE_ARRAY,m.TYPE_OBJECT]}]},map:{_func:this.functionMap,_signature:[{types:[m.TYPE_EXPREF]},{types:[m.TYPE_ARRAY]}]},max:{_func:this.functionMax,_signature:[{types:[m.TYPE_ARRAY_NUMBER,m.TYPE_ARRAY_STRING]}]},max_by:{_func:this.functionMaxBy,_signature:[{types:[m.TYPE_ARRAY]},{types:[m.TYPE_EXPREF]}]},merge:{_func:this.functionMerge,_signature:[{types:[m.TYPE_OBJECT],variadic:!0}]},min:{_func:this.functionMin,_signature:[{types:[m.TYPE_ARRAY_NUMBER,m.TYPE_ARRAY_STRING]}]},min_by:{_func:this.functionMinBy,_signature:[{types:[m.TYPE_ARRAY]},{types:[m.TYPE_EXPREF]}]},not_null:{_func:this.functionNotNull,_signature:[{types:[m.TYPE_ANY],variadic:!0}]},reverse:{_func:this.functionReverse,_signature:[{types:[m.TYPE_STRING,m.TYPE_ARRAY]}]},sort:{_func:this.functionSort,_signature:[{types:[m.TYPE_ARRAY_STRING,m.TYPE_ARRAY_NUMBER]}]},sort_by:{_func:this.functionSortBy,_signature:[{types:[m.TYPE_ARRAY]},{types:[m.TYPE_EXPREF]}]},starts_with:{_func:this.functionStartsWith,_signature:[{types:[m.TYPE_STRING]},{types:[m.TYPE_STRING]}]},sum:{_func:this.functionSum,_signature:[{types:[m.TYPE_ARRAY_NUMBER]}]},to_array:{_func:this.functionToArray,_signature:[{types:[m.TYPE_ANY]}]},to_number:{_func:this.functionToNumber,_signature:[{types:[m.TYPE_ANY]}]},to_string:{_func:this.functionToString,_signature:[{types:[m.TYPE_ANY]}]},type:{_func:this.functionType,_signature:[{types:[m.TYPE_ANY]}]},values:{_func:this.functionValues,_signature:[{types:[m.TYPE_OBJECT]}]}},this._interpreter=l}registerFunction(l,h,k){if(l in this.functionTable)throw Error(`Function already defined: ${l}()`);this.functionTable[l]={_func:h.bind(this),_signature:k}}callFunction(l,h){let k=this.functionTable[l];if(k===void 0)throw Error(`Unknown function: ${l}()`);return this.validateArgs(l,h,k._signature),k._func.call(this,h)}validateInputSignatures(l,h){for(let k=0;k<h.length;k+=1)if("variadic"in h[k]&&k!==h.length-1)throw Error(`ArgumentError: ${l}() 'variadic' argument ${k+1} must occur last`)}validateArgs(l,h,k){var p,T;let x;this.validateInputSignatures(l,k);let F=k.filter((U)=>{var ee;return(ee=!U.optional)!==null&&ee!==void 0?ee:!1}).length,K=(T=(p=k[k.length-1])===null||p===void 0?void 0:p.variadic)!==null&&T!==void 0?T:!1,X=h.length<F,te=h.length>k.length,le=X&&(!K&&F>1||K)?"at least ":"";if(K&&X||!K&&(X||te))throw x=k.length>1,Error(`ArgumentError: ${l}() takes ${le}${F} argument${x&&"s"||""} but received ${h.length}`);let oe,C,M;for(let U=0;U<k.length;U+=1){M=!1,oe=k[U].types,C=this.getTypeName(h[U]);let ee;for(ee=0;ee<oe.length;ee+=1)if(C!==void 0&&this.typeMatches(C,oe[ee],h[U])){M=!0;break}if(!M&&C!==void 0){let ie=oe.map((ue)=>this.TYPE_NAME_TABLE[ue]).join(" | ");throw Error(`TypeError: ${l}() expected argument ${U+1} to be type (${ie}) but received type ${this.TYPE_NAME_TABLE[C]} instead.`)}}}typeMatches(l,h,k){if(h===m.TYPE_ANY)return!0;if(h===m.TYPE_ARRAY_STRING||h===m.TYPE_ARRAY_NUMBER||h===m.TYPE_ARRAY){if(h===m.TYPE_ARRAY)return l===m.TYPE_ARRAY;if(l===m.TYPE_ARRAY){let p;if(h===m.TYPE_ARRAY_NUMBER)p=m.TYPE_NUMBER;else if(h===m.TYPE_ARRAY_STRING)p=m.TYPE_STRING;for(let T=0;T<k.length;T+=1){let x=this.getTypeName(k[T]);if(x!==void 0&&p!==void 0&&!this.typeMatches(x,p,k[T]))return!1}return!0}}else return l===h;return!1}getTypeName(l){switch(Object.prototype.toString.call(l)){case"[object String]":return m.TYPE_STRING;case"[object Number]":return m.TYPE_NUMBER;case"[object Array]":return m.TYPE_ARRAY;case"[object Boolean]":return m.TYPE_BOOLEAN;case"[object Null]":return m.TYPE_NULL;case"[object Object]":if(l.jmespathType===i.TOK_EXPREF)return m.TYPE_EXPREF;return m.TYPE_OBJECT;default:return}}createKeyFunction(l,h){if(!this._interpreter)return;let k=this._interpreter;return(T)=>{let x=k.visit(l,T);if(!h.includes(this.getTypeName(x))){let F=`TypeError: expected one of (${h.map((K)=>this.TYPE_NAME_TABLE[K]).join(" | ")}), received ${this.TYPE_NAME_TABLE[this.getTypeName(x)]}`;throw Error(F)}return x}}}class z{constructor(){this._rootValue=null,this.runtime=new g(this)}search(l,h){return this._rootValue=h,this.visit(l,h)}visit(l,h){let k,p,T,x,F,K,X,te,le,oe,C;switch(l.type){case"Field":if(h===null)return null;if(t(h)){if(K=h[l.name],K===void 0)return null;return K}return null;case"Subexpression":T=this.visit(l.children[0],h);for(oe=1;oe<l.children.length;oe+=1)if(T=this.visit(l.children[1],T),T===null)return null;return T;case"IndexExpression":return X=this.visit(l.children[0],h),te=this.visit(l.children[1],X),te;case"Index":if(!Array.isArray(h))return null;let M=l.value;if(M<0)M=h.length+M;if(T=h[M],T===void 0)T=null;return T;case"Slice":if(!Array.isArray(h))return null;let U=[...l.children],ee=this.computeSliceParams(h.length,U),[ie,ue,Te]=ee;if(T=[],Te>0)for(oe=ie;oe<ue;oe+=Te)T.push(h[oe]);else for(oe=ie;oe>ue;oe+=Te)T.push(h[oe]);return T;case"Projection":if(C=this.visit(l.children[0],h),!Array.isArray(C))return null;le=[];for(oe=0;oe<C.length;oe+=1)if(p=this.visit(l.children[1],C[oe]),p!==null)le.push(p);return le;case"ValueProjection":if(C=this.visit(l.children[0],h),!t(C))return null;le=[];let Ne=Object.values(C);for(oe=0;oe<Ne.length;oe+=1)if(p=this.visit(l.children[1],Ne[oe]),p!==null)le.push(p);return le;case"FilterProjection":if(C=this.visit(l.children[0],h),!Array.isArray(C))return null;let qe=[],Ce=[];for(oe=0;oe<C.length;oe+=1)if(k=this.visit(l.children[2],C[oe]),!n(k))qe.push(C[oe]);for(let Fe=0;Fe<qe.length;Fe+=1)if(p=this.visit(l.children[1],qe[Fe]),p!==null)Ce.push(p);return Ce;case"Comparator":switch(x=this.visit(l.children[0],h),F=this.visit(l.children[1],h),l.name){case i.TOK_EQ:T=r(x,F);break;case i.TOK_NE:T=!r(x,F);break;case i.TOK_GT:T=x>F;break;case i.TOK_GTE:T=x>=F;break;case i.TOK_LT:T=x<F;break;case i.TOK_LTE:T=x<=F;break;default:throw Error(`Unknown comparator: ${l.name}`)}return T;case i.TOK_FLATTEN:let $e=this.visit(l.children[0],h);if(!Array.isArray($e))return null;let Ue=[];for(oe=0;oe<$e.length;oe+=1)if(p=$e[oe],Array.isArray(p))Ue=[...Ue,...p];else Ue.push(p);return Ue;case"Identity":return h;case"MultiSelectList":if(h===null)return null;le=[];for(oe=0;oe<l.children.length;oe+=1)le.push(this.visit(l.children[oe],h));return le;case"MultiSelectHash":if(h===null)return null;le={};let xe;for(oe=0;oe<l.children.length;oe+=1)xe=l.children[oe],le[xe.name]=this.visit(xe.value,h);return le;case"OrExpression":if(k=this.visit(l.children[0],h),n(k))k=this.visit(l.children[1],h);return k;case"AndExpression":if(x=this.visit(l.children[0],h),n(x))return x;return this.visit(l.children[1],h);case"NotExpression":return x=this.visit(l.children[0],h),n(x);case"Literal":return l.value;case i.TOK_PIPE:return X=this.visit(l.children[0],h),this.visit(l.children[1],X);case i.TOK_CURRENT:return h;case i.TOK_ROOT:return this._rootValue;case"Function":let nt=[];for(let Fe=0;Fe<l.children.length;Fe+=1)nt.push(this.visit(l.children[Fe],h));return this.runtime.callFunction(l.name,nt);case"ExpressionReference":let Ge=l.children[0];return Ge.jmespathType=i.TOK_EXPREF,Ge;default:throw Error(`Unknown node type: ${l.type}`)}}computeSliceParams(l,h){let[k,p,T]=h;if(T===null)T=1;else if(T===0){let F=Error("Invalid slice, step cannot be 0");throw F.name="RuntimeError",F}let x=T<0?!0:!1;return k=k===null?x?l-1:0:this.capSliceRange(l,k,T),p=p===null?x?-1:l:this.capSliceRange(l,p,T),[k,p,T]}capSliceRange(l,h,k){let p=h;if(p<0){if(p+=l,p<0)p=k<0?-1:0}else if(p>=l)p=k<0?l-1:l;return p}}let S=new z,b=m.TYPE_ANY,O=m.TYPE_ARRAY,R=m.TYPE_ARRAY_NUMBER,y=m.TYPE_ARRAY_STRING,N=m.TYPE_BOOLEAN,q=m.TYPE_EXPREF,H=m.TYPE_NULL,D=m.TYPE_NUMBER,Z=m.TYPE_OBJECT,G=m.TYPE_STRING;function B(l){return w.parse(l)}function he(l){return E.tokenize(l)}let we=(l,h,k)=>{S.runtime.registerFunction(l,h,k)};function be(l,h){let k=w.parse(h);return S.search(k,l)}let Oe=S,fe={compile:B,registerFunction:we,search:be,tokenize:he,TreeInterpreter:Oe,TYPE_ANY:b,TYPE_ARRAY_NUMBER:R,TYPE_ARRAY_STRING:y,TYPE_ARRAY:O,TYPE_BOOLEAN:N,TYPE_EXPREF:q,TYPE_NULL:H,TYPE_NUMBER:D,TYPE_OBJECT:Z,TYPE_STRING:G};e.TYPE_ANY=b,e.TYPE_ARRAY=O,e.TYPE_ARRAY_NUMBER=R,e.TYPE_ARRAY_STRING=y,e.TYPE_BOOLEAN=N,e.TYPE_EXPREF=q,e.TYPE_NULL=H,e.TYPE_NUMBER=D,e.TYPE_OBJECT=Z,e.TYPE_STRING=G,e.TreeInterpreter=Oe,e.compile=B,e.default=fe,e.jmespath=fe,e.registerFunction=we,e.search=be,e.tokenize=he,Object.defineProperty(e,"__esModule",{value:!0})})});var{create:gg,defineProperty:Fo,getOwnPropertyDescriptor:_g,getOwnPropertyNames:Sg,getPrototypeOf:yg}=Object,vg=Object.prototype.hasOwnProperty,V=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),cl=(e,t)=>{let r={};for(var n in e)Fo(r,n,{get:e[n],enumerable:!0});if(t)Fo(r,Symbol.toStringTag,{value:"Module"});return r},bg=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(var o=Sg(t),s=0,a=o.length,i;s<a;s++)if(i=o[s],!vg.call(e,i)&&i!==r)Fo(e,i,{get:((c)=>t[c]).bind(null,i),enumerable:!(n=_g(t,i))||n.enumerable})}return e},Zo=(e,t,r)=>(r=e!=null?gg(yg(e)):{},bg(t||!e||!e.__esModule?Fo(r,"default",{value:e,enumerable:!0}):r,e));var Rg=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),ul=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),zg=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),wg=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function ll(e){return typeof e==="string"&&ul.has(e.replace(/#$/,""))}function dl(e,t){if(!("$schema"in e)||typeof e.$schema!=="string")return"2020-12";let r=e.$schema.replace(/#$/,"");if(Rg.has(r))return"2020-12";if(ul.has(r))return"2019-09";if(zg.has(r)||wg.has(r))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}`)}var ml,Sa=Object.freeze({status:"aborted"});function L(e,t,r){function n(i,c){if(!i._zod)Object.defineProperty(i,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1});if(i._zod.traits.has(e))return;i._zod.traits.add(e),t(i,c);let u=a.prototype,f=Object.keys(u);for(let _=0;_<f.length;_++){let E=f[_];if(!(E in i))i[E]=u[E].bind(i)}}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function a(i){var c;let u=r?.Parent?new s:this;n(u,i),(c=u._zod).deferred??(c.deferred=[]);for(let f of u._zod.deferred)f();return u}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:(i)=>{if(r?.Parent&&i instanceof r.Parent)return!0;return i?._zod?.traits?.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}var $g=Symbol("zod_brand");class pt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class wn extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(ml=globalThis).__zod_globalConfig??(ml.__zod_globalConfig={});var vr=globalThis.__zod_globalConfig;function Xe(e){if(e)Object.assign(vr,e);return vr}var ve={};Uo(ve,{BIGINT_FORMAT_RANGES:()=>gl,Class:()=>vl,NUMBER_FORMAT_RANGES:()=>$a,aborted:()=>kt,allowsEval:()=>Ra,assert:()=>Og,assertEqual:()=>Eg,assertIs:()=>Pg,assertNever:()=>kg,assertNotEqual:()=>Tg,assignProp:()=>Tt,base64ToUint8Array:()=>Sl,base64urlToUint8Array:()=>Kg,cached:()=>Rr,captureStackTrace:()=>Ho,cleanEnum:()=>Hg,cleanRegex:()=>Pn,clone:()=>st,cloneDef:()=>Ng,createTransparentProxy:()=>qg,defineLazy:()=>ye,esc:()=>Jo,escapeRegex:()=>ft,explicitlyAborted:()=>Ea,extend:()=>Ug,finalizeIssue:()=>it,floatSafeRemainder:()=>va,getElementAtPath:()=>xg,getEnumValues:()=>En,getLengthableOrigin:()=>kn,getParsedType:()=>Mg,getSizableOrigin:()=>_l,hexToUint8Array:()=>Yg,isObject:()=>Xt,isPlainObject:()=>Pt,issue:()=>zr,joinValues:()=>Vo,jsonStringifyReplacer:()=>br,merge:()=>Zg,mergeDefs:()=>ht,normalizeParams:()=>ae,nullish:()=>Tn,numKeys:()=>jg,objectClone:()=>Cg,omit:()=>Dg,optionalKeys:()=>wa,parsedType:()=>Ta,partial:()=>Vg,pick:()=>Lg,prefixIssues:()=>gt,primitiveTypes:()=>fl,promiseAllObject:()=>Ig,propertyKeyTypes:()=>za,randomString:()=>Ag,required:()=>Jg,safeExtend:()=>Fg,shallowClone:()=>hl,slugify:()=>ba,stringifyPrimitive:()=>Ko,uint8ArrayToBase64:()=>yl,uint8ArrayToBase64url:()=>Bg,uint8ArrayToHex:()=>Gg,unwrapMessage:()=>$n});function Eg(e){return e}function Tg(e){return e}function Pg(e){}function kg(e){throw Error("Unexpected value in exhaustive check")}function Og(e){}function En(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Vo(e,t="|"){return e.map((r)=>Ko(r)).join(t)}function br(e,t){if(typeof t==="bigint")return t.toString();return t}function Rr(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function Tn(e){return e===null||e===void 0}function Pn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function va(e,t){let r=e/t,n=Math.round(r),o=Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}var pl=Symbol("evaluating");function ye(e,t,r){let n=void 0;Object.defineProperty(e,t,{get(){if(n===pl)return;if(n===void 0)n=pl,n=r();return n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Cg(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Tt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ht(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Ng(e){return ht(e._zod.def)}function xg(e,t){if(!t)return e;return t.reduce((r,n)=>r?.[n],e)}function Ig(e){let t=Object.keys(e),r=t.map((n)=>e[n]);return Promise.all(r).then((n)=>{let o={};for(let s=0;s<t.length;s++)o[t[s]]=n[s];return o})}function Ag(e=10){let r="";for(let n=0;n<e;n++)r+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return r}function Jo(e){return JSON.stringify(e)}function ba(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ho="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Xt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Ra=Rr(()=>{if(vr.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Pt(e){if(Xt(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(Xt(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function hl(e){if(Pt(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}function jg(e){let t=0;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r))t++;return t}var Mg=(e)=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(e))return"array";if(e===null)return"null";if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return"promise";if(typeof Map<"u"&&e instanceof Map)return"map";if(typeof Set<"u"&&e instanceof Set)return"set";if(typeof Date<"u"&&e instanceof Date)return"date";if(typeof File<"u"&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},za=new Set(["string","number","symbol"]),fl=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ft(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function st(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function ae(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}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function qg(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,s){return t??(t=e()),Reflect.set(t,n,o,s)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function Ko(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function wa(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var $a={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},gl={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Lg(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let s=ht(e._zod.def,{get shape(){let a={};for(let i in t){if(!(i in r.shape))throw Error(`Unrecognized key: "${i}"`);if(!t[i])continue;a[i]=r.shape[i]}return Tt(this,"shape",a),a},checks:[]});return st(e,s)}function Dg(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let s=ht(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let i in t){if(!(i in r.shape))throw Error(`Unrecognized key: "${i}"`);if(!t[i])continue;delete a[i]}return Tt(this,"shape",a),a},checks:[]});return st(e,s)}function Ug(e,t){if(!Pt(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(s,a)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=ht(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return Tt(this,"shape",s),s}});return st(e,o)}function Fg(e,t){if(!Pt(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=ht(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Tt(this,"shape",n),n}});return st(e,r)}function Zg(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=ht(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Tt(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return st(e,r)}function Vg(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let a=ht(t._zod.def,{get shape(){let i=t._zod.def.shape,c={...i};if(r)for(let u in r){if(!(u in i))throw Error(`Unrecognized key: "${u}"`);if(!r[u])continue;c[u]=e?new e({type:"optional",innerType:i[u]}):i[u]}else for(let u in i)c[u]=e?new e({type:"optional",innerType:i[u]}):i[u];return Tt(this,"shape",c),c},checks:[]});return st(t,a)}function Jg(e,t,r){let n=ht(t._zod.def,{get shape(){let o=t._zod.def.shape,s={...o};if(r)for(let a in r){if(!(a in s))throw Error(`Unrecognized key: "${a}"`);if(!r[a])continue;s[a]=new e({type:"nonoptional",innerType:o[a]})}else for(let a in o)s[a]=new e({type:"nonoptional",innerType:o[a]});return Tt(this,"shape",s),s}});return st(t,n)}function kt(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Ea(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function gt(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function $n(e){return typeof e==="string"?e:e?.message}function it(e,t,r){let n=e.message?e.message:$n(e.inst?._zod.def?.error?.(e))??$n(t?.error?.(e))??$n(r.customError?.(e))??$n(r.localeError?.(e))??"Invalid input",{inst:o,continue:s,input:a,...i}=e;if(i.path??(i.path=[]),i.message=n,t?.reportInput)i.input=a;return i}function _l(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}function kn(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Ta(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 r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function zr(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function Hg(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map((t)=>t[1])}function Sl(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function yl(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Kg(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Sl(t+r)}function Bg(e){return yl(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Yg(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function Gg(e){return Array.from(e).map((t)=>t.toString(16).padStart(2,"0")).join("")}class vl{constructor(...e){}}var bl=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,br,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Bo=L("$ZodError",bl),Pa=L("$ZodError",bl,{Parent:Error});function ka(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function Oa(e,t=(r)=>r.message){let r={_errors:[]},n=(o,s=[])=>{for(let a of o.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map((i)=>n({issues:i},[...s,...a.path]));else if(a.code==="invalid_key")n({issues:a.issues},[...s,...a.path]);else if(a.code==="invalid_element")n({issues:a.issues},[...s,...a.path]);else{let i=[...s,...a.path];if(i.length===0)r._errors.push(t(a));else{let c=r,u=0;while(u<i.length){let f=i[u];if(u!==i.length-1)c[f]=c[f]||{_errors:[]};else c[f]=c[f]||{_errors:[]},c[f]._errors.push(t(a));c=c[f],u++}}}};return n(e),r}var Yo=(e)=>(t,r,n,o)=>{let s=n?{...n,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new pt;if(a.issues.length){let i=new(o?.Err??e)(a.issues.map((c)=>it(c,s,Xe())));throw Ho(i,o?.callee),i}return a.value};var Go=(e)=>async(t,r,n,o)=>{let s=n?{...n,async:!0}:{async:!0},a=t._zod.run({value:r,issues:[]},s);if(a instanceof Promise)a=await a;if(a.issues.length){let i=new(o?.Err??e)(a.issues.map((c)=>it(c,s,Xe())));throw Ho(i,o?.callee),i}return a.value};var On=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new pt;return s.issues.length?{success:!1,error:new(e??Bo)(s.issues.map((a)=>it(a,o,Xe())))}:{success:!0,data:s.value}},Rl=On(Pa),Cn=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)s=await s;return s.issues.length?{success:!1,error:new e(s.issues.map((a)=>it(a,o,Xe())))}:{success:!0,data:s.value}},zl=Cn(Pa),wl=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Yo(e)(t,r,o)};var $l=(e)=>(t,r,n)=>Yo(e)(t,r,n);var El=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Go(e)(t,r,o)};var Tl=(e)=>async(t,r,n)=>Go(e)(t,r,n);var Pl=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return On(e)(t,r,o)};var kl=(e)=>(t,r,n)=>On(e)(t,r,n);var Ol=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Cn(e)(t,r,o)};var Cl=(e)=>async(t,r,n)=>Cn(e)(t,r,n);var Nl=/^[cC][0-9a-z]{6,}$/,xl=/^[0-9a-z]+$/,Il=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Al=/^[0-9a-vA-V]{20}$/,jl=/^[A-Za-z0-9]{27}$/,Ml=/^[a-zA-Z0-9_-]{21}$/,ql=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Ll=/^([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})$/,Ca=(e)=>{if(!e)return/^([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)$/;return new 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})$`)};var Dl=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Wg="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Ul(){return new RegExp(Wg,"u")}var Fl=/^(?:(?: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])$/,Zl=/^(([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}|:))$/;var Vl=/^((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])$/,Jl=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Hl=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Na=/^[A-Za-z0-9_-]*$/;var Kl=/^https?$/,Bl=/^\+[1-9]\d{6,14}$/,Yl="(?:(?:\\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])))",Gl=new RegExp(`^${Yl}$`);function Ql(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Wl(e){return new RegExp(`^${Ql(e)}$`)}function Xl(e){let t=Ql({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Yl}T(?:${n})$`)}var ed=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},td=/^-?\d+n?$/,rd=/^-?\d+$/,Qo=/^-?\d+(?:\.\d+)?$/,nd=/^(?:true|false)$/i,od=/^null$/i;var sd=/^[^A-Z]*$/,id=/^[^a-z]*$/;var Ze=L("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),ad={number:"number",bigint:"bigint",object:"date"},xa=L("$ZodCheckLessThan",(e,t)=>{Ze.init(e,t);let r=ad[typeof t.value];e._zod.onattach.push((n)=>{let o=n._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<s)if(t.inclusive)o.maximum=t.value;else o.exclusiveMaximum=t.value}),e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ia=L("$ZodCheckGreaterThan",(e,t)=>{Ze.init(e,t);let r=ad[typeof t.value];e._zod.onattach.push((n)=>{let o=n._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>s)if(t.inclusive)o.minimum=t.value;else o.exclusiveMinimum=t.value}),e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),cd=L("$ZodCheckMultipleOf",(e,t)=>{Ze.init(e,t),e._zod.onattach.push((r)=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):va(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),ud=L("$ZodCheckNumberFormat",(e,t)=>{Ze.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=$a[t.format];e._zod.onattach.push((a)=>{let i=a._zod.bag;if(i.format=t.format,i.minimum=o,i.maximum=s,r)i.pattern=rd}),e._zod.check=(a)=>{let i=a.value;if(r){if(!Number.isInteger(i)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:i,inst:e});return}if(!Number.isSafeInteger(i)){if(i>0)a.issues.push({input:i,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});else a.issues.push({input:i,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(i<o)a.issues.push({origin:"number",input:i,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(i>s)a.issues.push({origin:"number",input:i,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var ld=L("$ZodCheckMaxLength",(e,t)=>{var r;Ze.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!Tn(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<o)n._zod.bag.maximum=t.maximum}),e._zod.check=(n)=>{let o=n.value;if(o.length<=t.maximum)return;let a=kn(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),dd=L("$ZodCheckMinLength",(e,t)=>{var r;Ze.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!Tn(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>o)n._zod.bag.minimum=t.minimum}),e._zod.check=(n)=>{let o=n.value;if(o.length>=t.minimum)return;let a=kn(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),md=L("$ZodCheckLengthEquals",(e,t)=>{var r;Ze.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!Tn(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=(n)=>{let o=n.value,s=o.length;if(s===t.length)return;let a=kn(o),i=s>t.length;n.issues.push({origin:a,...i?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),xn=L("$ZodCheckStringFormat",(e,t)=>{var r,n;if(Ze.init(e,t),e._zod.onattach.push((o)=>{let s=o._zod.bag;if(s.format=t.format,t.pattern)s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),pd=L("$ZodCheckRegex",(e,t)=>{xn.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),hd=L("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=sd),xn.init(e,t)}),fd=L("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=id),xn.init(e,t)}),gd=L("$ZodCheckIncludes",(e,t)=>{Ze.init(e,t);let r=ft(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push((o)=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),_d=L("$ZodCheckStartsWith",(e,t)=>{Ze.init(e,t);let r=new RegExp(`^${ft(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Sd=L("$ZodCheckEndsWith",(e,t)=>{Ze.init(e,t);let r=new RegExp(`.*${ft(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var yd=L("$ZodCheckOverwrite",(e,t)=>{Ze.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Aa{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
8
- `).filter((s)=>s),n=Math.min(...r.map((s)=>s.length-s.trimStart().length)),o=r.map((s)=>s.slice(n)).map((s)=>" ".repeat(this.indent*2)+s);for(let s of o)this.content.push(s)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[""]).map((o)=>` ${o}`)];return new e(...t,n.join(`
9
- `))}}var bd={major:4,minor:4,patch:3};var Re=L("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=bd;let n=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))n.unshift(e);for(let o of n)for(let s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(a,i,c)=>{let u=kt(a),f;for(let _ of i){if(_._zod.def.when){if(Ea(a))continue;if(!_._zod.def.when(a))continue}else if(u)continue;let E=a.issues.length,P=_._zod.check(a);if(P instanceof Promise&&c?.async===!1)throw new pt;if(f||P instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await P,a.issues.length===E)return;if(!u)u=kt(a,E)});else{if(a.issues.length===E)continue;if(!u)u=kt(a,E)}}if(f)return f.then(()=>a);return a},s=(a,i,c)=>{if(kt(a))return a.aborted=!0,a;let u=o(i,n,c);if(u instanceof Promise){if(c.async===!1)throw new pt;return u.then((f)=>e._zod.parse(f,c))}return e._zod.parse(u,c)};e._zod.run=(a,i)=>{if(i.skipChecks)return e._zod.parse(a,i);if(i.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...i,skipChecks:!0});if(u instanceof Promise)return u.then((f)=>s(f,a,i));return s(u,a,i)}let c=e._zod.parse(a,i);if(c instanceof Promise){if(i.async===!1)throw new pt;return c.then((u)=>o(u,n,i))}return o(c,n,i)}}ye(e,"~standard",()=>({validate:(o)=>{try{let s=Rl(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch(s){return zl(e,o).then((a)=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),es=L("$ZodString",(e,t)=>{Re.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ed(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Pe=L("$ZodStringFormat",(e,t)=>{xn.init(e,t),es.init(e,t)}),Od=L("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ll),Pe.init(e,t)}),Cd=L("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ca(n))}else t.pattern??(t.pattern=Ca());Pe.init(e,t)}),Nd=L("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Dl),Pe.init(e,t)}),xd=L("$ZodURL",(e,t)=>{Pe.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim();if(!t.normalize&&t.protocol?.source===Kl.source){if(!/^https?:\/\//i.test(n)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}}let o=new URL(n);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(o.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(t.normalize)r.value=o.href;else r.value=n;return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Id=L("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Ul()),Pe.init(e,t)}),Ad=L("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Ml),Pe.init(e,t)}),jd=L("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Nl),Pe.init(e,t)}),Md=L("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=xl),Pe.init(e,t)}),qd=L("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Il),Pe.init(e,t)}),Ld=L("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Al),Pe.init(e,t)}),Dd=L("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=jl),Pe.init(e,t)}),Ud=L("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Xl(t)),Pe.init(e,t)}),Fd=L("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Gl),Pe.init(e,t)}),Zd=L("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Wl(t)),Pe.init(e,t)}),Vd=L("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ql),Pe.init(e,t)}),Jd=L("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Fl),Pe.init(e,t),e._zod.bag.format="ipv4"}),Hd=L("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Zl),Pe.init(e,t),e._zod.bag.format="ipv6",e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}});var Kd=L("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Vl),Pe.init(e,t)}),Bd=L("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Jl),Pe.init(e,t),e._zod.check=(r)=>{let n=r.value.split("/");try{if(n.length!==2)throw Error();let[o,s]=n;if(!s)throw Error();let a=Number(s);if(`${a}`!==s)throw Error();if(a<0||a>128)throw Error();new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Yd(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Gd=L("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Hl),Pe.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(r)=>{if(Yd(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Xg(e){if(!Na.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Yd(r)}var Qd=L("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Na),Pe.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(r)=>{if(Xg(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Wd=L("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Bl),Pe.init(e,t)});function e_(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var Xd=L("$ZodJWT",(e,t)=>{Pe.init(e,t),e._zod.check=(r)=>{if(e_(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Ma=L("$ZodNumber",(e,t)=>{Re.init(e,t),e._zod.pattern=e._zod.bag.pattern??Qo,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(a){}let o=r.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),em=L("$ZodNumberFormat",(e,t)=>{ud.init(e,t),Ma.init(e,t)}),tm=L("$ZodBoolean",(e,t)=>{Re.init(e,t),e._zod.pattern=nd,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(s){}let o=r.value;if(typeof o==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),rm=L("$ZodBigInt",(e,t)=>{Re.init(e,t),e._zod.pattern=td,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(o){}if(typeof r.value==="bigint")return r;return r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}});var nm=L("$ZodNull",(e,t)=>{Re.init(e,t),e._zod.pattern=od,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;if(o===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),om=L("$ZodAny",(e,t)=>{Re.init(e,t),e._zod.parse=(r)=>r}),sm=L("$ZodUnknown",(e,t)=>{Re.init(e,t),e._zod.parse=(r)=>r}),im=L("$ZodNever",(e,t)=>{Re.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});var am=L("$ZodDate",(e,t)=>{Re.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(i){}let o=r.value,s=o instanceof Date;if(s&&!Number.isNaN(o.getTime()))return r;return r.issues.push({expected:"date",code:"invalid_type",input:o,...s?{received:"Invalid Date"}:{},inst:e}),r}});function Rd(e,t,r){if(e.issues.length)t.issues.push(...gt(r,e.issues));t.value[r]=e.value}var cm=L("$ZodArray",(e,t)=>{Re.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let s=[];for(let a=0;a<o.length;a++){let i=o[a],c=t.element._zod.run({value:i,issues:[]},n);if(c instanceof Promise)s.push(c.then((u)=>Rd(u,r,a)));else Rd(c,r,a)}if(s.length)return Promise.all(s).then(()=>r);return r}});function Xo(e,t,r,n,o,s){let a=r in n;if(e.issues.length){if(o&&s&&!a)return;t.issues.push(...gt(r,e.issues))}if(!a&&!o){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(a)t.value[r]=void 0}else t.value[r]=e.value}function um(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let r=wa(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function lm(e,t,r,n,o,s){let a=[],i=o.keySet,c=o.catchall._zod,u=c.def.type,f=c.optin==="optional",_=c.optout==="optional";for(let E in t){if(E==="__proto__")continue;if(i.has(E))continue;if(u==="never"){a.push(E);continue}let P=c.run({value:t[E],issues:[]},n);if(P instanceof Promise)e.push(P.then((v)=>Xo(v,r,E,t,f,_)));else Xo(P,r,E,t,f,_)}if(a.length)r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s});if(!e.length)return r;return Promise.all(e).then(()=>r)}var t_=L("$ZodObject",(e,t)=>{if(Re.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let i=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...i};return Object.defineProperty(t,"shape",{value:c}),c}})}let n=Rr(()=>um(t));ye(e._zod,"propValues",()=>{let i=t.shape,c={};for(let u in i){let f=i[u]._zod;if(f.values){c[u]??(c[u]=new Set);for(let _ of f.values)c[u].add(_)}}return c});let o=Xt,s=t.catchall,a;e._zod.parse=(i,c)=>{a??(a=n.value);let u=i.value;if(!o(u))return i.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),i;i.value={};let f=[],_=a.shape;for(let E of a.keys){let P=_[E],v=P._zod.optin==="optional",w=P._zod.optout==="optional",m=P._zod.run({value:u[E],issues:[]},c);if(m instanceof Promise)f.push(m.then((g)=>Xo(g,i,E,u,v,w)));else Xo(m,i,E,u,v,w)}if(!s)return f.length?Promise.all(f).then(()=>i):i;return lm(f,u,i,c,n.value,e)}}),dm=L("$ZodObjectJIT",(e,t)=>{t_.init(e,t);let r=e._zod.parse,n=Rr(()=>um(t)),o=(E)=>{let P=new Aa(["shape","payload","ctx"]),v=n.value,w=(S)=>{let b=Jo(S);return`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`};P.write("const input = payload.value;");let m=Object.create(null),g=0;for(let S of v.keys)m[S]=`key_${g++}`;P.write("const newResult = {};");for(let S of v.keys){let b=m[S],O=Jo(S),R=E[S],y=R?._zod?.optin==="optional",N=R?._zod?.optout==="optional";if(P.write(`const ${b} = ${w(S)};`),y&&N)P.write(`
6
+ Lifetime used`):new ju("Lifetime not alive")}},sr=class extends Be{constructor(e,t){super(e,void 0,void 0,t)}get dupable(){return!0}dup(){return this}dispose(){}},mf=class extends Be{constructor(e,t,r,n){super(e,t,r,n)}dispose(){this._alive=!1}};lt=class e extends ft{constructor(){super(...arguments);this._disposables=new Be(new Set),this.manage=(t)=>(this._disposables.value.add(t),t)}static withScope(t){let r=new e,n;try{return t(r)}catch(o){throw n=o,o}finally{xu(r,n)}}static withScopeMaybeAsync(t,r){return Ov(void 0,function*(n){let o=new e,i;try{return yield*n.of(r.call(t,n,o))}catch(a){throw i=a,a}finally{xu(o,i)}})}static async withScopeAsync(t){let r=new e,n;try{return await t(r)}catch(o){throw n=o,o}finally{xu(r,n)}}get alive(){return this._disposables.alive}dispose(){let t=Array.from(this._disposables.value.values()).reverse();for(let r of t)r.alive&&r.dispose();this._disposables.dispose()}};Uu=class e extends ft{static success(t){return new Nv(t)}static fail(t,r){return new xv(t,r)}static is(t){return t instanceof e}},Nv=class extends Uu{constructor(e){super();this.value=e}get alive(){return aa(this.value)?this.value.alive:!0}dispose(){aa(this.value)&&this.value.dispose()}unwrap(){return this.value}unwrapOr(e){return this.value}},xv=class extends Uu{constructor(e,t){super();this.error=e,this.onUnwrap=t}get alive(){return aa(this.error)?this.error.alive:!0}dispose(){aa(this.error)&&this.error.dispose()}unwrap(){throw this.onUnwrap(this),this.error}unwrapOr(e){return e}},Zr=Uu,Iv=class extends ft{constructor(e){super();this.resolve=(t)=>{this.resolveHandle.alive&&(this.context.unwrapResult(this.context.callFunction(this.resolveHandle,this.context.undefined,t||this.context.undefined)).dispose(),this.disposeResolvers(),this.onSettled())},this.reject=(t)=>{this.rejectHandle.alive&&(this.context.unwrapResult(this.context.callFunction(this.rejectHandle,this.context.undefined,t||this.context.undefined)).dispose(),this.disposeResolvers(),this.onSettled())},this.dispose=()=>{this.handle.alive&&this.handle.dispose(),this.disposeResolvers()},this.context=e.context,this.owner=e.context.runtime,this.handle=e.promiseHandle,this.settled=new Promise((t)=>{this.onSettled=t}),this.resolveHandle=e.resolveHandle,this.rejectHandle=e.rejectHandle}get alive(){return this.handle.alive||this.resolveHandle.alive||this.rejectHandle.alive}disposeResolvers(){this.resolveHandle.alive&&this.resolveHandle.dispose(),this.rejectHandle.alive&&this.rejectHandle.dispose()}},iw=Symbol("Unstable"),aw=Object.freeze({BaseObjects:!0,Date:!0,Eval:!0,StringNormalize:!0,RegExp:!0,JSON:!0,Proxy:!0,MapSet:!0,TypedArrays:!0,Promise:!0});Lv=class extends ft{constructor(e,t){super();this.handle=e,this.context=t,this._isDone=!1,this.owner=t.runtime}[Symbol.iterator](){return this}next(e){if(!this.alive||this._isDone)return{done:!0,value:void 0};let t=this._next??(this._next=this.context.getProp(this.handle,"next"));return this.callIteratorMethod(t,e)}return(e){if(!this.alive)return{done:!0,value:void 0};let t=this.context.getProp(this.handle,"return");if(t===this.context.undefined&&e===void 0)return this.dispose(),{done:!0,value:void 0};let r=this.callIteratorMethod(t,e);return t.dispose(),this.dispose(),r}throw(e){if(!this.alive)return{done:!0,value:void 0};let t=e instanceof Be?e:this.context.newError(e),r=this.context.getProp(this.handle,"throw"),n=this.callIteratorMethod(r,e);return t.alive&&t.dispose(),r.dispose(),this.dispose(),n}get alive(){return this.handle.alive}dispose(){this._isDone=!0,this.handle.dispose(),this._next?.dispose()}callIteratorMethod(e,t){let r=t?this.context.callFunction(e,this.handle,t):this.context.callFunction(e,this.handle);if(r.error)return this.dispose(),{value:r};let n=this.context.getProp(r.value,"done").consume((i)=>this.context.dump(i)),o=this.context.getProp(r.value,"value");return r.value.dispose(),n&&this.dispose(),{value:Zr.success(o),done:n}}};ff=class extends ft{constructor(e,t,r){if(r===ia)throw new jt("cannot create HostRef with undefined id");super();this.runtime=e,this.handle=t,this.id=r}get alive(){return this.handle.alive}dispose(){this.handle.dispose()}get value(){return this.runtime.hostRefs.get(this.id)}},Uv=class extends $f{constructor(e){super(e.module);this.scope=new lt,this.copyJSValue=(t)=>this.ffi.QTS_DupValuePointer(this.ctx.value,t),this.freeJSValue=(t)=>{this.ffi.QTS_FreeValuePointer(this.ctx.value,t)},e.ownedLifetimes?.forEach((t)=>this.scope.manage(t)),this.owner=e.owner,this.module=e.module,this.ffi=e.ffi,this.rt=e.rt,this.ctx=this.scope.manage(e.ctx)}get alive(){return this.scope.alive}dispose(){return this.scope.dispose()}[Symbol.dispose](){return this.dispose()}manage(e){return this.scope.manage(e)}consumeJSCharPointer(e){let t=this.module.UTF8ToString(e);return this.ffi.QTS_FreeCString(this.ctx.value,e),t}heapValueHandle(e,t){let r=t?(n)=>{t(),this.freeJSValue(n)}:this.freeJSValue;return new Be(e,this.copyJSValue,r,this.owner)}staticHeapValueHandle(e){return this.manage(this.heapValueHandle(e)),new sr(e,this.owner)}},Fv=class extends ft{constructor(e){super();this._undefined=void 0,this._null=void 0,this._false=void 0,this._true=void 0,this._global=void 0,this._BigInt=void 0,this._Symbol=void 0,this._SymbolIterator=void 0,this._SymbolAsyncIterator=void 0,this.cToHostCallbacks={callFunction:(t,r,n,o,i)=>{if(t!==this.ctx.value)throw Error("QuickJSContext instance received C -> JS call with mismatched ctx");let a=this.getFunction(i);return lt.withScopeMaybeAsync(this,function*(s,c){let u=c.manage(new mf(r,this.memory.copyJSValue,this.memory.freeJSValue,this.runtime)),f=Array(n);for(let _=0;_<n;_++){let E=this.ffi.QTS_ArgvGetJSValueConstPointer(o,_);f[_]=c.manage(new mf(E,this.memory.copyJSValue,this.memory.freeJSValue,this.runtime))}try{let _=yield*s(a.apply(u,f));if(_){if("error"in _&&_.error)throw this.runtime.debugLog("throw error",_.error),_.error;let E=c.manage(_ instanceof Be?_:_.value);return this.ffi.QTS_DupValuePointer(this.ctx.value,E.value)}return 0}catch(_){return this.errorToHandle(_).consume((E)=>this.ffi.QTS_Throw(this.ctx.value,E.value))}})}},this.runtime=e.runtime,this.module=e.module,this.ffi=e.ffi,this.rt=e.rt,this.ctx=e.ctx,this.memory=new Uv({...e,owner:this.runtime}),e.callbacks.setContextCallbacks(this.ctx.value,this.cToHostCallbacks),this.dump=this.dump.bind(this),this.getString=this.getString.bind(this),this.getNumber=this.getNumber.bind(this),this.resolvePromise=this.resolvePromise.bind(this),this.uint32Out=this.memory.manage(this.memory.newTypedArray(Uint32Array,1))}get alive(){return this.memory.alive}dispose(){this.memory.dispose()}get undefined(){if(this._undefined)return this._undefined;let e=this.ffi.QTS_GetUndefined();return this._undefined=new sr(e)}get null(){if(this._null)return this._null;let e=this.ffi.QTS_GetNull();return this._null=new sr(e)}get true(){if(this._true)return this._true;let e=this.ffi.QTS_GetTrue();return this._true=new sr(e)}get false(){if(this._false)return this._false;let e=this.ffi.QTS_GetFalse();return this._false=new sr(e)}get global(){if(this._global)return this._global;let e=this.ffi.QTS_GetGlobalObject(this.ctx.value);return this._global=this.memory.staticHeapValueHandle(e),this._global}newNumber(e){return this.memory.heapValueHandle(this.ffi.QTS_NewFloat64(this.ctx.value,e))}newString(e){let t=this.memory.newHeapCharPointer(e).consume((r)=>this.ffi.QTS_NewString(this.ctx.value,r.value.ptr));return this.memory.heapValueHandle(t)}newUniqueSymbol(e){let t=(typeof e=="symbol"?e.description:e)??"",r=this.memory.newHeapCharPointer(t).consume((n)=>this.ffi.QTS_NewSymbol(this.ctx.value,n.value.ptr,0));return this.memory.heapValueHandle(r)}newSymbolFor(e){let t=(typeof e=="symbol"?e.description:e)??"",r=this.memory.newHeapCharPointer(t).consume((n)=>this.ffi.QTS_NewSymbol(this.ctx.value,n.value.ptr,1));return this.memory.heapValueHandle(r)}getWellKnownSymbol(e){return this._Symbol??(this._Symbol=this.memory.manage(this.getProp(this.global,"Symbol"))),this.getProp(this._Symbol,e)}newBigInt(e){if(!this._BigInt){let n=this.getProp(this.global,"BigInt");this.memory.manage(n),this._BigInt=new sr(n.value,this.runtime)}let t=this._BigInt,r=String(e);return this.newString(r).consume((n)=>this.unwrapResult(this.callFunction(t,this.undefined,n)))}newObject(e){e&&this.runtime.assertOwned(e);let t=e?this.ffi.QTS_NewObjectProto(this.ctx.value,e.value):this.ffi.QTS_NewObject(this.ctx.value);return this.memory.heapValueHandle(t)}newArray(){let e=this.ffi.QTS_NewArray(this.ctx.value);return this.memory.heapValueHandle(e)}newArrayBuffer(e){let t=new Uint8Array(e),r=this.memory.newHeapBufferPointer(t),n=this.ffi.QTS_NewArrayBuffer(this.ctx.value,r.value.pointer,t.length);return this.memory.heapValueHandle(n)}newPromise(e){let t=lt.withScope((r)=>{let n=r.manage(this.memory.newMutablePointerArray(2)),o=this.ffi.QTS_NewPromiseCapability(this.ctx.value,n.value.ptr),i=this.memory.heapValueHandle(o),[a,s]=Array.from(n.value.typedArray).map((c)=>this.memory.heapValueHandle(c));return new Iv({context:this,promiseHandle:i,resolveHandle:a,rejectHandle:s})});return e&&typeof e=="function"&&(e=new Promise(e)),e&&Promise.resolve(e).then(t.resolve,(r)=>r instanceof Be?t.reject(r):this.newError(r).consume(t.reject)),t}newFunction(e,t){let r=typeof e=="function"?e:t;if(!r)throw TypeError("Expected a function");return this.newFunctionWithOptions({name:typeof e=="string"?e:void 0,length:r.length,isConstructor:!1,fn:r})}newConstructorFunction(e,t){let r=typeof e=="function"?e:t;if(!r)throw TypeError("Expected a function");return this.newFunctionWithOptions({name:typeof e=="string"?e:void 0,length:r.length,isConstructor:!0,fn:r})}newFunctionWithOptions(e){let{name:t,length:r,isConstructor:n,fn:o}=e,i=this.runtime.hostRefs.put(o);try{return this.memory.heapValueHandle(this.ffi.QTS_NewFunction(this.ctx.value,t??"",r,n,i))}catch(a){throw this.runtime.hostRefs.delete(i),a}}newError(e){let t=this.memory.heapValueHandle(this.ffi.QTS_NewError(this.ctx.value));return e&&typeof e=="object"?(e.name!==void 0&&this.newString(e.name).consume((r)=>this.setProp(t,"name",r)),e.message!==void 0&&this.newString(e.message).consume((r)=>this.setProp(t,"message",r))):typeof e=="string"?this.newString(e).consume((r)=>this.setProp(t,"message",r)):e!==void 0&&this.newString(String(e)).consume((r)=>this.setProp(t,"message",r)),t}newHostRef(e){let t=this.runtime.hostRefs.put(e);try{let r=this.memory.heapValueHandle(this.ffi.QTS_NewHostRef(this.ctx.value,t));return new ff(this.runtime,r,t)}catch(r){throw this.runtime.hostRefs.delete(t),r}}toHostRef(e){let t=this.ffi.QTS_GetHostRefId(e.value);if(t!==0)return this.runtime.hostRefs.get(t),new ff(this.runtime,e.dup(),t)}unwrapHostRef(e){let t=this.ffi.QTS_GetHostRefId(e.value);if(t===0)throw new jt("handle is not a HostRef");return this.runtime.hostRefs.get(t)}typeof(e){return this.runtime.assertOwned(e),this.memory.consumeHeapCharPointer(this.ffi.QTS_Typeof(this.ctx.value,e.value))}getNumber(e){return this.runtime.assertOwned(e),this.ffi.QTS_GetFloat64(this.ctx.value,e.value)}getString(e){return this.runtime.assertOwned(e),this.memory.consumeJSCharPointer(this.ffi.QTS_GetString(this.ctx.value,e.value))}getSymbol(e){this.runtime.assertOwned(e);let t=this.memory.consumeJSCharPointer(this.ffi.QTS_GetSymbolDescriptionOrKey(this.ctx.value,e.value));return this.ffi.QTS_IsGlobalSymbol(this.ctx.value,e.value)?Symbol.for(t):Symbol(t)}getBigInt(e){this.runtime.assertOwned(e);let t=this.getString(e);return BigInt(t)}getArrayBuffer(e){this.runtime.assertOwned(e);let t=this.ffi.QTS_GetArrayBufferLength(this.ctx.value,e.value),r=this.ffi.QTS_GetArrayBuffer(this.ctx.value,e.value);if(!r)throw Error("Couldn't allocate memory to get ArrayBuffer");return new Be(this.module.HEAPU8.subarray(r,r+t),void 0,()=>this.module._free(r))}getPromiseState(e){this.runtime.assertOwned(e);let t=this.ffi.QTS_PromiseState(this.ctx.value,e.value);if(t<0)return{type:"fulfilled",value:e,notAPromise:!0};if(t===oa.Pending)return{type:"pending",get error(){return new bf("Cannot unwrap a pending promise")}};let r=this.ffi.QTS_PromiseResult(this.ctx.value,e.value),n=this.memory.heapValueHandle(r);if(t===oa.Fulfilled)return{type:"fulfilled",value:n};if(t===oa.Rejected)return{type:"rejected",error:n};throw n.dispose(),Error(`Unknown JSPromiseStateEnum: ${t}`)}resolvePromise(e){this.runtime.assertOwned(e);let t=lt.withScope((r)=>{let n=r.manage(this.getProp(this.global,"Promise")),o=r.manage(this.getProp(n,"resolve"));return this.callFunction(o,n,e)});return t.error?Promise.resolve(t):new Promise((r)=>{lt.withScope((n)=>{let o=n.manage(this.newFunction("resolve",(c)=>{r(this.success(c&&c.dup()))})),i=n.manage(this.newFunction("reject",(c)=>{r(this.fail(c&&c.dup()))})),a=n.manage(t.value),s=n.manage(this.getProp(a,"then"));this.callFunction(s,a,o,i).unwrap().dispose()})})}isEqual(e,t,r=ho.IsStrictlyEqual){if(e===t)return!0;this.runtime.assertOwned(e),this.runtime.assertOwned(t);let n=this.ffi.QTS_IsEqual(this.ctx.value,e.value,t.value,r);if(n===-1)throw new _f("WASM variant does not expose equality");return!!n}eq(e,t){return this.isEqual(e,t,ho.IsStrictlyEqual)}sameValue(e,t){return this.isEqual(e,t,ho.IsSameValue)}sameValueZero(e,t){return this.isEqual(e,t,ho.IsSameValueZero)}getProp(e,t){this.runtime.assertOwned(e);let r;return typeof t=="number"&&t>=0?r=this.ffi.QTS_GetPropNumber(this.ctx.value,e.value,t):r=this.borrowPropertyKey(t).consume((n)=>this.ffi.QTS_GetProp(this.ctx.value,e.value,n.value)),this.memory.heapValueHandle(r)}getLength(e){if(this.runtime.assertOwned(e),!(this.ffi.QTS_GetLength(this.ctx.value,this.uint32Out.value.ptr,e.value)<0))return this.uint32Out.value.typedArray[0]}getOwnPropertyNames(e,t={strings:!0,numbersAsStrings:!0}){this.runtime.assertOwned(e),e.value;let r=Mv(t);if(r===0)throw new Rf("No options set, will return an empty array");return lt.withScope((n)=>{let o=n.manage(this.memory.newMutablePointerArray(1)),i=this.ffi.QTS_GetOwnPropertyNames(this.ctx.value,o.value.ptr,this.uint32Out.value.ptr,e.value,r);if(i)return this.fail(this.memory.heapValueHandle(i));let a=this.uint32Out.value.typedArray[0],s=o.value.typedArray[0],c=new Uint32Array(this.module.HEAP8.buffer,s,a),u=Array.from(c).map((f)=>this.memory.heapValueHandle(f));return this.ffi.QTS_FreeVoidPointer(this.ctx.value,s),this.success(Cv(u))})}getIterator(e){let t=this._SymbolIterator??(this._SymbolIterator=this.memory.manage(this.getWellKnownSymbol("iterator")));return lt.withScope((r)=>{let n=r.manage(this.getProp(e,t)),o=this.callFunction(n,e);return o.error?o:this.success(new Lv(o.value,this))})}setProp(e,t,r){this.runtime.assertOwned(e),this.borrowPropertyKey(t).consume((n)=>this.ffi.QTS_SetProp(this.ctx.value,e.value,n.value,r.value))}defineProp(e,t,r){this.runtime.assertOwned(e),lt.withScope((n)=>{let o=n.manage(this.borrowPropertyKey(t)),i=r.value||this.undefined,a=!!r.configurable,s=!!r.enumerable,c=!!r.value,u=r.get?n.manage(this.newFunction(r.get.name,r.get)):this.undefined,f=r.set?n.manage(this.newFunction(r.set.name,r.set)):this.undefined;this.ffi.QTS_DefineProp(this.ctx.value,e.value,o.value,i.value,u.value,f.value,a,s,c)})}callFunction(e,t,...r){this.runtime.assertOwned(e);let n,o=r[0];o===void 0||Array.isArray(o)?n=o??[]:n=r;let i=this.memory.toPointerArray(n).consume((s)=>this.ffi.QTS_Call(this.ctx.value,e.value,t.value,n.length,s.value)),a=this.ffi.QTS_ResolveException(this.ctx.value,i);return a?(this.ffi.QTS_FreeValuePointer(this.ctx.value,i),this.fail(this.memory.heapValueHandle(a))):this.success(this.memory.heapValueHandle(i))}callMethod(e,t,r=[]){return this.getProp(e,t).consume((n)=>this.callFunction(n,e,r))}evalCode(e,t="eval.js",r){let n=r===void 0?1:0,o=jv(r),i=this.memory.newHeapCharPointer(e).consume((s)=>this.ffi.QTS_Eval(this.ctx.value,s.value.ptr,s.value.strlen,t,n,o)),a=this.ffi.QTS_ResolveException(this.ctx.value,i);return a?(this.ffi.QTS_FreeValuePointer(this.ctx.value,i),this.fail(this.memory.heapValueHandle(a))):this.success(this.memory.heapValueHandle(i))}throw(e){return this.errorToHandle(e).consume((t)=>this.ffi.QTS_Throw(this.ctx.value,t.value))}borrowPropertyKey(e){return typeof e=="number"?this.newNumber(e):typeof e=="string"?this.newString(e):new sr(e.value,this.runtime)}getMemory(e){if(e===this.rt.value)return this.memory;throw Error("Private API. Cannot get memory from a different runtime")}dump(e){this.runtime.assertOwned(e);let t=this.typeof(e);if(t==="string")return this.getString(e);if(t==="number")return this.getNumber(e);if(t==="bigint")return this.getBigInt(e);if(t==="undefined")return;if(t==="symbol")return this.getSymbol(e);let r=this.getPromiseState(e);if(r.type==="fulfilled"&&!r.notAPromise)return e.dispose(),{type:r.type,value:r.value.consume(this.dump)};if(r.type==="pending")return e.dispose(),{type:r.type};if(r.type==="rejected")return e.dispose(),{type:r.type,error:r.error.consume(this.dump)};let n=this.memory.consumeJSCharPointer(this.ffi.QTS_Dump(this.ctx.value,e.value));try{return JSON.parse(n)}catch{return n}}unwrapResult(e){if(e.error){let t="context"in e.error?e.error.context:this,r=e.error.consume((n)=>this.dump(n));if(r&&typeof r=="object"&&typeof r.message=="string"){let{message:n,name:o,stack:i,...a}=r,s=new Au(r,t);typeof o=="string"&&(s.name=r.name),s.message=n;let c=s.stack;throw typeof i=="string"&&(s.stack=`${o}: ${n}
7
+ ${r.stack}Host: ${c}`),Object.assign(s,a),s}throw new Au(r)}return e.value}[Symbol.for("nodejs.util.inspect.custom")](){return this.alive?`${this.constructor.name} { ctx: ${this.ctx.value} rt: ${this.rt.value} }`:`${this.constructor.name} { disposed }`}getFunction(e){let t=this.runtime.hostRefs.get(e);if(typeof t!="function")throw Error(`Host reference ${e} is not a function`);return t}errorToHandle(e){return e instanceof Be?e:this.newError(e)}encodeBinaryJSON(e){let t=this.ffi.QTS_bjson_encode(this.ctx.value,e.value);return this.memory.heapValueHandle(t)}decodeBinaryJSON(e){let t=this.ffi.QTS_bjson_decode(this.ctx.value,e.value);return this.memory.heapValueHandle(t)}success(e){return Zr.success(e)}fail(e){return Zr.fail(e,(t)=>this.unwrapResult(t))}},Zv=class extends ft{constructor(e){super();this.scope=new lt,this.contextMap=new Map,this.hostRefs=new Dv,this._debugMode=!1,this.cToHostCallbacks={freeHostRef:(t,r)=>{if(t!==this.rt.value)throw Error("Runtime pointer mismatch");this.hostRefs.delete(r)},shouldInterrupt:(t)=>{if(t!==this.rt.value)throw Error("QuickJSContext instance received C -> JS interrupt with mismatched rt");let r=this.interruptHandler;if(!r)throw Error("QuickJSContext had no interrupt handler");return r(this)?1:0},loadModuleSource:lf(this,function*(t,r,n,o){let i=this.moduleLoader;if(!i)throw Error("Runtime has no module loader");if(r!==this.rt.value)throw Error("Runtime pointer mismatch");let a=this.contextMap.get(n)??this.newContext({contextPointer:n});try{let s=yield*t(i(o,a));if(typeof s=="object"&&"error"in s&&s.error)throw this.debugLog("cToHostLoadModule: loader returned error",s.error),s.error;let c=typeof s=="string"?s:("value"in s)?s.value:s;return this.memory.newHeapCharPointer(c).value.ptr}catch(s){return this.debugLog("cToHostLoadModule: caught error",s),a.throw(s),0}}),normalizeModule:lf(this,function*(t,r,n,o,i){let a=this.moduleNormalizer;if(!a)throw Error("Runtime has no module normalizer");if(r!==this.rt.value)throw Error("Runtime pointer mismatch");let s=this.contextMap.get(n)??this.newContext({contextPointer:n});try{let c=yield*t(a(o,i,s));if(typeof c=="object"&&"error"in c&&c.error)throw this.debugLog("cToHostNormalizeModule: normalizer returned error",c.error),c.error;let u=typeof c=="string"?c:c.value;return s.getMemory(this.rt.value).newHeapCharPointer(u).value.ptr}catch(c){return this.debugLog("normalizeModule: caught error",c),s.throw(c),0}})},e.ownedLifetimes?.forEach((t)=>this.scope.manage(t)),this.module=e.module,this.memory=new $f(this.module),this.ffi=e.ffi,this.rt=e.rt,this.callbacks=e.callbacks,this.scope.manage(this.rt),this.callbacks.setRuntimeCallbacks(this.rt.value,this.cToHostCallbacks),this.executePendingJobs=this.executePendingJobs.bind(this),qu&&this.setDebugMode(!0)}get alive(){return this.scope.alive}dispose(){return this.scope.dispose()}newContext(e={}){let t=Av(e.intrinsics),r=new Be(e.contextPointer||this.ffi.QTS_NewContext(this.rt.value,t),void 0,(o)=>{this.contextMap.delete(o),this.callbacks.deleteContext(o),this.ffi.QTS_FreeContext(o)}),n=new Fv({module:this.module,ctx:r,ffi:this.ffi,rt:this.rt,ownedLifetimes:e.ownedLifetimes,runtime:this,callbacks:this.callbacks});return this.contextMap.set(r.value,n),n}setModuleLoader(e,t){this.moduleLoader=e,this.moduleNormalizer=t,this.ffi.QTS_RuntimeEnableModuleLoader(this.rt.value,this.moduleNormalizer?1:0)}removeModuleLoader(){this.moduleLoader=void 0,this.ffi.QTS_RuntimeDisableModuleLoader(this.rt.value)}hasPendingJob(){return!!this.ffi.QTS_IsJobPending(this.rt.value)}setInterruptHandler(e){let t=this.interruptHandler;this.interruptHandler=e,t||this.ffi.QTS_RuntimeEnableInterruptHandler(this.rt.value)}removeInterruptHandler(){this.interruptHandler&&(this.ffi.QTS_RuntimeDisableInterruptHandler(this.rt.value),this.interruptHandler=void 0)}executePendingJobs(e=-1){let t=this.memory.newMutablePointerArray(1),r=this.ffi.QTS_ExecutePendingJob(this.rt.value,e??-1,t.value.ptr),n=t.value.typedArray[0];if(t.dispose(),n===0)return this.ffi.QTS_FreeValuePointerRuntime(this.rt.value,r),Zr.success(0);let o=this.contextMap.get(n)??this.newContext({contextPointer:n}),i=o.getMemory(this.rt.value).heapValueHandle(r);if(o.typeof(i)==="number"){let a=o.getNumber(i);return i.dispose(),Zr.success(a)}else{let a=Object.assign(i,{context:o});return Zr.fail(a,(s)=>o.unwrapResult(s))}}setMemoryLimit(e){if(e<0&&e!==-1)throw Error("Cannot set memory limit to negative number. To unset, pass -1");this.ffi.QTS_RuntimeSetMemoryLimit(this.rt.value,e)}computeMemoryUsage(){let e=this.getSystemContext().getMemory(this.rt.value);return e.heapValueHandle(this.ffi.QTS_RuntimeComputeMemoryUsage(this.rt.value,e.ctx.value))}dumpMemoryUsage(){return this.memory.consumeHeapCharPointer(this.ffi.QTS_RuntimeDumpMemoryUsage(this.rt.value))}setMaxStackSize(e){if(e<0)throw Error("Cannot set memory limit to negative number. To unset, pass 0.");this.ffi.QTS_RuntimeSetMaxStackSize(this.rt.value,e)}assertOwned(e){if(e.owner&&e.owner.rt!==this.rt)throw new gf(`Handle is not owned by this runtime: ${e.owner.rt.value} != ${this.rt.value}`)}setDebugMode(e){this._debugMode=e,this.ffi.DEBUG&&this.rt.alive&&this.ffi.QTS_SetDebugLogEnabled(this.rt.value,e?1:0)}isDebugMode(){return this._debugMode}debugLog(...e){this._debugMode&&console.log("quickjs-emscripten:",...e)}[Symbol.for("nodejs.util.inspect.custom")](){return this.alive?`${this.constructor.name} { rt: ${this.rt.value} }`:`${this.constructor.name} { disposed }`}getSystemContext(){return this.context||(this.context=this.scope.manage(this.newContext())),this.context}}});var Pf={};Gf(Pf,{QuickJSModuleCallbacks:()=>Fu,QuickJSWASMModule:()=>Ef,applyBaseRuntimeOptions:()=>Zu,applyModuleEvalRuntimeOptions:()=>Vu});var kf=da(()=>{Tf()});var Af=Kf(function(ca,If){(function(e,t){typeof ca==="object"&&typeof If<"u"?t(ca):typeof define==="function"&&define.amd?define(["exports"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.jmespath={}))})(ca,function(e){let t=(l)=>l!==null&&Object.prototype.toString.call(l)==="[object Object]",r=(l,h)=>{if(l===h)return!0;if(typeof l!==typeof h)return!1;if(Array.isArray(l)&&Array.isArray(h)){if(l.length!==h.length)return!1;for(let k=0;k<l.length;k+=1)if(!r(l[k],h[k]))return!1;return!0}if(t(l)&&t(h)){let k=Object.entries(l),p=new Set(Object.keys(h));if(k.length!==p.size)return!1;for(let[T,x]of k){if(!r(x,h[T]))return!1;p.delete(T)}return p.size===0}return!1},n=(l)=>{if(l===""||l===!1||l===null||l===void 0)return!0;if(Array.isArray(l)&&l.length===0)return!0;if(t(l)){for(let h in l)if(l.hasOwnProperty(h))return!1;return!0}return!1},o=(l)=>l>="a"&&l<="z"||l>="A"&&l<="Z"||l==="_",i=(l)=>l>="0"&&l<="9"||l==="-",a=(l)=>l>="a"&&l<="z"||l>="A"&&l<="Z"||l>="0"&&l<="9"||l==="_";var s;(function(l){l.TOK_EOF="EOF",l.TOK_UNQUOTEDIDENTIFIER="UnquotedIdentifier",l.TOK_QUOTEDIDENTIFIER="QuotedIdentifier",l.TOK_RBRACKET="Rbracket",l.TOK_RPAREN="Rparen",l.TOK_COMMA="Comma",l.TOK_COLON="Colon",l.TOK_RBRACE="Rbrace",l.TOK_NUMBER="Number",l.TOK_CURRENT="Current",l.TOK_ROOT="Root",l.TOK_EXPREF="Expref",l.TOK_PIPE="Pipe",l.TOK_OR="Or",l.TOK_AND="And",l.TOK_EQ="EQ",l.TOK_GT="GT",l.TOK_LT="LT",l.TOK_GTE="GTE",l.TOK_LTE="LTE",l.TOK_NE="NE",l.TOK_FLATTEN="Flatten",l.TOK_STAR="Star",l.TOK_FILTER="Filter",l.TOK_DOT="Dot",l.TOK_NOT="Not",l.TOK_LBRACE="Lbrace",l.TOK_LBRACKET="Lbracket",l.TOK_LPAREN="Lparen",l.TOK_LITERAL="Literal"})(s||(s={}));let c={"(":s.TOK_LPAREN,")":s.TOK_RPAREN,"*":s.TOK_STAR,",":s.TOK_COMMA,".":s.TOK_DOT,":":s.TOK_COLON,"@":s.TOK_CURRENT,["$"]:s.TOK_ROOT,"]":s.TOK_RBRACKET,"{":s.TOK_LBRACE,"}":s.TOK_RBRACE},u={"!":!0,"<":!0,"=":!0,">":!0},f={"\t":!0,"\n":!0,"\r":!0," ":!0};class _{constructor(){this._current=0}tokenize(l){let h=[];this._current=0;let k,p,T;while(this._current<l.length)if(o(l[this._current]))k=this._current,p=this.consumeUnquotedIdentifier(l),h.push({start:k,type:s.TOK_UNQUOTEDIDENTIFIER,value:p});else if(c[l[this._current]]!==void 0)h.push({start:this._current,type:c[l[this._current]],value:l[this._current]}),this._current+=1;else if(i(l[this._current]))T=this.consumeNumber(l),h.push(T);else if(l[this._current]==="[")T=this.consumeLBracket(l),h.push(T);else if(l[this._current]==='"')k=this._current,p=this.consumeQuotedIdentifier(l),h.push({start:k,type:s.TOK_QUOTEDIDENTIFIER,value:p});else if(l[this._current]==="'")k=this._current,p=this.consumeRawStringLiteral(l),h.push({start:k,type:s.TOK_LITERAL,value:p});else if(l[this._current]==="`"){k=this._current;let x=this.consumeLiteral(l);h.push({start:k,type:s.TOK_LITERAL,value:x})}else if(u[l[this._current]]!==void 0)T=this.consumeOperator(l),T&&h.push(T);else if(f[l[this._current]]!==void 0)this._current+=1;else if(l[this._current]==="&")if(k=this._current,this._current+=1,l[this._current]==="&")this._current+=1,h.push({start:k,type:s.TOK_AND,value:"&&"});else h.push({start:k,type:s.TOK_EXPREF,value:"&"});else if(l[this._current]==="|")if(k=this._current,this._current+=1,l[this._current]==="|")this._current+=1,h.push({start:k,type:s.TOK_OR,value:"||"});else h.push({start:k,type:s.TOK_PIPE,value:"|"});else{let x=Error(`Unknown character: ${l[this._current]}`);throw x.name="LexerError",x}return h}consumeUnquotedIdentifier(l){let h=this._current;this._current+=1;while(this._current<l.length&&a(l[this._current]))this._current+=1;return l.slice(h,this._current)}consumeQuotedIdentifier(l){let h=this._current;this._current+=1;let k=l.length;while(l[this._current]!=='"'&&this._current<k){let p=this._current;if(l[p]==="\\"&&(l[p+1]==="\\"||l[p+1]==='"'))p+=2;else p+=1;this._current=p}return this._current+=1,JSON.parse(l.slice(h,this._current))}consumeRawStringLiteral(l){let h=this._current;this._current+=1;let k=l.length;while(l[this._current]!=="'"&&this._current<k){let T=this._current;if(l[T]==="\\"&&(l[T+1]==="\\"||l[T+1]==="'"))T+=2;else T+=1;this._current=T}return this._current+=1,l.slice(h+1,this._current-1).replace("\\'","'")}consumeNumber(l){let h=this._current;this._current+=1;let k=l.length;while(i(l[this._current])&&this._current<k)this._current+=1;let p=parseInt(l.slice(h,this._current),10);return{start:h,value:p,type:s.TOK_NUMBER}}consumeLBracket(l){let h=this._current;if(this._current+=1,l[this._current]==="?")return this._current+=1,{start:h,type:s.TOK_FILTER,value:"[?"};if(l[this._current]==="]")return this._current+=1,{start:h,type:s.TOK_FLATTEN,value:"[]"};return{start:h,type:s.TOK_LBRACKET,value:"["}}consumeOperator(l){let h=this._current,k=l[h];if(this._current+=1,k==="!"){if(l[this._current]==="=")return this._current+=1,{start:h,type:s.TOK_NE,value:"!="};return{start:h,type:s.TOK_NOT,value:"!"}}if(k==="<"){if(l[this._current]==="=")return this._current+=1,{start:h,type:s.TOK_LTE,value:"<="};return{start:h,type:s.TOK_LT,value:"<"}}if(k===">"){if(l[this._current]==="=")return this._current+=1,{start:h,type:s.TOK_GTE,value:">="};return{start:h,type:s.TOK_GT,value:">"}}if(k==="="&&l[this._current]==="=")return this._current+=1,{start:h,type:s.TOK_EQ,value:"=="}}consumeLiteral(l){this._current+=1;let h=this._current,k=l.length;while(l[this._current]!=="`"&&this._current<k){let x=this._current;if(l[x]==="\\"&&(l[x+1]==="\\"||l[x+1]==="`"))x+=2;else x+=1;this._current=x}let p=l.slice(h,this._current).trimLeft();p=p.replace("\\`","`");let T=this.looksLikeJSON(p)?JSON.parse(p):JSON.parse(`"${p}"`);return this._current+=1,T}looksLikeJSON(l){let k=["true","false","null"],p="-0123456789";if(l==="")return!1;if('[{"'.includes(l[0]))return!0;if(k.includes(l))return!0;if("-0123456789".includes(l[0]))try{return JSON.parse(l),!0}catch(T){return!1}return!1}}let E=new _,P={[s.TOK_EOF]:0,[s.TOK_UNQUOTEDIDENTIFIER]:0,[s.TOK_QUOTEDIDENTIFIER]:0,[s.TOK_RBRACKET]:0,[s.TOK_RPAREN]:0,[s.TOK_COMMA]:0,[s.TOK_RBRACE]:0,[s.TOK_NUMBER]:0,[s.TOK_CURRENT]:0,[s.TOK_EXPREF]:0,[s.TOK_ROOT]:0,[s.TOK_PIPE]:1,[s.TOK_OR]:2,[s.TOK_AND]:3,[s.TOK_EQ]:5,[s.TOK_GT]:5,[s.TOK_LT]:5,[s.TOK_GTE]:5,[s.TOK_LTE]:5,[s.TOK_NE]:5,[s.TOK_FLATTEN]:9,[s.TOK_STAR]:20,[s.TOK_FILTER]:21,[s.TOK_DOT]:40,[s.TOK_NOT]:45,[s.TOK_LBRACE]:50,[s.TOK_LBRACKET]:55,[s.TOK_LPAREN]:60};class v{constructor(){this.index=0,this.tokens=[]}parse(l){this.loadTokens(l),this.index=0;let h=this.expression(0);if(this.lookahead(0)!==s.TOK_EOF){let k=this.lookaheadToken(0);this.errorToken(k,`Unexpected token type: ${k.type}, value: ${k.value}`)}return h}loadTokens(l){this.tokens=[...E.tokenize(l),{type:s.TOK_EOF,value:"",start:l.length}]}expression(l){let h=this.lookaheadToken(0);this.advance();let k=this.nud(h),p=this.lookahead(0);while(l<P[p])this.advance(),k=this.led(p,k),p=this.lookahead(0);return k}lookahead(l){return this.tokens[this.index+l].type}lookaheadToken(l){return this.tokens[this.index+l]}advance(){this.index+=1}nud(l){let h,k,p;switch(l.type){case s.TOK_LITERAL:return{type:"Literal",value:l.value};case s.TOK_UNQUOTEDIDENTIFIER:return{type:"Field",name:l.value};case s.TOK_QUOTEDIDENTIFIER:let T={type:"Field",name:l.value};if(this.lookahead(0)===s.TOK_LPAREN)throw Error("Quoted identifier not allowed for function names.");else return T;case s.TOK_NOT:return k=this.expression(P.Not),{type:"NotExpression",children:[k]};case s.TOK_STAR:return h={type:"Identity"},k=this.lookahead(0)===s.TOK_RBRACKET&&{type:"Identity"}||this.parseProjectionRHS(P.Star),{type:"ValueProjection",children:[h,k]};case s.TOK_FILTER:return this.led(l.type,{type:"Identity"});case s.TOK_LBRACE:return this.parseMultiselectHash();case s.TOK_FLATTEN:return h={type:s.TOK_FLATTEN,children:[{type:"Identity"}]},k=this.parseProjectionRHS(P.Flatten),{type:"Projection",children:[h,k]};case s.TOK_LBRACKET:if(this.lookahead(0)===s.TOK_NUMBER||this.lookahead(0)===s.TOK_COLON)return k=this.parseIndexExpression(),this.projectIfSlice({type:"Identity"},k);if(this.lookahead(0)===s.TOK_STAR&&this.lookahead(1)===s.TOK_RBRACKET)return this.advance(),this.advance(),k=this.parseProjectionRHS(P.Star),{children:[{type:"Identity"},k],type:"Projection"};return this.parseMultiselectList();case s.TOK_CURRENT:return{type:s.TOK_CURRENT};case s.TOK_ROOT:return{type:s.TOK_ROOT};case s.TOK_EXPREF:return p=this.expression(P.Expref),{type:"ExpressionReference",children:[p]};case s.TOK_LPAREN:let x=[];while(this.lookahead(0)!==s.TOK_RPAREN){if(this.lookahead(0)===s.TOK_CURRENT)p={type:s.TOK_CURRENT},this.advance();else p=this.expression(0);x.push(p)}return this.match(s.TOK_RPAREN),x[0];default:this.errorToken(l)}}led(l,h){let k;switch(l){case s.TOK_DOT:let p=P.Dot;if(this.lookahead(0)!==s.TOK_STAR)return k=this.parseDotRHS(p),{type:"Subexpression",children:[h,k]};return this.advance(),k=this.parseProjectionRHS(p),{type:"ValueProjection",children:[h,k]};case s.TOK_PIPE:return k=this.expression(P.Pipe),{type:s.TOK_PIPE,children:[h,k]};case s.TOK_OR:return k=this.expression(P.Or),{type:"OrExpression",children:[h,k]};case s.TOK_AND:return k=this.expression(P.And),{type:"AndExpression",children:[h,k]};case s.TOK_LPAREN:let T=h.name,x=[],F;while(this.lookahead(0)!==s.TOK_RPAREN){if(this.lookahead(0)===s.TOK_CURRENT)F={type:s.TOK_CURRENT},this.advance();else F=this.expression(0);if(this.lookahead(0)===s.TOK_COMMA)this.match(s.TOK_COMMA);x.push(F)}return this.match(s.TOK_RPAREN),{name:T,type:"Function",children:x};case s.TOK_FILTER:let X=this.expression(0);return this.match(s.TOK_RBRACKET),k=this.lookahead(0)===s.TOK_FLATTEN&&{type:"Identity"}||this.parseProjectionRHS(P.Filter),{type:"FilterProjection",children:[h,k,X]};case s.TOK_FLATTEN:let te={type:s.TOK_FLATTEN,children:[h]},le=this.parseProjectionRHS(P.Flatten);return{type:"Projection",children:[te,le]};case s.TOK_EQ:case s.TOK_NE:case s.TOK_GT:case s.TOK_GTE:case s.TOK_LT:case s.TOK_LTE:return this.parseComparator(h,l);case s.TOK_LBRACKET:let se=this.lookaheadToken(0);if(se.type===s.TOK_NUMBER||se.type===s.TOK_COLON)return k=this.parseIndexExpression(),this.projectIfSlice(h,k);return this.match(s.TOK_STAR),this.match(s.TOK_RBRACKET),k=this.parseProjectionRHS(P.Star),{type:"Projection",children:[h,k]};default:return this.errorToken(this.lookaheadToken(0))}}match(l){if(this.lookahead(0)===l){this.advance();return}else{let h=this.lookaheadToken(0);this.errorToken(h,`Expected ${l}, got: ${h.type}`)}}errorToken(l,h=""){let k=Error(h||`Invalid token (${l.type}): "${l.value}"`);throw k.name="ParserError",k}parseIndexExpression(){if(this.lookahead(0)===s.TOK_COLON||this.lookahead(1)===s.TOK_COLON)return this.parseSliceExpression();let l={type:"Index",value:this.lookaheadToken(0).value};return this.advance(),this.match(s.TOK_RBRACKET),l}projectIfSlice(l,h){let k={type:"IndexExpression",children:[l,h]};if(h.type==="Slice")return{children:[k,this.parseProjectionRHS(P.Star)],type:"Projection"};return k}parseSliceExpression(){let l=[null,null,null],h=0,k=this.lookahead(0);while(k!==s.TOK_RBRACKET&&h<3){if(k===s.TOK_COLON)h+=1,this.advance();else if(k===s.TOK_NUMBER)l[h]=this.lookaheadToken(0).value,this.advance();else{let p=this.lookaheadToken(0);this.errorToken(p,`Syntax error, unexpected token: ${p.value}(${p.type})`)}k=this.lookahead(0)}return this.match(s.TOK_RBRACKET),{children:l,type:"Slice"}}parseComparator(l,h){let k=this.expression(P[h]);return{type:"Comparator",name:h,children:[l,k]}}parseDotRHS(l){let h=this.lookahead(0);if([s.TOK_UNQUOTEDIDENTIFIER,s.TOK_QUOTEDIDENTIFIER,s.TOK_STAR].includes(h))return this.expression(l);if(h===s.TOK_LBRACKET)return this.match(s.TOK_LBRACKET),this.parseMultiselectList();if(h===s.TOK_LBRACE)return this.match(s.TOK_LBRACE),this.parseMultiselectHash();let p=this.lookaheadToken(0);this.errorToken(p,`Syntax error, unexpected token: ${p.value}(${p.type})`)}parseProjectionRHS(l){if(P[this.lookahead(0)]<10)return{type:"Identity"};if(this.lookahead(0)===s.TOK_LBRACKET)return this.expression(l);if(this.lookahead(0)===s.TOK_FILTER)return this.expression(l);if(this.lookahead(0)===s.TOK_DOT)return this.match(s.TOK_DOT),this.parseDotRHS(l);let h=this.lookaheadToken(0);this.errorToken(h,`Syntax error, unexpected token: ${h.value}(${h.type})`)}parseMultiselectList(){let l=[];while(this.lookahead(0)!==s.TOK_RBRACKET){let h=this.expression(0);if(l.push(h),this.lookahead(0)===s.TOK_COMMA){if(this.match(s.TOK_COMMA),this.lookahead(0)===s.TOK_RBRACKET)throw Error("Unexpected token Rbracket")}}return this.match(s.TOK_RBRACKET),{type:"MultiSelectList",children:l}}parseMultiselectHash(){let l=[],h=[s.TOK_UNQUOTEDIDENTIFIER,s.TOK_QUOTEDIDENTIFIER],k,p,T;for(;;){if(k=this.lookaheadToken(0),!h.includes(k.type))throw Error(`Expecting an identifier token, got: ${k.type}`);if(p=k.value,this.advance(),this.match(s.TOK_COLON),T=this.expression(0),l.push({value:T,type:"KeyValuePair",name:p}),this.lookahead(0)===s.TOK_COMMA)this.match(s.TOK_COMMA);else if(this.lookahead(0)===s.TOK_RBRACE){this.match(s.TOK_RBRACE);break}}return{type:"MultiSelectHash",children:l}}}let w=new v;var m;(function(l){l[l.TYPE_NUMBER=0]="TYPE_NUMBER",l[l.TYPE_ANY=1]="TYPE_ANY",l[l.TYPE_STRING=2]="TYPE_STRING",l[l.TYPE_ARRAY=3]="TYPE_ARRAY",l[l.TYPE_OBJECT=4]="TYPE_OBJECT",l[l.TYPE_BOOLEAN=5]="TYPE_BOOLEAN",l[l.TYPE_EXPREF=6]="TYPE_EXPREF",l[l.TYPE_NULL=7]="TYPE_NULL",l[l.TYPE_ARRAY_NUMBER=8]="TYPE_ARRAY_NUMBER",l[l.TYPE_ARRAY_STRING=9]="TYPE_ARRAY_STRING"})(m||(m={}));class g{constructor(l){this.TYPE_NAME_TABLE={[m.TYPE_NUMBER]:"number",[m.TYPE_ANY]:"any",[m.TYPE_STRING]:"string",[m.TYPE_ARRAY]:"array",[m.TYPE_OBJECT]:"object",[m.TYPE_BOOLEAN]:"boolean",[m.TYPE_EXPREF]:"expression",[m.TYPE_NULL]:"null",[m.TYPE_ARRAY_NUMBER]:"Array<number>",[m.TYPE_ARRAY_STRING]:"Array<string>"},this.functionAbs=([h])=>Math.abs(h),this.functionAvg=([h])=>{let k=0;for(let p=0;p<h.length;p+=1)k+=h[p];return k/h.length},this.functionCeil=([h])=>Math.ceil(h),this.functionContains=(h)=>{let[k,p]=h;return k.includes(p)},this.functionEndsWith=(h)=>{let[k,p]=h;return k.includes(p,k.length-p.length)},this.functionFloor=([h])=>Math.floor(h),this.functionJoin=(h)=>{let[k,p]=h;return p.join(k)},this.functionKeys=([h])=>Object.keys(h),this.functionLength=([h])=>{if(!t(h))return h.length;return Object.keys(h).length},this.functionMap=(h)=>{if(!this._interpreter)return[];let k=[],p=this._interpreter,T=h[0],x=h[1];for(let F=0;F<x.length;F+=1)k.push(p.visit(T,x[F]));return k},this.functionMax=([h])=>{if(!h.length)return null;if(this.getTypeName(h[0])===m.TYPE_NUMBER)return Math.max(...h);let p=h,T=p[0];for(let x=1;x<p.length;x+=1)if(T.localeCompare(p[x])<0)T=p[x];return T},this.functionMaxBy=(h)=>{let k=h[1],p=h[0],T=this.createKeyFunction(k,[m.TYPE_NUMBER,m.TYPE_STRING]),x=-1/0,F,K;for(let X=0;X<p.length;X+=1)if(K=T&&T(p[X]),K!==void 0&&K>x)x=K,F=p[X];return F},this.functionMerge=(h)=>{let k={};for(let p=0;p<h.length;p+=1){let T=h[p];k=Object.assign(k,T)}return k},this.functionMin=([h])=>{if(!h.length)return null;if(this.getTypeName(h[0])===m.TYPE_NUMBER)return Math.min(...h);let p=h,T=p[0];for(let x=1;x<p.length;x+=1)if(p[x].localeCompare(T)<0)T=p[x];return T},this.functionMinBy=(h)=>{let k=h[1],p=h[0],T=this.createKeyFunction(k,[m.TYPE_NUMBER,m.TYPE_STRING]),x=1/0,F,K;for(let X=0;X<p.length;X+=1)if(K=T&&T(p[X]),K!==void 0&&K<x)x=K,F=p[X];return F},this.functionNotNull=(h)=>{for(let k=0;k<h.length;k+=1)if(this.getTypeName(h[k])!==m.TYPE_NULL)return h[k];return null},this.functionReverse=([h])=>{if(this.getTypeName(h)===m.TYPE_STRING){let T=h,x="";for(let F=T.length-1;F>=0;F-=1)x+=T[F];return x}let p=h.slice(0);return p.reverse(),p},this.functionSort=([h])=>[...h].sort(),this.functionSortBy=(h)=>{if(!this._interpreter)return[];let k=h[0].slice(0);if(k.length===0)return k;let p=this._interpreter,T=h[1],x=this.getTypeName(p.visit(T,k[0]));if(x!==void 0&&![m.TYPE_NUMBER,m.TYPE_STRING].includes(x))throw Error(`TypeError: unexpected type (${this.TYPE_NAME_TABLE[x]})`);let F=[];for(let K=0;K<k.length;K+=1)F.push([K,k[K]]);F.sort((K,X)=>{let te=p.visit(T,K[1]),le=p.visit(T,X[1]);if(this.getTypeName(te)!==x)throw Error(`TypeError: expected (${this.TYPE_NAME_TABLE[x]}), received ${this.TYPE_NAME_TABLE[this.getTypeName(te)]}`);else if(this.getTypeName(le)!==x)throw Error(`TypeError: expected (${this.TYPE_NAME_TABLE[x]}), received ${this.TYPE_NAME_TABLE[this.getTypeName(le)]}`);if(te>le)return 1;return te<le?-1:K[0]-X[0]});for(let K=0;K<F.length;K+=1)k[K]=F[K][1];return k},this.functionStartsWith=([h,k])=>h.startsWith(k),this.functionSum=([h])=>h.reduce((k,p)=>k+p,0),this.functionToArray=([h])=>{if(this.getTypeName(h)===m.TYPE_ARRAY)return h;return[h]},this.functionToNumber=([h])=>{let k=this.getTypeName(h),p;if(k===m.TYPE_NUMBER)return h;if(k===m.TYPE_STRING){if(p=+h,!isNaN(p))return p}return null},this.functionToString=([h])=>{if(this.getTypeName(h)===m.TYPE_STRING)return h;return JSON.stringify(h)},this.functionType=([h])=>{switch(this.getTypeName(h)){case m.TYPE_NUMBER:return"number";case m.TYPE_STRING:return"string";case m.TYPE_ARRAY:return"array";case m.TYPE_OBJECT:return"object";case m.TYPE_BOOLEAN:return"boolean";case m.TYPE_EXPREF:return"expref";case m.TYPE_NULL:return"null";default:return}},this.functionValues=([h])=>Object.values(h),this.functionTable={abs:{_func:this.functionAbs,_signature:[{types:[m.TYPE_NUMBER]}]},avg:{_func:this.functionAvg,_signature:[{types:[m.TYPE_ARRAY_NUMBER]}]},ceil:{_func:this.functionCeil,_signature:[{types:[m.TYPE_NUMBER]}]},contains:{_func:this.functionContains,_signature:[{types:[m.TYPE_STRING,m.TYPE_ARRAY]},{types:[m.TYPE_ANY]}]},ends_with:{_func:this.functionEndsWith,_signature:[{types:[m.TYPE_STRING]},{types:[m.TYPE_STRING]}]},floor:{_func:this.functionFloor,_signature:[{types:[m.TYPE_NUMBER]}]},join:{_func:this.functionJoin,_signature:[{types:[m.TYPE_STRING]},{types:[m.TYPE_ARRAY_STRING]}]},keys:{_func:this.functionKeys,_signature:[{types:[m.TYPE_OBJECT]}]},length:{_func:this.functionLength,_signature:[{types:[m.TYPE_STRING,m.TYPE_ARRAY,m.TYPE_OBJECT]}]},map:{_func:this.functionMap,_signature:[{types:[m.TYPE_EXPREF]},{types:[m.TYPE_ARRAY]}]},max:{_func:this.functionMax,_signature:[{types:[m.TYPE_ARRAY_NUMBER,m.TYPE_ARRAY_STRING]}]},max_by:{_func:this.functionMaxBy,_signature:[{types:[m.TYPE_ARRAY]},{types:[m.TYPE_EXPREF]}]},merge:{_func:this.functionMerge,_signature:[{types:[m.TYPE_OBJECT],variadic:!0}]},min:{_func:this.functionMin,_signature:[{types:[m.TYPE_ARRAY_NUMBER,m.TYPE_ARRAY_STRING]}]},min_by:{_func:this.functionMinBy,_signature:[{types:[m.TYPE_ARRAY]},{types:[m.TYPE_EXPREF]}]},not_null:{_func:this.functionNotNull,_signature:[{types:[m.TYPE_ANY],variadic:!0}]},reverse:{_func:this.functionReverse,_signature:[{types:[m.TYPE_STRING,m.TYPE_ARRAY]}]},sort:{_func:this.functionSort,_signature:[{types:[m.TYPE_ARRAY_STRING,m.TYPE_ARRAY_NUMBER]}]},sort_by:{_func:this.functionSortBy,_signature:[{types:[m.TYPE_ARRAY]},{types:[m.TYPE_EXPREF]}]},starts_with:{_func:this.functionStartsWith,_signature:[{types:[m.TYPE_STRING]},{types:[m.TYPE_STRING]}]},sum:{_func:this.functionSum,_signature:[{types:[m.TYPE_ARRAY_NUMBER]}]},to_array:{_func:this.functionToArray,_signature:[{types:[m.TYPE_ANY]}]},to_number:{_func:this.functionToNumber,_signature:[{types:[m.TYPE_ANY]}]},to_string:{_func:this.functionToString,_signature:[{types:[m.TYPE_ANY]}]},type:{_func:this.functionType,_signature:[{types:[m.TYPE_ANY]}]},values:{_func:this.functionValues,_signature:[{types:[m.TYPE_OBJECT]}]}},this._interpreter=l}registerFunction(l,h,k){if(l in this.functionTable)throw Error(`Function already defined: ${l}()`);this.functionTable[l]={_func:h.bind(this),_signature:k}}callFunction(l,h){let k=this.functionTable[l];if(k===void 0)throw Error(`Unknown function: ${l}()`);return this.validateArgs(l,h,k._signature),k._func.call(this,h)}validateInputSignatures(l,h){for(let k=0;k<h.length;k+=1)if("variadic"in h[k]&&k!==h.length-1)throw Error(`ArgumentError: ${l}() 'variadic' argument ${k+1} must occur last`)}validateArgs(l,h,k){var p,T;let x;this.validateInputSignatures(l,k);let F=k.filter((U)=>{var ee;return(ee=!U.optional)!==null&&ee!==void 0?ee:!1}).length,K=(T=(p=k[k.length-1])===null||p===void 0?void 0:p.variadic)!==null&&T!==void 0?T:!1,X=h.length<F,te=h.length>k.length,le=X&&(!K&&F>1||K)?"at least ":"";if(K&&X||!K&&(X||te))throw x=k.length>1,Error(`ArgumentError: ${l}() takes ${le}${F} argument${x&&"s"||""} but received ${h.length}`);let se,C,M;for(let U=0;U<k.length;U+=1){M=!1,se=k[U].types,C=this.getTypeName(h[U]);let ee;for(ee=0;ee<se.length;ee+=1)if(C!==void 0&&this.typeMatches(C,se[ee],h[U])){M=!0;break}if(!M&&C!==void 0){let ae=se.map((ue)=>this.TYPE_NAME_TABLE[ue]).join(" | ");throw Error(`TypeError: ${l}() expected argument ${U+1} to be type (${ae}) but received type ${this.TYPE_NAME_TABLE[C]} instead.`)}}}typeMatches(l,h,k){if(h===m.TYPE_ANY)return!0;if(h===m.TYPE_ARRAY_STRING||h===m.TYPE_ARRAY_NUMBER||h===m.TYPE_ARRAY){if(h===m.TYPE_ARRAY)return l===m.TYPE_ARRAY;if(l===m.TYPE_ARRAY){let p;if(h===m.TYPE_ARRAY_NUMBER)p=m.TYPE_NUMBER;else if(h===m.TYPE_ARRAY_STRING)p=m.TYPE_STRING;for(let T=0;T<k.length;T+=1){let x=this.getTypeName(k[T]);if(x!==void 0&&p!==void 0&&!this.typeMatches(x,p,k[T]))return!1}return!0}}else return l===h;return!1}getTypeName(l){switch(Object.prototype.toString.call(l)){case"[object String]":return m.TYPE_STRING;case"[object Number]":return m.TYPE_NUMBER;case"[object Array]":return m.TYPE_ARRAY;case"[object Boolean]":return m.TYPE_BOOLEAN;case"[object Null]":return m.TYPE_NULL;case"[object Object]":if(l.jmespathType===s.TOK_EXPREF)return m.TYPE_EXPREF;return m.TYPE_OBJECT;default:return}}createKeyFunction(l,h){if(!this._interpreter)return;let k=this._interpreter;return(T)=>{let x=k.visit(l,T);if(!h.includes(this.getTypeName(x))){let F=`TypeError: expected one of (${h.map((K)=>this.TYPE_NAME_TABLE[K]).join(" | ")}), received ${this.TYPE_NAME_TABLE[this.getTypeName(x)]}`;throw Error(F)}return x}}}class z{constructor(){this._rootValue=null,this.runtime=new g(this)}search(l,h){return this._rootValue=h,this.visit(l,h)}visit(l,h){let k,p,T,x,F,K,X,te,le,se,C;switch(l.type){case"Field":if(h===null)return null;if(t(h)){if(K=h[l.name],K===void 0)return null;return K}return null;case"Subexpression":T=this.visit(l.children[0],h);for(se=1;se<l.children.length;se+=1)if(T=this.visit(l.children[1],T),T===null)return null;return T;case"IndexExpression":return X=this.visit(l.children[0],h),te=this.visit(l.children[1],X),te;case"Index":if(!Array.isArray(h))return null;let M=l.value;if(M<0)M=h.length+M;if(T=h[M],T===void 0)T=null;return T;case"Slice":if(!Array.isArray(h))return null;let U=[...l.children],ee=this.computeSliceParams(h.length,U),[ae,ue,Ee]=ee;if(T=[],Ee>0)for(se=ae;se<ue;se+=Ee)T.push(h[se]);else for(se=ae;se>ue;se+=Ee)T.push(h[se]);return T;case"Projection":if(C=this.visit(l.children[0],h),!Array.isArray(C))return null;le=[];for(se=0;se<C.length;se+=1)if(p=this.visit(l.children[1],C[se]),p!==null)le.push(p);return le;case"ValueProjection":if(C=this.visit(l.children[0],h),!t(C))return null;le=[];let Ce=Object.values(C);for(se=0;se<Ce.length;se+=1)if(p=this.visit(l.children[1],Ce[se]),p!==null)le.push(p);return le;case"FilterProjection":if(C=this.visit(l.children[0],h),!Array.isArray(C))return null;let Me=[],Oe=[];for(se=0;se<C.length;se+=1)if(k=this.visit(l.children[2],C[se]),!n(k))Me.push(C[se]);for(let Ue=0;Ue<Me.length;Ue+=1)if(p=this.visit(l.children[1],Me[Ue]),p!==null)Oe.push(p);return Oe;case"Comparator":switch(x=this.visit(l.children[0],h),F=this.visit(l.children[1],h),l.name){case s.TOK_EQ:T=r(x,F);break;case s.TOK_NE:T=!r(x,F);break;case s.TOK_GT:T=x>F;break;case s.TOK_GTE:T=x>=F;break;case s.TOK_LT:T=x<F;break;case s.TOK_LTE:T=x<=F;break;default:throw Error(`Unknown comparator: ${l.name}`)}return T;case s.TOK_FLATTEN:let Re=this.visit(l.children[0],h);if(!Array.isArray(Re))return null;let De=[];for(se=0;se<Re.length;se+=1)if(p=Re[se],Array.isArray(p))De=[...De,...p];else De.push(p);return De;case"Identity":return h;case"MultiSelectList":if(h===null)return null;le=[];for(se=0;se<l.children.length;se+=1)le.push(this.visit(l.children[se],h));return le;case"MultiSelectHash":if(h===null)return null;le={};let Ne;for(se=0;se<l.children.length;se+=1)Ne=l.children[se],le[Ne.name]=this.visit(Ne.value,h);return le;case"OrExpression":if(k=this.visit(l.children[0],h),n(k))k=this.visit(l.children[1],h);return k;case"AndExpression":if(x=this.visit(l.children[0],h),n(x))return x;return this.visit(l.children[1],h);case"NotExpression":return x=this.visit(l.children[0],h),n(x);case"Literal":return l.value;case s.TOK_PIPE:return X=this.visit(l.children[0],h),this.visit(l.children[1],X);case s.TOK_CURRENT:return h;case s.TOK_ROOT:return this._rootValue;case"Function":let rt=[];for(let Ue=0;Ue<l.children.length;Ue+=1)rt.push(this.visit(l.children[Ue],h));return this.runtime.callFunction(l.name,rt);case"ExpressionReference":let Ye=l.children[0];return Ye.jmespathType=s.TOK_EXPREF,Ye;default:throw Error(`Unknown node type: ${l.type}`)}}computeSliceParams(l,h){let[k,p,T]=h;if(T===null)T=1;else if(T===0){let F=Error("Invalid slice, step cannot be 0");throw F.name="RuntimeError",F}let x=T<0?!0:!1;return k=k===null?x?l-1:0:this.capSliceRange(l,k,T),p=p===null?x?-1:l:this.capSliceRange(l,p,T),[k,p,T]}capSliceRange(l,h,k){let p=h;if(p<0){if(p+=l,p<0)p=k<0?-1:0}else if(p>=l)p=k<0?l-1:l;return p}}let S=new z,b=m.TYPE_ANY,O=m.TYPE_ARRAY,R=m.TYPE_ARRAY_NUMBER,y=m.TYPE_ARRAY_STRING,N=m.TYPE_BOOLEAN,q=m.TYPE_EXPREF,H=m.TYPE_NULL,L=m.TYPE_NUMBER,Z=m.TYPE_OBJECT,G=m.TYPE_STRING;function B(l){return w.parse(l)}function he(l){return E.tokenize(l)}let be=(l,h,k)=>{S.runtime.registerFunction(l,h,k)};function ve(l,h){let k=w.parse(h);return S.search(k,l)}let ke=S,fe={compile:B,registerFunction:be,search:ve,tokenize:he,TreeInterpreter:ke,TYPE_ANY:b,TYPE_ARRAY_NUMBER:R,TYPE_ARRAY_STRING:y,TYPE_ARRAY:O,TYPE_BOOLEAN:N,TYPE_EXPREF:q,TYPE_NULL:H,TYPE_NUMBER:L,TYPE_OBJECT:Z,TYPE_STRING:G};e.TYPE_ANY=b,e.TYPE_ARRAY=O,e.TYPE_ARRAY_NUMBER=R,e.TYPE_ARRAY_STRING=y,e.TYPE_BOOLEAN=N,e.TYPE_EXPREF=q,e.TYPE_NULL=H,e.TYPE_NUMBER=L,e.TYPE_OBJECT=Z,e.TYPE_STRING=G,e.TreeInterpreter=ke,e.compile=B,e.default=fe,e.jmespath=fe,e.registerFunction=be,e.search=ve,e.tokenize=he,Object.defineProperty(e,"__esModule",{value:!0})})});var{create:Qf,defineProperty:xo,getOwnPropertyDescriptor:Wf,getOwnPropertyNames:Xf,getPrototypeOf:eg}=Object,tg=Object.prototype.hasOwnProperty,V=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Bu=(e,t)=>{let r={};for(var n in e)xo(r,n,{get:e[n],enumerable:!0});if(t)xo(r,Symbol.toStringTag,{value:"Module"});return r},rg=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(var o=Xf(t),i=0,a=o.length,s;i<a;i++)if(s=o[i],!tg.call(e,s)&&s!==r)xo(e,s,{get:((c)=>t[c]).bind(null,s),enumerable:!(n=Wf(t,s))||n.enumerable})}return e},Io=(e,t,r)=>(r=e!=null?Qf(eg(e)):{},rg(t||!e||!e.__esModule?xo(r,"default",{value:e,enumerable:!0}):r,e));var ng=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),Yu=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),og=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),sg=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function Gu(e){return typeof e==="string"&&Yu.has(e.replace(/#$/,""))}function Qu(e,t){if(!("$schema"in e)||typeof e.$schema!=="string")return"2020-12";let r=e.$schema.replace(/#$/,"");if(ng.has(r))return"2020-12";if(Yu.has(r))return"2019-09";if(og.has(r)||sg.has(r))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}`)}var Wu,ma=Object.freeze({status:"aborted"});function D(e,t,r){function n(s,c){if(!s._zod)Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1});if(s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,c);let u=a.prototype,f=Object.keys(u);for(let _=0;_<f.length;_++){let E=f[_];if(!(E in s))s[E]=u[E].bind(s)}}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(s){var c;let u=r?.Parent?new i:this;n(u,s),(c=u._zod).deferred??(c.deferred=[]);for(let f of u._zod.deferred)f();return u}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:(s)=>{if(r?.Parent&&s instanceof r.Parent)return!0;return s?._zod?.traits?.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}var ig=Symbol("zod_brand");class dt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Sn extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Wu=globalThis).__zod_globalConfig??(Wu.__zod_globalConfig={});var _r=globalThis.__zod_globalConfig;function We(e){if(e)Object.assign(_r,e);return _r}function jo(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function ha(e,t="|"){return e.map((r)=>Sa(r)).join(t)}function yn(e,t){if(typeof t==="bigint")return t.toString();return t}function vn(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function Mo(e){return e===null||e===void 0}function qo(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function el(e,t){let r=e/t,n=Math.round(r),o=Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}var Xu=Symbol("evaluating");function ye(e,t,r){let n=void 0;Object.defineProperty(e,t,{get(){if(n===Xu)return;if(n===void 0)n=Xu,n=r();return n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Kt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function bt(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function fa(e){return JSON.stringify(e)}function tl(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ga="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Sr(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var rl=vn(()=>{if(_r.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Bt(e){if(Sr(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(Sr(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function _a(e){if(Bt(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var nl=new Set(["string","number","symbol"]);function Rt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function st(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function re(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}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function Sa(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function ol(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var sl={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ag(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i=bt(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw Error(`Unrecognized key: "${s}"`);if(!t[s])continue;a[s]=r.shape[s]}return Kt(this,"shape",a),a},checks:[]});return st(e,i)}function cg(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=bt(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw Error(`Unrecognized key: "${s}"`);if(!t[s])continue;delete a[s]}return Kt(this,"shape",a),a},checks:[]});return st(e,i)}function ug(e,t){if(!Bt(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=bt(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Kt(this,"shape",i),i}});return st(e,o)}function lg(e,t){if(!Bt(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=bt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Kt(this,"shape",n),n}});return st(e,r)}function dg(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=bt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Kt(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return st(e,r)}function mg(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let a=bt(t._zod.def,{get shape(){let s=t._zod.def.shape,c={...s};if(r)for(let u in r){if(!(u in s))throw Error(`Unrecognized key: "${u}"`);if(!r[u])continue;c[u]=e?new e({type:"optional",innerType:s[u]}):s[u]}else for(let u in s)c[u]=e?new e({type:"optional",innerType:s[u]}):s[u];return Kt(this,"shape",c),c},checks:[]});return st(t,a)}function pg(e,t,r){let n=bt(t._zod.def,{get shape(){let o=t._zod.def.shape,i={...o};if(r)for(let a in r){if(!(a in i))throw Error(`Unrecognized key: "${a}"`);if(!r[a])continue;i[a]=new e({type:"nonoptional",innerType:o[a]})}else for(let a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return Kt(this,"shape",i),i}});return st(t,n)}function Yt(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function il(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function zt(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Ao(e){return typeof e==="string"?e:e?.message}function it(e,t,r){let n=e.message?e.message:Ao(e.inst?._zod.def?.error?.(e))??Ao(t?.error?.(e))??Ao(r.customError?.(e))??Ao(r.localeError?.(e))??"Invalid input",{inst:o,continue:i,input:a,...s}=e;if(s.path??(s.path=[]),s.message=n,t?.reportInput)s.input=a;return s}function Lo(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function al(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 r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Gt(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}var cl=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,yn,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Do=D("$ZodError",cl),ya=D("$ZodError",cl,{Parent:Error});function va(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function ba(e,t=(r)=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let a of o.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map((s)=>n({issues:s},[...i,...a.path]));else if(a.code==="invalid_key")n({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")n({issues:a.issues},[...i,...a.path]);else{let s=[...i,...a.path];if(s.length===0)r._errors.push(t(a));else{let c=r,u=0;while(u<s.length){let f=s[u];if(u!==s.length-1)c[f]=c[f]||{_errors:[]};else c[f]=c[f]||{_errors:[]},c[f]._errors.push(t(a));c=c[f],u++}}}};return n(e),r}var Uo=(e)=>(t,r,n,o)=>{let i=n?{...n,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new dt;if(a.issues.length){let s=new(o?.Err??e)(a.issues.map((c)=>it(c,i,We())));throw ga(s,o?.callee),s}return a.value};var Fo=(e)=>async(t,r,n,o)=>{let i=n?{...n,async:!0}:{async:!0},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)a=await a;if(a.issues.length){let s=new(o?.Err??e)(a.issues.map((c)=>it(c,i,We())));throw ga(s,o?.callee),s}return a.value};var bn=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new dt;return i.issues.length?{success:!1,error:new(e??Do)(i.issues.map((a)=>it(a,o,We())))}:{success:!0,data:i.value}},ul=bn(ya),Rn=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?{success:!1,error:new e(i.issues.map((a)=>it(a,o,We())))}:{success:!0,data:i.value}},ll=Rn(ya),dl=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Uo(e)(t,r,o)};var ml=(e)=>(t,r,n)=>Uo(e)(t,r,n);var pl=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Fo(e)(t,r,o)};var hl=(e)=>async(t,r,n)=>Fo(e)(t,r,n);var fl=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return bn(e)(t,r,o)};var gl=(e)=>(t,r,n)=>bn(e)(t,r,n);var _l=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Rn(e)(t,r,o)};var Sl=(e)=>async(t,r,n)=>Rn(e)(t,r,n);var yl=/^[cC][0-9a-z]{6,}$/,vl=/^[0-9a-z]+$/,bl=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Rl=/^[0-9a-vA-V]{20}$/,zl=/^[A-Za-z0-9]{27}$/,wl=/^[a-zA-Z0-9_-]{21}$/,$l=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var El=/^([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})$/,Ra=(e)=>{if(!e)return/^([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)$/;return new 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})$`)};var Tl=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var fg="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Pl(){return new RegExp(fg,"u")}var kl=/^(?:(?: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])$/,Ol=/^(([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}|:))$/;var Cl=/^((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])$/,Nl=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,xl=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,za=/^[A-Za-z0-9_-]*$/;var Il=/^https?$/,Al=/^\+[1-9]\d{6,14}$/,jl="(?:(?:\\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])))",Ml=new RegExp(`^${jl}$`);function ql(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Ll(e){return new RegExp(`^${ql(e)}$`)}function Dl(e){let t=ql({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${jl}T(?:${n})$`)}var Ul=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var Fl=/^-?\d+$/,wa=/^-?\d+(?:\.\d+)?$/,Zl=/^(?:true|false)$/i,Vl=/^null$/i;var Jl=/^[^A-Z]*$/,Hl=/^[^a-z]*$/;var Fe=D("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Kl={number:"number",bigint:"bigint",object:"date"},$a=D("$ZodCheckLessThan",(e,t)=>{Fe.init(e,t);let r=Kl[typeof t.value];e._zod.onattach.push((n)=>{let o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<i)if(t.inclusive)o.maximum=t.value;else o.exclusiveMaximum=t.value}),e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ea=D("$ZodCheckGreaterThan",(e,t)=>{Fe.init(e,t);let r=Kl[typeof t.value];e._zod.onattach.push((n)=>{let o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>i)if(t.inclusive)o.minimum=t.value;else o.exclusiveMinimum=t.value}),e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Bl=D("$ZodCheckMultipleOf",(e,t)=>{Fe.init(e,t),e._zod.onattach.push((r)=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):el(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Yl=D("$ZodCheckNumberFormat",(e,t)=>{Fe.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=sl[t.format];e._zod.onattach.push((a)=>{let s=a._zod.bag;if(s.format=t.format,s.minimum=o,s.maximum=i,r)s.pattern=Fl}),e._zod.check=(a)=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){if(s>0)a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});else a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(s<o)a.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(s>i)a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var Gl=D("$ZodCheckMaxLength",(e,t)=>{var r;Fe.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!Mo(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<o)n._zod.bag.maximum=t.maximum}),e._zod.check=(n)=>{let o=n.value;if(o.length<=t.maximum)return;let a=Lo(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ql=D("$ZodCheckMinLength",(e,t)=>{var r;Fe.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!Mo(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>o)n._zod.bag.minimum=t.minimum}),e._zod.check=(n)=>{let o=n.value;if(o.length>=t.minimum)return;let a=Lo(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Wl=D("$ZodCheckLengthEquals",(e,t)=>{var r;Fe.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!Mo(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=(n)=>{let o=n.value,i=o.length;if(i===t.length)return;let a=Lo(o),s=i>t.length;n.issues.push({origin:a,...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})}}),wn=D("$ZodCheckStringFormat",(e,t)=>{var r,n;if(Fe.init(e,t),e._zod.onattach.push((o)=>{let i=o._zod.bag;if(i.format=t.format,t.pattern)i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),Xl=D("$ZodCheckRegex",(e,t)=>{wn.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ed=D("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Jl),wn.init(e,t)}),td=D("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Hl),wn.init(e,t)}),rd=D("$ZodCheckIncludes",(e,t)=>{Fe.init(e,t);let r=Rt(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push((o)=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),nd=D("$ZodCheckStartsWith",(e,t)=>{Fe.init(e,t);let r=new RegExp(`^${Rt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),od=D("$ZodCheckEndsWith",(e,t)=>{Fe.init(e,t);let r=new RegExp(`.*${Rt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var sd=D("$ZodCheckOverwrite",(e,t)=>{Fe.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Ta{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
8
+ `).filter((i)=>i),n=Math.min(...r.map((i)=>i.length-i.trimStart().length)),o=r.map((i)=>i.slice(n)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of o)this.content.push(i)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[""]).map((o)=>` ${o}`)];return new e(...t,n.join(`
9
+ `))}}var ad={major:4,minor:4,patch:3};var ze=D("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ad;let n=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))n.unshift(e);for(let o of n)for(let i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(a,s,c)=>{let u=Yt(a),f;for(let _ of s){if(_._zod.def.when){if(il(a))continue;if(!_._zod.def.when(a))continue}else if(u)continue;let E=a.issues.length,P=_._zod.check(a);if(P instanceof Promise&&c?.async===!1)throw new dt;if(f||P instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await P,a.issues.length===E)return;if(!u)u=Yt(a,E)});else{if(a.issues.length===E)continue;if(!u)u=Yt(a,E)}}if(f)return f.then(()=>a);return a},i=(a,s,c)=>{if(Yt(a))return a.aborted=!0,a;let u=o(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new dt;return u.then((f)=>e._zod.parse(f,c))}return e._zod.parse(u,c)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});if(u instanceof Promise)return u.then((f)=>i(f,a,s));return i(u,a,s)}let c=e._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new dt;return c.then((u)=>o(u,n,s))}return o(c,n,s)}}ye(e,"~standard",()=>({validate:(o)=>{try{let i=ul(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch(i){return ll(e,o).then((a)=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),Jo=D("$ZodString",(e,t)=>{ze.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ul(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Te=D("$ZodStringFormat",(e,t)=>{wn.init(e,t),Jo.init(e,t)}),gd=D("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=El),Te.init(e,t)}),_d=D("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ra(n))}else t.pattern??(t.pattern=Ra());Te.init(e,t)}),Sd=D("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Tl),Te.init(e,t)}),yd=D("$ZodURL",(e,t)=>{Te.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim();if(!t.normalize&&t.protocol?.source===Il.source){if(!/^https?:\/\//i.test(n)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}}let o=new URL(n);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(o.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(t.normalize)r.value=o.href;else r.value=n;return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),vd=D("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Pl()),Te.init(e,t)}),bd=D("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=wl),Te.init(e,t)}),Rd=D("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=yl),Te.init(e,t)}),zd=D("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=vl),Te.init(e,t)}),wd=D("$ZodULID",(e,t)=>{t.pattern??(t.pattern=bl),Te.init(e,t)}),$d=D("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Rl),Te.init(e,t)}),Ed=D("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=zl),Te.init(e,t)}),Td=D("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Dl(t)),Te.init(e,t)}),Pd=D("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Ml),Te.init(e,t)}),kd=D("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ll(t)),Te.init(e,t)}),Od=D("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=$l),Te.init(e,t)}),Cd=D("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=kl),Te.init(e,t),e._zod.bag.format="ipv4"}),Nd=D("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ol),Te.init(e,t),e._zod.bag.format="ipv6",e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}});var xd=D("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Cl),Te.init(e,t)}),Id=D("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Nl),Te.init(e,t),e._zod.check=(r)=>{let n=r.value.split("/");try{if(n.length!==2)throw Error();let[o,i]=n;if(!i)throw Error();let a=Number(i);if(`${a}`!==i)throw Error();if(a<0||a>128)throw Error();new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Ad(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var jd=D("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=xl),Te.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(r)=>{if(Ad(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function gg(e){if(!za.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ad(r)}var Md=D("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=za),Te.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(r)=>{if(gg(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),qd=D("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Al),Te.init(e,t)});function _g(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var Ld=D("$ZodJWT",(e,t)=>{Te.init(e,t),e._zod.check=(r)=>{if(_g(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var ka=D("$ZodNumber",(e,t)=>{ze.init(e,t),e._zod.pattern=e._zod.bag.pattern??wa,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(a){}let o=r.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),Dd=D("$ZodNumberFormat",(e,t)=>{Yl.init(e,t),ka.init(e,t)}),Ud=D("$ZodBoolean",(e,t)=>{ze.init(e,t),e._zod.pattern=Zl,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(i){}let o=r.value;if(typeof o==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var Fd=D("$ZodNull",(e,t)=>{ze.init(e,t),e._zod.pattern=Vl,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;if(o===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),Zd=D("$ZodAny",(e,t)=>{ze.init(e,t),e._zod.parse=(r)=>r}),Vd=D("$ZodUnknown",(e,t)=>{ze.init(e,t),e._zod.parse=(r)=>r}),Jd=D("$ZodNever",(e,t)=>{ze.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function cd(e,t,r){if(e.issues.length)t.issues.push(...zt(r,e.issues));t.value[r]=e.value}var Hd=D("$ZodArray",(e,t)=>{ze.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let i=[];for(let a=0;a<o.length;a++){let s=o[a],c=t.element._zod.run({value:s,issues:[]},n);if(c instanceof Promise)i.push(c.then((u)=>cd(u,r,a)));else cd(c,r,a)}if(i.length)return Promise.all(i).then(()=>r);return r}});function Vo(e,t,r,n,o,i){let a=r in n;if(e.issues.length){if(o&&i&&!a)return;t.issues.push(...zt(r,e.issues))}if(!a&&!o){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(a)t.value[r]=void 0}else t.value[r]=e.value}function Kd(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let r=ol(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Bd(e,t,r,n,o,i){let a=[],s=o.keySet,c=o.catchall._zod,u=c.def.type,f=c.optin==="optional",_=c.optout==="optional";for(let E in t){if(E==="__proto__")continue;if(s.has(E))continue;if(u==="never"){a.push(E);continue}let P=c.run({value:t[E],issues:[]},n);if(P instanceof Promise)e.push(P.then((v)=>Vo(v,r,E,t,f,_)));else Vo(P,r,E,t,f,_)}if(a.length)r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i});if(!e.length)return r;return Promise.all(e).then(()=>r)}var Sg=D("$ZodObject",(e,t)=>{if(ze.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...s};return Object.defineProperty(t,"shape",{value:c}),c}})}let n=vn(()=>Kd(t));ye(e._zod,"propValues",()=>{let s=t.shape,c={};for(let u in s){let f=s[u]._zod;if(f.values){c[u]??(c[u]=new Set);for(let _ of f.values)c[u].add(_)}}return c});let o=Sr,i=t.catchall,a;e._zod.parse=(s,c)=>{a??(a=n.value);let u=s.value;if(!o(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),s;s.value={};let f=[],_=a.shape;for(let E of a.keys){let P=_[E],v=P._zod.optin==="optional",w=P._zod.optout==="optional",m=P._zod.run({value:u[E],issues:[]},c);if(m instanceof Promise)f.push(m.then((g)=>Vo(g,s,E,u,v,w)));else Vo(m,s,E,u,v,w)}if(!i)return f.length?Promise.all(f).then(()=>s):s;return Bd(f,u,s,c,n.value,e)}}),Yd=D("$ZodObjectJIT",(e,t)=>{Sg.init(e,t);let r=e._zod.parse,n=vn(()=>Kd(t)),o=(E)=>{let P=new Ta(["shape","payload","ctx"]),v=n.value,w=(S)=>{let b=fa(S);return`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`};P.write("const input = payload.value;");let m=Object.create(null),g=0;for(let S of v.keys)m[S]=`key_${g++}`;P.write("const newResult = {};");for(let S of v.keys){let b=m[S],O=fa(S),R=E[S],y=R?._zod?.optin==="optional",N=R?._zod?.optout==="optional";if(P.write(`const ${b} = ${w(S)};`),y&&N)P.write(`
10
10
  if (${b}.issues.length) {
11
11
  if (${O} in input) {
12
12
  payload.issues = payload.issues.concat(${b}.issues.map(iss => ({
@@ -65,24 +65,24 @@ ${r.stack}Host: ${c}`),Object.assign(i,a),i}throw new Gu(r)}return e.value}[Symb
65
65
  newResult[${O}] = ${b}.value;
66
66
  }
67
67
 
68
- `)}P.write("payload.value = newResult;"),P.write("return payload;");let z=P.compile();return(S,b)=>z(E,S,b)},s,a=Xt,i=!vr.jitless,u=i&&Ra.value,f=t.catchall,_;e._zod.parse=(E,P)=>{_??(_=n.value);let v=E.value;if(!a(v))return E.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),E;if(i&&u&&P?.async===!1&&P.jitless!==!0){if(!s)s=o(t.shape);if(E=s(E,P),!f)return E;return lm([],v,E,P,_,e)}return r(E,P)}});function zd(e,t,r,n){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter((s)=>!kt(s));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((s)=>s.issues.map((a)=>it(a,n,Xe())))}),t}var qa=L("$ZodUnion",(e,t)=>{Re.init(e,t),ye(e._zod,"optin",()=>t.options.some((n)=>n._zod.optin==="optional")?"optional":void 0),ye(e._zod,"optout",()=>t.options.some((n)=>n._zod.optout==="optional")?"optional":void 0),ye(e._zod,"values",()=>{if(t.options.every((n)=>n._zod.values))return new Set(t.options.flatMap((n)=>Array.from(n._zod.values)));return}),ye(e._zod,"pattern",()=>{if(t.options.every((n)=>n._zod.pattern)){let n=t.options.map((o)=>o._zod.pattern);return new RegExp(`^(${n.map((o)=>Pn(o.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let s=!1,a=[];for(let i of t.options){let c=i._zod.run({value:n.value,issues:[]},o);if(c instanceof Promise)a.push(c),s=!0;else{if(c.issues.length===0)return c;a.push(c)}}if(!s)return zd(a,n,e,o);return Promise.all(a).then((i)=>zd(i,n,e,o))}});var mm=L("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,qa.init(e,t);let r=e._zod.parse;ye(e._zod,"propValues",()=>{let o={};for(let s of t.options){let a=s._zod.propValues;if(!a||Object.keys(a).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[i,c]of Object.entries(a)){if(!o[i])o[i]=new Set;for(let u of c)o[i].add(u)}}return o});let n=Rr(()=>{let o=t.options,s=new Map;for(let a of o){let i=a._zod.propValues?.[t.discriminator];if(!i||i.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let c of i){if(s.has(c))throw Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,a)}}return s});e._zod.parse=(o,s)=>{let a=o.value;if(!Xt(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;let i=n.value.get(a?.[t.discriminator]);if(i)return i._zod.run(o,s);if(t.unionFallback||s.direction==="backward")return r(o,s);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()),input:a,path:[t.discriminator],inst:e}),o}}),pm=L("$ZodIntersection",(e,t)=>{Re.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,s=t.left._zod.run({value:o,issues:[]},n),a=t.right._zod.run({value:o,issues:[]},n);if(s instanceof Promise||a instanceof Promise)return Promise.all([s,a]).then(([c,u])=>wd(r,c,u));return wd(r,s,a)}});function ja(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Pt(e)&&Pt(t)){let r=Object.keys(t),n=Object.keys(e).filter((s)=>r.indexOf(s)!==-1),o={...e,...t};for(let s of n){let a=ja(e[s],t[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};o[s]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n],a=ja(o,s);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function wd(e,t,r){let n=new Map,o;for(let i of t.issues)if(i.code==="unrecognized_keys"){o??(o=i);for(let c of i.keys){if(!n.has(c))n.set(c,{});n.get(c).l=!0}}else e.issues.push(i);for(let i of r.issues)if(i.code==="unrecognized_keys")for(let c of i.keys){if(!n.has(c))n.set(c,{});n.get(c).r=!0}else e.issues.push(i);let s=[...n].filter(([,i])=>i.l&&i.r).map(([i])=>i);if(s.length&&o)e.issues.push({...o,keys:s});if(kt(e))return e;let a=ja(t.value,r.value);if(!a.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var hm=L("$ZodRecord",(e,t)=>{Re.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Pt(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let s=[],a=t.keyType._zod.values;if(a){r.value={};let i=new Set;for(let u of a)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){i.add(typeof u==="number"?u.toString():u);let f=t.keyType._zod.run({value:u,issues:[]},n);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map((P)=>it(P,n,Xe())),input:u,path:[u],inst:e});continue}let _=f.value,E=t.valueType._zod.run({value:o[u],issues:[]},n);if(E instanceof Promise)s.push(E.then((P)=>{if(P.issues.length)r.issues.push(...gt(u,P.issues));r.value[_]=P.value}));else{if(E.issues.length)r.issues.push(...gt(u,E.issues));r.value[_]=E.value}}let c;for(let u in o)if(!i.has(u))c=c??[],c.push(u);if(c&&c.length>0)r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{r.value={};for(let i of Reflect.ownKeys(o)){if(i==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(o,i))continue;let c=t.keyType._zod.run({value:i,issues:[]},n);if(c instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof i==="string"&&Qo.test(i)&&c.issues.length){let _=t.keyType._zod.run({value:Number(i),issues:[]},n);if(_ instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(_.issues.length===0)c=_}if(c.issues.length){if(t.mode==="loose")r.value[i]=o[i];else r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map((_)=>it(_,n,Xe())),input:i,path:[i],inst:e});continue}let f=t.valueType._zod.run({value:o[i],issues:[]},n);if(f instanceof Promise)s.push(f.then((_)=>{if(_.issues.length)r.issues.push(...gt(i,_.issues));r.value[c.value]=_.value}));else{if(f.issues.length)r.issues.push(...gt(i,f.issues));r.value[c.value]=f.value}}}if(s.length)return Promise.all(s).then(()=>r);return r}});var fm=L("$ZodEnum",(e,t)=>{Re.init(e,t);let r=En(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter((o)=>za.has(typeof o)).map((o)=>typeof o==="string"?ft(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{let a=o.value;if(n.has(a))return o;return o.issues.push({code:"invalid_value",values:r,input:a,inst:e}),o}}),gm=L("$ZodLiteral",(e,t)=>{if(Re.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map((n)=>typeof n==="string"?ft(n):n?ft(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let s=n.value;if(r.has(s))return n;return n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}});var _m=L("$ZodTransform",(e,t)=>{Re.init(e,t),e._zod.optin="optional",e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new wn(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((a)=>(r.value=a,r.fallback=!0,r));if(o instanceof Promise)throw new pt;return r.value=o,r.fallback=!0,r}});function $d(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var La=L("$ZodOptional",(e,t)=>{Re.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ye(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ye(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Pn(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=r.value,s=t.innerType._zod.run(r,n);if(s instanceof Promise)return s.then((a)=>$d(a,o));return $d(s,o)}if(r.value===void 0)return r;return t.innerType._zod.run(r,n)}}),Sm=L("$ZodExactOptional",(e,t)=>{La.init(e,t),ye(e._zod,"values",()=>t.innerType._zod.values),ye(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),ym=L("$ZodNullable",(e,t)=>{Re.init(e,t),ye(e._zod,"optin",()=>t.innerType._zod.optin),ye(e._zod,"optout",()=>t.innerType._zod.optout),ye(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Pn(r.source)}|null)$`):void 0}),ye(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),vm=L("$ZodDefault",(e,t)=>{Re.init(e,t),e._zod.optin="optional",ye(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>Ed(s,t));return Ed(o,t)}});function Ed(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var bm=L("$ZodPrefault",(e,t)=>{Re.init(e,t),e._zod.optin="optional",ye(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),Rm=L("$ZodNonOptional",(e,t)=>{Re.init(e,t),ye(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((n)=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>Td(s,e));return Td(o,e)}});function Td(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var zm=L("$ZodCatch",(e,t)=>{Re.init(e,t),e._zod.optin="optional",ye(e._zod,"optout",()=>t.innerType._zod.optout),ye(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>{if(r.value=s.value,s.issues.length)r.value=t.catchValue({...r,error:{issues:s.issues.map((a)=>it(a,n,Xe()))},input:r.value}),r.issues=[],r.fallback=!0;return r});if(r.value=o.value,o.issues.length)r.value=t.catchValue({...r,error:{issues:o.issues.map((s)=>it(s,n,Xe()))},input:r.value}),r.issues=[],r.fallback=!0;return r}});var Da=L("$ZodPipe",(e,t)=>{Re.init(e,t),ye(e._zod,"values",()=>t.in._zod.values),ye(e._zod,"optin",()=>t.in._zod.optin),ye(e._zod,"optout",()=>t.out._zod.optout),ye(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let s=t.out._zod.run(r,n);if(s instanceof Promise)return s.then((a)=>Wo(a,t.in,n));return Wo(s,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>Wo(s,t.out,n));return Wo(o,t.out,n)}});function Wo(e,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var wm=L("$ZodPreprocess",(e,t)=>{Da.init(e,t)}),$m=L("$ZodReadonly",(e,t)=>{Re.init(e,t),ye(e._zod,"propValues",()=>t.innerType._zod.propValues),ye(e._zod,"values",()=>t.innerType._zod.values),ye(e._zod,"optin",()=>t.innerType?._zod?.optin),ye(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(Pd);return Pd(o)}});function Pd(e){return e.value=Object.freeze(e.value),e}var Em=L("$ZodLazy",(e,t)=>{Re.init(e,t),ye(e._zod,"innerType",()=>{let r=t;if(!r._cachedInner)r._cachedInner=t.getter();return r._cachedInner}),ye(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),ye(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),ye(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),ye(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Tm=L("$ZodCustom",(e,t)=>{Ze.init(e,t),Re.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((s)=>kd(s,r,n,e));kd(o,r,n,e);return}});function kd(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(zr(o))}}var r_=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(o){return e[o]??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",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return(o)=>{switch(o.code){case"invalid_type":{let s=n[o.expected]??o.expected,a=Ta(o.input),i=n[a]??a;return`Invalid input: expected ${s}, received ${i}`}case"invalid_value":if(o.values.length===1)return`Invalid input: expected ${Ko(o.values[0])}`;return`Invalid option: expected one of ${Vo(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);if(a)return`Too big: expected ${o.origin??"value"} to have ${s}${o.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${o.origin??"value"} to be ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);if(a)return`Too small: expected ${o.origin} to have ${s}${o.minimum.toString()} ${a.unit}`;return`Too small: expected ${o.origin} to be ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${r[s.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${Vo(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":if(o.options&&Array.isArray(o.options)&&o.options.length>0)return`Invalid discriminator value. Expected ${o.options.map((a)=>`'${a}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function Ua(){return{localeError:r_()}}var Pm,n_=Symbol("ZodOutput"),o_=Symbol("ZodInput");class km{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Om(){return new km}(Pm=globalThis).__zod_globalRegistry??(Pm.__zod_globalRegistry=Om());var Ot=globalThis.__zod_globalRegistry;function Cm(e,t){return new e({type:"string",...ae(t)})}function Nm(e,t){return new e({type:"string",coerce:!0,...ae(t)})}function Fa(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ae(t)})}function Za(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ae(t)})}function xm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ae(t)})}function Im(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ae(t)})}function Am(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ae(t)})}function jm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ae(t)})}function Va(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ae(t)})}function Mm(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ae(t)})}function qm(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ae(t)})}function Lm(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ae(t)})}function Dm(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ae(t)})}function Um(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ae(t)})}function Fm(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ae(t)})}function Zm(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ae(t)})}function Vm(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ae(t)})}function Jm(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ae(t)})}function Hm(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ae(t)})}function Km(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ae(t)})}function Bm(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ae(t)})}function Ym(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ae(t)})}function Gm(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ae(t)})}function Qm(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ae(t)})}function Wm(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ae(t)})}function Xm(e,t){return new e({type:"string",format:"date",check:"string_format",...ae(t)})}function ep(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ae(t)})}function tp(e,t){return new e({type:"string",format:"duration",check:"string_format",...ae(t)})}function rp(e,t){return new e({type:"number",checks:[],...ae(t)})}function np(e,t){return new e({type:"number",coerce:!0,checks:[],...ae(t)})}function op(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ae(t)})}function sp(e,t){return new e({type:"boolean",...ae(t)})}function ip(e,t){return new e({type:"boolean",coerce:!0,...ae(t)})}function ap(e,t){return new e({type:"bigint",coerce:!0,...ae(t)})}function cp(e,t){return new e({type:"null",...ae(t)})}function up(e){return new e({type:"any"})}function lp(e){return new e({type:"unknown"})}function dp(e,t){return new e({type:"never",...ae(t)})}function mp(e,t){return new e({type:"date",coerce:!0,...ae(t)})}function wr(e,t){return new xa({check:"less_than",...ae(t),value:e,inclusive:!1})}function _t(e,t){return new xa({check:"less_than",...ae(t),value:e,inclusive:!0})}function $r(e,t){return new Ia({check:"greater_than",...ae(t),value:e,inclusive:!1})}function ct(e,t){return new Ia({check:"greater_than",...ae(t),value:e,inclusive:!0})}function In(e,t){return new cd({check:"multiple_of",...ae(t),value:e})}function ts(e,t){return new ld({check:"max_length",...ae(t),maximum:e})}function Er(e,t){return new dd({check:"min_length",...ae(t),minimum:e})}function rs(e,t){return new md({check:"length_equals",...ae(t),length:e})}function Ja(e,t){return new pd({check:"string_format",format:"regex",...ae(t),pattern:e})}function Ha(e){return new hd({check:"string_format",format:"lowercase",...ae(e)})}function Ka(e){return new fd({check:"string_format",format:"uppercase",...ae(e)})}function Ba(e,t){return new gd({check:"string_format",format:"includes",...ae(t),includes:e})}function Ya(e,t){return new _d({check:"string_format",format:"starts_with",...ae(t),prefix:e})}function Ga(e,t){return new Sd({check:"string_format",format:"ends_with",...ae(t),suffix:e})}function Ct(e){return new yd({check:"overwrite",tx:e})}function Qa(e){return Ct((t)=>t.normalize(e))}function Wa(){return Ct((e)=>e.trim())}function Xa(){return Ct((e)=>e.toLowerCase())}function ec(){return Ct((e)=>e.toUpperCase())}function tc(){return Ct((e)=>ba(e))}function pp(e,t,r){return new e({type:"array",element:t,...ae(r)})}function hp(e,t,r){return new e({type:"custom",check:"custom",fn:t,...ae(r)})}function fp(e,t){let r=s_((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(zr(o,n.value,r._zod.def));else{let s=o;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push(zr(s))}},e(n.value,n)),t);return r}function s_(e,t){let r=new Ze({check:"custom",...ae(t)});return r._zod.check=e,r}function jn(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Ot,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Ee(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,s=t.seen.get(e);if(s){if(s.count++,r.schemaPath.includes(e))s.cycle=r.path;return s.schema}let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let i=e._zod.toJSONSchema?.();if(i)a.schema=i;else{let f={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,f);else{let E=a.schema,P=t.processors[o.type];if(!P)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);P(e,t,E,f)}let _=e._zod.parent;if(_){if(!a.ref)a.ref=_;Ee(_,t,f),t.seen.get(_).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Object.assign(a.schema,c);if(t.io==="input"&&Be(e))delete a.schema.examples,delete a.schema.default;if(t.io==="input"&&"_prefault"in a.schema)(n=a.schema).default??(n.default=a.schema._prefault);return delete a.schema._prefault,t.seen.get(e).schema}function Mn(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let a of e.seen.entries()){let i=e.metadataRegistry.get(a[0])?.id;if(i){let c=n.get(i);if(c&&c!==a[0])throw Error(`Duplicate schema id "${i}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(i,a[0])}}let o=(a)=>{let i=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let _=e.external.registry.get(a[0])?.id,E=e.external.uri??((v)=>v);if(_)return{ref:E(_)};let P=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=P,{defId:P,ref:`${E("__shared")}#/${i}/${P}`}}if(a[1]===r)return{ref:"#"};let u=`${"#"}/${i}/`,f=a[1].schema.id??`__schema${e.counter++}`;return{defId:f,ref:u+f}},s=(a)=>{if(a[1].schema.$ref)return;let i=a[1],{ref:c,defId:u}=o(a);if(i.def={...i.schema},u)i.defId=u;let f=i.schema;for(let _ in f)delete f[_];f.$ref=c};if(e.cycles==="throw")for(let a of e.seen.entries()){let i=a[1];if(i.cycle)throw Error(`Cycle detected: #/${i.cycle?.join("/")}/<root>
68
+ `)}P.write("payload.value = newResult;"),P.write("return payload;");let z=P.compile();return(S,b)=>z(E,S,b)},i,a=Sr,s=!_r.jitless,u=s&&rl.value,f=t.catchall,_;e._zod.parse=(E,P)=>{_??(_=n.value);let v=E.value;if(!a(v))return E.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),E;if(s&&u&&P?.async===!1&&P.jitless!==!0){if(!i)i=o(t.shape);if(E=i(E,P),!f)return E;return Bd([],v,E,P,_,e)}return r(E,P)}});function ud(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter((i)=>!Yt(i));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((a)=>it(a,n,We())))}),t}var Oa=D("$ZodUnion",(e,t)=>{ze.init(e,t),ye(e._zod,"optin",()=>t.options.some((n)=>n._zod.optin==="optional")?"optional":void 0),ye(e._zod,"optout",()=>t.options.some((n)=>n._zod.optout==="optional")?"optional":void 0),ye(e._zod,"values",()=>{if(t.options.every((n)=>n._zod.values))return new Set(t.options.flatMap((n)=>Array.from(n._zod.values)));return}),ye(e._zod,"pattern",()=>{if(t.options.every((n)=>n._zod.pattern)){let n=t.options.map((o)=>o._zod.pattern);return new RegExp(`^(${n.map((o)=>qo(o.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,a=[];for(let s of t.options){let c=s._zod.run({value:n.value,issues:[]},o);if(c instanceof Promise)a.push(c),i=!0;else{if(c.issues.length===0)return c;a.push(c)}}if(!i)return ud(a,n,e,o);return Promise.all(a).then((s)=>ud(s,n,e,o))}});var Gd=D("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Oa.init(e,t);let r=e._zod.parse;ye(e._zod,"propValues",()=>{let o={};for(let i of t.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[s,c]of Object.entries(a)){if(!o[s])o[s]=new Set;for(let u of c)o[s].add(u)}}return o});let n=vn(()=>{let o=t.options,i=new Map;for(let a of o){let s=a._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let c of s){if(i.has(c))throw Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});e._zod.parse=(o,i)=>{let a=o.value;if(!Sr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;let s=n.value.get(a?.[t.discriminator]);if(s)return s._zod.run(o,i);if(t.unionFallback||i.direction==="backward")return r(o,i);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()),input:a,path:[t.discriminator],inst:e}),o}}),Qd=D("$ZodIntersection",(e,t)=>{ze.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),a=t.right._zod.run({value:o,issues:[]},n);if(i instanceof Promise||a instanceof Promise)return Promise.all([i,a]).then(([c,u])=>ld(r,c,u));return ld(r,i,a)}});function Pa(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Bt(e)&&Bt(t)){let r=Object.keys(t),n=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),o={...e,...t};for(let i of n){let a=Pa(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],a=Pa(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function ld(e,t,r){let n=new Map,o;for(let s of t.issues)if(s.code==="unrecognized_keys"){o??(o=s);for(let c of s.keys){if(!n.has(c))n.set(c,{});n.get(c).l=!0}}else e.issues.push(s);for(let s of r.issues)if(s.code==="unrecognized_keys")for(let c of s.keys){if(!n.has(c))n.set(c,{});n.get(c).r=!0}else e.issues.push(s);let i=[...n].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(i.length&&o)e.issues.push({...o,keys:i});if(Yt(e))return e;let a=Pa(t.value,r.value);if(!a.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var Wd=D("$ZodRecord",(e,t)=>{ze.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Bt(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let i=[],a=t.keyType._zod.values;if(a){r.value={};let s=new Set;for(let u of a)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){s.add(typeof u==="number"?u.toString():u);let f=t.keyType._zod.run({value:u,issues:[]},n);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map((P)=>it(P,n,We())),input:u,path:[u],inst:e});continue}let _=f.value,E=t.valueType._zod.run({value:o[u],issues:[]},n);if(E instanceof Promise)i.push(E.then((P)=>{if(P.issues.length)r.issues.push(...zt(u,P.issues));r.value[_]=P.value}));else{if(E.issues.length)r.issues.push(...zt(u,E.issues));r.value[_]=E.value}}let c;for(let u in o)if(!s.has(u))c=c??[],c.push(u);if(c&&c.length>0)r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{r.value={};for(let s of Reflect.ownKeys(o)){if(s==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(o,s))continue;let c=t.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof s==="string"&&wa.test(s)&&c.issues.length){let _=t.keyType._zod.run({value:Number(s),issues:[]},n);if(_ instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(_.issues.length===0)c=_}if(c.issues.length){if(t.mode==="loose")r.value[s]=o[s];else r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map((_)=>it(_,n,We())),input:s,path:[s],inst:e});continue}let f=t.valueType._zod.run({value:o[s],issues:[]},n);if(f instanceof Promise)i.push(f.then((_)=>{if(_.issues.length)r.issues.push(...zt(s,_.issues));r.value[c.value]=_.value}));else{if(f.issues.length)r.issues.push(...zt(s,f.issues));r.value[c.value]=f.value}}}if(i.length)return Promise.all(i).then(()=>r);return r}});var Xd=D("$ZodEnum",(e,t)=>{ze.init(e,t);let r=jo(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter((o)=>nl.has(typeof o)).map((o)=>typeof o==="string"?Rt(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{let a=o.value;if(n.has(a))return o;return o.issues.push({code:"invalid_value",values:r,input:a,inst:e}),o}}),em=D("$ZodLiteral",(e,t)=>{if(ze.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map((n)=>typeof n==="string"?Rt(n):n?Rt(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let i=n.value;if(r.has(i))return n;return n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}});var tm=D("$ZodTransform",(e,t)=>{ze.init(e,t),e._zod.optin="optional",e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Sn(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((a)=>(r.value=a,r.fallback=!0,r));if(o instanceof Promise)throw new dt;return r.value=o,r.fallback=!0,r}});function dd(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var Ca=D("$ZodOptional",(e,t)=>{ze.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ye(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ye(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${qo(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=r.value,i=t.innerType._zod.run(r,n);if(i instanceof Promise)return i.then((a)=>dd(a,o));return dd(i,o)}if(r.value===void 0)return r;return t.innerType._zod.run(r,n)}}),rm=D("$ZodExactOptional",(e,t)=>{Ca.init(e,t),ye(e._zod,"values",()=>t.innerType._zod.values),ye(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),nm=D("$ZodNullable",(e,t)=>{ze.init(e,t),ye(e._zod,"optin",()=>t.innerType._zod.optin),ye(e._zod,"optout",()=>t.innerType._zod.optout),ye(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${qo(r.source)}|null)$`):void 0}),ye(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),om=D("$ZodDefault",(e,t)=>{ze.init(e,t),e._zod.optin="optional",ye(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>md(i,t));return md(o,t)}});function md(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var sm=D("$ZodPrefault",(e,t)=>{ze.init(e,t),e._zod.optin="optional",ye(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),im=D("$ZodNonOptional",(e,t)=>{ze.init(e,t),ye(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((n)=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>pd(i,e));return pd(o,e)}});function pd(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var am=D("$ZodCatch",(e,t)=>{ze.init(e,t),e._zod.optin="optional",ye(e._zod,"optout",()=>t.innerType._zod.optout),ye(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>{if(r.value=i.value,i.issues.length)r.value=t.catchValue({...r,error:{issues:i.issues.map((a)=>it(a,n,We()))},input:r.value}),r.issues=[],r.fallback=!0;return r});if(r.value=o.value,o.issues.length)r.value=t.catchValue({...r,error:{issues:o.issues.map((i)=>it(i,n,We()))},input:r.value}),r.issues=[],r.fallback=!0;return r}});var Na=D("$ZodPipe",(e,t)=>{ze.init(e,t),ye(e._zod,"values",()=>t.in._zod.values),ye(e._zod,"optin",()=>t.in._zod.optin),ye(e._zod,"optout",()=>t.out._zod.optout),ye(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);if(i instanceof Promise)return i.then((a)=>Zo(a,t.in,n));return Zo(i,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Zo(i,t.out,n));return Zo(o,t.out,n)}});function Zo(e,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var cm=D("$ZodPreprocess",(e,t)=>{Na.init(e,t)}),um=D("$ZodReadonly",(e,t)=>{ze.init(e,t),ye(e._zod,"propValues",()=>t.innerType._zod.propValues),ye(e._zod,"values",()=>t.innerType._zod.values),ye(e._zod,"optin",()=>t.innerType?._zod?.optin),ye(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(hd);return hd(o)}});function hd(e){return e.value=Object.freeze(e.value),e}var lm=D("$ZodLazy",(e,t)=>{ze.init(e,t),ye(e._zod,"innerType",()=>{let r=t;if(!r._cachedInner)r._cachedInner=t.getter();return r._cachedInner}),ye(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),ye(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),ye(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),ye(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),dm=D("$ZodCustom",(e,t)=>{Fe.init(e,t),ze.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((i)=>fd(i,r,n,e));fd(o,r,n,e);return}});function fd(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(Gt(o))}}var yg=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(o){return e[o]??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",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return(o)=>{switch(o.code){case"invalid_type":{let i=n[o.expected]??o.expected,a=al(o.input),s=n[a]??a;return`Invalid input: expected ${i}, received ${s}`}case"invalid_value":if(o.values.length===1)return`Invalid input: expected ${Sa(o.values[0])}`;return`Invalid option: expected one of ${ha(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=t(o.origin);if(a)return`Too big: expected ${o.origin??"value"} to have ${i}${o.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${o.origin??"value"} to be ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=t(o.origin);if(a)return`Too small: expected ${o.origin} to have ${i}${o.minimum.toString()} ${a.unit}`;return`Too small: expected ${o.origin} to be ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;if(i.format==="starts_with")return`Invalid string: must start with "${i.prefix}"`;if(i.format==="ends_with")return`Invalid string: must end with "${i.suffix}"`;if(i.format==="includes")return`Invalid string: must include "${i.includes}"`;if(i.format==="regex")return`Invalid string: must match pattern ${i.pattern}`;return`Invalid ${r[i.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${ha(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":if(o.options&&Array.isArray(o.options)&&o.options.length>0)return`Invalid discriminator value. Expected ${o.options.map((a)=>`'${a}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function xa(){return{localeError:yg()}}var mm,vg=Symbol("ZodOutput"),bg=Symbol("ZodInput");class pm{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function hm(){return new pm}(mm=globalThis).__zod_globalRegistry??(mm.__zod_globalRegistry=hm());var wt=globalThis.__zod_globalRegistry;function fm(e,t){return new e({type:"string",...re(t)})}function Ia(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...re(t)})}function Aa(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...re(t)})}function gm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...re(t)})}function _m(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...re(t)})}function Sm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...re(t)})}function ym(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...re(t)})}function ja(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...re(t)})}function vm(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...re(t)})}function bm(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...re(t)})}function Rm(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...re(t)})}function zm(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...re(t)})}function wm(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...re(t)})}function $m(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...re(t)})}function Em(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...re(t)})}function Tm(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...re(t)})}function Pm(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...re(t)})}function km(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...re(t)})}function Om(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...re(t)})}function Cm(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...re(t)})}function Nm(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...re(t)})}function xm(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...re(t)})}function Im(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...re(t)})}function Am(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...re(t)})}function jm(e,t){return new e({type:"string",format:"date",check:"string_format",...re(t)})}function Mm(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...re(t)})}function qm(e,t){return new e({type:"string",format:"duration",check:"string_format",...re(t)})}function Lm(e,t){return new e({type:"number",checks:[],...re(t)})}function Dm(e,t){return new e({type:"number",coerce:!0,checks:[],...re(t)})}function Um(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...re(t)})}function Fm(e,t){return new e({type:"boolean",...re(t)})}function Zm(e,t){return new e({type:"null",...re(t)})}function Vm(e){return new e({type:"any"})}function Jm(e){return new e({type:"unknown"})}function Hm(e,t){return new e({type:"never",...re(t)})}function Ho(e,t){return new $a({check:"less_than",...re(t),value:e,inclusive:!1})}function $n(e,t){return new $a({check:"less_than",...re(t),value:e,inclusive:!0})}function Ko(e,t){return new Ea({check:"greater_than",...re(t),value:e,inclusive:!1})}function En(e,t){return new Ea({check:"greater_than",...re(t),value:e,inclusive:!0})}function Bo(e,t){return new Bl({check:"multiple_of",...re(t),value:e})}function Yo(e,t){return new Gl({check:"max_length",...re(t),maximum:e})}function yr(e,t){return new Ql({check:"min_length",...re(t),minimum:e})}function Go(e,t){return new Wl({check:"length_equals",...re(t),length:e})}function Ma(e,t){return new Xl({check:"string_format",format:"regex",...re(t),pattern:e})}function qa(e){return new ed({check:"string_format",format:"lowercase",...re(e)})}function La(e){return new td({check:"string_format",format:"uppercase",...re(e)})}function Da(e,t){return new rd({check:"string_format",format:"includes",...re(t),includes:e})}function Ua(e,t){return new nd({check:"string_format",format:"starts_with",...re(t),prefix:e})}function Fa(e,t){return new od({check:"string_format",format:"ends_with",...re(t),suffix:e})}function $t(e){return new sd({check:"overwrite",tx:e})}function Za(e){return $t((t)=>t.normalize(e))}function Va(){return $t((e)=>e.trim())}function Ja(){return $t((e)=>e.toLowerCase())}function Ha(){return $t((e)=>e.toUpperCase())}function Ka(){return $t((e)=>tl(e))}function Km(e,t,r){return new e({type:"array",element:t,...re(r)})}function Bm(e,t,r){return new e({type:"custom",check:"custom",fn:t,...re(r)})}function Ym(e,t){let r=Rg((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(Gt(o,n.value,r._zod.def));else{let i=o;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(Gt(i))}},e(n.value,n)),t);return r}function Rg(e,t){let r=new Fe({check:"custom",...re(t)});return r._zod.check=e,r}function Pn(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??wt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function we(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let f={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,f);else{let E=a.schema,P=t.processors[o.type];if(!P)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);P(e,t,E,f)}let _=e._zod.parent;if(_){if(!a.ref)a.ref=_;we(_,t,f),t.seen.get(_).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Object.assign(a.schema,c);if(t.io==="input"&&Ke(e))delete a.schema.examples,delete a.schema.default;if(t.io==="input"&&"_prefault"in a.schema)(n=a.schema).default??(n.default=a.schema._prefault);return delete a.schema._prefault,t.seen.get(e).schema}function kn(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let a of e.seen.entries()){let s=e.metadataRegistry.get(a[0])?.id;if(s){let c=n.get(s);if(c&&c!==a[0])throw Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(s,a[0])}}let o=(a)=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let _=e.external.registry.get(a[0])?.id,E=e.external.uri??((v)=>v);if(_)return{ref:E(_)};let P=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=P,{defId:P,ref:`${E("__shared")}#/${s}/${P}`}}if(a[1]===r)return{ref:"#"};let u=`${"#"}/${s}/`,f=a[1].schema.id??`__schema${e.counter++}`;return{defId:f,ref:u+f}},i=(a)=>{if(a[1].schema.$ref)return;let s=a[1],{ref:c,defId:u}=o(a);if(s.def={...s.schema},u)s.defId=u;let f=s.schema;for(let _ in f)delete f[_];f.$ref=c};if(e.cycles==="throw")for(let a of e.seen.entries()){let s=a[1];if(s.cycle)throw Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
69
69
 
70
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let i=a[1];if(t===a[0]){s(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){s(a);continue}}if(e.metadataRegistry.get(a[0])?.id){s(a);continue}if(i.cycle){s(a);continue}if(i.count>1){if(e.reused==="ref"){s(a);continue}}}}function qn(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(i)=>{let c=e.seen.get(i);if(c.ref===null)return;let u=c.def??c.schema,f={...u},_=c.ref;if(c.ref=null,_){n(_);let P=e.seen.get(_),v=P.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(v);else Object.assign(u,v);if(Object.assign(u,f),i._zod.parent===_)for(let m in u){if(m==="$ref"||m==="allOf")continue;if(!(m in f))delete u[m]}if(v.$ref&&P.def)for(let m in u){if(m==="$ref"||m==="allOf")continue;if(m in P.def&&JSON.stringify(u[m])===JSON.stringify(P.def[m]))delete u[m]}}let E=i._zod.parent;if(E&&E!==_){n(E);let P=e.seen.get(E);if(P?.schema.$ref){if(u.$ref=P.schema.$ref,P.def)for(let v in u){if(v==="$ref"||v==="allOf")continue;if(v in P.def&&JSON.stringify(u[v])===JSON.stringify(P.def[v]))delete u[v]}}}e.override({zodSchema:i,jsonSchema:u,path:c.path??[]})};for(let i of[...e.seen.entries()].reverse())n(i[0]);let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let i=e.external.registry.get(t)?.id;if(!i)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(i)}Object.assign(o,r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;if(s!==void 0&&o.id===s)delete o.id;let a=e.external?.defs??{};for(let i of e.seen.entries()){let c=i[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;a[c.defId]=c.def}}if(e.external);else if(Object.keys(a).length>0)if(e.target==="draft-2020-12")o.$defs=a;else o.definitions=a;try{let i=JSON.parse(JSON.stringify(o));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:An(t,"input",e.processors),output:An(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch(i){throw Error("Error converting schema to JSON.")}}function Be(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Be(n.element,r);if(n.type==="set")return Be(n.valueType,r);if(n.type==="lazy")return Be(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Be(n.innerType,r);if(n.type==="intersection")return Be(n.left,r)||Be(n.right,r);if(n.type==="record"||n.type==="map")return Be(n.keyType,r)||Be(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return Be(n.in,r)||Be(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(Be(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Be(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Be(o,r))return!0;if(n.rest&&Be(n.rest,r))return!0;return!1}return!1}var gp=(e,t={})=>(r)=>{let n=jn({...r,processors:t});return Ee(e,n),Mn(n,e),qn(n,e)},An=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:s}=n??{},a=jn({...o??{},target:s,io:t,processors:r});return Ee(e,a),Mn(a,e),qn(a,e)};var i_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},rc=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:s,maximum:a,format:i,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s==="number")o.minLength=s;if(typeof a==="number")o.maxLength=a;if(i){if(o.format=i_[i]??i,o.format==="")delete o.format;if(i==="time")delete o.format}if(u)o.contentEncoding=u;if(c&&c.size>0){let f=[...c];if(f.length===1)o.pattern=f[0].source;else if(f.length>1)o.allOf=[...f.map((_)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:_.source}))]}},nc=(e,t,r,n)=>{let o=r,{minimum:s,maximum:a,format:i,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:f}=e._zod.bag;if(typeof i==="string"&&i.includes("int"))o.type="integer";else o.type="number";let _=typeof f==="number"&&f>=(s??Number.NEGATIVE_INFINITY),E=typeof u==="number"&&u<=(a??Number.POSITIVE_INFINITY),P=t.target==="draft-04"||t.target==="openapi-3.0";if(_)if(P)o.minimum=f,o.exclusiveMinimum=!0;else o.exclusiveMinimum=f;else if(typeof s==="number")o.minimum=s;if(E)if(P)o.maximum=u,o.exclusiveMaximum=!0;else o.exclusiveMaximum=u;else if(typeof a==="number")o.maximum=a;if(typeof c==="number")o.multipleOf=c},oc=(e,t,r,n)=>{r.type="boolean"},sc=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},Sp=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},ic=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},yp=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},vp=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},ac=(e,t,r,n)=>{r.not={}},cc=(e,t,r,n)=>{},uc=(e,t,r,n)=>{},lc=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},dc=(e,t,r,n)=>{let o=e._zod.def,s=En(o.entries);if(s.every((a)=>typeof a==="number"))r.type="number";if(s.every((a)=>typeof a==="string"))r.type="string";r.enum=s},mc=(e,t,r,n)=>{let o=e._zod.def,s=[];for(let a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else s.push(Number(a));else s.push(a);if(s.length===0);else if(s.length===1){let a=s[0];if(r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[a];else r.const=a}else{if(s.every((a)=>typeof a==="number"))r.type="number";if(s.every((a)=>typeof a==="string"))r.type="string";if(s.every((a)=>typeof a==="boolean"))r.type="boolean";if(s.every((a)=>a===null))r.type="null";r.enum=s}},bp=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},Rp=(e,t,r,n)=>{let o=r,s=e._zod.pattern;if(!s)throw Error("Pattern not found in template literal");o.type="string",o.pattern=s.source},zp=(e,t,r,n)=>{let o=r,s={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:i,mime:c}=e._zod.bag;if(a!==void 0)s.minLength=a;if(i!==void 0)s.maxLength=i;if(c)if(c.length===1)s.contentMediaType=c[0],Object.assign(o,s);else Object.assign(o,s),o.anyOf=c.map((u)=>({contentMediaType:u}));else Object.assign(o,s)},wp=(e,t,r,n)=>{r.type="boolean"},pc=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},$p=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},hc=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},Ep=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},Tp=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},fc=(e,t,r,n)=>{let o=r,s=e._zod.def,{minimum:a,maximum:i}=e._zod.bag;if(typeof a==="number")o.minItems=a;if(typeof i==="number")o.maxItems=i;o.type="array",o.items=Ee(s.element,t,{...n,path:[...n.path,"items"]})},gc=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object",o.properties={};let a=s.shape;for(let u in a)o.properties[u]=Ee(a[u],t,{...n,path:[...n.path,"properties",u]});let i=new Set(Object.keys(a)),c=new Set([...i].filter((u)=>{let f=s.shape[u]._zod;if(t.io==="input")return f.optin===void 0;else return f.optout===void 0}));if(c.size>0)o.required=Array.from(c);if(s.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!s.catchall){if(t.io==="output")o.additionalProperties=!1}else if(s.catchall)o.additionalProperties=Ee(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},_c=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,a=o.options.map((i,c)=>Ee(i,t,{...n,path:[...n.path,s?"oneOf":"anyOf",c]}));if(s)r.oneOf=a;else r.anyOf=a},Sc=(e,t,r,n)=>{let o=e._zod.def,s=Ee(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=Ee(o.right,t,{...n,path:[...n.path,"allOf",1]}),i=(u)=>("allOf"in u)&&Object.keys(u).length===1,c=[...i(s)?s.allOf:[s],...i(a)?a.allOf:[a]];r.allOf=c},Pp=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",i=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=s.items.map((E,P)=>Ee(E,t,{...n,path:[...n.path,a,P]})),u=s.rest?Ee(s.rest,t,{...n,path:[...n.path,i,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;if(t.target==="draft-2020-12"){if(o.prefixItems=c,u)o.items=u}else if(t.target==="openapi-3.0"){if(o.items={anyOf:c},u)o.items.anyOf.push(u);if(o.minItems=c.length,!u)o.maxItems=c.length}else if(o.items=c,u)o.additionalItems=u;let{minimum:f,maximum:_}=e._zod.bag;if(typeof f==="number")o.minItems=f;if(typeof _==="number")o.maxItems=_},yc=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object";let a=s.keyType,c=a._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let f=Ee(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let _ of c)o.patternProperties[_.source]=f}else{if(t.target==="draft-07"||t.target==="draft-2020-12")o.propertyNames=Ee(s.keyType,t,{...n,path:[...n.path,"propertyNames"]});o.additionalProperties=Ee(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let u=a._zod.values;if(u){let f=[...u].filter((_)=>typeof _==="string"||typeof _==="number");if(f.length>0)o.required=f}},vc=(e,t,r,n)=>{let o=e._zod.def,s=Ee(o.innerType,t,n),a=t.seen.get(e);if(t.target==="openapi-3.0")a.ref=o.innerType,r.nullable=!0;else r.anyOf=[s,{type:"null"}]},bc=(e,t,r,n)=>{let o=e._zod.def;Ee(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},Rc=(e,t,r,n)=>{let o=e._zod.def;Ee(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},zc=(e,t,r,n)=>{let o=e._zod.def;Ee(o.innerType,t,n);let s=t.seen.get(e);if(s.ref=o.innerType,t.io==="input")r._prefault=JSON.parse(JSON.stringify(o.defaultValue))},wc=(e,t,r,n)=>{let o=e._zod.def;Ee(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},$c=(e,t,r,n)=>{let o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?s?o.out:o.in:o.out;Ee(a,t,n);let i=t.seen.get(e);i.ref=a},Ec=(e,t,r,n)=>{let o=e._zod.def;Ee(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0},kp=(e,t,r,n)=>{let o=e._zod.def;Ee(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},ns=(e,t,r,n)=>{let o=e._zod.def;Ee(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},Tc=(e,t,r,n)=>{let o=e._zod.innerType;Ee(o,t,n);let s=t.seen.get(e);s.ref=o},_p={string:rc,number:nc,boolean:oc,bigint:sc,symbol:Sp,null:ic,undefined:yp,void:vp,never:ac,any:cc,unknown:uc,date:lc,enum:dc,literal:mc,nan:bp,template_literal:Rp,file:zp,success:wp,custom:pc,function:$p,transform:hc,map:Ep,set:Tp,array:fc,object:gc,union:_c,intersection:Sc,tuple:Pp,record:yc,nullable:vc,nonoptional:bc,default:Rc,prefault:zc,catch:wc,pipe:$c,readonly:Ec,promise:kp,optional:ns,lazy:Tc};function os(e,t){if("_idmap"in e){let n=e,o=jn({...t,processors:_p}),s={};for(let c of n._idmap.entries()){let[u,f]=c;Ee(f,o)}let a={},i={registry:n,uri:t?.uri,defs:s};o.external=i;for(let c of n._idmap.entries()){let[u,f]=c;Mn(o,f),a[u]=qn(o,f)}if(Object.keys(s).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[c]:s}}return{schemas:a}}let r=jn({...t,processors:_p});return Ee(e,r),Mn(r,e),qn(r,e)}var dt={};Uo(dt,{ZodISODate:()=>Cp,ZodISODateTime:()=>Op,ZodISODuration:()=>xp,ZodISOTime:()=>Np,date:()=>kc,datetime:()=>Pc,duration:()=>Cc,time:()=>Oc});var Op=L("ZodISODateTime",(e,t)=>{Ud.init(e,t),ke.init(e,t)});function Pc(e){return Wm(Op,e)}var Cp=L("ZodISODate",(e,t)=>{Fd.init(e,t),ke.init(e,t)});function kc(e){return Xm(Cp,e)}var Np=L("ZodISOTime",(e,t)=>{Zd.init(e,t),ke.init(e,t)});function Oc(e){return ep(Np,e)}var xp=L("ZodISODuration",(e,t)=>{Vd.init(e,t),ke.init(e,t)});function Cc(e){return tp(xp,e)}var h_=(e,t)=>{Bo.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>Oa(e,r)},flatten:{value:(r)=>ka(e,r)},addIssue:{value:(r)=>{e.issues.push(r),e.message=JSON.stringify(e.issues,br,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,br,2)}},isEmpty:{get(){return e.issues.length===0}}})};var rt=L("ZodError",h_,{Parent:Error});var Ap=Yo(rt),jp=Go(rt),ss=On(rt),Mp=Cn(rt),qp=wl(rt),Lp=$l(rt),Dp=El(rt),Up=Tl(rt),Fp=Pl(rt),Zp=kl(rt),Vp=Ol(rt),Jp=Cl(rt);var Hp=new WeakMap;function Ln(e,t,r){let n=Object.getPrototypeOf(e),o=Hp.get(n);if(!o)o=new Set,Hp.set(n,o);if(o.has(t))return;o.add(t);for(let s in r){let a=r[s];Object.defineProperty(n,s,{configurable:!0,enumerable:!1,get(){let i=a.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:i}),i},set(i){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:i})}})}}var ze=L("ZodType",(e,t)=>(Re.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:An(e,"input"),output:An(e,"output")}}),e.toJSONSchema=gp(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,n)=>Ap(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>ss(e,r,n),e.parseAsync=async(r,n)=>jp(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Mp(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>qp(e,r,n),e.decode=(r,n)=>Lp(e,r,n),e.encodeAsync=async(r,n)=>Dp(e,r,n),e.decodeAsync=async(r,n)=>Up(e,r,n),e.safeEncode=(r,n)=>Fp(e,r,n),e.safeDecode=(r,n)=>Zp(e,r,n),e.safeEncodeAsync=async(r,n)=>Vp(e,r,n),e.safeDecodeAsync=async(r,n)=>Jp(e,r,n),Ln(e,"ZodType",{check(...r){let n=this.def;return this.clone(ve.mergeDefs(n,{checks:[...n.checks??[],...r.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,n){return st(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(nS(r,n))},superRefine(r,n){return this.check(oS(r,n))},overwrite(r){return this.check(Ct(r))},optional(){return re(this)},exactOptional(){return Z_(this)},nullable(){return Gp(this)},nullish(){return re(Gp(this))},nonoptional(r){return Y_(this,r)},array(){return A(this)},or(r){return W([this,r])},and(r){return St(this,r)},transform(r){return Qp(this,ah(r))},default(r){return H_(this,r)},prefault(r){return B_(this,r)},catch(r){return Q_(this,r)},pipe(r){return Qp(this,r)},readonly(){return eS(this)},describe(r){let n=this.clone();return Ot.add(n,{description:r}),n},meta(...r){if(r.length===0)return Ot.get(this);let n=this.clone();return Ot.add(n,r[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return Ot.get(e)?.description},configurable:!0}),e)),Wp=L("_ZodString",(e,t)=>{es.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(n,o,s)=>rc(e,n,o,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,Ln(e,"_ZodString",{regex(...n){return this.check(Ja(...n))},includes(...n){return this.check(Ba(...n))},startsWith(...n){return this.check(Ya(...n))},endsWith(...n){return this.check(Ga(...n))},min(...n){return this.check(Er(...n))},max(...n){return this.check(ts(...n))},length(...n){return this.check(rs(...n))},nonempty(...n){return this.check(Er(1,...n))},lowercase(n){return this.check(Ha(n))},uppercase(n){return this.check(Ka(n))},trim(){return this.check(Wa())},normalize(...n){return this.check(Qa(...n))},toLowerCase(){return this.check(Xa())},toUpperCase(){return this.check(ec())},slugify(){return this.check(tc())}})}),xc=L("ZodString",(e,t)=>{es.init(e,t),Wp.init(e,t),e.email=(r)=>e.check(Fa(Xp,r)),e.url=(r)=>e.check(Va(th,r)),e.jwt=(r)=>e.check(Qm(O_,r)),e.emoji=(r)=>e.check(Mm(g_,r)),e.guid=(r)=>e.check(Za(Kp,r)),e.uuid=(r)=>e.check(xm(is,r)),e.uuidv4=(r)=>e.check(Im(is,r)),e.uuidv6=(r)=>e.check(Am(is,r)),e.uuidv7=(r)=>e.check(jm(is,r)),e.nanoid=(r)=>e.check(qm(__,r)),e.guid=(r)=>e.check(Za(Kp,r)),e.cuid=(r)=>e.check(Lm(S_,r)),e.cuid2=(r)=>e.check(Dm(y_,r)),e.ulid=(r)=>e.check(Um(v_,r)),e.base64=(r)=>e.check(Bm(T_,r)),e.base64url=(r)=>e.check(Ym(P_,r)),e.xid=(r)=>e.check(Fm(b_,r)),e.ksuid=(r)=>e.check(Zm(R_,r)),e.ipv4=(r)=>e.check(Vm(z_,r)),e.ipv6=(r)=>e.check(Jm(w_,r)),e.cidrv4=(r)=>e.check(Hm($_,r)),e.cidrv6=(r)=>e.check(Km(E_,r)),e.e164=(r)=>e.check(Gm(k_,r)),e.datetime=(r)=>e.check(Pc(r)),e.date=(r)=>e.check(kc(r)),e.time=(r)=>e.check(Oc(r)),e.duration=(r)=>e.check(Cc(r))});function d(e){return Cm(xc,e)}var ke=L("ZodStringFormat",(e,t)=>{Pe.init(e,t),Wp.init(e,t)}),Xp=L("ZodEmail",(e,t)=>{Nd.init(e,t),ke.init(e,t)});function eh(e){return Fa(Xp,e)}var Kp=L("ZodGUID",(e,t)=>{Od.init(e,t),ke.init(e,t)});var is=L("ZodUUID",(e,t)=>{Cd.init(e,t),ke.init(e,t)});var th=L("ZodURL",(e,t)=>{xd.init(e,t),ke.init(e,t)});function as(e){return Va(th,e)}var g_=L("ZodEmoji",(e,t)=>{Id.init(e,t),ke.init(e,t)});var __=L("ZodNanoID",(e,t)=>{Ad.init(e,t),ke.init(e,t)});var S_=L("ZodCUID",(e,t)=>{jd.init(e,t),ke.init(e,t)});var y_=L("ZodCUID2",(e,t)=>{Md.init(e,t),ke.init(e,t)});var v_=L("ZodULID",(e,t)=>{qd.init(e,t),ke.init(e,t)});var b_=L("ZodXID",(e,t)=>{Ld.init(e,t),ke.init(e,t)});var R_=L("ZodKSUID",(e,t)=>{Dd.init(e,t),ke.init(e,t)});var z_=L("ZodIPv4",(e,t)=>{Jd.init(e,t),ke.init(e,t)});var w_=L("ZodIPv6",(e,t)=>{Hd.init(e,t),ke.init(e,t)});var $_=L("ZodCIDRv4",(e,t)=>{Kd.init(e,t),ke.init(e,t)});var E_=L("ZodCIDRv6",(e,t)=>{Bd.init(e,t),ke.init(e,t)});var T_=L("ZodBase64",(e,t)=>{Gd.init(e,t),ke.init(e,t)});var P_=L("ZodBase64URL",(e,t)=>{Qd.init(e,t),ke.init(e,t)});var k_=L("ZodE164",(e,t)=>{Wd.init(e,t),ke.init(e,t)});var O_=L("ZodJWT",(e,t)=>{Xd.init(e,t),ke.init(e,t)});var cs=L("ZodNumber",(e,t)=>{Ma.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(n,o,s)=>nc(e,n,o,s),Ln(e,"ZodNumber",{gt(n,o){return this.check($r(n,o))},gte(n,o){return this.check(ct(n,o))},min(n,o){return this.check(ct(n,o))},lt(n,o){return this.check(wr(n,o))},lte(n,o){return this.check(_t(n,o))},max(n,o){return this.check(_t(n,o))},int(n){return this.check(Bp(n))},safe(n){return this.check(Bp(n))},positive(n){return this.check($r(0,n))},nonnegative(n){return this.check(ct(0,n))},negative(n){return this.check(wr(0,n))},nonpositive(n){return this.check(_t(0,n))},multipleOf(n,o){return this.check(In(n,o))},step(n,o){return this.check(In(n,o))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function J(e){return rp(cs,e)}var C_=L("ZodNumberFormat",(e,t)=>{em.init(e,t),cs.init(e,t)});function Bp(e){return op(C_,e)}var Ic=L("ZodBoolean",(e,t)=>{tm.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oc(e,r,n,o)});function Q(e){return sp(Ic,e)}var rh=L("ZodBigInt",(e,t)=>{rm.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(n,o,s)=>sc(e,n,o,s),e.gte=(n,o)=>e.check(ct(n,o)),e.min=(n,o)=>e.check(ct(n,o)),e.gt=(n,o)=>e.check($r(n,o)),e.gte=(n,o)=>e.check(ct(n,o)),e.min=(n,o)=>e.check(ct(n,o)),e.lt=(n,o)=>e.check(wr(n,o)),e.lte=(n,o)=>e.check(_t(n,o)),e.max=(n,o)=>e.check(_t(n,o)),e.positive=(n)=>e.check($r(BigInt(0),n)),e.negative=(n)=>e.check(wr(BigInt(0),n)),e.nonpositive=(n)=>e.check(_t(BigInt(0),n)),e.nonnegative=(n)=>e.check(ct(BigInt(0),n)),e.multipleOf=(n,o)=>e.check(In(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});var N_=L("ZodNull",(e,t)=>{nm.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ic(e,r,n,o)});function er(e){return cp(N_,e)}var x_=L("ZodAny",(e,t)=>{om.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cc(e,r,n,o)});function nh(){return up(x_)}var I_=L("ZodUnknown",(e,t)=>{sm.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uc(e,r,n,o)});function se(){return lp(I_)}var A_=L("ZodNever",(e,t)=>{im.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ac(e,r,n,o)});function j_(e){return dp(A_,e)}var oh=L("ZodDate",(e,t)=>{am.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(n,o,s)=>lc(e,n,o,s),e.min=(n,o)=>e.check(ct(n,o)),e.max=(n,o)=>e.check(_t(n,o));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});var M_=L("ZodArray",(e,t)=>{cm.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fc(e,r,n,o),e.element=t.element,Ln(e,"ZodArray",{min(r,n){return this.check(Er(r,n))},nonempty(r){return this.check(Er(1,r))},max(r,n){return this.check(ts(r,n))},length(r,n){return this.check(rs(r,n))},unwrap(){return this.element}})});function A(e,t){return pp(M_,e,t)}var sh=L("ZodObject",(e,t)=>{dm.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gc(e,r,n,o),ve.defineLazy(e,"shape",()=>t.shape),Ln(e,"ZodObject",{keyof(){return de(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:se()})},loose(){return this.clone({...this._zod.def,catchall:se()})},strict(){return this.clone({...this._zod.def,catchall:j_()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return ve.extend(this,r)},safeExtend(r){return ve.safeExtend(this,r)},merge(r){return ve.merge(this,r)},pick(r){return ve.pick(this,r)},omit(r){return ve.omit(this,r)},partial(...r){return ve.partial(ch,this,r[0])},required(...r){return ve.required(uh,this,r[0])}})});function I(e,t){let r={type:"object",shape:e??{},...ve.normalizeParams(t)};return new sh(r)}function ce(e,t){return new sh({type:"object",shape:e,catchall:se(),...ve.normalizeParams(t)})}var ih=L("ZodUnion",(e,t)=>{qa.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_c(e,r,n,o),e.options=t.options});function W(e,t){return new ih({type:"union",options:e,...ve.normalizeParams(t)})}var q_=L("ZodDiscriminatedUnion",(e,t)=>{ih.init(e,t),mm.init(e,t)});function Pr(e,t,r){return new q_({type:"union",options:t,discriminator:e,...ve.normalizeParams(r)})}var L_=L("ZodIntersection",(e,t)=>{pm.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sc(e,r,n,o)});function St(e,t){return new L_({type:"intersection",left:e,right:t})}var Yp=L("ZodRecord",(e,t)=>{hm.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yc(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function Y(e,t,r){if(!t||!t._zod)return new Yp({type:"record",keyType:d(),valueType:e,...ve.normalizeParams(t)});return new Yp({type:"record",keyType:e,valueType:t,...ve.normalizeParams(r)})}var Nc=L("ZodEnum",(e,t)=>{fm.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(n,o,s)=>dc(e,n,o,s),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let s={};for(let a of n)if(r.has(a))s[a]=t.entries[a];else throw Error(`Key ${a} not found in enum`);return new Nc({...t,checks:[],...ve.normalizeParams(o),entries:s})},e.exclude=(n,o)=>{let s={...t.entries};for(let a of n)if(r.has(a))delete s[a];else throw Error(`Key ${a} not found in enum`);return new Nc({...t,checks:[],...ve.normalizeParams(o),entries:s})}});function de(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new Nc({type:"enum",entries:r,...ve.normalizeParams(t)})}var D_=L("ZodLiteral",(e,t)=>{gm.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mc(e,r,n,o),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 j(e,t){return new D_({type:"literal",values:Array.isArray(e)?e:[e],...ve.normalizeParams(t)})}var U_=L("ZodTransform",(e,t)=>{_m.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hc(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new wn(e.constructor.name);r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(ve.issue(s,r.value,t));else{let a=s;if(a.fatal)a.continue=!1;a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(ve.issue(a))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((s)=>(r.value=s,r.fallback=!0,r));return r.value=o,r.fallback=!0,r}});function ah(e){return new U_({type:"transform",transform:e})}var ch=L("ZodOptional",(e,t)=>{La.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ns(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function re(e){return new ch({type:"optional",innerType:e})}var F_=L("ZodExactOptional",(e,t)=>{Sm.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ns(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Z_(e){return new F_({type:"optional",innerType:e})}var V_=L("ZodNullable",(e,t)=>{ym.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Gp(e){return new V_({type:"nullable",innerType:e})}var J_=L("ZodDefault",(e,t)=>{vm.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function H_(e,t){return new J_({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():ve.shallowClone(t)}})}var K_=L("ZodPrefault",(e,t)=>{bm.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function B_(e,t){return new K_({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():ve.shallowClone(t)}})}var uh=L("ZodNonOptional",(e,t)=>{Rm.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Y_(e,t){return new uh({type:"nonoptional",innerType:e,...ve.normalizeParams(t)})}var G_=L("ZodCatch",(e,t)=>{zm.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Q_(e,t){return new G_({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var lh=L("ZodPipe",(e,t)=>{Da.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$c(e,r,n,o),e.in=t.in,e.out=t.out});function Qp(e,t){return new lh({type:"pipe",in:e,out:t})}var W_=L("ZodPreprocess",(e,t)=>{lh.init(e,t),wm.init(e,t)}),X_=L("ZodReadonly",(e,t)=>{$m.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ec(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function eS(e){return new X_({type:"readonly",innerType:e})}var tS=L("ZodLazy",(e,t)=>{Em.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Tc(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Dn(e){return new tS({type:"lazy",getter:e})}var rS=L("ZodCustom",(e,t)=>{Tm.init(e,t),ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pc(e,r,n,o)});function nS(e,t={}){return hp(rS,e,t)}function oS(e,t){return fp(e,t)}function tr(e,t){return new W_({type:"pipe",in:ah(e),out:t})}var mh={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 dh;(function(e){})(dh||(dh={}));var us={};Uo(us,{bigint:()=>cS,boolean:()=>aS,date:()=>uS,number:()=>iS,string:()=>sS});function sS(e){return Nm(xc,e)}function iS(e){return np(cs,e)}function aS(e){return ip(Ic,e)}function cS(e){return ap(rh,e)}function uS(e){return mp(oh,e)}Xe(Ua());var kr="2025-11-25";var jc=[kr,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Mc="io.modelcontextprotocol/related-task",Or="io.modelcontextprotocol/protocolVersion",Un="io.modelcontextprotocol/clientInfo",xt="io.modelcontextprotocol/serverInfo",It="io.modelcontextprotocol/clientCapabilities",ls="io.modelcontextprotocol/subscriptionId",nr="io.modelcontextprotocol/logLevel";var Cr="2.0";var Nt=Dn(()=>W([d(),J(),Q(),er(),Y(d(),Nt),A(Nt)])),Ie=Y(d(),Nt),qc=A(Nt),Fn=W([d(),J().int()]),Zn=d(),ds=I({ttl:J().optional()}),ms=I({taskId:d()}),Vn=ce({progressToken:Fn.optional(),[Mc]:ms.optional()}),De=I({_meta:Vn.optional()}),or=De.extend({task:ds.optional()}),Ae=I({method:d(),params:De.loose().optional()}),He=I({_meta:Vn.optional()}),Ke=I({method:d(),params:He.loose().optional()}),Jn=ce({get[xt](){return Ir.optional().catch(void 0)}}),je=ce({_meta:Jn.optional()}),At=W([d(),J().int()]),Hn=I({jsonrpc:j(Cr),id:At,...Ae.shape}).strict(),Kn=I({jsonrpc:j(Cr),...Ke.shape}).strict(),Nr=I({jsonrpc:j(Cr),id:At,result:je}).strict(),xr=I({jsonrpc:j(Cr),id:At.optional(),error:I({code:J().int(),message:d(),data:se().optional()})}).strict(),ps=W([Hn,Kn,Nr,xr]),Lc=W([Nr,xr]),Bn=je.strict(),hs=He.extend({requestId:At.optional(),reason:d().optional()}),Yn=Ke.extend({method:j("notifications/cancelled"),params:hs}),fs=I({src:d(),mimeType:d().optional(),sizes:A(d()).optional(),theme:de(["light","dark"]).optional()}),jt=I({icons:A(fs).optional()}),yt=I({name:d(),title:d().optional()}),Ir=yt.extend({...yt.shape,...jt.shape,version:d(),websiteUrl:d().optional(),description:d().optional()}),dS=St(I({applyDefaults:Q().optional()}),Ie),mS=tr((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)&&Object.keys(e).length===0)return{form:{}};return e},St(I({form:dS.optional(),url:Ie.optional()}),Ie.optional())),gs=ce({list:Ie.optional(),cancel:Ie.optional(),requests:ce({sampling:ce({createMessage:Ie.optional()}).optional(),elicitation:ce({create:Ie.optional()}).optional()}).optional()}),_s=ce({list:Ie.optional(),cancel:Ie.optional(),requests:ce({tools:ce({call:Ie.optional()}).optional()}).optional()}),Ss=I({experimental:Y(d(),Ie).optional(),sampling:I({context:Ie.optional(),tools:Ie.optional()}).optional(),elicitation:mS.optional(),roots:I({listChanged:Q().optional()}).optional(),tasks:gs.optional(),extensions:Y(d(),Ie).optional()}),ys=De.extend({protocolVersion:d(),capabilities:Ss,clientInfo:Ir}),vs=Ae.extend({method:j("initialize"),params:ys}),Gn=I({experimental:Y(d(),Ie).optional(),logging:Ie.optional(),completions:Ie.optional(),prompts:I({listChanged:Q().optional()}).optional(),resources:I({subscribe:Q().optional(),listChanged:Q().optional()}).optional(),tools:I({listChanged:Q().optional()}).optional(),tasks:_s.optional(),extensions:Y(d(),Ie).optional()}),bs=je.extend({protocolVersion:d(),capabilities:Gn,serverInfo:Ir,instructions:d().optional()}),Rs=Ke.extend({method:j("notifications/initialized"),params:He.optional()}),zs=Ae.extend({method:j("server/discover"),params:De.optional()}),ws=je.extend({supportedVersions:A(d()),capabilities:Gn,instructions:d().optional()}),Qn=Ae.extend({method:j("ping"),params:De.optional()}),$s=I({progress:J(),total:re(J()),message:re(d())}),Es=I({...He.shape,...$s.shape,progressToken:Fn}),Wn=Ke.extend({method:j("notifications/progress"),params:Es}),Ts=De.extend({cursor:Zn.optional()}),Mt=Ae.extend({params:Ts.optional()}),qt=je.extend({nextCursor:Zn.optional()}),Xn=I({uri:d(),mimeType:re(d()),_meta:Y(d(),se()).optional()}),eo=Xn.extend({text:d()}),Dc=d().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),to=Xn.extend({blob:Dc}),Lt=de(["user","assistant"]),vt=I({audience:A(Lt).optional(),priority:J().min(0).max(1).optional(),lastModified:dt.datetime({offset:!0}).optional()}),ro=I({...yt.shape,...jt.shape,uri:d(),description:re(d()),mimeType:re(d()),size:re(J()),annotations:vt.optional(),_meta:re(ce({}))}),Ps=I({...yt.shape,...jt.shape,uriTemplate:d(),description:re(d()),mimeType:re(d()),annotations:vt.optional(),_meta:re(ce({}))}),ks=Mt.extend({method:j("resources/list")}),Os=qt.extend({resources:A(ro)}),Cs=Mt.extend({method:j("resources/templates/list")}),Ns=qt.extend({resourceTemplates:A(Ps)}),Ar=De.extend({uri:d()}),xs=Ar,Is=Ae.extend({method:j("resources/read"),params:xs}),As=je.extend({contents:A(W([eo,to]))}),js=Ke.extend({method:j("notifications/resources/list_changed"),params:He.optional()}),Ms=Ar,qs=Ae.extend({method:j("resources/subscribe"),params:Ms}),Ls=Ar,Ds=Ae.extend({method:j("resources/unsubscribe"),params:Ls}),no=I({toolsListChanged:Q().optional(),promptsListChanged:Q().optional(),resourcesListChanged:Q().optional(),resourceSubscriptions:A(d()).optional()}),Us=De.extend({notifications:no}),Fs=Ae.extend({method:j("subscriptions/listen"),params:Us}),Zs=He.extend({notifications:no}),Vs=Ke.extend({method:j("notifications/subscriptions/acknowledged"),params:Zs}),Js=Jn.extend({[ls]:At}),Hs=je.extend({_meta:Js}),Ks=He.extend({uri:d()}),Bs=Ke.extend({method:j("notifications/resources/updated"),params:Ks}),Ys=I({name:d(),description:re(d()),required:re(Q())}),Gs=I({...yt.shape,...jt.shape,description:re(d()),arguments:re(A(Ys)),_meta:re(ce({}))}),Qs=Mt.extend({method:j("prompts/list")}),Ws=qt.extend({prompts:A(Gs)}),Xs=De.extend({name:d(),arguments:Y(d(),d()).optional()}),ei=Ae.extend({method:j("prompts/get"),params:Xs}),jr=I({type:j("text"),text:d(),annotations:vt.optional(),_meta:Y(d(),se()).optional()}),Mr=I({type:j("image"),data:Dc,mimeType:d(),annotations:vt.optional(),_meta:Y(d(),se()).optional()}),qr=I({type:j("audio"),data:Dc,mimeType:d(),annotations:vt.optional(),_meta:Y(d(),se()).optional()}),ti=I({type:j("tool_use"),name:d(),id:d(),input:Y(d(),se()),_meta:Y(d(),se()).optional()}),ri=I({type:j("resource"),resource:W([eo,to]),annotations:vt.optional(),_meta:Y(d(),se()).optional()}),ni=ro.extend({type:j("resource_link")}),Lr=W([jr,Mr,qr,ni,ri]),oi=I({role:Lt,content:Lr}),si=je.extend({description:d().optional(),messages:A(oi)}),ii=Ke.extend({method:j("notifications/prompts/list_changed"),params:He.optional()}),ai=I({title:d().optional(),readOnlyHint:Q().optional(),destructiveHint:Q().optional(),idempotentHint:Q().optional(),openWorldHint:Q().optional()}),ci=I({taskSupport:de(["required","optional","forbidden"]).optional()}),oo=I({...yt.shape,...jt.shape,description:d().optional(),inputSchema:I({type:j("object"),properties:Y(d(),Nt).optional(),required:A(d()).optional()}).catchall(se()),outputSchema:ce({$schema:d().optional()}).optional(),annotations:ai.optional(),execution:ci.optional(),_meta:Y(d(),se()).optional()}),ui=Mt.extend({method:j("tools/list")}),li=qt.extend({tools:A(oo)}),so=je.extend({content:A(Lr).default([]),structuredContent:se().optional(),isError:Q().optional()}),Uc=so.or(je.extend({toolResult:se()})),di=or.extend({name:d(),arguments:Y(d(),se()).optional()}),mi=Ae.extend({method:j("tools/call"),params:di}),pi=Ke.extend({method:j("notifications/tools/list_changed"),params:He.optional()}),Fc=I({autoRefresh:Q().default(!0),debounceMs:J().int().nonnegative().default(300)}),Dt=de(["debug","info","notice","warning","error","critical","alert","emergency"]),hi=De.extend({level:Dt}),fi=Ae.extend({method:j("logging/setLevel"),params:hi}),gi=He.extend({level:Dt,logger:d().optional(),data:se()}),_i=Ke.extend({method:j("notifications/message"),params:gi}),Si=I({name:d().optional()}),yi=I({hints:A(Si).optional(),costPriority:J().min(0).max(1).optional(),speedPriority:J().min(0).max(1).optional(),intelligencePriority:J().min(0).max(1).optional()}),vi=I({mode:de(["auto","required","none"]).optional()}),bi=I({type:j("tool_result"),toolUseId:d().describe("The unique identifier for the corresponding tool call."),content:A(Lr),structuredContent:se().optional(),isError:Q().optional(),_meta:Y(d(),se()).optional()}),Ri=Pr("type",[jr,Mr,qr]),rr=Pr("type",[jr,Mr,qr,ti,bi]),zi=I({role:Lt,content:W([rr,A(rr)]),_meta:Y(d(),se()).optional()}),wi=or.extend({messages:A(zi),modelPreferences:yi.optional(),systemPrompt:d().optional(),includeContext:de(["none","thisServer","allServers"]).optional(),temperature:J().optional(),maxTokens:J().int(),stopSequences:A(d()).optional(),metadata:Ie.optional(),tools:A(oo).optional(),toolChoice:vi.optional()}),$i=Ae.extend({method:j("sampling/createMessage"),params:wi}),Ei=je.extend({model:d(),stopReason:re(de(["endTurn","stopSequence","maxTokens"]).or(d())),role:Lt,content:Ri}),Ti=je.extend({model:d(),stopReason:re(de(["endTurn","stopSequence","maxTokens","toolUse"]).or(d())),role:Lt,content:W([rr,A(rr)])}),io=I({type:j("boolean"),title:d().optional(),description:d().optional(),default:Q().optional()}),Dr=I({type:j("string"),title:d().optional(),description:d().optional(),minLength:J().optional(),maxLength:J().optional(),format:de(["email","uri","date","date-time"]).optional(),default:d().optional()}),Ur=I({type:de(["number","integer"]),title:d().optional(),description:d().optional(),minimum:J().optional(),maximum:J().optional(),default:J().optional()}),ao=I({type:j("string"),title:d().optional(),description:d().optional(),enum:A(d()),default:d().optional()}),co=I({type:j("string"),title:d().optional(),description:d().optional(),oneOf:A(I({const:d(),title:d()})),default:d().optional()}),uo=I({type:j("string"),title:d().optional(),description:d().optional(),enum:A(d()),enumNames:A(d()).optional(),default:d().optional()}),Pi=W([ao,co]),lo=I({type:j("array"),title:d().optional(),description:d().optional(),minItems:J().optional(),maxItems:J().optional(),items:I({type:j("string"),enum:A(d())}),default:A(d()).optional()}),mo=I({type:j("array"),title:d().optional(),description:d().optional(),minItems:J().optional(),maxItems:J().optional(),items:I({anyOf:A(I({const:d(),title:d()}))}),default:A(d()).optional()}),ki=W([lo,mo]),Oi=W([uo,Pi,ki]),po=W([Oi,io,Dr,Ur]),Fr=or.extend({mode:j("form").optional(),message:d(),requestedSchema:I({type:j("object"),properties:Y(d(),po),required:A(d()).optional()}).catchall(se())}),Ci=or.extend({mode:j("url"),message:d(),elicitationId:d(),url:d().url()}),Ni=W([Fr,Ci]),xi=Ae.extend({method:j("elicitation/create"),params:Ni}),Ii=He.extend({elicitationId:d()}),Ai=Ke.extend({method:j("notifications/elicitation/complete"),params:Ii}),ji=je.extend({action:de(["accept","decline","cancel"]),content:tr((e)=>e===null?void 0:e,Y(d(),W([d(),J(),Q(),A(d())])).optional())}),Mi=I({type:j("ref/resource"),uri:d()}),qi=I({type:j("ref/prompt"),name:d()}),Li=De.extend({ref:W([qi,Mi]),argument:I({name:d(),value:d()}),context:I({arguments:Y(d(),d()).optional()}).optional()}),Di=Ae.extend({method:j("completion/complete"),params:Li}),Ui=je.extend({completion:ce({values:A(d()).max(100),total:re(J().int()),hasMore:re(Q())})}),Fi=I({uri:d().startsWith("file://"),name:d().optional(),_meta:Y(d(),se()).optional()}),Zi=Ae.extend({method:j("roots/list"),params:De.optional()}),Vi=je.extend({roots:A(Fi)}),Ji=Ke.extend({method:j("notifications/roots/list_changed"),params:He.optional()}),Zc=ce({ttl:J().optional(),pollInterval:J().optional()}),Hi=de(["working","input_required","completed","failed","cancelled"]),Ut=I({taskId:d(),status:Hi,ttl:W([J(),er()]),createdAt:d(),lastUpdatedAt:d(),pollInterval:re(J()),statusMessage:re(d())}),Vc=je.extend({task:Ut}),Ki=He.merge(Ut),Jc=Ke.extend({method:j("notifications/tasks/status"),params:Ki}),Hc=Ae.extend({method:j("tasks/get"),params:De.extend({taskId:d()})}),Kc=je.merge(Ut),Bc=Ae.extend({method:j("tasks/result"),params:De.extend({taskId:d()})}),Yc=je.loose(),Gc=Mt.extend({method:j("tasks/list")}),Qc=qt.extend({tasks:A(Ut)}),Wc=Ae.extend({method:j("tasks/cancel"),params:De.extend({taskId:d()})}),Xc=je.merge(Ut),eu=W([Qn,vs,zs,Di,fi,ei,Qs,ks,Cs,Is,qs,Ds,Fs,mi,ui]),tu=W([Yn,Wn,Rs,Ji]),ru=W([Bn,Ei,Ti,ji,Vi]),nu=W([Qn,$i,xi,Zi]),ou=W([Yn,Wn,_i,Bs,js,pi,ii,Vs,Ai]),su=W([Bn,bs,ws,Ui,si,Ws,Os,Ns,As,so,li,Hs]),Le=as().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:mh.custom,message:"URL must be parseable",fatal:!0}),Sa}).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"}),iu=ce({resource:d().url(),authorization_servers:A(Le).optional(),jwks_uri:d().url().optional(),scopes_supported:A(d()).optional(),bearer_methods_supported:A(d()).optional(),resource_signing_alg_values_supported:A(d()).optional(),resource_name:d().optional(),resource_documentation:d().optional(),resource_policy_uri:d().url().optional(),resource_tos_uri:d().url().optional(),tls_client_certificate_bound_access_tokens:Q().optional(),authorization_details_types_supported:A(d()).optional(),dpop_signing_alg_values_supported:A(d()).optional(),dpop_bound_access_tokens_required:Q().optional()}),Bi=ce({issuer:d(),authorization_endpoint:Le,token_endpoint:Le,registration_endpoint:Le.optional(),scopes_supported:A(d()).optional(),response_types_supported:A(d()),response_modes_supported:A(d()).optional(),grant_types_supported:A(d()).optional(),token_endpoint_auth_methods_supported:A(d()).optional(),token_endpoint_auth_signing_alg_values_supported:A(d()).optional(),service_documentation:Le.optional(),revocation_endpoint:Le.optional(),revocation_endpoint_auth_methods_supported:A(d()).optional(),revocation_endpoint_auth_signing_alg_values_supported:A(d()).optional(),introspection_endpoint:d().optional(),introspection_endpoint_auth_methods_supported:A(d()).optional(),introspection_endpoint_auth_signing_alg_values_supported:A(d()).optional(),code_challenge_methods_supported:A(d()).optional(),client_id_metadata_document_supported:Q().optional(),authorization_response_iss_parameter_supported:Q().optional().catch(void 0)}),Yi=ce({issuer:d(),authorization_endpoint:Le,token_endpoint:Le,userinfo_endpoint:Le.optional(),jwks_uri:Le,registration_endpoint:Le.optional(),scopes_supported:A(d()).optional(),response_types_supported:A(d()),response_modes_supported:A(d()).optional(),grant_types_supported:A(d()).optional(),acr_values_supported:A(d()).optional(),subject_types_supported:A(d()),id_token_signing_alg_values_supported:A(d()),id_token_encryption_alg_values_supported:A(d()).optional(),id_token_encryption_enc_values_supported:A(d()).optional(),userinfo_signing_alg_values_supported:A(d()).optional(),userinfo_encryption_alg_values_supported:A(d()).optional(),userinfo_encryption_enc_values_supported:A(d()).optional(),request_object_signing_alg_values_supported:A(d()).optional(),request_object_encryption_alg_values_supported:A(d()).optional(),request_object_encryption_enc_values_supported:A(d()).optional(),token_endpoint_auth_methods_supported:A(d()).optional(),token_endpoint_auth_signing_alg_values_supported:A(d()).optional(),display_values_supported:A(d()).optional(),claim_types_supported:A(d()).optional(),claims_supported:A(d()).optional(),service_documentation:d().optional(),claims_locales_supported:A(d()).optional(),ui_locales_supported:A(d()).optional(),claims_parameter_supported:Q().optional(),request_parameter_supported:Q().optional(),request_uri_parameter_supported:Q().optional(),require_request_uri_registration:Q().optional(),op_policy_uri:Le.optional(),op_tos_uri:Le.optional(),client_id_metadata_document_supported:Q().optional(),authorization_response_iss_parameter_supported:Q().optional().catch(void 0)}),au=I({...Yi.shape,...Bi.pick({code_challenge_methods_supported:!0}).shape}),cu=I({access_token:d(),id_token:d().optional(),token_type:d(),expires_in:us.number().optional(),scope:d().optional(),refresh_token:d().optional()}).strip(),uu=I({issued_token_type:j("urn:ietf:params:oauth:token-type:id-jag"),access_token:d(),token_type:d().optional(),expires_in:J().optional(),scope:d().optional()}).strip(),lu=I({error:d(),error_description:d().optional(),error_uri:d().optional()}),Ac=Le.optional().or(j("").transform(()=>{return})),Gi=I({redirect_uris:A(Le),token_endpoint_auth_method:d().optional(),grant_types:A(d()).optional(),response_types:A(d()).optional(),application_type:d().optional(),client_name:d().optional(),client_uri:Le.optional(),logo_uri:Ac,scope:d().optional(),contacts:A(d()).optional(),tos_uri:Ac,policy_uri:d().optional(),jwks_uri:Le.optional(),jwks:nh().optional(),software_id:d().optional(),software_version:d().optional(),software_statement:d().optional()}).strip(),Qi=I({client_id:d(),client_secret:d().optional(),client_id_issued_at:J().optional(),client_secret_expires_at:J().optional()}).strip(),du=Gi.merge(Qi),mu=I({error:d(),error_description:d().optional()}).strip(),pu=I({token:d(),token_type_hint:d().optional()}).strip();var _u=Symbol.for("mcp.sdk.errorBrands");function zu(e,t){let r=new Set,n=t;while(typeof n==="function"){let o=n.mcpBrand;if(Object.prototype.hasOwnProperty.call(n,"mcpBrand")&&typeof o==="string")r.add(o);n=Object.getPrototypeOf(n)}if(r.size===0)return;Object.defineProperty(e,_u,{value:r,enumerable:!1,configurable:!0})}function Vr(e,t){try{if(typeof t==="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(t,_u)){let r=t[_u];if(r&&typeof r.has==="function"&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var L0=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return Vr(this,t)}static isInstance(t){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 Vr(this,t)}constructor(t,r,n){super(r);this.code=t,this.errorUri=n,this.name="OAuthError",zu(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};if(this.errorUri)t.error_uri=this.errorUri;return t}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}},ge=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}({}),pe=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return Vr(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 Vr(this,e)}constructor(e,t,r){super(t);this.code=e,this.data=r,this.name="SdkError",zu(this,new.target)}},D0=class extends pe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r){super(e,t,r);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};function ph(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function RS(e,t,r){return e==="elicitation"&&t==="form"&&r.form===void 0&&r.url===void 0}function wh(e){switch(e.method){case"elicitation/create":if(e.params?.mode==="url")return{elicitation:{url:{}}};return{elicitation:{form:{}}};case"sampling/createMessage":{let t=e.params;if(t!==void 0&&(t.tools!==void 0||t.toolChoice!==void 0))return{sampling:{tools:{}}};return{sampling:{}}}case"roots/list":return{roots:{}};default:return}}function wu(e,t){let r={};for(let[n,o]of Object.entries(e)){if(o===void 0)continue;let s=t===void 0?void 0:t[n];if(s===void 0){r[n]=o;continue}if(ph(o)&&ph(s)){let a={};for(let[i,c]of Object.entries(o))if(c!==void 0&&s[i]===void 0&&!RS(n,i,s))a[i]=c;if(Object.keys(a).length>0)r[n]=a}}return Object.keys(r).length>0?r:void 0}var zS="2026-07-28";function yo(e){return e>=zS}function $h(e){return e.filter((t)=>!yo(t))}function $u(e){return e.filter((t)=>yo(t))}function Eh(e){let t=e.structuredContent;if(t===void 0)return e;if(!(typeof t!=="object"||t===null||Array.isArray(t)))return e;if(e.content?.some((r)=>r.type==="text")??!1)return e;return{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var Th=["task","inputRequests","requestState"];function Eu(e){if(e===null||typeof e!=="object"||Array.isArray(e)||e.content!==void 0||Th.some((t)=>(t in e)))return e;return{...e,content:[]}}function wS(){let e=Dn(()=>W([d(),J(),Q(),er(),Y(d(),e),A(e)])),t=Y(d(),e),r=W([d(),J().int()]),n=d(),o=I({ttl:J().optional()}),s=I({taskId:d()}),a=ce({progressToken:r.optional(),"io.modelcontextprotocol/related-task":s.optional()}),i=I({_meta:a.optional()}),c=i.extend({task:o.optional()}),u=I({method:d(),params:i.loose().optional()}),f=I({_meta:a.optional()}),_=I({method:d(),params:f.loose().optional()}),E=ce({_meta:a.optional()}),P=W([d(),J().int()]),v=E.strict(),w=f.extend({requestId:P.optional(),reason:d().optional()}),m=_.extend({method:j("notifications/cancelled"),params:w}),g=I({src:d(),mimeType:d().optional(),sizes:A(d()).optional(),theme:de(["light","dark"]).optional()}),z=I({icons:A(g).optional()}),S=I({name:d(),title:d().optional()}),b=S.extend({...S.shape,...z.shape,version:d(),websiteUrl:d().optional(),description:d().optional()}),O=St(I({applyDefaults:Q().optional()}),t),R=tr((Je)=>{if(Je&&typeof Je==="object"&&!Array.isArray(Je)&&Object.keys(Je).length===0)return{form:{}};return Je},St(I({form:O.optional(),url:t.optional()}),t.optional())),y=ce({list:t.optional(),cancel:t.optional(),requests:ce({sampling:ce({createMessage:t.optional()}).optional(),elicitation:ce({create:t.optional()}).optional()}).optional()}),N=ce({list:t.optional(),cancel:t.optional(),requests:ce({tools:ce({call:t.optional()}).optional()}).optional()}),q=I({experimental:Y(d(),t).optional(),sampling:I({context:t.optional(),tools:t.optional()}).optional(),elicitation:R.optional(),roots:I({listChanged:Q().optional()}).optional(),tasks:y.optional(),extensions:Y(d(),t).optional()}),H=i.extend({protocolVersion:d(),capabilities:q,clientInfo:b}),D=u.extend({method:j("initialize"),params:H}),Z=I({experimental:Y(d(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:I({listChanged:Q().optional()}).optional(),resources:I({subscribe:Q().optional(),listChanged:Q().optional()}).optional(),tools:I({listChanged:Q().optional()}).optional(),tasks:N.optional(),extensions:Y(d(),t).optional()}),G=E.extend({protocolVersion:d(),capabilities:Z,serverInfo:b,instructions:d().optional()}),B=_.extend({method:j("notifications/initialized"),params:f.optional()}),he=u.extend({method:j("ping"),params:i.optional()}),we=I({progress:J(),total:re(J()),message:re(d())}),be=I({...f.shape,...we.shape,progressToken:r}),Oe=_.extend({method:j("notifications/progress"),params:be}),fe=i.extend({cursor:n.optional()}),l=u.extend({params:fe.optional()}),h=E.extend({nextCursor:n.optional()}),k=I({uri:d(),mimeType:re(d()),_meta:Y(d(),se()).optional()}),p=k.extend({text:d()}),T=d().refine((Je)=>{try{return atob(Je),!0}catch{return!1}},{message:"Invalid Base64 string"}),x=k.extend({blob:T}),F=de(["user","assistant"]),K=I({audience:A(F).optional(),priority:J().min(0).max(1).optional(),lastModified:dt.datetime({offset:!0}).optional()}),X=I({...S.shape,...z.shape,uri:d(),description:re(d()),mimeType:re(d()),size:re(J()),annotations:K.optional(),_meta:re(ce({}))}),te=I({...S.shape,...z.shape,uriTemplate:d(),description:re(d()),mimeType:re(d()),annotations:K.optional(),_meta:re(ce({}))}),le=l.extend({method:j("resources/list")}),oe=h.extend({resources:A(X)}),C=l.extend({method:j("resources/templates/list")}),M=h.extend({resourceTemplates:A(te)}),U=i.extend({uri:d()}),ee=U,ie=u.extend({method:j("resources/read"),params:ee}),ue=E.extend({contents:A(W([p,x]))}),Te=_.extend({method:j("notifications/resources/list_changed"),params:f.optional()}),Ne=U,qe=u.extend({method:j("resources/subscribe"),params:Ne}),Ce=U,$e=u.extend({method:j("resources/unsubscribe"),params:Ce}),Ue=f.extend({uri:d()}),xe=_.extend({method:j("notifications/resources/updated"),params:Ue}),nt=I({name:d(),description:re(d()),required:re(Q())}),Ge=I({...S.shape,...z.shape,description:re(d()),arguments:re(A(nt)),_meta:re(ce({}))}),Fe=l.extend({method:j("prompts/list")}),Rt=h.extend({prompts:A(Ge)}),zt=i.extend({name:d(),arguments:Y(d(),d()).optional()}),Zt=u.extend({method:j("prompts/get"),params:zt}),Vt=I({type:j("text"),text:d(),annotations:K.optional(),_meta:Y(d(),se()).optional()}),Jt=I({type:j("image"),data:T,mimeType:d(),annotations:K.optional(),_meta:Y(d(),se()).optional()}),Ht=I({type:j("audio"),data:T,mimeType:d(),annotations:K.optional(),_meta:Y(d(),se()).optional()}),Gr=I({type:j("tool_use"),name:d(),id:d(),input:Y(d(),se()),_meta:Y(d(),se()).optional()}),wt=I({type:j("resource"),resource:W([p,x]),annotations:K.optional(),_meta:Y(d(),se()).optional()}),Qr=X.extend({type:j("resource_link")}),ot=W([Vt,Jt,Ht,Qr,wt]),ur=I({role:F,content:ot}),lr=E.extend({description:d().optional(),messages:A(ur)}),Kt=_.extend({method:j("notifications/prompts/list_changed"),params:f.optional()}),Wr=I({title:d().optional(),readOnlyHint:Q().optional(),destructiveHint:Q().optional(),idempotentHint:Q().optional(),openWorldHint:Q().optional()}),dr=I({taskSupport:de(["required","optional","forbidden"]).optional()}),Bt=I({...S.shape,...z.shape,description:d().optional(),inputSchema:I({type:j("object"),properties:Y(d(),e).optional(),required:A(d()).optional()}).catchall(se()),outputSchema:I({type:j("object"),properties:Y(d(),e).optional(),required:A(d()).optional()}).catchall(se()).optional(),annotations:Wr.optional(),execution:dr.optional(),_meta:Y(d(),se()).optional()}),mr=l.extend({method:j("tools/list")}),pr=h.extend({tools:A(Bt)}),hr=E.extend({content:A(ot),structuredContent:Y(d(),se()).optional(),isError:Q().optional()}),Ve=c.extend({name:d(),arguments:Y(d(),se()).optional()}),Xr=u.extend({method:j("tools/call"),params:Ve}),wo=_.extend({method:j("notifications/tools/list_changed"),params:f.optional()}),fr=de(["debug","info","notice","warning","error","critical","alert","emergency"]),en=i.extend({level:fr}),tn=u.extend({method:j("logging/setLevel"),params:en}),rn=f.extend({level:fr,logger:d().optional(),data:se()}),nn=_.extend({method:j("notifications/message"),params:rn}),on=I({name:d().optional()}),sn=I({hints:A(on).optional(),costPriority:J().min(0).max(1).optional(),speedPriority:J().min(0).max(1).optional(),intelligencePriority:J().min(0).max(1).optional()}),an=I({mode:de(["auto","required","none"]).optional()}),$o=I({type:j("tool_result"),toolUseId:d().describe("The unique identifier for the corresponding tool call."),content:A(ot),structuredContent:I({}).loose().optional(),isError:Q().optional(),_meta:Y(d(),se()).optional()}),cn=Pr("type",[Vt,Jt,Ht]),$t=Pr("type",[Vt,Jt,Ht,Gr,$o]),un=I({role:F,content:W([$t,A($t)]),_meta:Y(d(),se()).optional()}),ln=c.extend({messages:A(un),modelPreferences:sn.optional(),systemPrompt:d().optional(),includeContext:de(["none","thisServer","allServers"]).optional(),temperature:J().optional(),maxTokens:J().int(),stopSequences:A(d()).optional(),metadata:t.optional(),tools:A(Bt).optional(),toolChoice:an.optional()}),dn=u.extend({method:j("sampling/createMessage"),params:ln}),mn=E.extend({model:d(),stopReason:re(de(["endTurn","stopSequence","maxTokens"]).or(d())),role:F,content:cn}),pn=E.extend({model:d(),stopReason:re(de(["endTurn","stopSequence","maxTokens","toolUse"]).or(d())),role:F,content:W([$t,A($t)])}),hn=I({type:j("boolean"),title:d().optional(),description:d().optional(),default:Q().optional()}),fn=I({type:j("string"),title:d().optional(),description:d().optional(),minLength:J().optional(),maxLength:J().optional(),format:de(["email","uri","date","date-time"]).optional(),default:d().optional()}),gn=I({type:de(["number","integer"]),title:d().optional(),description:d().optional(),minimum:J().optional(),maximum:J().optional(),default:J().optional()}),_n=I({type:j("string"),title:d().optional(),description:d().optional(),enum:A(d()),default:d().optional()}),Sn=I({type:j("string"),title:d().optional(),description:d().optional(),oneOf:A(I({const:d(),title:d()})),default:d().optional()}),yn=I({type:j("string"),title:d().optional(),description:d().optional(),enum:A(d()),enumNames:A(d()).optional(),default:d().optional()}),vn=W([_n,Sn]),Yt=I({type:j("array"),title:d().optional(),description:d().optional(),minItems:J().optional(),maxItems:J().optional(),items:I({type:j("string"),enum:A(d())}),default:A(d()).optional()}),Gt=I({type:j("array"),title:d().optional(),description:d().optional(),minItems:J().optional(),maxItems:J().optional(),items:I({anyOf:A(I({const:d(),title:d()}))}),default:A(d()).optional()}),Eo=W([Yt,Gt]),To=W([yn,vn,Eo]),et=W([To,hn,fn,gn]),tt=c.extend({mode:j("form").optional(),message:d(),requestedSchema:I({type:j("object"),properties:Y(d(),et),required:A(d()).optional()}).catchall(se())}),bn=c.extend({mode:j("url"),message:d(),elicitationId:d(),url:d().url()}),at=W([tt,bn]),Po=u.extend({method:j("elicitation/create"),params:at}),ko=f.extend({elicitationId:d()}),Oo=_.extend({method:j("notifications/elicitation/complete"),params:ko}),Co=E.extend({action:de(["accept","decline","cancel"]),content:tr((Je)=>Je===null?void 0:Je,Y(d(),W([d(),J(),Q(),A(d())])).optional())}),No=I({type:j("ref/resource"),uri:d()}),xo=I({type:j("ref/prompt"),name:d()}),Io=i.extend({ref:W([xo,No]),argument:I({name:d(),value:d()}),context:I({arguments:Y(d(),d()).optional()}).optional()}),Rn=u.extend({method:j("completion/complete"),params:Io}),Ao=E.extend({completion:ce({values:A(d()).max(100),total:re(J().int()),hasMore:re(Q())})}),jo=I({uri:d().startsWith("file://"),name:d().optional(),_meta:Y(d(),se()).optional()}),gr=u.extend({method:j("roots/list"),params:i.optional()}),zn=E.extend({roots:A(jo)}),Mo=_.extend({method:j("notifications/roots/list_changed"),params:f.optional()}),qo=ce({ttl:J().optional(),pollInterval:J().optional()}),Lo=de(["working","input_required","completed","failed","cancelled"]),Et=I({taskId:d(),status:Lo,ttl:W([J(),er()]),createdAt:d(),lastUpdatedAt:d(),pollInterval:re(J()),statusMessage:re(d())}),Qe=E.extend({task:Et}),Do=f.merge(Et),Qt=_.extend({method:j("notifications/tasks/status"),params:Do}),_r=u.extend({method:j("tasks/get"),params:i.extend({taskId:d()})}),Sr=E.merge(Et),yr=u.extend({method:j("tasks/result"),params:i.extend({taskId:d()})}),fa=E.loose(),We=l.extend({method:j("tasks/list")}),Me=h.extend({tasks:A(Et)}),Wt=u.extend({method:j("tasks/cancel"),params:i.extend({taskId:d()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:n,TaskMetadataSchema:o,RelatedTaskMetadataSchema:s,RequestMetaSchema:a,BaseRequestParamsSchema:i,TaskAugmentedRequestParamsSchema:c,RequestSchema:u,NotificationsParamsSchema:f,NotificationSchema:_,ResultSchema:E,RequestIdSchema:P,EmptyResultSchema:v,CancelledNotificationParamsSchema:w,CancelledNotificationSchema:m,IconSchema:g,IconsSchema:z,BaseMetadataSchema:S,ImplementationSchema:b,ClientTasksCapabilitySchema:y,ServerTasksCapabilitySchema:N,ClientCapabilitiesSchema:q,InitializeRequestParamsSchema:H,InitializeRequestSchema:D,ServerCapabilitiesSchema:Z,InitializeResultSchema:G,InitializedNotificationSchema:B,PingRequestSchema:he,ProgressSchema:we,ProgressNotificationParamsSchema:be,ProgressNotificationSchema:Oe,PaginatedRequestParamsSchema:fe,PaginatedRequestSchema:l,PaginatedResultSchema:h,ResourceContentsSchema:k,TextResourceContentsSchema:p,BlobResourceContentsSchema:x,RoleSchema:F,AnnotationsSchema:K,ResourceSchema:X,ResourceTemplateSchema:te,ListResourcesRequestSchema:le,ListResourcesResultSchema:oe,ListResourceTemplatesRequestSchema:C,ListResourceTemplatesResultSchema:M,ResourceRequestParamsSchema:U,ReadResourceRequestParamsSchema:ee,ReadResourceRequestSchema:ie,ReadResourceResultSchema:ue,ResourceListChangedNotificationSchema:Te,SubscribeRequestParamsSchema:Ne,SubscribeRequestSchema:qe,UnsubscribeRequestParamsSchema:Ce,UnsubscribeRequestSchema:$e,ResourceUpdatedNotificationParamsSchema:Ue,ResourceUpdatedNotificationSchema:xe,PromptArgumentSchema:nt,PromptSchema:Ge,ListPromptsRequestSchema:Fe,ListPromptsResultSchema:Rt,GetPromptRequestParamsSchema:zt,GetPromptRequestSchema:Zt,TextContentSchema:Vt,ImageContentSchema:Jt,AudioContentSchema:Ht,ToolUseContentSchema:Gr,EmbeddedResourceSchema:wt,ResourceLinkSchema:Qr,ContentBlockSchema:ot,PromptMessageSchema:ur,GetPromptResultSchema:lr,PromptListChangedNotificationSchema:Kt,ToolAnnotationsSchema:Wr,ToolExecutionSchema:dr,ToolSchema:Bt,ListToolsRequestSchema:mr,ListToolsResultSchema:pr,CallToolResultSchema:hr,CallToolRequestParamsSchema:Ve,CallToolRequestSchema:Xr,ToolListChangedNotificationSchema:wo,LoggingLevelSchema:fr,SetLevelRequestParamsSchema:en,SetLevelRequestSchema:tn,LoggingMessageNotificationParamsSchema:rn,LoggingMessageNotificationSchema:nn,ModelHintSchema:on,ModelPreferencesSchema:sn,ToolChoiceSchema:an,ToolResultContentSchema:$o,SamplingContentSchema:cn,SamplingMessageContentBlockSchema:$t,SamplingMessageSchema:un,CreateMessageRequestParamsSchema:ln,CreateMessageRequestSchema:dn,CreateMessageResultSchema:mn,CreateMessageResultWithToolsSchema:pn,BooleanSchemaSchema:hn,StringSchemaSchema:fn,NumberSchemaSchema:gn,UntitledSingleSelectEnumSchemaSchema:_n,TitledSingleSelectEnumSchemaSchema:Sn,LegacyTitledEnumSchemaSchema:yn,SingleSelectEnumSchemaSchema:vn,UntitledMultiSelectEnumSchemaSchema:Yt,TitledMultiSelectEnumSchemaSchema:Gt,MultiSelectEnumSchemaSchema:Eo,EnumSchemaSchema:To,PrimitiveSchemaDefinitionSchema:et,ElicitRequestFormParamsSchema:tt,ElicitRequestURLParamsSchema:bn,ElicitRequestParamsSchema:at,ElicitRequestSchema:Po,ElicitationCompleteNotificationParamsSchema:ko,ElicitationCompleteNotificationSchema:Oo,ElicitResultSchema:Co,ResourceTemplateReferenceSchema:No,PromptReferenceSchema:xo,CompleteRequestParamsSchema:Io,CompleteRequestSchema:Rn,CompleteResultSchema:Ao,RootSchema:jo,ListRootsRequestSchema:gr,ListRootsResultSchema:zn,RootsListChangedNotificationSchema:Mo,TaskCreationParamsSchema:qo,TaskStatusSchema:Lo,TaskSchema:Et,CreateTaskResultSchema:Qe,TaskStatusNotificationParamsSchema:Do,TaskStatusNotificationSchema:Qt,GetTaskRequestSchema:_r,GetTaskResultSchema:Sr,GetTaskPayloadRequestSchema:yr,GetTaskPayloadResultSchema:fa,ListTasksRequestSchema:We,ListTasksResultSchema:Me,CancelTaskRequestSchema:Wt,CancelTaskResultSchema:E.merge(Et),ClientRequestSchema:W([he,D,Rn,tn,Zt,Fe,le,C,ie,qe,$e,Xr,mr,_r,yr,We,Wt]),ClientNotificationSchema:W([m,Oe,B,Mo,Qt]),ClientResultSchema:W([v,mn,pn,Co,zn,Sr,Me,Qe]),ServerRequestSchema:W([he,dn,Po,gr,_r,yr,We,Wt]),ServerNotificationSchema:W([m,Oe,nn,xe,Te,wo,Kt,Qt,Oo]),ServerResultSchema:W([v,G,Ao,lr,Rt,oe,M,ue,hr,pr,Sr,Me,Qe]),CallToolResultWireSchema:se().superRefine((Je,og)=>{if(typeof Je!=="object"||Je===null||Array.isArray(Je)||Je.content!==void 0)return;for(let al of Th)if(al in Je){og.addIssue({code:"custom",message:`content is required when the body carries '${al}' — another result family cannot default into an empty tools/call success`});return}}).transform(Eu).pipe(hr)}}var $S;function Ph(){return $S??=wS()}function kh(e){return e.type!=="object"}var ES=new Set(["const","enum","default","examples"]),TS=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function hh(e){return e!==void 0&&!(typeof e==="string"&&e.startsWith("#"))}function PS(e){let t=typeof e.$schema==="string"?e.$schema:void 0;if(hh(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let r=ll(e.$schema)&&e.$recursiveAnchor!==!0,n=(o,s)=>{if(Array.isArray(o))return o.map((c)=>n(c,!1));if(o===null||typeof o!=="object")return o;if(!s&&hh(o.$id))return o;let a={},i=!1;for(let[c,u]of Object.entries(o))if(s)a[c]=n(u,!1);else if((c==="$ref"||c==="$dynamicRef")&&typeof u==="string")a[c]=u==="#"?"#/properties/result":u.startsWith("#/")?`#/properties/result${u.slice(1)}`:u;else if(c==="$recursiveRef"&&u==="#"&&r)i=!0;else if(ES.has(c))a[c]=u;else if(TS.has(c))a[c]=n(u,!0);else a[c]=n(u,!1);if(i)if("$ref"in a)a.allOf=[...Array.isArray(a.allOf)?a.allOf:[],{$ref:"#/properties/result"}];else a.$ref="#/properties/result";return a};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:n(e,!1)},required:["result"]}}var Oh={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},Ch={"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},kS={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},Wi;function Tu(){if(Wi)return Wi;let e=Ph();return Wi={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}},Wi}function Nh(e){return Object.prototype.hasOwnProperty.call(Oh,e)}function xh(e){return Object.prototype.hasOwnProperty.call(Ch,e)}function OS(e){return Object.prototype.hasOwnProperty.call(kS,e)}function CS(e){return OS(e)?Tu().resultSchemas[e]:void 0}function NS(e){return Nh(e)?Tu().requestSchemas[e]:void 0}function xS(e){return xh(e)?Tu().notificationSchemas[e]:void 0}var U0=Object.keys(Oh),F0=Object.keys(Ch);function Su(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Xi(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var fh={ok:!1,reason:"not-in-era"};function gh(e){return Su(e)&&Su(e.outputSchema)&&kh(e.outputSchema)}function _h(e){return e}var Pu={era:"2025-11-25",hasRequestMethod:Nh,hasNotificationMethod:xh,validateRequest:(e,t)=>Xi(NS(e),t),validateResult:(e,t)=>Xi(CS(e),t),validateNotification:(e,t)=>Xi(xS(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>fh,validateInputResponse:()=>fh,samplingResultVariant:(e,t)=>{let r=Ph();return Xi(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:(e)=>{return},validateEnvelopeMeta:(e)=>[],projectCallToolResult(e,t){let r=Eh(e),n=r.structuredContent;if(n===void 0)return r;let o=typeof n!=="object"||n===null||Array.isArray(n),s=t!==void 0&&kh(t);if(!o&&!s)return r;return{...r,structuredContent:{result:n}}},decodeResult(e,t){if(Su(t)&&"resultType"in t){let r={...t};return delete r.resultType,{kind:"complete",result:_h(r)}}return{kind:"complete",result:_h(t)}},encodeResult(e,t){if(e!=="tools/list")return t;let r=t.tools;if(!Array.isArray(r)||!r.some((n)=>gh(n)))return t;return{...t,tools:r.map((n)=>gh(n)?{...n,outputSchema:PS(n.outputSchema)}:n)}},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope:(e)=>{return}};function IS(){let e=Dn(()=>W([d(),J(),Q(),er(),Y(d(),e),A(e)])),t=Y(d(),e),r=W([d(),J().int()]),n=d(),o=W([d(),J().int()]),s=de(["user","assistant"]),a=de(["debug","info","notice","warning","error","critical","alert","emergency"]),i=d().refine((Me)=>{try{return atob(Me),!0}catch{return!1}},{message:"Invalid Base64 string"}),c=I({ttl:J().optional()}),u=I({taskId:d()}),f=ce({progressToken:r.optional(),"io.modelcontextprotocol/related-task":u.optional()}),_=I({_meta:f.optional()}),E=_.extend({task:c.optional()}),P=I({_meta:f.optional()}),v=I({method:d(),params:P.loose().optional()}),w=I({src:d(),mimeType:d().optional(),sizes:A(d()).optional(),theme:de(["light","dark"]).optional()}),m=I({icons:A(w).optional()}),g=I({name:d(),title:d().optional()}),z=g.extend({...g.shape,...m.shape,version:d(),websiteUrl:d().optional(),description:d().optional()}),S=St(I({applyDefaults:Q().optional()}),t),b=tr((Me)=>{if(Me&&typeof Me==="object"&&!Array.isArray(Me)&&Object.keys(Me).length===0)return{form:{}};return Me},St(I({form:S.optional(),url:t.optional()}),t.optional())),O=ce({list:t.optional(),cancel:t.optional(),requests:ce({sampling:ce({createMessage:t.optional()}).optional(),elicitation:ce({create:t.optional()}).optional()}).optional()}),R=ce({list:t.optional(),cancel:t.optional(),requests:ce({tools:ce({call:t.optional()}).optional()}).optional()}),y=I({experimental:Y(d(),t).optional(),sampling:I({context:t.optional(),tools:t.optional()}).optional(),elicitation:b.optional(),roots:I({listChanged:Q().optional()}).optional(),tasks:O.optional(),extensions:Y(d(),t).optional()}),N=I({experimental:Y(d(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:I({listChanged:Q().optional()}).optional(),resources:I({subscribe:Q().optional(),listChanged:Q().optional()}).optional(),tools:I({listChanged:Q().optional()}).optional(),tasks:R.optional(),extensions:Y(d(),t).optional()}),q=I({progress:J(),total:re(J()),message:re(d())}),H=I({...P.shape,...q.shape,progressToken:r}),D=v.extend({method:j("notifications/progress"),params:H}),Z=P.extend({level:a,logger:d().optional(),data:se()}),G=v.extend({method:j("notifications/message"),params:Z}),B=I({uri:d(),mimeType:re(d()),_meta:Y(d(),se()).optional()}),he=B.extend({text:d()}),we=B.extend({blob:i}),be=I({audience:A(s).optional(),priority:J().min(0).max(1).optional(),lastModified:dt.datetime({offset:!0}).optional()}),Oe=I({...g.shape,...m.shape,uri:d(),description:re(d()),mimeType:re(d()),size:re(J()),annotations:be.optional(),_meta:re(ce({}))}),fe=I({...g.shape,...m.shape,uriTemplate:d(),description:re(d()),mimeType:re(d()),annotations:be.optional(),_meta:re(ce({}))}),l=v.extend({method:j("notifications/resources/list_changed"),params:P.optional()}),h=P.extend({uri:d()}),k=v.extend({method:j("notifications/resources/updated"),params:h}),p=I({name:d(),description:re(d()),required:re(Q())}),T=I({...g.shape,...m.shape,description:re(d()),arguments:re(A(p)),_meta:re(ce({}))}),x=v.extend({method:j("notifications/prompts/list_changed"),params:P.optional()}),F=I({type:j("text"),text:d(),annotations:be.optional(),_meta:Y(d(),se()).optional()}),K=I({type:j("image"),data:i,mimeType:d(),annotations:be.optional(),_meta:Y(d(),se()).optional()}),X=I({type:j("audio"),data:i,mimeType:d(),annotations:be.optional(),_meta:Y(d(),se()).optional()}),te=I({type:j("tool_use"),name:d(),id:d(),input:Y(d(),se()),_meta:Y(d(),se()).optional()}),le=I({type:j("resource"),resource:W([he,we]),annotations:be.optional(),_meta:Y(d(),se()).optional()}),oe=Oe.extend({type:j("resource_link")}),C=W([F,K,X,oe,le]),M=I({role:s,content:C}),U=I({title:d().optional(),readOnlyHint:Q().optional(),destructiveHint:Q().optional(),idempotentHint:Q().optional(),openWorldHint:Q().optional()}),ee=v.extend({method:j("notifications/tools/list_changed"),params:P.optional()}),ie=I({name:d().optional()}),ue=I({hints:A(ie).optional(),costPriority:J().min(0).max(1).optional(),speedPriority:J().min(0).max(1).optional(),intelligencePriority:J().min(0).max(1).optional()}),Te=I({mode:de(["auto","required","none"]).optional()}),Ne=I({type:j("boolean"),title:d().optional(),description:d().optional(),default:Q().optional()}),qe=I({type:j("string"),title:d().optional(),description:d().optional(),minLength:J().optional(),maxLength:J().optional(),format:de(["email","uri","date","date-time"]).optional(),default:d().optional()}),Ce=I({type:de(["number","integer"]),title:d().optional(),description:d().optional(),minimum:J().optional(),maximum:J().optional(),default:J().optional()}),$e=I({type:j("string"),title:d().optional(),description:d().optional(),enum:A(d()),default:d().optional()}),Ue=I({type:j("string"),title:d().optional(),description:d().optional(),oneOf:A(I({const:d(),title:d()})),default:d().optional()}),xe=I({type:j("string"),title:d().optional(),description:d().optional(),enum:A(d()),enumNames:A(d()).optional(),default:d().optional()}),nt=W([$e,Ue]),Ge=I({type:j("array"),title:d().optional(),description:d().optional(),minItems:J().optional(),maxItems:J().optional(),items:I({type:j("string"),enum:A(d())}),default:A(d()).optional()}),Fe=I({type:j("array"),title:d().optional(),description:d().optional(),minItems:J().optional(),maxItems:J().optional(),items:I({anyOf:A(I({const:d(),title:d()}))}),default:A(d()).optional()}),Rt=W([Ge,Fe]),zt=W([xe,nt,Rt]),Zt=W([zt,Ne,qe,Ce]),Vt=E.extend({mode:j("form").optional(),message:d(),requestedSchema:I({type:j("object"),properties:Y(d(),Zt),required:A(d()).optional()}).catchall(se())}),Jt=I({type:j("ref/resource"),uri:d()}),Ht=I({type:j("ref/prompt"),name:d()}),Gr=I({uri:d().startsWith("file://"),name:d().optional(),_meta:Y(d(),se()).optional()}),wt=y.shape,Qr=I({experimental:wt.experimental,sampling:wt.sampling,elicitation:wt.elicitation,roots:wt.roots,extensions:wt.extensions}),ot=N.shape,ur=I({experimental:ot.experimental,logging:ot.logging,completions:ot.completions,prompts:ot.prompts,resources:ot.resources,tools:ot.tools,extensions:ot.extensions}),lr=ce({progressToken:r.optional(),[Or]:d(),[Un]:z.optional(),[It]:Qr,[nr]:a.optional()}),Kt=I({...g.shape,...m.shape,description:d().optional(),inputSchema:ce({$schema:d().optional(),type:j("object")}),outputSchema:ce({$schema:d().optional()}).optional(),annotations:U.optional(),_meta:Y(d(),se()).optional()}),Wr=I({type:j("tool_result"),toolUseId:d(),content:A(C),structuredContent:se().optional(),isError:Q().optional(),_meta:Y(d(),se()).optional()}),dr=W([F,K,X,te,Wr]),Bt=I({role:s,content:W([dr,A(dr)]),_meta:Y(d(),se()).optional()}),mr=d(),pr=ce({[xt]:z.optional().catch(void 0)}),hr=pr.optional();function Ve(Me){return ce({_meta:hr,resultType:mr.default("complete"),...Me})}let Xr=Ve({}),wo=Ve({nextCursor:n.optional()}),fr=Ve({content:A(C),structuredContent:se().optional(),isError:Q().optional()}),en=Ve({ttlMs:J().int().min(0),cacheScope:de(["public","private"]),tools:A(Kt),nextCursor:n.optional()}),tn=Ve({ttlMs:J().int().min(0),cacheScope:de(["public","private"]),prompts:A(T),nextCursor:n.optional()}),rn=Ve({description:d().optional(),messages:A(M)}),nn=Ve({ttlMs:J().int().min(0),cacheScope:de(["public","private"]),resources:A(Oe),nextCursor:n.optional()}),on=Ve({ttlMs:J().int().min(0),cacheScope:de(["public","private"]),resourceTemplates:A(fe),nextCursor:n.optional()}),sn=Ve({ttlMs:J().int().min(0),cacheScope:de(["public","private"]),contents:A(W([he,we]))}),an=Ve({completion:I({values:A(d()).max(100),total:J().int().optional(),hasMore:Q().optional()}).loose()}),$o=Ve({ttlMs:J().int().min(0),cacheScope:de(["public","private"])}),cn=Ve({ttlMs:J().int().min(0).catch(0),cacheScope:de(["public","private"]).catch("private"),supportedVersions:A(d()),capabilities:ur,instructions:d().optional()}),$t=I({messages:A(Bt),modelPreferences:ue.optional(),systemPrompt:d().optional(),includeContext:de(["none","thisServer","allServers"]).optional(),temperature:J().optional(),maxTokens:J().int(),stopSequences:A(d()).optional(),metadata:t.optional(),tools:A(Kt).optional(),toolChoice:Te.optional()}),un=I({method:j("sampling/createMessage"),params:$t}),ln=I({method:j("roots/list"),params:I({_meta:Y(d(),se()).optional()}).optional()}),dn=I({...Bt.shape,model:d(),stopReason:d().optional()}),mn=I({roots:A(Gr)}),pn=I({action:de(["accept","decline","cancel"]),content:Y(d(),W([d(),J(),Q(),A(d())])).optional()}),hn=I({mode:j("url"),message:d(),url:d().url()}),fn=W([Vt,hn]),gn=I({method:j("elicitation/create"),params:fn}),_n=W([un,ln,gn]),Sn=W([dn,mn,pn]),yn=Y(d(),_n),vn=Y(d(),Sn),Yt=Ve({inputRequests:yn.optional(),requestState:d().optional()}),Gt={inputResponses:vn.optional(),requestState:d().optional()},Eo=I({_meta:lr,...Gt}),To=ce({progressToken:r.optional()});function et(Me,Wt){return I({method:j(Me),params:I({_meta:lr,...Wt})})}function tt(Me,Wt){return I({method:j(Me),params:I({_meta:To.optional(),...Wt}).optional()})}let bn={name:d(),arguments:Y(d(),se()).optional(),...Gt},at={cursor:n.optional()},Po=et("tools/call",bn),ko=et("tools/list",at),Oo=et("prompts/list",at),Co=et("prompts/get",{name:d(),arguments:Y(d(),d()).optional(),...Gt}),No=et("resources/list",at),xo=et("resources/templates/list",at),Io=et("resources/read",{uri:d(),...Gt}),Rn={ref:W([Ht,Jt]),argument:I({name:d(),value:d()}),context:I({arguments:Y(d(),d()).optional()}).optional()},Ao=et("completion/complete",Rn),jo=et("server/discover",{}),gr=I({toolsListChanged:Q().optional(),promptsListChanged:Q().optional(),resourcesListChanged:Q().optional(),resourceSubscriptions:A(d()).optional()}),zn={notifications:gr},Mo=et("subscriptions/listen",zn),qo=pr.extend({"io.modelcontextprotocol/subscriptionId":o}),Lo=ce({_meta:qo,resultType:mr.default("complete")}),Et={"tools/call":tt("tools/call",bn),"tools/list":tt("tools/list",at),"prompts/get":tt("prompts/get",{name:d(),arguments:Y(d(),d()).optional()}),"prompts/list":tt("prompts/list",at),"resources/list":tt("resources/list",at),"resources/templates/list":tt("resources/templates/list",at),"resources/read":tt("resources/read",{uri:d()}),"completion/complete":tt("completion/complete",Rn),"server/discover":tt("server/discover",{}),"subscriptions/listen":tt("subscriptions/listen",zn)};function Qe(Me){return ce({_meta:hr,...Me})}let Do={"tools/call":Qe({content:A(C),structuredContent:se().optional(),isError:Q().optional()}),"tools/list":Qe({ttlMs:J().int().min(0),cacheScope:de(["public","private"]),tools:A(Kt),nextCursor:n.optional()}),"prompts/get":Qe({description:d().optional(),messages:A(M)}),"prompts/list":Qe({ttlMs:J().int().min(0),cacheScope:de(["public","private"]),prompts:A(T),nextCursor:n.optional()}),"resources/list":Qe({ttlMs:J().int().min(0),cacheScope:de(["public","private"]),resources:A(Oe),nextCursor:n.optional()}),"resources/templates/list":Qe({ttlMs:J().int().min(0),cacheScope:de(["public","private"]),resourceTemplates:A(fe),nextCursor:n.optional()}),"resources/read":Qe({ttlMs:J().int().min(0),cacheScope:de(["public","private"]),contents:A(W([he,we]))}),"completion/complete":Qe({completion:I({values:A(d()).max(100),total:J().int().optional(),hasMore:Q().optional()}).loose()}),"server/discover":Qe({ttlMs:J().int().min(0).catch(0),cacheScope:de(["public","private"]).catch("private"),supportedVersions:A(d()),capabilities:ur,instructions:d().optional()}),"subscriptions/listen":Qe({})},Qt=ce({"io.modelcontextprotocol/subscriptionId":o.optional()}),_r=I({method:j("notifications/subscriptions/acknowledged"),params:I({_meta:Qt.optional(),notifications:gr})}),Sr=I({_meta:Qt.optional(),requestId:o,reason:d().optional()}),yr=I({method:j("notifications/cancelled"),params:Sr}),fa={"notifications/cancelled":yr,"notifications/progress":D,"notifications/message":G,"notifications/resources/updated":k,"notifications/resources/list_changed":l,"notifications/tools/list_changed":ee,"notifications/prompts/list_changed":x,"notifications/subscriptions/acknowledged":_r},We=(Me)=>I({jsonrpc:j("2.0"),id:W([d(),J().int()]),result:Me}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:n,RequestIdSchema:o,RoleSchema:s,LoggingLevelSchema:a,TaskMetadataSchema:c,RelatedTaskMetadataSchema:u,RequestMetaSchema:f,BaseRequestParamsSchema:_,TaskAugmentedRequestParamsSchema:E,NotificationsParamsSchema:P,NotificationSchema:v,IconSchema:w,IconsSchema:m,BaseMetadataSchema:g,ImplementationSchema:z,ClientTasksCapabilitySchema:O,ServerTasksCapabilitySchema:R,ClientCapabilitiesSchema:y,ServerCapabilitiesSchema:N,ProgressSchema:q,ProgressNotificationParamsSchema:H,ProgressNotificationSchema:D,LoggingMessageNotificationParamsSchema:Z,LoggingMessageNotificationSchema:G,ResourceContentsSchema:B,TextResourceContentsSchema:he,BlobResourceContentsSchema:we,AnnotationsSchema:be,ResourceSchema:Oe,ResourceTemplateSchema:fe,ResourceListChangedNotificationSchema:l,ResourceUpdatedNotificationParamsSchema:h,ResourceUpdatedNotificationSchema:k,PromptArgumentSchema:p,PromptSchema:T,PromptListChangedNotificationSchema:x,TextContentSchema:F,ImageContentSchema:K,AudioContentSchema:X,ToolUseContentSchema:te,EmbeddedResourceSchema:le,ResourceLinkSchema:oe,ContentBlockSchema:C,PromptMessageSchema:M,ToolAnnotationsSchema:U,ToolListChangedNotificationSchema:ee,ModelHintSchema:ie,ModelPreferencesSchema:ue,ToolChoiceSchema:Te,BooleanSchemaSchema:Ne,StringSchemaSchema:qe,NumberSchemaSchema:Ce,UntitledSingleSelectEnumSchemaSchema:$e,TitledSingleSelectEnumSchemaSchema:Ue,LegacyTitledEnumSchemaSchema:xe,SingleSelectEnumSchemaSchema:nt,UntitledMultiSelectEnumSchemaSchema:Ge,TitledMultiSelectEnumSchemaSchema:Fe,MultiSelectEnumSchemaSchema:Rt,EnumSchemaSchema:zt,PrimitiveSchemaDefinitionSchema:Zt,ElicitRequestFormParamsSchema:Vt,ResourceTemplateReferenceSchema:Jt,PromptReferenceSchema:Ht,RootSchema:Gr,ClientCapabilities2026Schema:Qr,ServerCapabilities2026Schema:ur,RequestMetaEnvelopeSchema:lr,ToolSchema:Kt,ToolResultContentSchema:Wr,SamplingMessageContentBlockSchema:dr,SamplingMessageSchema:Bt,ResultTypeSchema:mr,ResultMetaSchema:pr,ResultSchema:Xr,PaginatedResultSchema:wo,CallToolResultSchema:fr,ListToolsResultSchema:en,ListPromptsResultSchema:tn,GetPromptResultSchema:rn,ListResourcesResultSchema:nn,ListResourceTemplatesResultSchema:on,ReadResourceResultSchema:sn,CompleteResultSchema:an,CacheableResultSchema:$o,DiscoverResultSchema:cn,CreateMessageRequestParamsSchema:$t,CreateMessageRequestSchema:un,ListRootsRequestSchema:ln,CreateMessageResultSchema:dn,ListRootsResultSchema:mn,ElicitResultSchema:pn,ElicitRequestURLParamsSchema:hn,ElicitRequestParamsSchema:fn,ElicitRequestSchema:gn,InputRequestSchema:_n,InputResponseSchema:Sn,InputRequestsSchema:yn,InputResponsesSchema:vn,InputRequiredResultSchema:Yt,InputResponseRequestParamsSchema:Eo,CallToolRequestSchema:Po,ListToolsRequestSchema:ko,ListPromptsRequestSchema:Oo,GetPromptRequestSchema:Co,ListResourcesRequestSchema:No,ListResourceTemplatesRequestSchema:xo,ReadResourceRequestSchema:Io,CompleteRequestSchema:Ao,DiscoverRequestSchema:jo,SubscriptionFilterSchema:gr,SubscriptionsListenRequestSchema:Mo,SubscriptionsListenResultMetaSchema:qo,SubscriptionsListenResultSchema:Lo,dispatchRequestSchemas:Et,dispatchResultSchemas:Do,NotificationMetaSchema:Qt,SubscriptionsAcknowledgedNotificationSchema:_r,CancelledNotificationParamsSchema:Sr,CancelledNotificationSchema:yr,notificationSchemas2026:fa,JSONRPCResultResponseSchema:We(Xr),CallToolResultResponseSchema:We(W([fr,Yt])),ListToolsResultResponseSchema:We(en),ListPromptsResultResponseSchema:We(tn),GetPromptResultResponseSchema:We(W([rn,Yt])),ListResourcesResultResponseSchema:We(nn),ListResourceTemplatesResultResponseSchema:We(on),ReadResourceResultResponseSchema:We(W([sn,Yt])),CompleteResultResponseSchema:We(an),DiscoverResultResponseSchema:We(cn)}}var AS;function sr(){return AS??=IS()}var jS=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function MS(e){return jS.includes(e)}var Zr=Symbol("modelcontextprotocol.resultCacheHintFallback");function Ih(e,t){if(t===void 0)return e;let r=e[Zr];if(r===void 0)return{...e,[Zr]:t};let n={},o=r.ttlMs??t.ttlMs;if(o!==void 0)n.ttlMs=o;let s=r.cacheScope??t.cacheScope;if(s!==void 0)n.cacheScope=s;return{...e,[Zr]:n}}function qS(e){return e[Zr]}function ku(e){return typeof e==="number"&&Number.isSafeInteger(e)&&e>=0}function Ou(e){return e==="public"||e==="private"}function Ah(e,t){if(e.ttlMs!==void 0&&!ku(e.ttlMs))throw RangeError(`Invalid cache hint for ${t}: ttlMs must be a non-negative safe integer (got ${String(e.ttlMs)})`);if(e.cacheScope!==void 0&&!Ou(e.cacheScope))throw RangeError(`Invalid cache hint for ${t}: cacheScope must be 'public' or 'private' (got ${String(e.cacheScope)})`)}var ne=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}({}),_e=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return Vr(this,t)}static isInstance(t){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 Vr(this,t)}constructor(t,r,n){super(r);this.code=t,this.data=n,this.name="ProtocolError",zu(this,new.target)}static fromError(t,r,n){if(t===ne.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new LS(o.elicitations,r)}if(t===ne.UnsupportedProtocolVersion&&n){let o=n;if(Array.isArray(o.supported)&&typeof o.requested==="string")return new Mh({supported:o.supported,requested:o.requested},r)}if(t===ne.InvalidParams||t===ne.ResourceNotFound){let o=n;if(typeof o?.uri==="string"&&(t===ne.ResourceNotFound||Object.keys(o).length===1))return new jh(o.uri,r)}if(t===ne.MissingRequiredClientCapability&&n){let o=n;if(o.requiredCapabilities!==null&&typeof o.requiredCapabilities==="object"&&!Array.isArray(o.requiredCapabilities))return new Cu({requiredCapabilities:o.requiredCapabilities},r)}return new e(t,r,n)}},jh=class extends _e{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(ne.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},LS=class extends _e{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(ne.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Mh=class extends _e{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(ne.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Cu=class extends _e{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(ne.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},DS=0,US="private",FS=["tools/call","prompts/get","resources/read"];function ZS(e,t){let r=t.resultType;if(r===void 0)return{...t,resultType:"complete"};if(r==="complete")return t;if(FS.includes(e))return t;throw new _e(ne.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function VS(e,t){let r=qS(t);if(t.resultType!=="complete"||!MS(e))return r===void 0?t:YS(t);let n=t,o=ku(n.ttlMs)?n.ttlMs:KS(r),s=Ou(n.cacheScope)?n.cacheScope:BS(r),a={...n,ttlMs:o,cacheScope:s};return delete a[Zr],a}function JS(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function HS(e,t){if(t===void 0)return e;let r=e._meta;if(r===void 0)return{...e,_meta:{[xt]:t}};if(!JS(r))return e;if(r[xt]!==void 0)return e;return{...e,_meta:{...r,[xt]:t}}}function KS(e){return e!==void 0&&ku(e.ttlMs)?e.ttlMs:DS}function BS(e){return e!==void 0&&Ou(e.cacheScope)?e.cacheScope:US}function YS(e){let t={...e};return delete t[Zr],t}var GS=["elicitation/create","sampling/createMessage","roots/list"],ea;function qh(){if(ea)return ea;let e=sr();return ea={request:{"elicitation/create":I({method:j("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":I({method:j("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":I({method:j("roots/list"),params:ce({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},ea}function Lh(e){return GS.includes(e)}function hu(e){return Lh(e)?qh().request[e]:void 0}function QS(e){return Lh(e)?qh().response[e]:void 0}var Nu={"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},Dh={"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 Uh(e){return Object.prototype.hasOwnProperty.call(Nu,e)}function Fh(e){return Object.prototype.hasOwnProperty.call(Dh,e)}function WS(e){return Object.prototype.hasOwnProperty.call(Nu,e)}function XS(e){return Uh(e)?sr().dispatchRequestSchemas[e]:void 0}function ey(e){return WS(e)?sr().dispatchResultSchemas[e]:void 0}function ty(e){return Fh(e)?sr().notificationSchemas2026[e]:void 0}var Z0=Object.keys(Nu),V0=Object.keys(Dh);function go(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function ho(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var ry={ok:!1,reason:"not-in-era"},ny=[Or,It];function oy(e,t){let r=t,n=!1,o=()=>{if(!n)r={...r},n=!0;return r},s=t.tools;if(e==="tools/list"&&Array.isArray(s)&&s.some((i)=>go(i)&&("execution"in i)))o().tools=s.map((i)=>{if(!go(i)||!("execution"in i))return i;let c={...i};return delete c.execution,c});let a=t.capabilities;if(go(a)&&"tasks"in a){let i={...a};delete i.tasks,o().capabilities=i}return r}var xu={era:"2026-07-28",hasRequestMethod:Uh,hasNotificationMethod:Fh,hasInputRequestMethod:(e)=>hu(e)!==void 0,validateRequest:(e,t)=>ho(XS(e),t),validateResult:(e,t)=>ho(ey(e),t),validateNotification:(e,t)=>ho(ty(e),t),validateInputRequest:(e,t)=>ho(hu(e),t),validateInputResponse:(e,t)=>ho(QS(e),t),samplingResultVariant:()=>ry,outboundEnvelope(e){return{[Or]:e.protocolVersion,[Un]:e.clientInfo,[It]:e.clientCapabilities,...e.logLevel!==void 0&&{[nr]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of ny)if(!(n in e))t.push({key:n,problem:"missing"});let r=sr().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let n of r.error.issues){let o=n.path.map(String),s=o.length>0?o.join("."):"_meta";if(o.length===1&&t.some((a)=>a.key===s&&a.problem==="missing"))continue;t.push({key:s,problem:n.message})}return t},projectCallToolResult:(e)=>Eh(e),inputRequestSchema:hu,decodeResult(e,t){if(!go(t))return{kind:"invalid",error:new pe(ge.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(r===void 0)return{kind:"invalid",error:new pe(ge.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 r!=="string")return{kind:"invalid",error:new pe(ge.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if(r==="input_required"){let a=t.inputRequests,i=go(a)?a:{},c=t.requestState;if(Object.keys(i).length===0&&typeof c!=="string")return{kind:"invalid",error:new pe(ge.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"})};return{kind:"input_required",inputRequests:i,...typeof c==="string"&&{requestState:c}}}if(r!=="complete")return{kind:"invalid",error:new pe(ge.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let n=sy(),o=Object.hasOwn(n,e)?n[e]:void 0;if(o!==void 0){let a=o.safeParse(t);if(!a.success)return{kind:"invalid",error:new pe(ge.InvalidResult,`Invalid result for ${e}: ${a.error}`,{method:e})}}let s={...t};return delete s.resultType,{kind:"complete",result:s}},encodeResult(e,t,r){return HS(VS(e,ZS(e,oy(e,t))),r)},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=sr().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map((r)=>r.message).join("; ")}`}},ta;function sy(){if(ta)return ta;let e=sr();return ta={"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},ta}var Iu="2026-07-28";function Jr(e){return e!==void 0&&yo(e)?xu:Pu}function Sh(e){if(e.revision!==void 0)return Jr(e.revision).era;return e.era==="modern"?xu.era:Pu.era}function fu(e){return Zh.some((t)=>t.hasRequestMethod(e))}function gu(e){return Zh.some((t)=>t.hasNotificationMethod(e))}var Zh=[Pu,xu];var iy=cl({AnnotationsSchema:()=>vt,AudioContentSchema:()=>qr,BaseMetadataSchema:()=>yt,BaseRequestParamsSchema:()=>De,BlobResourceContentsSchema:()=>to,BooleanSchemaSchema:()=>io,CallToolRequestParamsSchema:()=>di,CallToolRequestSchema:()=>mi,CallToolResultSchema:()=>so,CancelTaskRequestSchema:()=>Wc,CancelTaskResultSchema:()=>Xc,CancelledNotificationParamsSchema:()=>hs,CancelledNotificationSchema:()=>Yn,ClientCapabilitiesSchema:()=>Ss,ClientNotificationSchema:()=>tu,ClientRequestSchema:()=>eu,ClientResultSchema:()=>ru,ClientTasksCapabilitySchema:()=>gs,CompatibilityCallToolResultSchema:()=>Uc,CompleteRequestParamsSchema:()=>Li,CompleteRequestSchema:()=>Di,CompleteResultSchema:()=>Ui,ContentBlockSchema:()=>Lr,CreateMessageRequestParamsSchema:()=>wi,CreateMessageRequestSchema:()=>$i,CreateMessageResultSchema:()=>Ei,CreateMessageResultWithToolsSchema:()=>Ti,CreateTaskResultSchema:()=>Vc,CursorSchema:()=>Zn,DiscoverRequestSchema:()=>zs,DiscoverResultSchema:()=>ws,ElicitRequestFormParamsSchema:()=>Fr,ElicitRequestParamsSchema:()=>Ni,ElicitRequestSchema:()=>xi,ElicitRequestURLParamsSchema:()=>Ci,ElicitResultSchema:()=>ji,ElicitationCompleteNotificationParamsSchema:()=>Ii,ElicitationCompleteNotificationSchema:()=>Ai,EmbeddedResourceSchema:()=>ri,EmptyResultSchema:()=>Bn,EnumSchemaSchema:()=>Oi,GetPromptRequestParamsSchema:()=>Xs,GetPromptRequestSchema:()=>ei,GetPromptResultSchema:()=>si,GetTaskPayloadRequestSchema:()=>Bc,GetTaskPayloadResultSchema:()=>Yc,GetTaskRequestSchema:()=>Hc,GetTaskResultSchema:()=>Kc,IconSchema:()=>fs,IconsSchema:()=>jt,ImageContentSchema:()=>Mr,ImplementationSchema:()=>Ir,InitializeRequestParamsSchema:()=>ys,InitializeRequestSchema:()=>vs,InitializeResultSchema:()=>bs,InitializedNotificationSchema:()=>Rs,JSONArraySchema:()=>qc,JSONObjectSchema:()=>Ie,JSONRPCErrorResponseSchema:()=>xr,JSONRPCMessageSchema:()=>ps,JSONRPCNotificationSchema:()=>Kn,JSONRPCRequestSchema:()=>Hn,JSONRPCResponseSchema:()=>Lc,JSONRPCResultResponseSchema:()=>Nr,JSONValueSchema:()=>Nt,LegacyTitledEnumSchemaSchema:()=>uo,ListChangedOptionsBaseSchema:()=>Fc,ListPromptsRequestSchema:()=>Qs,ListPromptsResultSchema:()=>Ws,ListResourceTemplatesRequestSchema:()=>Cs,ListResourceTemplatesResultSchema:()=>Ns,ListResourcesRequestSchema:()=>ks,ListResourcesResultSchema:()=>Os,ListRootsRequestSchema:()=>Zi,ListRootsResultSchema:()=>Vi,ListTasksRequestSchema:()=>Gc,ListTasksResultSchema:()=>Qc,ListToolsRequestSchema:()=>ui,ListToolsResultSchema:()=>li,LoggingLevelSchema:()=>Dt,LoggingMessageNotificationParamsSchema:()=>gi,LoggingMessageNotificationSchema:()=>_i,ModelHintSchema:()=>Si,ModelPreferencesSchema:()=>yi,MultiSelectEnumSchemaSchema:()=>ki,NotificationSchema:()=>Ke,NotificationsParamsSchema:()=>He,NumberSchemaSchema:()=>Ur,PaginatedRequestParamsSchema:()=>Ts,PaginatedRequestSchema:()=>Mt,PaginatedResultSchema:()=>qt,PingRequestSchema:()=>Qn,PrimitiveSchemaDefinitionSchema:()=>po,ProgressNotificationParamsSchema:()=>Es,ProgressNotificationSchema:()=>Wn,ProgressSchema:()=>$s,ProgressTokenSchema:()=>Fn,PromptArgumentSchema:()=>Ys,PromptListChangedNotificationSchema:()=>ii,PromptMessageSchema:()=>oi,PromptReferenceSchema:()=>qi,PromptSchema:()=>Gs,ReadResourceRequestParamsSchema:()=>xs,ReadResourceRequestSchema:()=>Is,ReadResourceResultSchema:()=>As,RelatedTaskMetadataSchema:()=>ms,RequestIdSchema:()=>At,RequestMetaSchema:()=>Vn,RequestSchema:()=>Ae,ResourceContentsSchema:()=>Xn,ResourceLinkSchema:()=>ni,ResourceListChangedNotificationSchema:()=>js,ResourceRequestParamsSchema:()=>Ar,ResourceSchema:()=>ro,ResourceTemplateReferenceSchema:()=>Mi,ResourceTemplateSchema:()=>Ps,ResourceUpdatedNotificationParamsSchema:()=>Ks,ResourceUpdatedNotificationSchema:()=>Bs,ResultMetaObjectSchema:()=>Jn,ResultSchema:()=>je,RoleSchema:()=>Lt,RootSchema:()=>Fi,RootsListChangedNotificationSchema:()=>Ji,SamplingContentSchema:()=>Ri,SamplingMessageContentBlockSchema:()=>rr,SamplingMessageSchema:()=>zi,ServerCapabilitiesSchema:()=>Gn,ServerNotificationSchema:()=>ou,ServerRequestSchema:()=>nu,ServerResultSchema:()=>su,ServerTasksCapabilitySchema:()=>_s,SetLevelRequestParamsSchema:()=>hi,SetLevelRequestSchema:()=>fi,SingleSelectEnumSchemaSchema:()=>Pi,StringSchemaSchema:()=>Dr,SubscribeRequestParamsSchema:()=>Ms,SubscribeRequestSchema:()=>qs,SubscriptionFilterSchema:()=>no,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Zs,SubscriptionsAcknowledgedNotificationSchema:()=>Vs,SubscriptionsListenRequestParamsSchema:()=>Us,SubscriptionsListenRequestSchema:()=>Fs,SubscriptionsListenResultMetaSchema:()=>Js,SubscriptionsListenResultSchema:()=>Hs,TaskAugmentedRequestParamsSchema:()=>or,TaskCreationParamsSchema:()=>Zc,TaskMetadataSchema:()=>ds,TaskSchema:()=>Ut,TaskStatusNotificationParamsSchema:()=>Ki,TaskStatusNotificationSchema:()=>Jc,TaskStatusSchema:()=>Hi,TextContentSchema:()=>jr,TextResourceContentsSchema:()=>eo,TitledMultiSelectEnumSchemaSchema:()=>mo,TitledSingleSelectEnumSchemaSchema:()=>co,ToolAnnotationsSchema:()=>ai,ToolChoiceSchema:()=>vi,ToolExecutionSchema:()=>ci,ToolListChangedNotificationSchema:()=>pi,ToolResultContentSchema:()=>bi,ToolSchema:()=>oo,ToolUseContentSchema:()=>ti,UnsubscribeRequestParamsSchema:()=>Ls,UnsubscribeRequestSchema:()=>Ds,UntitledMultiSelectEnumSchemaSchema:()=>lo,UntitledSingleSelectEnumSchemaSchema:()=>ao});var Vh=(e)=>Hn.safeParse(e).success,Jh=(e)=>Kn.safeParse(e).success,yu=(e)=>Nr.safeParse(e).success,Hh=(e)=>xr.safeParse(e).success;var Hr=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";var ra=-32020,J0=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[ne.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[ra,ne.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[ne.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope — and a missing envelope on a request whose protocol-version header names a modern revision — is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[ne.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision’s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[ne.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[ra],conformance:["http-header-validation"],rationale:"SEP-2243 standard `Mcp-Method` / `Mcp-Name` headers — presence, sentinel decoding, and `Mcp-Name` ↔ body cross-check — are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The classifier’s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5–6) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[ne.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced — pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[ra],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool’s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],H0={[ne.ParseError]:400,[ne.InvalidRequest]:400,[ne.MethodNotFound]:404,[ne.UnsupportedProtocolVersion]:400,[ne.MissingRequiredClientCapability]:400,[ra]:400};function oa(e,t){return ss(e,t)}function fo(e){return new Set(e.flatMap((t)=>Object.keys(t.shape)))}function vu(e){if(e==null)return!1;let t=typeof e;if(t!=="object"&&t!=="function")return!1;if(!("~standard"in e))return!1;return typeof e["~standard"]?.validate==="function"}var yh=!1,bu="draft-2020-12";function Kh(e,t="input"){let r=e["~standard"],n;if(r.jsonSchema)n=r.jsonSchema[t]({target:bu});else if(r.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().");if(!yh)yh=!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.");n=os(e,{target:bu,io:t})}else throw Error(`Schema library "${r.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output"){if(n.type!==void 0)return n;return Bh(n)?{type:"object",...n}:n}if(n.type!==void 0&&n.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(n.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...n}}function Bh(e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;for(let t of["oneOf","anyOf","allOf"]){let r=e[t];if(Array.isArray(r)&&r.length>0)return r.every((n)=>n!==null&&typeof n==="object"&&(n.type==="object"||Bh(n)))}return!1}function ay(e){if(!e.path?.length)return e.message;return`${e.path.map((t)=>String(typeof t==="object"?t.key:t)).join(".")}: ${e.message}`}async function na(e,t){let r=await e["~standard"].validate(t);if(r.issues&&r.issues.length>0)return{success:!1,error:r.issues.map((n)=>ay(n)).join(", ")};return{success:!0,data:r.value}}function cy(e){let t=os(e,{target:bu,io:"input"});return typeof t.pattern==="string"?t.pattern:void 0}var uy=/\\\.\\d\{(\d+)\}/;function ly(e){let t=uy.exec(e),r=[void 0,-1,0];if(t)r.push(Number(t[1]));return[!1,!0].flatMap((n)=>[!1,!0].flatMap((o)=>r.map((s)=>dt.datetime({local:n,offset:o,precision:s}))))}function dy(e,t){let r;switch(e){case"email":r=[eh()];break;case"uri":r=[as()];break;case"date":r=[dt.date()];break;case"date-time":r=ly(t);break}return new Set(r.map((n)=>cy(n)).filter((n)=>n!==void 0))}function my(e,t,r){if(r!=="zod")return!0;return dy(e,t).has(t)}function So(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function py(e){try{return Kh(e,"input")}catch(t){let r=t instanceof Error?t.message:String(t);throw new _e(ne.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${r}`)}}var hy=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function Au(e){return hy.has(e)||e.startsWith("x-")}var fy=new Set(["$schema",...Object.keys(Fr.shape.requestedSchema.shape)]),vh={string:fo([Dr,ao,co,uo]),number:fo([Ur]),integer:fo([Ur]),boolean:fo([io]),array:fo([lo,mo])},gy=new Set(Dr.shape.format.unwrap().options);function _y(e,t,r,n){if(!So(e))return e;let o=typeof e.type==="string"&&Object.hasOwn(vh,e.type)?vh[e.type]:void 0;if(o===void 0)return e;let s={};for(let[a,i]of Object.entries(e))if(o.has(a)||Au(a))s[a]=i;else if(a==="pattern"&&e.type==="string"&&typeof e.format==="string"){if(!gy.has(e.format))s[a]=i;else if(typeof i!=="string"||!my(e.format,i,r))n.push(`${t}.${a}`)}else n.push(`${t}.${a}`);return s}function Sy(e,t){let r={},n=[];for(let[o,s]of Object.entries(e))if(o==="properties"&&So(s))r[o]=Object.fromEntries(Object.entries(s).map(([a,i])=>[a,_y(i,`properties.${a}`,t,n)]));else if(fy.has(o))r[o]=s;else if(!Au(o))n.push(o);if(n.length>0)throw new _e(ne.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);return r}function yy(e,t){if(!So(e.properties))return t;let r=Object.entries(e.properties).filter(([,n])=>!oa(po,n).success).map(([n])=>`properties.${n}`);return r.length>0?r.join(", "):t}function Ru(e,t,r=""){if(Array.isArray(e)&&Array.isArray(t))return e.flatMap((n,o)=>Ru(n,t[o],`${r}[${o}]`));if(!So(e)||!So(t))return[];return Object.entries(e).flatMap(([n,o])=>{let s=r?`${r}.${n}`:n;if(!Object.prototype.hasOwnProperty.call(t,n))return Au(n)?[]:[s];return Ru(o,t[n],s)})}function vy(e){if(!vu(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,r=Sy(py(e.requestedSchema),t),n=oa(Fr.shape.requestedSchema,r);if(!n.success)throw new _e(ne.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${yy(r,n.error.message)}`);let o=Ru(r,n.data);if(o.length>0)throw new _e(ne.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);let s=(n.data.required??[]).filter((a)=>!Object.prototype.hasOwnProperty.call(n.data.properties,a));if(s.length>0)throw new _e(ne.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...e,mode:"form",requestedSchema:n.data}}function by(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,r=typeof e.requestState==="string";if(!t&&!r)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}}}var K0=Object.assign(by,{elicit(e){try{return{method:"elicitation/create",params:vy(e)}}catch(t){throw t instanceof _e?TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});var Yh=250;function Gh(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function Qh(e,t){return new Promise((r,n)=>{if(t?.aborted){n(t.reason instanceof pe?t.reason:new pe(ge.RequestTimeout,String(t.reason)));return}let o=setTimeout(()=>{t?.removeEventListener("abort",s),r()},e),s=()=>{clearTimeout(o),n(t?.reason instanceof pe?t.reason:new pe(ge.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",s,{once:!0})})}function Wh(e){let t=new AbortController,r=()=>t.abort(e?.reason);if(e?.addEventListener("abort",r,{once:!0}),e?.aborted)t.abort(e.reason);return{signal:t.signal,abort:(n)=>t.abort(n),dispose:()=>e?.removeEventListener("abort",r)}}var Ry=["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"],zy={IdJagTokenExchangeResponseSchema:uu,OAuthClientInformationFullSchema:du,OAuthClientInformationSchema:Qi,OAuthClientMetadataSchema:Gi,OAuthClientRegistrationErrorSchema:mu,OAuthErrorResponseSchema:lu,OAuthMetadataSchema:Bi,OAuthProtectedResourceMetadataSchema:iu,OAuthTokenRevocationRequestSchema:pu,OAuthTokensSchema:cu,OpenIdProviderDiscoveryMetadataSchema:au,OpenIdProviderMetadataSchema:Yi},Xh={},ef={};function tf(e,t){let r=e.slice(0,-6);Xh[r]=t,ef[r]=(n)=>t.safeParse(n).success}for(let e of Ry)tf(e,iy[e]);for(let[e,t]of Object.entries(zy))tf(e,t);var B0=Object.freeze(Xh),Y0=Object.freeze(ef);function wy(e){switch(e){case"initialize":case"notifications/initialized":return Jr(void 0);case"server/discover":return Jr(Iu);default:return}}var $y=60000,Ey=[Or,Un,It,nr],Ty=["inputResponses","requestState"];function bh(e,t){let r=e.params;if(!_o(r))return{message:e,lifted:{}};let n=r._meta,o=_o(n)?Ey.filter((c)=>(c in n)):[],s=t==="request"?Ty.filter((c)=>(c in r)):[];if(o.length===0&&s.length===0)return{message:e,lifted:{}};let a={},i={...r};if(o.length>0&&_o(n)){let c={},u={...n};for(let f of o)c[f]=n[f],delete u[f];if(a.envelope=c,Object.keys(u).length>0)i._meta=u;else delete i._meta}for(let c of s){if(c==="inputResponses")a.inputResponses=i[c];if(c==="requestState")a.requestState=i[c];delete i[c]}return{message:{...e,params:i},lifted:a}}function Rh(e,t){let r=e.validateResult(t,void 0);if(!r.ok&&r.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(n){let o=e.validateResult(t,n);if(o.ok)return{value:o.value};return{issues:[{message:o.reason==="invalid"?o.message:`not-in-era: ${t}`}]}}}}}function vo(e){return()=>e}var Py=vo(void 0);function ju(e,t){return{...e,mcpReq:{...e.mcpReq,requestState:vo(t)}}}var ky;var rf=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{ky=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??jc,this.setNotificationHandler("notifications/cancelled",(t)=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",(t)=>{this._onprogress(t)}),this.setRequestHandler("ping",(t)=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new pe(ge.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){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,n,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:o,onTimeout:n})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new pe(ge.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(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 r=this.transport?.onerror;this._transport.onerror=(o)=>{r?.(o),this._onerror(o)};let n=this._transport?.onmessage;this._transport.onmessage=(o,s)=>{if(n?.(o,s),yu(o)||Hh(o))this._onresponse(o);else if(Vh(o))this._onrequest(o,s);else if(Jh(o))this._onnotification(o,s);else this._onerror(Error(`Unknown message type: ${JSON.stringify(o)}`))},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 n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new pe(ge.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let n of e.values())n(r);for(let n of t.values())n.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=bh(e,"notification"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let a=Sh(t.classification);if(a!==n.era){this._onerror(Error(`Era mismatch on inbound notification '${r.method}': classified as ${a} but this instance serves ${n.era}`));return}}if(gu(r.method)&&!n.hasNotificationMethod(r.method))return;let o=this._notificationHandlers.get(r.method),s=this.fallbackNotificationHandler;if(o===void 0&&s===void 0)return;Promise.resolve().then(()=>o===void 0?s(r):o(r,n)).catch((a)=>this._onerror(Error(`Uncaught error in notification handler: ${a}`)))}_onrequest(e,t){let{message:r,lifted:n}=bh(e,"request"),o=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 s=this._transport,a=(w,m,g)=>{let z={jsonrpc:"2.0",id:r.id,error:{code:w,message:m,...g!==void 0&&{data:g}}};s?.send(z).catch((S)=>this._onerror(Error(`Failed to send an error response: ${S}`)))};if(t?.classification!==void 0){let w=Sh(t.classification);if(w!==o.era){this._onerror(Error(`Era mismatch on inbound request '${r.method}': classified as ${w} but this instance serves ${o.era}`));let m=t.classification.revision??w;a(ne.UnsupportedProtocolVersion,`Unsupported protocol version: ${m}`,{supported:this._supportedProtocolVersions,requested:m});return}}if(fu(r.method)&&!o.hasRequestMethod(r.method)){a(ne.MethodNotFound,"Method not found");return}let i=this._requestHandlers.get(r.method)??this.fallbackRequestHandler;if(i===void 0){a(ne.MethodNotFound,"Method not found");return}let c=o.checkInboundEnvelope(n);if(c!==void 0){a(ne.InvalidParams,c);return}let u=(w,m)=>this._notificationViaCodec(this._resolveOutboundCodec(w.method),w,{...m,relatedRequestId:r.id}),f=(w,m,g)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(w.method),w,m,{...g,relatedRequestId:r.id}),_=new AbortController;this._requestHandlerAbortControllers.set(r.id,_);let E=n.inputResponses===void 0?void 0:Oy(n.inputResponses),P={sessionId:s?.sessionId,mcpReq:{id:r.id,method:r.method,_meta:r.params?._meta,...n.envelope!==void 0&&{envelope:n.envelope},...E!==void 0&&{inputResponses:E.accepted},...E!==void 0&&E.droppedKeys.length>0&&{droppedInputResponseKeys:E.droppedKeys},requestState:n.requestState===void 0?Py:vo(n.requestState),signal:_.signal,send:(w,m,g)=>{let z=this._resolveOutboundCodec(w.method);if(this._assertOutboundRequestInEra(z,w.method),vu(m))return f(w,m,g);let S=Rh(z,w.method);if(S===void 0)throw TypeError(`'${w.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return f(w,S,m)},notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},v=this.buildContext(P,t);Promise.resolve().then(()=>i(r,v)).then(async(w)=>{if(_.signal.aborted)return;let m;try{m=o.encodeResult(r.method,w,this._outboundServerInfo())}catch(z){this._onerror(Error(`Failed to encode result for ${r.method}: ${z}`)),a(ne.InternalError,"Internal error");return}let g={result:m,jsonrpc:"2.0",id:r.id};await s?.send(g)},async(w)=>{if(_.signal.aborted)return;let m=Number.isSafeInteger(w.code)?w.code:ne.InternalError,g={jsonrpc:"2.0",id:r.id,error:{code:o.encodeErrorCode(m),message:w.message??"Internal error",...w.data!==void 0&&{data:w.data}}};await s?.send(g)}).catch((w)=>this._onerror(Error(`Failed to send response: ${w}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(r.id)===_)this._requestHandlerAbortControllers.delete(r.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,n=Number(t),o=this._progressHandlers.get(n);if(!o){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(i){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),s(i);return}o(r)}_onresponse(e){let t=Number(e.id),r=this._responseHandlers.get(t);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),yu(e))r(e);else r(_e.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,r){let n=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(n,e.method),vu(t))return this._requestWithSchemaViaCodec(n,e,t,r);let o=Rh(n,e.method);if(o===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(n,e,o,t)}_negotiatedWireCodec(){return Jr(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=wy(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(fu(t)&&!e.hasRequestMethod(t))throw new pe(ge.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,r){let n=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(n,e.method),this._requestWithSchemaViaCodec(n,e,t,r)}_requestWithSchemaViaCodec(e,t,r,n){let{relatedRequestId:o,resumptionToken:s,onresumptiontoken:a,headers:i}=n??{},c=Date.now(),u,f;return new Promise((_,E)=>{let P=(R)=>{E(R)};if(!this._transport){P(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(R){P(R);return}if(n?.signal?.aborted){let R=n.signal.reason;throw R instanceof pe?R:new pe(ge.RequestTimeout,String(R))}let v=e.era===Iu&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,w=this._requestMessageId++;f=w;let m={...t,jsonrpc:"2.0",id:w};if(n?.onprogress)this._progressHandlers.set(w,n.onprogress),m.params={...t.params,_meta:{...t.params?._meta,progressToken:w}};let g=this._envelopeOutbound(m),z=!1,S=(R)=>{if(z)return;if(this._progressHandlers.delete(w),v===void 0)this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:w,reason:String(R)}}),{relatedRequestId:o,resumptionToken:s,onresumptiontoken:a}).catch((y)=>this._onerror(Error(`Failed to send cancellation: ${y}`)));else v.abort();E(R instanceof pe?R:new pe(ge.RequestTimeout,String(R)))};this._responseHandlers.set(w,(R)=>{if(n?.signal?.aborted)return;if(z=!0,R instanceof Error)return E(R);let y;try{y=e.decodeResult(t.method,R.result)}catch(q){return E(q instanceof Error?q:Error(String(q)))}if(y.kind==="invalid")return E(y.error);if(y.kind==="input_required"){if(n?.allowInputRequired===!0)return _(Cy(y));let q={codec:e,request:t,resultSchema:r,options:n,flowStartedAt:c,retry:(H,D)=>this._requestWithSchemaViaCodec(e,H===void 0?{method:t.method}:{method:t.method,params:H},r,D)};return _(this._resolveNonCompleteResult(y,q))}let N=y.result;na(r,N).then((q)=>{if(q.success)_(q.data);else E(new pe(ge.InvalidResult,`Invalid result for ${t.method}: ${q.error}`))},E)}),u=()=>S(n?.signal?.reason),n?.signal?.addEventListener("abort",u,{once:!0});let b=n?.timeout??$y,O=()=>S(new pe(ge.RequestTimeout,"Request timed out",{timeout:b}));this._setupTimeout(w,b,n?.maxTotalTimeout,O,n?.resetTimeoutOnProgress??!1),this._transport.send(g,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:a,headers:i,requestSignal:v?.signal}).catch((R)=>{this._progressHandlers.delete(w),E(R)})}).finally(()=>{if(u)n?.signal?.removeEventListener("abort",u);if(f!==void 0)this._responseHandlers.delete(f),this._cleanupTimeout(f)})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new pe(ge.NotConnected,"Not connected");if(gu(t.method)&&!e.hasNotificationMethod(t.method))throw new pe(ge.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 n=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;this._transport?.send(n,r).catch((o)=>this._onerror(o))});return}await this._transport.send(n,r)}setRequestHandler(e,t,r){this.assertRequestHandlerCapability(e);let n;if(typeof t==="function"){if(!fu(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);n=(o,s)=>{let a=this._negotiatedWireCodec(),i=a.validateRequest(e,o);if(!i.ok&&i.reason==="not-in-era")i=a.validateInputRequest(e,o);if(!i.ok){if(i.reason==="not-in-era")throw new _e(ne.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(i.message)}return Promise.resolve(t(i.value,s))}}else if(r)n=async(o,s)=>{let a=await na(t.params,{...o.params});if(!a.success)throw new _e(ne.InvalidParams,`Invalid params for ${e}: ${a.error}`);return r(a.data,s)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(e,this._wrapHandler(e,n))}_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,r){if(typeof t==="function"){if(!gu(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,o)=>{let s=o.validateNotification(e,n);if(!s.ok){if(s.reason==="not-in-era")throw new _e(ne.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(s.message)}return Promise.resolve(t(s.value))});return}if(!r)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async(n)=>{let o=await na(t.params,{...n.params});if(!o.success)throw new _e(ne.InvalidParams,`Invalid params for notification ${e}: ${o.error}`);await r(o.data,n)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function _o(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function nf(e,t){let r={...e};for(let n in t){let o=n,s=t[o];if(s===void 0)continue;let a=r[o];r[o]=_o(a)&&_o(s)?{...a,...s}:s}return r}function zh(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Oy(e){let t={},r=[];if(!zh(e))return{accepted:t,droppedKeys:r};for(let[n,o]of Object.entries(e)){if(!zh(o)||"method"in o||"result"in o){r.push(n);continue}t[n]=o}return{accepted:t,droppedKeys:r}}function Cy(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState}}}/*!
70
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){i(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1){if(e.reused==="ref"){i(a);continue}}}}function On(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(s)=>{let c=e.seen.get(s);if(c.ref===null)return;let u=c.def??c.schema,f={...u},_=c.ref;if(c.ref=null,_){n(_);let P=e.seen.get(_),v=P.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(v);else Object.assign(u,v);if(Object.assign(u,f),s._zod.parent===_)for(let m in u){if(m==="$ref"||m==="allOf")continue;if(!(m in f))delete u[m]}if(v.$ref&&P.def)for(let m in u){if(m==="$ref"||m==="allOf")continue;if(m in P.def&&JSON.stringify(u[m])===JSON.stringify(P.def[m]))delete u[m]}}let E=s._zod.parent;if(E&&E!==_){n(E);let P=e.seen.get(E);if(P?.schema.$ref){if(u.$ref=P.schema.$ref,P.def)for(let v in u){if(v==="$ref"||v==="allOf")continue;if(v in P.def&&JSON.stringify(u[v])===JSON.stringify(P.def[v]))delete u[v]}}}e.override({zodSchema:s,jsonSchema:u,path:c.path??[]})};for(let s of[...e.seen.entries()].reverse())n(s[0]);let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(s)}Object.assign(o,r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&o.id===i)delete o.id;let a=e.external?.defs??{};for(let s of e.seen.entries()){let c=s[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;a[c.defId]=c.def}}if(e.external);else if(Object.keys(a).length>0)if(e.target==="draft-2020-12")o.$defs=a;else o.definitions=a;try{let s=JSON.parse(JSON.stringify(o));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:Tn(t,"input",e.processors),output:Tn(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch(s){throw Error("Error converting schema to JSON.")}}function Ke(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Ke(n.element,r);if(n.type==="set")return Ke(n.valueType,r);if(n.type==="lazy")return Ke(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Ke(n.innerType,r);if(n.type==="intersection")return Ke(n.left,r)||Ke(n.right,r);if(n.type==="record"||n.type==="map")return Ke(n.keyType,r)||Ke(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return Ke(n.in,r)||Ke(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(Ke(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Ke(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Ke(o,r))return!0;if(n.rest&&Ke(n.rest,r))return!0;return!1}return!1}var Gm=(e,t={})=>(r)=>{let n=Pn({...r,processors:t});return we(e,n),kn(n,e),On(n,e)},Tn=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:i}=n??{},a=Pn({...o??{},target:i,io:t,processors:r});return we(e,a),kn(a,e),On(a,e)};var zg={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ba=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i==="number")o.minLength=i;if(typeof a==="number")o.maxLength=a;if(s){if(o.format=zg[s]??s,o.format==="")delete o.format;if(s==="time")delete o.format}if(u)o.contentEncoding=u;if(c&&c.size>0){let f=[...c];if(f.length===1)o.pattern=f[0].source;else if(f.length>1)o.allOf=[...f.map((_)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:_.source}))]}},Ya=(e,t,r,n)=>{let o=r,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:f}=e._zod.bag;if(typeof s==="string"&&s.includes("int"))o.type="integer";else o.type="number";let _=typeof f==="number"&&f>=(i??Number.NEGATIVE_INFINITY),E=typeof u==="number"&&u<=(a??Number.POSITIVE_INFINITY),P=t.target==="draft-04"||t.target==="openapi-3.0";if(_)if(P)o.minimum=f,o.exclusiveMinimum=!0;else o.exclusiveMinimum=f;else if(typeof i==="number")o.minimum=i;if(E)if(P)o.maximum=u,o.exclusiveMaximum=!0;else o.exclusiveMaximum=u;else if(typeof a==="number")o.maximum=a;if(typeof c==="number")o.multipleOf=c},Ga=(e,t,r,n)=>{r.type="boolean"},Wm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},Xm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},Qa=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},ep=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},tp=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},Wa=(e,t,r,n)=>{r.not={}},Xa=(e,t,r,n)=>{},ec=(e,t,r,n)=>{},rp=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},tc=(e,t,r,n)=>{let o=e._zod.def,i=jo(o.entries);if(i.every((a)=>typeof a==="number"))r.type="number";if(i.every((a)=>typeof a==="string"))r.type="string";r.enum=i},rc=(e,t,r,n)=>{let o=e._zod.def,i=[];for(let a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else i.push(Number(a));else i.push(a);if(i.length===0);else if(i.length===1){let a=i[0];if(r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[a];else r.const=a}else{if(i.every((a)=>typeof a==="number"))r.type="number";if(i.every((a)=>typeof a==="string"))r.type="string";if(i.every((a)=>typeof a==="boolean"))r.type="boolean";if(i.every((a)=>a===null))r.type="null";r.enum=i}},np=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},op=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},sp=(e,t,r,n)=>{let o=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=e._zod.bag;if(a!==void 0)i.minLength=a;if(s!==void 0)i.maxLength=s;if(c)if(c.length===1)i.contentMediaType=c[0],Object.assign(o,i);else Object.assign(o,i),o.anyOf=c.map((u)=>({contentMediaType:u}));else Object.assign(o,i)},ip=(e,t,r,n)=>{r.type="boolean"},nc=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},ap=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},oc=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},cp=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},up=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},sc=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;if(typeof a==="number")o.minItems=a;if(typeof s==="number")o.maxItems=s;o.type="array",o.items=we(i.element,t,{...n,path:[...n.path,"items"]})},ic=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object",o.properties={};let a=i.shape;for(let u in a)o.properties[u]=we(a[u],t,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter((u)=>{let f=i.shape[u]._zod;if(t.io==="input")return f.optin===void 0;else return f.optout===void 0}));if(c.size>0)o.required=Array.from(c);if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=we(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},ac=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>we(s,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));if(i)r.oneOf=a;else r.anyOf=a},cc=(e,t,r,n)=>{let o=e._zod.def,i=we(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=we(o.right,t,{...n,path:[...n.path,"allOf",1]}),s=(u)=>("allOf"in u)&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c},lp=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((E,P)=>we(E,t,{...n,path:[...n.path,a,P]})),u=i.rest?we(i.rest,t,{...n,path:[...n.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;if(t.target==="draft-2020-12"){if(o.prefixItems=c,u)o.items=u}else if(t.target==="openapi-3.0"){if(o.items={anyOf:c},u)o.items.anyOf.push(u);if(o.minItems=c.length,!u)o.maxItems=c.length}else if(o.items=c,u)o.additionalItems=u;let{minimum:f,maximum:_}=e._zod.bag;if(typeof f==="number")o.minItems=f;if(typeof _==="number")o.maxItems=_},uc=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let f=we(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let _ of c)o.patternProperties[_.source]=f}else{if(t.target==="draft-07"||t.target==="draft-2020-12")o.propertyNames=we(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});o.additionalProperties=we(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let u=a._zod.values;if(u){let f=[...u].filter((_)=>typeof _==="string"||typeof _==="number");if(f.length>0)o.required=f}},lc=(e,t,r,n)=>{let o=e._zod.def,i=we(o.innerType,t,n),a=t.seen.get(e);if(t.target==="openapi-3.0")a.ref=o.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},dc=(e,t,r,n)=>{let o=e._zod.def;we(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},mc=(e,t,r,n)=>{let o=e._zod.def;we(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},pc=(e,t,r,n)=>{let o=e._zod.def;we(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io==="input")r._prefault=JSON.parse(JSON.stringify(o.defaultValue))},hc=(e,t,r,n)=>{let o=e._zod.def;we(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},fc=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?i?o.out:o.in:o.out;we(a,t,n);let s=t.seen.get(e);s.ref=a},gc=(e,t,r,n)=>{let o=e._zod.def;we(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},dp=(e,t,r,n)=>{let o=e._zod.def;we(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Qo=(e,t,r,n)=>{let o=e._zod.def;we(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},_c=(e,t,r,n)=>{let o=e._zod.innerType;we(o,t,n);let i=t.seen.get(e);i.ref=o},Qm={string:Ba,number:Ya,boolean:Ga,bigint:Wm,symbol:Xm,null:Qa,undefined:ep,void:tp,never:Wa,any:Xa,unknown:ec,date:rp,enum:tc,literal:rc,nan:np,template_literal:op,file:sp,success:ip,custom:nc,function:ap,transform:oc,map:cp,set:up,array:sc,object:ic,union:ac,intersection:cc,tuple:lp,record:uc,nullable:lc,nonoptional:dc,default:mc,prefault:pc,catch:hc,pipe:fc,readonly:gc,promise:dp,optional:Qo,lazy:_c};function Wo(e,t){if("_idmap"in e){let n=e,o=Pn({...t,processors:Qm}),i={};for(let c of n._idmap.entries()){let[u,f]=c;we(f,o)}let a={},s={registry:n,uri:t?.uri,defs:i};o.external=s;for(let c of n._idmap.entries()){let[u,f]=c;kn(o,f),a[u]=On(o,f)}if(Object.keys(i).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[c]:i}}return{schemas:a}}let r=Pn({...t,processors:Qm});return we(e,r),kn(r,e),On(r,e)}var Cg=D("ZodISODateTime",(e,t)=>{Td.init(e,t),Pe.init(e,t)});function br(e){return Am(Cg,e)}var Ng=D("ZodISODate",(e,t)=>{Pd.init(e,t),Pe.init(e,t)});function Sc(e){return jm(Ng,e)}var xg=D("ZodISOTime",(e,t)=>{kd.init(e,t),Pe.init(e,t)});function mp(e){return Mm(xg,e)}var Ig=D("ZodISODuration",(e,t)=>{Od.init(e,t),Pe.init(e,t)});function pp(e){return qm(Ig,e)}var Ag=(e,t)=>{Do.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>ba(e,r)},flatten:{value:(r)=>va(e,r)},addIssue:{value:(r)=>{e.issues.push(r),e.message=JSON.stringify(e.issues,yn,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,yn,2)}},isEmpty:{get(){return e.issues.length===0}}})};var tt=D("ZodError",Ag,{Parent:Error});var fp=Uo(tt),gp=Fo(tt),es=bn(tt),_p=Rn(tt),Sp=dl(tt),yp=ml(tt),vp=pl(tt),bp=hl(tt),Rp=fl(tt),zp=gl(tt),wp=_l(tt),$p=Sl(tt);var Ep=new WeakMap;function Cn(e,t,r){let n=Object.getPrototypeOf(e),o=Ep.get(n);if(!o)o=new Set,Ep.set(n,o);if(o.has(t))return;o.add(t);for(let i in r){let a=r[i];Object.defineProperty(n,i,{configurable:!0,enumerable:!1,get(){let s=a.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:s}),s},set(s){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:s})}})}}var $e=D("ZodType",(e,t)=>(ze.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Tn(e,"input"),output:Tn(e,"output")}}),e.toJSONSchema=Gm(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,n)=>fp(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>es(e,r,n),e.parseAsync=async(r,n)=>gp(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>_p(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Sp(e,r,n),e.decode=(r,n)=>yp(e,r,n),e.encodeAsync=async(r,n)=>vp(e,r,n),e.decodeAsync=async(r,n)=>bp(e,r,n),e.safeEncode=(r,n)=>Rp(e,r,n),e.safeDecode=(r,n)=>zp(e,r,n),e.safeEncodeAsync=async(r,n)=>wp(e,r,n),e.safeDecodeAsync=async(r,n)=>$p(e,r,n),Cn(e,"ZodType",{check(...r){let n=this.def;return this.clone(bt(n,{checks:[...n.checks??[],...r.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,n){return st(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(w_(r,n))},superRefine(r,n){return this.check($_(r,n))},overwrite(r){return this.check($t(r))},optional(){return ne(this)},exactOptional(){return l_(this)},nullable(){return Op(this)},nullish(){return ne(Op(this))},nonoptional(r){return g_(this,r)},array(){return A(this)},or(r){return W([this,r])},and(r){return mt(this,r)},transform(r){return Cp(this,Up(r))},default(r){return p_(this,r)},prefault(r){return f_(this,r)},catch(r){return S_(this,r)},pipe(r){return Cp(this,r)},readonly(){return b_(this)},describe(r){let n=this.clone();return wt.add(n,{description:r}),n},meta(...r){if(r.length===0)return wt.get(this);let n=this.clone();return wt.add(n,r[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return wt.get(e)?.description},configurable:!0}),e)),Np=D("_ZodString",(e,t)=>{Jo.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ba(e,n,o,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,Cn(e,"_ZodString",{regex(...n){return this.check(Ma(...n))},includes(...n){return this.check(Da(...n))},startsWith(...n){return this.check(Ua(...n))},endsWith(...n){return this.check(Fa(...n))},min(...n){return this.check(yr(...n))},max(...n){return this.check(Yo(...n))},length(...n){return this.check(Go(...n))},nonempty(...n){return this.check(yr(1,...n))},lowercase(n){return this.check(qa(n))},uppercase(n){return this.check(La(n))},trim(){return this.check(Va())},normalize(...n){return this.check(Za(...n))},toLowerCase(){return this.check(Ja())},toUpperCase(){return this.check(Ha())},slugify(){return this.check(Ka())}})}),xp=D("ZodString",(e,t)=>{Jo.init(e,t),Np.init(e,t),e.email=(r)=>e.check(Ia(Ip,r)),e.url=(r)=>e.check(ja(jp,r)),e.jwt=(r)=>e.check(Im(Qg,r)),e.emoji=(r)=>e.check(vm(Mg,r)),e.guid=(r)=>e.check(Aa(Tp,r)),e.uuid=(r)=>e.check(gm(ts,r)),e.uuidv4=(r)=>e.check(_m(ts,r)),e.uuidv6=(r)=>e.check(Sm(ts,r)),e.uuidv7=(r)=>e.check(ym(ts,r)),e.nanoid=(r)=>e.check(bm(qg,r)),e.guid=(r)=>e.check(Aa(Tp,r)),e.cuid=(r)=>e.check(Rm(Lg,r)),e.cuid2=(r)=>e.check(zm(Dg,r)),e.ulid=(r)=>e.check(wm(Ug,r)),e.base64=(r)=>e.check(Cm(Bg,r)),e.base64url=(r)=>e.check(Nm(Yg,r)),e.xid=(r)=>e.check($m(Fg,r)),e.ksuid=(r)=>e.check(Em(Zg,r)),e.ipv4=(r)=>e.check(Tm(Vg,r)),e.ipv6=(r)=>e.check(Pm(Jg,r)),e.cidrv4=(r)=>e.check(km(Hg,r)),e.cidrv6=(r)=>e.check(Om(Kg,r)),e.e164=(r)=>e.check(xm(Gg,r)),e.datetime=(r)=>e.check(br(r)),e.date=(r)=>e.check(Sc(r)),e.time=(r)=>e.check(mp(r)),e.duration=(r)=>e.check(pp(r))});function d(e){return fm(xp,e)}var Pe=D("ZodStringFormat",(e,t)=>{Te.init(e,t),Np.init(e,t)}),Ip=D("ZodEmail",(e,t)=>{Sd.init(e,t),Pe.init(e,t)});function Ap(e){return Ia(Ip,e)}var Tp=D("ZodGUID",(e,t)=>{gd.init(e,t),Pe.init(e,t)});var ts=D("ZodUUID",(e,t)=>{_d.init(e,t),Pe.init(e,t)});var jp=D("ZodURL",(e,t)=>{yd.init(e,t),Pe.init(e,t)});function rs(e){return ja(jp,e)}var Mg=D("ZodEmoji",(e,t)=>{vd.init(e,t),Pe.init(e,t)});var qg=D("ZodNanoID",(e,t)=>{bd.init(e,t),Pe.init(e,t)});var Lg=D("ZodCUID",(e,t)=>{Rd.init(e,t),Pe.init(e,t)});var Dg=D("ZodCUID2",(e,t)=>{zd.init(e,t),Pe.init(e,t)});var Ug=D("ZodULID",(e,t)=>{wd.init(e,t),Pe.init(e,t)});var Fg=D("ZodXID",(e,t)=>{$d.init(e,t),Pe.init(e,t)});var Zg=D("ZodKSUID",(e,t)=>{Ed.init(e,t),Pe.init(e,t)});var Vg=D("ZodIPv4",(e,t)=>{Cd.init(e,t),Pe.init(e,t)});var Jg=D("ZodIPv6",(e,t)=>{Nd.init(e,t),Pe.init(e,t)});var Hg=D("ZodCIDRv4",(e,t)=>{xd.init(e,t),Pe.init(e,t)});var Kg=D("ZodCIDRv6",(e,t)=>{Id.init(e,t),Pe.init(e,t)});var Bg=D("ZodBase64",(e,t)=>{jd.init(e,t),Pe.init(e,t)});var Yg=D("ZodBase64URL",(e,t)=>{Md.init(e,t),Pe.init(e,t)});var Gg=D("ZodE164",(e,t)=>{qd.init(e,t),Pe.init(e,t)});var Qg=D("ZodJWT",(e,t)=>{Ld.init(e,t),Pe.init(e,t)});var ns=D("ZodNumber",(e,t)=>{ka.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ya(e,n,o,i),Cn(e,"ZodNumber",{gt(n,o){return this.check(Ko(n,o))},gte(n,o){return this.check(En(n,o))},min(n,o){return this.check(En(n,o))},lt(n,o){return this.check(Ho(n,o))},lte(n,o){return this.check($n(n,o))},max(n,o){return this.check($n(n,o))},int(n){return this.check(Pp(n))},safe(n){return this.check(Pp(n))},positive(n){return this.check(Ko(0,n))},nonnegative(n){return this.check(En(0,n))},negative(n){return this.check(Ho(0,n))},nonpositive(n){return this.check($n(0,n))},multipleOf(n,o){return this.check(Bo(n,o))},step(n,o){return this.check(Bo(n,o))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function J(e){return Lm(ns,e)}var Wg=D("ZodNumberFormat",(e,t)=>{Dd.init(e,t),ns.init(e,t)});function Pp(e){return Um(Wg,e)}var Mp=D("ZodBoolean",(e,t)=>{Ud.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ga(e,r,n,o)});function Q(e){return Fm(Mp,e)}var Xg=D("ZodNull",(e,t)=>{Fd.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qa(e,r,n,o)});function Qt(e){return Zm(Xg,e)}var e_=D("ZodAny",(e,t)=>{Zd.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xa(e,r,n,o)});function qp(){return Vm(e_)}var t_=D("ZodUnknown",(e,t)=>{Vd.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ec(e,r,n,o)});function ie(){return Jm(t_)}var r_=D("ZodNever",(e,t)=>{Jd.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wa(e,r,n,o)});function n_(e){return Hm(r_,e)}var o_=D("ZodArray",(e,t)=>{Hd.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sc(e,r,n,o),e.element=t.element,Cn(e,"ZodArray",{min(r,n){return this.check(yr(r,n))},nonempty(r){return this.check(yr(1,r))},max(r,n){return this.check(Yo(r,n))},length(r,n){return this.check(Go(r,n))},unwrap(){return this.element}})});function A(e,t){return Km(o_,e,t)}var Lp=D("ZodObject",(e,t)=>{Yd.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ic(e,r,n,o),ye(e,"shape",()=>t.shape),Cn(e,"ZodObject",{keyof(){return de(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:ie()})},loose(){return this.clone({...this._zod.def,catchall:ie()})},strict(){return this.clone({...this._zod.def,catchall:n_()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return ug(this,r)},safeExtend(r){return lg(this,r)},merge(r){return dg(this,r)},pick(r){return ag(this,r)},omit(r){return cg(this,r)},partial(...r){return mg(Fp,this,r[0])},required(...r){return pg(Zp,this,r[0])}})});function I(e,t){let r={type:"object",shape:e??{},...re(t)};return new Lp(r)}function ce(e,t){return new Lp({type:"object",shape:e,catchall:ie(),...re(t)})}var Dp=D("ZodUnion",(e,t)=>{Oa.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ac(e,r,n,o),e.options=t.options});function W(e,t){return new Dp({type:"union",options:e,...re(t)})}var s_=D("ZodDiscriminatedUnion",(e,t)=>{Dp.init(e,t),Gd.init(e,t)});function Rr(e,t,r){return new s_({type:"union",options:t,discriminator:e,...re(r)})}var i_=D("ZodIntersection",(e,t)=>{Qd.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cc(e,r,n,o)});function mt(e,t){return new i_({type:"intersection",left:e,right:t})}var kp=D("ZodRecord",(e,t)=>{Wd.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uc(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function Y(e,t,r){if(!t||!t._zod)return new kp({type:"record",keyType:d(),valueType:e,...re(t)});return new kp({type:"record",keyType:e,valueType:t,...re(r)})}var yc=D("ZodEnum",(e,t)=>{Xd.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(n,o,i)=>tc(e,n,o,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=t.entries[a];else throw Error(`Key ${a} not found in enum`);return new yc({...t,checks:[],...re(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let a of n)if(r.has(a))delete i[a];else throw Error(`Key ${a} not found in enum`);return new yc({...t,checks:[],...re(o),entries:i})}});function de(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new yc({type:"enum",entries:r,...re(t)})}var a_=D("ZodLiteral",(e,t)=>{em.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rc(e,r,n,o),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 j(e,t){return new a_({type:"literal",values:Array.isArray(e)?e:[e],...re(t)})}var c_=D("ZodTransform",(e,t)=>{tm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oc(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Sn(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(Gt(i,r.value,t));else{let a=i;if(a.fatal)a.continue=!1;a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(Gt(a))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((i)=>(r.value=i,r.fallback=!0,r));return r.value=o,r.fallback=!0,r}});function Up(e){return new c_({type:"transform",transform:e})}var Fp=D("ZodOptional",(e,t)=>{Ca.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ne(e){return new Fp({type:"optional",innerType:e})}var u_=D("ZodExactOptional",(e,t)=>{rm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function l_(e){return new u_({type:"optional",innerType:e})}var d_=D("ZodNullable",(e,t)=>{nm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Op(e){return new d_({type:"nullable",innerType:e})}var m_=D("ZodDefault",(e,t)=>{om.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function p_(e,t){return new m_({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():_a(t)}})}var h_=D("ZodPrefault",(e,t)=>{sm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function f_(e,t){return new h_({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():_a(t)}})}var Zp=D("ZodNonOptional",(e,t)=>{im.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function g_(e,t){return new Zp({type:"nonoptional",innerType:e,...re(t)})}var __=D("ZodCatch",(e,t)=>{am.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function S_(e,t){return new __({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var Vp=D("ZodPipe",(e,t)=>{Na.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fc(e,r,n,o),e.in=t.in,e.out=t.out});function Cp(e,t){return new Vp({type:"pipe",in:e,out:t})}var y_=D("ZodPreprocess",(e,t)=>{Vp.init(e,t),cm.init(e,t)}),v_=D("ZodReadonly",(e,t)=>{um.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function b_(e){return new v_({type:"readonly",innerType:e})}var R_=D("ZodLazy",(e,t)=>{lm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_c(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Nn(e){return new R_({type:"lazy",getter:e})}var z_=D("ZodCustom",(e,t)=>{dm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>nc(e,r,n,o)});function w_(e,t={}){return Bm(z_,e,t)}function $_(e,t){return Ym(e,t)}function Wt(e,t){return new y_({type:"pipe",in:Up(e),out:t})}var Hp={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 Jp;(function(e){})(Jp||(Jp={}));function E_(e){return Dm(ns,e)}We(xa());var zr="2025-11-25";var bc=[zr,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Rc="io.modelcontextprotocol/related-task",wr="io.modelcontextprotocol/protocolVersion",xn="io.modelcontextprotocol/clientInfo",Tt="io.modelcontextprotocol/serverInfo",Pt="io.modelcontextprotocol/clientCapabilities",os="io.modelcontextprotocol/subscriptionId",er="io.modelcontextprotocol/logLevel";var $r="2.0";var Et=Nn(()=>W([d(),J(),Q(),Qt(),Y(d(),Et),A(Et)])),xe=Y(d(),Et),zc=A(Et),In=W([d(),J().int()]),An=d(),ss=I({ttl:J().optional()}),is=I({taskId:d()}),jn=ce({progressToken:In.optional(),[Rc]:is.optional()}),Le=I({_meta:jn.optional()}),tr=Le.extend({task:ss.optional()}),Ie=I({method:d(),params:Le.loose().optional()}),Je=I({_meta:jn.optional()}),He=I({method:d(),params:Je.loose().optional()}),Mn=ce({get[Tt](){return Pr.optional().catch(void 0)}}),Ae=ce({_meta:Mn.optional()}),kt=W([d(),J().int()]),qn=I({jsonrpc:j($r),id:kt,...Ie.shape}).strict(),Ln=I({jsonrpc:j($r),...He.shape}).strict(),Er=I({jsonrpc:j($r),id:kt,result:Ae}).strict(),Tr=I({jsonrpc:j($r),id:kt.optional(),error:I({code:J().int(),message:d(),data:ie().optional()})}).strict(),as=W([qn,Ln,Er,Tr]),wc=W([Er,Tr]),Dn=Ae.strict(),cs=Je.extend({requestId:kt.optional(),reason:d().optional()}),Un=He.extend({method:j("notifications/cancelled"),params:cs}),us=I({src:d(),mimeType:d().optional(),sizes:A(d()).optional(),theme:de(["light","dark"]).optional()}),Ot=I({icons:A(us).optional()}),pt=I({name:d(),title:d().optional()}),Pr=pt.extend({...pt.shape,...Ot.shape,version:d(),websiteUrl:d().optional(),description:d().optional()}),P_=mt(I({applyDefaults:Q().optional()}),xe),k_=Wt((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)&&Object.keys(e).length===0)return{form:{}};return e},mt(I({form:P_.optional(),url:xe.optional()}),xe.optional())),ls=ce({list:xe.optional(),cancel:xe.optional(),requests:ce({sampling:ce({createMessage:xe.optional()}).optional(),elicitation:ce({create:xe.optional()}).optional()}).optional()}),ds=ce({list:xe.optional(),cancel:xe.optional(),requests:ce({tools:ce({call:xe.optional()}).optional()}).optional()}),ms=I({experimental:Y(d(),xe).optional(),sampling:I({context:xe.optional(),tools:xe.optional()}).optional(),elicitation:k_.optional(),roots:I({listChanged:Q().optional()}).optional(),tasks:ls.optional(),extensions:Y(d(),xe).optional()}),ps=Le.extend({protocolVersion:d(),capabilities:ms,clientInfo:Pr}),hs=Ie.extend({method:j("initialize"),params:ps}),Fn=I({experimental:Y(d(),xe).optional(),logging:xe.optional(),completions:xe.optional(),prompts:I({listChanged:Q().optional()}).optional(),resources:I({subscribe:Q().optional(),listChanged:Q().optional()}).optional(),tools:I({listChanged:Q().optional()}).optional(),tasks:ds.optional(),extensions:Y(d(),xe).optional()}),fs=Ae.extend({protocolVersion:d(),capabilities:Fn,serverInfo:Pr,instructions:d().optional()}),gs=He.extend({method:j("notifications/initialized"),params:Je.optional()}),_s=Ie.extend({method:j("server/discover"),params:Le.optional()}),Ss=Ae.extend({supportedVersions:A(d()),capabilities:Fn,instructions:d().optional()}),Zn=Ie.extend({method:j("ping"),params:Le.optional()}),ys=I({progress:J(),total:ne(J()),message:ne(d())}),vs=I({...Je.shape,...ys.shape,progressToken:In}),Vn=He.extend({method:j("notifications/progress"),params:vs}),bs=Le.extend({cursor:An.optional()}),Ct=Ie.extend({params:bs.optional()}),Nt=Ae.extend({nextCursor:An.optional()}),Jn=I({uri:d(),mimeType:ne(d()),_meta:Y(d(),ie()).optional()}),Hn=Jn.extend({text:d()}),$c=d().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Kn=Jn.extend({blob:$c}),xt=de(["user","assistant"]),ht=I({audience:A(xt).optional(),priority:J().min(0).max(1).optional(),lastModified:br({offset:!0}).optional()}),Bn=I({...pt.shape,...Ot.shape,uri:d(),description:ne(d()),mimeType:ne(d()),size:ne(J()),annotations:ht.optional(),_meta:ne(ce({}))}),Rs=I({...pt.shape,...Ot.shape,uriTemplate:d(),description:ne(d()),mimeType:ne(d()),annotations:ht.optional(),_meta:ne(ce({}))}),zs=Ct.extend({method:j("resources/list")}),ws=Nt.extend({resources:A(Bn)}),$s=Ct.extend({method:j("resources/templates/list")}),Es=Nt.extend({resourceTemplates:A(Rs)}),kr=Le.extend({uri:d()}),Ts=kr,Ps=Ie.extend({method:j("resources/read"),params:Ts}),ks=Ae.extend({contents:A(W([Hn,Kn]))}),Os=He.extend({method:j("notifications/resources/list_changed"),params:Je.optional()}),Cs=kr,Ns=Ie.extend({method:j("resources/subscribe"),params:Cs}),xs=kr,Is=Ie.extend({method:j("resources/unsubscribe"),params:xs}),Yn=I({toolsListChanged:Q().optional(),promptsListChanged:Q().optional(),resourcesListChanged:Q().optional(),resourceSubscriptions:A(d()).optional()}),As=Le.extend({notifications:Yn}),js=Ie.extend({method:j("subscriptions/listen"),params:As}),Ms=Je.extend({notifications:Yn}),qs=He.extend({method:j("notifications/subscriptions/acknowledged"),params:Ms}),Ls=Mn.extend({[os]:kt}),Ds=Ae.extend({_meta:Ls}),Us=Je.extend({uri:d()}),Fs=He.extend({method:j("notifications/resources/updated"),params:Us}),Zs=I({name:d(),description:ne(d()),required:ne(Q())}),Vs=I({...pt.shape,...Ot.shape,description:ne(d()),arguments:ne(A(Zs)),_meta:ne(ce({}))}),Js=Ct.extend({method:j("prompts/list")}),Hs=Nt.extend({prompts:A(Vs)}),Ks=Le.extend({name:d(),arguments:Y(d(),d()).optional()}),Bs=Ie.extend({method:j("prompts/get"),params:Ks}),Or=I({type:j("text"),text:d(),annotations:ht.optional(),_meta:Y(d(),ie()).optional()}),Cr=I({type:j("image"),data:$c,mimeType:d(),annotations:ht.optional(),_meta:Y(d(),ie()).optional()}),Nr=I({type:j("audio"),data:$c,mimeType:d(),annotations:ht.optional(),_meta:Y(d(),ie()).optional()}),Ys=I({type:j("tool_use"),name:d(),id:d(),input:Y(d(),ie()),_meta:Y(d(),ie()).optional()}),Gs=I({type:j("resource"),resource:W([Hn,Kn]),annotations:ht.optional(),_meta:Y(d(),ie()).optional()}),Qs=Bn.extend({type:j("resource_link")}),xr=W([Or,Cr,Nr,Qs,Gs]),Ws=I({role:xt,content:xr}),Xs=Ae.extend({description:d().optional(),messages:A(Ws)}),ei=He.extend({method:j("notifications/prompts/list_changed"),params:Je.optional()}),ti=I({title:d().optional(),readOnlyHint:Q().optional(),destructiveHint:Q().optional(),idempotentHint:Q().optional(),openWorldHint:Q().optional()}),ri=I({taskSupport:de(["required","optional","forbidden"]).optional()}),Gn=I({...pt.shape,...Ot.shape,description:d().optional(),inputSchema:I({type:j("object"),properties:Y(d(),Et).optional(),required:A(d()).optional()}).catchall(ie()),outputSchema:ce({$schema:d().optional()}).optional(),annotations:ti.optional(),execution:ri.optional(),_meta:Y(d(),ie()).optional()}),ni=Ct.extend({method:j("tools/list")}),oi=Nt.extend({tools:A(Gn)}),Qn=Ae.extend({content:A(xr).default([]),structuredContent:ie().optional(),isError:Q().optional()}),Ec=Qn.or(Ae.extend({toolResult:ie()})),si=tr.extend({name:d(),arguments:Y(d(),ie()).optional()}),ii=Ie.extend({method:j("tools/call"),params:si}),ai=He.extend({method:j("notifications/tools/list_changed"),params:Je.optional()}),Tc=I({autoRefresh:Q().default(!0),debounceMs:J().int().nonnegative().default(300)}),It=de(["debug","info","notice","warning","error","critical","alert","emergency"]),ci=Le.extend({level:It}),ui=Ie.extend({method:j("logging/setLevel"),params:ci}),li=Je.extend({level:It,logger:d().optional(),data:ie()}),di=He.extend({method:j("notifications/message"),params:li}),mi=I({name:d().optional()}),pi=I({hints:A(mi).optional(),costPriority:J().min(0).max(1).optional(),speedPriority:J().min(0).max(1).optional(),intelligencePriority:J().min(0).max(1).optional()}),hi=I({mode:de(["auto","required","none"]).optional()}),fi=I({type:j("tool_result"),toolUseId:d().describe("The unique identifier for the corresponding tool call."),content:A(xr),structuredContent:ie().optional(),isError:Q().optional(),_meta:Y(d(),ie()).optional()}),gi=Rr("type",[Or,Cr,Nr]),Xt=Rr("type",[Or,Cr,Nr,Ys,fi]),_i=I({role:xt,content:W([Xt,A(Xt)]),_meta:Y(d(),ie()).optional()}),Si=tr.extend({messages:A(_i),modelPreferences:pi.optional(),systemPrompt:d().optional(),includeContext:de(["none","thisServer","allServers"]).optional(),temperature:J().optional(),maxTokens:J().int(),stopSequences:A(d()).optional(),metadata:xe.optional(),tools:A(Gn).optional(),toolChoice:hi.optional()}),yi=Ie.extend({method:j("sampling/createMessage"),params:Si}),vi=Ae.extend({model:d(),stopReason:ne(de(["endTurn","stopSequence","maxTokens"]).or(d())),role:xt,content:gi}),bi=Ae.extend({model:d(),stopReason:ne(de(["endTurn","stopSequence","maxTokens","toolUse"]).or(d())),role:xt,content:W([Xt,A(Xt)])}),Wn=I({type:j("boolean"),title:d().optional(),description:d().optional(),default:Q().optional()}),Ir=I({type:j("string"),title:d().optional(),description:d().optional(),minLength:J().optional(),maxLength:J().optional(),format:de(["email","uri","date","date-time"]).optional(),default:d().optional()}),Ar=I({type:de(["number","integer"]),title:d().optional(),description:d().optional(),minimum:J().optional(),maximum:J().optional(),default:J().optional()}),Xn=I({type:j("string"),title:d().optional(),description:d().optional(),enum:A(d()),default:d().optional()}),eo=I({type:j("string"),title:d().optional(),description:d().optional(),oneOf:A(I({const:d(),title:d()})),default:d().optional()}),to=I({type:j("string"),title:d().optional(),description:d().optional(),enum:A(d()),enumNames:A(d()).optional(),default:d().optional()}),Ri=W([Xn,eo]),ro=I({type:j("array"),title:d().optional(),description:d().optional(),minItems:J().optional(),maxItems:J().optional(),items:I({type:j("string"),enum:A(d())}),default:A(d()).optional()}),no=I({type:j("array"),title:d().optional(),description:d().optional(),minItems:J().optional(),maxItems:J().optional(),items:I({anyOf:A(I({const:d(),title:d()}))}),default:A(d()).optional()}),zi=W([ro,no]),wi=W([to,Ri,zi]),oo=W([wi,Wn,Ir,Ar]),jr=tr.extend({mode:j("form").optional(),message:d(),requestedSchema:I({type:j("object"),properties:Y(d(),oo),required:A(d()).optional()}).catchall(ie())}),$i=tr.extend({mode:j("url"),message:d(),elicitationId:d(),url:d().url()}),Ei=W([jr,$i]),Ti=Ie.extend({method:j("elicitation/create"),params:Ei}),Pi=Je.extend({elicitationId:d()}),ki=He.extend({method:j("notifications/elicitation/complete"),params:Pi}),Oi=Ae.extend({action:de(["accept","decline","cancel"]),content:Wt((e)=>e===null?void 0:e,Y(d(),W([d(),J(),Q(),A(d())])).optional())}),Ci=I({type:j("ref/resource"),uri:d()}),Ni=I({type:j("ref/prompt"),name:d()}),xi=Le.extend({ref:W([Ni,Ci]),argument:I({name:d(),value:d()}),context:I({arguments:Y(d(),d()).optional()}).optional()}),Ii=Ie.extend({method:j("completion/complete"),params:xi}),Ai=Ae.extend({completion:ce({values:A(d()).max(100),total:ne(J().int()),hasMore:ne(Q())})}),ji=I({uri:d().startsWith("file://"),name:d().optional(),_meta:Y(d(),ie()).optional()}),Mi=Ie.extend({method:j("roots/list"),params:Le.optional()}),qi=Ae.extend({roots:A(ji)}),Li=He.extend({method:j("notifications/roots/list_changed"),params:Je.optional()}),Pc=ce({ttl:J().optional(),pollInterval:J().optional()}),Di=de(["working","input_required","completed","failed","cancelled"]),At=I({taskId:d(),status:Di,ttl:W([J(),Qt()]),createdAt:d(),lastUpdatedAt:d(),pollInterval:ne(J()),statusMessage:ne(d())}),kc=Ae.extend({task:At}),Ui=Je.merge(At),Oc=He.extend({method:j("notifications/tasks/status"),params:Ui}),Cc=Ie.extend({method:j("tasks/get"),params:Le.extend({taskId:d()})}),Nc=Ae.merge(At),xc=Ie.extend({method:j("tasks/result"),params:Le.extend({taskId:d()})}),Ic=Ae.loose(),Ac=Ct.extend({method:j("tasks/list")}),jc=Nt.extend({tasks:A(At)}),Mc=Ie.extend({method:j("tasks/cancel"),params:Le.extend({taskId:d()})}),qc=Ae.merge(At),Lc=W([Zn,hs,_s,Ii,ui,Bs,Js,zs,$s,Ps,Ns,Is,js,ii,ni]),Dc=W([Un,Vn,gs,Li]),Uc=W([Dn,vi,bi,Oi,qi]),Fc=W([Zn,yi,Ti,Mi]),Zc=W([Un,Vn,di,Fs,Os,ai,ei,qs,ki]),Vc=W([Dn,fs,Ss,Ai,Xs,Hs,ws,Es,ks,Qn,oi,Ds]),qe=rs().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Hp.custom,message:"URL must be parseable",fatal:!0}),ma}).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"}),Jc=ce({resource:d().url(),authorization_servers:A(qe).optional(),jwks_uri:d().url().optional(),scopes_supported:A(d()).optional(),bearer_methods_supported:A(d()).optional(),resource_signing_alg_values_supported:A(d()).optional(),resource_name:d().optional(),resource_documentation:d().optional(),resource_policy_uri:d().url().optional(),resource_tos_uri:d().url().optional(),tls_client_certificate_bound_access_tokens:Q().optional(),authorization_details_types_supported:A(d()).optional(),dpop_signing_alg_values_supported:A(d()).optional(),dpop_bound_access_tokens_required:Q().optional()}),Fi=ce({issuer:d(),authorization_endpoint:qe,token_endpoint:qe,registration_endpoint:qe.optional(),scopes_supported:A(d()).optional(),response_types_supported:A(d()),response_modes_supported:A(d()).optional(),grant_types_supported:A(d()).optional(),token_endpoint_auth_methods_supported:A(d()).optional(),token_endpoint_auth_signing_alg_values_supported:A(d()).optional(),service_documentation:qe.optional(),revocation_endpoint:qe.optional(),revocation_endpoint_auth_methods_supported:A(d()).optional(),revocation_endpoint_auth_signing_alg_values_supported:A(d()).optional(),introspection_endpoint:d().optional(),introspection_endpoint_auth_methods_supported:A(d()).optional(),introspection_endpoint_auth_signing_alg_values_supported:A(d()).optional(),code_challenge_methods_supported:A(d()).optional(),client_id_metadata_document_supported:Q().optional(),authorization_response_iss_parameter_supported:Q().optional().catch(void 0)}),Zi=ce({issuer:d(),authorization_endpoint:qe,token_endpoint:qe,userinfo_endpoint:qe.optional(),jwks_uri:qe,registration_endpoint:qe.optional(),scopes_supported:A(d()).optional(),response_types_supported:A(d()),response_modes_supported:A(d()).optional(),grant_types_supported:A(d()).optional(),acr_values_supported:A(d()).optional(),subject_types_supported:A(d()),id_token_signing_alg_values_supported:A(d()),id_token_encryption_alg_values_supported:A(d()).optional(),id_token_encryption_enc_values_supported:A(d()).optional(),userinfo_signing_alg_values_supported:A(d()).optional(),userinfo_encryption_alg_values_supported:A(d()).optional(),userinfo_encryption_enc_values_supported:A(d()).optional(),request_object_signing_alg_values_supported:A(d()).optional(),request_object_encryption_alg_values_supported:A(d()).optional(),request_object_encryption_enc_values_supported:A(d()).optional(),token_endpoint_auth_methods_supported:A(d()).optional(),token_endpoint_auth_signing_alg_values_supported:A(d()).optional(),display_values_supported:A(d()).optional(),claim_types_supported:A(d()).optional(),claims_supported:A(d()).optional(),service_documentation:d().optional(),claims_locales_supported:A(d()).optional(),ui_locales_supported:A(d()).optional(),claims_parameter_supported:Q().optional(),request_parameter_supported:Q().optional(),request_uri_parameter_supported:Q().optional(),require_request_uri_registration:Q().optional(),op_policy_uri:qe.optional(),op_tos_uri:qe.optional(),client_id_metadata_document_supported:Q().optional(),authorization_response_iss_parameter_supported:Q().optional().catch(void 0)}),Hc=I({...Zi.shape,...Fi.pick({code_challenge_methods_supported:!0}).shape}),Kc=I({access_token:d(),id_token:d().optional(),token_type:d(),expires_in:E_().optional(),scope:d().optional(),refresh_token:d().optional()}).strip(),Bc=I({issued_token_type:j("urn:ietf:params:oauth:token-type:id-jag"),access_token:d(),token_type:d().optional(),expires_in:J().optional(),scope:d().optional()}).strip(),Yc=I({error:d(),error_description:d().optional(),error_uri:d().optional()}),vc=qe.optional().or(j("").transform(()=>{return})),Vi=I({redirect_uris:A(qe),token_endpoint_auth_method:d().optional(),grant_types:A(d()).optional(),response_types:A(d()).optional(),application_type:d().optional(),client_name:d().optional(),client_uri:qe.optional(),logo_uri:vc,scope:d().optional(),contacts:A(d()).optional(),tos_uri:vc,policy_uri:d().optional(),jwks_uri:qe.optional(),jwks:qp().optional(),software_id:d().optional(),software_version:d().optional(),software_statement:d().optional()}).strip(),Ji=I({client_id:d(),client_secret:d().optional(),client_id_issued_at:J().optional(),client_secret_expires_at:J().optional()}).strip(),Gc=Vi.merge(Ji),Qc=I({error:d(),error_description:d().optional()}).strip(),Wc=I({token:d(),token_type_hint:d().optional()}).strip();var ru=Symbol.for("mcp.sdk.errorBrands");function cu(e,t){let r=new Set,n=t;while(typeof n==="function"){let o=n.mcpBrand;if(Object.prototype.hasOwnProperty.call(n,"mcpBrand")&&typeof o==="string")r.add(o);n=Object.getPrototypeOf(n)}if(r.size===0)return;Object.defineProperty(e,ru,{value:r,enumerable:!1,configurable:!0})}function qr(e,t){try{if(typeof t==="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(t,ru)){let r=t[ru];if(r&&typeof r.has==="function"&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var h0=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return qr(this,t)}static isInstance(t){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 qr(this,t)}constructor(t,r,n){super(r);this.code=t,this.errorUri=n,this.name="OAuthError",cu(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};if(this.errorUri)t.error_uri=this.errorUri;return t}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}},ge=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}({}),pe=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return qr(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 qr(this,e)}constructor(e,t,r){super(t);this.code=e,this.data=r,this.name="SdkError",cu(this,new.target)}},f0=class extends pe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r){super(e,t,r);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};function Bp(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function L_(e,t,r){return e==="elicitation"&&t==="form"&&r.form===void 0&&r.url===void 0}function sh(e){switch(e.method){case"elicitation/create":if(e.params?.mode==="url")return{elicitation:{url:{}}};return{elicitation:{form:{}}};case"sampling/createMessage":{let t=e.params;if(t!==void 0&&(t.tools!==void 0||t.toolChoice!==void 0))return{sampling:{tools:{}}};return{sampling:{}}}case"roots/list":return{roots:{}};default:return}}function uu(e,t){let r={};for(let[n,o]of Object.entries(e)){if(o===void 0)continue;let i=t===void 0?void 0:t[n];if(i===void 0){r[n]=o;continue}if(Bp(o)&&Bp(i)){let a={};for(let[s,c]of Object.entries(o))if(c!==void 0&&i[s]===void 0&&!L_(n,s,i))a[s]=c;if(Object.keys(a).length>0)r[n]=a}}return Object.keys(r).length>0?r:void 0}var D_="2026-07-28";function lo(e){return e>=D_}function ih(e){return e.filter((t)=>!lo(t))}function lu(e){return e.filter((t)=>lo(t))}function ah(e){let t=e.structuredContent;if(t===void 0)return e;if(!(typeof t!=="object"||t===null||Array.isArray(t)))return e;if(e.content?.some((r)=>r.type==="text")??!1)return e;return{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var ch=["task","inputRequests","requestState"];function du(e){if(e===null||typeof e!=="object"||Array.isArray(e)||e.content!==void 0||ch.some((t)=>(t in e)))return e;return{...e,content:[]}}function U_(){let e=Nn(()=>W([d(),J(),Q(),Qt(),Y(d(),e),A(e)])),t=Y(d(),e),r=W([d(),J().int()]),n=d(),o=I({ttl:J().optional()}),i=I({taskId:d()}),a=ce({progressToken:r.optional(),"io.modelcontextprotocol/related-task":i.optional()}),s=I({_meta:a.optional()}),c=s.extend({task:o.optional()}),u=I({method:d(),params:s.loose().optional()}),f=I({_meta:a.optional()}),_=I({method:d(),params:f.loose().optional()}),E=ce({_meta:a.optional()}),P=W([d(),J().int()]),v=E.strict(),w=f.extend({requestId:P.optional(),reason:d().optional()}),m=_.extend({method:j("notifications/cancelled"),params:w}),g=I({src:d(),mimeType:d().optional(),sizes:A(d()).optional(),theme:de(["light","dark"]).optional()}),z=I({icons:A(g).optional()}),S=I({name:d(),title:d().optional()}),b=S.extend({...S.shape,...z.shape,version:d(),websiteUrl:d().optional(),description:d().optional()}),O=mt(I({applyDefaults:Q().optional()}),t),R=Wt((Ve)=>{if(Ve&&typeof Ve==="object"&&!Array.isArray(Ve)&&Object.keys(Ve).length===0)return{form:{}};return Ve},mt(I({form:O.optional(),url:t.optional()}),t.optional())),y=ce({list:t.optional(),cancel:t.optional(),requests:ce({sampling:ce({createMessage:t.optional()}).optional(),elicitation:ce({create:t.optional()}).optional()}).optional()}),N=ce({list:t.optional(),cancel:t.optional(),requests:ce({tools:ce({call:t.optional()}).optional()}).optional()}),q=I({experimental:Y(d(),t).optional(),sampling:I({context:t.optional(),tools:t.optional()}).optional(),elicitation:R.optional(),roots:I({listChanged:Q().optional()}).optional(),tasks:y.optional(),extensions:Y(d(),t).optional()}),H=s.extend({protocolVersion:d(),capabilities:q,clientInfo:b}),L=u.extend({method:j("initialize"),params:H}),Z=I({experimental:Y(d(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:I({listChanged:Q().optional()}).optional(),resources:I({subscribe:Q().optional(),listChanged:Q().optional()}).optional(),tools:I({listChanged:Q().optional()}).optional(),tasks:N.optional(),extensions:Y(d(),t).optional()}),G=E.extend({protocolVersion:d(),capabilities:Z,serverInfo:b,instructions:d().optional()}),B=_.extend({method:j("notifications/initialized"),params:f.optional()}),he=u.extend({method:j("ping"),params:s.optional()}),be=I({progress:J(),total:ne(J()),message:ne(d())}),ve=I({...f.shape,...be.shape,progressToken:r}),ke=_.extend({method:j("notifications/progress"),params:ve}),fe=s.extend({cursor:n.optional()}),l=u.extend({params:fe.optional()}),h=E.extend({nextCursor:n.optional()}),k=I({uri:d(),mimeType:ne(d()),_meta:Y(d(),ie()).optional()}),p=k.extend({text:d()}),T=d().refine((Ve)=>{try{return atob(Ve),!0}catch{return!1}},{message:"Invalid Base64 string"}),x=k.extend({blob:T}),F=de(["user","assistant"]),K=I({audience:A(F).optional(),priority:J().min(0).max(1).optional(),lastModified:br({offset:!0}).optional()}),X=I({...S.shape,...z.shape,uri:d(),description:ne(d()),mimeType:ne(d()),size:ne(J()),annotations:K.optional(),_meta:ne(ce({}))}),te=I({...S.shape,...z.shape,uriTemplate:d(),description:ne(d()),mimeType:ne(d()),annotations:K.optional(),_meta:ne(ce({}))}),le=l.extend({method:j("resources/list")}),se=h.extend({resources:A(X)}),C=l.extend({method:j("resources/templates/list")}),M=h.extend({resourceTemplates:A(te)}),U=s.extend({uri:d()}),ee=U,ae=u.extend({method:j("resources/read"),params:ee}),ue=E.extend({contents:A(W([p,x]))}),Ee=_.extend({method:j("notifications/resources/list_changed"),params:f.optional()}),Ce=U,Me=u.extend({method:j("resources/subscribe"),params:Ce}),Oe=U,Re=u.extend({method:j("resources/unsubscribe"),params:Oe}),De=f.extend({uri:d()}),Ne=_.extend({method:j("notifications/resources/updated"),params:De}),rt=I({name:d(),description:ne(d()),required:ne(Q())}),Ye=I({...S.shape,...z.shape,description:ne(d()),arguments:ne(A(rt)),_meta:ne(ce({}))}),Ue=l.extend({method:j("prompts/list")}),gt=h.extend({prompts:A(Ye)}),_t=s.extend({name:d(),arguments:Y(d(),d()).optional()}),Mt=u.extend({method:j("prompts/get"),params:_t}),qt=I({type:j("text"),text:d(),annotations:K.optional(),_meta:Y(d(),ie()).optional()}),Lt=I({type:j("image"),data:T,mimeType:d(),annotations:K.optional(),_meta:Y(d(),ie()).optional()}),Dt=I({type:j("audio"),data:T,mimeType:d(),annotations:K.optional(),_meta:Y(d(),ie()).optional()}),Vr=I({type:j("tool_use"),name:d(),id:d(),input:Y(d(),ie()),_meta:Y(d(),ie()).optional()}),St=I({type:j("resource"),resource:W([p,x]),annotations:K.optional(),_meta:Y(d(),ie()).optional()}),Jr=X.extend({type:j("resource_link")}),nt=W([qt,Lt,Dt,Jr,St]),ir=I({role:F,content:nt}),ar=E.extend({description:d().optional(),messages:A(ir)}),Ut=_.extend({method:j("notifications/prompts/list_changed"),params:f.optional()}),Hr=I({title:d().optional(),readOnlyHint:Q().optional(),destructiveHint:Q().optional(),idempotentHint:Q().optional(),openWorldHint:Q().optional()}),cr=I({taskSupport:de(["required","optional","forbidden"]).optional()}),Ft=I({...S.shape,...z.shape,description:d().optional(),inputSchema:I({type:j("object"),properties:Y(d(),e).optional(),required:A(d()).optional()}).catchall(ie()),outputSchema:I({type:j("object"),properties:Y(d(),e).optional(),required:A(d()).optional()}).catchall(ie()).optional(),annotations:Hr.optional(),execution:cr.optional(),_meta:Y(d(),ie()).optional()}),ur=l.extend({method:j("tools/list")}),lr=h.extend({tools:A(Ft)}),dr=E.extend({content:A(nt),structuredContent:Y(d(),ie()).optional(),isError:Q().optional()}),Ze=c.extend({name:d(),arguments:Y(d(),ie()).optional()}),Kr=u.extend({method:j("tools/call"),params:Ze}),go=_.extend({method:j("notifications/tools/list_changed"),params:f.optional()}),mr=de(["debug","info","notice","warning","error","critical","alert","emergency"]),Br=s.extend({level:mr}),Yr=u.extend({method:j("logging/setLevel"),params:Br}),Gr=f.extend({level:mr,logger:d().optional(),data:ie()}),Qr=_.extend({method:j("notifications/message"),params:Gr}),Wr=I({name:d().optional()}),Xr=I({hints:A(Wr).optional(),costPriority:J().min(0).max(1).optional(),speedPriority:J().min(0).max(1).optional(),intelligencePriority:J().min(0).max(1).optional()}),en=I({mode:de(["auto","required","none"]).optional()}),_o=I({type:j("tool_result"),toolUseId:d().describe("The unique identifier for the corresponding tool call."),content:A(nt),structuredContent:I({}).loose().optional(),isError:Q().optional(),_meta:Y(d(),ie()).optional()}),tn=Rr("type",[qt,Lt,Dt]),yt=Rr("type",[qt,Lt,Dt,Vr,_o]),rn=I({role:F,content:W([yt,A(yt)]),_meta:Y(d(),ie()).optional()}),nn=c.extend({messages:A(rn),modelPreferences:Xr.optional(),systemPrompt:d().optional(),includeContext:de(["none","thisServer","allServers"]).optional(),temperature:J().optional(),maxTokens:J().int(),stopSequences:A(d()).optional(),metadata:t.optional(),tools:A(Ft).optional(),toolChoice:en.optional()}),on=u.extend({method:j("sampling/createMessage"),params:nn}),sn=E.extend({model:d(),stopReason:ne(de(["endTurn","stopSequence","maxTokens"]).or(d())),role:F,content:tn}),an=E.extend({model:d(),stopReason:ne(de(["endTurn","stopSequence","maxTokens","toolUse"]).or(d())),role:F,content:W([yt,A(yt)])}),cn=I({type:j("boolean"),title:d().optional(),description:d().optional(),default:Q().optional()}),un=I({type:j("string"),title:d().optional(),description:d().optional(),minLength:J().optional(),maxLength:J().optional(),format:de(["email","uri","date","date-time"]).optional(),default:d().optional()}),ln=I({type:de(["number","integer"]),title:d().optional(),description:d().optional(),minimum:J().optional(),maximum:J().optional(),default:J().optional()}),dn=I({type:j("string"),title:d().optional(),description:d().optional(),enum:A(d()),default:d().optional()}),mn=I({type:j("string"),title:d().optional(),description:d().optional(),oneOf:A(I({const:d(),title:d()})),default:d().optional()}),pn=I({type:j("string"),title:d().optional(),description:d().optional(),enum:A(d()),enumNames:A(d()).optional(),default:d().optional()}),hn=W([dn,mn]),Zt=I({type:j("array"),title:d().optional(),description:d().optional(),minItems:J().optional(),maxItems:J().optional(),items:I({type:j("string"),enum:A(d())}),default:A(d()).optional()}),Vt=I({type:j("array"),title:d().optional(),description:d().optional(),minItems:J().optional(),maxItems:J().optional(),items:I({anyOf:A(I({const:d(),title:d()}))}),default:A(d()).optional()}),So=W([Zt,Vt]),yo=W([pn,hn,So]),Xe=W([yo,cn,un,ln]),et=c.extend({mode:j("form").optional(),message:d(),requestedSchema:I({type:j("object"),properties:Y(d(),Xe),required:A(d()).optional()}).catchall(ie())}),fn=c.extend({mode:j("url"),message:d(),elicitationId:d(),url:d().url()}),ot=W([et,fn]),vo=u.extend({method:j("elicitation/create"),params:ot}),bo=f.extend({elicitationId:d()}),Ro=_.extend({method:j("notifications/elicitation/complete"),params:bo}),zo=E.extend({action:de(["accept","decline","cancel"]),content:Wt((Ve)=>Ve===null?void 0:Ve,Y(d(),W([d(),J(),Q(),A(d())])).optional())}),wo=I({type:j("ref/resource"),uri:d()}),$o=I({type:j("ref/prompt"),name:d()}),Eo=s.extend({ref:W([$o,wo]),argument:I({name:d(),value:d()}),context:I({arguments:Y(d(),d()).optional()}).optional()}),gn=u.extend({method:j("completion/complete"),params:Eo}),To=E.extend({completion:ce({values:A(d()).max(100),total:ne(J().int()),hasMore:ne(Q())})}),Po=I({uri:d().startsWith("file://"),name:d().optional(),_meta:Y(d(),ie()).optional()}),pr=u.extend({method:j("roots/list"),params:s.optional()}),_n=E.extend({roots:A(Po)}),ko=_.extend({method:j("notifications/roots/list_changed"),params:f.optional()}),Oo=ce({ttl:J().optional(),pollInterval:J().optional()}),Co=de(["working","input_required","completed","failed","cancelled"]),vt=I({taskId:d(),status:Co,ttl:W([J(),Qt()]),createdAt:d(),lastUpdatedAt:d(),pollInterval:ne(J()),statusMessage:ne(d())}),Ge=E.extend({task:vt}),No=f.merge(vt),Jt=_.extend({method:j("notifications/tasks/status"),params:No}),hr=u.extend({method:j("tasks/get"),params:s.extend({taskId:d()})}),fr=E.merge(vt),gr=u.extend({method:j("tasks/result"),params:s.extend({taskId:d()})}),ua=E.loose(),Qe=l.extend({method:j("tasks/list")}),je=h.extend({tasks:A(vt)}),Ht=u.extend({method:j("tasks/cancel"),params:s.extend({taskId:d()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:n,TaskMetadataSchema:o,RelatedTaskMetadataSchema:i,RequestMetaSchema:a,BaseRequestParamsSchema:s,TaskAugmentedRequestParamsSchema:c,RequestSchema:u,NotificationsParamsSchema:f,NotificationSchema:_,ResultSchema:E,RequestIdSchema:P,EmptyResultSchema:v,CancelledNotificationParamsSchema:w,CancelledNotificationSchema:m,IconSchema:g,IconsSchema:z,BaseMetadataSchema:S,ImplementationSchema:b,ClientTasksCapabilitySchema:y,ServerTasksCapabilitySchema:N,ClientCapabilitiesSchema:q,InitializeRequestParamsSchema:H,InitializeRequestSchema:L,ServerCapabilitiesSchema:Z,InitializeResultSchema:G,InitializedNotificationSchema:B,PingRequestSchema:he,ProgressSchema:be,ProgressNotificationParamsSchema:ve,ProgressNotificationSchema:ke,PaginatedRequestParamsSchema:fe,PaginatedRequestSchema:l,PaginatedResultSchema:h,ResourceContentsSchema:k,TextResourceContentsSchema:p,BlobResourceContentsSchema:x,RoleSchema:F,AnnotationsSchema:K,ResourceSchema:X,ResourceTemplateSchema:te,ListResourcesRequestSchema:le,ListResourcesResultSchema:se,ListResourceTemplatesRequestSchema:C,ListResourceTemplatesResultSchema:M,ResourceRequestParamsSchema:U,ReadResourceRequestParamsSchema:ee,ReadResourceRequestSchema:ae,ReadResourceResultSchema:ue,ResourceListChangedNotificationSchema:Ee,SubscribeRequestParamsSchema:Ce,SubscribeRequestSchema:Me,UnsubscribeRequestParamsSchema:Oe,UnsubscribeRequestSchema:Re,ResourceUpdatedNotificationParamsSchema:De,ResourceUpdatedNotificationSchema:Ne,PromptArgumentSchema:rt,PromptSchema:Ye,ListPromptsRequestSchema:Ue,ListPromptsResultSchema:gt,GetPromptRequestParamsSchema:_t,GetPromptRequestSchema:Mt,TextContentSchema:qt,ImageContentSchema:Lt,AudioContentSchema:Dt,ToolUseContentSchema:Vr,EmbeddedResourceSchema:St,ResourceLinkSchema:Jr,ContentBlockSchema:nt,PromptMessageSchema:ir,GetPromptResultSchema:ar,PromptListChangedNotificationSchema:Ut,ToolAnnotationsSchema:Hr,ToolExecutionSchema:cr,ToolSchema:Ft,ListToolsRequestSchema:ur,ListToolsResultSchema:lr,CallToolResultSchema:dr,CallToolRequestParamsSchema:Ze,CallToolRequestSchema:Kr,ToolListChangedNotificationSchema:go,LoggingLevelSchema:mr,SetLevelRequestParamsSchema:Br,SetLevelRequestSchema:Yr,LoggingMessageNotificationParamsSchema:Gr,LoggingMessageNotificationSchema:Qr,ModelHintSchema:Wr,ModelPreferencesSchema:Xr,ToolChoiceSchema:en,ToolResultContentSchema:_o,SamplingContentSchema:tn,SamplingMessageContentBlockSchema:yt,SamplingMessageSchema:rn,CreateMessageRequestParamsSchema:nn,CreateMessageRequestSchema:on,CreateMessageResultSchema:sn,CreateMessageResultWithToolsSchema:an,BooleanSchemaSchema:cn,StringSchemaSchema:un,NumberSchemaSchema:ln,UntitledSingleSelectEnumSchemaSchema:dn,TitledSingleSelectEnumSchemaSchema:mn,LegacyTitledEnumSchemaSchema:pn,SingleSelectEnumSchemaSchema:hn,UntitledMultiSelectEnumSchemaSchema:Zt,TitledMultiSelectEnumSchemaSchema:Vt,MultiSelectEnumSchemaSchema:So,EnumSchemaSchema:yo,PrimitiveSchemaDefinitionSchema:Xe,ElicitRequestFormParamsSchema:et,ElicitRequestURLParamsSchema:fn,ElicitRequestParamsSchema:ot,ElicitRequestSchema:vo,ElicitationCompleteNotificationParamsSchema:bo,ElicitationCompleteNotificationSchema:Ro,ElicitResultSchema:zo,ResourceTemplateReferenceSchema:wo,PromptReferenceSchema:$o,CompleteRequestParamsSchema:Eo,CompleteRequestSchema:gn,CompleteResultSchema:To,RootSchema:Po,ListRootsRequestSchema:pr,ListRootsResultSchema:_n,RootsListChangedNotificationSchema:ko,TaskCreationParamsSchema:Oo,TaskStatusSchema:Co,TaskSchema:vt,CreateTaskResultSchema:Ge,TaskStatusNotificationParamsSchema:No,TaskStatusNotificationSchema:Jt,GetTaskRequestSchema:hr,GetTaskResultSchema:fr,GetTaskPayloadRequestSchema:gr,GetTaskPayloadResultSchema:ua,ListTasksRequestSchema:Qe,ListTasksResultSchema:je,CancelTaskRequestSchema:Ht,CancelTaskResultSchema:E.merge(vt),ClientRequestSchema:W([he,L,gn,Yr,Mt,Ue,le,C,ae,Me,Re,Kr,ur,hr,gr,Qe,Ht]),ClientNotificationSchema:W([m,ke,B,ko,Jt]),ClientResultSchema:W([v,sn,an,zo,_n,fr,je,Ge]),ServerRequestSchema:W([he,on,vo,pr,hr,gr,Qe,Ht]),ServerNotificationSchema:W([m,ke,Qr,Ne,Ee,go,Ut,Jt,Ro]),ServerResultSchema:W([v,G,To,ar,gt,se,M,ue,dr,lr,fr,je,Ge]),CallToolResultWireSchema:ie().superRefine((Ve,Lf)=>{if(typeof Ve!=="object"||Ve===null||Array.isArray(Ve)||Ve.content!==void 0)return;for(let Hu of ch)if(Hu in Ve){Lf.addIssue({code:"custom",message:`content is required when the body carries '${Hu}' — another result family cannot default into an empty tools/call success`});return}}).transform(du).pipe(dr)}}var F_;function uh(){return F_??=U_()}function lh(e){return e.type!=="object"}var Z_=new Set(["const","enum","default","examples"]),V_=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function Yp(e){return e!==void 0&&!(typeof e==="string"&&e.startsWith("#"))}function J_(e){let t=typeof e.$schema==="string"?e.$schema:void 0;if(Yp(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let r=Gu(e.$schema)&&e.$recursiveAnchor!==!0,n=(o,i)=>{if(Array.isArray(o))return o.map((c)=>n(c,!1));if(o===null||typeof o!=="object")return o;if(!i&&Yp(o.$id))return o;let a={},s=!1;for(let[c,u]of Object.entries(o))if(i)a[c]=n(u,!1);else if((c==="$ref"||c==="$dynamicRef")&&typeof u==="string")a[c]=u==="#"?"#/properties/result":u.startsWith("#/")?`#/properties/result${u.slice(1)}`:u;else if(c==="$recursiveRef"&&u==="#"&&r)s=!0;else if(Z_.has(c))a[c]=u;else if(V_.has(c))a[c]=n(u,!0);else a[c]=n(u,!1);if(s)if("$ref"in a)a.allOf=[...Array.isArray(a.allOf)?a.allOf:[],{$ref:"#/properties/result"}];else a.$ref="#/properties/result";return a};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:n(e,!1)},required:["result"]}}var dh={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},mh={"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},H_={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},Hi;function mu(){if(Hi)return Hi;let e=uh();return Hi={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}},Hi}function ph(e){return Object.prototype.hasOwnProperty.call(dh,e)}function hh(e){return Object.prototype.hasOwnProperty.call(mh,e)}function K_(e){return Object.prototype.hasOwnProperty.call(H_,e)}function B_(e){return K_(e)?mu().resultSchemas[e]:void 0}function Y_(e){return ph(e)?mu().requestSchemas[e]:void 0}function G_(e){return hh(e)?mu().notificationSchemas[e]:void 0}var g0=Object.keys(dh),_0=Object.keys(mh);function nu(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Ki(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var Gp={ok:!1,reason:"not-in-era"};function Qp(e){return nu(e)&&nu(e.outputSchema)&&lh(e.outputSchema)}function Wp(e){return e}var pu={era:"2025-11-25",hasRequestMethod:ph,hasNotificationMethod:hh,validateRequest:(e,t)=>Ki(Y_(e),t),validateResult:(e,t)=>Ki(B_(e),t),validateNotification:(e,t)=>Ki(G_(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Gp,validateInputResponse:()=>Gp,samplingResultVariant:(e,t)=>{let r=uh();return Ki(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:(e)=>{return},validateEnvelopeMeta:(e)=>[],projectCallToolResult(e,t){let r=ah(e),n=r.structuredContent;if(n===void 0)return r;let o=typeof n!=="object"||n===null||Array.isArray(n),i=t!==void 0&&lh(t);if(!o&&!i)return r;return{...r,structuredContent:{result:n}}},decodeResult(e,t){if(nu(t)&&"resultType"in t){let r={...t};return delete r.resultType,{kind:"complete",result:Wp(r)}}return{kind:"complete",result:Wp(t)}},encodeResult(e,t){if(e!=="tools/list")return t;let r=t.tools;if(!Array.isArray(r)||!r.some((n)=>Qp(n)))return t;return{...t,tools:r.map((n)=>Qp(n)?{...n,outputSchema:J_(n.outputSchema)}:n)}},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope:(e)=>{return}};function Q_(){let e=Nn(()=>W([d(),J(),Q(),Qt(),Y(d(),e),A(e)])),t=Y(d(),e),r=W([d(),J().int()]),n=d(),o=W([d(),J().int()]),i=de(["user","assistant"]),a=de(["debug","info","notice","warning","error","critical","alert","emergency"]),s=d().refine((je)=>{try{return atob(je),!0}catch{return!1}},{message:"Invalid Base64 string"}),c=I({ttl:J().optional()}),u=I({taskId:d()}),f=ce({progressToken:r.optional(),"io.modelcontextprotocol/related-task":u.optional()}),_=I({_meta:f.optional()}),E=_.extend({task:c.optional()}),P=I({_meta:f.optional()}),v=I({method:d(),params:P.loose().optional()}),w=I({src:d(),mimeType:d().optional(),sizes:A(d()).optional(),theme:de(["light","dark"]).optional()}),m=I({icons:A(w).optional()}),g=I({name:d(),title:d().optional()}),z=g.extend({...g.shape,...m.shape,version:d(),websiteUrl:d().optional(),description:d().optional()}),S=mt(I({applyDefaults:Q().optional()}),t),b=Wt((je)=>{if(je&&typeof je==="object"&&!Array.isArray(je)&&Object.keys(je).length===0)return{form:{}};return je},mt(I({form:S.optional(),url:t.optional()}),t.optional())),O=ce({list:t.optional(),cancel:t.optional(),requests:ce({sampling:ce({createMessage:t.optional()}).optional(),elicitation:ce({create:t.optional()}).optional()}).optional()}),R=ce({list:t.optional(),cancel:t.optional(),requests:ce({tools:ce({call:t.optional()}).optional()}).optional()}),y=I({experimental:Y(d(),t).optional(),sampling:I({context:t.optional(),tools:t.optional()}).optional(),elicitation:b.optional(),roots:I({listChanged:Q().optional()}).optional(),tasks:O.optional(),extensions:Y(d(),t).optional()}),N=I({experimental:Y(d(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:I({listChanged:Q().optional()}).optional(),resources:I({subscribe:Q().optional(),listChanged:Q().optional()}).optional(),tools:I({listChanged:Q().optional()}).optional(),tasks:R.optional(),extensions:Y(d(),t).optional()}),q=I({progress:J(),total:ne(J()),message:ne(d())}),H=I({...P.shape,...q.shape,progressToken:r}),L=v.extend({method:j("notifications/progress"),params:H}),Z=P.extend({level:a,logger:d().optional(),data:ie()}),G=v.extend({method:j("notifications/message"),params:Z}),B=I({uri:d(),mimeType:ne(d()),_meta:Y(d(),ie()).optional()}),he=B.extend({text:d()}),be=B.extend({blob:s}),ve=I({audience:A(i).optional(),priority:J().min(0).max(1).optional(),lastModified:br({offset:!0}).optional()}),ke=I({...g.shape,...m.shape,uri:d(),description:ne(d()),mimeType:ne(d()),size:ne(J()),annotations:ve.optional(),_meta:ne(ce({}))}),fe=I({...g.shape,...m.shape,uriTemplate:d(),description:ne(d()),mimeType:ne(d()),annotations:ve.optional(),_meta:ne(ce({}))}),l=v.extend({method:j("notifications/resources/list_changed"),params:P.optional()}),h=P.extend({uri:d()}),k=v.extend({method:j("notifications/resources/updated"),params:h}),p=I({name:d(),description:ne(d()),required:ne(Q())}),T=I({...g.shape,...m.shape,description:ne(d()),arguments:ne(A(p)),_meta:ne(ce({}))}),x=v.extend({method:j("notifications/prompts/list_changed"),params:P.optional()}),F=I({type:j("text"),text:d(),annotations:ve.optional(),_meta:Y(d(),ie()).optional()}),K=I({type:j("image"),data:s,mimeType:d(),annotations:ve.optional(),_meta:Y(d(),ie()).optional()}),X=I({type:j("audio"),data:s,mimeType:d(),annotations:ve.optional(),_meta:Y(d(),ie()).optional()}),te=I({type:j("tool_use"),name:d(),id:d(),input:Y(d(),ie()),_meta:Y(d(),ie()).optional()}),le=I({type:j("resource"),resource:W([he,be]),annotations:ve.optional(),_meta:Y(d(),ie()).optional()}),se=ke.extend({type:j("resource_link")}),C=W([F,K,X,se,le]),M=I({role:i,content:C}),U=I({title:d().optional(),readOnlyHint:Q().optional(),destructiveHint:Q().optional(),idempotentHint:Q().optional(),openWorldHint:Q().optional()}),ee=v.extend({method:j("notifications/tools/list_changed"),params:P.optional()}),ae=I({name:d().optional()}),ue=I({hints:A(ae).optional(),costPriority:J().min(0).max(1).optional(),speedPriority:J().min(0).max(1).optional(),intelligencePriority:J().min(0).max(1).optional()}),Ee=I({mode:de(["auto","required","none"]).optional()}),Ce=I({type:j("boolean"),title:d().optional(),description:d().optional(),default:Q().optional()}),Me=I({type:j("string"),title:d().optional(),description:d().optional(),minLength:J().optional(),maxLength:J().optional(),format:de(["email","uri","date","date-time"]).optional(),default:d().optional()}),Oe=I({type:de(["number","integer"]),title:d().optional(),description:d().optional(),minimum:J().optional(),maximum:J().optional(),default:J().optional()}),Re=I({type:j("string"),title:d().optional(),description:d().optional(),enum:A(d()),default:d().optional()}),De=I({type:j("string"),title:d().optional(),description:d().optional(),oneOf:A(I({const:d(),title:d()})),default:d().optional()}),Ne=I({type:j("string"),title:d().optional(),description:d().optional(),enum:A(d()),enumNames:A(d()).optional(),default:d().optional()}),rt=W([Re,De]),Ye=I({type:j("array"),title:d().optional(),description:d().optional(),minItems:J().optional(),maxItems:J().optional(),items:I({type:j("string"),enum:A(d())}),default:A(d()).optional()}),Ue=I({type:j("array"),title:d().optional(),description:d().optional(),minItems:J().optional(),maxItems:J().optional(),items:I({anyOf:A(I({const:d(),title:d()}))}),default:A(d()).optional()}),gt=W([Ye,Ue]),_t=W([Ne,rt,gt]),Mt=W([_t,Ce,Me,Oe]),qt=E.extend({mode:j("form").optional(),message:d(),requestedSchema:I({type:j("object"),properties:Y(d(),Mt),required:A(d()).optional()}).catchall(ie())}),Lt=I({type:j("ref/resource"),uri:d()}),Dt=I({type:j("ref/prompt"),name:d()}),Vr=I({uri:d().startsWith("file://"),name:d().optional(),_meta:Y(d(),ie()).optional()}),St=y.shape,Jr=I({experimental:St.experimental,sampling:St.sampling,elicitation:St.elicitation,roots:St.roots,extensions:St.extensions}),nt=N.shape,ir=I({experimental:nt.experimental,logging:nt.logging,completions:nt.completions,prompts:nt.prompts,resources:nt.resources,tools:nt.tools,extensions:nt.extensions}),ar=ce({progressToken:r.optional(),[wr]:d(),[xn]:z.optional(),[Pt]:Jr,[er]:a.optional()}),Ut=I({...g.shape,...m.shape,description:d().optional(),inputSchema:ce({$schema:d().optional(),type:j("object")}),outputSchema:ce({$schema:d().optional()}).optional(),annotations:U.optional(),_meta:Y(d(),ie()).optional()}),Hr=I({type:j("tool_result"),toolUseId:d(),content:A(C),structuredContent:ie().optional(),isError:Q().optional(),_meta:Y(d(),ie()).optional()}),cr=W([F,K,X,te,Hr]),Ft=I({role:i,content:W([cr,A(cr)]),_meta:Y(d(),ie()).optional()}),ur=d(),lr=ce({[Tt]:z.optional().catch(void 0)}),dr=lr.optional();function Ze(je){return ce({_meta:dr,resultType:ur.default("complete"),...je})}let Kr=Ze({}),go=Ze({nextCursor:n.optional()}),mr=Ze({content:A(C),structuredContent:ie().optional(),isError:Q().optional()}),Br=Ze({ttlMs:J().int().min(0),cacheScope:de(["public","private"]),tools:A(Ut),nextCursor:n.optional()}),Yr=Ze({ttlMs:J().int().min(0),cacheScope:de(["public","private"]),prompts:A(T),nextCursor:n.optional()}),Gr=Ze({description:d().optional(),messages:A(M)}),Qr=Ze({ttlMs:J().int().min(0),cacheScope:de(["public","private"]),resources:A(ke),nextCursor:n.optional()}),Wr=Ze({ttlMs:J().int().min(0),cacheScope:de(["public","private"]),resourceTemplates:A(fe),nextCursor:n.optional()}),Xr=Ze({ttlMs:J().int().min(0),cacheScope:de(["public","private"]),contents:A(W([he,be]))}),en=Ze({completion:I({values:A(d()).max(100),total:J().int().optional(),hasMore:Q().optional()}).loose()}),_o=Ze({ttlMs:J().int().min(0),cacheScope:de(["public","private"])}),tn=Ze({ttlMs:J().int().min(0).catch(0),cacheScope:de(["public","private"]).catch("private"),supportedVersions:A(d()),capabilities:ir,instructions:d().optional()}),yt=I({messages:A(Ft),modelPreferences:ue.optional(),systemPrompt:d().optional(),includeContext:de(["none","thisServer","allServers"]).optional(),temperature:J().optional(),maxTokens:J().int(),stopSequences:A(d()).optional(),metadata:t.optional(),tools:A(Ut).optional(),toolChoice:Ee.optional()}),rn=I({method:j("sampling/createMessage"),params:yt}),nn=I({method:j("roots/list"),params:I({_meta:Y(d(),ie()).optional()}).optional()}),on=I({...Ft.shape,model:d(),stopReason:d().optional()}),sn=I({roots:A(Vr)}),an=I({action:de(["accept","decline","cancel"]),content:Y(d(),W([d(),J(),Q(),A(d())])).optional()}),cn=I({mode:j("url"),message:d(),url:d().url()}),un=W([qt,cn]),ln=I({method:j("elicitation/create"),params:un}),dn=W([rn,nn,ln]),mn=W([on,sn,an]),pn=Y(d(),dn),hn=Y(d(),mn),Zt=Ze({inputRequests:pn.optional(),requestState:d().optional()}),Vt={inputResponses:hn.optional(),requestState:d().optional()},So=I({_meta:ar,...Vt}),yo=ce({progressToken:r.optional()});function Xe(je,Ht){return I({method:j(je),params:I({_meta:ar,...Ht})})}function et(je,Ht){return I({method:j(je),params:I({_meta:yo.optional(),...Ht}).optional()})}let fn={name:d(),arguments:Y(d(),ie()).optional(),...Vt},ot={cursor:n.optional()},vo=Xe("tools/call",fn),bo=Xe("tools/list",ot),Ro=Xe("prompts/list",ot),zo=Xe("prompts/get",{name:d(),arguments:Y(d(),d()).optional(),...Vt}),wo=Xe("resources/list",ot),$o=Xe("resources/templates/list",ot),Eo=Xe("resources/read",{uri:d(),...Vt}),gn={ref:W([Dt,Lt]),argument:I({name:d(),value:d()}),context:I({arguments:Y(d(),d()).optional()}).optional()},To=Xe("completion/complete",gn),Po=Xe("server/discover",{}),pr=I({toolsListChanged:Q().optional(),promptsListChanged:Q().optional(),resourcesListChanged:Q().optional(),resourceSubscriptions:A(d()).optional()}),_n={notifications:pr},ko=Xe("subscriptions/listen",_n),Oo=lr.extend({"io.modelcontextprotocol/subscriptionId":o}),Co=ce({_meta:Oo,resultType:ur.default("complete")}),vt={"tools/call":et("tools/call",fn),"tools/list":et("tools/list",ot),"prompts/get":et("prompts/get",{name:d(),arguments:Y(d(),d()).optional()}),"prompts/list":et("prompts/list",ot),"resources/list":et("resources/list",ot),"resources/templates/list":et("resources/templates/list",ot),"resources/read":et("resources/read",{uri:d()}),"completion/complete":et("completion/complete",gn),"server/discover":et("server/discover",{}),"subscriptions/listen":et("subscriptions/listen",_n)};function Ge(je){return ce({_meta:dr,...je})}let No={"tools/call":Ge({content:A(C),structuredContent:ie().optional(),isError:Q().optional()}),"tools/list":Ge({ttlMs:J().int().min(0),cacheScope:de(["public","private"]),tools:A(Ut),nextCursor:n.optional()}),"prompts/get":Ge({description:d().optional(),messages:A(M)}),"prompts/list":Ge({ttlMs:J().int().min(0),cacheScope:de(["public","private"]),prompts:A(T),nextCursor:n.optional()}),"resources/list":Ge({ttlMs:J().int().min(0),cacheScope:de(["public","private"]),resources:A(ke),nextCursor:n.optional()}),"resources/templates/list":Ge({ttlMs:J().int().min(0),cacheScope:de(["public","private"]),resourceTemplates:A(fe),nextCursor:n.optional()}),"resources/read":Ge({ttlMs:J().int().min(0),cacheScope:de(["public","private"]),contents:A(W([he,be]))}),"completion/complete":Ge({completion:I({values:A(d()).max(100),total:J().int().optional(),hasMore:Q().optional()}).loose()}),"server/discover":Ge({ttlMs:J().int().min(0).catch(0),cacheScope:de(["public","private"]).catch("private"),supportedVersions:A(d()),capabilities:ir,instructions:d().optional()}),"subscriptions/listen":Ge({})},Jt=ce({"io.modelcontextprotocol/subscriptionId":o.optional()}),hr=I({method:j("notifications/subscriptions/acknowledged"),params:I({_meta:Jt.optional(),notifications:pr})}),fr=I({_meta:Jt.optional(),requestId:o,reason:d().optional()}),gr=I({method:j("notifications/cancelled"),params:fr}),ua={"notifications/cancelled":gr,"notifications/progress":L,"notifications/message":G,"notifications/resources/updated":k,"notifications/resources/list_changed":l,"notifications/tools/list_changed":ee,"notifications/prompts/list_changed":x,"notifications/subscriptions/acknowledged":hr},Qe=(je)=>I({jsonrpc:j("2.0"),id:W([d(),J().int()]),result:je}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:n,RequestIdSchema:o,RoleSchema:i,LoggingLevelSchema:a,TaskMetadataSchema:c,RelatedTaskMetadataSchema:u,RequestMetaSchema:f,BaseRequestParamsSchema:_,TaskAugmentedRequestParamsSchema:E,NotificationsParamsSchema:P,NotificationSchema:v,IconSchema:w,IconsSchema:m,BaseMetadataSchema:g,ImplementationSchema:z,ClientTasksCapabilitySchema:O,ServerTasksCapabilitySchema:R,ClientCapabilitiesSchema:y,ServerCapabilitiesSchema:N,ProgressSchema:q,ProgressNotificationParamsSchema:H,ProgressNotificationSchema:L,LoggingMessageNotificationParamsSchema:Z,LoggingMessageNotificationSchema:G,ResourceContentsSchema:B,TextResourceContentsSchema:he,BlobResourceContentsSchema:be,AnnotationsSchema:ve,ResourceSchema:ke,ResourceTemplateSchema:fe,ResourceListChangedNotificationSchema:l,ResourceUpdatedNotificationParamsSchema:h,ResourceUpdatedNotificationSchema:k,PromptArgumentSchema:p,PromptSchema:T,PromptListChangedNotificationSchema:x,TextContentSchema:F,ImageContentSchema:K,AudioContentSchema:X,ToolUseContentSchema:te,EmbeddedResourceSchema:le,ResourceLinkSchema:se,ContentBlockSchema:C,PromptMessageSchema:M,ToolAnnotationsSchema:U,ToolListChangedNotificationSchema:ee,ModelHintSchema:ae,ModelPreferencesSchema:ue,ToolChoiceSchema:Ee,BooleanSchemaSchema:Ce,StringSchemaSchema:Me,NumberSchemaSchema:Oe,UntitledSingleSelectEnumSchemaSchema:Re,TitledSingleSelectEnumSchemaSchema:De,LegacyTitledEnumSchemaSchema:Ne,SingleSelectEnumSchemaSchema:rt,UntitledMultiSelectEnumSchemaSchema:Ye,TitledMultiSelectEnumSchemaSchema:Ue,MultiSelectEnumSchemaSchema:gt,EnumSchemaSchema:_t,PrimitiveSchemaDefinitionSchema:Mt,ElicitRequestFormParamsSchema:qt,ResourceTemplateReferenceSchema:Lt,PromptReferenceSchema:Dt,RootSchema:Vr,ClientCapabilities2026Schema:Jr,ServerCapabilities2026Schema:ir,RequestMetaEnvelopeSchema:ar,ToolSchema:Ut,ToolResultContentSchema:Hr,SamplingMessageContentBlockSchema:cr,SamplingMessageSchema:Ft,ResultTypeSchema:ur,ResultMetaSchema:lr,ResultSchema:Kr,PaginatedResultSchema:go,CallToolResultSchema:mr,ListToolsResultSchema:Br,ListPromptsResultSchema:Yr,GetPromptResultSchema:Gr,ListResourcesResultSchema:Qr,ListResourceTemplatesResultSchema:Wr,ReadResourceResultSchema:Xr,CompleteResultSchema:en,CacheableResultSchema:_o,DiscoverResultSchema:tn,CreateMessageRequestParamsSchema:yt,CreateMessageRequestSchema:rn,ListRootsRequestSchema:nn,CreateMessageResultSchema:on,ListRootsResultSchema:sn,ElicitResultSchema:an,ElicitRequestURLParamsSchema:cn,ElicitRequestParamsSchema:un,ElicitRequestSchema:ln,InputRequestSchema:dn,InputResponseSchema:mn,InputRequestsSchema:pn,InputResponsesSchema:hn,InputRequiredResultSchema:Zt,InputResponseRequestParamsSchema:So,CallToolRequestSchema:vo,ListToolsRequestSchema:bo,ListPromptsRequestSchema:Ro,GetPromptRequestSchema:zo,ListResourcesRequestSchema:wo,ListResourceTemplatesRequestSchema:$o,ReadResourceRequestSchema:Eo,CompleteRequestSchema:To,DiscoverRequestSchema:Po,SubscriptionFilterSchema:pr,SubscriptionsListenRequestSchema:ko,SubscriptionsListenResultMetaSchema:Oo,SubscriptionsListenResultSchema:Co,dispatchRequestSchemas:vt,dispatchResultSchemas:No,NotificationMetaSchema:Jt,SubscriptionsAcknowledgedNotificationSchema:hr,CancelledNotificationParamsSchema:fr,CancelledNotificationSchema:gr,notificationSchemas2026:ua,JSONRPCResultResponseSchema:Qe(Kr),CallToolResultResponseSchema:Qe(W([mr,Zt])),ListToolsResultResponseSchema:Qe(Br),ListPromptsResultResponseSchema:Qe(Yr),GetPromptResultResponseSchema:Qe(W([Gr,Zt])),ListResourcesResultResponseSchema:Qe(Qr),ListResourceTemplatesResultResponseSchema:Qe(Wr),ReadResourceResultResponseSchema:Qe(W([Xr,Zt])),CompleteResultResponseSchema:Qe(en),DiscoverResultResponseSchema:Qe(tn)}}var W_;function rr(){return W_??=Q_()}var X_=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function eS(e){return X_.includes(e)}var Mr=Symbol("modelcontextprotocol.resultCacheHintFallback");function fh(e,t){if(t===void 0)return e;let r=e[Mr];if(r===void 0)return{...e,[Mr]:t};let n={},o=r.ttlMs??t.ttlMs;if(o!==void 0)n.ttlMs=o;let i=r.cacheScope??t.cacheScope;if(i!==void 0)n.cacheScope=i;return{...e,[Mr]:n}}function tS(e){return e[Mr]}function hu(e){return typeof e==="number"&&Number.isSafeInteger(e)&&e>=0}function fu(e){return e==="public"||e==="private"}function gh(e,t){if(e.ttlMs!==void 0&&!hu(e.ttlMs))throw RangeError(`Invalid cache hint for ${t}: ttlMs must be a non-negative safe integer (got ${String(e.ttlMs)})`);if(e.cacheScope!==void 0&&!fu(e.cacheScope))throw RangeError(`Invalid cache hint for ${t}: cacheScope must be 'public' or 'private' (got ${String(e.cacheScope)})`)}var oe=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}({}),_e=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return qr(this,t)}static isInstance(t){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 qr(this,t)}constructor(t,r,n){super(r);this.code=t,this.data=n,this.name="ProtocolError",cu(this,new.target)}static fromError(t,r,n){if(t===oe.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new rS(o.elicitations,r)}if(t===oe.UnsupportedProtocolVersion&&n){let o=n;if(Array.isArray(o.supported)&&typeof o.requested==="string")return new Sh({supported:o.supported,requested:o.requested},r)}if(t===oe.InvalidParams||t===oe.ResourceNotFound){let o=n;if(typeof o?.uri==="string"&&(t===oe.ResourceNotFound||Object.keys(o).length===1))return new _h(o.uri,r)}if(t===oe.MissingRequiredClientCapability&&n){let o=n;if(o.requiredCapabilities!==null&&typeof o.requiredCapabilities==="object"&&!Array.isArray(o.requiredCapabilities))return new gu({requiredCapabilities:o.requiredCapabilities},r)}return new e(t,r,n)}},_h=class extends _e{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(oe.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},rS=class extends _e{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(oe.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Sh=class extends _e{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(oe.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},gu=class extends _e{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(oe.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},nS=0,oS="private",sS=["tools/call","prompts/get","resources/read"];function iS(e,t){let r=t.resultType;if(r===void 0)return{...t,resultType:"complete"};if(r==="complete")return t;if(sS.includes(e))return t;throw new _e(oe.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function aS(e,t){let r=tS(t);if(t.resultType!=="complete"||!eS(e))return r===void 0?t:mS(t);let n=t,o=hu(n.ttlMs)?n.ttlMs:lS(r),i=fu(n.cacheScope)?n.cacheScope:dS(r),a={...n,ttlMs:o,cacheScope:i};return delete a[Mr],a}function cS(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function uS(e,t){if(t===void 0)return e;let r=e._meta;if(r===void 0)return{...e,_meta:{[Tt]:t}};if(!cS(r))return e;if(r[Tt]!==void 0)return e;return{...e,_meta:{...r,[Tt]:t}}}function lS(e){return e!==void 0&&hu(e.ttlMs)?e.ttlMs:nS}function dS(e){return e!==void 0&&fu(e.cacheScope)?e.cacheScope:oS}function mS(e){let t={...e};return delete t[Mr],t}var pS=["elicitation/create","sampling/createMessage","roots/list"],Bi;function yh(){if(Bi)return Bi;let e=rr();return Bi={request:{"elicitation/create":I({method:j("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":I({method:j("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":I({method:j("roots/list"),params:ce({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Bi}function vh(e){return pS.includes(e)}function Xc(e){return vh(e)?yh().request[e]:void 0}function hS(e){return vh(e)?yh().response[e]:void 0}var _u={"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},bh={"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 Rh(e){return Object.prototype.hasOwnProperty.call(_u,e)}function zh(e){return Object.prototype.hasOwnProperty.call(bh,e)}function fS(e){return Object.prototype.hasOwnProperty.call(_u,e)}function gS(e){return Rh(e)?rr().dispatchRequestSchemas[e]:void 0}function _S(e){return fS(e)?rr().dispatchResultSchemas[e]:void 0}function SS(e){return zh(e)?rr().notificationSchemas2026[e]:void 0}var S0=Object.keys(_u),y0=Object.keys(bh);function ao(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function so(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var yS={ok:!1,reason:"not-in-era"},vS=[wr,Pt];function bS(e,t){let r=t,n=!1,o=()=>{if(!n)r={...r},n=!0;return r},i=t.tools;if(e==="tools/list"&&Array.isArray(i)&&i.some((s)=>ao(s)&&("execution"in s)))o().tools=i.map((s)=>{if(!ao(s)||!("execution"in s))return s;let c={...s};return delete c.execution,c});let a=t.capabilities;if(ao(a)&&"tasks"in a){let s={...a};delete s.tasks,o().capabilities=s}return r}var Su={era:"2026-07-28",hasRequestMethod:Rh,hasNotificationMethod:zh,hasInputRequestMethod:(e)=>Xc(e)!==void 0,validateRequest:(e,t)=>so(gS(e),t),validateResult:(e,t)=>so(_S(e),t),validateNotification:(e,t)=>so(SS(e),t),validateInputRequest:(e,t)=>so(Xc(e),t),validateInputResponse:(e,t)=>so(hS(e),t),samplingResultVariant:()=>yS,outboundEnvelope(e){return{[wr]:e.protocolVersion,[xn]:e.clientInfo,[Pt]:e.clientCapabilities,...e.logLevel!==void 0&&{[er]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of vS)if(!(n in e))t.push({key:n,problem:"missing"});let r=rr().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let n of r.error.issues){let o=n.path.map(String),i=o.length>0?o.join("."):"_meta";if(o.length===1&&t.some((a)=>a.key===i&&a.problem==="missing"))continue;t.push({key:i,problem:n.message})}return t},projectCallToolResult:(e)=>ah(e),inputRequestSchema:Xc,decodeResult(e,t){if(!ao(t))return{kind:"invalid",error:new pe(ge.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(r===void 0)return{kind:"invalid",error:new pe(ge.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 r!=="string")return{kind:"invalid",error:new pe(ge.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if(r==="input_required"){let a=t.inputRequests,s=ao(a)?a:{},c=t.requestState;if(Object.keys(s).length===0&&typeof c!=="string")return{kind:"invalid",error:new pe(ge.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"})};return{kind:"input_required",inputRequests:s,...typeof c==="string"&&{requestState:c}}}if(r!=="complete")return{kind:"invalid",error:new pe(ge.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let n=RS(),o=Object.hasOwn(n,e)?n[e]:void 0;if(o!==void 0){let a=o.safeParse(t);if(!a.success)return{kind:"invalid",error:new pe(ge.InvalidResult,`Invalid result for ${e}: ${a.error}`,{method:e})}}let i={...t};return delete i.resultType,{kind:"complete",result:i}},encodeResult(e,t,r){return uS(aS(e,iS(e,bS(e,t))),r)},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=rr().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map((r)=>r.message).join("; ")}`}},Yi;function RS(){if(Yi)return Yi;let e=rr();return Yi={"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},Yi}var yu="2026-07-28";function Lr(e){return e!==void 0&&lo(e)?Su:pu}function Xp(e){if(e.revision!==void 0)return Lr(e.revision).era;return e.era==="modern"?Su.era:pu.era}function eu(e){return wh.some((t)=>t.hasRequestMethod(e))}function tu(e){return wh.some((t)=>t.hasNotificationMethod(e))}var wh=[pu,Su];var zS=Bu({AnnotationsSchema:()=>ht,AudioContentSchema:()=>Nr,BaseMetadataSchema:()=>pt,BaseRequestParamsSchema:()=>Le,BlobResourceContentsSchema:()=>Kn,BooleanSchemaSchema:()=>Wn,CallToolRequestParamsSchema:()=>si,CallToolRequestSchema:()=>ii,CallToolResultSchema:()=>Qn,CancelTaskRequestSchema:()=>Mc,CancelTaskResultSchema:()=>qc,CancelledNotificationParamsSchema:()=>cs,CancelledNotificationSchema:()=>Un,ClientCapabilitiesSchema:()=>ms,ClientNotificationSchema:()=>Dc,ClientRequestSchema:()=>Lc,ClientResultSchema:()=>Uc,ClientTasksCapabilitySchema:()=>ls,CompatibilityCallToolResultSchema:()=>Ec,CompleteRequestParamsSchema:()=>xi,CompleteRequestSchema:()=>Ii,CompleteResultSchema:()=>Ai,ContentBlockSchema:()=>xr,CreateMessageRequestParamsSchema:()=>Si,CreateMessageRequestSchema:()=>yi,CreateMessageResultSchema:()=>vi,CreateMessageResultWithToolsSchema:()=>bi,CreateTaskResultSchema:()=>kc,CursorSchema:()=>An,DiscoverRequestSchema:()=>_s,DiscoverResultSchema:()=>Ss,ElicitRequestFormParamsSchema:()=>jr,ElicitRequestParamsSchema:()=>Ei,ElicitRequestSchema:()=>Ti,ElicitRequestURLParamsSchema:()=>$i,ElicitResultSchema:()=>Oi,ElicitationCompleteNotificationParamsSchema:()=>Pi,ElicitationCompleteNotificationSchema:()=>ki,EmbeddedResourceSchema:()=>Gs,EmptyResultSchema:()=>Dn,EnumSchemaSchema:()=>wi,GetPromptRequestParamsSchema:()=>Ks,GetPromptRequestSchema:()=>Bs,GetPromptResultSchema:()=>Xs,GetTaskPayloadRequestSchema:()=>xc,GetTaskPayloadResultSchema:()=>Ic,GetTaskRequestSchema:()=>Cc,GetTaskResultSchema:()=>Nc,IconSchema:()=>us,IconsSchema:()=>Ot,ImageContentSchema:()=>Cr,ImplementationSchema:()=>Pr,InitializeRequestParamsSchema:()=>ps,InitializeRequestSchema:()=>hs,InitializeResultSchema:()=>fs,InitializedNotificationSchema:()=>gs,JSONArraySchema:()=>zc,JSONObjectSchema:()=>xe,JSONRPCErrorResponseSchema:()=>Tr,JSONRPCMessageSchema:()=>as,JSONRPCNotificationSchema:()=>Ln,JSONRPCRequestSchema:()=>qn,JSONRPCResponseSchema:()=>wc,JSONRPCResultResponseSchema:()=>Er,JSONValueSchema:()=>Et,LegacyTitledEnumSchemaSchema:()=>to,ListChangedOptionsBaseSchema:()=>Tc,ListPromptsRequestSchema:()=>Js,ListPromptsResultSchema:()=>Hs,ListResourceTemplatesRequestSchema:()=>$s,ListResourceTemplatesResultSchema:()=>Es,ListResourcesRequestSchema:()=>zs,ListResourcesResultSchema:()=>ws,ListRootsRequestSchema:()=>Mi,ListRootsResultSchema:()=>qi,ListTasksRequestSchema:()=>Ac,ListTasksResultSchema:()=>jc,ListToolsRequestSchema:()=>ni,ListToolsResultSchema:()=>oi,LoggingLevelSchema:()=>It,LoggingMessageNotificationParamsSchema:()=>li,LoggingMessageNotificationSchema:()=>di,ModelHintSchema:()=>mi,ModelPreferencesSchema:()=>pi,MultiSelectEnumSchemaSchema:()=>zi,NotificationSchema:()=>He,NotificationsParamsSchema:()=>Je,NumberSchemaSchema:()=>Ar,PaginatedRequestParamsSchema:()=>bs,PaginatedRequestSchema:()=>Ct,PaginatedResultSchema:()=>Nt,PingRequestSchema:()=>Zn,PrimitiveSchemaDefinitionSchema:()=>oo,ProgressNotificationParamsSchema:()=>vs,ProgressNotificationSchema:()=>Vn,ProgressSchema:()=>ys,ProgressTokenSchema:()=>In,PromptArgumentSchema:()=>Zs,PromptListChangedNotificationSchema:()=>ei,PromptMessageSchema:()=>Ws,PromptReferenceSchema:()=>Ni,PromptSchema:()=>Vs,ReadResourceRequestParamsSchema:()=>Ts,ReadResourceRequestSchema:()=>Ps,ReadResourceResultSchema:()=>ks,RelatedTaskMetadataSchema:()=>is,RequestIdSchema:()=>kt,RequestMetaSchema:()=>jn,RequestSchema:()=>Ie,ResourceContentsSchema:()=>Jn,ResourceLinkSchema:()=>Qs,ResourceListChangedNotificationSchema:()=>Os,ResourceRequestParamsSchema:()=>kr,ResourceSchema:()=>Bn,ResourceTemplateReferenceSchema:()=>Ci,ResourceTemplateSchema:()=>Rs,ResourceUpdatedNotificationParamsSchema:()=>Us,ResourceUpdatedNotificationSchema:()=>Fs,ResultMetaObjectSchema:()=>Mn,ResultSchema:()=>Ae,RoleSchema:()=>xt,RootSchema:()=>ji,RootsListChangedNotificationSchema:()=>Li,SamplingContentSchema:()=>gi,SamplingMessageContentBlockSchema:()=>Xt,SamplingMessageSchema:()=>_i,ServerCapabilitiesSchema:()=>Fn,ServerNotificationSchema:()=>Zc,ServerRequestSchema:()=>Fc,ServerResultSchema:()=>Vc,ServerTasksCapabilitySchema:()=>ds,SetLevelRequestParamsSchema:()=>ci,SetLevelRequestSchema:()=>ui,SingleSelectEnumSchemaSchema:()=>Ri,StringSchemaSchema:()=>Ir,SubscribeRequestParamsSchema:()=>Cs,SubscribeRequestSchema:()=>Ns,SubscriptionFilterSchema:()=>Yn,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Ms,SubscriptionsAcknowledgedNotificationSchema:()=>qs,SubscriptionsListenRequestParamsSchema:()=>As,SubscriptionsListenRequestSchema:()=>js,SubscriptionsListenResultMetaSchema:()=>Ls,SubscriptionsListenResultSchema:()=>Ds,TaskAugmentedRequestParamsSchema:()=>tr,TaskCreationParamsSchema:()=>Pc,TaskMetadataSchema:()=>ss,TaskSchema:()=>At,TaskStatusNotificationParamsSchema:()=>Ui,TaskStatusNotificationSchema:()=>Oc,TaskStatusSchema:()=>Di,TextContentSchema:()=>Or,TextResourceContentsSchema:()=>Hn,TitledMultiSelectEnumSchemaSchema:()=>no,TitledSingleSelectEnumSchemaSchema:()=>eo,ToolAnnotationsSchema:()=>ti,ToolChoiceSchema:()=>hi,ToolExecutionSchema:()=>ri,ToolListChangedNotificationSchema:()=>ai,ToolResultContentSchema:()=>fi,ToolSchema:()=>Gn,ToolUseContentSchema:()=>Ys,UnsubscribeRequestParamsSchema:()=>xs,UnsubscribeRequestSchema:()=>Is,UntitledMultiSelectEnumSchemaSchema:()=>ro,UntitledSingleSelectEnumSchemaSchema:()=>Xn});var $h=(e)=>qn.safeParse(e).success,Eh=(e)=>Ln.safeParse(e).success,ou=(e)=>Er.safeParse(e).success,Th=(e)=>Tr.safeParse(e).success;var Dr=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";var Gi=-32020,v0=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[oe.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[Gi,oe.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[oe.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope — and a missing envelope on a request whose protocol-version header names a modern revision — is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[oe.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision’s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[oe.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[Gi],conformance:["http-header-validation"],rationale:"SEP-2243 standard `Mcp-Method` / `Mcp-Name` headers — presence, sentinel decoding, and `Mcp-Name` ↔ body cross-check — are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The classifier’s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5–6) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[oe.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced — pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[Gi],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool’s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],b0={[oe.ParseError]:400,[oe.InvalidRequest]:400,[oe.MethodNotFound]:404,[oe.UnsupportedProtocolVersion]:400,[oe.MissingRequiredClientCapability]:400,[Gi]:400};function Wi(e,t){return es(e,t)}function io(e){return new Set(e.flatMap((t)=>Object.keys(t.shape)))}function su(e){if(e==null)return!1;let t=typeof e;if(t!=="object"&&t!=="function")return!1;if(!("~standard"in e))return!1;return typeof e["~standard"]?.validate==="function"}var eh=!1,iu="draft-2020-12";function Ph(e,t="input"){let r=e["~standard"],n;if(r.jsonSchema)n=r.jsonSchema[t]({target:iu});else if(r.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().");if(!eh)eh=!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.");n=Wo(e,{target:iu,io:t})}else throw Error(`Schema library "${r.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output"){if(n.type!==void 0)return n;return kh(n)?{type:"object",...n}:n}if(n.type!==void 0&&n.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(n.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...n}}function kh(e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;for(let t of["oneOf","anyOf","allOf"]){let r=e[t];if(Array.isArray(r)&&r.length>0)return r.every((n)=>n!==null&&typeof n==="object"&&(n.type==="object"||kh(n)))}return!1}function wS(e){if(!e.path?.length)return e.message;return`${e.path.map((t)=>String(typeof t==="object"?t.key:t)).join(".")}: ${e.message}`}async function Qi(e,t){let r=await e["~standard"].validate(t);if(r.issues&&r.issues.length>0)return{success:!1,error:r.issues.map((n)=>wS(n)).join(", ")};return{success:!0,data:r.value}}function $S(e){let t=Wo(e,{target:iu,io:"input"});return typeof t.pattern==="string"?t.pattern:void 0}var ES=/\\\.\\d\{(\d+)\}/;function TS(e){let t=ES.exec(e),r=[void 0,-1,0];if(t)r.push(Number(t[1]));return[!1,!0].flatMap((n)=>[!1,!0].flatMap((o)=>r.map((i)=>br({local:n,offset:o,precision:i}))))}function PS(e,t){let r;switch(e){case"email":r=[Ap()];break;case"uri":r=[rs()];break;case"date":r=[Sc()];break;case"date-time":r=TS(t);break}return new Set(r.map((n)=>$S(n)).filter((n)=>n!==void 0))}function kS(e,t,r){if(r!=="zod")return!0;return PS(e,t).has(t)}function uo(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function OS(e){try{return Ph(e,"input")}catch(t){let r=t instanceof Error?t.message:String(t);throw new _e(oe.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${r}`)}}var CS=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function vu(e){return CS.has(e)||e.startsWith("x-")}var NS=new Set(["$schema",...Object.keys(jr.shape.requestedSchema.shape)]),th={string:io([Ir,Xn,eo,to]),number:io([Ar]),integer:io([Ar]),boolean:io([Wn]),array:io([ro,no])},xS=new Set(Ir.shape.format.unwrap().options);function IS(e,t,r,n){if(!uo(e))return e;let o=typeof e.type==="string"&&Object.hasOwn(th,e.type)?th[e.type]:void 0;if(o===void 0)return e;let i={};for(let[a,s]of Object.entries(e))if(o.has(a)||vu(a))i[a]=s;else if(a==="pattern"&&e.type==="string"&&typeof e.format==="string"){if(!xS.has(e.format))i[a]=s;else if(typeof s!=="string"||!kS(e.format,s,r))n.push(`${t}.${a}`)}else n.push(`${t}.${a}`);return i}function AS(e,t){let r={},n=[];for(let[o,i]of Object.entries(e))if(o==="properties"&&uo(i))r[o]=Object.fromEntries(Object.entries(i).map(([a,s])=>[a,IS(s,`properties.${a}`,t,n)]));else if(NS.has(o))r[o]=i;else if(!vu(o))n.push(o);if(n.length>0)throw new _e(oe.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);return r}function jS(e,t){if(!uo(e.properties))return t;let r=Object.entries(e.properties).filter(([,n])=>!Wi(oo,n).success).map(([n])=>`properties.${n}`);return r.length>0?r.join(", "):t}function au(e,t,r=""){if(Array.isArray(e)&&Array.isArray(t))return e.flatMap((n,o)=>au(n,t[o],`${r}[${o}]`));if(!uo(e)||!uo(t))return[];return Object.entries(e).flatMap(([n,o])=>{let i=r?`${r}.${n}`:n;if(!Object.prototype.hasOwnProperty.call(t,n))return vu(n)?[]:[i];return au(o,t[n],i)})}function MS(e){if(!su(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,r=AS(OS(e.requestedSchema),t),n=Wi(jr.shape.requestedSchema,r);if(!n.success)throw new _e(oe.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${jS(r,n.error.message)}`);let o=au(r,n.data);if(o.length>0)throw new _e(oe.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);let i=(n.data.required??[]).filter((a)=>!Object.prototype.hasOwnProperty.call(n.data.properties,a));if(i.length>0)throw new _e(oe.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${i.join(", ")}`);return{...e,mode:"form",requestedSchema:n.data}}function qS(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,r=typeof e.requestState==="string";if(!t&&!r)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}}}var R0=Object.assign(qS,{elicit(e){try{return{method:"elicitation/create",params:MS(e)}}catch(t){throw t instanceof _e?TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});var Oh=250;function Ch(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function Nh(e,t){return new Promise((r,n)=>{if(t?.aborted){n(t.reason instanceof pe?t.reason:new pe(ge.RequestTimeout,String(t.reason)));return}let o=setTimeout(()=>{t?.removeEventListener("abort",i),r()},e),i=()=>{clearTimeout(o),n(t?.reason instanceof pe?t.reason:new pe(ge.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",i,{once:!0})})}function xh(e){let t=new AbortController,r=()=>t.abort(e?.reason);if(e?.addEventListener("abort",r,{once:!0}),e?.aborted)t.abort(e.reason);return{signal:t.signal,abort:(n)=>t.abort(n),dispose:()=>e?.removeEventListener("abort",r)}}var LS=["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"],DS={IdJagTokenExchangeResponseSchema:Bc,OAuthClientInformationFullSchema:Gc,OAuthClientInformationSchema:Ji,OAuthClientMetadataSchema:Vi,OAuthClientRegistrationErrorSchema:Qc,OAuthErrorResponseSchema:Yc,OAuthMetadataSchema:Fi,OAuthProtectedResourceMetadataSchema:Jc,OAuthTokenRevocationRequestSchema:Wc,OAuthTokensSchema:Kc,OpenIdProviderDiscoveryMetadataSchema:Hc,OpenIdProviderMetadataSchema:Zi},Ih={},Ah={};function jh(e,t){let r=e.slice(0,-6);Ih[r]=t,Ah[r]=(n)=>t.safeParse(n).success}for(let e of LS)jh(e,zS[e]);for(let[e,t]of Object.entries(DS))jh(e,t);var z0=Object.freeze(Ih),w0=Object.freeze(Ah);function US(e){switch(e){case"initialize":case"notifications/initialized":return Lr(void 0);case"server/discover":return Lr(yu);default:return}}var FS=60000,ZS=[wr,xn,Pt,er],VS=["inputResponses","requestState"];function rh(e,t){let r=e.params;if(!co(r))return{message:e,lifted:{}};let n=r._meta,o=co(n)?ZS.filter((c)=>(c in n)):[],i=t==="request"?VS.filter((c)=>(c in r)):[];if(o.length===0&&i.length===0)return{message:e,lifted:{}};let a={},s={...r};if(o.length>0&&co(n)){let c={},u={...n};for(let f of o)c[f]=n[f],delete u[f];if(a.envelope=c,Object.keys(u).length>0)s._meta=u;else delete s._meta}for(let c of i){if(c==="inputResponses")a.inputResponses=s[c];if(c==="requestState")a.requestState=s[c];delete s[c]}return{message:{...e,params:s},lifted:a}}function nh(e,t){let r=e.validateResult(t,void 0);if(!r.ok&&r.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(n){let o=e.validateResult(t,n);if(o.ok)return{value:o.value};return{issues:[{message:o.reason==="invalid"?o.message:`not-in-era: ${t}`}]}}}}}function mo(e){return()=>e}var JS=mo(void 0);function bu(e,t){return{...e,mcpReq:{...e.mcpReq,requestState:mo(t)}}}var HS;var Mh=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{HS=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??bc,this.setNotificationHandler("notifications/cancelled",(t)=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",(t)=>{this._onprogress(t)}),this.setRequestHandler("ping",(t)=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new pe(ge.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){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,n,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:o,onTimeout:n})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new pe(ge.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(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 r=this.transport?.onerror;this._transport.onerror=(o)=>{r?.(o),this._onerror(o)};let n=this._transport?.onmessage;this._transport.onmessage=(o,i)=>{if(n?.(o,i),ou(o)||Th(o))this._onresponse(o);else if($h(o))this._onrequest(o,i);else if(Eh(o))this._onnotification(o,i);else this._onerror(Error(`Unknown message type: ${JSON.stringify(o)}`))},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 n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new pe(ge.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let n of e.values())n(r);for(let n of t.values())n.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=rh(e,"notification"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let a=Xp(t.classification);if(a!==n.era){this._onerror(Error(`Era mismatch on inbound notification '${r.method}': classified as ${a} but this instance serves ${n.era}`));return}}if(tu(r.method)&&!n.hasNotificationMethod(r.method))return;let o=this._notificationHandlers.get(r.method),i=this.fallbackNotificationHandler;if(o===void 0&&i===void 0)return;Promise.resolve().then(()=>o===void 0?i(r):o(r,n)).catch((a)=>this._onerror(Error(`Uncaught error in notification handler: ${a}`)))}_onrequest(e,t){let{message:r,lifted:n}=rh(e,"request"),o=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 i=this._transport,a=(w,m,g)=>{let z={jsonrpc:"2.0",id:r.id,error:{code:w,message:m,...g!==void 0&&{data:g}}};i?.send(z).catch((S)=>this._onerror(Error(`Failed to send an error response: ${S}`)))};if(t?.classification!==void 0){let w=Xp(t.classification);if(w!==o.era){this._onerror(Error(`Era mismatch on inbound request '${r.method}': classified as ${w} but this instance serves ${o.era}`));let m=t.classification.revision??w;a(oe.UnsupportedProtocolVersion,`Unsupported protocol version: ${m}`,{supported:this._supportedProtocolVersions,requested:m});return}}if(eu(r.method)&&!o.hasRequestMethod(r.method)){a(oe.MethodNotFound,"Method not found");return}let s=this._requestHandlers.get(r.method)??this.fallbackRequestHandler;if(s===void 0){a(oe.MethodNotFound,"Method not found");return}let c=o.checkInboundEnvelope(n);if(c!==void 0){a(oe.InvalidParams,c);return}let u=(w,m)=>this._notificationViaCodec(this._resolveOutboundCodec(w.method),w,{...m,relatedRequestId:r.id}),f=(w,m,g)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(w.method),w,m,{...g,relatedRequestId:r.id}),_=new AbortController;this._requestHandlerAbortControllers.set(r.id,_);let E=n.inputResponses===void 0?void 0:KS(n.inputResponses),P={sessionId:i?.sessionId,mcpReq:{id:r.id,method:r.method,_meta:r.params?._meta,...n.envelope!==void 0&&{envelope:n.envelope},...E!==void 0&&{inputResponses:E.accepted},...E!==void 0&&E.droppedKeys.length>0&&{droppedInputResponseKeys:E.droppedKeys},requestState:n.requestState===void 0?JS:mo(n.requestState),signal:_.signal,send:(w,m,g)=>{let z=this._resolveOutboundCodec(w.method);if(this._assertOutboundRequestInEra(z,w.method),su(m))return f(w,m,g);let S=nh(z,w.method);if(S===void 0)throw TypeError(`'${w.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return f(w,S,m)},notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},v=this.buildContext(P,t);Promise.resolve().then(()=>s(r,v)).then(async(w)=>{if(_.signal.aborted)return;let m;try{m=o.encodeResult(r.method,w,this._outboundServerInfo())}catch(z){this._onerror(Error(`Failed to encode result for ${r.method}: ${z}`)),a(oe.InternalError,"Internal error");return}let g={result:m,jsonrpc:"2.0",id:r.id};await i?.send(g)},async(w)=>{if(_.signal.aborted)return;let m=Number.isSafeInteger(w.code)?w.code:oe.InternalError,g={jsonrpc:"2.0",id:r.id,error:{code:o.encodeErrorCode(m),message:w.message??"Internal error",...w.data!==void 0&&{data:w.data}}};await i?.send(g)}).catch((w)=>this._onerror(Error(`Failed to send response: ${w}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(r.id)===_)this._requestHandlerAbortControllers.delete(r.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,n=Number(t),o=this._progressHandlers.get(n);if(!o){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(s){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),i(s);return}o(r)}_onresponse(e){let t=Number(e.id),r=this._responseHandlers.get(t);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),ou(e))r(e);else r(_e.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,r){let n=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(n,e.method),su(t))return this._requestWithSchemaViaCodec(n,e,t,r);let o=nh(n,e.method);if(o===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(n,e,o,t)}_negotiatedWireCodec(){return Lr(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=US(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(eu(t)&&!e.hasRequestMethod(t))throw new pe(ge.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,r){let n=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(n,e.method),this._requestWithSchemaViaCodec(n,e,t,r)}_requestWithSchemaViaCodec(e,t,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,headers:s}=n??{},c=Date.now(),u,f;return new Promise((_,E)=>{let P=(R)=>{E(R)};if(!this._transport){P(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(R){P(R);return}if(n?.signal?.aborted){let R=n.signal.reason;throw R instanceof pe?R:new pe(ge.RequestTimeout,String(R))}let v=e.era===yu&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,w=this._requestMessageId++;f=w;let m={...t,jsonrpc:"2.0",id:w};if(n?.onprogress)this._progressHandlers.set(w,n.onprogress),m.params={...t.params,_meta:{...t.params?._meta,progressToken:w}};let g=this._envelopeOutbound(m),z=!1,S=(R)=>{if(z)return;if(this._progressHandlers.delete(w),v===void 0)this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:w,reason:String(R)}}),{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch((y)=>this._onerror(Error(`Failed to send cancellation: ${y}`)));else v.abort();E(R instanceof pe?R:new pe(ge.RequestTimeout,String(R)))};this._responseHandlers.set(w,(R)=>{if(n?.signal?.aborted)return;if(z=!0,R instanceof Error)return E(R);let y;try{y=e.decodeResult(t.method,R.result)}catch(q){return E(q instanceof Error?q:Error(String(q)))}if(y.kind==="invalid")return E(y.error);if(y.kind==="input_required"){if(n?.allowInputRequired===!0)return _(BS(y));let q={codec:e,request:t,resultSchema:r,options:n,flowStartedAt:c,retry:(H,L)=>this._requestWithSchemaViaCodec(e,H===void 0?{method:t.method}:{method:t.method,params:H},r,L)};return _(this._resolveNonCompleteResult(y,q))}let N=y.result;Qi(r,N).then((q)=>{if(q.success)_(q.data);else E(new pe(ge.InvalidResult,`Invalid result for ${t.method}: ${q.error}`))},E)}),u=()=>S(n?.signal?.reason),n?.signal?.addEventListener("abort",u,{once:!0});let b=n?.timeout??FS,O=()=>S(new pe(ge.RequestTimeout,"Request timed out",{timeout:b}));this._setupTimeout(w,b,n?.maxTotalTimeout,O,n?.resetTimeoutOnProgress??!1),this._transport.send(g,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,headers:s,requestSignal:v?.signal}).catch((R)=>{this._progressHandlers.delete(w),E(R)})}).finally(()=>{if(u)n?.signal?.removeEventListener("abort",u);if(f!==void 0)this._responseHandlers.delete(f),this._cleanupTimeout(f)})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new pe(ge.NotConnected,"Not connected");if(tu(t.method)&&!e.hasNotificationMethod(t.method))throw new pe(ge.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 n=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;this._transport?.send(n,r).catch((o)=>this._onerror(o))});return}await this._transport.send(n,r)}setRequestHandler(e,t,r){this.assertRequestHandlerCapability(e);let n;if(typeof t==="function"){if(!eu(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);n=(o,i)=>{let a=this._negotiatedWireCodec(),s=a.validateRequest(e,o);if(!s.ok&&s.reason==="not-in-era")s=a.validateInputRequest(e,o);if(!s.ok){if(s.reason==="not-in-era")throw new _e(oe.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(s.message)}return Promise.resolve(t(s.value,i))}}else if(r)n=async(o,i)=>{let a=await Qi(t.params,{...o.params});if(!a.success)throw new _e(oe.InvalidParams,`Invalid params for ${e}: ${a.error}`);return r(a.data,i)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(e,this._wrapHandler(e,n))}_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,r){if(typeof t==="function"){if(!tu(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,o)=>{let i=o.validateNotification(e,n);if(!i.ok){if(i.reason==="not-in-era")throw new _e(oe.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(i.message)}return Promise.resolve(t(i.value))});return}if(!r)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async(n)=>{let o=await Qi(t.params,{...n.params});if(!o.success)throw new _e(oe.InvalidParams,`Invalid params for notification ${e}: ${o.error}`);await r(o.data,n)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function co(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function qh(e,t){let r={...e};for(let n in t){let o=n,i=t[o];if(i===void 0)continue;let a=r[o];r[o]=co(a)&&co(i)?{...a,...i}:i}return r}function oh(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function KS(e){let t={},r=[];if(!oh(e))return{accepted:t,droppedKeys:r};for(let[n,o]of Object.entries(e)){if(!oh(o)||"method"in o||"result"in o){r.push(n);continue}t[n]=o}return{accepted:t,droppedKeys:r}}function BS(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState}}}/*!
71
71
  * content-type
72
72
  * Copyright(c) 2015 Douglas Christopher Wilson
73
73
  * MIT Licensed
74
- */var Ny=V((e)=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,n=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=o;function o(i){if(!i)throw TypeError("argument string is required");var c=typeof i==="object"?s(i):i;if(typeof c!=="string")throw TypeError("argument string is required to be a string");var u=c.indexOf(";"),f=u!==-1?c.slice(0,u).trim():c.trim();if(!n.test(f))throw TypeError("invalid media type");var _=new a(f.toLowerCase());if(u!==-1){var E,P,v;t.lastIndex=u;while(P=t.exec(c)){if(P.index!==u)throw TypeError("invalid parameter format");if(u+=P[0].length,E=P[1].toLowerCase(),v=P[2],v.charCodeAt(0)===34){if(v=v.slice(1,-1),v.indexOf("\\")!==-1)v=v.replace(r,"$1")}_.parameters[E]=v}if(u!==c.length)throw TypeError("invalid parameter format")}return _}function s(i){var c;if(typeof i.getHeader==="function")c=i.getHeader("content-type");else if(typeof i.headers==="object")c=i.headers&&i.headers["content-type"];if(typeof c!=="string")throw TypeError("content-type header is missing from object");return c}function a(i){this.parameters=Object.create(null),this.type=i}}),G0=Zo(Ny(),1);var xy=10485760,of=class{_buffer;_maxBufferSize;constructor(e){this._maxBufferSize=e?.maxBufferSize??xy}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(){while(this._buffer){let e=this._buffer.indexOf(`
75
- `);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");this._buffer=this._buffer.subarray(e+1);try{return Iy(t)}catch(r){if(r instanceof SyntaxError)continue;throw r}}return null}clear(){this._buffer=void 0}};function Iy(e){return ps.parse(JSON.parse(e))}function sf(e){return JSON.stringify(e)+`
76
- `}var sa=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var r=class extends t{constructor(g){super();if(!e.IDENTIFIER.test(g))throw Error("CodeGen: name must be a valid identifier");this.str=g}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=r;var n=class extends t{constructor(g){super();this._items=typeof g==="string"?[g]:g}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let g=this._items[0];return g===""||g==='""'}get str(){var g;return(g=this._str)!==null&&g!==void 0?g:this._str=this._items.reduce((z,S)=>`${z}${S}`,"")}get names(){var g;return(g=this._names)!==null&&g!==void 0?g:this._names=this._items.reduce((z,S)=>{if(S instanceof r)z[S.str]=(z[S.str]||0)+1;return z},{})}};e._Code=n,e.nil=new n("");function o(g,...z){let S=[g[0]],b=0;while(b<z.length)i(S,z[b]),S.push(g[++b]);return new n(S)}e._=o;let s=new n("+");function a(g,...z){let S=[P(g[0])],b=0;while(b<z.length)S.push(s),i(S,z[b]),S.push(s,P(g[++b]));return c(S),new n(S)}e.str=a;function i(g,z){if(z instanceof n)g.push(...z._items);else if(z instanceof r)g.push(z);else g.push(_(z))}e.addCodeArg=i;function c(g){let z=1;while(z<g.length-1){if(g[z]===s){let S=u(g[z-1],g[z+1]);if(S!==void 0){g.splice(z-1,3,S);continue}g[z++]="+"}z++}}function u(g,z){if(z==='""')return g;if(g==='""')return z;if(typeof g=="string"){if(z instanceof r||g[g.length-1]!=='"')return;if(typeof z!="string")return`${g.slice(0,-1)}${z}"`;if(z[0]==='"')return g.slice(0,-1)+z.slice(1);return}if(typeof z=="string"&&z[0]==='"'&&!(g instanceof r))return`"${g}${z.slice(1)}`}function f(g,z){return z.emptyStr()?g:g.emptyStr()?z:a`${g}${z}`}e.strConcat=f;function _(g){return typeof g=="number"||typeof g=="boolean"||g===null?g:P(Array.isArray(g)?g.join(","):g)}function E(g){return new n(P(g))}e.stringify=E;function P(g){return JSON.stringify(g).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=P;function v(g){return typeof g=="string"&&e.IDENTIFIER.test(g)?new n(`.${g}`):o`[${g}]`}e.getProperty=v;function w(g){if(typeof g=="string"&&e.IDENTIFIER.test(g))return new n(`${g}`);throw Error(`CodeGen: invalid export name: ${g}, use explicit $id name mapping`)}e.getEsmExportName=w;function m(g){return new n(g.toString())}e.regexpCode=m}),af=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=sa();var r=class extends Error{constructor(c){super(`CodeGen: "code" for ${c} not defined`);this.value=c.value}},n;(function(c){c[c.Started=0]="Started",c[c.Completed=1]="Completed"})(n||(e.UsedValueState=n={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};var o=class{constructor({prefixes:c,parent:u}={}){this._names={},this._prefixes=c,this._parent=u}toName(c){return c instanceof t.Name?c:this.name(c)}name(c){return new t.Name(this._newName(c))}_newName(c){let u=this._names[c]||this._nameGroup(c);return`${c}${u.index++}`}_nameGroup(c){var u,f;if(((f=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||f===void 0?void 0:f.has(c))||this._prefixes&&!this._prefixes.has(c))throw Error(`CodeGen: prefix "${c}" is not allowed in this scope`);return this._names[c]={prefix:c,index:0}}};e.Scope=o;var s=class extends t.Name{constructor(c,u){super(u);this.prefix=c}setValue(c,{property:u,itemIndex:f}){this.value=c,this.scopePath=t._`.${new t.Name(u)}[${f}]`}};e.ValueScopeName=s;let a=t._`\n`;var i=class extends o{constructor(c){super(c);this._values={},this._scope=c.scope,this.opts={...c,_n:c.lines?a:t.nil}}get(){return this._scope}name(c){return new s(c,this._newName(c))}value(c,u){var f;if(u.ref===void 0)throw Error("CodeGen: ref must be passed in value");let _=this.toName(c),{prefix:E}=_,P=(f=u.key)!==null&&f!==void 0?f:u.ref,v=this._values[E];if(v){let g=v.get(P);if(g)return g}else v=this._values[E]=new Map;v.set(P,_);let w=this._scope[E]||(this._scope[E]=[]),m=w.length;return w[m]=u.ref,_.setValue(u,{property:E,itemIndex:m}),_}getValue(c,u){let f=this._values[c];if(!f)return;return f.get(u)}scopeRefs(c,u=this._values){return this._reduceValues(u,(f)=>{if(f.scopePath===void 0)throw Error(`CodeGen: name "${f}" has no value`);return t._`${c}${f.scopePath}`})}scopeCode(c=this._values,u,f){return this._reduceValues(c,(_)=>{if(_.value===void 0)throw Error(`CodeGen: name "${_}" has no value`);return _.value.code},u,f)}_reduceValues(c,u,f={},_){let E=t.nil;for(let P in c){let v=c[P];if(!v)continue;let w=f[P]=f[P]||new Map;v.forEach((m)=>{if(w.has(m))return;w.set(m,n.Started);let g=u(m);if(g){let z=this.opts.es5?e.varKinds.var:e.varKinds.const;E=t._`${E}${z} ${m} = ${g};${this.opts._n}`}else if(g=_===null||_===void 0?void 0:_(m))E=t._`${E}${g}${this.opts._n}`;else throw new r(m);w.set(m,n.Completed)})}return E}};e.ValueScope=i}),me=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=sa(),r=af();var n=sa();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var o=af();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};var s=class{optimizeNodes(){return this}optimizeNames(p,T){return this}},a=class extends s{constructor(p,T,x){super();this.varKind=p,this.name=T,this.rhs=x}render({es5:p,_n:T}){let x=p?r.varKinds.var:this.varKind,F=this.rhs===void 0?"":` = ${this.rhs}`;return`${x} ${this.name}${F};`+T}optimizeNames(p,T){if(!p[this.name.str])return;if(this.rhs)this.rhs=B(this.rhs,p,T);return this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},i=class extends s{constructor(p,T,x){super();this.lhs=p,this.rhs=T,this.sideEffects=x}render({_n:p}){return`${this.lhs} = ${this.rhs};`+p}optimizeNames(p,T){if(this.lhs instanceof t.Name&&!p[this.lhs.str]&&!this.sideEffects)return;return this.rhs=B(this.rhs,p,T),this}get names(){return G(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends i{constructor(p,T,x,F){super(p,x,F);this.op=T}render({_n:p}){return`${this.lhs} ${this.op}= ${this.rhs};`+p}},u=class extends s{constructor(p){super();this.label=p,this.names={}}render({_n:p}){return`${this.label}:`+p}},f=class extends s{constructor(p){super();this.label=p,this.names={}}render({_n:p}){return`break${this.label?` ${this.label}`:""};`+p}},_=class extends s{constructor(p){super();this.error=p}render({_n:p}){return`throw ${this.error};`+p}get names(){return this.error.names}},E=class extends s{constructor(p){super();this.code=p}render({_n:p}){return`${this.code};`+p}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(p,T){return this.code=B(this.code,p,T),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},P=class extends s{constructor(p=[]){super();this.nodes=p}render(p){return this.nodes.reduce((T,x)=>T+x.render(p),"")}optimizeNodes(){let{nodes:p}=this,T=p.length;while(T--){let x=p[T].optimizeNodes();if(Array.isArray(x))p.splice(T,1,...x);else if(x)p[T]=x;else p.splice(T,1)}return p.length>0?this:void 0}optimizeNames(p,T){let{nodes:x}=this,F=x.length;while(F--){let K=x[F];if(K.optimizeNames(p,T))continue;he(p,K.names),x.splice(F,1)}return x.length>0?this:void 0}get names(){return this.nodes.reduce((p,T)=>Z(p,T.names),{})}},v=class extends P{render(p){return"{"+p._n+super.render(p)+"}"+p._n}},w=class extends P{},m=class extends v{};m.kind="else";var g=class p extends v{constructor(T,x){super(x);this.condition=T}render(T){let x=`if(${this.condition})`+super.render(T);if(this.else)x+="else "+this.else.render(T);return x}optimizeNodes(){super.optimizeNodes();let T=this.condition;if(T===!0)return this.nodes;let x=this.else;if(x){let F=x.optimizeNodes();x=this.else=Array.isArray(F)?new m(F):F}if(x){if(T===!1)return x instanceof p?x:x.nodes;if(this.nodes.length)return this;return new p(we(T),x instanceof p?[x]:x.nodes)}if(T===!1||!this.nodes.length)return;return this}optimizeNames(T,x){var F;if(this.else=(F=this.else)===null||F===void 0?void 0:F.optimizeNames(T,x),!(super.optimizeNames(T,x)||this.else))return;return this.condition=B(this.condition,T,x),this}get names(){let T=super.names;if(G(T,this.condition),this.else)Z(T,this.else.names);return T}};g.kind="if";var z=class extends v{};z.kind="for";var S=class extends z{constructor(p){super();this.iteration=p}render(p){return`for(${this.iteration})`+super.render(p)}optimizeNames(p,T){if(!super.optimizeNames(p,T))return;return this.iteration=B(this.iteration,p,T),this}get names(){return Z(super.names,this.iteration.names)}},b=class extends z{constructor(p,T,x,F){super();this.varKind=p,this.name=T,this.from=x,this.to=F}render(p){let T=p.es5?r.varKinds.var:this.varKind,{name:x,from:F,to:K}=this;return`for(${T} ${x}=${F}; ${x}<${K}; ${x}++)`+super.render(p)}get names(){return G(G(super.names,this.from),this.to)}},O=class extends z{constructor(p,T,x,F){super();this.loop=p,this.varKind=T,this.name=x,this.iterable=F}render(p){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(p)}optimizeNames(p,T){if(!super.optimizeNames(p,T))return;return this.iterable=B(this.iterable,p,T),this}get names(){return Z(super.names,this.iterable.names)}},R=class extends v{constructor(p,T,x){super();this.name=p,this.args=T,this.async=x}render(p){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(p)}};R.kind="func";var y=class extends P{render(p){return"return "+super.render(p)}};y.kind="return";var N=class extends v{render(p){let T="try"+super.render(p);if(this.catch)T+=this.catch.render(p);if(this.finally)T+=this.finally.render(p);return T}optimizeNodes(){var p,T;return super.optimizeNodes(),(p=this.catch)===null||p===void 0||p.optimizeNodes(),(T=this.finally)===null||T===void 0||T.optimizeNodes(),this}optimizeNames(p,T){var x,F;return super.optimizeNames(p,T),(x=this.catch)===null||x===void 0||x.optimizeNames(p,T),(F=this.finally)===null||F===void 0||F.optimizeNames(p,T),this}get names(){let p=super.names;if(this.catch)Z(p,this.catch.names);if(this.finally)Z(p,this.finally.names);return p}},q=class extends v{constructor(p){super();this.error=p}render(p){return`catch(${this.error})`+super.render(p)}};q.kind="catch";var H=class extends v{render(p){return"finally"+super.render(p)}};H.kind="finally";var D=class{constructor(p,T={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...T,_n:T.lines?`
77
- `:""},this._extScope=p,this._scope=new r.Scope({parent:p}),this._nodes=[new w]}toString(){return this._root.render(this.opts)}name(p){return this._scope.name(p)}scopeName(p){return this._extScope.name(p)}scopeValue(p,T){let x=this._extScope.value(p,T);return(this._values[x.prefix]||(this._values[x.prefix]=new Set)).add(x),x}getScopeValue(p,T){return this._extScope.getValue(p,T)}scopeRefs(p){return this._extScope.scopeRefs(p,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(p,T,x,F){let K=this._scope.toName(T);if(x!==void 0&&F)this._constants[K.str]=x;return this._leafNode(new a(p,K,x)),K}const(p,T,x){return this._def(r.varKinds.const,p,T,x)}let(p,T,x){return this._def(r.varKinds.let,p,T,x)}var(p,T,x){return this._def(r.varKinds.var,p,T,x)}assign(p,T,x){return this._leafNode(new i(p,T,x))}add(p,T){return this._leafNode(new c(p,e.operators.ADD,T))}code(p){if(typeof p=="function")p();else if(p!==t.nil)this._leafNode(new E(p));return this}object(...p){let T=["{"];for(let[x,F]of p){if(T.length>1)T.push(",");if(T.push(x),x!==F||this.opts.es5)T.push(":"),(0,t.addCodeArg)(T,F)}return T.push("}"),new t._Code(T)}if(p,T,x){if(this._blockNode(new g(p)),T&&x)this.code(T).else().code(x).endIf();else if(T)this.code(T).endIf();else if(x)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(p){return this._elseNode(new g(p))}else(){return this._elseNode(new m)}endIf(){return this._endBlockNode(g,m)}_for(p,T){if(this._blockNode(p),T)this.code(T).endFor();return this}for(p,T){return this._for(new S(p),T)}forRange(p,T,x,F,K=this.opts.es5?r.varKinds.var:r.varKinds.let){let X=this._scope.toName(p);return this._for(new b(K,X,T,x),()=>F(X))}forOf(p,T,x,F=r.varKinds.const){let K=this._scope.toName(p);if(this.opts.es5){let X=T instanceof t.Name?T:this.var("_arr",T);return this.forRange("_i",0,t._`${X}.length`,(te)=>{this.var(K,t._`${X}[${te}]`),x(K)})}return this._for(new O("of",F,K,T),()=>x(K))}forIn(p,T,x,F=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(p,t._`Object.keys(${T})`,x);let K=this._scope.toName(p);return this._for(new O("in",F,K,T),()=>x(K))}endFor(){return this._endBlockNode(z)}label(p){return this._leafNode(new u(p))}break(p){return this._leafNode(new f(p))}return(p){let T=new y;if(this._blockNode(T),this.code(p),T.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(y)}try(p,T,x){if(!T&&!x)throw Error('CodeGen: "try" without "catch" and "finally"');let F=new N;if(this._blockNode(F),this.code(p),T){let K=this.name("e");this._currNode=F.catch=new q(K),T(K)}if(x)this._currNode=F.finally=new H,this.code(x);return this._endBlockNode(q,H)}throw(p){return this._leafNode(new _(p))}block(p,T){if(this._blockStarts.push(this._nodes.length),p)this.code(p).endBlock(T);return this}endBlock(p){let T=this._blockStarts.pop();if(T===void 0)throw Error("CodeGen: not in self-balancing block");let x=this._nodes.length-T;if(x<0||p!==void 0&&x!==p)throw Error(`CodeGen: wrong number of nodes: ${x} vs ${p} expected`);return this._nodes.length=T,this}func(p,T=t.nil,x,F){if(this._blockNode(new R(p,T,x)),F)this.code(F).endFunc();return this}endFunc(){return this._endBlockNode(R)}optimize(p=1){while(p-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(p){return this._currNode.nodes.push(p),this}_blockNode(p){this._currNode.nodes.push(p),this._nodes.push(p)}_endBlockNode(p,T){let x=this._currNode;if(x instanceof p||T&&x instanceof T)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${T?`${p.kind}/${T.kind}`:p.kind}"`)}_elseNode(p){let T=this._currNode;if(!(T instanceof g))throw Error('CodeGen: "else" without "if"');return this._currNode=T.else=p,this}get _root(){return this._nodes[0]}get _currNode(){let p=this._nodes;return p[p.length-1]}set _currNode(p){let T=this._nodes;T[T.length-1]=p}};e.CodeGen=D;function Z(p,T){for(let x in T)p[x]=(p[x]||0)+(T[x]||0);return p}function G(p,T){return T instanceof t._CodeOrName?Z(p,T.names):p}function B(p,T,x){if(p instanceof t.Name)return F(p);if(!K(p))return p;return new t._Code(p._items.reduce((X,te)=>{if(te instanceof t.Name)te=F(te);if(te instanceof t._Code)X.push(...te._items);else X.push(te);return X},[]));function F(X){let te=x[X.str];if(te===void 0||T[X.str]!==1)return X;return delete T[X.str],te}function K(X){return X instanceof t._Code&&X._items.some((te)=>te instanceof t.Name&&T[te.str]===1&&x[te.str]!==void 0)}}function he(p,T){for(let x in T)p[x]=(p[x]||0)-(T[x]||0)}function we(p){return typeof p=="boolean"||typeof p=="number"||p===null?!p:t._`!${k(p)}`}e.not=we;let be=h(e.operators.AND);function Oe(...p){return p.reduce(be)}e.and=Oe;let fe=h(e.operators.OR);function l(...p){return p.reduce(fe)}e.or=l;function h(p){return(T,x)=>T===t.nil?x:x===t.nil?T:t._`${k(T)} ${p} ${k(x)}`}function k(p){return p instanceof t.Name?p:t._`(${p})`}}),Se=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let t=me(),r=sa();function n(R){let y={};for(let N of R)y[N]=!0;return y}e.toHash=n;function o(R,y){if(typeof y=="boolean")return y;if(Object.keys(y).length===0)return!0;return s(R,y),!a(y,R.self.RULES.all)}e.alwaysValidSchema=o;function s(R,y=R.schema){let{opts:N,self:q}=R;if(!N.strictSchema)return;if(typeof y==="boolean")return;let H=q.RULES.keywords;for(let D in y)if(!H[D])O(R,`unknown keyword: "${D}"`)}e.checkUnknownRules=s;function a(R,y){if(typeof R=="boolean")return!R;for(let N in R)if(y[N])return!0;return!1}e.schemaHasRules=a;function i(R,y){if(typeof R=="boolean")return!R;for(let N in R)if(N!=="$ref"&&y.all[N])return!0;return!1}e.schemaHasRulesButRef=i;function c({topSchemaRef:R,schemaPath:y},N,q,H){if(!H){if(typeof N=="number"||typeof N=="boolean")return N;if(typeof N=="string")return t._`${N}`}return t._`${R}${y}${(0,t.getProperty)(q)}`}e.schemaRefOrVal=c;function u(R){return E(decodeURIComponent(R))}e.unescapeFragment=u;function f(R){return encodeURIComponent(_(R))}e.escapeFragment=f;function _(R){if(typeof R=="number")return`${R}`;return R.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=_;function E(R){return R.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=E;function P(R,y){if(Array.isArray(R))for(let N of R)y(N);else y(R)}e.eachItem=P;function v({mergeNames:R,mergeToName:y,mergeValues:N,resultToName:q}){return(H,D,Z,G)=>{let B=Z===void 0?D:Z instanceof t.Name?(D instanceof t.Name?R(H,D,Z):y(H,D,Z),Z):D instanceof t.Name?(y(H,Z,D),D):N(D,Z);return G===t.Name&&!(B instanceof t.Name)?q(H,B):B}}e.mergeEvaluated={props:v({mergeNames:(R,y,N)=>R.if(t._`${N} !== true && ${y} !== undefined`,()=>{R.if(t._`${y} === true`,()=>R.assign(N,!0),()=>R.assign(N,t._`${N} || {}`).code(t._`Object.assign(${N}, ${y})`))}),mergeToName:(R,y,N)=>R.if(t._`${N} !== true`,()=>{if(y===!0)R.assign(N,!0);else R.assign(N,t._`${N} || {}`),m(R,N,y)}),mergeValues:(R,y)=>R===!0?!0:{...R,...y},resultToName:w}),items:v({mergeNames:(R,y,N)=>R.if(t._`${N} !== true && ${y} !== undefined`,()=>R.assign(N,t._`${y} === true ? true : ${N} > ${y} ? ${N} : ${y}`)),mergeToName:(R,y,N)=>R.if(t._`${N} !== true`,()=>R.assign(N,y===!0?!0:t._`${N} > ${y} ? ${N} : ${y}`)),mergeValues:(R,y)=>R===!0?!0:Math.max(R,y),resultToName:(R,y)=>R.var("items",y)})};function w(R,y){if(y===!0)return R.var("props",!0);let N=R.var("props",t._`{}`);if(y!==void 0)m(R,N,y);return N}e.evaluatedPropsToName=w;function m(R,y,N){Object.keys(N).forEach((q)=>R.assign(t._`${y}${(0,t.getProperty)(q)}`,!0))}e.setEvaluated=m;let g={};function z(R,y){return R.scopeValue("func",{ref:y,code:g[y.code]||(g[y.code]=new r._Code(y.code))})}e.useFunc=z;var S;(function(R){R[R.Num=0]="Num",R[R.Str=1]="Str"})(S||(e.Type=S={}));function b(R,y,N){if(R instanceof t.Name){let q=y===S.Num;return N?q?t._`"[" + ${R} + "]"`:t._`"['" + ${R} + "']"`:q?t._`"/" + ${R}`:t._`"/" + ${R}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return N?(0,t.getProperty)(R).toString():"/"+_(R)}e.getErrorPath=b;function O(R,y,N=R.opts.strictSchema){if(!N)return;if(y=`strict mode: ${y}`,N===!0)throw Error(y);R.self.logger.warn(y)}e.checkStrictMode=O}),ut=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r={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")};e.default=r}),aa=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=me(),r=Se(),n=ut();e.keywordError={message:({keyword:m})=>t.str`must pass "${m}" keyword validation`},e.keyword$DataError={message:({keyword:m,schemaType:g})=>g?t.str`"${m}" keyword must be ${g} ($data)`:t.str`"${m}" keyword is invalid ($data)`};function o(m,g=e.keywordError,z,S){let{it:b}=m,{gen:O,compositeRule:R,allErrors:y}=b,N=_(m,g,z);if(S!==null&&S!==void 0?S:R||y)c(O,N);else u(b,t._`[${N}]`)}e.reportError=o;function s(m,g=e.keywordError,z){let{it:S}=m,{gen:b,compositeRule:O,allErrors:R}=S;if(c(b,_(m,g,z)),!(O||R))u(S,n.default.vErrors)}e.reportExtraError=s;function a(m,g){m.assign(n.default.errors,g),m.if(t._`${n.default.vErrors} !== null`,()=>m.if(g,()=>m.assign(t._`${n.default.vErrors}.length`,g),()=>m.assign(n.default.vErrors,null)))}e.resetErrorsCount=a;function i({gen:m,keyword:g,schemaValue:z,data:S,errsCount:b,it:O}){if(b===void 0)throw Error("ajv implementation error");let R=m.name("err");m.forRange("i",b,n.default.errors,(y)=>{if(m.const(R,t._`${n.default.vErrors}[${y}]`),m.if(t._`${R}.instancePath === undefined`,()=>m.assign(t._`${R}.instancePath`,(0,t.strConcat)(n.default.instancePath,O.errorPath))),m.assign(t._`${R}.schemaPath`,t.str`${O.errSchemaPath}/${g}`),O.opts.verbose)m.assign(t._`${R}.schema`,z),m.assign(t._`${R}.data`,S)})}e.extendErrors=i;function c(m,g){let z=m.const("err",g);m.if(t._`${n.default.vErrors} === null`,()=>m.assign(n.default.vErrors,t._`[${z}]`),t._`${n.default.vErrors}.push(${z})`),m.code(t._`${n.default.errors}++`)}function u(m,g){let{gen:z,validateName:S,schemaEnv:b}=m;if(b.$async)z.throw(t._`new ${m.ValidationError}(${g})`);else z.assign(t._`${S}.errors`,g),z.return(!1)}let f={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 _(m,g,z){let{createErrors:S}=m.it;if(S===!1)return t._`{}`;return E(m,g,z)}function E(m,g,z={}){let{gen:S,it:b}=m,O=[P(b,z),v(m,z)];return w(m,g,O),S.object(...O)}function P({errorPath:m},{instancePath:g}){let z=g?t.str`${m}${(0,r.getErrorPath)(g,r.Type.Str)}`:m;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,z)]}function v({keyword:m,it:{errSchemaPath:g}},{schemaPath:z,parentSchema:S}){let b=S?g:t.str`${g}/${m}`;if(z)b=t.str`${b}${(0,r.getErrorPath)(z,r.Type.Str)}`;return[f.schemaPath,b]}function w(m,{params:g,message:z},S){let{keyword:b,data:O,schemaValue:R,it:y}=m,{opts:N,propertyName:q,topSchemaRef:H,schemaPath:D}=y;if(S.push([f.keyword,b],[f.params,typeof g=="function"?g(m):g||t._`{}`]),N.messages)S.push([f.message,typeof z=="function"?z(m):z]);if(N.verbose)S.push([f.schema,R],[f.parentSchema,t._`${H}${D}`],[n.default.data,O]);if(q)S.push([f.propertyName,q])}}),Ay=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=aa(),r=me(),n=ut(),o={message:"boolean schema is false"};function s(c){let{gen:u,schema:f,validateName:_}=c;if(f===!1)i(c,!1);else if(typeof f=="object"&&f.$async===!0)u.return(n.default.data);else u.assign(r._`${_}.errors`,null),u.return(!0)}e.topBoolOrEmptySchema=s;function a(c,u){let{gen:f,schema:_}=c;if(_===!1)f.var(u,!1),i(c);else f.var(u,!0)}e.boolOrEmptySchema=a;function i(c,u){let{gen:f,data:_}=c,E={gen:f,keyword:"false schema",data:_,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:c};(0,t.reportError)(E,o,void 0,u)}}),cf=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set(["string","number","integer","boolean","null","object","array"]);function r(o){return typeof o=="string"&&t.has(o)}e.isJSONType=r;function n(){let o={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...o,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},o.number,o.string,o.array,o.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=n}),uf=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:o,self:s},a){let i=s.RULES.types[a];return i&&i!==!0&&r(o,i)}e.schemaHasRulesForType=t;function r(o,s){return s.rules.some((a)=>n(o,a))}e.shouldUseGroup=r;function n(o,s){var a;return o[s.keyword]!==void 0||((a=s.definition.implements)===null||a===void 0?void 0:a.some((i)=>o[i]!==void 0))}e.shouldUseRule=n}),ia=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let t=cf(),r=uf(),n=aa(),o=me(),s=Se();var a;(function(S){S[S.Correct=0]="Correct",S[S.Wrong=1]="Wrong"})(a||(e.DataType=a={}));function i(S){let b=c(S.type);if(b.includes("null")){if(S.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!b.length&&S.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(S.nullable===!0)b.push("null")}return b}e.getSchemaTypes=i;function c(S){let b=Array.isArray(S)?S:S?[S]:[];if(b.every(t.isJSONType))return b;throw Error("type must be JSONType or JSONType[]: "+b.join(","))}e.getJSONTypes=c;function u(S,b){let{gen:O,data:R,opts:y}=S,N=_(b,y.coerceTypes),q=b.length>0&&!(N.length===0&&b.length===1&&(0,r.schemaHasRulesForType)(S,b[0]));if(q){let H=w(b,R,y.strictNumbers,a.Wrong);O.if(H,()=>{if(N.length)E(S,b,N);else g(S)})}return q}e.coerceAndCheckDataType=u;let f=new Set(["string","number","integer","boolean","null"]);function _(S,b){return b?S.filter((O)=>f.has(O)||b==="array"&&O==="array"):[]}function E(S,b,O){let{gen:R,data:y,opts:N}=S,q=R.let("dataType",o._`typeof ${y}`),H=R.let("coerced",o._`undefined`);if(N.coerceTypes==="array")R.if(o._`${q} == 'object' && Array.isArray(${y}) && ${y}.length == 1`,()=>R.assign(y,o._`${y}[0]`).assign(q,o._`typeof ${y}`).if(w(b,y,N.strictNumbers),()=>R.assign(H,y)));R.if(o._`${H} !== undefined`);for(let Z of O)if(f.has(Z)||Z==="array"&&N.coerceTypes==="array")D(Z);R.else(),g(S),R.endIf(),R.if(o._`${H} !== undefined`,()=>{R.assign(y,H),P(S,H)});function D(Z){switch(Z){case"string":R.elseIf(o._`${q} == "number" || ${q} == "boolean"`).assign(H,o._`"" + ${y}`).elseIf(o._`${y} === null`).assign(H,o._`""`);return;case"number":R.elseIf(o._`${q} == "boolean" || ${y} === null
74
+ */var YS=V((e)=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,n=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=o;function o(s){if(!s)throw TypeError("argument string is required");var c=typeof s==="object"?i(s):s;if(typeof c!=="string")throw TypeError("argument string is required to be a string");var u=c.indexOf(";"),f=u!==-1?c.slice(0,u).trim():c.trim();if(!n.test(f))throw TypeError("invalid media type");var _=new a(f.toLowerCase());if(u!==-1){var E,P,v;t.lastIndex=u;while(P=t.exec(c)){if(P.index!==u)throw TypeError("invalid parameter format");if(u+=P[0].length,E=P[1].toLowerCase(),v=P[2],v.charCodeAt(0)===34){if(v=v.slice(1,-1),v.indexOf("\\")!==-1)v=v.replace(r,"$1")}_.parameters[E]=v}if(u!==c.length)throw TypeError("invalid parameter format")}return _}function i(s){var c;if(typeof s.getHeader==="function")c=s.getHeader("content-type");else if(typeof s.headers==="object")c=s.headers&&s.headers["content-type"];if(typeof c!=="string")throw TypeError("content-type header is missing from object");return c}function a(s){this.parameters=Object.create(null),this.type=s}}),$0=Io(YS(),1);var GS=10485760,Lh=class{_buffer;_maxBufferSize;constructor(e){this._maxBufferSize=e?.maxBufferSize??GS}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(){while(this._buffer){let e=this._buffer.indexOf(`
75
+ `);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");this._buffer=this._buffer.subarray(e+1);try{return QS(t)}catch(r){if(r instanceof SyntaxError)continue;throw r}}return null}clear(){this._buffer=void 0}};function QS(e){return as.parse(JSON.parse(e))}function Dh(e){return JSON.stringify(e)+`
76
+ `}var Xi=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var r=class extends t{constructor(g){super();if(!e.IDENTIFIER.test(g))throw Error("CodeGen: name must be a valid identifier");this.str=g}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=r;var n=class extends t{constructor(g){super();this._items=typeof g==="string"?[g]:g}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let g=this._items[0];return g===""||g==='""'}get str(){var g;return(g=this._str)!==null&&g!==void 0?g:this._str=this._items.reduce((z,S)=>`${z}${S}`,"")}get names(){var g;return(g=this._names)!==null&&g!==void 0?g:this._names=this._items.reduce((z,S)=>{if(S instanceof r)z[S.str]=(z[S.str]||0)+1;return z},{})}};e._Code=n,e.nil=new n("");function o(g,...z){let S=[g[0]],b=0;while(b<z.length)s(S,z[b]),S.push(g[++b]);return new n(S)}e._=o;let i=new n("+");function a(g,...z){let S=[P(g[0])],b=0;while(b<z.length)S.push(i),s(S,z[b]),S.push(i,P(g[++b]));return c(S),new n(S)}e.str=a;function s(g,z){if(z instanceof n)g.push(...z._items);else if(z instanceof r)g.push(z);else g.push(_(z))}e.addCodeArg=s;function c(g){let z=1;while(z<g.length-1){if(g[z]===i){let S=u(g[z-1],g[z+1]);if(S!==void 0){g.splice(z-1,3,S);continue}g[z++]="+"}z++}}function u(g,z){if(z==='""')return g;if(g==='""')return z;if(typeof g=="string"){if(z instanceof r||g[g.length-1]!=='"')return;if(typeof z!="string")return`${g.slice(0,-1)}${z}"`;if(z[0]==='"')return g.slice(0,-1)+z.slice(1);return}if(typeof z=="string"&&z[0]==='"'&&!(g instanceof r))return`"${g}${z.slice(1)}`}function f(g,z){return z.emptyStr()?g:g.emptyStr()?z:a`${g}${z}`}e.strConcat=f;function _(g){return typeof g=="number"||typeof g=="boolean"||g===null?g:P(Array.isArray(g)?g.join(","):g)}function E(g){return new n(P(g))}e.stringify=E;function P(g){return JSON.stringify(g).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=P;function v(g){return typeof g=="string"&&e.IDENTIFIER.test(g)?new n(`.${g}`):o`[${g}]`}e.getProperty=v;function w(g){if(typeof g=="string"&&e.IDENTIFIER.test(g))return new n(`${g}`);throw Error(`CodeGen: invalid export name: ${g}, use explicit $id name mapping`)}e.getEsmExportName=w;function m(g){return new n(g.toString())}e.regexpCode=m}),Uh=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=Xi();var r=class extends Error{constructor(c){super(`CodeGen: "code" for ${c} not defined`);this.value=c.value}},n;(function(c){c[c.Started=0]="Started",c[c.Completed=1]="Completed"})(n||(e.UsedValueState=n={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};var o=class{constructor({prefixes:c,parent:u}={}){this._names={},this._prefixes=c,this._parent=u}toName(c){return c instanceof t.Name?c:this.name(c)}name(c){return new t.Name(this._newName(c))}_newName(c){let u=this._names[c]||this._nameGroup(c);return`${c}${u.index++}`}_nameGroup(c){var u,f;if(((f=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||f===void 0?void 0:f.has(c))||this._prefixes&&!this._prefixes.has(c))throw Error(`CodeGen: prefix "${c}" is not allowed in this scope`);return this._names[c]={prefix:c,index:0}}};e.Scope=o;var i=class extends t.Name{constructor(c,u){super(u);this.prefix=c}setValue(c,{property:u,itemIndex:f}){this.value=c,this.scopePath=t._`.${new t.Name(u)}[${f}]`}};e.ValueScopeName=i;let a=t._`\n`;var s=class extends o{constructor(c){super(c);this._values={},this._scope=c.scope,this.opts={...c,_n:c.lines?a:t.nil}}get(){return this._scope}name(c){return new i(c,this._newName(c))}value(c,u){var f;if(u.ref===void 0)throw Error("CodeGen: ref must be passed in value");let _=this.toName(c),{prefix:E}=_,P=(f=u.key)!==null&&f!==void 0?f:u.ref,v=this._values[E];if(v){let g=v.get(P);if(g)return g}else v=this._values[E]=new Map;v.set(P,_);let w=this._scope[E]||(this._scope[E]=[]),m=w.length;return w[m]=u.ref,_.setValue(u,{property:E,itemIndex:m}),_}getValue(c,u){let f=this._values[c];if(!f)return;return f.get(u)}scopeRefs(c,u=this._values){return this._reduceValues(u,(f)=>{if(f.scopePath===void 0)throw Error(`CodeGen: name "${f}" has no value`);return t._`${c}${f.scopePath}`})}scopeCode(c=this._values,u,f){return this._reduceValues(c,(_)=>{if(_.value===void 0)throw Error(`CodeGen: name "${_}" has no value`);return _.value.code},u,f)}_reduceValues(c,u,f={},_){let E=t.nil;for(let P in c){let v=c[P];if(!v)continue;let w=f[P]=f[P]||new Map;v.forEach((m)=>{if(w.has(m))return;w.set(m,n.Started);let g=u(m);if(g){let z=this.opts.es5?e.varKinds.var:e.varKinds.const;E=t._`${E}${z} ${m} = ${g};${this.opts._n}`}else if(g=_===null||_===void 0?void 0:_(m))E=t._`${E}${g}${this.opts._n}`;else throw new r(m);w.set(m,n.Completed)})}return E}};e.ValueScope=s}),me=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=Xi(),r=Uh();var n=Xi();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var o=Uh();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};var i=class{optimizeNodes(){return this}optimizeNames(p,T){return this}},a=class extends i{constructor(p,T,x){super();this.varKind=p,this.name=T,this.rhs=x}render({es5:p,_n:T}){let x=p?r.varKinds.var:this.varKind,F=this.rhs===void 0?"":` = ${this.rhs}`;return`${x} ${this.name}${F};`+T}optimizeNames(p,T){if(!p[this.name.str])return;if(this.rhs)this.rhs=B(this.rhs,p,T);return this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends i{constructor(p,T,x){super();this.lhs=p,this.rhs=T,this.sideEffects=x}render({_n:p}){return`${this.lhs} = ${this.rhs};`+p}optimizeNames(p,T){if(this.lhs instanceof t.Name&&!p[this.lhs.str]&&!this.sideEffects)return;return this.rhs=B(this.rhs,p,T),this}get names(){return G(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(p,T,x,F){super(p,x,F);this.op=T}render({_n:p}){return`${this.lhs} ${this.op}= ${this.rhs};`+p}},u=class extends i{constructor(p){super();this.label=p,this.names={}}render({_n:p}){return`${this.label}:`+p}},f=class extends i{constructor(p){super();this.label=p,this.names={}}render({_n:p}){return`break${this.label?` ${this.label}`:""};`+p}},_=class extends i{constructor(p){super();this.error=p}render({_n:p}){return`throw ${this.error};`+p}get names(){return this.error.names}},E=class extends i{constructor(p){super();this.code=p}render({_n:p}){return`${this.code};`+p}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(p,T){return this.code=B(this.code,p,T),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},P=class extends i{constructor(p=[]){super();this.nodes=p}render(p){return this.nodes.reduce((T,x)=>T+x.render(p),"")}optimizeNodes(){let{nodes:p}=this,T=p.length;while(T--){let x=p[T].optimizeNodes();if(Array.isArray(x))p.splice(T,1,...x);else if(x)p[T]=x;else p.splice(T,1)}return p.length>0?this:void 0}optimizeNames(p,T){let{nodes:x}=this,F=x.length;while(F--){let K=x[F];if(K.optimizeNames(p,T))continue;he(p,K.names),x.splice(F,1)}return x.length>0?this:void 0}get names(){return this.nodes.reduce((p,T)=>Z(p,T.names),{})}},v=class extends P{render(p){return"{"+p._n+super.render(p)+"}"+p._n}},w=class extends P{},m=class extends v{};m.kind="else";var g=class p extends v{constructor(T,x){super(x);this.condition=T}render(T){let x=`if(${this.condition})`+super.render(T);if(this.else)x+="else "+this.else.render(T);return x}optimizeNodes(){super.optimizeNodes();let T=this.condition;if(T===!0)return this.nodes;let x=this.else;if(x){let F=x.optimizeNodes();x=this.else=Array.isArray(F)?new m(F):F}if(x){if(T===!1)return x instanceof p?x:x.nodes;if(this.nodes.length)return this;return new p(be(T),x instanceof p?[x]:x.nodes)}if(T===!1||!this.nodes.length)return;return this}optimizeNames(T,x){var F;if(this.else=(F=this.else)===null||F===void 0?void 0:F.optimizeNames(T,x),!(super.optimizeNames(T,x)||this.else))return;return this.condition=B(this.condition,T,x),this}get names(){let T=super.names;if(G(T,this.condition),this.else)Z(T,this.else.names);return T}};g.kind="if";var z=class extends v{};z.kind="for";var S=class extends z{constructor(p){super();this.iteration=p}render(p){return`for(${this.iteration})`+super.render(p)}optimizeNames(p,T){if(!super.optimizeNames(p,T))return;return this.iteration=B(this.iteration,p,T),this}get names(){return Z(super.names,this.iteration.names)}},b=class extends z{constructor(p,T,x,F){super();this.varKind=p,this.name=T,this.from=x,this.to=F}render(p){let T=p.es5?r.varKinds.var:this.varKind,{name:x,from:F,to:K}=this;return`for(${T} ${x}=${F}; ${x}<${K}; ${x}++)`+super.render(p)}get names(){return G(G(super.names,this.from),this.to)}},O=class extends z{constructor(p,T,x,F){super();this.loop=p,this.varKind=T,this.name=x,this.iterable=F}render(p){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(p)}optimizeNames(p,T){if(!super.optimizeNames(p,T))return;return this.iterable=B(this.iterable,p,T),this}get names(){return Z(super.names,this.iterable.names)}},R=class extends v{constructor(p,T,x){super();this.name=p,this.args=T,this.async=x}render(p){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(p)}};R.kind="func";var y=class extends P{render(p){return"return "+super.render(p)}};y.kind="return";var N=class extends v{render(p){let T="try"+super.render(p);if(this.catch)T+=this.catch.render(p);if(this.finally)T+=this.finally.render(p);return T}optimizeNodes(){var p,T;return super.optimizeNodes(),(p=this.catch)===null||p===void 0||p.optimizeNodes(),(T=this.finally)===null||T===void 0||T.optimizeNodes(),this}optimizeNames(p,T){var x,F;return super.optimizeNames(p,T),(x=this.catch)===null||x===void 0||x.optimizeNames(p,T),(F=this.finally)===null||F===void 0||F.optimizeNames(p,T),this}get names(){let p=super.names;if(this.catch)Z(p,this.catch.names);if(this.finally)Z(p,this.finally.names);return p}},q=class extends v{constructor(p){super();this.error=p}render(p){return`catch(${this.error})`+super.render(p)}};q.kind="catch";var H=class extends v{render(p){return"finally"+super.render(p)}};H.kind="finally";var L=class{constructor(p,T={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...T,_n:T.lines?`
77
+ `:""},this._extScope=p,this._scope=new r.Scope({parent:p}),this._nodes=[new w]}toString(){return this._root.render(this.opts)}name(p){return this._scope.name(p)}scopeName(p){return this._extScope.name(p)}scopeValue(p,T){let x=this._extScope.value(p,T);return(this._values[x.prefix]||(this._values[x.prefix]=new Set)).add(x),x}getScopeValue(p,T){return this._extScope.getValue(p,T)}scopeRefs(p){return this._extScope.scopeRefs(p,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(p,T,x,F){let K=this._scope.toName(T);if(x!==void 0&&F)this._constants[K.str]=x;return this._leafNode(new a(p,K,x)),K}const(p,T,x){return this._def(r.varKinds.const,p,T,x)}let(p,T,x){return this._def(r.varKinds.let,p,T,x)}var(p,T,x){return this._def(r.varKinds.var,p,T,x)}assign(p,T,x){return this._leafNode(new s(p,T,x))}add(p,T){return this._leafNode(new c(p,e.operators.ADD,T))}code(p){if(typeof p=="function")p();else if(p!==t.nil)this._leafNode(new E(p));return this}object(...p){let T=["{"];for(let[x,F]of p){if(T.length>1)T.push(",");if(T.push(x),x!==F||this.opts.es5)T.push(":"),(0,t.addCodeArg)(T,F)}return T.push("}"),new t._Code(T)}if(p,T,x){if(this._blockNode(new g(p)),T&&x)this.code(T).else().code(x).endIf();else if(T)this.code(T).endIf();else if(x)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(p){return this._elseNode(new g(p))}else(){return this._elseNode(new m)}endIf(){return this._endBlockNode(g,m)}_for(p,T){if(this._blockNode(p),T)this.code(T).endFor();return this}for(p,T){return this._for(new S(p),T)}forRange(p,T,x,F,K=this.opts.es5?r.varKinds.var:r.varKinds.let){let X=this._scope.toName(p);return this._for(new b(K,X,T,x),()=>F(X))}forOf(p,T,x,F=r.varKinds.const){let K=this._scope.toName(p);if(this.opts.es5){let X=T instanceof t.Name?T:this.var("_arr",T);return this.forRange("_i",0,t._`${X}.length`,(te)=>{this.var(K,t._`${X}[${te}]`),x(K)})}return this._for(new O("of",F,K,T),()=>x(K))}forIn(p,T,x,F=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(p,t._`Object.keys(${T})`,x);let K=this._scope.toName(p);return this._for(new O("in",F,K,T),()=>x(K))}endFor(){return this._endBlockNode(z)}label(p){return this._leafNode(new u(p))}break(p){return this._leafNode(new f(p))}return(p){let T=new y;if(this._blockNode(T),this.code(p),T.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(y)}try(p,T,x){if(!T&&!x)throw Error('CodeGen: "try" without "catch" and "finally"');let F=new N;if(this._blockNode(F),this.code(p),T){let K=this.name("e");this._currNode=F.catch=new q(K),T(K)}if(x)this._currNode=F.finally=new H,this.code(x);return this._endBlockNode(q,H)}throw(p){return this._leafNode(new _(p))}block(p,T){if(this._blockStarts.push(this._nodes.length),p)this.code(p).endBlock(T);return this}endBlock(p){let T=this._blockStarts.pop();if(T===void 0)throw Error("CodeGen: not in self-balancing block");let x=this._nodes.length-T;if(x<0||p!==void 0&&x!==p)throw Error(`CodeGen: wrong number of nodes: ${x} vs ${p} expected`);return this._nodes.length=T,this}func(p,T=t.nil,x,F){if(this._blockNode(new R(p,T,x)),F)this.code(F).endFunc();return this}endFunc(){return this._endBlockNode(R)}optimize(p=1){while(p-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(p){return this._currNode.nodes.push(p),this}_blockNode(p){this._currNode.nodes.push(p),this._nodes.push(p)}_endBlockNode(p,T){let x=this._currNode;if(x instanceof p||T&&x instanceof T)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${T?`${p.kind}/${T.kind}`:p.kind}"`)}_elseNode(p){let T=this._currNode;if(!(T instanceof g))throw Error('CodeGen: "else" without "if"');return this._currNode=T.else=p,this}get _root(){return this._nodes[0]}get _currNode(){let p=this._nodes;return p[p.length-1]}set _currNode(p){let T=this._nodes;T[T.length-1]=p}};e.CodeGen=L;function Z(p,T){for(let x in T)p[x]=(p[x]||0)+(T[x]||0);return p}function G(p,T){return T instanceof t._CodeOrName?Z(p,T.names):p}function B(p,T,x){if(p instanceof t.Name)return F(p);if(!K(p))return p;return new t._Code(p._items.reduce((X,te)=>{if(te instanceof t.Name)te=F(te);if(te instanceof t._Code)X.push(...te._items);else X.push(te);return X},[]));function F(X){let te=x[X.str];if(te===void 0||T[X.str]!==1)return X;return delete T[X.str],te}function K(X){return X instanceof t._Code&&X._items.some((te)=>te instanceof t.Name&&T[te.str]===1&&x[te.str]!==void 0)}}function he(p,T){for(let x in T)p[x]=(p[x]||0)-(T[x]||0)}function be(p){return typeof p=="boolean"||typeof p=="number"||p===null?!p:t._`!${k(p)}`}e.not=be;let ve=h(e.operators.AND);function ke(...p){return p.reduce(ve)}e.and=ke;let fe=h(e.operators.OR);function l(...p){return p.reduce(fe)}e.or=l;function h(p){return(T,x)=>T===t.nil?x:x===t.nil?T:t._`${k(T)} ${p} ${k(x)}`}function k(p){return p instanceof t.Name?p:t._`(${p})`}}),Se=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let t=me(),r=Xi();function n(R){let y={};for(let N of R)y[N]=!0;return y}e.toHash=n;function o(R,y){if(typeof y=="boolean")return y;if(Object.keys(y).length===0)return!0;return i(R,y),!a(y,R.self.RULES.all)}e.alwaysValidSchema=o;function i(R,y=R.schema){let{opts:N,self:q}=R;if(!N.strictSchema)return;if(typeof y==="boolean")return;let H=q.RULES.keywords;for(let L in y)if(!H[L])O(R,`unknown keyword: "${L}"`)}e.checkUnknownRules=i;function a(R,y){if(typeof R=="boolean")return!R;for(let N in R)if(y[N])return!0;return!1}e.schemaHasRules=a;function s(R,y){if(typeof R=="boolean")return!R;for(let N in R)if(N!=="$ref"&&y.all[N])return!0;return!1}e.schemaHasRulesButRef=s;function c({topSchemaRef:R,schemaPath:y},N,q,H){if(!H){if(typeof N=="number"||typeof N=="boolean")return N;if(typeof N=="string")return t._`${N}`}return t._`${R}${y}${(0,t.getProperty)(q)}`}e.schemaRefOrVal=c;function u(R){return E(decodeURIComponent(R))}e.unescapeFragment=u;function f(R){return encodeURIComponent(_(R))}e.escapeFragment=f;function _(R){if(typeof R=="number")return`${R}`;return R.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=_;function E(R){return R.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=E;function P(R,y){if(Array.isArray(R))for(let N of R)y(N);else y(R)}e.eachItem=P;function v({mergeNames:R,mergeToName:y,mergeValues:N,resultToName:q}){return(H,L,Z,G)=>{let B=Z===void 0?L:Z instanceof t.Name?(L instanceof t.Name?R(H,L,Z):y(H,L,Z),Z):L instanceof t.Name?(y(H,Z,L),L):N(L,Z);return G===t.Name&&!(B instanceof t.Name)?q(H,B):B}}e.mergeEvaluated={props:v({mergeNames:(R,y,N)=>R.if(t._`${N} !== true && ${y} !== undefined`,()=>{R.if(t._`${y} === true`,()=>R.assign(N,!0),()=>R.assign(N,t._`${N} || {}`).code(t._`Object.assign(${N}, ${y})`))}),mergeToName:(R,y,N)=>R.if(t._`${N} !== true`,()=>{if(y===!0)R.assign(N,!0);else R.assign(N,t._`${N} || {}`),m(R,N,y)}),mergeValues:(R,y)=>R===!0?!0:{...R,...y},resultToName:w}),items:v({mergeNames:(R,y,N)=>R.if(t._`${N} !== true && ${y} !== undefined`,()=>R.assign(N,t._`${y} === true ? true : ${N} > ${y} ? ${N} : ${y}`)),mergeToName:(R,y,N)=>R.if(t._`${N} !== true`,()=>R.assign(N,y===!0?!0:t._`${N} > ${y} ? ${N} : ${y}`)),mergeValues:(R,y)=>R===!0?!0:Math.max(R,y),resultToName:(R,y)=>R.var("items",y)})};function w(R,y){if(y===!0)return R.var("props",!0);let N=R.var("props",t._`{}`);if(y!==void 0)m(R,N,y);return N}e.evaluatedPropsToName=w;function m(R,y,N){Object.keys(N).forEach((q)=>R.assign(t._`${y}${(0,t.getProperty)(q)}`,!0))}e.setEvaluated=m;let g={};function z(R,y){return R.scopeValue("func",{ref:y,code:g[y.code]||(g[y.code]=new r._Code(y.code))})}e.useFunc=z;var S;(function(R){R[R.Num=0]="Num",R[R.Str=1]="Str"})(S||(e.Type=S={}));function b(R,y,N){if(R instanceof t.Name){let q=y===S.Num;return N?q?t._`"[" + ${R} + "]"`:t._`"['" + ${R} + "']"`:q?t._`"/" + ${R}`:t._`"/" + ${R}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return N?(0,t.getProperty)(R).toString():"/"+_(R)}e.getErrorPath=b;function O(R,y,N=R.opts.strictSchema){if(!N)return;if(y=`strict mode: ${y}`,N===!0)throw Error(y);R.self.logger.warn(y)}e.checkStrictMode=O}),at=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r={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")};e.default=r}),ta=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=me(),r=Se(),n=at();e.keywordError={message:({keyword:m})=>t.str`must pass "${m}" keyword validation`},e.keyword$DataError={message:({keyword:m,schemaType:g})=>g?t.str`"${m}" keyword must be ${g} ($data)`:t.str`"${m}" keyword is invalid ($data)`};function o(m,g=e.keywordError,z,S){let{it:b}=m,{gen:O,compositeRule:R,allErrors:y}=b,N=_(m,g,z);if(S!==null&&S!==void 0?S:R||y)c(O,N);else u(b,t._`[${N}]`)}e.reportError=o;function i(m,g=e.keywordError,z){let{it:S}=m,{gen:b,compositeRule:O,allErrors:R}=S;if(c(b,_(m,g,z)),!(O||R))u(S,n.default.vErrors)}e.reportExtraError=i;function a(m,g){m.assign(n.default.errors,g),m.if(t._`${n.default.vErrors} !== null`,()=>m.if(g,()=>m.assign(t._`${n.default.vErrors}.length`,g),()=>m.assign(n.default.vErrors,null)))}e.resetErrorsCount=a;function s({gen:m,keyword:g,schemaValue:z,data:S,errsCount:b,it:O}){if(b===void 0)throw Error("ajv implementation error");let R=m.name("err");m.forRange("i",b,n.default.errors,(y)=>{if(m.const(R,t._`${n.default.vErrors}[${y}]`),m.if(t._`${R}.instancePath === undefined`,()=>m.assign(t._`${R}.instancePath`,(0,t.strConcat)(n.default.instancePath,O.errorPath))),m.assign(t._`${R}.schemaPath`,t.str`${O.errSchemaPath}/${g}`),O.opts.verbose)m.assign(t._`${R}.schema`,z),m.assign(t._`${R}.data`,S)})}e.extendErrors=s;function c(m,g){let z=m.const("err",g);m.if(t._`${n.default.vErrors} === null`,()=>m.assign(n.default.vErrors,t._`[${z}]`),t._`${n.default.vErrors}.push(${z})`),m.code(t._`${n.default.errors}++`)}function u(m,g){let{gen:z,validateName:S,schemaEnv:b}=m;if(b.$async)z.throw(t._`new ${m.ValidationError}(${g})`);else z.assign(t._`${S}.errors`,g),z.return(!1)}let f={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 _(m,g,z){let{createErrors:S}=m.it;if(S===!1)return t._`{}`;return E(m,g,z)}function E(m,g,z={}){let{gen:S,it:b}=m,O=[P(b,z),v(m,z)];return w(m,g,O),S.object(...O)}function P({errorPath:m},{instancePath:g}){let z=g?t.str`${m}${(0,r.getErrorPath)(g,r.Type.Str)}`:m;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,z)]}function v({keyword:m,it:{errSchemaPath:g}},{schemaPath:z,parentSchema:S}){let b=S?g:t.str`${g}/${m}`;if(z)b=t.str`${b}${(0,r.getErrorPath)(z,r.Type.Str)}`;return[f.schemaPath,b]}function w(m,{params:g,message:z},S){let{keyword:b,data:O,schemaValue:R,it:y}=m,{opts:N,propertyName:q,topSchemaRef:H,schemaPath:L}=y;if(S.push([f.keyword,b],[f.params,typeof g=="function"?g(m):g||t._`{}`]),N.messages)S.push([f.message,typeof z=="function"?z(m):z]);if(N.verbose)S.push([f.schema,R],[f.parentSchema,t._`${H}${L}`],[n.default.data,O]);if(q)S.push([f.propertyName,q])}}),WS=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=ta(),r=me(),n=at(),o={message:"boolean schema is false"};function i(c){let{gen:u,schema:f,validateName:_}=c;if(f===!1)s(c,!1);else if(typeof f=="object"&&f.$async===!0)u.return(n.default.data);else u.assign(r._`${_}.errors`,null),u.return(!0)}e.topBoolOrEmptySchema=i;function a(c,u){let{gen:f,schema:_}=c;if(_===!1)f.var(u,!1),s(c);else f.var(u,!0)}e.boolOrEmptySchema=a;function s(c,u){let{gen:f,data:_}=c,E={gen:f,keyword:"false schema",data:_,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:c};(0,t.reportError)(E,o,void 0,u)}}),Fh=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set(["string","number","integer","boolean","null","object","array"]);function r(o){return typeof o=="string"&&t.has(o)}e.isJSONType=r;function n(){let o={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...o,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},o.number,o.string,o.array,o.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=n}),Zh=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:o,self:i},a){let s=i.RULES.types[a];return s&&s!==!0&&r(o,s)}e.schemaHasRulesForType=t;function r(o,i){return i.rules.some((a)=>n(o,a))}e.shouldUseGroup=r;function n(o,i){var a;return o[i.keyword]!==void 0||((a=i.definition.implements)===null||a===void 0?void 0:a.some((s)=>o[s]!==void 0))}e.shouldUseRule=n}),ea=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let t=Fh(),r=Zh(),n=ta(),o=me(),i=Se();var a;(function(S){S[S.Correct=0]="Correct",S[S.Wrong=1]="Wrong"})(a||(e.DataType=a={}));function s(S){let b=c(S.type);if(b.includes("null")){if(S.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!b.length&&S.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(S.nullable===!0)b.push("null")}return b}e.getSchemaTypes=s;function c(S){let b=Array.isArray(S)?S:S?[S]:[];if(b.every(t.isJSONType))return b;throw Error("type must be JSONType or JSONType[]: "+b.join(","))}e.getJSONTypes=c;function u(S,b){let{gen:O,data:R,opts:y}=S,N=_(b,y.coerceTypes),q=b.length>0&&!(N.length===0&&b.length===1&&(0,r.schemaHasRulesForType)(S,b[0]));if(q){let H=w(b,R,y.strictNumbers,a.Wrong);O.if(H,()=>{if(N.length)E(S,b,N);else g(S)})}return q}e.coerceAndCheckDataType=u;let f=new Set(["string","number","integer","boolean","null"]);function _(S,b){return b?S.filter((O)=>f.has(O)||b==="array"&&O==="array"):[]}function E(S,b,O){let{gen:R,data:y,opts:N}=S,q=R.let("dataType",o._`typeof ${y}`),H=R.let("coerced",o._`undefined`);if(N.coerceTypes==="array")R.if(o._`${q} == 'object' && Array.isArray(${y}) && ${y}.length == 1`,()=>R.assign(y,o._`${y}[0]`).assign(q,o._`typeof ${y}`).if(w(b,y,N.strictNumbers),()=>R.assign(H,y)));R.if(o._`${H} !== undefined`);for(let Z of O)if(f.has(Z)||Z==="array"&&N.coerceTypes==="array")L(Z);R.else(),g(S),R.endIf(),R.if(o._`${H} !== undefined`,()=>{R.assign(y,H),P(S,H)});function L(Z){switch(Z){case"string":R.elseIf(o._`${q} == "number" || ${q} == "boolean"`).assign(H,o._`"" + ${y}`).elseIf(o._`${y} === null`).assign(H,o._`""`);return;case"number":R.elseIf(o._`${q} == "boolean" || ${y} === null
78
78
  || (${q} == "string" && ${y} && ${y} == +${y})`).assign(H,o._`+${y}`);return;case"integer":R.elseIf(o._`${q} === "boolean" || ${y} === null
79
79
  || (${q} === "string" && ${y} && ${y} == +${y} && !(${y} % 1))`).assign(H,o._`+${y}`);return;case"boolean":R.elseIf(o._`${y} === "false" || ${y} === 0 || ${y} === null`).assign(H,!1).elseIf(o._`${y} === "true" || ${y} === 1`).assign(H,!0);return;case"null":R.elseIf(o._`${y} === "" || ${y} === 0 || ${y} === false`),R.assign(H,null);return;case"array":R.elseIf(o._`${q} === "string" || ${q} === "number"
80
- || ${q} === "boolean" || ${y} === null`).assign(H,o._`[${y}]`)}}}function P({gen:S,parentData:b,parentDataProperty:O},R){S.if(o._`${b} !== undefined`,()=>S.assign(o._`${b}[${O}]`,R))}function v(S,b,O,R=a.Correct){let y=R===a.Correct?o.operators.EQ:o.operators.NEQ,N;switch(S){case"null":return o._`${b} ${y} null`;case"array":N=o._`Array.isArray(${b})`;break;case"object":N=o._`${b} && typeof ${b} == "object" && !Array.isArray(${b})`;break;case"integer":N=q(o._`!(${b} % 1) && !isNaN(${b})`);break;case"number":N=q();break;default:return o._`typeof ${b} ${y} ${S}`}return R===a.Correct?N:(0,o.not)(N);function q(H=o.nil){return(0,o.and)(o._`typeof ${b} == "number"`,H,O?o._`isFinite(${b})`:o.nil)}}e.checkDataType=v;function w(S,b,O,R){if(S.length===1)return v(S[0],b,O,R);let y,N=(0,s.toHash)(S);if(N.array&&N.object){let q=o._`typeof ${b} != "object"`;y=N.null?q:o._`!${b} || ${q}`,delete N.null,delete N.array,delete N.object}else y=o.nil;if(N.number)delete N.integer;for(let q in N)y=(0,o.and)(y,v(q,b,O,R));return y}e.checkDataTypes=w;let m={message:({schema:S})=>`must be ${S}`,params:({schema:S,schemaValue:b})=>typeof S=="string"?o._`{type: ${S}}`:o._`{type: ${b}}`};function g(S){let b=z(S);(0,n.reportError)(b,m)}e.reportTypeError=g;function z(S){let{gen:b,data:O,schema:R}=S,y=(0,s.schemaRefOrVal)(S,R,"type");return{gen:b,keyword:"type",data:O,schema:R.type,schemaCode:y,schemaValue:y,parentSchema:R,params:{},it:S}}}),jy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=me(),r=Se();function n(s,a){let{properties:i,items:c}=s.schema;if(a==="object"&&i)for(let u in i)o(s,u,i[u].default);else if(a==="array"&&Array.isArray(c))c.forEach((u,f)=>o(s,f,u.default))}e.assignDefaults=n;function o(s,a,i){let{gen:c,compositeRule:u,data:f,opts:_}=s;if(i===void 0)return;let E=t._`${f}${(0,t.getProperty)(a)}`;if(u){(0,r.checkStrictMode)(s,`default is ignored for: ${E}`);return}let P=t._`${E} === undefined`;if(_.useDefaults==="empty")P=t._`${P} || ${E} === null || ${E} === ""`;c.if(P,t._`${E} = ${(0,t.stringify)(i)}`)}}),lt=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;let t=me(),r=Se(),n=ut(),o=Se();function s(S,b){let{gen:O,data:R,it:y}=S;O.if(_(O,R,b,y.opts.ownProperties),()=>{S.setParams({missingProperty:t._`${b}`},!0),S.error()})}e.checkReportMissingProp=s;function a({gen:S,data:b,it:{opts:O}},R,y){return(0,t.or)(...R.map((N)=>(0,t.and)(_(S,b,N,O.ownProperties),t._`${y} = ${N}`)))}e.checkMissingProp=a;function i(S,b){S.setParams({missingProperty:b},!0),S.error()}e.reportMissingProp=i;function c(S){return S.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:t._`Object.prototype.hasOwnProperty`})}e.hasPropFunc=c;function u(S,b,O){return t._`${c(S)}.call(${b}, ${O})`}e.isOwnProperty=u;function f(S,b,O,R){let y=t._`${b}${(0,t.getProperty)(O)} !== undefined`;return R?t._`${y} && ${u(S,b,O)}`:y}e.propertyInData=f;function _(S,b,O,R){let y=t._`${b}${(0,t.getProperty)(O)} === undefined`;return R?(0,t.or)(y,(0,t.not)(u(S,b,O))):y}e.noPropertyInData=_;function E(S){return S?Object.keys(S).filter((b)=>b!=="__proto__"):[]}e.allSchemaProperties=E;function P(S,b){return E(b).filter((O)=>!(0,r.alwaysValidSchema)(S,b[O]))}e.schemaProperties=P;function v({schemaCode:S,data:b,it:{gen:O,topSchemaRef:R,schemaPath:y,errorPath:N},it:q},H,D,Z){let G=Z?t._`${S}, ${b}, ${R}${y}`:b,B=[[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,N)],[n.default.parentData,q.parentData],[n.default.parentDataProperty,q.parentDataProperty],[n.default.rootData,n.default.rootData]];if(q.opts.dynamicRef)B.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);let he=t._`${G}, ${O.object(...B)}`;return D!==t.nil?t._`${H}.call(${D}, ${he})`:t._`${H}(${he})`}e.callValidateCode=v;let w=t._`new RegExp`;function m({gen:S,it:{opts:b}},O){let R=b.unicodeRegExp?"u":"",{regExp:y}=b.code,N=y(O,R);return S.scopeValue("pattern",{key:N.toString(),ref:N,code:t._`${y.code==="new RegExp"?w:(0,o.useFunc)(S,y)}(${O}, ${R})`})}e.usePattern=m;function g(S){let{gen:b,data:O,keyword:R,it:y}=S,N=b.name("valid");if(y.allErrors){let H=b.let("valid",!0);return q(()=>b.assign(H,!1)),H}return b.var(N,!0),q(()=>b.break()),N;function q(H){let D=b.const("len",t._`${O}.length`);b.forRange("i",0,D,(Z)=>{S.subschema({keyword:R,dataProp:Z,dataPropType:r.Type.Num},N),b.if((0,t.not)(N),H)})}}e.validateArray=g;function z(S){let{gen:b,schema:O,keyword:R,it:y}=S;if(!Array.isArray(O))throw Error("ajv implementation error");if(O.some((H)=>(0,r.alwaysValidSchema)(y,H))&&!y.opts.unevaluated)return;let N=b.let("valid",!1),q=b.name("_valid");b.block(()=>O.forEach((H,D)=>{let Z=S.subschema({keyword:R,schemaProp:D,compositeRule:!0},q);if(b.assign(N,t._`${N} || ${q}`),!S.mergeValidEvaluated(Z,q))b.if((0,t.not)(N))})),S.result(N,()=>S.reset(),()=>S.error(!0))}e.validateUnion=z}),My=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=me(),r=ut(),n=lt(),o=aa();function s(P,v){let{gen:w,keyword:m,schema:g,parentSchema:z,it:S}=P,b=v.macro.call(S.self,g,z,S),O=f(w,m,b);if(S.opts.validateSchema!==!1)S.self.validateSchema(b,!0);let R=w.name("valid");P.subschema({schema:b,schemaPath:t.nil,errSchemaPath:`${S.errSchemaPath}/${m}`,topSchemaRef:O,compositeRule:!0},R),P.pass(R,()=>P.error(!0))}e.macroKeywordCode=s;function a(P,v){var w;let{gen:m,keyword:g,schema:z,parentSchema:S,$data:b,it:O}=P;u(O,v);let R=f(m,g,!b&&v.compile?v.compile.call(O.self,z,S,O):v.validate),y=m.let("valid");P.block$data(y,N),P.ok((w=v.valid)!==null&&w!==void 0?w:y);function N(){if(v.errors===!1){if(D(),v.modifying)i(P);Z(()=>P.error())}else{let G=v.async?q():H();if(v.modifying)i(P);Z(()=>c(P,G))}}function q(){let G=m.let("ruleErrs",null);return m.try(()=>D(t._`await `),(B)=>m.assign(y,!1).if(t._`${B} instanceof ${O.ValidationError}`,()=>m.assign(G,t._`${B}.errors`),()=>m.throw(B))),G}function H(){let G=t._`${R}.errors`;return m.assign(G,null),D(t.nil),G}function D(G=v.async?t._`await `:t.nil){let B=O.opts.passContext?r.default.this:r.default.self,he=!(("compile"in v)&&!b||v.schema===!1);m.assign(y,t._`${G}${(0,n.callValidateCode)(P,R,B,he)}`,v.modifying)}function Z(G){var B;m.if((0,t.not)((B=v.valid)!==null&&B!==void 0?B:y),G)}}e.funcKeywordCode=a;function i(P){let{gen:v,data:w,it:m}=P;v.if(m.parentData,()=>v.assign(w,t._`${m.parentData}[${m.parentDataProperty}]`))}function c(P,v){let{gen:w}=P;w.if(t._`Array.isArray(${v})`,()=>{w.assign(r.default.vErrors,t._`${r.default.vErrors} === null ? ${v} : ${r.default.vErrors}.concat(${v})`).assign(r.default.errors,t._`${r.default.vErrors}.length`),(0,o.extendErrors)(P)},()=>P.error())}function u({schemaEnv:P},v){if(v.async&&!P.$async)throw Error("async keyword in sync schema")}function f(P,v,w){if(w===void 0)throw Error(`keyword "${v}" failed to compile`);return P.scopeValue("keyword",typeof w=="function"?{ref:w}:{ref:w,code:(0,t.stringify)(w)})}function _(P,v,w=!1){return!v.length||v.some((m)=>m==="array"?Array.isArray(P):m==="object"?P&&typeof P=="object"&&!Array.isArray(P):typeof P==m||w&&typeof P>"u")}e.validSchemaType=_;function E({schema:P,opts:v,self:w,errSchemaPath:m},g,z){if(Array.isArray(g.keyword)?!g.keyword.includes(z):g.keyword!==z)throw Error("ajv implementation error");let S=g.dependencies;if(S===null||S===void 0?void 0:S.some((b)=>!Object.prototype.hasOwnProperty.call(P,b)))throw Error(`parent schema must have dependencies of ${z}: ${S.join(",")}`);if(g.validateSchema){if(!g.validateSchema(P[z])){let b=`keyword "${z}" value is invalid at path "${m}": `+w.errorsText(g.validateSchema.errors);if(v.validateSchema==="log")w.logger.error(b);else throw Error(b)}}}e.validateKeywordUsage=E}),qy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=me(),r=Se();function n(a,{keyword:i,schemaProp:c,schema:u,schemaPath:f,errSchemaPath:_,topSchemaRef:E}){if(i!==void 0&&u!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(i!==void 0){let P=a.schema[i];return c===void 0?{schema:P,schemaPath:t._`${a.schemaPath}${(0,t.getProperty)(i)}`,errSchemaPath:`${a.errSchemaPath}/${i}`}:{schema:P[c],schemaPath:t._`${a.schemaPath}${(0,t.getProperty)(i)}${(0,t.getProperty)(c)}`,errSchemaPath:`${a.errSchemaPath}/${i}/${(0,r.escapeFragment)(c)}`}}if(u!==void 0){if(f===void 0||_===void 0||E===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:u,schemaPath:f,topSchemaRef:E,errSchemaPath:_}}throw Error('either "keyword" or "schema" must be passed')}e.getSubschema=n;function o(a,i,{dataProp:c,dataPropType:u,data:f,dataTypes:_,propertyName:E}){if(f!==void 0&&c!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:P}=i;if(c!==void 0){let{errorPath:w,dataPathArr:m,opts:g}=i;v(P.let("data",t._`${i.data}${(0,t.getProperty)(c)}`,!0)),a.errorPath=t.str`${w}${(0,r.getErrorPath)(c,u,g.jsPropertySyntax)}`,a.parentDataProperty=t._`${c}`,a.dataPathArr=[...m,a.parentDataProperty]}if(f!==void 0){if(v(f instanceof t.Name?f:P.let("data",f,!0)),E!==void 0)a.propertyName=E}if(_)a.dataTypes=_;function v(w){a.data=w,a.dataLevel=i.dataLevel+1,a.dataTypes=[],i.definedProperties=new Set,a.parentData=i.data,a.dataNames=[...i.dataNames,w]}}e.extendSubschemaData=o;function s(a,{jtdDiscriminator:i,jtdMetadata:c,compositeRule:u,createErrors:f,allErrors:_}){if(u!==void 0)a.compositeRule=u;if(f!==void 0)a.createErrors=f;if(_!==void 0)a.allErrors=_;a.jtdDiscriminator=i,a.jtdMetadata=c}e.extendSubschemaMode=s}),lf=V((e,t)=>{t.exports=function r(n,o){if(n===o)return!0;if(n&&o&&typeof n=="object"&&typeof o=="object"){if(n.constructor!==o.constructor)return!1;var s,a,i;if(Array.isArray(n)){if(s=n.length,s!=o.length)return!1;for(a=s;a--!==0;)if(!r(n[a],o[a]))return!1;return!0}if(n.constructor===RegExp)return n.source===o.source&&n.flags===o.flags;if(n.valueOf!==Object.prototype.valueOf)return n.valueOf()===o.valueOf();if(n.toString!==Object.prototype.toString)return n.toString()===o.toString();if(i=Object.keys(n),s=i.length,s!==Object.keys(o).length)return!1;for(a=s;a--!==0;)if(!Object.prototype.hasOwnProperty.call(o,i[a]))return!1;for(a=s;a--!==0;){var c=i[a];if(!r(n[c],o[c]))return!1}return!0}return n!==n&&o!==o}}),Ly=V((e,t)=>{var r=t.exports=function(s,a,i){if(typeof a=="function")i=a,a={};i=a.cb||i;var c=typeof i=="function"?i:i.pre||function(){},u=i.post||function(){};n(a,c,u,s,"",s)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.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 n(s,a,i,c,u,f,_,E,P,v){if(c&&typeof c=="object"&&!Array.isArray(c)){a(c,u,f,_,E,P,v);for(var w in c){var m=c[w];if(Array.isArray(m)){if(w in r.arrayKeywords)for(var g=0;g<m.length;g++)n(s,a,i,m[g],u+"/"+w+"/"+g,f,u,w,c,g)}else if(w in r.propsKeywords){if(m&&typeof m=="object")for(var z in m)n(s,a,i,m[z],u+"/"+w+"/"+o(z),f,u,w,c,z)}else if(w in r.keywords||s.allKeys&&!(w in r.skipKeywords))n(s,a,i,m,u+"/"+w,f,u,w,c)}i(c,u,f,_,E,P,v)}}function o(s){return s.replace(/~/g,"~0").replace(/\//g,"~1")}}),ca=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=Se(),r=lf(),n=Ly(),o=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function s(m,g=!0){if(typeof m=="boolean")return!0;if(g===!0)return!i(m);if(!g)return!1;return c(m)<=g}e.inlineRef=s;let a=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function i(m){for(let g in m){if(a.has(g))return!0;let z=m[g];if(Array.isArray(z)&&z.some(i))return!0;if(typeof z=="object"&&i(z))return!0}return!1}function c(m){let g=0;for(let z in m){if(z==="$ref")return 1/0;if(g++,o.has(z))continue;if(typeof m[z]=="object")(0,t.eachItem)(m[z],(S)=>g+=c(S));if(g===1/0)return 1/0}return g}function u(m,g="",z){if(z!==!1)g=E(g);return f(m,m.parse(g))}e.getFullPath=u;function f(m,g){return m.serialize(g).split("#")[0]+"#"}e._getFullPath=f;let _=/#\/?$/;function E(m){return m?m.replace(_,""):""}e.normalizeId=E;function P(m,g,z){return z=E(z),m.resolve(g,z)}e.resolveUrl=P;let v=/^[a-z_][-a-z0-9._]*$/i;function w(m,g){if(typeof m=="boolean")return{};let{schemaId:z,uriResolver:S}=this.opts,b=E(m[z]||g),O={"":b},R=u(S,b,!1),y={},N=new Set;return n(m,{allKeys:!0},(D,Z,G,B)=>{if(B===void 0)return;let he=R+Z,we=O[B];if(typeof D[z]=="string")we=be.call(this,D[z]);Oe.call(this,D.$anchor),Oe.call(this,D.$dynamicAnchor),O[Z]=we;function be(fe){let l=this.opts.uriResolver.resolve;if(fe=E(we?l(we,fe):fe),N.has(fe))throw H(fe);N.add(fe);let h=this.refs[fe];if(typeof h=="string")h=this.refs[h];if(typeof h=="object")q(D,h.schema,fe);else if(fe!==E(he))if(fe[0]==="#")q(D,y[fe],fe),y[fe]=D;else this.refs[fe]=he;return fe}function Oe(fe){if(typeof fe=="string"){if(!v.test(fe))throw Error(`invalid anchor "${fe}"`);be.call(this,`#${fe}`)}}}),y;function q(D,Z,G){if(Z!==void 0&&!r(D,Z))throw H(G)}function H(D){return Error(`reference "${D}" resolves to more than one schema`)}}e.getSchemaRefs=w}),Kr=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=Ay(),r=ia(),n=uf(),o=ia(),s=jy(),a=My(),i=qy(),c=me(),u=ut(),f=ca(),_=Se(),E=aa();function P(C){if(R(C)){if(N(C),O(C)){g(C);return}}v(C,()=>(0,t.topBoolOrEmptySchema)(C))}e.validateFunctionCode=P;function v({gen:C,validateName:M,schema:U,schemaEnv:ee,opts:ie},ue){if(ie.code.es5)C.func(M,c._`${u.default.data}, ${u.default.valCxt}`,ee.$async,()=>{C.code(c._`"use strict"; ${S(U,ie)}`),m(C,ie),C.code(ue)});else C.func(M,c._`${u.default.data}, ${w(ie)}`,ee.$async,()=>C.code(S(U,ie)).code(ue))}function w(C){return c._`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${C.dynamicRef?c._`, ${u.default.dynamicAnchors}={}`:c.nil}}={}`}function m(C,M){C.if(u.default.valCxt,()=>{if(C.var(u.default.instancePath,c._`${u.default.valCxt}.${u.default.instancePath}`),C.var(u.default.parentData,c._`${u.default.valCxt}.${u.default.parentData}`),C.var(u.default.parentDataProperty,c._`${u.default.valCxt}.${u.default.parentDataProperty}`),C.var(u.default.rootData,c._`${u.default.valCxt}.${u.default.rootData}`),M.dynamicRef)C.var(u.default.dynamicAnchors,c._`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{if(C.var(u.default.instancePath,c._`""`),C.var(u.default.parentData,c._`undefined`),C.var(u.default.parentDataProperty,c._`undefined`),C.var(u.default.rootData,u.default.data),M.dynamicRef)C.var(u.default.dynamicAnchors,c._`{}`)})}function g(C){let{schema:M,opts:U,gen:ee}=C;v(C,()=>{if(U.$comment&&M.$comment)B(C);if(D(C),ee.let(u.default.vErrors,null),ee.let(u.default.errors,0),U.unevaluated)z(C);q(C),he(C)})}function z(C){let{gen:M,validateName:U}=C;C.evaluated=M.const("evaluated",c._`${U}.evaluated`),M.if(c._`${C.evaluated}.dynamicProps`,()=>M.assign(c._`${C.evaluated}.props`,c._`undefined`)),M.if(c._`${C.evaluated}.dynamicItems`,()=>M.assign(c._`${C.evaluated}.items`,c._`undefined`))}function S(C,M){let U=typeof C=="object"&&C[M.schemaId];return U&&(M.code.source||M.code.process)?c._`/*# sourceURL=${U} */`:c.nil}function b(C,M){if(R(C)){if(N(C),O(C)){y(C,M);return}}(0,t.boolOrEmptySchema)(C,M)}function O({schema:C,self:M}){if(typeof C=="boolean")return!C;for(let U in C)if(M.RULES.all[U])return!0;return!1}function R(C){return typeof C.schema!="boolean"}function y(C,M){let{schema:U,gen:ee,opts:ie}=C;if(ie.$comment&&U.$comment)B(C);Z(C),G(C);let ue=ee.const("_errs",u.default.errors);q(C,ue),ee.var(M,c._`${ue} === ${u.default.errors}`)}function N(C){(0,_.checkUnknownRules)(C),H(C)}function q(C,M){if(C.opts.jtd)return be(C,[],!1,M);let U=(0,r.getSchemaTypes)(C.schema);be(C,U,!(0,r.coerceAndCheckDataType)(C,U),M)}function H(C){let{schema:M,errSchemaPath:U,opts:ee,self:ie}=C;if(M.$ref&&ee.ignoreKeywordsWithRef&&(0,_.schemaHasRulesButRef)(M,ie.RULES))ie.logger.warn(`$ref: keywords ignored in schema at path "${U}"`)}function D(C){let{schema:M,opts:U}=C;if(M.default!==void 0&&U.useDefaults&&U.strictSchema)(0,_.checkStrictMode)(C,"default is ignored in the schema root")}function Z(C){let M=C.schema[C.opts.schemaId];if(M)C.baseId=(0,f.resolveUrl)(C.opts.uriResolver,C.baseId,M)}function G(C){if(C.schema.$async&&!C.schemaEnv.$async)throw Error("async schema in sync schema")}function B({gen:C,schemaEnv:M,schema:U,errSchemaPath:ee,opts:ie}){let ue=U.$comment;if(ie.$comment===!0)C.code(c._`${u.default.self}.logger.log(${ue})`);else if(typeof ie.$comment=="function"){let Te=c.str`${ee}/$comment`,Ne=C.scopeValue("root",{ref:M.root});C.code(c._`${u.default.self}.opts.$comment(${ue}, ${Te}, ${Ne}.schema)`)}}function he(C){let{gen:M,schemaEnv:U,validateName:ee,ValidationError:ie,opts:ue}=C;if(U.$async)M.if(c._`${u.default.errors} === 0`,()=>M.return(u.default.data),()=>M.throw(c._`new ${ie}(${u.default.vErrors})`));else{if(M.assign(c._`${ee}.errors`,u.default.vErrors),ue.unevaluated)we(C);M.return(c._`${u.default.errors} === 0`)}}function we({gen:C,evaluated:M,props:U,items:ee}){if(U instanceof c.Name)C.assign(c._`${M}.props`,U);if(ee instanceof c.Name)C.assign(c._`${M}.items`,ee)}function be(C,M,U,ee){let{gen:ie,schema:ue,data:Te,allErrors:Ne,opts:qe,self:Ce}=C,{RULES:$e}=Ce;if(ue.$ref&&(qe.ignoreKeywordsWithRef||!(0,_.schemaHasRulesButRef)(ue,$e))){ie.block(()=>X(C,"$ref",$e.all.$ref.definition));return}if(!qe.jtd)fe(C,M);ie.block(()=>{for(let xe of $e.rules)Ue(xe);Ue($e.post)});function Ue(xe){if(!(0,n.shouldUseGroup)(ue,xe))return;if(xe.type){if(ie.if((0,o.checkDataType)(xe.type,Te,qe.strictNumbers)),Oe(C,xe),M.length===1&&M[0]===xe.type&&U)ie.else(),(0,o.reportTypeError)(C);ie.endIf()}else Oe(C,xe);if(!Ne)ie.if(c._`${u.default.errors} === ${ee||0}`)}}function Oe(C,M){let{gen:U,schema:ee,opts:{useDefaults:ie}}=C;if(ie)(0,s.assignDefaults)(C,M.type);U.block(()=>{for(let ue of M.rules)if((0,n.shouldUseRule)(ee,ue))X(C,ue.keyword,ue.definition,M.type)})}function fe(C,M){if(C.schemaEnv.meta||!C.opts.strictTypes)return;if(l(C,M),!C.opts.allowUnionTypes)h(C,M);k(C,C.dataTypes)}function l(C,M){if(!M.length)return;if(!C.dataTypes.length){C.dataTypes=M;return}M.forEach((U)=>{if(!T(C.dataTypes,U))F(C,`type "${U}" not allowed by context "${C.dataTypes.join(",")}"`)}),x(C,M)}function h(C,M){if(M.length>1&&!(M.length===2&&M.includes("null")))F(C,"use allowUnionTypes to allow union type keyword")}function k(C,M){let U=C.self.RULES.all;for(let ee in U){let ie=U[ee];if(typeof ie=="object"&&(0,n.shouldUseRule)(C.schema,ie)){let{type:ue}=ie.definition;if(ue.length&&!ue.some((Te)=>p(M,Te)))F(C,`missing type "${ue.join(",")}" for keyword "${ee}"`)}}}function p(C,M){return C.includes(M)||M==="number"&&C.includes("integer")}function T(C,M){return C.includes(M)||M==="integer"&&C.includes("number")}function x(C,M){let U=[];for(let ee of C.dataTypes)if(T(M,ee))U.push(ee);else if(M.includes("integer")&&ee==="number")U.push("integer");C.dataTypes=U}function F(C,M){let U=C.schemaEnv.baseId+C.errSchemaPath;M+=` at "${U}" (strictTypes)`,(0,_.checkStrictMode)(C,M,C.opts.strictTypes)}var K=class{constructor(C,M,U){if((0,a.validateKeywordUsage)(C,M,U),this.gen=C.gen,this.allErrors=C.allErrors,this.keyword=U,this.data=C.data,this.schema=C.schema[U],this.$data=M.$data&&C.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,_.schemaRefOrVal)(C,this.schema,U,this.$data),this.schemaType=M.schemaType,this.parentSchema=C.schema,this.params={},this.it=C,this.def=M,this.$data)this.schemaCode=C.gen.const("vSchema",oe(this.$data,C));else if(this.schemaCode=this.schemaValue,!(0,a.validSchemaType)(this.schema,M.schemaType,M.allowUndefined))throw Error(`${U} value must be ${JSON.stringify(M.schemaType)}`);if("code"in M?M.trackErrors:M.errors!==!1)this.errsCount=C.gen.const("_errs",u.default.errors)}result(C,M,U){this.failResult((0,c.not)(C),M,U)}failResult(C,M,U){if(this.gen.if(C),U)U();else this.error();if(M){if(this.gen.else(),M(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(C,M){this.failResult((0,c.not)(C),void 0,M)}fail(C){if(C===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(C),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(C){if(!this.$data)return this.fail(C);let{schemaCode:M}=this;this.fail(c._`${M} !== undefined && (${(0,c.or)(this.invalid$data(),C)})`)}error(C,M,U){if(M){this.setParams(M),this._error(C,U),this.setParams({});return}this._error(C,U)}_error(C,M){(C?E.reportExtraError:E.reportError)(this,this.def.error,M)}$dataError(){(0,E.reportError)(this,this.def.$dataError||E.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,E.resetErrorsCount)(this.gen,this.errsCount)}ok(C){if(!this.allErrors)this.gen.if(C)}setParams(C,M){if(M)Object.assign(this.params,C);else this.params=C}block$data(C,M,U=c.nil){this.gen.block(()=>{this.check$data(C,U),M()})}check$data(C=c.nil,M=c.nil){if(!this.$data)return;let{gen:U,schemaCode:ee,schemaType:ie,def:ue}=this;if(U.if((0,c.or)(c._`${ee} === undefined`,M)),C!==c.nil)U.assign(C,!0);if(ie.length||ue.validateSchema){if(U.elseIf(this.invalid$data()),this.$dataError(),C!==c.nil)U.assign(C,!1)}U.else()}invalid$data(){let{gen:C,schemaCode:M,schemaType:U,def:ee,it:ie}=this;return(0,c.or)(ue(),Te());function ue(){if(U.length){if(!(M instanceof c.Name))throw Error("ajv implementation error");let Ne=Array.isArray(U)?U:[U];return c._`${(0,o.checkDataTypes)(Ne,M,ie.opts.strictNumbers,o.DataType.Wrong)}`}return c.nil}function Te(){if(ee.validateSchema){let Ne=C.scopeValue("validate$data",{ref:ee.validateSchema});return c._`!${Ne}(${M})`}return c.nil}}subschema(C,M){let U=(0,i.getSubschema)(this.it,C);(0,i.extendSubschemaData)(U,this.it,C),(0,i.extendSubschemaMode)(U,C);let ee={...this.it,...U,items:void 0,props:void 0};return b(ee,M),ee}mergeEvaluated(C,M){let{it:U,gen:ee}=this;if(!U.opts.unevaluated)return;if(U.props!==!0&&C.props!==void 0)U.props=_.mergeEvaluated.props(ee,C.props,U.props,M);if(U.items!==!0&&C.items!==void 0)U.items=_.mergeEvaluated.items(ee,C.items,U.items,M)}mergeValidEvaluated(C,M){let{it:U,gen:ee}=this;if(U.opts.unevaluated&&(U.props!==!0||U.items!==!0))return ee.if(M,()=>this.mergeEvaluated(C,c.Name)),!0}};e.KeywordCxt=K;function X(C,M,U,ee){let ie=new K(C,U,M);if("code"in U)U.code(ie,ee);else if(ie.$data&&U.validate)(0,a.funcKeywordCode)(ie,U);else if("macro"in U)(0,a.macroKeywordCode)(ie,U);else if(U.compile||U.validate)(0,a.funcKeywordCode)(ie,U)}let te=/^\/(?:[^~]|~0|~1)*$/,le=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function oe(C,{dataLevel:M,dataNames:U,dataPathArr:ee}){let ie,ue;if(C==="")return u.default.rootData;if(C[0]==="/"){if(!te.test(C))throw Error(`Invalid JSON-pointer: ${C}`);ie=C,ue=u.default.rootData}else{let Ce=le.exec(C);if(!Ce)throw Error(`Invalid JSON-pointer: ${C}`);let $e=+Ce[1];if(ie=Ce[2],ie==="#"){if($e>=M)throw Error(qe("property/index",$e));return ee[M-$e]}if($e>M)throw Error(qe("data",$e));if(ue=U[M-$e],!ie)return ue}let Te=ue,Ne=ie.split("/");for(let Ce of Ne)if(Ce)ue=c._`${ue}${(0,c.getProperty)((0,_.unescapeJsonPointer)(Ce))}`,Te=c._`${Te} && ${ue}`;return Te;function qe(Ce,$e){return`Cannot access ${Ce} ${$e} levels up, current level is ${M}`}}e.getData=oe}),bo=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});var t=class extends Error{constructor(r){super("validation failed");this.errors=r,this.ajv=this.validation=!0}};e.default=t}),Br=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ca();var r=class extends Error{constructor(n,o,s,a){super(a||`can't resolve reference ${s} from id ${o}`);this.missingRef=(0,t.resolveUrl)(n,o,s),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(n,this.missingRef))}};e.default=r}),ua=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=me(),r=bo(),n=ut(),o=ca(),s=Se(),a=Kr();var i=class{constructor(g){var z;this.refs={},this.dynamicAnchors={};let S;if(typeof g.schema=="object")S=g.schema;this.schema=g.schema,this.schemaId=g.schemaId,this.root=g.root||this,this.baseId=(z=g.baseId)!==null&&z!==void 0?z:(0,o.normalizeId)(S===null||S===void 0?void 0:S[g.schemaId||"$id"]),this.schemaPath=g.schemaPath,this.localRefs=g.localRefs,this.meta=g.meta,this.$async=S===null||S===void 0?void 0:S.$async,this.refs={}}};e.SchemaEnv=i;function c(g){let z=_.call(this,g);if(z)return z;let S=(0,o.getFullPath)(this.opts.uriResolver,g.root.baseId),{es5:b,lines:O}=this.opts.code,{ownProperties:R}=this.opts,y=new t.CodeGen(this.scope,{es5:b,lines:O,ownProperties:R}),N;if(g.$async)N=y.scopeValue("Error",{ref:r.default,code:t._`require("ajv/dist/runtime/validation_error").default`});let q=y.scopeName("validate");g.validateName=q;let H={gen:y,allErrors:this.opts.allErrors,data:n.default.data,parentData:n.default.parentData,parentDataProperty:n.default.parentDataProperty,dataNames:[n.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:y.scopeValue("schema",this.opts.code.source===!0?{ref:g.schema,code:(0,t.stringify)(g.schema)}:{ref:g.schema}),validateName:q,ValidationError:N,schema:g.schema,schemaEnv:g,rootId:S,baseId:g.baseId||S,schemaPath:t.nil,errSchemaPath:g.schemaPath||(this.opts.jtd?"":"#"),errorPath:t._`""`,opts:this.opts,self:this},D;try{this._compilations.add(g),(0,a.validateFunctionCode)(H),y.optimize(this.opts.code.optimize);let Z=y.toString();if(D=`${y.scopeRefs(n.default.scope)}return ${Z}`,this.opts.code.process)D=this.opts.code.process(D,g);let G=Function(`${n.default.self}`,`${n.default.scope}`,D)(this,this.scope.get());if(this.scope.value(q,{ref:G}),G.errors=null,G.schema=g.schema,G.schemaEnv=g,g.$async)G.$async=!0;if(this.opts.code.source===!0)G.source={validateName:q,validateCode:Z,scopeValues:y._values};if(this.opts.unevaluated){let{props:B,items:he}=H;if(G.evaluated={props:B instanceof t.Name?void 0:B,items:he instanceof t.Name?void 0:he,dynamicProps:B instanceof t.Name,dynamicItems:he instanceof t.Name},G.source)G.source.evaluated=(0,t.stringify)(G.evaluated)}return g.validate=G,g}catch(Z){if(delete g.validate,delete g.validateName,D)this.logger.error("Error compiling schema, function code:",D);throw Z}finally{this._compilations.delete(g)}}e.compileSchema=c;function u(g,z,S){var b;S=(0,o.resolveUrl)(this.opts.uriResolver,z,S);let O=g.refs[S];if(O)return O;let R=P.call(this,g,S);if(R===void 0){let y=(b=g.localRefs)===null||b===void 0?void 0:b[S],{schemaId:N}=this.opts;if(y)R=new i({schema:y,schemaId:N,root:g,baseId:z})}if(R===void 0)return;return g.refs[S]=f.call(this,R)}e.resolveRef=u;function f(g){if((0,o.inlineRef)(g.schema,this.opts.inlineRefs))return g.schema;return g.validate?g:c.call(this,g)}function _(g){for(let z of this._compilations)if(E(z,g))return z}e.getCompilingSchema=_;function E(g,z){return g.schema===z.schema&&g.root===z.root&&g.baseId===z.baseId}function P(g,z){let S;while(typeof(S=this.refs[z])=="string")z=S;return S||this.schemas[z]||v.call(this,g,z)}function v(g,z){let S=this.opts.uriResolver.parse(z),b=(0,o._getFullPath)(this.opts.uriResolver,S),O=(0,o.getFullPath)(this.opts.uriResolver,g.baseId,void 0);if(Object.keys(g.schema).length>0&&b===O)return m.call(this,S,g);let R=(0,o.normalizeId)(b),y=this.refs[R]||this.schemas[R];if(typeof y=="string"){let N=v.call(this,g,y);if(typeof(N===null||N===void 0?void 0:N.schema)!=="object")return;return m.call(this,S,N)}if(typeof(y===null||y===void 0?void 0:y.schema)!=="object")return;if(!y.validate)c.call(this,y);if(R===(0,o.normalizeId)(z)){let{schema:N}=y,{schemaId:q}=this.opts,H=N[q];if(H)O=(0,o.resolveUrl)(this.opts.uriResolver,O,H);return new i({schema:N,schemaId:q,root:g,baseId:O})}return m.call(this,S,y)}e.resolveSchema=v;let w=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function m(g,{baseId:z,schema:S,root:b}){var O;if(((O=g.fragment)===null||O===void 0?void 0:O[0])!=="/")return;for(let N of g.fragment.slice(1).split("/")){if(typeof S==="boolean")return;let q=S[(0,s.unescapeFragment)(N)];if(q===void 0)return;S=q;let H=typeof S==="object"&&S[this.opts.schemaId];if(!w.has(N)&&H)z=(0,o.resolveUrl)(this.opts.uriResolver,z,H)}let R;if(typeof S!="boolean"&&S.$ref&&!(0,s.schemaHasRulesButRef)(S,this.RULES)){let N=(0,o.resolveUrl)(this.opts.uriResolver,z,S.$ref);R=v.call(this,b,N)}let{schemaId:y}=this.opts;if(R=R||new i({schema:S,schemaId:y,root:b,baseId:z}),R.schema!==R.root.schema)return R}}),Dy=V((e,t)=>{t.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),df=V((e,t)=>{let r=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),n=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 o(v){let w="",m=0,g=0;for(g=0;g<v.length;g++){if(m=v[g].charCodeAt(0),m===48)continue;if(!(m>=48&&m<=57||m>=65&&m<=70||m>=97&&m<=102))return"";w+=v[g];break}for(g+=1;g<v.length;g++){if(m=v[g].charCodeAt(0),!(m>=48&&m<=57||m>=65&&m<=70||m>=97&&m<=102))return"";w+=v[g]}return w}let s=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function a(v){return v.length=0,!0}function i(v,w,m){if(v.length){let g=o(v);if(g!=="")w.push(g);else return m.error=!0,!1;v.length=0}return!0}function c(v){let w=0,m={error:!1,address:"",zone:""},g=[],z=[],S=!1,b=!1,O=i;for(let R=0;R<v.length;R++){let y=v[R];if(y==="["||y==="]")continue;if(y===":"){if(S===!0)b=!0;if(!O(z,g,m))break;if(++w>7){m.error=!0;break}if(R>0&&v[R-1]===":")S=!0;g.push(":");continue}else if(y==="%"){if(!O(z,g,m))break;O=a}else{z.push(y);continue}}if(z.length)if(O===a)m.zone=z.join("");else if(b)g.push(z.join(""));else g.push(o(z));return m.address=g.join(""),m}function u(v){if(f(v,":")<2)return{host:v,isIPV6:!1};let w=c(v);if(!w.error){let{address:m,address:g}=w;if(w.zone)m+="%"+w.zone,g+="%25"+w.zone;return{host:m,isIPV6:!0,escapedHost:g}}else return{host:v,isIPV6:!1}}function f(v,w){let m=0;for(let g=0;g<v.length;g++)if(v[g]===w)m++;return m}function _(v){let w=v,m=[],g=-1,z=0;while(z=w.length){if(z===1)if(w===".")break;else if(w==="/"){m.push("/");break}else{m.push(w);break}else if(z===2){if(w[0]==="."){if(w[1]===".")break;else if(w[1]==="/"){w=w.slice(2);continue}}else if(w[0]==="/"){if(w[1]==="."||w[1]==="/"){m.push("/");break}}}else if(z===3){if(w==="/.."){if(m.length!==0)m.pop();m.push("/");break}}if(w[0]==="."){if(w[1]==="."){if(w[2]==="/"){w=w.slice(3);continue}}else if(w[1]==="/"){w=w.slice(2);continue}}else if(w[0]==="/"){if(w[1]==="."){if(w[2]==="/"){w=w.slice(2);continue}else if(w[2]==="."){if(w[3]==="/"){if(w=w.slice(3),m.length!==0)m.pop();continue}}}}if((g=w.indexOf("/",1))===-1){m.push(w);break}else m.push(w.slice(0,g)),w=w.slice(g)}return m.join("")}function E(v,w){let m=w!==!0?escape:unescape;if(v.scheme!==void 0)v.scheme=m(v.scheme);if(v.userinfo!==void 0)v.userinfo=m(v.userinfo);if(v.host!==void 0)v.host=m(v.host);if(v.path!==void 0)v.path=m(v.path);if(v.query!==void 0)v.query=m(v.query);if(v.fragment!==void 0)v.fragment=m(v.fragment);return v}function P(v){let w=[];if(v.userinfo!==void 0)w.push(v.userinfo),w.push("@");if(v.host!==void 0){let m=unescape(v.host);if(!n(m)){let g=u(m);if(g.isIPV6===!0)m=`[${g.escapedHost}]`;else m=v.host}w.push(m)}if(typeof v.port==="number"||typeof v.port==="string")w.push(":"),w.push(String(v.port));return w.length?w.join(""):void 0}t.exports={nonSimpleDomain:s,recomposeAuthority:P,normalizeComponentEncoding:E,removeDotSegments:_,isIPv4:n,isUUID:r,normalizeIPv6:u,stringArrayToHexStripped:o}}),Uy=V((e,t)=>{let{isUUID:r}=df(),n=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,o=["http","https","ws","wss","urn","urn:uuid"];function s(y){return o.indexOf(y)!==-1}function a(y){if(y.secure===!0)return!0;else if(y.secure===!1)return!1;else if(y.scheme)return y.scheme.length===3&&(y.scheme[0]==="w"||y.scheme[0]==="W")&&(y.scheme[1]==="s"||y.scheme[1]==="S")&&(y.scheme[2]==="s"||y.scheme[2]==="S");else return!1}function i(y){if(!y.host)y.error=y.error||"HTTP URIs must have a host.";return y}function c(y){let N=String(y.scheme).toLowerCase()==="https";if(y.port===(N?443:80)||y.port==="")y.port=void 0;if(!y.path)y.path="/";return y}function u(y){return y.secure=a(y),y.resourceName=(y.path||"/")+(y.query?"?"+y.query:""),y.path=void 0,y.query=void 0,y}function f(y){if(y.port===(a(y)?443:80)||y.port==="")y.port=void 0;if(typeof y.secure==="boolean")y.scheme=y.secure?"wss":"ws",y.secure=void 0;if(y.resourceName){let[N,q]=y.resourceName.split("?");y.path=N&&N!=="/"?N:void 0,y.query=q,y.resourceName=void 0}return y.fragment=void 0,y}function _(y,N){if(!y.path)return y.error="URN can not be parsed",y;let q=y.path.match(n);if(q){let H=N.scheme||y.scheme||"urn";y.nid=q[1].toLowerCase(),y.nss=q[2];let D=R(`${H}:${N.nid||y.nid}`);if(y.path=void 0,D)y=D.parse(y,N)}else y.error=y.error||"URN can not be parsed.";return y}function E(y,N){if(y.nid===void 0)throw Error("URN without nid cannot be serialized");let q=N.scheme||y.scheme||"urn",H=y.nid.toLowerCase(),D=R(`${q}:${N.nid||H}`);if(D)y=D.serialize(y,N);let Z=y,G=y.nss;return Z.path=`${H||N.nid}:${G}`,N.skipEscape=!0,Z}function P(y,N){let q=y;if(q.uuid=q.nss,q.nss=void 0,!N.tolerant&&(!q.uuid||!r(q.uuid)))q.error=q.error||"UUID is not valid.";return q}function v(y){let N=y;return N.nss=(y.uuid||"").toLowerCase(),N}let w={scheme:"http",domainHost:!0,parse:i,serialize:c},m={scheme:"https",domainHost:w.domainHost,parse:i,serialize:c},g={scheme:"ws",domainHost:!0,parse:u,serialize:f},z={scheme:"wss",domainHost:g.domainHost,parse:g.parse,serialize:g.serialize},O={http:w,https:m,ws:g,wss:z,urn:{scheme:"urn",parse:_,serialize:E,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:P,serialize:v,skipNormalize:!0}};Object.setPrototypeOf(O,null);function R(y){return y&&(O[y]||O[y.toLowerCase()])||void 0}t.exports={wsIsSecure:a,SCHEMES:O,isValidSchemeName:s,getSchemeHandler:R}}),Fy=V((e,t)=>{let{normalizeIPv6:r,removeDotSegments:n,recomposeAuthority:o,normalizeComponentEncoding:s,isIPv4:a,nonSimpleDomain:i}=df(),{SCHEMES:c,getSchemeHandler:u}=Uy();function f(z,S){if(typeof z==="string")z=v(m(z,S),S);else if(typeof z==="object")z=m(v(z,S),S);return z}function _(z,S,b){let O=b?Object.assign({scheme:"null"},b):{scheme:"null"},R=E(m(z,O),m(S,O),O,!0);return O.skipEscape=!0,v(R,O)}function E(z,S,b,O){let R={};if(!O)z=m(v(z,b),b),S=m(v(S,b),b);if(b=b||{},!b.tolerant&&S.scheme)R.scheme=S.scheme,R.userinfo=S.userinfo,R.host=S.host,R.port=S.port,R.path=n(S.path||""),R.query=S.query;else{if(S.userinfo!==void 0||S.host!==void 0||S.port!==void 0)R.userinfo=S.userinfo,R.host=S.host,R.port=S.port,R.path=n(S.path||""),R.query=S.query;else{if(!S.path)if(R.path=z.path,S.query!==void 0)R.query=S.query;else R.query=z.query;else{if(S.path[0]==="/")R.path=n(S.path);else{if((z.userinfo!==void 0||z.host!==void 0||z.port!==void 0)&&!z.path)R.path="/"+S.path;else if(!z.path)R.path=S.path;else R.path=z.path.slice(0,z.path.lastIndexOf("/")+1)+S.path;R.path=n(R.path)}R.query=S.query}R.userinfo=z.userinfo,R.host=z.host,R.port=z.port}R.scheme=z.scheme}return R.fragment=S.fragment,R}function P(z,S,b){if(typeof z==="string")z=unescape(z),z=v(s(m(z,b),!0),{...b,skipEscape:!0});else if(typeof z==="object")z=v(s(z,!0),{...b,skipEscape:!0});if(typeof S==="string")S=unescape(S),S=v(s(m(S,b),!0),{...b,skipEscape:!0});else if(typeof S==="object")S=v(s(S,!0),{...b,skipEscape:!0});return z.toLowerCase()===S.toLowerCase()}function v(z,S){let b={host:z.host,scheme:z.scheme,userinfo:z.userinfo,port:z.port,path:z.path,query:z.query,nid:z.nid,nss:z.nss,uuid:z.uuid,fragment:z.fragment,reference:z.reference,resourceName:z.resourceName,secure:z.secure,error:""},O=Object.assign({},S),R=[],y=u(O.scheme||b.scheme);if(y&&y.serialize)y.serialize(b,O);if(b.path!==void 0)if(!O.skipEscape){if(b.path=escape(b.path),b.scheme!==void 0)b.path=b.path.split("%3A").join(":")}else b.path=unescape(b.path);if(O.reference!=="suffix"&&b.scheme)R.push(b.scheme,":");let N=o(b);if(N!==void 0){if(O.reference!=="suffix")R.push("//");if(R.push(N),b.path&&b.path[0]!=="/")R.push("/")}if(b.path!==void 0){let q=b.path;if(!O.absolutePath&&(!y||!y.absolutePath))q=n(q);if(N===void 0&&q[0]==="/"&&q[1]==="/")q="/%2F"+q.slice(2);R.push(q)}if(b.query!==void 0)R.push("?",b.query);if(b.fragment!==void 0)R.push("#",b.fragment);return R.join("")}let w=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function m(z,S){let b=Object.assign({},S),O={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},R=!1;if(b.reference==="suffix")if(b.scheme)z=b.scheme+":"+z;else z="//"+z;let y=z.match(w);if(y){if(O.scheme=y[1],O.userinfo=y[3],O.host=y[4],O.port=parseInt(y[5],10),O.path=y[6]||"",O.query=y[7],O.fragment=y[8],isNaN(O.port))O.port=y[5];if(O.host)if(a(O.host)===!1){let q=r(O.host);O.host=q.host.toLowerCase(),R=q.isIPV6}else R=!0;if(O.scheme===void 0&&O.userinfo===void 0&&O.host===void 0&&O.port===void 0&&O.query===void 0&&!O.path)O.reference="same-document";else if(O.scheme===void 0)O.reference="relative";else if(O.fragment===void 0)O.reference="absolute";else O.reference="uri";if(b.reference&&b.reference!=="suffix"&&b.reference!==O.reference)O.error=O.error||"URI is not a "+b.reference+" reference.";let N=u(b.scheme||O.scheme);if(!b.unicodeSupport&&(!N||!N.unicodeSupport)){if(O.host&&(b.domainHost||N&&N.domainHost)&&R===!1&&i(O.host))try{O.host=URL.domainToASCII(O.host.toLowerCase())}catch(q){O.error=O.error||"Host's domain name can not be converted to ASCII: "+q}}if(!N||N&&!N.skipNormalize){if(z.indexOf("%")!==-1){if(O.scheme!==void 0)O.scheme=unescape(O.scheme);if(O.host!==void 0)O.host=unescape(O.host)}if(O.path)O.path=escape(unescape(O.path));if(O.fragment)O.fragment=encodeURI(decodeURIComponent(O.fragment))}if(N&&N.parse)N.parse(O,b)}else O.error=O.error||"URI can not be parsed.";return O}let g={SCHEMES:c,normalize:f,resolve:_,resolveComponent:E,equal:P,serialize:v,parse:m};t.exports=g,t.exports.default=g,t.exports.fastUri=g}),Zy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Fy();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),qu=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=Kr();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=me();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});let n=bo(),o=Br(),s=cf(),a=ua(),i=me(),c=ca(),u=ia(),f=Se(),_=Dy(),E=Zy(),P=(l,h)=>new RegExp(l,h);P.code="new RegExp";let v=["removeAdditional","useDefaults","coerceTypes"],w=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),m={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."},g={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},z=200;function S(l){var h,k,p,T,x,F,K,X,te,le,oe,C,M,U,ee,ie,ue,Te,Ne,qe,Ce,$e,Ue,xe,nt;let Ge=l.strict,Fe=(h=l.code)===null||h===void 0?void 0:h.optimize,Rt=Fe===!0||Fe===void 0?1:Fe||0,zt=(p=(k=l.code)===null||k===void 0?void 0:k.regExp)!==null&&p!==void 0?p:P,Zt=(T=l.uriResolver)!==null&&T!==void 0?T:E.default;return{strictSchema:(F=(x=l.strictSchema)!==null&&x!==void 0?x:Ge)!==null&&F!==void 0?F:!0,strictNumbers:(X=(K=l.strictNumbers)!==null&&K!==void 0?K:Ge)!==null&&X!==void 0?X:!0,strictTypes:(le=(te=l.strictTypes)!==null&&te!==void 0?te:Ge)!==null&&le!==void 0?le:"log",strictTuples:(C=(oe=l.strictTuples)!==null&&oe!==void 0?oe:Ge)!==null&&C!==void 0?C:"log",strictRequired:(U=(M=l.strictRequired)!==null&&M!==void 0?M:Ge)!==null&&U!==void 0?U:!1,code:l.code?{...l.code,optimize:Rt,regExp:zt}:{optimize:Rt,regExp:zt},loopRequired:(ee=l.loopRequired)!==null&&ee!==void 0?ee:z,loopEnum:(ie=l.loopEnum)!==null&&ie!==void 0?ie:z,meta:(ue=l.meta)!==null&&ue!==void 0?ue:!0,messages:(Te=l.messages)!==null&&Te!==void 0?Te:!0,inlineRefs:(Ne=l.inlineRefs)!==null&&Ne!==void 0?Ne:!0,schemaId:(qe=l.schemaId)!==null&&qe!==void 0?qe:"$id",addUsedSchema:(Ce=l.addUsedSchema)!==null&&Ce!==void 0?Ce:!0,validateSchema:($e=l.validateSchema)!==null&&$e!==void 0?$e:!0,validateFormats:(Ue=l.validateFormats)!==null&&Ue!==void 0?Ue:!0,unicodeRegExp:(xe=l.unicodeRegExp)!==null&&xe!==void 0?xe:!0,int32range:(nt=l.int32range)!==null&&nt!==void 0?nt:!0,uriResolver:Zt}}var b=class{constructor(l={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,l=this.opts={...l,...S(l)};let{es5:h,lines:k}=this.opts.code;this.scope=new i.ValueScope({scope:{},prefixes:w,es5:h,lines:k}),this.logger=Z(l.logger);let p=l.validateFormats;if(l.validateFormats=!1,this.RULES=(0,s.getRules)(),O.call(this,m,l,"NOT SUPPORTED"),O.call(this,g,l,"DEPRECATED","warn"),this._metaOpts=H.call(this),l.formats)N.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),l.keywords)q.call(this,l.keywords);if(typeof l.meta=="object")this.addMetaSchema(l.meta);y.call(this),l.validateFormats=p}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:l,meta:h,schemaId:k}=this.opts,p=_;if(k==="id")p={..._},p.id=p.$id,delete p.$id;if(h&&l)this.addMetaSchema(p,p[k],!1)}defaultMeta(){let{meta:l,schemaId:h}=this.opts;return this.opts.defaultMeta=typeof l=="object"?l[h]||l:void 0}validate(l,h){let k;if(typeof l=="string"){if(k=this.getSchema(l),!k)throw Error(`no schema with key or ref "${l}"`)}else k=this.compile(l);let p=k(h);if(!("$async"in k))this.errors=k.errors;return p}compile(l,h){let k=this._addSchema(l,h);return k.validate||this._compileSchemaEnv(k)}compileAsync(l,h){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:k}=this.opts;return p.call(this,l,h);async function p(te,le){await T.call(this,te.$schema);let oe=this._addSchema(te,le);return oe.validate||x.call(this,oe)}async function T(te){if(te&&!this.getSchema(te))await p.call(this,{$ref:te},!0)}async function x(te){try{return this._compileSchemaEnv(te)}catch(le){if(!(le instanceof o.default))throw le;return F.call(this,le),await K.call(this,le.missingSchema),x.call(this,te)}}function F({missingSchema:te,missingRef:le}){if(this.refs[te])throw Error(`AnySchema ${te} is loaded but ${le} cannot be resolved`)}async function K(te){let le=await X.call(this,te);if(!this.refs[te])await T.call(this,le.$schema);if(!this.refs[te])this.addSchema(le,te,h)}async function X(te){let le=this._loading[te];if(le)return le;try{return await(this._loading[te]=k(te))}finally{delete this._loading[te]}}}addSchema(l,h,k,p=this.opts.validateSchema){if(Array.isArray(l)){for(let x of l)this.addSchema(x,void 0,k,p);return this}let T;if(typeof l==="object"){let{schemaId:x}=this.opts;if(T=l[x],T!==void 0&&typeof T!="string")throw Error(`schema ${x} must be string`)}return h=(0,c.normalizeId)(h||T),this._checkUnique(h),this.schemas[h]=this._addSchema(l,k,h,p,!0),this}addMetaSchema(l,h,k=this.opts.validateSchema){return this.addSchema(l,h,!0,k),this}validateSchema(l,h){if(typeof l=="boolean")return!0;let k;if(k=l.$schema,k!==void 0&&typeof k!="string")throw Error("$schema must be a string");if(k=k||this.opts.defaultMeta||this.defaultMeta(),!k)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let p=this.validate(k,l);if(!p&&h){let T="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(T);else throw Error(T)}return p}getSchema(l){let h;while(typeof(h=R.call(this,l))=="string")l=h;if(h===void 0){let{schemaId:k}=this.opts,p=new a.SchemaEnv({schema:{},schemaId:k});if(h=a.resolveSchema.call(this,p,l),!h)return;this.refs[l]=h}return h.validate||this._compileSchemaEnv(h)}removeSchema(l){if(l instanceof RegExp)return this._removeAllSchemas(this.schemas,l),this._removeAllSchemas(this.refs,l),this;switch(typeof l){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let h=R.call(this,l);if(typeof h=="object")this._cache.delete(h.schema);return delete this.schemas[l],delete this.refs[l],this}case"object":{let h=l;this._cache.delete(h);let k=l[this.opts.schemaId];if(k)k=(0,c.normalizeId)(k),delete this.schemas[k],delete this.refs[k];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(l){for(let h of l)this.addKeyword(h);return this}addKeyword(l,h){let k;if(typeof l=="string"){if(k=l,typeof h=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),h.keyword=k}else if(typeof l=="object"&&h===void 0){if(h=l,k=h.keyword,Array.isArray(k)&&!k.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(B.call(this,k,h),!h)return(0,f.eachItem)(k,(T)=>he.call(this,T)),this;be.call(this,h);let p={...h,type:(0,u.getJSONTypes)(h.type),schemaType:(0,u.getJSONTypes)(h.schemaType)};return(0,f.eachItem)(k,p.type.length===0?(T)=>he.call(this,T,p):(T)=>p.type.forEach((x)=>he.call(this,T,p,x))),this}getKeyword(l){let h=this.RULES.all[l];return typeof h=="object"?h.definition:!!h}removeKeyword(l){let{RULES:h}=this;delete h.keywords[l],delete h.all[l];for(let k of h.rules){let p=k.rules.findIndex((T)=>T.keyword===l);if(p>=0)k.rules.splice(p,1)}return this}addFormat(l,h){if(typeof h=="string")h=new RegExp(h);return this.formats[l]=h,this}errorsText(l=this.errors,{separator:h=", ",dataVar:k="data"}={}){if(!l||l.length===0)return"No errors";return l.map((p)=>`${k}${p.instancePath} ${p.message}`).reduce((p,T)=>p+h+T)}$dataMetaSchema(l,h){let k=this.RULES.all;l=JSON.parse(JSON.stringify(l));for(let p of h){let T=p.split("/").slice(1),x=l;for(let F of T)x=x[F];for(let F in k){let K=k[F];if(typeof K!="object")continue;let{$data:X}=K.definition,te=x[F];if(X&&te)x[F]=fe(te)}}return l}_removeAllSchemas(l,h){for(let k in l){let p=l[k];if(!h||h.test(k)){if(typeof p=="string")delete l[k];else if(p&&!p.meta)this._cache.delete(p.schema),delete l[k]}}}_addSchema(l,h,k,p=this.opts.validateSchema,T=this.opts.addUsedSchema){let x,{schemaId:F}=this.opts;if(typeof l=="object")x=l[F];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof l!="boolean")throw Error("schema must be object or boolean");let K=this._cache.get(l);if(K!==void 0)return K;k=(0,c.normalizeId)(x||k);let X=c.getSchemaRefs.call(this,l,k);if(K=new a.SchemaEnv({schema:l,schemaId:F,meta:h,baseId:k,localRefs:X}),this._cache.set(K.schema,K),T&&!k.startsWith("#")){if(k)this._checkUnique(k);this.refs[k]=K}if(p)this.validateSchema(l,!0);return K}_checkUnique(l){if(this.schemas[l]||this.refs[l])throw Error(`schema with key or id "${l}" already exists`)}_compileSchemaEnv(l){if(l.meta)this._compileMetaSchema(l);else a.compileSchema.call(this,l);if(!l.validate)throw Error("ajv implementation error");return l.validate}_compileMetaSchema(l){let h=this.opts;this.opts=this._metaOpts;try{a.compileSchema.call(this,l)}finally{this.opts=h}}};b.ValidationError=n.default,b.MissingRefError=o.default,e.default=b;function O(l,h,k,p="error"){for(let T in l){let x=T;if(x in h)this.logger[p](`${k}: option ${T}. ${l[x]}`)}}function R(l){return l=(0,c.normalizeId)(l),this.schemas[l]||this.refs[l]}function y(){let l=this.opts.schemas;if(!l)return;if(Array.isArray(l))this.addSchema(l);else for(let h in l)this.addSchema(l[h],h)}function N(){for(let l in this.opts.formats){let h=this.opts.formats[l];if(h)this.addFormat(l,h)}}function q(l){if(Array.isArray(l)){this.addVocabulary(l);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let h in l){let k=l[h];if(!k.keyword)k.keyword=h;this.addKeyword(k)}}function H(){let l={...this.opts};for(let h of v)delete l[h];return l}let D={log(){},warn(){},error(){}};function Z(l){if(l===!1)return D;if(l===void 0)return console;if(l.log&&l.warn&&l.error)return l;throw Error("logger must implement log, warn and error methods")}let G=/^[a-z_$][a-z0-9_$:-]*$/i;function B(l,h){let{RULES:k}=this;if((0,f.eachItem)(l,(p)=>{if(k.keywords[p])throw Error(`Keyword ${p} is already defined`);if(!G.test(p))throw Error(`Keyword ${p} has invalid name`)}),!h)return;if(h.$data&&!(("code"in h)||("validate"in h)))throw Error('$data keyword must have "code" or "validate" function')}function he(l,h,k){var p;let T=h===null||h===void 0?void 0:h.post;if(k&&T)throw Error('keyword with "post" flag cannot have "type"');let{RULES:x}=this,F=T?x.post:x.rules.find(({type:X})=>X===k);if(!F)F={type:k,rules:[]},x.rules.push(F);if(x.keywords[l]=!0,!h)return;let K={keyword:l,definition:{...h,type:(0,u.getJSONTypes)(h.type),schemaType:(0,u.getJSONTypes)(h.schemaType)}};if(h.before)we.call(this,F,K,h.before);else F.rules.push(K);x.all[l]=K,(p=h.implements)===null||p===void 0||p.forEach((X)=>this.addKeyword(X))}function we(l,h,k){let p=l.rules.findIndex((T)=>T.keyword===k);if(p>=0)l.rules.splice(p,0,h);else l.rules.push(h),this.logger.warn(`rule ${k} is not defined`)}function be(l){let{metaSchema:h}=l;if(h===void 0)return;if(l.$data&&this.opts.$data)h=fe(h);l.validateSchema=this.compile(h,!0)}let Oe={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function fe(l){return{anyOf:[l,Oe]}}}),Vy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};e.default=t}),Lu=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=Br(),r=lt(),n=me(),o=ut(),s=ua(),a=Se(),i={keyword:"$ref",schemaType:"string",code(f){let{gen:_,schema:E,it:P}=f,{baseId:v,schemaEnv:w,validateName:m,opts:g,self:z}=P,{root:S}=w;if((E==="#"||E==="#/")&&v===S.baseId)return O();let b=s.resolveRef.call(z,S,v,E);if(b===void 0)throw new t.default(P.opts.uriResolver,v,E);if(b instanceof s.SchemaEnv)return R(b);return y(b);function O(){if(w===S)return u(f,m,w,w.$async);let N=_.scopeValue("root",{ref:S});return u(f,n._`${N}.validate`,S,S.$async)}function R(N){u(f,c(f,N),N,N.$async)}function y(N){let q=_.scopeValue("schema",g.code.source===!0?{ref:N,code:(0,n.stringify)(N)}:{ref:N}),H=_.name("valid"),D=f.subschema({schema:N,dataTypes:[],schemaPath:n.nil,topSchemaRef:q,errSchemaPath:E},H);f.mergeEvaluated(D),f.ok(H)}}};function c(f,_){let{gen:E}=f;return _.validate?E.scopeValue("validate",{ref:_.validate}):n._`${E.scopeValue("wrapper",{ref:_})}.validate`}e.getValidate=c;function u(f,_,E,P){let{gen:v,it:w}=f,{allErrors:m,schemaEnv:g,opts:z}=w,S=z.passContext?o.default.this:n.nil;if(P)b();else O();function b(){if(!g.$async)throw Error("async schema referenced by sync schema");let N=v.let("valid");v.try(()=>{if(v.code(n._`await ${(0,r.callValidateCode)(f,_,S)}`),y(_),!m)v.assign(N,!0)},(q)=>{if(v.if(n._`!(${q} instanceof ${w.ValidationError})`,()=>v.throw(q)),R(q),!m)v.assign(N,!1)}),f.ok(N)}function O(){f.result((0,r.callValidateCode)(f,_,S),()=>y(_),()=>R(_))}function R(N){let q=n._`${N}.errors`;v.assign(o.default.vErrors,n._`${o.default.vErrors} === null ? ${q} : ${o.default.vErrors}.concat(${q})`),v.assign(o.default.errors,n._`${o.default.vErrors}.length`)}function y(N){var q;if(!w.opts.unevaluated)return;let H=(q=E===null||E===void 0?void 0:E.validate)===null||q===void 0?void 0:q.evaluated;if(w.props!==!0)if(H&&!H.dynamicProps){if(H.props!==void 0)w.props=a.mergeEvaluated.props(v,H.props,w.props)}else{let D=v.var("props",n._`${N}.evaluated.props`);w.props=a.mergeEvaluated.props(v,D,w.props,n.Name)}if(w.items!==!0)if(H&&!H.dynamicItems){if(H.items!==void 0)w.items=a.mergeEvaluated.items(v,H.items,w.items)}else{let D=v.var("items",n._`${N}.evaluated.items`);w.items=a.mergeEvaluated.items(v,D,w.items,n.Name)}}}e.callRef=u,e.default=i}),mf=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Vy(),r=Lu(),n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default];e.default=n}),Jy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=t.operators,n={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},o={keyword:Object.keys(n),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:s,schemaCode:a})=>t.str`must be ${n[s].okStr} ${a}`,params:({keyword:s,schemaCode:a})=>t._`{comparison: ${n[s].okStr}, limit: ${a}}`},code(s){let{keyword:a,data:i,schemaCode:c}=s;s.fail$data(t._`${i} ${n[a].fail} ${c} || isNaN(${i})`)}};e.default=o}),Hy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:n})=>t.str`must be multiple of ${n}`,params:({schemaCode:n})=>t._`{multipleOf: ${n}}`},code(n){let{gen:o,data:s,schemaCode:a,it:i}=n,c=i.opts.multipleOfPrecision,u=o.let("res"),f=c?t._`Math.abs(Math.round(${u}) - ${u}) > 1e-${c}`:t._`${u} !== parseInt(${u})`;n.fail$data(t._`(${a} === 0 || (${u} = ${s}/${a}, ${f}))`)}};e.default=r}),Ky=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});function t(r){let n=r.length,o=0,s=0,a;while(s<n)if(o++,a=r.charCodeAt(s++),a>=55296&&a<=56319&&s<n){if(a=r.charCodeAt(s),(a&64512)===56320)s++}return o}e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'}),By=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=Se(),n=Ky(),o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:s,schemaCode:a}){let i=s==="maxLength"?"more":"fewer";return t.str`must NOT have ${i} than ${a} characters`},params:({schemaCode:s})=>t._`{limit: ${s}}`},code(s){let{keyword:a,data:i,schemaCode:c,it:u}=s,f=a==="maxLength"?t.operators.GT:t.operators.LT,_=u.opts.unicode===!1?t._`${i}.length`:t._`${(0,r.useFunc)(s.gen,n.default)}(${i})`;s.fail$data(t._`${_} ${f} ${c}`)}};e.default=o}),Yy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=lt(),r=Se(),n=me(),o={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:s})=>n.str`must match pattern "${s}"`,params:({schemaCode:s})=>n._`{pattern: ${s}}`},code(s){let{gen:a,data:i,$data:c,schema:u,schemaCode:f,it:_}=s,E=_.opts.unicodeRegExp?"u":"";if(c){let{regExp:P}=_.opts.code,v=P.code==="new RegExp"?n._`new RegExp`:(0,r.useFunc)(a,P),w=a.let("valid");a.try(()=>a.assign(w,n._`${v}(${f}, ${E}).test(${i})`),()=>a.assign(w,!1)),s.fail$data(n._`!${w}`)}else{let P=(0,t.usePattern)(s,u);s.fail$data(n._`!${P}.test(${i})`)}}};e.default=o}),Gy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:o}){let s=n==="maxProperties"?"more":"fewer";return t.str`must NOT have ${s} than ${o} properties`},params:({schemaCode:n})=>t._`{limit: ${n}}`},code(n){let{keyword:o,data:s,schemaCode:a}=n,i=o==="maxProperties"?t.operators.GT:t.operators.LT;n.fail$data(t._`Object.keys(${s}).length ${i} ${a}`)}};e.default=r}),Qy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=lt(),r=me(),n=Se(),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:s}})=>r.str`must have required property '${s}'`,params:({params:{missingProperty:s}})=>r._`{missingProperty: ${s}}`},code(s){let{gen:a,schema:i,schemaCode:c,data:u,$data:f,it:_}=s,{opts:E}=_;if(!f&&i.length===0)return;let P=i.length>=E.loopRequired;if(_.allErrors)v();else w();if(E.strictRequired){let z=s.parentSchema.properties,{definedProperties:S}=s.it;for(let b of i)if((z===null||z===void 0?void 0:z[b])===void 0&&!S.has(b)){let O=`required property "${b}" is not defined at "${_.schemaEnv.baseId+_.errSchemaPath}" (strictRequired)`;(0,n.checkStrictMode)(_,O,_.opts.strictRequired)}}function v(){if(P||f)s.block$data(r.nil,m);else for(let z of i)(0,t.checkReportMissingProp)(s,z)}function w(){let z=a.let("missing");if(P||f){let S=a.let("valid",!0);s.block$data(S,()=>g(z,S)),s.ok(S)}else a.if((0,t.checkMissingProp)(s,i,z)),(0,t.reportMissingProp)(s,z),a.else()}function m(){a.forOf("prop",c,(z)=>{s.setParams({missingProperty:z}),a.if((0,t.noPropertyInData)(a,u,z,E.ownProperties),()=>s.error())})}function g(z,S){s.setParams({missingProperty:z}),a.forOf(z,c,()=>{a.assign(S,(0,t.propertyInData)(a,u,z,E.ownProperties)),a.if((0,r.not)(S),()=>{s.error(),a.break()})},r.nil)}}};e.default=o}),Wy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:o}){let s=n==="maxItems"?"more":"fewer";return t.str`must NOT have ${s} than ${o} items`},params:({schemaCode:n})=>t._`{limit: ${n}}`},code(n){let{keyword:o,data:s,schemaCode:a}=n,i=o==="maxItems"?t.operators.GT:t.operators.LT;n.fail$data(t._`${s}.length ${i} ${a}`)}};e.default=r}),Du=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=lf();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),Xy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ia(),r=me(),n=Se(),o=Du(),s={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:a,j:i}})=>r.str`must NOT have duplicate items (items ## ${i} and ${a} are identical)`,params:({params:{i:a,j:i}})=>r._`{i: ${a}, j: ${i}}`},code(a){let{gen:i,data:c,$data:u,schema:f,parentSchema:_,schemaCode:E,it:P}=a;if(!u&&!f)return;let v=i.let("valid"),w=_.items?(0,t.getSchemaTypes)(_.items):[];a.block$data(v,m,r._`${E} === false`),a.ok(v);function m(){let b=i.let("i",r._`${c}.length`),O=i.let("j");a.setParams({i:b,j:O}),i.assign(v,!0),i.if(r._`${b} > 1`,()=>(g()?z:S)(b,O))}function g(){return w.length>0&&!w.some((b)=>b==="object"||b==="array")}function z(b,O){let R=i.name("item"),y=(0,t.checkDataTypes)(w,R,P.opts.strictNumbers,t.DataType.Wrong),N=i.const("indices",r._`{}`);i.for(r._`;${b}--;`,()=>{if(i.let(R,r._`${c}[${b}]`),i.if(y,r._`continue`),w.length>1)i.if(r._`typeof ${R} == "string"`,r._`${R} += "_"`);i.if(r._`typeof ${N}[${R}] == "number"`,()=>{i.assign(O,r._`${N}[${R}]`),a.error(),i.assign(v,!1).break()}).code(r._`${N}[${R}] = ${b}`)})}function S(b,O){let R=(0,n.useFunc)(i,o.default),y=i.name("outer");i.label(y).for(r._`;${b}--;`,()=>i.for(r._`${O} = ${b}; ${O}--;`,()=>i.if(r._`${R}(${c}[${b}], ${c}[${O}])`,()=>{a.error(),i.assign(v,!1).break(y)})))}}};e.default=s}),ev=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=Se(),n=Du(),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:s})=>t._`{allowedValue: ${s}}`},code(s){let{gen:a,data:i,$data:c,schemaCode:u,schema:f}=s;if(c||f&&typeof f=="object")s.fail$data(t._`!${(0,r.useFunc)(a,n.default)}(${i}, ${u})`);else s.fail(t._`${f} !== ${i}`)}};e.default=o}),tv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=Se(),n=Du(),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:s})=>t._`{allowedValues: ${s}}`},code(s){let{gen:a,data:i,$data:c,schema:u,schemaCode:f,it:_}=s;if(!c&&u.length===0)throw Error("enum must have non-empty array");let E=u.length>=_.opts.loopEnum,P,v=()=>P!==null&&P!==void 0?P:P=(0,r.useFunc)(a,n.default),w;if(E||c)w=a.let("valid"),s.block$data(w,m);else{if(!Array.isArray(u))throw Error("ajv implementation error");let z=a.const("vSchema",f);w=(0,t.or)(...u.map((S,b)=>g(z,b)))}s.pass(w);function m(){a.assign(w,!1),a.forOf("v",f,(z)=>a.if(t._`${v()}(${i}, ${z})`,()=>a.assign(w,!0).break()))}function g(z,S){let b=u[S];return typeof b==="object"&&b!==null?t._`${v()}(${i}, ${z}[${S}])`:t._`${i} === ${b}`}}};e.default=o}),pf=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Jy(),r=Hy(),n=By(),o=Yy(),s=Gy(),a=Qy(),i=Wy(),c=Xy(),u=ev(),f=tv(),_=[t.default,r.default,n.default,o.default,s.default,a.default,i.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,f.default];e.default=_}),hf=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=me(),r=Se(),n={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:s}})=>t.str`must NOT have more than ${s} items`,params:({params:{len:s}})=>t._`{limit: ${s}}`},code(s){let{parentSchema:a,it:i}=s,{items:c}=a;if(!Array.isArray(c)){(0,r.checkStrictMode)(i,'"additionalItems" is ignored when "items" is not an array of schemas');return}o(s,c)}};function o(s,a){let{gen:i,schema:c,data:u,keyword:f,it:_}=s;_.items=!0;let E=i.const("len",t._`${u}.length`);if(c===!1)s.setParams({len:a.length}),s.pass(t._`${E} <= ${a.length}`);else if(typeof c=="object"&&!(0,r.alwaysValidSchema)(_,c)){let v=i.var("valid",t._`${E} <= ${a.length}`);i.if((0,t.not)(v),()=>P(v)),s.ok(v)}function P(v){i.forRange("i",a.length,E,(w)=>{if(s.subschema({keyword:f,dataProp:w,dataPropType:r.Type.Num},v),!_.allErrors)i.if((0,t.not)(v),()=>i.break())})}}e.validateAdditionalItems=o,e.default=n}),ff=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=me(),r=Se(),n=lt(),o={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(a){let{schema:i,it:c}=a;if(Array.isArray(i))return s(a,"additionalItems",i);if(c.items=!0,(0,r.alwaysValidSchema)(c,i))return;a.ok((0,n.validateArray)(a))}};function s(a,i,c=a.schema){let{gen:u,parentSchema:f,data:_,keyword:E,it:P}=a;if(m(f),P.opts.unevaluated&&c.length&&P.items!==!0)P.items=r.mergeEvaluated.items(u,c.length,P.items);let v=u.name("valid"),w=u.const("len",t._`${_}.length`);c.forEach((g,z)=>{if((0,r.alwaysValidSchema)(P,g))return;u.if(t._`${w} > ${z}`,()=>a.subschema({keyword:E,schemaProp:z,dataProp:z},v)),a.ok(v)});function m(g){let{opts:z,errSchemaPath:S}=P,b=c.length,O=b===g.minItems&&(b===g.maxItems||g[i]===!1);if(z.strictTuples&&!O){let R=`"${E}" is ${b}-tuple, but minItems or maxItems/${i} are not specified or different at path "${S}"`;(0,r.checkStrictMode)(P,R,z.strictTuples)}}}e.validateTuple=s,e.default=o}),rv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ff(),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(n)=>(0,t.validateTuple)(n,"items")};e.default=r}),nv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=Se(),n=lt(),o=hf(),s={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:a}})=>t.str`must NOT have more than ${a} items`,params:({params:{len:a}})=>t._`{limit: ${a}}`},code(a){let{schema:i,parentSchema:c,it:u}=a,{prefixItems:f}=c;if(u.items=!0,(0,r.alwaysValidSchema)(u,i))return;if(f)(0,o.validateAdditionalItems)(a,f);else a.ok((0,n.validateArray)(a))}};e.default=s}),ov=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=Se(),n={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:o,max:s}})=>s===void 0?t.str`must contain at least ${o} valid item(s)`:t.str`must contain at least ${o} and no more than ${s} valid item(s)`,params:({params:{min:o,max:s}})=>s===void 0?t._`{minContains: ${o}}`:t._`{minContains: ${o}, maxContains: ${s}}`},code(o){let{gen:s,schema:a,parentSchema:i,data:c,it:u}=o,f,_,{minContains:E,maxContains:P}=i;if(u.opts.next)f=E===void 0?1:E,_=P;else f=1;let v=s.const("len",t._`${c}.length`);if(o.setParams({min:f,max:_}),_===void 0&&f===0){(0,r.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(_!==void 0&&f>_){(0,r.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),o.fail();return}if((0,r.alwaysValidSchema)(u,a)){let S=t._`${v} >= ${f}`;if(_!==void 0)S=t._`${S} && ${v} <= ${_}`;o.pass(S);return}u.items=!0;let w=s.name("valid");if(_===void 0&&f===1)g(w,()=>s.if(w,()=>s.break()));else if(f===0){if(s.let(w,!0),_!==void 0)s.if(t._`${c}.length > 0`,m)}else s.let(w,!1),m();o.result(w,()=>o.reset());function m(){let S=s.name("_valid"),b=s.let("count",0);g(S,()=>s.if(S,()=>z(b)))}function g(S,b){s.forRange("i",0,v,(O)=>{o.subschema({keyword:"contains",dataProp:O,dataPropType:r.Type.Num,compositeRule:!0},S),b()})}function z(S){if(s.code(t._`${S}++`),_===void 0)s.if(t._`${S} >= ${f}`,()=>s.assign(w,!0).break());else if(s.if(t._`${S} > ${_}`,()=>s.assign(w,!1).break()),f===1)s.assign(w,!0);else s.if(t._`${S} >= ${f}`,()=>s.assign(w,!0))}}};e.default=n}),Uu=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=me(),r=Se(),n=lt();e.error={message:({params:{property:c,depsCount:u,deps:f}})=>{let _=u===1?"property":"properties";return t.str`must have ${_} ${f} when property ${c} is present`},params:({params:{property:c,depsCount:u,deps:f,missingProperty:_}})=>t._`{property: ${c},
80
+ || ${q} === "boolean" || ${y} === null`).assign(H,o._`[${y}]`)}}}function P({gen:S,parentData:b,parentDataProperty:O},R){S.if(o._`${b} !== undefined`,()=>S.assign(o._`${b}[${O}]`,R))}function v(S,b,O,R=a.Correct){let y=R===a.Correct?o.operators.EQ:o.operators.NEQ,N;switch(S){case"null":return o._`${b} ${y} null`;case"array":N=o._`Array.isArray(${b})`;break;case"object":N=o._`${b} && typeof ${b} == "object" && !Array.isArray(${b})`;break;case"integer":N=q(o._`!(${b} % 1) && !isNaN(${b})`);break;case"number":N=q();break;default:return o._`typeof ${b} ${y} ${S}`}return R===a.Correct?N:(0,o.not)(N);function q(H=o.nil){return(0,o.and)(o._`typeof ${b} == "number"`,H,O?o._`isFinite(${b})`:o.nil)}}e.checkDataType=v;function w(S,b,O,R){if(S.length===1)return v(S[0],b,O,R);let y,N=(0,i.toHash)(S);if(N.array&&N.object){let q=o._`typeof ${b} != "object"`;y=N.null?q:o._`!${b} || ${q}`,delete N.null,delete N.array,delete N.object}else y=o.nil;if(N.number)delete N.integer;for(let q in N)y=(0,o.and)(y,v(q,b,O,R));return y}e.checkDataTypes=w;let m={message:({schema:S})=>`must be ${S}`,params:({schema:S,schemaValue:b})=>typeof S=="string"?o._`{type: ${S}}`:o._`{type: ${b}}`};function g(S){let b=z(S);(0,n.reportError)(b,m)}e.reportTypeError=g;function z(S){let{gen:b,data:O,schema:R}=S,y=(0,i.schemaRefOrVal)(S,R,"type");return{gen:b,keyword:"type",data:O,schema:R.type,schemaCode:y,schemaValue:y,parentSchema:R,params:{},it:S}}}),XS=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=me(),r=Se();function n(i,a){let{properties:s,items:c}=i.schema;if(a==="object"&&s)for(let u in s)o(i,u,s[u].default);else if(a==="array"&&Array.isArray(c))c.forEach((u,f)=>o(i,f,u.default))}e.assignDefaults=n;function o(i,a,s){let{gen:c,compositeRule:u,data:f,opts:_}=i;if(s===void 0)return;let E=t._`${f}${(0,t.getProperty)(a)}`;if(u){(0,r.checkStrictMode)(i,`default is ignored for: ${E}`);return}let P=t._`${E} === undefined`;if(_.useDefaults==="empty")P=t._`${P} || ${E} === null || ${E} === ""`;c.if(P,t._`${E} = ${(0,t.stringify)(s)}`)}}),ct=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;let t=me(),r=Se(),n=at(),o=Se();function i(S,b){let{gen:O,data:R,it:y}=S;O.if(_(O,R,b,y.opts.ownProperties),()=>{S.setParams({missingProperty:t._`${b}`},!0),S.error()})}e.checkReportMissingProp=i;function a({gen:S,data:b,it:{opts:O}},R,y){return(0,t.or)(...R.map((N)=>(0,t.and)(_(S,b,N,O.ownProperties),t._`${y} = ${N}`)))}e.checkMissingProp=a;function s(S,b){S.setParams({missingProperty:b},!0),S.error()}e.reportMissingProp=s;function c(S){return S.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:t._`Object.prototype.hasOwnProperty`})}e.hasPropFunc=c;function u(S,b,O){return t._`${c(S)}.call(${b}, ${O})`}e.isOwnProperty=u;function f(S,b,O,R){let y=t._`${b}${(0,t.getProperty)(O)} !== undefined`;return R?t._`${y} && ${u(S,b,O)}`:y}e.propertyInData=f;function _(S,b,O,R){let y=t._`${b}${(0,t.getProperty)(O)} === undefined`;return R?(0,t.or)(y,(0,t.not)(u(S,b,O))):y}e.noPropertyInData=_;function E(S){return S?Object.keys(S).filter((b)=>b!=="__proto__"):[]}e.allSchemaProperties=E;function P(S,b){return E(b).filter((O)=>!(0,r.alwaysValidSchema)(S,b[O]))}e.schemaProperties=P;function v({schemaCode:S,data:b,it:{gen:O,topSchemaRef:R,schemaPath:y,errorPath:N},it:q},H,L,Z){let G=Z?t._`${S}, ${b}, ${R}${y}`:b,B=[[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,N)],[n.default.parentData,q.parentData],[n.default.parentDataProperty,q.parentDataProperty],[n.default.rootData,n.default.rootData]];if(q.opts.dynamicRef)B.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);let he=t._`${G}, ${O.object(...B)}`;return L!==t.nil?t._`${H}.call(${L}, ${he})`:t._`${H}(${he})`}e.callValidateCode=v;let w=t._`new RegExp`;function m({gen:S,it:{opts:b}},O){let R=b.unicodeRegExp?"u":"",{regExp:y}=b.code,N=y(O,R);return S.scopeValue("pattern",{key:N.toString(),ref:N,code:t._`${y.code==="new RegExp"?w:(0,o.useFunc)(S,y)}(${O}, ${R})`})}e.usePattern=m;function g(S){let{gen:b,data:O,keyword:R,it:y}=S,N=b.name("valid");if(y.allErrors){let H=b.let("valid",!0);return q(()=>b.assign(H,!1)),H}return b.var(N,!0),q(()=>b.break()),N;function q(H){let L=b.const("len",t._`${O}.length`);b.forRange("i",0,L,(Z)=>{S.subschema({keyword:R,dataProp:Z,dataPropType:r.Type.Num},N),b.if((0,t.not)(N),H)})}}e.validateArray=g;function z(S){let{gen:b,schema:O,keyword:R,it:y}=S;if(!Array.isArray(O))throw Error("ajv implementation error");if(O.some((H)=>(0,r.alwaysValidSchema)(y,H))&&!y.opts.unevaluated)return;let N=b.let("valid",!1),q=b.name("_valid");b.block(()=>O.forEach((H,L)=>{let Z=S.subschema({keyword:R,schemaProp:L,compositeRule:!0},q);if(b.assign(N,t._`${N} || ${q}`),!S.mergeValidEvaluated(Z,q))b.if((0,t.not)(N))})),S.result(N,()=>S.reset(),()=>S.error(!0))}e.validateUnion=z}),ey=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=me(),r=at(),n=ct(),o=ta();function i(P,v){let{gen:w,keyword:m,schema:g,parentSchema:z,it:S}=P,b=v.macro.call(S.self,g,z,S),O=f(w,m,b);if(S.opts.validateSchema!==!1)S.self.validateSchema(b,!0);let R=w.name("valid");P.subschema({schema:b,schemaPath:t.nil,errSchemaPath:`${S.errSchemaPath}/${m}`,topSchemaRef:O,compositeRule:!0},R),P.pass(R,()=>P.error(!0))}e.macroKeywordCode=i;function a(P,v){var w;let{gen:m,keyword:g,schema:z,parentSchema:S,$data:b,it:O}=P;u(O,v);let R=f(m,g,!b&&v.compile?v.compile.call(O.self,z,S,O):v.validate),y=m.let("valid");P.block$data(y,N),P.ok((w=v.valid)!==null&&w!==void 0?w:y);function N(){if(v.errors===!1){if(L(),v.modifying)s(P);Z(()=>P.error())}else{let G=v.async?q():H();if(v.modifying)s(P);Z(()=>c(P,G))}}function q(){let G=m.let("ruleErrs",null);return m.try(()=>L(t._`await `),(B)=>m.assign(y,!1).if(t._`${B} instanceof ${O.ValidationError}`,()=>m.assign(G,t._`${B}.errors`),()=>m.throw(B))),G}function H(){let G=t._`${R}.errors`;return m.assign(G,null),L(t.nil),G}function L(G=v.async?t._`await `:t.nil){let B=O.opts.passContext?r.default.this:r.default.self,he=!(("compile"in v)&&!b||v.schema===!1);m.assign(y,t._`${G}${(0,n.callValidateCode)(P,R,B,he)}`,v.modifying)}function Z(G){var B;m.if((0,t.not)((B=v.valid)!==null&&B!==void 0?B:y),G)}}e.funcKeywordCode=a;function s(P){let{gen:v,data:w,it:m}=P;v.if(m.parentData,()=>v.assign(w,t._`${m.parentData}[${m.parentDataProperty}]`))}function c(P,v){let{gen:w}=P;w.if(t._`Array.isArray(${v})`,()=>{w.assign(r.default.vErrors,t._`${r.default.vErrors} === null ? ${v} : ${r.default.vErrors}.concat(${v})`).assign(r.default.errors,t._`${r.default.vErrors}.length`),(0,o.extendErrors)(P)},()=>P.error())}function u({schemaEnv:P},v){if(v.async&&!P.$async)throw Error("async keyword in sync schema")}function f(P,v,w){if(w===void 0)throw Error(`keyword "${v}" failed to compile`);return P.scopeValue("keyword",typeof w=="function"?{ref:w}:{ref:w,code:(0,t.stringify)(w)})}function _(P,v,w=!1){return!v.length||v.some((m)=>m==="array"?Array.isArray(P):m==="object"?P&&typeof P=="object"&&!Array.isArray(P):typeof P==m||w&&typeof P>"u")}e.validSchemaType=_;function E({schema:P,opts:v,self:w,errSchemaPath:m},g,z){if(Array.isArray(g.keyword)?!g.keyword.includes(z):g.keyword!==z)throw Error("ajv implementation error");let S=g.dependencies;if(S===null||S===void 0?void 0:S.some((b)=>!Object.prototype.hasOwnProperty.call(P,b)))throw Error(`parent schema must have dependencies of ${z}: ${S.join(",")}`);if(g.validateSchema){if(!g.validateSchema(P[z])){let b=`keyword "${z}" value is invalid at path "${m}": `+w.errorsText(g.validateSchema.errors);if(v.validateSchema==="log")w.logger.error(b);else throw Error(b)}}}e.validateKeywordUsage=E}),ty=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=me(),r=Se();function n(a,{keyword:s,schemaProp:c,schema:u,schemaPath:f,errSchemaPath:_,topSchemaRef:E}){if(s!==void 0&&u!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(s!==void 0){let P=a.schema[s];return c===void 0?{schema:P,schemaPath:t._`${a.schemaPath}${(0,t.getProperty)(s)}`,errSchemaPath:`${a.errSchemaPath}/${s}`}:{schema:P[c],schemaPath:t._`${a.schemaPath}${(0,t.getProperty)(s)}${(0,t.getProperty)(c)}`,errSchemaPath:`${a.errSchemaPath}/${s}/${(0,r.escapeFragment)(c)}`}}if(u!==void 0){if(f===void 0||_===void 0||E===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:u,schemaPath:f,topSchemaRef:E,errSchemaPath:_}}throw Error('either "keyword" or "schema" must be passed')}e.getSubschema=n;function o(a,s,{dataProp:c,dataPropType:u,data:f,dataTypes:_,propertyName:E}){if(f!==void 0&&c!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:P}=s;if(c!==void 0){let{errorPath:w,dataPathArr:m,opts:g}=s;v(P.let("data",t._`${s.data}${(0,t.getProperty)(c)}`,!0)),a.errorPath=t.str`${w}${(0,r.getErrorPath)(c,u,g.jsPropertySyntax)}`,a.parentDataProperty=t._`${c}`,a.dataPathArr=[...m,a.parentDataProperty]}if(f!==void 0){if(v(f instanceof t.Name?f:P.let("data",f,!0)),E!==void 0)a.propertyName=E}if(_)a.dataTypes=_;function v(w){a.data=w,a.dataLevel=s.dataLevel+1,a.dataTypes=[],s.definedProperties=new Set,a.parentData=s.data,a.dataNames=[...s.dataNames,w]}}e.extendSubschemaData=o;function i(a,{jtdDiscriminator:s,jtdMetadata:c,compositeRule:u,createErrors:f,allErrors:_}){if(u!==void 0)a.compositeRule=u;if(f!==void 0)a.createErrors=f;if(_!==void 0)a.allErrors=_;a.jtdDiscriminator=s,a.jtdMetadata=c}e.extendSubschemaMode=i}),Vh=V((e,t)=>{t.exports=function r(n,o){if(n===o)return!0;if(n&&o&&typeof n=="object"&&typeof o=="object"){if(n.constructor!==o.constructor)return!1;var i,a,s;if(Array.isArray(n)){if(i=n.length,i!=o.length)return!1;for(a=i;a--!==0;)if(!r(n[a],o[a]))return!1;return!0}if(n.constructor===RegExp)return n.source===o.source&&n.flags===o.flags;if(n.valueOf!==Object.prototype.valueOf)return n.valueOf()===o.valueOf();if(n.toString!==Object.prototype.toString)return n.toString()===o.toString();if(s=Object.keys(n),i=s.length,i!==Object.keys(o).length)return!1;for(a=i;a--!==0;)if(!Object.prototype.hasOwnProperty.call(o,s[a]))return!1;for(a=i;a--!==0;){var c=s[a];if(!r(n[c],o[c]))return!1}return!0}return n!==n&&o!==o}}),ry=V((e,t)=>{var r=t.exports=function(i,a,s){if(typeof a=="function")s=a,a={};s=a.cb||s;var c=typeof s=="function"?s:s.pre||function(){},u=s.post||function(){};n(a,c,u,i,"",i)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.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 n(i,a,s,c,u,f,_,E,P,v){if(c&&typeof c=="object"&&!Array.isArray(c)){a(c,u,f,_,E,P,v);for(var w in c){var m=c[w];if(Array.isArray(m)){if(w in r.arrayKeywords)for(var g=0;g<m.length;g++)n(i,a,s,m[g],u+"/"+w+"/"+g,f,u,w,c,g)}else if(w in r.propsKeywords){if(m&&typeof m=="object")for(var z in m)n(i,a,s,m[z],u+"/"+w+"/"+o(z),f,u,w,c,z)}else if(w in r.keywords||i.allKeys&&!(w in r.skipKeywords))n(i,a,s,m,u+"/"+w,f,u,w,c)}s(c,u,f,_,E,P,v)}}function o(i){return i.replace(/~/g,"~0").replace(/\//g,"~1")}}),ra=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=Se(),r=Vh(),n=ry(),o=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function i(m,g=!0){if(typeof m=="boolean")return!0;if(g===!0)return!s(m);if(!g)return!1;return c(m)<=g}e.inlineRef=i;let a=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function s(m){for(let g in m){if(a.has(g))return!0;let z=m[g];if(Array.isArray(z)&&z.some(s))return!0;if(typeof z=="object"&&s(z))return!0}return!1}function c(m){let g=0;for(let z in m){if(z==="$ref")return 1/0;if(g++,o.has(z))continue;if(typeof m[z]=="object")(0,t.eachItem)(m[z],(S)=>g+=c(S));if(g===1/0)return 1/0}return g}function u(m,g="",z){if(z!==!1)g=E(g);return f(m,m.parse(g))}e.getFullPath=u;function f(m,g){return m.serialize(g).split("#")[0]+"#"}e._getFullPath=f;let _=/#\/?$/;function E(m){return m?m.replace(_,""):""}e.normalizeId=E;function P(m,g,z){return z=E(z),m.resolve(g,z)}e.resolveUrl=P;let v=/^[a-z_][-a-z0-9._]*$/i;function w(m,g){if(typeof m=="boolean")return{};let{schemaId:z,uriResolver:S}=this.opts,b=E(m[z]||g),O={"":b},R=u(S,b,!1),y={},N=new Set;return n(m,{allKeys:!0},(L,Z,G,B)=>{if(B===void 0)return;let he=R+Z,be=O[B];if(typeof L[z]=="string")be=ve.call(this,L[z]);ke.call(this,L.$anchor),ke.call(this,L.$dynamicAnchor),O[Z]=be;function ve(fe){let l=this.opts.uriResolver.resolve;if(fe=E(be?l(be,fe):fe),N.has(fe))throw H(fe);N.add(fe);let h=this.refs[fe];if(typeof h=="string")h=this.refs[h];if(typeof h=="object")q(L,h.schema,fe);else if(fe!==E(he))if(fe[0]==="#")q(L,y[fe],fe),y[fe]=L;else this.refs[fe]=he;return fe}function ke(fe){if(typeof fe=="string"){if(!v.test(fe))throw Error(`invalid anchor "${fe}"`);ve.call(this,`#${fe}`)}}}),y;function q(L,Z,G){if(Z!==void 0&&!r(L,Z))throw H(G)}function H(L){return Error(`reference "${L}" resolves to more than one schema`)}}e.getSchemaRefs=w}),Ur=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=WS(),r=ea(),n=Zh(),o=ea(),i=XS(),a=ey(),s=ty(),c=me(),u=at(),f=ra(),_=Se(),E=ta();function P(C){if(R(C)){if(N(C),O(C)){g(C);return}}v(C,()=>(0,t.topBoolOrEmptySchema)(C))}e.validateFunctionCode=P;function v({gen:C,validateName:M,schema:U,schemaEnv:ee,opts:ae},ue){if(ae.code.es5)C.func(M,c._`${u.default.data}, ${u.default.valCxt}`,ee.$async,()=>{C.code(c._`"use strict"; ${S(U,ae)}`),m(C,ae),C.code(ue)});else C.func(M,c._`${u.default.data}, ${w(ae)}`,ee.$async,()=>C.code(S(U,ae)).code(ue))}function w(C){return c._`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${C.dynamicRef?c._`, ${u.default.dynamicAnchors}={}`:c.nil}}={}`}function m(C,M){C.if(u.default.valCxt,()=>{if(C.var(u.default.instancePath,c._`${u.default.valCxt}.${u.default.instancePath}`),C.var(u.default.parentData,c._`${u.default.valCxt}.${u.default.parentData}`),C.var(u.default.parentDataProperty,c._`${u.default.valCxt}.${u.default.parentDataProperty}`),C.var(u.default.rootData,c._`${u.default.valCxt}.${u.default.rootData}`),M.dynamicRef)C.var(u.default.dynamicAnchors,c._`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{if(C.var(u.default.instancePath,c._`""`),C.var(u.default.parentData,c._`undefined`),C.var(u.default.parentDataProperty,c._`undefined`),C.var(u.default.rootData,u.default.data),M.dynamicRef)C.var(u.default.dynamicAnchors,c._`{}`)})}function g(C){let{schema:M,opts:U,gen:ee}=C;v(C,()=>{if(U.$comment&&M.$comment)B(C);if(L(C),ee.let(u.default.vErrors,null),ee.let(u.default.errors,0),U.unevaluated)z(C);q(C),he(C)})}function z(C){let{gen:M,validateName:U}=C;C.evaluated=M.const("evaluated",c._`${U}.evaluated`),M.if(c._`${C.evaluated}.dynamicProps`,()=>M.assign(c._`${C.evaluated}.props`,c._`undefined`)),M.if(c._`${C.evaluated}.dynamicItems`,()=>M.assign(c._`${C.evaluated}.items`,c._`undefined`))}function S(C,M){let U=typeof C=="object"&&C[M.schemaId];return U&&(M.code.source||M.code.process)?c._`/*# sourceURL=${U} */`:c.nil}function b(C,M){if(R(C)){if(N(C),O(C)){y(C,M);return}}(0,t.boolOrEmptySchema)(C,M)}function O({schema:C,self:M}){if(typeof C=="boolean")return!C;for(let U in C)if(M.RULES.all[U])return!0;return!1}function R(C){return typeof C.schema!="boolean"}function y(C,M){let{schema:U,gen:ee,opts:ae}=C;if(ae.$comment&&U.$comment)B(C);Z(C),G(C);let ue=ee.const("_errs",u.default.errors);q(C,ue),ee.var(M,c._`${ue} === ${u.default.errors}`)}function N(C){(0,_.checkUnknownRules)(C),H(C)}function q(C,M){if(C.opts.jtd)return ve(C,[],!1,M);let U=(0,r.getSchemaTypes)(C.schema);ve(C,U,!(0,r.coerceAndCheckDataType)(C,U),M)}function H(C){let{schema:M,errSchemaPath:U,opts:ee,self:ae}=C;if(M.$ref&&ee.ignoreKeywordsWithRef&&(0,_.schemaHasRulesButRef)(M,ae.RULES))ae.logger.warn(`$ref: keywords ignored in schema at path "${U}"`)}function L(C){let{schema:M,opts:U}=C;if(M.default!==void 0&&U.useDefaults&&U.strictSchema)(0,_.checkStrictMode)(C,"default is ignored in the schema root")}function Z(C){let M=C.schema[C.opts.schemaId];if(M)C.baseId=(0,f.resolveUrl)(C.opts.uriResolver,C.baseId,M)}function G(C){if(C.schema.$async&&!C.schemaEnv.$async)throw Error("async schema in sync schema")}function B({gen:C,schemaEnv:M,schema:U,errSchemaPath:ee,opts:ae}){let ue=U.$comment;if(ae.$comment===!0)C.code(c._`${u.default.self}.logger.log(${ue})`);else if(typeof ae.$comment=="function"){let Ee=c.str`${ee}/$comment`,Ce=C.scopeValue("root",{ref:M.root});C.code(c._`${u.default.self}.opts.$comment(${ue}, ${Ee}, ${Ce}.schema)`)}}function he(C){let{gen:M,schemaEnv:U,validateName:ee,ValidationError:ae,opts:ue}=C;if(U.$async)M.if(c._`${u.default.errors} === 0`,()=>M.return(u.default.data),()=>M.throw(c._`new ${ae}(${u.default.vErrors})`));else{if(M.assign(c._`${ee}.errors`,u.default.vErrors),ue.unevaluated)be(C);M.return(c._`${u.default.errors} === 0`)}}function be({gen:C,evaluated:M,props:U,items:ee}){if(U instanceof c.Name)C.assign(c._`${M}.props`,U);if(ee instanceof c.Name)C.assign(c._`${M}.items`,ee)}function ve(C,M,U,ee){let{gen:ae,schema:ue,data:Ee,allErrors:Ce,opts:Me,self:Oe}=C,{RULES:Re}=Oe;if(ue.$ref&&(Me.ignoreKeywordsWithRef||!(0,_.schemaHasRulesButRef)(ue,Re))){ae.block(()=>X(C,"$ref",Re.all.$ref.definition));return}if(!Me.jtd)fe(C,M);ae.block(()=>{for(let Ne of Re.rules)De(Ne);De(Re.post)});function De(Ne){if(!(0,n.shouldUseGroup)(ue,Ne))return;if(Ne.type){if(ae.if((0,o.checkDataType)(Ne.type,Ee,Me.strictNumbers)),ke(C,Ne),M.length===1&&M[0]===Ne.type&&U)ae.else(),(0,o.reportTypeError)(C);ae.endIf()}else ke(C,Ne);if(!Ce)ae.if(c._`${u.default.errors} === ${ee||0}`)}}function ke(C,M){let{gen:U,schema:ee,opts:{useDefaults:ae}}=C;if(ae)(0,i.assignDefaults)(C,M.type);U.block(()=>{for(let ue of M.rules)if((0,n.shouldUseRule)(ee,ue))X(C,ue.keyword,ue.definition,M.type)})}function fe(C,M){if(C.schemaEnv.meta||!C.opts.strictTypes)return;if(l(C,M),!C.opts.allowUnionTypes)h(C,M);k(C,C.dataTypes)}function l(C,M){if(!M.length)return;if(!C.dataTypes.length){C.dataTypes=M;return}M.forEach((U)=>{if(!T(C.dataTypes,U))F(C,`type "${U}" not allowed by context "${C.dataTypes.join(",")}"`)}),x(C,M)}function h(C,M){if(M.length>1&&!(M.length===2&&M.includes("null")))F(C,"use allowUnionTypes to allow union type keyword")}function k(C,M){let U=C.self.RULES.all;for(let ee in U){let ae=U[ee];if(typeof ae=="object"&&(0,n.shouldUseRule)(C.schema,ae)){let{type:ue}=ae.definition;if(ue.length&&!ue.some((Ee)=>p(M,Ee)))F(C,`missing type "${ue.join(",")}" for keyword "${ee}"`)}}}function p(C,M){return C.includes(M)||M==="number"&&C.includes("integer")}function T(C,M){return C.includes(M)||M==="integer"&&C.includes("number")}function x(C,M){let U=[];for(let ee of C.dataTypes)if(T(M,ee))U.push(ee);else if(M.includes("integer")&&ee==="number")U.push("integer");C.dataTypes=U}function F(C,M){let U=C.schemaEnv.baseId+C.errSchemaPath;M+=` at "${U}" (strictTypes)`,(0,_.checkStrictMode)(C,M,C.opts.strictTypes)}var K=class{constructor(C,M,U){if((0,a.validateKeywordUsage)(C,M,U),this.gen=C.gen,this.allErrors=C.allErrors,this.keyword=U,this.data=C.data,this.schema=C.schema[U],this.$data=M.$data&&C.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,_.schemaRefOrVal)(C,this.schema,U,this.$data),this.schemaType=M.schemaType,this.parentSchema=C.schema,this.params={},this.it=C,this.def=M,this.$data)this.schemaCode=C.gen.const("vSchema",se(this.$data,C));else if(this.schemaCode=this.schemaValue,!(0,a.validSchemaType)(this.schema,M.schemaType,M.allowUndefined))throw Error(`${U} value must be ${JSON.stringify(M.schemaType)}`);if("code"in M?M.trackErrors:M.errors!==!1)this.errsCount=C.gen.const("_errs",u.default.errors)}result(C,M,U){this.failResult((0,c.not)(C),M,U)}failResult(C,M,U){if(this.gen.if(C),U)U();else this.error();if(M){if(this.gen.else(),M(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(C,M){this.failResult((0,c.not)(C),void 0,M)}fail(C){if(C===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(C),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(C){if(!this.$data)return this.fail(C);let{schemaCode:M}=this;this.fail(c._`${M} !== undefined && (${(0,c.or)(this.invalid$data(),C)})`)}error(C,M,U){if(M){this.setParams(M),this._error(C,U),this.setParams({});return}this._error(C,U)}_error(C,M){(C?E.reportExtraError:E.reportError)(this,this.def.error,M)}$dataError(){(0,E.reportError)(this,this.def.$dataError||E.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,E.resetErrorsCount)(this.gen,this.errsCount)}ok(C){if(!this.allErrors)this.gen.if(C)}setParams(C,M){if(M)Object.assign(this.params,C);else this.params=C}block$data(C,M,U=c.nil){this.gen.block(()=>{this.check$data(C,U),M()})}check$data(C=c.nil,M=c.nil){if(!this.$data)return;let{gen:U,schemaCode:ee,schemaType:ae,def:ue}=this;if(U.if((0,c.or)(c._`${ee} === undefined`,M)),C!==c.nil)U.assign(C,!0);if(ae.length||ue.validateSchema){if(U.elseIf(this.invalid$data()),this.$dataError(),C!==c.nil)U.assign(C,!1)}U.else()}invalid$data(){let{gen:C,schemaCode:M,schemaType:U,def:ee,it:ae}=this;return(0,c.or)(ue(),Ee());function ue(){if(U.length){if(!(M instanceof c.Name))throw Error("ajv implementation error");let Ce=Array.isArray(U)?U:[U];return c._`${(0,o.checkDataTypes)(Ce,M,ae.opts.strictNumbers,o.DataType.Wrong)}`}return c.nil}function Ee(){if(ee.validateSchema){let Ce=C.scopeValue("validate$data",{ref:ee.validateSchema});return c._`!${Ce}(${M})`}return c.nil}}subschema(C,M){let U=(0,s.getSubschema)(this.it,C);(0,s.extendSubschemaData)(U,this.it,C),(0,s.extendSubschemaMode)(U,C);let ee={...this.it,...U,items:void 0,props:void 0};return b(ee,M),ee}mergeEvaluated(C,M){let{it:U,gen:ee}=this;if(!U.opts.unevaluated)return;if(U.props!==!0&&C.props!==void 0)U.props=_.mergeEvaluated.props(ee,C.props,U.props,M);if(U.items!==!0&&C.items!==void 0)U.items=_.mergeEvaluated.items(ee,C.items,U.items,M)}mergeValidEvaluated(C,M){let{it:U,gen:ee}=this;if(U.opts.unevaluated&&(U.props!==!0||U.items!==!0))return ee.if(M,()=>this.mergeEvaluated(C,c.Name)),!0}};e.KeywordCxt=K;function X(C,M,U,ee){let ae=new K(C,U,M);if("code"in U)U.code(ae,ee);else if(ae.$data&&U.validate)(0,a.funcKeywordCode)(ae,U);else if("macro"in U)(0,a.macroKeywordCode)(ae,U);else if(U.compile||U.validate)(0,a.funcKeywordCode)(ae,U)}let te=/^\/(?:[^~]|~0|~1)*$/,le=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function se(C,{dataLevel:M,dataNames:U,dataPathArr:ee}){let ae,ue;if(C==="")return u.default.rootData;if(C[0]==="/"){if(!te.test(C))throw Error(`Invalid JSON-pointer: ${C}`);ae=C,ue=u.default.rootData}else{let Oe=le.exec(C);if(!Oe)throw Error(`Invalid JSON-pointer: ${C}`);let Re=+Oe[1];if(ae=Oe[2],ae==="#"){if(Re>=M)throw Error(Me("property/index",Re));return ee[M-Re]}if(Re>M)throw Error(Me("data",Re));if(ue=U[M-Re],!ae)return ue}let Ee=ue,Ce=ae.split("/");for(let Oe of Ce)if(Oe)ue=c._`${ue}${(0,c.getProperty)((0,_.unescapeJsonPointer)(Oe))}`,Ee=c._`${Ee} && ${ue}`;return Ee;function Me(Oe,Re){return`Cannot access ${Oe} ${Re} levels up, current level is ${M}`}}e.getData=se}),po=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});var t=class extends Error{constructor(r){super("validation failed");this.errors=r,this.ajv=this.validation=!0}};e.default=t}),Fr=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ra();var r=class extends Error{constructor(n,o,i,a){super(a||`can't resolve reference ${i} from id ${o}`);this.missingRef=(0,t.resolveUrl)(n,o,i),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(n,this.missingRef))}};e.default=r}),na=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=me(),r=po(),n=at(),o=ra(),i=Se(),a=Ur();var s=class{constructor(g){var z;this.refs={},this.dynamicAnchors={};let S;if(typeof g.schema=="object")S=g.schema;this.schema=g.schema,this.schemaId=g.schemaId,this.root=g.root||this,this.baseId=(z=g.baseId)!==null&&z!==void 0?z:(0,o.normalizeId)(S===null||S===void 0?void 0:S[g.schemaId||"$id"]),this.schemaPath=g.schemaPath,this.localRefs=g.localRefs,this.meta=g.meta,this.$async=S===null||S===void 0?void 0:S.$async,this.refs={}}};e.SchemaEnv=s;function c(g){let z=_.call(this,g);if(z)return z;let S=(0,o.getFullPath)(this.opts.uriResolver,g.root.baseId),{es5:b,lines:O}=this.opts.code,{ownProperties:R}=this.opts,y=new t.CodeGen(this.scope,{es5:b,lines:O,ownProperties:R}),N;if(g.$async)N=y.scopeValue("Error",{ref:r.default,code:t._`require("ajv/dist/runtime/validation_error").default`});let q=y.scopeName("validate");g.validateName=q;let H={gen:y,allErrors:this.opts.allErrors,data:n.default.data,parentData:n.default.parentData,parentDataProperty:n.default.parentDataProperty,dataNames:[n.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:y.scopeValue("schema",this.opts.code.source===!0?{ref:g.schema,code:(0,t.stringify)(g.schema)}:{ref:g.schema}),validateName:q,ValidationError:N,schema:g.schema,schemaEnv:g,rootId:S,baseId:g.baseId||S,schemaPath:t.nil,errSchemaPath:g.schemaPath||(this.opts.jtd?"":"#"),errorPath:t._`""`,opts:this.opts,self:this},L;try{this._compilations.add(g),(0,a.validateFunctionCode)(H),y.optimize(this.opts.code.optimize);let Z=y.toString();if(L=`${y.scopeRefs(n.default.scope)}return ${Z}`,this.opts.code.process)L=this.opts.code.process(L,g);let G=Function(`${n.default.self}`,`${n.default.scope}`,L)(this,this.scope.get());if(this.scope.value(q,{ref:G}),G.errors=null,G.schema=g.schema,G.schemaEnv=g,g.$async)G.$async=!0;if(this.opts.code.source===!0)G.source={validateName:q,validateCode:Z,scopeValues:y._values};if(this.opts.unevaluated){let{props:B,items:he}=H;if(G.evaluated={props:B instanceof t.Name?void 0:B,items:he instanceof t.Name?void 0:he,dynamicProps:B instanceof t.Name,dynamicItems:he instanceof t.Name},G.source)G.source.evaluated=(0,t.stringify)(G.evaluated)}return g.validate=G,g}catch(Z){if(delete g.validate,delete g.validateName,L)this.logger.error("Error compiling schema, function code:",L);throw Z}finally{this._compilations.delete(g)}}e.compileSchema=c;function u(g,z,S){var b;S=(0,o.resolveUrl)(this.opts.uriResolver,z,S);let O=g.refs[S];if(O)return O;let R=P.call(this,g,S);if(R===void 0){let y=(b=g.localRefs)===null||b===void 0?void 0:b[S],{schemaId:N}=this.opts;if(y)R=new s({schema:y,schemaId:N,root:g,baseId:z})}if(R===void 0)return;return g.refs[S]=f.call(this,R)}e.resolveRef=u;function f(g){if((0,o.inlineRef)(g.schema,this.opts.inlineRefs))return g.schema;return g.validate?g:c.call(this,g)}function _(g){for(let z of this._compilations)if(E(z,g))return z}e.getCompilingSchema=_;function E(g,z){return g.schema===z.schema&&g.root===z.root&&g.baseId===z.baseId}function P(g,z){let S;while(typeof(S=this.refs[z])=="string")z=S;return S||this.schemas[z]||v.call(this,g,z)}function v(g,z){let S=this.opts.uriResolver.parse(z),b=(0,o._getFullPath)(this.opts.uriResolver,S),O=(0,o.getFullPath)(this.opts.uriResolver,g.baseId,void 0);if(Object.keys(g.schema).length>0&&b===O)return m.call(this,S,g);let R=(0,o.normalizeId)(b),y=this.refs[R]||this.schemas[R];if(typeof y=="string"){let N=v.call(this,g,y);if(typeof(N===null||N===void 0?void 0:N.schema)!=="object")return;return m.call(this,S,N)}if(typeof(y===null||y===void 0?void 0:y.schema)!=="object")return;if(!y.validate)c.call(this,y);if(R===(0,o.normalizeId)(z)){let{schema:N}=y,{schemaId:q}=this.opts,H=N[q];if(H)O=(0,o.resolveUrl)(this.opts.uriResolver,O,H);return new s({schema:N,schemaId:q,root:g,baseId:O})}return m.call(this,S,y)}e.resolveSchema=v;let w=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function m(g,{baseId:z,schema:S,root:b}){var O;if(((O=g.fragment)===null||O===void 0?void 0:O[0])!=="/")return;for(let N of g.fragment.slice(1).split("/")){if(typeof S==="boolean")return;let q=S[(0,i.unescapeFragment)(N)];if(q===void 0)return;S=q;let H=typeof S==="object"&&S[this.opts.schemaId];if(!w.has(N)&&H)z=(0,o.resolveUrl)(this.opts.uriResolver,z,H)}let R;if(typeof S!="boolean"&&S.$ref&&!(0,i.schemaHasRulesButRef)(S,this.RULES)){let N=(0,o.resolveUrl)(this.opts.uriResolver,z,S.$ref);R=v.call(this,b,N)}let{schemaId:y}=this.opts;if(R=R||new s({schema:S,schemaId:y,root:b,baseId:z}),R.schema!==R.root.schema)return R}}),ny=V((e,t)=>{t.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),Jh=V((e,t)=>{let r=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),n=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 o(v){let w="",m=0,g=0;for(g=0;g<v.length;g++){if(m=v[g].charCodeAt(0),m===48)continue;if(!(m>=48&&m<=57||m>=65&&m<=70||m>=97&&m<=102))return"";w+=v[g];break}for(g+=1;g<v.length;g++){if(m=v[g].charCodeAt(0),!(m>=48&&m<=57||m>=65&&m<=70||m>=97&&m<=102))return"";w+=v[g]}return w}let i=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function a(v){return v.length=0,!0}function s(v,w,m){if(v.length){let g=o(v);if(g!=="")w.push(g);else return m.error=!0,!1;v.length=0}return!0}function c(v){let w=0,m={error:!1,address:"",zone:""},g=[],z=[],S=!1,b=!1,O=s;for(let R=0;R<v.length;R++){let y=v[R];if(y==="["||y==="]")continue;if(y===":"){if(S===!0)b=!0;if(!O(z,g,m))break;if(++w>7){m.error=!0;break}if(R>0&&v[R-1]===":")S=!0;g.push(":");continue}else if(y==="%"){if(!O(z,g,m))break;O=a}else{z.push(y);continue}}if(z.length)if(O===a)m.zone=z.join("");else if(b)g.push(z.join(""));else g.push(o(z));return m.address=g.join(""),m}function u(v){if(f(v,":")<2)return{host:v,isIPV6:!1};let w=c(v);if(!w.error){let{address:m,address:g}=w;if(w.zone)m+="%"+w.zone,g+="%25"+w.zone;return{host:m,isIPV6:!0,escapedHost:g}}else return{host:v,isIPV6:!1}}function f(v,w){let m=0;for(let g=0;g<v.length;g++)if(v[g]===w)m++;return m}function _(v){let w=v,m=[],g=-1,z=0;while(z=w.length){if(z===1)if(w===".")break;else if(w==="/"){m.push("/");break}else{m.push(w);break}else if(z===2){if(w[0]==="."){if(w[1]===".")break;else if(w[1]==="/"){w=w.slice(2);continue}}else if(w[0]==="/"){if(w[1]==="."||w[1]==="/"){m.push("/");break}}}else if(z===3){if(w==="/.."){if(m.length!==0)m.pop();m.push("/");break}}if(w[0]==="."){if(w[1]==="."){if(w[2]==="/"){w=w.slice(3);continue}}else if(w[1]==="/"){w=w.slice(2);continue}}else if(w[0]==="/"){if(w[1]==="."){if(w[2]==="/"){w=w.slice(2);continue}else if(w[2]==="."){if(w[3]==="/"){if(w=w.slice(3),m.length!==0)m.pop();continue}}}}if((g=w.indexOf("/",1))===-1){m.push(w);break}else m.push(w.slice(0,g)),w=w.slice(g)}return m.join("")}function E(v,w){let m=w!==!0?escape:unescape;if(v.scheme!==void 0)v.scheme=m(v.scheme);if(v.userinfo!==void 0)v.userinfo=m(v.userinfo);if(v.host!==void 0)v.host=m(v.host);if(v.path!==void 0)v.path=m(v.path);if(v.query!==void 0)v.query=m(v.query);if(v.fragment!==void 0)v.fragment=m(v.fragment);return v}function P(v){let w=[];if(v.userinfo!==void 0)w.push(v.userinfo),w.push("@");if(v.host!==void 0){let m=unescape(v.host);if(!n(m)){let g=u(m);if(g.isIPV6===!0)m=`[${g.escapedHost}]`;else m=v.host}w.push(m)}if(typeof v.port==="number"||typeof v.port==="string")w.push(":"),w.push(String(v.port));return w.length?w.join(""):void 0}t.exports={nonSimpleDomain:i,recomposeAuthority:P,normalizeComponentEncoding:E,removeDotSegments:_,isIPv4:n,isUUID:r,normalizeIPv6:u,stringArrayToHexStripped:o}}),oy=V((e,t)=>{let{isUUID:r}=Jh(),n=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,o=["http","https","ws","wss","urn","urn:uuid"];function i(y){return o.indexOf(y)!==-1}function a(y){if(y.secure===!0)return!0;else if(y.secure===!1)return!1;else if(y.scheme)return y.scheme.length===3&&(y.scheme[0]==="w"||y.scheme[0]==="W")&&(y.scheme[1]==="s"||y.scheme[1]==="S")&&(y.scheme[2]==="s"||y.scheme[2]==="S");else return!1}function s(y){if(!y.host)y.error=y.error||"HTTP URIs must have a host.";return y}function c(y){let N=String(y.scheme).toLowerCase()==="https";if(y.port===(N?443:80)||y.port==="")y.port=void 0;if(!y.path)y.path="/";return y}function u(y){return y.secure=a(y),y.resourceName=(y.path||"/")+(y.query?"?"+y.query:""),y.path=void 0,y.query=void 0,y}function f(y){if(y.port===(a(y)?443:80)||y.port==="")y.port=void 0;if(typeof y.secure==="boolean")y.scheme=y.secure?"wss":"ws",y.secure=void 0;if(y.resourceName){let[N,q]=y.resourceName.split("?");y.path=N&&N!=="/"?N:void 0,y.query=q,y.resourceName=void 0}return y.fragment=void 0,y}function _(y,N){if(!y.path)return y.error="URN can not be parsed",y;let q=y.path.match(n);if(q){let H=N.scheme||y.scheme||"urn";y.nid=q[1].toLowerCase(),y.nss=q[2];let L=R(`${H}:${N.nid||y.nid}`);if(y.path=void 0,L)y=L.parse(y,N)}else y.error=y.error||"URN can not be parsed.";return y}function E(y,N){if(y.nid===void 0)throw Error("URN without nid cannot be serialized");let q=N.scheme||y.scheme||"urn",H=y.nid.toLowerCase(),L=R(`${q}:${N.nid||H}`);if(L)y=L.serialize(y,N);let Z=y,G=y.nss;return Z.path=`${H||N.nid}:${G}`,N.skipEscape=!0,Z}function P(y,N){let q=y;if(q.uuid=q.nss,q.nss=void 0,!N.tolerant&&(!q.uuid||!r(q.uuid)))q.error=q.error||"UUID is not valid.";return q}function v(y){let N=y;return N.nss=(y.uuid||"").toLowerCase(),N}let w={scheme:"http",domainHost:!0,parse:s,serialize:c},m={scheme:"https",domainHost:w.domainHost,parse:s,serialize:c},g={scheme:"ws",domainHost:!0,parse:u,serialize:f},z={scheme:"wss",domainHost:g.domainHost,parse:g.parse,serialize:g.serialize},O={http:w,https:m,ws:g,wss:z,urn:{scheme:"urn",parse:_,serialize:E,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:P,serialize:v,skipNormalize:!0}};Object.setPrototypeOf(O,null);function R(y){return y&&(O[y]||O[y.toLowerCase()])||void 0}t.exports={wsIsSecure:a,SCHEMES:O,isValidSchemeName:i,getSchemeHandler:R}}),sy=V((e,t)=>{let{normalizeIPv6:r,removeDotSegments:n,recomposeAuthority:o,normalizeComponentEncoding:i,isIPv4:a,nonSimpleDomain:s}=Jh(),{SCHEMES:c,getSchemeHandler:u}=oy();function f(z,S){if(typeof z==="string")z=v(m(z,S),S);else if(typeof z==="object")z=m(v(z,S),S);return z}function _(z,S,b){let O=b?Object.assign({scheme:"null"},b):{scheme:"null"},R=E(m(z,O),m(S,O),O,!0);return O.skipEscape=!0,v(R,O)}function E(z,S,b,O){let R={};if(!O)z=m(v(z,b),b),S=m(v(S,b),b);if(b=b||{},!b.tolerant&&S.scheme)R.scheme=S.scheme,R.userinfo=S.userinfo,R.host=S.host,R.port=S.port,R.path=n(S.path||""),R.query=S.query;else{if(S.userinfo!==void 0||S.host!==void 0||S.port!==void 0)R.userinfo=S.userinfo,R.host=S.host,R.port=S.port,R.path=n(S.path||""),R.query=S.query;else{if(!S.path)if(R.path=z.path,S.query!==void 0)R.query=S.query;else R.query=z.query;else{if(S.path[0]==="/")R.path=n(S.path);else{if((z.userinfo!==void 0||z.host!==void 0||z.port!==void 0)&&!z.path)R.path="/"+S.path;else if(!z.path)R.path=S.path;else R.path=z.path.slice(0,z.path.lastIndexOf("/")+1)+S.path;R.path=n(R.path)}R.query=S.query}R.userinfo=z.userinfo,R.host=z.host,R.port=z.port}R.scheme=z.scheme}return R.fragment=S.fragment,R}function P(z,S,b){if(typeof z==="string")z=unescape(z),z=v(i(m(z,b),!0),{...b,skipEscape:!0});else if(typeof z==="object")z=v(i(z,!0),{...b,skipEscape:!0});if(typeof S==="string")S=unescape(S),S=v(i(m(S,b),!0),{...b,skipEscape:!0});else if(typeof S==="object")S=v(i(S,!0),{...b,skipEscape:!0});return z.toLowerCase()===S.toLowerCase()}function v(z,S){let b={host:z.host,scheme:z.scheme,userinfo:z.userinfo,port:z.port,path:z.path,query:z.query,nid:z.nid,nss:z.nss,uuid:z.uuid,fragment:z.fragment,reference:z.reference,resourceName:z.resourceName,secure:z.secure,error:""},O=Object.assign({},S),R=[],y=u(O.scheme||b.scheme);if(y&&y.serialize)y.serialize(b,O);if(b.path!==void 0)if(!O.skipEscape){if(b.path=escape(b.path),b.scheme!==void 0)b.path=b.path.split("%3A").join(":")}else b.path=unescape(b.path);if(O.reference!=="suffix"&&b.scheme)R.push(b.scheme,":");let N=o(b);if(N!==void 0){if(O.reference!=="suffix")R.push("//");if(R.push(N),b.path&&b.path[0]!=="/")R.push("/")}if(b.path!==void 0){let q=b.path;if(!O.absolutePath&&(!y||!y.absolutePath))q=n(q);if(N===void 0&&q[0]==="/"&&q[1]==="/")q="/%2F"+q.slice(2);R.push(q)}if(b.query!==void 0)R.push("?",b.query);if(b.fragment!==void 0)R.push("#",b.fragment);return R.join("")}let w=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function m(z,S){let b=Object.assign({},S),O={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},R=!1;if(b.reference==="suffix")if(b.scheme)z=b.scheme+":"+z;else z="//"+z;let y=z.match(w);if(y){if(O.scheme=y[1],O.userinfo=y[3],O.host=y[4],O.port=parseInt(y[5],10),O.path=y[6]||"",O.query=y[7],O.fragment=y[8],isNaN(O.port))O.port=y[5];if(O.host)if(a(O.host)===!1){let q=r(O.host);O.host=q.host.toLowerCase(),R=q.isIPV6}else R=!0;if(O.scheme===void 0&&O.userinfo===void 0&&O.host===void 0&&O.port===void 0&&O.query===void 0&&!O.path)O.reference="same-document";else if(O.scheme===void 0)O.reference="relative";else if(O.fragment===void 0)O.reference="absolute";else O.reference="uri";if(b.reference&&b.reference!=="suffix"&&b.reference!==O.reference)O.error=O.error||"URI is not a "+b.reference+" reference.";let N=u(b.scheme||O.scheme);if(!b.unicodeSupport&&(!N||!N.unicodeSupport)){if(O.host&&(b.domainHost||N&&N.domainHost)&&R===!1&&s(O.host))try{O.host=URL.domainToASCII(O.host.toLowerCase())}catch(q){O.error=O.error||"Host's domain name can not be converted to ASCII: "+q}}if(!N||N&&!N.skipNormalize){if(z.indexOf("%")!==-1){if(O.scheme!==void 0)O.scheme=unescape(O.scheme);if(O.host!==void 0)O.host=unescape(O.host)}if(O.path)O.path=escape(unescape(O.path));if(O.fragment)O.fragment=encodeURI(decodeURIComponent(O.fragment))}if(N&&N.parse)N.parse(O,b)}else O.error=O.error||"URI can not be parsed.";return O}let g={SCHEMES:c,normalize:f,resolve:_,resolveComponent:E,equal:P,serialize:v,parse:m};t.exports=g,t.exports.default=g,t.exports.fastUri=g}),iy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sy();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),zu=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=Ur();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=me();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});let n=po(),o=Fr(),i=Fh(),a=na(),s=me(),c=ra(),u=ea(),f=Se(),_=ny(),E=iy(),P=(l,h)=>new RegExp(l,h);P.code="new RegExp";let v=["removeAdditional","useDefaults","coerceTypes"],w=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),m={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."},g={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},z=200;function S(l){var h,k,p,T,x,F,K,X,te,le,se,C,M,U,ee,ae,ue,Ee,Ce,Me,Oe,Re,De,Ne,rt;let Ye=l.strict,Ue=(h=l.code)===null||h===void 0?void 0:h.optimize,gt=Ue===!0||Ue===void 0?1:Ue||0,_t=(p=(k=l.code)===null||k===void 0?void 0:k.regExp)!==null&&p!==void 0?p:P,Mt=(T=l.uriResolver)!==null&&T!==void 0?T:E.default;return{strictSchema:(F=(x=l.strictSchema)!==null&&x!==void 0?x:Ye)!==null&&F!==void 0?F:!0,strictNumbers:(X=(K=l.strictNumbers)!==null&&K!==void 0?K:Ye)!==null&&X!==void 0?X:!0,strictTypes:(le=(te=l.strictTypes)!==null&&te!==void 0?te:Ye)!==null&&le!==void 0?le:"log",strictTuples:(C=(se=l.strictTuples)!==null&&se!==void 0?se:Ye)!==null&&C!==void 0?C:"log",strictRequired:(U=(M=l.strictRequired)!==null&&M!==void 0?M:Ye)!==null&&U!==void 0?U:!1,code:l.code?{...l.code,optimize:gt,regExp:_t}:{optimize:gt,regExp:_t},loopRequired:(ee=l.loopRequired)!==null&&ee!==void 0?ee:z,loopEnum:(ae=l.loopEnum)!==null&&ae!==void 0?ae:z,meta:(ue=l.meta)!==null&&ue!==void 0?ue:!0,messages:(Ee=l.messages)!==null&&Ee!==void 0?Ee:!0,inlineRefs:(Ce=l.inlineRefs)!==null&&Ce!==void 0?Ce:!0,schemaId:(Me=l.schemaId)!==null&&Me!==void 0?Me:"$id",addUsedSchema:(Oe=l.addUsedSchema)!==null&&Oe!==void 0?Oe:!0,validateSchema:(Re=l.validateSchema)!==null&&Re!==void 0?Re:!0,validateFormats:(De=l.validateFormats)!==null&&De!==void 0?De:!0,unicodeRegExp:(Ne=l.unicodeRegExp)!==null&&Ne!==void 0?Ne:!0,int32range:(rt=l.int32range)!==null&&rt!==void 0?rt:!0,uriResolver:Mt}}var b=class{constructor(l={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,l=this.opts={...l,...S(l)};let{es5:h,lines:k}=this.opts.code;this.scope=new s.ValueScope({scope:{},prefixes:w,es5:h,lines:k}),this.logger=Z(l.logger);let p=l.validateFormats;if(l.validateFormats=!1,this.RULES=(0,i.getRules)(),O.call(this,m,l,"NOT SUPPORTED"),O.call(this,g,l,"DEPRECATED","warn"),this._metaOpts=H.call(this),l.formats)N.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),l.keywords)q.call(this,l.keywords);if(typeof l.meta=="object")this.addMetaSchema(l.meta);y.call(this),l.validateFormats=p}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:l,meta:h,schemaId:k}=this.opts,p=_;if(k==="id")p={..._},p.id=p.$id,delete p.$id;if(h&&l)this.addMetaSchema(p,p[k],!1)}defaultMeta(){let{meta:l,schemaId:h}=this.opts;return this.opts.defaultMeta=typeof l=="object"?l[h]||l:void 0}validate(l,h){let k;if(typeof l=="string"){if(k=this.getSchema(l),!k)throw Error(`no schema with key or ref "${l}"`)}else k=this.compile(l);let p=k(h);if(!("$async"in k))this.errors=k.errors;return p}compile(l,h){let k=this._addSchema(l,h);return k.validate||this._compileSchemaEnv(k)}compileAsync(l,h){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:k}=this.opts;return p.call(this,l,h);async function p(te,le){await T.call(this,te.$schema);let se=this._addSchema(te,le);return se.validate||x.call(this,se)}async function T(te){if(te&&!this.getSchema(te))await p.call(this,{$ref:te},!0)}async function x(te){try{return this._compileSchemaEnv(te)}catch(le){if(!(le instanceof o.default))throw le;return F.call(this,le),await K.call(this,le.missingSchema),x.call(this,te)}}function F({missingSchema:te,missingRef:le}){if(this.refs[te])throw Error(`AnySchema ${te} is loaded but ${le} cannot be resolved`)}async function K(te){let le=await X.call(this,te);if(!this.refs[te])await T.call(this,le.$schema);if(!this.refs[te])this.addSchema(le,te,h)}async function X(te){let le=this._loading[te];if(le)return le;try{return await(this._loading[te]=k(te))}finally{delete this._loading[te]}}}addSchema(l,h,k,p=this.opts.validateSchema){if(Array.isArray(l)){for(let x of l)this.addSchema(x,void 0,k,p);return this}let T;if(typeof l==="object"){let{schemaId:x}=this.opts;if(T=l[x],T!==void 0&&typeof T!="string")throw Error(`schema ${x} must be string`)}return h=(0,c.normalizeId)(h||T),this._checkUnique(h),this.schemas[h]=this._addSchema(l,k,h,p,!0),this}addMetaSchema(l,h,k=this.opts.validateSchema){return this.addSchema(l,h,!0,k),this}validateSchema(l,h){if(typeof l=="boolean")return!0;let k;if(k=l.$schema,k!==void 0&&typeof k!="string")throw Error("$schema must be a string");if(k=k||this.opts.defaultMeta||this.defaultMeta(),!k)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let p=this.validate(k,l);if(!p&&h){let T="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(T);else throw Error(T)}return p}getSchema(l){let h;while(typeof(h=R.call(this,l))=="string")l=h;if(h===void 0){let{schemaId:k}=this.opts,p=new a.SchemaEnv({schema:{},schemaId:k});if(h=a.resolveSchema.call(this,p,l),!h)return;this.refs[l]=h}return h.validate||this._compileSchemaEnv(h)}removeSchema(l){if(l instanceof RegExp)return this._removeAllSchemas(this.schemas,l),this._removeAllSchemas(this.refs,l),this;switch(typeof l){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let h=R.call(this,l);if(typeof h=="object")this._cache.delete(h.schema);return delete this.schemas[l],delete this.refs[l],this}case"object":{let h=l;this._cache.delete(h);let k=l[this.opts.schemaId];if(k)k=(0,c.normalizeId)(k),delete this.schemas[k],delete this.refs[k];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(l){for(let h of l)this.addKeyword(h);return this}addKeyword(l,h){let k;if(typeof l=="string"){if(k=l,typeof h=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),h.keyword=k}else if(typeof l=="object"&&h===void 0){if(h=l,k=h.keyword,Array.isArray(k)&&!k.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(B.call(this,k,h),!h)return(0,f.eachItem)(k,(T)=>he.call(this,T)),this;ve.call(this,h);let p={...h,type:(0,u.getJSONTypes)(h.type),schemaType:(0,u.getJSONTypes)(h.schemaType)};return(0,f.eachItem)(k,p.type.length===0?(T)=>he.call(this,T,p):(T)=>p.type.forEach((x)=>he.call(this,T,p,x))),this}getKeyword(l){let h=this.RULES.all[l];return typeof h=="object"?h.definition:!!h}removeKeyword(l){let{RULES:h}=this;delete h.keywords[l],delete h.all[l];for(let k of h.rules){let p=k.rules.findIndex((T)=>T.keyword===l);if(p>=0)k.rules.splice(p,1)}return this}addFormat(l,h){if(typeof h=="string")h=new RegExp(h);return this.formats[l]=h,this}errorsText(l=this.errors,{separator:h=", ",dataVar:k="data"}={}){if(!l||l.length===0)return"No errors";return l.map((p)=>`${k}${p.instancePath} ${p.message}`).reduce((p,T)=>p+h+T)}$dataMetaSchema(l,h){let k=this.RULES.all;l=JSON.parse(JSON.stringify(l));for(let p of h){let T=p.split("/").slice(1),x=l;for(let F of T)x=x[F];for(let F in k){let K=k[F];if(typeof K!="object")continue;let{$data:X}=K.definition,te=x[F];if(X&&te)x[F]=fe(te)}}return l}_removeAllSchemas(l,h){for(let k in l){let p=l[k];if(!h||h.test(k)){if(typeof p=="string")delete l[k];else if(p&&!p.meta)this._cache.delete(p.schema),delete l[k]}}}_addSchema(l,h,k,p=this.opts.validateSchema,T=this.opts.addUsedSchema){let x,{schemaId:F}=this.opts;if(typeof l=="object")x=l[F];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof l!="boolean")throw Error("schema must be object or boolean");let K=this._cache.get(l);if(K!==void 0)return K;k=(0,c.normalizeId)(x||k);let X=c.getSchemaRefs.call(this,l,k);if(K=new a.SchemaEnv({schema:l,schemaId:F,meta:h,baseId:k,localRefs:X}),this._cache.set(K.schema,K),T&&!k.startsWith("#")){if(k)this._checkUnique(k);this.refs[k]=K}if(p)this.validateSchema(l,!0);return K}_checkUnique(l){if(this.schemas[l]||this.refs[l])throw Error(`schema with key or id "${l}" already exists`)}_compileSchemaEnv(l){if(l.meta)this._compileMetaSchema(l);else a.compileSchema.call(this,l);if(!l.validate)throw Error("ajv implementation error");return l.validate}_compileMetaSchema(l){let h=this.opts;this.opts=this._metaOpts;try{a.compileSchema.call(this,l)}finally{this.opts=h}}};b.ValidationError=n.default,b.MissingRefError=o.default,e.default=b;function O(l,h,k,p="error"){for(let T in l){let x=T;if(x in h)this.logger[p](`${k}: option ${T}. ${l[x]}`)}}function R(l){return l=(0,c.normalizeId)(l),this.schemas[l]||this.refs[l]}function y(){let l=this.opts.schemas;if(!l)return;if(Array.isArray(l))this.addSchema(l);else for(let h in l)this.addSchema(l[h],h)}function N(){for(let l in this.opts.formats){let h=this.opts.formats[l];if(h)this.addFormat(l,h)}}function q(l){if(Array.isArray(l)){this.addVocabulary(l);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let h in l){let k=l[h];if(!k.keyword)k.keyword=h;this.addKeyword(k)}}function H(){let l={...this.opts};for(let h of v)delete l[h];return l}let L={log(){},warn(){},error(){}};function Z(l){if(l===!1)return L;if(l===void 0)return console;if(l.log&&l.warn&&l.error)return l;throw Error("logger must implement log, warn and error methods")}let G=/^[a-z_$][a-z0-9_$:-]*$/i;function B(l,h){let{RULES:k}=this;if((0,f.eachItem)(l,(p)=>{if(k.keywords[p])throw Error(`Keyword ${p} is already defined`);if(!G.test(p))throw Error(`Keyword ${p} has invalid name`)}),!h)return;if(h.$data&&!(("code"in h)||("validate"in h)))throw Error('$data keyword must have "code" or "validate" function')}function he(l,h,k){var p;let T=h===null||h===void 0?void 0:h.post;if(k&&T)throw Error('keyword with "post" flag cannot have "type"');let{RULES:x}=this,F=T?x.post:x.rules.find(({type:X})=>X===k);if(!F)F={type:k,rules:[]},x.rules.push(F);if(x.keywords[l]=!0,!h)return;let K={keyword:l,definition:{...h,type:(0,u.getJSONTypes)(h.type),schemaType:(0,u.getJSONTypes)(h.schemaType)}};if(h.before)be.call(this,F,K,h.before);else F.rules.push(K);x.all[l]=K,(p=h.implements)===null||p===void 0||p.forEach((X)=>this.addKeyword(X))}function be(l,h,k){let p=l.rules.findIndex((T)=>T.keyword===k);if(p>=0)l.rules.splice(p,0,h);else l.rules.push(h),this.logger.warn(`rule ${k} is not defined`)}function ve(l){let{metaSchema:h}=l;if(h===void 0)return;if(l.$data&&this.opts.$data)h=fe(h);l.validateSchema=this.compile(h,!0)}let ke={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function fe(l){return{anyOf:[l,ke]}}});var ay=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};e.default=t}),wu=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=Fr(),r=ct(),n=me(),o=at(),i=na(),a=Se(),s={keyword:"$ref",schemaType:"string",code(f){let{gen:_,schema:E,it:P}=f,{baseId:v,schemaEnv:w,validateName:m,opts:g,self:z}=P,{root:S}=w;if((E==="#"||E==="#/")&&v===S.baseId)return O();let b=i.resolveRef.call(z,S,v,E);if(b===void 0)throw new t.default(P.opts.uriResolver,v,E);if(b instanceof i.SchemaEnv)return R(b);return y(b);function O(){if(w===S)return u(f,m,w,w.$async);let N=_.scopeValue("root",{ref:S});return u(f,n._`${N}.validate`,S,S.$async)}function R(N){u(f,c(f,N),N,N.$async)}function y(N){let q=_.scopeValue("schema",g.code.source===!0?{ref:N,code:(0,n.stringify)(N)}:{ref:N}),H=_.name("valid"),L=f.subschema({schema:N,dataTypes:[],schemaPath:n.nil,topSchemaRef:q,errSchemaPath:E},H);f.mergeEvaluated(L),f.ok(H)}}};function c(f,_){let{gen:E}=f;return _.validate?E.scopeValue("validate",{ref:_.validate}):n._`${E.scopeValue("wrapper",{ref:_})}.validate`}e.getValidate=c;function u(f,_,E,P){let{gen:v,it:w}=f,{allErrors:m,schemaEnv:g,opts:z}=w,S=z.passContext?o.default.this:n.nil;if(P)b();else O();function b(){if(!g.$async)throw Error("async schema referenced by sync schema");let N=v.let("valid");v.try(()=>{if(v.code(n._`await ${(0,r.callValidateCode)(f,_,S)}`),y(_),!m)v.assign(N,!0)},(q)=>{if(v.if(n._`!(${q} instanceof ${w.ValidationError})`,()=>v.throw(q)),R(q),!m)v.assign(N,!1)}),f.ok(N)}function O(){f.result((0,r.callValidateCode)(f,_,S),()=>y(_),()=>R(_))}function R(N){let q=n._`${N}.errors`;v.assign(o.default.vErrors,n._`${o.default.vErrors} === null ? ${q} : ${o.default.vErrors}.concat(${q})`),v.assign(o.default.errors,n._`${o.default.vErrors}.length`)}function y(N){var q;if(!w.opts.unevaluated)return;let H=(q=E===null||E===void 0?void 0:E.validate)===null||q===void 0?void 0:q.evaluated;if(w.props!==!0)if(H&&!H.dynamicProps){if(H.props!==void 0)w.props=a.mergeEvaluated.props(v,H.props,w.props)}else{let L=v.var("props",n._`${N}.evaluated.props`);w.props=a.mergeEvaluated.props(v,L,w.props,n.Name)}if(w.items!==!0)if(H&&!H.dynamicItems){if(H.items!==void 0)w.items=a.mergeEvaluated.items(v,H.items,w.items)}else{let L=v.var("items",n._`${N}.evaluated.items`);w.items=a.mergeEvaluated.items(v,L,w.items,n.Name)}}}e.callRef=u,e.default=s}),Hh=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ay(),r=wu(),n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default];e.default=n}),cy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=t.operators,n={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},o={keyword:Object.keys(n),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:i,schemaCode:a})=>t.str`must be ${n[i].okStr} ${a}`,params:({keyword:i,schemaCode:a})=>t._`{comparison: ${n[i].okStr}, limit: ${a}}`},code(i){let{keyword:a,data:s,schemaCode:c}=i;i.fail$data(t._`${s} ${n[a].fail} ${c} || isNaN(${s})`)}};e.default=o}),uy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:n})=>t.str`must be multiple of ${n}`,params:({schemaCode:n})=>t._`{multipleOf: ${n}}`},code(n){let{gen:o,data:i,schemaCode:a,it:s}=n,c=s.opts.multipleOfPrecision,u=o.let("res"),f=c?t._`Math.abs(Math.round(${u}) - ${u}) > 1e-${c}`:t._`${u} !== parseInt(${u})`;n.fail$data(t._`(${a} === 0 || (${u} = ${i}/${a}, ${f}))`)}};e.default=r}),ly=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});function t(r){let n=r.length,o=0,i=0,a;while(i<n)if(o++,a=r.charCodeAt(i++),a>=55296&&a<=56319&&i<n){if(a=r.charCodeAt(i),(a&64512)===56320)i++}return o}e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'}),dy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=Se(),n=ly(),o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:i,schemaCode:a}){let s=i==="maxLength"?"more":"fewer";return t.str`must NOT have ${s} than ${a} characters`},params:({schemaCode:i})=>t._`{limit: ${i}}`},code(i){let{keyword:a,data:s,schemaCode:c,it:u}=i,f=a==="maxLength"?t.operators.GT:t.operators.LT,_=u.opts.unicode===!1?t._`${s}.length`:t._`${(0,r.useFunc)(i.gen,n.default)}(${s})`;i.fail$data(t._`${_} ${f} ${c}`)}};e.default=o}),my=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ct(),r=Se(),n=me(),o={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:i})=>n.str`must match pattern "${i}"`,params:({schemaCode:i})=>n._`{pattern: ${i}}`},code(i){let{gen:a,data:s,$data:c,schema:u,schemaCode:f,it:_}=i,E=_.opts.unicodeRegExp?"u":"";if(c){let{regExp:P}=_.opts.code,v=P.code==="new RegExp"?n._`new RegExp`:(0,r.useFunc)(a,P),w=a.let("valid");a.try(()=>a.assign(w,n._`${v}(${f}, ${E}).test(${s})`),()=>a.assign(w,!1)),i.fail$data(n._`!${w}`)}else{let P=(0,t.usePattern)(i,u);i.fail$data(n._`!${P}.test(${s})`)}}};e.default=o}),py=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:o}){let i=n==="maxProperties"?"more":"fewer";return t.str`must NOT have ${i} than ${o} properties`},params:({schemaCode:n})=>t._`{limit: ${n}}`},code(n){let{keyword:o,data:i,schemaCode:a}=n,s=o==="maxProperties"?t.operators.GT:t.operators.LT;n.fail$data(t._`Object.keys(${i}).length ${s} ${a}`)}};e.default=r}),hy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ct(),r=me(),n=Se(),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:i}})=>r.str`must have required property '${i}'`,params:({params:{missingProperty:i}})=>r._`{missingProperty: ${i}}`},code(i){let{gen:a,schema:s,schemaCode:c,data:u,$data:f,it:_}=i,{opts:E}=_;if(!f&&s.length===0)return;let P=s.length>=E.loopRequired;if(_.allErrors)v();else w();if(E.strictRequired){let z=i.parentSchema.properties,{definedProperties:S}=i.it;for(let b of s)if((z===null||z===void 0?void 0:z[b])===void 0&&!S.has(b)){let O=`required property "${b}" is not defined at "${_.schemaEnv.baseId+_.errSchemaPath}" (strictRequired)`;(0,n.checkStrictMode)(_,O,_.opts.strictRequired)}}function v(){if(P||f)i.block$data(r.nil,m);else for(let z of s)(0,t.checkReportMissingProp)(i,z)}function w(){let z=a.let("missing");if(P||f){let S=a.let("valid",!0);i.block$data(S,()=>g(z,S)),i.ok(S)}else a.if((0,t.checkMissingProp)(i,s,z)),(0,t.reportMissingProp)(i,z),a.else()}function m(){a.forOf("prop",c,(z)=>{i.setParams({missingProperty:z}),a.if((0,t.noPropertyInData)(a,u,z,E.ownProperties),()=>i.error())})}function g(z,S){i.setParams({missingProperty:z}),a.forOf(z,c,()=>{a.assign(S,(0,t.propertyInData)(a,u,z,E.ownProperties)),a.if((0,r.not)(S),()=>{i.error(),a.break()})},r.nil)}}};e.default=o}),fy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:o}){let i=n==="maxItems"?"more":"fewer";return t.str`must NOT have ${i} than ${o} items`},params:({schemaCode:n})=>t._`{limit: ${n}}`},code(n){let{keyword:o,data:i,schemaCode:a}=n,s=o==="maxItems"?t.operators.GT:t.operators.LT;n.fail$data(t._`${i}.length ${s} ${a}`)}};e.default=r}),$u=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Vh();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),gy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ea(),r=me(),n=Se(),o=$u(),i={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:a,j:s}})=>r.str`must NOT have duplicate items (items ## ${s} and ${a} are identical)`,params:({params:{i:a,j:s}})=>r._`{i: ${a}, j: ${s}}`},code(a){let{gen:s,data:c,$data:u,schema:f,parentSchema:_,schemaCode:E,it:P}=a;if(!u&&!f)return;let v=s.let("valid"),w=_.items?(0,t.getSchemaTypes)(_.items):[];a.block$data(v,m,r._`${E} === false`),a.ok(v);function m(){let b=s.let("i",r._`${c}.length`),O=s.let("j");a.setParams({i:b,j:O}),s.assign(v,!0),s.if(r._`${b} > 1`,()=>(g()?z:S)(b,O))}function g(){return w.length>0&&!w.some((b)=>b==="object"||b==="array")}function z(b,O){let R=s.name("item"),y=(0,t.checkDataTypes)(w,R,P.opts.strictNumbers,t.DataType.Wrong),N=s.const("indices",r._`{}`);s.for(r._`;${b}--;`,()=>{if(s.let(R,r._`${c}[${b}]`),s.if(y,r._`continue`),w.length>1)s.if(r._`typeof ${R} == "string"`,r._`${R} += "_"`);s.if(r._`typeof ${N}[${R}] == "number"`,()=>{s.assign(O,r._`${N}[${R}]`),a.error(),s.assign(v,!1).break()}).code(r._`${N}[${R}] = ${b}`)})}function S(b,O){let R=(0,n.useFunc)(s,o.default),y=s.name("outer");s.label(y).for(r._`;${b}--;`,()=>s.for(r._`${O} = ${b}; ${O}--;`,()=>s.if(r._`${R}(${c}[${b}], ${c}[${O}])`,()=>{a.error(),s.assign(v,!1).break(y)})))}}};e.default=i}),_y=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=Se(),n=$u(),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:i})=>t._`{allowedValue: ${i}}`},code(i){let{gen:a,data:s,$data:c,schemaCode:u,schema:f}=i;if(c||f&&typeof f=="object")i.fail$data(t._`!${(0,r.useFunc)(a,n.default)}(${s}, ${u})`);else i.fail(t._`${f} !== ${s}`)}};e.default=o}),Sy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=Se(),n=$u(),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:i})=>t._`{allowedValues: ${i}}`},code(i){let{gen:a,data:s,$data:c,schema:u,schemaCode:f,it:_}=i;if(!c&&u.length===0)throw Error("enum must have non-empty array");let E=u.length>=_.opts.loopEnum,P,v=()=>P!==null&&P!==void 0?P:P=(0,r.useFunc)(a,n.default),w;if(E||c)w=a.let("valid"),i.block$data(w,m);else{if(!Array.isArray(u))throw Error("ajv implementation error");let z=a.const("vSchema",f);w=(0,t.or)(...u.map((S,b)=>g(z,b)))}i.pass(w);function m(){a.assign(w,!1),a.forOf("v",f,(z)=>a.if(t._`${v()}(${s}, ${z})`,()=>a.assign(w,!0).break()))}function g(z,S){let b=u[S];return typeof b==="object"&&b!==null?t._`${v()}(${s}, ${z}[${S}])`:t._`${s} === ${b}`}}};e.default=o}),Kh=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cy(),r=uy(),n=dy(),o=my(),i=py(),a=hy(),s=fy(),c=gy(),u=_y(),f=Sy(),_=[t.default,r.default,n.default,o.default,i.default,a.default,s.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,f.default];e.default=_}),Bh=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=me(),r=Se(),n={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:i}})=>t.str`must NOT have more than ${i} items`,params:({params:{len:i}})=>t._`{limit: ${i}}`},code(i){let{parentSchema:a,it:s}=i,{items:c}=a;if(!Array.isArray(c)){(0,r.checkStrictMode)(s,'"additionalItems" is ignored when "items" is not an array of schemas');return}o(i,c)}};function o(i,a){let{gen:s,schema:c,data:u,keyword:f,it:_}=i;_.items=!0;let E=s.const("len",t._`${u}.length`);if(c===!1)i.setParams({len:a.length}),i.pass(t._`${E} <= ${a.length}`);else if(typeof c=="object"&&!(0,r.alwaysValidSchema)(_,c)){let v=s.var("valid",t._`${E} <= ${a.length}`);s.if((0,t.not)(v),()=>P(v)),i.ok(v)}function P(v){s.forRange("i",a.length,E,(w)=>{if(i.subschema({keyword:f,dataProp:w,dataPropType:r.Type.Num},v),!_.allErrors)s.if((0,t.not)(v),()=>s.break())})}}e.validateAdditionalItems=o,e.default=n}),Yh=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=me(),r=Se(),n=ct(),o={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(a){let{schema:s,it:c}=a;if(Array.isArray(s))return i(a,"additionalItems",s);if(c.items=!0,(0,r.alwaysValidSchema)(c,s))return;a.ok((0,n.validateArray)(a))}};function i(a,s,c=a.schema){let{gen:u,parentSchema:f,data:_,keyword:E,it:P}=a;if(m(f),P.opts.unevaluated&&c.length&&P.items!==!0)P.items=r.mergeEvaluated.items(u,c.length,P.items);let v=u.name("valid"),w=u.const("len",t._`${_}.length`);c.forEach((g,z)=>{if((0,r.alwaysValidSchema)(P,g))return;u.if(t._`${w} > ${z}`,()=>a.subschema({keyword:E,schemaProp:z,dataProp:z},v)),a.ok(v)});function m(g){let{opts:z,errSchemaPath:S}=P,b=c.length,O=b===g.minItems&&(b===g.maxItems||g[s]===!1);if(z.strictTuples&&!O){let R=`"${E}" is ${b}-tuple, but minItems or maxItems/${s} are not specified or different at path "${S}"`;(0,r.checkStrictMode)(P,R,z.strictTuples)}}}e.validateTuple=i,e.default=o}),yy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Yh(),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(n)=>(0,t.validateTuple)(n,"items")};e.default=r}),vy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=Se(),n=ct(),o=Bh(),i={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:a}})=>t.str`must NOT have more than ${a} items`,params:({params:{len:a}})=>t._`{limit: ${a}}`},code(a){let{schema:s,parentSchema:c,it:u}=a,{prefixItems:f}=c;if(u.items=!0,(0,r.alwaysValidSchema)(u,s))return;if(f)(0,o.validateAdditionalItems)(a,f);else a.ok((0,n.validateArray)(a))}};e.default=i}),by=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=Se(),n={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:o,max:i}})=>i===void 0?t.str`must contain at least ${o} valid item(s)`:t.str`must contain at least ${o} and no more than ${i} valid item(s)`,params:({params:{min:o,max:i}})=>i===void 0?t._`{minContains: ${o}}`:t._`{minContains: ${o}, maxContains: ${i}}`},code(o){let{gen:i,schema:a,parentSchema:s,data:c,it:u}=o,f,_,{minContains:E,maxContains:P}=s;if(u.opts.next)f=E===void 0?1:E,_=P;else f=1;let v=i.const("len",t._`${c}.length`);if(o.setParams({min:f,max:_}),_===void 0&&f===0){(0,r.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(_!==void 0&&f>_){(0,r.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),o.fail();return}if((0,r.alwaysValidSchema)(u,a)){let S=t._`${v} >= ${f}`;if(_!==void 0)S=t._`${S} && ${v} <= ${_}`;o.pass(S);return}u.items=!0;let w=i.name("valid");if(_===void 0&&f===1)g(w,()=>i.if(w,()=>i.break()));else if(f===0){if(i.let(w,!0),_!==void 0)i.if(t._`${c}.length > 0`,m)}else i.let(w,!1),m();o.result(w,()=>o.reset());function m(){let S=i.name("_valid"),b=i.let("count",0);g(S,()=>i.if(S,()=>z(b)))}function g(S,b){i.forRange("i",0,v,(O)=>{o.subschema({keyword:"contains",dataProp:O,dataPropType:r.Type.Num,compositeRule:!0},S),b()})}function z(S){if(i.code(t._`${S}++`),_===void 0)i.if(t._`${S} >= ${f}`,()=>i.assign(w,!0).break());else if(i.if(t._`${S} > ${_}`,()=>i.assign(w,!1).break()),f===1)i.assign(w,!0);else i.if(t._`${S} >= ${f}`,()=>i.assign(w,!0))}}};e.default=n}),Eu=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=me(),r=Se(),n=ct();e.error={message:({params:{property:c,depsCount:u,deps:f}})=>{let _=u===1?"property":"properties";return t.str`must have ${_} ${f} when property ${c} is present`},params:({params:{property:c,depsCount:u,deps:f,missingProperty:_}})=>t._`{property: ${c},
81
81
  missingProperty: ${_},
82
82
  depsCount: ${u},
83
- deps: ${f}}`};let o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(c){let[u,f]=s(c);a(c,u),i(c,f)}};function s({schema:c}){let u={},f={};for(let _ in c){if(_==="__proto__")continue;let E=Array.isArray(c[_])?u:f;E[_]=c[_]}return[u,f]}function a(c,u=c.schema){let{gen:f,data:_,it:E}=c;if(Object.keys(u).length===0)return;let P=f.let("missing");for(let v in u){let w=u[v];if(w.length===0)continue;let m=(0,n.propertyInData)(f,_,v,E.opts.ownProperties);if(c.setParams({property:v,depsCount:w.length,deps:w.join(", ")}),E.allErrors)f.if(m,()=>{for(let g of w)(0,n.checkReportMissingProp)(c,g)});else f.if(t._`${m} && (${(0,n.checkMissingProp)(c,w,P)})`),(0,n.reportMissingProp)(c,P),f.else()}}e.validatePropertyDeps=a;function i(c,u=c.schema){let{gen:f,data:_,keyword:E,it:P}=c,v=f.name("valid");for(let w in u){if((0,r.alwaysValidSchema)(P,u[w]))continue;f.if((0,n.propertyInData)(f,_,w,P.opts.ownProperties),()=>{let m=c.subschema({keyword:E,schemaProp:w},v);c.mergeValidEvaluated(m,v)},()=>f.var(v,!0)),c.ok(v)}}e.validateSchemaDeps=i,e.default=o}),sv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=Se(),n={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:o})=>t._`{propertyName: ${o.propertyName}}`},code(o){let{gen:s,schema:a,data:i,it:c}=o;if((0,r.alwaysValidSchema)(c,a))return;let u=s.name("valid");s.forIn("key",i,(f)=>{o.setParams({propertyName:f}),o.subschema({keyword:"propertyNames",data:f,dataTypes:["string"],propertyName:f,compositeRule:!0},u),s.if((0,t.not)(u),()=>{if(o.error(!0),!c.allErrors)s.break()})}),o.ok(u)}};e.default=n}),gf=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=lt(),r=me(),n=ut(),o=Se(),s={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:a})=>r._`{additionalProperty: ${a.additionalProperty}}`},code(a){let{gen:i,schema:c,parentSchema:u,data:f,errsCount:_,it:E}=a;if(!_)throw Error("ajv implementation error");let{allErrors:P,opts:v}=E;if(E.props=!0,v.removeAdditional!=="all"&&(0,o.alwaysValidSchema)(E,c))return;let w=(0,t.allSchemaProperties)(u.properties),m=(0,t.allSchemaProperties)(u.patternProperties);g(),a.ok(r._`${_} === ${n.default.errors}`);function g(){i.forIn("key",f,(R)=>{if(!w.length&&!m.length)b(R);else i.if(z(R),()=>b(R))})}function z(R){let y;if(w.length>8){let N=(0,o.schemaRefOrVal)(E,u.properties,"properties");y=(0,t.isOwnProperty)(i,N,R)}else if(w.length)y=(0,r.or)(...w.map((N)=>r._`${R} === ${N}`));else y=r.nil;if(m.length)y=(0,r.or)(y,...m.map((N)=>r._`${(0,t.usePattern)(a,N)}.test(${R})`));return(0,r.not)(y)}function S(R){i.code(r._`delete ${f}[${R}]`)}function b(R){if(v.removeAdditional==="all"||v.removeAdditional&&c===!1){S(R);return}if(c===!1){if(a.setParams({additionalProperty:R}),a.error(),!P)i.break();return}if(typeof c=="object"&&!(0,o.alwaysValidSchema)(E,c)){let y=i.name("valid");if(v.removeAdditional==="failing")O(R,y,!1),i.if((0,r.not)(y),()=>{a.reset(),S(R)});else if(O(R,y),!P)i.if((0,r.not)(y),()=>i.break())}}function O(R,y,N){let q={keyword:"additionalProperties",dataProp:R,dataPropType:o.Type.Str};if(N===!1)Object.assign(q,{compositeRule:!0,createErrors:!1,allErrors:!1});a.subschema(q,y)}}};e.default=s}),iv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Kr(),r=lt(),n=Se(),o=gf(),s={keyword:"properties",type:"object",schemaType:"object",code(a){let{gen:i,schema:c,parentSchema:u,data:f,it:_}=a;if(_.opts.removeAdditional==="all"&&u.additionalProperties===void 0)o.default.code(new t.KeywordCxt(_,o.default,"additionalProperties"));let E=(0,r.allSchemaProperties)(c);for(let g of E)_.definedProperties.add(g);if(_.opts.unevaluated&&E.length&&_.props!==!0)_.props=n.mergeEvaluated.props(i,(0,n.toHash)(E),_.props);let P=E.filter((g)=>!(0,n.alwaysValidSchema)(_,c[g]));if(P.length===0)return;let v=i.name("valid");for(let g of P){if(w(g))m(g);else{if(i.if((0,r.propertyInData)(i,f,g,_.opts.ownProperties)),m(g),!_.allErrors)i.else().var(v,!0);i.endIf()}a.it.definedProperties.add(g),a.ok(v)}function w(g){return _.opts.useDefaults&&!_.compositeRule&&c[g].default!==void 0}function m(g){a.subschema({keyword:"properties",schemaProp:g,dataProp:g},v)}}};e.default=s}),av=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=lt(),r=me(),n=Se(),o=Se(),s={keyword:"patternProperties",type:"object",schemaType:"object",code(a){let{gen:i,schema:c,data:u,parentSchema:f,it:_}=a,{opts:E}=_,P=(0,t.allSchemaProperties)(c),v=P.filter((O)=>(0,n.alwaysValidSchema)(_,c[O]));if(P.length===0||v.length===P.length&&(!_.opts.unevaluated||_.props===!0))return;let w=E.strictSchema&&!E.allowMatchingProperties&&f.properties,m=i.name("valid");if(_.props!==!0&&!(_.props instanceof r.Name))_.props=(0,o.evaluatedPropsToName)(i,_.props);let{props:g}=_;z();function z(){for(let O of P){if(w)S(O);if(_.allErrors)b(O);else i.var(m,!0),b(O),i.if(m)}}function S(O){for(let R in w)if(new RegExp(O).test(R))(0,n.checkStrictMode)(_,`property ${R} matches pattern ${O} (use allowMatchingProperties)`)}function b(O){i.forIn("key",u,(R)=>{i.if(r._`${(0,t.usePattern)(a,O)}.test(${R})`,()=>{let y=v.includes(O);if(!y)a.subschema({keyword:"patternProperties",schemaProp:O,dataProp:R,dataPropType:o.Type.Str},m);if(_.opts.unevaluated&&g!==!0)i.assign(r._`${g}[${R}]`,!0);else if(!y&&!_.allErrors)i.if((0,r.not)(m),()=>i.break())})})}}};e.default=s}),cv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Se(),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(n){let{gen:o,schema:s,it:a}=n;if((0,t.alwaysValidSchema)(a,s)){n.fail();return}let i=o.name("valid");n.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),n.failResult(i,()=>n.reset(),()=>n.error())},error:{message:"must NOT be valid"}};e.default=r}),uv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:lt().validateUnion,error:{message:"must match a schema in anyOf"}};e.default=t}),lv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=Se(),n={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:o})=>t._`{passingSchemas: ${o.passing}}`},code(o){let{gen:s,schema:a,parentSchema:i,it:c}=o;if(!Array.isArray(a))throw Error("ajv implementation error");if(c.opts.discriminator&&i.discriminator)return;let u=a,f=s.let("valid",!1),_=s.let("passing",null),E=s.name("_valid");o.setParams({passing:_}),s.block(P),o.result(f,()=>o.reset(),()=>o.error(!0));function P(){u.forEach((v,w)=>{let m;if((0,r.alwaysValidSchema)(c,v))s.var(E,!0);else m=o.subschema({keyword:"oneOf",schemaProp:w,compositeRule:!0},E);if(w>0)s.if(t._`${E} && ${f}`).assign(f,!1).assign(_,t._`[${_}, ${w}]`).else();s.if(E,()=>{if(s.assign(f,!0),s.assign(_,w),m)o.mergeEvaluated(m,t.Name)})})}}};e.default=n}),dv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Se(),r={keyword:"allOf",schemaType:"array",code(n){let{gen:o,schema:s,it:a}=n;if(!Array.isArray(s))throw Error("ajv implementation error");let i=o.name("valid");s.forEach((c,u)=>{if((0,t.alwaysValidSchema)(a,c))return;let f=n.subschema({keyword:"allOf",schemaProp:u},i);n.ok(i),n.mergeEvaluated(f)})}};e.default=r}),mv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=Se(),n={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:s})=>t.str`must match "${s.ifClause}" schema`,params:({params:s})=>t._`{failingKeyword: ${s.ifClause}}`},code(s){let{gen:a,parentSchema:i,it:c}=s;if(i.then===void 0&&i.else===void 0)(0,r.checkStrictMode)(c,'"if" without "then" and "else" is ignored');let u=o(c,"then"),f=o(c,"else");if(!u&&!f)return;let _=a.let("valid",!0),E=a.name("_valid");if(P(),s.reset(),u&&f){let w=a.let("ifClause");s.setParams({ifClause:w}),a.if(E,v("then",w),v("else",w))}else if(u)a.if(E,v("then"));else a.if((0,t.not)(E),v("else"));s.pass(_,()=>s.error(!0));function P(){let w=s.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},E);s.mergeEvaluated(w)}function v(w,m){return()=>{let g=s.subschema({keyword:w},E);if(a.assign(_,E),s.mergeValidEvaluated(g,_),m)a.assign(m,t._`${w}`);else s.setParams({ifClause:w})}}}};function o(s,a){let i=s.schema[a];return i!==void 0&&!(0,r.alwaysValidSchema)(s,i)}e.default=n}),pv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Se(),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:n,parentSchema:o,it:s}){if(o.if===void 0)(0,t.checkStrictMode)(s,`"${n}" without "if" is ignored`)}};e.default=r}),_f=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=hf(),r=rv(),n=ff(),o=nv(),s=ov(),a=Uu(),i=sv(),c=gf(),u=iv(),f=av(),_=cv(),E=uv(),P=lv(),v=dv(),w=mv(),m=pv();function g(z=!1){let S=[_.default,E.default,P.default,v.default,w.default,m.default,i.default,c.default,a.default,u.default,f.default];if(z)S.push(r.default,o.default);else S.push(t.default,n.default);return S.push(s.default),S}e.default=g}),hv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:n})=>t.str`must match format "${n}"`,params:({schemaCode:n})=>t._`{format: ${n}}`},code(n,o){let{gen:s,data:a,$data:i,schema:c,schemaCode:u,it:f}=n,{opts:_,errSchemaPath:E,schemaEnv:P,self:v}=f;if(!_.validateFormats)return;if(i)w();else m();function w(){let g=s.scopeValue("formats",{ref:v.formats,code:_.code.formats}),z=s.const("fDef",t._`${g}[${u}]`),S=s.let("fType"),b=s.let("format");s.if(t._`typeof ${z} == "object" && !(${z} instanceof RegExp)`,()=>s.assign(S,t._`${z}.type || "string"`).assign(b,t._`${z}.validate`),()=>s.assign(S,t._`"string"`).assign(b,z)),n.fail$data((0,t.or)(O(),R()));function O(){if(_.strictSchema===!1)return t.nil;return t._`${u} && !${b}`}function R(){let y=P.$async?t._`(${z}.async ? await ${b}(${a}) : ${b}(${a}))`:t._`${b}(${a})`,N=t._`(typeof ${b} == "function" ? ${y} : ${b}.test(${a}))`;return t._`${b} && ${b} !== true && ${S} === ${o} && !${N}`}}function m(){let g=v.formats[c];if(!g){O();return}if(g===!0)return;let[z,S,b]=R(g);if(z===o)n.pass(y());function O(){if(_.strictSchema===!1){v.logger.warn(N());return}throw Error(N());function N(){return`unknown format "${c}" ignored in schema at path "${E}"`}}function R(N){let q=N instanceof RegExp?(0,t.regexpCode)(N):_.code.formats?t._`${_.code.formats}${(0,t.getProperty)(c)}`:void 0,H=s.scopeValue("formats",{key:c,ref:N,code:q});if(typeof N=="object"&&!(N instanceof RegExp))return[N.type||"string",N.validate,t._`${H}.validate`];return["string",N,H]}function y(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!P.$async)throw Error("async format in sync schema");return t._`await ${b}(${a})`}return typeof S=="function"?t._`${b}(${a})`:t._`${b}.test(${a})`}}}};e.default=r}),Sf=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=[hv().default];e.default=t}),yf=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),vf=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=mf(),r=pf(),n=_f(),o=Sf(),s=yf(),a=[t.default,r.default,(0,n.default)(),o.default,s.metadataVocabulary,s.contentVocabulary];e.default=a}),fv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(r){r.Tag="tag",r.Mapping="mapping"})(t||(e.DiscrError=t={}))}),Fu=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=fv(),n=ua(),o=Br(),s=Se(),a={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:i,tagName:c}})=>i===r.DiscrError.Tag?`tag "${c}" must be string`:`value of tag "${c}" must be in oneOf`,params:({params:{discrError:i,tag:c,tagName:u}})=>t._`{error: ${i}, tag: ${u}, tagValue: ${c}}`},code(i){let{gen:c,data:u,schema:f,parentSchema:_,it:E}=i,{oneOf:P}=_;if(!E.opts.discriminator)throw Error("discriminator: requires discriminator option");let v=f.propertyName;if(typeof v!="string")throw Error("discriminator: requires propertyName");if(f.mapping)throw Error("discriminator: mapping is not supported");if(!P)throw Error("discriminator: requires oneOf keyword");let w=c.let("valid",!1),m=c.const("tag",t._`${u}${(0,t.getProperty)(v)}`);c.if(t._`typeof ${m} == "string"`,()=>g(),()=>i.error(!1,{discrError:r.DiscrError.Tag,tag:m,tagName:v})),i.ok(w);function g(){let b=S();c.if(!1);for(let O in b)c.elseIf(t._`${m} === ${O}`),c.assign(w,z(b[O]));c.else(),i.error(!1,{discrError:r.DiscrError.Mapping,tag:m,tagName:v}),c.endIf()}function z(b){let O=c.name("valid"),R=i.subschema({keyword:"oneOf",schemaProp:b},O);return i.mergeEvaluated(R,t.Name),O}function S(){var b;let O={},R=N(_),y=!0;for(let D=0;D<P.length;D++){let Z=P[D];if((Z===null||Z===void 0?void 0:Z.$ref)&&!(0,s.schemaHasRulesButRef)(Z,E.self.RULES)){let B=Z.$ref;if(Z=n.resolveRef.call(E.self,E.schemaEnv.root,E.baseId,B),Z instanceof n.SchemaEnv)Z=Z.schema;if(Z===void 0)throw new o.default(E.opts.uriResolver,E.baseId,B)}let G=(b=Z===null||Z===void 0?void 0:Z.properties)===null||b===void 0?void 0:b[v];if(typeof G!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${v}"`);y=y&&(R||N(Z)),q(G,D)}if(!y)throw Error(`discriminator: "${v}" must be required`);return O;function N({required:D}){return Array.isArray(D)&&D.includes(v)}function q(D,Z){if(D.const)H(D.const,Z);else if(D.enum)for(let G of D.enum)H(G,Z);else throw Error(`discriminator: "properties/${v}" must have "const" or "enum"`)}function H(D,Z){if(typeof D!="string"||D in O)throw Error(`discriminator: "${v}" values must be unique strings`);O[D]=Z}}}};e.default=a}),gv=V((e,t)=>{t.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),bf=V((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let r=qu(),n=vf(),o=Fu(),s=gv(),a=["/properties"],i="http://json-schema.org/draft-07/schema";var c=class extends r.default{_addVocabularies(){if(super._addVocabularies(),n.default.forEach((P)=>this.addVocabulary(P)),this.opts.discriminator)this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let P=this.opts.$data?this.$dataMetaSchema(s,a):s;this.addMetaSchema(P,i,!1),this.refs["http://json-schema.org/schema"]=i}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}};e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var u=Kr();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var f=me();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return f._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return f.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return f.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return f.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return f.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return f.CodeGen}});var _=bo();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return _.default}});var E=Br();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return E.default}})}),Rf=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=me(),r=ut(),n=ua(),o=Lu(),s={keyword:"$dynamicAnchor",schemaType:"string",code:(c)=>a(c,c.schema)};function a(c,u){let{gen:f,it:_}=c;_.schemaEnv.root.dynamicAnchors[u]=!0;let E=t._`${r.default.dynamicAnchors}${(0,t.getProperty)(u)}`,P=_.errSchemaPath==="#"?_.validateName:i(c);f.if(t._`!${E}`,()=>f.assign(E,P))}e.dynamicAnchor=a;function i(c){let{schemaEnv:u,schema:f,self:_}=c.it,{root:E,baseId:P,localRefs:v,meta:w}=u.root,{schemaId:m}=_.opts,g=new n.SchemaEnv({schema:f,schemaId:m,root:E,baseId:P,localRefs:v,meta:w});return n.compileSchema.call(_,g),(0,o.getValidate)(c,g)}e.default=s}),zf=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=me(),r=ut(),n=Lu(),o={keyword:"$dynamicRef",schemaType:"string",code:(a)=>s(a,a.schema)};function s(a,i){let{gen:c,keyword:u,it:f}=a;if(i[0]!=="#")throw Error(`"${u}" only supports hash fragment reference`);let _=i.slice(1);if(f.allErrors)E();else{let v=c.let("valid",!1);E(v),a.ok(v)}function E(v){if(f.schemaEnv.root.dynamicAnchors[_]){let w=c.let("_v",t._`${r.default.dynamicAnchors}${(0,t.getProperty)(_)}`);c.if(w,P(w,v),P(f.validateName,v))}else P(f.validateName,v)()}function P(v,w){return w?()=>c.block(()=>{(0,n.callRef)(a,v),c.let(w,!0)}):()=>(0,n.callRef)(a,v)}}e.dynamicRef=s,e.default=o}),_v=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Rf(),r=Se(),n={keyword:"$recursiveAnchor",schemaType:"boolean",code(o){if(o.schema)(0,t.dynamicAnchor)(o,"");else(0,r.checkStrictMode)(o.it,"$recursiveAnchor: false is ignored")}};e.default=n}),Sv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=zf(),r={keyword:"$recursiveRef",schemaType:"string",code:(n)=>(0,t.dynamicRef)(n,n.schema)};e.default=r}),wf=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Rf(),r=zf(),n=_v(),o=Sv(),s=[t.default,r.default,n.default,o.default];e.default=s}),yv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Uu(),r={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:(n)=>(0,t.validatePropertyDeps)(n)};e.default=r}),vv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Uu(),r={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(n)=>(0,t.validateSchemaDeps)(n)};e.default=r}),bv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Se(),r={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:n,parentSchema:o,it:s}){if(o.contains===void 0)(0,t.checkStrictMode)(s,`"${n}" without "contains" is ignored`)}};e.default=r}),$f=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=yv(),r=vv(),n=bv(),o=[t.default,r.default,n.default];e.default=o}),Rv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=Se(),n=ut(),o={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:s})=>t._`{unevaluatedProperty: ${s.unevaluatedProperty}}`},code(s){let{gen:a,schema:i,data:c,errsCount:u,it:f}=s;if(!u)throw Error("ajv implementation error");let{allErrors:_,props:E}=f;if(E instanceof t.Name)a.if(t._`${E} !== true`,()=>a.forIn("key",c,(m)=>a.if(v(E,m),()=>P(m))));else if(E!==!0)a.forIn("key",c,(m)=>E===void 0?P(m):a.if(w(E,m),()=>P(m)));f.props=!0,s.ok(t._`${u} === ${n.default.errors}`);function P(m){if(i===!1){if(s.setParams({unevaluatedProperty:m}),s.error(),!_)a.break();return}if(!(0,r.alwaysValidSchema)(f,i)){let g=a.name("valid");if(s.subschema({keyword:"unevaluatedProperties",dataProp:m,dataPropType:r.Type.Str},g),!_)a.if((0,t.not)(g),()=>a.break())}}function v(m,g){return t._`!${m} || !${m}[${g}]`}function w(m,g){let z=[];for(let S in m)if(m[S]===!0)z.push(t._`${g} !== ${S}`);return(0,t.and)(...z)}}};e.default=o}),zv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=Se(),n={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:o}})=>t.str`must NOT have more than ${o} items`,params:({params:{len:o}})=>t._`{limit: ${o}}`},code(o){let{gen:s,schema:a,data:i,it:c}=o,u=c.items||0;if(u===!0)return;let f=s.const("len",t._`${i}.length`);if(a===!1)o.setParams({len:u}),o.fail(t._`${f} > ${u}`);else if(typeof a=="object"&&!(0,r.alwaysValidSchema)(c,a)){let E=s.var("valid",t._`${f} <= ${u}`);s.if((0,t.not)(E),()=>_(E,u)),o.ok(E)}c.items=!0;function _(E,P){s.forRange("i",P,f,(v)=>{if(o.subschema({keyword:"unevaluatedItems",dataProp:v,dataPropType:r.Type.Num},E),!c.allErrors)s.if((0,t.not)(E),()=>s.break())})}}};e.default=n}),Ef=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Rv(),r=zv(),n=[t.default,r.default];e.default=n}),wv=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}}),$v=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}}),Ev=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}}),Tv=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}}),Pv=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}}),kv=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),Ov=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),Cv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=wv(),r=$v(),n=Ev(),o=Tv(),s=Pv(),a=kv(),i=Ov(),c=["/properties"];function u(f){return[t,r,n,o,_(this,s),a,_(this,i)].forEach((E)=>this.addMetaSchema(E,void 0,!1)),this;function _(E,P){return f?E.$dataMetaSchema(P,c):P}}e.default=u}),Nv=V((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2019=void 0;let r=qu(),n=vf(),o=wf(),s=$f(),a=Ef(),i=Fu(),c=Cv(),u="https://json-schema.org/draft/2019-09/schema";var f=class extends r.default{constructor(w={}){super({...w,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),this.addVocabulary(o.default),n.default.forEach((w)=>this.addVocabulary(w)),this.addVocabulary(s.default),this.addVocabulary(a.default),this.opts.discriminator)this.addKeyword(i.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:w,meta:m}=this.opts;if(!m)return;c.default.call(this,w),this.refs["http://json-schema.org/schema"]=u}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(u)?u:void 0)}};e.Ajv2019=f,t.exports=e=f,t.exports.Ajv2019=f,Object.defineProperty(e,"__esModule",{value:!0}),e.default=f;var _=Kr();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return _.KeywordCxt}});var E=me();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return E._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return E.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return E.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return E.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return E.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return E.CodeGen}});var P=bo();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return P.default}});var v=Br();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return v.default}})}),xv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=mf(),r=pf(),n=_f(),o=wf(),s=$f(),a=Ef(),i=Sf(),c=yf(),u=[o.default,t.default,r.default,(0,n.default)(!0),i.default,c.metadataVocabulary,c.contentVocabulary,s.default,a.default];e.default=u}),Iv=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}}),Av=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}}),jv=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}}),Mv=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}}),qv=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}}),Lv=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}}),Dv=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),Uv=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),Fv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Iv(),r=Av(),n=jv(),o=Mv(),s=qv(),a=Lv(),i=Dv(),c=Uv(),u=["/properties"];function f(_){return[t,r,n,o,s,E(this,a),i,E(this,c)].forEach((P)=>this.addMetaSchema(P,void 0,!1)),this;function E(P,v){return _?P.$dataMetaSchema(v,u):v}}e.default=f}),Zv=V((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;let r=qu(),n=xv(),o=Fu(),s=Fv(),a="https://json-schema.org/draft/2020-12/schema";var i=class extends r.default{constructor(E={}){super({...E,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),n.default.forEach((E)=>this.addVocabulary(E)),this.opts.discriminator)this.addKeyword(o.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:E,meta:P}=this.opts;if(!P)return;s.default.call(this,E),this.refs["http://json-schema.org/schema"]=a}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}};e.Ajv2020=i,t.exports=e=i,t.exports.Ajv2020=i,Object.defineProperty(e,"__esModule",{value:!0}),e.default=i;var c=Kr();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=me();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var f=bo();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return f.default}});var _=Br();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return _.default}})}),Vv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(D,Z){return{validate:D,compare:Z}}e.fullFormats={date:t(s,a),time:t(c(!0),u),"date-time":t(E(!0),P),"iso-time":t(c(),f),"iso-date-time":t(E(),v),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:g,"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:H,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:S,int32:{type:"number",validate:R},int64:{type:"number",validate:y},float:{type:"number",validate:N},double:{type:"number",validate:N},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,a),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u),"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,f),"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,v),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function r(D){return D%4===0&&(D%100!==0||D%400===0)}let n=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,o=[0,31,28,31,30,31,30,31,31,30,31,30,31];function s(D){let Z=n.exec(D);if(!Z)return!1;let G=+Z[1],B=+Z[2],he=+Z[3];return B>=1&&B<=12&&he>=1&&he<=(B===2&&r(G)?29:o[B])}function a(D,Z){if(!(D&&Z))return;if(D>Z)return 1;if(D<Z)return-1;return 0}let i=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(D){return function(G){let B=i.exec(G);if(!B)return!1;let he=+B[1],we=+B[2],be=+B[3],Oe=B[4],fe=B[5]==="-"?-1:1,l=+(B[6]||0),h=+(B[7]||0);if(l>23||h>59||D&&!Oe)return!1;if(he<=23&&we<=59&&be<60)return!0;let k=we-h*fe,p=he-l*fe-(k<0?1:0);return(p===23||p===-1)&&(k===59||k===-1)&&be<61}}function u(D,Z){if(!(D&&Z))return;let G=new Date("2020-01-01T"+D).valueOf(),B=new Date("2020-01-01T"+Z).valueOf();if(!(G&&B))return;return G-B}function f(D,Z){if(!(D&&Z))return;let G=i.exec(D),B=i.exec(Z);if(!(G&&B))return;if(D=G[1]+G[2]+G[3],Z=B[1]+B[2]+B[3],D>Z)return 1;if(D<Z)return-1;return 0}let _=/t|\s/i;function E(D){let Z=c(D);return function(B){let he=B.split(_);return he.length===2&&s(he[0])&&Z(he[1])}}function P(D,Z){if(!(D&&Z))return;let G=new Date(D).valueOf(),B=new Date(Z).valueOf();if(!(G&&B))return;return G-B}function v(D,Z){if(!(D&&Z))return;let[G,B]=D.split(_),[he,we]=Z.split(_),be=a(G,he);if(be===void 0)return;return be||u(B,we)}let w=/\/|:/,m=/^(?:[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 g(D){return w.test(D)&&m.test(D)}let z=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function S(D){return z.lastIndex=0,z.test(D)}let b=-2147483648,O=2147483647;function R(D){return Number.isInteger(D)&&D<=O&&D>=b}function y(D){return Number.isInteger(D)}function N(){return!0}let q=/[^\\]\\Z/;function H(D){if(q.test(D))return!1;try{return new RegExp(D),!0}catch(Z){return!1}}}),Jv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=bf(),r=me(),n=r.operators,o={formatMaximum:{okStr:"<=",ok:n.LTE,fail:n.GT},formatMinimum:{okStr:">=",ok:n.GTE,fail:n.LT},formatExclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},formatExclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},s={message:({keyword:i,schemaCode:c})=>r.str`should be ${o[i].okStr} ${c}`,params:({keyword:i,schemaCode:c})=>r._`{comparison: ${o[i].okStr}, limit: ${c}}`};e.formatLimitDefinition={keyword:Object.keys(o),type:"string",schemaType:"string",$data:!0,error:s,code(i){let{gen:c,data:u,schemaCode:f,keyword:_,it:E}=i,{opts:P,self:v}=E;if(!P.validateFormats)return;let w=new t.KeywordCxt(E,v.RULES.all.format.definition,"format");if(w.$data)m();else g();function m(){let S=c.scopeValue("formats",{ref:v.formats,code:P.code.formats}),b=c.const("fmt",r._`${S}[${w.schemaCode}]`);i.fail$data((0,r.or)(r._`typeof ${b} != "object"`,r._`${b} instanceof RegExp`,r._`typeof ${b}.compare != "function"`,z(b)))}function g(){let S=w.schema,b=v.formats[S];if(!b||b===!0)return;if(typeof b!="object"||b instanceof RegExp||typeof b.compare!="function")throw Error(`"${_}": format "${S}" does not define "compare" function`);let O=c.scopeValue("formats",{key:S,ref:b,code:P.code.formats?r._`${P.code.formats}${(0,r.getProperty)(S)}`:void 0});i.fail$data(z(O))}function z(S){return r._`${S}.compare(${u}, ${f}) ${o[_].fail} 0`}},dependencies:["format"]};let a=(i)=>(i.addKeyword(e.formatLimitDefinition),i);e.default=a}),Hv=V((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=Vv(),n=Jv(),o=me(),s=new o.Name("fullFormats"),a=new o.Name("fastFormats"),i=(u,f={keywords:!0})=>{if(Array.isArray(f))return c(u,f,r.fullFormats,s),u;let[_,E]=f.mode==="fast"?[r.fastFormats,a]:[r.fullFormats,s];if(c(u,f.formats||r.formatNames,_,E),f.keywords)(0,n.default)(u);return u};i.get=(u,f="full")=>{let _=(f==="fast"?r.fastFormats:r.fullFormats)[u];if(!_)throw Error(`Unknown format "${u}"`);return _};function c(u,f,_,E){var P,v;(P=(v=u.opts.code).formats)!==null&&P!==void 0||(v.formats=o._`require("ajv-formats/dist/formats").${E}`);for(let w of f)u.addFormat(w,_[w])}t.exports=e=i,Object.defineProperty(e,"__esModule",{value:!0}),e.default=i}),Tf=bf(),Kv=Nv(),Bv=Zv(),Yv=Zo(Hv(),1),Gv=Yv.default;function Mu(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Gv(t),t}var Zu=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=e!==void 0,this._ajv=e}get ajv(){return this._ajv??=Mu(Bv.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=dl(e,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");if(t==="2020-12")return this.ajv;if(t==="2019-09")return this._ajv2019??=Mu(Kv.Ajv2019);return this._ajvDraft7??=Mu(Tf.Ajv)}getValidator(e){let t=this._engineFor(e),r="$id"in e&&typeof e.$id==="string"?t.getSchema(e.$id)??t.compile(e):t.compile(e);return(n)=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:t.errorsText(r.errors)}}},cz=Tf.Ajv;import Vu from"node:process";var Qv=8,Wv=600000;function Xv(e){if(e?.maxRounds!==void 0&&(!Number.isInteger(e.maxRounds)||e.maxRounds<1))throw RangeError(`inputRequired.maxRounds must be a positive integer (got ${e.maxRounds})`);if(e?.roundTimeoutMs!==void 0&&(!Number.isFinite(e.roundTimeoutMs)||e.roundTimeoutMs<=0))throw RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${e.roundTimeoutMs})`);return{maxRounds:e?.maxRounds??Qv,roundTimeoutMs:e?.roundTimeoutMs??Wv,legacyShim:e?.legacyShim??!0}}function Pf(e,t,r){if(r===null||typeof r!=="object"||typeof r.method!=="string")throw new _e(ne.InternalError,`Handler for ${e} returned an invalid input request '${t}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let n=r,o=wh(n);if(o===void 0)throw new _e(ne.InternalError,`Handler for ${e} returned an input request '${t}' of kind '${n.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:n,required:o}}function eb(){let e=globalThis.crypto;if(e?.randomUUID!==void 0)return e.randomUUID();let t=new Uint8Array(16);e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let r=[...t].map((n)=>n.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function Ju(e,t){if(e==="tools/call")return{content:[{type:"text",text:t}],isError:!0};throw new _e(ne.InternalError,t)}var tb=class{constructor(e){this._host=e}async fulfill(e,t,r,n,o){let{maxRounds:s,roundTimeoutMs:a}=this._host,i=n.mcpReq.signal,c=o,u=0;while(!0){if(u+=1,u>s)return Ju(e,Gh(e,s));let f=c.inputRequests,_=f!=null&&Object.keys(f).length>0,E=typeof c.requestState==="string"?c.requestState:void 0;if(!_&&E===void 0)throw new _e(ne.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);let P;if(_){let m=this._host.resolvedClientCapabilities(n),g=[];for(let[S,b]of Object.entries(f)){let{embedded:O,required:R}=Pf(e,S,b);if(O.method!=="roots/list"&&O.params===void 0)throw new _e(ne.InternalError,`Handler for ${e} returned an input request '${S}' of kind '${O.method}' without params`);if(wu(R,m)!==void 0)return Ju(e,`Cannot request input '${S}' (${O.method}): the client on this 2025-era connection did not declare the required capability${m===void 0?" (no client capabilities are available on this connection — per-request legacy serving cannot receive server-to-client requests)":""}`);g.push([S,O])}let z=Wh(i);try{let S={relatedRequestId:n.mcpReq.id,timeout:a,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:z.signal},b=await Promise.all(g.map(async([O,R])=>{try{return[O,await this._dispatchLeg(R,S)]}catch(y){throw z.abort(y),y}}));P=Object.fromEntries(b)}catch(S){if(i.aborted)throw S;return Ju(e,`Fulfilling input required by '${e}' failed: ${S instanceof Error?S.message:String(S)}`)}finally{z.dispose()}}else await Qh(Yh,i);let v={...n,mcpReq:{...n.mcpReq,inputResponses:P,droppedInputResponseKeys:void 0,requestState:vo(E)}};if(E!==void 0){let m=await this._host.verifyRequestState(E,v,e);if(m!==void 0)v=ju(v,m)}let w=await t(r,v);if(!Hr(w))return w;c=w}}async _dispatchLeg(e,t){switch(e.method){case"elicitation/create":{let r=e.params;if(r.mode==="url"&&r.elicitationId===void 0)r={...r,elicitationId:eb()};return await this._host.sendElicitation(r,t)}case"sampling/createMessage":return await this._host.sendSampling(e.params,t);case"roots/list":return await this._host.listRoots(e.params,t)}}},rb=new Set(["tools/call","prompts/get","resources/read"]),nb,ob,sb;var iw=class extends rf{_clientCapabilities;_clientVersion;static{nb=(e,t)=>{if(t.clientCapabilities!==void 0)e._clientCapabilities=t.clientCapabilities;if(t.clientInfo!==void 0)e._clientVersion=t.clientInfo},ob=(e,t)=>{let r=t.filter((n)=>!e._supportedProtocolVersions.includes(n));if(r.length>0)e._supportedProtocolVersions=[...e._supportedProtocolVersions,...r];e.setRequestHandler("server/discover",()=>e._ondiscover())},sb=(e)=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new tb({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:(e)=>this._inputRequestCapabilityView(e),verifyRequestState:(e,t,r)=>this._verifyRequestState(e,t,r),sendElicitation:(e,t)=>this._sendElicitationLeg(e,t,{validateAcceptedContent:!1}),sendSampling:(e,t)=>this.createMessage(e,t),listRoots:(e,t)=>this.listRoots(e,t)})}oninitialized;constructor(e,t){super(t);if(this._serverInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new Zu,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=Xv(t?.inputRequired),t?.cacheHints!==void 0){for(let[r,n]of Object.entries(t.cacheHints))if(n!==void 0)Ah(n,`cacheHints['${r}']`);this._cacheHints=t.cacheHints}if(this.setRequestHandler("initialize",(r)=>this._oninitialize(r)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),$u(this._supportedProtocolVersions).length>0)this.setRequestHandler("server/discover",()=>this._ondiscover());if(this._capabilities.logging)this._registerLoggingHandler()}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(e,t)=>{let r=t.sessionId||t.http?.req?.headers.get("mcp-session-id")||void 0,{level:n}=e.params,o=oa(Dt,n);if(o.success)this._loggingLevels.set(r,o.data);return{}})}buildContext(e,t){let r=e.http||t?.request||t?.closeSSEStream||t?.closeStandaloneSSEStream;return{...e,mcpReq:{...e.mcpReq,log:(n,o,s)=>{if(!this._capabilities.logging)return Promise.resolve();let a;if(this._servedModernEra()){if(a=e.mcpReq.envelope?.[nr],a===void 0)return Promise.resolve()}else a=this._loggingLevels.get(e.sessionId)??this._loggingLevels.get(void 0);if(a!==void 0&&this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(a))return Promise.resolve();return e.mcpReq.notify({method:"notifications/message",params:{level:n,data:o,logger:s}})},elicitInput:(n,o)=>this.elicitInput(n,o),requestSampling:(n,o)=>this.createMessage(n,o)},http:r?{...e.http,req:t?.request,closeSSE:t?.closeSSEStream,closeStandaloneSSE:t?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(Dt.options.map((e,t)=>[e,t]));isMessageIgnored=(e,t)=>{let r=this._loggingLevels.get(t);return r?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(r):!1};registerCapabilities(e){if(this.transport)throw new pe(ge.AlreadyConnected,"Cannot register capabilities after connecting to transport");let t=!!this._capabilities.logging;if(this._capabilities=nf(this._capabilities,e),!t&&this._capabilities.logging)this._registerLoggingHandler()}_wrapHandler(e,t){if(e!=="tools/call"){let r=this._cacheHints?.[e],n=rb.has(e);if(r===void 0&&!n)return async(o,s)=>{let a=await t(o,s);if(Hr(a))throw new _e(ne.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return a};return async(o,s)=>{let a=n?await this._invokeInputRequiredCapableHandler(e,t,o,s):await t(o,s);if(Hr(a)){if(!n)throw new _e(ne.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return a}return r===void 0?a:Ih(a,r)}}return async(r,n)=>{let o=Jr(this._negotiatedProtocolVersion),s=o.validateRequest("tools/call",r);if(!s.ok)throw new _e(s.reason==="not-in-era"?ne.InternalError:ne.InvalidParams,s.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${s.message}`);let a=await this._invokeInputRequiredCapableHandler("tools/call",t,r,n);if(Hr(a))return a;let i=Eu(a),c=o.validateResult("tools/call",i);if(!c.ok)throw new _e(c.reason==="not-in-era"?ne.InternalError:ne.InvalidParams,c.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${c.message}`);return c.value}}_servedModernEra(){return this._negotiatedProtocolVersion!==void 0&&yo(this._negotiatedProtocolVersion)}async _invokeInputRequiredCapableHandler(e,t,r,n){let o=this._servedModernEra(),s=n.mcpReq.requestState();if(s!==void 0&&typeof s!=="string")throw new _e(ne.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let a=n;if(typeof s==="string"){let _=await this._verifyRequestState(s,n,e);if(_!==void 0)a=ju(n,_)}let i;try{i=await t(r,a)}catch(_){if(_ instanceof _e&&_.code===ne.UrlElicitationRequired){if(!o)throw _;throw new _e(ne.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { …: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`)}throw _}if(!Hr(i))return i;if(!o){if(!this._inputRequiredServing.legacyShim)throw new _e(ne.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??kr}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(e,t,r,a,i)}let c=i.inputRequests,u=c!=null&&Object.keys(c).length>0,f=typeof i.requestState==="string";if(!u&&!f)throw new _e(ne.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(u){let _=this._inputRequestCapabilityView(n);for(let[E,P]of Object.entries(c)){let{embedded:v,required:w}=Pf(e,E,P),m=wu(w,_);if(m!==void 0)throw new Cu({requiredCapabilities:m},`Cannot request input '${E}' (${v.method}): the request's client capabilities do not declare the required capability`)}}return i}async _verifyRequestState(e,t,r){if(this._requestStateVerify===void 0)return;try{return await this._requestStateVerify(e,t)}catch(n){throw this.onerror?.(Error(`requestState verification rejected ${r}: ${n instanceof Error?n.message:String(n)}`)),new _e(ne.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(e){return this._servedModernEra()?e.mcpReq.envelope?.[It]:this._clientCapabilities}_assertPushApiInServedEra(e){if(this._servedModernEra())throw new pe(ge.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${e}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead — the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:e,era:"2026-07-28"})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new pe(ge.CapabilityNotSupported,`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new pe(ge.CapabilityNotSupported,`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new pe(ge.CapabilityNotSupported,`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new pe(ge.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new pe(ge.CapabilityNotSupported,`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new pe(ge.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new pe(ge.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new pe(ge.CapabilityNotSupported,`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"completion/complete":if(!this._capabilities.completions)throw new pe(ge.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new pe(ge.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new pe(ge.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new pe(ge.CapabilityNotSupported,`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new pe(ge.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;let r=$h(this._supportedProtocolVersions),n=r.includes(t)?t:r[0]??kr;return this._negotiatedProtocolVersion=n,this.transport?.setProtocolVersion?.(n),{protocolVersion:n,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:$u(this._supportedProtocolVersions),capabilities:ib(this.getCapabilities()),...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(e,t){return this._wireCodec().projectCallToolResult(e,t)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(e,t){if(this._assertPushApiInServedEra("sampling/createMessage"),(e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new pe(ge.CapabilityNotSupported,"Client does not support sampling tools capability.");if(e.messages.length>0){let s=e.messages.at(-1),a=Array.isArray(s.content)?s.content:[s.content],i=a.some((_)=>_.type==="tool_result"),c=e.messages.length>1?e.messages.at(-2):void 0,u=c?Array.isArray(c.content)?c.content:[c.content]:[],f=u.some((_)=>_.type==="tool_use");if(i){if(a.some((_)=>_.type!=="tool_result"))throw new _e(ne.InvalidParams,"The last message must contain only tool_result content if any is present");if(!f)throw new _e(ne.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(f){let _=new Set(u.filter((P)=>P.type==="tool_use").map((P)=>P.id)),E=new Set(a.filter((P)=>P.type==="tool_result").map((P)=>P.toolUseId));if(_.size!==E.size||![..._].every((P)=>E.has(P)))throw new _e(ne.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let r=Boolean(e.tools||e.toolChoice),n=await this.request({method:"sampling/createMessage",params:e},t),o=this._wireCodec().samplingResultVariant(r,n);if(!o.ok)throw new pe(ge.InvalidResult,`Invalid sampling/createMessage result: ${o.reason==="invalid"?o.message:o.reason}`);return o.value}async elicitInput(e,t){switch(this._assertPushApiInServedEra("elicitation/create"),e.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new pe(ge.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new pe(ge.CapabilityNotSupported,"Client does not support form elicitation.");break}return this._sendElicitationLeg(e,t)}async _sendElicitationLeg(e,t,r){let n=e.mode??"form",o=r?.validateAcceptedContent??!0;switch(n){case"url":{let s=e;return this.request({method:"elicitation/create",params:s},t)}case"form":{let s=e.mode==="form"?e:{...e,mode:"form"},a=await this.request({method:"elicitation/create",params:s},t);if(o&&a.action==="accept"&&a.content&&s.requestedSchema)try{let i=this._jsonSchemaValidator.getValidator(s.requestedSchema)(a.content);if(!i.valid)throw new _e(ne.InvalidParams,`Elicitation response content does not match requested schema: ${i.errorMessage}`)}catch(i){if(i instanceof _e)throw i;throw new _e(ne.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return a}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new pe(ge.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:e},t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};function ib(e){return{...e}}var Hu=class{_readBuffer;_started=!1;_closed=!1;constructor(e=Vu.stdin,t=Vu.stdout,r){this._stdin=e,this._stdout=t,this._readBuffer=new of({maxBufferSize:r?.maxBufferSize})}onclose;onerror;onmessage;_ondata=(e)=>{try{this._readBuffer.append(e),this.processReadBuffer()}catch(t){this.onerror?.(t),this.close().catch(()=>{})}};_onerror=(e)=>{this.onerror?.(e)};_onstdouterror=(e)=>{this.onerror?.(e),this.close().catch(()=>{})};async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror),this._stdout.on("error",this._onstdouterror)}processReadBuffer(){while(!0)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._closed)return;if(this._closed=!0,this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdout.off("error",this._onstdouterror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(e){if(this._closed)return Promise.reject(Error("StdioServerTransport is closed"));return new Promise((t,r)=>{let n=sf(e),o=!1,s=(i)=>{if(o)return;o=!0,this._stdout.off("error",s),this._stdout.off("drain",a),r(i)},a=()=>{if(o)return;o=!0,this._stdout.off("error",s),this._stdout.off("drain",a),t()};if(this._stdout.once("error",s),this._stdout.write(n)){if(o)return;o=!0,this._stdout.off("error",s),t()}else if(!o)this._stdout.once("drain",a)})}};import{existsSync as jb}from"node:fs";da();async function Yf(e){let t=il(await e),[r,n,{QuickJSWASMModule:o}]=await Promise.all([t.importModuleLoader().then(il),t.importFFI(),Promise.resolve().then(() => (Bf(),Kf)).then(il)]),s=await r();s.type="sync";let a=new n(s);return new o(s,a)}function il(e){return e&&"default"in e&&e.default?e.default&&"default"in e.default&&e.default.default?e.default.default:e.default:e}var Qf="engine";function Pb(e){let t=(r)=>new URL(r,e).href;return{type:"sync",importFFI:()=>import(t("ffi.mjs")).then((r)=>r.QuickJSFFI),importModuleLoader:()=>import(t("emscripten-module.mjs")).then((r)=>r.default)}}var Gf=null;function Wf(e){return()=>(Gf??=Yf(Pb(e)),Gf)}var kb=mg(eg(),1);var Cb="__mcpcloud_call_tool",v$=`globalThis.tool = (name, args) =>
84
- globalThis.${Cb}(String(name), JSON.stringify(args ?? {}))
85
- .then((json) => JSON.parse(json));`;var Nb=6,xb=["log","warn","error","info","debug"],Ib="__mcpcloud_console",z$=`globalThis.console = {
86
- ${xb.map((e)=>` ${e}: (...args) => globalThis.${Ib}(${JSON.stringify(e)}, JSON.stringify(args.slice(0, ${Nb}).map((value) => (value instanceof Error ? { __mcpcloudError: value.name + ': ' + value.message } : value)))),`).join(`
83
+ deps: ${f}}`};let o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(c){let[u,f]=i(c);a(c,u),s(c,f)}};function i({schema:c}){let u={},f={};for(let _ in c){if(_==="__proto__")continue;let E=Array.isArray(c[_])?u:f;E[_]=c[_]}return[u,f]}function a(c,u=c.schema){let{gen:f,data:_,it:E}=c;if(Object.keys(u).length===0)return;let P=f.let("missing");for(let v in u){let w=u[v];if(w.length===0)continue;let m=(0,n.propertyInData)(f,_,v,E.opts.ownProperties);if(c.setParams({property:v,depsCount:w.length,deps:w.join(", ")}),E.allErrors)f.if(m,()=>{for(let g of w)(0,n.checkReportMissingProp)(c,g)});else f.if(t._`${m} && (${(0,n.checkMissingProp)(c,w,P)})`),(0,n.reportMissingProp)(c,P),f.else()}}e.validatePropertyDeps=a;function s(c,u=c.schema){let{gen:f,data:_,keyword:E,it:P}=c,v=f.name("valid");for(let w in u){if((0,r.alwaysValidSchema)(P,u[w]))continue;f.if((0,n.propertyInData)(f,_,w,P.opts.ownProperties),()=>{let m=c.subschema({keyword:E,schemaProp:w},v);c.mergeValidEvaluated(m,v)},()=>f.var(v,!0)),c.ok(v)}}e.validateSchemaDeps=s,e.default=o}),Ry=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=Se(),n={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:o})=>t._`{propertyName: ${o.propertyName}}`},code(o){let{gen:i,schema:a,data:s,it:c}=o;if((0,r.alwaysValidSchema)(c,a))return;let u=i.name("valid");i.forIn("key",s,(f)=>{o.setParams({propertyName:f}),o.subschema({keyword:"propertyNames",data:f,dataTypes:["string"],propertyName:f,compositeRule:!0},u),i.if((0,t.not)(u),()=>{if(o.error(!0),!c.allErrors)i.break()})}),o.ok(u)}};e.default=n}),Gh=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ct(),r=me(),n=at(),o=Se(),i={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:a})=>r._`{additionalProperty: ${a.additionalProperty}}`},code(a){let{gen:s,schema:c,parentSchema:u,data:f,errsCount:_,it:E}=a;if(!_)throw Error("ajv implementation error");let{allErrors:P,opts:v}=E;if(E.props=!0,v.removeAdditional!=="all"&&(0,o.alwaysValidSchema)(E,c))return;let w=(0,t.allSchemaProperties)(u.properties),m=(0,t.allSchemaProperties)(u.patternProperties);g(),a.ok(r._`${_} === ${n.default.errors}`);function g(){s.forIn("key",f,(R)=>{if(!w.length&&!m.length)b(R);else s.if(z(R),()=>b(R))})}function z(R){let y;if(w.length>8){let N=(0,o.schemaRefOrVal)(E,u.properties,"properties");y=(0,t.isOwnProperty)(s,N,R)}else if(w.length)y=(0,r.or)(...w.map((N)=>r._`${R} === ${N}`));else y=r.nil;if(m.length)y=(0,r.or)(y,...m.map((N)=>r._`${(0,t.usePattern)(a,N)}.test(${R})`));return(0,r.not)(y)}function S(R){s.code(r._`delete ${f}[${R}]`)}function b(R){if(v.removeAdditional==="all"||v.removeAdditional&&c===!1){S(R);return}if(c===!1){if(a.setParams({additionalProperty:R}),a.error(),!P)s.break();return}if(typeof c=="object"&&!(0,o.alwaysValidSchema)(E,c)){let y=s.name("valid");if(v.removeAdditional==="failing")O(R,y,!1),s.if((0,r.not)(y),()=>{a.reset(),S(R)});else if(O(R,y),!P)s.if((0,r.not)(y),()=>s.break())}}function O(R,y,N){let q={keyword:"additionalProperties",dataProp:R,dataPropType:o.Type.Str};if(N===!1)Object.assign(q,{compositeRule:!0,createErrors:!1,allErrors:!1});a.subschema(q,y)}}};e.default=i}),zy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ur(),r=ct(),n=Se(),o=Gh(),i={keyword:"properties",type:"object",schemaType:"object",code(a){let{gen:s,schema:c,parentSchema:u,data:f,it:_}=a;if(_.opts.removeAdditional==="all"&&u.additionalProperties===void 0)o.default.code(new t.KeywordCxt(_,o.default,"additionalProperties"));let E=(0,r.allSchemaProperties)(c);for(let g of E)_.definedProperties.add(g);if(_.opts.unevaluated&&E.length&&_.props!==!0)_.props=n.mergeEvaluated.props(s,(0,n.toHash)(E),_.props);let P=E.filter((g)=>!(0,n.alwaysValidSchema)(_,c[g]));if(P.length===0)return;let v=s.name("valid");for(let g of P){if(w(g))m(g);else{if(s.if((0,r.propertyInData)(s,f,g,_.opts.ownProperties)),m(g),!_.allErrors)s.else().var(v,!0);s.endIf()}a.it.definedProperties.add(g),a.ok(v)}function w(g){return _.opts.useDefaults&&!_.compositeRule&&c[g].default!==void 0}function m(g){a.subschema({keyword:"properties",schemaProp:g,dataProp:g},v)}}};e.default=i}),wy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ct(),r=me(),n=Se(),o=Se(),i={keyword:"patternProperties",type:"object",schemaType:"object",code(a){let{gen:s,schema:c,data:u,parentSchema:f,it:_}=a,{opts:E}=_,P=(0,t.allSchemaProperties)(c),v=P.filter((O)=>(0,n.alwaysValidSchema)(_,c[O]));if(P.length===0||v.length===P.length&&(!_.opts.unevaluated||_.props===!0))return;let w=E.strictSchema&&!E.allowMatchingProperties&&f.properties,m=s.name("valid");if(_.props!==!0&&!(_.props instanceof r.Name))_.props=(0,o.evaluatedPropsToName)(s,_.props);let{props:g}=_;z();function z(){for(let O of P){if(w)S(O);if(_.allErrors)b(O);else s.var(m,!0),b(O),s.if(m)}}function S(O){for(let R in w)if(new RegExp(O).test(R))(0,n.checkStrictMode)(_,`property ${R} matches pattern ${O} (use allowMatchingProperties)`)}function b(O){s.forIn("key",u,(R)=>{s.if(r._`${(0,t.usePattern)(a,O)}.test(${R})`,()=>{let y=v.includes(O);if(!y)a.subschema({keyword:"patternProperties",schemaProp:O,dataProp:R,dataPropType:o.Type.Str},m);if(_.opts.unevaluated&&g!==!0)s.assign(r._`${g}[${R}]`,!0);else if(!y&&!_.allErrors)s.if((0,r.not)(m),()=>s.break())})})}}};e.default=i}),$y=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Se(),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(n){let{gen:o,schema:i,it:a}=n;if((0,t.alwaysValidSchema)(a,i)){n.fail();return}let s=o.name("valid");n.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),n.failResult(s,()=>n.reset(),()=>n.error())},error:{message:"must NOT be valid"}};e.default=r}),Ey=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:ct().validateUnion,error:{message:"must match a schema in anyOf"}};e.default=t}),Ty=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=Se(),n={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:o})=>t._`{passingSchemas: ${o.passing}}`},code(o){let{gen:i,schema:a,parentSchema:s,it:c}=o;if(!Array.isArray(a))throw Error("ajv implementation error");if(c.opts.discriminator&&s.discriminator)return;let u=a,f=i.let("valid",!1),_=i.let("passing",null),E=i.name("_valid");o.setParams({passing:_}),i.block(P),o.result(f,()=>o.reset(),()=>o.error(!0));function P(){u.forEach((v,w)=>{let m;if((0,r.alwaysValidSchema)(c,v))i.var(E,!0);else m=o.subschema({keyword:"oneOf",schemaProp:w,compositeRule:!0},E);if(w>0)i.if(t._`${E} && ${f}`).assign(f,!1).assign(_,t._`[${_}, ${w}]`).else();i.if(E,()=>{if(i.assign(f,!0),i.assign(_,w),m)o.mergeEvaluated(m,t.Name)})})}}};e.default=n}),Py=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Se(),r={keyword:"allOf",schemaType:"array",code(n){let{gen:o,schema:i,it:a}=n;if(!Array.isArray(i))throw Error("ajv implementation error");let s=o.name("valid");i.forEach((c,u)=>{if((0,t.alwaysValidSchema)(a,c))return;let f=n.subschema({keyword:"allOf",schemaProp:u},s);n.ok(s),n.mergeEvaluated(f)})}};e.default=r}),ky=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=Se(),n={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:i})=>t.str`must match "${i.ifClause}" schema`,params:({params:i})=>t._`{failingKeyword: ${i.ifClause}}`},code(i){let{gen:a,parentSchema:s,it:c}=i;if(s.then===void 0&&s.else===void 0)(0,r.checkStrictMode)(c,'"if" without "then" and "else" is ignored');let u=o(c,"then"),f=o(c,"else");if(!u&&!f)return;let _=a.let("valid",!0),E=a.name("_valid");if(P(),i.reset(),u&&f){let w=a.let("ifClause");i.setParams({ifClause:w}),a.if(E,v("then",w),v("else",w))}else if(u)a.if(E,v("then"));else a.if((0,t.not)(E),v("else"));i.pass(_,()=>i.error(!0));function P(){let w=i.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},E);i.mergeEvaluated(w)}function v(w,m){return()=>{let g=i.subschema({keyword:w},E);if(a.assign(_,E),i.mergeValidEvaluated(g,_),m)a.assign(m,t._`${w}`);else i.setParams({ifClause:w})}}}};function o(i,a){let s=i.schema[a];return s!==void 0&&!(0,r.alwaysValidSchema)(i,s)}e.default=n}),Oy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Se(),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:n,parentSchema:o,it:i}){if(o.if===void 0)(0,t.checkStrictMode)(i,`"${n}" without "if" is ignored`)}};e.default=r}),Qh=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Bh(),r=yy(),n=Yh(),o=vy(),i=by(),a=Eu(),s=Ry(),c=Gh(),u=zy(),f=wy(),_=$y(),E=Ey(),P=Ty(),v=Py(),w=ky(),m=Oy();function g(z=!1){let S=[_.default,E.default,P.default,v.default,w.default,m.default,s.default,c.default,a.default,u.default,f.default];if(z)S.push(r.default,o.default);else S.push(t.default,n.default);return S.push(i.default),S}e.default=g}),Cy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:n})=>t.str`must match format "${n}"`,params:({schemaCode:n})=>t._`{format: ${n}}`},code(n,o){let{gen:i,data:a,$data:s,schema:c,schemaCode:u,it:f}=n,{opts:_,errSchemaPath:E,schemaEnv:P,self:v}=f;if(!_.validateFormats)return;if(s)w();else m();function w(){let g=i.scopeValue("formats",{ref:v.formats,code:_.code.formats}),z=i.const("fDef",t._`${g}[${u}]`),S=i.let("fType"),b=i.let("format");i.if(t._`typeof ${z} == "object" && !(${z} instanceof RegExp)`,()=>i.assign(S,t._`${z}.type || "string"`).assign(b,t._`${z}.validate`),()=>i.assign(S,t._`"string"`).assign(b,z)),n.fail$data((0,t.or)(O(),R()));function O(){if(_.strictSchema===!1)return t.nil;return t._`${u} && !${b}`}function R(){let y=P.$async?t._`(${z}.async ? await ${b}(${a}) : ${b}(${a}))`:t._`${b}(${a})`,N=t._`(typeof ${b} == "function" ? ${y} : ${b}.test(${a}))`;return t._`${b} && ${b} !== true && ${S} === ${o} && !${N}`}}function m(){let g=v.formats[c];if(!g){O();return}if(g===!0)return;let[z,S,b]=R(g);if(z===o)n.pass(y());function O(){if(_.strictSchema===!1){v.logger.warn(N());return}throw Error(N());function N(){return`unknown format "${c}" ignored in schema at path "${E}"`}}function R(N){let q=N instanceof RegExp?(0,t.regexpCode)(N):_.code.formats?t._`${_.code.formats}${(0,t.getProperty)(c)}`:void 0,H=i.scopeValue("formats",{key:c,ref:N,code:q});if(typeof N=="object"&&!(N instanceof RegExp))return[N.type||"string",N.validate,t._`${H}.validate`];return["string",N,H]}function y(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!P.$async)throw Error("async format in sync schema");return t._`await ${b}(${a})`}return typeof S=="function"?t._`${b}(${a})`:t._`${b}.test(${a})`}}}};e.default=r}),Wh=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=[Cy().default];e.default=t}),Xh=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),ef=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Hh(),r=Kh(),n=Qh(),o=Wh(),i=Xh(),a=[t.default,r.default,(0,n.default)(),o.default,i.metadataVocabulary,i.contentVocabulary];e.default=a}),Ny=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(r){r.Tag="tag",r.Mapping="mapping"})(t||(e.DiscrError=t={}))}),Tu=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=Ny(),n=na(),o=Fr(),i=Se(),a={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:s,tagName:c}})=>s===r.DiscrError.Tag?`tag "${c}" must be string`:`value of tag "${c}" must be in oneOf`,params:({params:{discrError:s,tag:c,tagName:u}})=>t._`{error: ${s}, tag: ${u}, tagValue: ${c}}`},code(s){let{gen:c,data:u,schema:f,parentSchema:_,it:E}=s,{oneOf:P}=_;if(!E.opts.discriminator)throw Error("discriminator: requires discriminator option");let v=f.propertyName;if(typeof v!="string")throw Error("discriminator: requires propertyName");if(f.mapping)throw Error("discriminator: mapping is not supported");if(!P)throw Error("discriminator: requires oneOf keyword");let w=c.let("valid",!1),m=c.const("tag",t._`${u}${(0,t.getProperty)(v)}`);c.if(t._`typeof ${m} == "string"`,()=>g(),()=>s.error(!1,{discrError:r.DiscrError.Tag,tag:m,tagName:v})),s.ok(w);function g(){let b=S();c.if(!1);for(let O in b)c.elseIf(t._`${m} === ${O}`),c.assign(w,z(b[O]));c.else(),s.error(!1,{discrError:r.DiscrError.Mapping,tag:m,tagName:v}),c.endIf()}function z(b){let O=c.name("valid"),R=s.subschema({keyword:"oneOf",schemaProp:b},O);return s.mergeEvaluated(R,t.Name),O}function S(){var b;let O={},R=N(_),y=!0;for(let L=0;L<P.length;L++){let Z=P[L];if((Z===null||Z===void 0?void 0:Z.$ref)&&!(0,i.schemaHasRulesButRef)(Z,E.self.RULES)){let B=Z.$ref;if(Z=n.resolveRef.call(E.self,E.schemaEnv.root,E.baseId,B),Z instanceof n.SchemaEnv)Z=Z.schema;if(Z===void 0)throw new o.default(E.opts.uriResolver,E.baseId,B)}let G=(b=Z===null||Z===void 0?void 0:Z.properties)===null||b===void 0?void 0:b[v];if(typeof G!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${v}"`);y=y&&(R||N(Z)),q(G,L)}if(!y)throw Error(`discriminator: "${v}" must be required`);return O;function N({required:L}){return Array.isArray(L)&&L.includes(v)}function q(L,Z){if(L.const)H(L.const,Z);else if(L.enum)for(let G of L.enum)H(G,Z);else throw Error(`discriminator: "properties/${v}" must have "const" or "enum"`)}function H(L,Z){if(typeof L!="string"||L in O)throw Error(`discriminator: "${v}" values must be unique strings`);O[L]=Z}}}};e.default=a}),xy=V((e,t)=>{t.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),tf=V((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let r=zu(),n=ef(),o=Tu(),i=xy(),a=["/properties"],s="http://json-schema.org/draft-07/schema";var c=class extends r.default{_addVocabularies(){if(super._addVocabularies(),n.default.forEach((P)=>this.addVocabulary(P)),this.opts.discriminator)this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let P=this.opts.$data?this.$dataMetaSchema(i,a):i;this.addMetaSchema(P,s,!1),this.refs["http://json-schema.org/schema"]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var u=Ur();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var f=me();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return f._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return f.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return f.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return f.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return f.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return f.CodeGen}});var _=po();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return _.default}});var E=Fr();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return E.default}})}),rf=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=me(),r=at(),n=na(),o=wu(),i={keyword:"$dynamicAnchor",schemaType:"string",code:(c)=>a(c,c.schema)};function a(c,u){let{gen:f,it:_}=c;_.schemaEnv.root.dynamicAnchors[u]=!0;let E=t._`${r.default.dynamicAnchors}${(0,t.getProperty)(u)}`,P=_.errSchemaPath==="#"?_.validateName:s(c);f.if(t._`!${E}`,()=>f.assign(E,P))}e.dynamicAnchor=a;function s(c){let{schemaEnv:u,schema:f,self:_}=c.it,{root:E,baseId:P,localRefs:v,meta:w}=u.root,{schemaId:m}=_.opts,g=new n.SchemaEnv({schema:f,schemaId:m,root:E,baseId:P,localRefs:v,meta:w});return n.compileSchema.call(_,g),(0,o.getValidate)(c,g)}e.default=i}),nf=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=me(),r=at(),n=wu(),o={keyword:"$dynamicRef",schemaType:"string",code:(a)=>i(a,a.schema)};function i(a,s){let{gen:c,keyword:u,it:f}=a;if(s[0]!=="#")throw Error(`"${u}" only supports hash fragment reference`);let _=s.slice(1);if(f.allErrors)E();else{let v=c.let("valid",!1);E(v),a.ok(v)}function E(v){if(f.schemaEnv.root.dynamicAnchors[_]){let w=c.let("_v",t._`${r.default.dynamicAnchors}${(0,t.getProperty)(_)}`);c.if(w,P(w,v),P(f.validateName,v))}else P(f.validateName,v)()}function P(v,w){return w?()=>c.block(()=>{(0,n.callRef)(a,v),c.let(w,!0)}):()=>(0,n.callRef)(a,v)}}e.dynamicRef=i,e.default=o}),Iy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=rf(),r=Se(),n={keyword:"$recursiveAnchor",schemaType:"boolean",code(o){if(o.schema)(0,t.dynamicAnchor)(o,"");else(0,r.checkStrictMode)(o.it,"$recursiveAnchor: false is ignored")}};e.default=n}),Ay=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=nf(),r={keyword:"$recursiveRef",schemaType:"string",code:(n)=>(0,t.dynamicRef)(n,n.schema)};e.default=r}),of=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=rf(),r=nf(),n=Iy(),o=Ay(),i=[t.default,r.default,n.default,o.default];e.default=i}),jy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Eu(),r={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:(n)=>(0,t.validatePropertyDeps)(n)};e.default=r}),My=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Eu(),r={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(n)=>(0,t.validateSchemaDeps)(n)};e.default=r}),qy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Se(),r={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:n,parentSchema:o,it:i}){if(o.contains===void 0)(0,t.checkStrictMode)(i,`"${n}" without "contains" is ignored`)}};e.default=r}),sf=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=jy(),r=My(),n=qy(),o=[t.default,r.default,n.default];e.default=o}),Ly=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=Se(),n=at(),o={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:i})=>t._`{unevaluatedProperty: ${i.unevaluatedProperty}}`},code(i){let{gen:a,schema:s,data:c,errsCount:u,it:f}=i;if(!u)throw Error("ajv implementation error");let{allErrors:_,props:E}=f;if(E instanceof t.Name)a.if(t._`${E} !== true`,()=>a.forIn("key",c,(m)=>a.if(v(E,m),()=>P(m))));else if(E!==!0)a.forIn("key",c,(m)=>E===void 0?P(m):a.if(w(E,m),()=>P(m)));f.props=!0,i.ok(t._`${u} === ${n.default.errors}`);function P(m){if(s===!1){if(i.setParams({unevaluatedProperty:m}),i.error(),!_)a.break();return}if(!(0,r.alwaysValidSchema)(f,s)){let g=a.name("valid");if(i.subschema({keyword:"unevaluatedProperties",dataProp:m,dataPropType:r.Type.Str},g),!_)a.if((0,t.not)(g),()=>a.break())}}function v(m,g){return t._`!${m} || !${m}[${g}]`}function w(m,g){let z=[];for(let S in m)if(m[S]===!0)z.push(t._`${g} !== ${S}`);return(0,t.and)(...z)}}};e.default=o}),Dy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=me(),r=Se(),n={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:o}})=>t.str`must NOT have more than ${o} items`,params:({params:{len:o}})=>t._`{limit: ${o}}`},code(o){let{gen:i,schema:a,data:s,it:c}=o,u=c.items||0;if(u===!0)return;let f=i.const("len",t._`${s}.length`);if(a===!1)o.setParams({len:u}),o.fail(t._`${f} > ${u}`);else if(typeof a=="object"&&!(0,r.alwaysValidSchema)(c,a)){let E=i.var("valid",t._`${f} <= ${u}`);i.if((0,t.not)(E),()=>_(E,u)),o.ok(E)}c.items=!0;function _(E,P){i.forRange("i",P,f,(v)=>{if(o.subschema({keyword:"unevaluatedItems",dataProp:v,dataPropType:r.Type.Num},E),!c.allErrors)i.if((0,t.not)(E),()=>i.break())})}}};e.default=n}),af=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ly(),r=Dy(),n=[t.default,r.default];e.default=n}),Uy=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}}),Fy=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}}),Zy=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}}),Vy=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}}),Jy=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}}),Hy=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),Ky=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),By=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Uy(),r=Fy(),n=Zy(),o=Vy(),i=Jy(),a=Hy(),s=Ky(),c=["/properties"];function u(f){return[t,r,n,o,_(this,i),a,_(this,s)].forEach((E)=>this.addMetaSchema(E,void 0,!1)),this;function _(E,P){return f?E.$dataMetaSchema(P,c):P}}e.default=u}),Yy=V((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2019=void 0;let r=zu(),n=ef(),o=of(),i=sf(),a=af(),s=Tu(),c=By(),u="https://json-schema.org/draft/2019-09/schema";var f=class extends r.default{constructor(w={}){super({...w,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),this.addVocabulary(o.default),n.default.forEach((w)=>this.addVocabulary(w)),this.addVocabulary(i.default),this.addVocabulary(a.default),this.opts.discriminator)this.addKeyword(s.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:w,meta:m}=this.opts;if(!m)return;c.default.call(this,w),this.refs["http://json-schema.org/schema"]=u}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(u)?u:void 0)}};e.Ajv2019=f,t.exports=e=f,t.exports.Ajv2019=f,Object.defineProperty(e,"__esModule",{value:!0}),e.default=f;var _=Ur();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return _.KeywordCxt}});var E=me();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return E._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return E.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return E.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return E.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return E.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return E.CodeGen}});var P=po();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return P.default}});var v=Fr();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return v.default}})}),Gy=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Hh(),r=Kh(),n=Qh(),o=of(),i=sf(),a=af(),s=Wh(),c=Xh(),u=[o.default,t.default,r.default,(0,n.default)(!0),s.default,c.metadataVocabulary,c.contentVocabulary,i.default,a.default];e.default=u}),Qy=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}}),Wy=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}}),Xy=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}}),ev=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}}),tv=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}}),rv=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}}),nv=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),ov=V((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),sv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Qy(),r=Wy(),n=Xy(),o=ev(),i=tv(),a=rv(),s=nv(),c=ov(),u=["/properties"];function f(_){return[t,r,n,o,i,E(this,a),s,E(this,c)].forEach((P)=>this.addMetaSchema(P,void 0,!1)),this;function E(P,v){return _?P.$dataMetaSchema(v,u):v}}e.default=f}),iv=V((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;let r=zu(),n=Gy(),o=Tu(),i=sv(),a="https://json-schema.org/draft/2020-12/schema";var s=class extends r.default{constructor(E={}){super({...E,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),n.default.forEach((E)=>this.addVocabulary(E)),this.opts.discriminator)this.addKeyword(o.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:E,meta:P}=this.opts;if(!P)return;i.default.call(this,E),this.refs["http://json-schema.org/schema"]=a}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}};e.Ajv2020=s,t.exports=e=s,t.exports.Ajv2020=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s;var c=Ur();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=me();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var f=po();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return f.default}});var _=Fr();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return _.default}})}),av=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(L,Z){return{validate:L,compare:Z}}e.fullFormats={date:t(i,a),time:t(c(!0),u),"date-time":t(E(!0),P),"iso-time":t(c(),f),"iso-date-time":t(E(),v),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:g,"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:H,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:S,int32:{type:"number",validate:R},int64:{type:"number",validate:y},float:{type:"number",validate:N},double:{type:"number",validate:N},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,a),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u),"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,f),"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,v),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function r(L){return L%4===0&&(L%100!==0||L%400===0)}let n=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,o=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(L){let Z=n.exec(L);if(!Z)return!1;let G=+Z[1],B=+Z[2],he=+Z[3];return B>=1&&B<=12&&he>=1&&he<=(B===2&&r(G)?29:o[B])}function a(L,Z){if(!(L&&Z))return;if(L>Z)return 1;if(L<Z)return-1;return 0}let s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(L){return function(G){let B=s.exec(G);if(!B)return!1;let he=+B[1],be=+B[2],ve=+B[3],ke=B[4],fe=B[5]==="-"?-1:1,l=+(B[6]||0),h=+(B[7]||0);if(l>23||h>59||L&&!ke)return!1;if(he<=23&&be<=59&&ve<60)return!0;let k=be-h*fe,p=he-l*fe-(k<0?1:0);return(p===23||p===-1)&&(k===59||k===-1)&&ve<61}}function u(L,Z){if(!(L&&Z))return;let G=new Date("2020-01-01T"+L).valueOf(),B=new Date("2020-01-01T"+Z).valueOf();if(!(G&&B))return;return G-B}function f(L,Z){if(!(L&&Z))return;let G=s.exec(L),B=s.exec(Z);if(!(G&&B))return;if(L=G[1]+G[2]+G[3],Z=B[1]+B[2]+B[3],L>Z)return 1;if(L<Z)return-1;return 0}let _=/t|\s/i;function E(L){let Z=c(L);return function(B){let he=B.split(_);return he.length===2&&i(he[0])&&Z(he[1])}}function P(L,Z){if(!(L&&Z))return;let G=new Date(L).valueOf(),B=new Date(Z).valueOf();if(!(G&&B))return;return G-B}function v(L,Z){if(!(L&&Z))return;let[G,B]=L.split(_),[he,be]=Z.split(_),ve=a(G,he);if(ve===void 0)return;return ve||u(B,be)}let w=/\/|:/,m=/^(?:[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 g(L){return w.test(L)&&m.test(L)}let z=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function S(L){return z.lastIndex=0,z.test(L)}let b=-2147483648,O=2147483647;function R(L){return Number.isInteger(L)&&L<=O&&L>=b}function y(L){return Number.isInteger(L)}function N(){return!0}let q=/[^\\]\\Z/;function H(L){if(q.test(L))return!1;try{return new RegExp(L),!0}catch(Z){return!1}}}),cv=V((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=tf(),r=me(),n=r.operators,o={formatMaximum:{okStr:"<=",ok:n.LTE,fail:n.GT},formatMinimum:{okStr:">=",ok:n.GTE,fail:n.LT},formatExclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},formatExclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},i={message:({keyword:s,schemaCode:c})=>r.str`should be ${o[s].okStr} ${c}`,params:({keyword:s,schemaCode:c})=>r._`{comparison: ${o[s].okStr}, limit: ${c}}`};e.formatLimitDefinition={keyword:Object.keys(o),type:"string",schemaType:"string",$data:!0,error:i,code(s){let{gen:c,data:u,schemaCode:f,keyword:_,it:E}=s,{opts:P,self:v}=E;if(!P.validateFormats)return;let w=new t.KeywordCxt(E,v.RULES.all.format.definition,"format");if(w.$data)m();else g();function m(){let S=c.scopeValue("formats",{ref:v.formats,code:P.code.formats}),b=c.const("fmt",r._`${S}[${w.schemaCode}]`);s.fail$data((0,r.or)(r._`typeof ${b} != "object"`,r._`${b} instanceof RegExp`,r._`typeof ${b}.compare != "function"`,z(b)))}function g(){let S=w.schema,b=v.formats[S];if(!b||b===!0)return;if(typeof b!="object"||b instanceof RegExp||typeof b.compare!="function")throw Error(`"${_}": format "${S}" does not define "compare" function`);let O=c.scopeValue("formats",{key:S,ref:b,code:P.code.formats?r._`${P.code.formats}${(0,r.getProperty)(S)}`:void 0});s.fail$data(z(O))}function z(S){return r._`${S}.compare(${u}, ${f}) ${o[_].fail} 0`}},dependencies:["format"]};let a=(s)=>(s.addKeyword(e.formatLimitDefinition),s);e.default=a}),uv=V((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=av(),n=cv(),o=me(),i=new o.Name("fullFormats"),a=new o.Name("fastFormats"),s=(u,f={keywords:!0})=>{if(Array.isArray(f))return c(u,f,r.fullFormats,i),u;let[_,E]=f.mode==="fast"?[r.fastFormats,a]:[r.fullFormats,i];if(c(u,f.formats||r.formatNames,_,E),f.keywords)(0,n.default)(u);return u};s.get=(u,f="full")=>{let _=(f==="fast"?r.fastFormats:r.fullFormats)[u];if(!_)throw Error(`Unknown format "${u}"`);return _};function c(u,f,_,E){var P,v;(P=(v=u.opts.code).formats)!==null&&P!==void 0||(v.formats=o._`require("ajv-formats/dist/formats").${E}`);for(let w of f)u.addFormat(w,_[w])}t.exports=e=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s}),cf=tf(),lv=Yy(),dv=iv(),mv=Io(uv(),1),pv=mv.default;function Ru(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return pv(t),t}var Pu=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=e!==void 0,this._ajv=e}get ajv(){return this._ajv??=Ru(dv.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=Qu(e,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");if(t==="2020-12")return this.ajv;if(t==="2019-09")return this._ajv2019??=Ru(lv.Ajv2019);return this._ajvDraft7??=Ru(cf.Ajv)}getValidator(e){let t=this._engineFor(e),r="$id"in e&&typeof e.$id==="string"?t.getSchema(e.$id)??t.compile(e):t.compile(e);return(n)=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:t.errorsText(r.errors)}}},M0=cf.Ajv;import ku from"node:process";var hv=8,fv=600000;function gv(e){if(e?.maxRounds!==void 0&&(!Number.isInteger(e.maxRounds)||e.maxRounds<1))throw RangeError(`inputRequired.maxRounds must be a positive integer (got ${e.maxRounds})`);if(e?.roundTimeoutMs!==void 0&&(!Number.isFinite(e.roundTimeoutMs)||e.roundTimeoutMs<=0))throw RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${e.roundTimeoutMs})`);return{maxRounds:e?.maxRounds??hv,roundTimeoutMs:e?.roundTimeoutMs??fv,legacyShim:e?.legacyShim??!0}}function uf(e,t,r){if(r===null||typeof r!=="object"||typeof r.method!=="string")throw new _e(oe.InternalError,`Handler for ${e} returned an invalid input request '${t}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let n=r,o=sh(n);if(o===void 0)throw new _e(oe.InternalError,`Handler for ${e} returned an input request '${t}' of kind '${n.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:n,required:o}}function _v(){let e=globalThis.crypto;if(e?.randomUUID!==void 0)return e.randomUUID();let t=new Uint8Array(16);e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let r=[...t].map((n)=>n.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function Ou(e,t){if(e==="tools/call")return{content:[{type:"text",text:t}],isError:!0};throw new _e(oe.InternalError,t)}var Sv=class{constructor(e){this._host=e}async fulfill(e,t,r,n,o){let{maxRounds:i,roundTimeoutMs:a}=this._host,s=n.mcpReq.signal,c=o,u=0;while(!0){if(u+=1,u>i)return Ou(e,Ch(e,i));let f=c.inputRequests,_=f!=null&&Object.keys(f).length>0,E=typeof c.requestState==="string"?c.requestState:void 0;if(!_&&E===void 0)throw new _e(oe.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);let P;if(_){let m=this._host.resolvedClientCapabilities(n),g=[];for(let[S,b]of Object.entries(f)){let{embedded:O,required:R}=uf(e,S,b);if(O.method!=="roots/list"&&O.params===void 0)throw new _e(oe.InternalError,`Handler for ${e} returned an input request '${S}' of kind '${O.method}' without params`);if(uu(R,m)!==void 0)return Ou(e,`Cannot request input '${S}' (${O.method}): the client on this 2025-era connection did not declare the required capability${m===void 0?" (no client capabilities are available on this connection — per-request legacy serving cannot receive server-to-client requests)":""}`);g.push([S,O])}let z=xh(s);try{let S={relatedRequestId:n.mcpReq.id,timeout:a,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:z.signal},b=await Promise.all(g.map(async([O,R])=>{try{return[O,await this._dispatchLeg(R,S)]}catch(y){throw z.abort(y),y}}));P=Object.fromEntries(b)}catch(S){if(s.aborted)throw S;return Ou(e,`Fulfilling input required by '${e}' failed: ${S instanceof Error?S.message:String(S)}`)}finally{z.dispose()}}else await Nh(Oh,s);let v={...n,mcpReq:{...n.mcpReq,inputResponses:P,droppedInputResponseKeys:void 0,requestState:mo(E)}};if(E!==void 0){let m=await this._host.verifyRequestState(E,v,e);if(m!==void 0)v=bu(v,m)}let w=await t(r,v);if(!Dr(w))return w;c=w}}async _dispatchLeg(e,t){switch(e.method){case"elicitation/create":{let r=e.params;if(r.mode==="url"&&r.elicitationId===void 0)r={...r,elicitationId:_v()};return await this._host.sendElicitation(r,t)}case"sampling/createMessage":return await this._host.sendSampling(e.params,t);case"roots/list":return await this._host.listRoots(e.params,t)}}},yv=new Set(["tools/call","prompts/get","resources/read"]),vv,bv,Rv;var Az=class extends Mh{_clientCapabilities;_clientVersion;static{vv=(e,t)=>{if(t.clientCapabilities!==void 0)e._clientCapabilities=t.clientCapabilities;if(t.clientInfo!==void 0)e._clientVersion=t.clientInfo},bv=(e,t)=>{let r=t.filter((n)=>!e._supportedProtocolVersions.includes(n));if(r.length>0)e._supportedProtocolVersions=[...e._supportedProtocolVersions,...r];e.setRequestHandler("server/discover",()=>e._ondiscover())},Rv=(e)=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new Sv({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:(e)=>this._inputRequestCapabilityView(e),verifyRequestState:(e,t,r)=>this._verifyRequestState(e,t,r),sendElicitation:(e,t)=>this._sendElicitationLeg(e,t,{validateAcceptedContent:!1}),sendSampling:(e,t)=>this.createMessage(e,t),listRoots:(e,t)=>this.listRoots(e,t)})}oninitialized;constructor(e,t){super(t);if(this._serverInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new Pu,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=gv(t?.inputRequired),t?.cacheHints!==void 0){for(let[r,n]of Object.entries(t.cacheHints))if(n!==void 0)gh(n,`cacheHints['${r}']`);this._cacheHints=t.cacheHints}if(this.setRequestHandler("initialize",(r)=>this._oninitialize(r)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),lu(this._supportedProtocolVersions).length>0)this.setRequestHandler("server/discover",()=>this._ondiscover());if(this._capabilities.logging)this._registerLoggingHandler()}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(e,t)=>{let r=t.sessionId||t.http?.req?.headers.get("mcp-session-id")||void 0,{level:n}=e.params,o=Wi(It,n);if(o.success)this._loggingLevels.set(r,o.data);return{}})}buildContext(e,t){let r=e.http||t?.request||t?.closeSSEStream||t?.closeStandaloneSSEStream;return{...e,mcpReq:{...e.mcpReq,log:(n,o,i)=>{if(!this._capabilities.logging)return Promise.resolve();let a;if(this._servedModernEra()){if(a=e.mcpReq.envelope?.[er],a===void 0)return Promise.resolve()}else a=this._loggingLevels.get(e.sessionId)??this._loggingLevels.get(void 0);if(a!==void 0&&this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(a))return Promise.resolve();return e.mcpReq.notify({method:"notifications/message",params:{level:n,data:o,logger:i}})},elicitInput:(n,o)=>this.elicitInput(n,o),requestSampling:(n,o)=>this.createMessage(n,o)},http:r?{...e.http,req:t?.request,closeSSE:t?.closeSSEStream,closeStandaloneSSE:t?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(It.options.map((e,t)=>[e,t]));isMessageIgnored=(e,t)=>{let r=this._loggingLevels.get(t);return r?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(r):!1};registerCapabilities(e){if(this.transport)throw new pe(ge.AlreadyConnected,"Cannot register capabilities after connecting to transport");let t=!!this._capabilities.logging;if(this._capabilities=qh(this._capabilities,e),!t&&this._capabilities.logging)this._registerLoggingHandler()}_wrapHandler(e,t){if(e!=="tools/call"){let r=this._cacheHints?.[e],n=yv.has(e);if(r===void 0&&!n)return async(o,i)=>{let a=await t(o,i);if(Dr(a))throw new _e(oe.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return a};return async(o,i)=>{let a=n?await this._invokeInputRequiredCapableHandler(e,t,o,i):await t(o,i);if(Dr(a)){if(!n)throw new _e(oe.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return a}return r===void 0?a:fh(a,r)}}return async(r,n)=>{let o=Lr(this._negotiatedProtocolVersion),i=o.validateRequest("tools/call",r);if(!i.ok)throw new _e(i.reason==="not-in-era"?oe.InternalError:oe.InvalidParams,i.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${i.message}`);let a=await this._invokeInputRequiredCapableHandler("tools/call",t,r,n);if(Dr(a))return a;let s=du(a),c=o.validateResult("tools/call",s);if(!c.ok)throw new _e(c.reason==="not-in-era"?oe.InternalError:oe.InvalidParams,c.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${c.message}`);return c.value}}_servedModernEra(){return this._negotiatedProtocolVersion!==void 0&&lo(this._negotiatedProtocolVersion)}async _invokeInputRequiredCapableHandler(e,t,r,n){let o=this._servedModernEra(),i=n.mcpReq.requestState();if(i!==void 0&&typeof i!=="string")throw new _e(oe.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let a=n;if(typeof i==="string"){let _=await this._verifyRequestState(i,n,e);if(_!==void 0)a=bu(n,_)}let s;try{s=await t(r,a)}catch(_){if(_ instanceof _e&&_.code===oe.UrlElicitationRequired){if(!o)throw _;throw new _e(oe.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { …: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`)}throw _}if(!Dr(s))return s;if(!o){if(!this._inputRequiredServing.legacyShim)throw new _e(oe.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??zr}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(e,t,r,a,s)}let c=s.inputRequests,u=c!=null&&Object.keys(c).length>0,f=typeof s.requestState==="string";if(!u&&!f)throw new _e(oe.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(u){let _=this._inputRequestCapabilityView(n);for(let[E,P]of Object.entries(c)){let{embedded:v,required:w}=uf(e,E,P),m=uu(w,_);if(m!==void 0)throw new gu({requiredCapabilities:m},`Cannot request input '${E}' (${v.method}): the request's client capabilities do not declare the required capability`)}}return s}async _verifyRequestState(e,t,r){if(this._requestStateVerify===void 0)return;try{return await this._requestStateVerify(e,t)}catch(n){throw this.onerror?.(Error(`requestState verification rejected ${r}: ${n instanceof Error?n.message:String(n)}`)),new _e(oe.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(e){return this._servedModernEra()?e.mcpReq.envelope?.[Pt]:this._clientCapabilities}_assertPushApiInServedEra(e){if(this._servedModernEra())throw new pe(ge.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${e}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead — the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:e,era:"2026-07-28"})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new pe(ge.CapabilityNotSupported,`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new pe(ge.CapabilityNotSupported,`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new pe(ge.CapabilityNotSupported,`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new pe(ge.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new pe(ge.CapabilityNotSupported,`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new pe(ge.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new pe(ge.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new pe(ge.CapabilityNotSupported,`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"completion/complete":if(!this._capabilities.completions)throw new pe(ge.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new pe(ge.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new pe(ge.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new pe(ge.CapabilityNotSupported,`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new pe(ge.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;let r=ih(this._supportedProtocolVersions),n=r.includes(t)?t:r[0]??zr;return this._negotiatedProtocolVersion=n,this.transport?.setProtocolVersion?.(n),{protocolVersion:n,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:lu(this._supportedProtocolVersions),capabilities:zv(this.getCapabilities()),...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(e,t){return this._wireCodec().projectCallToolResult(e,t)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(e,t){if(this._assertPushApiInServedEra("sampling/createMessage"),(e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new pe(ge.CapabilityNotSupported,"Client does not support sampling tools capability.");if(e.messages.length>0){let i=e.messages.at(-1),a=Array.isArray(i.content)?i.content:[i.content],s=a.some((_)=>_.type==="tool_result"),c=e.messages.length>1?e.messages.at(-2):void 0,u=c?Array.isArray(c.content)?c.content:[c.content]:[],f=u.some((_)=>_.type==="tool_use");if(s){if(a.some((_)=>_.type!=="tool_result"))throw new _e(oe.InvalidParams,"The last message must contain only tool_result content if any is present");if(!f)throw new _e(oe.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(f){let _=new Set(u.filter((P)=>P.type==="tool_use").map((P)=>P.id)),E=new Set(a.filter((P)=>P.type==="tool_result").map((P)=>P.toolUseId));if(_.size!==E.size||![..._].every((P)=>E.has(P)))throw new _e(oe.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let r=Boolean(e.tools||e.toolChoice),n=await this.request({method:"sampling/createMessage",params:e},t),o=this._wireCodec().samplingResultVariant(r,n);if(!o.ok)throw new pe(ge.InvalidResult,`Invalid sampling/createMessage result: ${o.reason==="invalid"?o.message:o.reason}`);return o.value}async elicitInput(e,t){switch(this._assertPushApiInServedEra("elicitation/create"),e.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new pe(ge.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new pe(ge.CapabilityNotSupported,"Client does not support form elicitation.");break}return this._sendElicitationLeg(e,t)}async _sendElicitationLeg(e,t,r){let n=e.mode??"form",o=r?.validateAcceptedContent??!0;switch(n){case"url":{let i=e;return this.request({method:"elicitation/create",params:i},t)}case"form":{let i=e.mode==="form"?e:{...e,mode:"form"},a=await this.request({method:"elicitation/create",params:i},t);if(o&&a.action==="accept"&&a.content&&i.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(i.requestedSchema)(a.content);if(!s.valid)throw new _e(oe.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(s){if(s instanceof _e)throw s;throw new _e(oe.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return a}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new pe(ge.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:e},t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};function zv(e){return{...e}}var Cu=class{_readBuffer;_started=!1;_closed=!1;constructor(e=ku.stdin,t=ku.stdout,r){this._stdin=e,this._stdout=t,this._readBuffer=new Lh({maxBufferSize:r?.maxBufferSize})}onclose;onerror;onmessage;_ondata=(e)=>{try{this._readBuffer.append(e),this.processReadBuffer()}catch(t){this.onerror?.(t),this.close().catch(()=>{})}};_onerror=(e)=>{this.onerror?.(e)};_onstdouterror=(e)=>{this.onerror?.(e),this.close().catch(()=>{})};async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror),this._stdout.on("error",this._onstdouterror)}processReadBuffer(){while(!0)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._closed)return;if(this._closed=!0,this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdout.off("error",this._onstdouterror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(e){if(this._closed)return Promise.reject(Error("StdioServerTransport is closed"));return new Promise((t,r)=>{let n=Dh(e),o=!1,i=(s)=>{if(o)return;o=!0,this._stdout.off("error",i),this._stdout.off("drain",a),r(s)},a=()=>{if(o)return;o=!0,this._stdout.off("error",i),this._stdout.off("drain",a),t()};if(this._stdout.once("error",i),this._stdout.write(n)){if(o)return;o=!0,this._stdout.off("error",i),t()}else if(!o)this._stdout.once("drain",a)})}};import{existsSync as Xv}from"node:fs";sa();async function Of(e){let t=Ju(await e),[r,n,{QuickJSWASMModule:o}]=await Promise.all([t.importModuleLoader().then(Ju),t.importFFI(),Promise.resolve().then(() => (kf(),Pf)).then(Ju)]),i=await r();i.type="sync";let a=new n(i);return new o(i,a)}function Ju(e){return e&&"default"in e&&e.default?e.default&&"default"in e.default&&e.default.default?e.default.default:e.default:e}var Nf="engine";function Jv(e){let t=(r)=>new URL(r,e).href;return{type:"sync",importFFI:()=>import(t("ffi.mjs")).then((r)=>r.QuickJSFFI),importModuleLoader:()=>import(t("emscripten-module.mjs")).then((r)=>r.default)}}var Cf=null;function xf(e){return()=>(Cf??=Of(Jv(e)),Cf)}var Hv=Hf(Af(),1);var Bv="__mcpcloud_call_tool",Yw=`globalThis.tool = (name, args) =>
84
+ globalThis.${Bv}(String(name), JSON.stringify(args ?? {}))
85
+ .then((json) => JSON.parse(json));`;var Yv=6,Gv=["log","warn","error","info","debug"],Qv="__mcpcloud_console",Ww=`globalThis.console = {
86
+ ${Gv.map((e)=>` ${e}: (...args) => globalThis.${Qv}(${JSON.stringify(e)}, JSON.stringify(args.slice(0, ${Yv}).map((value) => (value instanceof Error ? { __mcpcloudError: value.name + ': ' + value.message } : value)))),`).join(`
87
87
  `)}
88
- };`;var Ab=Symbol.for("@mcpcloud/runtime.codeModeEngineProvider");function tg(e){globalThis[Ab]=e}var rg=[`./${Qf}/`,"../engine/vendor/","../../engine/vendor/"];function Mb(e=new URL(import.meta.url)){for(let t of rg){let r=new URL(t,e);if(jb(new URL("emscripten-module.wasm",r)))return r}throw Error(`Code Mode engine not found. Looked for emscripten-module.wasm in: ${rg.join(", ")} (relative to ${e.href}).`)}function ng(){tg(()=>Wf(Mb())())}async function qb(e,t){ng();let r=e.createServer(t),n=new Hu;await r.connect(n)}export{Hu as StdioServerTransport,qb as startStdioServer};
88
+ };`;var Wv=Symbol.for("@mcpcloud/runtime.codeModeEngineProvider");function jf(e){globalThis[Wv]=e}var Mf=[`./${Nf}/`,"../engine/vendor/","../../engine/vendor/"];function eb(e=new URL(import.meta.url)){for(let t of Mf){let r=new URL(t,e);if(Xv(new URL("emscripten-module.wasm",r)))return r}throw Error(`Code Mode engine not found. Looked for emscripten-module.wasm in: ${Mf.join(", ")} (relative to ${e.href}).`)}function qf(){jf(()=>xf(eb())())}async function tb(e,t){qf();let r=e.createServer(t),n=new Cu;await r.connect(n)}export{Cu as StdioServerTransport,tb as startStdioServer};