@aiquants/html-to-markdown 1.2.0 → 1.3.0
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/core-CHYQAf6b.cjs +1 -0
- package/dist/core-CkCUqS2i.js +3 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/main.cjs +1 -1
- package/dist/main.js +1 -1
- package/dist/mcp-server-BviJ0BJj.js +1 -0
- package/dist/mcp-server-D18WYyj-.cjs +1 -0
- package/dist/mcp-server-streamable-BPxUnvzy.cjs +1 -0
- package/dist/mcp-server-streamable-D4CUcTDr.js +1 -0
- package/dist/mcp-streamable.cjs +1 -1
- package/dist/mcp-streamable.js +1 -1
- package/dist/mcp.cjs +1 -1
- package/dist/mcp.js +1 -1
- package/dist/src/mcp-server.d.ts +9 -3
- package/dist/src/plugins/index.d.ts +1 -1
- package/dist/src/simple-logger.d.ts +97 -0
- package/dist/version-Dbzh6HLt.cjs +7 -0
- package/dist/version-Fr0FqrXS.js +24 -0
- package/package.json +27 -29
- package/dist/core-CTBCnkuY.js +0 -3
- package/dist/core-diGadcw4.cjs +0 -1
- package/dist/mcp-server-DSLDlYZX.cjs +0 -1
- package/dist/mcp-server-DmJXoVRZ.js +0 -1
- package/dist/mcp-server-streamable-CgJP5t9P.js +0 -1
- package/dist/mcp-server-streamable-DZ7VyWAg.cjs +0 -1
- package/dist/version-DAQkOvqo.cjs +0 -7
- package/dist/version-yDYKn_vW.js +0 -7
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
const e=new(require("happy-dom").Window);Object.assign(global,{document:e.document,window:e,self:e});const t=require("./core-diGadcw4.cjs"),r=require("fs"),n=require("path"),o=require("node:fs"),s=require("node:path"),a=require("node:url");var i="undefined"!=typeof document?document.currentScript:null;function c(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:a,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);const o=a.prototype,s=Object.keys(o);for(let e=0;e<s.length;e++){const t=s[e];t in r||(r[t]=o[t].bind(r))}}const o=r?.Parent??Object;class s extends o{}function a(e){var t;const o=r?.Parent?new s:this;n(o,e),(t=o._zod).deferred??(t.deferred=[]);for(const r of o._zod.deferred)r();return o}return Object.defineProperty(s,"name",{value:e}),Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}class u extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class d extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const l={};function f(e){return l}function p(e,t){return"bigint"==typeof t?t.toString():t}function h(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function m(e){return null==e}function v(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const y=Symbol("evaluating");function g(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==y)return void 0===n&&(n=y,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function _(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function w(...e){const t={};for(const r of e){const e=Object.getOwnPropertyDescriptors(r);Object.assign(t,e)}return Object.defineProperties({},t)}function $(e){return JSON.stringify(e)}const b="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function k(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const E=h(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function S(e){if(!1===k(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const r=t.prototype;return!1!==k(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function P(e){return S(e)?{...e}:Array.isArray(e)?[...e]:e}const x=new Set(["string","number","symbol"]);function T(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function I(e,t,r){const n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function z(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}const j={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function N(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(!0!==e.issues[r]?.continue)return!0;return!1}function C(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function O(e){return"string"==typeof e?e:e?.message}function R(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const o=O(e.inst?._zod.def?.error?.(e))??O(t?.error?.(e))??O(r.customError?.(e))??O(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function A(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function q(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}const M=(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,p,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},D=c("$ZodError",M),V=c("$ZodError",M,{Parent:Error});const U=e=>(t,r,n,o)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new u;if(a.issues.length){const t=new(o?.Err??e)(a.issues.map(e=>R(e,s,f())));throw b(t,o?.callee),t}return a.value},F=e=>async(t,r,n,o)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let a=t._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const t=new(o?.Err??e)(a.issues.map(e=>R(e,s,f())));throw b(t,o?.callee),t}return a.value},Z=e=>(t,r,n)=>{const o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new u;return s.issues.length?{success:!1,error:new(e??D)(s.issues.map(e=>R(e,o,f())))}:{success:!0,data:s.value}},L=Z(V),H=e=>async(t,r,n)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(e=>R(e,o,f())))}:{success:!0,data:s.value}},K=H(V),G=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return U(e)(t,r,o)},J=e=>(t,r,n)=>U(e)(t,r,n),B=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return F(e)(t,r,o)},W=e=>async(t,r,n)=>F(e)(t,r,n),Q=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Z(e)(t,r,o)},Y=e=>(t,r,n)=>Z(e)(t,r,n),X=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return H(e)(t,r,o)},ee=e=>async(t,r,n)=>H(e)(t,r,n),te=/^[cC][^\s-]{8,}$/,re=/^[0-9a-z]+$/,ne=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,oe=/^[0-9a-vA-V]{20}$/,se=/^[A-Za-z0-9]{27}$/,ae=/^[a-zA-Z0-9_-]{21}$/,ie=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ce=/^([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})$/,ue=e=>e?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})$`):/^([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)$/,de=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const le=/^(?:(?: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])$/,fe=/^(([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}|:))$/,pe=/^((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])$/,he=/^(([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])$/,me=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ve=/^[A-Za-z0-9_-]*$/,ye=/^\+(?:[0-9]){6,14}[0-9]$/,ge="(?:(?:\\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])))",_e=new RegExp(`^${ge}$`);function we(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const $e=/^-?\d+$/,be=/^-?\d+(?:\.\d+)?/,ke=/^(?:true|false)$/i,Ee=/^null$/i,Se=/^[^A-Z]*$/,Pe=/^[^a-z]*$/,xe=c("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Te={number:"number",bigint:"bigint",object:"date"},Ie=c("$ZodCheckLessThan",(e,t)=>{xe.init(e,t);const r=Te[typeof t.value];e._zod.onattach.push(e=>{const r=e._zod.bag,n=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<n&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ze=c("$ZodCheckGreaterThan",(e,t)=>{xe.init(e,t);const r=Te[typeof t.value];e._zod.onattach.push(e=>{const r=e._zod.bag,n=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>n&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),je=c("$ZodCheckMultipleOf",(e,t)=>{xe.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0===function(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let o=(n.split(".")[1]||"").length;if(0===o&&/\d?e-\d?/.test(n)){const e=n.match(/\d?e-(\d?)/);e?.[1]&&(o=Number.parseInt(e[1]))}const s=r>o?r:o;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}(r.value,t.value))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Ne=c("$ZodCheckNumberFormat",(e,t)=>{xe.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[o,s]=j[t.format];e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,n.minimum=o,n.maximum=s,r&&(n.pattern=$e)}),e._zod.check=a=>{const i=a.value;if(r){if(!Number.isInteger(i))return void a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:i,inst:e});if(!Number.isSafeInteger(i))return void(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,continue:!t.abort}):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,continue:!t.abort}))}i<o&&a.issues.push({origin:"number",input:i,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),i>s&&a.issues.push({origin:"number",input:i,code:"too_big",maximum:s,inst:e})}}),Ce=c("$ZodCheckMaxLength",(e,t)=>{var r;xe.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!m(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const n=r.value;if(n.length<=t.maximum)return;const o=A(n);r.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Oe=c("$ZodCheckMinLength",(e,t)=>{var r;xe.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!m(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const n=r.value;if(n.length>=t.minimum)return;const o=A(n);r.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Re=c("$ZodCheckLengthEquals",(e,t)=>{var r;xe.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!m(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{const n=r.value,o=n.length;if(o===t.length)return;const s=A(n),a=o>t.length;r.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Ae=c("$ZodCheckStringFormat",(e,t)=>{var r,n;xe.init(e,t),e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),qe=c("$ZodCheckRegex",(e,t)=>{Ae.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Me=c("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Se),Ae.init(e,t)}),De=c("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Pe),Ae.init(e,t)}),Ve=c("$ZodCheckIncludes",(e,t)=>{xe.init(e,t);const r=T(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),Ue=c("$ZodCheckStartsWith",(e,t)=>{xe.init(e,t);const r=new RegExp(`^${T(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Fe=c("$ZodCheckEndsWith",(e,t)=>{xe.init(e,t);const r=new RegExp(`.*${T(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),Ze=c("$ZodCheckOverwrite",(e,t)=>{xe.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class Le{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length)),n=t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e);for(const o of n)this.content.push(o)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const He={major:4,minor:1,patch:13},Ke=c("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=He;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const o of n)for(const t of o._zod.onattach)t(e);if(0===n.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,r)=>{let n,o=N(e);for(const s of t){if(s._zod.def.when){if(!s._zod.def.when(e))continue}else if(o)continue;const t=e.issues.length,a=s._zod.check(e);if(a instanceof Promise&&!1===r?.async)throw new u;if(n||a instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await a;e.issues.length!==t&&(o||(o=N(e,t)))});else{if(e.issues.length===t)continue;o||(o=N(e,t))}}return n?n.then(()=>e):e},r=(r,o,s)=>{if(N(r))return r.aborted=!0,r;const a=t(o,n,s);if(a instanceof Promise){if(!1===s.async)throw new u;return a.then(t=>e._zod.parse(t,s))}return e._zod.parse(a,s)};e._zod.run=(o,s)=>{if(s.skipChecks)return e._zod.parse(o,s);if("backward"===s.direction){const t=e._zod.parse({value:o.value,issues:[]},{...s,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,o,s)):r(t,o,s)}const a=e._zod.parse(o,s);if(a instanceof Promise){if(!1===s.async)throw new u;return a.then(e=>t(e,n,s))}return t(a,n,s)}}e["~standard"]={validate:t=>{try{const r=L(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return K(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),Ge=c("$ZodString",(e,t)=>{var r;Ke.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(r=e._zod.bag,new RegExp(`^${r?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Je=c("$ZodStringFormat",(e,t)=>{Ae.init(e,t),Ge.init(e,t)}),Be=c("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ce),Je.init(e,t)}),We=c("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ue(e))}else t.pattern??(t.pattern=ue());Je.init(e,t)}),Qe=c("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=de),Je.init(e,t)}),Ye=c("$ZodURL",(e,t)=>{Je.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),o=new URL(n);return t.hostname&&(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})),t.protocol&&(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})),void(t.normalize?r.value=o.href:r.value=n)}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Xe=c("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Je.init(e,t)}),et=c("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ae),Je.init(e,t)}),tt=c("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=te),Je.init(e,t)}),rt=c("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=re),Je.init(e,t)}),nt=c("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ne),Je.init(e,t)}),ot=c("$ZodXID",(e,t)=>{t.pattern??(t.pattern=oe),Je.init(e,t)}),st=c("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=se),Je.init(e,t)}),at=c("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=we({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${ge}T(?:${n})$`)}(t)),Je.init(e,t)}),it=c("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=_e),Je.init(e,t)}),ct=c("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${we(t)}$`)),Je.init(e,t)}),ut=c("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ie),Je.init(e,t)}),dt=c("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=le),Je.init(e,t),e._zod.bag.format="ipv4"}),lt=c("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=fe),Je.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})}}}),ft=c("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=pe),Je.init(e,t)}),pt=c("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=he),Je.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(2!==n.length)throw new Error;const[e,t]=n;if(!t)throw new Error;const r=Number(t);if(`${r}`!==t)throw new Error;if(r<0||r>128)throw new Error;new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function ht(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const mt=c("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=me),Je.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{ht(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});const vt=c("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ve),Je.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{(function(e){if(!ve.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return ht(t.padEnd(4*Math.ceil(t.length/4),"="))})(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),yt=c("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ye),Je.init(e,t)});const gt=c("$ZodJWT",(e,t)=>{Je.init(e,t),e._zod.check=r=>{(function(e,t=null){try{const r=e.split(".");if(3!==r.length)return!1;const[n]=r;if(!n)return!1;const o=JSON.parse(atob(n));return!("typ"in o&&"JWT"!==o?.typ||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}})(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),_t=c("$ZodNumber",(e,t)=>{Ke.init(e,t),e._zod.pattern=e._zod.bag.pattern??be,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(a){}const o=r.value;if("number"==typeof o&&!Number.isNaN(o)&&Number.isFinite(o))return r;const s="number"==typeof o?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),wt=c("$ZodNumberFormat",(e,t)=>{Ne.init(e,t),_t.init(e,t)}),$t=c("$ZodBoolean",(e,t)=>{Ke.init(e,t),e._zod.pattern=ke,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(s){}const o=r.value;return"boolean"==typeof o||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),bt=c("$ZodNull",(e,t)=>{Ke.init(e,t),e._zod.pattern=Ee,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{const n=t.value;return null===n||t.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),t}}),kt=c("$ZodUnknown",(e,t)=>{Ke.init(e,t),e._zod.parse=e=>e}),Et=c("$ZodNever",(e,t)=>{Ke.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function St(e,t,r){e.issues.length&&t.issues.push(...C(r,e.issues)),t.value[r]=e.value}const Pt=c("$ZodArray",(e,t)=>{Ke.init(e,t),e._zod.parse=(r,n)=>{const 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);const s=[];for(let e=0;e<o.length;e++){const a=o[e],i=t.element._zod.run({value:a,issues:[]},n);i instanceof Promise?s.push(i.then(t=>St(t,r,e))):St(i,r,e)}return s.length?Promise.all(s).then(()=>r):r}});function xt(e,t,r,n){e.issues.length&&t.issues.push(...C(r,e.issues)),void 0===e.value?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Tt(e){const t=Object.keys(e.shape);for(const o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);const r=(n=e.shape,Object.keys(n).filter(e=>"optional"===n[e]._zod.optin&&"optional"===n[e]._zod.optout));var n;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function It(e,t,r,n,o,s){const a=[],i=o.keySet,c=o.catchall._zod,u=c.def.type;for(const d in t){if(i.has(d))continue;if("never"===u){a.push(d);continue}const o=c.run({value:t[d],issues:[]},n);o instanceof Promise?e.push(o.then(e=>xt(e,r,d,t))):xt(o,r,d,t)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}const zt=c("$ZodObject",(e,t)=>{Ke.init(e,t);const r=Object.getOwnPropertyDescriptor(t,"shape");if(!r?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}const n=h(()=>Tt(t));g(e._zod,"propValues",()=>{const e=t.shape,r={};for(const t in e){const n=e[t]._zod;if(n.values){r[t]??(r[t]=new Set);for(const e of n.values)r[t].add(e)}}return r});const o=k,s=t.catchall;let a;e._zod.parse=(t,r)=>{a??(a=n.value);const i=t.value;if(!o(i))return t.issues.push({expected:"object",code:"invalid_type",input:i,inst:e}),t;t.value={};const c=[],u=a.shape;for(const e of a.keys){const n=u[e]._zod.run({value:i[e],issues:[]},r);n instanceof Promise?c.push(n.then(r=>xt(r,t,e,i))):xt(n,t,e,i)}return s?It(c,i,t,r,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),jt=c("$ZodObjectJIT",(e,t)=>{zt.init(e,t);const r=e._zod.parse,n=h(()=>Tt(t));let o;const s=k,a=!l.jitless,i=a&&E.value,c=t.catchall;let u;e._zod.parse=(d,l)=>{u??(u=n.value);const f=d.value;return s(f)?a&&i&&!1===l?.async&&!0!==l.jitless?(o||(o=(e=>{const t=new Le(["shape","payload","ctx"]),r=n.value,o=e=>{const t=$(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const s=Object.create(null);let a=0;for(const n of r.keys)s[n]="key_"+a++;t.write("const newResult = {};");for(const n of r.keys){const e=s[n],r=$(n);t.write(`const ${e} = ${o(n)};`),t.write(`\n if (${e}.issues.length) {\n payload.issues = payload.issues.concat(${e}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${r}, ...iss.path] : [${r}]\n })));\n }\n \n \n if (${e}.value === undefined) {\n if (${r} in input) {\n newResult[${r}] = undefined;\n }\n } else {\n newResult[${r}] = ${e}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const i=t.compile();return(t,r)=>i(e,t,r)})(t.shape)),d=o(d,l),c?It([],f,d,l,u,e):d):r(d,l):(d.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),d)}});function Nt(e,t,r,n){for(const s of e)if(0===s.issues.length)return t.value=s.value,t;const o=e.filter(e=>!N(e));return 1===o.length?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>R(e,n,f())))}),t)}const Ct=c("$ZodUnion",(e,t)=>{Ke.init(e,t),g(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),g(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),g(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),g(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>v(e.source)).join("|")})$`)}});const r=1===t.options.length,n=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(r)return n(o,s);let a=!1;const i=[];for(const e of t.options){const t=e._zod.run({value:o.value,issues:[]},s);if(t instanceof Promise)i.push(t),a=!0;else{if(0===t.issues.length)return t;i.push(t)}}return a?Promise.all(i).then(t=>Nt(t,o,e,s)):Nt(i,o,e,s)}}),Ot=c("$ZodDiscriminatedUnion",(e,t)=>{Ct.init(e,t);const r=e._zod.parse;g(e._zod,"propValues",()=>{const e={};for(const r of t.options){const n=r._zod.propValues;if(!n||0===Object.keys(n).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(const[t,r]of Object.entries(n)){e[t]||(e[t]=new Set);for(const n of r)e[t].add(n)}}return e});const n=h(()=>{const e=t.options,r=new Map;for(const n of e){const e=n._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const t of e){if(r.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,n)}}return r});e._zod.parse=(o,s)=>{const a=o.value;if(!k(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const i=n.value.get(a?.[t.discriminator]);return i?i._zod.run(o,s):t.unionFallback?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),Rt=c("$ZodIntersection",(e,t)=>{Ke.init(e,t),e._zod.parse=(e,r)=>{const n=e.value,o=t.left._zod.run({value:n,issues:[]},r),s=t.right._zod.run({value:n,issues:[]},r);return o instanceof Promise||s instanceof Promise?Promise.all([o,s]).then(([t,r])=>qt(e,t,r)):qt(e,o,s)}});function At(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(S(e)&&S(t)){const r=Object.keys(t),n=Object.keys(e).filter(e=>-1!==r.indexOf(e)),o={...e,...t};for(const s of n){const r=At(e[s],t[s]);if(!r.valid)return{valid:!1,mergeErrorPath:[s,...r.mergeErrorPath]};o[s]=r.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const o=At(e[n],t[n]);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};r.push(o.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function qt(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),N(e))return e;const n=At(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const Mt=c("$ZodRecord",(e,t)=>{Ke.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!S(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;const s=[],a=t.keyType._zod.values;if(a){r.value={};const i=new Set;for(const e of a)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){i.add("number"==typeof e?e.toString():e);const a=t.valueType._zod.run({value:o[e],issues:[]},n);a instanceof Promise?s.push(a.then(t=>{t.issues.length&&r.issues.push(...C(e,t.issues)),r.value[e]=t.value})):(a.issues.length&&r.issues.push(...C(e,a.issues)),r.value[e]=a.value)}let c;for(const e in o)i.has(e)||(c=c??[],c.push(e));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{r.value={};for(const a of Reflect.ownKeys(o)){if("__proto__"===a)continue;const i=t.keyType._zod.run({value:a,issues:[]},n);if(i instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(i.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:i.issues.map(e=>R(e,n,f())),input:a,path:[a],inst:e}),r.value[i.value]=i.value;continue}const c=t.valueType._zod.run({value:o[a],issues:[]},n);c instanceof Promise?s.push(c.then(e=>{e.issues.length&&r.issues.push(...C(a,e.issues)),r.value[i.value]=e.value})):(c.issues.length&&r.issues.push(...C(a,c.issues)),r.value[i.value]=c.value)}}return s.length?Promise.all(s).then(()=>r):r}}),Dt=c("$ZodEnum",(e,t)=>{Ke.init(e,t);const r=function(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(e=>x.has(typeof e)).map(e=>"string"==typeof e?T(e):e.toString()).join("|")})$`),e._zod.parse=(t,o)=>{const s=t.value;return n.has(s)||t.issues.push({code:"invalid_value",values:r,input:s,inst:e}),t}}),Vt=c("$ZodLiteral",(e,t)=>{if(Ke.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");const r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?T(e):e?T(e.toString()):String(e)).join("|")})$`),e._zod.parse=(n,o)=>{const s=n.value;return r.has(s)||n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}}),Ut=c("$ZodTransform",(e,t)=>{Ke.init(e,t),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new d(e.constructor.name);const o=t.transform(r.value,r);if(n.async){return(o instanceof Promise?o:Promise.resolve(o)).then(e=>(r.value=e,r))}if(o instanceof Promise)throw new u;return r.value=o,r}});function Ft(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const Zt=c("$ZodOptional",(e,t)=>{Ke.init(e,t),e._zod.optin="optional",e._zod.optout="optional",g(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),g(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${v(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(t=>Ft(t,e.value)):Ft(n,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),Lt=c("$ZodNullable",(e,t)=>{Ke.init(e,t),g(e._zod,"optin",()=>t.innerType._zod.optin),g(e._zod,"optout",()=>t.innerType._zod.optout),g(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${v(e.source)}|null)$`):void 0}),g(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),Ht=c("$ZodDefault",(e,t)=>{Ke.init(e,t),e._zod.optin="optional",g(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(e=>Kt(e,t)):Kt(n,t)}});function Kt(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Gt=c("$ZodPrefault",(e,t)=>{Ke.init(e,t),e._zod.optin="optional",g(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),Jt=c("$ZodNonOptional",(e,t)=>{Ke.init(e,t),g(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,n)=>{const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(t=>Bt(t,e)):Bt(o,e)}});function Bt(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Wt=c("$ZodCatch",(e,t)=>{Ke.init(e,t),g(e._zod,"optin",()=>t.innerType._zod.optin),g(e._zod,"optout",()=>t.innerType._zod.optout),g(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(n=>(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>R(e,r,f()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>R(e,r,f()))},input:e.value}),e.issues=[]),e)}}),Qt=c("$ZodPipe",(e,t)=>{Ke.init(e,t),g(e._zod,"values",()=>t.in._zod.values),g(e._zod,"optin",()=>t.in._zod.optin),g(e._zod,"optout",()=>t.out._zod.optout),g(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){const n=t.out._zod.run(e,r);return n instanceof Promise?n.then(e=>Yt(e,t.in,r)):Yt(n,t.in,r)}const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>Yt(e,t.out,r)):Yt(n,t.out,r)}});function Yt(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const Xt=c("$ZodReadonly",(e,t)=>{Ke.init(e,t),g(e._zod,"propValues",()=>t.innerType._zod.propValues),g(e._zod,"values",()=>t.innerType._zod.values),g(e._zod,"optin",()=>t.innerType?._zod?.optin),g(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(er):er(n)}});function er(e){return e.value=Object.freeze(e.value),e}const tr=c("$ZodCustom",(e,t)=>{xe.init(e,t),Ke.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{const n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(t=>rr(t,r,n,e));rr(o,r,n,e)}});function rr(e,t,r,n){if(!e){const e={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(e.params=n._zod.def.params),t.issues.push(q(e))}}var nr;class or{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const r=t[0];if(this._map.set(e,r),r&&"object"==typeof r&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const r={...this.get(t)??{}};delete r.id;const 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)}}(nr=globalThis).__zod_globalRegistry??(nr.__zod_globalRegistry=new or);const sr=globalThis.__zod_globalRegistry;function ar(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...z(t)})}function ir(e,t){return new Ie({check:"less_than",...z(t),value:e,inclusive:!1})}function cr(e,t){return new Ie({check:"less_than",...z(t),value:e,inclusive:!0})}function ur(e,t){return new ze({check:"greater_than",...z(t),value:e,inclusive:!1})}function dr(e,t){return new ze({check:"greater_than",...z(t),value:e,inclusive:!0})}function lr(e,t){return new je({check:"multiple_of",...z(t),value:e})}function fr(e,t){return new Ce({check:"max_length",...z(t),maximum:e})}function pr(e,t){return new Oe({check:"min_length",...z(t),minimum:e})}function hr(e,t){return new Re({check:"length_equals",...z(t),length:e})}function mr(e){return new Ze({check:"overwrite",tx:e})}function vr(e){const t=function(e,t){const r=new xe({check:"custom",...z(t)});return r._zod.check=e,r}(r=>(r.addIssue=e=>{if("string"==typeof e)r.issues.push(q(e,r.value,t._zod.def));else{const n=e;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(q(n))}},e(r.value,r)));return t}function yr(e){return!!e._zod}function gr(e,t){if(yr(e)){return L(e,t)}return e.safeParse(t)}function _r(e){var t,r;if(!e)return;let n;if(yr(e)){n=null===(r=null===(t=e._zod)||void 0===t?void 0:t.def)||void 0===r?void 0:r.shape}else{n=e.shape}if(n){if("function"==typeof n)try{return n()}catch(o){return}return n}}const wr=c("ZodISODateTime",(e,t)=>{at.init(e,t),Hr.init(e,t)});function $r(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...z(t)})}(wr,e)}const br=c("ZodISODate",(e,t)=>{it.init(e,t),Hr.init(e,t)});function kr(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...z(t)})}(br,e)}const Er=c("ZodISOTime",(e,t)=>{ct.init(e,t),Hr.init(e,t)});function Sr(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...z(t)})}(Er,e)}const Pr=c("ZodISODuration",(e,t)=>{ut.init(e,t),Hr.init(e,t)});function xr(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...z(t)})}(Pr,e)}const Tr=c("ZodError",(e,t)=>{D.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const r={_errors:[]},n=e=>{for(const o of e.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(e=>n({issues:e}));else if("invalid_key"===o.code)n({issues:o.issues});else if("invalid_element"===o.code)n({issues:o.issues});else if(0===o.path.length)r._errors.push(t(o));else{let e=r,n=0;for(;n<o.path.length;){const r=o.path[n];n===o.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(o))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(e),r}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const r={},n=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,p,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,p,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),Ir=U(Tr),zr=F(Tr),jr=Z(Tr),Nr=H(Tr),Cr=G(Tr),Or=J(Tr),Rr=B(Tr),Ar=W(Tr),qr=Q(Tr),Mr=Y(Tr),Dr=X(Tr),Vr=ee(Tr),Ur=c("ZodType",(e,t)=>(Ke.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(w(t,{checks:[...t.checks??[],...r.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]})),e.clone=(t,r)=>I(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>Ir(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>jr(e,t,r),e.parseAsync=async(t,r)=>zr(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>Nr(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>Cr(e,t,r),e.decode=(t,r)=>Or(e,t,r),e.encodeAsync=async(t,r)=>Rr(e,t,r),e.decodeAsync=async(t,r)=>Ar(e,t,r),e.safeEncode=(t,r)=>qr(e,t,r),e.safeDecode=(t,r)=>Mr(e,t,r),e.safeEncodeAsync=async(t,r)=>Dr(e,t,r),e.safeDecodeAsync=async(t,r)=>Vr(e,t,r),e.refine=(t,r)=>e.check(function(e,t={}){return function(e,t,r){return new e({type:"custom",check:"custom",fn:t,...z(r)})}(eo,e,t)}(t,r)),e.superRefine=t=>e.check(vr(t)),e.overwrite=t=>e.check(mr(t)),e.optional=()=>Ln(e),e.nullable=()=>Kn(e),e.nullish=()=>Ln(Kn(e)),e.nonoptional=t=>function(e,t){return new Bn({type:"nonoptional",innerType:e,...z(t)})}(e,t),e.array=()=>Sn(e),e.or=t=>zn([e,t]),e.and=t=>On(e,t),e.transform=t=>Yn(e,Fn(t)),e.default=t=>{return r=t,new Gn({type:"default",innerType:e,get defaultValue(){return"function"==typeof r?r():P(r)}});var r},e.prefault=t=>{return r=t,new Jn({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof r?r():P(r)}});var r},e.catch=t=>{return new Wn({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r});var r},e.pipe=t=>Yn(e,t),e.readonly=()=>new Xn({type:"readonly",innerType:e}),e.describe=t=>{const r=e.clone();return sr.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>sr.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return sr.get(e);const r=e.clone();return sr.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Fr=c("_ZodString",(e,t)=>{Ge.init(e,t),Ur.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new qe({check:"string_format",format:"regex",...z(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new Ve({check:"string_format",format:"includes",...z(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new Ue({check:"string_format",format:"starts_with",...z(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new Fe({check:"string_format",format:"ends_with",...z(t),suffix:e})}(...t)),e.min=(...t)=>e.check(pr(...t)),e.max=(...t)=>e.check(fr(...t)),e.length=(...t)=>e.check(hr(...t)),e.nonempty=(...t)=>e.check(pr(1,...t)),e.lowercase=t=>e.check(function(e){return new Me({check:"string_format",format:"lowercase",...z(e)})}(t)),e.uppercase=t=>e.check(function(e){return new De({check:"string_format",format:"uppercase",...z(e)})}(t)),e.trim=()=>e.check(mr(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return mr(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(mr(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(mr(e=>e.toUpperCase())),e.slugify=()=>e.check(mr(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}),Zr=c("ZodString",(e,t)=>{Ge.init(e,t),Fr.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...z(t)})}(Kr,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...z(t)})}(Br,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...z(t)})}(ln,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...z(t)})}(Wr,t)),e.guid=t=>e.check(ar(Gr,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...z(t)})}(Jr,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...z(t)})}(Jr,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...z(t)})}(Jr,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...z(t)})}(Jr,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...z(t)})}(Qr,t)),e.guid=t=>e.check(ar(Gr,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...z(t)})}(Yr,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...z(t)})}(Xr,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...z(t)})}(en,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...z(t)})}(cn,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...z(t)})}(un,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...z(t)})}(tn,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...z(t)})}(rn,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...z(t)})}(nn,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...z(t)})}(on,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...z(t)})}(sn,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...z(t)})}(an,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...z(t)})}(dn,t)),e.datetime=t=>e.check($r(t)),e.date=t=>e.check(kr(t)),e.time=t=>e.check(Sr(t)),e.duration=t=>e.check(xr(t))});function Lr(e){return function(e,t){return new e({type:"string",...z(t)})}(Zr,e)}const Hr=c("ZodStringFormat",(e,t)=>{Je.init(e,t),Fr.init(e,t)}),Kr=c("ZodEmail",(e,t)=>{Qe.init(e,t),Hr.init(e,t)}),Gr=c("ZodGUID",(e,t)=>{Be.init(e,t),Hr.init(e,t)}),Jr=c("ZodUUID",(e,t)=>{We.init(e,t),Hr.init(e,t)}),Br=c("ZodURL",(e,t)=>{Ye.init(e,t),Hr.init(e,t)}),Wr=c("ZodEmoji",(e,t)=>{Xe.init(e,t),Hr.init(e,t)}),Qr=c("ZodNanoID",(e,t)=>{et.init(e,t),Hr.init(e,t)}),Yr=c("ZodCUID",(e,t)=>{tt.init(e,t),Hr.init(e,t)}),Xr=c("ZodCUID2",(e,t)=>{rt.init(e,t),Hr.init(e,t)}),en=c("ZodULID",(e,t)=>{nt.init(e,t),Hr.init(e,t)}),tn=c("ZodXID",(e,t)=>{ot.init(e,t),Hr.init(e,t)}),rn=c("ZodKSUID",(e,t)=>{st.init(e,t),Hr.init(e,t)}),nn=c("ZodIPv4",(e,t)=>{dt.init(e,t),Hr.init(e,t)}),on=c("ZodIPv6",(e,t)=>{lt.init(e,t),Hr.init(e,t)}),sn=c("ZodCIDRv4",(e,t)=>{ft.init(e,t),Hr.init(e,t)}),an=c("ZodCIDRv6",(e,t)=>{pt.init(e,t),Hr.init(e,t)}),cn=c("ZodBase64",(e,t)=>{mt.init(e,t),Hr.init(e,t)}),un=c("ZodBase64URL",(e,t)=>{vt.init(e,t),Hr.init(e,t)}),dn=c("ZodE164",(e,t)=>{yt.init(e,t),Hr.init(e,t)}),ln=c("ZodJWT",(e,t)=>{gt.init(e,t),Hr.init(e,t)}),fn=c("ZodNumber",(e,t)=>{_t.init(e,t),Ur.init(e,t),e.gt=(t,r)=>e.check(ur(t,r)),e.gte=(t,r)=>e.check(dr(t,r)),e.min=(t,r)=>e.check(dr(t,r)),e.lt=(t,r)=>e.check(ir(t,r)),e.lte=(t,r)=>e.check(cr(t,r)),e.max=(t,r)=>e.check(cr(t,r)),e.int=t=>e.check(mn(t)),e.safe=t=>e.check(mn(t)),e.positive=t=>e.check(ur(0,t)),e.nonnegative=t=>e.check(dr(0,t)),e.negative=t=>e.check(ir(0,t)),e.nonpositive=t=>e.check(cr(0,t)),e.multipleOf=(t,r)=>e.check(lr(t,r)),e.step=(t,r)=>e.check(lr(t,r)),e.finite=()=>e;const 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??.5),e.isFinite=!0,e.format=r.format??null});function pn(e){return function(e,t){return new e({type:"number",checks:[],...z(t)})}(fn,e)}const hn=c("ZodNumberFormat",(e,t)=>{wt.init(e,t),fn.init(e,t)});function mn(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...z(t)})}(hn,e)}const vn=c("ZodBoolean",(e,t)=>{$t.init(e,t),Ur.init(e,t)});function yn(e){return function(e,t){return new e({type:"boolean",...z(t)})}(vn,e)}const gn=c("ZodNull",(e,t)=>{bt.init(e,t),Ur.init(e,t)});function _n(e){return function(e,t){return new e({type:"null",...z(t)})}(gn,e)}const wn=c("ZodUnknown",(e,t)=>{kt.init(e,t),Ur.init(e,t)});function $n(){return new wn({type:"unknown"})}const bn=c("ZodNever",(e,t)=>{Et.init(e,t),Ur.init(e,t)});function kn(e){return function(e,t){return new e({type:"never",...z(t)})}(bn,e)}const En=c("ZodArray",(e,t)=>{Pt.init(e,t),Ur.init(e,t),e.element=t.element,e.min=(t,r)=>e.check(pr(t,r)),e.nonempty=t=>e.check(pr(1,t)),e.max=(t,r)=>e.check(fr(t,r)),e.length=(t,r)=>e.check(hr(t,r)),e.unwrap=()=>e.element});function Sn(e,t){return function(e,t,r){return new e({type:"array",element:t,...z(r)})}(En,e,t)}const Pn=c("ZodObject",(e,t)=>{jt.init(e,t),Ur.init(e,t),g(e,"shape",()=>t.shape),e.keyof=()=>Mn(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:$n()}),e.loose=()=>e.clone({...e._zod.def,catchall:$n()}),e.strict=()=>e.clone({...e._zod.def,catchall:kn()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!S(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const n=w(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return _(this,"shape",r),r},checks:[]});return I(e,n)}(e,t),e.safeExtend=t=>function(e,t){if(!S(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return _(this,"shape",r),r},checks:e._zod.def.checks};return I(e,r)}(e,t),e.merge=t=>function(e,t){const r=w(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return _(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return I(e,r)}(e,t),e.pick=t=>function(e,t){const r=e._zod.def;return I(e,w(e._zod.def,{get shape(){const e={};for(const n in t){if(!(n in r.shape))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(e[n]=r.shape[n])}return _(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const r=e._zod.def,n=w(e._zod.def,{get shape(){const n={...e._zod.def.shape};for(const e in t){if(!(e in r.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return _(this,"shape",n),n},checks:[]});return I(e,n)}(e,t),e.partial=(...t)=>function(e,t,r){const n=w(t._zod.def,{get shape(){const n=t._zod.def.shape,o={...n};if(r)for(const t in r){if(!(t in n))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(o[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(const t in n)o[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return _(this,"shape",o),o},checks:[]});return I(t,n)}(Zn,e,t[0]),e.required=(...t)=>function(e,t,r){const n=w(t._zod.def,{get shape(){const n=t._zod.def.shape,o={...n};if(r)for(const t in r){if(!(t in o))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(o[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(const t in n)o[t]=new e({type:"nonoptional",innerType:n[t]});return _(this,"shape",o),o},checks:[]});return I(t,n)}(Bn,e,t[0])});function xn(e,t){const r={type:"object",shape:e??{},...z(t)};return new Pn(r)}function Tn(e,t){return new Pn({type:"object",shape:e,catchall:$n(),...z(t)})}const In=c("ZodUnion",(e,t)=>{Ct.init(e,t),Ur.init(e,t),e.options=t.options});function zn(e,t){return new In({type:"union",options:e,...z(t)})}const jn=c("ZodDiscriminatedUnion",(e,t)=>{In.init(e,t),Ot.init(e,t)});function Nn(e,t,r){return new jn({type:"union",options:t,discriminator:e,...z(r)})}const Cn=c("ZodIntersection",(e,t)=>{Rt.init(e,t),Ur.init(e,t)});function On(e,t){return new Cn({type:"intersection",left:e,right:t})}const Rn=c("ZodRecord",(e,t)=>{Mt.init(e,t),Ur.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function An(e,t,r){return new Rn({type:"record",keyType:e,valueType:t,...z(r)})}const qn=c("ZodEnum",(e,t)=>{Dt.init(e,t),Ur.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(e,n)=>{const o={};for(const s of e){if(!r.has(s))throw new Error(`Key ${s} not found in enum`);o[s]=t.entries[s]}return new qn({...t,checks:[],...z(n),entries:o})},e.exclude=(e,n)=>{const o={...t.entries};for(const t of e){if(!r.has(t))throw new Error(`Key ${t} not found in enum`);delete o[t]}return new qn({...t,checks:[],...z(n),entries:o})}});function Mn(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new qn({type:"enum",entries:r,...z(t)})}const Dn=c("ZodLiteral",(e,t)=>{Vt.init(e,t),Ur.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Vn(e,t){return new Dn({type:"literal",values:Array.isArray(e)?e:[e],...z(t)})}const Un=c("ZodTransform",(e,t)=>{Ut.init(e,t),Ur.init(e,t),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new d(e.constructor.name);r.addIssue=n=>{if("string"==typeof n)r.issues.push(q(n,r.value,t));else{const t=n;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=r.value),t.inst??(t.inst=e),r.issues.push(q(t))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(e=>(r.value=e,r)):(r.value=o,r)}});function Fn(e){return new Un({type:"transform",transform:e})}const Zn=c("ZodOptional",(e,t)=>{Zt.init(e,t),Ur.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Ln(e){return new Zn({type:"optional",innerType:e})}const Hn=c("ZodNullable",(e,t)=>{Lt.init(e,t),Ur.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Kn(e){return new Hn({type:"nullable",innerType:e})}const Gn=c("ZodDefault",(e,t)=>{Ht.init(e,t),Ur.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const Jn=c("ZodPrefault",(e,t)=>{Gt.init(e,t),Ur.init(e,t),e.unwrap=()=>e._zod.def.innerType});const Bn=c("ZodNonOptional",(e,t)=>{Jt.init(e,t),Ur.init(e,t),e.unwrap=()=>e._zod.def.innerType});const Wn=c("ZodCatch",(e,t)=>{Wt.init(e,t),Ur.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const Qn=c("ZodPipe",(e,t)=>{Qt.init(e,t),Ur.init(e,t),e.in=t.in,e.out=t.out});function Yn(e,t){return new Qn({type:"pipe",in:e,out:t})}const Xn=c("ZodReadonly",(e,t)=>{Xt.init(e,t),Ur.init(e,t),e.unwrap=()=>e._zod.def.innerType});const eo=c("ZodCustom",(e,t)=>{tr.init(e,t),Ur.init(e,t)});function to(e,t){return Yn(Fn(e),t)}const ro="2025-11-25",no=[ro,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],oo="io.modelcontextprotocol/related-task",so="2.0",ao=function(e,t,r){const n=z(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}(eo,(e=>null!==e&&("object"==typeof e||"function"==typeof e))??(()=>!0),io);var io;const co=zn([Lr(),pn().int()]),uo=Lr(),lo=Tn({ttl:zn([pn(),_n()]).optional(),pollInterval:pn().optional()}),fo=Tn({taskId:Lr()}),po=Tn({progressToken:co.optional(),[oo]:fo.optional()}),ho=Tn({task:lo.optional(),_meta:po.optional()}),mo=xn({method:Lr(),params:ho.optional()}),vo=Tn({_meta:xn({[oo]:Ln(fo)}).passthrough().optional()}),yo=xn({method:Lr(),params:vo.optional()}),go=Tn({_meta:Tn({[oo]:fo.optional()}).optional()}),_o=zn([Lr(),pn().int()]),wo=xn({jsonrpc:Vn(so),id:_o,...mo.shape}).strict(),$o=e=>wo.safeParse(e).success,bo=xn({jsonrpc:Vn(so),...yo.shape}).strict(),ko=xn({jsonrpc:Vn(so),id:_o,result:go}).strict(),Eo=e=>ko.safeParse(e).success;var So,Po;(Po=So||(So={}))[Po.ConnectionClosed=-32e3]="ConnectionClosed",Po[Po.RequestTimeout=-32001]="RequestTimeout",Po[Po.ParseError=-32700]="ParseError",Po[Po.InvalidRequest=-32600]="InvalidRequest",Po[Po.MethodNotFound=-32601]="MethodNotFound",Po[Po.InvalidParams=-32602]="InvalidParams",Po[Po.InternalError=-32603]="InternalError",Po[Po.UrlElicitationRequired=-32042]="UrlElicitationRequired";const xo=xn({jsonrpc:Vn(so),id:_o,error:xn({code:pn().int(),message:Lr(),data:Ln($n())})}).strict(),To=e=>xo.safeParse(e).success,Io=zn([wo,bo,ko,xo]),zo=go.strict(),jo=vo.extend({requestId:_o,reason:Lr().optional()}),No=yo.extend({method:Vn("notifications/cancelled"),params:jo}),Co=xn({src:Lr(),mimeType:Lr().optional(),sizes:Sn(Lr()).optional()}),Oo=xn({icons:Sn(Co).optional()}),Ro=xn({name:Lr(),title:Lr().optional()}),Ao=Ro.extend({...Ro.shape,...Oo.shape,version:Lr(),websiteUrl:Lr().optional()}),qo=On(xn({applyDefaults:yn().optional()}),An(Lr(),$n())),Mo=to(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,On(xn({form:qo.optional(),url:ao.optional()}),An(Lr(),$n()).optional())),Do=xn({list:Ln(xn({}).passthrough()),cancel:Ln(xn({}).passthrough()),requests:Ln(xn({sampling:Ln(xn({createMessage:Ln(xn({}).passthrough())}).passthrough()),elicitation:Ln(xn({create:Ln(xn({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),Vo=xn({list:Ln(xn({}).passthrough()),cancel:Ln(xn({}).passthrough()),requests:Ln(xn({tools:Ln(xn({call:Ln(xn({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),Uo=xn({experimental:An(Lr(),ao).optional(),sampling:xn({context:ao.optional(),tools:ao.optional()}).optional(),elicitation:Mo.optional(),roots:xn({listChanged:yn().optional()}).optional(),tasks:Ln(Do)}),Fo=ho.extend({protocolVersion:Lr(),capabilities:Uo,clientInfo:Ao}),Zo=mo.extend({method:Vn("initialize"),params:Fo}),Lo=xn({experimental:An(Lr(),ao).optional(),logging:ao.optional(),completions:ao.optional(),prompts:Ln(xn({listChanged:Ln(yn())})),resources:xn({subscribe:yn().optional(),listChanged:yn().optional()}).optional(),tools:xn({listChanged:yn().optional()}).optional(),tasks:Ln(Vo)}).passthrough(),Ho=go.extend({protocolVersion:Lr(),capabilities:Lo,serverInfo:Ao,instructions:Lr().optional()}),Ko=yo.extend({method:Vn("notifications/initialized")}),Go=mo.extend({method:Vn("ping")}),Jo=xn({progress:pn(),total:Ln(pn()),message:Ln(Lr())}),Bo=xn({...vo.shape,...Jo.shape,progressToken:co}),Wo=yo.extend({method:Vn("notifications/progress"),params:Bo}),Qo=ho.extend({cursor:uo.optional()}),Yo=mo.extend({params:Qo.optional()}),Xo=go.extend({nextCursor:Ln(uo)}),es=xn({taskId:Lr(),status:Mn(["working","input_required","completed","failed","cancelled"]),ttl:zn([pn(),_n()]),createdAt:Lr(),lastUpdatedAt:Lr(),pollInterval:Ln(pn()),statusMessage:Ln(Lr())}),ts=go.extend({task:es}),rs=vo.merge(es),ns=yo.extend({method:Vn("notifications/tasks/status"),params:rs}),os=mo.extend({method:Vn("tasks/get"),params:ho.extend({taskId:Lr()})}),ss=go.merge(es),as=mo.extend({method:Vn("tasks/result"),params:ho.extend({taskId:Lr()})}),is=Yo.extend({method:Vn("tasks/list")}),cs=Xo.extend({tasks:Sn(es)}),us=mo.extend({method:Vn("tasks/cancel"),params:ho.extend({taskId:Lr()})}),ds=go.merge(es),ls=xn({uri:Lr(),mimeType:Ln(Lr()),_meta:An(Lr(),$n()).optional()}),fs=ls.extend({text:Lr()}),ps=Lr().refine(e=>{try{return atob(e),!0}catch(t){return!1}},{message:"Invalid Base64 string"}),hs=ls.extend({blob:ps}),ms=xn({audience:Sn(Mn(["user","assistant"])).optional(),priority:pn().min(0).max(1).optional(),lastModified:$r({offset:!0}).optional()}),vs=xn({...Ro.shape,...Oo.shape,uri:Lr(),description:Ln(Lr()),mimeType:Ln(Lr()),annotations:ms.optional(),_meta:Ln(Tn({}))}),ys=xn({...Ro.shape,...Oo.shape,uriTemplate:Lr(),description:Ln(Lr()),mimeType:Ln(Lr()),annotations:ms.optional(),_meta:Ln(Tn({}))}),gs=Yo.extend({method:Vn("resources/list")}),_s=Xo.extend({resources:Sn(vs)}),ws=Yo.extend({method:Vn("resources/templates/list")}),$s=Xo.extend({resourceTemplates:Sn(ys)}),bs=ho.extend({uri:Lr()}),ks=bs,Es=mo.extend({method:Vn("resources/read"),params:ks}),Ss=go.extend({contents:Sn(zn([fs,hs]))}),Ps=yo.extend({method:Vn("notifications/resources/list_changed")}),xs=bs,Ts=mo.extend({method:Vn("resources/subscribe"),params:xs}),Is=bs,zs=mo.extend({method:Vn("resources/unsubscribe"),params:Is}),js=vo.extend({uri:Lr()}),Ns=yo.extend({method:Vn("notifications/resources/updated"),params:js}),Cs=xn({name:Lr(),description:Ln(Lr()),required:Ln(yn())}),Os=xn({...Ro.shape,...Oo.shape,description:Ln(Lr()),arguments:Ln(Sn(Cs)),_meta:Ln(Tn({}))}),Rs=Yo.extend({method:Vn("prompts/list")}),As=Xo.extend({prompts:Sn(Os)}),qs=ho.extend({name:Lr(),arguments:An(Lr(),Lr()).optional()}),Ms=mo.extend({method:Vn("prompts/get"),params:qs}),Ds=xn({type:Vn("text"),text:Lr(),annotations:ms.optional(),_meta:An(Lr(),$n()).optional()}),Vs=xn({type:Vn("image"),data:ps,mimeType:Lr(),annotations:ms.optional(),_meta:An(Lr(),$n()).optional()}),Us=xn({type:Vn("audio"),data:ps,mimeType:Lr(),annotations:ms.optional(),_meta:An(Lr(),$n()).optional()}),Fs=xn({type:Vn("tool_use"),name:Lr(),id:Lr(),input:xn({}).passthrough(),_meta:Ln(xn({}).passthrough())}).passthrough(),Zs=xn({type:Vn("resource"),resource:zn([fs,hs]),annotations:ms.optional(),_meta:An(Lr(),$n()).optional()}),Ls=zn([Ds,Vs,Us,vs.extend({type:Vn("resource_link")}),Zs]),Hs=xn({role:Mn(["user","assistant"]),content:Ls}),Ks=go.extend({description:Ln(Lr()),messages:Sn(Hs)}),Gs=yo.extend({method:Vn("notifications/prompts/list_changed")}),Js=xn({title:Lr().optional(),readOnlyHint:yn().optional(),destructiveHint:yn().optional(),idempotentHint:yn().optional(),openWorldHint:yn().optional()}),Bs=xn({taskSupport:Mn(["required","optional","forbidden"]).optional()}),Ws=xn({...Ro.shape,...Oo.shape,description:Lr().optional(),inputSchema:xn({type:Vn("object"),properties:An(Lr(),ao).optional(),required:Sn(Lr()).optional()}).catchall($n()),outputSchema:xn({type:Vn("object"),properties:An(Lr(),ao).optional(),required:Sn(Lr()).optional()}).catchall($n()).optional(),annotations:Ln(Js),execution:Ln(Bs),_meta:An(Lr(),$n()).optional()}),Qs=Yo.extend({method:Vn("tools/list")}),Ys=Xo.extend({tools:Sn(Ws)}),Xs=go.extend({content:Sn(Ls).default([]),structuredContent:An(Lr(),$n()).optional(),isError:Ln(yn())});Xs.or(go.extend({toolResult:$n()}));const ea=ho.extend({name:Lr(),arguments:Ln(An(Lr(),$n()))}),ta=mo.extend({method:Vn("tools/call"),params:ea}),ra=yo.extend({method:Vn("notifications/tools/list_changed")}),na=Mn(["debug","info","notice","warning","error","critical","alert","emergency"]),oa=ho.extend({level:na}),sa=mo.extend({method:Vn("logging/setLevel"),params:oa}),aa=vo.extend({level:na,logger:Lr().optional(),data:$n()}),ia=yo.extend({method:Vn("notifications/message"),params:aa}),ca=xn({name:Lr().optional()}),ua=xn({hints:Ln(Sn(ca)),costPriority:Ln(pn().min(0).max(1)),speedPriority:Ln(pn().min(0).max(1)),intelligencePriority:Ln(pn().min(0).max(1))}),da=xn({mode:Ln(Mn(["auto","required","none"]))}),la=xn({type:Vn("tool_result"),toolUseId:Lr().describe("The unique identifier for the corresponding tool call."),content:Sn(Ls).default([]),structuredContent:xn({}).passthrough().optional(),isError:Ln(yn()),_meta:Ln(xn({}).passthrough())}).passthrough(),fa=Nn("type",[Ds,Vs,Us]),pa=Nn("type",[Ds,Vs,Us,Fs,la]),ha=xn({role:Mn(["user","assistant"]),content:zn([pa,Sn(pa)]),_meta:Ln(xn({}).passthrough())}).passthrough(),ma=ho.extend({messages:Sn(ha),modelPreferences:ua.optional(),systemPrompt:Lr().optional(),includeContext:Mn(["none","thisServer","allServers"]).optional(),temperature:pn().optional(),maxTokens:pn().int(),stopSequences:Sn(Lr()).optional(),metadata:ao.optional(),tools:Ln(Sn(Ws)),toolChoice:Ln(da)}),va=mo.extend({method:Vn("sampling/createMessage"),params:ma}),ya=go.extend({model:Lr(),stopReason:Ln(Mn(["endTurn","stopSequence","maxTokens"]).or(Lr())),role:Mn(["user","assistant"]),content:fa}),ga=go.extend({model:Lr(),stopReason:Ln(Mn(["endTurn","stopSequence","maxTokens","toolUse"]).or(Lr())),role:Mn(["user","assistant"]),content:zn([pa,Sn(pa)])}),_a=xn({type:Vn("boolean"),title:Lr().optional(),description:Lr().optional(),default:yn().optional()}),wa=xn({type:Vn("string"),title:Lr().optional(),description:Lr().optional(),minLength:pn().optional(),maxLength:pn().optional(),format:Mn(["email","uri","date","date-time"]).optional(),default:Lr().optional()}),$a=xn({type:Mn(["number","integer"]),title:Lr().optional(),description:Lr().optional(),minimum:pn().optional(),maximum:pn().optional(),default:pn().optional()}),ba=xn({type:Vn("string"),title:Lr().optional(),description:Lr().optional(),enum:Sn(Lr()),default:Lr().optional()}),ka=xn({type:Vn("string"),title:Lr().optional(),description:Lr().optional(),oneOf:Sn(xn({const:Lr(),title:Lr()})),default:Lr().optional()}),Ea=xn({type:Vn("string"),title:Lr().optional(),description:Lr().optional(),enum:Sn(Lr()),enumNames:Sn(Lr()).optional(),default:Lr().optional()}),Sa=zn([ba,ka]),Pa=zn([xn({type:Vn("array"),title:Lr().optional(),description:Lr().optional(),minItems:pn().optional(),maxItems:pn().optional(),items:xn({type:Vn("string"),enum:Sn(Lr())}),default:Sn(Lr()).optional()}),xn({type:Vn("array"),title:Lr().optional(),description:Lr().optional(),minItems:pn().optional(),maxItems:pn().optional(),items:xn({anyOf:Sn(xn({const:Lr(),title:Lr()}))}),default:Sn(Lr()).optional()})]),xa=zn([Ea,Sa,Pa]),Ta=zn([xa,_a,wa,$a]),Ia=zn([ho.extend({mode:Vn("form").optional(),message:Lr(),requestedSchema:xn({type:Vn("object"),properties:An(Lr(),Ta),required:Sn(Lr()).optional()})}),ho.extend({mode:Vn("url"),message:Lr(),elicitationId:Lr(),url:Lr().url()})]),za=mo.extend({method:Vn("elicitation/create"),params:Ia}),ja=vo.extend({elicitationId:Lr()}),Na=yo.extend({method:Vn("notifications/elicitation/complete"),params:ja}),Ca=go.extend({action:Mn(["accept","decline","cancel"]),content:to(e=>null===e?void 0:e,An(Lr(),zn([Lr(),pn(),yn(),Sn(Lr())])).optional())}),Oa=xn({type:Vn("ref/resource"),uri:Lr()}),Ra=xn({type:Vn("ref/prompt"),name:Lr()}),Aa=ho.extend({ref:zn([Ra,Oa]),argument:xn({name:Lr(),value:Lr()}),context:xn({arguments:An(Lr(),Lr()).optional()}).optional()}),qa=mo.extend({method:Vn("completion/complete"),params:Aa}),Ma=go.extend({completion:Tn({values:Sn(Lr()).max(100),total:Ln(pn().int()),hasMore:Ln(yn())})}),Da=xn({uri:Lr().startsWith("file://"),name:Lr().optional(),_meta:An(Lr(),$n()).optional()}),Va=mo.extend({method:Vn("roots/list")}),Ua=go.extend({roots:Sn(Da)}),Fa=yo.extend({method:Vn("notifications/roots/list_changed")});zn([Go,Zo,qa,sa,Ms,Rs,gs,ws,Es,Ts,zs,ta,Qs,os,as,is]),zn([No,Wo,Ko,Fa,ns]),zn([zo,ya,ga,Ca,Ua,ss,cs,ts]),zn([Go,va,za,Va,os,as,is]),zn([No,Wo,ia,Ns,Ps,ra,Gs,ns,Na]),zn([zo,Ho,Ma,Ks,As,_s,$s,Ss,Xs,Ys,ss,cs,ts]);class Za extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`),this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===So.UrlElicitationRequired&&r){const e=r;if(e.elicitations)return new La(e.elicitations,t)}return new Za(e,t,r)}}class La extends Za{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(So.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){var e,t;return null!==(t=null===(e=this.data)||void 0===e?void 0:e.elicitations)&&void 0!==t?t:[]}}function Ha(e){return"completed"===e||"failed"===e||"cancelled"===e}function Ka(e){const t=_r(e),r=null==t?void 0:t.method;if(!r)throw new Error("Schema is missing a method literal");const n=function(e){var t;if(yr(e)){const r=null===(t=e._zod)||void 0===t?void 0:t.def;if(r){if(void 0!==r.value)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}}const r=e._def;if(r){if(void 0!==r.value)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}const n=e.value;if(void 0!==n)return n}(r);if("string"!=typeof n)throw new Error("Schema method literal must be a string");return n}function Ga(e,t){const r=gr(e,t);if(!r.success)throw r.error;return r.data}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");class Ja{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(No,e=>{this._oncancel(e)}),this.setNotificationHandler(Wo,e=>{this._onprogress(e)}),this.setRequestHandler(Go,e=>({})),this._taskStore=null==e?void 0:e.taskStore,this._taskMessageQueue=null==e?void 0:e.taskMessageQueue,this._taskStore&&(this.setRequestHandler(os,async(e,t)=>{const r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new Za(So.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(as,async(e,t)=>{const r=async()=>{var n;const o=e.params.taskId;if(this._taskMessageQueue){let e;for(;e=await this._taskMessageQueue.dequeue(o,t.sessionId);){if("response"===e.type||"error"===e.type){const t=e.message,r=t.id,n=this._requestResolvers.get(r);if(n)if(this._requestResolvers.delete(r),"response"===e.type)n(t);else{const e=t;n(new Za(e.error.code,e.error.message,e.error.data))}else{const t="response"===e.type?"Response":"Error";this._onerror(new Error(`${t} handler missing for request ${r}`))}continue}await(null===(n=this._transport)||void 0===n?void 0:n.send(e.message,{relatedRequestId:t.requestId}))}}const s=await this._taskStore.getTask(o,t.sessionId);if(!s)throw new Za(So.InvalidParams,`Task not found: ${o}`);if(!Ha(s.status))return await this._waitForTaskUpdate(o,t.signal),await r();if(Ha(s.status)){const e=await this._taskStore.getTaskResult(o,t.sessionId);return this._clearTaskQueue(o),{...e,_meta:{...e._meta,[oo]:{taskId:o}}}}return await r()};return await r()}),this.setRequestHandler(is,async(e,t)=>{var r;try{const{tasks:n,nextCursor:o}=await this._taskStore.listTasks(null===(r=e.params)||void 0===r?void 0:r.cursor,t.sessionId);return{tasks:n,nextCursor:o,_meta:{}}}catch(n){throw new Za(So.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(us,async(e,t)=>{try{const r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new Za(So.InvalidParams,`Task not found: ${e.params.taskId}`);if(Ha(r.status))throw new Za(So.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(e.params.taskId,"cancelled","Client cancelled task execution.",t.sessionId),this._clearTaskQueue(e.params.taskId);const n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new Za(So.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...n}}catch(r){if(r instanceof Za)throw r;throw new Za(So.InvalidRequest,`Failed to cancel task: ${r instanceof Error?r.message:String(r)}`)}}))}async _oncancel(e){const t=this._requestHandlerAbortControllers.get(e.params.requestId);null==t||t.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){const t=this._timeoutInfo.get(e);if(!t)return!1;const r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),Za.fromError(So.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){const t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var t,r,n;this._transport=e;const o=null===(t=this.transport)||void 0===t?void 0:t.onclose;this._transport.onclose=()=>{null==o||o(),this._onclose()};const s=null===(r=this.transport)||void 0===r?void 0:r.onerror;this._transport.onerror=e=>{null==s||s(e),this._onerror(e)};const a=null===(n=this._transport)||void 0===n?void 0:n.onmessage;this._transport.onmessage=(e,t)=>{var r;null==a||a(e,t),Eo(e)||To(e)?this._onresponse(e):$o(e)?this._onrequest(e,t):(r=e,bo.safeParse(r).success?this._onnotification(e):this._onerror(new Error(`Unknown message type: ${JSON.stringify(e)}`)))},await this._transport.start()}_onclose(){var e;const t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();const r=Za.fromError(So.ConnectionClosed,"Connection closed");this._transport=void 0,null===(e=this.onclose)||void 0===e||e.call(this);for(const n of t.values())n(r)}_onerror(e){var t;null===(t=this.onerror)||void 0===t||t.call(this,e)}_onnotification(e){var t;const r=null!==(t=this._notificationHandlers.get(e.method))&&void 0!==t?t:this.fallbackNotificationHandler;void 0!==r&&Promise.resolve().then(()=>r(e)).catch(e=>this._onerror(new Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){var r,n,o,s,a,i;const c=null!==(r=this._requestHandlers.get(e.method))&&void 0!==r?r:this.fallbackRequestHandler,u=this._transport,d=null===(s=null===(o=null===(n=e.params)||void 0===n?void 0:n._meta)||void 0===o?void 0:o[oo])||void 0===s?void 0:s.taskId;if(void 0===c){const t={jsonrpc:"2.0",id:e.id,error:{code:So.MethodNotFound,message:"Method not found"}};return void(d&&this._taskMessageQueue?this._enqueueTaskMessage(d,{type:"error",message:t,timestamp:Date.now()},null==u?void 0:u.sessionId).catch(e=>this._onerror(new Error(`Failed to enqueue error response: ${e}`))):null==u||u.send(t).catch(e=>this._onerror(new Error(`Failed to send an error response: ${e}`))))}const l=new AbortController;this._requestHandlerAbortControllers.set(e.id,l);const f=null===(a=e.params)||void 0===a?void 0:a.task,p=this._taskStore?this.requestTaskStore(e,null==u?void 0:u.sessionId):void 0,h={signal:l.signal,sessionId:null==u?void 0:u.sessionId,_meta:null===(i=e.params)||void 0===i?void 0:i._meta,sendNotification:async t=>{const r={relatedRequestId:e.id};d&&(r.relatedTask={taskId:d}),await this.notification(t,r)},sendRequest:async(t,r,n)=>{var o,s;const a={...n,relatedRequestId:e.id};d&&!a.relatedTask&&(a.relatedTask={taskId:d});const i=null!==(s=null===(o=a.relatedTask)||void 0===o?void 0:o.taskId)&&void 0!==s?s:d;return i&&p&&await p.updateTaskStatus(i,"input_required"),await this.request(t,r,a)},authInfo:null==t?void 0:t.authInfo,requestId:e.id,requestInfo:null==t?void 0:t.requestInfo,taskId:d,taskStore:p,taskRequestedTtl:null==f?void 0:f.ttl,closeSSEStream:null==t?void 0:t.closeSSEStream,closeStandaloneSSEStream:null==t?void 0:t.closeStandaloneSSEStream};Promise.resolve().then(()=>{f&&this.assertTaskHandlerCapability(e.method)}).then(()=>c(e,h)).then(async t=>{if(l.signal.aborted)return;const r={result:t,jsonrpc:"2.0",id:e.id};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"response",message:r,timestamp:Date.now()},null==u?void 0:u.sessionId):await(null==u?void 0:u.send(r))},async t=>{var r;if(l.signal.aborted)return;const n={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:So.InternalError,message:null!==(r=t.message)&&void 0!==r?r:"Internal error",...void 0!==t.data&&{data:t.data}}};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"error",message:n,timestamp:Date.now()},null==u?void 0:u.sessionId):await(null==u?void 0:u.send(n))}).catch(e=>this._onerror(new Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:t,...r}=e.params,n=Number(t),o=this._progressHandlers.get(n);if(!o)return void this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));const s=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(i){return this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),void s(i)}o(r)}_onresponse(e){const t=Number(e.id),r=this._requestResolvers.get(t);if(r){if(this._requestResolvers.delete(t),Eo(e))r(e);else{r(new Za(e.error.code,e.error.message,e.error.data))}return}const n=this._responseHandlers.get(t);if(void 0===n)return void this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));this._responseHandlers.delete(t),this._cleanupTimeout(t);let o=!1;if(Eo(e)&&e.result&&"object"==typeof e.result){const r=e.result;if(r.task&&"object"==typeof r.task){const e=r.task;"string"==typeof e.taskId&&(o=!0,this._taskProgressTokens.set(e.taskId,t))}}if(o||this._progressHandlers.delete(t),Eo(e))n(e);else{n(Za.fromError(e.error.code,e.error.message,e.error.data))}}get transport(){return this._transport}async close(){var e;await(null===(e=this._transport)||void 0===e?void 0:e.close())}async*requestStream(e,t,r){var n,o,s,a;const{task:i}=null!=r?r:{};if(!i){try{const n=await this.request(e,t,r);yield{type:"result",result:n}}catch(u){yield{type:"error",error:u instanceof Za?u:new Za(So.InternalError,String(u))}}return}let c;try{const i=await this.request(e,ts,r);if(!i.task)throw new Za(So.InternalError,"Task creation did not return a task");for(c=i.task.taskId,yield{type:"taskCreated",task:i.task};;){const e=await this.getTask({taskId:c},r);if(yield{type:"taskStatus",task:e},Ha(e.status)){if("completed"===e.status){const e=await this.getTaskResult({taskId:c},t,r);yield{type:"result",result:e}}else"failed"===e.status?yield{type:"error",error:new Za(So.InternalError,`Task ${c} failed`)}:"cancelled"===e.status&&(yield{type:"error",error:new Za(So.InternalError,`Task ${c} was cancelled`)});return}if("input_required"===e.status){const e=await this.getTaskResult({taskId:c},t,r);return void(yield{type:"result",result:e})}const i=null!==(s=null!==(n=e.pollInterval)&&void 0!==n?n:null===(o=this._options)||void 0===o?void 0:o.defaultTaskPollInterval)&&void 0!==s?s:1e3;await new Promise(e=>setTimeout(e,i)),null===(a=null==r?void 0:r.signal)||void 0===a||a.throwIfAborted()}}catch(u){yield{type:"error",error:u instanceof Za?u:new Za(So.InternalError,String(u))}}}request(e,t,r){const{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s,task:a,relatedTask:i}=null!=r?r:{};return new Promise((c,u)=>{var d,l,f,p,h,m,v;const y=e=>{u(e)};if(!this._transport)return void y(new Error("Not connected"));if(!0===(null===(d=this._options)||void 0===d?void 0:d.enforceStrictCapabilities))try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(k){return void y(k)}null===(l=null==r?void 0:r.signal)||void 0===l||l.throwIfAborted();const g=this._requestMessageId++,_={...e,jsonrpc:"2.0",id:g};(null==r?void 0:r.onprogress)&&(this._progressHandlers.set(g,r.onprogress),_.params={...e.params,_meta:{...(null===(f=e.params)||void 0===f?void 0:f._meta)||{},progressToken:g}}),a&&(_.params={..._.params,task:a}),i&&(_.params={..._.params,_meta:{...(null===(p=_.params)||void 0===p?void 0:p._meta)||{},[oo]:i}});const w=e=>{var t;this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),null===(t=this._transport)||void 0===t||t.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(e)}},{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch(e=>this._onerror(new Error(`Failed to send cancellation: ${e}`)));const r=e instanceof Za?e:new Za(So.RequestTimeout,String(e));u(r)};this._responseHandlers.set(g,e=>{var n;if(!(null===(n=null==r?void 0:r.signal)||void 0===n?void 0:n.aborted)){if(e instanceof Error)return u(e);try{const r=gr(t,e.result);r.success?c(r.data):u(r.error)}catch(o){u(o)}}}),null===(h=null==r?void 0:r.signal)||void 0===h||h.addEventListener("abort",()=>{var e;w(null===(e=null==r?void 0:r.signal)||void 0===e?void 0:e.reason)});const $=null!==(m=null==r?void 0:r.timeout)&&void 0!==m?m:6e4;this._setupTimeout(g,$,null==r?void 0:r.maxTotalTimeout,()=>w(Za.fromError(So.RequestTimeout,"Request timed out",{timeout:$})),null!==(v=null==r?void 0:r.resetTimeoutOnProgress)&&void 0!==v&&v);const b=null==i?void 0:i.taskId;if(b){const e=e=>{const t=this._responseHandlers.get(g);t?t(e):this._onerror(new Error(`Response handler missing for side-channeled request ${g}`))};this._requestResolvers.set(g,e),this._enqueueTaskMessage(b,{type:"request",message:_,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(g),u(e)})}else this._transport.send(_,{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch(e=>{this._cleanupTimeout(g),u(e)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},ss,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},cs,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},ds,t)}async notification(e,t){var r,n,o,s,a;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const i=null===(r=null==t?void 0:t.relatedTask)||void 0===r?void 0:r.taskId;if(i){const r={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...(null===(n=e.params)||void 0===n?void 0:n._meta)||{},[oo]:t.relatedTask}}};return void(await this._enqueueTaskMessage(i,{type:"notification",message:r,timestamp:Date.now()}))}if((null!==(s=null===(o=this._options)||void 0===o?void 0:o.debouncedNotificationMethods)&&void 0!==s?s:[]).includes(e.method)&&!e.params&&!(null==t?void 0:t.relatedRequestId)&&!(null==t?void 0:t.relatedTask)){if(this._pendingDebouncedNotifications.has(e.method))return;return this._pendingDebouncedNotifications.add(e.method),void Promise.resolve().then(()=>{var r,n;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let o={...e,jsonrpc:"2.0"};(null==t?void 0:t.relatedTask)&&(o={...o,params:{...o.params,_meta:{...(null===(r=o.params)||void 0===r?void 0:r._meta)||{},[oo]:t.relatedTask}}}),null===(n=this._transport)||void 0===n||n.send(o,t).catch(e=>this._onerror(e))})}let c={...e,jsonrpc:"2.0"};(null==t?void 0:t.relatedTask)&&(c={...c,params:{...c.params,_meta:{...(null===(a=c.params)||void 0===a?void 0:a._meta)||{},[oo]:t.relatedTask}}}),await this._transport.send(c,t)}setRequestHandler(e,t){const r=Ka(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(r,n)=>{const o=Ga(e,r);return Promise.resolve(t(o,n))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){const r=Ka(e);this._notificationHandlers.set(r,r=>{const n=Ga(e,r);return Promise.resolve(t(n))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){const t=this._taskProgressTokens.get(e);void 0!==t&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,r){var n;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const o=null===(n=this._options)||void 0===n?void 0:n.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,o)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){const r=await this._taskMessageQueue.dequeueAll(e,t);for(const t of r)if("request"===t.type&&$o(t.message)){const r=t.message.id,n=this._requestResolvers.get(r);n?(n(new Za(So.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(r)):this._onerror(new Error(`Resolver missing for request ${r} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){var r,n,o;let s=null!==(n=null===(r=this._options)||void 0===r?void 0:r.defaultTaskPollInterval)&&void 0!==n?n:1e3;try{const t=await(null===(o=this._taskStore)||void 0===o?void 0:o.getTask(e));(null==t?void 0:t.pollInterval)&&(s=t.pollInterval)}catch(a){}return new Promise((e,r)=>{if(t.aborted)return void r(new Za(So.InvalidRequest,"Request cancelled"));const n=setTimeout(e,s);t.addEventListener("abort",()=>{clearTimeout(n),r(new Za(So.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){const r=this._taskStore;if(!r)throw new Error("No task store configured");return{createTask:async n=>{if(!e)throw new Error("No request provided");return await r.createTask(n,e.id,{method:e.method,params:e.params},t)},getTask:async e=>{const n=await r.getTask(e,t);if(!n)throw new Za(So.InvalidParams,"Failed to retrieve task: Task not found");return n},storeTaskResult:async(e,n,o)=>{await r.storeTaskResult(e,n,o,t);const s=await r.getTask(e,t);if(s){const t=ns.parse({method:"notifications/tasks/status",params:s});await this.notification(t),Ha(s.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>r.getTaskResult(e,t),updateTaskStatus:async(e,n,o)=>{const s=await r.getTask(e,t);if(!s)throw new Za(So.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(Ha(s.status))throw new Za(So.InvalidParams,`Cannot update task "${e}" from terminal status "${s.status}" to "${n}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(e,n,o,t);const a=await r.getTask(e,t);if(a){const t=ns.parse({method:"notifications/tasks/status",params:a});await this.notification(t),Ha(a.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>r.listTasks(e,t)}}}function Ba(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}var Wa,Qa={exports:{}},Ya={},Xa={},ei={},ti={},ri={},ni={};function oi(){return Wa||(Wa=1,function(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;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce((e,t)=>(t instanceof r&&(e[t.str]=(e[t.str]||0)+1),e),{})}}function o(e,...t){const r=[e[0]];let o=0;for(;o<t.length;)i(r,t[o]),r.push(e[++o]);return new n(r)}e._Code=n,e.nil=new n(""),e._=o;const s=new n("+");function a(e,...t){const r=[u(e[0])];let o=0;for(;o<t.length;)r.push(s),i(r,t[o]),r.push(s,u(e[++o]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===s){const r=c(e[t-1],e[t+1]);if(void 0!==r){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}(r),new n(r)}function i(e,t){var o;t instanceof n?e.push(...t._items):t instanceof r?e.push(t):e.push("number"==typeof(o=t)||"boolean"==typeof o||null===o?o:u(Array.isArray(o)?o.join(","):o))}function c(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof r||'"'!==e[e.length-1])return;return"string"!=typeof t?`${e.slice(0,-1)}${t}"`:'"'===t[0]?e.slice(0,-1)+t.slice(1):void 0}return"string"!=typeof t||'"'!==t[0]||e instanceof r?void 0:`"${e}${t.slice(1)}`}function u(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=a,e.addCodeArg=i,e.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:a`${e}${t}`},e.stringify=function(e){return new n(u(e))},e.safeStringify=u,e.getProperty=function(t){return"string"==typeof t&&e.IDENTIFIER.test(t)?new n(`.${t}`):o`[${t}]`},e.getEsmExportName=function(t){if("string"==typeof t&&e.IDENTIFIER.test(t))return new n(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},e.regexpCode=function(e){return new n(e.toString())}}(ni)),ni}var si,ai,ii={};function ci(){return si||(si=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=oi();class r extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var n,o;(o=n||(e.UsedValueState=n={}))[o.Started=0]="Started",o[o.Completed=1]="Completed",e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class s{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,r;if((null===(r=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===r?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}e.Scope=s;class a extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=t._`.${new t.Name(r)}[${n}]`}}e.ValueScopeName=a;const i=t._`\n`;e.ValueScope=class extends s{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?i:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const n=this.toName(e),{prefix:o}=n,s=null!==(r=t.key)&&void 0!==r?r:t.ref;let a=this._values[o];if(a){const e=a.get(s);if(e)return e}else a=this._values[o]=new Map;a.set(s,n);const i=this._scope[o]||(this._scope[o]=[]),c=i.length;return i[c]=t.ref,n.setValue(t,{property:o,itemIndex:c}),n}getValue(e,t){const r=this._values[e];if(r)return r.get(t)}scopeRefs(e,r=this._values){return this._reduceValues(r,r=>{if(void 0===r.scopePath)throw new Error(`CodeGen: name "${r}" has no value`);return t._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(o,s,a={},i){let c=t.nil;for(const u in o){const d=o[u];if(!d)continue;const l=a[u]=a[u]||new Map;d.forEach(o=>{if(l.has(o))return;l.set(o,n.Started);let a=s(o);if(a){const r=this.opts.es5?e.varKinds.var:e.varKinds.const;c=t._`${c}${r} ${o} = ${a};${this.opts._n}`}else{if(!(a=null==i?void 0:i(o)))throw new r(o);c=t._`${c}${a}${this.opts._n}`}l.set(o,n.Completed)})}return c}}}(ii)),ii}function ui(){return ai||(ai=1,function(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;const t=oi(),r=ci();var n=oi();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=ci();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("+")};class s{optimizeNodes(){return this}optimizeNames(e,t){return this}}class a extends s{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){const n=e?r.varKinds.var:this.varKind,o=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=I(this.rhs,e,t)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class i extends s{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof t.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=I(this.rhs,e,r),this}get names(){return T(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}}class c extends i{constructor(e,t,r,n){super(e,r,n),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class u extends s{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class d extends s{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class l extends s{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class f extends s{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=I(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class p extends s{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:r}=this;let n=r.length;for(;n--;){const o=r[n];o.optimizeNames(e,t)||(z(e,o.names),r.splice(n,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>x(e,t.names),{})}}class h extends p{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class m extends p{}class v extends h{}v.kind="else";class y extends h{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new v(e):e}return t?!1===e?t instanceof y?t:t.nodes:this.nodes.length?this:new y(j(e),t instanceof y?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=I(this.condition,e,t),this}get names(){const e=super.names;return T(e,this.condition),this.else&&x(e,this.else.names),e}}y.kind="if";class g extends h{}g.kind="for";class _ extends g{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=I(this.iteration,e,t),this}get names(){return x(super.names,this.iteration.names)}}class w extends g{constructor(e,t,r,n){super(),this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){const t=e.es5?r.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${t} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){const e=T(super.names,this.from);return T(e,this.to)}}class $ extends g{constructor(e,t,r,n){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=I(this.iterable,e,t),this}get names(){return x(super.names,this.iterable.names)}}class b extends h{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}b.kind="func";class k extends p{render(e){return"return "+super.render(e)}}k.kind="return";class E extends h{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var r,n;return super.optimizeNames(e,t),null===(r=this.catch)||void 0===r||r.optimizeNames(e,t),null===(n=this.finally)||void 0===n||n.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&x(e,this.catch.names),this.finally&&x(e,this.finally.names),e}}class S extends h{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}S.kind="catch";class P extends h{render(e){return"finally"+super.render(e)}}P.kind="finally";function x(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function T(e,r){return r instanceof t._CodeOrName?x(e,r.names):e}function I(e,r,n){return e instanceof t.Name?s(e):(o=e)instanceof t._Code&&o._items.some(e=>e instanceof t.Name&&1===r[e.str]&&void 0!==n[e.str])?new t._Code(e._items.reduce((e,r)=>(r instanceof t.Name&&(r=s(r)),r instanceof t._Code?e.push(...r._items):e.push(r),e),[])):e;var o;function s(e){const t=n[e.str];return void 0===t||1!==r[e.str]?e:(delete r[e.str],t)}}function z(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function j(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:t._`!${R(e)}`}e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new m]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){const o=this._scope.toName(t);return void 0!==r&&n&&(this._constants[o.str]=r),this._leafNode(new a(e,o,r)),o}const(e,t,n){return this._def(r.varKinds.const,e,t,n)}let(e,t,n){return this._def(r.varKinds.let,e,t,n)}var(e,t,n){return this._def(r.varKinds.var,e,t,n)}assign(e,t,r){return this._leafNode(new i(e,t,r))}add(t,r){return this._leafNode(new c(t,e.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==t.nil&&this._leafNode(new f(e)),this}object(...e){const r=["{"];for(const[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,t.addCodeArg)(r,o));return r.push("}"),new t._Code(r)}if(e,t,r){if(this._blockNode(new y(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new y(e))}else(){return this._elseNode(new v)}endIf(){return this._endBlockNode(y,v)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new _(e),t)}forRange(e,t,n,o,s=(this.opts.es5?r.varKinds.var:r.varKinds.let)){const a=this._scope.toName(e);return this._for(new w(s,a,t,n),()=>o(a))}forOf(e,n,o,s=r.varKinds.const){const a=this._scope.toName(e);if(this.opts.es5){const e=n instanceof t.Name?n:this.var("_arr",n);return this.forRange("_i",0,t._`${e}.length`,r=>{this.var(a,t._`${e}[${r}]`),o(a)})}return this._for(new $("of",s,a,n),()=>o(a))}forIn(e,n,o,s=(this.opts.es5?r.varKinds.var:r.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,t._`Object.keys(${n})`,o);const a=this._scope.toName(e);return this._for(new $("in",s,a,n),()=>o(a))}endFor(){return this._endBlockNode(g)}label(e){return this._leafNode(new u(e))}break(e){return this._leafNode(new d(e))}return(e){const t=new k;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(k)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const n=new E;if(this._blockNode(n),this.code(e),t){const e=this.name("e");this._currNode=n.catch=new S(e),t(e)}return r&&(this._currNode=n.finally=new P,this.code(r)),this._endBlockNode(S,P)}throw(e){return this._leafNode(new l(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,r=t.nil,n,o){return this._blockNode(new b(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(b)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof y))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}},e.not=j;const N=O(e.operators.AND);e.and=function(...e){return e.reduce(N)};const C=O(e.operators.OR);function O(e){return(r,n)=>r===t.nil?n:n===t.nil?r:t._`${R(r)} ${e} ${R(n)}`}function R(e){return e instanceof t.Name?e:t._`(${e})`}e.or=function(...e){return e.reduce(C)}}(ri)),ri}var di,li={};function fi(){if(di)return li;di=1,Object.defineProperty(li,"__esModule",{value:!0}),li.checkStrictMode=li.getErrorPath=li.Type=li.useFunc=li.setEvaluated=li.evaluatedPropsToName=li.mergeEvaluated=li.eachItem=li.unescapeJsonPointer=li.escapeJsonPointer=li.escapeFragment=li.unescapeFragment=li.schemaRefOrVal=li.schemaHasRulesButRef=li.schemaHasRules=li.checkUnknownRules=li.alwaysValidSchema=li.toHash=void 0;const e=ui(),t=oi();function r(e,t=e.schema){const{opts:r,self:n}=e;if(!r.strictSchema)return;if("boolean"==typeof t)return;const o=n.RULES.keywords;for(const s in t)o[s]||f(e,`unknown keyword: "${s}"`)}function n(e,t){if("boolean"==typeof e)return!e;for(const r in e)if(t[r])return!0;return!1}function o(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function s(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function a({mergeNames:t,mergeToName:r,mergeValues:n,resultToName:o}){return(s,a,i,c)=>{const u=void 0===i?a:i instanceof e.Name?(a instanceof e.Name?t(s,a,i):r(s,a,i),i):a instanceof e.Name?(r(s,i,a),a):n(a,i);return c!==e.Name||u instanceof e.Name?u:o(s,u)}}function i(t,r){if(!0===r)return t.var("props",!0);const n=t.var("props",e._`{}`);return void 0!==r&&c(t,n,r),n}function c(t,r,n){Object.keys(n).forEach(n=>t.assign(e._`${r}${(0,e.getProperty)(n)}`,!0))}li.toHash=function(e){const t={};for(const r of e)t[r]=!0;return t},li.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(r(e,t),!n(t,e.self.RULES.all))},li.checkUnknownRules=r,li.schemaHasRules=n,li.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const r in e)if("$ref"!==r&&t.all[r])return!0;return!1},li.schemaRefOrVal=function({topSchemaRef:t,schemaPath:r},n,o,s){if(!s){if("number"==typeof n||"boolean"==typeof n)return n;if("string"==typeof n)return e._`${n}`}return e._`${t}${r}${(0,e.getProperty)(o)}`},li.unescapeFragment=function(e){return s(decodeURIComponent(e))},li.escapeFragment=function(e){return encodeURIComponent(o(e))},li.escapeJsonPointer=o,li.unescapeJsonPointer=s,li.eachItem=function(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)},li.mergeEvaluated={props:a({mergeNames:(t,r,n)=>t.if(e._`${n} !== true && ${r} !== undefined`,()=>{t.if(e._`${r} === true`,()=>t.assign(n,!0),()=>t.assign(n,e._`${n} || {}`).code(e._`Object.assign(${n}, ${r})`))}),mergeToName:(t,r,n)=>t.if(e._`${n} !== true`,()=>{!0===r?t.assign(n,!0):(t.assign(n,e._`${n} || {}`),c(t,n,r))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:i}),items:a({mergeNames:(t,r,n)=>t.if(e._`${n} !== true && ${r} !== undefined`,()=>t.assign(n,e._`${r} === true ? true : ${n} > ${r} ? ${n} : ${r}`)),mergeToName:(t,r,n)=>t.if(e._`${n} !== true`,()=>t.assign(n,!0===r||e._`${n} > ${r} ? ${n} : ${r}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},li.evaluatedPropsToName=i,li.setEvaluated=c;const u={};var d,l;function f(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw new Error(t);e.self.logger.warn(t)}}return li.useFunc=function(e,r){return e.scopeValue("func",{ref:r,code:u[r.code]||(u[r.code]=new t._Code(r.code))})},(l=d||(li.Type=d={}))[l.Num=0]="Num",l[l.Str=1]="Str",li.getErrorPath=function(t,r,n){if(t instanceof e.Name){const o=r===d.Num;return n?o?e._`"[" + ${t} + "]"`:e._`"['" + ${t} + "']"`:o?e._`"/" + ${t}`:e._`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,e.getProperty)(t).toString():"/"+o(t)},li.checkStrictMode=f,li}var pi,hi,mi,vi={};function yi(){if(pi)return vi;pi=1,Object.defineProperty(vi,"__esModule",{value:!0});const e=ui(),t={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return vi.default=t,vi}function gi(){return hi||(hi=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=ui(),r=fi(),n=yi();function o(e,r){const o=e.const("err",r);e.if(t._`${n.default.vErrors} === null`,()=>e.assign(n.default.vErrors,t._`[${o}]`),t._`${n.default.vErrors}.push(${o})`),e.code(t._`${n.default.errors}++`)}function s(e,r){const{gen:n,validateName:o,schemaEnv:s}=e;s.$async?n.throw(t._`new ${e.ValidationError}(${r})`):(n.assign(t._`${o}.errors`,r),n.return(!1))}e.keywordError={message:({keyword:e})=>t.str`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:r})=>r?t.str`"${e}" keyword must be ${r} ($data)`:t.str`"${e}" keyword is invalid ($data)`},e.reportError=function(r,n=e.keywordError,a,c){const{it:u}=r,{gen:d,compositeRule:l,allErrors:f}=u,p=i(r,n,a);(null!=c?c:l||f)?o(d,p):s(u,t._`[${p}]`)},e.reportExtraError=function(t,r=e.keywordError,a){const{it:c}=t,{gen:u,compositeRule:d,allErrors:l}=c;o(u,i(t,r,a)),d||l||s(c,n.default.vErrors)},e.resetErrorsCount=function(e,r){e.assign(n.default.errors,r),e.if(t._`${n.default.vErrors} !== null`,()=>e.if(r,()=>e.assign(t._`${n.default.vErrors}.length`,r),()=>e.assign(n.default.vErrors,null)))},e.extendErrors=function({gen:e,keyword:r,schemaValue:o,data:s,errsCount:a,it:i}){if(void 0===a)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",a,n.default.errors,a=>{e.const(c,t._`${n.default.vErrors}[${a}]`),e.if(t._`${c}.instancePath === undefined`,()=>e.assign(t._`${c}.instancePath`,(0,t.strConcat)(n.default.instancePath,i.errorPath))),e.assign(t._`${c}.schemaPath`,t.str`${i.errSchemaPath}/${r}`),i.opts.verbose&&(e.assign(t._`${c}.schema`,o),e.assign(t._`${c}.data`,s))})};const a={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 i(e,r,o){const{createErrors:s}=e.it;return!1===s?t._`{}`:function(e,r,o={}){const{gen:s,it:i}=e,d=[c(i,o),u(e,o)];return function(e,{params:r,message:o},s){const{keyword:i,data:c,schemaValue:u,it:d}=e,{opts:l,propertyName:f,topSchemaRef:p,schemaPath:h}=d;s.push([a.keyword,i],[a.params,"function"==typeof r?r(e):r||t._`{}`]),l.messages&&s.push([a.message,"function"==typeof o?o(e):o]);l.verbose&&s.push([a.schema,u],[a.parentSchema,t._`${p}${h}`],[n.default.data,c]);f&&s.push([a.propertyName,f])}(e,r,d),s.object(...d)}(e,r,o)}function c({errorPath:e},{instancePath:o}){const s=o?t.str`${e}${(0,r.getErrorPath)(o,r.Type.Str)}`:e;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,s)]}function u({keyword:e,it:{errSchemaPath:n}},{schemaPath:o,parentSchema:s}){let i=s?n:t.str`${n}/${e}`;return o&&(i=t.str`${i}${(0,r.getErrorPath)(o,r.Type.Str)}`),[a.schemaPath,i]}}(ti)),ti}var _i,wi={},$i={};function bi(){if(_i)return $i;_i=1,Object.defineProperty($i,"__esModule",{value:!0}),$i.getRules=$i.isJSONType=void 0;const e=new Set(["string","number","integer","boolean","null","object","array"]);return $i.isJSONType=function(t){return"string"==typeof t&&e.has(t)},$i.getRules=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}},$i}var ki,Ei,Si={};function Pi(){if(ki)return Si;function e(e,r){return r.rules.some(r=>t(e,r))}function t(e,t){var r;return void 0!==e[t.keyword]||(null===(r=t.definition.implements)||void 0===r?void 0:r.some(t=>void 0!==e[t]))}return ki=1,Object.defineProperty(Si,"__esModule",{value:!0}),Si.shouldUseRule=Si.shouldUseGroup=Si.schemaHasRulesForType=void 0,Si.schemaHasRulesForType=function({schema:t,self:r},n){const o=r.RULES.types[n];return o&&!0!==o&&e(t,o)},Si.shouldUseGroup=e,Si.shouldUseRule=t,Si}function xi(){if(Ei)return wi;Ei=1,Object.defineProperty(wi,"__esModule",{value:!0}),wi.reportTypeError=wi.checkDataTypes=wi.checkDataType=wi.coerceAndCheckDataType=wi.getJSONTypes=wi.getSchemaTypes=wi.DataType=void 0;const e=bi(),t=Pi(),r=gi(),n=ui(),o=fi();var s,a;function i(t){const r=Array.isArray(t)?t:t?[t]:[];if(r.every(e.isJSONType))return r;throw new Error("type must be JSONType or JSONType[]: "+r.join(","))}(a=s||(wi.DataType=s={}))[a.Correct=0]="Correct",a[a.Wrong=1]="Wrong",wi.getSchemaTypes=function(e){const t=i(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},wi.getJSONTypes=i,wi.coerceAndCheckDataType=function(e,r){const{gen:o,data:a,opts:i}=e,u=function(e,t){return t?e.filter(e=>c.has(e)||"array"===t&&"array"===e):[]}(r,i.coerceTypes),l=r.length>0&&!(0===u.length&&1===r.length&&(0,t.schemaHasRulesForType)(e,r[0]));if(l){const t=d(r,a,i.strictNumbers,s.Wrong);o.if(t,()=>{u.length?function(e,t,r){const{gen:o,data:s,opts:a}=e,i=o.let("dataType",n._`typeof ${s}`),u=o.let("coerced",n._`undefined`);"array"===a.coerceTypes&&o.if(n._`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>o.assign(s,n._`${s}[0]`).assign(i,n._`typeof ${s}`).if(d(t,s,a.strictNumbers),()=>o.assign(u,s)));o.if(n._`${u} !== undefined`);for(const n of r)(c.has(n)||"array"===n&&"array"===a.coerceTypes)&&l(n);function l(e){switch(e){case"string":return void o.elseIf(n._`${i} == "number" || ${i} == "boolean"`).assign(u,n._`"" + ${s}`).elseIf(n._`${s} === null`).assign(u,n._`""`);case"number":return void o.elseIf(n._`${i} == "boolean" || ${s} === null
|
|
2
|
-
|| (${i} == "string" && ${s} && ${s} == +${s})`).assign(u,n._`+${s}`);case"integer":return void o.elseIf(n._`${i} === "boolean" || ${s} === null
|
|
3
|
-
|| (${i} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(u,n._`+${s}`);case"boolean":return void o.elseIf(n._`${s} === "false" || ${s} === 0 || ${s} === null`).assign(u,!1).elseIf(n._`${s} === "true" || ${s} === 1`).assign(u,!0);case"null":return o.elseIf(n._`${s} === "" || ${s} === 0 || ${s} === false`),void o.assign(u,null);case"array":o.elseIf(n._`${i} === "string" || ${i} === "number"
|
|
4
|
-
|| ${i} === "boolean" || ${s} === null`).assign(u,n._`[${s}]`)}}o.else(),f(e),o.endIf(),o.if(n._`${u} !== undefined`,()=>{o.assign(s,u),function({gen:e,parentData:t,parentDataProperty:r},o){e.if(n._`${t} !== undefined`,()=>e.assign(n._`${t}[${r}]`,o))}(e,u)})}(e,r,u):f(e)})}return l};const c=new Set(["string","number","integer","boolean","null"]);function u(e,t,r,o=s.Correct){const a=o===s.Correct?n.operators.EQ:n.operators.NEQ;let i;switch(e){case"null":return n._`${t} ${a} null`;case"array":i=n._`Array.isArray(${t})`;break;case"object":i=n._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=c(n._`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=c();break;default:return n._`typeof ${t} ${a} ${e}`}return o===s.Correct?i:(0,n.not)(i);function c(e=n.nil){return(0,n.and)(n._`typeof ${t} == "number"`,e,r?n._`isFinite(${t})`:n.nil)}}function d(e,t,r,s){if(1===e.length)return u(e[0],t,r,s);let a;const i=(0,o.toHash)(e);if(i.array&&i.object){const e=n._`typeof ${t} != "object"`;a=i.null?e:n._`!${t} || ${e}`,delete i.null,delete i.array,delete i.object}else a=n.nil;i.number&&delete i.integer;for(const o in i)a=(0,n.and)(a,u(o,t,r,s));return a}wi.checkDataType=u,wi.checkDataTypes=d;const l={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?n._`{type: ${e}}`:n._`{type: ${t}}`};function f(e){const t=function(e){const{gen:t,data:r,schema:n}=e,s=(0,o.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:e}}(e);(0,r.reportError)(t,l)}return wi.reportTypeError=f,wi}var Ti,Ii={};var zi,ji,Ni={},Ci={};function Oi(){if(zi)return Ci;zi=1,Object.defineProperty(Ci,"__esModule",{value:!0}),Ci.validateUnion=Ci.validateArray=Ci.usePattern=Ci.callValidateCode=Ci.schemaProperties=Ci.allSchemaProperties=Ci.noPropertyInData=Ci.propertyInData=Ci.isOwnProperty=Ci.hasPropFunc=Ci.reportMissingProp=Ci.checkMissingProp=Ci.checkReportMissingProp=void 0;const e=ui(),t=fi(),r=yi(),n=fi();function o(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:e._`Object.prototype.hasOwnProperty`})}function s(t,r,n){return e._`${o(t)}.call(${r}, ${n})`}function a(t,r,n,o){const a=e._`${r}${(0,e.getProperty)(n)} === undefined`;return o?(0,e.or)(a,(0,e.not)(s(t,r,n))):a}function i(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}Ci.checkReportMissingProp=function(t,r){const{gen:n,data:o,it:s}=t;n.if(a(n,o,r,s.opts.ownProperties),()=>{t.setParams({missingProperty:e._`${r}`},!0),t.error()})},Ci.checkMissingProp=function({gen:t,data:r,it:{opts:n}},o,s){return(0,e.or)(...o.map(o=>(0,e.and)(a(t,r,o,n.ownProperties),e._`${s} = ${o}`)))},Ci.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},Ci.hasPropFunc=o,Ci.isOwnProperty=s,Ci.propertyInData=function(t,r,n,o){const a=e._`${r}${(0,e.getProperty)(n)} !== undefined`;return o?e._`${a} && ${s(t,r,n)}`:a},Ci.noPropertyInData=a,Ci.allSchemaProperties=i,Ci.schemaProperties=function(e,r){return i(r).filter(n=>!(0,t.alwaysValidSchema)(e,r[n]))},Ci.callValidateCode=function({schemaCode:t,data:n,it:{gen:o,topSchemaRef:s,schemaPath:a,errorPath:i},it:c},u,d,l){const f=l?e._`${t}, ${n}, ${s}${a}`:n,p=[[r.default.instancePath,(0,e.strConcat)(r.default.instancePath,i)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&p.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);const h=e._`${f}, ${o.object(...p)}`;return d!==e.nil?e._`${u}.call(${d}, ${h})`:e._`${u}(${h})`};const c=e._`new RegExp`;return Ci.usePattern=function({gen:t,it:{opts:r}},o){const s=r.unicodeRegExp?"u":"",{regExp:a}=r.code,i=a(o,s);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:e._`${"new RegExp"===a.code?c:(0,n.useFunc)(t,a)}(${o}, ${s})`})},Ci.validateArray=function(r){const{gen:n,data:o,keyword:s,it:a}=r,i=n.name("valid");if(a.allErrors){const e=n.let("valid",!0);return c(()=>n.assign(e,!1)),e}return n.var(i,!0),c(()=>n.break()),i;function c(a){const c=n.const("len",e._`${o}.length`);n.forRange("i",0,c,o=>{r.subschema({keyword:s,dataProp:o,dataPropType:t.Type.Num},i),n.if((0,e.not)(i),a)})}},Ci.validateUnion=function(r){const{gen:n,schema:o,keyword:s,it:a}=r;if(!Array.isArray(o))throw new Error("ajv implementation error");if(o.some(e=>(0,t.alwaysValidSchema)(a,e))&&!a.opts.unevaluated)return;const i=n.let("valid",!1),c=n.name("_valid");n.block(()=>o.forEach((t,o)=>{const a=r.subschema({keyword:s,schemaProp:o,compositeRule:!0},c);n.assign(i,e._`${i} || ${c}`);r.mergeValidEvaluated(a,c)||n.if((0,e.not)(i))})),r.result(i,()=>r.reset(),()=>r.error(!0))},Ci}function Ri(){if(ji)return Ni;ji=1,Object.defineProperty(Ni,"__esModule",{value:!0}),Ni.validateKeywordUsage=Ni.validSchemaType=Ni.funcKeywordCode=Ni.macroKeywordCode=void 0;const e=ui(),t=yi(),r=Oi(),n=gi();function o(t){const{gen:r,data:n,it:o}=t;r.if(o.parentData,()=>r.assign(n,e._`${o.parentData}[${o.parentDataProperty}]`))}function s(t,r,n){if(void 0===n)throw new Error(`keyword "${r}" failed to compile`);return t.scopeValue("keyword","function"==typeof n?{ref:n}:{ref:n,code:(0,e.stringify)(n)})}return Ni.macroKeywordCode=function(t,r){const{gen:n,keyword:o,schema:a,parentSchema:i,it:c}=t,u=r.macro.call(c.self,a,i,c),d=s(n,o,u);!1!==c.opts.validateSchema&&c.self.validateSchema(u,!0);const l=n.name("valid");t.subschema({schema:u,schemaPath:e.nil,errSchemaPath:`${c.errSchemaPath}/${o}`,topSchemaRef:d,compositeRule:!0},l),t.pass(l,()=>t.error(!0))},Ni.funcKeywordCode=function(a,i){var c;const{gen:u,keyword:d,schema:l,parentSchema:f,$data:p,it:h}=a;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(h,i);const m=!p&&i.compile?i.compile.call(h.self,l,f,h):i.validate,v=s(u,d,m),y=u.let("valid");function g(n=(i.async?e._`await `:e.nil)){const o=h.opts.passContext?t.default.this:t.default.self,s=!("compile"in i&&!p||!1===i.schema);u.assign(y,e._`${n}${(0,r.callValidateCode)(a,v,o,s)}`,i.modifying)}function _(t){var r;u.if((0,e.not)(null!==(r=i.valid)&&void 0!==r?r:y),t)}a.block$data(y,function(){if(!1===i.errors)g(),i.modifying&&o(a),_(()=>a.error());else{const r=i.async?function(){const t=u.let("ruleErrs",null);return u.try(()=>g(e._`await `),r=>u.assign(y,!1).if(e._`${r} instanceof ${h.ValidationError}`,()=>u.assign(t,e._`${r}.errors`),()=>u.throw(r))),t}():function(){const t=e._`${v}.errors`;return u.assign(t,null),g(e.nil),t}();i.modifying&&o(a),_(()=>function(r,o){const{gen:s}=r;s.if(e._`Array.isArray(${o})`,()=>{s.assign(t.default.vErrors,e._`${t.default.vErrors} === null ? ${o} : ${t.default.vErrors}.concat(${o})`).assign(t.default.errors,e._`${t.default.vErrors}.length`),(0,n.extendErrors)(r)},()=>r.error())}(a,r))}}),a.ok(null!==(c=i.valid)&&void 0!==c?c:y)},Ni.validSchemaType=function(e,t,r=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e)},Ni.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");const a=o.dependencies;if(null==a?void 0:a.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw new Error(`parent schema must have dependencies of ${s}: ${a.join(",")}`);if(o.validateSchema){if(!o.validateSchema(e[s])){const e=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);r.logger.error(e)}}},Ni}var Ai,qi={};var Mi,Di,Vi={};function Ui(){return Di?Mi:(Di=1,Mi=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(o=n;0!==o--;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(s=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(o=n;0!==o--;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;0!==o--;){var a=s[o];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r})}var Fi,Zi,Li,Hi={exports:{}};function Ki(){if(Fi)return Hi.exports;Fi=1;var e=Hi.exports=function(e,r,n){"function"==typeof r&&(n=r,r={}),t(r,"function"==typeof(n=r.cb||n)?n:n.pre||function(){},n.post||function(){},e,"",e)};function t(n,o,s,a,i,c,u,d,l,f){if(a&&"object"==typeof a&&!Array.isArray(a)){for(var p in o(a,i,c,u,d,l,f),a){var h=a[p];if(Array.isArray(h)){if(p in e.arrayKeywords)for(var m=0;m<h.length;m++)t(n,o,s,h[m],i+"/"+p+"/"+m,c,i,p,a,m)}else if(p in e.propsKeywords){if(h&&"object"==typeof h)for(var v in h)t(n,o,s,h[v],i+"/"+p+"/"+r(v),c,i,p,a,v)}else(p in e.keywords||n.allKeys&&!(p in e.skipKeywords))&&t(n,o,s,h,i+"/"+p,c,i,p,a)}s(a,i,c,u,d,l,f)}}function r(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}return e.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},e.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},e.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},e.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},Hi.exports}function Gi(){if(Zi)return Vi;Zi=1,Object.defineProperty(Vi,"__esModule",{value:!0}),Vi.getSchemaRefs=Vi.resolveUrl=Vi.normalizeId=Vi._getFullPath=Vi.getFullPath=Vi.inlineRef=void 0;const e=fi(),t=Ui(),r=Ki(),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);Vi.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!s(e):!!t&&a(e)<=t)};const o=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function s(e){for(const t in e){if(o.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(s))return!0;if("object"==typeof r&&s(r))return!0}return!1}function a(t){let r=0;for(const o in t){if("$ref"===o)return 1/0;if(r++,!n.has(o)&&("object"==typeof t[o]&&(0,e.eachItem)(t[o],e=>r+=a(e)),r===1/0))return 1/0}return r}function i(e,t="",r){!1!==r&&(t=d(t));const n=e.parse(t);return c(e,n)}function c(e,t){return e.serialize(t).split("#")[0]+"#"}Vi.getFullPath=i,Vi._getFullPath=c;const u=/#\/?$/;function d(e){return e?e.replace(u,""):""}Vi.normalizeId=d,Vi.resolveUrl=function(e,t,r){return r=d(r),e.resolve(t,r)};const l=/^[a-z_][-a-z0-9._]*$/i;return Vi.getSchemaRefs=function(e,n){if("boolean"==typeof e)return{};const{schemaId:o,uriResolver:s}=this.opts,a=d(e[o]||n),c={"":a},u=i(s,a,!1),f={},p=new Set;return r(e,{allKeys:!0},(e,t,r,n)=>{if(void 0===n)return;const s=u+t;let a=c[n];function i(t){const r=this.opts.uriResolver.resolve;if(t=d(a?r(a,t):t),p.has(t))throw m(t);p.add(t);let n=this.refs[t];return"string"==typeof n&&(n=this.refs[n]),"object"==typeof n?h(e,n.schema,t):t!==d(s)&&("#"===t[0]?(h(e,f[t],t),f[t]=e):this.refs[t]=s),t}function v(e){if("string"==typeof e){if(!l.test(e))throw new Error(`invalid anchor "${e}"`);i.call(this,`#${e}`)}}"string"==typeof e[o]&&(a=i.call(this,e[o])),v.call(this,e.$anchor),v.call(this,e.$dynamicAnchor),c[t]=a}),f;function h(e,r,n){if(void 0!==r&&!t(e,r))throw m(n)}function m(e){return new Error(`reference "${e}" resolves to more than one schema`)}},Vi}function Ji(){if(Li)return Xa;Li=1,Object.defineProperty(Xa,"__esModule",{value:!0}),Xa.getData=Xa.KeywordCxt=Xa.validateFunctionCode=void 0;const e=function(){if(mi)return ei;mi=1,Object.defineProperty(ei,"__esModule",{value:!0}),ei.boolOrEmptySchema=ei.topBoolOrEmptySchema=void 0;const e=gi(),t=ui(),r=yi(),n={message:"boolean schema is false"};function o(t,r){const{gen:o,data:s}=t,a={gen:o,keyword:"false schema",data:s,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,e.reportError)(a,n,void 0,r)}return ei.topBoolOrEmptySchema=function(e){const{gen:n,schema:s,validateName:a}=e;!1===s?o(e,!1):"object"==typeof s&&!0===s.$async?n.return(r.default.data):(n.assign(t._`${a}.errors`,null),n.return(!0))},ei.boolOrEmptySchema=function(e,t){const{gen:r,schema:n}=e;!1===n?(r.var(t,!1),o(e)):r.var(t,!0)},ei}(),t=xi(),r=Pi(),n=xi(),o=function(){if(Ti)return Ii;Ti=1,Object.defineProperty(Ii,"__esModule",{value:!0}),Ii.assignDefaults=void 0;const e=ui(),t=fi();function r(r,n,o){const{gen:s,compositeRule:a,data:i,opts:c}=r;if(void 0===o)return;const u=e._`${i}${(0,e.getProperty)(n)}`;if(a)return void(0,t.checkStrictMode)(r,`default is ignored for: ${u}`);let d=e._`${u} === undefined`;"empty"===c.useDefaults&&(d=e._`${d} || ${u} === null || ${u} === ""`),s.if(d,e._`${u} = ${(0,e.stringify)(o)}`)}return Ii.assignDefaults=function(e,t){const{properties:n,items:o}=e.schema;if("object"===t&&n)for(const s in n)r(e,s,n[s].default);else"array"===t&&Array.isArray(o)&&o.forEach((t,n)=>r(e,n,t.default))},Ii}(),s=Ri(),a=function(){if(Ai)return qi;Ai=1,Object.defineProperty(qi,"__esModule",{value:!0}),qi.extendSubschemaMode=qi.extendSubschemaData=qi.getSubschema=void 0;const e=ui(),t=fi();return qi.getSubschema=function(r,{keyword:n,schemaProp:o,schema:s,schemaPath:a,errSchemaPath:i,topSchemaRef:c}){if(void 0!==n&&void 0!==s)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==n){const s=r.schema[n];return void 0===o?{schema:s,schemaPath:e._`${r.schemaPath}${(0,e.getProperty)(n)}`,errSchemaPath:`${r.errSchemaPath}/${n}`}:{schema:s[o],schemaPath:e._`${r.schemaPath}${(0,e.getProperty)(n)}${(0,e.getProperty)(o)}`,errSchemaPath:`${r.errSchemaPath}/${n}/${(0,t.escapeFragment)(o)}`}}if(void 0!==s){if(void 0===a||void 0===i||void 0===c)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:s,schemaPath:a,topSchemaRef:c,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')},qi.extendSubschemaData=function(r,n,{dataProp:o,dataPropType:s,data:a,dataTypes:i,propertyName:c}){if(void 0!==a&&void 0!==o)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:u}=n;if(void 0!==o){const{errorPath:a,dataPathArr:i,opts:c}=n;d(u.let("data",e._`${n.data}${(0,e.getProperty)(o)}`,!0)),r.errorPath=e.str`${a}${(0,t.getErrorPath)(o,s,c.jsPropertySyntax)}`,r.parentDataProperty=e._`${o}`,r.dataPathArr=[...i,r.parentDataProperty]}function d(e){r.data=e,r.dataLevel=n.dataLevel+1,r.dataTypes=[],n.definedProperties=new Set,r.parentData=n.data,r.dataNames=[...n.dataNames,e]}void 0!==a&&(d(a instanceof e.Name?a:u.let("data",a,!0)),void 0!==c&&(r.propertyName=c)),i&&(r.dataTypes=i)},qi.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){void 0!==n&&(e.compositeRule=n),void 0!==o&&(e.createErrors=o),void 0!==s&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r},qi}(),i=ui(),c=yi(),u=Gi(),d=fi(),l=gi();function f({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){o.code.es5?e.func(t,i._`${c.default.data}, ${c.default.valCxt}`,n.$async,()=>{e.code(i._`"use strict"; ${p(r,o)}`),function(e,t){e.if(c.default.valCxt,()=>{e.var(c.default.instancePath,i._`${c.default.valCxt}.${c.default.instancePath}`),e.var(c.default.parentData,i._`${c.default.valCxt}.${c.default.parentData}`),e.var(c.default.parentDataProperty,i._`${c.default.valCxt}.${c.default.parentDataProperty}`),e.var(c.default.rootData,i._`${c.default.valCxt}.${c.default.rootData}`),t.dynamicRef&&e.var(c.default.dynamicAnchors,i._`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{e.var(c.default.instancePath,i._`""`),e.var(c.default.parentData,i._`undefined`),e.var(c.default.parentDataProperty,i._`undefined`),e.var(c.default.rootData,c.default.data),t.dynamicRef&&e.var(c.default.dynamicAnchors,i._`{}`)})}(e,o),e.code(s)}):e.func(t,i._`${c.default.data}, ${function(e){return i._`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${e.dynamicRef?i._`, ${c.default.dynamicAnchors}={}`:i.nil}}={}`}(o)}`,n.$async,()=>e.code(p(r,o)).code(s))}function p(e,t){const r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?i._`/*# sourceURL=${r} */`:i.nil}function h(t,r){v(t)&&(y(t),m(t))?function(e,t){const{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&_(e);(function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,u.resolveUrl)(e.opts.uriResolver,e.baseId,t))})(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const s=n.const("_errs",c.default.errors);g(e,s),n.var(t,i._`${s} === ${c.default.errors}`)}(t,r):(0,e.boolOrEmptySchema)(t,r)}function m({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function v(e){return"boolean"!=typeof e.schema}function y(e){(0,d.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function g(e,r){if(e.opts.jtd)return w(e,[],!1,r);const n=(0,t.getSchemaTypes)(e.schema);w(e,n,!(0,t.coerceAndCheckDataType)(e,n),r)}function _({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){const s=r.$comment;if(!0===o.$comment)e.code(i._`${c.default.self}.logger.log(${s})`);else if("function"==typeof o.$comment){const r=i.str`${n}/$comment`,o=e.scopeValue("root",{ref:t.root});e.code(i._`${c.default.self}.opts.$comment(${s}, ${r}, ${o}.schema)`)}}function w(e,t,o,s){const{gen:a,schema:u,data:l,allErrors:f,opts:p,self:h}=e,{RULES:m}=h;function v(d){(0,r.shouldUseGroup)(u,d)&&(d.type?(a.if((0,n.checkDataType)(d.type,l,p.strictNumbers)),$(e,d),1===t.length&&t[0]===d.type&&o&&(a.else(),(0,n.reportTypeError)(e)),a.endIf()):$(e,d),f||a.if(i._`${c.default.errors} === ${s||0}`))}!u.$ref||!p.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(u,m)?(p.jtd||function(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;(function(e,t){if(!t.length)return;if(!e.dataTypes.length)return void(e.dataTypes=t);t.forEach(t=>{k(e.dataTypes,t)||E(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){const r=[];for(const n of e.dataTypes)k(t,n)?r.push(n):t.includes("integer")&&"number"===n&&r.push("integer");e.dataTypes=r}(e,t)})(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&E(e,"use allowUnionTypes to allow union type keyword")}(e,t);!function(e,t){const n=e.self.RULES.all;for(const o in n){const s=n[o];if("object"==typeof s&&(0,r.shouldUseRule)(e.schema,s)){const{type:r}=s.definition;r.length&&!r.some(e=>b(t,e))&&E(e,`missing type "${r.join(",")}" for keyword "${o}"`)}}}(e,e.dataTypes)}(e,t),a.block(()=>{for(const e of m.rules)v(e);v(m.post)})):a.block(()=>P(e,"$ref",m.all.$ref.definition))}function $(e,t){const{gen:n,schema:s,opts:{useDefaults:a}}=e;a&&(0,o.assignDefaults)(e,t.type),n.block(()=>{for(const n of t.rules)(0,r.shouldUseRule)(s,n)&&P(e,n.keyword,n.definition,t.type)})}function b(e,t){return e.includes(t)||"number"===t&&e.includes("integer")}function k(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function E(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}Xa.validateFunctionCode=function(t){v(t)&&(y(t),m(t))?function(e){const{schema:t,opts:r,gen:n}=e;f(e,()=>{r.$comment&&t.$comment&&_(e),function(e){const{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,d.checkStrictMode)(e,"default is ignored in the schema root")}(e),n.let(c.default.vErrors,null),n.let(c.default.errors,0),r.unevaluated&&function(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",i._`${r}.evaluated`),t.if(i._`${e.evaluated}.dynamicProps`,()=>t.assign(i._`${e.evaluated}.props`,i._`undefined`)),t.if(i._`${e.evaluated}.dynamicItems`,()=>t.assign(i._`${e.evaluated}.items`,i._`undefined`))}(e),g(e),function(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;r.$async?t.if(i._`${c.default.errors} === 0`,()=>t.return(c.default.data),()=>t.throw(i._`new ${o}(${c.default.vErrors})`)):(t.assign(i._`${n}.errors`,c.default.vErrors),s.unevaluated&&function({gen:e,evaluated:t,props:r,items:n}){r instanceof i.Name&&e.assign(i._`${t}.props`,r);n instanceof i.Name&&e.assign(i._`${t}.items`,n)}(e),t.return(i._`${c.default.errors} === 0`))}(e)})}(t):f(t,()=>(0,e.topBoolOrEmptySchema)(t))};class S{constructor(e,t,r){if((0,s.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",I(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",c.default.errors))}result(e,t,r){this.failResult((0,i.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,i.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(i._`${t} !== undefined && (${(0,i.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t)return this.setParams(t),this._error(e,r),void this.setParams({});this._error(e,r)}_error(e,t){(e?l.reportExtraError:l.reportError)(this,this.def.error,t)}$dataError(){(0,l.reportError)(this,this.def.$dataError||l.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,l.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=i.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=i.nil,t=i.nil){if(!this.$data)return;const{gen:r,schemaCode:n,schemaType:o,def:s}=this;r.if((0,i.or)(i._`${n} === undefined`,t)),e!==i.nil&&r.assign(e,!0),(o.length||s.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==i.nil&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:o,it:s}=this;return(0,i.or)(function(){if(r.length){if(!(t instanceof i.Name))throw new Error("ajv implementation error");const e=Array.isArray(r)?r:[r];return i._`${(0,n.checkDataTypes)(e,t,s.opts.strictNumbers,n.DataType.Wrong)}`}return i.nil}(),function(){if(o.validateSchema){const r=e.scopeValue("validate$data",{ref:o.validateSchema});return i._`!${r}(${t})`}return i.nil}())}subschema(e,t){const r=(0,a.getSubschema)(this.it,e);(0,a.extendSubschemaData)(r,this.it,e),(0,a.extendSubschemaMode)(r,e);const n={...this.it,...r,items:void 0,props:void 0};return h(n,t),n}mergeEvaluated(e,t){const{it:r,gen:n}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=d.mergeEvaluated.props(n,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=d.mergeEvaluated.items(n,e.items,r.items,t)))}mergeValidEvaluated(e,t){const{it:r,gen:n}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return n.if(t,()=>this.mergeEvaluated(e,i.Name)),!0}}function P(e,t,r,n){const o=new S(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,s.funcKeywordCode)(o,r):"macro"in r?(0,s.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,s.funcKeywordCode)(o,r)}Xa.KeywordCxt=S;const x=/^\/(?:[^~]|~0|~1)*$/,T=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function I(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(""===e)return c.default.rootData;if("/"===e[0]){if(!x.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,s=c.default.rootData}else{const a=T.exec(e);if(!a)throw new Error(`Invalid JSON-pointer: ${e}`);const i=+a[1];if(o=a[2],"#"===o){if(i>=t)throw new Error(l("property/index",i));return n[t-i]}if(i>t)throw new Error(l("data",i));if(s=r[t-i],!o)return s}let a=s;const u=o.split("/");for(const c of u)c&&(s=i._`${s}${(0,i.getProperty)((0,d.unescapeJsonPointer)(c))}`,a=i._`${a} && ${s}`);return a;function l(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}return Xa.getData=I,Xa}var Bi,Wi={};function Qi(){if(Bi)return Wi;Bi=1,Object.defineProperty(Wi,"__esModule",{value:!0});class e extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}return Wi.default=e,Wi}var Yi,Xi={};function ec(){if(Yi)return Xi;Yi=1,Object.defineProperty(Xi,"__esModule",{value:!0});const e=Gi();class t extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,e.resolveUrl)(t,r,n),this.missingSchema=(0,e.normalizeId)((0,e.getFullPath)(t,this.missingRef))}}return Xi.default=t,Xi}var tc,rc={};function nc(){if(tc)return rc;tc=1,Object.defineProperty(rc,"__esModule",{value:!0}),rc.resolveSchema=rc.getCompilingSchema=rc.resolveRef=rc.compileSchema=rc.SchemaEnv=void 0;const e=ui(),t=Qi(),r=yi(),n=Gi(),o=fi(),s=Ji();class a{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,n.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function i(o){const a=u.call(this,o);if(a)return a;const i=(0,n.getFullPath)(this.opts.uriResolver,o.root.baseId),{es5:c,lines:d}=this.opts.code,{ownProperties:l}=this.opts,f=new e.CodeGen(this.scope,{es5:c,lines:d,ownProperties:l});let p;o.$async&&(p=f.scopeValue("Error",{ref:t.default,code:e._`require("ajv/dist/runtime/validation_error").default`}));const h=f.scopeName("validate");o.validateName=h;const m={gen:f,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[e.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue("schema",!0===this.opts.code.source?{ref:o.schema,code:(0,e.stringify)(o.schema)}:{ref:o.schema}),validateName:h,ValidationError:p,schema:o.schema,schemaEnv:o,rootId:i,baseId:o.baseId||i,schemaPath:e.nil,errSchemaPath:o.schemaPath||(this.opts.jtd?"":"#"),errorPath:e._`""`,opts:this.opts,self:this};let v;try{this._compilations.add(o),(0,s.validateFunctionCode)(m),f.optimize(this.opts.code.optimize);const t=f.toString();v=`${f.scopeRefs(r.default.scope)}return ${t}`,this.opts.code.process&&(v=this.opts.code.process(v,o));const n=new Function(`${r.default.self}`,`${r.default.scope}`,v)(this,this.scope.get());if(this.scope.value(h,{ref:n}),n.errors=null,n.schema=o.schema,n.schemaEnv=o,o.$async&&(n.$async=!0),!0===this.opts.code.source&&(n.source={validateName:h,validateCode:t,scopeValues:f._values}),this.opts.unevaluated){const{props:t,items:r}=m;n.evaluated={props:t instanceof e.Name?void 0:t,items:r instanceof e.Name?void 0:r,dynamicProps:t instanceof e.Name,dynamicItems:r instanceof e.Name},n.source&&(n.source.evaluated=(0,e.stringify)(n.evaluated))}return o.validate=n,o}catch(y){throw delete o.validate,delete o.validateName,v&&this.logger.error("Error compiling schema, function code:",v),y}finally{this._compilations.delete(o)}}function c(e){return(0,n.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:i.call(this,e)}function u(e){for(const t of this._compilations)if(d(t,e))return t}function d(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function l(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||f.call(this,e,t)}function f(e,t){const r=this.opts.uriResolver.parse(t),o=(0,n._getFullPath)(this.opts.uriResolver,r);let s=(0,n.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===s)return h.call(this,r,e);const c=(0,n.normalizeId)(o),u=this.refs[c]||this.schemas[c];if("string"==typeof u){const t=f.call(this,e,u);if("object"!=typeof(null==t?void 0:t.schema))return;return h.call(this,r,t)}if("object"==typeof(null==u?void 0:u.schema)){if(u.validate||i.call(this,u),c===(0,n.normalizeId)(t)){const{schema:t}=u,{schemaId:r}=this.opts,o=t[r];return o&&(s=(0,n.resolveUrl)(this.opts.uriResolver,s,o)),new a({schema:t,schemaId:r,root:e,baseId:s})}return h.call(this,r,u)}}rc.SchemaEnv=a,rc.compileSchema=i,rc.resolveRef=function(e,t,r){var o;r=(0,n.resolveUrl)(this.opts.uriResolver,t,r);const s=e.refs[r];if(s)return s;let i=l.call(this,e,r);if(void 0===i){const n=null===(o=e.localRefs)||void 0===o?void 0:o[r],{schemaId:s}=this.opts;n&&(i=new a({schema:n,schemaId:s,root:e,baseId:t}))}return void 0!==i?e.refs[r]=c.call(this,i):void 0},rc.getCompilingSchema=u,rc.resolveSchema=f;const p=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function h(e,{baseId:t,schema:r,root:s}){var i;if("/"!==(null===(i=e.fragment)||void 0===i?void 0:i[0]))return;for(const a of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;const e=r[(0,o.unescapeFragment)(a)];if(void 0===e)return;const s="object"==typeof(r=e)&&r[this.opts.schemaId];!p.has(a)&&s&&(t=(0,n.resolveUrl)(this.opts.uriResolver,t,s))}let c;if("boolean"!=typeof r&&r.$ref&&!(0,o.schemaHasRulesButRef)(r,this.RULES)){const e=(0,n.resolveUrl)(this.opts.uriResolver,t,r.$ref);c=f.call(this,s,e)}const{schemaId:u}=this.opts;return c=c||new a({schema:r,schemaId:u,root:s,baseId:t}),c.schema!==c.root.schema?c:void 0}return rc}const oc={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1};var sc,ac,ic,cc,uc,dc,lc,fc={},pc={exports:{}};function hc(){if(ac)return sc;ac=1;const e=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),t=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 r(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),48!==r){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}const n=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function o(e){return e.length=0,!0}function s(e,t,n){if(e.length){const o=r(e);if(""===o)return n.error=!0,!1;t.push(o),e.length=0}return!0}function a(e){if(function(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}(e,":")<2)return{host:e,isIPV6:!1};const t=function(e){let t=0;const n={error:!1,address:"",zone:""},a=[],i=[];let c=!1,u=!1,d=s;for(let r=0;r<e.length;r++){const s=e[r];if("["!==s&&"]"!==s)if(":"!==s)if("%"===s){if(!d(i,a,n))break;d=o}else i.push(s);else{if(!0===c&&(u=!0),!d(i,a,n))break;if(++t>7){n.error=!0;break}r>0&&":"===e[r-1]&&(c=!0),a.push(":")}}return i.length&&(d===o?n.zone=i.join(""):u?a.push(i.join("")):a.push(r(i))),n.address=a.join(""),n}(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,r=t.address;return t.zone&&(e+="%"+t.zone,r+="%25"+t.zone),{host:e,isIPV6:!0,escapedHost:r}}}return sc={nonSimpleDomain:n,recomposeAuthority:function(e){const r=[];if(void 0!==e.userinfo&&(r.push(e.userinfo),r.push("@")),void 0!==e.host){let n=unescape(e.host);if(!t(n)){const t=a(n);n=!0===t.isIPV6?`[${t.escapedHost}]`:e.host}r.push(n)}return"number"!=typeof e.port&&"string"!=typeof e.port||(r.push(":"),r.push(String(e.port))),r.length?r.join(""):void 0},normalizeComponentEncoding:function(e,t){const r=!0!==t?escape:unescape;return void 0!==e.scheme&&(e.scheme=r(e.scheme)),void 0!==e.userinfo&&(e.userinfo=r(e.userinfo)),void 0!==e.host&&(e.host=r(e.host)),void 0!==e.path&&(e.path=r(e.path)),void 0!==e.query&&(e.query=r(e.query)),void 0!==e.fragment&&(e.fragment=r(e.fragment)),e},removeDotSegments:function(e){let t=e;const r=[];let n=-1,o=0;for(;o=t.length;){if(1===o){if("."===t)break;if("/"===t){r.push("/");break}r.push(t);break}if(2===o){if("."===t[0]){if("."===t[1])break;if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&("."===t[1]||"/"===t[1])){r.push("/");break}}else if(3===o&&"/.."===t){0!==r.length&&r.pop(),r.push("/");break}if("."===t[0]){if("."===t[1]){if("/"===t[2]){t=t.slice(3);continue}}else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&"."===t[1]){if("/"===t[2]){t=t.slice(2);continue}if("."===t[2]&&"/"===t[3]){t=t.slice(3),0!==r.length&&r.pop();continue}}if(-1===(n=t.indexOf("/",1))){r.push(t);break}r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")},isIPv4:t,isUUID:e,normalizeIPv6:a,stringArrayToHexStripped:r}}function mc(){if(uc)return pc.exports;uc=1;const{normalizeIPv6:e,removeDotSegments:t,recomposeAuthority:r,normalizeComponentEncoding:n,isIPv4:o,nonSimpleDomain:s}=hc(),{SCHEMES:a,getSchemeHandler:i}=function(){if(cc)return ic;cc=1;const{isUUID:e}=hc(),t=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,r=["http","https","ws","wss","urn","urn:uuid"];function n(e){return!0===e.secure||!1!==e.secure&&!!e.scheme&&!(3!==e.scheme.length||"w"!==e.scheme[0]&&"W"!==e.scheme[0]||"s"!==e.scheme[1]&&"S"!==e.scheme[1]||"s"!==e.scheme[2]&&"S"!==e.scheme[2])}function o(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function s(e){const t="https"===String(e.scheme).toLowerCase();return e.port!==(t?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}const a={scheme:"http",domainHost:!0,parse:o,serialize:s},i={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=n(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if(e.port!==(n(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){const[t,r]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},c={http:a,https:{scheme:"https",domainHost:a.domainHost,parse:o,serialize:s},ws:i,wss:{scheme:"wss",domainHost:i.domainHost,parse:i.parse,serialize:i.serialize},urn:{scheme:"urn",parse:function(e,r){if(!e.path)return e.error="URN can not be parsed",e;const n=e.path.match(t);if(n){const t=r.scheme||e.scheme||"urn";e.nid=n[1].toLowerCase(),e.nss=n[2];const o=u(`${t}:${r.nid||e.nid}`);e.path=void 0,o&&(e=o.parse(e,r))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){if(void 0===e.nid)throw new Error("URN without nid cannot be serialized");const r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=u(`${r}:${t.nid||n}`);o&&(e=o.serialize(e,t));const s=e,a=e.nss;return s.path=`${n||t.nid}:${a}`,t.skipEscape=!0,s},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(t,r){const n=t;return n.uuid=n.nss,n.nss=void 0,r.tolerant||n.uuid&&e(n.uuid)||(n.error=n.error||"UUID is not valid."),n},serialize:function(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t},skipNormalize:!0}};function u(e){return e&&(c[e]||c[e.toLowerCase()])||void 0}return Object.setPrototypeOf(c,null),ic={wsIsSecure:n,SCHEMES:c,isValidSchemeName:function(e){return-1!==r.indexOf(e)},getSchemeHandler:u}}();function c(e,r,n,o){const s={};return o||(e=l(u(e,n),n),r=l(u(r,n),n)),!(n=n||{}).tolerant&&r.scheme?(s.scheme=r.scheme,s.userinfo=r.userinfo,s.host=r.host,s.port=r.port,s.path=t(r.path||""),s.query=r.query):(void 0!==r.userinfo||void 0!==r.host||void 0!==r.port?(s.userinfo=r.userinfo,s.host=r.host,s.port=r.port,s.path=t(r.path||""),s.query=r.query):(r.path?("/"===r.path[0]?s.path=t(r.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?s.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+r.path:s.path=r.path:s.path="/"+r.path,s.path=t(s.path)),s.query=r.query):(s.path=e.path,void 0!==r.query?s.query=r.query:s.query=e.query),s.userinfo=e.userinfo,s.host=e.host,s.port=e.port),s.scheme=e.scheme),s.fragment=r.fragment,s}function u(e,n){const o={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},s=Object.assign({},n),a=[],c=i(s.scheme||o.scheme);c&&c.serialize&&c.serialize(o,s),void 0!==o.path&&(s.skipEscape?o.path=unescape(o.path):(o.path=escape(o.path),void 0!==o.scheme&&(o.path=o.path.split("%3A").join(":")))),"suffix"!==s.reference&&o.scheme&&a.push(o.scheme,":");const u=r(o);if(void 0!==u&&("suffix"!==s.reference&&a.push("//"),a.push(u),o.path&&"/"!==o.path[0]&&a.push("/")),void 0!==o.path){let e=o.path;s.absolutePath||c&&c.absolutePath||(e=t(e)),void 0===u&&"/"===e[0]&&"/"===e[1]&&(e="/%2F"+e.slice(2)),a.push(e)}return void 0!==o.query&&a.push("?",o.query),void 0!==o.fragment&&a.push("#",o.fragment),a.join("")}const d=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function l(t,r){const n=Object.assign({},r),a={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let c=!1;"suffix"===n.reference&&(t=n.scheme?n.scheme+":"+t:"//"+t);const u=t.match(d);if(u){if(a.scheme=u[1],a.userinfo=u[3],a.host=u[4],a.port=parseInt(u[5],10),a.path=u[6]||"",a.query=u[7],a.fragment=u[8],isNaN(a.port)&&(a.port=u[5]),a.host){if(!1===o(a.host)){const t=e(a.host);a.host=t.host.toLowerCase(),c=t.isIPV6}else c=!0}void 0!==a.scheme||void 0!==a.userinfo||void 0!==a.host||void 0!==a.port||void 0!==a.query||a.path?void 0===a.scheme?a.reference="relative":void 0===a.fragment?a.reference="absolute":a.reference="uri":a.reference="same-document",n.reference&&"suffix"!==n.reference&&n.reference!==a.reference&&(a.error=a.error||"URI is not a "+n.reference+" reference.");const r=i(n.scheme||a.scheme);if(!(n.unicodeSupport||r&&r.unicodeSupport)&&a.host&&(n.domainHost||r&&r.domainHost)&&!1===c&&s(a.host))try{a.host=URL.domainToASCII(a.host.toLowerCase())}catch(l){a.error=a.error||"Host's domain name can not be converted to ASCII: "+l}(!r||r&&!r.skipNormalize)&&(-1!==t.indexOf("%")&&(void 0!==a.scheme&&(a.scheme=unescape(a.scheme)),void 0!==a.host&&(a.host=unescape(a.host))),a.path&&(a.path=escape(unescape(a.path))),a.fragment&&(a.fragment=encodeURI(decodeURIComponent(a.fragment)))),r&&r.parse&&r.parse(a,n)}else a.error=a.error||"URI can not be parsed.";return a}const f={SCHEMES:a,normalize:function(e,t){return"string"==typeof e?e=u(l(e,t),t):"object"==typeof e&&(e=l(u(e,t),t)),e},resolve:function(e,t,r){const n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=c(l(e,n),l(t,n),n,!0);return n.skipEscape=!0,u(o,n)},resolveComponent:c,equal:function(e,t,r){return"string"==typeof e?(e=unescape(e),e=u(n(l(e,r),!0),{...r,skipEscape:!0})):"object"==typeof e&&(e=u(n(e,!0),{...r,skipEscape:!0})),"string"==typeof t?(t=unescape(t),t=u(n(l(t,r),!0),{...r,skipEscape:!0})):"object"==typeof t&&(t=u(n(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()},serialize:u,parse:l};return pc.exports=f,pc.exports.default=f,pc.exports.fastUri=f,pc.exports}function vc(){return lc||(lc=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=Ji();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=ui();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}});const n=Qi(),o=ec(),s=bi(),a=nc(),i=ui(),c=Gi(),u=xi(),d=fi(),l=oc,f=function(){if(dc)return fc;dc=1,Object.defineProperty(fc,"__esModule",{value:!0});const e=mc();return e.code='require("ajv/dist/runtime/uri").default',fc.default=e,fc}(),p=(e,t)=>new RegExp(e,t);p.code="new RegExp";const h=["removeAdditional","useDefaults","coerceTypes"],m=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),v={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."},y={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function g(e){var t,r,n,o,s,a,i,c,u,d,l,h,m,v,y,g,_,w,$,b,k,E,S,P,x;const T=e.strict,I=null===(t=e.code)||void 0===t?void 0:t.optimize,z=!0===I||void 0===I?1:I||0,j=null!==(n=null===(r=e.code)||void 0===r?void 0:r.regExp)&&void 0!==n?n:p,N=null!==(o=e.uriResolver)&&void 0!==o?o:f.default;return{strictSchema:null===(a=null!==(s=e.strictSchema)&&void 0!==s?s:T)||void 0===a||a,strictNumbers:null===(c=null!==(i=e.strictNumbers)&&void 0!==i?i:T)||void 0===c||c,strictTypes:null!==(d=null!==(u=e.strictTypes)&&void 0!==u?u:T)&&void 0!==d?d:"log",strictTuples:null!==(h=null!==(l=e.strictTuples)&&void 0!==l?l:T)&&void 0!==h?h:"log",strictRequired:null!==(v=null!==(m=e.strictRequired)&&void 0!==m?m:T)&&void 0!==v&&v,code:e.code?{...e.code,optimize:z,regExp:j}:{optimize:z,regExp:j},loopRequired:null!==(y=e.loopRequired)&&void 0!==y?y:200,loopEnum:null!==(g=e.loopEnum)&&void 0!==g?g:200,meta:null===(_=e.meta)||void 0===_||_,messages:null===(w=e.messages)||void 0===w||w,inlineRefs:null===($=e.inlineRefs)||void 0===$||$,schemaId:null!==(b=e.schemaId)&&void 0!==b?b:"$id",addUsedSchema:null===(k=e.addUsedSchema)||void 0===k||k,validateSchema:null===(E=e.validateSchema)||void 0===E||E,validateFormats:null===(S=e.validateFormats)||void 0===S||S,unicodeRegExp:null===(P=e.unicodeRegExp)||void 0===P||P,int32range:null===(x=e.int32range)||void 0===x||x,uriResolver:N}}class _{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...g(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new i.ValueScope({scope:{},prefixes:m,es5:t,lines:r}),this.logger=function(e){if(!1===e)return P;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,s.getRules)(),w.call(this,v,e,"NOT SUPPORTED"),w.call(this,y,e,"DEPRECATED","warn"),this._metaOpts=S.call(this),e.formats&&k.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&E.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),b.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:r}=this.opts;let n=l;"id"===r&&(n={...l},n.id=n.$id,delete n.$id),t&&e&&this.addMetaSchema(n,n[r],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(r=this.getSchema(e),!r)throw new Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);const n=r(t);return"$async"in r||(this.errors=r.errors),n}compile(e,t){const r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(e,t){await s.call(this,e.$schema);const r=this._addSchema(e,t);return r.validate||a.call(this,r)}async function s(e){e&&!this.getSchema(e)&&await n.call(this,{$ref:e},!0)}async function a(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof o.default))throw t;return i.call(this,t),await c.call(this,t.missingSchema),a.call(this,e)}}function i({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){const r=await u.call(this,e);this.refs[e]||await s.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function u(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,r,n);return this}let o;if("object"==typeof e){const{schemaId:t}=this.opts;if(o=e[t],void 0!==o&&"string"!=typeof o)throw new Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||o),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let r;if(r=e.$schema,void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const n=this.validate(r,e);if(!n&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return n}getSchema(e){let t;for(;"string"==typeof(t=$.call(this,e));)e=t;if(void 0===t){const{schemaId:r}=this.opts,n=new a.SchemaEnv({schema:{},schemaId:r});if(t=a.resolveSchema.call(this,n,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=$.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let r=e[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(r=(t=e).keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(T.call(this,r,t),!t)return(0,d.eachItem)(r,e=>I.call(this,e)),this;j.call(this,t);const n={...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)};return(0,d.eachItem)(r,0===n.type.length?e=>I.call(this,e,n):e=>n.type.forEach(t=>I.call(this,e,n,t))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const r of t.rules){const t=r.rules.findIndex(t=>t.keyword===e);t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map(e=>`${r}${e.instancePath} ${e.message}`).reduce((e,r)=>e+t+r):"No errors"}$dataMetaSchema(e,t){const r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const n of t){const t=n.split("/").slice(1);let o=e;for(const e of t)o=o[e];for(const e in r){const t=r[e];if("object"!=typeof t)continue;const{$data:n}=t.definition,s=o[e];n&&s&&(o[e]=C(s))}}return e}_removeAllSchemas(e,t){for(const r in e){const n=e[r];t&&!t.test(r)||("string"==typeof n?delete e[r]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[r]))}}_addSchema(e,t,r,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let s;const{schemaId:i}=this.opts;if("object"==typeof e)s=e[i];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let u=this._cache.get(e);if(void 0!==u)return u;r=(0,c.normalizeId)(s||r);const d=c.getSchemaRefs.call(this,e,r);return u=new a.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:r,localRefs:d}),this._cache.set(u.schema,u),o&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=u),n&&this.validateSchema(e,!0),u}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):a.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{a.compileSchema.call(this,e)}finally{this.opts=t}}}function w(e,t,r,n="error"){for(const o in e){const s=o;s in t&&this.logger[n](`${r}: option ${o}. ${e[s]}`)}}function $(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function b(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function k(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function E(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}}function S(){const e={...this.opts};for(const t of h)delete e[t];return e}_.ValidationError=n.default,_.MissingRefError=o.default,e.default=_;const P={log(){},warn(){},error(){}};const x=/^[a-z_$][a-z0-9_$:-]*$/i;function T(e,t){const{RULES:r}=this;if((0,d.eachItem)(e,e=>{if(r.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!x.test(e))throw new Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function I(e,t,r){var n;const o=null==t?void 0:t.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:s}=this;let a=o?s.post:s.rules.find(({type:e})=>e===r);if(a||(a={type:r,rules:[]},s.rules.push(a)),s.keywords[e]=!0,!t)return;const i={keyword:e,definition:{...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)}};t.before?z.call(this,a,i,t.before):a.rules.push(i),s.all[e]=i,null===(n=t.implements)||void 0===n||n.forEach(e=>this.addKeyword(e))}function z(e,t,r){const n=e.rules.findIndex(e=>e.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function j(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=C(t)),e.validateSchema=this.compile(t,!0))}const N={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function C(e){return{anyOf:[e,N]}}}(Ya)),Ya}var yc,gc={},_c={},wc={};var $c,bc,kc={};function Ec(){if(bc)return _c;bc=1,Object.defineProperty(_c,"__esModule",{value:!0});const e=function(){if(yc)return wc;yc=1,Object.defineProperty(wc,"__esModule",{value:!0});const e={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return wc.default=e,wc}(),t=function(){if($c)return kc;$c=1,Object.defineProperty(kc,"__esModule",{value:!0}),kc.callRef=kc.getValidate=void 0;const e=ec(),t=Oi(),r=ui(),n=yi(),o=nc(),s=fi(),a={keyword:"$ref",schemaType:"string",code(t){const{gen:n,schema:s,it:a}=t,{baseId:u,schemaEnv:d,validateName:l,opts:f,self:p}=a,{root:h}=d;if(("#"===s||"#/"===s)&&u===h.baseId)return function(){if(d===h)return c(t,l,d,d.$async);const e=n.scopeValue("root",{ref:h});return c(t,r._`${e}.validate`,h,h.$async)}();const m=o.resolveRef.call(p,h,u,s);if(void 0===m)throw new e.default(a.opts.uriResolver,u,s);return m instanceof o.SchemaEnv?function(e){const r=i(t,e);c(t,r,e,e.$async)}(m):function(e){const o=n.scopeValue("schema",!0===f.code.source?{ref:e,code:(0,r.stringify)(e)}:{ref:e}),a=n.name("valid"),i=t.subschema({schema:e,dataTypes:[],schemaPath:r.nil,topSchemaRef:o,errSchemaPath:s},a);t.mergeEvaluated(i),t.ok(a)}(m)}};function i(e,t){const{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):r._`${n.scopeValue("wrapper",{ref:t})}.validate`}function c(e,o,a,i){const{gen:c,it:u}=e,{allErrors:d,schemaEnv:l,opts:f}=u,p=f.passContext?n.default.this:r.nil;function h(e){const t=r._`${e}.errors`;c.assign(n.default.vErrors,r._`${n.default.vErrors} === null ? ${t} : ${n.default.vErrors}.concat(${t})`),c.assign(n.default.errors,r._`${n.default.vErrors}.length`)}function m(e){var t;if(!u.opts.unevaluated)return;const n=null===(t=null==a?void 0:a.validate)||void 0===t?void 0:t.evaluated;if(!0!==u.props)if(n&&!n.dynamicProps)void 0!==n.props&&(u.props=s.mergeEvaluated.props(c,n.props,u.props));else{const t=c.var("props",r._`${e}.evaluated.props`);u.props=s.mergeEvaluated.props(c,t,u.props,r.Name)}if(!0!==u.items)if(n&&!n.dynamicItems)void 0!==n.items&&(u.items=s.mergeEvaluated.items(c,n.items,u.items));else{const t=c.var("items",r._`${e}.evaluated.items`);u.items=s.mergeEvaluated.items(c,t,u.items,r.Name)}}i?function(){if(!l.$async)throw new Error("async schema referenced by sync schema");const n=c.let("valid");c.try(()=>{c.code(r._`await ${(0,t.callValidateCode)(e,o,p)}`),m(o),d||c.assign(n,!0)},e=>{c.if(r._`!(${e} instanceof ${u.ValidationError})`,()=>c.throw(e)),h(e),d||c.assign(n,!1)}),e.ok(n)}():e.result((0,t.callValidateCode)(e,o,p),()=>m(o),()=>h(o))}return kc.getValidate=i,kc.callRef=c,kc.default=a,kc}(),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",e.default,t.default];return _c.default=r,_c}var Sc,Pc={},xc={};var Tc,Ic={};var zc,jc,Nc={},Cc={};function Oc(){if(jc)return Nc;jc=1,Object.defineProperty(Nc,"__esModule",{value:!0});const e=ui(),t=fi(),r=function(){if(zc)return Cc;function e(e){const t=e.length;let r,n=0,o=0;for(;o<t;)n++,r=e.charCodeAt(o++),r>=55296&&r<=56319&&o<t&&(r=e.charCodeAt(o),56320==(64512&r)&&o++);return n}return zc=1,Object.defineProperty(Cc,"__esModule",{value:!0}),Cc.default=e,e.code='require("ajv/dist/runtime/ucs2length").default',Cc}(),n={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:r}){const n="maxLength"===t?"more":"fewer";return e.str`must NOT have ${n} than ${r} characters`},params:({schemaCode:t})=>e._`{limit: ${t}}`},code(n){const{keyword:o,data:s,schemaCode:a,it:i}=n,c="maxLength"===o?e.operators.GT:e.operators.LT,u=!1===i.opts.unicode?e._`${s}.length`:e._`${(0,t.useFunc)(n.gen,r.default)}(${s})`;n.fail$data(e._`${u} ${c} ${a}`)}};return Nc.default=n,Nc}var Rc,Ac={};var qc,Mc={};var Dc,Vc={};function Uc(){if(Dc)return Vc;Dc=1,Object.defineProperty(Vc,"__esModule",{value:!0});const e=Oi(),t=ui(),r=fi(),n={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>t.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>t._`{missingProperty: ${e}}`},code(n){const{gen:o,schema:s,schemaCode:a,data:i,$data:c,it:u}=n,{opts:d}=u;if(!c&&0===s.length)return;const l=s.length>=d.loopRequired;if(u.allErrors?function(){if(l||c)n.block$data(t.nil,f);else for(const t of s)(0,e.checkReportMissingProp)(n,t)}():function(){const r=o.let("missing");if(l||c){const s=o.let("valid",!0);n.block$data(s,()=>function(r,s){n.setParams({missingProperty:r}),o.forOf(r,a,()=>{o.assign(s,(0,e.propertyInData)(o,i,r,d.ownProperties)),o.if((0,t.not)(s),()=>{n.error(),o.break()})},t.nil)}(r,s)),n.ok(s)}else o.if((0,e.checkMissingProp)(n,s,r)),(0,e.reportMissingProp)(n,r),o.else()}(),d.strictRequired){const e=n.parentSchema.properties,{definedProperties:t}=n.it;for(const n of s)if(void 0===(null==e?void 0:e[n])&&!t.has(n)){const e=`required property "${n}" is not defined at "${u.schemaEnv.baseId+u.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(u,e,u.opts.strictRequired)}}function f(){o.forOf("prop",a,t=>{n.setParams({missingProperty:t}),o.if((0,e.noPropertyInData)(o,i,t,d.ownProperties),()=>n.error())})}}};return Vc.default=n,Vc}var Fc,Zc={};var Lc,Hc,Kc={},Gc={};function Jc(){if(Lc)return Gc;Lc=1,Object.defineProperty(Gc,"__esModule",{value:!0});const e=Ui();return e.code='require("ajv/dist/runtime/equal").default',Gc.default=e,Gc}function Bc(){if(Hc)return Kc;Hc=1,Object.defineProperty(Kc,"__esModule",{value:!0});const e=xi(),t=ui(),r=fi(),n=Jc(),o={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:r}})=>t.str`must NOT have duplicate items (items ## ${r} and ${e} are identical)`,params:({params:{i:e,j:r}})=>t._`{i: ${e}, j: ${r}}`},code(o){const{gen:s,data:a,$data:i,schema:c,parentSchema:u,schemaCode:d,it:l}=o;if(!i&&!c)return;const f=s.let("valid"),p=u.items?(0,e.getSchemaTypes)(u.items):[];function h(r,n){const i=s.name("item"),c=(0,e.checkDataTypes)(p,i,l.opts.strictNumbers,e.DataType.Wrong),u=s.const("indices",t._`{}`);s.for(t._`;${r}--;`,()=>{s.let(i,t._`${a}[${r}]`),s.if(c,t._`continue`),p.length>1&&s.if(t._`typeof ${i} == "string"`,t._`${i} += "_"`),s.if(t._`typeof ${u}[${i}] == "number"`,()=>{s.assign(n,t._`${u}[${i}]`),o.error(),s.assign(f,!1).break()}).code(t._`${u}[${i}] = ${r}`)})}function m(e,i){const c=(0,r.useFunc)(s,n.default),u=s.name("outer");s.label(u).for(t._`;${e}--;`,()=>s.for(t._`${i} = ${e}; ${i}--;`,()=>s.if(t._`${c}(${a}[${e}], ${a}[${i}])`,()=>{o.error(),s.assign(f,!1).break(u)})))}o.block$data(f,function(){const e=s.let("i",t._`${a}.length`),r=s.let("j");o.setParams({i:e,j:r}),s.assign(f,!0),s.if(t._`${e} > 1`,()=>(p.length>0&&!p.some(e=>"object"===e||"array"===e)?h:m)(e,r))},t._`${d} === false`),o.ok(f)}};return Kc.default=o,Kc}var Wc,Qc={};var Yc,Xc,eu={};function tu(){if(Yc)return eu;Yc=1,Object.defineProperty(eu,"__esModule",{value:!0});const e=ui(),t=fi(),r=Jc(),n={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>e._`{allowedValues: ${t}}`},code(n){const{gen:o,data:s,$data:a,schema:i,schemaCode:c,it:u}=n;if(!a&&0===i.length)throw new Error("enum must have non-empty array");const d=i.length>=u.opts.loopEnum;let l;const f=()=>null!=l?l:l=(0,t.useFunc)(o,r.default);let p;if(d||a)p=o.let("valid"),n.block$data(p,function(){o.assign(p,!1),o.forOf("v",c,t=>o.if(e._`${f()}(${s}, ${t})`,()=>o.assign(p,!0).break()))});else{if(!Array.isArray(i))throw new Error("ajv implementation error");const t=o.const("vSchema",c);p=(0,e.or)(...i.map((r,n)=>function(t,r){const n=i[r];return"object"==typeof n&&null!==n?e._`${f()}(${s}, ${t}[${r}])`:e._`${s} === ${n}`}(t,n)))}n.pass(p)}};return eu.default=n,eu}function ru(){if(Xc)return Pc;Xc=1,Object.defineProperty(Pc,"__esModule",{value:!0});const e=function(){if(Sc)return xc;Sc=1,Object.defineProperty(xc,"__esModule",{value:!0});const e=ui(),t=e.operators,r={maximum:{okStr:"<=",ok:t.LTE,fail:t.GT},minimum:{okStr:">=",ok:t.GTE,fail:t.LT},exclusiveMaximum:{okStr:"<",ok:t.LT,fail:t.GTE},exclusiveMinimum:{okStr:">",ok:t.GT,fail:t.LTE}},n={message:({keyword:t,schemaCode:n})=>e.str`must be ${r[t].okStr} ${n}`,params:({keyword:t,schemaCode:n})=>e._`{comparison: ${r[t].okStr}, limit: ${n}}`},o={keyword:Object.keys(r),type:"number",schemaType:"number",$data:!0,error:n,code(t){const{keyword:n,data:o,schemaCode:s}=t;t.fail$data(e._`${o} ${r[n].fail} ${s} || isNaN(${o})`)}};return xc.default=o,xc}(),t=function(){if(Tc)return Ic;Tc=1,Object.defineProperty(Ic,"__esModule",{value:!0});const e=ui(),t={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>e.str`must be multiple of ${t}`,params:({schemaCode:t})=>e._`{multipleOf: ${t}}`},code(t){const{gen:r,data:n,schemaCode:o,it:s}=t,a=s.opts.multipleOfPrecision,i=r.let("res"),c=a?e._`Math.abs(Math.round(${i}) - ${i}) > 1e-${a}`:e._`${i} !== parseInt(${i})`;t.fail$data(e._`(${o} === 0 || (${i} = ${n}/${o}, ${c}))`)}};return Ic.default=t,Ic}(),r=Oc(),n=function(){if(Rc)return Ac;Rc=1,Object.defineProperty(Ac,"__esModule",{value:!0});const e=Oi(),t=ui(),r={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>t.str`must match pattern "${e}"`,params:({schemaCode:e})=>t._`{pattern: ${e}}`},code(r){const{data:n,$data:o,schema:s,schemaCode:a,it:i}=r,c=i.opts.unicodeRegExp?"u":"",u=o?t._`(new RegExp(${a}, ${c}))`:(0,e.usePattern)(r,s);r.fail$data(t._`!${u}.test(${n})`)}};return Ac.default=r,Ac}(),o=function(){if(qc)return Mc;qc=1,Object.defineProperty(Mc,"__esModule",{value:!0});const e=ui(),t={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:r}){const n="maxProperties"===t?"more":"fewer";return e.str`must NOT have ${n} than ${r} properties`},params:({schemaCode:t})=>e._`{limit: ${t}}`},code(t){const{keyword:r,data:n,schemaCode:o}=t,s="maxProperties"===r?e.operators.GT:e.operators.LT;t.fail$data(e._`Object.keys(${n}).length ${s} ${o}`)}};return Mc.default=t,Mc}(),s=Uc(),a=function(){if(Fc)return Zc;Fc=1,Object.defineProperty(Zc,"__esModule",{value:!0});const e=ui(),t={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:r}){const n="maxItems"===t?"more":"fewer";return e.str`must NOT have ${n} than ${r} items`},params:({schemaCode:t})=>e._`{limit: ${t}}`},code(t){const{keyword:r,data:n,schemaCode:o}=t,s="maxItems"===r?e.operators.GT:e.operators.LT;t.fail$data(e._`${n}.length ${s} ${o}`)}};return Zc.default=t,Zc}(),i=Bc(),c=function(){if(Wc)return Qc;Wc=1,Object.defineProperty(Qc,"__esModule",{value:!0});const e=ui(),t=fi(),r=Jc(),n={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>e._`{allowedValue: ${t}}`},code(n){const{gen:o,data:s,$data:a,schemaCode:i,schema:c}=n;a||c&&"object"==typeof c?n.fail$data(e._`!${(0,t.useFunc)(o,r.default)}(${s}, ${i})`):n.fail(e._`${c} !== ${s}`)}};return Qc.default=n,Qc}(),u=tu(),d=[e.default,t.default,r.default,n.default,o.default,s.default,a.default,i.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},c.default,u.default];return Pc.default=d,Pc}var nu,ou={},su={};function au(){if(nu)return su;nu=1,Object.defineProperty(su,"__esModule",{value:!0}),su.validateAdditionalItems=void 0;const e=ui(),t=fi(),r={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>e.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>e._`{limit: ${t}}`},code(e){const{parentSchema:r,it:o}=e,{items:s}=r;Array.isArray(s)?n(e,s):(0,t.checkStrictMode)(o,'"additionalItems" is ignored when "items" is not an array of schemas')}};function n(r,n){const{gen:o,schema:s,data:a,keyword:i,it:c}=r;c.items=!0;const u=o.const("len",e._`${a}.length`);if(!1===s)r.setParams({len:n.length}),r.pass(e._`${u} <= ${n.length}`);else if("object"==typeof s&&!(0,t.alwaysValidSchema)(c,s)){const s=o.var("valid",e._`${u} <= ${n.length}`);o.if((0,e.not)(s),()=>function(s){o.forRange("i",n.length,u,n=>{r.subschema({keyword:i,dataProp:n,dataPropType:t.Type.Num},s),c.allErrors||o.if((0,e.not)(s),()=>o.break())})}(s)),r.ok(s)}}return su.validateAdditionalItems=n,su.default=r,su}var iu,cu,uu={},du={};function lu(){if(iu)return du;iu=1,Object.defineProperty(du,"__esModule",{value:!0}),du.validateTuple=void 0;const e=ui(),t=fi(),r=Oi(),n={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:n,it:s}=e;if(Array.isArray(n))return o(e,"additionalItems",n);s.items=!0,(0,t.alwaysValidSchema)(s,n)||e.ok((0,r.validateArray)(e))}};function o(r,n,o=r.schema){const{gen:s,parentSchema:a,data:i,keyword:c,it:u}=r;!function(e){const{opts:r,errSchemaPath:s}=u,a=o.length,i=a===e.minItems&&(a===e.maxItems||!1===e[n]);if(r.strictTuples&&!i){const e=`"${c}" is ${a}-tuple, but minItems or maxItems/${n} are not specified or different at path "${s}"`;(0,t.checkStrictMode)(u,e,r.strictTuples)}}(a),u.opts.unevaluated&&o.length&&!0!==u.items&&(u.items=t.mergeEvaluated.items(s,o.length,u.items));const d=s.name("valid"),l=s.const("len",e._`${i}.length`);o.forEach((n,o)=>{(0,t.alwaysValidSchema)(u,n)||(s.if(e._`${l} > ${o}`,()=>r.subschema({keyword:c,schemaProp:o,dataProp:o},d)),r.ok(d))})}return du.validateTuple=o,du.default=n,du}var fu,pu={};var hu,mu={};function vu(){if(hu)return mu;hu=1,Object.defineProperty(mu,"__esModule",{value:!0});const e=ui(),t=fi(),r={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:r}})=>void 0===r?e.str`must contain at least ${t} valid item(s)`:e.str`must contain at least ${t} and no more than ${r} valid item(s)`,params:({params:{min:t,max:r}})=>void 0===r?e._`{minContains: ${t}}`:e._`{minContains: ${t}, maxContains: ${r}}`},code(r){const{gen:n,schema:o,parentSchema:s,data:a,it:i}=r;let c,u;const{minContains:d,maxContains:l}=s;i.opts.next?(c=void 0===d?1:d,u=l):c=1;const f=n.const("len",e._`${a}.length`);if(r.setParams({min:c,max:u}),void 0===u&&0===c)return void(0,t.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==u&&c>u)return(0,t.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),void r.fail();if((0,t.alwaysValidSchema)(i,o)){let t=e._`${f} >= ${c}`;return void 0!==u&&(t=e._`${t} && ${f} <= ${u}`),void r.pass(t)}i.items=!0;const p=n.name("valid");function h(){const t=n.name("_valid"),r=n.let("count",0);m(t,()=>n.if(t,()=>function(t){n.code(e._`${t}++`),void 0===u?n.if(e._`${t} >= ${c}`,()=>n.assign(p,!0).break()):(n.if(e._`${t} > ${u}`,()=>n.assign(p,!1).break()),1===c?n.assign(p,!0):n.if(e._`${t} >= ${c}`,()=>n.assign(p,!0)))}(r)))}function m(e,o){n.forRange("i",0,f,n=>{r.subschema({keyword:"contains",dataProp:n,dataPropType:t.Type.Num,compositeRule:!0},e),o()})}void 0===u&&1===c?m(p,()=>n.if(p,()=>n.break())):0===c?(n.let(p,!0),void 0!==u&&n.if(e._`${a}.length > 0`,h)):(n.let(p,!1),h()),r.result(p,()=>r.reset())}};return mu.default=r,mu}var yu,gu={};function _u(){return yu||(yu=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=ui(),r=fi(),n=Oi();e.error={message:({params:{property:e,depsCount:r,deps:n}})=>{const o=1===r?"property":"properties";return t.str`must have ${o} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:r,deps:n,missingProperty:o}})=>t._`{property: ${e},
|
|
5
|
-
missingProperty: ${o},
|
|
6
|
-
depsCount: ${r},
|
|
7
|
-
deps: ${n}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(e){const[t,r]=function({schema:e}){const t={},r={};for(const n in e){if("__proto__"===n)continue;(Array.isArray(e[n])?t:r)[n]=e[n]}return[t,r]}(e);s(e,t),a(e,r)}};function s(e,r=e.schema){const{gen:o,data:s,it:a}=e;if(0===Object.keys(r).length)return;const i=o.let("missing");for(const c in r){const u=r[c];if(0===u.length)continue;const d=(0,n.propertyInData)(o,s,c,a.opts.ownProperties);e.setParams({property:c,depsCount:u.length,deps:u.join(", ")}),a.allErrors?o.if(d,()=>{for(const t of u)(0,n.checkReportMissingProp)(e,t)}):(o.if(t._`${d} && (${(0,n.checkMissingProp)(e,u,i)})`),(0,n.reportMissingProp)(e,i),o.else())}}function a(e,t=e.schema){const{gen:o,data:s,keyword:a,it:i}=e,c=o.name("valid");for(const u in t)(0,r.alwaysValidSchema)(i,t[u])||(o.if((0,n.propertyInData)(o,s,u,i.opts.ownProperties),()=>{const t=e.subschema({keyword:a,schemaProp:u},c);e.mergeValidEvaluated(t,c)},()=>o.var(c,!0)),e.ok(c))}e.validatePropertyDeps=s,e.validateSchemaDeps=a,e.default=o}(gu)),gu}var wu,$u={};var bu,ku={};function Eu(){if(bu)return ku;bu=1,Object.defineProperty(ku,"__esModule",{value:!0});const e=Oi(),t=ui(),r=yi(),n=fi(),o={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>t._`{additionalProperty: ${e.additionalProperty}}`},code(o){const{gen:s,schema:a,parentSchema:i,data:c,errsCount:u,it:d}=o;if(!u)throw new Error("ajv implementation error");const{allErrors:l,opts:f}=d;if(d.props=!0,"all"!==f.removeAdditional&&(0,n.alwaysValidSchema)(d,a))return;const p=(0,e.allSchemaProperties)(i.properties),h=(0,e.allSchemaProperties)(i.patternProperties);function m(e){s.code(t._`delete ${c}[${e}]`)}function v(e){if("all"===f.removeAdditional||f.removeAdditional&&!1===a)m(e);else{if(!1===a)return o.setParams({additionalProperty:e}),o.error(),void(l||s.break());if("object"==typeof a&&!(0,n.alwaysValidSchema)(d,a)){const r=s.name("valid");"failing"===f.removeAdditional?(y(e,r,!1),s.if((0,t.not)(r),()=>{o.reset(),m(e)})):(y(e,r),l||s.if((0,t.not)(r),()=>s.break()))}}}function y(e,t,r){const s={keyword:"additionalProperties",dataProp:e,dataPropType:n.Type.Str};!1===r&&Object.assign(s,{compositeRule:!0,createErrors:!1,allErrors:!1}),o.subschema(s,t)}s.forIn("key",c,r=>{p.length||h.length?s.if(function(r){let a;if(p.length>8){const t=(0,n.schemaRefOrVal)(d,i.properties,"properties");a=(0,e.isOwnProperty)(s,t,r)}else a=p.length?(0,t.or)(...p.map(e=>t._`${r} === ${e}`)):t.nil;return h.length&&(a=(0,t.or)(a,...h.map(n=>t._`${(0,e.usePattern)(o,n)}.test(${r})`))),(0,t.not)(a)}(r),()=>v(r)):v(r)}),o.ok(t._`${u} === ${r.default.errors}`)}};return ku.default=o,ku}var Su,Pu={};var xu,Tu={};var Iu,zu={};var ju,Nu={};var Cu,Ou={};var Ru,Au={};var qu,Mu={};var Du,Vu,Uu={};function Fu(){if(Vu)return ou;Vu=1,Object.defineProperty(ou,"__esModule",{value:!0});const e=au(),t=function(){if(cu)return uu;cu=1,Object.defineProperty(uu,"__esModule",{value:!0});const e=lu(),t={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,e.validateTuple)(t,"items")};return uu.default=t,uu}(),r=lu(),n=function(){if(fu)return pu;fu=1,Object.defineProperty(pu,"__esModule",{value:!0});const e=ui(),t=fi(),r=Oi(),n=au(),o={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>e.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>e._`{limit: ${t}}`},code(e){const{schema:o,parentSchema:s,it:a}=e,{prefixItems:i}=s;a.items=!0,(0,t.alwaysValidSchema)(a,o)||(i?(0,n.validateAdditionalItems)(e,i):e.ok((0,r.validateArray)(e)))}};return pu.default=o,pu}(),o=vu(),s=_u(),a=function(){if(wu)return $u;wu=1,Object.defineProperty($u,"__esModule",{value:!0});const e=ui(),t=fi(),r={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>e._`{propertyName: ${t.propertyName}}`},code(r){const{gen:n,schema:o,data:s,it:a}=r;if((0,t.alwaysValidSchema)(a,o))return;const i=n.name("valid");n.forIn("key",s,t=>{r.setParams({propertyName:t}),r.subschema({keyword:"propertyNames",data:t,dataTypes:["string"],propertyName:t,compositeRule:!0},i),n.if((0,e.not)(i),()=>{r.error(!0),a.allErrors||n.break()})}),r.ok(i)}};return $u.default=r,$u}(),i=Eu(),c=function(){if(Su)return Pu;Su=1,Object.defineProperty(Pu,"__esModule",{value:!0});const e=Ji(),t=Oi(),r=fi(),n=Eu(),o={keyword:"properties",type:"object",schemaType:"object",code(o){const{gen:s,schema:a,parentSchema:i,data:c,it:u}=o;"all"===u.opts.removeAdditional&&void 0===i.additionalProperties&&n.default.code(new e.KeywordCxt(u,n.default,"additionalProperties"));const d=(0,t.allSchemaProperties)(a);for(const e of d)u.definedProperties.add(e);u.opts.unevaluated&&d.length&&!0!==u.props&&(u.props=r.mergeEvaluated.props(s,(0,r.toHash)(d),u.props));const l=d.filter(e=>!(0,r.alwaysValidSchema)(u,a[e]));if(0===l.length)return;const f=s.name("valid");for(const e of l)p(e)?h(e):(s.if((0,t.propertyInData)(s,c,e,u.opts.ownProperties)),h(e),u.allErrors||s.else().var(f,!0),s.endIf()),o.it.definedProperties.add(e),o.ok(f);function p(e){return u.opts.useDefaults&&!u.compositeRule&&void 0!==a[e].default}function h(e){o.subschema({keyword:"properties",schemaProp:e,dataProp:e},f)}}};return Pu.default=o,Pu}(),u=function(){if(xu)return Tu;xu=1,Object.defineProperty(Tu,"__esModule",{value:!0});const e=Oi(),t=ui(),r=fi(),n=fi(),o={keyword:"patternProperties",type:"object",schemaType:"object",code(o){const{gen:s,schema:a,data:i,parentSchema:c,it:u}=o,{opts:d}=u,l=(0,e.allSchemaProperties)(a),f=l.filter(e=>(0,r.alwaysValidSchema)(u,a[e]));if(0===l.length||f.length===l.length&&(!u.opts.unevaluated||!0===u.props))return;const p=d.strictSchema&&!d.allowMatchingProperties&&c.properties,h=s.name("valid");!0===u.props||u.props instanceof t.Name||(u.props=(0,n.evaluatedPropsToName)(s,u.props));const{props:m}=u;function v(e){for(const t in p)new RegExp(e).test(t)&&(0,r.checkStrictMode)(u,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function y(r){s.forIn("key",i,a=>{s.if(t._`${(0,e.usePattern)(o,r)}.test(${a})`,()=>{const e=f.includes(r);e||o.subschema({keyword:"patternProperties",schemaProp:r,dataProp:a,dataPropType:n.Type.Str},h),u.opts.unevaluated&&!0!==m?s.assign(t._`${m}[${a}]`,!0):e||u.allErrors||s.if((0,t.not)(h),()=>s.break())})})}!function(){for(const e of l)p&&v(e),u.allErrors?y(e):(s.var(h,!0),y(e),s.if(h))}()}};return Tu.default=o,Tu}(),d=function(){if(Iu)return zu;Iu=1,Object.defineProperty(zu,"__esModule",{value:!0});const e=fi(),t={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:r,schema:n,it:o}=t;if((0,e.alwaysValidSchema)(o,n))return void t.fail();const s=r.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),t.failResult(s,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};return zu.default=t,zu}(),l=function(){if(ju)return Nu;ju=1,Object.defineProperty(Nu,"__esModule",{value:!0});const e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Oi().validateUnion,error:{message:"must match a schema in anyOf"}};return Nu.default=e,Nu}(),f=function(){if(Cu)return Ou;Cu=1,Object.defineProperty(Ou,"__esModule",{value:!0});const e=ui(),t=fi(),r={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>e._`{passingSchemas: ${t.passing}}`},code(r){const{gen:n,schema:o,parentSchema:s,it:a}=r;if(!Array.isArray(o))throw new Error("ajv implementation error");if(a.opts.discriminator&&s.discriminator)return;const i=o,c=n.let("valid",!1),u=n.let("passing",null),d=n.name("_valid");r.setParams({passing:u}),n.block(function(){i.forEach((o,s)=>{let i;(0,t.alwaysValidSchema)(a,o)?n.var(d,!0):i=r.subschema({keyword:"oneOf",schemaProp:s,compositeRule:!0},d),s>0&&n.if(e._`${d} && ${c}`).assign(c,!1).assign(u,e._`[${u}, ${s}]`).else(),n.if(d,()=>{n.assign(c,!0),n.assign(u,s),i&&r.mergeEvaluated(i,e.Name)})})}),r.result(c,()=>r.reset(),()=>r.error(!0))}};return Ou.default=r,Ou}(),p=function(){if(Ru)return Au;Ru=1,Object.defineProperty(Au,"__esModule",{value:!0});const e=fi(),t={keyword:"allOf",schemaType:"array",code(t){const{gen:r,schema:n,it:o}=t;if(!Array.isArray(n))throw new Error("ajv implementation error");const s=r.name("valid");n.forEach((r,n)=>{if((0,e.alwaysValidSchema)(o,r))return;const a=t.subschema({keyword:"allOf",schemaProp:n},s);t.ok(s),t.mergeEvaluated(a)})}};return Au.default=t,Au}(),h=function(){if(qu)return Mu;qu=1,Object.defineProperty(Mu,"__esModule",{value:!0});const e=ui(),t=fi(),r={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>e.str`must match "${t.ifClause}" schema`,params:({params:t})=>e._`{failingKeyword: ${t.ifClause}}`},code(r){const{gen:o,parentSchema:s,it:a}=r;void 0===s.then&&void 0===s.else&&(0,t.checkStrictMode)(a,'"if" without "then" and "else" is ignored');const i=n(a,"then"),c=n(a,"else");if(!i&&!c)return;const u=o.let("valid",!0),d=o.name("_valid");if(function(){const e=r.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},d);r.mergeEvaluated(e)}(),r.reset(),i&&c){const e=o.let("ifClause");r.setParams({ifClause:e}),o.if(d,l("then",e),l("else",e))}else i?o.if(d,l("then")):o.if((0,e.not)(d),l("else"));function l(t,n){return()=>{const s=r.subschema({keyword:t},d);o.assign(u,d),r.mergeValidEvaluated(s,u),n?o.assign(n,e._`${t}`):r.setParams({ifClause:t})}}r.pass(u,()=>r.error(!0))}};function n(e,r){const n=e.schema[r];return void 0!==n&&!(0,t.alwaysValidSchema)(e,n)}return Mu.default=r,Mu}(),m=function(){if(Du)return Uu;Du=1,Object.defineProperty(Uu,"__esModule",{value:!0});const e=fi(),t={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:r,it:n}){void 0===r.if&&(0,e.checkStrictMode)(n,`"${t}" without "if" is ignored`)}};return Uu.default=t,Uu}();return ou.default=function(v=!1){const y=[d.default,l.default,f.default,p.default,h.default,m.default,a.default,i.default,s.default,c.default,u.default];return v?y.push(t.default,n.default):y.push(e.default,r.default),y.push(o.default),y},ou}var Zu,Lu,Hu={},Ku={};function Gu(){if(Lu)return Hu;Lu=1,Object.defineProperty(Hu,"__esModule",{value:!0});const e=function(){if(Zu)return Ku;Zu=1,Object.defineProperty(Ku,"__esModule",{value:!0});const e=ui(),t={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>e.str`must match format "${t}"`,params:({schemaCode:t})=>e._`{format: ${t}}`},code(t,r){const{gen:n,data:o,$data:s,schema:a,schemaCode:i,it:c}=t,{opts:u,errSchemaPath:d,schemaEnv:l,self:f}=c;u.validateFormats&&(s?function(){const s=n.scopeValue("formats",{ref:f.formats,code:u.code.formats}),a=n.const("fDef",e._`${s}[${i}]`),c=n.let("fType"),d=n.let("format");n.if(e._`typeof ${a} == "object" && !(${a} instanceof RegExp)`,()=>n.assign(c,e._`${a}.type || "string"`).assign(d,e._`${a}.validate`),()=>n.assign(c,e._`"string"`).assign(d,a)),t.fail$data((0,e.or)(!1===u.strictSchema?e.nil:e._`${i} && !${d}`,function(){const t=l.$async?e._`(${a}.async ? await ${d}(${o}) : ${d}(${o}))`:e._`${d}(${o})`,n=e._`(typeof ${d} == "function" ? ${t} : ${d}.test(${o}))`;return e._`${d} && ${d} !== true && ${c} === ${r} && !${n}`}()))}():function(){const s=f.formats[a];if(!s)return void function(){if(!1!==u.strictSchema)throw new Error(e());function e(){return`unknown format "${a}" ignored in schema at path "${d}"`}f.logger.warn(e())}();if(!0===s)return;const[i,c,p]=function(t){const r=t instanceof RegExp?(0,e.regexpCode)(t):u.code.formats?e._`${u.code.formats}${(0,e.getProperty)(a)}`:void 0,o=n.scopeValue("formats",{key:a,ref:t,code:r});return"object"!=typeof t||t instanceof RegExp?["string",t,o]:[t.type||"string",t.validate,e._`${o}.validate`]}(s);i===r&&t.pass(function(){if("object"==typeof s&&!(s instanceof RegExp)&&s.async){if(!l.$async)throw new Error("async format in sync schema");return e._`await ${p}(${o})`}return"function"==typeof c?e._`${p}(${o})`:e._`${p}.test(${o})`}())}())}};return Ku.default=t,Ku}(),t=[e.default];return Hu.default=t,Hu}var Ju,Bu,Wu={};function Qu(){if(Bu)return gc;Bu=1,Object.defineProperty(gc,"__esModule",{value:!0});const e=Ec(),t=ru(),r=Fu(),n=Gu(),o=(Ju||(Ju=1,Object.defineProperty(Wu,"__esModule",{value:!0}),Wu.contentVocabulary=Wu.metadataVocabulary=void 0,Wu.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],Wu.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),Wu),s=[e.default,t.default,(0,r.default)(),n.default,o.metadataVocabulary,o.contentVocabulary];return gc.default=s,gc}var Yu,Xu,ed={},td={};function rd(){if(Xu)return ed;Xu=1,Object.defineProperty(ed,"__esModule",{value:!0});const e=ui(),t=(Yu||(Yu=1,Object.defineProperty(td,"__esModule",{value:!0}),td.DiscrError=void 0,(n=r||(td.DiscrError=r={})).Tag="tag",n.Mapping="mapping"),td);var r,n;const o=nc(),s=ec(),a=fi(),i={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:r}})=>e===t.DiscrError.Tag?`tag "${r}" must be string`:`value of tag "${r}" must be in oneOf`,params:({params:{discrError:t,tag:r,tagName:n}})=>e._`{error: ${t}, tag: ${n}, tagValue: ${r}}`},code(r){const{gen:n,data:i,schema:c,parentSchema:u,it:d}=r,{oneOf:l}=u;if(!d.opts.discriminator)throw new Error("discriminator: requires discriminator option");const f=c.propertyName;if("string"!=typeof f)throw new Error("discriminator: requires propertyName");if(c.mapping)throw new Error("discriminator: mapping is not supported");if(!l)throw new Error("discriminator: requires oneOf keyword");const p=n.let("valid",!1),h=n.const("tag",e._`${i}${(0,e.getProperty)(f)}`);function m(t){const o=n.name("valid"),s=r.subschema({keyword:"oneOf",schemaProp:t},o);return r.mergeEvaluated(s,e.Name),o}n.if(e._`typeof ${h} == "string"`,()=>function(){const i=function(){var e;const t={},r=i(u);let n=!0;for(let u=0;u<l.length;u++){let t=l[u];if((null==t?void 0:t.$ref)&&!(0,a.schemaHasRulesButRef)(t,d.self.RULES)){const e=t.$ref;if(t=o.resolveRef.call(d.self,d.schemaEnv.root,d.baseId,e),t instanceof o.SchemaEnv&&(t=t.schema),void 0===t)throw new s.default(d.opts.uriResolver,d.baseId,e)}const p=null===(e=null==t?void 0:t.properties)||void 0===e?void 0:e[f];if("object"!=typeof p)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);n=n&&(r||i(t)),c(p,u)}if(!n)throw new Error(`discriminator: "${f}" must be required`);return t;function i({required:e}){return Array.isArray(e)&&e.includes(f)}function c(e,t){if(e.const)p(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${f}" must have "const" or "enum"`);for(const r of e.enum)p(r,t)}}function p(e,r){if("string"!=typeof e||e in t)throw new Error(`discriminator: "${f}" values must be unique strings`);t[e]=r}}();n.if(!1);for(const t in i)n.elseIf(e._`${h} === ${t}`),n.assign(p,m(i[t]));n.else(),r.error(!1,{discrError:t.DiscrError.Mapping,tag:h,tagName:f}),n.endIf()}(),()=>r.error(!1,{discrError:t.DiscrError.Tag,tag:h,tagName:f})),r.ok(p)}};return ed.default=i,ed}const nd={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0};var od;function sd(){return od||(od=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;const r=vc(),n=Qu(),o=rd(),s=nd,a=["/properties"],i="http://json-schema.org/draft-07/schema";class c extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(s,a):s;this.addMetaSchema(e,i,!1),this.refs["http://json-schema.org/schema"]=i}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}}t.Ajv=c,e.exports=t=c,e.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var u=Ji();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=ui();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var l=Qi();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return l.default}});var f=ec();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return f.default}})}(Qa,Qa.exports)),Qa.exports}var ad,id=sd(),cd={exports:{}},ud={};var dd,ld,fd={};var pd=(ld||(ld=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=(ad||(ad=1,function(e){function t(e,t){return{validate:e,compare:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0,e.fullFormats={date:t(o,s),time:t(i(!0),c),"date-time":t(l(!0),f),"iso-time":t(i(),u),"iso-date-time":t(l(),p),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(e){return h.test(e)&&m.test(e)},"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:function(e){if(w.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}},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:function(e){return v.lastIndex=0,v.test(e)},int32:{type:"number",validate:function(e){return Number.isInteger(e)&&e<=g&&e>=y}},int64:{type:"number",validate:function(e){return Number.isInteger(e)}},float:{type:"number",validate:_},double:{type:"number",validate:_},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,s),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,c),"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,f),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,p),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);const r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,n=[0,31,28,31,30,31,30,31,31,30,31,30,31];function o(e){const t=r.exec(e);if(!t)return!1;const o=+t[1],s=+t[2],a=+t[3];return s>=1&&s<=12&&a>=1&&a<=(2===s&&function(e){return e%4==0&&(e%100!=0||e%400==0)}(o)?29:n[s])}function s(e,t){if(e&&t)return e>t?1:e<t?-1:0}const a=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function i(e){return function(t){const r=a.exec(t);if(!r)return!1;const n=+r[1],o=+r[2],s=+r[3],i=r[4],c="-"===r[5]?-1:1,u=+(r[6]||0),d=+(r[7]||0);if(u>23||d>59||e&&!i)return!1;if(n<=23&&o<=59&&s<60)return!0;const l=o-d*c,f=n-u*c-(l<0?1:0);return(23===f||-1===f)&&(59===l||-1===l)&&s<61}}function c(e,t){if(!e||!t)return;const r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();return r&&n?r-n:void 0}function u(e,t){if(!e||!t)return;const r=a.exec(e),n=a.exec(t);return r&&n?(e=r[1]+r[2]+r[3])>(t=n[1]+n[2]+n[3])?1:e<t?-1:0:void 0}const d=/t|\s/i;function l(e){const t=i(e);return function(e){const r=e.split(d);return 2===r.length&&o(r[0])&&t(r[1])}}function f(e,t){if(!e||!t)return;const r=new Date(e).valueOf(),n=new Date(t).valueOf();return r&&n?r-n:void 0}function p(e,t){if(!e||!t)return;const[r,n]=e.split(d),[o,a]=t.split(d),i=s(r,o);return void 0!==i?i||c(n,a):void 0}const h=/\/|:/,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,v=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,y=-2147483648,g=2**31-1;function _(){return!0}const w=/[^\\]\\Z/}(ud)),ud),n=(dd||(dd=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;const t=sd(),r=ui(),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:e,schemaCode:t})=>r.str`should be ${o[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>r._`{comparison: ${o[e].okStr}, limit: ${t}}`};e.formatLimitDefinition={keyword:Object.keys(o),type:"string",schemaType:"string",$data:!0,error:s,code(e){const{gen:n,data:s,schemaCode:a,keyword:i,it:c}=e,{opts:u,self:d}=c;if(!u.validateFormats)return;const l=new t.KeywordCxt(c,d.RULES.all.format.definition,"format");function f(e){return r._`${e}.compare(${s}, ${a}) ${o[i].fail} 0`}l.$data?function(){const t=n.scopeValue("formats",{ref:d.formats,code:u.code.formats}),o=n.const("fmt",r._`${t}[${l.schemaCode}]`);e.fail$data((0,r.or)(r._`typeof ${o} != "object"`,r._`${o} instanceof RegExp`,r._`typeof ${o}.compare != "function"`,f(o)))}():function(){const t=l.schema,o=d.formats[t];if(!o||!0===o)return;if("object"!=typeof o||o instanceof RegExp||"function"!=typeof o.compare)throw new Error(`"${i}": format "${t}" does not define "compare" function`);const s=n.scopeValue("formats",{key:t,ref:o,code:u.code.formats?r._`${u.code.formats}${(0,r.getProperty)(t)}`:void 0});e.fail$data(f(s))}()},dependencies:["format"]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)}(fd)),fd),o=ui(),s=new o.Name("fullFormats"),a=new o.Name("fastFormats"),i=(e,t={keywords:!0})=>{if(Array.isArray(t))return c(e,t,r.fullFormats,s),e;const[o,i]="fast"===t.mode?[r.fastFormats,a]:[r.fullFormats,s];return c(e,t.formats||r.formatNames,o,i),t.keywords&&(0,n.default)(e),e};function c(e,t,r,n){var s,a;null!==(s=(a=e.opts.code).formats)&&void 0!==s||(a.formats=o._`require("ajv-formats/dist/formats").${n}`);for(const o of t)e.addFormat(o,r[o])}i.get=(e,t="full")=>{const n=("fast"===t?r.fastFormats:r.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n},e.exports=t=i,Object.defineProperty(t,"__esModule",{value:!0}),t.default=i}(cd,cd.exports)),cd.exports);const hd=t.getDefaultExportFromCjs(pd);class md{constructor(e){this._ajv=null!=e?e:function(){const e=new id.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return hd(e),e}()}getValidator(e){var t;const r="$id"in e&&"string"==typeof e.$id&&null!==(t=this._ajv.getSchema(e.$id))&&void 0!==t?t:this._ajv.compile(e);return e=>r(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}}class vd{constructor(e){this._server=e}requestStream(e,t,r){return this._server.requestStream(e,t,r)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._server.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}exports.CallToolRequestSchema=ta,exports.DEFAULT_NEGOTIATED_PROTOCOL_VERSION="2025-03-26",exports.InitializeRequestSchema=Zo,exports.JSONRPCMessageSchema=Io,exports.ListToolsRequestSchema=Qs,exports.MCP_TOOL_SCHEMAS={htmlToMarkdown:{type:"object",properties:{url:{type:"string",description:"URL of the web page to convert (e.g., https://example.com). Handles JavaScript-rendered dynamic content effectively."},html_content:{type:"string",description:"HTML string to convert directly. Use instead of URL for local files or API response HTML content."},locale:{type:"string",description:"Browser locale setting. Use 'ja-JP' for Japanese sites, 'en-US' for English sites. Affects content rendering and language detection.",enum:["en-US","ja-JP"],default:"en-US"}},anyOf:[{required:["url"]},{required:["html_content"]}]},saveContentToFile:{type:"object",properties:{content:{type:"string",description:"Text content to save to file. Will be saved as Markdown format."},save_path:{type:"string",description:"Complete file path including filename to save content (e.g., '/home/user/output.md'). Cannot be used with save_directory."},save_directory:{type:"string",description:"Directory path to save content with auto-generated filename (e.g., '/home/user/downloads'). Cannot be used with save_path."},filename:{type:"string",description:"Base filename to use when save_directory is specified (e.g., 'my-document'). Extension .md will be added automatically."}},required:["content"],anyOf:[{required:["save_path"]},{required:["save_directory"]}]},urlToMarkdownFile:{type:"object",properties:{url:{type:"string",description:"URL of the web page to convert and save as Markdown file (e.g., https://example.com). Handles JavaScript-rendered dynamic content effectively."},html_content:{type:"string",description:"HTML string to convert directly and save as Markdown file. Use instead of URL for local files or API response HTML content."},locale:{type:"string",description:"Browser locale setting. Use 'ja-JP' for Japanese sites, 'en-US' for English sites. Affects content rendering and language detection.",enum:["en-US","ja-JP"],default:"en-US"},save_path:{type:"string",description:"Complete file path including filename to save the converted Markdown content (e.g., '/home/user/output.md'). Cannot be used with save_directory."},save_directory:{type:"string",description:"Directory path to save the converted Markdown content with auto-generated filename (e.g., '/home/user/downloads'). Cannot be used with save_path."},filename:{type:"string",description:"Base filename to use when save_directory is specified (e.g., 'my-document'). Extension .md will be added automatically."}},anyOf:[{required:["url","save_path"]},{required:["url","save_directory"]},{required:["html_content","save_path"]},{required:["html_content","save_directory"]}]}},exports.SUPPORTED_PROTOCOL_VERSIONS=no,exports.Server=class extends Ja{constructor(e,t){var r,n;super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(na.options.map((e,t)=>[e,t])),this.isMessageIgnored=(e,t)=>{const r=this._loggingLevels.get(t);return!!r&&this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(r)},this._capabilities=null!==(r=null==t?void 0:t.capabilities)&&void 0!==r?r:{},this._instructions=null==t?void 0:t.instructions,this._jsonSchemaValidator=null!==(n=null==t?void 0:t.jsonSchemaValidator)&&void 0!==n?n:new md,this.setRequestHandler(Zo,e=>this._oninitialize(e)),this.setNotificationHandler(Ko,()=>{var e;return null===(e=this.oninitialized)||void 0===e?void 0:e.call(this)}),this._capabilities.logging&&this.setRequestHandler(sa,async(e,t)=>{var r;const n=t.sessionId||(null===(r=t.requestInfo)||void 0===r?void 0:r.headers["mcp-session-id"])||void 0,{level:o}=e.params,s=na.safeParse(o);return s.success&&this._loggingLevels.set(n,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new vd(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=function(e,t){const r={...e};for(const n in t){const e=n,o=t[e];if(void 0===o)continue;const s=r[e];Ba(s)&&Ba(o)?r[e]={...s,...o}:r[e]=o}return r}(this._capabilities,e)}setRequestHandler(e,t){var r,n,o;const s=_r(e),a=null==s?void 0:s.method;if(!a)throw new Error("Schema is missing a method literal");let i;if(yr(a)){const e=a,t=null===(r=e._zod)||void 0===r?void 0:r.def;i=null!==(n=null==t?void 0:t.value)&&void 0!==n?n:e.value}else{const e=a,t=e._def;i=null!==(o=null==t?void 0:t.value)&&void 0!==o?o:e.value}if("string"!=typeof i)throw new Error("Schema method literal must be a string");if("tools/call"===i){const r=async(e,r)=>{const n=gr(ta,e);if(!n.success){const e=n.error instanceof Error?n.error.message:String(n.error);throw new Za(So.InvalidParams,`Invalid tools/call request: ${e}`)}const{params:o}=n.data,s=await Promise.resolve(t(e,r));if(o.task){const e=gr(ts,s);if(!e.success){const t=e.error instanceof Error?e.error.message:String(e.error);throw new Za(So.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}const a=gr(Xs,s);if(!a.success){const e=a.error instanceof Error?a.error.message:String(a.error);throw new Za(So.InvalidParams,`Invalid tools/call result: ${e}`)}return a.data};return super.setRequestHandler(e,r)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){var t,r,n;switch(e){case"sampling/createMessage":if(!(null===(t=this._clientCapabilities)||void 0===t?void 0:t.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(null===(r=this._clientCapabilities)||void 0===r?void 0:r.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(null===(n=this._clientCapabilities)||void 0===n?void 0:n.roots))throw new Error(`Client does not support listing roots (required for ${e})`)}}assertNotificationCapability(e){var t,r;switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!(null===(r=null===(t=this._clientCapabilities)||void 0===t?void 0:t.elicitation)||void 0===r?void 0:r.url))throw new Error(`Client does not support URL elicitation (required for ${e})`)}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`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 Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`)}}assertTaskCapability(e){var t,r;!function(e,t,r){var n,o;if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!(null===(n=e.sampling)||void 0===n?void 0:n.createMessage))throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!(null===(o=e.elicitation)||void 0===o?void 0:o.create))throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`)}}(null===(r=null===(t=this._clientCapabilities)||void 0===t?void 0:t.tasks)||void 0===r?void 0:r.requests,e,"Client")}assertTaskHandlerCapability(e){var t;this._capabilities&&function(e,t,r){var n;if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);if("tools/call"===t&&!(null===(n=e.tools)||void 0===n?void 0:n.call))throw new Error(`${r} does not support task creation for tools/call (required for ${t})`)}(null===(t=this._capabilities.tasks)||void 0===t?void 0:t.requests,e,"Server")}async _oninitialize(e){const t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;return{protocolVersion:no.includes(t)?t:ro,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},zo)}async createMessage(e,t){var r,n;if((e.tools||e.toolChoice)&&!(null===(n=null===(r=this._clientCapabilities)||void 0===r?void 0:r.sampling)||void 0===n?void 0:n.tools))throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){const t=e.messages[e.messages.length-1],r=Array.isArray(t.content)?t.content:[t.content],n=r.some(e=>"tool_result"===e.type),o=e.messages.length>1?e.messages[e.messages.length-2]:void 0,s=o?Array.isArray(o.content)?o.content:[o.content]:[],a=s.some(e=>"tool_use"===e.type);if(n){if(r.some(e=>"tool_result"!==e.type))throw new Error("The last message must contain only tool_result content if any is present");if(!a)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(a){const e=new Set(s.filter(e=>"tool_use"===e.type).map(e=>e.id)),t=new Set(r.filter(e=>"tool_result"===e.type).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},ga,t):this.request({method:"sampling/createMessage",params:e},ya,t)}async elicitInput(e,t){var r,n,o,s,a;switch(null!==(r=e.mode)&&void 0!==r?r:"form"){case"url":{if(!(null===(o=null===(n=this._clientCapabilities)||void 0===n?void 0:n.elicitation)||void 0===o?void 0:o.url))throw new Error("Client does not support url elicitation.");const r=e;return this.request({method:"elicitation/create",params:r},Ca,t)}case"form":{if(!(null===(a=null===(s=this._clientCapabilities)||void 0===s?void 0:s.elicitation)||void 0===a?void 0:a.form))throw new Error("Client does not support form elicitation.");const r="form"===e.mode?e:{...e,mode:"form"},n=await this.request({method:"elicitation/create",params:r},Ca,t);if("accept"===n.action&&n.content&&r.requestedSchema)try{const e=this._jsonSchemaValidator.getValidator(r.requestedSchema)(n.content);if(!e.valid)throw new Za(So.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(i){if(i instanceof Za)throw i;throw new Za(So.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return n}}}createElicitationCompletionNotifier(e,t){var r,n;if(!(null===(n=null===(r=this._clientCapabilities)||void 0===r?void 0:r.elicitation)||void 0===n?void 0:n.url))throw new Error("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.request({method:"roots/list",params:e},Ua,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"})}},exports.createErrorResult=function(e){return{content:[{type:"text",text:`Error: ${e instanceof Error?e.message:String(e)}`}],isError:!0}},exports.createSuccessResult=function(e){return{content:[{type:"text",text:e}],isError:!1}},exports.getPackageVersion=()=>{try{const e=a.fileURLToPath("undefined"==typeof document?require("url").pathToFileURL(e).href:i&&"SCRIPT"===i.tagName.toUpperCase()&&i.src||new URL("version-DAQkOvqo.cjs",document.baseURI).href),t=s.dirname(e),r=s.resolve(t,"../package.json");return JSON.parse(o.readFileSync(r,"utf-8")).version||"0.0.0"}catch(e){return"0.0.0"}},exports.isInitializeRequest=e=>Zo.safeParse(e).success,exports.isJSONRPCError=To,exports.isJSONRPCRequest=$o,exports.isJSONRPCResponse=Eo,exports.parseHtmlToMarkdownArgs=function(e){if(!e||"object"!=typeof e)throw new Error("Arguments are required");const{url:t,html_content:r,locale:n="en-US"}=e;if(!t&&!r)throw new Error("Either 'url' or 'html_content' is required");if(t&&"string"!=typeof t)throw new Error("'url' must be a string");if(r&&"string"!=typeof r)throw new Error("'html_content' must be a string");if(n&&!["en-US","ja-JP"].includes(n))throw new Error("'locale' must be 'en-US' or 'ja-JP'");return{url:t,html_content:r,locale:n}},exports.parseSaveContentArgs=function(e){if(!e||"object"!=typeof e)throw new Error("Arguments are required");const{content:t,save_path:r,save_directory:n,filename:o}=e;if(!t||"string"!=typeof t)throw new Error("'content' is required and must be a string");if(!r&&!n)throw new Error("Either 'save_path' or 'save_directory' is required");if(r&&"string"!=typeof r)throw new Error("'save_path' must be a string");if(n&&"string"!=typeof n)throw new Error("'save_directory' must be a string");if(o&&"string"!=typeof o)throw new Error("'filename' must be a string");if(r&&n)throw new Error("Cannot specify both 'save_path' and 'save_directory'");return{content:t,save_path:r,save_directory:n,filename:o}},exports.parseUrlToMarkdownFileArgs=function(e){if(!e||"object"!=typeof e)throw new Error("Arguments are required");const{url:t,html_content:r,locale:n="en-US",save_path:o,save_directory:s,filename:a}=e;if(!t&&!r)throw new Error("Either 'url' or 'html_content' is required");if(t&&"string"!=typeof t)throw new Error("'url' must be a string");if(r&&"string"!=typeof r)throw new Error("'html_content' must be a string");if(n&&!["en-US","ja-JP"].includes(n))throw new Error("'locale' must be 'en-US' or 'ja-JP'");if(!o&&!s)throw new Error("Either 'save_path' or 'save_directory' is required");if(o&&"string"!=typeof o)throw new Error("'save_path' must be a string");if(s&&"string"!=typeof s)throw new Error("'save_directory' must be a string");if(a&&"string"!=typeof a)throw new Error("'filename' must be a string");if(o&&s)throw new Error("Cannot specify both 'save_path' and 'save_directory'");return{url:t,html_content:r,locale:n,save_path:o,save_directory:s,filename:a}},exports.saveContentToFile=async function(e,t,o,s){let a;if(t)a=n.resolve(t);else{if(!o)throw new Error("Either save_path or save_directory must be specified");{const e=s||"page",t=".md";a=n.resolve(o,`${e}${t}`)}}return await r.promises.mkdir(n.dirname(a),{recursive:!0}),await r.promises.writeFile(a,e,"utf-8"),a};
|