@agent-sh/computer-use-linux 0.4.10 → 0.5.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.
@@ -0,0 +1,62 @@
1
+ // Generated by pi/scripts/build.mjs. Do not edit by hand.
2
+ "use strict";var O_=Object.create;var Kn=Object.defineProperty;var I_=Object.getOwnPropertyDescriptor;var x_=Object.getOwnPropertyNames;var N_=Object.getPrototypeOf,j_=Object.prototype.hasOwnProperty;var et=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Gn=(e,t)=>{for(var r in t)Kn(e,r,{get:t[r],enumerable:!0})},Ul=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of x_(t))!j_.call(e,n)&&n!==r&&Kn(e,n,{get:()=>t[n],enumerable:!(o=I_(t,n))||o.enumerable});return e};var Ha=(e,t,r)=>(r=e!=null?O_(N_(e)):{},Ul(t||!e||!e.__esModule?Kn(r,"default",{value:e,enumerable:!0}):r,e)),A_=e=>Ul(Kn({},"__esModule",{value:!0}),e);var Dg=et((zE,Ug)=>{Ug.exports=Lg;Lg.sync=C0;var qg=require("fs");function k0(e,t){var r=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var o=0;o<r.length;o++){var n=r[o].toLowerCase();if(n&&e.substr(-n.length).toLowerCase()===n)return!0}return!1}function Mg(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:k0(t,r)}function Lg(e,t,r){qg.stat(e,function(o,n){r(o,o?!1:Mg(n,e,t))})}function C0(e,t){return Mg(qg.statSync(e),e,t)}});var Jg=et((wE,Hg)=>{Hg.exports=Vg;Vg.sync=O0;var Zg=require("fs");function Vg(e,t,r){Zg.stat(e,function(o,n){r(o,o?!1:Fg(n,t))})}function O0(e,t){return Fg(Zg.statSync(e),t)}function Fg(e,t){return e.isFile()&&I0(e,t)}function I0(e,t){var r=e.mode,o=e.uid,n=e.gid,s=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),i=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),c=parseInt("100",8),a=parseInt("010",8),u=parseInt("001",8),l=c|a,p=r&u||r&a&&n===i||r&c&&o===s||r&l&&s===0;return p}});var Kg=et((RE,Bg)=>{var $E=require("fs"),Za;process.platform==="win32"||global.TESTING_WINDOWS?Za=Dg():Za=Jg();Bg.exports=El;El.sync=x0;function El(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(o,n){El(e,t||{},function(s,i){s?n(s):o(i)})})}Za(e,t||{},function(o,n){o&&(o.code==="EACCES"||t&&t.ignoreErrors)&&(o=null,n=!1),r(o,n)})}function x0(e,t){try{return Za.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var t_=et((PE,e_)=>{var Gr=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Gg=require("path"),N0=Gr?";":":",Wg=Kg(),Yg=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Xg=(e,t)=>{let r=t.colon||N0,o=e.match(/\//)||Gr&&e.match(/\\/)?[""]:[...Gr?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],n=Gr?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Gr?n.split(r):[""];return Gr&&e.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:o,pathExt:s,pathExtExe:n}},Qg=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:o,pathExt:n,pathExtExe:s}=Xg(e,t),i=[],c=u=>new Promise((l,p)=>{if(u===o.length)return t.all&&i.length?l(i):p(Yg(e));let f=o[u],z=/^".*"$/.test(f)?f.slice(1,-1):f,m=Gg.join(z,e),_=!z&&/^\.[\\\/]/.test(e)?e.slice(0,2)+m:m;l(a(_,u,0))}),a=(u,l,p)=>new Promise((f,z)=>{if(p===n.length)return f(c(l+1));let m=n[p];Wg(u+m,{pathExt:s},(_,g)=>{if(!_&&g)if(t.all)i.push(u+m);else return f(u+m);return f(a(u,l,p+1))})});return r?c(0).then(u=>r(null,u),r):c(0)},j0=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:o,pathExtExe:n}=Xg(e,t),s=[];for(let i=0;i<r.length;i++){let c=r[i],a=/^".*"$/.test(c)?c.slice(1,-1):c,u=Gg.join(a,e),l=!a&&/^\.[\\\/]/.test(e)?e.slice(0,2)+u:u;for(let p=0;p<o.length;p++){let f=l+o[p];try{if(Wg.sync(f,{pathExt:n}))if(t.all)s.push(f);else return f}catch{}}}if(t.all&&s.length)return s;if(t.nothrow)return null;throw Yg(e)};e_.exports=Qg;Qg.sync=j0});var o_=et((EE,Tl)=>{"use strict";var r_=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(o=>o.toUpperCase()==="PATH")||"Path"};Tl.exports=r_;Tl.exports.default=r_});var a_=et((TE,i_)=>{"use strict";var n_=require("path"),A0=t_(),q0=o_();function s_(e,t){let r=e.options.env||process.env,o=process.cwd(),n=e.options.cwd!=null,s=n&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(e.options.cwd)}catch{}let i;try{i=A0.sync(e.command,{path:r[q0({env:r})],pathExt:t?n_.delimiter:void 0})}catch{}finally{s&&process.chdir(o)}return i&&(i=n_.resolve(n?e.options.cwd:"",i)),i}function M0(e){return s_(e)||s_(e,!0)}i_.exports=M0});var c_=et((kE,Cl)=>{"use strict";var kl=/([()\][%!^"`<>&|;, *?])/g;function L0(e){return e=e.replace(kl,"^$1"),e}function U0(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(kl,"^$1"),t&&(e=e.replace(kl,"^$1")),e}Cl.exports.command=L0;Cl.exports.argument=U0});var l_=et((CE,u_)=>{"use strict";u_.exports=/^#!(.*)/});var p_=et((OE,d_)=>{"use strict";var D0=l_();d_.exports=(e="")=>{let t=e.match(D0);if(!t)return null;let[r,o]=t[0].replace(/#! ?/,"").split(" "),n=r.split("/").pop();return n==="env"?o:o?`${n} ${o}`:n}});var h_=et((IE,m_)=>{"use strict";var Ol=require("fs"),Z0=p_();function V0(e){let r=Buffer.alloc(150),o;try{o=Ol.openSync(e,"r"),Ol.readSync(o,r,0,150,0),Ol.closeSync(o)}catch{}return Z0(r.toString())}m_.exports=V0});var y_=et((xE,__)=>{"use strict";var F0=require("path"),f_=a_(),g_=c_(),H0=h_(),J0=process.platform==="win32",B0=/\.(?:com|exe)$/i,K0=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function G0(e){e.file=f_(e);let t=e.file&&H0(e.file);return t?(e.args.unshift(e.file),e.command=t,f_(e)):e.file}function W0(e){if(!J0)return e;let t=G0(e),r=!B0.test(t);if(e.options.forceShell||r){let o=K0.test(t);e.command=F0.normalize(e.command),e.command=g_.command(e.command),e.args=e.args.map(s=>g_.argument(s,o));let n=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${n}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function Y0(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign({},r);let o={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?o:W0(o)}__.exports=Y0});var b_=et((NE,v_)=>{"use strict";var Il=process.platform==="win32";function xl(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function X0(e,t){if(!Il)return;let r=e.emit;e.emit=function(o,n){if(o==="exit"){let s=S_(n,t);if(s)return r.call(e,"error",s)}return r.apply(e,arguments)}}function S_(e,t){return Il&&e===1&&!t.file?xl(t.original,"spawn"):null}function Q0(e,t){return Il&&e===1&&!t.file?xl(t.original,"spawnSync"):null}v_.exports={hookChildProcess:X0,verifyENOENT:S_,verifyENOENTSync:Q0,notFoundError:xl}});var $_=et((jE,Wr)=>{"use strict";var z_=require("child_process"),Nl=y_(),jl=b_();function w_(e,t,r){let o=Nl(e,t,r),n=z_.spawn(o.command,o.args,o.options);return jl.hookChildProcess(n,o),n}function ew(e,t,r){let o=Nl(e,t,r),n=z_.spawnSync(o.command,o.args,o.options);return n.error=n.error||jl.verifyENOENTSync(n.status,o),n}Wr.exports=w_;Wr.exports.spawn=w_;Wr.exports.sync=ew;Wr.exports._parse=Nl;Wr.exports._enoent=jl});var iw={};Gn(iw,{ComputerUseMcpClient:()=>Ml});module.exports=A_(iw);var q_=Object.create,Wn=Object.defineProperty,M_=Object.getOwnPropertyDescriptor,L_=Object.getOwnPropertyNames,U_=Object.getPrototypeOf,D_=Object.prototype.hasOwnProperty,D=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Dl=(e,t)=>{let r={};for(var o in e)Wn(r,o,{get:e[o],enumerable:!0});return t&&Wn(r,Symbol.toStringTag,{value:"Module"}),r},Z_=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(var n=L_(t),s=0,i=n.length,c;s<i;s++)c=n[s],!D_.call(e,c)&&c!==r&&Wn(e,c,{get:(a=>t[a]).bind(null,c),enumerable:!(o=M_(t,c))||o.enumerable});return e},Yn=(e,t,r)=>(r=e!=null?q_(U_(e)):{},Z_(t||!e||!e.__esModule?Wn(r,"default",{value:e,enumerable:!0}):r,e));var V_=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),Zl=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),F_=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),H_=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function Vl(e){return typeof e=="string"&&Zl.has(e.replace(/#$/,""))}function Fl(e,t){if(!("$schema"in e)||typeof e.$schema!="string")return"2020-12";let r=e.$schema.replace(/#$/,"");if(V_.has(r))return"2020-12";if(Zl.has(r))return"2019-09";if(F_.has(r)||H_.has(r))return"draft-7";throw new Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}var pe={};Gn(pe,{BIGINT_FORMAT_RANGES:()=>Gl,CONSTANT_CATCH:()=>Ql,Class:()=>Ba,NUMBER_FORMAT_RANGES:()=>rc,aborted:()=>It,allowsEval:()=>Qa,assert:()=>W_,assertEqual:()=>J_,assertIs:()=>K_,assertNever:()=>G_,assertNotEqual:()=>B_,assignProp:()=>Ne,attachSchema:()=>ts,base64ToUint8Array:()=>Yl,base64urlToUint8Array:()=>hy,cached:()=>$r,captureStackTrace:()=>Qn,cleanEnum:()=>my,cleanRegex:()=>Po,clone:()=>st,cloneDef:()=>X_,codePointLength:()=>Eo,constantCatch:()=>ed,createTransparentProxy:()=>ny,defineLazy:()=>Wa,defineLazyInternal:()=>ge,esc:()=>Ya,escapeRegex:()=>ft,explicitlyAborted:()=>oc,extend:()=>ay,finalizeIssue:()=>ct,floatSafeRemainder:()=>Ga,getElementAtPath:()=>Q_,getEnumValues:()=>Ro,getLengthableOrigin:()=>To,getParsedType:()=>oy,getSizableOrigin:()=>Wl,hexToUint8Array:()=>gy,hide:()=>ic,installLazyProp:()=>by,isObject:()=>Qt,isPlainObject:()=>Ot,issue:()=>Rr,joinValues:()=>Xn,jsonStringifyReplacer:()=>wr,members:()=>sc,merge:()=>uy,mergeDefs:()=>ht,normalizeParams:()=>re,nullish:()=>Ka,numKeys:()=>ry,objectClone:()=>Y_,omit:()=>iy,optionalKeys:()=>tc,own:()=>zr,parsedType:()=>nc,partial:()=>ly,pick:()=>sy,prefixIssues:()=>gt,primitiveTypes:()=>Kl,promiseAllObject:()=>ey,propertyKeyTypes:()=>ec,randomString:()=>ty,required:()=>dy,safeExtend:()=>cy,shallowClone:()=>Bl,slugify:()=>Xa,stringifyPrimitive:()=>es,toZod:()=>Jl,uint8ArrayToBase64:()=>Xl,uint8ArrayToBase64url:()=>fy,uint8ArrayToHex:()=>_y,unwrapMessage:()=>br});function J_(e){return e}function B_(e){return e}function Jl(){return e=>e}function K_(e){}function G_(e){throw new Error("Unexpected value in exhaustive check")}function W_(e){}function Ro(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function Xn(e,t="|"){return e.map(r=>es(r)).join(t)}function wr(e,t){return typeof t=="bigint"?t.toString():t}function $r(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Ka(e){return e==null}function Po(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ga(e,t){let r=e/t,o=Math.round(r),n=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}var Hl=Symbol("evaluating");function Wa(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==Hl)return o===void 0&&(o=Hl,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Y_(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Ne(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ht(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function X_(e){return ht(e._zod.def)}function Q_(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function ey(e){let t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{let n={};for(let s=0;s<t.length;s++)n[t[s]]=o[s];return n})}function ty(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}function Ya(e){return JSON.stringify(e)}function Xa(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Qn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Qt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Qa=$r(()=>{if(We.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Ot(e){if(Qt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Qt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Bl(e){return Ot(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function ry(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var oy=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},ec=new Set(["string","number","symbol"]),Kl=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ft(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function st(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function re(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function ny(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,s){return t??(t=e()),Reflect.set(t,o,n,s)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function es(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function tc(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var rc={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]},Gl={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function sy(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=ht(e._zod.def,{get shape(){let i={};for(let c of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(r.shape,c))throw new Error(`Unrecognized key: "${String(c)}"`);t[c]&&Ne(i,c,r.shape[c])}return Ne(this,"shape",i),i},checks:[]});return st(e,s)}function iy(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=ht(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let c of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(r.shape,c))throw new Error(`Unrecognized key: "${String(c)}"`);t[c]&&delete i[c]}return Ne(this,"shape",i),i},checks:[]});return st(e,s)}function ay(e,t){if(!Ot(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=e._zod.def.shape;for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=ht(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return Ne(this,"shape",s),s}});return st(e,n)}function cy(e,t){if(!Ot(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=ht(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Ne(this,"shape",o),o}});return st(e,r)}function uy(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=ht(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return Ne(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return st(e,r)}function ly(e,t,r,o="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw new Error(`.${o}() cannot be used on object schemas containing refinements`);let c=ht(t._zod.def,{get shape(){let a=t._zod.def.shape,u={...a};if(r)for(let l of Reflect.ownKeys(r)){if(!Object.prototype.hasOwnProperty.call(a,l))throw new Error(`Unrecognized key: "${String(l)}"`);r[l]&&(u[l]=e?new e({type:"optional",innerType:a[l]}):a[l])}else for(let l of Reflect.ownKeys(a))u[l]=e?new e({type:"optional",innerType:a[l]}):a[l];return Ne(this,"shape",u),u},checks:[]});return st(t,c)}function dy(e,t,r){let o=ht(t._zod.def,{get shape(){let n=t._zod.def.shape,s={...n};if(r)for(let i of Reflect.ownKeys(r)){if(!Object.prototype.hasOwnProperty.call(s,i))throw new Error(`Unrecognized key: "${String(i)}"`);r[i]&&(s[i]=new e({type:"nonoptional",innerType:n[i]}))}else for(let i of Reflect.ownKeys(n))s[i]=new e({type:"nonoptional",innerType:n[i]});return Ne(this,"shape",s),s}});return st(t,o)}function It(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function oc(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function gt(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function br(e){return typeof e=="string"?e:e?.message}function ts(e,t,r){var o;for(let n=t;n<e.length;n++)(o=e[n]).schema??(o.schema=r)}function ct(e,t,r){var o;let n=e.inst?._zod?.traits;n?.has("$ZodType")&&(n.has("$ZodCheck")?(o=e).schema??(o.schema=e.inst):e.schema=e.inst);let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:br(e.inst?._zod.def?.error?.(e))??br(s?.(e))??br(t?.error?.(e))??br(r.customError?.(e))??br(r.localeError?.(e))??"Invalid input",{inst:c,schema:a,continue:u,input:l,...p}=e;return p.path??(p.path=[]),p.message=i,t?.reportInput&&(p.input=l),p}function Wl(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var py=/[\uD800-\uDBFF]/;function Eo(e){let t=e.length;if(!py.test(e))return t;let r=t;for(let o=0;o<t-1;o++)(e.charCodeAt(o)&64512)===55296&&(e.charCodeAt(o+1)&64512)===56320&&(r--,o++);return r}function To(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function nc(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Rr(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}function my(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Yl(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}function Xl(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function hy(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Yl(t+r)}function fy(e){return Xl(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function gy(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}function _y(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Ba=class{constructor(...t){}};function sc(e,t){for(let r in t){let o=Object.getOwnPropertyDescriptor(t,r);o.get?Object.defineProperty(e,r,{...o,enumerable:!1}):yy(e,r,o.value)}}function zr(e,t,r,o=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:o,value:r}),r}function ic(e,t,r){return zr(e,t,r,!1)}function yy(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:zr(this,t,r.bind(this))},set(o){zr(this,t,o)}})}function Sy(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Ja,Ct=!1,vy={configurable:!0,get(){Ct=!0}};function ge(e,t,r){let o=Object.getPrototypeOf(e._zod);if(t in o&&Ja!==e._zod){Ja=void 0;return}Ja=e._zod,Object.defineProperty(o,t,{configurable:!0,get(){Object.defineProperty(this,t,vy);let n=Ct;Ct=!1;try{let s=r(this);return Ct?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s}),Ct=Ct||n,s}catch(s){throw delete this[t],Ct=Ct||n,s}},set(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})}function by(e,t,r,o){let n=Sy(e,t);n&&Object.defineProperty(n,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:o,value:void 0};return Object.defineProperty(this,t,s),s.value=r(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:o,value:s})}})}var Ql="~constantCatch";function ed(e){let t=()=>e;return t[Ql]=!0,t}var td,cc=Object.freeze({status:"aborted"}),ac={value:void 0,enumerable:!1},rd="captureStackTrace"in Error?Error:null;function zy(e){let t=rd;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return rd=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function q(e,t,r,o){let n={};function s(f){this.def=f,this.constr=p,this.traits=new Set}s.prototype=n;let i=r,c=i&&new WeakSet;function a(f,z){if(!f._zod){ac.value=new s(z);try{Object.defineProperty(f,"_zod",ac)}finally{ac.value=void 0}}if(f._zod.traits.has(e))return;if(f._zod.traits.add(e),t(f,z),c){let _=Object.getPrototypeOf(f),g=f._zod.constr.prototype,h=_;for(;h&&h!==g;)h=Object.getPrototypeOf(h);let v=h??_;c.has(v)||(c.add(v),sc(v,i))}let m=p.prototype;for(let _ in m)Object.prototype.hasOwnProperty.call(m,_)&&(_ in f||(f[_]=m[_].bind(f)))}let u=o?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function p(f){let z=o?.Parent?zy(l):this;a(z,f);let m=z._zod.deferred;if(m){for(let g of m)g();z._zod.deferred=void 0}let _=globalThis.__zod_globalConfig?.postProcessor;return _&&_(z),z}return Object.defineProperty(p,"init",{value:a}),Object.defineProperty(p,Symbol.hasInstance,{value:f=>o?.Parent&&f instanceof o.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(p,"name",{value:e}),p}var dt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Pr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(td=globalThis).__zod_globalConfig??(td.__zod_globalConfig={});var We=globalThis.__zod_globalConfig;function Ye(e){return e&&Object.assign(We,e),We}function wy(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,wr,2)),e.message}function $y(e){this._zod.message=e}var Ry={get:wy,set:$y,enumerable:!0,configurable:!0},lc={value:void 0,enumerable:!1},dc={value:void 0,enumerable:!1},od=new WeakSet([Object.prototype,Error.prototype]),nd=(e,t)=>{e.name="$ZodError",lc.value=e._zod,Object.defineProperty(e,"_zod",lc),dc.value=t,Object.defineProperty(e,"issues",dc),lc.value=void 0,dc.value=void 0,Object.defineProperty(e,"message",Ry);let r=Object.getPrototypeOf(e);od.has(r)||(od.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let o=()=>this.message;return Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0})}}))},rs=q("$ZodError",nd),pc=q("$ZodError",nd,void 0,{Parent:Error});function Py(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function mc(e,t=r=>r.message){let r={},o=[];for(let n of e.issues)n.path.length>0?Py(r,n.path[0],()=>[]).push(t(n)):o.push(t(n));return{formErrors:o,fieldErrors:r}}function hc(e,t=r=>r.message){let r={_errors:[]},o=(n,s=[])=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(c=>o({issues:c},[...s,...i.path]));else if(i.code==="invalid_key")o({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")o({issues:i.issues},[...s,...i.path]);else{let c=[...s,...i.path];if(c.length===0)r._errors.push(t(i));else{let a=r,u=0;for(;u<c.length;){let l=c[u],p=u===c.length-1;if(l==="_errors"){p&&a._errors.push(t(i)),u++;continue}Object.prototype.hasOwnProperty.call(a,l)||Object.defineProperty(a,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let f=a[l];p&&f._errors.push(t(i)),a=f,u++}}}};return o(e),r}function os(e,t){return{callee:t?.callee??e,Err:t?.Err}}var ns=e=>{let t=(r,o,n,s)=>{let i=n?{...n,async:!1}:{async:!1},c=r._zod.run({value:o,issues:[]},i);if(c instanceof Promise)throw new dt;if(c.issues.length){let a=new(s?.Err??e)(c.issues.map(u=>ct(u,i,Ye())));throw Qn(a,s?.callee??t),a}return c.value};return t};var ss=e=>{let t=async(r,o,n,s)=>{let i=n?{...n,async:!0}:{async:!0},c=r._zod.run({value:o,issues:[]},i);if(c instanceof Promise&&(c=await c),c.issues.length){let a=new(s?.Err??e)(c.issues.map(u=>ct(u,i,Ye())));throw Qn(a,s?.callee??t),a}return c.value};return t};var ko=e=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new dt;return s.issues.length?{success:!1,error:new(e??rs)(s.issues.map(i=>ct(i,n,Ye())))}:{success:!0,data:s.value}},sd=ko(pc),Co=e=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>ct(i,n,Ye())))}:{success:!0,data:s.value}},id=Co(pc);var ad=e=>{let t=ns(e),r=(o,n,s,i)=>{let c=s?{...s,direction:"backward"}:{direction:"backward"};return t(o,n,c,os(r,i))};return r};var cd=e=>{let t=ns(e),r=(o,n,s,i)=>t(o,n,s,os(r,i));return r};var ud=e=>{let t=ss(e),r=async(o,n,s,i)=>{let c=s?{...s,direction:"backward"}:{direction:"backward"};return await t(o,n,c,os(r,i))};return r};var ld=e=>{let t=ss(e),r=async(o,n,s,i)=>await t(o,n,s,os(r,i));return r};var dd=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return ko(e)(t,r,n)};var pd=e=>(t,r,o)=>ko(e)(t,r,o);var md=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Co(e)(t,r,n)};var hd=e=>async(t,r,o)=>Co(e)(t,r,o);var fd=/^[cC][0-9a-z]{6,}$/,gd=/^[0-9a-z]+$/,_d=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,yd=/^[0-9a-vA-V]{20}$/,Sd=/^[A-Za-z0-9]{27}$/,vd=/^[a-zA-Z0-9_-]{21}$/;function bd(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var zd=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var wd=/^([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})$/,gc=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)$/;var $d=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Ty="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Rd(){return new RegExp(Ty,"u")}var Pd=/^(?:(?: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])$/,Ed=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var Td=/^((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])$/,kd=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Cd=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_c=/^[A-Za-z0-9_-]*$/;var Od=/^https?$/,Id=/^\+[1-9]\d{6,14}$/;var xd="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function ky(e){return new RegExp(`^${e}$`)}var Nd=ky(xd);function fc(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function jd(e){return new RegExp(`^${fc(e)}$`)}function Ad(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${fc({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,o=e.local?`${r}|${fc({precision:e.precision})}`:r;return new RegExp(`^${xd}T(?:${o})$`)}var qd=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Md=/^-?\d+n?$/,is=/^-?\d+$/,Oo=/^-?\d+(?:\.\d+)?$/,Ld=/^(?:true|false)$/i,Ud=/^null$/i;var Dd=/^[^A-Z]*$/,Zd=/^[^a-z]*$/;var Ue=q("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var yc=e=>{let t=e.value;return!Ka(t)&&t.length!==void 0},as={number:"number",bigint:"bigint",object:"date"},Sc=q("$ZodCheckLessThan",(e,t)=>{Ue.init(e,t);let r=as[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,s=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:as[typeof o.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vc=q("$ZodCheckGreaterThan",(e,t)=>{Ue.init(e,t);let r=as[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,s=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:as[typeof o.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Vd=q("$ZodCheckMultipleOf",(e,t)=>{Ue.init(e,t),e._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.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.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):Ga(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Fd=q("$ZodCheckNumberFormat",(e,t)=>{Ue.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=rc[t.format];e._zod.onattach.push(i=>{let c=i._zod.bag;c.format=t.format,c.minimum=n,c.maximum=s,r&&(c.pattern=is)}),e._zod.check=i=>{let c=i.value;if(r){if(!Number.isInteger(c)){i.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?i.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):i.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}c<n&&i.issues.push({origin:"number",input:c,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),c>s&&i.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var Hd=q("$ZodCheckMaxLength",(e,t)=>{var r;Ue.init(e,t),(r=e._zod.def).when??(r.when=yc),e._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let n=o.value,s=n.length;if((typeof n=="string"&&s>t.maximum?Eo(n):s)<=t.maximum)return;let c=To(n);o.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Jd=q("$ZodCheckMinLength",(e,t)=>{var r;Ue.init(e,t),(r=e._zod.def).when??(r.when=yc),e._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let n=o.value,s=n.length;if((typeof n=="string"&&s>=t.minimum&&s<t.minimum*2?Eo(n):s)>=t.minimum)return;let c=To(n);o.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Bd=q("$ZodCheckLengthEquals",(e,t)=>{var r;Ue.init(e,t),(r=e._zod.def).when??(r.when=yc),e._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=o=>{let n=o.value,s=n.length,i=typeof n=="string"&&s>=t.length&&s<=t.length*2?Eo(n):s;if(i===t.length)return;let c=To(n),a=i>t.length;o.issues.push({origin:c,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Io=q("$ZodCheckStringFormat",(e,t)=>{var r,o;Ue.init(e,t),e._zod.onattach.push(n=>{let s=n._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),Kd=q("$ZodCheckRegex",(e,t)=>{Io.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})}}),Gd=q("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Dd),Io.init(e,t)}),Wd=q("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Zd),Io.init(e,t)}),Yd=q("$ZodCheckIncludes",(e,t)=>{Ue.init(e,t);let r=ft(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=o,e._zod.onattach.push(n=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Xd=q("$ZodCheckStartsWith",(e,t)=>{Ue.init(e,t);let r=new RegExp(`^${ft(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Qd=q("$ZodCheckEndsWith",(e,t)=>{Ue.init(e,t);let r=new RegExp(`.*${ft(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var ep=q("$ZodCheckOverwrite",(e,t)=>{Ue.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var cs=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let o=t.split(`
3
+ `).filter(i=>i),n=Math.min(...o.map(i=>i.length-i.trimStart().length)),s=o.map(i=>i.slice(n)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
4
+ ${r.join(`
5
+ `)}
6
+ };`)(...Object.values(this.closed))}};var rp={major:4,minor:5,patch:4};var ye=q("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=rp;let o=e._zod.def.checks,n=e._zod.traits.has("$ZodCheck")?[e,...o??[]]:o?.length?[...o]:[];for(let s of n)for(let i of s._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(c,a,u)=>{if(c.memo)return c;let l=It(c),p;for(let f of a){if(f._zod.def.when){if(oc(c)||!f._zod.def.when(c))continue}else if(l)continue;let z=c.issues.length,m=f._zod.check(c);if(m instanceof Promise&&u?.async===!1)throw new dt;if(p||m instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await m,c.issues.length!==z&&(ts(c.issues,z,e),l||(l=It(c,z)))});else{if(c.issues.length===z)continue;ts(c.issues,z,e),l||(l=It(c,z))}}return p?p.then(()=>c):c},i=(c,a,u)=>{if(It(c))return c.aborted=!0,c;let l=s(a,n,u);if(l instanceof Promise){if(u.async===!1)throw new dt;return l.then(p=>e._zod.parse(p,u))}return e._zod.parse(l,u)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){let l=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(p=>i(p,c,a)):i(l,c,a)}let u=e._zod.parse(c,a);if(u instanceof Promise){if(a.async===!1)throw new dt;return u.then(l=>s(l,n,a))}return s(u,n,a)}}},{get"~standard"(){return ic(this,"~standard",wc(this))},set"~standard"(e){zr(this,"~standard",e)}}),op=e=>e.success?{value:e.data}:{issues:e.error?.issues};function wc(e){return{validate:t=>{try{return op(sd(e,t))}catch{return id(e,t).then(op)}},vendor:"zod",version:1}}var ds=q("$ZodString",(e,t)=>{ye.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??qd(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),we=q("$ZodStringFormat",(e,t)=>{Io.init(e,t),ds.init(e,t)}),mp=q("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=wd),we.init(e,t)}),hp=q("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=gc(o))}else t.pattern??(t.pattern=gc());we.init(e,t)}),fp=q("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=$d),we.init(e,t)}),gp=1,_p=2;function Cy(e,t){if(!t.normalize&&t.protocol?.source===Od.source&&!/^https?:\/\//i.test(e))return gp;try{return new URL(e)}catch{return _p}}var Oy=/[\t\n\r]/g;function Iy(e){return e.replace(Oy,"")}function xy(e,t){return t.lastIndex=0,t.test(e.hostname)}function Ny(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var yp=q("$ZodURL",(e,t)=>{we.init(e,t),e._zod.check=r=>{try{let o=r.value.trim(),n=Cy(o,t);if(n===gp){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(n===_p){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}t.hostname&&!xy(n,t.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&!Ny(n,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?n.href:Iy(o);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Sp=q("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Rd()),we.init(e,t)}),vp=q("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?vd:bd(t.length)),we.init(e,t)}),bp=q("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=fd),we.init(e,t)}),zp=q("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=gd),we.init(e,t)}),wp=q("$ZodULID",(e,t)=>{t.pattern??(t.pattern=_d),we.init(e,t)}),$p=q("$ZodXID",(e,t)=>{t.pattern??(t.pattern=yd),we.init(e,t)}),Rp=q("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Sd),we.init(e,t)}),Pp=q("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ad(t)),we.init(e,t),(t.local||t.precision===-1)&&(e._zod.bag.laxFormat=!0,e._zod.onattach.push(r=>{r._zod.bag.laxFormat=!0}))}),Ep=q("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Nd),we.init(e,t)}),Tp=q("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=jd(t)),we.init(e,t)}),kp=q("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=zd),we.init(e,t)}),Cp=q("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Pd),we.init(e,t),e._zod.bag.format="ipv4"}),jy=/^[0-9a-fA-F:.]+$/;function Op(e){if(!jy.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}var Ip=q("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ed),we.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{Op(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var xp=q("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Td),we.init(e,t)});function Ay(e){let t=e.split("/");if(t.length!==2)return!1;let[r,o]=t;if(!o)return!1;let n=Number(o);return`${n}`!==o||n<0||n>128?!1:Op(r)}var Np=q("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=kd),we.init(e,t),e._zod.check=r=>{Ay(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function jp(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Ap=q("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Cd),we.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{jp(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function qy(e){if(!_c.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return jp(r)}var qp=q("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=_c),we.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{qy(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Mp=q("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Id),we.init(e,t)});function My(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var Lp=q("$ZodJWT",(e,t)=>{we.init(e,t),e._zod.check=r=>{My(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var $c=q("$ZodNumber",(e,t)=>{ye.init(e,t),e._zod.pattern=e._zod.bag.pattern??Oo,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:String(n):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),Up=q("$ZodNumberFormat",(e,t)=>{Fd.init(e,t),$c.init(e,t)}),Dp=q("$ZodBoolean",(e,t)=>{ye.init(e,t),e._zod.pattern=Ld,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),Zp=q("$ZodBigInt",(e,t)=>{ye.init(e,t),e._zod.pattern=Md,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}});var Vp=q("$ZodNull",(e,t)=>{ye.init(e,t),e._zod.pattern=Ud,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),Fp=q("$ZodAny",(e,t)=>{ye.init(e,t),e._zod.parse=r=>r}),Hp=q("$ZodUnknown",(e,t)=>{ye.init(e,t),e._zod.parse=r=>r}),Jp=q("$ZodNever",(e,t)=>{ye.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});var Bp=q("$ZodDate",(e,t)=>{ye.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,s=n instanceof Date;return s&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...s?{received:"Invalid Date"}:{},inst:e}),r}});function np(e,t,r){e.issues.length&&t.issues.push(...gt(r,e.issues)),t.value[r]=e.value}var Kp=q("$ZodArray",(e,t)=>{ye.init(e,t);let r=We.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),o;o.value=r?r.alloc(e,o,Array(s.length),n):Array(s.length);let i=[];for(let c=0;c<s.length;c++){let a=s[c],u=t.element._zod.run({value:a,issues:[]},n);u instanceof Promise?i.push(u.then(l=>np(l,o,c))):np(u,o,c)}return i.length?Promise.all(i).then(()=>o):o}});function ls(e,t,r,o,n,s){let i=r in o,c=s==="optional";if(!(!i&&c&&n==="optional")){if(e.issues.length){if(n!==void 0&&c&&!i)return;t.issues.push(...gt(r,e.issues))}if(!i&&n===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?i&&(t.value[r]=void 0):t.value[r]=e.value}}var Ly=[];function Gp(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),o=r.length?r:Ly,n=o.length?[...t,...o]:t;for(let i of n)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(i)}": expected a Zod schema`);let s=tc(e.shape);return{...e,allKeys:n,symbolKeys:o,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function Wp(e,t,r,o,n,s){let i=[],c=n.keySet,a=n.catchall._zod,u=a.def.type,l=a.optin,p=a.optout;for(let f in t){if(c.has(f))continue;if(f==="__proto__"){u==="never"&&i.push(f);continue}if(u==="never"){i.push(f);continue}let z=a.run({value:t[f],issues:[]},o);z instanceof Promise?e.push(z.then(m=>ls(m,r,f,t,l,p))):ls(z,r,f,t,l,p)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var bc=new WeakMap,Uy=q("$ZodObject",(e,t)=>{if(ye.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;bc.set(t,a),Object.defineProperty(t,"shape",{get:()=>{let u={...a};return Object.defineProperty(t,"shape",{value:u}),bc.set(t,u),u}})}let o=$r(()=>Gp(t));ge(e,"propValues",a=>{let u=a.def.shape,l={};for(let p in u){let f=u[p]._zod;if(f.values){Object.prototype.hasOwnProperty.call(l,p)||Ne(l,p,new Set);for(let z of f.values)l[p].add(z);f.optin!==void 0&&l[p].add(void 0)}}return l});let n=Qt,s=t.catchall,i,c=We.memoizer;c?.attach(e),e._zod.parse=(a,u)=>{i??(i=o.value);let l=a.value;if(!n(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),a;a.value=c?c.alloc(e,a,{},u):{};let p=[],f=i.shape;for(let z of i.allKeys){if(z==="__proto__")continue;let m=f[z],_=m._zod.optin,g=m._zod.optout,h=m._zod.run({value:l[z],issues:[]},u);h instanceof Promise?p.push(h.then(v=>ls(v,a,z,l,_,g))):ls(h,a,z,l,_,g)}return s?Wp(p,l,a,u,o.value,e):p.length?Promise.all(p).then(()=>a):a}}),Yp=q("$ZodObjectJIT",(e,t)=>{Uy.init(e,t);let r=e._zod.parse,o=$r(()=>Gp(t)),n=We.memoizer,s=z=>{let m=o.value,_=m.symbolKeys,g=new cs(["payload","ctx"],{shape:z,inst:e,memo:n,syms:_}),h=R=>`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`,v=(R,b)=>`
7
+ for (let i = 0; i < ${R}.issues.length; i++) {
8
+ const iss = ${R}.issues[i];
9
+ iss.path = iss.path ? [${b}, ...iss.path] : [${b}];
10
+ payload.issues.push(iss);
11
+ }`;g.write("const input = payload.value;");let S=Object.create(null),w=0;for(let R of m.allKeys)S[R]=`key_${w++}`;g.write(n?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let R of m.allKeys){if(R==="__proto__")continue;let b=S[R],y=typeof R=="symbol"?`syms[${_.indexOf(R)}]`:Ya(R),P=`${y} in input`,N=z[R],F=N?._zod?.optin,M=F!==void 0,U=N?._zod?.optout==="optional";if(g.write(`const ${b} = ${h(y)};`),M&&U){let K=F==="optional"?`${b}_present`:`${b}.value !== undefined || ${b}_present`;g.write(`
12
+ const ${b}_present = ${P};
13
+ if (!${b}.issues.length || ${b}_present) {
14
+ if (${b}.issues.length) {${v(b,y)}
15
+ }
16
+
17
+ if (${K}) {
18
+ newResult[${y}] = ${b}.value;
19
+ }
20
+ }
21
+
22
+ `)}else M?g.write(`
23
+ if (${b}.issues.length) {${v(b,y)}
24
+ }
25
+
26
+ if (${b}.value === undefined) {
27
+ if (${P}) {
28
+ newResult[${y}] = undefined;
29
+ }
30
+ } else {
31
+ newResult[${y}] = ${b}.value;
32
+ }
33
+
34
+ `):g.write(`
35
+ const ${b}_present = ${P};
36
+ if (${b}.issues.length) {${v(b,y)}
37
+ }
38
+ if (!${b}_present && !${b}.issues.length) {
39
+ payload.issues.push({
40
+ code: "invalid_type",
41
+ expected: "nonoptional",
42
+ input: undefined,
43
+ path: [${y}]
44
+ });
45
+ }
46
+
47
+ if (${b}_present) {
48
+ newResult[${y}] = ${b}.value;
49
+ }
50
+
51
+ `)}return g.write("payload.value = newResult;"),g.write("return payload;"),g.compile()},i,c=Qt,a=!We.jitless,l=a&&Qa.value,p=t.catchall,f;e._zod.parse=(z,m)=>{f??(f=o.value);let _=z.value;return c(_)?a&&l&&m?.async===!1&&m.jitless!==!0?(i||(i=s(t.shape)),z=i(z,m),p?Wp([],_,z,m,f,e):z):r(z,m):(z.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),z)}});function sp(e,t,r,o){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let n=e.filter(s=>!It(s));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>ct(i,o,Ye())))}),t)}var Rc=q("$ZodUnion",(e,t)=>{ye.init(e,t),ge(e,"optin",o=>o.def.options.some(n=>n._zod.optin==="defaulted")?"defaulted":o.def.options.some(n=>n._zod.optin!==void 0)?"optional":void 0),ge(e,"optout",o=>o.def.options.some(n=>n._zod.optout==="optional")?"optional":void 0),ge(e,"values",o=>{if(o.def.options.every(n=>n._zod.values))return new Set(o.def.options.flatMap(n=>Array.from(n._zod.values)))}),ge(e,"pattern",o=>{if(o.def.options.every(n=>n._zod.pattern)){let n=o.def.options.map(s=>s._zod.pattern);return new RegExp(`^(${n.map(s=>Po(s.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let s=!1,i=[];for(let c of t.options){let a=c._zod.run({value:o.value,issues:[]},n);if(a instanceof Promise)i.push(a),s=!0;else{if(a.issues.length===0)return a;i.push(a)}}return s?Promise.all(i).then(c=>sp(c,o,e,n)):sp(i,o,e,n)}});var Xp=q("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Rc.init(e,t);let r=e._zod.parse;ge(e,"propValues",n=>{let s={};for(let i of n.def.options){let c=i._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${n.def.options.indexOf(i)}"`);for(let[a,u]of Object.entries(c)){Object.prototype.hasOwnProperty.call(s,a)||Ne(s,a,new Set);for(let l of u)s[a].add(l)}}return s}),t.options.forEach((n,s)=>{let i=bc.get(n._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw new Error(`Invalid discriminated union option at index "${s}"`)});let o=$r(()=>{let n=t.options,s=new Map;for(let i of n){let c=i._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let a of c){if(s.has(a))throw new Error(`Duplicate discriminator value "${String(a)}"`);s.set(a,i)}}return s});e._zod.parse=(n,s)=>{let i=n.value;if(!Qt(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let c=o.value.get(i?.[t.discriminator]);return c?c._zod.run(n,s):t.unionFallback||s.direction==="backward"?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:i,path:[t.discriminator],inst:e}),n)}}),Qp=q("$ZodIntersection",(e,t)=>{ye.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([a,u])=>ip(r,a,u)):ip(r,s,i)}});function zc(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(Ot(e)&&Ot(t)){let r=Object.keys(t),o=Object.keys(e).filter(s=>r.indexOf(s)!==-1),n={...e,...t};Object.prototype.hasOwnProperty.call(n,"__proto__")&&delete n.__proto__;for(let s of o){if(s==="__proto__")continue;let i=zc(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=zc(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function ip(e,t,r){let o=new Map,n,s=new Map,i=(u,l)=>{let p;if(u.code==="unrecognized_keys"&&!u.path?.length)n??(n=u),p=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let f=String(u.path[0]);s.has(f)||s.set(f,u),p=[f]}else return!1;for(let f of p)o.has(f)||o.set(f,{}),o.get(f)[l]=!0;return!0};for(let u of t.issues)i(u,"l")||e.issues.push(u);for(let u of r.issues)i(u,"r")||e.issues.push(u);let c=[...o].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(c.length){let u=n?c.filter(l=>n.keys.includes(l)):[];u.length&&e.issues.push({...n,keys:u});for(let l of c)!u.includes(l)&&s.has(l)&&e.issues.push(s.get(l))}let a=zc(t.value,r.value);if(!a.valid){if(It(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}var em=q("$ZodRecord",(e,t)=>{ye.init(e,t);let r=We.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let s=o.value;if(!Ot(s))return o.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),o;let i=[],c=t.keyType._zod.values;if(c&&!t.partial){o.value=r?r.alloc(e,o,{},n):{};let a=new Set;for(let l of c)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(a.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;let p=t.keyType._zod.run({value:l,issues:[]},n);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(p.issues.length){o.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(m=>ct(m,n,Ye())),input:l,path:[l],inst:e});continue}let f=p.value;if(f==="__proto__")continue;let z=t.valueType._zod.run({value:s[l],issues:[]},n);z instanceof Promise?i.push(z.then(m=>{m.issues.length&&o.issues.push(...gt(l,m.issues)),o.value[f]=m.value})):(z.issues.length&&o.issues.push(...gt(l,z.issues)),o.value[f]=z.value)}let u;for(let l in s)if(!a.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;o.value[l]=s[l]}else u=u??[],u.push(l);u&&u.length>0&&o.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}else{o.value=r?r.alloc(e,o,{},n):{};let a;for(let u of Reflect.ownKeys(s)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(s,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Oo.test(u)&&l.issues.length){let m=t.keyType._zod.run({value:Number(u),issues:[]},n);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(l=m)}if(l.issues.length){t.mode==="loose"?o.value[u]=s[u]:c?(a=a??[],a.push(u)):o.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(m=>ct(m,n,Ye())),input:u,path:[u],inst:e});continue}let f=l.value;if(f==="__proto__")continue;let z=t.valueType._zod.run({value:s[u],issues:[]},n);z instanceof Promise?i.push(z.then(m=>{m.issues.length&&o.issues.push(...gt(u,m.issues)),o.value[f]=m.value})):(z.issues.length&&o.issues.push(...gt(u,z.issues)),o.value[f]=z.value)}a&&a.length>0&&o.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:a,continue:!0})}return i.length?Promise.all(i).then(()=>o):o}});var tm=q("$ZodEnum",(e,t)=>{ye.init(e,t);let r=Ro(t.entries),o=new Set(r);e._zod.values=o;let n=r.filter(s=>ec.has(typeof s));e._zod.pattern=new RegExp(n.length?`^(${n.map(s=>ft(s.toString())).join("|")})$`:"^[^\\s\\S]$"),e._zod.parse=(s,i)=>{let c=s.value;return o.has(c)||s.issues.push({code:"invalid_value",values:r,input:c,inst:e}),s}}),rm=q("$ZodLiteral",(e,t)=>{ye.init(e,t);let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(t.values.length?`^(${t.values.map(o=>typeof o=="string"?ft(o):o?ft(o.toString()):String(o)).join("|")})$`:"^[^\\s\\S]$"),e._zod.parse=(o,n)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}});var om=q("$ZodTransform",(e,t)=>{ye.init(e,t),e._zod.optin="optional",We.memoizer?.guard(e),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Pr(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(r.value=i,r));if(n instanceof Promise)throw new dt;return r.value=n,r}});function ap(e,t){return e.value=t.issues.length?void 0:t.value,e}var Pc=q("$ZodOptional",(e,t)=>{ye.init(e,t),ge(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",ge(e,"values",r=>{let o=r.def.innerType._zod.values;return o?new Set([...o,void 0]):void 0}),ge(e,"pattern",r=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${Po(o.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let n=t.innerType._zod.run({value:r.value,issues:[]},o);return n instanceof Promise?n.then(s=>ap(r,s)):ap(r,n)}return t.innerType._zod.run(r,o)}}),nm=q("$ZodExactOptional",(e,t)=>{Pc.init(e,t),ge(e,"values",r=>r.def.innerType._zod.values),ge(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),sm=q("$ZodNullable",(e,t)=>{ye.init(e,t),ge(e,"optin",r=>r.def.innerType._zod.optin),ge(e,"optout",r=>r.def.innerType._zod.optout),ge(e,"pattern",r=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${Po(o.source)}|null)$`):void 0}),ge(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)}),im=q("$ZodDefault",(e,t)=>{ye.init(e,t),e._zod.optin="defaulted",ge(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>cp(s,t)):cp(n,t)}});function cp(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var am=q("$ZodPrefault",(e,t)=>{ye.init(e,t),e._zod.optin="defaulted",ge(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),cm=q("$ZodNonOptional",(e,t)=>{ye.init(e,t),ge(e,"values",r=>{let o=r.def.innerType._zod.values;return o?new Set([...o].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>up(s,e)):up(n,e)}});function up(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function lp(e,t,r,o){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(n=>ct(n,o,Ye()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var um=q("$ZodCatch",(e,t)=>{ye.init(e,t),ge(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),ge(e,"optout",r=>r.def.innerType._zod.optout),ge(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run({value:r.value,issues:[]},o);return n instanceof Promise?n.then(s=>lp(r,s,t,o)):lp(r,n,t,o)}});var Ec=q("$ZodPipe",(e,t)=>{ye.init(e,t),ge(e,"values",r=>r.def.in._zod.values),ge(e,"optin",r=>r.def.in._zod.optin),ge(e,"optout",r=>r.def.out._zod.optout),ge(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=t.out._zod.run(r,o);return s instanceof Promise?s.then(i=>us(i,t.in,o)):us(s,t.in,o)}let n=t.in._zod.run(r,o);return n instanceof Promise?n.then(s=>us(s,t.out,o)):us(n,t.out,o)}});function us(e,t,r){return e.issues.some(o=>o.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var lm=q("$ZodPreprocess",(e,t)=>{Ec.init(e,t)}),dm=q("$ZodReadonly",(e,t)=>{ye.init(e,t),ge(e,"propValues",r=>r.def.innerType._zod.propValues),ge(e,"values",r=>r.def.innerType._zod.values),ge(e,"optin",r=>r.def.innerType?._zod?.optin),ge(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(dp):dp(n)}});function dp(e){return e.memo||(e.value=Object.freeze(e.value)),e}var pm=q("$ZodLazy",(e,t)=>{ye.init(e,t),Wa(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),ge(e,"pattern",r=>r.innerType?._zod?.pattern),ge(e,"propValues",r=>r.innerType?._zod?.propValues),ge(e,"optin",r=>r.innerType?._zod?.optin??void 0),ge(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),mm=q("$ZodCustom",(e,t)=>{Ue.init(e,t),ye.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(s=>pp(s,r,o,e));pp(n,r,o,e)}});function pp(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(Rr(n))}}var kc=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Cc="~memo",hm=[];function Tc(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var fm=new WeakMap;function gm(e,t){let r=fm.get(e);if(r!==void 0)return r;if(t.has(e))return!0;t.add(e);let o=!1,n=c=>{!o&&c?._zod&&gm(c,t)&&(o=!0)},s=e._zod.def,i=s.type;switch(i){case"object":{for(let c of Reflect.ownKeys(s.shape))n(s.shape[c]);n(s.catchall);break}case"array":n(s.element);break;case"tuple":for(let c of s.items)n(c);n(s.rest);break;case"record":case"map":n(s.keyType),n(s.valueType);break;case"set":n(s.valueType);break;case"union":for(let c of s.options)n(c);break;case"intersection":n(s.left),n(s.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":n(s.innerType);break;case"pipe":n(s.in),n(s.out);break;case"function":n(s.input),n(s.output);break;case"lazy":n(e._zod.innerType);break;case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let c in s){let a=Object.getOwnPropertyDescriptor(s,c);if(!a||a.get)continue;let u=a.value;if(!(!u||typeof u!="object")){if(u._zod)n(u);else if(Array.isArray(u))for(let l of u)n(l)}}}return t.delete(e),fm.set(e,o),o}function Dy(e,t){let r=e.buckets.get(t);return r||(r=new Map,e.buckets.set(t,r)),r}var ps,ms=[],Zy={alloc(e,t,r){let o=ps;if(!o)return r;ps=void 0;let n={value:r,issues:null};return o.set(t.value,n),ms.push(n),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,o=(n,s)=>{if(s.direction!=="backward"&&Vy(s,n.value))throw new kc;return r(n,s)};e._zod.parse=o,e._zod.run===r&&(e._zod.run=o)})},attach(e){var t;let r,o,n;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,i=(c,a)=>{if(r===void 0&&(r=gm(e,new Set),!r))return e._zod.parse=s,e._zod.run===i&&(e._zod.run=s),s(c,a);let u=c.value;if(u===null||typeof u!="object")return s(c,a);let l=a[Cc];l||(l={buckets:new Map,backEdges:void 0},a[Cc]=l);let p;o===a?p=n:(p=Dy(l,e),o=a,n=p);let f=p.get(u);if(f)return c.value=f.value,f.issues?f.issues.length&&c.issues.push(...Tc(f.issues)):(c.memo=!0,l.backEdges??(l.backEdges=new Set),l.backEdges.add(f.value)),c;ps=p;let z=ms.length,m=s(c,a);ps=void 0;let _=ms.length>z?ms.pop():void 0;return m instanceof Promise?m.then(g=>(_&&(_.issues=g.issues.length?Tc(g.issues):hm),g)):(_&&(_.issues=m.issues.length?Tc(m.issues):hm),m)};e._zod.parse=i,e._zod.run===s&&(e._zod.run=i)})}};function Oc(){return Zy}function Vy(e,t){let r=e[Cc]?.backEdges;return r!==void 0&&t!==null&&typeof t=="object"&&r.has(t)}var Fy=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(s){return e[s]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",credit_card:"credit card number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};function n(s,i){return s==="number"&&typeof i=="number"&&!Number.isFinite(i)?String(i):o[s]??s}return s=>{switch(s.code){case"invalid_type":{let i=n(s.expected),c=nc(s.input),a=n(c,s.input);return`Invalid input: expected ${i}, received ${a}`}case"invalid_value":return s.values.length===1?`Invalid input: expected ${es(s.values[0])}`:`Invalid option: expected one of ${Xn(s.values,"|")}`;case"too_big":{let i=s.exact?"exactly ":s.inclusive?"<=":"<",c=t(s.origin);return c?`Too big: expected ${s.origin??"value"} to have ${i}${s.maximum.toString()} ${c.unit??"elements"}`:`Too big: expected ${s.origin??"value"} to be ${i}${s.maximum.toString()}`}case"too_small":{let i=s.exact?"exactly ":s.inclusive?">=":">",c=t(s.origin);return c?`Too small: expected ${s.origin} to have ${i}${s.minimum.toString()} ${c.unit}`:`Too small: expected ${s.origin} to be ${i}${s.minimum.toString()}`}case"invalid_format":{let i=s;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${Xn(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":return s.options&&Array.isArray(s.options)&&s.options.length>0?`Invalid discriminator value. Expected ${s.options.map(c=>`'${c}'`).join(" | ")}`:s.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function _m(){return{localeError:Fy()}}var ym;var Ic=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let o=r[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let o={...this.get(r)??{}};delete o.id;let n={...o,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Sm(){return new Ic}(ym=globalThis).__zod_globalRegistry??(ym.__zod_globalRegistry=Sm());var xt=globalThis.__zod_globalRegistry;function vm(e,t){return new e({type:"string",...re(t)})}function bm(e,t){return new e({type:"string",coerce:!0,...re(t)})}function xc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...re(t)})}function zm(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...re(t)})}function wm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...re(t)})}function $m(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...re(t)})}function Rm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...re(t)})}function Pm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...re(t)})}function Nc(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...re(t)})}function Em(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...re(t)})}function Tm(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...re(t)})}function km(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...re(t)})}function Cm(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...re(t)})}function Om(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...re(t)})}function Im(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...re(t)})}function xm(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...re(t)})}function Nm(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...re(t)})}function jm(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...re(t)})}function Am(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...re(t)})}function qm(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...re(t)})}function Mm(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...re(t)})}function Lm(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...re(t)})}function Um(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...re(t)})}function Dm(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...re(t)})}function hs(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...re(t)})}function fs(e,t){return new e({type:"string",format:"date",check:"string_format",...re(t)})}function gs(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...re(t)})}function _s(e,t){return new e({type:"string",format:"duration",check:"string_format",...re(t)})}function Zm(e,t){return new e({type:"number",checks:[],...re(t)})}function Vm(e,t){return new e({type:"number",coerce:!0,checks:[],...re(t)})}function Fm(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...re(t)})}function Hm(e,t){return new e({type:"boolean",...re(t)})}function Jm(e,t){return new e({type:"boolean",coerce:!0,...re(t)})}function Bm(e,t){return new e({type:"bigint",coerce:!0,...re(t)})}function Km(e,t){return new e({type:"null",...re(t)})}function Gm(e){return new e({type:"any"})}function Wm(e){return new e({type:"unknown"})}function Ym(e,t){return new e({type:"never",...re(t)})}function Xm(e,t){return new e({type:"date",coerce:!0,...re(t)})}function Tr(e,t){return new Sc({check:"less_than",...re(t),value:e,inclusive:!1})}function _t(e,t){return new Sc({check:"less_than",...re(t),value:e,inclusive:!0})}function kr(e,t){return new vc({check:"greater_than",...re(t),value:e,inclusive:!1})}function yt(e,t){return new vc({check:"greater_than",...re(t),value:e,inclusive:!0})}function xo(e,t){return new Vd({check:"multiple_of",...re(t),value:e})}function ys(e,t){return new Hd({check:"max_length",...re(t),maximum:e})}function Cr(e,t){return new Jd({check:"min_length",...re(t),minimum:e})}function Ss(e,t){return new Bd({check:"length_equals",...re(t),length:e})}function jc(e,t){return new Kd({check:"string_format",format:"regex",...re(t),pattern:e})}function Ac(e){return new Gd({check:"string_format",format:"lowercase",...re(e)})}function qc(e){return new Wd({check:"string_format",format:"uppercase",...re(e)})}function Mc(e,t){return new Yd({check:"string_format",format:"includes",...re(t),includes:e})}function Lc(e,t){return new Xd({check:"string_format",format:"starts_with",...re(t),prefix:e})}function Uc(e,t){return new Qd({check:"string_format",format:"ends_with",...re(t),suffix:e})}function Nt(e){return new ep({check:"overwrite",tx:e})}function Dc(e){return Nt(t=>t.normalize(e))}function Zc(){return Nt(e=>e.trim())}function Vc(){return Nt(e=>e.toLowerCase())}function Fc(){return Nt(e=>e.toUpperCase())}function Hc(){return Nt(e=>Xa(e))}function Qm(e,t,r){return new e({type:"array",element:t,...re(r)})}function eh(e,t,r){return new e({type:"custom",check:"custom",fn:t,...re(r)})}function th(e,t){let r=Hy(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(Rr(n,o.value,r._zod.def));else{let s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=o.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),o.issues.push(Rr(s))}},e(o.value,o)),t);return r}function Hy(e,t){let r=new Ue({check:"custom",...re(t)});return r._zod.check=e,r}function No(e,...t){for(let r of t)for(let o of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,o)&&Ne(e,o,r[o]);return e}function Ao(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??xt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function qe(e,t,r,o,n){let s=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:o.path,message:n}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw new Error(n);return Object.assign(r,s),!0}function ve(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,s=t.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)i.schema=c;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let f=i.schema,z=t.processors[n.type];if(!z)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);z(e,t,f,l)}let p=e._zod.parent;p&&(i.ref||(i.ref=p),ve(p,t,l),t.seen.get(p).isParent=!0)}let a=t.metadataRegistry.get(e);return a&&No(i.schema,a),t.io==="input"&&Be(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((o=i.schema).default??(o.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function rh(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function qo(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let o=new Map;for(let i of e.seen.entries()){let c=e.metadataRegistry.get(i[0])?.id;if(c){let a=o.get(c);if(a&&a!==i[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(c,i[0])}}let n=i=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(i[0])?.id,f=e.external.uri??(m=>m);if(p)return{ref:f(p)};let z=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=z,{defId:z,ref:`${f("__shared")}#/${c}/${rh(z)}`}}let a="#",u=`${a}/${c}/`;if(i[1]===r&&!i[1].schema.id)return{ref:a};let l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+rh(l)}},s=i=>{if(i[1].schema.$ref)return;let c=i[1],{ref:a,defId:u}=n(i);c.def={...c.schema},u&&(c.defId=u);let l=c.schema;for(let p in l)delete l[p];l.$ref=a};if(e.cycles==="throw")for(let i of e.seen.entries()){let c=i[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
52
+
53
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let c=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(c.cycle){s(i);continue}if(c.count>1&&e.reused==="ref"){s(i);continue}}e.external&&(e.sharedDefsExtractedFor=e.external)}function sh(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let o of t){if(!o||typeof o!="object")return;sh(o);let n=Object.keys(o);if(n.length!==1||n[0]!=="type")return;let s=o.type;for(let i of Array.isArray(s)?s:[s]){if(typeof i!="string")return;r.includes(i)||r.push(i)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var ih=new Set(["type","properties","required","additionalProperties"]),oh=["oneOf","anyOf"];function nh(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function Jc(e){let t=[];for(let s of e){if(typeof s!="object"||s.type!=="object")return null;for(let i in s)if(!ih.has(i))return null;t.push(s)}let r={},o=new Set;for(let s of t){for(let i in s.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let c=[];for(let u of t){let l=u.properties?.[i]??nh(u);l!=null&&(c.some(p=>JSON.stringify(p)===JSON.stringify(l))||c.push(l))}let a=c.length===1?c[0]:Jc(c)??{allOf:c};Ne(r,i,a)}for(let i of s.required??[])o.add(i)}let n={type:"object",properties:r};if(o.size&&(n.required=[...o]),t.every(s=>s.additionalProperties===!1))n.additionalProperties=!1;else{let s=[];for(let i of t){let c=nh(i);c&&!s.some(a=>JSON.stringify(a)===JSON.stringify(c))&&s.push(c)}s.length===1?n.additionalProperties=s[0]:s.length>1&&(n.additionalProperties={allOf:s})}return n}function Jy(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let n of ih)if(n in e)return;let r=t.filter(n=>oh.some(s=>Array.isArray(n[s]))),o=null;if(!r.length)o=Jc(t);else{let n=r[0],s=oh.find(a=>Array.isArray(n[a]));if(Object.keys(n).length!==1)return;let i=t.filter(a=>a!==n),c=n[s].map(a=>Jc([...i,a]));if(c.some(a=>!a))return;o={[s]:c}}o&&(delete e.allOf,No(e,o))}function Mo(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=c=>{let a=e.seen.get(c);if(a.ref===null)return;let u=a.def??a.schema,l={...u},p=a.ref;if(a.ref=null,p){o(p);let z=e.seen.get(p),m=z.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):No(u,m),No(u,l),c._zod.parent===p)for(let g in u)g==="$ref"||g==="allOf"||g in l||delete u[g];if(m.$ref&&z.def)for(let g in u)g==="$ref"||g==="allOf"||g in z.def&&JSON.stringify(u[g])===JSON.stringify(z.def[g])&&delete u[g]}let f=c._zod.parent;if(f&&f!==p){o(f);let z=e.seen.get(f);if(z?.schema.$ref&&(u.$ref=z.schema.$ref,z.def))for(let m in u)m==="$ref"||m==="allOf"||m in z.def&&JSON.stringify(u[m])===JSON.stringify(z.def[m])&&delete u[m]}e.override({zodSchema:c,jsonSchema:u,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())o(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())sh(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let u of[a.schema,a.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let p=c.get(l);p?p.push(u):c.set(l,[u])}for(let a of e.intersections)for(let u of c.get(a)??[])Jy(u)}}let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(c)}No(n,r.defId?r.schema:r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&n.id===s&&delete n.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];a.def&&a.defId&&(a.def.id===a.defId&&delete a.def.id,Ne(i,a.defId,a.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?n.$defs=i:n.definitions=i);try{let c=JSON.parse(JSON.stringify(n));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:jo(t,"input",e.processors),output:jo(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function Be(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return Be(o.element,r);if(o.type==="set")return Be(o.valueType,r);if(o.type==="lazy")return Be(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return Be(o.innerType,r);if(o.type==="intersection")return Be(o.left,r)||Be(o.right,r);if(o.type==="record"||o.type==="map")return Be(o.keyType,r)||Be(o.valueType,r);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Be(o.in,r)||Be(o.out,r);if(o.type==="object"){for(let n in o.shape)if(Be(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(Be(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(Be(n,r))return!0;return!!(o.rest&&Be(o.rest,r))}return!1}var ah=(e,t={})=>r=>{let o=Ao({...r,processors:t});return ve(e,o),qo(o,e),Mo(o,e)},jo=(e,t,r={})=>o=>{let{libraryOptions:n,target:s}=o??{},i=Ao({...n??{},target:s,io:t,processors:r});return ve(e,i),qo(i,e),Mo(i,e)};var By={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Gc=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:c,patterns:a,contentEncoding:u,laxFormat:l}=e._zod.bag;if(typeof s=="number"&&(n.minLength=s),typeof i=="number"&&(n.maxLength=i),c&&(n.format=By[c]??c,n.format===""&&delete n.format,(c==="time"||l)&&delete n.format),u&&(n.contentEncoding=u),a&&a.size>0){let p=[...a];p.length===1?n.pattern=p[0].source:p.length>1&&(n.allOf=[...p.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},Wc=(e,t,r,o)=>{let n=r,{minimum:s,maximum:i,format:c,multipleOf:a,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof c=="string"&&c.includes("int")?n.type="integer":n.type="number";let p=typeof l=="number"&&l>=(s??Number.NEGATIVE_INFINITY),f=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),z=t.target==="draft-04"||t.target==="openapi-3.0";p?z?(n.minimum=l,n.exclusiveMinimum=!0):n.exclusiveMinimum=l:typeof s=="number"&&(n.minimum=s),f?z?(n.maximum=u,n.exclusiveMaximum=!0):n.exclusiveMaximum=u:typeof i=="number"&&(n.maximum=i),typeof a=="number"&&(Number.isFinite(a)&&a!==0?n.multipleOf=Math.abs(a):qe(e,t,n,o,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`))},Yc=(e,t,r,o)=>{r.type="boolean"},Xc=(e,t,r,o)=>{qe(e,t,r,o,"BigInt cannot be represented in JSON Schema")},uh=(e,t,r,o)=>{qe(e,t,r,o,"Symbols cannot be represented in JSON Schema")},Qc=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},lh=(e,t,r,o)=>{qe(e,t,r,o,"Undefined cannot be represented in JSON Schema")},dh=(e,t,r,o)=>{qe(e,t,r,o,"Void cannot be represented in JSON Schema")},eu=(e,t,r,o)=>{r.not={}},tu=(e,t,r,o)=>{},ru=(e,t,r,o)=>{},ou=(e,t,r,o)=>{qe(e,t,r,o,"Date cannot be represented in JSON Schema")},nu=(e,t,r,o)=>{let n=e._zod.def,s=Ro(n.entries);if(s.length===0){r.not={};return}s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},su=(e,t,r,o)=>{let n=e._zod.def;if(n.values.length===0){r.not={};return}let s=[];for(let i of n.values)if(i===void 0){if(qe(e,t,r,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i=="bigint"){if(qe(e,t,r,o,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[i]:r.const=i}else s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),s.every(i=>typeof i=="boolean")&&(r.type="boolean"),s.every(i=>i===null)&&(r.type="null"),r.enum=s},ph=(e,t,r,o)=>{qe(e,t,r,o,"NaN cannot be represented in JSON Schema")},mh=(e,t,r,o)=>{let n=r,s=e._zod.pattern;if(!s)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=s.source},hh=(e,t,r,o)=>{let n=r,s={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:c,mime:a}=e._zod.bag;i!==void 0&&(s.minLength=i),c!==void 0&&(s.maxLength=c),a?a.length===1?(s.contentMediaType=a[0],Object.assign(n,s)):(Object.assign(n,s),n.anyOf=a.map(u=>({contentMediaType:u}))):Object.assign(n,s)},fh=(e,t,r,o)=>{r.type="boolean"},iu=(e,t,r,o)=>{qe(e,t,r,o,"Custom types cannot be represented in JSON Schema")},gh=(e,t,r,o)=>{qe(e,t,r,o,"Function types cannot be represented in JSON Schema")},au=(e,t,r,o)=>{qe(e,t,r,o,"Transforms cannot be represented in JSON Schema")},_h=(e,t,r,o)=>{qe(e,t,r,o,"Map cannot be represented in JSON Schema")},yh=(e,t,r,o)=>{qe(e,t,r,o,"Set cannot be represented in JSON Schema")},cu=(e,t,r,o)=>{let n=r,s=e._zod.def,{minimum:i,maximum:c}=e._zod.bag;typeof i=="number"&&(n.minItems=i),typeof c=="number"&&(n.maxItems=c),n.type="array",n.items=ve(s.element,t,{...o,path:[...o.path,"items"]})};function Lo(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Lo(t.out):t.type==="catch"?Lo(t.innerType):e._zod.optin}var uu=(e,t,r,o)=>{let n=r,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&qe(e,t,n,o,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let l in i)Ne(n.properties,l,ve(i[l],t,{...o,path:[...o.path,"properties",l]}));let a=new Set(Object.keys(i)),u=new Set([...a].filter(l=>{let p=s.shape[l];return t.io==="input"?Lo(p)===void 0:p._zod.optout===void 0}));u.size>0&&(n.required=Array.from(u)),s.catchall?._zod.def.type==="never"?n.additionalProperties=!1:s.catchall?s.catchall&&(n.additionalProperties=ve(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},lu=(e,t,r,o)=>{let n=e._zod.def,s=n.inclusive===!1,i=n.options.map((c,a)=>ve(c,t,{...o,path:[...o.path,s?"oneOf":"anyOf",a]}));s?r.oneOf=i:r.anyOf=i},du=(e,t,r,o)=>{let n=e._zod.def,s=ve(n.left,t,{...o,path:[...o.path,"allOf",0]}),i=ve(n.right,t,{...o,path:[...o.path,"allOf",1]}),c=u=>"allOf"in u&&Object.keys(u).length===1,a=[...c(s)?s.allOf:[s],...c(i)?i.allOf:[i]];r.allOf=a,t.intersections.push(a)},Sh=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="array";let i=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",a=s.items.map((_,g)=>ve(_,t,{...o,path:[...o.path,i,g]})),u=s.rest?ve(s.rest,t,{...o,path:[...o.path,c,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null,l=s.items.length;for(;l>0;){let _=s.items[l-1];if(!(t.io==="input"?Lo(_)!==void 0:_._zod.optout==="optional"))break;l--}let p=s.items.length,f=!s.rest;t.target==="draft-2020-12"?(n.prefixItems=a,f?n.items=!1:u&&(n.items=u),l>0&&(n.minItems=l),f&&(n.maxItems=p)):t.target==="openapi-3.0"?(n.items={anyOf:a},u&&n.items.anyOf.push(u),l>0&&(n.minItems=l),f&&(n.maxItems=p)):(n.items=a,f?n.additionalItems=!1:u&&(n.additionalItems=u),l>0&&(n.minItems=l),f&&(n.maxItems=p));let{minimum:z,maximum:m}=e._zod.bag;typeof z=="number"&&(n.minItems=z),typeof m=="number"&&(n.maxItems=m)};function Bc(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let m=e.get(t)?.def;if(!m)return t;let _=Bc(e,m,r);return _===m?t:_}for(let m of["anyOf","oneOf"]){let _=t[m];if(!Array.isArray(_))continue;let g=_.map(h=>Bc(e,h,r));g.some((h,v)=>h!==_[v])&&(t={...t,[m]:g})}let o=Array.isArray(t.type)?t.type:[t.type],n=!o.includes("string")&&o.some(m=>m==="number"||m==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!n&&!s?.some(m=>typeof m=="number"))return t;let{minimum:i,maximum:c,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:l,format:p,id:f,...z}=t;return z.enum?z.enum=z.enum.map(m=>typeof m=="number"?String(m):m):typeof z.const=="number"&&(z.const=String(z.const)),n&&(z.type="string",s||(z.pattern=(o.includes("number")?Oo:is).source)),z}var Kc=new WeakMap;function Ky(e){let t=new Map;for(let o of e.seen.values())o.def&&!t.has(o.schema)&&t.set(o.schema,o);let r=new Map;for(let o of Kc.get(e)??[]){let n=e.seen.get(o),s=(n?.def??n?.schema)?.propertyNames;if(!s||s===!0||r.has(s))continue;let i=Bc(t,s,new Set);i!==s&&r.set(s,i)}if(r.size)for(let o of e.seen.values())for(let n of[o.schema,o.def]){let s=n&&r.get(n.propertyNames);s&&(n.propertyNames=s)}}var pu=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object";let i=s.keyType,a=i._zod.bag?.patterns;if(s.mode==="loose"&&a&&a.size>0){let p=ve(s.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let f of a)Ne(n.patternProperties,f.source,p)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){n.propertyNames=ve(s.keyType,t,{...o,path:[...o.path,"propertyNames"]});let p=Kc.get(t);p||(p=[],Kc.set(t,p),t.deferred.push(()=>Ky(t))),p.push(e)}n.additionalProperties=ve(s.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let u=i._zod.values,l=t.io==="input"&&Lo(s.valueType)!==void 0;if(u&&!s.partial&&!l){let p=[...u].filter(f=>typeof f=="string"||typeof f=="number");p.length>0&&(n.required=p.map(String))}},mu=(e,t,r,o)=>{let n=e._zod.def,s=ve(n.innerType,t,o),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=n.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},hu=(e,t,r,o)=>{let n=e._zod.def;ve(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},fu=Symbol();function vh(e,t,r,o,n){let s=!1,i=JSON.stringify(e,(c,a)=>typeof a!="bigint"?a:(s=!0,null));return s?(qe(t,r,o,n,"BigInt defaults cannot be represented in JSON Schema"),fu):JSON.parse(i)}var gu=(e,t,r,o)=>{let n=e._zod.def;ve(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i=vh(n.defaultValue,e,t,r,o);i!==fu&&(r.default=i)},_u=(e,t,r,o)=>{let n=e._zod.def;ve(n.innerType,t,o);let s=t.seen.get(e);if(s.ref=n.innerType,t.io!=="input")return;let i=vh(n.defaultValue,e,t,r,o);i!==fu&&(r._prefault=i)},yu=(e,t,r,o)=>{let n=e._zod.def;ve(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{qe(e,t,r,o,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},Su=(e,t,r,o)=>{let n=e._zod.def,s=n.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?n.out:n.in:n.out;ve(i,t,o);let c=t.seen.get(e);c.ref=i},vu=(e,t,r,o)=>{let n=e._zod.def;ve(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.readOnly=!0},bh=(e,t,r,o)=>{let n=e._zod.def;ve(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},vs=(e,t,r,o)=>{let n=e._zod.def;ve(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},bu=(e,t,r,o)=>{let n=e._zod.innerType;ve(n,t,o);let s=t.seen.get(e);s.ref=n},ch={string:Gc,number:Wc,boolean:Yc,bigint:Xc,symbol:uh,null:Qc,undefined:lh,void:dh,never:eu,any:tu,unknown:ru,date:ou,enum:nu,literal:su,nan:ph,template_literal:mh,file:hh,success:fh,custom:iu,function:gh,transform:au,map:_h,set:yh,array:cu,object:uu,union:lu,intersection:du,tuple:Sh,record:pu,nullable:mu,nonoptional:hu,default:gu,prefault:_u,catch:yu,pipe:Su,readonly:vu,promise:bh,optional:vs,lazy:bu};function bs(e,t){if("_idmap"in e){let o=e,n=Ao({...t,processors:ch}),s={};for(let a of o._idmap.entries()){let[u,l]=a;ve(l,n)}let i={},c={registry:o,uri:t?.uri,defs:s};n.external=c;for(let a of o._idmap.entries()){let[u,l]=a;qo(n,l),Ne(i,u,Mo(n,l))}if(Object.keys(s).length>0){let a=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:s}}return{schemas:i}}let r=Ao({...t,processors:ch});return ve(e,r),qo(r,e),Mo(r,e)}var zh=new WeakSet([Object.prototype,Error.prototype]);function zs(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let o=r(this);return Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0})}})}var rS=(e,t)=>{rs.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);zh.has(r)||(zh.add(r),zs(r,"format",o=>n=>hc(o,n)),zs(r,"flatten",o=>n=>mc(o,n)),zs(r,"addIssue",o=>n=>{o.issues.push(n),o.message=JSON.stringify(o.issues,wr,2)}),zs(r,"addIssues",o=>n=>{o.issues.push(...n),o.message=JSON.stringify(o.issues,wr,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var tt=q("ZodError",rS,void 0,{Parent:Error});var wh=ns(tt),$h=ss(tt),ws=ko(tt),Rh=Co(tt),Ph=ad(tt),Eh=cd(tt),Th=ud(tt),kh=ld(tt),Ch=dd(tt),Oh=pd(tt),Ih=md(tt),xh=hd(tt);function nS(){We.localeError||Ye(_m())}function Rs(){We.memoizer||Ye({memoizer:Oc()})}var Se=q("ZodType",(e,t)=>(nS(),ye.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(pe.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return st(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(JS(e,t))},superRefine(e,t){return this.check(BS(e,t))},overwrite(e){return this.check(Nt(e))},optional(){return Q(this)},exactOptional(){return IS(this)},nullable(){return Ah(this)},nullish(){return Q(Ah(this))},nonoptional(e){return MS(this,e)},array(){return O(this)},or(e){return W([this,e])},and(e){return St(this,e)},transform(e){return qh(this,Bh(e))},default(e){return jS(this,e)},prefault(e){return qS(this,e)},catch(e){return US(this,e)},pipe(e){return qh(this,e)},readonly(){return VS(this)},describe(e){let t=this.clone();return xt.add(t,{description:e}),t},meta(...e){if(e.length===0)return xt.get(this);let t=this.clone();return xt.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return pe.hide(this,"~standard",{...wc(this),jsonSchema:{input:jo(this,"input"),output:jo(this,"output")}})},set"~standard"(e){pe.own(this,"~standard",e)},parse:function e(t,r){return wh(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await $h(this,t,r,{callee:e})},safeParse(e,t){return ws(this,e,t)},async safeParseAsync(e,t){return Rh(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){pe.own(this,"spa",e)},encode:function e(t,r){return Ph(this,t,r,{callee:e})},decode:function e(t,r){return Eh(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Th(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await kh(this,t,r,{callee:e})},safeEncode(e,t){return Ch(this,e,t)},safeDecode(e,t){return Oh(this,e,t)},async safeEncodeAsync(e,t){return Ih(this,e,t)},async safeDecodeAsync(e,t){return xh(this,e,t)},toJSONSchema(e){return ah(this,{})(e)},get description(){return xt.get(this)?.description},get _def(){return this._zod.def}}),Mh=q("_ZodString",(e,t)=>{ds.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(o,n,s)=>Gc(e,o,n,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null},{regex(...e){return this.check(jc(...e))},includes(...e){return this.check(Mc(...e))},startsWith(...e){return this.check(Lc(...e))},endsWith(...e){return this.check(Uc(...e))},min(...e){return this.check(Cr(...e))},max(...e){return this.check(ys(...e))},length(...e){return this.check(Ss(...e))},nonempty(...e){return this.check(Cr(1,...e))},lowercase(e){return this.check(Ac(e))},uppercase(e){return this.check(qc(e))},trim(){return this.check(Zc())},normalize(...e){return this.check(Dc(...e))},toLowerCase(){return this.check(Vc())},toUpperCase(){return this.check(Fc())},slugify(){return this.check(Hc())}}),wu=q("ZodString",(e,t)=>{ds.init(e,t),Mh.init(e,t)},{email(e){return this.check(xc(Lh,e))},url(e){return this.check(Nc(Dh,e))},jwt(e){return this.check(Dm(vS,e))},emoji(e){return this.check(Em(iS,e))},guid(e){return this.check(zm(sS,e))},uuid(e){return this.check(wm($s,e))},uuidv4(e){return this.check($m($s,e))},uuidv6(e){return this.check(Rm($s,e))},uuidv7(e){return this.check(Pm($s,e))},nanoid(e){return this.check(Tm(aS,e))},cuid(e){return this.check(km(cS,e))},cuid2(e){return this.check(Cm(uS,e))},ulid(e){return this.check(Om(lS,e))},base64(e){return this.check(Mm(_S,e))},base64url(e){return this.check(Lm(yS,e))},xid(e){return this.check(Im(dS,e))},ksuid(e){return this.check(xm(pS,e))},ipv4(e){return this.check(Nm(mS,e))},ipv6(e){return this.check(jm(hS,e))},cidrv4(e){return this.check(Am(fS,e))},cidrv6(e){return this.check(qm(gS,e))},e164(e){return this.check(Um(SS,e))},datetime(e){return this.check(hs(Uo,e))},date(e){return this.check(fs(Do,e))},time(e){return this.check(gs(Zo,e))},duration(e){return this.check(_s(Vo,e))}});function d(e){return vm(wu,e)}var Pe=q("ZodStringFormat",(e,t)=>{we.init(e,t),Mh.init(e,t)}),Uo=q("ZodISODateTime",(e,t)=>{Pp.init(e,t),Pe.init(e,t)}),Do=q("ZodISODate",(e,t)=>{Ep.init(e,t),Pe.init(e,t)}),Zo=q("ZodISOTime",(e,t)=>{Tp.init(e,t),Pe.init(e,t)}),Vo=q("ZodISODuration",(e,t)=>{kp.init(e,t),Pe.init(e,t)}),Lh=q("ZodEmail",(e,t)=>{fp.init(e,t),Pe.init(e,t)});function Uh(e){return xc(Lh,e)}var sS=q("ZodGUID",(e,t)=>{mp.init(e,t),Pe.init(e,t)});var $s=q("ZodUUID",(e,t)=>{hp.init(e,t),Pe.init(e,t)});var Dh=q("ZodURL",(e,t)=>{yp.init(e,t),Pe.init(e,t)});function Ps(e){return Nc(Dh,e)}var iS=q("ZodEmoji",(e,t)=>{Sp.init(e,t),Pe.init(e,t)});var aS=q("ZodNanoID",(e,t)=>{vp.init(e,t),Pe.init(e,t)});var cS=q("ZodCUID",(e,t)=>{bp.init(e,t),Pe.init(e,t)});var uS=q("ZodCUID2",(e,t)=>{zp.init(e,t),Pe.init(e,t)});var lS=q("ZodULID",(e,t)=>{wp.init(e,t),Pe.init(e,t)});var dS=q("ZodXID",(e,t)=>{$p.init(e,t),Pe.init(e,t)});var pS=q("ZodKSUID",(e,t)=>{Rp.init(e,t),Pe.init(e,t)});var mS=q("ZodIPv4",(e,t)=>{Cp.init(e,t),Pe.init(e,t)});var hS=q("ZodIPv6",(e,t)=>{Ip.init(e,t),Pe.init(e,t)});var fS=q("ZodCIDRv4",(e,t)=>{xp.init(e,t),Pe.init(e,t)});var gS=q("ZodCIDRv6",(e,t)=>{Np.init(e,t),Pe.init(e,t)});var _S=q("ZodBase64",(e,t)=>{Ap.init(e,t),Pe.init(e,t)});var yS=q("ZodBase64URL",(e,t)=>{qp.init(e,t),Pe.init(e,t)});var SS=q("ZodE164",(e,t)=>{Mp.init(e,t),Pe.init(e,t)});var vS=q("ZodJWT",(e,t)=>{Lp.init(e,t),Pe.init(e,t)});var Es=q("ZodNumber",(e,t)=>{$c.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(o,n,s)=>Wc(e,o,n,s);let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null},{gt(e,t){return this.check(kr(e,t))},gte(e,t){return this.check(yt(e,t))},min(e,t){return this.check(yt(e,t))},lt(e,t){return this.check(Tr(e,t))},lte(e,t){return this.check(_t(e,t))},max(e,t){return this.check(_t(e,t))},int(e){return this.check(Nh(e))},safe(e){return this.check(Nh(e))},positive(e){return this.check(kr(0,e))},nonnegative(e){return this.check(yt(0,e))},negative(e){return this.check(Tr(0,e))},nonpositive(e){return this.check(_t(0,e))},multipleOf(e,t){return this.check(xo(e,t))},step(e,t){return this.check(xo(e,t))},finite(){return this}});function V(e){return Zm(Es,e)}var bS=q("ZodNumberFormat",(e,t)=>{Up.init(e,t),Es.init(e,t)});function Nh(e){return Fm(bS,e)}var $u=q("ZodBoolean",(e,t)=>{Dp.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yc(e,r,o,n)});function G(e){return Hm($u,e)}var Zh=q("ZodBigInt",(e,t)=>{Zp.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(o,n,s)=>Xc(e,o,n,s);let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null},{gte(e,t){return this.check(yt(e,t))},min(e,t){return this.check(yt(e,t))},gt(e,t){return this.check(kr(e,t))},lt(e,t){return this.check(Tr(e,t))},lte(e,t){return this.check(_t(e,t))},max(e,t){return this.check(_t(e,t))},positive(e){return this.check(kr(BigInt(0),e))},negative(e){return this.check(Tr(BigInt(0),e))},nonpositive(e){return this.check(_t(BigInt(0),e))},nonnegative(e){return this.check(yt(BigInt(0),e))},multipleOf(e,t){return this.check(xo(e,t))}});var zS=q("ZodNull",(e,t)=>{Vp.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Qc(e,r,o,n)});function er(e){return Km(zS,e)}var wS=q("ZodAny",(e,t)=>{Fp.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>tu(e,r,o,n)});function Vh(){return Gm(wS)}var $S=q("ZodUnknown",(e,t)=>{Hp.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ru(e,r,o,n)});function ee(){return Wm($S)}var RS=q("ZodNever",(e,t)=>{Jp.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>eu(e,r,o,n)});function PS(e){return Ym(RS,e)}var Fh=q("ZodDate",(e,t)=>{Bp.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(o,n,s)=>ou(e,o,n,s),e.min=(o,n)=>e.check(yt(o,n)),e.max=(o,n)=>e.check(_t(o,n));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});var ES=q("ZodArray",(e,t)=>{Rs(),Kp.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>cu(e,r,o,n),e.element=t.element},{min(e,t){return this.check(Cr(e,t))},nonempty(e){return this.check(Cr(1,e))},max(e,t){return this.check(ys(e,t))},length(e,t){return this.check(Ss(e,t))},unwrap(){return this.element}});function O(e,t){return Qm(ES,e,t)}var Hh=q("ZodObject",(e,t)=>{Rs(),Yp.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>uu(e,r,o,n),pe.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return ce(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:ee()})},loose(){return this.clone({...this._zod.def,catchall:ee()})},strict(){return this.clone({...this._zod.def,catchall:PS()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return pe.extend(this,e)},safeExtend(e){return pe.safeExtend(this,e)},merge(e){return pe.merge(this,e)},pick(e){return pe.pick(this,e)},omit(e){return pe.omit(this,e)},partial(...e){return pe.partial(Kh,this,e[0])},exactPartial(...e){return pe.partial(Gh,this,e[0],"exactPartial")},required(...e){return pe.required(Wh,this,e[0])}});function E(e,t){let r={type:"object",shape:e??{},...pe.normalizeParams(t)};return new Hh(r)}function oe(e,t){return new Hh({type:"object",shape:e,catchall:ee(),...pe.normalizeParams(t)})}var Jh=q("ZodUnion",(e,t)=>{Rc.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>lu(e,r,o,n),e.options=t.options});function W(e,t){return new Jh({type:"union",options:e,...pe.normalizeParams(t)})}var TS=q("ZodDiscriminatedUnion",(e,t)=>{Jh.init(e,t),Xp.init(e,t)});function Ir(e,t,r){return new TS({type:"union",options:t,discriminator:e,...pe.normalizeParams(r)})}var kS=q("ZodIntersection",(e,t)=>{Qp.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>du(e,r,o,n)});function St(e,t){return new kS({type:"intersection",left:e,right:t})}var jh=q("ZodRecord",(e,t)=>{Rs(),em.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>pu(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function J(e,t,r){return!t||!t._zod?new jh({type:"record",keyType:d(),valueType:e,...pe.normalizeParams(t)}):new jh({type:"record",keyType:e,valueType:t,...pe.normalizeParams(r)})}var zu=q("ZodEnum",(e,t)=>{tm.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(o,n,s)=>nu(e,o,n,s),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new zu({...t,checks:[],...pe.normalizeParams(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new zu({...t,checks:[],...pe.normalizeParams(n),entries:s})}});function ce(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new zu({type:"enum",entries:r,...pe.normalizeParams(t)})}var CS=q("ZodLiteral",(e,t)=>{rm.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>su(e,r,o,n),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 I(e,t){return new CS({type:"literal",values:Array.isArray(e)?e:[e],...pe.normalizeParams(t)})}var OS=q("ZodTransform",(e,t)=>{Rs(),om.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>au(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Pr(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(pe.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=e),r.issues.push(pe.issue(i))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r)):(r.value=n,r)}});function Bh(e){return new OS({type:"transform",transform:e})}var Kh=q("ZodOptional",(e,t)=>{Pc.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>vs(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Q(e){return new Kh({type:"optional",innerType:e})}var Gh=q("ZodExactOptional",(e,t)=>{nm.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>vs(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function IS(e){return new Gh({type:"optional",innerType:e})}var xS=q("ZodNullable",(e,t)=>{sm.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>mu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Ah(e){return new xS({type:"nullable",innerType:e})}var NS=q("ZodDefault",(e,t)=>{im.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>gu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function jS(e,t){return new NS({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():pe.shallowClone(t)}})}var AS=q("ZodPrefault",(e,t)=>{am.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>_u(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function qS(e,t){return new AS({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():pe.shallowClone(t)}})}var Wh=q("ZodNonOptional",(e,t)=>{cm.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>hu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function MS(e,t){return new Wh({type:"nonoptional",innerType:e,...pe.normalizeParams(t)})}var LS=q("ZodCatch",(e,t)=>{um.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>yu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function US(e,t){return new LS({type:"catch",innerType:e,catchValue:typeof t=="function"?t:pe.constantCatch(t)})}var Yh=q("ZodPipe",(e,t)=>{Ec.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Su(e,r,o,n),e.in=t.in,e.out=t.out});function qh(e,t){return new Yh({type:"pipe",in:e,out:t})}var DS=q("ZodPreprocess",(e,t)=>{Yh.init(e,t),lm.init(e,t)}),ZS=q("ZodReadonly",(e,t)=>{dm.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>vu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function VS(e){return new ZS({type:"readonly",innerType:e})}var FS=q("ZodLazy",(e,t)=>{pm.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>bu(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function Fo(e){return new FS({type:"lazy",getter:e})}var HS=q("ZodCustom",(e,t)=>{mm.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>iu(e,r,o,n)});function JS(e,t={}){return eh(HS,e,t)}function BS(e,t){return th(e,t)}function tr(e,t){return new DS({type:"pipe",in:Bh(e),out:t})}var Qh={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var Xh;Xh||(Xh={});var vt={};Gn(vt,{ZodISODate:()=>Do,ZodISODateTime:()=>Uo,ZodISODuration:()=>Vo,ZodISOTime:()=>Zo,date:()=>WS,datetime:()=>GS,duration:()=>XS,time:()=>YS});function GS(e){return hs(Uo,e)}function WS(e){return fs(Do,e)}function YS(e){return gs(Zo,e)}function XS(e){return _s(Vo,e)}var Ts={};Gn(Ts,{bigint:()=>rv,boolean:()=>tv,date:()=>ov,number:()=>ev,string:()=>QS});function QS(e){return bm(wu,e)}function ev(e){return Vm(Es,e)}function tv(e){return Jm($u,e)}function rv(e){return Bm(Zh,e)}function ov(e){return Xm(Fh,e)}var ks="2025-11-25";var Cs=[ks,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Os="io.modelcontextprotocol/related-task",or="io.modelcontextprotocol/protocolVersion",xr="io.modelcontextprotocol/clientInfo",zt="io.modelcontextprotocol/serverInfo",nr="io.modelcontextprotocol/clientCapabilities",Ho="io.modelcontextprotocol/subscriptionId",Nr="io.modelcontextprotocol/logLevel";var sr="2.0";var jt=Fo(()=>W([d(),V(),G(),er(),J(d(),jt),O(jt)])),Ee=J(d(),jt),Pu=O(jt),Jo=W([d(),V().int()]),Bo=d(),Is=E({ttl:V().optional()}),xs=E({taskId:d()}),Ko=oe({progressToken:Jo.optional(),[Os]:xs.optional()}),Le=E({_meta:Ko.optional()}),ir=Le.extend({task:Is.optional()}),Te=E({method:d(),params:Le.loose().optional()}),Fe=E({_meta:Ko.optional()}),He=E({method:d(),params:Fe.loose().optional()}),Go=oe({get[zt](){return qr.optional().catch(void 0)}}),ke=oe({_meta:Go.optional()}),At=W([d(),V().int()]),Wo=E({jsonrpc:I(sr),id:At,...Te.shape}).strict(),Yo=E({jsonrpc:I(sr),...He.shape}).strict(),jr=E({jsonrpc:I(sr),id:At,result:ke}).strict(),Ar=E({jsonrpc:I(sr),id:At.optional(),error:E({code:V().int(),message:d(),data:ee().optional()})}).strict(),Xo=W([Wo,Yo,jr,Ar]),Eu=W([jr,Ar]),Qo=ke.strict(),Ns=Fe.extend({requestId:At.optional(),reason:d().optional()}),en=He.extend({method:I("notifications/cancelled"),params:Ns}),js=E({src:d(),mimeType:d().optional(),sizes:O(d()).optional(),theme:ce(["light","dark"]).optional()}),qt=E({icons:O(js).optional()}),bt=E({name:d(),title:d().optional()}),qr=bt.extend({...bt.shape,...qt.shape,version:d(),websiteUrl:d().optional(),description:d().optional()}),sv=St(E({applyDefaults:G().optional()}),Ee),iv=tr(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,St(E({form:sv.optional(),url:Ee.optional()}),Ee.optional())),As=oe({list:Ee.optional(),cancel:Ee.optional(),requests:oe({sampling:oe({createMessage:Ee.optional()}).optional(),elicitation:oe({create:Ee.optional()}).optional()}).optional()}),qs=oe({list:Ee.optional(),cancel:Ee.optional(),requests:oe({tools:oe({call:Ee.optional()}).optional()}).optional()}),Ms=E({experimental:J(d(),Ee).optional(),sampling:E({context:Ee.optional(),tools:Ee.optional()}).optional(),elicitation:iv.optional(),roots:E({listChanged:G().optional()}).optional(),tasks:As.optional(),extensions:J(d(),Ee).optional()}),Ls=Le.extend({protocolVersion:d(),capabilities:Ms,clientInfo:qr}),Us=Te.extend({method:I("initialize"),params:Ls}),tn=E({experimental:J(d(),Ee).optional(),logging:Ee.optional(),completions:Ee.optional(),prompts:E({listChanged:G().optional()}).optional(),resources:E({subscribe:G().optional(),listChanged:G().optional()}).optional(),tools:E({listChanged:G().optional()}).optional(),tasks:qs.optional(),extensions:J(d(),Ee).optional()}),Ds=ke.extend({protocolVersion:d(),capabilities:tn,serverInfo:qr,instructions:d().optional()}),Zs=He.extend({method:I("notifications/initialized"),params:Fe.optional()}),Vs=Te.extend({method:I("server/discover"),params:Le.optional()}),ar=ke.extend({supportedVersions:O(d()),capabilities:tn,instructions:d().optional()}),rn=Te.extend({method:I("ping"),params:Le.optional()}),Fs=E({progress:V(),total:Q(V()),message:Q(d())}),Hs=E({...Fe.shape,...Fs.shape,progressToken:Jo}),on=He.extend({method:I("notifications/progress"),params:Hs}),Js=Le.extend({cursor:Bo.optional()}),Mt=Te.extend({params:Js.optional()}),Lt=ke.extend({nextCursor:Bo.optional()}),nn=E({uri:d(),mimeType:Q(d()),_meta:J(d(),ee()).optional()}),sn=nn.extend({text:d()}),Tu=d().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),an=nn.extend({blob:Tu}),Ut=ce(["user","assistant"]),wt=E({audience:O(Ut).optional(),priority:V().min(0).max(1).optional(),lastModified:vt.datetime({offset:!0}).optional()}),cn=E({...bt.shape,...qt.shape,uri:d(),description:Q(d()),mimeType:Q(d()),size:Q(V()),annotations:wt.optional(),_meta:Q(oe({}))}),Bs=E({...bt.shape,...qt.shape,uriTemplate:d(),description:Q(d()),mimeType:Q(d()),annotations:wt.optional(),_meta:Q(oe({}))}),Ks=Mt.extend({method:I("resources/list")}),Gs=Lt.extend({resources:O(cn)}),Ws=Mt.extend({method:I("resources/templates/list")}),Ys=Lt.extend({resourceTemplates:O(Bs)}),Mr=Le.extend({uri:d()}),Xs=Mr,Qs=Te.extend({method:I("resources/read"),params:Xs}),ei=ke.extend({contents:O(W([sn,an]))}),ti=He.extend({method:I("notifications/resources/list_changed"),params:Fe.optional()}),ri=Mr,oi=Te.extend({method:I("resources/subscribe"),params:ri}),ni=Mr,si=Te.extend({method:I("resources/unsubscribe"),params:ni}),un=E({toolsListChanged:G().optional(),promptsListChanged:G().optional(),resourcesListChanged:G().optional(),resourceSubscriptions:O(d()).optional()}),ii=Le.extend({notifications:un}),ai=Te.extend({method:I("subscriptions/listen"),params:ii}),ci=Fe.extend({notifications:un}),ui=He.extend({method:I("notifications/subscriptions/acknowledged"),params:ci}),li=Go.extend({[Ho]:At}),di=ke.extend({_meta:li}),pi=Fe.extend({uri:d()}),mi=He.extend({method:I("notifications/resources/updated"),params:pi}),hi=E({name:d(),description:Q(d()),required:Q(G())}),fi=E({...bt.shape,...qt.shape,description:Q(d()),arguments:Q(O(hi)),_meta:Q(oe({}))}),gi=Mt.extend({method:I("prompts/list")}),_i=Lt.extend({prompts:O(fi)}),yi=Le.extend({name:d(),arguments:J(d(),d()).optional()}),Si=Te.extend({method:I("prompts/get"),params:yi}),Lr=E({type:I("text"),text:d(),annotations:wt.optional(),_meta:J(d(),ee()).optional()}),Ur=E({type:I("image"),data:Tu,mimeType:d(),annotations:wt.optional(),_meta:J(d(),ee()).optional()}),Dr=E({type:I("audio"),data:Tu,mimeType:d(),annotations:wt.optional(),_meta:J(d(),ee()).optional()}),vi=E({type:I("tool_use"),name:d(),id:d(),input:J(d(),ee()),_meta:J(d(),ee()).optional()}),bi=E({type:I("resource"),resource:W([sn,an]),annotations:wt.optional(),_meta:J(d(),ee()).optional()}),zi=cn.extend({type:I("resource_link")}),Zr=W([Lr,Ur,Dr,zi,bi]),wi=E({role:Ut,content:Zr}),$i=ke.extend({description:d().optional(),messages:O(wi)}),Ri=He.extend({method:I("notifications/prompts/list_changed"),params:Fe.optional()}),Pi=E({title:d().optional(),readOnlyHint:G().optional(),destructiveHint:G().optional(),idempotentHint:G().optional(),openWorldHint:G().optional()}),Ei=E({taskSupport:ce(["required","optional","forbidden"]).optional()}),ln=E({...bt.shape,...qt.shape,description:d().optional(),inputSchema:E({type:I("object"),properties:J(d(),jt).optional(),required:O(d()).optional()}).catchall(ee()),outputSchema:oe({$schema:d().optional()}).optional(),annotations:Pi.optional(),execution:Ei.optional(),_meta:J(d(),ee()).optional()}),Ti=Mt.extend({method:I("tools/list")}),ki=Lt.extend({tools:O(ln)}),dn=ke.extend({content:O(Zr).default([]),structuredContent:ee().optional(),isError:G().optional()}),ku=dn.or(ke.extend({toolResult:ee()})),Ci=ir.extend({name:d(),arguments:J(d(),ee()).optional()}),Oi=Te.extend({method:I("tools/call"),params:Ci}),Ii=He.extend({method:I("notifications/tools/list_changed"),params:Fe.optional()}),pn=E({autoRefresh:G().default(!0),debounceMs:V().int().nonnegative().default(300)}),mn=ce(["debug","info","notice","warning","error","critical","alert","emergency"]),xi=Le.extend({level:mn}),Ni=Te.extend({method:I("logging/setLevel"),params:xi}),ji=Fe.extend({level:mn,logger:d().optional(),data:ee()}),Ai=He.extend({method:I("notifications/message"),params:ji}),qi=E({name:d().optional()}),Mi=E({hints:O(qi).optional(),costPriority:V().min(0).max(1).optional(),speedPriority:V().min(0).max(1).optional(),intelligencePriority:V().min(0).max(1).optional()}),Li=E({mode:ce(["auto","required","none"]).optional()}),Ui=E({type:I("tool_result"),toolUseId:d().describe("The unique identifier for the corresponding tool call."),content:O(Zr),structuredContent:ee().optional(),isError:G().optional(),_meta:J(d(),ee()).optional()}),Di=Ir("type",[Lr,Ur,Dr]),rr=Ir("type",[Lr,Ur,Dr,vi,Ui]),Zi=E({role:Ut,content:W([rr,O(rr)]),_meta:J(d(),ee()).optional()}),Vi=ir.extend({messages:O(Zi),modelPreferences:Mi.optional(),systemPrompt:d().optional(),includeContext:ce(["none","thisServer","allServers"]).optional(),temperature:V().optional(),maxTokens:V().int(),stopSequences:O(d()).optional(),metadata:Ee.optional(),tools:O(ln).optional(),toolChoice:Li.optional()}),Fi=Te.extend({method:I("sampling/createMessage"),params:Vi}),Hi=ke.extend({model:d(),stopReason:Q(ce(["endTurn","stopSequence","maxTokens"]).or(d())),role:Ut,content:Di}),Ji=ke.extend({model:d(),stopReason:Q(ce(["endTurn","stopSequence","maxTokens","toolUse"]).or(d())),role:Ut,content:W([rr,O(rr)])}),hn=E({type:I("boolean"),title:d().optional(),description:d().optional(),default:G().optional()}),Vr=E({type:I("string"),title:d().optional(),description:d().optional(),minLength:V().optional(),maxLength:V().optional(),format:ce(["email","uri","date","date-time"]).optional(),default:d().optional()}),Fr=E({type:ce(["number","integer"]),title:d().optional(),description:d().optional(),minimum:V().optional(),maximum:V().optional(),default:V().optional()}),fn=E({type:I("string"),title:d().optional(),description:d().optional(),enum:O(d()),default:d().optional()}),gn=E({type:I("string"),title:d().optional(),description:d().optional(),oneOf:O(E({const:d(),title:d()})),default:d().optional()}),_n=E({type:I("string"),title:d().optional(),description:d().optional(),enum:O(d()),enumNames:O(d()).optional(),default:d().optional()}),Bi=W([fn,gn]),yn=E({type:I("array"),title:d().optional(),description:d().optional(),minItems:V().optional(),maxItems:V().optional(),items:E({type:I("string"),enum:O(d())}),default:O(d()).optional()}),Sn=E({type:I("array"),title:d().optional(),description:d().optional(),minItems:V().optional(),maxItems:V().optional(),items:E({anyOf:O(E({const:d(),title:d()}))}),default:O(d()).optional()}),Ki=W([yn,Sn]),Gi=W([_n,Bi,Ki]),vn=W([Gi,hn,Vr,Fr]),Hr=ir.extend({mode:I("form").optional(),message:d(),requestedSchema:E({type:I("object"),properties:J(d(),vn),required:O(d()).optional()}).catchall(ee())}),Wi=ir.extend({mode:I("url"),message:d(),elicitationId:d(),url:d().url()}),Yi=W([Hr,Wi]),Xi=Te.extend({method:I("elicitation/create"),params:Yi}),Qi=Fe.extend({elicitationId:d()}),ea=He.extend({method:I("notifications/elicitation/complete"),params:Qi}),ta=ke.extend({action:ce(["accept","decline","cancel"]),content:tr(e=>e===null?void 0:e,J(d(),W([d(),V(),G(),O(d())])).optional())}),ra=E({type:I("ref/resource"),uri:d()}),oa=E({type:I("ref/prompt"),name:d()}),na=Le.extend({ref:W([oa,ra]),argument:E({name:d(),value:d()}),context:E({arguments:J(d(),d()).optional()}).optional()}),sa=Te.extend({method:I("completion/complete"),params:na}),ia=ke.extend({completion:oe({values:O(d()).max(100),total:Q(V().int()),hasMore:Q(G())})}),aa=E({uri:d().startsWith("file://"),name:d().optional(),_meta:J(d(),ee()).optional()}),ca=Te.extend({method:I("roots/list"),params:Le.optional()}),ua=ke.extend({roots:O(aa)}),la=He.extend({method:I("notifications/roots/list_changed"),params:Fe.optional()}),Cu=oe({ttl:V().optional(),pollInterval:V().optional()}),da=ce(["working","input_required","completed","failed","cancelled"]),Dt=E({taskId:d(),status:da,ttl:W([V(),er()]),createdAt:d(),lastUpdatedAt:d(),pollInterval:Q(V()),statusMessage:Q(d())}),Ou=ke.extend({task:Dt}),pa=Fe.merge(Dt),Iu=He.extend({method:I("notifications/tasks/status"),params:pa}),xu=Te.extend({method:I("tasks/get"),params:Le.extend({taskId:d()})}),Nu=ke.merge(Dt),ju=Te.extend({method:I("tasks/result"),params:Le.extend({taskId:d()})}),Au=ke.loose(),qu=Mt.extend({method:I("tasks/list")}),Mu=Lt.extend({tasks:O(Dt)}),Lu=Te.extend({method:I("tasks/cancel"),params:Le.extend({taskId:d()})}),Uu=ke.merge(Dt),Du=W([rn,Us,Vs,sa,Ni,Si,gi,Ks,Ws,Qs,oi,si,ai,Oi,Ti]),Zu=W([en,on,Zs,la]),Vu=W([Qo,Hi,Ji,ta,ua]),Fu=W([rn,Fi,Xi,ca]),Hu=W([en,on,Ai,mi,ti,Ii,Ri,ui,ea]),Ju=W([Qo,Ds,ar,ia,$i,_i,Gs,Ys,ei,dn,ki,di]),Me=Ps().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Qh.custom,message:"URL must be parseable",fatal:!0}),cc}).refine(e=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),ma=oe({resource:d().url(),authorization_servers:O(Me).optional(),jwks_uri:d().url().optional(),scopes_supported:O(d()).optional(),bearer_methods_supported:O(d()).optional(),resource_signing_alg_values_supported:O(d()).optional(),resource_name:d().optional(),resource_documentation:d().optional(),resource_policy_uri:d().url().optional(),resource_tos_uri:d().url().optional(),tls_client_certificate_bound_access_tokens:G().optional(),authorization_details_types_supported:O(d()).optional(),dpop_signing_alg_values_supported:O(d()).optional(),dpop_bound_access_tokens_required:G().optional()}),bn=oe({issuer:d(),authorization_endpoint:Me,token_endpoint:Me,registration_endpoint:Me.optional(),scopes_supported:O(d()).optional(),response_types_supported:O(d()),response_modes_supported:O(d()).optional(),grant_types_supported:O(d()).optional(),token_endpoint_auth_methods_supported:O(d()).optional(),token_endpoint_auth_signing_alg_values_supported:O(d()).optional(),service_documentation:Me.optional(),revocation_endpoint:Me.optional(),revocation_endpoint_auth_methods_supported:O(d()).optional(),revocation_endpoint_auth_signing_alg_values_supported:O(d()).optional(),introspection_endpoint:d().optional(),introspection_endpoint_auth_methods_supported:O(d()).optional(),introspection_endpoint_auth_signing_alg_values_supported:O(d()).optional(),code_challenge_methods_supported:O(d()).optional(),client_id_metadata_document_supported:G().optional(),authorization_response_iss_parameter_supported:G().optional().catch(void 0)}),ha=oe({issuer:d(),authorization_endpoint:Me,token_endpoint:Me,userinfo_endpoint:Me.optional(),jwks_uri:Me,registration_endpoint:Me.optional(),scopes_supported:O(d()).optional(),response_types_supported:O(d()),response_modes_supported:O(d()).optional(),grant_types_supported:O(d()).optional(),acr_values_supported:O(d()).optional(),subject_types_supported:O(d()),id_token_signing_alg_values_supported:O(d()),id_token_encryption_alg_values_supported:O(d()).optional(),id_token_encryption_enc_values_supported:O(d()).optional(),userinfo_signing_alg_values_supported:O(d()).optional(),userinfo_encryption_alg_values_supported:O(d()).optional(),userinfo_encryption_enc_values_supported:O(d()).optional(),request_object_signing_alg_values_supported:O(d()).optional(),request_object_encryption_alg_values_supported:O(d()).optional(),request_object_encryption_enc_values_supported:O(d()).optional(),token_endpoint_auth_methods_supported:O(d()).optional(),token_endpoint_auth_signing_alg_values_supported:O(d()).optional(),display_values_supported:O(d()).optional(),claim_types_supported:O(d()).optional(),claims_supported:O(d()).optional(),service_documentation:d().optional(),claims_locales_supported:O(d()).optional(),ui_locales_supported:O(d()).optional(),claims_parameter_supported:G().optional(),request_parameter_supported:G().optional(),request_uri_parameter_supported:G().optional(),require_request_uri_registration:G().optional(),op_policy_uri:Me.optional(),op_tos_uri:Me.optional(),client_id_metadata_document_supported:G().optional(),authorization_response_iss_parameter_supported:G().optional().catch(void 0)}),fa=E({...ha.shape,...bn.pick({code_challenge_methods_supported:!0}).shape}),ga=E({access_token:d(),id_token:d().optional(),token_type:d(),expires_in:Ts.number().optional(),scope:d().optional(),refresh_token:d().optional()}).strip(),_a=E({issued_token_type:I("urn:ietf:params:oauth:token-type:id-jag"),access_token:d(),token_type:d().optional(),expires_in:V().optional(),scope:d().optional()}).strip(),ya=E({error:d(),error_description:d().optional(),error_uri:d().optional()}),Ru=Me.optional().or(I("").transform(()=>{})),Sa=E({redirect_uris:O(Me),token_endpoint_auth_method:d().optional(),grant_types:O(d()).optional(),response_types:O(d()).optional(),application_type:d().optional(),client_name:d().optional(),client_uri:Me.optional(),logo_uri:Ru,scope:d().optional(),contacts:O(d()).optional(),tos_uri:Ru,policy_uri:d().optional(),jwks_uri:Me.optional(),jwks:Vh().optional(),software_id:d().optional(),software_version:d().optional(),software_statement:d().optional()}).strip(),va=E({client_id:d(),client_secret:d().optional(),client_id_issued_at:V().optional(),client_secret_expires_at:V().optional()}).strip(),ba=Sa.merge(va),Bu=E({error:d(),error_description:d().optional()}).strip(),Ku=E({token:d(),token_type_hint:d().optional()}).strip();var Qu=Symbol.for("mcp.sdk.errorBrands");function ur(e,t){let r=new Set,o=t;for(;typeof o=="function";){let n=o.mcpBrand;Object.prototype.hasOwnProperty.call(o,"mcpBrand")&&typeof n=="string"&&r.add(n),o=Object.getPrototypeOf(o)}r.size!==0&&Object.defineProperty(e,Qu,{value:r,enumerable:!1,configurable:!0})}function rt(e,t){try{if(typeof t=="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand=="string"&&Object.prototype.hasOwnProperty.call(t,Qu)){let r=t[Qu];if(r&&typeof r.has=="function"&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var av=class vf extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return rt(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return rt(this,t)}constructor(t,r,o){super(r),this.code=t,this.errorUri=o,this.name="OAuthError",ur(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}static fromResponse(t){return new vf(t.error,t.error_description??t.error,t.error_uri)}},X=(function(e){return e.NotConnected="NOT_CONNECTED",e.AlreadyConnected="ALREADY_CONNECTED",e.NotInitialized="NOT_INITIALIZED",e.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",e.RequestTimeout="REQUEST_TIMEOUT",e.ConnectionClosed="CONNECTION_CLOSED",e.SendFailed="SEND_FAILED",e.InvalidResult="INVALID_RESULT",e.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",e.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",e.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",e.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",e.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",e.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",e.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",e.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",e.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",e.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",e.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",e})({}),Y=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return rt(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return rt(this,e)}constructor(e,t,r){super(t),this.code=e,this.data=r,this.name="SdkError",ur(this,new.target)}},Ta=class extends Y{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r){super(e,t,r),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};var bf="2026-07-28",nl=[bf];function Zt(e){return e>=bf}function sl(e){return e.filter(t=>!Zt(t))}function Tn(e){return e.filter(t=>Zt(t))}function zf(e){let t=e.structuredContent;return t===void 0||!(typeof t!="object"||t===null||Array.isArray(t))||(e.content?.some(r=>r.type==="text")??!1)?e:{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var wf=["task","inputRequests","requestState"];function cv(e){return e===null||typeof e!="object"||Array.isArray(e)||e.content!==void 0||wf.some(t=>t in e)?e:{...e,content:[]}}function uv(){let e=Fo(()=>W([d(),V(),G(),er(),J(d(),e),O(e)])),t=J(d(),e),r=W([d(),V().int()]),o=d(),n=E({ttl:V().optional()}),s=E({taskId:d()}),i=oe({progressToken:r.optional(),"io.modelcontextprotocol/related-task":s.optional()}),c=E({_meta:i.optional()}),a=c.extend({task:n.optional()}),u=E({method:d(),params:c.loose().optional()}),l=E({_meta:i.optional()}),p=E({method:d(),params:l.loose().optional()}),f=oe({_meta:i.optional()}),z=W([d(),V().int()]),m=f.strict(),_=l.extend({requestId:z.optional(),reason:d().optional()}),g=p.extend({method:I("notifications/cancelled"),params:_}),h=E({src:d(),mimeType:d().optional(),sizes:O(d()).optional(),theme:ce(["light","dark"]).optional()}),v=E({icons:O(h).optional()}),S=E({name:d(),title:d().optional()}),w=S.extend({...S.shape,...v.shape,version:d(),websiteUrl:d().optional(),description:d().optional()}),R=St(E({applyDefaults:G().optional()}),t),b=tr(Ve=>Ve&&typeof Ve=="object"&&!Array.isArray(Ve)&&Object.keys(Ve).length===0?{form:{}}:Ve,St(E({form:R.optional(),url:t.optional()}),t.optional())),y=oe({list:t.optional(),cancel:t.optional(),requests:oe({sampling:oe({createMessage:t.optional()}).optional(),elicitation:oe({create:t.optional()}).optional()}).optional()}),P=oe({list:t.optional(),cancel:t.optional(),requests:oe({tools:oe({call:t.optional()}).optional()}).optional()}),N=E({experimental:J(d(),t).optional(),sampling:E({context:t.optional(),tools:t.optional()}).optional(),elicitation:b.optional(),roots:E({listChanged:G().optional()}).optional(),tasks:y.optional(),extensions:J(d(),t).optional()}),F=c.extend({protocolVersion:d(),capabilities:N,clientInfo:w}),M=u.extend({method:I("initialize"),params:F}),U=E({experimental:J(d(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:E({listChanged:G().optional()}).optional(),resources:E({subscribe:G().optional(),listChanged:G().optional()}).optional(),tools:E({listChanged:G().optional()}).optional(),tasks:P.optional(),extensions:J(d(),t).optional()}),K=f.extend({protocolVersion:d(),capabilities:U,serverInfo:w,instructions:d().optional()}),B=p.extend({method:I("notifications/initialized"),params:l.optional()}),me=u.extend({method:I("ping"),params:c.optional()}),$e=E({progress:V(),total:Q(V()),message:Q(d())}),be=E({...l.shape,...$e.shape,progressToken:r}),Ie=p.extend({method:I("notifications/progress"),params:be}),he=c.extend({cursor:o.optional()}),C=u.extend({params:he.optional()}),j=f.extend({nextCursor:o.optional()}),Z=E({uri:d(),mimeType:Q(d()),_meta:J(d(),ee()).optional()}),$=Z.extend({text:d()}),k=d().refine(Ve=>{try{return atob(Ve),!0}catch{return!1}},{message:"Invalid Base64 string"}),x=Z.extend({blob:k}),H=ce(["user","assistant"]),te=E({audience:O(H).optional(),priority:V().min(0).max(1).optional(),lastModified:vt.datetime({offset:!0}).optional()}),de=E({...S.shape,...v.shape,uri:d(),description:Q(d()),mimeType:Q(d()),size:Q(V()),annotations:te.optional(),_meta:Q(oe({}))}),ie=E({...S.shape,...v.shape,uriTemplate:d(),description:Q(d()),mimeType:Q(d()),annotations:te.optional(),_meta:Q(oe({}))}),ze=C.extend({method:I("resources/list")}),Je=j.extend({resources:O(de)}),T=C.extend({method:I("resources/templates/list")}),A=j.extend({resourceTemplates:O(ie)}),L=c.extend({uri:d()}),ne=L,se=u.extend({method:I("resources/read"),params:ne}),le=f.extend({contents:O(W([$,x]))}),Ce=p.extend({method:I("notifications/resources/list_changed"),params:l.optional()}),je=L,De=u.extend({method:I("resources/subscribe"),params:je}),xe=L,Re=u.extend({method:I("resources/unsubscribe"),params:xe}),ot=l.extend({uri:d()}),Ae=p.extend({method:I("notifications/resources/updated"),params:ot}),pt=E({name:d(),description:Q(d()),required:Q(G())}),it=E({...S.shape,...v.shape,description:Q(d()),arguments:Q(O(pt)),_meta:Q(oe({}))}),mt=C.extend({method:I("prompts/list")}),Rt=j.extend({prompts:O(it)}),Pt=c.extend({name:d(),arguments:J(d(),d()).optional()}),Vt=u.extend({method:I("prompts/get"),params:Pt}),Ft=E({type:I("text"),text:d(),annotations:te.optional(),_meta:J(d(),ee()).optional()}),Ht=E({type:I("image"),data:k,mimeType:d(),annotations:te.optional(),_meta:J(d(),ee()).optional()}),Jt=E({type:I("audio"),data:k,mimeType:d(),annotations:te.optional(),_meta:J(d(),ee()).optional()}),Yr=E({type:I("tool_use"),name:d(),id:d(),input:J(d(),ee()),_meta:J(d(),ee()).optional()}),Et=E({type:I("resource"),resource:W([$,x]),annotations:te.optional(),_meta:J(d(),ee()).optional()}),Xr=de.extend({type:I("resource_link")}),nt=W([Ft,Ht,Jt,Xr,Et]),lr=E({role:H,content:nt}),dr=f.extend({description:d().optional(),messages:O(lr)}),Bt=p.extend({method:I("notifications/prompts/list_changed"),params:l.optional()}),Qr=E({title:d().optional(),readOnlyHint:G().optional(),destructiveHint:G().optional(),idempotentHint:G().optional(),openWorldHint:G().optional()}),pr=E({taskSupport:ce(["required","optional","forbidden"]).optional()}),Kt=E({...S.shape,...v.shape,description:d().optional(),inputSchema:E({type:I("object"),properties:J(d(),e).optional(),required:O(d()).optional()}).catchall(ee()),outputSchema:E({type:I("object"),properties:J(d(),e).optional(),required:O(d()).optional()}).catchall(ee()).optional(),annotations:Qr.optional(),execution:pr.optional(),_meta:J(d(),ee()).optional()}),mr=C.extend({method:I("tools/list")}),hr=j.extend({tools:O(Kt)}),fr=f.extend({content:O(nt),structuredContent:J(d(),ee()).optional(),isError:G().optional()}),Ze=a.extend({name:d(),arguments:J(d(),ee()).optional()}),eo=u.extend({method:I("tools/call"),params:Ze}),On=p.extend({method:I("notifications/tools/list_changed"),params:l.optional()}),gr=ce(["debug","info","notice","warning","error","critical","alert","emergency"]),to=c.extend({level:gr}),ro=u.extend({method:I("logging/setLevel"),params:to}),oo=l.extend({level:gr,logger:d().optional(),data:ee()}),no=p.extend({method:I("notifications/message"),params:oo}),so=E({name:d().optional()}),io=E({hints:O(so).optional(),costPriority:V().min(0).max(1).optional(),speedPriority:V().min(0).max(1).optional(),intelligencePriority:V().min(0).max(1).optional()}),ao=E({mode:ce(["auto","required","none"]).optional()}),In=E({type:I("tool_result"),toolUseId:d().describe("The unique identifier for the corresponding tool call."),content:O(nt),structuredContent:E({}).loose().optional(),isError:G().optional(),_meta:J(d(),ee()).optional()}),co=Ir("type",[Ft,Ht,Jt]),Tt=Ir("type",[Ft,Ht,Jt,Yr,In]),uo=E({role:H,content:W([Tt,O(Tt)]),_meta:J(d(),ee()).optional()}),lo=a.extend({messages:O(uo),modelPreferences:io.optional(),systemPrompt:d().optional(),includeContext:ce(["none","thisServer","allServers"]).optional(),temperature:V().optional(),maxTokens:V().int(),stopSequences:O(d()).optional(),metadata:t.optional(),tools:O(Kt).optional(),toolChoice:ao.optional()}),po=u.extend({method:I("sampling/createMessage"),params:lo}),mo=f.extend({model:d(),stopReason:Q(ce(["endTurn","stopSequence","maxTokens"]).or(d())),role:H,content:co}),ho=f.extend({model:d(),stopReason:Q(ce(["endTurn","stopSequence","maxTokens","toolUse"]).or(d())),role:H,content:W([Tt,O(Tt)])}),fo=E({type:I("boolean"),title:d().optional(),description:d().optional(),default:G().optional()}),go=E({type:I("string"),title:d().optional(),description:d().optional(),minLength:V().optional(),maxLength:V().optional(),format:ce(["email","uri","date","date-time"]).optional(),default:d().optional()}),_o=E({type:ce(["number","integer"]),title:d().optional(),description:d().optional(),minimum:V().optional(),maximum:V().optional(),default:V().optional()}),yo=E({type:I("string"),title:d().optional(),description:d().optional(),enum:O(d()),default:d().optional()}),So=E({type:I("string"),title:d().optional(),description:d().optional(),oneOf:O(E({const:d(),title:d()})),default:d().optional()}),vo=E({type:I("string"),title:d().optional(),description:d().optional(),enum:O(d()),enumNames:O(d()).optional(),default:d().optional()}),bo=W([yo,So]),Gt=E({type:I("array"),title:d().optional(),description:d().optional(),minItems:V().optional(),maxItems:V().optional(),items:E({type:I("string"),enum:O(d())}),default:O(d()).optional()}),Wt=E({type:I("array"),title:d().optional(),description:d().optional(),minItems:V().optional(),maxItems:V().optional(),items:E({anyOf:O(E({const:d(),title:d()}))}),default:O(d()).optional()}),xn=W([Gt,Wt]),Nn=W([vo,bo,xn]),Xe=W([Nn,fo,go,_o]),Qe=a.extend({mode:I("form").optional(),message:d(),requestedSchema:E({type:I("object"),properties:J(d(),Xe),required:O(d()).optional()}).catchall(ee())}),zo=a.extend({mode:I("url"),message:d(),elicitationId:d(),url:d().url()}),at=W([Qe,zo]),jn=u.extend({method:I("elicitation/create"),params:at}),An=l.extend({elicitationId:d()}),qn=p.extend({method:I("notifications/elicitation/complete"),params:An}),Mn=f.extend({action:ce(["accept","decline","cancel"]),content:tr(Ve=>Ve===null?void 0:Ve,J(d(),W([d(),V(),G(),O(d())])).optional())}),Ln=E({type:I("ref/resource"),uri:d()}),Un=E({type:I("ref/prompt"),name:d()}),Dn=c.extend({ref:W([Un,Ln]),argument:E({name:d(),value:d()}),context:E({arguments:J(d(),d()).optional()}).optional()}),wo=u.extend({method:I("completion/complete"),params:Dn}),Zn=f.extend({completion:oe({values:O(d()).max(100),total:Q(V().int()),hasMore:Q(G())})}),Vn=E({uri:d().startsWith("file://"),name:d().optional(),_meta:J(d(),ee()).optional()}),_r=u.extend({method:I("roots/list"),params:c.optional()}),$o=f.extend({roots:O(Vn)}),Fn=p.extend({method:I("notifications/roots/list_changed"),params:l.optional()}),Hn=oe({ttl:V().optional(),pollInterval:V().optional()}),Jn=ce(["working","input_required","completed","failed","cancelled"]),kt=E({taskId:d(),status:Jn,ttl:W([V(),er()]),createdAt:d(),lastUpdatedAt:d(),pollInterval:Q(V()),statusMessage:Q(d())}),Ke=f.extend({task:kt}),Bn=l.merge(kt),Yt=p.extend({method:I("notifications/tasks/status"),params:Bn}),yr=u.extend({method:I("tasks/get"),params:c.extend({taskId:d()})}),Sr=f.merge(kt),vr=u.extend({method:I("tasks/result"),params:c.extend({taskId:d()})}),Fa=f.loose(),Ge=C.extend({method:I("tasks/list")}),Oe=j.extend({tasks:O(kt)}),Xt=u.extend({method:I("tasks/cancel"),params:c.extend({taskId:d()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,TaskMetadataSchema:n,RelatedTaskMetadataSchema:s,RequestMetaSchema:i,BaseRequestParamsSchema:c,TaskAugmentedRequestParamsSchema:a,RequestSchema:u,NotificationsParamsSchema:l,NotificationSchema:p,ResultSchema:f,RequestIdSchema:z,EmptyResultSchema:m,CancelledNotificationParamsSchema:_,CancelledNotificationSchema:g,IconSchema:h,IconsSchema:v,BaseMetadataSchema:S,ImplementationSchema:w,ClientTasksCapabilitySchema:y,ServerTasksCapabilitySchema:P,ClientCapabilitiesSchema:N,InitializeRequestParamsSchema:F,InitializeRequestSchema:M,ServerCapabilitiesSchema:U,InitializeResultSchema:K,InitializedNotificationSchema:B,PingRequestSchema:me,ProgressSchema:$e,ProgressNotificationParamsSchema:be,ProgressNotificationSchema:Ie,PaginatedRequestParamsSchema:he,PaginatedRequestSchema:C,PaginatedResultSchema:j,ResourceContentsSchema:Z,TextResourceContentsSchema:$,BlobResourceContentsSchema:x,RoleSchema:H,AnnotationsSchema:te,ResourceSchema:de,ResourceTemplateSchema:ie,ListResourcesRequestSchema:ze,ListResourcesResultSchema:Je,ListResourceTemplatesRequestSchema:T,ListResourceTemplatesResultSchema:A,ResourceRequestParamsSchema:L,ReadResourceRequestParamsSchema:ne,ReadResourceRequestSchema:se,ReadResourceResultSchema:le,ResourceListChangedNotificationSchema:Ce,SubscribeRequestParamsSchema:je,SubscribeRequestSchema:De,UnsubscribeRequestParamsSchema:xe,UnsubscribeRequestSchema:Re,ResourceUpdatedNotificationParamsSchema:ot,ResourceUpdatedNotificationSchema:Ae,PromptArgumentSchema:pt,PromptSchema:it,ListPromptsRequestSchema:mt,ListPromptsResultSchema:Rt,GetPromptRequestParamsSchema:Pt,GetPromptRequestSchema:Vt,TextContentSchema:Ft,ImageContentSchema:Ht,AudioContentSchema:Jt,ToolUseContentSchema:Yr,EmbeddedResourceSchema:Et,ResourceLinkSchema:Xr,ContentBlockSchema:nt,PromptMessageSchema:lr,GetPromptResultSchema:dr,PromptListChangedNotificationSchema:Bt,ToolAnnotationsSchema:Qr,ToolExecutionSchema:pr,ToolSchema:Kt,ListToolsRequestSchema:mr,ListToolsResultSchema:hr,CallToolResultSchema:fr,CallToolRequestParamsSchema:Ze,CallToolRequestSchema:eo,ToolListChangedNotificationSchema:On,LoggingLevelSchema:gr,SetLevelRequestParamsSchema:to,SetLevelRequestSchema:ro,LoggingMessageNotificationParamsSchema:oo,LoggingMessageNotificationSchema:no,ModelHintSchema:so,ModelPreferencesSchema:io,ToolChoiceSchema:ao,ToolResultContentSchema:In,SamplingContentSchema:co,SamplingMessageContentBlockSchema:Tt,SamplingMessageSchema:uo,CreateMessageRequestParamsSchema:lo,CreateMessageRequestSchema:po,CreateMessageResultSchema:mo,CreateMessageResultWithToolsSchema:ho,BooleanSchemaSchema:fo,StringSchemaSchema:go,NumberSchemaSchema:_o,UntitledSingleSelectEnumSchemaSchema:yo,TitledSingleSelectEnumSchemaSchema:So,LegacyTitledEnumSchemaSchema:vo,SingleSelectEnumSchemaSchema:bo,UntitledMultiSelectEnumSchemaSchema:Gt,TitledMultiSelectEnumSchemaSchema:Wt,MultiSelectEnumSchemaSchema:xn,EnumSchemaSchema:Nn,PrimitiveSchemaDefinitionSchema:Xe,ElicitRequestFormParamsSchema:Qe,ElicitRequestURLParamsSchema:zo,ElicitRequestParamsSchema:at,ElicitRequestSchema:jn,ElicitationCompleteNotificationParamsSchema:An,ElicitationCompleteNotificationSchema:qn,ElicitResultSchema:Mn,ResourceTemplateReferenceSchema:Ln,PromptReferenceSchema:Un,CompleteRequestParamsSchema:Dn,CompleteRequestSchema:wo,CompleteResultSchema:Zn,RootSchema:Vn,ListRootsRequestSchema:_r,ListRootsResultSchema:$o,RootsListChangedNotificationSchema:Fn,TaskCreationParamsSchema:Hn,TaskStatusSchema:Jn,TaskSchema:kt,CreateTaskResultSchema:Ke,TaskStatusNotificationParamsSchema:Bn,TaskStatusNotificationSchema:Yt,GetTaskRequestSchema:yr,GetTaskResultSchema:Sr,GetTaskPayloadRequestSchema:vr,GetTaskPayloadResultSchema:Fa,ListTasksRequestSchema:Ge,ListTasksResultSchema:Oe,CancelTaskRequestSchema:Xt,CancelTaskResultSchema:f.merge(kt),ClientRequestSchema:W([me,M,wo,ro,Vt,mt,ze,T,se,De,Re,eo,mr,yr,vr,Ge,Xt]),ClientNotificationSchema:W([g,Ie,B,Fn,Yt]),ClientResultSchema:W([m,mo,ho,Mn,$o,Sr,Oe,Ke]),ServerRequestSchema:W([me,po,jn,_r,yr,vr,Ge,Xt]),ServerNotificationSchema:W([g,Ie,no,Ae,Ce,On,Bt,Yt,qn]),ServerResultSchema:W([m,K,Zn,dr,Rt,Je,A,le,fr,hr,Sr,Oe,Ke]),CallToolResultWireSchema:ee().superRefine((Ve,C_)=>{if(!(typeof Ve!="object"||Ve===null||Array.isArray(Ve)||Ve.content!==void 0)){for(let Ll of wf)if(Ll in Ve){C_.addIssue({code:"custom",message:`content is required when the body carries '${Ll}' \u2014 another result family cannot default into an empty tools/call success`});return}}}).transform(cv).pipe(fr)}}var lv;function $f(){return lv??=uv()}function Rf(e){return e.type!=="object"}var dv=new Set(["const","enum","default","examples"]),pv=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function lf(e){return e!==void 0&&!(typeof e=="string"&&e.startsWith("#"))}function mv(e){let t=typeof e.$schema=="string"?e.$schema:void 0;if(lf(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let r=Vl(e.$schema)&&e.$recursiveAnchor!==!0,o=(n,s)=>{if(Array.isArray(n))return n.map(a=>o(a,!1));if(n===null||typeof n!="object"||!s&&lf(n.$id))return n;let i={},c=!1;for(let[a,u]of Object.entries(n))s?i[a]=o(u,!1):(a==="$ref"||a==="$dynamicRef")&&typeof u=="string"?i[a]=u==="#"?"#/properties/result":u.startsWith("#/")?`#/properties/result${u.slice(1)}`:u:a==="$recursiveRef"&&u==="#"&&r?c=!0:dv.has(a)?i[a]=u:pv.has(a)?i[a]=o(u,!0):i[a]=o(u,!1);return c&&("$ref"in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:"#/properties/result"}]:i.$ref="#/properties/result"),i};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:o(e,!1)},required:["result"]}}var Pf={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Ef={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},hv={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},za;function il(){if(za)return za;let e=$f();return za={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},za}function Tf(e){return Object.prototype.hasOwnProperty.call(Pf,e)}function kf(e){return Object.prototype.hasOwnProperty.call(Ef,e)}function fv(e){return Object.prototype.hasOwnProperty.call(hv,e)}function gv(e){return fv(e)?il().resultSchemas[e]:void 0}function _v(e){return Tf(e)?il().requestSchemas[e]:void 0}function yv(e){return kf(e)?il().notificationSchemas[e]:void 0}var $R=Object.keys(Pf),RR=Object.keys(Ef);function el(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function wa(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var df={ok:!1,reason:"not-in-era"};function pf(e){return el(e)&&el(e.outputSchema)&&Rf(e.outputSchema)}var al={era:"2025-11-25",hasRequestMethod:Tf,hasNotificationMethod:kf,validateRequest:(e,t)=>wa(_v(e),t),validateResult:(e,t)=>wa(gv(e),t),validateNotification:(e,t)=>wa(yv(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>df,validateInputResponse:()=>df,samplingResultVariant:((e,t)=>{let r=$f();return wa(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)}),outboundEnvelope:e=>{},validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let r=zf(e),o=r.structuredContent;if(o===void 0)return r;let n=typeof o!="object"||o===null||Array.isArray(o),s=t!==void 0&&Rf(t);return!n&&!s?r:{...r,structuredContent:{result:o}}},decodeResult(e,t){if(el(t)&&"resultType"in t){let r={...t};return delete r.resultType,{kind:"complete",result:r}}return{kind:"complete",result:t}},encodeResult(e,t){if(e!=="tools/list")return t;let r=t.tools;return!Array.isArray(r)||!r.some(o=>pf(o))?t:{...t,tools:r.map(o=>pf(o)?{...o,outputSchema:mv(o.outputSchema)}:o)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>{}};function Sv(){let e=Fo(()=>W([d(),V(),G(),er(),J(d(),e),O(e)])),t=J(d(),e),r=W([d(),V().int()]),o=d(),n=W([d(),V().int()]),s=ce(["user","assistant"]),i=ce(["debug","info","notice","warning","error","critical","alert","emergency"]),c=d().refine(Oe=>{try{return atob(Oe),!0}catch{return!1}},{message:"Invalid Base64 string"}),a=E({ttl:V().optional()}),u=E({taskId:d()}),l=oe({progressToken:r.optional(),"io.modelcontextprotocol/related-task":u.optional()}),p=E({_meta:l.optional()}),f=p.extend({task:a.optional()}),z=E({_meta:l.optional()}),m=E({method:d(),params:z.loose().optional()}),_=E({src:d(),mimeType:d().optional(),sizes:O(d()).optional(),theme:ce(["light","dark"]).optional()}),g=E({icons:O(_).optional()}),h=E({name:d(),title:d().optional()}),v=h.extend({...h.shape,...g.shape,version:d(),websiteUrl:d().optional(),description:d().optional()}),S=St(E({applyDefaults:G().optional()}),t),w=tr(Oe=>Oe&&typeof Oe=="object"&&!Array.isArray(Oe)&&Object.keys(Oe).length===0?{form:{}}:Oe,St(E({form:S.optional(),url:t.optional()}),t.optional())),R=oe({list:t.optional(),cancel:t.optional(),requests:oe({sampling:oe({createMessage:t.optional()}).optional(),elicitation:oe({create:t.optional()}).optional()}).optional()}),b=oe({list:t.optional(),cancel:t.optional(),requests:oe({tools:oe({call:t.optional()}).optional()}).optional()}),y=E({experimental:J(d(),t).optional(),sampling:E({context:t.optional(),tools:t.optional()}).optional(),elicitation:w.optional(),roots:E({listChanged:G().optional()}).optional(),tasks:R.optional(),extensions:J(d(),t).optional()}),P=E({experimental:J(d(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:E({listChanged:G().optional()}).optional(),resources:E({subscribe:G().optional(),listChanged:G().optional()}).optional(),tools:E({listChanged:G().optional()}).optional(),tasks:b.optional(),extensions:J(d(),t).optional()}),N=E({progress:V(),total:Q(V()),message:Q(d())}),F=E({...z.shape,...N.shape,progressToken:r}),M=m.extend({method:I("notifications/progress"),params:F}),U=z.extend({level:i,logger:d().optional(),data:ee()}),K=m.extend({method:I("notifications/message"),params:U}),B=E({uri:d(),mimeType:Q(d()),_meta:J(d(),ee()).optional()}),me=B.extend({text:d()}),$e=B.extend({blob:c}),be=E({audience:O(s).optional(),priority:V().min(0).max(1).optional(),lastModified:vt.datetime({offset:!0}).optional()}),Ie=E({...h.shape,...g.shape,uri:d(),description:Q(d()),mimeType:Q(d()),size:Q(V()),annotations:be.optional(),_meta:Q(oe({}))}),he=E({...h.shape,...g.shape,uriTemplate:d(),description:Q(d()),mimeType:Q(d()),annotations:be.optional(),_meta:Q(oe({}))}),C=m.extend({method:I("notifications/resources/list_changed"),params:z.optional()}),j=z.extend({uri:d()}),Z=m.extend({method:I("notifications/resources/updated"),params:j}),$=E({name:d(),description:Q(d()),required:Q(G())}),k=E({...h.shape,...g.shape,description:Q(d()),arguments:Q(O($)),_meta:Q(oe({}))}),x=m.extend({method:I("notifications/prompts/list_changed"),params:z.optional()}),H=E({type:I("text"),text:d(),annotations:be.optional(),_meta:J(d(),ee()).optional()}),te=E({type:I("image"),data:c,mimeType:d(),annotations:be.optional(),_meta:J(d(),ee()).optional()}),de=E({type:I("audio"),data:c,mimeType:d(),annotations:be.optional(),_meta:J(d(),ee()).optional()}),ie=E({type:I("tool_use"),name:d(),id:d(),input:J(d(),ee()),_meta:J(d(),ee()).optional()}),ze=E({type:I("resource"),resource:W([me,$e]),annotations:be.optional(),_meta:J(d(),ee()).optional()}),Je=Ie.extend({type:I("resource_link")}),T=W([H,te,de,Je,ze]),A=E({role:s,content:T}),L=E({title:d().optional(),readOnlyHint:G().optional(),destructiveHint:G().optional(),idempotentHint:G().optional(),openWorldHint:G().optional()}),ne=m.extend({method:I("notifications/tools/list_changed"),params:z.optional()}),se=E({name:d().optional()}),le=E({hints:O(se).optional(),costPriority:V().min(0).max(1).optional(),speedPriority:V().min(0).max(1).optional(),intelligencePriority:V().min(0).max(1).optional()}),Ce=E({mode:ce(["auto","required","none"]).optional()}),je=E({type:I("boolean"),title:d().optional(),description:d().optional(),default:G().optional()}),De=E({type:I("string"),title:d().optional(),description:d().optional(),minLength:V().optional(),maxLength:V().optional(),format:ce(["email","uri","date","date-time"]).optional(),default:d().optional()}),xe=E({type:ce(["number","integer"]),title:d().optional(),description:d().optional(),minimum:V().optional(),maximum:V().optional(),default:V().optional()}),Re=E({type:I("string"),title:d().optional(),description:d().optional(),enum:O(d()),default:d().optional()}),ot=E({type:I("string"),title:d().optional(),description:d().optional(),oneOf:O(E({const:d(),title:d()})),default:d().optional()}),Ae=E({type:I("string"),title:d().optional(),description:d().optional(),enum:O(d()),enumNames:O(d()).optional(),default:d().optional()}),pt=W([Re,ot]),it=E({type:I("array"),title:d().optional(),description:d().optional(),minItems:V().optional(),maxItems:V().optional(),items:E({type:I("string"),enum:O(d())}),default:O(d()).optional()}),mt=E({type:I("array"),title:d().optional(),description:d().optional(),minItems:V().optional(),maxItems:V().optional(),items:E({anyOf:O(E({const:d(),title:d()}))}),default:O(d()).optional()}),Rt=W([it,mt]),Pt=W([Ae,pt,Rt]),Vt=W([Pt,je,De,xe]),Ft=f.extend({mode:I("form").optional(),message:d(),requestedSchema:E({type:I("object"),properties:J(d(),Vt),required:O(d()).optional()}).catchall(ee())}),Ht=E({type:I("ref/resource"),uri:d()}),Jt=E({type:I("ref/prompt"),name:d()}),Yr=E({uri:d().startsWith("file://"),name:d().optional(),_meta:J(d(),ee()).optional()}),Et=y.shape,Xr=E({experimental:Et.experimental,sampling:Et.sampling,elicitation:Et.elicitation,roots:Et.roots,extensions:Et.extensions}),nt=P.shape,lr=E({experimental:nt.experimental,logging:nt.logging,completions:nt.completions,prompts:nt.prompts,resources:nt.resources,tools:nt.tools,extensions:nt.extensions}),dr=oe({progressToken:r.optional(),[or]:d(),[xr]:v.optional(),[nr]:Xr,[Nr]:i.optional()}),Bt=E({...h.shape,...g.shape,description:d().optional(),inputSchema:oe({$schema:d().optional(),type:I("object")}),outputSchema:oe({$schema:d().optional()}).optional(),annotations:L.optional(),_meta:J(d(),ee()).optional()}),Qr=E({type:I("tool_result"),toolUseId:d(),content:O(T),structuredContent:ee().optional(),isError:G().optional(),_meta:J(d(),ee()).optional()}),pr=W([H,te,de,ie,Qr]),Kt=E({role:s,content:W([pr,O(pr)]),_meta:J(d(),ee()).optional()}),mr=d(),hr=oe({[zt]:v.optional().catch(void 0)}),fr=hr.optional();function Ze(Oe){return oe({_meta:fr,resultType:mr.default("complete"),...Oe})}let eo=Ze({}),On=Ze({nextCursor:o.optional()}),gr=Ze({content:O(T),structuredContent:ee().optional(),isError:G().optional()}),to=Ze({ttlMs:V().int().min(0),cacheScope:ce(["public","private"]),tools:O(Bt),nextCursor:o.optional()}),ro=Ze({ttlMs:V().int().min(0),cacheScope:ce(["public","private"]),prompts:O(k),nextCursor:o.optional()}),oo=Ze({description:d().optional(),messages:O(A)}),no=Ze({ttlMs:V().int().min(0),cacheScope:ce(["public","private"]),resources:O(Ie),nextCursor:o.optional()}),so=Ze({ttlMs:V().int().min(0),cacheScope:ce(["public","private"]),resourceTemplates:O(he),nextCursor:o.optional()}),io=Ze({ttlMs:V().int().min(0),cacheScope:ce(["public","private"]),contents:O(W([me,$e]))}),ao=Ze({completion:E({values:O(d()).max(100),total:V().int().optional(),hasMore:G().optional()}).loose()}),In=Ze({ttlMs:V().int().min(0),cacheScope:ce(["public","private"])}),co=Ze({ttlMs:V().int().min(0).catch(0),cacheScope:ce(["public","private"]).catch("private"),supportedVersions:O(d()),capabilities:lr,instructions:d().optional()}),Tt=E({messages:O(Kt),modelPreferences:le.optional(),systemPrompt:d().optional(),includeContext:ce(["none","thisServer","allServers"]).optional(),temperature:V().optional(),maxTokens:V().int(),stopSequences:O(d()).optional(),metadata:t.optional(),tools:O(Bt).optional(),toolChoice:Ce.optional()}),uo=E({method:I("sampling/createMessage"),params:Tt}),lo=E({method:I("roots/list"),params:E({_meta:J(d(),ee()).optional()}).optional()}),po=E({...Kt.shape,model:d(),stopReason:d().optional()}),mo=E({roots:O(Yr)}),ho=E({action:ce(["accept","decline","cancel"]),content:J(d(),W([d(),V(),G(),O(d())])).optional()}),fo=E({mode:I("url"),message:d(),url:d().url()}),go=W([Ft,fo]),_o=E({method:I("elicitation/create"),params:go}),yo=W([uo,lo,_o]),So=W([po,mo,ho]),vo=J(d(),yo),bo=J(d(),So),Gt=Ze({inputRequests:vo.optional(),requestState:d().optional()}),Wt={inputResponses:bo.optional(),requestState:d().optional()},xn=E({_meta:dr,...Wt}),Nn=oe({progressToken:r.optional()});function Xe(Oe,Xt){return E({method:I(Oe),params:E({_meta:dr,...Xt})})}function Qe(Oe,Xt){return E({method:I(Oe),params:E({_meta:Nn.optional(),...Xt}).optional()})}let zo={name:d(),arguments:J(d(),ee()).optional(),...Wt},at={cursor:o.optional()},jn=Xe("tools/call",zo),An=Xe("tools/list",at),qn=Xe("prompts/list",at),Mn=Xe("prompts/get",{name:d(),arguments:J(d(),d()).optional(),...Wt}),Ln=Xe("resources/list",at),Un=Xe("resources/templates/list",at),Dn=Xe("resources/read",{uri:d(),...Wt}),wo={ref:W([Jt,Ht]),argument:E({name:d(),value:d()}),context:E({arguments:J(d(),d()).optional()}).optional()},Zn=Xe("completion/complete",wo),Vn=Xe("server/discover",{}),_r=E({toolsListChanged:G().optional(),promptsListChanged:G().optional(),resourcesListChanged:G().optional(),resourceSubscriptions:O(d()).optional()}),$o={notifications:_r},Fn=Xe("subscriptions/listen",$o),Hn=hr.extend({"io.modelcontextprotocol/subscriptionId":n}),Jn=oe({_meta:Hn,resultType:mr.default("complete")}),kt={"tools/call":Qe("tools/call",zo),"tools/list":Qe("tools/list",at),"prompts/get":Qe("prompts/get",{name:d(),arguments:J(d(),d()).optional()}),"prompts/list":Qe("prompts/list",at),"resources/list":Qe("resources/list",at),"resources/templates/list":Qe("resources/templates/list",at),"resources/read":Qe("resources/read",{uri:d()}),"completion/complete":Qe("completion/complete",wo),"server/discover":Qe("server/discover",{}),"subscriptions/listen":Qe("subscriptions/listen",$o)};function Ke(Oe){return oe({_meta:fr,...Oe})}let Bn={"tools/call":Ke({content:O(T),structuredContent:ee().optional(),isError:G().optional()}),"tools/list":Ke({ttlMs:V().int().min(0),cacheScope:ce(["public","private"]),tools:O(Bt),nextCursor:o.optional()}),"prompts/get":Ke({description:d().optional(),messages:O(A)}),"prompts/list":Ke({ttlMs:V().int().min(0),cacheScope:ce(["public","private"]),prompts:O(k),nextCursor:o.optional()}),"resources/list":Ke({ttlMs:V().int().min(0),cacheScope:ce(["public","private"]),resources:O(Ie),nextCursor:o.optional()}),"resources/templates/list":Ke({ttlMs:V().int().min(0),cacheScope:ce(["public","private"]),resourceTemplates:O(he),nextCursor:o.optional()}),"resources/read":Ke({ttlMs:V().int().min(0),cacheScope:ce(["public","private"]),contents:O(W([me,$e]))}),"completion/complete":Ke({completion:E({values:O(d()).max(100),total:V().int().optional(),hasMore:G().optional()}).loose()}),"server/discover":Ke({ttlMs:V().int().min(0).catch(0),cacheScope:ce(["public","private"]).catch("private"),supportedVersions:O(d()),capabilities:lr,instructions:d().optional()}),"subscriptions/listen":Ke({})},Yt=oe({"io.modelcontextprotocol/subscriptionId":n.optional()}),yr=E({method:I("notifications/subscriptions/acknowledged"),params:E({_meta:Yt.optional(),notifications:_r})}),Sr=E({_meta:Yt.optional(),requestId:n,reason:d().optional()}),vr=E({method:I("notifications/cancelled"),params:Sr}),Fa={"notifications/cancelled":vr,"notifications/progress":M,"notifications/message":K,"notifications/resources/updated":Z,"notifications/resources/list_changed":C,"notifications/tools/list_changed":ne,"notifications/prompts/list_changed":x,"notifications/subscriptions/acknowledged":yr},Ge=Oe=>E({jsonrpc:I("2.0"),id:W([d(),V().int()]),result:Oe}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,RequestIdSchema:n,RoleSchema:s,LoggingLevelSchema:i,TaskMetadataSchema:a,RelatedTaskMetadataSchema:u,RequestMetaSchema:l,BaseRequestParamsSchema:p,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:z,NotificationSchema:m,IconSchema:_,IconsSchema:g,BaseMetadataSchema:h,ImplementationSchema:v,ClientTasksCapabilitySchema:R,ServerTasksCapabilitySchema:b,ClientCapabilitiesSchema:y,ServerCapabilitiesSchema:P,ProgressSchema:N,ProgressNotificationParamsSchema:F,ProgressNotificationSchema:M,LoggingMessageNotificationParamsSchema:U,LoggingMessageNotificationSchema:K,ResourceContentsSchema:B,TextResourceContentsSchema:me,BlobResourceContentsSchema:$e,AnnotationsSchema:be,ResourceSchema:Ie,ResourceTemplateSchema:he,ResourceListChangedNotificationSchema:C,ResourceUpdatedNotificationParamsSchema:j,ResourceUpdatedNotificationSchema:Z,PromptArgumentSchema:$,PromptSchema:k,PromptListChangedNotificationSchema:x,TextContentSchema:H,ImageContentSchema:te,AudioContentSchema:de,ToolUseContentSchema:ie,EmbeddedResourceSchema:ze,ResourceLinkSchema:Je,ContentBlockSchema:T,PromptMessageSchema:A,ToolAnnotationsSchema:L,ToolListChangedNotificationSchema:ne,ModelHintSchema:se,ModelPreferencesSchema:le,ToolChoiceSchema:Ce,BooleanSchemaSchema:je,StringSchemaSchema:De,NumberSchemaSchema:xe,UntitledSingleSelectEnumSchemaSchema:Re,TitledSingleSelectEnumSchemaSchema:ot,LegacyTitledEnumSchemaSchema:Ae,SingleSelectEnumSchemaSchema:pt,UntitledMultiSelectEnumSchemaSchema:it,TitledMultiSelectEnumSchemaSchema:mt,MultiSelectEnumSchemaSchema:Rt,EnumSchemaSchema:Pt,PrimitiveSchemaDefinitionSchema:Vt,ElicitRequestFormParamsSchema:Ft,ResourceTemplateReferenceSchema:Ht,PromptReferenceSchema:Jt,RootSchema:Yr,ClientCapabilities2026Schema:Xr,ServerCapabilities2026Schema:lr,RequestMetaEnvelopeSchema:dr,ToolSchema:Bt,ToolResultContentSchema:Qr,SamplingMessageContentBlockSchema:pr,SamplingMessageSchema:Kt,ResultTypeSchema:mr,ResultMetaSchema:hr,ResultSchema:eo,PaginatedResultSchema:On,CallToolResultSchema:gr,ListToolsResultSchema:to,ListPromptsResultSchema:ro,GetPromptResultSchema:oo,ListResourcesResultSchema:no,ListResourceTemplatesResultSchema:so,ReadResourceResultSchema:io,CompleteResultSchema:ao,CacheableResultSchema:In,DiscoverResultSchema:co,CreateMessageRequestParamsSchema:Tt,CreateMessageRequestSchema:uo,ListRootsRequestSchema:lo,CreateMessageResultSchema:po,ListRootsResultSchema:mo,ElicitResultSchema:ho,ElicitRequestURLParamsSchema:fo,ElicitRequestParamsSchema:go,ElicitRequestSchema:_o,InputRequestSchema:yo,InputResponseSchema:So,InputRequestsSchema:vo,InputResponsesSchema:bo,InputRequiredResultSchema:Gt,InputResponseRequestParamsSchema:xn,CallToolRequestSchema:jn,ListToolsRequestSchema:An,ListPromptsRequestSchema:qn,GetPromptRequestSchema:Mn,ListResourcesRequestSchema:Ln,ListResourceTemplatesRequestSchema:Un,ReadResourceRequestSchema:Dn,CompleteRequestSchema:Zn,DiscoverRequestSchema:Vn,SubscriptionFilterSchema:_r,SubscriptionsListenRequestSchema:Fn,SubscriptionsListenResultMetaSchema:Hn,SubscriptionsListenResultSchema:Jn,dispatchRequestSchemas:kt,dispatchResultSchemas:Bn,NotificationMetaSchema:Yt,SubscriptionsAcknowledgedNotificationSchema:yr,CancelledNotificationParamsSchema:Sr,CancelledNotificationSchema:vr,notificationSchemas2026:Fa,JSONRPCResultResponseSchema:Ge(eo),CallToolResultResponseSchema:Ge(W([gr,Gt])),ListToolsResultResponseSchema:Ge(to),ListPromptsResultResponseSchema:Ge(ro),GetPromptResultResponseSchema:Ge(W([oo,Gt])),ListResourcesResultResponseSchema:Ge(no),ListResourceTemplatesResultResponseSchema:Ge(so),ReadResourceResultResponseSchema:Ge(W([io,Gt])),CompleteResultResponseSchema:Ge(ao),DiscoverResultResponseSchema:Ge(co)}}var vv;function cr(){return vv??=Sv()}var bv=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function zv(e){return bv.includes(e)}var cl=Symbol("modelcontextprotocol.resultCacheHintFallback");function wv(e){return e[cl]}function Cf(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function Of(e){return e==="public"||e==="private"}var ae=(function(e){return e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.ResourceNotFound=-32002]="ResourceNotFound",e[e.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",e[e.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired",e})({}),_e=class If extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return rt(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return rt(this,t)}constructor(t,r,o){super(r),this.code=t,this.data=o,this.name="ProtocolError",ur(this,new.target)}static fromError(t,r,o){if(t===ae.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new Nf(n.elicitations,r)}if(t===ae.UnsupportedProtocolVersion&&o){let n=o;if(Array.isArray(n.supported)&&typeof n.requested=="string")return new ka({supported:n.supported,requested:n.requested},r)}if(t===ae.InvalidParams||t===ae.ResourceNotFound){let n=o;if(typeof n?.uri=="string"&&(t===ae.ResourceNotFound||Object.keys(n).length===1))return new xf(n.uri,r)}if(t===ae.MissingRequiredClientCapability&&o){let n=o;if(n.requiredCapabilities!==null&&typeof n.requiredCapabilities=="object"&&!Array.isArray(n.requiredCapabilities))return new jf({requiredCapabilities:n.requiredCapabilities},r)}return new If(t,r,o)}},xf=class extends _e{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(ae.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Nf=class extends _e{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(ae.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},ka=class extends _e{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(ae.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},jf=class extends _e{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(ae.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},$v=0,Rv="private",Pv=["tools/call","prompts/get","resources/read"];function Ev(e,t){let r=t.resultType;if(r===void 0)return{...t,resultType:"complete"};if(r==="complete"||Pv.includes(e))return t;throw new _e(ae.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function Tv(e,t){let r=wv(t);if(t.resultType!=="complete"||!zv(e))return r===void 0?t:xv(t);let o=t,n=Cf(o.ttlMs)?o.ttlMs:Ov(r),s=Of(o.cacheScope)?o.cacheScope:Iv(r),i={...o,ttlMs:n,cacheScope:s};return delete i[cl],i}function kv(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Cv(e,t){if(t===void 0)return e;let r=e._meta;return r===void 0?{...e,_meta:{[zt]:t}}:!kv(r)||r[zt]!==void 0?e:{...e,_meta:{...r,[zt]:t}}}function Ov(e){return e!==void 0&&Cf(e.ttlMs)?e.ttlMs:$v}function Iv(e){return e!==void 0&&Of(e.cacheScope)?e.cacheScope:Rv}function xv(e){let t={...e};return delete t[cl],t}var Nv=["elicitation/create","sampling/createMessage","roots/list"],$a;function Af(){if($a)return $a;let e=cr();return $a={request:{"elicitation/create":E({method:I("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":E({method:I("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":E({method:I("roots/list"),params:oe({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},$a}function qf(e){return Nv.includes(e)}function Gu(e){return qf(e)?Af().request[e]:void 0}function jv(e){return qf(e)?Af().response[e]:void 0}var ul={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},Mf={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function Lf(e){return Object.prototype.hasOwnProperty.call(ul,e)}function Uf(e){return Object.prototype.hasOwnProperty.call(Mf,e)}function Av(e){return Object.prototype.hasOwnProperty.call(ul,e)}function qv(e){return Lf(e)?cr().dispatchRequestSchemas[e]:void 0}function Mv(e){return Av(e)?cr().dispatchResultSchemas[e]:void 0}function Lv(e){return Uf(e)?cr().notificationSchemas2026[e]:void 0}var PR=Object.keys(ul),ER=Object.keys(Mf);function $n(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function zn(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var Uv={ok:!1,reason:"not-in-era"},Dv=[or,nr];function Zv(e,t){let r=t,o=!1,n=()=>(o||(r={...r},o=!0),r),s=t.tools;e==="tools/list"&&Array.isArray(s)&&s.some(c=>$n(c)&&"execution"in c)&&(n().tools=s.map(c=>{if(!$n(c)||!("execution"in c))return c;let a={...c};return delete a.execution,a}));let i=t.capabilities;if($n(i)&&"tasks"in i){let c={...i};delete c.tasks,n().capabilities=c}return r}var ll={era:"2026-07-28",hasRequestMethod:Lf,hasNotificationMethod:Uf,hasInputRequestMethod:e=>Gu(e)!==void 0,validateRequest:(e,t)=>zn(qv(e),t),validateResult:(e,t)=>zn(Mv(e),t),validateNotification:(e,t)=>zn(Lv(e),t),validateInputRequest:(e,t)=>zn(Gu(e),t),validateInputResponse:(e,t)=>zn(jv(e),t),samplingResultVariant:()=>Uv,outboundEnvelope(e){return{[or]:e.protocolVersion,[xr]:e.clientInfo,[nr]:e.clientCapabilities,...e.logLevel!==void 0&&{[Nr]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let o of Dv)o in e||t.push({key:o,problem:"missing"});let r=cr().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let o of r.error.issues){let n=o.path.map(String),s=n.length>0?n.join("."):"_meta";n.length===1&&t.some(i=>i.key===s&&i.problem==="missing")||t.push({key:s,problem:o.message})}return t},projectCallToolResult:e=>zf(e),inputRequestSchema:Gu,decodeResult(e,t){if(!$n(t))return{kind:"invalid",error:new Y(X.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(r===void 0)return{kind:"invalid",error:new Y(X.InvalidResult,`Invalid result for ${e}: missing required resultType \u2014 servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:"missing-resultType"})};if(typeof r!="string")return{kind:"invalid",error:new Y(X.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if(r==="input_required"){let i=t.inputRequests,c=$n(i)?i:{},a=t.requestState;return Object.keys(c).length===0&&typeof a!="string"?{kind:"invalid",error:new Y(X.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:"input-required-missing-both"})}:{kind:"input_required",inputRequests:c,...typeof a=="string"&&{requestState:a}}}if(r!=="complete")return{kind:"invalid",error:new Y(X.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let o=Vv(),n=Object.hasOwn(o,e)?o[e]:void 0;if(n!==void 0){let i=n.safeParse(t);if(!i.success)return{kind:"invalid",error:new Y(X.InvalidResult,`Invalid result for ${e}: ${i.error}`,{method:e})}}let s={...t};return delete s.resultType,{kind:"complete",result:s}},encodeResult(e,t,r){return Cv(Tv(e,Ev(e,Zv(e,t))),r)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=cr().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(r=>r.message).join("; ")}`}},Ra;function Vv(){if(Ra)return Ra;let e=cr();return Ra={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},Ra}var Ca="2026-07-28";function $t(e){return e!==void 0&&Zt(e)?ll:al}function mf(e){return e.revision!==void 0?$t(e.revision).era:e.era==="modern"?ll.era:al.era}function Wu(e){return Df.some(t=>t.hasRequestMethod(e))}function Yu(e){return Df.some(t=>t.hasNotificationMethod(e))}var Df=[al,ll],Fv=Dl({AnnotationsSchema:()=>wt,AudioContentSchema:()=>Dr,BaseMetadataSchema:()=>bt,BaseRequestParamsSchema:()=>Le,BlobResourceContentsSchema:()=>an,BooleanSchemaSchema:()=>hn,CallToolRequestParamsSchema:()=>Ci,CallToolRequestSchema:()=>Oi,CallToolResultSchema:()=>dn,CancelTaskRequestSchema:()=>Lu,CancelTaskResultSchema:()=>Uu,CancelledNotificationParamsSchema:()=>Ns,CancelledNotificationSchema:()=>en,ClientCapabilitiesSchema:()=>Ms,ClientNotificationSchema:()=>Zu,ClientRequestSchema:()=>Du,ClientResultSchema:()=>Vu,ClientTasksCapabilitySchema:()=>As,CompatibilityCallToolResultSchema:()=>ku,CompleteRequestParamsSchema:()=>na,CompleteRequestSchema:()=>sa,CompleteResultSchema:()=>ia,ContentBlockSchema:()=>Zr,CreateMessageRequestParamsSchema:()=>Vi,CreateMessageRequestSchema:()=>Fi,CreateMessageResultSchema:()=>Hi,CreateMessageResultWithToolsSchema:()=>Ji,CreateTaskResultSchema:()=>Ou,CursorSchema:()=>Bo,DiscoverRequestSchema:()=>Vs,DiscoverResultSchema:()=>ar,ElicitRequestFormParamsSchema:()=>Hr,ElicitRequestParamsSchema:()=>Yi,ElicitRequestSchema:()=>Xi,ElicitRequestURLParamsSchema:()=>Wi,ElicitResultSchema:()=>ta,ElicitationCompleteNotificationParamsSchema:()=>Qi,ElicitationCompleteNotificationSchema:()=>ea,EmbeddedResourceSchema:()=>bi,EmptyResultSchema:()=>Qo,EnumSchemaSchema:()=>Gi,GetPromptRequestParamsSchema:()=>yi,GetPromptRequestSchema:()=>Si,GetPromptResultSchema:()=>$i,GetTaskPayloadRequestSchema:()=>ju,GetTaskPayloadResultSchema:()=>Au,GetTaskRequestSchema:()=>xu,GetTaskResultSchema:()=>Nu,IconSchema:()=>js,IconsSchema:()=>qt,ImageContentSchema:()=>Ur,ImplementationSchema:()=>qr,InitializeRequestParamsSchema:()=>Ls,InitializeRequestSchema:()=>Us,InitializeResultSchema:()=>Ds,InitializedNotificationSchema:()=>Zs,JSONArraySchema:()=>Pu,JSONObjectSchema:()=>Ee,JSONRPCErrorResponseSchema:()=>Ar,JSONRPCMessageSchema:()=>Xo,JSONRPCNotificationSchema:()=>Yo,JSONRPCRequestSchema:()=>Wo,JSONRPCResponseSchema:()=>Eu,JSONRPCResultResponseSchema:()=>jr,JSONValueSchema:()=>jt,LegacyTitledEnumSchemaSchema:()=>_n,ListChangedOptionsBaseSchema:()=>pn,ListPromptsRequestSchema:()=>gi,ListPromptsResultSchema:()=>_i,ListResourceTemplatesRequestSchema:()=>Ws,ListResourceTemplatesResultSchema:()=>Ys,ListResourcesRequestSchema:()=>Ks,ListResourcesResultSchema:()=>Gs,ListRootsRequestSchema:()=>ca,ListRootsResultSchema:()=>ua,ListTasksRequestSchema:()=>qu,ListTasksResultSchema:()=>Mu,ListToolsRequestSchema:()=>Ti,ListToolsResultSchema:()=>ki,LoggingLevelSchema:()=>mn,LoggingMessageNotificationParamsSchema:()=>ji,LoggingMessageNotificationSchema:()=>Ai,ModelHintSchema:()=>qi,ModelPreferencesSchema:()=>Mi,MultiSelectEnumSchemaSchema:()=>Ki,NotificationSchema:()=>He,NotificationsParamsSchema:()=>Fe,NumberSchemaSchema:()=>Fr,PaginatedRequestParamsSchema:()=>Js,PaginatedRequestSchema:()=>Mt,PaginatedResultSchema:()=>Lt,PingRequestSchema:()=>rn,PrimitiveSchemaDefinitionSchema:()=>vn,ProgressNotificationParamsSchema:()=>Hs,ProgressNotificationSchema:()=>on,ProgressSchema:()=>Fs,ProgressTokenSchema:()=>Jo,PromptArgumentSchema:()=>hi,PromptListChangedNotificationSchema:()=>Ri,PromptMessageSchema:()=>wi,PromptReferenceSchema:()=>oa,PromptSchema:()=>fi,ReadResourceRequestParamsSchema:()=>Xs,ReadResourceRequestSchema:()=>Qs,ReadResourceResultSchema:()=>ei,RelatedTaskMetadataSchema:()=>xs,RequestIdSchema:()=>At,RequestMetaSchema:()=>Ko,RequestSchema:()=>Te,ResourceContentsSchema:()=>nn,ResourceLinkSchema:()=>zi,ResourceListChangedNotificationSchema:()=>ti,ResourceRequestParamsSchema:()=>Mr,ResourceSchema:()=>cn,ResourceTemplateReferenceSchema:()=>ra,ResourceTemplateSchema:()=>Bs,ResourceUpdatedNotificationParamsSchema:()=>pi,ResourceUpdatedNotificationSchema:()=>mi,ResultMetaObjectSchema:()=>Go,ResultSchema:()=>ke,RoleSchema:()=>Ut,RootSchema:()=>aa,RootsListChangedNotificationSchema:()=>la,SamplingContentSchema:()=>Di,SamplingMessageContentBlockSchema:()=>rr,SamplingMessageSchema:()=>Zi,ServerCapabilitiesSchema:()=>tn,ServerNotificationSchema:()=>Hu,ServerRequestSchema:()=>Fu,ServerResultSchema:()=>Ju,ServerTasksCapabilitySchema:()=>qs,SetLevelRequestParamsSchema:()=>xi,SetLevelRequestSchema:()=>Ni,SingleSelectEnumSchemaSchema:()=>Bi,StringSchemaSchema:()=>Vr,SubscribeRequestParamsSchema:()=>ri,SubscribeRequestSchema:()=>oi,SubscriptionFilterSchema:()=>un,SubscriptionsAcknowledgedNotificationParamsSchema:()=>ci,SubscriptionsAcknowledgedNotificationSchema:()=>ui,SubscriptionsListenRequestParamsSchema:()=>ii,SubscriptionsListenRequestSchema:()=>ai,SubscriptionsListenResultMetaSchema:()=>li,SubscriptionsListenResultSchema:()=>di,TaskAugmentedRequestParamsSchema:()=>ir,TaskCreationParamsSchema:()=>Cu,TaskMetadataSchema:()=>Is,TaskSchema:()=>Dt,TaskStatusNotificationParamsSchema:()=>pa,TaskStatusNotificationSchema:()=>Iu,TaskStatusSchema:()=>da,TextContentSchema:()=>Lr,TextResourceContentsSchema:()=>sn,TitledMultiSelectEnumSchemaSchema:()=>Sn,TitledSingleSelectEnumSchemaSchema:()=>gn,ToolAnnotationsSchema:()=>Pi,ToolChoiceSchema:()=>Li,ToolExecutionSchema:()=>Ei,ToolListChangedNotificationSchema:()=>Ii,ToolResultContentSchema:()=>Ui,ToolSchema:()=>ln,ToolUseContentSchema:()=>vi,UnsubscribeRequestParamsSchema:()=>ni,UnsubscribeRequestSchema:()=>si,UntitledMultiSelectEnumSchemaSchema:()=>yn,UntitledSingleSelectEnumSchemaSchema:()=>fn});var dl=e=>Wo.safeParse(e).success,Zf=e=>Yo.safeParse(e).success,Pn=e=>jr.safeParse(e).success,Oa=e=>Ar.safeParse(e).success;var Vf=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";var Hv="Mcp-Param-",hf="x-mcp-header",Jv=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Bv=new Set(["string","integer","boolean","number"]);function pl(e){let t=[],r=new Map,o=(s,i,c)=>{if(s===null||typeof s!="object")return;let a=s;if(hf in a){if(!c||i.length===0)return`${Pa(i)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let l=a[hf];if(typeof l!="string"||l.length===0)return`${Pa(i)}: x-mcp-header MUST be a non-empty string`;if(!Jv.test(l))return`${Pa(i)}: x-mcp-header '${l}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let p=typeof a.type=="string"?a.type:void 0;if(p===void 0||!Bv.has(p))return`${Pa(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${p??"<none>"}`;let f=l.toLowerCase(),z=r.get(f);if(z!==void 0)return`x-mcp-header '${l}' is not case-insensitively unique (also declared as '${z}')`;r.set(f,l),t.push({path:i,headerName:l,type:p})}let u=a.properties;if(u!==null&&typeof u=="object")for(let[l,p]of Object.entries(u)){let f=o(p,[...i,l],c);if(f!==void 0)return f}for(let l of Kv){let p=a[l];if(p===void 0)continue;let f=Array.isArray(p)?p:p!==null&&typeof p=="object"&&Gv.has(l)?Object.values(p):[p];for(let z of f){let m=o(z,[...i,`<${l}>`],!1);if(m!==void 0)return m}}},n=o(e,[],!0);return n===void 0?{valid:!0,declarations:t}:{valid:!1,reason:n}}var Kv=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],Gv=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function Pa(e){return e.length===0?"<root>":e.join(".")}var Ff="=?base64?",Hf="?=";function Wv(e){if(typeof e=="string")return e;if(typeof e=="boolean")return e?"true":"false";if(typeof e=="number")return!Number.isFinite(e)||Number.isInteger(e)&&!Number.isSafeInteger(e)?void 0:String(e)}function Yv(e){if(e.length===0||e.startsWith(Ff)&&e.endsWith(Hf)||e!==e.trim())return!0;for(let t=0;t<e.length;t++){let r=e.codePointAt(t);if(!(r===9||r>=32&&r<=126))return!0}return!1}function Xv(e){let t=new TextEncoder().encode(e),r="";for(let o of t)r+=String.fromCodePoint(o);return btoa(r)}function Jf(e){return Yv(e)?`${Ff}${Xv(e)}${Hf}`:e}function Qv(e,t){let r=e;for(let o of t){if(r===null||typeof r!="object")return;r=r[o]}return r}function Bf(e,t){let r={};for(let o of e){let n=Qv(t,o.path);if(n==null)continue;let s=Wv(n);s!==void 0&&(r[`${Hv}${o.headerName}`]=Jf(s))}return r}var Jr=-32020,TR=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32e3],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[ae.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[Jr,ae.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[ae.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope \u2014 and a missing envelope on a request whose protocol-version header names a modern revision \u2014 is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[ae.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision\u2019s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[ae.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[Jr],conformance:["http-header-validation"],rationale:"SEP-2243 standard `Mcp-Method` / `Mcp-Name` headers \u2014 presence, sentinel decoding, and `Mcp-Name` \u2194 body cross-check \u2014 are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The classifier\u2019s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5\u20136) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[ae.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced \u2014 pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[Jr],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool\u2019s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],kR={[ae.ParseError]:400,[ae.InvalidRequest]:400,[ae.MethodNotFound]:404,[ae.UnsupportedProtocolVersion]:400,[ae.MissingRequiredClientCapability]:400,[Jr]:400};function Ia(e,t){return ws(e,t)}function wn(e){return new Set(e.flatMap(t=>Object.keys(t.shape)))}function tl(e){if(e==null)return!1;let t=typeof e;return t!=="object"&&t!=="function"||!("~standard"in e)?!1:typeof e["~standard"]?.validate=="function"}var ff=!1,rl="draft-2020-12";function eb(e,t="input"){let r=e["~standard"],o;if(r.jsonSchema)o=r.jsonSchema[t]({target:rl});else if(r.vendor==="zod"){if(!("_zod"in e))throw new Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");ff||(ff=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),o=bs(e,{target:rl,io:t})}else throw new Error(`Schema library "${r.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output")return o.type!==void 0?o:Kf(o)?{type:"object",...o}:o;if(o.type!==void 0&&o.type!=="object")throw new Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(o.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...o}}function Kf(e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;for(let t of["oneOf","anyOf","allOf"]){let r=e[t];if(Array.isArray(r)&&r.length>0)return r.every(o=>o!==null&&typeof o=="object"&&(o.type==="object"||Kf(o)))}return!1}function tb(e){return e.path?.length?`${e.path.map(t=>String(typeof t=="object"?t.key:t)).join(".")}: ${e.message}`:e.message}async function Xu(e,t){let r=await e["~standard"].validate(t);return r.issues&&r.issues.length>0?{success:!1,error:r.issues.map(o=>tb(o)).join(", ")}:{success:!0,data:r.value}}function rb(e){let t=bs(e,{target:rl,io:"input"});return typeof t.pattern=="string"?t.pattern:void 0}var ob=/\\\.\\d\{(\d+)\}/;function nb(e){let t=ob.exec(e),r=[void 0,-1,0];return t&&r.push(Number(t[1])),[!1,!0].flatMap(o=>[!1,!0].flatMap(n=>r.map(s=>vt.datetime({local:o,offset:n,precision:s}))))}function sb(e,t){let r;switch(e){case"email":r=[Uh()];break;case"uri":r=[Ps()];break;case"date":r=[vt.date()];break;case"date-time":r=nb(t);break}return new Set(r.map(o=>rb(o)).filter(o=>o!==void 0))}function ib(e,t,r){return r!=="zod"?!0:sb(e,t).has(t)}function En(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ab(e){try{return eb(e,"input")}catch(t){let r=t instanceof Error?t.message:String(t);throw new _e(ae.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${r}`)}}var cb=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function ml(e){return cb.has(e)||e.startsWith("x-")}var ub=new Set(["$schema",...Object.keys(Hr.shape.requestedSchema.shape)]),gf={string:wn([Vr,fn,gn,_n]),number:wn([Fr]),integer:wn([Fr]),boolean:wn([hn]),array:wn([yn,Sn])},lb=new Set(Vr.shape.format.unwrap().options);function db(e,t,r,o){if(!En(e))return e;let n=typeof e.type=="string"&&Object.hasOwn(gf,e.type)?gf[e.type]:void 0;if(n===void 0)return e;let s={};for(let[i,c]of Object.entries(e))n.has(i)||ml(i)?s[i]=c:i==="pattern"&&e.type==="string"&&typeof e.format=="string"?lb.has(e.format)?(typeof c!="string"||!ib(e.format,c,r))&&o.push(`${t}.${i}`):s[i]=c:o.push(`${t}.${i}`);return s}function pb(e,t){let r={},o=[];for(let[n,s]of Object.entries(e))n==="properties"&&En(s)?r[n]=Object.fromEntries(Object.entries(s).map(([i,c])=>[i,db(c,`properties.${i}`,t,o)])):ub.has(n)?r[n]=s:ml(n)||o.push(n);if(o.length>0)throw new _e(ae.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);return r}function mb(e,t){if(!En(e.properties))return t;let r=Object.entries(e.properties).filter(([,o])=>!Ia(vn,o).success).map(([o])=>`properties.${o}`);return r.length>0?r.join(", "):t}function ol(e,t,r=""){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((o,n)=>ol(o,t[n],`${r}[${n}]`)):!En(e)||!En(t)?[]:Object.entries(e).flatMap(([o,n])=>{let s=r?`${r}.${o}`:o;return Object.prototype.hasOwnProperty.call(t,o)?ol(n,t[o],s):ml(o)?[]:[s]})}function hb(e){if(!tl(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,r=pb(ab(e.requestedSchema),t),o=Ia(Hr.shape.requestedSchema,r);if(!o.success)throw new _e(ae.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${mb(r,o.error.message)}`);let n=ol(r,o.data);if(n.length>0)throw new _e(ae.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let s=(o.data.required??[]).filter(i=>!Object.prototype.hasOwnProperty.call(o.data.properties,i));if(s.length>0)throw new _e(ae.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...e,mode:"form",requestedSchema:o.data}}function fb(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,r=typeof e.requestState=="string";if(!t&&!r)throw new TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}var CR=Object.assign(fb,{elicit(e){try{return{method:"elicitation/create",params:hb(e)}}catch(t){throw t instanceof _e?new TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});var gb=!0,_b=10,yb=250;function Gf(e){return{autoFulfill:e?.autoFulfill??gb,maxRounds:e?.maxRounds??_b}}function Sb(e,t,r){let o=t!==void 0&&Object.keys(t).length>0;return!o&&r===void 0?e:{...e,...o&&{inputResponses:t},...r!==void 0&&{requestState:r}}}function vb(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function bb(e,t){return new Promise((r,o)=>{if(t?.aborted){o(t.reason instanceof Y?t.reason:new Y(X.RequestTimeout,String(t.reason)));return}let n=setTimeout(()=>{t?.removeEventListener("abort",s),r()},e),s=()=>{clearTimeout(n),o(t?.reason instanceof Y?t.reason:new Y(X.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",s,{once:!0})})}function zb(e){let t=new AbortController,r=()=>t.abort(e?.reason);return e?.addEventListener("abort",r,{once:!0}),e?.aborted&&t.abort(e.reason),{signal:t.signal,abort:o=>t.abort(o),dispose:()=>e?.removeEventListener("abort",r)}}async function wb(e){let{config:t,method:r,originalParams:o,requestOptions:n,hooks:s,signal:i}=e,c=e.flowStartedAt??Date.now(),a=e.firstPayload,u=0;for(;;){if(u+=1,u>t.maxRounds)throw new Y(X.InputRequiredRoundsExceeded,vb(r,t.maxRounds),{rounds:t.maxRounds,lastResult:{inputRequests:a.inputRequests,...a.requestState!==void 0&&{requestState:a.requestState}}});n.onprogress?.({progress:u,message:`Fulfilling input required by '${r}' (round ${u})`});let l=Object.entries(a.inputRequests??{}),p;if(l.length>0){let m=zb(i);try{let _=await Promise.all(l.map(async([g,h])=>{try{return[g,await s.dispatchInputRequest(g,h,m.signal)]}catch(v){throw m.abort(v),v}}));p=Object.fromEntries(_)}finally{m.dispose()}}else await bb(yb,i);let f={...n.timeout!==void 0&&{timeout:n.timeout}};if(n.maxTotalTimeout!==void 0){let m=Date.now()-c,_=n.maxTotalTimeout-m;if(_<=0)throw new Y(X.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:m});f.maxTotalTimeout=_}let z=await s.retry(Sb(o,p,a.requestState),f);if(Vf(z)){a={inputRequests:z.inputRequests??{},...z.requestState!==void 0&&{requestState:z.requestState}};continue}return z}}var $b=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],Rb={IdJagTokenExchangeResponseSchema:_a,OAuthClientInformationFullSchema:ba,OAuthClientInformationSchema:va,OAuthClientMetadataSchema:Sa,OAuthClientRegistrationErrorSchema:Bu,OAuthErrorResponseSchema:ya,OAuthMetadataSchema:bn,OAuthProtectedResourceMetadataSchema:ma,OAuthTokenRevocationRequestSchema:Ku,OAuthTokensSchema:ga,OpenIdProviderDiscoveryMetadataSchema:fa,OpenIdProviderMetadataSchema:ha},Wf={},Yf={};function Xf(e,t){let r=e.slice(0,-6);Wf[r]=t,Yf[r]=o=>t.safeParse(o).success}for(let e of $b)Xf(e,Fv[e]);for(let[e,t]of Object.entries(Rb))Xf(e,t);var Pb=Object.freeze(Wf),Qf=Object.freeze(Yf);function Eb(e){switch(e){case"initialize":case"notifications/initialized":return $t(void 0);case"server/discover":return $t(Ca);default:return}}var xa=6e4,Tb=[or,xr,nr,Nr],kb=["inputResponses","requestState"];function _f(e,t){let r=e.params;if(!Rn(r))return{message:e,lifted:{}};let o=r._meta,n=Rn(o)?Tb.filter(a=>a in o):[],s=t==="request"?kb.filter(a=>a in r):[];if(n.length===0&&s.length===0)return{message:e,lifted:{}};let i={},c={...r};if(n.length>0&&Rn(o)){let a={},u={...o};for(let l of n)a[l]=o[l],delete u[l];i.envelope=a,Object.keys(u).length>0?c._meta=u:delete c._meta}for(let a of s)a==="inputResponses"&&(i.inputResponses=c[a]),a==="requestState"&&(i.requestState=c[a]),delete c[a];return{message:{...e,params:c},lifted:i}}function yf(e,t){let r=e.validateResult(t,void 0);if(!(!r.ok&&r.reason==="not-in-era"))return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(o){let n=e.validateResult(t,o);return n.ok?{value:n.value}:{issues:[{message:n.reason==="invalid"?n.message:`not-in-era: ${t}`}]}}}}}function hl(e){return()=>e}var Cb=hl(void 0),Ob,eg=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{Ob=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??Cs,this.setNotificationHandler("notifications/cancelled",t=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",t=>{this._onprogress(t)}),this.setRequestHandler("ping",t=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new Y(X.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,o,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:n,onTimeout:o})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Y(X.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let r=this.transport?.onerror;this._transport.onerror=n=>{r?.(n),this._onerror(n)};let o=this._transport?.onmessage;this._transport.onmessage=(n,s)=>{o?.(n,s),Pn(n)||Oa(n)?this._onresponse(n):dl(n)?this._onrequest(n,s):Zf(n)?this._onnotification(n,s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(n)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new Y(X.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let o of e.values())o(r);for(let o of t.values())o.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=_f(e,"notification"),o=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let i=mf(t.classification);if(i!==o.era){this._onerror(new Error(`Era mismatch on inbound notification '${r.method}': classified as ${i} but this instance serves ${o.era}`));return}}if(Yu(r.method)&&!o.hasNotificationMethod(r.method))return;let n=this._notificationHandlers.get(r.method),s=this.fallbackNotificationHandler;n===void 0&&s===void 0||Promise.resolve().then(()=>n===void 0?s(r):n(r,o)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,t){let{message:r,lifted:o}=_f(e,"request"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop"){this._onerror(new Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let s=this._transport,i=(_,g,h)=>{let v={jsonrpc:"2.0",id:r.id,error:{code:_,message:g,...h!==void 0&&{data:h}}};s?.send(v).catch(S=>this._onerror(new Error(`Failed to send an error response: ${S}`)))};if(t?.classification!==void 0){let _=mf(t.classification);if(_!==n.era){this._onerror(new Error(`Era mismatch on inbound request '${r.method}': classified as ${_} but this instance serves ${n.era}`));let g=t.classification.revision??_;i(ae.UnsupportedProtocolVersion,`Unsupported protocol version: ${g}`,{supported:this._supportedProtocolVersions,requested:g});return}}if(Wu(r.method)&&!n.hasRequestMethod(r.method)){i(ae.MethodNotFound,"Method not found");return}let c=this._requestHandlers.get(r.method)??this.fallbackRequestHandler;if(c===void 0){i(ae.MethodNotFound,"Method not found");return}let a=n.checkInboundEnvelope(o);if(a!==void 0){i(ae.InvalidParams,a);return}let u=(_,g)=>this._notificationViaCodec(this._resolveOutboundCodec(_.method),_,{...g,relatedRequestId:r.id}),l=(_,g,h)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(_.method),_,g,{...h,relatedRequestId:r.id}),p=new AbortController;this._requestHandlerAbortControllers.set(r.id,p);let f=o.inputResponses===void 0?void 0:Ib(o.inputResponses),z={sessionId:s?.sessionId,mcpReq:{id:r.id,method:r.method,_meta:r.params?._meta,...o.envelope!==void 0&&{envelope:o.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:o.requestState===void 0?Cb:hl(o.requestState),signal:p.signal,send:((_,g,h)=>{let v=this._resolveOutboundCodec(_.method);if(this._assertOutboundRequestInEra(v,_.method),tl(g))return l(_,g,h);let S=yf(v,_.method);if(S===void 0)throw new TypeError(`'${_.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return l(_,S,g)}),notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},m=this.buildContext(z,t);Promise.resolve().then(()=>c(r,m)).then(async _=>{if(p.signal.aborted)return;let g;try{g=n.encodeResult(r.method,_,this._outboundServerInfo())}catch(v){this._onerror(new Error(`Failed to encode result for ${r.method}: ${v}`)),i(ae.InternalError,"Internal error");return}let h={result:g,jsonrpc:"2.0",id:r.id};await s?.send(h)},async _=>{if(p.signal.aborted)return;let g=Number.isSafeInteger(_.code)?_.code:ae.InternalError,h={jsonrpc:"2.0",id:r.id,error:{code:n.encodeErrorCode(g),message:_.message??"Internal error",..._.data!==void 0&&{data:_.data}}};await s?.send(h)}).catch(_=>this._onerror(new Error(`Failed to send response: ${_}`))).finally(()=>{this._requestHandlerAbortControllers.get(r.id)===p&&this._requestHandlerAbortControllers.delete(r.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,o=Number(t),n=this._progressHandlers.get(o);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(o),i=this._timeoutInfo.get(o);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(c);return}n(r)}_onresponse(e){let t=Number(e.id),r=this._responseHandlers.get(t);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),Pn(e)?r(e):r(_e.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,r){let o=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(o,e.method),tl(t))return this._requestWithSchemaViaCodec(o,e,t,r);let n=yf(o,e.method);if(n===void 0)throw new TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(o,e,n,t)}_negotiatedWireCodec(){return $t(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=Eb(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Wu(t)&&!e.hasRequestMethod(t))throw new Y(X.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,r){let o=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(o,e.method),this._requestWithSchemaViaCodec(o,e,t,r)}_requestWithSchemaViaCodec(e,t,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,headers:c}=o??{},a=Date.now(),u,l;return new Promise((p,f)=>{let z=b=>{f(b)};if(!this._transport){z(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(b){z(b);return}if(o?.signal?.aborted){let b=o.signal.reason;throw b instanceof Y?b:new Y(X.RequestTimeout,String(b))}let m=e.era===Ca&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,_=this._requestMessageId++;l=_;let g={...t,jsonrpc:"2.0",id:_};o?.onprogress&&(this._progressHandlers.set(_,o.onprogress),g.params={...t.params,_meta:{...t.params?._meta,progressToken:_}});let h=this._envelopeOutbound(g),v=!1,S=b=>{v||(this._progressHandlers.delete(_),m===void 0?this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:_,reason:String(b)}}),{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(y=>this._onerror(new Error(`Failed to send cancellation: ${y}`))):m.abort(),f(b instanceof Y?b:new Y(X.RequestTimeout,String(b))))};this._responseHandlers.set(_,b=>{if(o?.signal?.aborted)return;if(v=!0,b instanceof Error)return f(b);let y;try{y=e.decodeResult(t.method,b.result)}catch(N){return f(N instanceof Error?N:new Error(String(N)))}if(y.kind==="invalid")return f(y.error);if(y.kind==="input_required"){if(o?.allowInputRequired===!0)return p(Ab(y));let N={codec:e,request:t,resultSchema:r,options:o,flowStartedAt:a,retry:(F,M)=>this._requestWithSchemaViaCodec(e,F===void 0?{method:t.method}:{method:t.method,params:F},r,M)};return p(this._resolveNonCompleteResult(y,N))}let P=y.result;Xu(r,P).then(N=>{N.success?p(N.data):f(new Y(X.InvalidResult,`Invalid result for ${t.method}: ${N.error}`))},f)}),u=()=>S(o?.signal?.reason),o?.signal?.addEventListener("abort",u,{once:!0});let w=o?.timeout??xa,R=()=>S(new Y(X.RequestTimeout,"Request timed out",{timeout:w}));this._setupTimeout(_,w,o?.maxTotalTimeout,R,o?.resetTimeoutOnProgress??!1),this._transport.send(h,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,headers:c,requestSignal:m?.signal}).catch(b=>{this._progressHandlers.delete(_),f(b)})}).finally(()=>{u&&o?.signal?.removeEventListener("abort",u),l!==void 0&&(this._responseHandlers.delete(l),this._cleanupTimeout(l))})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new Y(X.NotConnected,"Not connected");if(Yu(t.method)&&!e.hasNotificationMethod(t.method))throw new Y(X.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let o=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(o,r).catch(n=>this._onerror(n))});return}await this._transport.send(o,r)}setRequestHandler(e,t,r){this.assertRequestHandlerCapability(e);let o;if(typeof t=="function"){if(!Wu(e))throw new TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);o=(n,s)=>{let i=this._negotiatedWireCodec(),c=i.validateRequest(e,n);if(!c.ok&&c.reason==="not-in-era"&&(c=i.validateInputRequest(e,n)),!c.ok)throw c.reason==="not-in-era"?new _e(ae.InternalError,`No wire schema for ${e} in the resolved era`):new Error(c.message);return Promise.resolve(t(c.value,s))}}else if(r)o=async(n,s)=>{let i=await Xu(t.params,{...n.params});if(!i.success)throw new _e(ae.InvalidParams,`Invalid params for ${e}: ${i.error}`);return r(i.data,s)};else throw new TypeError("setRequestHandler: handler is required");this._requestHandlers.set(e,this._wrapHandler(e,o))}_wrapHandler(e,t){return t}_outboundServerInfo(){}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,r){if(typeof t=="function"){if(!Yu(e))throw new TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(o,n)=>{let s=n.validateNotification(e,o);if(!s.ok)throw s.reason==="not-in-era"?new _e(ae.InternalError,`No wire schema for ${e} in the resolved era`):new Error(s.message);return Promise.resolve(t(s.value))});return}if(!r)throw new TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async o=>{let n=await Xu(t.params,{...o.params});if(!n.success)throw new _e(ae.InvalidParams,`Invalid params for notification ${e}: ${n.error}`);await r(n.data,o)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Rn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function tg(e,t){let r={...e};for(let o in t){let n=o,s=t[n];if(s===void 0)continue;let i=r[n];r[n]=Rn(i)&&Rn(s)?{...i,...s}:s}return r}function Ea(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ib(e){let t={},r=[];if(!Ea(e))return{accepted:t,droppedKeys:r};for(let[o,n]of Object.entries(e)){if(!Ea(n)||"method"in n||"result"in n){r.push(o);continue}t[o]=n}return{accepted:t,droppedKeys:r}}function Sf(e){throw new Y(X.SendFailed,`ctx.mcpReq.${e} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}function xb(e,t,r,o,n){return{sessionId:n,mcpReq:{id:e,method:t,_meta:r?._meta,requestState:hl(void 0),signal:o,send:(()=>Sf("send")),notify:()=>Sf("notify")}}}async function Nb(e,t,r,o,n){if(!Ea(o)||typeof o.method!="string")throw new Y(X.InvalidResult,`Invalid input request '${r}': each inputRequests entry must be an embedded request object with a method`,{key:r});let s=o.method;if(!t.hasInputRequestMethod(s))throw new Y(X.InvalidResult,`Invalid input request '${r}': '${s}' is not an embedded request the ${t.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:r,method:s});let i=e.getRequestHandler(s);if(i===void 0)throw new Y(X.CapabilityNotSupported,`Cannot fulfil input request '${r}': no handler is registered for '${s}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:r,method:s});let c=Ea(o.params)?o.params:void 0;return await i({jsonrpc:"2.0",id:r,method:s,...c!==void 0&&{params:c}},e.buildContext(xb(r,s,c,n,e.sessionId)))}function jb(e,t){return{...e?.signal!==void 0&&{signal:e.signal},...e?.onprogress!==void 0&&{onprogress:e.onprogress},...e?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:e.resetTimeoutOnProgress},...e?.headers!==void 0&&{headers:e.headers},...t.timeout!==void 0&&{timeout:t.timeout},...t.maxTotalTimeout!==void 0&&{maxTotalTimeout:t.maxTotalTimeout},allowInputRequired:!0}}function rg(e,t,r,o){let{codec:n,request:s,options:i,flowStartedAt:c}=o,a={inputRequests:r.inputRequests,...r.requestState!==void 0&&{requestState:r.requestState}},u={dispatchInputRequest:(l,p,f)=>Nb(e,n,l,p,f),retry:(l,p)=>o.retry(l,jb(i,p))};return wb({config:t,method:s.method,originalParams:s.params,firstPayload:a,flowStartedAt:c,signal:i?.signal,requestOptions:{...i?.timeout!==void 0&&{timeout:i.timeout},...i?.maxTotalTimeout!==void 0&&{maxTotalTimeout:i.maxTotalTimeout},...i?.onprogress!==void 0&&{onprogress:i.onprogress}},hooks:u})}function Ab(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState}}}var qb=D((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,o=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=n;function n(c){if(!c)throw new TypeError("argument string is required");var a=typeof c=="object"?s(c):c;if(typeof a!="string")throw new TypeError("argument string is required to be a string");var u=a.indexOf(";"),l=u!==-1?a.slice(0,u).trim():a.trim();if(!o.test(l))throw new TypeError("invalid media type");var p=new i(l.toLowerCase());if(u!==-1){var f,z,m;for(t.lastIndex=u;z=t.exec(a);){if(z.index!==u)throw new TypeError("invalid parameter format");u+=z[0].length,f=z[1].toLowerCase(),m=z[2],m.charCodeAt(0)===34&&(m=m.slice(1,-1),m.indexOf("\\")!==-1&&(m=m.replace(r,"$1"))),p.parameters[f]=m}if(u!==a.length)throw new TypeError("invalid parameter format")}return p}function s(c){var a;if(typeof c.getHeader=="function"?a=c.getHeader("content-type"):typeof c.headers=="object"&&(a=c.headers&&c.headers["content-type"]),typeof a!="string")throw new TypeError("content-type header is missing from object");return a}function i(c){this.parameters=Object.create(null),this.type=c}})),OR=Yn(qb(),1);var og=10*1024*1024,fl=class{_buffer;_maxBufferSize;constructor(e){this._maxBufferSize=e?.maxBufferSize??og}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){for(;this._buffer;){let e=this._buffer.indexOf(`
54
+ `);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");this._buffer=this._buffer.subarray(e+1);try{return ng(t)}catch(r){if(r instanceof SyntaxError)continue;throw r}}return null}clear(){this._buffer=void 0}};function ng(e){return Xo.parse(JSON.parse(e))}function gl(e){return JSON.stringify(e)+`
55
+ `}var ja=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var r=class extends t{constructor(h){if(super(),!e.IDENTIFIER.test(h))throw new Error("CodeGen: name must be a valid identifier");this.str=h}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=r;var o=class extends t{constructor(h){super(),this._items=typeof h=="string"?[h]:h}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let h=this._items[0];return h===""||h==='""'}get str(){var h;return(h=this._str)!==null&&h!==void 0?h:this._str=this._items.reduce((v,S)=>`${v}${S}`,"")}get names(){var h;return(h=this._names)!==null&&h!==void 0?h:this._names=this._items.reduce((v,S)=>(S instanceof r&&(v[S.str]=(v[S.str]||0)+1),v),{})}};e._Code=o,e.nil=new o("");function n(h,...v){let S=[h[0]],w=0;for(;w<v.length;)c(S,v[w]),S.push(h[++w]);return new o(S)}e._=n;let s=new o("+");function i(h,...v){let S=[z(h[0])],w=0;for(;w<v.length;)S.push(s),c(S,v[w]),S.push(s,z(h[++w]));return a(S),new o(S)}e.str=i;function c(h,v){v instanceof o?h.push(...v._items):v instanceof r?h.push(v):h.push(p(v))}e.addCodeArg=c;function a(h){let v=1;for(;v<h.length-1;){if(h[v]===s){let S=u(h[v-1],h[v+1]);if(S!==void 0){h.splice(v-1,3,S);continue}h[v++]="+"}v++}}function u(h,v){if(v==='""')return h;if(h==='""')return v;if(typeof h=="string")return v instanceof r||h[h.length-1]!=='"'?void 0:typeof v!="string"?`${h.slice(0,-1)}${v}"`:v[0]==='"'?h.slice(0,-1)+v.slice(1):void 0;if(typeof v=="string"&&v[0]==='"'&&!(h instanceof r))return`"${h}${v.slice(1)}`}function l(h,v){return v.emptyStr()?h:h.emptyStr()?v:i`${h}${v}`}e.strConcat=l;function p(h){return typeof h=="number"||typeof h=="boolean"||h===null?h:z(Array.isArray(h)?h.join(","):h)}function f(h){return new o(z(h))}e.stringify=f;function z(h){return JSON.stringify(h).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=z;function m(h){return typeof h=="string"&&e.IDENTIFIER.test(h)?new o(`.${h}`):n`[${h}]`}e.getProperty=m;function _(h){if(typeof h=="string"&&e.IDENTIFIER.test(h))return new o(`${h}`);throw new Error(`CodeGen: invalid export name: ${h}, use explicit $id name mapping`)}e.getEsmExportName=_;function g(h){return new o(h.toString())}e.regexpCode=g})),sg=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=ja();var r=class extends Error{constructor(a){super(`CodeGen: "code" for ${a} not defined`),this.value=a.value}},o;(function(a){a[a.Started=0]="Started",a[a.Completed=1]="Completed"})(o||(e.UsedValueState=o={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};var n=class{constructor({prefixes:a,parent:u}={}){this._names={},this._prefixes=a,this._parent=u}toName(a){return a instanceof t.Name?a:this.name(a)}name(a){return new t.Name(this._newName(a))}_newName(a){let u=this._names[a]||this._nameGroup(a);return`${a}${u.index++}`}_nameGroup(a){var u,l;if(!((l=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||l===void 0)&&l.has(a)||this._prefixes&&!this._prefixes.has(a))throw new Error(`CodeGen: prefix "${a}" is not allowed in this scope`);return this._names[a]={prefix:a,index:0}}};e.Scope=n;var s=class extends t.Name{constructor(a,u){super(u),this.prefix=a}setValue(a,{property:u,itemIndex:l}){this.value=a,this.scopePath=(0,t._)`.${new t.Name(u)}[${l}]`}};e.ValueScopeName=s;let i=(0,t._)`\n`;var c=class extends n{constructor(a){super(a),this._values={},this._scope=a.scope,this.opts={...a,_n:a.lines?i:t.nil}}get(){return this._scope}name(a){return new s(a,this._newName(a))}value(a,u){var l;if(u.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let p=this.toName(a),{prefix:f}=p,z=(l=u.key)!==null&&l!==void 0?l:u.ref,m=this._values[f];if(m){let h=m.get(z);if(h)return h}else m=this._values[f]=new Map;m.set(z,p);let _=this._scope[f]||(this._scope[f]=[]),g=_.length;return _[g]=u.ref,p.setValue(u,{property:f,itemIndex:g}),p}getValue(a,u){let l=this._values[a];if(l)return l.get(u)}scopeRefs(a,u=this._values){return this._reduceValues(u,l=>{if(l.scopePath===void 0)throw new Error(`CodeGen: name "${l}" has no value`);return(0,t._)`${a}${l.scopePath}`})}scopeCode(a=this._values,u,l){return this._reduceValues(a,p=>{if(p.value===void 0)throw new Error(`CodeGen: name "${p}" has no value`);return p.value.code},u,l)}_reduceValues(a,u,l={},p){let f=t.nil;for(let z in a){let m=a[z];if(!m)continue;let _=l[z]=l[z]||new Map;m.forEach(g=>{if(_.has(g))return;_.set(g,o.Started);let h=u(g);if(h){let v=this.opts.es5?e.varKinds.var:e.varKinds.const;f=(0,t._)`${f}${v} ${g} = ${h};${this.opts._n}`}else if(h=p?.(g))f=(0,t._)`${f}${h}${this.opts._n}`;else throw new r(g);_.set(g,o.Completed)})}return f}};e.ValueScope=c})),ue=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=ja(),r=sg();var o=ja();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return o.Name}});var n=sg();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return n.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return n.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return n.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return n.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};var s=class{optimizeNodes(){return this}optimizeNames($,k){return this}},i=class extends s{constructor($,k,x){super(),this.varKind=$,this.name=k,this.rhs=x}render({es5:$,_n:k}){let x=$?r.varKinds.var:this.varKind,H=this.rhs===void 0?"":` = ${this.rhs}`;return`${x} ${this.name}${H};`+k}optimizeNames($,k){if($[this.name.str])return this.rhs&&(this.rhs=B(this.rhs,$,k)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},c=class extends s{constructor($,k,x){super(),this.lhs=$,this.rhs=k,this.sideEffects=x}render({_n:$}){return`${this.lhs} = ${this.rhs};`+$}optimizeNames($,k){if(!(this.lhs instanceof t.Name&&!$[this.lhs.str]&&!this.sideEffects))return this.rhs=B(this.rhs,$,k),this}get names(){return K(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},a=class extends c{constructor($,k,x,H){super($,x,H),this.op=k}render({_n:$}){return`${this.lhs} ${this.op}= ${this.rhs};`+$}},u=class extends s{constructor($){super(),this.label=$,this.names={}}render({_n:$}){return`${this.label}:`+$}},l=class extends s{constructor($){super(),this.label=$,this.names={}}render({_n:$}){return`break${this.label?` ${this.label}`:""};`+$}},p=class extends s{constructor($){super(),this.error=$}render({_n:$}){return`throw ${this.error};`+$}get names(){return this.error.names}},f=class extends s{constructor($){super(),this.code=$}render({_n:$}){return`${this.code};`+$}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames($,k){return this.code=B(this.code,$,k),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},z=class extends s{constructor($=[]){super(),this.nodes=$}render($){return this.nodes.reduce((k,x)=>k+x.render($),"")}optimizeNodes(){let{nodes:$}=this,k=$.length;for(;k--;){let x=$[k].optimizeNodes();Array.isArray(x)?$.splice(k,1,...x):x?$[k]=x:$.splice(k,1)}return $.length>0?this:void 0}optimizeNames($,k){let{nodes:x}=this,H=x.length;for(;H--;){let te=x[H];te.optimizeNames($,k)||(me($,te.names),x.splice(H,1))}return x.length>0?this:void 0}get names(){return this.nodes.reduce(($,k)=>U($,k.names),{})}},m=class extends z{render($){return"{"+$._n+super.render($)+"}"+$._n}},_=class extends z{},g=class extends m{};g.kind="else";var h=class Na extends m{constructor(k,x){super(x),this.condition=k}render(k){let x=`if(${this.condition})`+super.render(k);return this.else&&(x+="else "+this.else.render(k)),x}optimizeNodes(){super.optimizeNodes();let k=this.condition;if(k===!0)return this.nodes;let x=this.else;if(x){let H=x.optimizeNodes();x=this.else=Array.isArray(H)?new g(H):H}if(x)return k===!1?x instanceof Na?x:x.nodes:this.nodes.length?this:new Na($e(k),x instanceof Na?[x]:x.nodes);if(!(k===!1||!this.nodes.length))return this}optimizeNames(k,x){var H;if(this.else=(H=this.else)===null||H===void 0?void 0:H.optimizeNames(k,x),!!(super.optimizeNames(k,x)||this.else))return this.condition=B(this.condition,k,x),this}get names(){let k=super.names;return K(k,this.condition),this.else&&U(k,this.else.names),k}};h.kind="if";var v=class extends m{};v.kind="for";var S=class extends v{constructor($){super(),this.iteration=$}render($){return`for(${this.iteration})`+super.render($)}optimizeNames($,k){if(super.optimizeNames($,k))return this.iteration=B(this.iteration,$,k),this}get names(){return U(super.names,this.iteration.names)}},w=class extends v{constructor($,k,x,H){super(),this.varKind=$,this.name=k,this.from=x,this.to=H}render($){let k=$.es5?r.varKinds.var:this.varKind,{name:x,from:H,to:te}=this;return`for(${k} ${x}=${H}; ${x}<${te}; ${x}++)`+super.render($)}get names(){return K(K(super.names,this.from),this.to)}},R=class extends v{constructor($,k,x,H){super(),this.loop=$,this.varKind=k,this.name=x,this.iterable=H}render($){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render($)}optimizeNames($,k){if(super.optimizeNames($,k))return this.iterable=B(this.iterable,$,k),this}get names(){return U(super.names,this.iterable.names)}},b=class extends m{constructor($,k,x){super(),this.name=$,this.args=k,this.async=x}render($){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render($)}};b.kind="func";var y=class extends z{render($){return"return "+super.render($)}};y.kind="return";var P=class extends m{render($){let k="try"+super.render($);return this.catch&&(k+=this.catch.render($)),this.finally&&(k+=this.finally.render($)),k}optimizeNodes(){var $,k;return super.optimizeNodes(),($=this.catch)===null||$===void 0||$.optimizeNodes(),(k=this.finally)===null||k===void 0||k.optimizeNodes(),this}optimizeNames($,k){var x,H;return super.optimizeNames($,k),(x=this.catch)===null||x===void 0||x.optimizeNames($,k),(H=this.finally)===null||H===void 0||H.optimizeNames($,k),this}get names(){let $=super.names;return this.catch&&U($,this.catch.names),this.finally&&U($,this.finally.names),$}},N=class extends m{constructor($){super(),this.error=$}render($){return`catch(${this.error})`+super.render($)}};N.kind="catch";var F=class extends m{render($){return"finally"+super.render($)}};F.kind="finally";var M=class{constructor($,k={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...k,_n:k.lines?`
56
+ `:""},this._extScope=$,this._scope=new r.Scope({parent:$}),this._nodes=[new _]}toString(){return this._root.render(this.opts)}name($){return this._scope.name($)}scopeName($){return this._extScope.name($)}scopeValue($,k){let x=this._extScope.value($,k);return(this._values[x.prefix]||(this._values[x.prefix]=new Set)).add(x),x}getScopeValue($,k){return this._extScope.getValue($,k)}scopeRefs($){return this._extScope.scopeRefs($,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def($,k,x,H){let te=this._scope.toName(k);return x!==void 0&&H&&(this._constants[te.str]=x),this._leafNode(new i($,te,x)),te}const($,k,x){return this._def(r.varKinds.const,$,k,x)}let($,k,x){return this._def(r.varKinds.let,$,k,x)}var($,k,x){return this._def(r.varKinds.var,$,k,x)}assign($,k,x){return this._leafNode(new c($,k,x))}add($,k){return this._leafNode(new a($,e.operators.ADD,k))}code($){return typeof $=="function"?$():$!==t.nil&&this._leafNode(new f($)),this}object(...$){let k=["{"];for(let[x,H]of $)k.length>1&&k.push(","),k.push(x),(x!==H||this.opts.es5)&&(k.push(":"),(0,t.addCodeArg)(k,H));return k.push("}"),new t._Code(k)}if($,k,x){if(this._blockNode(new h($)),k&&x)this.code(k).else().code(x).endIf();else if(k)this.code(k).endIf();else if(x)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf($){return this._elseNode(new h($))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(h,g)}_for($,k){return this._blockNode($),k&&this.code(k).endFor(),this}for($,k){return this._for(new S($),k)}forRange($,k,x,H,te=this.opts.es5?r.varKinds.var:r.varKinds.let){let de=this._scope.toName($);return this._for(new w(te,de,k,x),()=>H(de))}forOf($,k,x,H=r.varKinds.const){let te=this._scope.toName($);if(this.opts.es5){let de=k instanceof t.Name?k:this.var("_arr",k);return this.forRange("_i",0,(0,t._)`${de}.length`,ie=>{this.var(te,(0,t._)`${de}[${ie}]`),x(te)})}return this._for(new R("of",H,te,k),()=>x(te))}forIn($,k,x,H=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf($,(0,t._)`Object.keys(${k})`,x);let te=this._scope.toName($);return this._for(new R("in",H,te,k),()=>x(te))}endFor(){return this._endBlockNode(v)}label($){return this._leafNode(new u($))}break($){return this._leafNode(new l($))}return($){let k=new y;if(this._blockNode(k),this.code($),k.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(y)}try($,k,x){if(!k&&!x)throw new Error('CodeGen: "try" without "catch" and "finally"');let H=new P;if(this._blockNode(H),this.code($),k){let te=this.name("e");this._currNode=H.catch=new N(te),k(te)}return x&&(this._currNode=H.finally=new F,this.code(x)),this._endBlockNode(N,F)}throw($){return this._leafNode(new p($))}block($,k){return this._blockStarts.push(this._nodes.length),$&&this.code($).endBlock(k),this}endBlock($){let k=this._blockStarts.pop();if(k===void 0)throw new Error("CodeGen: not in self-balancing block");let x=this._nodes.length-k;if(x<0||$!==void 0&&x!==$)throw new Error(`CodeGen: wrong number of nodes: ${x} vs ${$} expected`);return this._nodes.length=k,this}func($,k=t.nil,x,H){return this._blockNode(new b($,k,x)),H&&this.code(H).endFunc(),this}endFunc(){return this._endBlockNode(b)}optimize($=1){for(;$-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode($){return this._currNode.nodes.push($),this}_blockNode($){this._currNode.nodes.push($),this._nodes.push($)}_endBlockNode($,k){let x=this._currNode;if(x instanceof $||k&&x instanceof k)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${k?`${$.kind}/${k.kind}`:$.kind}"`)}_elseNode($){let k=this._currNode;if(!(k instanceof h))throw new Error('CodeGen: "else" without "if"');return this._currNode=k.else=$,this}get _root(){return this._nodes[0]}get _currNode(){let $=this._nodes;return $[$.length-1]}set _currNode($){let k=this._nodes;k[k.length-1]=$}};e.CodeGen=M;function U($,k){for(let x in k)$[x]=($[x]||0)+(k[x]||0);return $}function K($,k){return k instanceof t._CodeOrName?U($,k.names):$}function B($,k,x){if($ instanceof t.Name)return H($);if(!te($))return $;return new t._Code($._items.reduce((de,ie)=>(ie instanceof t.Name&&(ie=H(ie)),ie instanceof t._Code?de.push(...ie._items):de.push(ie),de),[]));function H(de){let ie=x[de.str];return ie===void 0||k[de.str]!==1?de:(delete k[de.str],ie)}function te(de){return de instanceof t._Code&&de._items.some(ie=>ie instanceof t.Name&&k[ie.str]===1&&x[ie.str]!==void 0)}}function me($,k){for(let x in k)$[x]=($[x]||0)-(k[x]||0)}function $e($){return typeof $=="boolean"||typeof $=="number"||$===null?!$:(0,t._)`!${Z($)}`}e.not=$e;let be=j(e.operators.AND);function Ie(...$){return $.reduce(be)}e.and=Ie;let he=j(e.operators.OR);function C(...$){return $.reduce(he)}e.or=C;function j($){return(k,x)=>k===t.nil?x:x===t.nil?k:(0,t._)`${Z(k)} ${$} ${Z(x)}`}function Z($){return $ instanceof t.Name?$:(0,t._)`(${$})`}})),fe=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let t=ue(),r=ja();function o(b){let y={};for(let P of b)y[P]=!0;return y}e.toHash=o;function n(b,y){return typeof y=="boolean"?y:Object.keys(y).length===0?!0:(s(b,y),!i(y,b.self.RULES.all))}e.alwaysValidSchema=n;function s(b,y=b.schema){let{opts:P,self:N}=b;if(!P.strictSchema||typeof y=="boolean")return;let F=N.RULES.keywords;for(let M in y)F[M]||R(b,`unknown keyword: "${M}"`)}e.checkUnknownRules=s;function i(b,y){if(typeof b=="boolean")return!b;for(let P in b)if(y[P])return!0;return!1}e.schemaHasRules=i;function c(b,y){if(typeof b=="boolean")return!b;for(let P in b)if(P!=="$ref"&&y.all[P])return!0;return!1}e.schemaHasRulesButRef=c;function a({topSchemaRef:b,schemaPath:y},P,N,F){if(!F){if(typeof P=="number"||typeof P=="boolean")return P;if(typeof P=="string")return(0,t._)`${P}`}return(0,t._)`${b}${y}${(0,t.getProperty)(N)}`}e.schemaRefOrVal=a;function u(b){return f(decodeURIComponent(b))}e.unescapeFragment=u;function l(b){return encodeURIComponent(p(b))}e.escapeFragment=l;function p(b){return typeof b=="number"?`${b}`:b.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=p;function f(b){return b.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=f;function z(b,y){if(Array.isArray(b))for(let P of b)y(P);else y(b)}e.eachItem=z;function m({mergeNames:b,mergeToName:y,mergeValues:P,resultToName:N}){return(F,M,U,K)=>{let B=U===void 0?M:U instanceof t.Name?(M instanceof t.Name?b(F,M,U):y(F,M,U),U):M instanceof t.Name?(y(F,U,M),M):P(M,U);return K===t.Name&&!(B instanceof t.Name)?N(F,B):B}}e.mergeEvaluated={props:m({mergeNames:(b,y,P)=>b.if((0,t._)`${P} !== true && ${y} !== undefined`,()=>{b.if((0,t._)`${y} === true`,()=>b.assign(P,!0),()=>b.assign(P,(0,t._)`${P} || {}`).code((0,t._)`Object.assign(${P}, ${y})`))}),mergeToName:(b,y,P)=>b.if((0,t._)`${P} !== true`,()=>{y===!0?b.assign(P,!0):(b.assign(P,(0,t._)`${P} || {}`),g(b,P,y))}),mergeValues:(b,y)=>b===!0?!0:{...b,...y},resultToName:_}),items:m({mergeNames:(b,y,P)=>b.if((0,t._)`${P} !== true && ${y} !== undefined`,()=>b.assign(P,(0,t._)`${y} === true ? true : ${P} > ${y} ? ${P} : ${y}`)),mergeToName:(b,y,P)=>b.if((0,t._)`${P} !== true`,()=>b.assign(P,y===!0?!0:(0,t._)`${P} > ${y} ? ${P} : ${y}`)),mergeValues:(b,y)=>b===!0?!0:Math.max(b,y),resultToName:(b,y)=>b.var("items",y)})};function _(b,y){if(y===!0)return b.var("props",!0);let P=b.var("props",(0,t._)`{}`);return y!==void 0&&g(b,P,y),P}e.evaluatedPropsToName=_;function g(b,y,P){Object.keys(P).forEach(N=>b.assign((0,t._)`${y}${(0,t.getProperty)(N)}`,!0))}e.setEvaluated=g;let h={};function v(b,y){return b.scopeValue("func",{ref:y,code:h[y.code]||(h[y.code]=new r._Code(y.code))})}e.useFunc=v;var S;(function(b){b[b.Num=0]="Num",b[b.Str=1]="Str"})(S||(e.Type=S={}));function w(b,y,P){if(b instanceof t.Name){let N=y===S.Num;return P?N?(0,t._)`"[" + ${b} + "]"`:(0,t._)`"['" + ${b} + "']"`:N?(0,t._)`"/" + ${b}`:(0,t._)`"/" + ${b}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return P?(0,t.getProperty)(b).toString():"/"+p(b)}e.getErrorPath=w;function R(b,y,P=b.opts.strictSchema){if(P){if(y=`strict mode: ${y}`,P===!0)throw new Error(y);b.self.logger.warn(y)}}e.checkStrictMode=R})),ut=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ue(),r={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};e.default=r})),qa=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=ue(),r=fe(),o=ut();e.keywordError={message:({keyword:g})=>(0,t.str)`must pass "${g}" keyword validation`},e.keyword$DataError={message:({keyword:g,schemaType:h})=>h?(0,t.str)`"${g}" keyword must be ${h} ($data)`:(0,t.str)`"${g}" keyword is invalid ($data)`};function n(g,h=e.keywordError,v,S){let{it:w}=g,{gen:R,compositeRule:b,allErrors:y}=w,P=p(g,h,v);S??(b||y)?a(R,P):u(w,(0,t._)`[${P}]`)}e.reportError=n;function s(g,h=e.keywordError,v){let{it:S}=g,{gen:w,compositeRule:R,allErrors:b}=S;a(w,p(g,h,v)),R||b||u(S,o.default.vErrors)}e.reportExtraError=s;function i(g,h){g.assign(o.default.errors,h),g.if((0,t._)`${o.default.vErrors} !== null`,()=>g.if(h,()=>g.assign((0,t._)`${o.default.vErrors}.length`,h),()=>g.assign(o.default.vErrors,null)))}e.resetErrorsCount=i;function c({gen:g,keyword:h,schemaValue:v,data:S,errsCount:w,it:R}){if(w===void 0)throw new Error("ajv implementation error");let b=g.name("err");g.forRange("i",w,o.default.errors,y=>{g.const(b,(0,t._)`${o.default.vErrors}[${y}]`),g.if((0,t._)`${b}.instancePath === undefined`,()=>g.assign((0,t._)`${b}.instancePath`,(0,t.strConcat)(o.default.instancePath,R.errorPath))),g.assign((0,t._)`${b}.schemaPath`,(0,t.str)`${R.errSchemaPath}/${h}`),R.opts.verbose&&(g.assign((0,t._)`${b}.schema`,v),g.assign((0,t._)`${b}.data`,S))})}e.extendErrors=c;function a(g,h){let v=g.const("err",h);g.if((0,t._)`${o.default.vErrors} === null`,()=>g.assign(o.default.vErrors,(0,t._)`[${v}]`),(0,t._)`${o.default.vErrors}.push(${v})`),g.code((0,t._)`${o.default.errors}++`)}function u(g,h){let{gen:v,validateName:S,schemaEnv:w}=g;w.$async?v.throw((0,t._)`new ${g.ValidationError}(${h})`):(v.assign((0,t._)`${S}.errors`,h),v.return(!1))}let l={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 p(g,h,v){let{createErrors:S}=g.it;return S===!1?(0,t._)`{}`:f(g,h,v)}function f(g,h,v={}){let{gen:S,it:w}=g,R=[z(w,v),m(g,v)];return _(g,h,R),S.object(...R)}function z({errorPath:g},{instancePath:h}){let v=h?(0,t.str)`${g}${(0,r.getErrorPath)(h,r.Type.Str)}`:g;return[o.default.instancePath,(0,t.strConcat)(o.default.instancePath,v)]}function m({keyword:g,it:{errSchemaPath:h}},{schemaPath:v,parentSchema:S}){let w=S?h:(0,t.str)`${h}/${g}`;return v&&(w=(0,t.str)`${w}${(0,r.getErrorPath)(v,r.Type.Str)}`),[l.schemaPath,w]}function _(g,{params:h,message:v},S){let{keyword:w,data:R,schemaValue:b,it:y}=g,{opts:P,propertyName:N,topSchemaRef:F,schemaPath:M}=y;S.push([l.keyword,w],[l.params,typeof h=="function"?h(g):h||(0,t._)`{}`]),P.messages&&S.push([l.message,typeof v=="function"?v(g):v]),P.verbose&&S.push([l.schema,b],[l.parentSchema,(0,t._)`${F}${M}`],[o.default.data,R]),N&&S.push([l.propertyName,N])}})),Mb=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=qa(),r=ue(),o=ut(),n={message:"boolean schema is false"};function s(a){let{gen:u,schema:l,validateName:p}=a;l===!1?c(a,!1):typeof l=="object"&&l.$async===!0?u.return(o.default.data):(u.assign((0,r._)`${p}.errors`,null),u.return(!0))}e.topBoolOrEmptySchema=s;function i(a,u){let{gen:l,schema:p}=a;p===!1?(l.var(u,!1),c(a)):l.var(u,!0)}e.boolOrEmptySchema=i;function c(a,u){let{gen:l,data:p}=a,f={gen:l,keyword:"false schema",data:p,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:a};(0,t.reportError)(f,n,void 0,u)}})),ig=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set(["string","number","integer","boolean","null","object","array"]);function r(n){return typeof n=="string"&&t.has(n)}e.isJSONType=r;function o(){let n={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...n,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},n.number,n.string,n.array,n.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=o})),ag=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:n,self:s},i){let c=s.RULES.types[i];return c&&c!==!0&&r(n,c)}e.schemaHasRulesForType=t;function r(n,s){return s.rules.some(i=>o(n,i))}e.shouldUseGroup=r;function o(n,s){var i;return n[s.keyword]!==void 0||((i=s.definition.implements)===null||i===void 0?void 0:i.some(c=>n[c]!==void 0))}e.shouldUseRule=o})),Aa=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let t=ig(),r=ag(),o=qa(),n=ue(),s=fe();var i;(function(S){S[S.Correct=0]="Correct",S[S.Wrong=1]="Wrong"})(i||(e.DataType=i={}));function c(S){let w=a(S.type);if(w.includes("null")){if(S.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!w.length&&S.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');S.nullable===!0&&w.push("null")}return w}e.getSchemaTypes=c;function a(S){let w=Array.isArray(S)?S:S?[S]:[];if(w.every(t.isJSONType))return w;throw new Error("type must be JSONType or JSONType[]: "+w.join(","))}e.getJSONTypes=a;function u(S,w){let{gen:R,data:b,opts:y}=S,P=p(w,y.coerceTypes),N=w.length>0&&!(P.length===0&&w.length===1&&(0,r.schemaHasRulesForType)(S,w[0]));if(N){let F=_(w,b,y.strictNumbers,i.Wrong);R.if(F,()=>{P.length?f(S,w,P):h(S)})}return N}e.coerceAndCheckDataType=u;let l=new Set(["string","number","integer","boolean","null"]);function p(S,w){return w?S.filter(R=>l.has(R)||w==="array"&&R==="array"):[]}function f(S,w,R){let{gen:b,data:y,opts:P}=S,N=b.let("dataType",(0,n._)`typeof ${y}`),F=b.let("coerced",(0,n._)`undefined`);P.coerceTypes==="array"&&b.if((0,n._)`${N} == 'object' && Array.isArray(${y}) && ${y}.length == 1`,()=>b.assign(y,(0,n._)`${y}[0]`).assign(N,(0,n._)`typeof ${y}`).if(_(w,y,P.strictNumbers),()=>b.assign(F,y))),b.if((0,n._)`${F} !== undefined`);for(let U of R)(l.has(U)||U==="array"&&P.coerceTypes==="array")&&M(U);b.else(),h(S),b.endIf(),b.if((0,n._)`${F} !== undefined`,()=>{b.assign(y,F),z(S,F)});function M(U){switch(U){case"string":b.elseIf((0,n._)`${N} == "number" || ${N} == "boolean"`).assign(F,(0,n._)`"" + ${y}`).elseIf((0,n._)`${y} === null`).assign(F,(0,n._)`""`);return;case"number":b.elseIf((0,n._)`${N} == "boolean" || ${y} === null
57
+ || (${N} == "string" && ${y} && ${y} == +${y})`).assign(F,(0,n._)`+${y}`);return;case"integer":b.elseIf((0,n._)`${N} === "boolean" || ${y} === null
58
+ || (${N} === "string" && ${y} && ${y} == +${y} && !(${y} % 1))`).assign(F,(0,n._)`+${y}`);return;case"boolean":b.elseIf((0,n._)`${y} === "false" || ${y} === 0 || ${y} === null`).assign(F,!1).elseIf((0,n._)`${y} === "true" || ${y} === 1`).assign(F,!0);return;case"null":b.elseIf((0,n._)`${y} === "" || ${y} === 0 || ${y} === false`),b.assign(F,null);return;case"array":b.elseIf((0,n._)`${N} === "string" || ${N} === "number"
59
+ || ${N} === "boolean" || ${y} === null`).assign(F,(0,n._)`[${y}]`)}}}function z({gen:S,parentData:w,parentDataProperty:R},b){S.if((0,n._)`${w} !== undefined`,()=>S.assign((0,n._)`${w}[${R}]`,b))}function m(S,w,R,b=i.Correct){let y=b===i.Correct?n.operators.EQ:n.operators.NEQ,P;switch(S){case"null":return(0,n._)`${w} ${y} null`;case"array":P=(0,n._)`Array.isArray(${w})`;break;case"object":P=(0,n._)`${w} && typeof ${w} == "object" && !Array.isArray(${w})`;break;case"integer":P=N((0,n._)`!(${w} % 1) && !isNaN(${w})`);break;case"number":P=N();break;default:return(0,n._)`typeof ${w} ${y} ${S}`}return b===i.Correct?P:(0,n.not)(P);function N(F=n.nil){return(0,n.and)((0,n._)`typeof ${w} == "number"`,F,R?(0,n._)`isFinite(${w})`:n.nil)}}e.checkDataType=m;function _(S,w,R,b){if(S.length===1)return m(S[0],w,R,b);let y,P=(0,s.toHash)(S);if(P.array&&P.object){let N=(0,n._)`typeof ${w} != "object"`;y=P.null?N:(0,n._)`!${w} || ${N}`,delete P.null,delete P.array,delete P.object}else y=n.nil;P.number&&delete P.integer;for(let N in P)y=(0,n.and)(y,m(N,w,R,b));return y}e.checkDataTypes=_;let g={message:({schema:S})=>`must be ${S}`,params:({schema:S,schemaValue:w})=>typeof S=="string"?(0,n._)`{type: ${S}}`:(0,n._)`{type: ${w}}`};function h(S){let w=v(S);(0,o.reportError)(w,g)}e.reportTypeError=h;function v(S){let{gen:w,data:R,schema:b}=S,y=(0,s.schemaRefOrVal)(S,b,"type");return{gen:w,keyword:"type",data:R,schema:b.type,schemaCode:y,schemaValue:y,parentSchema:b,params:{},it:S}}})),Lb=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=ue(),r=fe();function o(s,i){let{properties:c,items:a}=s.schema;if(i==="object"&&c)for(let u in c)n(s,u,c[u].default);else i==="array"&&Array.isArray(a)&&a.forEach((u,l)=>n(s,l,u.default))}e.assignDefaults=o;function n(s,i,c){let{gen:a,compositeRule:u,data:l,opts:p}=s;if(c===void 0)return;let f=(0,t._)`${l}${(0,t.getProperty)(i)}`;if(u){(0,r.checkStrictMode)(s,`default is ignored for: ${f}`);return}let z=(0,t._)`${f} === undefined`;p.useDefaults==="empty"&&(z=(0,t._)`${z} || ${f} === null || ${f} === ""`),a.if(z,(0,t._)`${f} = ${(0,t.stringify)(c)}`)}})),lt=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;let t=ue(),r=fe(),o=ut(),n=fe();function s(S,w){let{gen:R,data:b,it:y}=S;R.if(p(R,b,w,y.opts.ownProperties),()=>{S.setParams({missingProperty:(0,t._)`${w}`},!0),S.error()})}e.checkReportMissingProp=s;function i({gen:S,data:w,it:{opts:R}},b,y){return(0,t.or)(...b.map(P=>(0,t.and)(p(S,w,P,R.ownProperties),(0,t._)`${y} = ${P}`)))}e.checkMissingProp=i;function c(S,w){S.setParams({missingProperty:w},!0),S.error()}e.reportMissingProp=c;function a(S){return S.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}e.hasPropFunc=a;function u(S,w,R){return(0,t._)`${a(S)}.call(${w}, ${R})`}e.isOwnProperty=u;function l(S,w,R,b){let y=(0,t._)`${w}${(0,t.getProperty)(R)} !== undefined`;return b?(0,t._)`${y} && ${u(S,w,R)}`:y}e.propertyInData=l;function p(S,w,R,b){let y=(0,t._)`${w}${(0,t.getProperty)(R)} === undefined`;return b?(0,t.or)(y,(0,t.not)(u(S,w,R))):y}e.noPropertyInData=p;function f(S){return S?Object.keys(S).filter(w=>w!=="__proto__"):[]}e.allSchemaProperties=f;function z(S,w){return f(w).filter(R=>!(0,r.alwaysValidSchema)(S,w[R]))}e.schemaProperties=z;function m({schemaCode:S,data:w,it:{gen:R,topSchemaRef:b,schemaPath:y,errorPath:P},it:N},F,M,U){let K=U?(0,t._)`${S}, ${w}, ${b}${y}`:w,B=[[o.default.instancePath,(0,t.strConcat)(o.default.instancePath,P)],[o.default.parentData,N.parentData],[o.default.parentDataProperty,N.parentDataProperty],[o.default.rootData,o.default.rootData]];N.opts.dynamicRef&&B.push([o.default.dynamicAnchors,o.default.dynamicAnchors]);let me=(0,t._)`${K}, ${R.object(...B)}`;return M!==t.nil?(0,t._)`${F}.call(${M}, ${me})`:(0,t._)`${F}(${me})`}e.callValidateCode=m;let _=(0,t._)`new RegExp`;function g({gen:S,it:{opts:w}},R){let b=w.unicodeRegExp?"u":"",{regExp:y}=w.code,P=y(R,b);return S.scopeValue("pattern",{key:P.toString(),ref:P,code:(0,t._)`${y.code==="new RegExp"?_:(0,n.useFunc)(S,y)}(${R}, ${b})`})}e.usePattern=g;function h(S){let{gen:w,data:R,keyword:b,it:y}=S,P=w.name("valid");if(y.allErrors){let F=w.let("valid",!0);return N(()=>w.assign(F,!1)),F}return w.var(P,!0),N(()=>w.break()),P;function N(F){let M=w.const("len",(0,t._)`${R}.length`);w.forRange("i",0,M,U=>{S.subschema({keyword:b,dataProp:U,dataPropType:r.Type.Num},P),w.if((0,t.not)(P),F)})}}e.validateArray=h;function v(S){let{gen:w,schema:R,keyword:b,it:y}=S;if(!Array.isArray(R))throw new Error("ajv implementation error");if(R.some(F=>(0,r.alwaysValidSchema)(y,F))&&!y.opts.unevaluated)return;let P=w.let("valid",!1),N=w.name("_valid");w.block(()=>R.forEach((F,M)=>{let U=S.subschema({keyword:b,schemaProp:M,compositeRule:!0},N);w.assign(P,(0,t._)`${P} || ${N}`),S.mergeValidEvaluated(U,N)||w.if((0,t.not)(P))})),S.result(P,()=>S.reset(),()=>S.error(!0))}e.validateUnion=v})),Ub=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=ue(),r=ut(),o=lt(),n=qa();function s(z,m){let{gen:_,keyword:g,schema:h,parentSchema:v,it:S}=z,w=m.macro.call(S.self,h,v,S),R=l(_,g,w);S.opts.validateSchema!==!1&&S.self.validateSchema(w,!0);let b=_.name("valid");z.subschema({schema:w,schemaPath:t.nil,errSchemaPath:`${S.errSchemaPath}/${g}`,topSchemaRef:R,compositeRule:!0},b),z.pass(b,()=>z.error(!0))}e.macroKeywordCode=s;function i(z,m){var _;let{gen:g,keyword:h,schema:v,parentSchema:S,$data:w,it:R}=z;u(R,m);let b=l(g,h,!w&&m.compile?m.compile.call(R.self,v,S,R):m.validate),y=g.let("valid");z.block$data(y,P),z.ok((_=m.valid)!==null&&_!==void 0?_:y);function P(){if(m.errors===!1)M(),m.modifying&&c(z),U(()=>z.error());else{let K=m.async?N():F();m.modifying&&c(z),U(()=>a(z,K))}}function N(){let K=g.let("ruleErrs",null);return g.try(()=>M((0,t._)`await `),B=>g.assign(y,!1).if((0,t._)`${B} instanceof ${R.ValidationError}`,()=>g.assign(K,(0,t._)`${B}.errors`),()=>g.throw(B))),K}function F(){let K=(0,t._)`${b}.errors`;return g.assign(K,null),M(t.nil),K}function M(K=m.async?(0,t._)`await `:t.nil){let B=R.opts.passContext?r.default.this:r.default.self,me=!("compile"in m&&!w||m.schema===!1);g.assign(y,(0,t._)`${K}${(0,o.callValidateCode)(z,b,B,me)}`,m.modifying)}function U(K){var B;g.if((0,t.not)((B=m.valid)!==null&&B!==void 0?B:y),K)}}e.funcKeywordCode=i;function c(z){let{gen:m,data:_,it:g}=z;m.if(g.parentData,()=>m.assign(_,(0,t._)`${g.parentData}[${g.parentDataProperty}]`))}function a(z,m){let{gen:_}=z;_.if((0,t._)`Array.isArray(${m})`,()=>{_.assign(r.default.vErrors,(0,t._)`${r.default.vErrors} === null ? ${m} : ${r.default.vErrors}.concat(${m})`).assign(r.default.errors,(0,t._)`${r.default.vErrors}.length`),(0,n.extendErrors)(z)},()=>z.error())}function u({schemaEnv:z},m){if(m.async&&!z.$async)throw new Error("async keyword in sync schema")}function l(z,m,_){if(_===void 0)throw new Error(`keyword "${m}" failed to compile`);return z.scopeValue("keyword",typeof _=="function"?{ref:_}:{ref:_,code:(0,t.stringify)(_)})}function p(z,m,_=!1){return!m.length||m.some(g=>g==="array"?Array.isArray(z):g==="object"?z&&typeof z=="object"&&!Array.isArray(z):typeof z==g||_&&typeof z>"u")}e.validSchemaType=p;function f({schema:z,opts:m,self:_,errSchemaPath:g},h,v){if(Array.isArray(h.keyword)?!h.keyword.includes(v):h.keyword!==v)throw new Error("ajv implementation error");let S=h.dependencies;if(S?.some(w=>!Object.prototype.hasOwnProperty.call(z,w)))throw new Error(`parent schema must have dependencies of ${v}: ${S.join(",")}`);if(h.validateSchema&&!h.validateSchema(z[v])){let w=`keyword "${v}" value is invalid at path "${g}": `+_.errorsText(h.validateSchema.errors);if(m.validateSchema==="log")_.logger.error(w);else throw new Error(w)}}e.validateKeywordUsage=f})),Db=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=ue(),r=fe();function o(i,{keyword:c,schemaProp:a,schema:u,schemaPath:l,errSchemaPath:p,topSchemaRef:f}){if(c!==void 0&&u!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(c!==void 0){let z=i.schema[c];return a===void 0?{schema:z,schemaPath:(0,t._)`${i.schemaPath}${(0,t.getProperty)(c)}`,errSchemaPath:`${i.errSchemaPath}/${c}`}:{schema:z[a],schemaPath:(0,t._)`${i.schemaPath}${(0,t.getProperty)(c)}${(0,t.getProperty)(a)}`,errSchemaPath:`${i.errSchemaPath}/${c}/${(0,r.escapeFragment)(a)}`}}if(u!==void 0){if(l===void 0||p===void 0||f===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:u,schemaPath:l,topSchemaRef:f,errSchemaPath:p}}throw new Error('either "keyword" or "schema" must be passed')}e.getSubschema=o;function n(i,c,{dataProp:a,dataPropType:u,data:l,dataTypes:p,propertyName:f}){if(l!==void 0&&a!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:z}=c;if(a!==void 0){let{errorPath:_,dataPathArr:g,opts:h}=c;m(z.let("data",(0,t._)`${c.data}${(0,t.getProperty)(a)}`,!0)),i.errorPath=(0,t.str)`${_}${(0,r.getErrorPath)(a,u,h.jsPropertySyntax)}`,i.parentDataProperty=(0,t._)`${a}`,i.dataPathArr=[...g,i.parentDataProperty]}l!==void 0&&(m(l instanceof t.Name?l:z.let("data",l,!0)),f!==void 0&&(i.propertyName=f)),p&&(i.dataTypes=p);function m(_){i.data=_,i.dataLevel=c.dataLevel+1,i.dataTypes=[],c.definedProperties=new Set,i.parentData=c.data,i.dataNames=[...c.dataNames,_]}}e.extendSubschemaData=n;function s(i,{jtdDiscriminator:c,jtdMetadata:a,compositeRule:u,createErrors:l,allErrors:p}){u!==void 0&&(i.compositeRule=u),l!==void 0&&(i.createErrors=l),p!==void 0&&(i.allErrors=p),i.jtdDiscriminator=c,i.jtdMetadata=a}e.extendSubschemaMode=s})),cg=D(((e,t)=>{t.exports=function r(o,n){if(o===n)return!0;if(o&&n&&typeof o=="object"&&typeof n=="object"){if(o.constructor!==n.constructor)return!1;var s,i,c;if(Array.isArray(o)){if(s=o.length,s!=n.length)return!1;for(i=s;i--!==0;)if(!r(o[i],n[i]))return!1;return!0}if(o.constructor===RegExp)return o.source===n.source&&o.flags===n.flags;if(o.valueOf!==Object.prototype.valueOf)return o.valueOf()===n.valueOf();if(o.toString!==Object.prototype.toString)return o.toString()===n.toString();if(c=Object.keys(o),s=c.length,s!==Object.keys(n).length)return!1;for(i=s;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,c[i]))return!1;for(i=s;i--!==0;){var a=c[i];if(!r(o[a],n[a]))return!1}return!0}return o!==o&&n!==n}})),Zb=D(((e,t)=>{var r=t.exports=function(s,i,c){typeof i=="function"&&(c=i,i={}),c=i.cb||c;var a=typeof c=="function"?c:c.pre||function(){},u=c.post||function(){};o(i,a,u,s,"",s)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function o(s,i,c,a,u,l,p,f,z,m){if(a&&typeof a=="object"&&!Array.isArray(a)){i(a,u,l,p,f,z,m);for(var _ in a){var g=a[_];if(Array.isArray(g)){if(_ in r.arrayKeywords)for(var h=0;h<g.length;h++)o(s,i,c,g[h],u+"/"+_+"/"+h,l,u,_,a,h)}else if(_ in r.propsKeywords){if(g&&typeof g=="object")for(var v in g)o(s,i,c,g[v],u+"/"+_+"/"+n(v),l,u,_,a,v)}else(_ in r.keywords||s.allKeys&&!(_ in r.skipKeywords))&&o(s,i,c,g,u+"/"+_,l,u,_,a)}c(a,u,l,p,f,z,m)}}function n(s){return s.replace(/~/g,"~0").replace(/\//g,"~1")}})),Ma=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=fe(),r=cg(),o=Zb(),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function s(g,h=!0){return typeof g=="boolean"?!0:h===!0?!c(g):h?a(g)<=h:!1}e.inlineRef=s;let i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function c(g){for(let h in g){if(i.has(h))return!0;let v=g[h];if(Array.isArray(v)&&v.some(c)||typeof v=="object"&&c(v))return!0}return!1}function a(g){let h=0;for(let v in g){if(v==="$ref")return 1/0;if(h++,!n.has(v)&&(typeof g[v]=="object"&&(0,t.eachItem)(g[v],S=>h+=a(S)),h===1/0))return 1/0}return h}function u(g,h="",v){return v!==!1&&(h=f(h)),l(g,g.parse(h))}e.getFullPath=u;function l(g,h){return g.serialize(h).split("#")[0]+"#"}e._getFullPath=l;let p=/#\/?$/;function f(g){return g?g.replace(p,""):""}e.normalizeId=f;function z(g,h,v){return v=f(v),g.resolve(h,v)}e.resolveUrl=z;let m=/^[a-z_][-a-z0-9._]*$/i;function _(g,h){if(typeof g=="boolean")return{};let{schemaId:v,uriResolver:S}=this.opts,w=f(g[v]||h),R={"":w},b=u(S,w,!1),y={},P=new Set;return o(g,{allKeys:!0},(M,U,K,B)=>{if(B===void 0)return;let me=b+U,$e=R[B];typeof M[v]=="string"&&($e=be.call(this,M[v])),Ie.call(this,M.$anchor),Ie.call(this,M.$dynamicAnchor),R[U]=$e;function be(he){let C=this.opts.uriResolver.resolve;if(he=f($e?C($e,he):he),P.has(he))throw F(he);P.add(he);let j=this.refs[he];return typeof j=="string"&&(j=this.refs[j]),typeof j=="object"?N(M,j.schema,he):he!==f(me)&&(he[0]==="#"?(N(M,y[he],he),y[he]=M):this.refs[he]=me),he}function Ie(he){if(typeof he=="string"){if(!m.test(he))throw new Error(`invalid anchor "${he}"`);be.call(this,`#${he}`)}}}),y;function N(M,U,K){if(U!==void 0&&!r(M,U))throw F(K)}function F(M){return new Error(`reference "${M}" resolves to more than one schema`)}}e.getSchemaRefs=_})),Br=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=Mb(),r=Aa(),o=ag(),n=Aa(),s=Lb(),i=Ub(),c=Db(),a=ue(),u=ut(),l=Ma(),p=fe(),f=qa();function z(T){if(b(T)&&(P(T),R(T))){h(T);return}m(T,()=>(0,t.topBoolOrEmptySchema)(T))}e.validateFunctionCode=z;function m({gen:T,validateName:A,schema:L,schemaEnv:ne,opts:se},le){se.code.es5?T.func(A,(0,a._)`${u.default.data}, ${u.default.valCxt}`,ne.$async,()=>{T.code((0,a._)`"use strict"; ${S(L,se)}`),g(T,se),T.code(le)}):T.func(A,(0,a._)`${u.default.data}, ${_(se)}`,ne.$async,()=>T.code(S(L,se)).code(le))}function _(T){return(0,a._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${T.dynamicRef?(0,a._)`, ${u.default.dynamicAnchors}={}`:a.nil}}={}`}function g(T,A){T.if(u.default.valCxt,()=>{T.var(u.default.instancePath,(0,a._)`${u.default.valCxt}.${u.default.instancePath}`),T.var(u.default.parentData,(0,a._)`${u.default.valCxt}.${u.default.parentData}`),T.var(u.default.parentDataProperty,(0,a._)`${u.default.valCxt}.${u.default.parentDataProperty}`),T.var(u.default.rootData,(0,a._)`${u.default.valCxt}.${u.default.rootData}`),A.dynamicRef&&T.var(u.default.dynamicAnchors,(0,a._)`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{T.var(u.default.instancePath,(0,a._)`""`),T.var(u.default.parentData,(0,a._)`undefined`),T.var(u.default.parentDataProperty,(0,a._)`undefined`),T.var(u.default.rootData,u.default.data),A.dynamicRef&&T.var(u.default.dynamicAnchors,(0,a._)`{}`)})}function h(T){let{schema:A,opts:L,gen:ne}=T;m(T,()=>{L.$comment&&A.$comment&&B(T),M(T),ne.let(u.default.vErrors,null),ne.let(u.default.errors,0),L.unevaluated&&v(T),N(T),me(T)})}function v(T){let{gen:A,validateName:L}=T;T.evaluated=A.const("evaluated",(0,a._)`${L}.evaluated`),A.if((0,a._)`${T.evaluated}.dynamicProps`,()=>A.assign((0,a._)`${T.evaluated}.props`,(0,a._)`undefined`)),A.if((0,a._)`${T.evaluated}.dynamicItems`,()=>A.assign((0,a._)`${T.evaluated}.items`,(0,a._)`undefined`))}function S(T,A){let L=typeof T=="object"&&T[A.schemaId];return L&&(A.code.source||A.code.process)?(0,a._)`/*# sourceURL=${L} */`:a.nil}function w(T,A){if(b(T)&&(P(T),R(T))){y(T,A);return}(0,t.boolOrEmptySchema)(T,A)}function R({schema:T,self:A}){if(typeof T=="boolean")return!T;for(let L in T)if(A.RULES.all[L])return!0;return!1}function b(T){return typeof T.schema!="boolean"}function y(T,A){let{schema:L,gen:ne,opts:se}=T;se.$comment&&L.$comment&&B(T),U(T),K(T);let le=ne.const("_errs",u.default.errors);N(T,le),ne.var(A,(0,a._)`${le} === ${u.default.errors}`)}function P(T){(0,p.checkUnknownRules)(T),F(T)}function N(T,A){if(T.opts.jtd)return be(T,[],!1,A);let L=(0,r.getSchemaTypes)(T.schema);be(T,L,!(0,r.coerceAndCheckDataType)(T,L),A)}function F(T){let{schema:A,errSchemaPath:L,opts:ne,self:se}=T;A.$ref&&ne.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(A,se.RULES)&&se.logger.warn(`$ref: keywords ignored in schema at path "${L}"`)}function M(T){let{schema:A,opts:L}=T;A.default!==void 0&&L.useDefaults&&L.strictSchema&&(0,p.checkStrictMode)(T,"default is ignored in the schema root")}function U(T){let A=T.schema[T.opts.schemaId];A&&(T.baseId=(0,l.resolveUrl)(T.opts.uriResolver,T.baseId,A))}function K(T){if(T.schema.$async&&!T.schemaEnv.$async)throw new Error("async schema in sync schema")}function B({gen:T,schemaEnv:A,schema:L,errSchemaPath:ne,opts:se}){let le=L.$comment;if(se.$comment===!0)T.code((0,a._)`${u.default.self}.logger.log(${le})`);else if(typeof se.$comment=="function"){let Ce=(0,a.str)`${ne}/$comment`,je=T.scopeValue("root",{ref:A.root});T.code((0,a._)`${u.default.self}.opts.$comment(${le}, ${Ce}, ${je}.schema)`)}}function me(T){let{gen:A,schemaEnv:L,validateName:ne,ValidationError:se,opts:le}=T;L.$async?A.if((0,a._)`${u.default.errors} === 0`,()=>A.return(u.default.data),()=>A.throw((0,a._)`new ${se}(${u.default.vErrors})`)):(A.assign((0,a._)`${ne}.errors`,u.default.vErrors),le.unevaluated&&$e(T),A.return((0,a._)`${u.default.errors} === 0`))}function $e({gen:T,evaluated:A,props:L,items:ne}){L instanceof a.Name&&T.assign((0,a._)`${A}.props`,L),ne instanceof a.Name&&T.assign((0,a._)`${A}.items`,ne)}function be(T,A,L,ne){let{gen:se,schema:le,data:Ce,allErrors:je,opts:De,self:xe}=T,{RULES:Re}=xe;if(le.$ref&&(De.ignoreKeywordsWithRef||!(0,p.schemaHasRulesButRef)(le,Re))){se.block(()=>de(T,"$ref",Re.all.$ref.definition));return}De.jtd||he(T,A),se.block(()=>{for(let Ae of Re.rules)ot(Ae);ot(Re.post)});function ot(Ae){(0,o.shouldUseGroup)(le,Ae)&&(Ae.type?(se.if((0,n.checkDataType)(Ae.type,Ce,De.strictNumbers)),Ie(T,Ae),A.length===1&&A[0]===Ae.type&&L&&(se.else(),(0,n.reportTypeError)(T)),se.endIf()):Ie(T,Ae),je||se.if((0,a._)`${u.default.errors} === ${ne||0}`))}}function Ie(T,A){let{gen:L,schema:ne,opts:{useDefaults:se}}=T;se&&(0,s.assignDefaults)(T,A.type),L.block(()=>{for(let le of A.rules)(0,o.shouldUseRule)(ne,le)&&de(T,le.keyword,le.definition,A.type)})}function he(T,A){T.schemaEnv.meta||!T.opts.strictTypes||(C(T,A),T.opts.allowUnionTypes||j(T,A),Z(T,T.dataTypes))}function C(T,A){if(A.length){if(!T.dataTypes.length){T.dataTypes=A;return}A.forEach(L=>{k(T.dataTypes,L)||H(T,`type "${L}" not allowed by context "${T.dataTypes.join(",")}"`)}),x(T,A)}}function j(T,A){A.length>1&&!(A.length===2&&A.includes("null"))&&H(T,"use allowUnionTypes to allow union type keyword")}function Z(T,A){let L=T.self.RULES.all;for(let ne in L){let se=L[ne];if(typeof se=="object"&&(0,o.shouldUseRule)(T.schema,se)){let{type:le}=se.definition;le.length&&!le.some(Ce=>$(A,Ce))&&H(T,`missing type "${le.join(",")}" for keyword "${ne}"`)}}}function $(T,A){return T.includes(A)||A==="number"&&T.includes("integer")}function k(T,A){return T.includes(A)||A==="integer"&&T.includes("number")}function x(T,A){let L=[];for(let ne of T.dataTypes)k(A,ne)?L.push(ne):A.includes("integer")&&ne==="number"&&L.push("integer");T.dataTypes=L}function H(T,A){let L=T.schemaEnv.baseId+T.errSchemaPath;A+=` at "${L}" (strictTypes)`,(0,p.checkStrictMode)(T,A,T.opts.strictTypes)}var te=class{constructor(T,A,L){if((0,i.validateKeywordUsage)(T,A,L),this.gen=T.gen,this.allErrors=T.allErrors,this.keyword=L,this.data=T.data,this.schema=T.schema[L],this.$data=A.$data&&T.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,p.schemaRefOrVal)(T,this.schema,L,this.$data),this.schemaType=A.schemaType,this.parentSchema=T.schema,this.params={},this.it=T,this.def=A,this.$data)this.schemaCode=T.gen.const("vSchema",Je(this.$data,T));else if(this.schemaCode=this.schemaValue,!(0,i.validSchemaType)(this.schema,A.schemaType,A.allowUndefined))throw new Error(`${L} value must be ${JSON.stringify(A.schemaType)}`);("code"in A?A.trackErrors:A.errors!==!1)&&(this.errsCount=T.gen.const("_errs",u.default.errors))}result(T,A,L){this.failResult((0,a.not)(T),A,L)}failResult(T,A,L){this.gen.if(T),L?L():this.error(),A?(this.gen.else(),A(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(T,A){this.failResult((0,a.not)(T),void 0,A)}fail(T){if(T===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(T),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(T){if(!this.$data)return this.fail(T);let{schemaCode:A}=this;this.fail((0,a._)`${A} !== undefined && (${(0,a.or)(this.invalid$data(),T)})`)}error(T,A,L){if(A){this.setParams(A),this._error(T,L),this.setParams({});return}this._error(T,L)}_error(T,A){(T?f.reportExtraError:f.reportError)(this,this.def.error,A)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(T){this.allErrors||this.gen.if(T)}setParams(T,A){A?Object.assign(this.params,T):this.params=T}block$data(T,A,L=a.nil){this.gen.block(()=>{this.check$data(T,L),A()})}check$data(T=a.nil,A=a.nil){if(!this.$data)return;let{gen:L,schemaCode:ne,schemaType:se,def:le}=this;L.if((0,a.or)((0,a._)`${ne} === undefined`,A)),T!==a.nil&&L.assign(T,!0),(se.length||le.validateSchema)&&(L.elseIf(this.invalid$data()),this.$dataError(),T!==a.nil&&L.assign(T,!1)),L.else()}invalid$data(){let{gen:T,schemaCode:A,schemaType:L,def:ne,it:se}=this;return(0,a.or)(le(),Ce());function le(){if(L.length){if(!(A instanceof a.Name))throw new Error("ajv implementation error");let je=Array.isArray(L)?L:[L];return(0,a._)`${(0,n.checkDataTypes)(je,A,se.opts.strictNumbers,n.DataType.Wrong)}`}return a.nil}function Ce(){if(ne.validateSchema){let je=T.scopeValue("validate$data",{ref:ne.validateSchema});return(0,a._)`!${je}(${A})`}return a.nil}}subschema(T,A){let L=(0,c.getSubschema)(this.it,T);(0,c.extendSubschemaData)(L,this.it,T),(0,c.extendSubschemaMode)(L,T);let ne={...this.it,...L,items:void 0,props:void 0};return w(ne,A),ne}mergeEvaluated(T,A){let{it:L,gen:ne}=this;L.opts.unevaluated&&(L.props!==!0&&T.props!==void 0&&(L.props=p.mergeEvaluated.props(ne,T.props,L.props,A)),L.items!==!0&&T.items!==void 0&&(L.items=p.mergeEvaluated.items(ne,T.items,L.items,A)))}mergeValidEvaluated(T,A){let{it:L,gen:ne}=this;if(L.opts.unevaluated&&(L.props!==!0||L.items!==!0))return ne.if(A,()=>this.mergeEvaluated(T,a.Name)),!0}};e.KeywordCxt=te;function de(T,A,L,ne){let se=new te(T,L,A);"code"in L?L.code(se,ne):se.$data&&L.validate?(0,i.funcKeywordCode)(se,L):"macro"in L?(0,i.macroKeywordCode)(se,L):(L.compile||L.validate)&&(0,i.funcKeywordCode)(se,L)}let ie=/^\/(?:[^~]|~0|~1)*$/,ze=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Je(T,{dataLevel:A,dataNames:L,dataPathArr:ne}){let se,le;if(T==="")return u.default.rootData;if(T[0]==="/"){if(!ie.test(T))throw new Error(`Invalid JSON-pointer: ${T}`);se=T,le=u.default.rootData}else{let xe=ze.exec(T);if(!xe)throw new Error(`Invalid JSON-pointer: ${T}`);let Re=+xe[1];if(se=xe[2],se==="#"){if(Re>=A)throw new Error(De("property/index",Re));return ne[A-Re]}if(Re>A)throw new Error(De("data",Re));if(le=L[A-Re],!se)return le}let Ce=le,je=se.split("/");for(let xe of je)xe&&(le=(0,a._)`${le}${(0,a.getProperty)((0,p.unescapeJsonPointer)(xe))}`,Ce=(0,a._)`${Ce} && ${le}`);return Ce;function De(xe,Re){return`Cannot access ${xe} ${Re} levels up, current level is ${A}`}}e.getData=Je})),kn=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=class extends Error{constructor(r){super("validation failed"),this.errors=r,this.ajv=this.validation=!0}};e.default=t})),Kr=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ma();var r=class extends Error{constructor(o,n,s,i){super(i||`can't resolve reference ${s} from id ${n}`),this.missingRef=(0,t.resolveUrl)(o,n,s),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(o,this.missingRef))}};e.default=r})),La=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=ue(),r=kn(),o=ut(),n=Ma(),s=fe(),i=Br();var c=class{constructor(h){var v;this.refs={},this.dynamicAnchors={};let S;typeof h.schema=="object"&&(S=h.schema),this.schema=h.schema,this.schemaId=h.schemaId,this.root=h.root||this,this.baseId=(v=h.baseId)!==null&&v!==void 0?v:(0,n.normalizeId)(S?.[h.schemaId||"$id"]),this.schemaPath=h.schemaPath,this.localRefs=h.localRefs,this.meta=h.meta,this.$async=S?.$async,this.refs={}}};e.SchemaEnv=c;function a(h){let v=p.call(this,h);if(v)return v;let S=(0,n.getFullPath)(this.opts.uriResolver,h.root.baseId),{es5:w,lines:R}=this.opts.code,{ownProperties:b}=this.opts,y=new t.CodeGen(this.scope,{es5:w,lines:R,ownProperties:b}),P;h.$async&&(P=y.scopeValue("Error",{ref:r.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let N=y.scopeName("validate");h.validateName=N;let F={gen:y,allErrors:this.opts.allErrors,data:o.default.data,parentData:o.default.parentData,parentDataProperty:o.default.parentDataProperty,dataNames:[o.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:y.scopeValue("schema",this.opts.code.source===!0?{ref:h.schema,code:(0,t.stringify)(h.schema)}:{ref:h.schema}),validateName:N,ValidationError:P,schema:h.schema,schemaEnv:h,rootId:S,baseId:h.baseId||S,schemaPath:t.nil,errSchemaPath:h.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,t._)`""`,opts:this.opts,self:this},M;try{this._compilations.add(h),(0,i.validateFunctionCode)(F),y.optimize(this.opts.code.optimize);let U=y.toString();M=`${y.scopeRefs(o.default.scope)}return ${U}`,this.opts.code.process&&(M=this.opts.code.process(M,h));let K=new Function(`${o.default.self}`,`${o.default.scope}`,M)(this,this.scope.get());if(this.scope.value(N,{ref:K}),K.errors=null,K.schema=h.schema,K.schemaEnv=h,h.$async&&(K.$async=!0),this.opts.code.source===!0&&(K.source={validateName:N,validateCode:U,scopeValues:y._values}),this.opts.unevaluated){let{props:B,items:me}=F;K.evaluated={props:B instanceof t.Name?void 0:B,items:me instanceof t.Name?void 0:me,dynamicProps:B instanceof t.Name,dynamicItems:me instanceof t.Name},K.source&&(K.source.evaluated=(0,t.stringify)(K.evaluated))}return h.validate=K,h}catch(U){throw delete h.validate,delete h.validateName,M&&this.logger.error("Error compiling schema, function code:",M),U}finally{this._compilations.delete(h)}}e.compileSchema=a;function u(h,v,S){var w;S=(0,n.resolveUrl)(this.opts.uriResolver,v,S);let R=h.refs[S];if(R)return R;let b=z.call(this,h,S);if(b===void 0){let y=(w=h.localRefs)===null||w===void 0?void 0:w[S],{schemaId:P}=this.opts;y&&(b=new c({schema:y,schemaId:P,root:h,baseId:v}))}if(b!==void 0)return h.refs[S]=l.call(this,b)}e.resolveRef=u;function l(h){return(0,n.inlineRef)(h.schema,this.opts.inlineRefs)?h.schema:h.validate?h:a.call(this,h)}function p(h){for(let v of this._compilations)if(f(v,h))return v}e.getCompilingSchema=p;function f(h,v){return h.schema===v.schema&&h.root===v.root&&h.baseId===v.baseId}function z(h,v){let S;for(;typeof(S=this.refs[v])=="string";)v=S;return S||this.schemas[v]||m.call(this,h,v)}function m(h,v){let S=this.opts.uriResolver.parse(v),w=(0,n._getFullPath)(this.opts.uriResolver,S),R=(0,n.getFullPath)(this.opts.uriResolver,h.baseId,void 0);if(Object.keys(h.schema).length>0&&w===R)return g.call(this,S,h);let b=(0,n.normalizeId)(w),y=this.refs[b]||this.schemas[b];if(typeof y=="string"){let P=m.call(this,h,y);return typeof P?.schema!="object"?void 0:g.call(this,S,P)}if(typeof y?.schema=="object"){if(y.validate||a.call(this,y),b===(0,n.normalizeId)(v)){let{schema:P}=y,{schemaId:N}=this.opts,F=P[N];return F&&(R=(0,n.resolveUrl)(this.opts.uriResolver,R,F)),new c({schema:P,schemaId:N,root:h,baseId:R})}return g.call(this,S,y)}}e.resolveSchema=m;let _=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function g(h,{baseId:v,schema:S,root:w}){var R;if(((R=h.fragment)===null||R===void 0?void 0:R[0])!=="/")return;for(let P of h.fragment.slice(1).split("/")){if(typeof S=="boolean")return;let N=S[(0,s.unescapeFragment)(P)];if(N===void 0)return;S=N;let F=typeof S=="object"&&S[this.opts.schemaId];!_.has(P)&&F&&(v=(0,n.resolveUrl)(this.opts.uriResolver,v,F))}let b;if(typeof S!="boolean"&&S.$ref&&!(0,s.schemaHasRulesButRef)(S,this.RULES)){let P=(0,n.resolveUrl)(this.opts.uriResolver,v,S.$ref);b=m.call(this,w,P)}let{schemaId:y}=this.opts;if(b=b||new c({schema:S,schemaId:y,root:w,baseId:v}),b.schema!==b.root.schema)return b}})),Vb=D(((e,t)=>{t.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}})),ug=D(((e,t)=>{let r=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),o=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 n(m){let _="",g=0,h=0;for(h=0;h<m.length;h++)if(g=m[h].charCodeAt(0),g!==48){if(!(g>=48&&g<=57||g>=65&&g<=70||g>=97&&g<=102))return"";_+=m[h];break}for(h+=1;h<m.length;h++){if(g=m[h].charCodeAt(0),!(g>=48&&g<=57||g>=65&&g<=70||g>=97&&g<=102))return"";_+=m[h]}return _}let s=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function i(m){return m.length=0,!0}function c(m,_,g){if(m.length){let h=n(m);if(h!=="")_.push(h);else return g.error=!0,!1;m.length=0}return!0}function a(m){let _=0,g={error:!1,address:"",zone:""},h=[],v=[],S=!1,w=!1,R=c;for(let b=0;b<m.length;b++){let y=m[b];if(!(y==="["||y==="]"))if(y===":"){if(S===!0&&(w=!0),!R(v,h,g))break;if(++_>7){g.error=!0;break}b>0&&m[b-1]===":"&&(S=!0),h.push(":");continue}else if(y==="%"){if(!R(v,h,g))break;R=i}else{v.push(y);continue}}return v.length&&(R===i?g.zone=v.join(""):w?h.push(v.join("")):h.push(n(v))),g.address=h.join(""),g}function u(m){if(l(m,":")<2)return{host:m,isIPV6:!1};let _=a(m);if(_.error)return{host:m,isIPV6:!1};{let g=_.address,h=_.address;return _.zone&&(g+="%"+_.zone,h+="%25"+_.zone),{host:g,isIPV6:!0,escapedHost:h}}}function l(m,_){let g=0;for(let h=0;h<m.length;h++)m[h]===_&&g++;return g}function p(m){let _=m,g=[],h=-1,v=0;for(;v=_.length;){if(v===1){if(_===".")break;if(_==="/"){g.push("/");break}else{g.push(_);break}}else if(v===2){if(_[0]==="."){if(_[1]===".")break;if(_[1]==="/"){_=_.slice(2);continue}}else if(_[0]==="/"&&(_[1]==="."||_[1]==="/")){g.push("/");break}}else if(v===3&&_==="/.."){g.length!==0&&g.pop(),g.push("/");break}if(_[0]==="."){if(_[1]==="."){if(_[2]==="/"){_=_.slice(3);continue}}else if(_[1]==="/"){_=_.slice(2);continue}}else if(_[0]==="/"&&_[1]==="."){if(_[2]==="/"){_=_.slice(2);continue}else if(_[2]==="."&&_[3]==="/"){_=_.slice(3),g.length!==0&&g.pop();continue}}if((h=_.indexOf("/",1))===-1){g.push(_);break}else g.push(_.slice(0,h)),_=_.slice(h)}return g.join("")}function f(m,_){let g=_!==!0?escape:unescape;return m.scheme!==void 0&&(m.scheme=g(m.scheme)),m.userinfo!==void 0&&(m.userinfo=g(m.userinfo)),m.host!==void 0&&(m.host=g(m.host)),m.path!==void 0&&(m.path=g(m.path)),m.query!==void 0&&(m.query=g(m.query)),m.fragment!==void 0&&(m.fragment=g(m.fragment)),m}function z(m){let _=[];if(m.userinfo!==void 0&&(_.push(m.userinfo),_.push("@")),m.host!==void 0){let g=unescape(m.host);if(!o(g)){let h=u(g);h.isIPV6===!0?g=`[${h.escapedHost}]`:g=m.host}_.push(g)}return(typeof m.port=="number"||typeof m.port=="string")&&(_.push(":"),_.push(String(m.port))),_.length?_.join(""):void 0}t.exports={nonSimpleDomain:s,recomposeAuthority:z,normalizeComponentEncoding:f,removeDotSegments:p,isIPv4:o,isUUID:r,normalizeIPv6:u,stringArrayToHexStripped:n}})),Fb=D(((e,t)=>{let{isUUID:r}=ug(),o=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n=["http","https","ws","wss","urn","urn:uuid"];function s(y){return n.indexOf(y)!==-1}function i(y){return y.secure===!0?!0:y.secure===!1?!1:y.scheme?y.scheme.length===3&&(y.scheme[0]==="w"||y.scheme[0]==="W")&&(y.scheme[1]==="s"||y.scheme[1]==="S")&&(y.scheme[2]==="s"||y.scheme[2]==="S"):!1}function c(y){return y.host||(y.error=y.error||"HTTP URIs must have a host."),y}function a(y){let P=String(y.scheme).toLowerCase()==="https";return(y.port===(P?443:80)||y.port==="")&&(y.port=void 0),y.path||(y.path="/"),y}function u(y){return y.secure=i(y),y.resourceName=(y.path||"/")+(y.query?"?"+y.query:""),y.path=void 0,y.query=void 0,y}function l(y){if((y.port===(i(y)?443:80)||y.port==="")&&(y.port=void 0),typeof y.secure=="boolean"&&(y.scheme=y.secure?"wss":"ws",y.secure=void 0),y.resourceName){let[P,N]=y.resourceName.split("?");y.path=P&&P!=="/"?P:void 0,y.query=N,y.resourceName=void 0}return y.fragment=void 0,y}function p(y,P){if(!y.path)return y.error="URN can not be parsed",y;let N=y.path.match(o);if(N){let F=P.scheme||y.scheme||"urn";y.nid=N[1].toLowerCase(),y.nss=N[2];let M=b(`${F}:${P.nid||y.nid}`);y.path=void 0,M&&(y=M.parse(y,P))}else y.error=y.error||"URN can not be parsed.";return y}function f(y,P){if(y.nid===void 0)throw new Error("URN without nid cannot be serialized");let N=P.scheme||y.scheme||"urn",F=y.nid.toLowerCase(),M=b(`${N}:${P.nid||F}`);M&&(y=M.serialize(y,P));let U=y,K=y.nss;return U.path=`${F||P.nid}:${K}`,P.skipEscape=!0,U}function z(y,P){let N=y;return N.uuid=N.nss,N.nss=void 0,!P.tolerant&&(!N.uuid||!r(N.uuid))&&(N.error=N.error||"UUID is not valid."),N}function m(y){let P=y;return P.nss=(y.uuid||"").toLowerCase(),P}let _={scheme:"http",domainHost:!0,parse:c,serialize:a},g={scheme:"https",domainHost:_.domainHost,parse:c,serialize:a},h={scheme:"ws",domainHost:!0,parse:u,serialize:l},v={scheme:"wss",domainHost:h.domainHost,parse:h.parse,serialize:h.serialize},R={http:_,https:g,ws:h,wss:v,urn:{scheme:"urn",parse:p,serialize:f,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:z,serialize:m,skipNormalize:!0}};Object.setPrototypeOf(R,null);function b(y){return y&&(R[y]||R[y.toLowerCase()])||void 0}t.exports={wsIsSecure:i,SCHEMES:R,isValidSchemeName:s,getSchemeHandler:b}})),Hb=D(((e,t)=>{let{normalizeIPv6:r,removeDotSegments:o,recomposeAuthority:n,normalizeComponentEncoding:s,isIPv4:i,nonSimpleDomain:c}=ug(),{SCHEMES:a,getSchemeHandler:u}=Fb();function l(v,S){return typeof v=="string"?v=m(g(v,S),S):typeof v=="object"&&(v=g(m(v,S),S)),v}function p(v,S,w){let R=w?Object.assign({scheme:"null"},w):{scheme:"null"},b=f(g(v,R),g(S,R),R,!0);return R.skipEscape=!0,m(b,R)}function f(v,S,w,R){let b={};return R||(v=g(m(v,w),w),S=g(m(S,w),w)),w=w||{},!w.tolerant&&S.scheme?(b.scheme=S.scheme,b.userinfo=S.userinfo,b.host=S.host,b.port=S.port,b.path=o(S.path||""),b.query=S.query):(S.userinfo!==void 0||S.host!==void 0||S.port!==void 0?(b.userinfo=S.userinfo,b.host=S.host,b.port=S.port,b.path=o(S.path||""),b.query=S.query):(S.path?(S.path[0]==="/"?b.path=o(S.path):((v.userinfo!==void 0||v.host!==void 0||v.port!==void 0)&&!v.path?b.path="/"+S.path:v.path?b.path=v.path.slice(0,v.path.lastIndexOf("/")+1)+S.path:b.path=S.path,b.path=o(b.path)),b.query=S.query):(b.path=v.path,S.query!==void 0?b.query=S.query:b.query=v.query),b.userinfo=v.userinfo,b.host=v.host,b.port=v.port),b.scheme=v.scheme),b.fragment=S.fragment,b}function z(v,S,w){return typeof v=="string"?(v=unescape(v),v=m(s(g(v,w),!0),{...w,skipEscape:!0})):typeof v=="object"&&(v=m(s(v,!0),{...w,skipEscape:!0})),typeof S=="string"?(S=unescape(S),S=m(s(g(S,w),!0),{...w,skipEscape:!0})):typeof S=="object"&&(S=m(s(S,!0),{...w,skipEscape:!0})),v.toLowerCase()===S.toLowerCase()}function m(v,S){let w={host:v.host,scheme:v.scheme,userinfo:v.userinfo,port:v.port,path:v.path,query:v.query,nid:v.nid,nss:v.nss,uuid:v.uuid,fragment:v.fragment,reference:v.reference,resourceName:v.resourceName,secure:v.secure,error:""},R=Object.assign({},S),b=[],y=u(R.scheme||w.scheme);y&&y.serialize&&y.serialize(w,R),w.path!==void 0&&(R.skipEscape?w.path=unescape(w.path):(w.path=escape(w.path),w.scheme!==void 0&&(w.path=w.path.split("%3A").join(":")))),R.reference!=="suffix"&&w.scheme&&b.push(w.scheme,":");let P=n(w);if(P!==void 0&&(R.reference!=="suffix"&&b.push("//"),b.push(P),w.path&&w.path[0]!=="/"&&b.push("/")),w.path!==void 0){let N=w.path;!R.absolutePath&&(!y||!y.absolutePath)&&(N=o(N)),P===void 0&&N[0]==="/"&&N[1]==="/"&&(N="/%2F"+N.slice(2)),b.push(N)}return w.query!==void 0&&b.push("?",w.query),w.fragment!==void 0&&b.push("#",w.fragment),b.join("")}let _=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function g(v,S){let w=Object.assign({},S),R={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},b=!1;w.reference==="suffix"&&(w.scheme?v=w.scheme+":"+v:v="//"+v);let y=v.match(_);if(y){if(R.scheme=y[1],R.userinfo=y[3],R.host=y[4],R.port=parseInt(y[5],10),R.path=y[6]||"",R.query=y[7],R.fragment=y[8],isNaN(R.port)&&(R.port=y[5]),R.host)if(i(R.host)===!1){let N=r(R.host);R.host=N.host.toLowerCase(),b=N.isIPV6}else b=!0;R.scheme===void 0&&R.userinfo===void 0&&R.host===void 0&&R.port===void 0&&R.query===void 0&&!R.path?R.reference="same-document":R.scheme===void 0?R.reference="relative":R.fragment===void 0?R.reference="absolute":R.reference="uri",w.reference&&w.reference!=="suffix"&&w.reference!==R.reference&&(R.error=R.error||"URI is not a "+w.reference+" reference.");let P=u(w.scheme||R.scheme);if(!w.unicodeSupport&&(!P||!P.unicodeSupport)&&R.host&&(w.domainHost||P&&P.domainHost)&&b===!1&&c(R.host))try{R.host=URL.domainToASCII(R.host.toLowerCase())}catch(N){R.error=R.error||"Host's domain name can not be converted to ASCII: "+N}(!P||P&&!P.skipNormalize)&&(v.indexOf("%")!==-1&&(R.scheme!==void 0&&(R.scheme=unescape(R.scheme)),R.host!==void 0&&(R.host=unescape(R.host))),R.path&&(R.path=escape(unescape(R.path))),R.fragment&&(R.fragment=encodeURI(decodeURIComponent(R.fragment)))),P&&P.parse&&P.parse(R,w)}else R.error=R.error||"URI can not be parsed.";return R}let h={SCHEMES:a,normalize:l,resolve:p,resolveComponent:f,equal:z,serialize:m,parse:g};t.exports=h,t.exports.default=h,t.exports.fastUri=h})),Jb=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Hb();t.code='require("ajv/dist/runtime/uri").default',e.default=t})),yl=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=Br();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=ue();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});let o=kn(),n=Kr(),s=ig(),i=La(),c=ue(),a=Ma(),u=Aa(),l=fe(),p=Vb(),f=Jb(),z=(C,j)=>new RegExp(C,j);z.code="new RegExp";let m=["removeAdditional","useDefaults","coerceTypes"],_=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},h={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},v=200;function S(C){var j,Z,$,k,x,H,te,de,ie,ze,Je,T,A,L,ne,se,le,Ce,je,De,xe,Re,ot,Ae,pt;let it=C.strict,mt=(j=C.code)===null||j===void 0?void 0:j.optimize,Rt=mt===!0||mt===void 0?1:mt||0,Pt=($=(Z=C.code)===null||Z===void 0?void 0:Z.regExp)!==null&&$!==void 0?$:z,Vt=(k=C.uriResolver)!==null&&k!==void 0?k:f.default;return{strictSchema:(H=(x=C.strictSchema)!==null&&x!==void 0?x:it)!==null&&H!==void 0?H:!0,strictNumbers:(de=(te=C.strictNumbers)!==null&&te!==void 0?te:it)!==null&&de!==void 0?de:!0,strictTypes:(ze=(ie=C.strictTypes)!==null&&ie!==void 0?ie:it)!==null&&ze!==void 0?ze:"log",strictTuples:(T=(Je=C.strictTuples)!==null&&Je!==void 0?Je:it)!==null&&T!==void 0?T:"log",strictRequired:(L=(A=C.strictRequired)!==null&&A!==void 0?A:it)!==null&&L!==void 0?L:!1,code:C.code?{...C.code,optimize:Rt,regExp:Pt}:{optimize:Rt,regExp:Pt},loopRequired:(ne=C.loopRequired)!==null&&ne!==void 0?ne:v,loopEnum:(se=C.loopEnum)!==null&&se!==void 0?se:v,meta:(le=C.meta)!==null&&le!==void 0?le:!0,messages:(Ce=C.messages)!==null&&Ce!==void 0?Ce:!0,inlineRefs:(je=C.inlineRefs)!==null&&je!==void 0?je:!0,schemaId:(De=C.schemaId)!==null&&De!==void 0?De:"$id",addUsedSchema:(xe=C.addUsedSchema)!==null&&xe!==void 0?xe:!0,validateSchema:(Re=C.validateSchema)!==null&&Re!==void 0?Re:!0,validateFormats:(ot=C.validateFormats)!==null&&ot!==void 0?ot:!0,unicodeRegExp:(Ae=C.unicodeRegExp)!==null&&Ae!==void 0?Ae:!0,int32range:(pt=C.int32range)!==null&&pt!==void 0?pt:!0,uriResolver:Vt}}var w=class{constructor(C={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,C=this.opts={...C,...S(C)};let{es5:j,lines:Z}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:_,es5:j,lines:Z}),this.logger=U(C.logger);let $=C.validateFormats;C.validateFormats=!1,this.RULES=(0,s.getRules)(),R.call(this,g,C,"NOT SUPPORTED"),R.call(this,h,C,"DEPRECATED","warn"),this._metaOpts=F.call(this),C.formats&&P.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),C.keywords&&N.call(this,C.keywords),typeof C.meta=="object"&&this.addMetaSchema(C.meta),y.call(this),C.validateFormats=$}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:C,meta:j,schemaId:Z}=this.opts,$=p;Z==="id"&&($={...p},$.id=$.$id,delete $.$id),j&&C&&this.addMetaSchema($,$[Z],!1)}defaultMeta(){let{meta:C,schemaId:j}=this.opts;return this.opts.defaultMeta=typeof C=="object"?C[j]||C:void 0}validate(C,j){let Z;if(typeof C=="string"){if(Z=this.getSchema(C),!Z)throw new Error(`no schema with key or ref "${C}"`)}else Z=this.compile(C);let $=Z(j);return"$async"in Z||(this.errors=Z.errors),$}compile(C,j){let Z=this._addSchema(C,j);return Z.validate||this._compileSchemaEnv(Z)}compileAsync(C,j){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:Z}=this.opts;return $.call(this,C,j);async function $(ie,ze){await k.call(this,ie.$schema);let Je=this._addSchema(ie,ze);return Je.validate||x.call(this,Je)}async function k(ie){ie&&!this.getSchema(ie)&&await $.call(this,{$ref:ie},!0)}async function x(ie){try{return this._compileSchemaEnv(ie)}catch(ze){if(!(ze instanceof n.default))throw ze;return H.call(this,ze),await te.call(this,ze.missingSchema),x.call(this,ie)}}function H({missingSchema:ie,missingRef:ze}){if(this.refs[ie])throw new Error(`AnySchema ${ie} is loaded but ${ze} cannot be resolved`)}async function te(ie){let ze=await de.call(this,ie);this.refs[ie]||await k.call(this,ze.$schema),this.refs[ie]||this.addSchema(ze,ie,j)}async function de(ie){let ze=this._loading[ie];if(ze)return ze;try{return await(this._loading[ie]=Z(ie))}finally{delete this._loading[ie]}}}addSchema(C,j,Z,$=this.opts.validateSchema){if(Array.isArray(C)){for(let x of C)this.addSchema(x,void 0,Z,$);return this}let k;if(typeof C=="object"){let{schemaId:x}=this.opts;if(k=C[x],k!==void 0&&typeof k!="string")throw new Error(`schema ${x} must be string`)}return j=(0,a.normalizeId)(j||k),this._checkUnique(j),this.schemas[j]=this._addSchema(C,Z,j,$,!0),this}addMetaSchema(C,j,Z=this.opts.validateSchema){return this.addSchema(C,j,!0,Z),this}validateSchema(C,j){if(typeof C=="boolean")return!0;let Z;if(Z=C.$schema,Z!==void 0&&typeof Z!="string")throw new Error("$schema must be a string");if(Z=Z||this.opts.defaultMeta||this.defaultMeta(),!Z)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let $=this.validate(Z,C);if(!$&&j){let k="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(k);else throw new Error(k)}return $}getSchema(C){let j;for(;typeof(j=b.call(this,C))=="string";)C=j;if(j===void 0){let{schemaId:Z}=this.opts,$=new i.SchemaEnv({schema:{},schemaId:Z});if(j=i.resolveSchema.call(this,$,C),!j)return;this.refs[C]=j}return j.validate||this._compileSchemaEnv(j)}removeSchema(C){if(C instanceof RegExp)return this._removeAllSchemas(this.schemas,C),this._removeAllSchemas(this.refs,C),this;switch(typeof C){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let j=b.call(this,C);return typeof j=="object"&&this._cache.delete(j.schema),delete this.schemas[C],delete this.refs[C],this}case"object":{let j=C;this._cache.delete(j);let Z=C[this.opts.schemaId];return Z&&(Z=(0,a.normalizeId)(Z),delete this.schemas[Z],delete this.refs[Z]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(C){for(let j of C)this.addKeyword(j);return this}addKeyword(C,j){let Z;if(typeof C=="string")Z=C,typeof j=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),j.keyword=Z);else if(typeof C=="object"&&j===void 0){if(j=C,Z=j.keyword,Array.isArray(Z)&&!Z.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(B.call(this,Z,j),!j)return(0,l.eachItem)(Z,k=>me.call(this,k)),this;be.call(this,j);let $={...j,type:(0,u.getJSONTypes)(j.type),schemaType:(0,u.getJSONTypes)(j.schemaType)};return(0,l.eachItem)(Z,$.type.length===0?k=>me.call(this,k,$):k=>$.type.forEach(x=>me.call(this,k,$,x))),this}getKeyword(C){let j=this.RULES.all[C];return typeof j=="object"?j.definition:!!j}removeKeyword(C){let{RULES:j}=this;delete j.keywords[C],delete j.all[C];for(let Z of j.rules){let $=Z.rules.findIndex(k=>k.keyword===C);$>=0&&Z.rules.splice($,1)}return this}addFormat(C,j){return typeof j=="string"&&(j=new RegExp(j)),this.formats[C]=j,this}errorsText(C=this.errors,{separator:j=", ",dataVar:Z="data"}={}){return!C||C.length===0?"No errors":C.map($=>`${Z}${$.instancePath} ${$.message}`).reduce(($,k)=>$+j+k)}$dataMetaSchema(C,j){let Z=this.RULES.all;C=JSON.parse(JSON.stringify(C));for(let $ of j){let k=$.split("/").slice(1),x=C;for(let H of k)x=x[H];for(let H in Z){let te=Z[H];if(typeof te!="object")continue;let{$data:de}=te.definition,ie=x[H];de&&ie&&(x[H]=he(ie))}}return C}_removeAllSchemas(C,j){for(let Z in C){let $=C[Z];(!j||j.test(Z))&&(typeof $=="string"?delete C[Z]:$&&!$.meta&&(this._cache.delete($.schema),delete C[Z]))}}_addSchema(C,j,Z,$=this.opts.validateSchema,k=this.opts.addUsedSchema){let x,{schemaId:H}=this.opts;if(typeof C=="object")x=C[H];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof C!="boolean")throw new Error("schema must be object or boolean")}let te=this._cache.get(C);if(te!==void 0)return te;Z=(0,a.normalizeId)(x||Z);let de=a.getSchemaRefs.call(this,C,Z);return te=new i.SchemaEnv({schema:C,schemaId:H,meta:j,baseId:Z,localRefs:de}),this._cache.set(te.schema,te),k&&!Z.startsWith("#")&&(Z&&this._checkUnique(Z),this.refs[Z]=te),$&&this.validateSchema(C,!0),te}_checkUnique(C){if(this.schemas[C]||this.refs[C])throw new Error(`schema with key or id "${C}" already exists`)}_compileSchemaEnv(C){if(C.meta?this._compileMetaSchema(C):i.compileSchema.call(this,C),!C.validate)throw new Error("ajv implementation error");return C.validate}_compileMetaSchema(C){let j=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,C)}finally{this.opts=j}}};w.ValidationError=o.default,w.MissingRefError=n.default,e.default=w;function R(C,j,Z,$="error"){for(let k in C){let x=k;x in j&&this.logger[$](`${Z}: option ${k}. ${C[x]}`)}}function b(C){return C=(0,a.normalizeId)(C),this.schemas[C]||this.refs[C]}function y(){let C=this.opts.schemas;if(C)if(Array.isArray(C))this.addSchema(C);else for(let j in C)this.addSchema(C[j],j)}function P(){for(let C in this.opts.formats){let j=this.opts.formats[C];j&&this.addFormat(C,j)}}function N(C){if(Array.isArray(C)){this.addVocabulary(C);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let j in C){let Z=C[j];Z.keyword||(Z.keyword=j),this.addKeyword(Z)}}function F(){let C={...this.opts};for(let j of m)delete C[j];return C}let M={log(){},warn(){},error(){}};function U(C){if(C===!1)return M;if(C===void 0)return console;if(C.log&&C.warn&&C.error)return C;throw new Error("logger must implement log, warn and error methods")}let K=/^[a-z_$][a-z0-9_$:-]*$/i;function B(C,j){let{RULES:Z}=this;if((0,l.eachItem)(C,$=>{if(Z.keywords[$])throw new Error(`Keyword ${$} is already defined`);if(!K.test($))throw new Error(`Keyword ${$} has invalid name`)}),!!j&&j.$data&&!("code"in j||"validate"in j))throw new Error('$data keyword must have "code" or "validate" function')}function me(C,j,Z){var $;let k=j?.post;if(Z&&k)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:x}=this,H=k?x.post:x.rules.find(({type:de})=>de===Z);if(H||(H={type:Z,rules:[]},x.rules.push(H)),x.keywords[C]=!0,!j)return;let te={keyword:C,definition:{...j,type:(0,u.getJSONTypes)(j.type),schemaType:(0,u.getJSONTypes)(j.schemaType)}};j.before?$e.call(this,H,te,j.before):H.rules.push(te),x.all[C]=te,($=j.implements)===null||$===void 0||$.forEach(de=>this.addKeyword(de))}function $e(C,j,Z){let $=C.rules.findIndex(k=>k.keyword===Z);$>=0?C.rules.splice($,0,j):(C.rules.push(j),this.logger.warn(`rule ${Z} is not defined`))}function be(C){let{metaSchema:j}=C;j!==void 0&&(C.$data&&this.opts.$data&&(j=he(j)),C.validateSchema=this.compile(j,!0))}let Ie={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function he(C){return{anyOf:[C,Ie]}}})),Bb=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};e.default=t})),Sl=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=Kr(),r=lt(),o=ue(),n=ut(),s=La(),i=fe(),c={keyword:"$ref",schemaType:"string",code(l){let{gen:p,schema:f,it:z}=l,{baseId:m,schemaEnv:_,validateName:g,opts:h,self:v}=z,{root:S}=_;if((f==="#"||f==="#/")&&m===S.baseId)return R();let w=s.resolveRef.call(v,S,m,f);if(w===void 0)throw new t.default(z.opts.uriResolver,m,f);if(w instanceof s.SchemaEnv)return b(w);return y(w);function R(){if(_===S)return u(l,g,_,_.$async);let P=p.scopeValue("root",{ref:S});return u(l,(0,o._)`${P}.validate`,S,S.$async)}function b(P){u(l,a(l,P),P,P.$async)}function y(P){let N=p.scopeValue("schema",h.code.source===!0?{ref:P,code:(0,o.stringify)(P)}:{ref:P}),F=p.name("valid"),M=l.subschema({schema:P,dataTypes:[],schemaPath:o.nil,topSchemaRef:N,errSchemaPath:f},F);l.mergeEvaluated(M),l.ok(F)}}};function a(l,p){let{gen:f}=l;return p.validate?f.scopeValue("validate",{ref:p.validate}):(0,o._)`${f.scopeValue("wrapper",{ref:p})}.validate`}e.getValidate=a;function u(l,p,f,z){let{gen:m,it:_}=l,{allErrors:g,schemaEnv:h,opts:v}=_,S=v.passContext?n.default.this:o.nil;z?w():R();function w(){if(!h.$async)throw new Error("async schema referenced by sync schema");let P=m.let("valid");m.try(()=>{m.code((0,o._)`await ${(0,r.callValidateCode)(l,p,S)}`),y(p),g||m.assign(P,!0)},N=>{m.if((0,o._)`!(${N} instanceof ${_.ValidationError})`,()=>m.throw(N)),b(N),g||m.assign(P,!1)}),l.ok(P)}function R(){l.result((0,r.callValidateCode)(l,p,S),()=>y(p),()=>b(p))}function b(P){let N=(0,o._)`${P}.errors`;m.assign(n.default.vErrors,(0,o._)`${n.default.vErrors} === null ? ${N} : ${n.default.vErrors}.concat(${N})`),m.assign(n.default.errors,(0,o._)`${n.default.vErrors}.length`)}function y(P){var N;if(!_.opts.unevaluated)return;let F=(N=f?.validate)===null||N===void 0?void 0:N.evaluated;if(_.props!==!0)if(F&&!F.dynamicProps)F.props!==void 0&&(_.props=i.mergeEvaluated.props(m,F.props,_.props));else{let M=m.var("props",(0,o._)`${P}.evaluated.props`);_.props=i.mergeEvaluated.props(m,M,_.props,o.Name)}if(_.items!==!0)if(F&&!F.dynamicItems)F.items!==void 0&&(_.items=i.mergeEvaluated.items(m,F.items,_.items));else{let M=m.var("items",(0,o._)`${P}.evaluated.items`);_.items=i.mergeEvaluated.items(m,M,_.items,o.Name)}}}e.callRef=u,e.default=c})),lg=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Bb(),r=Sl(),o=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default];e.default=o})),Kb=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ue(),r=t.operators,o={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},n={keyword:Object.keys(o),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:s,schemaCode:i})=>(0,t.str)`must be ${o[s].okStr} ${i}`,params:({keyword:s,schemaCode:i})=>(0,t._)`{comparison: ${o[s].okStr}, limit: ${i}}`},code(s){let{keyword:i,data:c,schemaCode:a}=s;s.fail$data((0,t._)`${c} ${o[i].fail} ${a} || isNaN(${c})`)}};e.default=n})),Gb=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ue(),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:o})=>(0,t.str)`must be multiple of ${o}`,params:({schemaCode:o})=>(0,t._)`{multipleOf: ${o}}`},code(o){let{gen:n,data:s,schemaCode:i,it:c}=o,a=c.opts.multipleOfPrecision,u=n.let("res"),l=a?(0,t._)`Math.abs(Math.round(${u}) - ${u}) > 1e-${a}`:(0,t._)`${u} !== parseInt(${u})`;o.fail$data((0,t._)`(${i} === 0 || (${u} = ${s}/${i}, ${l}))`)}};e.default=r})),Wb=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(r){let o=r.length,n=0,s=0,i;for(;s<o;)n++,i=r.charCodeAt(s++),i>=55296&&i<=56319&&s<o&&(i=r.charCodeAt(s),(i&64512)===56320&&s++);return n}e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'})),Yb=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ue(),r=fe(),o=Wb(),n={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:s,schemaCode:i}){let c=s==="maxLength"?"more":"fewer";return(0,t.str)`must NOT have ${c} than ${i} characters`},params:({schemaCode:s})=>(0,t._)`{limit: ${s}}`},code(s){let{keyword:i,data:c,schemaCode:a,it:u}=s,l=i==="maxLength"?t.operators.GT:t.operators.LT,p=u.opts.unicode===!1?(0,t._)`${c}.length`:(0,t._)`${(0,r.useFunc)(s.gen,o.default)}(${c})`;s.fail$data((0,t._)`${p} ${l} ${a}`)}};e.default=n})),Xb=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=lt(),r=fe(),o=ue(),n={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:s})=>(0,o.str)`must match pattern "${s}"`,params:({schemaCode:s})=>(0,o._)`{pattern: ${s}}`},code(s){let{gen:i,data:c,$data:a,schema:u,schemaCode:l,it:p}=s,f=p.opts.unicodeRegExp?"u":"";if(a){let{regExp:z}=p.opts.code,m=z.code==="new RegExp"?(0,o._)`new RegExp`:(0,r.useFunc)(i,z),_=i.let("valid");i.try(()=>i.assign(_,(0,o._)`${m}(${l}, ${f}).test(${c})`),()=>i.assign(_,!1)),s.fail$data((0,o._)`!${_}`)}else{let z=(0,t.usePattern)(s,u);s.fail$data((0,o._)`!${z}.test(${c})`)}}};e.default=n})),Qb=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ue(),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:o,schemaCode:n}){let s=o==="maxProperties"?"more":"fewer";return(0,t.str)`must NOT have ${s} than ${n} properties`},params:({schemaCode:o})=>(0,t._)`{limit: ${o}}`},code(o){let{keyword:n,data:s,schemaCode:i}=o,c=n==="maxProperties"?t.operators.GT:t.operators.LT;o.fail$data((0,t._)`Object.keys(${s}).length ${c} ${i}`)}};e.default=r})),ez=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=lt(),r=ue(),o=fe(),n={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:s}})=>(0,r.str)`must have required property '${s}'`,params:({params:{missingProperty:s}})=>(0,r._)`{missingProperty: ${s}}`},code(s){let{gen:i,schema:c,schemaCode:a,data:u,$data:l,it:p}=s,{opts:f}=p;if(!l&&c.length===0)return;let z=c.length>=f.loopRequired;if(p.allErrors?m():_(),f.strictRequired){let v=s.parentSchema.properties,{definedProperties:S}=s.it;for(let w of c)if(v?.[w]===void 0&&!S.has(w)){let R=`required property "${w}" is not defined at "${p.schemaEnv.baseId+p.errSchemaPath}" (strictRequired)`;(0,o.checkStrictMode)(p,R,p.opts.strictRequired)}}function m(){if(z||l)s.block$data(r.nil,g);else for(let v of c)(0,t.checkReportMissingProp)(s,v)}function _(){let v=i.let("missing");if(z||l){let S=i.let("valid",!0);s.block$data(S,()=>h(v,S)),s.ok(S)}else i.if((0,t.checkMissingProp)(s,c,v)),(0,t.reportMissingProp)(s,v),i.else()}function g(){i.forOf("prop",a,v=>{s.setParams({missingProperty:v}),i.if((0,t.noPropertyInData)(i,u,v,f.ownProperties),()=>s.error())})}function h(v,S){s.setParams({missingProperty:v}),i.forOf(v,a,()=>{i.assign(S,(0,t.propertyInData)(i,u,v,f.ownProperties)),i.if((0,r.not)(S),()=>{s.error(),i.break()})},r.nil)}}};e.default=n})),tz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ue(),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:o,schemaCode:n}){let s=o==="maxItems"?"more":"fewer";return(0,t.str)`must NOT have ${s} than ${n} items`},params:({schemaCode:o})=>(0,t._)`{limit: ${o}}`},code(o){let{keyword:n,data:s,schemaCode:i}=o,c=n==="maxItems"?t.operators.GT:t.operators.LT;o.fail$data((0,t._)`${s}.length ${c} ${i}`)}};e.default=r})),vl=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cg();t.code='require("ajv/dist/runtime/equal").default',e.default=t})),rz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Aa(),r=ue(),o=fe(),n=vl(),s={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i,j:c}})=>(0,r.str)`must NOT have duplicate items (items ## ${c} and ${i} are identical)`,params:({params:{i,j:c}})=>(0,r._)`{i: ${i}, j: ${c}}`},code(i){let{gen:c,data:a,$data:u,schema:l,parentSchema:p,schemaCode:f,it:z}=i;if(!u&&!l)return;let m=c.let("valid"),_=p.items?(0,t.getSchemaTypes)(p.items):[];i.block$data(m,g,(0,r._)`${f} === false`),i.ok(m);function g(){let w=c.let("i",(0,r._)`${a}.length`),R=c.let("j");i.setParams({i:w,j:R}),c.assign(m,!0),c.if((0,r._)`${w} > 1`,()=>(h()?v:S)(w,R))}function h(){return _.length>0&&!_.some(w=>w==="object"||w==="array")}function v(w,R){let b=c.name("item"),y=(0,t.checkDataTypes)(_,b,z.opts.strictNumbers,t.DataType.Wrong),P=c.const("indices",(0,r._)`{}`);c.for((0,r._)`;${w}--;`,()=>{c.let(b,(0,r._)`${a}[${w}]`),c.if(y,(0,r._)`continue`),_.length>1&&c.if((0,r._)`typeof ${b} == "string"`,(0,r._)`${b} += "_"`),c.if((0,r._)`typeof ${P}[${b}] == "number"`,()=>{c.assign(R,(0,r._)`${P}[${b}]`),i.error(),c.assign(m,!1).break()}).code((0,r._)`${P}[${b}] = ${w}`)})}function S(w,R){let b=(0,o.useFunc)(c,n.default),y=c.name("outer");c.label(y).for((0,r._)`;${w}--;`,()=>c.for((0,r._)`${R} = ${w}; ${R}--;`,()=>c.if((0,r._)`${b}(${a}[${w}], ${a}[${R}])`,()=>{i.error(),c.assign(m,!1).break(y)})))}}};e.default=s})),oz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ue(),r=fe(),o=vl(),n={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:s})=>(0,t._)`{allowedValue: ${s}}`},code(s){let{gen:i,data:c,$data:a,schemaCode:u,schema:l}=s;a||l&&typeof l=="object"?s.fail$data((0,t._)`!${(0,r.useFunc)(i,o.default)}(${c}, ${u})`):s.fail((0,t._)`${l} !== ${c}`)}};e.default=n})),nz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ue(),r=fe(),o=vl(),n={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:s})=>(0,t._)`{allowedValues: ${s}}`},code(s){let{gen:i,data:c,$data:a,schema:u,schemaCode:l,it:p}=s;if(!a&&u.length===0)throw new Error("enum must have non-empty array");let f=u.length>=p.opts.loopEnum,z,m=()=>z??(z=(0,r.useFunc)(i,o.default)),_;if(f||a)_=i.let("valid"),s.block$data(_,g);else{if(!Array.isArray(u))throw new Error("ajv implementation error");let v=i.const("vSchema",l);_=(0,t.or)(...u.map((S,w)=>h(v,w)))}s.pass(_);function g(){i.assign(_,!1),i.forOf("v",l,v=>i.if((0,t._)`${m()}(${c}, ${v})`,()=>i.assign(_,!0).break()))}function h(v,S){let w=u[S];return typeof w=="object"&&w!==null?(0,t._)`${m()}(${c}, ${v}[${S}])`:(0,t._)`${c} === ${w}`}}};e.default=n})),dg=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Kb(),r=Gb(),o=Yb(),n=Xb(),s=Qb(),i=ez(),c=tz(),a=rz(),u=oz(),l=nz(),p=[t.default,r.default,o.default,n.default,s.default,i.default,c.default,a.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,l.default];e.default=p})),pg=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=ue(),r=fe(),o={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:s}})=>(0,t.str)`must NOT have more than ${s} items`,params:({params:{len:s}})=>(0,t._)`{limit: ${s}}`},code(s){let{parentSchema:i,it:c}=s,{items:a}=i;if(!Array.isArray(a)){(0,r.checkStrictMode)(c,'"additionalItems" is ignored when "items" is not an array of schemas');return}n(s,a)}};function n(s,i){let{gen:c,schema:a,data:u,keyword:l,it:p}=s;p.items=!0;let f=c.const("len",(0,t._)`${u}.length`);if(a===!1)s.setParams({len:i.length}),s.pass((0,t._)`${f} <= ${i.length}`);else if(typeof a=="object"&&!(0,r.alwaysValidSchema)(p,a)){let m=c.var("valid",(0,t._)`${f} <= ${i.length}`);c.if((0,t.not)(m),()=>z(m)),s.ok(m)}function z(m){c.forRange("i",i.length,f,_=>{s.subschema({keyword:l,dataProp:_,dataPropType:r.Type.Num},m),p.allErrors||c.if((0,t.not)(m),()=>c.break())})}}e.validateAdditionalItems=n,e.default=o})),mg=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=ue(),r=fe(),o=lt(),n={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(i){let{schema:c,it:a}=i;if(Array.isArray(c))return s(i,"additionalItems",c);a.items=!0,!(0,r.alwaysValidSchema)(a,c)&&i.ok((0,o.validateArray)(i))}};function s(i,c,a=i.schema){let{gen:u,parentSchema:l,data:p,keyword:f,it:z}=i;g(l),z.opts.unevaluated&&a.length&&z.items!==!0&&(z.items=r.mergeEvaluated.items(u,a.length,z.items));let m=u.name("valid"),_=u.const("len",(0,t._)`${p}.length`);a.forEach((h,v)=>{(0,r.alwaysValidSchema)(z,h)||(u.if((0,t._)`${_} > ${v}`,()=>i.subschema({keyword:f,schemaProp:v,dataProp:v},m)),i.ok(m))});function g(h){let{opts:v,errSchemaPath:S}=z,w=a.length,R=w===h.minItems&&(w===h.maxItems||h[c]===!1);if(v.strictTuples&&!R){let b=`"${f}" is ${w}-tuple, but minItems or maxItems/${c} are not specified or different at path "${S}"`;(0,r.checkStrictMode)(z,b,v.strictTuples)}}}e.validateTuple=s,e.default=n})),sz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=mg(),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:o=>(0,t.validateTuple)(o,"items")};e.default=r})),iz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ue(),r=fe(),o=lt(),n=pg(),s={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:i}})=>(0,t.str)`must NOT have more than ${i} items`,params:({params:{len:i}})=>(0,t._)`{limit: ${i}}`},code(i){let{schema:c,parentSchema:a,it:u}=i,{prefixItems:l}=a;u.items=!0,!(0,r.alwaysValidSchema)(u,c)&&(l?(0,n.validateAdditionalItems)(i,l):i.ok((0,o.validateArray)(i)))}};e.default=s})),az=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ue(),r=fe(),o={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:n,max:s}})=>s===void 0?(0,t.str)`must contain at least ${n} valid item(s)`:(0,t.str)`must contain at least ${n} and no more than ${s} valid item(s)`,params:({params:{min:n,max:s}})=>s===void 0?(0,t._)`{minContains: ${n}}`:(0,t._)`{minContains: ${n}, maxContains: ${s}}`},code(n){let{gen:s,schema:i,parentSchema:c,data:a,it:u}=n,l,p,{minContains:f,maxContains:z}=c;u.opts.next?(l=f===void 0?1:f,p=z):l=1;let m=s.const("len",(0,t._)`${a}.length`);if(n.setParams({min:l,max:p}),p===void 0&&l===0){(0,r.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(p!==void 0&&l>p){(0,r.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),n.fail();return}if((0,r.alwaysValidSchema)(u,i)){let S=(0,t._)`${m} >= ${l}`;p!==void 0&&(S=(0,t._)`${S} && ${m} <= ${p}`),n.pass(S);return}u.items=!0;let _=s.name("valid");p===void 0&&l===1?h(_,()=>s.if(_,()=>s.break())):l===0?(s.let(_,!0),p!==void 0&&s.if((0,t._)`${a}.length > 0`,g)):(s.let(_,!1),g()),n.result(_,()=>n.reset());function g(){let S=s.name("_valid"),w=s.let("count",0);h(S,()=>s.if(S,()=>v(w)))}function h(S,w){s.forRange("i",0,m,R=>{n.subschema({keyword:"contains",dataProp:R,dataPropType:r.Type.Num,compositeRule:!0},S),w()})}function v(S){s.code((0,t._)`${S}++`),p===void 0?s.if((0,t._)`${S} >= ${l}`,()=>s.assign(_,!0).break()):(s.if((0,t._)`${S} > ${p}`,()=>s.assign(_,!1).break()),l===1?s.assign(_,!0):s.if((0,t._)`${S} >= ${l}`,()=>s.assign(_,!0)))}}};e.default=o})),bl=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=ue(),r=fe(),o=lt();e.error={message:({params:{property:a,depsCount:u,deps:l}})=>{let p=u===1?"property":"properties";return(0,t.str)`must have ${p} ${l} when property ${a} is present`},params:({params:{property:a,depsCount:u,deps:l,missingProperty:p}})=>(0,t._)`{property: ${a},
60
+ missingProperty: ${p},
61
+ depsCount: ${u},
62
+ deps: ${l}}`};let n={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(a){let[u,l]=s(a);i(a,u),c(a,l)}};function s({schema:a}){let u={},l={};for(let p in a){if(p==="__proto__")continue;let f=Array.isArray(a[p])?u:l;f[p]=a[p]}return[u,l]}function i(a,u=a.schema){let{gen:l,data:p,it:f}=a;if(Object.keys(u).length===0)return;let z=l.let("missing");for(let m in u){let _=u[m];if(_.length===0)continue;let g=(0,o.propertyInData)(l,p,m,f.opts.ownProperties);a.setParams({property:m,depsCount:_.length,deps:_.join(", ")}),f.allErrors?l.if(g,()=>{for(let h of _)(0,o.checkReportMissingProp)(a,h)}):(l.if((0,t._)`${g} && (${(0,o.checkMissingProp)(a,_,z)})`),(0,o.reportMissingProp)(a,z),l.else())}}e.validatePropertyDeps=i;function c(a,u=a.schema){let{gen:l,data:p,keyword:f,it:z}=a,m=l.name("valid");for(let _ in u)(0,r.alwaysValidSchema)(z,u[_])||(l.if((0,o.propertyInData)(l,p,_,z.opts.ownProperties),()=>{let g=a.subschema({keyword:f,schemaProp:_},m);a.mergeValidEvaluated(g,m)},()=>l.var(m,!0)),a.ok(m))}e.validateSchemaDeps=c,e.default=n})),cz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ue(),r=fe(),o={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:n})=>(0,t._)`{propertyName: ${n.propertyName}}`},code(n){let{gen:s,schema:i,data:c,it:a}=n;if((0,r.alwaysValidSchema)(a,i))return;let u=s.name("valid");s.forIn("key",c,l=>{n.setParams({propertyName:l}),n.subschema({keyword:"propertyNames",data:l,dataTypes:["string"],propertyName:l,compositeRule:!0},u),s.if((0,t.not)(u),()=>{n.error(!0),a.allErrors||s.break()})}),n.ok(u)}};e.default=o})),hg=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=lt(),r=ue(),o=ut(),n=fe(),s={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:i})=>(0,r._)`{additionalProperty: ${i.additionalProperty}}`},code(i){let{gen:c,schema:a,parentSchema:u,data:l,errsCount:p,it:f}=i;if(!p)throw new Error("ajv implementation error");let{allErrors:z,opts:m}=f;if(f.props=!0,m.removeAdditional!=="all"&&(0,n.alwaysValidSchema)(f,a))return;let _=(0,t.allSchemaProperties)(u.properties),g=(0,t.allSchemaProperties)(u.patternProperties);h(),i.ok((0,r._)`${p} === ${o.default.errors}`);function h(){c.forIn("key",l,b=>{!_.length&&!g.length?w(b):c.if(v(b),()=>w(b))})}function v(b){let y;if(_.length>8){let P=(0,n.schemaRefOrVal)(f,u.properties,"properties");y=(0,t.isOwnProperty)(c,P,b)}else _.length?y=(0,r.or)(..._.map(P=>(0,r._)`${b} === ${P}`)):y=r.nil;return g.length&&(y=(0,r.or)(y,...g.map(P=>(0,r._)`${(0,t.usePattern)(i,P)}.test(${b})`))),(0,r.not)(y)}function S(b){c.code((0,r._)`delete ${l}[${b}]`)}function w(b){if(m.removeAdditional==="all"||m.removeAdditional&&a===!1){S(b);return}if(a===!1){i.setParams({additionalProperty:b}),i.error(),z||c.break();return}if(typeof a=="object"&&!(0,n.alwaysValidSchema)(f,a)){let y=c.name("valid");m.removeAdditional==="failing"?(R(b,y,!1),c.if((0,r.not)(y),()=>{i.reset(),S(b)})):(R(b,y),z||c.if((0,r.not)(y),()=>c.break()))}}function R(b,y,P){let N={keyword:"additionalProperties",dataProp:b,dataPropType:n.Type.Str};P===!1&&Object.assign(N,{compositeRule:!0,createErrors:!1,allErrors:!1}),i.subschema(N,y)}}};e.default=s})),uz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Br(),r=lt(),o=fe(),n=hg(),s={keyword:"properties",type:"object",schemaType:"object",code(i){let{gen:c,schema:a,parentSchema:u,data:l,it:p}=i;p.opts.removeAdditional==="all"&&u.additionalProperties===void 0&&n.default.code(new t.KeywordCxt(p,n.default,"additionalProperties"));let f=(0,r.allSchemaProperties)(a);for(let h of f)p.definedProperties.add(h);p.opts.unevaluated&&f.length&&p.props!==!0&&(p.props=o.mergeEvaluated.props(c,(0,o.toHash)(f),p.props));let z=f.filter(h=>!(0,o.alwaysValidSchema)(p,a[h]));if(z.length===0)return;let m=c.name("valid");for(let h of z)_(h)?g(h):(c.if((0,r.propertyInData)(c,l,h,p.opts.ownProperties)),g(h),p.allErrors||c.else().var(m,!0),c.endIf()),i.it.definedProperties.add(h),i.ok(m);function _(h){return p.opts.useDefaults&&!p.compositeRule&&a[h].default!==void 0}function g(h){i.subschema({keyword:"properties",schemaProp:h,dataProp:h},m)}}};e.default=s})),lz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=lt(),r=ue(),o=fe(),n=fe(),s={keyword:"patternProperties",type:"object",schemaType:"object",code(i){let{gen:c,schema:a,data:u,parentSchema:l,it:p}=i,{opts:f}=p,z=(0,t.allSchemaProperties)(a),m=z.filter(R=>(0,o.alwaysValidSchema)(p,a[R]));if(z.length===0||m.length===z.length&&(!p.opts.unevaluated||p.props===!0))return;let _=f.strictSchema&&!f.allowMatchingProperties&&l.properties,g=c.name("valid");p.props!==!0&&!(p.props instanceof r.Name)&&(p.props=(0,n.evaluatedPropsToName)(c,p.props));let{props:h}=p;v();function v(){for(let R of z)_&&S(R),p.allErrors?w(R):(c.var(g,!0),w(R),c.if(g))}function S(R){for(let b in _)new RegExp(R).test(b)&&(0,o.checkStrictMode)(p,`property ${b} matches pattern ${R} (use allowMatchingProperties)`)}function w(R){c.forIn("key",u,b=>{c.if((0,r._)`${(0,t.usePattern)(i,R)}.test(${b})`,()=>{let y=m.includes(R);y||i.subschema({keyword:"patternProperties",schemaProp:R,dataProp:b,dataPropType:n.Type.Str},g),p.opts.unevaluated&&h!==!0?c.assign((0,r._)`${h}[${b}]`,!0):!y&&!p.allErrors&&c.if((0,r.not)(g),()=>c.break())})})}}};e.default=s})),dz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=fe(),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(o){let{gen:n,schema:s,it:i}=o;if((0,t.alwaysValidSchema)(i,s)){o.fail();return}let c=n.name("valid");o.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},c),o.failResult(c,()=>o.reset(),()=>o.error())},error:{message:"must NOT be valid"}};e.default=r})),pz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:lt().validateUnion,error:{message:"must match a schema in anyOf"}};e.default=t})),mz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ue(),r=fe(),o={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:n})=>(0,t._)`{passingSchemas: ${n.passing}}`},code(n){let{gen:s,schema:i,parentSchema:c,it:a}=n;if(!Array.isArray(i))throw new Error("ajv implementation error");if(a.opts.discriminator&&c.discriminator)return;let u=i,l=s.let("valid",!1),p=s.let("passing",null),f=s.name("_valid");n.setParams({passing:p}),s.block(z),n.result(l,()=>n.reset(),()=>n.error(!0));function z(){u.forEach((m,_)=>{let g;(0,r.alwaysValidSchema)(a,m)?s.var(f,!0):g=n.subschema({keyword:"oneOf",schemaProp:_,compositeRule:!0},f),_>0&&s.if((0,t._)`${f} && ${l}`).assign(l,!1).assign(p,(0,t._)`[${p}, ${_}]`).else(),s.if(f,()=>{s.assign(l,!0),s.assign(p,_),g&&n.mergeEvaluated(g,t.Name)})})}}};e.default=o})),hz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=fe(),r={keyword:"allOf",schemaType:"array",code(o){let{gen:n,schema:s,it:i}=o;if(!Array.isArray(s))throw new Error("ajv implementation error");let c=n.name("valid");s.forEach((a,u)=>{if((0,t.alwaysValidSchema)(i,a))return;let l=o.subschema({keyword:"allOf",schemaProp:u},c);o.ok(c),o.mergeEvaluated(l)})}};e.default=r})),fz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ue(),r=fe(),o={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:s})=>(0,t.str)`must match "${s.ifClause}" schema`,params:({params:s})=>(0,t._)`{failingKeyword: ${s.ifClause}}`},code(s){let{gen:i,parentSchema:c,it:a}=s;c.then===void 0&&c.else===void 0&&(0,r.checkStrictMode)(a,'"if" without "then" and "else" is ignored');let u=n(a,"then"),l=n(a,"else");if(!u&&!l)return;let p=i.let("valid",!0),f=i.name("_valid");if(z(),s.reset(),u&&l){let _=i.let("ifClause");s.setParams({ifClause:_}),i.if(f,m("then",_),m("else",_))}else u?i.if(f,m("then")):i.if((0,t.not)(f),m("else"));s.pass(p,()=>s.error(!0));function z(){let _=s.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},f);s.mergeEvaluated(_)}function m(_,g){return()=>{let h=s.subschema({keyword:_},f);i.assign(p,f),s.mergeValidEvaluated(h,p),g?i.assign(g,(0,t._)`${_}`):s.setParams({ifClause:_})}}}};function n(s,i){let c=s.schema[i];return c!==void 0&&!(0,r.alwaysValidSchema)(s,c)}e.default=o})),gz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=fe(),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:o,parentSchema:n,it:s}){n.if===void 0&&(0,t.checkStrictMode)(s,`"${o}" without "if" is ignored`)}};e.default=r})),fg=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=pg(),r=sz(),o=mg(),n=iz(),s=az(),i=bl(),c=cz(),a=hg(),u=uz(),l=lz(),p=dz(),f=pz(),z=mz(),m=hz(),_=fz(),g=gz();function h(v=!1){let S=[p.default,f.default,z.default,m.default,_.default,g.default,c.default,a.default,i.default,u.default,l.default];return v?S.push(r.default,n.default):S.push(t.default,o.default),S.push(s.default),S}e.default=h})),_z=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ue(),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:o})=>(0,t.str)`must match format "${o}"`,params:({schemaCode:o})=>(0,t._)`{format: ${o}}`},code(o,n){let{gen:s,data:i,$data:c,schema:a,schemaCode:u,it:l}=o,{opts:p,errSchemaPath:f,schemaEnv:z,self:m}=l;if(!p.validateFormats)return;c?_():g();function _(){let h=s.scopeValue("formats",{ref:m.formats,code:p.code.formats}),v=s.const("fDef",(0,t._)`${h}[${u}]`),S=s.let("fType"),w=s.let("format");s.if((0,t._)`typeof ${v} == "object" && !(${v} instanceof RegExp)`,()=>s.assign(S,(0,t._)`${v}.type || "string"`).assign(w,(0,t._)`${v}.validate`),()=>s.assign(S,(0,t._)`"string"`).assign(w,v)),o.fail$data((0,t.or)(R(),b()));function R(){return p.strictSchema===!1?t.nil:(0,t._)`${u} && !${w}`}function b(){let y=z.$async?(0,t._)`(${v}.async ? await ${w}(${i}) : ${w}(${i}))`:(0,t._)`${w}(${i})`,P=(0,t._)`(typeof ${w} == "function" ? ${y} : ${w}.test(${i}))`;return(0,t._)`${w} && ${w} !== true && ${S} === ${n} && !${P}`}}function g(){let h=m.formats[a];if(!h){R();return}if(h===!0)return;let[v,S,w]=b(h);v===n&&o.pass(y());function R(){if(p.strictSchema===!1){m.logger.warn(P());return}throw new Error(P());function P(){return`unknown format "${a}" ignored in schema at path "${f}"`}}function b(P){let N=P instanceof RegExp?(0,t.regexpCode)(P):p.code.formats?(0,t._)`${p.code.formats}${(0,t.getProperty)(a)}`:void 0,F=s.scopeValue("formats",{key:a,ref:P,code:N});return typeof P=="object"&&!(P instanceof RegExp)?[P.type||"string",P.validate,(0,t._)`${F}.validate`]:["string",P,F]}function y(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!z.$async)throw new Error("async format in sync schema");return(0,t._)`await ${w}(${i})`}return typeof S=="function"?(0,t._)`${w}(${i})`:(0,t._)`${w}.test(${i})`}}}};e.default=r})),gg=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=[_z().default];e.default=t})),_g=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]})),yg=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=lg(),r=dg(),o=fg(),n=gg(),s=_g(),i=[t.default,r.default,(0,o.default)(),n.default,s.metadataVocabulary,s.contentVocabulary];e.default=i})),yz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(r){r.Tag="tag",r.Mapping="mapping"})(t||(e.DiscrError=t={}))})),zl=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ue(),r=yz(),o=La(),n=Kr(),s=fe(),i={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:c,tagName:a}})=>c===r.DiscrError.Tag?`tag "${a}" must be string`:`value of tag "${a}" must be in oneOf`,params:({params:{discrError:c,tag:a,tagName:u}})=>(0,t._)`{error: ${c}, tag: ${u}, tagValue: ${a}}`},code(c){let{gen:a,data:u,schema:l,parentSchema:p,it:f}=c,{oneOf:z}=p;if(!f.opts.discriminator)throw new Error("discriminator: requires discriminator option");let m=l.propertyName;if(typeof m!="string")throw new Error("discriminator: requires propertyName");if(l.mapping)throw new Error("discriminator: mapping is not supported");if(!z)throw new Error("discriminator: requires oneOf keyword");let _=a.let("valid",!1),g=a.const("tag",(0,t._)`${u}${(0,t.getProperty)(m)}`);a.if((0,t._)`typeof ${g} == "string"`,()=>h(),()=>c.error(!1,{discrError:r.DiscrError.Tag,tag:g,tagName:m})),c.ok(_);function h(){let w=S();a.if(!1);for(let R in w)a.elseIf((0,t._)`${g} === ${R}`),a.assign(_,v(w[R]));a.else(),c.error(!1,{discrError:r.DiscrError.Mapping,tag:g,tagName:m}),a.endIf()}function v(w){let R=a.name("valid"),b=c.subschema({keyword:"oneOf",schemaProp:w},R);return c.mergeEvaluated(b,t.Name),R}function S(){var w;let R={},b=P(p),y=!0;for(let M=0;M<z.length;M++){let U=z[M];if(U?.$ref&&!(0,s.schemaHasRulesButRef)(U,f.self.RULES)){let B=U.$ref;if(U=o.resolveRef.call(f.self,f.schemaEnv.root,f.baseId,B),U instanceof o.SchemaEnv&&(U=U.schema),U===void 0)throw new n.default(f.opts.uriResolver,f.baseId,B)}let K=(w=U?.properties)===null||w===void 0?void 0:w[m];if(typeof K!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${m}"`);y=y&&(b||P(U)),N(K,M)}if(!y)throw new Error(`discriminator: "${m}" must be required`);return R;function P({required:M}){return Array.isArray(M)&&M.includes(m)}function N(M,U){if(M.const)F(M.const,U);else if(M.enum)for(let K of M.enum)F(K,U);else throw new Error(`discriminator: "properties/${m}" must have "const" or "enum"`)}function F(M,U){if(typeof M!="string"||M in R)throw new Error(`discriminator: "${m}" values must be unique strings`);R[M]=U}}}};e.default=i})),Sz=D(((e,t)=>{t.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}})),Sg=D(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let r=yl(),o=yg(),n=zl(),s=Sz(),i=["/properties"],c="http://json-schema.org/draft-07/schema";var a=class extends r.default{_addVocabularies(){super._addVocabularies(),o.default.forEach(z=>this.addVocabulary(z)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let z=this.opts.$data?this.$dataMetaSchema(s,i):s;this.addMetaSchema(z,c,!1),this.refs["http://json-schema.org/schema"]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}};e.Ajv=a,t.exports=e=a,t.exports.Ajv=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var u=Br();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var l=ue();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var p=kn();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return p.default}});var f=Kr();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return f.default}})})),vg=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=ue(),r=ut(),o=La(),n=Sl(),s={keyword:"$dynamicAnchor",schemaType:"string",code:a=>i(a,a.schema)};function i(a,u){let{gen:l,it:p}=a;p.schemaEnv.root.dynamicAnchors[u]=!0;let f=(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(u)}`,z=p.errSchemaPath==="#"?p.validateName:c(a);l.if((0,t._)`!${f}`,()=>l.assign(f,z))}e.dynamicAnchor=i;function c(a){let{schemaEnv:u,schema:l,self:p}=a.it,{root:f,baseId:z,localRefs:m,meta:_}=u.root,{schemaId:g}=p.opts,h=new o.SchemaEnv({schema:l,schemaId:g,root:f,baseId:z,localRefs:m,meta:_});return o.compileSchema.call(p,h),(0,n.getValidate)(a,h)}e.default=s})),bg=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=ue(),r=ut(),o=Sl(),n={keyword:"$dynamicRef",schemaType:"string",code:i=>s(i,i.schema)};function s(i,c){let{gen:a,keyword:u,it:l}=i;if(c[0]!=="#")throw new Error(`"${u}" only supports hash fragment reference`);let p=c.slice(1);if(l.allErrors)f();else{let m=a.let("valid",!1);f(m),i.ok(m)}function f(m){if(l.schemaEnv.root.dynamicAnchors[p]){let _=a.let("_v",(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(p)}`);a.if(_,z(_,m),z(l.validateName,m))}else z(l.validateName,m)()}function z(m,_){return _?()=>a.block(()=>{(0,o.callRef)(i,m),a.let(_,!0)}):()=>(0,o.callRef)(i,m)}}e.dynamicRef=s,e.default=n})),vz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=vg(),r=fe(),o={keyword:"$recursiveAnchor",schemaType:"boolean",code(n){n.schema?(0,t.dynamicAnchor)(n,""):(0,r.checkStrictMode)(n.it,"$recursiveAnchor: false is ignored")}};e.default=o})),bz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=bg(),r={keyword:"$recursiveRef",schemaType:"string",code:o=>(0,t.dynamicRef)(o,o.schema)};e.default=r})),zg=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=vg(),r=bg(),o=vz(),n=bz(),s=[t.default,r.default,o.default,n.default];e.default=s})),zz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=bl(),r={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:o=>(0,t.validatePropertyDeps)(o)};e.default=r})),wz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=bl(),r={keyword:"dependentSchemas",type:"object",schemaType:"object",code:o=>(0,t.validateSchemaDeps)(o)};e.default=r})),$z=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=fe(),r={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:o,parentSchema:n,it:s}){n.contains===void 0&&(0,t.checkStrictMode)(s,`"${o}" without "contains" is ignored`)}};e.default=r})),wg=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=zz(),r=wz(),o=$z(),n=[t.default,r.default,o.default];e.default=n})),Rz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ue(),r=fe(),o=ut(),n={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:s})=>(0,t._)`{unevaluatedProperty: ${s.unevaluatedProperty}}`},code(s){let{gen:i,schema:c,data:a,errsCount:u,it:l}=s;if(!u)throw new Error("ajv implementation error");let{allErrors:p,props:f}=l;f instanceof t.Name?i.if((0,t._)`${f} !== true`,()=>i.forIn("key",a,g=>i.if(m(f,g),()=>z(g)))):f!==!0&&i.forIn("key",a,g=>f===void 0?z(g):i.if(_(f,g),()=>z(g))),l.props=!0,s.ok((0,t._)`${u} === ${o.default.errors}`);function z(g){if(c===!1){s.setParams({unevaluatedProperty:g}),s.error(),p||i.break();return}if(!(0,r.alwaysValidSchema)(l,c)){let h=i.name("valid");s.subschema({keyword:"unevaluatedProperties",dataProp:g,dataPropType:r.Type.Str},h),p||i.if((0,t.not)(h),()=>i.break())}}function m(g,h){return(0,t._)`!${g} || !${g}[${h}]`}function _(g,h){let v=[];for(let S in g)g[S]===!0&&v.push((0,t._)`${h} !== ${S}`);return(0,t.and)(...v)}}};e.default=n})),Pz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ue(),r=fe(),o={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:n}})=>(0,t.str)`must NOT have more than ${n} items`,params:({params:{len:n}})=>(0,t._)`{limit: ${n}}`},code(n){let{gen:s,schema:i,data:c,it:a}=n,u=a.items||0;if(u===!0)return;let l=s.const("len",(0,t._)`${c}.length`);if(i===!1)n.setParams({len:u}),n.fail((0,t._)`${l} > ${u}`);else if(typeof i=="object"&&!(0,r.alwaysValidSchema)(a,i)){let f=s.var("valid",(0,t._)`${l} <= ${u}`);s.if((0,t.not)(f),()=>p(f,u)),n.ok(f)}a.items=!0;function p(f,z){s.forRange("i",z,l,m=>{n.subschema({keyword:"unevaluatedItems",dataProp:m,dataPropType:r.Type.Num},f),a.allErrors||s.if((0,t.not)(f),()=>s.break())})}}};e.default=o})),$g=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Rz(),r=Pz(),o=[t.default,r.default];e.default=o})),Ez=D(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}})),Tz=D(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}})),kz=D(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}})),Cz=D(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}})),Oz=D(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}})),Iz=D(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}})),xz=D(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}})),Nz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ez(),r=Tz(),o=kz(),n=Cz(),s=Oz(),i=Iz(),c=xz(),a=["/properties"];function u(l){return[t,r,o,n,p(this,s),i,p(this,c)].forEach(f=>this.addMetaSchema(f,void 0,!1)),this;function p(f,z){return l?f.$dataMetaSchema(z,a):z}}e.default=u})),jz=D(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2019=void 0;let r=yl(),o=yg(),n=zg(),s=wg(),i=$g(),c=zl(),a=Nz(),u="https://json-schema.org/draft/2019-09/schema";var l=class extends r.default{constructor(_={}){super({..._,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(n.default),o.default.forEach(_=>this.addVocabulary(_)),this.addVocabulary(s.default),this.addVocabulary(i.default),this.opts.discriminator&&this.addKeyword(c.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:_,meta:g}=this.opts;g&&(a.default.call(this,_),this.refs["http://json-schema.org/schema"]=u)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(u)?u:void 0)}};e.Ajv2019=l,t.exports=e=l,t.exports.Ajv2019=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var p=Br();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return p.KeywordCxt}});var f=ue();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return f._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return f.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return f.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return f.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return f.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return f.CodeGen}});var z=kn();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return z.default}});var m=Kr();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return m.default}})})),Az=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=lg(),r=dg(),o=fg(),n=zg(),s=wg(),i=$g(),c=gg(),a=_g(),u=[n.default,t.default,r.default,(0,o.default)(!0),c.default,a.metadataVocabulary,a.contentVocabulary,s.default,i.default];e.default=u})),qz=D(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}})),Mz=D(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}})),Lz=D(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}})),Uz=D(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}})),Dz=D(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}})),Zz=D(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}})),Vz=D(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}})),Fz=D(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}})),Hz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=qz(),r=Mz(),o=Lz(),n=Uz(),s=Dz(),i=Zz(),c=Vz(),a=Fz(),u=["/properties"];function l(p){return[t,r,o,n,s,f(this,i),c,f(this,a)].forEach(z=>this.addMetaSchema(z,void 0,!1)),this;function f(z,m){return p?z.$dataMetaSchema(m,u):m}}e.default=l})),Jz=D(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;let r=yl(),o=Az(),n=zl(),s=Hz(),i="https://json-schema.org/draft/2020-12/schema";var c=class extends r.default{constructor(f={}){super({...f,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),o.default.forEach(f=>this.addVocabulary(f)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:f,meta:z}=this.opts;z&&(s.default.call(this,f),this.refs["http://json-schema.org/schema"]=i)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}};e.Ajv2020=c,t.exports=e=c,t.exports.Ajv2020=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var a=Br();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return a.KeywordCxt}});var u=ue();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var l=kn();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return l.default}});var p=Kr();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})})),Bz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(M,U){return{validate:M,compare:U}}e.fullFormats={date:t(s,i),time:t(a(!0),u),"date-time":t(f(!0),z),"iso-time":t(a(),l),"iso-date-time":t(f(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:h,"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:F,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:S,int32:{type:"number",validate:b},int64:{type:"number",validate:y},float:{type:"number",validate:P},double:{type:"number",validate:P},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,i),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,z),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,l),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function r(M){return M%4===0&&(M%100!==0||M%400===0)}let o=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,n=[0,31,28,31,30,31,30,31,31,30,31,30,31];function s(M){let U=o.exec(M);if(!U)return!1;let K=+U[1],B=+U[2],me=+U[3];return B>=1&&B<=12&&me>=1&&me<=(B===2&&r(K)?29:n[B])}function i(M,U){if(M&&U)return M>U?1:M<U?-1:0}let c=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function a(M){return function(K){let B=c.exec(K);if(!B)return!1;let me=+B[1],$e=+B[2],be=+B[3],Ie=B[4],he=B[5]==="-"?-1:1,C=+(B[6]||0),j=+(B[7]||0);if(C>23||j>59||M&&!Ie)return!1;if(me<=23&&$e<=59&&be<60)return!0;let Z=$e-j*he,$=me-C*he-(Z<0?1:0);return($===23||$===-1)&&(Z===59||Z===-1)&&be<61}}function u(M,U){if(!(M&&U))return;let K=new Date("2020-01-01T"+M).valueOf(),B=new Date("2020-01-01T"+U).valueOf();if(K&&B)return K-B}function l(M,U){if(!(M&&U))return;let K=c.exec(M),B=c.exec(U);if(K&&B)return M=K[1]+K[2]+K[3],U=B[1]+B[2]+B[3],M>U?1:M<U?-1:0}let p=/t|\s/i;function f(M){let U=a(M);return function(B){let me=B.split(p);return me.length===2&&s(me[0])&&U(me[1])}}function z(M,U){if(!(M&&U))return;let K=new Date(M).valueOf(),B=new Date(U).valueOf();if(K&&B)return K-B}function m(M,U){if(!(M&&U))return;let[K,B]=M.split(p),[me,$e]=U.split(p),be=i(K,me);if(be!==void 0)return be||u(B,$e)}let _=/\/|:/,g=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function h(M){return _.test(M)&&g.test(M)}let v=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function S(M){return v.lastIndex=0,v.test(M)}let w=-(2**31),R=2**31-1;function b(M){return Number.isInteger(M)&&M<=R&&M>=w}function y(M){return Number.isInteger(M)}function P(){return!0}let N=/[^\\]\\Z/;function F(M){if(N.test(M))return!1;try{return new RegExp(M),!0}catch{return!1}}})),Kz=D((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=Sg(),r=ue(),o=r.operators,n={formatMaximum:{okStr:"<=",ok:o.LTE,fail:o.GT},formatMinimum:{okStr:">=",ok:o.GTE,fail:o.LT},formatExclusiveMaximum:{okStr:"<",ok:o.LT,fail:o.GTE},formatExclusiveMinimum:{okStr:">",ok:o.GT,fail:o.LTE}},s={message:({keyword:c,schemaCode:a})=>(0,r.str)`should be ${n[c].okStr} ${a}`,params:({keyword:c,schemaCode:a})=>(0,r._)`{comparison: ${n[c].okStr}, limit: ${a}}`};e.formatLimitDefinition={keyword:Object.keys(n),type:"string",schemaType:"string",$data:!0,error:s,code(c){let{gen:a,data:u,schemaCode:l,keyword:p,it:f}=c,{opts:z,self:m}=f;if(!z.validateFormats)return;let _=new t.KeywordCxt(f,m.RULES.all.format.definition,"format");_.$data?g():h();function g(){let S=a.scopeValue("formats",{ref:m.formats,code:z.code.formats}),w=a.const("fmt",(0,r._)`${S}[${_.schemaCode}]`);c.fail$data((0,r.or)((0,r._)`typeof ${w} != "object"`,(0,r._)`${w} instanceof RegExp`,(0,r._)`typeof ${w}.compare != "function"`,v(w)))}function h(){let S=_.schema,w=m.formats[S];if(!w||w===!0)return;if(typeof w!="object"||w instanceof RegExp||typeof w.compare!="function")throw new Error(`"${p}": format "${S}" does not define "compare" function`);let R=a.scopeValue("formats",{key:S,ref:w,code:z.code.formats?(0,r._)`${z.code.formats}${(0,r.getProperty)(S)}`:void 0});c.fail$data(v(R))}function v(S){return(0,r._)`${S}.compare(${u}, ${l}) ${n[p].fail} 0`}},dependencies:["format"]};let i=c=>(c.addKeyword(e.formatLimitDefinition),c);e.default=i})),Gz=D(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=Bz(),o=Kz(),n=ue(),s=new n.Name("fullFormats"),i=new n.Name("fastFormats"),c=(u,l={keywords:!0})=>{if(Array.isArray(l))return a(u,l,r.fullFormats,s),u;let[p,f]=l.mode==="fast"?[r.fastFormats,i]:[r.fullFormats,s];return a(u,l.formats||r.formatNames,p,f),l.keywords&&(0,o.default)(u),u};c.get=(u,l="full")=>{let p=(l==="fast"?r.fastFormats:r.fullFormats)[u];if(!p)throw new Error(`Unknown format "${u}"`);return p};function a(u,l,p,f){var z,m;(z=(m=u.opts.code).formats)!==null&&z!==void 0||(m.formats=(0,n._)`require("ajv-formats/dist/formats").${f}`);for(let _ of l)u.addFormat(_,p[_])}t.exports=e=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c})),Rg=Sg(),Wz=jz(),Yz=Jz(),Xz=Yn(Gz(),1),Qz=Xz.default;function _l(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Qz(t),t}var wl=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=e!==void 0,this._ajv=e}get ajv(){return this._ajv??=_l(Yz.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=Fl(e,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");return t==="2020-12"?this.ajv:t==="2019-09"?this._ajv2019??=_l(Wz.Ajv2019):this._ajvDraft7??=_l(Rg.Ajv)}getValidator(e){let t=this._engineFor(e),r="$id"in e&&typeof e.$id=="string"?t.getSchema(e.$id)??t.compile(e):t.compile(e);return o=>r(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:t.errorsText(r.errors)}}},VR=Rg.Ajv;var e0;e0=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(e=>e.webcrypto);var Cn=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](e){return rt(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return rt(this,e)}constructor(e){super(e),this.name=new.target.name,ur(this,new.target)}},nE=class extends Cn{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(e,t,r){super(`Issuer mismatch in ${e==="metadata"?"authorization server metadata (RFC 8414 \xA73.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(t)}, received ${JSON.stringify(r)}`),this.kind=e,this.expected=t,this.received=r}},sE=class extends Cn{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.RegistrationRejectedError"})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`),this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},iE=class extends Cn{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsecureTokenEndpointError"})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},aE=class extends Cn{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.AuthorizationServerMismatchError"})}constructor(e,t){super(`Authorization server changed between redirect and callback (redirected to ${JSON.stringify(e)}, callback resolved ${JSON.stringify(t)}); refusing to send authorization_code/code_verifier to a different token endpoint`),this.recordedIssuer=e,this.currentIssuer=t}},cE=class extends Cn{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsufficientScopeError"})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:""}`),this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}};var t0=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](e){return rt(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return rt(this,e)}constructor(e){super(e??"Unauthorized"),this.name="UnauthorizedError",ur(this,new.target)}};var Ua=new Set(["tools/list","prompts/list","resources/list","resources/templates/list","server/discover"]),r0=class{_entries=new Map;_maxEntries;_stamp=0;_cappedSize=0;constructor(e){this._maxEntries=e?.maxEntries??512}get size(){return this._entries.size}get(e){return this._entries.get($l(e))}set(e,t){let r=$l(e),o=Ua.has(e.method),n=!this._entries.has(r);if(!o&&n&&this._maxEntries>0&&this._cappedSize>=this._maxEntries){for(let i of this._entries.keys())if(!Ua.has(i.slice(0,i.indexOf("\0")))){this._entries.delete(i),this._cappedSize--;break}}let s=++this._stamp;return this._entries.set(r,{...t,stamp:s}),n&&!o&&this._cappedSize++,s}delete(e){this._entries.delete($l(e))&&!Ua.has(e.method)&&this._cappedSize--}evict(e){let t=`${e}\0`,r=Ua.has(e);for(let o of this._entries.keys())o.startsWith(t)&&(this._entries.delete(o),r||this._cappedSize--)}clear(){this._entries.clear(),this._cappedSize=0}};function $l(e){return`${e.method}\0${JSON.stringify([e.partition??"",e.params??""])}`}function Rl(e,t){return t===void 0?e:`${e}\0${t}`}var o0=864e5,n0=class{_evictionGeneration=new Map;_toolIndex;_toolOutputValidatorIndex;_serverIdentity="";constructor(e,t,r=()=>{},o="",n=Date.now){this._store=e,this._isUserSupplied=t,this._reportError=r,this._cachePartition=o,this._now=n}now(){return this._now()}setServerIdentity(e){this._serverIdentity=e}_partitionFor(e){return JSON.stringify([this._serverIdentity,e==="public"?"":this._cachePartition])}async _probe(e,t){let r={method:e,params:t??""},o=this._partitionFor("private"),n=await this._store.get({...r,partition:o});if(n!==void 0)return n;let s=this._partitionFor("public");if(s===o)return;let i=await this._store.get({...r,partition:s});return i?.scope==="public"?i:void 0}async evict(e){this._evictionGeneration.set(e,(this._evictionGeneration.get(e)??0)+1),await this._deleteBoth(e,"")}async _deleteBoth(e,t){let r=this._partitionFor("private"),o=this._partitionFor("public");try{await this._store.delete({method:e,params:t,partition:r})}catch(n){this._reportError(n)}if(o!==r)try{await this._store.delete({method:e,params:t,partition:o})}catch(n){this._reportError(n)}}async evictKey(e,t){let r=Rl(e,t),o=this._evictionGeneration.get(r);o!==void 0&&this._evictionGeneration.set(r,o+1),await this._deleteBoth(e,t)}captureGeneration(e,t){let r=Rl(e,t),o=this._evictionGeneration.get(r)??0;return this._evictionGeneration.set(r,o),o}async write(e,t,r,o){if((this._evictionGeneration.get(Rl(e,o?.params))??0)!==r)return;let n=o?.params??"",s=this._partitionFor("private"),i=this._partitionFor("public"),c=(o?.scope??"private")==="public"?i:s;try{await this._store.set({method:e,params:n,partition:c},{value:s0(t),expiresAt:o?.expiresAt,scope:o?.scope})}catch(a){this._reportError(a)}if(i!==s)try{await this._store.delete({method:e,params:n,partition:c===s?i:s})}catch(a){this._reportError(a)}}async read(e,t){let r=await this._probe(e,t);if(!(r?.expiresAt===void 0||!(r.expiresAt>this.now())))try{let o=JSON.parse(r.value);if(typeof o!="object"||o===null||Array.isArray(o))throw new TypeError("cached document is not an object");return{value:o}}catch(o){this._reportError(o),await this._deleteBoth(e,t??"");return}}resetForReconnect(){this._isUserSupplied||this._store.clear(),this._evictionGeneration.clear(),this._toolIndex=void 0,this._toolOutputValidatorIndex=void 0,this._serverIdentity=""}async toolDefinition(e){let t=await this._probe("tools/list");if(t===void 0){this._toolIndex=void 0;return}if(this._toolIndex?.stamp!==t.stamp){let r=this._decodeListTools(t),o=new Map;if(r!==void 0)for(let n of r.tools)o.set(n.name,n);this._toolIndex={stamp:t.stamp,byName:o}}return this._toolIndex.byName.get(e)}async outputValidator(e,t){let r=await this._probe("tools/list");if(r===void 0){this._toolOutputValidatorIndex=void 0;return}if(this._toolOutputValidatorIndex?.stamp!==r.stamp){let o=this._decodeListTools(r)??{tools:[]},n=new Map;for(let s of o.tools){let i=t(s);i!==void 0&&n.set(s.name,i)}this._toolOutputValidatorIndex={stamp:r.stamp,byName:n}}return this._toolOutputValidatorIndex.byName.get(e)}_decodeListTools(e){try{let t=JSON.parse(e.value);if(!Array.isArray(t?.tools)||!t.tools.every(r=>r!==null&&typeof r=="object"))throw new TypeError("cached tools/list document has a malformed tools array");return t}catch(t){this._reportError(t);return}}};function s0(e){let t;try{t=JSON.stringify(e)}catch(r){throw new TypeError(`cache value is not JSON-serializable: ${r instanceof Error?r.message:String(r)}`)}if(typeof t!="string")throw new TypeError("cache value is not JSON-serializable: it has no JSON representation");return t}var i0=Symbol.for("mcp.authSeamEscape");function a0(e){return(typeof e=="object"&&e!==null||typeof e=="function")&&e[i0]===!0}var c0=-32022,u0=new Set([-32001,-32020,-32021]);function l0(e,t){switch(e.kind){case"result":return d0(e.result,t);case"rpc-error":return xg(e,t);case"http-error":return p0(e,t);case"network-error":return Pg(e.error,t);case"auth-required":return{kind:"error",error:e.error};case"closed":return t.transportKind==="stdio"?{kind:"legacy"}:Pg(new Error("Connection closed during the version negotiation probe"),t);case"timeout":return t.transportKind==="stdio"?{kind:"legacy"}:{kind:"error",error:new Y(X.RequestTimeout,`Version negotiation probe timed out after ${e.timeoutMs}ms`,{timeout:e.timeoutMs})}}}function d0(e,t){let r=$t(Ca).validateResult("server/discover",e);if(!r.ok)return{kind:"legacy"};let o=r.value.supportedVersions,n=t.clientModernVersions.find(s=>o.includes(s));return n!==void 0?{kind:"modern",version:n,discover:r.value}:t.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:new ka({supported:[...o],requested:t.requestedVersion})}}function xg(e,t){let{code:r,message:o,data:n}=e;if(r===c0){let s=f0(n);if(s===void 0)return{kind:"legacy"};let i=new ka({supported:s,requested:g0(n)??t.requestedVersion},o),c=Tn(s),a=t.clientModernVersions.find(u=>c.includes(u));return a!==void 0?{kind:"corrective",version:a,error:i}:c.length>0?{kind:"error",error:i}:t.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:i}}return u0.has(r)?{kind:"legacy"}:{kind:"legacy"}}function p0(e,t){if(e.status===401||e.status===403){let o=e.status===403;return{kind:"error",error:new Ta(o?X.ClientHttpForbidden:X.ClientHttpAuthentication,`Version negotiation failed: ${o?"the server denied access (HTTP 403)":"the server requires authorization (HTTP 401)"}`,{status:e.status,statusText:e.statusText,text:e.body})}}if(e.status>=500)return{kind:"error",error:new Ta(X.EraNegotiationFailed,`Version negotiation failed: the server answered the probe with HTTP ${e.status}`,{status:e.status,statusText:e.statusText,text:e.body})};let r=_0(e.body);return r!==void 0?xg(r,t):{kind:"legacy"}}function Pg(e,t){return t.environment==="browser"&&m0(e)?{kind:"legacy"}:{kind:"error",error:new Y(X.EraNegotiationFailed,`Version negotiation probe failed: ${h0(e)}`,{cause:e})}}function m0(e){return e instanceof TypeError||e instanceof Error&&e.name==="TypeError"}function h0(e){return e instanceof Error?e.message:String(e)}function f0(e){if(typeof e!="object"||e===null)return;let t=e.supported;if(!(!Array.isArray(t)||t.length===0||!t.every(r=>typeof r=="string")))return t}function g0(e){if(typeof e!="object"||e===null)return;let t=e.requested;return typeof t=="string"?t:void 0}function _0(e){if(e===void 0||e==="")return;let t;try{t=JSON.parse(e)}catch{return}if(typeof t!="object"||t===null)return;let r=t.error;if(typeof r!="object"||r===null)return;let{code:o,message:n,data:s}=r;if(typeof o=="number")return{code:o,message:typeof n=="string"?n:"",data:s}}var y0="legacy";function S0(e,t){let r=e?.mode??y0;if(r==="legacy")return{kind:"legacy"};let o=e?.probe??{};if(typeof r=="object"){if(!Zt(r.pin))throw new TypeError(`versionNegotiation: { pin: '${r.pin}' } is not a modern protocol revision \u2014 pinning is for 2026-07-28 and later; omit versionNegotiation (or use mode: 'legacy') for 2025-era servers.`);return{kind:"pin",version:r.pin,probe:o}}let n=t?Tn(t):[];return{kind:"auto",modernVersions:n.length>0?n:[...nl],fallbackAvailable:t?sl(t).length>0:!0,probe:o}}function Eg(){let e=globalThis;return e.window!==void 0&&e.document!==void 0?"browser":"node"}function Tg(e){return"stderr"in e&&"pid"in e?"stdio":"http"}var v0=class Ng{_pending;_probeCounter=0;_savedOnMessage;_savedOnError;_savedOnClose;_closeDelivered=!1;constructor(t){this._transport=t,this._savedOnMessage=t.onmessage,this._savedOnError=t.onerror,this._savedOnClose=t.onclose}static async open(t){let r=new Ng(t);t.onmessage=o=>{let n=r._pending;if(n!==void 0&&(Pn(o)||Oa(o))&&o.id===n.id){r._pending=void 0,Pn(o)?n.resolve({kind:"response",result:o.result}):n.resolve({kind:"response",error:o.error});return}},t.onerror=o=>{r._savedOnError?.(o)},t.onclose=()=>{let o=r._pending;o!==void 0&&(r._pending=void 0,o.resolve({kind:"closed"})),r._closeDelivered=!0,r._savedOnClose?.()};try{await t.start()}catch(o){throw r.detach(),o}return r}async exchange(t,r){let o=`server-discover-probe-${++this._probeCounter}`;return new Promise(n=>{let s=!1,i=a=>{s||(s=!0,clearTimeout(c),this._pending?.id===o&&(this._pending=void 0),n(a))},c=setTimeout(()=>i({kind:"timeout"}),r);this._pending={id:o,resolve:i},this._transport.send(t(o)).catch(a=>i({kind:"send-error",error:a}))})}detach(){if(this._pending=void 0,this._transport.onmessage=this._savedOnMessage,this._transport.onerror=this._savedOnError,this._closeDelivered&&this._savedOnClose!==void 0){let t=this._savedOnClose,r=this._transport,o=!1,n=()=>{if(!o){o=!0;return}t()};r.onclose=n,Pl.set(r,()=>{r.onclose===n&&(r.onclose=t)})}else this._transport.onclose=this._savedOnClose}release(){this.detach();let t=this._transport,r=t.start,o=!0;t.start=async function(){if(o){o=!1,t.start=r;return}return r.call(t)}}},Pl=new WeakMap;function kg(e){let t=Pl.get(e);Pl.delete(e),t?.()}function b0(e,t,r,o){return{jsonrpc:"2.0",id:e,method:"server/discover",params:{_meta:$t(t).outboundEnvelope({protocolVersion:t,clientInfo:r,clientCapabilities:o})}}}function z0(e,t){switch(e.kind){case"response":return e.error===void 0?{kind:"result",result:e.result}:{kind:"rpc-error",...e.error};case"send-error":{let r=e.error;if(a0(r)||r instanceof t0||r instanceof Error&&r.name==="UnauthorizedError")return{kind:"auth-required",error:r};if(r instanceof Ta){let o=r.data?.text;return{kind:"http-error",status:r.data.status,body:typeof o=="string"?o:void 0,statusText:r.data.statusText}}return{kind:"network-error",error:r}}case"closed":return{kind:"closed"};case"timeout":return{kind:"timeout",timeoutMs:t}}}async function jg(e,t){let r=e.probe.timeoutMs??t.defaultTimeoutMs,o=Math.max(0,e.probe.maxRetries??0),n=e.kind==="pin"?[e.version]:e.modernVersions,s=e.kind==="auto"&&e.fallbackAvailable,i=await v0.open(t.transport),c=async()=>{let u=n[0],l=!1,p=o;for(;;){let f=await i.exchange(_=>b0(_,u,t.clientInfo,t.capabilities),r);if(f.kind==="timeout"&&p>0){p--;continue}let z=z0(f,r),m=l0(z,{clientModernVersions:n,requestedVersion:u,fallbackAvailable:s,environment:t.environment,transportKind:t.transportKind});switch(m.kind){case"modern":return{era:"modern",version:m.version,discover:m.discover};case"corrective":if(l)throw m.error;l=!0,u=m.version;continue;case"legacy":{let _=z.kind==="closed"?"the connection closed during the server/discover probe":void 0;if(e.kind==="pin")throw new Y(X.EraNegotiationFailed,_===void 0?`Version negotiation failed: the server did not offer pinned protocol version ${e.version} via server/discover (no fallback in pin mode)`:`Version negotiation failed: ${_} before the server offered pinned protocol version ${e.version} (no fallback in pin mode)`);if(!e.fallbackAvailable)throw new Y(X.EraNegotiationFailed,_===void 0?"Version negotiation failed: the server gave no modern evidence and this client supports no pre-2026-07-28 protocol version to fall back to":`Version negotiation failed: ${_} and this client supports no pre-2026-07-28 protocol version to fall back to`);if(_!==void 0&&t.disposableProbe!==!0)throw new Y(X.EraNegotiationFailed,`Version negotiation failed: ${_} (this transport probed in place \u2014 the disposable sibling probe requires the SDK's base StdioClientTransport)`);return{era:"legacy"}}case"error":throw m.error}}},a;try{a=await c()}catch(u){throw i.detach(),u}return i.release(),a}function w0(e){let t=Object.getPrototypeOf(e);if(t===null||!Object.prototype.hasOwnProperty.call(t,"_dispose"))return;let r=e._serverParams;return typeof r=="object"&&r!==null&&typeof r.command=="string"?r:void 0}async function $0(e,t,r,o){let n=t.constructor,s=new n({...r,stderr:"ignore"}),i=t.close,c=!1,a,u=new Promise((p,f)=>{a=()=>f(Cg())});t.close=async function(){return c=!0,a?.(),i.call(t)};let l;try{let p=jg(e,{...o,transport:s,transportKind:"stdio",disposableProbe:!0});p.catch(()=>{}),l=await Promise.race([p,u])}finally{await R0(s),t.close=i}if(c)throw Cg();return l}function Cg(){return new Y(X.EraNegotiationFailed,"Version negotiation failed: the transport was closed during the server/discover probe")}async function R0(e){try{let t=e._dispose;await(typeof t=="function"?t.call(e):e.close())}catch{}}function Og(e){let t=e._meta?.[zt];return Qf.Implementation(t)?t:void 0}function Da(e,t){if(!(!e||t===null||typeof t!="object")){if(e.type==="object"&&e.properties&&typeof e.properties=="object"){let r=t,o=e.properties;for(let n of Object.keys(o)){let s=o[n];r[n]===void 0&&Object.prototype.hasOwnProperty.call(s,"default")&&(r[n]=s.default),r[n]!==void 0&&Da(s,r[n])}}if(Array.isArray(e.anyOf))for(let r of e.anyOf)typeof r!="boolean"&&Da(r,t);if(Array.isArray(e.oneOf))for(let r of e.oneOf)typeof r!="boolean"&&Da(r,t)}}function P0(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,r=e.url!==void 0;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}function E0(e){if(typeof e=="object"&&e!==null&&(e.kind==="legacy"&&!("supportedVersions"in e)&&!("discover"in e)||e.kind==="modern"&&ar.safeParse(e.discover).success))return e;throw new Y(X.EraNegotiationFailed,"connect({ prior }): unrecognized prior \u2014 expected { kind: 'modern', discover } or { kind: 'legacy' }")}var Ig={"notifications/tools/list_changed":["tools/list"],"notifications/prompts/list_changed":["prompts/list"],"notifications/resources/list_changed":["resources/list","resources/templates/list"]},T0=64,Ag=class extends eg{_serverCapabilities;_serverVersion;_capabilities;_instructions;_jsonSchemaValidator;_cache;_defaultCacheTtlMs;_listMaxPages;_listChangedDebounceTimers=new Map;_listChangedConfig;_enforceStrictCapabilities;_versionNegotiation;_supportedProtocolVersionsOption;_inputRequiredDriverConfig;_listenState=new Map;_nextListenId=0;_autoOpenedSubscription;_discoverResult;_resetConnectionState(){if(this._negotiatedProtocolVersion=void 0,this._serverCapabilities=void 0,this._serverVersion=void 0,this._instructions=void 0,this._discoverResult=void 0,this._autoOpenedSubscription=void 0,this._listenState.size>0){let e=new Y(X.ConnectionClosed,"subscriptions/listen: client reconnected or closed; subscription state from the previous connection was reset");for(let t of this._listenState.values())t.settle({cause:"remote",error:e})}this._listenState.clear();for(let e of this._listChangedDebounceTimers.values())clearTimeout(e);this._listChangedDebounceTimers.clear(),this._cache.resetForReconnect()}async close(){try{await super.close()}finally{this._resetConnectionState()}}constructor(e,t){super(t),this._clientInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new wl,this._enforceStrictCapabilities=t?.enforceStrictCapabilities??!1,this._versionNegotiation=t?.versionNegotiation,this._supportedProtocolVersionsOption=t?.supportedProtocolVersions,this._inputRequiredDriverConfig=Gf(t?.inputRequired),this._cache=new n0(t?.responseCacheStore??new r0,t?.responseCacheStore!==void 0,r=>this._reportStoreError(r),t?.cachePartition??""),this._defaultCacheTtlMs=t?.defaultCacheTtlMs??0,this._listMaxPages=t?.listMaxPages??T0,t?.listChanged&&(this._listChangedConfig=t.listChanged)}buildContext(e,t){return e}_shouldDropInbound(e){if(this._negotiatedProtocolVersion!==void 0&&Zt(this._negotiatedProtocolVersion)&&dl(e))return"drop"}_outboundMetaEnvelope(){let e=this._negotiatedProtocolVersion;if(e!==void 0)return this._wireCodec().outboundEnvelope({protocolVersion:e,clientInfo:this._clientInfo,clientCapabilities:this._capabilities})}_resolveNonCompleteResult(e,t){return this._inputRequiredDriverConfig.autoFulfill?rg({getRequestHandler:r=>this._getRequestHandler(r),buildContext:r=>this.buildContext(r,void 0),sessionId:this.transport?.sessionId},this._inputRequiredDriverConfig,e,t):Promise.reject(new Y(X.UnsupportedResultType,`Unsupported result type 'input_required' for ${t.request.method}: multi-round-trip auto-fulfilment is not enabled on this instance \u2014 pass allowInputRequired: true to handle it manually, or enable inputRequired.autoFulfill`,{resultType:"input_required",method:t.request.method}))}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools","notifications/tools/list_changed",e.tools,async()=>(await this.listTools(void 0,{cacheMode:"refresh"})).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts","notifications/prompts/list_changed",e.prompts,async()=>(await this.listPrompts(void 0,{cacheMode:"refresh"})).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources","notifications/resources/list_changed",e.resources,async()=>(await this.listResources(void 0,{cacheMode:"refresh"})).resources)}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=tg(this._capabilities,e)}setVersionNegotiation(e){if(this.transport)throw new Error("Cannot configure version negotiation after connecting to transport");this._versionNegotiation=e}_wrapHandler(e,t){return e==="elicitation/create"?async(r,o)=>{let n=$t(this._negotiatedProtocolVersion),s=n.validateRequest("elicitation/create",r);if(!s.ok&&s.reason==="not-in-era"&&(s=n.validateInputRequest("elicitation/create",r)),!s.ok)throw new _e(s.reason==="not-in-era"?ae.InternalError:ae.InvalidParams,s.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation request: ${s.message}`);let{params:i}=s.value;i.mode=i.mode??"form";let{supportsFormMode:c,supportsUrlMode:a}=P0(this._capabilities.elicitation);if(i.mode==="form"&&!c)throw new _e(ae.InvalidParams,"Client does not support form-mode elicitation requests");if(i.mode==="url"&&!a)throw new _e(ae.InvalidParams,"Client does not support URL-mode elicitation requests");let u=await t(r,o),l=n.validateResult("elicitation/create",u);if(!l.ok&&l.reason==="not-in-era"&&(l=n.validateInputResponse("elicitation/create",u)),!l.ok)throw new _e(l.reason==="not-in-era"?ae.InternalError:ae.InvalidParams,l.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation result: ${l.message}`);let p=l.value,f=i.mode==="form"?i.requestedSchema:void 0;if(i.mode==="form"&&p.action==="accept"&&p.content&&f&&this._capabilities.elicitation?.form?.applyDefaults)try{Da(f,p.content)}catch{}return p}:e==="sampling/createMessage"?async(r,o)=>{let n=$t(this._negotiatedProtocolVersion),s=n.validateRequest("sampling/createMessage",r);if(!s.ok&&s.reason==="not-in-era"&&(s=n.validateInputRequest("sampling/createMessage",r)),!s.ok)throw new _e(s.reason==="not-in-era"?ae.InternalError:ae.InvalidParams,s.reason==="not-in-era"?"No wire schema for sampling/createMessage in the resolved era":`Invalid sampling request: ${s.message}`);let{params:i}=s.value,c=await t(r,o),a=!!(i.tools||i.toolChoice),u=n.samplingResultVariant(a,c);if(!u.ok&&u.reason==="not-in-era"&&(u=n.validateInputResponse("sampling/createMessage",c)),!u.ok)throw new _e(u.reason==="not-in-era"?ae.InternalError:ae.InvalidParams,u.reason==="not-in-era"?"No result schema for sampling/createMessage in the resolved era":`Invalid sampling result: ${u.message}`);return u.value}:t}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new Y(X.CapabilityNotSupported,`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(t?.prior!=null)return this._connectFromPrior(e,E0(t.prior),t);let r=S0(this._versionNegotiation,this._supportedProtocolVersionsOption);return r.kind!=="legacy"?this._connectNegotiated(e,r,t):this._connectPlainLegacy(e,t)}async _connectPlainLegacy(e,t){if(await super.connect(e),e.sessionId!==void 0){let r=this._negotiatedProtocolVersion;r!==void 0&&e.setProtocolVersion?.(r);return}this._resetConnectionState(),await this._legacyHandshake(e,t)}async _legacyHandshake(e,t){let r=sl(this._supportedProtocolVersions);try{let o=r[0];if(o===void 0)throw new Y(X.EraNegotiationFailed,"Cannot run the initialize handshake: supportedProtocolVersions contains no pre-2026-07-28 protocol version");let n=await this.request({method:"initialize",params:{protocolVersion:o,capabilities:this._capabilities,clientInfo:this._clientInfo}},t);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!r.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,this._cache.setServerIdentity(this._deriveServerIdentity(e)),e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"}),this._negotiatedProtocolVersion=n.protocolVersion,this._listChangedConfig&&this._setupListChangedHandlers(this._listChangedConfig)}catch(o){throw this.close(),o}}async _connectNegotiated(e,t,r){if(e.sessionId!==void 0){await super.connect(e);let n=this._negotiatedProtocolVersion;n!==void 0&&e.setProtocolVersion&&e.setProtocolVersion(n);return}this._resetConnectionState();let o;try{let n=Tg(e),s={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:Eg(),defaultTimeoutMs:r?.timeout??xa},i=n==="stdio"?w0(e):void 0;o=i===void 0?await jg(t,{...s,transport:e,transportKind:n}):await $0(t,e,i,s)}catch(n){throw await e.close().catch(()=>{}),kg(e),n}if(kg(e),await super.connect(e),o.era==="legacy"){await this._legacyHandshake(e,r);return}if(this._serverCapabilities=o.discover.capabilities,this._serverVersion=Og(o.discover),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=o.discover.instructions,this._discoverResult=o.discover,this._negotiatedProtocolVersion=o.version,e.setProtocolVersion&&e.setProtocolVersion(o.version),this._listChangedConfig){let n=this._listChangedConfig,s=this._serverCapabilities,i={...n.tools&&s?.tools?.listChanged&&{tools:n.tools},...n.prompts&&s?.prompts?.listChanged&&{prompts:n.prompts},...n.resources&&s?.resources?.listChanged&&{resources:n.resources}},c=!0;try{this._setupListChangedHandlers(i)}catch(u){c=!1,this.onerror?.(u instanceof Error?u:new Error(String(u)))}let a=c?{...i.tools&&{toolsListChanged:!0},...i.prompts&&{promptsListChanged:!0},...i.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(a).length>0){let u=new AbortController,l=()=>u.abort(r?.signal?.reason);r?.signal?.aborted&&l(),r?.signal?.addEventListener("abort",l);try{this._autoOpenedSubscription=await this.listen(a,{timeout:r?.timeout,signal:u.signal})}catch(p){if(r?.signal?.aborted)throw await this.close().catch(()=>{}),p;this.onerror?.(p instanceof Error?p:new Error(String(p)))}finally{r?.signal?.removeEventListener("abort",l)}}}}async _connectFromPrior(e,t,r){if(t.kind==="legacy")return this._connectPlainLegacy(e,r);let o=t.discover;this._resetConnectionState();let n=this._supportedProtocolVersionsOption,s=(n&&Tn(n).length>0?Tn(n):nl).find(i=>o.supportedVersions.includes(i));if(s===void 0)throw new Y(X.EraNegotiationFailed,"connect({ prior }) with a modern verdict requires a 2026-07-28+ mutual protocol version; the supplied DiscoverResult and this client's supportedProtocolVersions have no modern overlap. For a server known to be legacy, pass prior: { kind: 'legacy' } to skip the probe and initialize directly, or use versionNegotiation: { mode: 'auto' } to re-probe with legacy fallback.");if(await super.connect(e),this._discoverResult=o,this._serverCapabilities=o.capabilities,this._serverVersion=Og(o),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=o.instructions,this._negotiatedProtocolVersion=s,e.setProtocolVersion?.(s),this._listChangedConfig)try{this._setupListChangedHandlers(this._listChangedConfig)}catch(i){this.onerror?.(i instanceof Error?i:new Error(String(i)))}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}_deriveServerIdentity(e){let t=this._serverVersion;return t!==void 0?`${t.name}@${t.version}`:e.sessionId??`anonymous:${Date.now()}-${Math.random().toString(36).slice(2)}`}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}getProtocolEra(){let e=this._negotiatedProtocolVersion;if(e!==void 0)return Zt(e)?"modern":"legacy"}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Y(X.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Y(X.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Y(X.CapabilityNotSupported,`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Y(X.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Y(X.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Y(X.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"initialize":break;case"server/discover":break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new Y(X.CapabilityNotSupported,`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Y(X.CapabilityNotSupported,`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Y(X.CapabilityNotSupported,`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Y(X.CapabilityNotSupported,`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},e)}async discover(e){let t=await this._requestWithSchema({method:"server/discover"},ar,e);return this._discoverResult=t,t}async complete(e,t){return this.request({method:"completion/complete",params:e},t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},t)}async listPrompts(e,t){if(!this._serverCapabilities?.prompts&&!this._enforceStrictCapabilities)return console.debug("Client.listPrompts() called but server does not advertise prompts capability - returning empty list"),{prompts:[]};if(e?.cursor!==void 0)return this.request({method:"prompts/list",params:e},t);let r=await this._serveFromCache("prompts/list",void 0,t);return r!==void 0?r:this._listAllPages("prompts/list",e,t,(o,n)=>o.prompts.push(...n.prompts))}async listResources(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResources() called but server does not advertise resources capability - returning empty list"),{resources:[]};if(e?.cursor!==void 0)return this.request({method:"resources/list",params:e},t);let r=await this._serveFromCache("resources/list",void 0,t);return r!==void 0?r:this._listAllPages("resources/list",e,t,(o,n)=>o.resources.push(...n.resources))}async listResourceTemplates(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResourceTemplates() called but server does not advertise resources capability - returning empty list"),{resourceTemplates:[]};if(e?.cursor!==void 0)return this.request({method:"resources/templates/list",params:e},t);let r=await this._serveFromCache("resources/templates/list",void 0,t);return r!==void 0?r:this._listAllPages("resources/templates/list",e,t,(o,n)=>o.resourceTemplates.push(...n.resourceTemplates))}async _listAllPages(e,t,r,o,n){let s=r?.cacheMode==="bypass",i=this._cache.captureGeneration(e),c=await this.request({method:e,...t&&{params:{...t}}},r),a=c.nextCursor,u=new Set,l=1;for(;a!==void 0&&!u.has(a);){if(this._listMaxPages!==0&&l>=this._listMaxPages)throw new Y(X.ListPaginationExceeded,`${e}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:e,listMaxPages:this._listMaxPages});u.add(a);let p=await this.request({method:e,params:{...t,cursor:a}},r);o(c,p),a=p.nextCursor,l++}return delete c.nextCursor,n?.(c),s||await this._cache.write(e,c,i,this._freshness(c)),c}_freshness(e,t){let r=e,o=typeof r.ttlMs=="number"?r.ttlMs:this._defaultCacheTtlMs,n=r.cacheScope==="public"?"public":"private";return{expiresAt:this._cache.now()+Math.min(Math.max(0,o),o0),scope:n,params:t}}async _serveFromCache(e,t,r){if(r?.cacheMode==="bypass"||r?.cacheMode==="refresh")return;let o=await this._cache.read(e,t).catch(n=>{this._reportStoreError(n)});if(o!==void 0){if(r?.signal?.aborted){let n=r.signal.reason;throw n instanceof Y?n:new Y(X.RequestTimeout,String(n))}return o.value}}_reportStoreError(e){this.onerror?.(e instanceof Error?e:new Error(String(e)))}_compileOutputValidator(e){if(e.outputSchema)try{return{ok:!0,validator:this._jsonSchemaValidator.getValidator(e.outputSchema)}}catch(t){return{ok:!1,compileError:t}}}async _resolveXMcpHeaderScan(e,t){let r=t??await this._cache.toolDefinition(e);return r===void 0?void 0:pl(r.inputSchema)}async readResource(e,t){let r=await this._serveFromCache("resources/read",e.uri,t);if(r!==void 0)return r;let o=this._cache.captureGeneration("resources/read",e.uri),n=await this.request({method:"resources/read",params:e},t);if(t?.cacheMode!=="bypass"){let s=this._freshness(n,e.uri);s.expiresAt>this._cache.now()?await this._cache.write("resources/read",n,o,s):t?.cacheMode==="refresh"&&await this._cache.evictKey("resources/read",e.uri)}return n}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},t)}async listen(e,t){if(this.transport===void 0)throw new Y(X.NotConnected,"Not connected");let r=this._negotiatedProtocolVersion;if(r===void 0||!Zt(r))throw new Y(X.MethodNotSupportedByProtocolVersion,`subscriptions/listen requires a 2026-07-28-era connection (negotiated: ${r??"none"}). On a 2025-era connection, change notifications are delivered unsolicited: use ClientOptions.listChanged and resources/subscribe instead.`,{method:"subscriptions/listen",protocolVersion:r});if(t?.signal?.aborted){let v=t.signal.reason;throw v instanceof Y?v:new Y(X.RequestTimeout,String(v))}let o=new AbortController,n=`listen:${this._nextListenId++}`,s="opening",i,c,a,u,l=new Promise((v,S)=>{a=v,u=S}),p,f=new Promise(v=>{p=v}),z=v=>{if(s==="closed")return;let S=s==="opening";if(i!==void 0&&(clearTimeout(i),i=void 0),"ack"in v){s="open",a(v.ack);return}s="closed",c!==void 0&&t?.signal?.removeEventListener("abort",c),this._listenState.delete(n),o.abort(),p(v.cause),S&&u(v.error??new Y(X.ConnectionClosed,"subscriptions/listen closed before the server acknowledged"))},m=async()=>{o.abort(),await this.notification({method:"notifications/cancelled",params:{requestId:n}}).catch(()=>{})},_=async()=>{s!=="closed"&&(z({cause:"local"}),await m())};this._listenState.set(n,{settle:z});let g=t?.timeout??xa;if(i=setTimeout(()=>{z({cause:"remote",error:new Y(X.RequestTimeout,"subscriptions/listen ack timed out",{timeout:g})}),m().catch(()=>{})},g),t?.signal){let v=t.signal;c=()=>{if(s==="closed")return;let S=v.reason;z({cause:"local",error:S instanceof Error?S:new Error(String(S??"Aborted"))}),m().catch(()=>{})},v.addEventListener("abort",c,{once:!0})}let h={jsonrpc:"2.0",id:n,method:"subscriptions/listen",params:{_meta:{...this._outboundMetaEnvelope()},notifications:e}};try{await this.transport.send(h,{requestSignal:o.signal,onRequestStreamEnd:()=>z({cause:"remote",error:new Error("subscriptions/listen: stream ended")})})}catch(v){z({cause:"remote",error:v instanceof Error?v:new Error(String(v))})}return{honoredFilter:await l,close:_,closed:f}}get autoOpenedSubscription(){return this._autoOpenedSubscription}_onnotification(e,t){let r=Object.hasOwn(Ig,e.method)?Ig[e.method]:void 0;if(e.method==="notifications/resources/updated"){let o=e.params?.uri;typeof o=="string"&&this._cache.evictKey("resources/read",o)}else if(r!==void 0)for(let o of r)this._cache.evict(o);if(e.method==="notifications/subscriptions/acknowledged"){let o=e.params?._meta?.[Ho],n=typeof o=="string"?this._listenState.get(o):void 0;if(n!==void 0){let s=this._wireCodec().validateNotification("notifications/subscriptions/acknowledged",e);n.settle({ack:s.ok?s.value.params.notifications:{}});return}}if(e.method==="notifications/cancelled"){let o=e.params?.requestId,n=typeof o=="string"?this._listenState.get(o):void 0;if(n!==void 0){n.settle({cause:"remote",error:new Error("subscriptions/listen: server cancelled the subscription")});return}}super._onnotification(e,t)}_onresponse(e){let t=e.id,r=typeof t=="string"?this._listenState.get(t):void 0;if(r!==void 0){Oa(e)?r.settle({cause:"remote",error:_e.fromError(e.error.code,e.error.message,e.error.data)}):r.settle({cause:"graceful",error:new Y(X.ConnectionClosed,"subscriptions/listen: server closed the subscription gracefully before acknowledging")});return}super._onresponse(e)}_onclose(){if(this._listenState.size>0){let e=new Y(X.ConnectionClosed,"Connection closed");for(let t of this._listenState.values())t.settle({cause:"remote",error:e});this._listenState.clear()}super._onclose()}async callTool(e,t){let r=this.getProtocolEra()==="modern"&&Eg()!=="browser",o=async()=>{if(!r)return t;let a;try{a=await this._resolveXMcpHeaderScan(e.name,t?.toolDefinition)}catch(l){this._reportStoreError(l)}if(!a?.valid||a.declarations.length===0)return t;let u=Bf(a.declarations,e.arguments);return Object.keys(u).length===0?t:{...t,headers:{...t?.headers,...u}}},n=t?.toolDefinition===void 0?await this._cache.outputValidator(e.name,a=>this._compileOutputValidator(a)).catch(a=>{this._reportStoreError(a)}):this._compileOutputValidator(t.toolDefinition),s=()=>{if(n===void 0||n.ok)return;let a=n.compileError,u=(a instanceof Error?a.message:String(a)).slice(0,200);throw new _e(ae.InvalidParams,`Tool '${e.name}' has an invalid outputSchema: ${u}`)};s();let i;try{i=await this.request({method:"tools/call",params:e},await o())}catch(a){let u=a instanceof _e&&a.code===Jr;if(!r||!u||t?.toolDefinition!==void 0)throw a;let l={signal:t?.signal,timeout:t?.timeout,cacheMode:"refresh"};await this._cache.evict("tools/list"),await this.listTools(void 0,l).catch(p=>this._reportStoreError(p)),n=await this._cache.outputValidator(e.name,p=>this._compileOutputValidator(p)).catch(p=>{this._reportStoreError(p)}),s(),i=await this.request({method:"tools/call",params:e},await o())}let c=n!==void 0&&n.ok?n.validator:void 0;if(c){if(i.structuredContent===void 0&&!i.isError)throw new _e(ae.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(i.structuredContent!==void 0&&!i.isError)try{let a=c(i.structuredContent);if(!a.valid)throw new _e(ae.InvalidParams,`Structured content does not match the tool's output schema: ${a.errorMessage}`)}catch(a){throw a instanceof _e?a:new _e(ae.InvalidParams,`Failed to validate structured content: ${a instanceof Error?a.message:String(a)}`)}}return i}async listTools(e,t){if(!this._serverCapabilities?.tools&&!this._enforceStrictCapabilities)return console.debug("Client.listTools() called but server does not advertise tools capability - returning empty list"),{tools:[]};if(e?.cursor!==void 0){let o=await this.request({method:"tools/list",params:e},t);return this._excludeInvalidXMcpHeaderTools(o),o}let r=await this._serveFromCache("tools/list",void 0,t);return r!==void 0?r:this._listAllPages("tools/list",e,t,(o,n)=>o.tools.push(...n.tools),o=>this._excludeInvalidXMcpHeaderTools(o))}_excludeInvalidXMcpHeaderTools(e){if(this.getProtocolEra()!=="modern"||!this.transport||Tg(this.transport)==="stdio")return;let t=e.tools.filter(r=>{let o=pl(r.inputSchema);return o.valid?!0:(console.warn(`[mcp-sdk] excluding tool '${r.name}' from tools/list: invalid x-mcp-header declaration \u2014 ${o.reason}`),!1)});t.length!==e.tools.length&&(e.tools=t)}_setupListChangedHandler(e,t,r,o){let n=Ia(pn,r);if(!n.success)throw new Error(`Invalid ${e} listChanged options: ${n.error.message}`);if(typeof r.onChanged!="function")throw new TypeError(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:s,debounceMs:i}=n.data,{onChanged:c}=r,a=async()=>{if(!s){c(null,null);return}try{c(null,await o())}catch(l){c(l instanceof Error?l:new Error(String(l)),null)}},u=()=>{if(i){let l=this._listChangedDebounceTimers.get(e);l&&clearTimeout(l);let p=setTimeout(a,i);this._listChangedDebounceTimers.set(e,p)}else a()};this.setNotificationHandler(t,u)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var uE=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](e){return rt(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return rt(this,e)}constructor(e,t,r){super(`SSE error: ${t}`),this.code=e,this.event=r,ur(this,new.target)}};var Va=Ha(require("node:process"),1),R_=require("node:stream"),P_=Ha($_(),1),tw=Va.default.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function rw(){let e={};for(let t of tw){let r=Va.default.env[t];r!==void 0&&(r.startsWith("()")||(e[t]=r))}return e}var E_=class{_process;_readBuffer;_serverParams;_stderrStream=null;onclose;onerror;onmessage;constructor(e){this._serverParams=e,this._readBuffer=new fl({maxBufferSize:e.maxBufferSize}),(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new R_.PassThrough)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,t)=>{this._process=(0,P_.default)(this._serverParams.command,this._serverParams.args??[],{env:{...rw(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:Va.default.platform==="win32",cwd:this._serverParams.cwd}),this._process.on("error",r=>{t(r),this.onerror?.(r)}),this._process.on("spawn",()=>{e()}),this._process.on("close",r=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on("error",r=>{this.onerror?.(r)}),this._process.stdout?.on("data",r=>{try{this._readBuffer.append(r),this.processReadBuffer()}catch(o){this.onerror?.(o),this.close().catch(()=>{})}}),this._process.stdout?.on("error",r=>{this.onerror?.(r)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){return this._stderrStream?this._stderrStream:this._process?.stderr??null}get pid(){return this._process?.pid??null}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async _dispose(){let e=this._process;if(this._process=void 0,e&&e.exitCode===null&&e.signalCode===null){let t=new Promise(r=>e.once("exit",()=>r()));try{e.stdin?.end()}catch{}try{e.kill("SIGTERM")}catch{}if(await Promise.race([t,new Promise(r=>setTimeout(r,1e3).unref())]),e.exitCode===null&&e.signalCode===null)try{e.kill("SIGKILL")}catch{}await t}try{e?.stdout?.destroy()}catch{}try{e?.stdin?.destroy()}catch{}try{e?.stderr?.destroy()}catch{}this._readBuffer.clear()}async close(){if(this._process){let e=this._process;this._process=void 0;let t=new Promise(r=>{e.once("close",()=>{r()})});try{e.stdin?.end()}catch{}if(await Promise.race([t,new Promise(r=>setTimeout(r,2e3).unref())]),e.exitCode===null){try{e.kill("SIGTERM")}catch{}await Promise.race([t,new Promise(r=>setTimeout(r,2e3).unref())])}if(e.exitCode===null)try{e.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(e){return new Promise(t=>{if(!this._process?.stdin)throw new Y(X.NotConnected,"Not connected");let r=gl(e);this._process.stdin.write(r)?t():this._process.stdin.once("drain",t)})}};var T_=require("node:crypto");function ow(e,t){return e?AbortSignal.any([e,t]):t}function nw(e){return e instanceof Y&&e.code===X.RequestTimeout}function Al(e){return e.reason instanceof Error?e.reason:new Error(String(e.reason??"cancelled"))}function k_(e,t){return e<t?-1:e>t?1:0}function ql(e){return Array.isArray(e)?e.map(ql):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).sort(([t],[r])=>k_(t,r)).map(([t,r])=>[t,ql(r)])):e}function sw(e){let t=e.map(r=>({name:r.name,description:r.description??"",inputSchema:r.inputSchema??{type:"object"},outputSchema:r.outputSchema??null,annotations:r.annotations??{}})).sort((r,o)=>k_(r.name,o.name));return(0,T_.createHash)("sha256").update(JSON.stringify(ql(t))).digest("hex")}var Ml=class{constructor(t){this.options=t}options;client;transport;connecting;sessionAbort=new AbortController;stderrTail="";closed=!1;get pid(){return this.transport?.pid??null}get serverVersion(){return this.client?.getServerVersion()}async listTools(t){let r=await this.ensureConnected(t);try{return(await r.listTools(void 0,this.requestOptions(t))).tools}catch(o){throw await this.handleRequestFailure(o,t)}}async callTool(t,r,o){let n=await this.ensureConnected(o);try{return await n.callTool({name:t,arguments:r},this.requestOptions(o))}catch(s){throw await this.handleRequestFailure(s,o)}}async close(){if(this.closed)return;this.closed=!0,this.sessionAbort.abort(new Error("Pi session ended"));let t=this.connecting;this.connecting=void 0,t&&await t.catch(()=>{}),await this.resetConnection()}async ensureConnected(t){if(this.closed)throw new Error("Computer Use connection is closed");if(t?.aborted)throw Al(t);if(this.client&&this.transport?.pid!==null)return this.client;if((this.client||this.transport)&&await this.resetConnection(),!this.connecting){let r=this.connect().finally(()=>{this.connecting===r&&(this.connecting=void 0)});this.connecting=r}if(await this.waitForConnection(this.connecting,t),!this.client)throw new Error("Computer Use MCP client did not connect");return this.client}async connect(){this.stderrTail="";let t=new Ag({name:"computer-use-linux-pi",version:this.options.clientVersion}),r=new E_({command:this.options.binaryPath,args:this.options.binaryArgs??["mcp"],env:this.options.env,stderr:"pipe"});r.stderr?.on("data",o=>{this.stderrTail=`${this.stderrTail}${o.toString()}`.slice(-8192)});try{await t.connect(r,this.requestOptions());let o=t.getServerVersion();if(o?.name!=="computer-use-linux")throw new Error(`unexpected MCP server identity: ${o?.name??"unknown"}`);if(o.version!==this.options.expectedServerVersion)throw new Error(`computer-use-linux version ${o.version} does not match the Pi extension catalog version ${this.options.expectedServerVersion}`);let n=await t.listTools(void 0,this.requestOptions());if(sw(n.tools)!==this.options.expectedCatalogHash)throw new Error("computer-use-linux tools do not match the Pi extension catalog; reinstall or update @agent-sh/computer-use-linux");if(this.closed)throw new Error("Pi session ended while Computer Use was connecting");this.client=t,this.transport=r}catch(o){throw await t.close().catch(()=>{}),this.enrichError(o)}}requestOptions(t){return{signal:ow(t,this.sessionAbort.signal),timeout:this.options.requestTimeoutMs??6e4}}async waitForConnection(t,r){if(!r){await t;return}if(r.aborted)throw Al(r);await new Promise((o,n)=>{let s=()=>{n(Al(r))};r.addEventListener("abort",s,{once:!0}),t.then(o,n).finally(()=>{r.removeEventListener("abort",s)})})}async handleRequestFailure(t,r){let o=this.transport?.pid===null;o&&await this.resetConnection();let n=this.enrichError(t);return r?.aborted||o||nw(t)?new Error(`${n.message} The call ended without a confirmed result and was not replayed. Verify the current UI state and call get_app_state again before retrying an element-based action.`,{cause:n}):n}async resetConnection(){let t=this.client,r=this.transport;this.client=void 0,this.transport=void 0,t?await t.close().catch(()=>{}):r&&await r.close().catch(()=>{})}enrichError(t){let r=t instanceof Error?t:new Error(String(t)),o=this.stderrTail.trim();return!o||r.message.includes(o)?r:new Error(`${r.message} (server stderr: ${o})`,{cause:r})}};0&&(module.exports={ComputerUseMcpClient});