@atoms-tech/atoms-mcp 0.3.6 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -14
- package/dist/apps/src/apps/browse/browse-app.html +320 -0
- package/dist/apps/src/apps/coverage/coverage-app.html +1 -1
- package/dist/apps/src/apps/editor/editor-app.html +327 -0
- package/dist/apps/src/apps/import/import-app.html +5 -5
- package/dist/apps/src/apps/mermaid/mermaid-app.html +17 -10
- package/dist/apps/src/apps/summary/summary-app.html +1 -1
- package/dist/apps/src/apps/trace/trace-app.html +91 -40
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -2
|
@@ -4,38 +4,38 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>ATOMS Trace Graph</title>
|
|
7
|
-
<script type="module" crossorigin>(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const i of r.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&n(i)}).observe(document,{childList:!0,subtree:!0});function o(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerPolicy&&(r.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?r.credentials="include":s.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function n(s){if(s.ep)return;s.ep=!0;const r=o(s);fetch(s.href,r)}})();function d(e,t,o){function n(a,p){var h;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(h=a._zod).traits??(h.traits=new Set),a._zod.traits.add(e),t(a,p);for(const f in i.prototype)f in a||Object.defineProperty(a,f,{value:i.prototype[f].bind(a)});a._zod.constr=i,a._zod.def=p}const s=o?.Parent??Object;class r extends s{}Object.defineProperty(r,"name",{value:e});function i(a){var p;const h=o?.Parent?new r:this;n(h,a),(p=h._zod).deferred??(p.deferred=[]);for(const f of h._zod.deferred)f();return h}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>o?.Parent&&a instanceof o.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class de extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const Xt={};function K(e){return Xt}function Xo(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,s])=>t.indexOf(+n)===-1).map(([n,s])=>s)}function en(e,t){return typeof t=="bigint"?t.toString():t}function Ye(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Xe(e){return e==null}function et(e){const t=e.startsWith("^")?1:0,o=e.endsWith("$")?e.length-1:e.length;return e.slice(t,o)}function tn(e,t){const o=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=o>n?o:n,r=Number.parseInt(e.toFixed(s).replace(".","")),i=Number.parseInt(t.toFixed(s).replace(".",""));return r%i/10**s}function P(e,t,o){Object.defineProperty(e,t,{get(){{const n=o();return e[t]=n,n}},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ae(e,t,o){Object.defineProperty(e,t,{value:o,writable:!0,enumerable:!0,configurable:!0})}function ae(e){return JSON.stringify(e)}const eo=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Pe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const on=Ye(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Ze(e){if(Pe(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const o=t.prototype;return!(Pe(o)===!1||Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")===!1)}const nn=new Set(["string","number","symbol"]);function me(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ne(e,t,o){const n=new e._zod.constr(t??e._zod.def);return(!t||o?.parent)&&(n._zod.parent=e),n}function g(e){const 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 sn(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const rn={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function an(e,t){const o={},n=e._zod.def;for(const s in t){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(o[s]=n.shape[s])}return ne(e,{...e._zod.def,shape:o,checks:[]})}function cn(e,t){const o={...e._zod.def.shape},n=e._zod.def;for(const s in t){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete o[s]}return ne(e,{...e._zod.def,shape:o,checks:[]})}function un(e,t){if(!Ze(t))throw new Error("Invalid input to extend: expected a plain object");const o={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return Ae(this,"shape",n),n},checks:[]};return ne(e,o)}function ln(e,t){return ne(e,{...e._zod.def,get shape(){const o={...e._zod.def.shape,...t._zod.def.shape};return Ae(this,"shape",o),o},catchall:t._zod.def.catchall,checks:[]})}function dn(e,t,o){const n=t._zod.def.shape,s={...n};if(o)for(const r in o){if(!(r in n))throw new Error(`Unrecognized key: "${r}"`);o[r]&&(s[r]=e?new e({type:"optional",innerType:n[r]}):n[r])}else for(const r in n)s[r]=e?new e({type:"optional",innerType:n[r]}):n[r];return ne(t,{...t._zod.def,shape:s,checks:[]})}function pn(e,t,o){const n=t._zod.def.shape,s={...n};if(o)for(const r in o){if(!(r in s))throw new Error(`Unrecognized key: "${r}"`);o[r]&&(s[r]=new e({type:"nonoptional",innerType:n[r]}))}else for(const r in n)s[r]=new e({type:"nonoptional",innerType:n[r]});return ne(t,{...t._zod.def,shape:s,checks:[]})}function ue(e,t=0){for(let o=t;o<e.issues.length;o++)if(e.issues[o]?.continue!==!0)return!0;return!1}function te(e,t){return t.map(o=>{var n;return(n=o).path??(n.path=[]),o.path.unshift(e),o})}function Te(e){return typeof e=="string"?e:e?.message}function Q(e,t,o){const n={...e,path:e.path??[]};if(!e.message){const s=Te(e.inst?._zod.def?.error?.(e))??Te(t?.error?.(e))??Te(o.customError?.(e))??Te(o.localeError?.(e))??"Invalid input";n.message=s}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function tt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function pe(...e){const[t,o,n]=e;return typeof t=="string"?{message:t,code:"custom",input:o,inst:n}:{...t}}const to=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,en,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},oo=d("$ZodError",to),no=d("$ZodError",to,{Parent:Error});function hn(e,t=o=>o.message){const o={},n=[];for(const s of e.issues)s.path.length>0?(o[s.path[0]]=o[s.path[0]]||[],o[s.path[0]].push(t(s))):n.push(t(s));return{formErrors:n,fieldErrors:o}}function mn(e,t){const o=t||function(r){return r.message},n={_errors:[]},s=r=>{for(const i of r.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>s({issues:a}));else if(i.code==="invalid_key")s({issues:i.issues});else if(i.code==="invalid_element")s({issues:i.issues});else if(i.path.length===0)n._errors.push(o(i));else{let a=n,p=0;for(;p<i.path.length;){const h=i.path[p];p===i.path.length-1?(a[h]=a[h]||{_errors:[]},a[h]._errors.push(o(i))):a[h]=a[h]||{_errors:[]},a=a[h],p++}}};return s(e),n}const fn=e=>(t,o,n,s)=>{const r=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:o,issues:[]},r);if(i instanceof Promise)throw new de;if(i.issues.length){const a=new(s?.Err??e)(i.issues.map(p=>Q(p,r,K())));throw eo(a,s?.callee),a}return i.value},gn=e=>async(t,o,n,s)=>{const r=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:o,issues:[]},r);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(s?.Err??e)(i.issues.map(p=>Q(p,r,K())));throw eo(a,s?.callee),a}return i.value},so=e=>(t,o,n)=>{const s=n?{...n,async:!1}:{async:!1},r=t._zod.run({value:o,issues:[]},s);if(r instanceof Promise)throw new de;return r.issues.length?{success:!1,error:new(e??oo)(r.issues.map(i=>Q(i,s,K())))}:{success:!0,data:r.value}},ro=so(no),io=e=>async(t,o,n)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let r=t._zod.run({value:o,issues:[]},s);return r instanceof Promise&&(r=await r),r.issues.length?{success:!1,error:new e(r.issues.map(i=>Q(i,s,K())))}:{success:!0,data:r.value}},_n=io(no),vn=/^[cC][^\s-]{8,}$/,bn=/^[0-9a-z]+$/,yn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,wn=/^[0-9a-vA-V]{20}$/,kn=/^[A-Za-z0-9]{27}$/,Sn=/^[a-zA-Z0-9_-]{21}$/,xn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Tn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Pt=e=>e?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)$/,zn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Rn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function In(){return new RegExp(Rn,"u")}const $n=/^(?:(?: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])$/,Pn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,Zn=/^((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])$/,En=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Cn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ao=/^[A-Za-z0-9_-]*$/,Nn=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,qn=/^\+(?:[0-9]){6,14}[0-9]$/,co="(?:(?:\\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])))",Mn=new RegExp(`^${co}$`);function uo(e){const 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}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function An(e){return new RegExp(`^${uo(e)}$`)}function On(e){const t=uo({precision:e.precision}),o=["Z"];e.local&&o.push(""),e.offset&&o.push("([+-]\\d{2}:\\d{2})");const n=`${t}(?:${o.join("|")})`;return new RegExp(`^${co}T(?:${n})$`)}const Dn=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Un=/^\d+$/,Ln=/^-?\d+(?:\.\d+)?/i,jn=/true|false/i,Hn=/null/i,Fn=/undefined/i,Bn=/^[^A-Z]*$/,Vn=/^[^a-z]*$/,H=d("$ZodCheck",(e,t)=>{var o;e._zod??(e._zod={}),e._zod.def=t,(o=e._zod).onattach??(o.onattach=[])}),lo={number:"number",bigint:"bigint",object:"date"},po=d("$ZodCheckLessThan",(e,t)=>{H.init(e,t);const o=lo[typeof t.value];e._zod.onattach.push(n=>{const s=n._zod.bag,r=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<r&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:o,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ho=d("$ZodCheckGreaterThan",(e,t)=>{H.init(e,t);const o=lo[typeof t.value];e._zod.onattach.push(n=>{const s=n._zod.bag,r=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>r&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:o,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Wn=d("$ZodCheckMultipleOf",(e,t)=>{H.init(e,t),e._zod.onattach.push(o=>{var n;(n=o._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=o=>{if(typeof o.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof o.value=="bigint"?o.value%t.value===BigInt(0):tn(o.value,t.value)===0)||o.issues.push({origin:typeof o.value,code:"not_multiple_of",divisor:t.value,input:o.value,inst:e,continue:!t.abort})}}),Gn=d("$ZodCheckNumberFormat",(e,t)=>{H.init(e,t),t.format=t.format||"float64";const o=t.format?.includes("int"),n=o?"int":"number",[s,r]=rn[t.format];e._zod.onattach.push(i=>{const a=i._zod.bag;a.format=t.format,a.minimum=s,a.maximum=r,o&&(a.pattern=Un)}),e._zod.check=i=>{const a=i.value;if(o){if(!Number.isInteger(a)){i.issues.push({expected:n,format:t.format,code:"invalid_type",input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort});return}}a<s&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),a>r&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:r,inst:e})}}),Jn=d("$ZodCheckMaxLength",(e,t)=>{var o;H.init(e,t),(o=e._zod.def).when??(o.when=n=>{const s=n.value;return!Xe(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const s=n.value;if(s.length<=t.maximum)return;const i=tt(s);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Kn=d("$ZodCheckMinLength",(e,t)=>{var o;H.init(e,t),(o=e._zod.def).when??(o.when=n=>{const s=n.value;return!Xe(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const s=n.value;if(s.length>=t.minimum)return;const i=tt(s);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Qn=d("$ZodCheckLengthEquals",(e,t)=>{var o;H.init(e,t),(o=e._zod.def).when??(o.when=n=>{const s=n.value;return!Xe(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=n=>{const s=n.value,r=s.length;if(r===t.length)return;const i=tt(s),a=r>t.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Oe=d("$ZodCheckStringFormat",(e,t)=>{var o,n;H.init(e,t),e._zod.onattach.push(s=>{const r=s._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(o=e._zod).check??(o.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Yn=d("$ZodCheckRegex",(e,t)=>{Oe.init(e,t),e._zod.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:"regex",input:o.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Xn=d("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Bn),Oe.init(e,t)}),es=d("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Vn),Oe.init(e,t)}),ts=d("$ZodCheckIncludes",(e,t)=>{H.init(e,t);const o=me(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${o}`:o);t.pattern=n,e._zod.onattach.push(s=>{const r=s._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),os=d("$ZodCheckStartsWith",(e,t)=>{H.init(e,t);const o=new RegExp(`^${me(t.prefix)}.*`);t.pattern??(t.pattern=o),e._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),ns=d("$ZodCheckEndsWith",(e,t)=>{H.init(e,t);const o=new RegExp(`.*${me(t.suffix)}$`);t.pattern??(t.pattern=o),e._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),ss=d("$ZodCheckOverwrite",(e,t)=>{H.init(e,t),e._zod.check=o=>{o.value=t.tx(o.value)}});class rs{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}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}const n=t.split(`
|
|
8
|
-
`).filter(i=>i),
|
|
9
|
-
`))}}const
|
|
10
|
-
if (${
|
|
11
|
-
if (input[${
|
|
12
|
-
if (${
|
|
13
|
-
newResult[${
|
|
7
|
+
<script type="module" crossorigin>(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&n(i)}).observe(document,{childList:!0,subtree:!0});function o(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(r){if(r.ep)return;r.ep=!0;const s=o(r);fetch(r.href,s)}})();function d(e,t,o){function n(c,p){var h;Object.defineProperty(c,"_zod",{value:c._zod??{},enumerable:!1}),(h=c._zod).traits??(h.traits=new Set),c._zod.traits.add(e),t(c,p);for(const m in i.prototype)m in c||Object.defineProperty(c,m,{value:i.prototype[m].bind(c)});c._zod.constr=i,c._zod.def=p}const r=o?.Parent??Object;class s extends r{}Object.defineProperty(s,"name",{value:e});function i(c){var p;const h=o?.Parent?new s:this;n(h,c),(p=h._zod).deferred??(p.deferred=[]);for(const m of h._zod.deferred)m();return h}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:c=>o?.Parent&&c instanceof o.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class he extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const ao={};function X(e){return ao}function ln(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,r])=>t.indexOf(+n)===-1).map(([n,r])=>r)}function dn(e,t){return typeof t=="bigint"?t.toString():t}function st(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function it(e){return e==null}function at(e){const t=e.startsWith("^")?1:0,o=e.endsWith("$")?e.length-1:e.length;return e.slice(t,o)}function pn(e,t){const o=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,r=o>n?o:n,s=Number.parseInt(e.toFixed(r).replace(".","")),i=Number.parseInt(t.toFixed(r).replace(".",""));return s%i/10**r}function C(e,t,o){Object.defineProperty(e,t,{get(){{const n=o();return e[t]=n,n}},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ue(e,t,o){Object.defineProperty(e,t,{value:o,writable:!0,enumerable:!0,configurable:!0})}function le(e){return JSON.stringify(e)}const co=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Me(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const hn=st(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Oe(e){if(Me(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const o=t.prototype;return!(Me(o)===!1||Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")===!1)}const mn=new Set(["string","number","symbol"]);function _e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ie(e,t,o){const n=new e._zod.constr(t??e._zod.def);return(!t||o?.parent)&&(n._zod.parent=e),n}function g(e){const 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 fn(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const gn={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function vn(e,t){const o={},n=e._zod.def;for(const r in t){if(!(r in n.shape))throw new Error(`Unrecognized key: "${r}"`);t[r]&&(o[r]=n.shape[r])}return ie(e,{...e._zod.def,shape:o,checks:[]})}function _n(e,t){const o={...e._zod.def.shape},n=e._zod.def;for(const r in t){if(!(r in n.shape))throw new Error(`Unrecognized key: "${r}"`);t[r]&&delete o[r]}return ie(e,{...e._zod.def,shape:o,checks:[]})}function bn(e,t){if(!Oe(t))throw new Error("Invalid input to extend: expected a plain object");const o={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return Ue(this,"shape",n),n},checks:[]};return ie(e,o)}function yn(e,t){return ie(e,{...e._zod.def,get shape(){const o={...e._zod.def.shape,...t._zod.def.shape};return Ue(this,"shape",o),o},catchall:t._zod.def.catchall,checks:[]})}function wn(e,t,o){const n=t._zod.def.shape,r={...n};if(o)for(const s in o){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);o[s]&&(r[s]=e?new e({type:"optional",innerType:n[s]}):n[s])}else for(const s in n)r[s]=e?new e({type:"optional",innerType:n[s]}):n[s];return ie(t,{...t._zod.def,shape:r,checks:[]})}function kn(e,t,o){const n=t._zod.def.shape,r={...n};if(o)for(const s in o){if(!(s in r))throw new Error(`Unrecognized key: "${s}"`);o[s]&&(r[s]=new e({type:"nonoptional",innerType:n[s]}))}else for(const s in n)r[s]=new e({type:"nonoptional",innerType:n[s]});return ie(t,{...t._zod.def,shape:r,checks:[]})}function pe(e,t=0){for(let o=t;o<e.issues.length;o++)if(e.issues[o]?.continue!==!0)return!0;return!1}function se(e,t){return t.map(o=>{var n;return(n=o).path??(n.path=[]),o.path.unshift(e),o})}function $e(e){return typeof e=="string"?e:e?.message}function ee(e,t,o){const n={...e,path:e.path??[]};if(!e.message){const r=$e(e.inst?._zod.def?.error?.(e))??$e(t?.error?.(e))??$e(o.customError?.(e))??$e(o.localeError?.(e))??"Invalid input";n.message=r}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function ct(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function me(...e){const[t,o,n]=e;return typeof t=="string"?{message:t,code:"custom",input:o,inst:n}:{...t}}const uo=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,dn,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},lo=d("$ZodError",uo),po=d("$ZodError",uo,{Parent:Error});function xn(e,t=o=>o.message){const o={},n=[];for(const r of e.issues)r.path.length>0?(o[r.path[0]]=o[r.path[0]]||[],o[r.path[0]].push(t(r))):n.push(t(r));return{formErrors:n,fieldErrors:o}}function Sn(e,t){const o=t||function(s){return s.message},n={_errors:[]},r=s=>{for(const i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(c=>r({issues:c}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(o(i));else{let c=n,p=0;for(;p<i.path.length;){const h=i.path[p];p===i.path.length-1?(c[h]=c[h]||{_errors:[]},c[h]._errors.push(o(i))):c[h]=c[h]||{_errors:[]},c=c[h],p++}}};return r(e),n}const Tn=e=>(t,o,n,r)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:o,issues:[]},s);if(i instanceof Promise)throw new he;if(i.issues.length){const c=new(r?.Err??e)(i.issues.map(p=>ee(p,s,X())));throw co(c,r?.callee),c}return i.value},zn=e=>async(t,o,n,r)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:o,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const c=new(r?.Err??e)(i.issues.map(p=>ee(p,s,X())));throw co(c,r?.callee),c}return i.value},ho=e=>(t,o,n)=>{const r=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw new he;return s.issues.length?{success:!1,error:new(e??lo)(s.issues.map(i=>ee(i,r,X())))}:{success:!0,data:s.value}},mo=ho(po),fo=e=>async(t,o,n)=>{const r=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:o,issues:[]},r);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>ee(i,r,X())))}:{success:!0,data:s.value}},Rn=fo(po),In=/^[cC][^\s-]{8,}$/,$n=/^[0-9a-z]+$/,Pn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,En=/^[0-9a-vA-V]{20}$/,Zn=/^[A-Za-z0-9]{27}$/,Cn=/^[a-zA-Z0-9_-]{21}$/,Nn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,qn=/^([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})$/,At=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)$/,Mn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,On="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function An(){return new RegExp(On,"u")}const Dn=/^(?:(?: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])$/,Ln=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,Un=/^((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])$/,jn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Hn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,go=/^[A-Za-z0-9_-]*$/,Fn=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,Bn=/^\+(?:[0-9]){6,14}[0-9]$/,vo="(?:(?:\\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])))",Vn=new RegExp(`^${vo}$`);function _o(e){const 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}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Wn(e){return new RegExp(`^${_o(e)}$`)}function Jn(e){const t=_o({precision:e.precision}),o=["Z"];e.local&&o.push(""),e.offset&&o.push("([+-]\\d{2}:\\d{2})");const n=`${t}(?:${o.join("|")})`;return new RegExp(`^${vo}T(?:${n})$`)}const Gn=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Kn=/^\d+$/,Qn=/^-?\d+(?:\.\d+)?/i,Yn=/true|false/i,Xn=/null/i,er=/undefined/i,tr=/^[^A-Z]*$/,or=/^[^a-z]*$/,F=d("$ZodCheck",(e,t)=>{var o;e._zod??(e._zod={}),e._zod.def=t,(o=e._zod).onattach??(o.onattach=[])}),bo={number:"number",bigint:"bigint",object:"date"},yo=d("$ZodCheckLessThan",(e,t)=>{F.init(e,t);const o=bo[typeof t.value];e._zod.onattach.push(n=>{const r=n._zod.bag,s=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:o,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),wo=d("$ZodCheckGreaterThan",(e,t)=>{F.init(e,t);const o=bo[typeof t.value];e._zod.onattach.push(n=>{const r=n._zod.bag,s=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:o,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),nr=d("$ZodCheckMultipleOf",(e,t)=>{F.init(e,t),e._zod.onattach.push(o=>{var n;(n=o._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=o=>{if(typeof o.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof o.value=="bigint"?o.value%t.value===BigInt(0):pn(o.value,t.value)===0)||o.issues.push({origin:typeof o.value,code:"not_multiple_of",divisor:t.value,input:o.value,inst:e,continue:!t.abort})}}),rr=d("$ZodCheckNumberFormat",(e,t)=>{F.init(e,t),t.format=t.format||"float64";const o=t.format?.includes("int"),n=o?"int":"number",[r,s]=gn[t.format];e._zod.onattach.push(i=>{const c=i._zod.bag;c.format=t.format,c.minimum=r,c.maximum=s,o&&(c.pattern=Kn)}),e._zod.check=i=>{const c=i.value;if(o){if(!Number.isInteger(c)){i.issues.push({expected:n,format:t.format,code:"invalid_type",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:n,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:n,continue:!t.abort});return}}c<r&&i.issues.push({origin:"number",input:c,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),c>s&&i.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inst:e})}}),sr=d("$ZodCheckMaxLength",(e,t)=>{var o;F.init(e,t),(o=e._zod.def).when??(o.when=n=>{const r=n.value;return!it(r)&&r.length!==void 0}),e._zod.onattach.push(n=>{const r=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const r=n.value;if(r.length<=t.maximum)return;const i=ct(r);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ir=d("$ZodCheckMinLength",(e,t)=>{var o;F.init(e,t),(o=e._zod.def).when??(o.when=n=>{const r=n.value;return!it(r)&&r.length!==void 0}),e._zod.onattach.push(n=>{const r=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const r=n.value;if(r.length>=t.minimum)return;const i=ct(r);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ar=d("$ZodCheckLengthEquals",(e,t)=>{var o;F.init(e,t),(o=e._zod.def).when??(o.when=n=>{const r=n.value;return!it(r)&&r.length!==void 0}),e._zod.onattach.push(n=>{const r=n._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=n=>{const r=n.value,s=r.length;if(s===t.length)return;const i=ct(r),c=s>t.length;n.issues.push({origin:i,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),je=d("$ZodCheckStringFormat",(e,t)=>{var o,n;F.init(e,t),e._zod.onattach.push(r=>{const s=r._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(o=e._zod).check??(o.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),cr=d("$ZodCheckRegex",(e,t)=>{je.init(e,t),e._zod.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:"regex",input:o.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ur=d("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=tr),je.init(e,t)}),lr=d("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=or),je.init(e,t)}),dr=d("$ZodCheckIncludes",(e,t)=>{F.init(e,t);const o=_e(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${o}`:o);t.pattern=n,e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),pr=d("$ZodCheckStartsWith",(e,t)=>{F.init(e,t);const o=new RegExp(`^${_e(t.prefix)}.*`);t.pattern??(t.pattern=o),e._zod.onattach.push(n=>{const r=n._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(o)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),hr=d("$ZodCheckEndsWith",(e,t)=>{F.init(e,t);const o=new RegExp(`.*${_e(t.suffix)}$`);t.pattern??(t.pattern=o),e._zod.onattach.push(n=>{const r=n._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(o)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),mr=d("$ZodCheckOverwrite",(e,t)=>{F.init(e,t),e._zod.check=o=>{o.value=t.tx(o.value)}});class fr{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}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}const n=t.split(`
|
|
8
|
+
`).filter(i=>i),r=Math.min(...n.map(i=>i.length-i.trimStart().length)),s=n.map(i=>i.slice(r)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,o=this?.args,r=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...o,r.join(`
|
|
9
|
+
`))}}const gr={major:4,minor:0,patch:0},Z=d("$ZodType",(e,t)=>{var o;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=gr;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const r of n)for(const s of r._zod.onattach)s(e);if(n.length===0)(o=e._zod).deferred??(o.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const r=(s,i,c)=>{let p=pe(s),h;for(const m of i){if(m._zod.def.when){if(!m._zod.def.when(s))continue}else if(p)continue;const f=s.issues.length,v=m._zod.check(s);if(v instanceof Promise&&c?.async===!1)throw new he;if(h||v instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await v,s.issues.length!==f&&(p||(p=pe(s,f)))});else{if(s.issues.length===f)continue;p||(p=pe(s,f))}}return h?h.then(()=>s):s};e._zod.run=(s,i)=>{const c=e._zod.parse(s,i);if(c instanceof Promise){if(i.async===!1)throw new he;return c.then(p=>r(p,n,i))}return r(c,n,i)}}e["~standard"]={validate:r=>{try{const s=mo(e,r);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Rn(e,r).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),ut=d("$ZodString",(e,t)=>{Z.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Gn(e._zod.bag),e._zod.parse=(o,n)=>{if(t.coerce)try{o.value=String(o.value)}catch{}return typeof o.value=="string"||o.issues.push({expected:"string",code:"invalid_type",input:o.value,inst:e}),o}}),N=d("$ZodStringFormat",(e,t)=>{je.init(e,t),ut.init(e,t)}),vr=d("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=qn),N.init(e,t)}),_r=d("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=At(n))}else t.pattern??(t.pattern=At());N.init(e,t)}),br=d("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Mn),N.init(e,t)}),yr=d("$ZodURL",(e,t)=>{N.init(e,t),e._zod.check=o=>{try{const n=o.value,r=new URL(n),s=r.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(r.hostname)||o.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Fn.source,input:o.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||o.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:o.value,inst:e,continue:!t.abort})),!n.endsWith("/")&&s.endsWith("/")?o.value=s.slice(0,-1):o.value=s;return}catch{o.issues.push({code:"invalid_format",format:"url",input:o.value,inst:e,continue:!t.abort})}}}),wr=d("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=An()),N.init(e,t)}),kr=d("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Cn),N.init(e,t)}),xr=d("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=In),N.init(e,t)}),Sr=d("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=$n),N.init(e,t)}),Tr=d("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Pn),N.init(e,t)}),zr=d("$ZodXID",(e,t)=>{t.pattern??(t.pattern=En),N.init(e,t)}),Rr=d("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Zn),N.init(e,t)}),Ir=d("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Jn(t)),N.init(e,t)}),$r=d("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Vn),N.init(e,t)}),Pr=d("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Wn(t)),N.init(e,t)}),Er=d("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Nn),N.init(e,t)}),Zr=d("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Dn),N.init(e,t),e._zod.onattach.push(o=>{const n=o._zod.bag;n.format="ipv4"})}),Cr=d("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ln),N.init(e,t),e._zod.onattach.push(o=>{const n=o._zod.bag;n.format="ipv6"}),e._zod.check=o=>{try{new URL(`http://[${o.value}]`)}catch{o.issues.push({code:"invalid_format",format:"ipv6",input:o.value,inst:e,continue:!t.abort})}}}),Nr=d("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Un),N.init(e,t)}),qr=d("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=jn),N.init(e,t),e._zod.check=o=>{const[n,r]=o.value.split("/");try{if(!r)throw new Error;const s=Number(r);if(`${s}`!==r)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${n}]`)}catch{o.issues.push({code:"invalid_format",format:"cidrv6",input:o.value,inst:e,continue:!t.abort})}}});function ko(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Mr=d("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Hn),N.init(e,t),e._zod.onattach.push(o=>{o._zod.bag.contentEncoding="base64"}),e._zod.check=o=>{ko(o.value)||o.issues.push({code:"invalid_format",format:"base64",input:o.value,inst:e,continue:!t.abort})}});function Or(e){if(!go.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),o=t.padEnd(Math.ceil(t.length/4)*4,"=");return ko(o)}const Ar=d("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=go),N.init(e,t),e._zod.onattach.push(o=>{o._zod.bag.contentEncoding="base64url"}),e._zod.check=o=>{Or(o.value)||o.issues.push({code:"invalid_format",format:"base64url",input:o.value,inst:e,continue:!t.abort})}}),Dr=d("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Bn),N.init(e,t)});function Lr(e,t=null){try{const o=e.split(".");if(o.length!==3)return!1;const[n]=o;if(!n)return!1;const r=JSON.parse(atob(n));return!("typ"in r&&r?.typ!=="JWT"||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}}const Ur=d("$ZodJWT",(e,t)=>{N.init(e,t),e._zod.check=o=>{Lr(o.value,t.alg)||o.issues.push({code:"invalid_format",format:"jwt",input:o.value,inst:e,continue:!t.abort})}}),xo=d("$ZodNumber",(e,t)=>{Z.init(e,t),e._zod.pattern=e._zod.bag.pattern??Qn,e._zod.parse=(o,n)=>{if(t.coerce)try{o.value=Number(o.value)}catch{}const r=o.value;if(typeof r=="number"&&!Number.isNaN(r)&&Number.isFinite(r))return o;const s=typeof r=="number"?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return o.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...s?{received:s}:{}}),o}}),jr=d("$ZodNumber",(e,t)=>{rr.init(e,t),xo.init(e,t)}),Hr=d("$ZodBoolean",(e,t)=>{Z.init(e,t),e._zod.pattern=Yn,e._zod.parse=(o,n)=>{if(t.coerce)try{o.value=!!o.value}catch{}const r=o.value;return typeof r=="boolean"||o.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),o}}),Fr=d("$ZodUndefined",(e,t)=>{Z.init(e,t),e._zod.pattern=er,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(o,n)=>{const r=o.value;return typeof r>"u"||o.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:e}),o}}),Br=d("$ZodNull",(e,t)=>{Z.init(e,t),e._zod.pattern=Xn,e._zod.values=new Set([null]),e._zod.parse=(o,n)=>{const r=o.value;return r===null||o.issues.push({expected:"null",code:"invalid_type",input:r,inst:e}),o}}),Vr=d("$ZodUnknown",(e,t)=>{Z.init(e,t),e._zod.parse=o=>o}),Wr=d("$ZodNever",(e,t)=>{Z.init(e,t),e._zod.parse=(o,n)=>(o.issues.push({expected:"never",code:"invalid_type",input:o.value,inst:e}),o)});function Dt(e,t,o){e.issues.length&&t.issues.push(...se(o,e.issues)),t.value[o]=e.value}const Jr=d("$ZodArray",(e,t)=>{Z.init(e,t),e._zod.parse=(o,n)=>{const r=o.value;if(!Array.isArray(r))return o.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),o;o.value=Array(r.length);const s=[];for(let i=0;i<r.length;i++){const c=r[i],p=t.element._zod.run({value:c,issues:[]},n);p instanceof Promise?s.push(p.then(h=>Dt(h,o,i))):Dt(p,o,i)}return s.length?Promise.all(s).then(()=>o):o}});function Pe(e,t,o){e.issues.length&&t.issues.push(...se(o,e.issues)),t.value[o]=e.value}function Lt(e,t,o,n){e.issues.length?n[o]===void 0?o in n?t.value[o]=void 0:t.value[o]=e.value:t.issues.push(...se(o,e.issues)):e.value===void 0?o in n&&(t.value[o]=void 0):t.value[o]=e.value}const Gr=d("$ZodObject",(e,t)=>{Z.init(e,t);const o=st(()=>{const f=Object.keys(t.shape);for(const b of f)if(!(t.shape[b]instanceof Z))throw new Error(`Invalid element at key "${b}": expected a Zod schema`);const v=fn(t.shape);return{shape:t.shape,keys:f,keySet:new Set(f),numKeys:f.length,optionalKeys:new Set(v)}});C(e._zod,"propValues",()=>{const f=t.shape,v={};for(const b in f){const R=f[b]._zod;if(R.values){v[b]??(v[b]=new Set);for(const w of R.values)v[b].add(w)}}return v});const n=f=>{const v=new fr(["shape","payload","ctx"]),b=o.value,R=k=>{const y=le(k);return`shape[${y}]._zod.run({ value: input[${y}], issues: [] }, ctx)`};v.write("const input = payload.value;");const w=Object.create(null);let j=0;for(const k of b.keys)w[k]=`key_${j++}`;v.write("const newResult = {}");for(const k of b.keys)if(b.optionalKeys.has(k)){const y=w[k];v.write(`const ${y} = ${R(k)};`);const T=le(k);v.write(`
|
|
10
|
+
if (${y}.issues.length) {
|
|
11
|
+
if (input[${T}] === undefined) {
|
|
12
|
+
if (${T} in input) {
|
|
13
|
+
newResult[${T}] = undefined;
|
|
14
14
|
}
|
|
15
15
|
} else {
|
|
16
16
|
payload.issues = payload.issues.concat(
|
|
17
|
-
${
|
|
17
|
+
${y}.issues.map((iss) => ({
|
|
18
18
|
...iss,
|
|
19
|
-
path: iss.path ? [${
|
|
19
|
+
path: iss.path ? [${T}, ...iss.path] : [${T}],
|
|
20
20
|
}))
|
|
21
21
|
);
|
|
22
22
|
}
|
|
23
|
-
} else if (${
|
|
24
|
-
if (${
|
|
23
|
+
} else if (${y}.value === undefined) {
|
|
24
|
+
if (${T} in input) newResult[${T}] = undefined;
|
|
25
25
|
} else {
|
|
26
|
-
newResult[${
|
|
26
|
+
newResult[${T}] = ${y}.value;
|
|
27
27
|
}
|
|
28
|
-
`)}else{const
|
|
29
|
-
if (${
|
|
28
|
+
`)}else{const y=w[k];v.write(`const ${y} = ${R(k)};`),v.write(`
|
|
29
|
+
if (${y}.issues.length) payload.issues = payload.issues.concat(${y}.issues.map(iss => ({
|
|
30
30
|
...iss,
|
|
31
|
-
path: iss.path ? [${
|
|
32
|
-
})));`),_.write(`newResult[${ae(S)}] = ${k}.value`)}_.write("payload.value = newResult;"),_.write("return payload;");const Y=_.compile();return(S,k)=>Y(m,S,k)};let s;const r=Pe,i=!Xt.jitless,p=i&&on.value,h=t.catchall;let f;e._zod.parse=(m,_)=>{f??(f=o.value);const b=m.value;if(!r(b))return m.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),m;const M=[];if(i&&p&&_?.async===!1&&_.jitless!==!0)s||(s=n(t.shape)),m=s(m,_);else{m.value={};const k=f.shape;for(const Z of f.keys){const ie=k[Z],xe=ie._zod.run({value:b[Z],issues:[]},_),It=ie._zod.optin==="optional"&&ie._zod.optout==="optional";xe instanceof Promise?M.push(xe.then($t=>It?Et($t,m,Z,b):ze($t,m,Z))):It?Et(xe,m,Z,b):ze(xe,m,Z)}}if(!h)return M.length?Promise.all(M).then(()=>m):m;const L=[],G=f.keySet,Y=h._zod,S=Y.def.type;for(const k of Object.keys(b)){if(G.has(k))continue;if(S==="never"){L.push(k);continue}const Z=Y.run({value:b[k],issues:[]},_);Z instanceof Promise?M.push(Z.then(ie=>ze(ie,m,k))):ze(Z,m,k)}return L.length&&m.issues.push({code:"unrecognized_keys",keys:L,input:b,inst:e}),M.length?Promise.all(M).then(()=>m):m}});function Ct(e,t,o,n){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:o,errors:e.map(s=>s.issues.map(r=>Q(r,n,K())))}),t}const go=d("$ZodUnion",(e,t)=>{$.init(e,t),P(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),P(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),P(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),P(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(n=>n._zod.pattern);return new RegExp(`^(${o.map(n=>et(n.source)).join("|")})$`)}}),e._zod.parse=(o,n)=>{let s=!1;const r=[];for(const i of t.options){const a=i._zod.run({value:o.value,issues:[]},n);if(a instanceof Promise)r.push(a),s=!0;else{if(a.issues.length===0)return a;r.push(a)}}return s?Promise.all(r).then(i=>Ct(i,o,e,n)):Ct(r,o,e,n)}}),Us=d("$ZodDiscriminatedUnion",(e,t)=>{go.init(e,t);const o=e._zod.parse;P(e._zod,"propValues",()=>{const s={};for(const r of t.options){const i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(const[a,p]of Object.entries(i)){s[a]||(s[a]=new Set);for(const h of p)s[a].add(h)}}return s});const n=Ye(()=>{const s=t.options,r=new Map;for(const i of s){const a=i._zod.propValues[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const p of a){if(r.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);r.set(p,i)}}return r});e._zod.parse=(s,r)=>{const i=s.value;if(!Pe(i))return s.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),s;const a=n.value.get(i?.[t.discriminator]);return a?a._zod.run(s,r):t.unionFallback?o(s,r):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[t.discriminator],inst:e}),s)}}),Ls=d("$ZodIntersection",(e,t)=>{$.init(e,t),e._zod.parse=(o,n)=>{const s=o.value,r=t.left._zod.run({value:s,issues:[]},n),i=t.right._zod.run({value:s,issues:[]},n);return r instanceof Promise||i instanceof Promise?Promise.all([r,i]).then(([p,h])=>Nt(o,p,h)):Nt(o,r,i)}});function Ge(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(Ze(e)&&Ze(t)){const o=Object.keys(t),n=Object.keys(e).filter(r=>o.indexOf(r)!==-1),s={...e,...t};for(const r of n){const i=Ge(e[r],t[r]);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};s[r]=i.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const o=[];for(let n=0;n<e.length;n++){const s=e[n],r=t[n],i=Ge(s,r);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};o.push(i.data)}return{valid:!0,data:o}}return{valid:!1,mergeErrorPath:[]}}function Nt(e,t,o){if(t.issues.length&&e.issues.push(...t.issues),o.issues.length&&e.issues.push(...o.issues),ue(e))return e;const n=Ge(t.value,o.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const js=d("$ZodRecord",(e,t)=>{$.init(e,t),e._zod.parse=(o,n)=>{const s=o.value;if(!Ze(s))return o.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),o;const r=[];if(t.keyType._zod.values){const i=t.keyType._zod.values;o.value={};for(const p of i)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){const h=t.valueType._zod.run({value:s[p],issues:[]},n);h instanceof Promise?r.push(h.then(f=>{f.issues.length&&o.issues.push(...te(p,f.issues)),o.value[p]=f.value})):(h.issues.length&&o.issues.push(...te(p,h.issues)),o.value[p]=h.value)}let a;for(const p in s)i.has(p)||(a=a??[],a.push(p));a&&a.length>0&&o.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:a})}else{o.value={};for(const i of Reflect.ownKeys(s)){if(i==="__proto__")continue;const a=t.keyType._zod.run({value:i,issues:[]},n);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){o.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(h=>Q(h,n,K())),input:i,path:[i],inst:e}),o.value[a.value]=a.value;continue}const p=t.valueType._zod.run({value:s[i],issues:[]},n);p instanceof Promise?r.push(p.then(h=>{h.issues.length&&o.issues.push(...te(i,h.issues)),o.value[a.value]=h.value})):(p.issues.length&&o.issues.push(...te(i,p.issues)),o.value[a.value]=p.value)}}return r.length?Promise.all(r).then(()=>o):o}}),Hs=d("$ZodEnum",(e,t)=>{$.init(e,t);const o=Xo(t.entries);e._zod.values=new Set(o),e._zod.pattern=new RegExp(`^(${o.filter(n=>nn.has(typeof n)).map(n=>typeof n=="string"?me(n):n.toString()).join("|")})$`),e._zod.parse=(n,s)=>{const r=n.value;return e._zod.values.has(r)||n.issues.push({code:"invalid_value",values:o,input:r,inst:e}),n}}),Fs=d("$ZodLiteral",(e,t)=>{$.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(o=>typeof o=="string"?me(o):o?o.toString():String(o)).join("|")})$`),e._zod.parse=(o,n)=>{const s=o.value;return e._zod.values.has(s)||o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}}),Bs=d("$ZodTransform",(e,t)=>{$.init(e,t),e._zod.parse=(o,n)=>{const s=t.transform(o.value,o);if(n.async)return(s instanceof Promise?s:Promise.resolve(s)).then(i=>(o.value=i,o));if(s instanceof Promise)throw new de;return o.value=s,o}}),Vs=d("$ZodOptional",(e,t)=>{$.init(e,t),e._zod.optin="optional",e._zod.optout="optional",P(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),P(e._zod,"pattern",()=>{const o=t.innerType._zod.pattern;return o?new RegExp(`^(${et(o.source)})?$`):void 0}),e._zod.parse=(o,n)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(o,n):o.value===void 0?o:t.innerType._zod.run(o,n)}),Ws=d("$ZodNullable",(e,t)=>{$.init(e,t),P(e._zod,"optin",()=>t.innerType._zod.optin),P(e._zod,"optout",()=>t.innerType._zod.optout),P(e._zod,"pattern",()=>{const o=t.innerType._zod.pattern;return o?new RegExp(`^(${et(o.source)}|null)$`):void 0}),P(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(o,n)=>o.value===null?o:t.innerType._zod.run(o,n)}),Gs=d("$ZodDefault",(e,t)=>{$.init(e,t),e._zod.optin="optional",P(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(o,n)=>{if(o.value===void 0)return o.value=t.defaultValue,o;const s=t.innerType._zod.run(o,n);return s instanceof Promise?s.then(r=>qt(r,t)):qt(s,t)}});function qt(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Js=d("$ZodPrefault",(e,t)=>{$.init(e,t),e._zod.optin="optional",P(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(o,n)=>(o.value===void 0&&(o.value=t.defaultValue),t.innerType._zod.run(o,n))}),Ks=d("$ZodNonOptional",(e,t)=>{$.init(e,t),P(e._zod,"values",()=>{const o=t.innerType._zod.values;return o?new Set([...o].filter(n=>n!==void 0)):void 0}),e._zod.parse=(o,n)=>{const s=t.innerType._zod.run(o,n);return s instanceof Promise?s.then(r=>Mt(r,e)):Mt(s,e)}});function Mt(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Qs=d("$ZodCatch",(e,t)=>{$.init(e,t),e._zod.optin="optional",P(e._zod,"optout",()=>t.innerType._zod.optout),P(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(o,n)=>{const s=t.innerType._zod.run(o,n);return s instanceof Promise?s.then(r=>(o.value=r.value,r.issues.length&&(o.value=t.catchValue({...o,error:{issues:r.issues.map(i=>Q(i,n,K()))},input:o.value}),o.issues=[]),o)):(o.value=s.value,s.issues.length&&(o.value=t.catchValue({...o,error:{issues:s.issues.map(r=>Q(r,n,K()))},input:o.value}),o.issues=[]),o)}}),Ys=d("$ZodPipe",(e,t)=>{$.init(e,t),P(e._zod,"values",()=>t.in._zod.values),P(e._zod,"optin",()=>t.in._zod.optin),P(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(o,n)=>{const s=t.in._zod.run(o,n);return s instanceof Promise?s.then(r=>At(r,t,n)):At(s,t,n)}});function At(e,t,o){return ue(e)?e:t.out._zod.run({value:e.value,issues:e.issues},o)}const Xs=d("$ZodReadonly",(e,t)=>{$.init(e,t),P(e._zod,"propValues",()=>t.innerType._zod.propValues),P(e._zod,"values",()=>t.innerType._zod.values),P(e._zod,"optin",()=>t.innerType._zod.optin),P(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(o,n)=>{const s=t.innerType._zod.run(o,n);return s instanceof Promise?s.then(Ot):Ot(s)}});function Ot(e){return e.value=Object.freeze(e.value),e}const er=d("$ZodCustom",(e,t)=>{H.init(e,t),$.init(e,t),e._zod.parse=(o,n)=>o,e._zod.check=o=>{const n=o.value,s=t.fn(n);if(s instanceof Promise)return s.then(r=>Dt(r,o,n,e));Dt(s,o,n,e)}});function Dt(e,t,o,n){if(!e){const s={code:"custom",input:o,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(s.params=n._zod.def.params),t.issues.push(pe(s))}}class tr{constructor(){this._map=new Map,this._idmap=new Map}add(t,...o){const n=o[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const o=this._map.get(t);return o&&typeof o=="object"&&"id"in o&&this._idmap.delete(o.id),this._map.delete(t),this}get(t){const o=t._zod.parent;if(o){const n={...this.get(o)??{}};return delete n.id,{...n,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}}function or(){return new tr}const Re=or();function nr(e,t){return new e({type:"string",...g(t)})}function sr(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...g(t)})}function Ut(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...g(t)})}function rr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...g(t)})}function ir(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...g(t)})}function ar(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...g(t)})}function cr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...g(t)})}function ur(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...g(t)})}function lr(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...g(t)})}function dr(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...g(t)})}function pr(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...g(t)})}function hr(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...g(t)})}function mr(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...g(t)})}function fr(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...g(t)})}function gr(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...g(t)})}function _r(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...g(t)})}function vr(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...g(t)})}function br(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...g(t)})}function yr(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...g(t)})}function wr(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...g(t)})}function kr(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...g(t)})}function Sr(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...g(t)})}function xr(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...g(t)})}function Tr(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...g(t)})}function zr(e,t){return new e({type:"string",format:"date",check:"string_format",...g(t)})}function Rr(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...g(t)})}function Ir(e,t){return new e({type:"string",format:"duration",check:"string_format",...g(t)})}function $r(e,t){return new e({type:"number",checks:[],...g(t)})}function Pr(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...g(t)})}function Zr(e,t){return new e({type:"boolean",...g(t)})}function Er(e,t){return new e({type:"undefined",...g(t)})}function Cr(e,t){return new e({type:"null",...g(t)})}function Nr(e){return new e({type:"unknown"})}function qr(e,t){return new e({type:"never",...g(t)})}function Lt(e,t){return new po({check:"less_than",...g(t),value:e,inclusive:!1})}function Fe(e,t){return new po({check:"less_than",...g(t),value:e,inclusive:!0})}function jt(e,t){return new ho({check:"greater_than",...g(t),value:e,inclusive:!1})}function Be(e,t){return new ho({check:"greater_than",...g(t),value:e,inclusive:!0})}function Ht(e,t){return new Wn({check:"multiple_of",...g(t),value:e})}function _o(e,t){return new Jn({check:"max_length",...g(t),maximum:e})}function Ee(e,t){return new Kn({check:"min_length",...g(t),minimum:e})}function vo(e,t){return new Qn({check:"length_equals",...g(t),length:e})}function Mr(e,t){return new Yn({check:"string_format",format:"regex",...g(t),pattern:e})}function Ar(e){return new Xn({check:"string_format",format:"lowercase",...g(e)})}function Or(e){return new es({check:"string_format",format:"uppercase",...g(e)})}function Dr(e,t){return new ts({check:"string_format",format:"includes",...g(t),includes:e})}function Ur(e,t){return new os({check:"string_format",format:"starts_with",...g(t),prefix:e})}function Lr(e,t){return new ns({check:"string_format",format:"ends_with",...g(t),suffix:e})}function fe(e){return new ss({check:"overwrite",tx:e})}function jr(e){return fe(t=>t.normalize(e))}function Hr(){return fe(e=>e.trim())}function Fr(){return fe(e=>e.toLowerCase())}function Br(){return fe(e=>e.toUpperCase())}function Vr(e,t,o){return new e({type:"array",element:t,...g(o)})}function Wr(e,t,o){const n=g(o);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function Gr(e,t,o){return new e({type:"custom",check:"custom",fn:t,...g(o)})}function nt(e){return!!e._zod}function bo(e,t){return nt(e)?ro(e,t):e.safeParse(t)}function Jr(e){if(!e)return;let t;if(nt(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Kr(e){if(nt(e)){const r=e._zod?.def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}}const o=e._def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}const n=e.value;if(n!==void 0)return n}const Qr=d("ZodISODateTime",(e,t)=>{vs.init(e,t),N.init(e,t)});function yo(e){return Tr(Qr,e)}const Yr=d("ZodISODate",(e,t)=>{bs.init(e,t),N.init(e,t)});function Xr(e){return zr(Yr,e)}const ei=d("ZodISOTime",(e,t)=>{ys.init(e,t),N.init(e,t)});function ti(e){return Rr(ei,e)}const oi=d("ZodISODuration",(e,t)=>{ws.init(e,t),N.init(e,t)});function ni(e){return Ir(oi,e)}const si=(e,t)=>{oo.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:o=>mn(e,o)},flatten:{value:o=>hn(e,o)},addIssue:{value:o=>e.issues.push(o)},addIssues:{value:o=>e.issues.push(...o)},isEmpty:{get(){return e.issues.length===0}}})},De=d("ZodError",si,{Parent:Error}),ri=fn(De),ii=gn(De),ai=so(De),ci=io(De),C=d("ZodType",(e,t)=>($.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...o)=>e.clone({...t,checks:[...t.checks??[],...o.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),e.clone=(o,n)=>ne(e,o,n),e.brand=()=>e,e.register=((o,n)=>(o.add(e,n),e)),e.parse=(o,n)=>ri(e,o,n,{callee:e.parse}),e.safeParse=(o,n)=>ai(e,o,n),e.parseAsync=async(o,n)=>ii(e,o,n,{callee:e.parseAsync}),e.safeParseAsync=async(o,n)=>ci(e,o,n),e.spa=e.safeParseAsync,e.refine=(o,n)=>e.check(Xi(o,n)),e.superRefine=o=>e.check(ea(o)),e.overwrite=o=>e.check(fe(o)),e.optional=()=>q(e),e.nullable=()=>Vt(e),e.nullish=()=>q(Vt(e)),e.nonoptional=o=>Bi(e,o),e.array=()=>v(e),e.or=o=>w([e,o]),e.and=o=>st(e,o),e.transform=o=>Qe(e,Ro(o)),e.default=o=>ji(e,o),e.prefault=o=>Fi(e,o),e.catch=o=>Wi(e,o),e.pipe=o=>Qe(e,o),e.readonly=()=>Ki(e),e.describe=o=>{const n=e.clone();return Re.add(n,{description:o}),n},Object.defineProperty(e,"description",{get(){return Re.get(e)?.description},configurable:!0}),e.meta=(...o)=>{if(o.length===0)return Re.get(e);const n=e.clone();return Re.add(n,o[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),wo=d("_ZodString",(e,t)=>{ot.init(e,t),C.init(e,t);const o=e._zod.bag;e.format=o.format??null,e.minLength=o.minimum??null,e.maxLength=o.maximum??null,e.regex=(...n)=>e.check(Mr(...n)),e.includes=(...n)=>e.check(Dr(...n)),e.startsWith=(...n)=>e.check(Ur(...n)),e.endsWith=(...n)=>e.check(Lr(...n)),e.min=(...n)=>e.check(Ee(...n)),e.max=(...n)=>e.check(_o(...n)),e.length=(...n)=>e.check(vo(...n)),e.nonempty=(...n)=>e.check(Ee(1,...n)),e.lowercase=n=>e.check(Ar(n)),e.uppercase=n=>e.check(Or(n)),e.trim=()=>e.check(Hr()),e.normalize=(...n)=>e.check(jr(...n)),e.toLowerCase=()=>e.check(Fr()),e.toUpperCase=()=>e.check(Br())}),ui=d("ZodString",(e,t)=>{ot.init(e,t),wo.init(e,t),e.email=o=>e.check(sr(li,o)),e.url=o=>e.check(ur(di,o)),e.jwt=o=>e.check(xr(zi,o)),e.emoji=o=>e.check(lr(pi,o)),e.guid=o=>e.check(Ut(Ft,o)),e.uuid=o=>e.check(rr(Ie,o)),e.uuidv4=o=>e.check(ir(Ie,o)),e.uuidv6=o=>e.check(ar(Ie,o)),e.uuidv7=o=>e.check(cr(Ie,o)),e.nanoid=o=>e.check(dr(hi,o)),e.guid=o=>e.check(Ut(Ft,o)),e.cuid=o=>e.check(pr(mi,o)),e.cuid2=o=>e.check(hr(fi,o)),e.ulid=o=>e.check(mr(gi,o)),e.base64=o=>e.check(wr(Si,o)),e.base64url=o=>e.check(kr(xi,o)),e.xid=o=>e.check(fr(_i,o)),e.ksuid=o=>e.check(gr(vi,o)),e.ipv4=o=>e.check(_r(bi,o)),e.ipv6=o=>e.check(vr(yi,o)),e.cidrv4=o=>e.check(br(wi,o)),e.cidrv6=o=>e.check(yr(ki,o)),e.e164=o=>e.check(Sr(Ti,o)),e.datetime=o=>e.check(yo(o)),e.date=o=>e.check(Xr(o)),e.time=o=>e.check(ti(o)),e.duration=o=>e.check(ni(o))});function u(e){return nr(ui,e)}const N=d("ZodStringFormat",(e,t)=>{E.init(e,t),wo.init(e,t)}),li=d("ZodEmail",(e,t)=>{us.init(e,t),N.init(e,t)}),Ft=d("ZodGUID",(e,t)=>{as.init(e,t),N.init(e,t)}),Ie=d("ZodUUID",(e,t)=>{cs.init(e,t),N.init(e,t)}),di=d("ZodURL",(e,t)=>{ls.init(e,t),N.init(e,t)}),pi=d("ZodEmoji",(e,t)=>{ds.init(e,t),N.init(e,t)}),hi=d("ZodNanoID",(e,t)=>{ps.init(e,t),N.init(e,t)}),mi=d("ZodCUID",(e,t)=>{hs.init(e,t),N.init(e,t)}),fi=d("ZodCUID2",(e,t)=>{ms.init(e,t),N.init(e,t)}),gi=d("ZodULID",(e,t)=>{fs.init(e,t),N.init(e,t)}),_i=d("ZodXID",(e,t)=>{gs.init(e,t),N.init(e,t)}),vi=d("ZodKSUID",(e,t)=>{_s.init(e,t),N.init(e,t)}),bi=d("ZodIPv4",(e,t)=>{ks.init(e,t),N.init(e,t)}),yi=d("ZodIPv6",(e,t)=>{Ss.init(e,t),N.init(e,t)}),wi=d("ZodCIDRv4",(e,t)=>{xs.init(e,t),N.init(e,t)}),ki=d("ZodCIDRv6",(e,t)=>{Ts.init(e,t),N.init(e,t)}),Si=d("ZodBase64",(e,t)=>{zs.init(e,t),N.init(e,t)}),xi=d("ZodBase64URL",(e,t)=>{Is.init(e,t),N.init(e,t)}),Ti=d("ZodE164",(e,t)=>{$s.init(e,t),N.init(e,t)}),zi=d("ZodJWT",(e,t)=>{Zs.init(e,t),N.init(e,t)}),ko=d("ZodNumber",(e,t)=>{fo.init(e,t),C.init(e,t),e.gt=(n,s)=>e.check(jt(n,s)),e.gte=(n,s)=>e.check(Be(n,s)),e.min=(n,s)=>e.check(Be(n,s)),e.lt=(n,s)=>e.check(Lt(n,s)),e.lte=(n,s)=>e.check(Fe(n,s)),e.max=(n,s)=>e.check(Fe(n,s)),e.int=n=>e.check(Bt(n)),e.safe=n=>e.check(Bt(n)),e.positive=n=>e.check(jt(0,n)),e.nonnegative=n=>e.check(Be(0,n)),e.negative=n=>e.check(Lt(0,n)),e.nonpositive=n=>e.check(Fe(0,n)),e.multipleOf=(n,s)=>e.check(Ht(n,s)),e.step=(n,s)=>e.check(Ht(n,s)),e.finite=()=>e;const o=e._zod.bag;e.minValue=Math.max(o.minimum??Number.NEGATIVE_INFINITY,o.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(o.maximum??Number.POSITIVE_INFINITY,o.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(o.format??"").includes("int")||Number.isSafeInteger(o.multipleOf??.5),e.isFinite=!0,e.format=o.format??null});function y(e){return $r(ko,e)}const Ri=d("ZodNumberFormat",(e,t)=>{Es.init(e,t),ko.init(e,t)});function Bt(e){return Pr(Ri,e)}const Ii=d("ZodBoolean",(e,t)=>{Cs.init(e,t),C.init(e,t)});function I(e){return Zr(Ii,e)}const $i=d("ZodUndefined",(e,t)=>{Ns.init(e,t),C.init(e,t)});function Je(e){return Er($i,e)}const Pi=d("ZodNull",(e,t)=>{qs.init(e,t),C.init(e,t)});function So(e){return Cr(Pi,e)}const Zi=d("ZodUnknown",(e,t)=>{Ms.init(e,t),C.init(e,t)});function R(){return Nr(Zi)}const Ei=d("ZodNever",(e,t)=>{As.init(e,t),C.init(e,t)});function Ci(e){return qr(Ei,e)}const Ni=d("ZodArray",(e,t)=>{Os.init(e,t),C.init(e,t),e.element=t.element,e.min=(o,n)=>e.check(Ee(o,n)),e.nonempty=o=>e.check(Ee(1,o)),e.max=(o,n)=>e.check(_o(o,n)),e.length=(o,n)=>e.check(vo(o,n)),e.unwrap=()=>e.element});function v(e,t){return Vr(Ni,e,t)}const xo=d("ZodObject",(e,t)=>{Ds.init(e,t),C.init(e,t),P(e,"shape",()=>t.shape),e.keyof=()=>F(Object.keys(e._zod.def.shape)),e.catchall=o=>e.clone({...e._zod.def,catchall:o}),e.passthrough=()=>e.clone({...e._zod.def,catchall:R()}),e.loose=()=>e.clone({...e._zod.def,catchall:R()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ci()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=o=>un(e,o),e.merge=o=>ln(e,o),e.pick=o=>an(e,o),e.omit=o=>cn(e,o),e.partial=(...o)=>dn(Io,e,o[0]),e.required=(...o)=>pn($o,e,o[0])});function l(e,t){const o={type:"object",get shape(){return Ae(this,"shape",{...e}),this.shape},...g(t)};return new xo(o)}function j(e,t){return new xo({type:"object",get shape(){return Ae(this,"shape",{...e}),this.shape},catchall:R(),...g(t)})}const To=d("ZodUnion",(e,t)=>{go.init(e,t),C.init(e,t),e.options=t.options});function w(e,t){return new To({type:"union",options:e,...g(t)})}const qi=d("ZodDiscriminatedUnion",(e,t)=>{To.init(e,t),Us.init(e,t)});function zo(e,t,o){return new qi({type:"union",options:t,discriminator:e,...g(o)})}const Mi=d("ZodIntersection",(e,t)=>{Ls.init(e,t),C.init(e,t)});function st(e,t){return new Mi({type:"intersection",left:e,right:t})}const Ai=d("ZodRecord",(e,t)=>{js.init(e,t),C.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function z(e,t,o){return new Ai({type:"record",keyType:e,valueType:t,...g(o)})}const Ke=d("ZodEnum",(e,t)=>{Hs.init(e,t),C.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const o=new Set(Object.keys(t.entries));e.extract=(n,s)=>{const r={};for(const i of n)if(o.has(i))r[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Ke({...t,checks:[],...g(s),entries:r})},e.exclude=(n,s)=>{const r={...t.entries};for(const i of n)if(o.has(i))delete r[i];else throw new Error(`Key ${i} not found in enum`);return new Ke({...t,checks:[],...g(s),entries:r})}});function F(e,t){const o=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Ke({type:"enum",entries:o,...g(t)})}const Oi=d("ZodLiteral",(e,t)=>{Fs.init(e,t),C.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function c(e,t){return new Oi({type:"literal",values:Array.isArray(e)?e:[e],...g(t)})}const Di=d("ZodTransform",(e,t)=>{Bs.init(e,t),C.init(e,t),e._zod.parse=(o,n)=>{o.addIssue=r=>{if(typeof r=="string")o.issues.push(pe(r,o.value,t));else{const i=r;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=o.value),i.inst??(i.inst=e),i.continue??(i.continue=!0),o.issues.push(pe(i))}};const s=t.transform(o.value,o);return s instanceof Promise?s.then(r=>(o.value=r,o)):(o.value=s,o)}});function Ro(e){return new Di({type:"transform",transform:e})}const Io=d("ZodOptional",(e,t)=>{Vs.init(e,t),C.init(e,t),e.unwrap=()=>e._zod.def.innerType});function q(e){return new Io({type:"optional",innerType:e})}const Ui=d("ZodNullable",(e,t)=>{Ws.init(e,t),C.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Vt(e){return new Ui({type:"nullable",innerType:e})}const Li=d("ZodDefault",(e,t)=>{Gs.init(e,t),C.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ji(e,t){return new Li({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const Hi=d("ZodPrefault",(e,t)=>{Js.init(e,t),C.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Fi(e,t){return new Hi({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const $o=d("ZodNonOptional",(e,t)=>{Ks.init(e,t),C.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Bi(e,t){return new $o({type:"nonoptional",innerType:e,...g(t)})}const Vi=d("ZodCatch",(e,t)=>{Qs.init(e,t),C.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Wi(e,t){return new Vi({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Gi=d("ZodPipe",(e,t)=>{Ys.init(e,t),C.init(e,t),e.in=t.in,e.out=t.out});function Qe(e,t){return new Gi({type:"pipe",in:e,out:t})}const Ji=d("ZodReadonly",(e,t)=>{Xs.init(e,t),C.init(e,t)});function Ki(e){return new Ji({type:"readonly",innerType:e})}const Po=d("ZodCustom",(e,t)=>{er.init(e,t),C.init(e,t)});function Qi(e){const t=new H({check:"custom"});return t._zod.check=e,t}function Yi(e,t){return Wr(Po,e??(()=>!0),t)}function Xi(e,t={}){return Gr(Po,e,t)}function ea(e){const t=Qi(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(pe(n,o.value,t._zod.def));else{const s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=o.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),o.issues.push(pe(s))}},e(o.value,o)));return t}function Zo(e,t){return Qe(Ro(e),t)}const ee="io.modelcontextprotocol/related-task",Ue="2.0",A=Yi(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Eo=w([u(),y().int()]),Co=u();j({ttl:w([y(),So()]).optional(),pollInterval:y().optional()});const ta=l({ttl:y().optional()}),oa=l({taskId:u()}),rt=j({progressToken:Eo.optional(),[ee]:oa.optional()}),B=l({_meta:rt.optional()}),ge=B.extend({task:ta.optional()}),na=e=>ge.safeParse(e).success,O=l({method:u(),params:B.loose().optional()}),V=l({_meta:rt.optional()}),W=l({method:u(),params:V.loose().optional()}),D=j({_meta:rt.optional()}),_e=w([u(),y().int()]),No=l({jsonrpc:c(Ue),id:_e,...O.shape}).strict(),Wt=e=>No.safeParse(e).success,qo=l({jsonrpc:c(Ue),...W.shape}).strict(),sa=e=>qo.safeParse(e).success,it=l({jsonrpc:c(Ue),id:_e,result:D}).strict(),$e=e=>it.safeParse(e).success;var T;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",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.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(T||(T={}));const at=l({jsonrpc:c(Ue),id:_e.optional(),error:l({code:y().int(),message:u(),data:R().optional()})}).strict(),ra=e=>at.safeParse(e).success,ia=w([No,qo,it,at]);w([it,at]);const ct=D.strict(),aa=V.extend({requestId:_e.optional(),reason:u().optional()}),ut=W.extend({method:c("notifications/cancelled"),params:aa}),ca=l({src:u(),mimeType:u().optional(),sizes:v(u()).optional(),theme:F(["light","dark"]).optional()}),ve=l({icons:v(ca).optional()}),se=l({name:u(),title:u().optional()}),Le=se.extend({...se.shape,...ve.shape,version:u(),websiteUrl:u().optional(),description:u().optional()}),ua=st(l({applyDefaults:I().optional()}),z(u(),R())),la=Zo(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,st(l({form:ua.optional(),url:A.optional()}),z(u(),R()).optional())),da=j({list:A.optional(),cancel:A.optional(),requests:j({sampling:j({createMessage:A.optional()}).optional(),elicitation:j({create:A.optional()}).optional()}).optional()}),pa=j({list:A.optional(),cancel:A.optional(),requests:j({tools:j({call:A.optional()}).optional()}).optional()}),ha=l({experimental:z(u(),A).optional(),sampling:l({context:A.optional(),tools:A.optional()}).optional(),elicitation:la.optional(),roots:l({listChanged:I().optional()}).optional(),tasks:da.optional()}),ma=B.extend({protocolVersion:u(),capabilities:ha,clientInfo:Le}),fa=O.extend({method:c("initialize"),params:ma}),ga=l({experimental:z(u(),A).optional(),logging:A.optional(),completions:A.optional(),prompts:l({listChanged:I().optional()}).optional(),resources:l({subscribe:I().optional(),listChanged:I().optional()}).optional(),tools:l({listChanged:I().optional()}).optional(),tasks:pa.optional()}),_a=D.extend({protocolVersion:u(),capabilities:ga,serverInfo:Le,instructions:u().optional()}),va=W.extend({method:c("notifications/initialized"),params:V.optional()}),je=O.extend({method:c("ping"),params:B.optional()}),ba=l({progress:y(),total:q(y()),message:q(u())}),ya=l({...V.shape,...ba.shape,progressToken:Eo}),lt=W.extend({method:c("notifications/progress"),params:ya}),wa=B.extend({cursor:Co.optional()}),be=O.extend({params:wa.optional()}),ye=D.extend({nextCursor:Co.optional()}),ka=F(["working","input_required","completed","failed","cancelled"]),we=l({taskId:u(),status:ka,ttl:w([y(),So()]),createdAt:u(),lastUpdatedAt:u(),pollInterval:q(y()),statusMessage:q(u())}),dt=D.extend({task:we}),Sa=V.merge(we),Ce=W.extend({method:c("notifications/tasks/status"),params:Sa}),pt=O.extend({method:c("tasks/get"),params:B.extend({taskId:u()})}),ht=D.merge(we),mt=O.extend({method:c("tasks/result"),params:B.extend({taskId:u()})});D.loose();const ft=be.extend({method:c("tasks/list")}),gt=ye.extend({tasks:v(we)}),_t=O.extend({method:c("tasks/cancel"),params:B.extend({taskId:u()})}),xa=D.merge(we),Mo=l({uri:u(),mimeType:q(u()),_meta:z(u(),R()).optional()}),Ao=Mo.extend({text:u()}),vt=u().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Oo=Mo.extend({blob:vt}),ke=F(["user","assistant"]),re=l({audience:v(ke).optional(),priority:y().min(0).max(1).optional(),lastModified:yo({offset:!0}).optional()}),Do=l({...se.shape,...ve.shape,uri:u(),description:q(u()),mimeType:q(u()),annotations:re.optional(),_meta:q(j({}))}),Ta=l({...se.shape,...ve.shape,uriTemplate:u(),description:q(u()),mimeType:q(u()),annotations:re.optional(),_meta:q(j({}))}),za=be.extend({method:c("resources/list")}),Uo=ye.extend({resources:v(Do)}),Ra=be.extend({method:c("resources/templates/list")}),Ia=ye.extend({resourceTemplates:v(Ta)}),bt=B.extend({uri:u()}),$a=bt,Pa=O.extend({method:c("resources/read"),params:$a}),Lo=D.extend({contents:v(w([Ao,Oo]))}),Za=W.extend({method:c("notifications/resources/list_changed"),params:V.optional()}),Ea=bt,Ca=O.extend({method:c("resources/subscribe"),params:Ea}),Na=bt,qa=O.extend({method:c("resources/unsubscribe"),params:Na}),Ma=V.extend({uri:u()}),Aa=W.extend({method:c("notifications/resources/updated"),params:Ma}),Oa=l({name:u(),description:q(u()),required:q(I())}),Da=l({...se.shape,...ve.shape,description:q(u()),arguments:q(v(Oa)),_meta:q(j({}))}),Ua=be.extend({method:c("prompts/list")}),La=ye.extend({prompts:v(Da)}),ja=B.extend({name:u(),arguments:z(u(),u()).optional()}),Ha=O.extend({method:c("prompts/get"),params:ja}),yt=l({type:c("text"),text:u(),annotations:re.optional(),_meta:z(u(),R()).optional()}),wt=l({type:c("image"),data:vt,mimeType:u(),annotations:re.optional(),_meta:z(u(),R()).optional()}),kt=l({type:c("audio"),data:vt,mimeType:u(),annotations:re.optional(),_meta:z(u(),R()).optional()}),Fa=l({type:c("tool_use"),name:u(),id:u(),input:z(u(),R()),_meta:z(u(),R()).optional()}),jo=l({type:c("resource"),resource:w([Ao,Oo]),annotations:re.optional(),_meta:z(u(),R()).optional()}),Ho=Do.extend({type:c("resource_link")}),Se=w([yt,wt,kt,Ho,jo]),Ba=l({role:ke,content:Se}),Va=D.extend({description:u().optional(),messages:v(Ba)}),Wa=W.extend({method:c("notifications/prompts/list_changed"),params:V.optional()}),Ga=l({title:u().optional(),readOnlyHint:I().optional(),destructiveHint:I().optional(),idempotentHint:I().optional(),openWorldHint:I().optional()}),Ja=l({taskSupport:F(["required","optional","forbidden"]).optional()}),St=l({...se.shape,...ve.shape,description:u().optional(),inputSchema:l({type:c("object"),properties:z(u(),A).optional(),required:v(u()).optional()}).catchall(R()),outputSchema:l({type:c("object"),properties:z(u(),A).optional(),required:v(u()).optional()}).catchall(R()).optional(),annotations:Ga.optional(),execution:Ja.optional(),_meta:z(u(),R()).optional()}),Fo=be.extend({method:c("tools/list")}),Ka=ye.extend({tools:v(St)}),He=D.extend({content:v(Se).default([]),structuredContent:z(u(),R()).optional(),isError:I().optional()});He.or(D.extend({toolResult:R()}));const Qa=ge.extend({name:u(),arguments:z(u(),R()).optional()}),Bo=O.extend({method:c("tools/call"),params:Qa}),Ya=W.extend({method:c("notifications/tools/list_changed"),params:V.optional()});l({autoRefresh:I().default(!0),debounceMs:y().int().nonnegative().default(300)});const Vo=F(["debug","info","notice","warning","error","critical","alert","emergency"]),Xa=B.extend({level:Vo}),ec=O.extend({method:c("logging/setLevel"),params:Xa}),tc=V.extend({level:Vo,logger:u().optional(),data:R()}),oc=W.extend({method:c("notifications/message"),params:tc}),nc=l({name:u().optional()}),sc=l({hints:v(nc).optional(),costPriority:y().min(0).max(1).optional(),speedPriority:y().min(0).max(1).optional(),intelligencePriority:y().min(0).max(1).optional()}),rc=l({mode:F(["auto","required","none"]).optional()}),ic=l({type:c("tool_result"),toolUseId:u().describe("The unique identifier for the corresponding tool call."),content:v(Se).default([]),structuredContent:l({}).loose().optional(),isError:I().optional(),_meta:z(u(),R()).optional()}),ac=zo("type",[yt,wt,kt]),Ne=zo("type",[yt,wt,kt,Fa,ic]),cc=l({role:ke,content:w([Ne,v(Ne)]),_meta:z(u(),R()).optional()}),uc=ge.extend({messages:v(cc),modelPreferences:sc.optional(),systemPrompt:u().optional(),includeContext:F(["none","thisServer","allServers"]).optional(),temperature:y().optional(),maxTokens:y().int(),stopSequences:v(u()).optional(),metadata:A.optional(),tools:v(St).optional(),toolChoice:rc.optional()}),lc=O.extend({method:c("sampling/createMessage"),params:uc}),dc=D.extend({model:u(),stopReason:q(F(["endTurn","stopSequence","maxTokens"]).or(u())),role:ke,content:ac}),pc=D.extend({model:u(),stopReason:q(F(["endTurn","stopSequence","maxTokens","toolUse"]).or(u())),role:ke,content:w([Ne,v(Ne)])}),hc=l({type:c("boolean"),title:u().optional(),description:u().optional(),default:I().optional()}),mc=l({type:c("string"),title:u().optional(),description:u().optional(),minLength:y().optional(),maxLength:y().optional(),format:F(["email","uri","date","date-time"]).optional(),default:u().optional()}),fc=l({type:F(["number","integer"]),title:u().optional(),description:u().optional(),minimum:y().optional(),maximum:y().optional(),default:y().optional()}),gc=l({type:c("string"),title:u().optional(),description:u().optional(),enum:v(u()),default:u().optional()}),_c=l({type:c("string"),title:u().optional(),description:u().optional(),oneOf:v(l({const:u(),title:u()})),default:u().optional()}),vc=l({type:c("string"),title:u().optional(),description:u().optional(),enum:v(u()),enumNames:v(u()).optional(),default:u().optional()}),bc=w([gc,_c]),yc=l({type:c("array"),title:u().optional(),description:u().optional(),minItems:y().optional(),maxItems:y().optional(),items:l({type:c("string"),enum:v(u())}),default:v(u()).optional()}),wc=l({type:c("array"),title:u().optional(),description:u().optional(),minItems:y().optional(),maxItems:y().optional(),items:l({anyOf:v(l({const:u(),title:u()}))}),default:v(u()).optional()}),kc=w([yc,wc]),Sc=w([vc,bc,kc]),xc=w([Sc,hc,mc,fc]),Tc=ge.extend({mode:c("form").optional(),message:u(),requestedSchema:l({type:c("object"),properties:z(u(),xc),required:v(u()).optional()})}),zc=ge.extend({mode:c("url"),message:u(),elicitationId:u(),url:u().url()}),Rc=w([Tc,zc]),Ic=O.extend({method:c("elicitation/create"),params:Rc}),$c=V.extend({elicitationId:u()}),Pc=W.extend({method:c("notifications/elicitation/complete"),params:$c}),Zc=D.extend({action:F(["accept","decline","cancel"]),content:Zo(e=>e===null?void 0:e,z(u(),w([u(),y(),I(),v(u())])).optional())}),Ec=l({type:c("ref/resource"),uri:u()}),Cc=l({type:c("ref/prompt"),name:u()}),Nc=B.extend({ref:w([Cc,Ec]),argument:l({name:u(),value:u()}),context:l({arguments:z(u(),u()).optional()}).optional()}),qc=O.extend({method:c("completion/complete"),params:Nc}),Mc=D.extend({completion:j({values:v(u()).max(100),total:q(y().int()),hasMore:q(I())})}),Ac=l({uri:u().startsWith("file://"),name:u().optional(),_meta:z(u(),R()).optional()}),Oc=O.extend({method:c("roots/list"),params:B.optional()}),Dc=D.extend({roots:v(Ac)}),Uc=W.extend({method:c("notifications/roots/list_changed"),params:V.optional()});w([je,fa,qc,ec,Ha,Ua,za,Ra,Pa,Ca,qa,Bo,Fo,pt,mt,ft,_t]);w([ut,lt,va,Uc,Ce]);w([ct,dc,pc,Zc,Dc,ht,gt,dt]);w([je,lc,Ic,Oc,pt,mt,ft,_t]);w([ut,lt,oc,Aa,Za,Ya,Wa,Ce,Pc]);w([ct,_a,Mc,Va,La,Uo,Ia,Lo,He,Ka,ht,gt,dt]);class x extends Error{constructor(t,o,n){super(`MCP error ${t}: ${o}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,o,n){if(t===T.UrlElicitationRequired&&n){const s=n;if(s.elicitations)return new Lc(s.elicitations,o)}return new x(t,o,n)}}class Lc extends x{constructor(t,o=`URL elicitation${t.length>1?"s":""} required`){super(T.UrlElicitationRequired,o,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}}function X(e){return e==="completed"||e==="failed"||e==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Gt(e){const o=Jr(e)?.method;if(!o)throw new Error("Schema is missing a method literal");const n=Kr(o);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Jt(e,t){const o=bo(e,t);if(!o.success)throw o.error;return o.data}const jc=6e4;class Hc{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(ut,o=>{this._oncancel(o)}),this.setNotificationHandler(lt,o=>{this._onprogress(o)}),this.setRequestHandler(je,o=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(pt,async(o,n)=>{const s=await this._taskStore.getTask(o.params.taskId,n.sessionId);if(!s)throw new x(T.InvalidParams,"Failed to retrieve task: Task not found");return{...s}}),this.setRequestHandler(mt,async(o,n)=>{const s=async()=>{const r=o.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(r,n.sessionId);){if(a.type==="response"||a.type==="error"){const p=a.message,h=p.id,f=this._requestResolvers.get(h);if(f)if(this._requestResolvers.delete(h),a.type==="response")f(p);else{const m=p,_=new x(m.error.code,m.error.message,m.error.data);f(_)}else{const m=a.type==="response"?"Response":"Error";this._onerror(new Error(`${m} handler missing for request ${h}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}const i=await this._taskStore.getTask(r,n.sessionId);if(!i)throw new x(T.InvalidParams,`Task not found: ${r}`);if(!X(i.status))return await this._waitForTaskUpdate(r,n.signal),await s();if(X(i.status)){const a=await this._taskStore.getTaskResult(r,n.sessionId);return this._clearTaskQueue(r),{...a,_meta:{...a._meta,[ee]:{taskId:r}}}}return await s()};return await s()}),this.setRequestHandler(ft,async(o,n)=>{try{const{tasks:s,nextCursor:r}=await this._taskStore.listTasks(o.params?.cursor,n.sessionId);return{tasks:s,nextCursor:r,_meta:{}}}catch(s){throw new x(T.InvalidParams,`Failed to list tasks: ${s instanceof Error?s.message:String(s)}`)}}),this.setRequestHandler(_t,async(o,n)=>{try{const s=await this._taskStore.getTask(o.params.taskId,n.sessionId);if(!s)throw new x(T.InvalidParams,`Task not found: ${o.params.taskId}`);if(X(s.status))throw new x(T.InvalidParams,`Cannot cancel task in terminal status: ${s.status}`);await this._taskStore.updateTaskStatus(o.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(o.params.taskId);const r=await this._taskStore.getTask(o.params.taskId,n.sessionId);if(!r)throw new x(T.InvalidParams,`Task not found after cancellation: ${o.params.taskId}`);return{_meta:{},...r}}catch(s){throw s instanceof x?s:new x(T.InvalidRequest,`Failed to cancel task: ${s instanceof Error?s.message:String(s)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,o,n,s,r=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(s,o),startTime:Date.now(),timeout:o,maxTotalTimeout:n,resetTimeoutOnProgress:r,onTimeout:s})}_resetTimeout(t){const o=this._timeoutInfo.get(t);if(!o)return!1;const n=Date.now()-o.startTime;if(o.maxTotalTimeout&&n>=o.maxTotalTimeout)throw this._timeoutInfo.delete(t),x.fromError(T.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:o.maxTotalTimeout,totalElapsed:n});return clearTimeout(o.timeoutId),o.timeoutId=setTimeout(o.onTimeout,o.timeout),!0}_cleanupTimeout(t){const o=this._timeoutInfo.get(t);o&&(clearTimeout(o.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;const o=this.transport?.onclose;this._transport.onclose=()=>{o?.(),this._onclose()};const n=this.transport?.onerror;this._transport.onerror=r=>{n?.(r),this._onerror(r)};const s=this._transport?.onmessage;this._transport.onmessage=(r,i)=>{s?.(r,i),$e(r)||ra(r)?this._onresponse(r):Wt(r)?this._onrequest(r,i):sa(r)?this._onnotification(r):this._onerror(new Error(`Unknown message type: ${JSON.stringify(r)}`))},await this._transport.start()}_onclose(){const t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(const n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();const o=x.fromError(T.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(const n of t.values())n(o)}_onerror(t){this.onerror?.(t)}_onnotification(t){const o=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;o!==void 0&&Promise.resolve().then(()=>o(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,o){const n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,s=this._transport,r=t.params?._meta?.[ee]?.taskId;if(n===void 0){const f={jsonrpc:"2.0",id:t.id,error:{code:T.MethodNotFound,message:"Method not found"}};r&&this._taskMessageQueue?this._enqueueTaskMessage(r,{type:"error",message:f,timestamp:Date.now()},s?.sessionId).catch(m=>this._onerror(new Error(`Failed to enqueue error response: ${m}`))):s?.send(f).catch(m=>this._onerror(new Error(`Failed to send an error response: ${m}`)));return}const i=new AbortController;this._requestHandlerAbortControllers.set(t.id,i);const a=na(t.params)?t.params.task:void 0,p=this._taskStore?this.requestTaskStore(t,s?.sessionId):void 0,h={signal:i.signal,sessionId:s?.sessionId,_meta:t.params?._meta,sendNotification:async f=>{if(i.signal.aborted)return;const m={relatedRequestId:t.id};r&&(m.relatedTask={taskId:r}),await this.notification(f,m)},sendRequest:async(f,m,_)=>{if(i.signal.aborted)throw new x(T.ConnectionClosed,"Request was cancelled");const b={..._,relatedRequestId:t.id};r&&!b.relatedTask&&(b.relatedTask={taskId:r});const M=b.relatedTask?.taskId??r;return M&&p&&await p.updateTaskStatus(M,"input_required"),await this.request(f,m,b)},authInfo:o?.authInfo,requestId:t.id,requestInfo:o?.requestInfo,taskId:r,taskStore:p,taskRequestedTtl:a?.ttl,closeSSEStream:o?.closeSSEStream,closeStandaloneSSEStream:o?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,h)).then(async f=>{if(i.signal.aborted)return;const m={result:f,jsonrpc:"2.0",id:t.id};r&&this._taskMessageQueue?await this._enqueueTaskMessage(r,{type:"response",message:m,timestamp:Date.now()},s?.sessionId):await s?.send(m)},async f=>{if(i.signal.aborted)return;const m={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(f.code)?f.code:T.InternalError,message:f.message??"Internal error",...f.data!==void 0&&{data:f.data}}};r&&this._taskMessageQueue?await this._enqueueTaskMessage(r,{type:"error",message:m,timestamp:Date.now()},s?.sessionId):await s?.send(m)}).catch(f=>this._onerror(new Error(`Failed to send response: ${f}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){const{progressToken:o,...n}=t.params,s=Number(o),r=this._progressHandlers.get(s);if(!r){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}const i=this._responseHandlers.get(s),a=this._timeoutInfo.get(s);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(s)}catch(p){this._responseHandlers.delete(s),this._progressHandlers.delete(s),this._cleanupTimeout(s),i(p);return}r(n)}_onresponse(t){const o=Number(t.id),n=this._requestResolvers.get(o);if(n){if(this._requestResolvers.delete(o),$e(t))n(t);else{const i=new x(t.error.code,t.error.message,t.error.data);n(i)}return}const s=this._responseHandlers.get(o);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(o),this._cleanupTimeout(o);let r=!1;if($e(t)&&t.result&&typeof t.result=="object"){const i=t.result;if(i.task&&typeof i.task=="object"){const a=i.task;typeof a.taskId=="string"&&(r=!0,this._taskProgressTokens.set(a.taskId,o))}}if(r||this._progressHandlers.delete(o),$e(t))s(t);else{const i=x.fromError(t.error.code,t.error.message,t.error.data);s(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,o,n){const{task:s}=n??{};if(!s){try{yield{type:"result",result:await this.request(t,o,n)}}catch(i){yield{type:"error",error:i instanceof x?i:new x(T.InternalError,String(i))}}return}let r;try{const i=await this.request(t,dt,n);if(i.task)r=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new x(T.InternalError,"Task creation did not return a task");for(;;){const a=await this.getTask({taskId:r},n);if(yield{type:"taskStatus",task:a},X(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:r},o,n)}:a.status==="failed"?yield{type:"error",error:new x(T.InternalError,`Task ${r} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new x(T.InternalError,`Task ${r} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:r},o,n)};return}const p=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(h=>setTimeout(h,p)),n?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof x?i:new x(T.InternalError,String(i))}}}request(t,o,n){const{relatedRequestId:s,resumptionToken:r,onresumptiontoken:i,task:a,relatedTask:p}=n??{};return new Promise((h,f)=>{const m=S=>{f(S)};if(!this._transport){m(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(S){m(S);return}n?.signal?.throwIfAborted();const _=this._requestMessageId++,b={...t,jsonrpc:"2.0",id:_};n?.onprogress&&(this._progressHandlers.set(_,n.onprogress),b.params={...t.params,_meta:{...t.params?._meta||{},progressToken:_}}),a&&(b.params={...b.params,task:a}),p&&(b.params={...b.params,_meta:{...b.params?._meta||{},[ee]:p}});const M=S=>{this._responseHandlers.delete(_),this._progressHandlers.delete(_),this._cleanupTimeout(_),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:_,reason:String(S)}},{relatedRequestId:s,resumptionToken:r,onresumptiontoken:i}).catch(Z=>this._onerror(new Error(`Failed to send cancellation: ${Z}`)));const k=S instanceof x?S:new x(T.RequestTimeout,String(S));f(k)};this._responseHandlers.set(_,S=>{if(!n?.signal?.aborted){if(S instanceof Error)return f(S);try{const k=bo(o,S.result);k.success?h(k.data):f(k.error)}catch(k){f(k)}}}),n?.signal?.addEventListener("abort",()=>{M(n?.signal?.reason)});const L=n?.timeout??jc,G=()=>M(x.fromError(T.RequestTimeout,"Request timed out",{timeout:L}));this._setupTimeout(_,L,n?.maxTotalTimeout,G,n?.resetTimeoutOnProgress??!1);const Y=p?.taskId;if(Y){const S=k=>{const Z=this._responseHandlers.get(_);Z?Z(k):this._onerror(new Error(`Response handler missing for side-channeled request ${_}`))};this._requestResolvers.set(_,S),this._enqueueTaskMessage(Y,{type:"request",message:b,timestamp:Date.now()}).catch(k=>{this._cleanupTimeout(_),f(k)})}else this._transport.send(b,{relatedRequestId:s,resumptionToken:r,onresumptiontoken:i}).catch(S=>{this._cleanupTimeout(_),f(S)})})}async getTask(t,o){return this.request({method:"tasks/get",params:t},ht,o)}async getTaskResult(t,o,n){return this.request({method:"tasks/result",params:t},o,n)}async listTasks(t,o){return this.request({method:"tasks/list",params:t},gt,o)}async cancelTask(t,o){return this.request({method:"tasks/cancel",params:t},xa,o)}async notification(t,o){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);const n=o?.relatedTask?.taskId;if(n){const a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[ee]:o.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!o?.relatedRequestId&&!o?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let a={...t,jsonrpc:"2.0"};o?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[ee]:o.relatedTask}}}),this._transport?.send(a,o).catch(p=>this._onerror(p))});return}let i={...t,jsonrpc:"2.0"};o?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[ee]:o.relatedTask}}}),await this._transport.send(i,o)}setRequestHandler(t,o){const n=Gt(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(s,r)=>{const i=Jt(t,s);return Promise.resolve(o(i,r))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,o){const n=Gt(t);this._notificationHandlers.set(n,s=>{const r=Jt(t,s);return Promise.resolve(o(r))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){const o=this._taskProgressTokens.get(t);o!==void 0&&(this._progressHandlers.delete(o),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,o,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const s=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,o,n,s)}async _clearTaskQueue(t,o){if(this._taskMessageQueue){const n=await this._taskMessageQueue.dequeueAll(t,o);for(const s of n)if(s.type==="request"&&Wt(s.message)){const r=s.message.id,i=this._requestResolvers.get(r);i?(i(new x(T.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(r)):this._onerror(new Error(`Resolver missing for request ${r} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,o){let n=this._options?.defaultTaskPollInterval??1e3;try{const s=await this._taskStore?.getTask(t);s?.pollInterval&&(n=s.pollInterval)}catch{}return new Promise((s,r)=>{if(o.aborted){r(new x(T.InvalidRequest,"Request cancelled"));return}const i=setTimeout(s,n);o.addEventListener("abort",()=>{clearTimeout(i),r(new x(T.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,o){const n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async s=>{if(!t)throw new Error("No request provided");return await n.createTask(s,t.id,{method:t.method,params:t.params},o)},getTask:async s=>{const r=await n.getTask(s,o);if(!r)throw new x(T.InvalidParams,"Failed to retrieve task: Task not found");return r},storeTaskResult:async(s,r,i)=>{await n.storeTaskResult(s,r,i,o);const a=await n.getTask(s,o);if(a){const p=Ce.parse({method:"notifications/tasks/status",params:a});await this.notification(p),X(a.status)&&this._cleanupTaskProgressHandler(s)}},getTaskResult:s=>n.getTaskResult(s,o),updateTaskStatus:async(s,r,i)=>{const a=await n.getTask(s,o);if(!a)throw new x(T.InvalidParams,`Task "${s}" not found - it may have been cleaned up`);if(X(a.status))throw new x(T.InvalidParams,`Cannot update task "${s}" from terminal status "${a.status}" to "${r}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(s,r,i,o);const p=await n.getTask(s,o);if(p){const h=Ce.parse({method:"notifications/tasks/status",params:p});await this.notification(h),X(p.status)&&this._cleanupTaskProgressHandler(s)}},listTasks:s=>n.listTasks(s,o)}}}var Fc="2026-01-26",Bc="ui/notifications/tool-input-partial";class Wo{eventTarget;eventSource;messageListener;constructor(t=window.parent,o){this.eventTarget=t,this.eventSource=o,this.messageListener=n=>{if(o&&n.source!==this.eventSource){console.debug("Ignoring message from unknown source",n);return}let s=ia.safeParse(n.data);s.success?(console.debug("Parsed message",s.data),this.onmessage?.(s.data)):n.data?.jsonrpc!=="2.0"?console.debug("Ignoring non-JSON-RPC message",s.error.message,n):(console.error("Failed to parse message",s.error.message,n),this.onerror?.(Error("Invalid JSON-RPC message received: "+s.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(t,o){t.method!==Bc&&console.debug("Sending message",t),this.eventTarget.postMessage(t,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var Vc=w([c("light"),c("dark")]).describe("Color theme preference for the host environment."),he=w([c("inline"),c("fullscreen"),c("pip")]).describe("Display mode for UI presentation."),Wc=w([c("--color-background-primary"),c("--color-background-secondary"),c("--color-background-tertiary"),c("--color-background-inverse"),c("--color-background-ghost"),c("--color-background-info"),c("--color-background-danger"),c("--color-background-success"),c("--color-background-warning"),c("--color-background-disabled"),c("--color-text-primary"),c("--color-text-secondary"),c("--color-text-tertiary"),c("--color-text-inverse"),c("--color-text-ghost"),c("--color-text-info"),c("--color-text-danger"),c("--color-text-success"),c("--color-text-warning"),c("--color-text-disabled"),c("--color-border-primary"),c("--color-border-secondary"),c("--color-border-tertiary"),c("--color-border-inverse"),c("--color-border-ghost"),c("--color-border-info"),c("--color-border-danger"),c("--color-border-success"),c("--color-border-warning"),c("--color-border-disabled"),c("--color-ring-primary"),c("--color-ring-secondary"),c("--color-ring-inverse"),c("--color-ring-info"),c("--color-ring-danger"),c("--color-ring-success"),c("--color-ring-warning"),c("--font-sans"),c("--font-mono"),c("--font-weight-normal"),c("--font-weight-medium"),c("--font-weight-semibold"),c("--font-weight-bold"),c("--font-text-xs-size"),c("--font-text-sm-size"),c("--font-text-md-size"),c("--font-text-lg-size"),c("--font-heading-xs-size"),c("--font-heading-sm-size"),c("--font-heading-md-size"),c("--font-heading-lg-size"),c("--font-heading-xl-size"),c("--font-heading-2xl-size"),c("--font-heading-3xl-size"),c("--font-text-xs-line-height"),c("--font-text-sm-line-height"),c("--font-text-md-line-height"),c("--font-text-lg-line-height"),c("--font-heading-xs-line-height"),c("--font-heading-sm-line-height"),c("--font-heading-md-line-height"),c("--font-heading-lg-line-height"),c("--font-heading-xl-line-height"),c("--font-heading-2xl-line-height"),c("--font-heading-3xl-line-height"),c("--border-radius-xs"),c("--border-radius-sm"),c("--border-radius-md"),c("--border-radius-lg"),c("--border-radius-xl"),c("--border-radius-full"),c("--border-width-regular"),c("--shadow-hairline"),c("--shadow-sm"),c("--shadow-md"),c("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),Gc=z(Wc.describe(`Style variables for theming MCP apps.
|
|
31
|
+
path: iss.path ? [${le(k)}, ...iss.path] : [${le(k)}]
|
|
32
|
+
})));`),v.write(`newResult[${le(k)}] = ${y}.value`)}v.write("payload.value = newResult;"),v.write("return payload;");const W=v.compile();return(k,y)=>W(f,k,y)};let r;const s=Me,i=!ao.jitless,p=i&&hn.value,h=t.catchall;let m;e._zod.parse=(f,v)=>{m??(m=o.value);const b=f.value;if(!s(b))return f.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),f;const R=[];if(i&&p&&v?.async===!1&&v.jitless!==!0)r||(r=n(t.shape)),f=r(f,v);else{f.value={};const y=m.shape;for(const T of m.keys){const K=y[T],oe=K._zod.run({value:b[T],issues:[]},v),Mt=K._zod.optin==="optional"&&K._zod.optout==="optional";oe instanceof Promise?R.push(oe.then(Ot=>Mt?Lt(Ot,f,T,b):Pe(Ot,f,T))):Mt?Lt(oe,f,T,b):Pe(oe,f,T)}}if(!h)return R.length?Promise.all(R).then(()=>f):f;const w=[],j=m.keySet,W=h._zod,k=W.def.type;for(const y of Object.keys(b)){if(j.has(y))continue;if(k==="never"){w.push(y);continue}const T=W.run({value:b[y],issues:[]},v);T instanceof Promise?R.push(T.then(K=>Pe(K,f,y))):Pe(T,f,y)}return w.length&&f.issues.push({code:"unrecognized_keys",keys:w,input:b,inst:e}),R.length?Promise.all(R).then(()=>f):f}});function Ut(e,t,o,n){for(const r of e)if(r.issues.length===0)return t.value=r.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:o,errors:e.map(r=>r.issues.map(s=>ee(s,n,X())))}),t}const So=d("$ZodUnion",(e,t)=>{Z.init(e,t),C(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),C(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),C(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),C(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(n=>n._zod.pattern);return new RegExp(`^(${o.map(n=>at(n.source)).join("|")})$`)}}),e._zod.parse=(o,n)=>{let r=!1;const s=[];for(const i of t.options){const c=i._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)s.push(c),r=!0;else{if(c.issues.length===0)return c;s.push(c)}}return r?Promise.all(s).then(i=>Ut(i,o,e,n)):Ut(s,o,e,n)}}),Kr=d("$ZodDiscriminatedUnion",(e,t)=>{So.init(e,t);const o=e._zod.parse;C(e._zod,"propValues",()=>{const r={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[c,p]of Object.entries(i)){r[c]||(r[c]=new Set);for(const h of p)r[c].add(h)}}return r});const n=st(()=>{const r=t.options,s=new Map;for(const i of r){const 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(const p of c){if(s.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);s.set(p,i)}}return s});e._zod.parse=(r,s)=>{const i=r.value;if(!Me(i))return r.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),r;const c=n.value.get(i?.[t.discriminator]);return c?c._zod.run(r,s):t.unionFallback?o(r,s):(r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[t.discriminator],inst:e}),r)}}),Qr=d("$ZodIntersection",(e,t)=>{Z.init(e,t),e._zod.parse=(o,n)=>{const r=o.value,s=t.left._zod.run({value:r,issues:[]},n),i=t.right._zod.run({value:r,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([p,h])=>jt(o,p,h)):jt(o,s,i)}});function Ye(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(Oe(e)&&Oe(t)){const o=Object.keys(t),n=Object.keys(e).filter(s=>o.indexOf(s)!==-1),r={...e,...t};for(const s of n){const i=Ye(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};r[s]=i.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const o=[];for(let n=0;n<e.length;n++){const r=e[n],s=t[n],i=Ye(r,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};o.push(i.data)}return{valid:!0,data:o}}return{valid:!1,mergeErrorPath:[]}}function jt(e,t,o){if(t.issues.length&&e.issues.push(...t.issues),o.issues.length&&e.issues.push(...o.issues),pe(e))return e;const n=Ye(t.value,o.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const Yr=d("$ZodRecord",(e,t)=>{Z.init(e,t),e._zod.parse=(o,n)=>{const r=o.value;if(!Oe(r))return o.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),o;const s=[];if(t.keyType._zod.values){const i=t.keyType._zod.values;o.value={};for(const p of i)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){const h=t.valueType._zod.run({value:r[p],issues:[]},n);h instanceof Promise?s.push(h.then(m=>{m.issues.length&&o.issues.push(...se(p,m.issues)),o.value[p]=m.value})):(h.issues.length&&o.issues.push(...se(p,h.issues)),o.value[p]=h.value)}let c;for(const p in r)i.has(p)||(c=c??[],c.push(p));c&&c.length>0&&o.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:c})}else{o.value={};for(const i of Reflect.ownKeys(r)){if(i==="__proto__")continue;const c=t.keyType._zod.run({value:i,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(c.issues.length){o.issues.push({origin:"record",code:"invalid_key",issues:c.issues.map(h=>ee(h,n,X())),input:i,path:[i],inst:e}),o.value[c.value]=c.value;continue}const p=t.valueType._zod.run({value:r[i],issues:[]},n);p instanceof Promise?s.push(p.then(h=>{h.issues.length&&o.issues.push(...se(i,h.issues)),o.value[c.value]=h.value})):(p.issues.length&&o.issues.push(...se(i,p.issues)),o.value[c.value]=p.value)}}return s.length?Promise.all(s).then(()=>o):o}}),Xr=d("$ZodEnum",(e,t)=>{Z.init(e,t);const o=ln(t.entries);e._zod.values=new Set(o),e._zod.pattern=new RegExp(`^(${o.filter(n=>mn.has(typeof n)).map(n=>typeof n=="string"?_e(n):n.toString()).join("|")})$`),e._zod.parse=(n,r)=>{const s=n.value;return e._zod.values.has(s)||n.issues.push({code:"invalid_value",values:o,input:s,inst:e}),n}}),es=d("$ZodLiteral",(e,t)=>{Z.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(o=>typeof o=="string"?_e(o):o?o.toString():String(o)).join("|")})$`),e._zod.parse=(o,n)=>{const r=o.value;return e._zod.values.has(r)||o.issues.push({code:"invalid_value",values:t.values,input:r,inst:e}),o}}),ts=d("$ZodTransform",(e,t)=>{Z.init(e,t),e._zod.parse=(o,n)=>{const r=t.transform(o.value,o);if(n.async)return(r instanceof Promise?r:Promise.resolve(r)).then(i=>(o.value=i,o));if(r instanceof Promise)throw new he;return o.value=r,o}}),os=d("$ZodOptional",(e,t)=>{Z.init(e,t),e._zod.optin="optional",e._zod.optout="optional",C(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),C(e._zod,"pattern",()=>{const o=t.innerType._zod.pattern;return o?new RegExp(`^(${at(o.source)})?$`):void 0}),e._zod.parse=(o,n)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(o,n):o.value===void 0?o:t.innerType._zod.run(o,n)}),ns=d("$ZodNullable",(e,t)=>{Z.init(e,t),C(e._zod,"optin",()=>t.innerType._zod.optin),C(e._zod,"optout",()=>t.innerType._zod.optout),C(e._zod,"pattern",()=>{const o=t.innerType._zod.pattern;return o?new RegExp(`^(${at(o.source)}|null)$`):void 0}),C(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(o,n)=>o.value===null?o:t.innerType._zod.run(o,n)}),rs=d("$ZodDefault",(e,t)=>{Z.init(e,t),e._zod.optin="optional",C(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(o,n)=>{if(o.value===void 0)return o.value=t.defaultValue,o;const r=t.innerType._zod.run(o,n);return r instanceof Promise?r.then(s=>Ht(s,t)):Ht(r,t)}});function Ht(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const ss=d("$ZodPrefault",(e,t)=>{Z.init(e,t),e._zod.optin="optional",C(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(o,n)=>(o.value===void 0&&(o.value=t.defaultValue),t.innerType._zod.run(o,n))}),is=d("$ZodNonOptional",(e,t)=>{Z.init(e,t),C(e._zod,"values",()=>{const o=t.innerType._zod.values;return o?new Set([...o].filter(n=>n!==void 0)):void 0}),e._zod.parse=(o,n)=>{const r=t.innerType._zod.run(o,n);return r instanceof Promise?r.then(s=>Ft(s,e)):Ft(r,e)}});function Ft(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const as=d("$ZodCatch",(e,t)=>{Z.init(e,t),e._zod.optin="optional",C(e._zod,"optout",()=>t.innerType._zod.optout),C(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(o,n)=>{const r=t.innerType._zod.run(o,n);return r instanceof Promise?r.then(s=>(o.value=s.value,s.issues.length&&(o.value=t.catchValue({...o,error:{issues:s.issues.map(i=>ee(i,n,X()))},input:o.value}),o.issues=[]),o)):(o.value=r.value,r.issues.length&&(o.value=t.catchValue({...o,error:{issues:r.issues.map(s=>ee(s,n,X()))},input:o.value}),o.issues=[]),o)}}),cs=d("$ZodPipe",(e,t)=>{Z.init(e,t),C(e._zod,"values",()=>t.in._zod.values),C(e._zod,"optin",()=>t.in._zod.optin),C(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(o,n)=>{const r=t.in._zod.run(o,n);return r instanceof Promise?r.then(s=>Bt(s,t,n)):Bt(r,t,n)}});function Bt(e,t,o){return pe(e)?e:t.out._zod.run({value:e.value,issues:e.issues},o)}const us=d("$ZodReadonly",(e,t)=>{Z.init(e,t),C(e._zod,"propValues",()=>t.innerType._zod.propValues),C(e._zod,"values",()=>t.innerType._zod.values),C(e._zod,"optin",()=>t.innerType._zod.optin),C(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(o,n)=>{const r=t.innerType._zod.run(o,n);return r instanceof Promise?r.then(Vt):Vt(r)}});function Vt(e){return e.value=Object.freeze(e.value),e}const ls=d("$ZodCustom",(e,t)=>{F.init(e,t),Z.init(e,t),e._zod.parse=(o,n)=>o,e._zod.check=o=>{const n=o.value,r=t.fn(n);if(r instanceof Promise)return r.then(s=>Wt(s,o,n,e));Wt(r,o,n,e)}});function Wt(e,t,o,n){if(!e){const r={code:"custom",input:o,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(r.params=n._zod.def.params),t.issues.push(me(r))}}class ds{constructor(){this._map=new Map,this._idmap=new Map}add(t,...o){const n=o[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const o=this._map.get(t);return o&&typeof o=="object"&&"id"in o&&this._idmap.delete(o.id),this._map.delete(t),this}get(t){const o=t._zod.parent;if(o){const n={...this.get(o)??{}};return delete n.id,{...n,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}}function ps(){return new ds}const Ee=ps();function hs(e,t){return new e({type:"string",...g(t)})}function ms(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...g(t)})}function Jt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...g(t)})}function fs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...g(t)})}function gs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...g(t)})}function vs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...g(t)})}function _s(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...g(t)})}function bs(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...g(t)})}function ys(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...g(t)})}function ws(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...g(t)})}function ks(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...g(t)})}function xs(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...g(t)})}function Ss(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...g(t)})}function Ts(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...g(t)})}function zs(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...g(t)})}function Rs(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...g(t)})}function Is(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...g(t)})}function $s(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...g(t)})}function Ps(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...g(t)})}function Es(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...g(t)})}function Zs(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...g(t)})}function Cs(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...g(t)})}function Ns(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...g(t)})}function qs(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...g(t)})}function Ms(e,t){return new e({type:"string",format:"date",check:"string_format",...g(t)})}function Os(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...g(t)})}function As(e,t){return new e({type:"string",format:"duration",check:"string_format",...g(t)})}function Ds(e,t){return new e({type:"number",checks:[],...g(t)})}function Ls(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...g(t)})}function Us(e,t){return new e({type:"boolean",...g(t)})}function js(e,t){return new e({type:"undefined",...g(t)})}function Hs(e,t){return new e({type:"null",...g(t)})}function Fs(e){return new e({type:"unknown"})}function Bs(e,t){return new e({type:"never",...g(t)})}function Gt(e,t){return new yo({check:"less_than",...g(t),value:e,inclusive:!1})}function Je(e,t){return new yo({check:"less_than",...g(t),value:e,inclusive:!0})}function Kt(e,t){return new wo({check:"greater_than",...g(t),value:e,inclusive:!1})}function Ge(e,t){return new wo({check:"greater_than",...g(t),value:e,inclusive:!0})}function Qt(e,t){return new nr({check:"multiple_of",...g(t),value:e})}function To(e,t){return new sr({check:"max_length",...g(t),maximum:e})}function Ae(e,t){return new ir({check:"min_length",...g(t),minimum:e})}function zo(e,t){return new ar({check:"length_equals",...g(t),length:e})}function Vs(e,t){return new cr({check:"string_format",format:"regex",...g(t),pattern:e})}function Ws(e){return new ur({check:"string_format",format:"lowercase",...g(e)})}function Js(e){return new lr({check:"string_format",format:"uppercase",...g(e)})}function Gs(e,t){return new dr({check:"string_format",format:"includes",...g(t),includes:e})}function Ks(e,t){return new pr({check:"string_format",format:"starts_with",...g(t),prefix:e})}function Qs(e,t){return new hr({check:"string_format",format:"ends_with",...g(t),suffix:e})}function be(e){return new mr({check:"overwrite",tx:e})}function Ys(e){return be(t=>t.normalize(e))}function Xs(){return be(e=>e.trim())}function ei(){return be(e=>e.toLowerCase())}function ti(){return be(e=>e.toUpperCase())}function oi(e,t,o){return new e({type:"array",element:t,...g(o)})}function ni(e,t,o){const n=g(o);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function ri(e,t,o){return new e({type:"custom",check:"custom",fn:t,...g(o)})}function lt(e){return!!e._zod}function Ro(e,t){return lt(e)?mo(e,t):e.safeParse(t)}function si(e){if(!e)return;let t;if(lt(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function ii(e){if(lt(e)){const s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}const o=e._def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}const n=e.value;if(n!==void 0)return n}const ai=d("ZodISODateTime",(e,t)=>{Ir.init(e,t),M.init(e,t)});function Io(e){return qs(ai,e)}const ci=d("ZodISODate",(e,t)=>{$r.init(e,t),M.init(e,t)});function ui(e){return Ms(ci,e)}const li=d("ZodISOTime",(e,t)=>{Pr.init(e,t),M.init(e,t)});function di(e){return Os(li,e)}const pi=d("ZodISODuration",(e,t)=>{Er.init(e,t),M.init(e,t)});function hi(e){return As(pi,e)}const mi=(e,t)=>{lo.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:o=>Sn(e,o)},flatten:{value:o=>xn(e,o)},addIssue:{value:o=>e.issues.push(o)},addIssues:{value:o=>e.issues.push(...o)},isEmpty:{get(){return e.issues.length===0}}})},He=d("ZodError",mi,{Parent:Error}),fi=Tn(He),gi=zn(He),vi=ho(He),_i=fo(He),q=d("ZodType",(e,t)=>(Z.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...o)=>e.clone({...t,checks:[...t.checks??[],...o.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),e.clone=(o,n)=>ie(e,o,n),e.brand=()=>e,e.register=((o,n)=>(o.add(e,n),e)),e.parse=(o,n)=>fi(e,o,n,{callee:e.parse}),e.safeParse=(o,n)=>vi(e,o,n),e.parseAsync=async(o,n)=>gi(e,o,n,{callee:e.parseAsync}),e.safeParseAsync=async(o,n)=>_i(e,o,n),e.spa=e.safeParseAsync,e.refine=(o,n)=>e.check(ua(o,n)),e.superRefine=o=>e.check(la(o)),e.overwrite=o=>e.check(be(o)),e.optional=()=>O(e),e.nullable=()=>eo(e),e.nullish=()=>O(eo(e)),e.nonoptional=o=>ta(e,o),e.array=()=>_(e),e.or=o=>S([e,o]),e.and=o=>dt(e,o),e.transform=o=>tt(e,qo(o)),e.default=o=>Yi(e,o),e.prefault=o=>ea(e,o),e.catch=o=>na(e,o),e.pipe=o=>tt(e,o),e.readonly=()=>ia(e),e.describe=o=>{const n=e.clone();return Ee.add(n,{description:o}),n},Object.defineProperty(e,"description",{get(){return Ee.get(e)?.description},configurable:!0}),e.meta=(...o)=>{if(o.length===0)return Ee.get(e);const n=e.clone();return Ee.add(n,o[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),$o=d("_ZodString",(e,t)=>{ut.init(e,t),q.init(e,t);const o=e._zod.bag;e.format=o.format??null,e.minLength=o.minimum??null,e.maxLength=o.maximum??null,e.regex=(...n)=>e.check(Vs(...n)),e.includes=(...n)=>e.check(Gs(...n)),e.startsWith=(...n)=>e.check(Ks(...n)),e.endsWith=(...n)=>e.check(Qs(...n)),e.min=(...n)=>e.check(Ae(...n)),e.max=(...n)=>e.check(To(...n)),e.length=(...n)=>e.check(zo(...n)),e.nonempty=(...n)=>e.check(Ae(1,...n)),e.lowercase=n=>e.check(Ws(n)),e.uppercase=n=>e.check(Js(n)),e.trim=()=>e.check(Xs()),e.normalize=(...n)=>e.check(Ys(...n)),e.toLowerCase=()=>e.check(ei()),e.toUpperCase=()=>e.check(ti())}),bi=d("ZodString",(e,t)=>{ut.init(e,t),$o.init(e,t),e.email=o=>e.check(ms(yi,o)),e.url=o=>e.check(bs(wi,o)),e.jwt=o=>e.check(Ns(Mi,o)),e.emoji=o=>e.check(ys(ki,o)),e.guid=o=>e.check(Jt(Yt,o)),e.uuid=o=>e.check(fs(Ze,o)),e.uuidv4=o=>e.check(gs(Ze,o)),e.uuidv6=o=>e.check(vs(Ze,o)),e.uuidv7=o=>e.check(_s(Ze,o)),e.nanoid=o=>e.check(ws(xi,o)),e.guid=o=>e.check(Jt(Yt,o)),e.cuid=o=>e.check(ks(Si,o)),e.cuid2=o=>e.check(xs(Ti,o)),e.ulid=o=>e.check(Ss(zi,o)),e.base64=o=>e.check(Es(Ci,o)),e.base64url=o=>e.check(Zs(Ni,o)),e.xid=o=>e.check(Ts(Ri,o)),e.ksuid=o=>e.check(zs(Ii,o)),e.ipv4=o=>e.check(Rs($i,o)),e.ipv6=o=>e.check(Is(Pi,o)),e.cidrv4=o=>e.check($s(Ei,o)),e.cidrv6=o=>e.check(Ps(Zi,o)),e.e164=o=>e.check(Cs(qi,o)),e.datetime=o=>e.check(Io(o)),e.date=o=>e.check(ui(o)),e.time=o=>e.check(di(o)),e.duration=o=>e.check(hi(o))});function u(e){return hs(bi,e)}const M=d("ZodStringFormat",(e,t)=>{N.init(e,t),$o.init(e,t)}),yi=d("ZodEmail",(e,t)=>{br.init(e,t),M.init(e,t)}),Yt=d("ZodGUID",(e,t)=>{vr.init(e,t),M.init(e,t)}),Ze=d("ZodUUID",(e,t)=>{_r.init(e,t),M.init(e,t)}),wi=d("ZodURL",(e,t)=>{yr.init(e,t),M.init(e,t)}),ki=d("ZodEmoji",(e,t)=>{wr.init(e,t),M.init(e,t)}),xi=d("ZodNanoID",(e,t)=>{kr.init(e,t),M.init(e,t)}),Si=d("ZodCUID",(e,t)=>{xr.init(e,t),M.init(e,t)}),Ti=d("ZodCUID2",(e,t)=>{Sr.init(e,t),M.init(e,t)}),zi=d("ZodULID",(e,t)=>{Tr.init(e,t),M.init(e,t)}),Ri=d("ZodXID",(e,t)=>{zr.init(e,t),M.init(e,t)}),Ii=d("ZodKSUID",(e,t)=>{Rr.init(e,t),M.init(e,t)}),$i=d("ZodIPv4",(e,t)=>{Zr.init(e,t),M.init(e,t)}),Pi=d("ZodIPv6",(e,t)=>{Cr.init(e,t),M.init(e,t)}),Ei=d("ZodCIDRv4",(e,t)=>{Nr.init(e,t),M.init(e,t)}),Zi=d("ZodCIDRv6",(e,t)=>{qr.init(e,t),M.init(e,t)}),Ci=d("ZodBase64",(e,t)=>{Mr.init(e,t),M.init(e,t)}),Ni=d("ZodBase64URL",(e,t)=>{Ar.init(e,t),M.init(e,t)}),qi=d("ZodE164",(e,t)=>{Dr.init(e,t),M.init(e,t)}),Mi=d("ZodJWT",(e,t)=>{Ur.init(e,t),M.init(e,t)}),Po=d("ZodNumber",(e,t)=>{xo.init(e,t),q.init(e,t),e.gt=(n,r)=>e.check(Kt(n,r)),e.gte=(n,r)=>e.check(Ge(n,r)),e.min=(n,r)=>e.check(Ge(n,r)),e.lt=(n,r)=>e.check(Gt(n,r)),e.lte=(n,r)=>e.check(Je(n,r)),e.max=(n,r)=>e.check(Je(n,r)),e.int=n=>e.check(Xt(n)),e.safe=n=>e.check(Xt(n)),e.positive=n=>e.check(Kt(0,n)),e.nonnegative=n=>e.check(Ge(0,n)),e.negative=n=>e.check(Gt(0,n)),e.nonpositive=n=>e.check(Je(0,n)),e.multipleOf=(n,r)=>e.check(Qt(n,r)),e.step=(n,r)=>e.check(Qt(n,r)),e.finite=()=>e;const o=e._zod.bag;e.minValue=Math.max(o.minimum??Number.NEGATIVE_INFINITY,o.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(o.maximum??Number.POSITIVE_INFINITY,o.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(o.format??"").includes("int")||Number.isSafeInteger(o.multipleOf??.5),e.isFinite=!0,e.format=o.format??null});function x(e){return Ds(Po,e)}const Oi=d("ZodNumberFormat",(e,t)=>{jr.init(e,t),Po.init(e,t)});function Xt(e){return Ls(Oi,e)}const Ai=d("ZodBoolean",(e,t)=>{Hr.init(e,t),q.init(e,t)});function E(e){return Us(Ai,e)}const Di=d("ZodUndefined",(e,t)=>{Fr.init(e,t),q.init(e,t)});function Xe(e){return js(Di,e)}const Li=d("ZodNull",(e,t)=>{Br.init(e,t),q.init(e,t)});function Eo(e){return Hs(Li,e)}const Ui=d("ZodUnknown",(e,t)=>{Vr.init(e,t),q.init(e,t)});function P(){return Fs(Ui)}const ji=d("ZodNever",(e,t)=>{Wr.init(e,t),q.init(e,t)});function Hi(e){return Bs(ji,e)}const Fi=d("ZodArray",(e,t)=>{Jr.init(e,t),q.init(e,t),e.element=t.element,e.min=(o,n)=>e.check(Ae(o,n)),e.nonempty=o=>e.check(Ae(1,o)),e.max=(o,n)=>e.check(To(o,n)),e.length=(o,n)=>e.check(zo(o,n)),e.unwrap=()=>e.element});function _(e,t){return oi(Fi,e,t)}const Zo=d("ZodObject",(e,t)=>{Gr.init(e,t),q.init(e,t),C(e,"shape",()=>t.shape),e.keyof=()=>B(Object.keys(e._zod.def.shape)),e.catchall=o=>e.clone({...e._zod.def,catchall:o}),e.passthrough=()=>e.clone({...e._zod.def,catchall:P()}),e.loose=()=>e.clone({...e._zod.def,catchall:P()}),e.strict=()=>e.clone({...e._zod.def,catchall:Hi()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=o=>bn(e,o),e.merge=o=>yn(e,o),e.pick=o=>vn(e,o),e.omit=o=>_n(e,o),e.partial=(...o)=>wn(Mo,e,o[0]),e.required=(...o)=>kn(Oo,e,o[0])});function l(e,t){const o={type:"object",get shape(){return Ue(this,"shape",{...e}),this.shape},...g(t)};return new Zo(o)}function H(e,t){return new Zo({type:"object",get shape(){return Ue(this,"shape",{...e}),this.shape},catchall:P(),...g(t)})}const Co=d("ZodUnion",(e,t)=>{So.init(e,t),q.init(e,t),e.options=t.options});function S(e,t){return new Co({type:"union",options:e,...g(t)})}const Bi=d("ZodDiscriminatedUnion",(e,t)=>{Co.init(e,t),Kr.init(e,t)});function No(e,t,o){return new Bi({type:"union",options:t,discriminator:e,...g(o)})}const Vi=d("ZodIntersection",(e,t)=>{Qr.init(e,t),q.init(e,t)});function dt(e,t){return new Vi({type:"intersection",left:e,right:t})}const Wi=d("ZodRecord",(e,t)=>{Yr.init(e,t),q.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function $(e,t,o){return new Wi({type:"record",keyType:e,valueType:t,...g(o)})}const et=d("ZodEnum",(e,t)=>{Xr.init(e,t),q.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const o=new Set(Object.keys(t.entries));e.extract=(n,r)=>{const s={};for(const i of n)if(o.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new et({...t,checks:[],...g(r),entries:s})},e.exclude=(n,r)=>{const s={...t.entries};for(const i of n)if(o.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new et({...t,checks:[],...g(r),entries:s})}});function B(e,t){const o=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new et({type:"enum",entries:o,...g(t)})}const Ji=d("ZodLiteral",(e,t)=>{es.init(e,t),q.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function a(e,t){return new Ji({type:"literal",values:Array.isArray(e)?e:[e],...g(t)})}const Gi=d("ZodTransform",(e,t)=>{ts.init(e,t),q.init(e,t),e._zod.parse=(o,n)=>{o.addIssue=s=>{if(typeof s=="string")o.issues.push(me(s,o.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=o.value),i.inst??(i.inst=e),i.continue??(i.continue=!0),o.issues.push(me(i))}};const r=t.transform(o.value,o);return r instanceof Promise?r.then(s=>(o.value=s,o)):(o.value=r,o)}});function qo(e){return new Gi({type:"transform",transform:e})}const Mo=d("ZodOptional",(e,t)=>{os.init(e,t),q.init(e,t),e.unwrap=()=>e._zod.def.innerType});function O(e){return new Mo({type:"optional",innerType:e})}const Ki=d("ZodNullable",(e,t)=>{ns.init(e,t),q.init(e,t),e.unwrap=()=>e._zod.def.innerType});function eo(e){return new Ki({type:"nullable",innerType:e})}const Qi=d("ZodDefault",(e,t)=>{rs.init(e,t),q.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Yi(e,t){return new Qi({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const Xi=d("ZodPrefault",(e,t)=>{ss.init(e,t),q.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ea(e,t){return new Xi({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const Oo=d("ZodNonOptional",(e,t)=>{is.init(e,t),q.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ta(e,t){return new Oo({type:"nonoptional",innerType:e,...g(t)})}const oa=d("ZodCatch",(e,t)=>{as.init(e,t),q.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function na(e,t){return new oa({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const ra=d("ZodPipe",(e,t)=>{cs.init(e,t),q.init(e,t),e.in=t.in,e.out=t.out});function tt(e,t){return new ra({type:"pipe",in:e,out:t})}const sa=d("ZodReadonly",(e,t)=>{us.init(e,t),q.init(e,t)});function ia(e){return new sa({type:"readonly",innerType:e})}const Ao=d("ZodCustom",(e,t)=>{ls.init(e,t),q.init(e,t)});function aa(e){const t=new F({check:"custom"});return t._zod.check=e,t}function ca(e,t){return ni(Ao,e??(()=>!0),t)}function ua(e,t={}){return ri(Ao,e,t)}function la(e){const t=aa(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(me(n,o.value,t._zod.def));else{const r=n;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=o.value),r.inst??(r.inst=t),r.continue??(r.continue=!t._zod.def.abort),o.issues.push(me(r))}},e(o.value,o)));return t}function Do(e,t){return tt(qo(e),t)}const re="io.modelcontextprotocol/related-task",Fe="2.0",A=ca(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Lo=S([u(),x().int()]),Uo=u();H({ttl:S([x(),Eo()]).optional(),pollInterval:x().optional()});const da=l({ttl:x().optional()}),pa=l({taskId:u()}),pt=H({progressToken:Lo.optional(),[re]:pa.optional()}),V=l({_meta:pt.optional()}),ye=V.extend({task:da.optional()}),ha=e=>ye.safeParse(e).success,D=l({method:u(),params:V.loose().optional()}),J=l({_meta:pt.optional()}),G=l({method:u(),params:J.loose().optional()}),L=H({_meta:pt.optional()}),we=S([u(),x().int()]),jo=l({jsonrpc:a(Fe),id:we,...D.shape}).strict(),to=e=>jo.safeParse(e).success,Ho=l({jsonrpc:a(Fe),...G.shape}).strict(),ma=e=>Ho.safeParse(e).success,ht=l({jsonrpc:a(Fe),id:we,result:L}).strict(),Ce=e=>ht.safeParse(e).success;var I;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",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.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(I||(I={}));const mt=l({jsonrpc:a(Fe),id:we.optional(),error:l({code:x().int(),message:u(),data:P().optional()})}).strict(),fa=e=>mt.safeParse(e).success,ga=S([jo,Ho,ht,mt]);S([ht,mt]);const ft=L.strict(),va=J.extend({requestId:we.optional(),reason:u().optional()}),gt=G.extend({method:a("notifications/cancelled"),params:va}),_a=l({src:u(),mimeType:u().optional(),sizes:_(u()).optional(),theme:B(["light","dark"]).optional()}),ke=l({icons:_(_a).optional()}),ce=l({name:u(),title:u().optional()}),Be=ce.extend({...ce.shape,...ke.shape,version:u(),websiteUrl:u().optional(),description:u().optional()}),ba=dt(l({applyDefaults:E().optional()}),$(u(),P())),ya=Do(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,dt(l({form:ba.optional(),url:A.optional()}),$(u(),P()).optional())),wa=H({list:A.optional(),cancel:A.optional(),requests:H({sampling:H({createMessage:A.optional()}).optional(),elicitation:H({create:A.optional()}).optional()}).optional()}),ka=H({list:A.optional(),cancel:A.optional(),requests:H({tools:H({call:A.optional()}).optional()}).optional()}),xa=l({experimental:$(u(),A).optional(),sampling:l({context:A.optional(),tools:A.optional()}).optional(),elicitation:ya.optional(),roots:l({listChanged:E().optional()}).optional(),tasks:wa.optional()}),Sa=V.extend({protocolVersion:u(),capabilities:xa,clientInfo:Be}),Ta=D.extend({method:a("initialize"),params:Sa}),za=l({experimental:$(u(),A).optional(),logging:A.optional(),completions:A.optional(),prompts:l({listChanged:E().optional()}).optional(),resources:l({subscribe:E().optional(),listChanged:E().optional()}).optional(),tools:l({listChanged:E().optional()}).optional(),tasks:ka.optional()}),Ra=L.extend({protocolVersion:u(),capabilities:za,serverInfo:Be,instructions:u().optional()}),Ia=G.extend({method:a("notifications/initialized"),params:J.optional()}),Ve=D.extend({method:a("ping"),params:V.optional()}),$a=l({progress:x(),total:O(x()),message:O(u())}),Pa=l({...J.shape,...$a.shape,progressToken:Lo}),vt=G.extend({method:a("notifications/progress"),params:Pa}),Ea=V.extend({cursor:Uo.optional()}),xe=D.extend({params:Ea.optional()}),Se=L.extend({nextCursor:Uo.optional()}),Za=B(["working","input_required","completed","failed","cancelled"]),Te=l({taskId:u(),status:Za,ttl:S([x(),Eo()]),createdAt:u(),lastUpdatedAt:u(),pollInterval:O(x()),statusMessage:O(u())}),_t=L.extend({task:Te}),Ca=J.merge(Te),De=G.extend({method:a("notifications/tasks/status"),params:Ca}),bt=D.extend({method:a("tasks/get"),params:V.extend({taskId:u()})}),yt=L.merge(Te),wt=D.extend({method:a("tasks/result"),params:V.extend({taskId:u()})});L.loose();const kt=xe.extend({method:a("tasks/list")}),xt=Se.extend({tasks:_(Te)}),St=D.extend({method:a("tasks/cancel"),params:V.extend({taskId:u()})}),Na=L.merge(Te),Fo=l({uri:u(),mimeType:O(u()),_meta:$(u(),P()).optional()}),Bo=Fo.extend({text:u()}),Tt=u().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Vo=Fo.extend({blob:Tt}),ze=B(["user","assistant"]),ue=l({audience:_(ze).optional(),priority:x().min(0).max(1).optional(),lastModified:Io({offset:!0}).optional()}),Wo=l({...ce.shape,...ke.shape,uri:u(),description:O(u()),mimeType:O(u()),annotations:ue.optional(),_meta:O(H({}))}),qa=l({...ce.shape,...ke.shape,uriTemplate:u(),description:O(u()),mimeType:O(u()),annotations:ue.optional(),_meta:O(H({}))}),Ma=xe.extend({method:a("resources/list")}),Jo=Se.extend({resources:_(Wo)}),Oa=xe.extend({method:a("resources/templates/list")}),Aa=Se.extend({resourceTemplates:_(qa)}),zt=V.extend({uri:u()}),Da=zt,La=D.extend({method:a("resources/read"),params:Da}),Go=L.extend({contents:_(S([Bo,Vo]))}),Ua=G.extend({method:a("notifications/resources/list_changed"),params:J.optional()}),ja=zt,Ha=D.extend({method:a("resources/subscribe"),params:ja}),Fa=zt,Ba=D.extend({method:a("resources/unsubscribe"),params:Fa}),Va=J.extend({uri:u()}),Wa=G.extend({method:a("notifications/resources/updated"),params:Va}),Ja=l({name:u(),description:O(u()),required:O(E())}),Ga=l({...ce.shape,...ke.shape,description:O(u()),arguments:O(_(Ja)),_meta:O(H({}))}),Ka=xe.extend({method:a("prompts/list")}),Qa=Se.extend({prompts:_(Ga)}),Ya=V.extend({name:u(),arguments:$(u(),u()).optional()}),Xa=D.extend({method:a("prompts/get"),params:Ya}),Rt=l({type:a("text"),text:u(),annotations:ue.optional(),_meta:$(u(),P()).optional()}),It=l({type:a("image"),data:Tt,mimeType:u(),annotations:ue.optional(),_meta:$(u(),P()).optional()}),$t=l({type:a("audio"),data:Tt,mimeType:u(),annotations:ue.optional(),_meta:$(u(),P()).optional()}),ec=l({type:a("tool_use"),name:u(),id:u(),input:$(u(),P()),_meta:$(u(),P()).optional()}),Ko=l({type:a("resource"),resource:S([Bo,Vo]),annotations:ue.optional(),_meta:$(u(),P()).optional()}),Qo=Wo.extend({type:a("resource_link")}),Re=S([Rt,It,$t,Qo,Ko]),tc=l({role:ze,content:Re}),oc=L.extend({description:u().optional(),messages:_(tc)}),nc=G.extend({method:a("notifications/prompts/list_changed"),params:J.optional()}),rc=l({title:u().optional(),readOnlyHint:E().optional(),destructiveHint:E().optional(),idempotentHint:E().optional(),openWorldHint:E().optional()}),sc=l({taskSupport:B(["required","optional","forbidden"]).optional()}),Pt=l({...ce.shape,...ke.shape,description:u().optional(),inputSchema:l({type:a("object"),properties:$(u(),A).optional(),required:_(u()).optional()}).catchall(P()),outputSchema:l({type:a("object"),properties:$(u(),A).optional(),required:_(u()).optional()}).catchall(P()).optional(),annotations:rc.optional(),execution:sc.optional(),_meta:$(u(),P()).optional()}),Yo=xe.extend({method:a("tools/list")}),ic=Se.extend({tools:_(Pt)}),We=L.extend({content:_(Re).default([]),structuredContent:$(u(),P()).optional(),isError:E().optional()});We.or(L.extend({toolResult:P()}));const ac=ye.extend({name:u(),arguments:$(u(),P()).optional()}),Xo=D.extend({method:a("tools/call"),params:ac}),cc=G.extend({method:a("notifications/tools/list_changed"),params:J.optional()});l({autoRefresh:E().default(!0),debounceMs:x().int().nonnegative().default(300)});const en=B(["debug","info","notice","warning","error","critical","alert","emergency"]),uc=V.extend({level:en}),lc=D.extend({method:a("logging/setLevel"),params:uc}),dc=J.extend({level:en,logger:u().optional(),data:P()}),pc=G.extend({method:a("notifications/message"),params:dc}),hc=l({name:u().optional()}),mc=l({hints:_(hc).optional(),costPriority:x().min(0).max(1).optional(),speedPriority:x().min(0).max(1).optional(),intelligencePriority:x().min(0).max(1).optional()}),fc=l({mode:B(["auto","required","none"]).optional()}),gc=l({type:a("tool_result"),toolUseId:u().describe("The unique identifier for the corresponding tool call."),content:_(Re).default([]),structuredContent:l({}).loose().optional(),isError:E().optional(),_meta:$(u(),P()).optional()}),vc=No("type",[Rt,It,$t]),Le=No("type",[Rt,It,$t,ec,gc]),_c=l({role:ze,content:S([Le,_(Le)]),_meta:$(u(),P()).optional()}),bc=ye.extend({messages:_(_c),modelPreferences:mc.optional(),systemPrompt:u().optional(),includeContext:B(["none","thisServer","allServers"]).optional(),temperature:x().optional(),maxTokens:x().int(),stopSequences:_(u()).optional(),metadata:A.optional(),tools:_(Pt).optional(),toolChoice:fc.optional()}),yc=D.extend({method:a("sampling/createMessage"),params:bc}),wc=L.extend({model:u(),stopReason:O(B(["endTurn","stopSequence","maxTokens"]).or(u())),role:ze,content:vc}),kc=L.extend({model:u(),stopReason:O(B(["endTurn","stopSequence","maxTokens","toolUse"]).or(u())),role:ze,content:S([Le,_(Le)])}),xc=l({type:a("boolean"),title:u().optional(),description:u().optional(),default:E().optional()}),Sc=l({type:a("string"),title:u().optional(),description:u().optional(),minLength:x().optional(),maxLength:x().optional(),format:B(["email","uri","date","date-time"]).optional(),default:u().optional()}),Tc=l({type:B(["number","integer"]),title:u().optional(),description:u().optional(),minimum:x().optional(),maximum:x().optional(),default:x().optional()}),zc=l({type:a("string"),title:u().optional(),description:u().optional(),enum:_(u()),default:u().optional()}),Rc=l({type:a("string"),title:u().optional(),description:u().optional(),oneOf:_(l({const:u(),title:u()})),default:u().optional()}),Ic=l({type:a("string"),title:u().optional(),description:u().optional(),enum:_(u()),enumNames:_(u()).optional(),default:u().optional()}),$c=S([zc,Rc]),Pc=l({type:a("array"),title:u().optional(),description:u().optional(),minItems:x().optional(),maxItems:x().optional(),items:l({type:a("string"),enum:_(u())}),default:_(u()).optional()}),Ec=l({type:a("array"),title:u().optional(),description:u().optional(),minItems:x().optional(),maxItems:x().optional(),items:l({anyOf:_(l({const:u(),title:u()}))}),default:_(u()).optional()}),Zc=S([Pc,Ec]),Cc=S([Ic,$c,Zc]),Nc=S([Cc,xc,Sc,Tc]),qc=ye.extend({mode:a("form").optional(),message:u(),requestedSchema:l({type:a("object"),properties:$(u(),Nc),required:_(u()).optional()})}),Mc=ye.extend({mode:a("url"),message:u(),elicitationId:u(),url:u().url()}),Oc=S([qc,Mc]),Ac=D.extend({method:a("elicitation/create"),params:Oc}),Dc=J.extend({elicitationId:u()}),Lc=G.extend({method:a("notifications/elicitation/complete"),params:Dc}),Uc=L.extend({action:B(["accept","decline","cancel"]),content:Do(e=>e===null?void 0:e,$(u(),S([u(),x(),E(),_(u())])).optional())}),jc=l({type:a("ref/resource"),uri:u()}),Hc=l({type:a("ref/prompt"),name:u()}),Fc=V.extend({ref:S([Hc,jc]),argument:l({name:u(),value:u()}),context:l({arguments:$(u(),u()).optional()}).optional()}),Bc=D.extend({method:a("completion/complete"),params:Fc}),Vc=L.extend({completion:H({values:_(u()).max(100),total:O(x().int()),hasMore:O(E())})}),Wc=l({uri:u().startsWith("file://"),name:u().optional(),_meta:$(u(),P()).optional()}),Jc=D.extend({method:a("roots/list"),params:V.optional()}),Gc=L.extend({roots:_(Wc)}),Kc=G.extend({method:a("notifications/roots/list_changed"),params:J.optional()});S([Ve,Ta,Bc,lc,Xa,Ka,Ma,Oa,La,Ha,Ba,Xo,Yo,bt,wt,kt,St]);S([gt,vt,Ia,Kc,De]);S([ft,wc,kc,Uc,Gc,yt,xt,_t]);S([Ve,yc,Ac,Jc,bt,wt,kt,St]);S([gt,vt,pc,Wa,Ua,cc,nc,De,Lc]);S([ft,Ra,Vc,oc,Qa,Jo,Aa,Go,We,ic,yt,xt,_t]);class z extends Error{constructor(t,o,n){super(`MCP error ${t}: ${o}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,o,n){if(t===I.UrlElicitationRequired&&n){const r=n;if(r.elicitations)return new Qc(r.elicitations,o)}return new z(t,o,n)}}class Qc extends z{constructor(t,o=`URL elicitation${t.length>1?"s":""} required`){super(I.UrlElicitationRequired,o,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}}function ne(e){return e==="completed"||e==="failed"||e==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function oo(e){const o=si(e)?.method;if(!o)throw new Error("Schema is missing a method literal");const n=ii(o);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function no(e,t){const o=Ro(e,t);if(!o.success)throw o.error;return o.data}const Yc=6e4;class Xc{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(gt,o=>{this._oncancel(o)}),this.setNotificationHandler(vt,o=>{this._onprogress(o)}),this.setRequestHandler(Ve,o=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(bt,async(o,n)=>{const r=await this._taskStore.getTask(o.params.taskId,n.sessionId);if(!r)throw new z(I.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(wt,async(o,n)=>{const r=async()=>{const s=o.params.taskId;if(this._taskMessageQueue){let c;for(;c=await this._taskMessageQueue.dequeue(s,n.sessionId);){if(c.type==="response"||c.type==="error"){const p=c.message,h=p.id,m=this._requestResolvers.get(h);if(m)if(this._requestResolvers.delete(h),c.type==="response")m(p);else{const f=p,v=new z(f.error.code,f.error.message,f.error.data);m(v)}else{const f=c.type==="response"?"Response":"Error";this._onerror(new Error(`${f} handler missing for request ${h}`))}continue}await this._transport?.send(c.message,{relatedRequestId:n.requestId})}}const i=await this._taskStore.getTask(s,n.sessionId);if(!i)throw new z(I.InvalidParams,`Task not found: ${s}`);if(!ne(i.status))return await this._waitForTaskUpdate(s,n.signal),await r();if(ne(i.status)){const c=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s),{...c,_meta:{...c._meta,[re]:{taskId:s}}}}return await r()};return await r()}),this.setRequestHandler(kt,async(o,n)=>{try{const{tasks:r,nextCursor:s}=await this._taskStore.listTasks(o.params?.cursor,n.sessionId);return{tasks:r,nextCursor:s,_meta:{}}}catch(r){throw new z(I.InvalidParams,`Failed to list tasks: ${r instanceof Error?r.message:String(r)}`)}}),this.setRequestHandler(St,async(o,n)=>{try{const r=await this._taskStore.getTask(o.params.taskId,n.sessionId);if(!r)throw new z(I.InvalidParams,`Task not found: ${o.params.taskId}`);if(ne(r.status))throw new z(I.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(o.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(o.params.taskId);const s=await this._taskStore.getTask(o.params.taskId,n.sessionId);if(!s)throw new z(I.InvalidParams,`Task not found after cancellation: ${o.params.taskId}`);return{_meta:{},...s}}catch(r){throw r instanceof z?r:new z(I.InvalidRequest,`Failed to cancel task: ${r instanceof Error?r.message:String(r)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,o,n,r,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(r,o),startTime:Date.now(),timeout:o,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:r})}_resetTimeout(t){const o=this._timeoutInfo.get(t);if(!o)return!1;const n=Date.now()-o.startTime;if(o.maxTotalTimeout&&n>=o.maxTotalTimeout)throw this._timeoutInfo.delete(t),z.fromError(I.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:o.maxTotalTimeout,totalElapsed:n});return clearTimeout(o.timeoutId),o.timeoutId=setTimeout(o.onTimeout,o.timeout),!0}_cleanupTimeout(t){const o=this._timeoutInfo.get(t);o&&(clearTimeout(o.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;const o=this.transport?.onclose;this._transport.onclose=()=>{o?.(),this._onclose()};const n=this.transport?.onerror;this._transport.onerror=s=>{n?.(s),this._onerror(s)};const r=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{r?.(s,i),Ce(s)||fa(s)?this._onresponse(s):to(s)?this._onrequest(s,i):ma(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){const t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(const n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();const o=z.fromError(I.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(const n of t.values())n(o)}_onerror(t){this.onerror?.(t)}_onnotification(t){const o=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;o!==void 0&&Promise.resolve().then(()=>o(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,o){const n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,r=this._transport,s=t.params?._meta?.[re]?.taskId;if(n===void 0){const m={jsonrpc:"2.0",id:t.id,error:{code:I.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:m,timestamp:Date.now()},r?.sessionId).catch(f=>this._onerror(new Error(`Failed to enqueue error response: ${f}`))):r?.send(m).catch(f=>this._onerror(new Error(`Failed to send an error response: ${f}`)));return}const i=new AbortController;this._requestHandlerAbortControllers.set(t.id,i);const c=ha(t.params)?t.params.task:void 0,p=this._taskStore?this.requestTaskStore(t,r?.sessionId):void 0,h={signal:i.signal,sessionId:r?.sessionId,_meta:t.params?._meta,sendNotification:async m=>{if(i.signal.aborted)return;const f={relatedRequestId:t.id};s&&(f.relatedTask={taskId:s}),await this.notification(m,f)},sendRequest:async(m,f,v)=>{if(i.signal.aborted)throw new z(I.ConnectionClosed,"Request was cancelled");const b={...v,relatedRequestId:t.id};s&&!b.relatedTask&&(b.relatedTask={taskId:s});const R=b.relatedTask?.taskId??s;return R&&p&&await p.updateTaskStatus(R,"input_required"),await this.request(m,f,b)},authInfo:o?.authInfo,requestId:t.id,requestInfo:o?.requestInfo,taskId:s,taskStore:p,taskRequestedTtl:c?.ttl,closeSSEStream:o?.closeSSEStream,closeStandaloneSSEStream:o?.closeStandaloneSSEStream};Promise.resolve().then(()=>{c&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,h)).then(async m=>{if(i.signal.aborted)return;const f={result:m,jsonrpc:"2.0",id:t.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:f,timestamp:Date.now()},r?.sessionId):await r?.send(f)},async m=>{if(i.signal.aborted)return;const f={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(m.code)?m.code:I.InternalError,message:m.message??"Internal error",...m.data!==void 0&&{data:m.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:f,timestamp:Date.now()},r?.sessionId):await r?.send(f)}).catch(m=>this._onerror(new Error(`Failed to send response: ${m}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){const{progressToken:o,...n}=t.params,r=Number(o),s=this._progressHandlers.get(r);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}const i=this._responseHandlers.get(r),c=this._timeoutInfo.get(r);if(c&&i&&c.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(p){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),i(p);return}s(n)}_onresponse(t){const o=Number(t.id),n=this._requestResolvers.get(o);if(n){if(this._requestResolvers.delete(o),Ce(t))n(t);else{const i=new z(t.error.code,t.error.message,t.error.data);n(i)}return}const r=this._responseHandlers.get(o);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(o),this._cleanupTimeout(o);let s=!1;if(Ce(t)&&t.result&&typeof t.result=="object"){const i=t.result;if(i.task&&typeof i.task=="object"){const c=i.task;typeof c.taskId=="string"&&(s=!0,this._taskProgressTokens.set(c.taskId,o))}}if(s||this._progressHandlers.delete(o),Ce(t))r(t);else{const i=z.fromError(t.error.code,t.error.message,t.error.data);r(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,o,n){const{task:r}=n??{};if(!r){try{yield{type:"result",result:await this.request(t,o,n)}}catch(i){yield{type:"error",error:i instanceof z?i:new z(I.InternalError,String(i))}}return}let s;try{const i=await this.request(t,_t,n);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new z(I.InternalError,"Task creation did not return a task");for(;;){const c=await this.getTask({taskId:s},n);if(yield{type:"taskStatus",task:c},ne(c.status)){c.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},o,n)}:c.status==="failed"?yield{type:"error",error:new z(I.InternalError,`Task ${s} failed`)}:c.status==="cancelled"&&(yield{type:"error",error:new z(I.InternalError,`Task ${s} was cancelled`)});return}if(c.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},o,n)};return}const p=c.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(h=>setTimeout(h,p)),n?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof z?i:new z(I.InternalError,String(i))}}}request(t,o,n){const{relatedRequestId:r,resumptionToken:s,onresumptiontoken:i,task:c,relatedTask:p}=n??{};return new Promise((h,m)=>{const f=k=>{m(k)};if(!this._transport){f(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),c&&this.assertTaskCapability(t.method)}catch(k){f(k);return}n?.signal?.throwIfAborted();const v=this._requestMessageId++,b={...t,jsonrpc:"2.0",id:v};n?.onprogress&&(this._progressHandlers.set(v,n.onprogress),b.params={...t.params,_meta:{...t.params?._meta||{},progressToken:v}}),c&&(b.params={...b.params,task:c}),p&&(b.params={...b.params,_meta:{...b.params?._meta||{},[re]:p}});const R=k=>{this._responseHandlers.delete(v),this._progressHandlers.delete(v),this._cleanupTimeout(v),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:v,reason:String(k)}},{relatedRequestId:r,resumptionToken:s,onresumptiontoken:i}).catch(T=>this._onerror(new Error(`Failed to send cancellation: ${T}`)));const y=k instanceof z?k:new z(I.RequestTimeout,String(k));m(y)};this._responseHandlers.set(v,k=>{if(!n?.signal?.aborted){if(k instanceof Error)return m(k);try{const y=Ro(o,k.result);y.success?h(y.data):m(y.error)}catch(y){m(y)}}}),n?.signal?.addEventListener("abort",()=>{R(n?.signal?.reason)});const w=n?.timeout??Yc,j=()=>R(z.fromError(I.RequestTimeout,"Request timed out",{timeout:w}));this._setupTimeout(v,w,n?.maxTotalTimeout,j,n?.resetTimeoutOnProgress??!1);const W=p?.taskId;if(W){const k=y=>{const T=this._responseHandlers.get(v);T?T(y):this._onerror(new Error(`Response handler missing for side-channeled request ${v}`))};this._requestResolvers.set(v,k),this._enqueueTaskMessage(W,{type:"request",message:b,timestamp:Date.now()}).catch(y=>{this._cleanupTimeout(v),m(y)})}else this._transport.send(b,{relatedRequestId:r,resumptionToken:s,onresumptiontoken:i}).catch(k=>{this._cleanupTimeout(v),m(k)})})}async getTask(t,o){return this.request({method:"tasks/get",params:t},yt,o)}async getTaskResult(t,o,n){return this.request({method:"tasks/result",params:t},o,n)}async listTasks(t,o){return this.request({method:"tasks/list",params:t},xt,o)}async cancelTask(t,o){return this.request({method:"tasks/cancel",params:t},Na,o)}async notification(t,o){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);const n=o?.relatedTask?.taskId;if(n){const c={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[re]:o.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:c,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!o?.relatedRequestId&&!o?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let c={...t,jsonrpc:"2.0"};o?.relatedTask&&(c={...c,params:{...c.params,_meta:{...c.params?._meta||{},[re]:o.relatedTask}}}),this._transport?.send(c,o).catch(p=>this._onerror(p))});return}let i={...t,jsonrpc:"2.0"};o?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[re]:o.relatedTask}}}),await this._transport.send(i,o)}setRequestHandler(t,o){const n=oo(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(r,s)=>{const i=no(t,r);return Promise.resolve(o(i,s))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,o){const n=oo(t);this._notificationHandlers.set(n,r=>{const s=no(t,r);return Promise.resolve(o(s))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){const o=this._taskProgressTokens.get(t);o!==void 0&&(this._progressHandlers.delete(o),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,o,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,o,n,r)}async _clearTaskQueue(t,o){if(this._taskMessageQueue){const n=await this._taskMessageQueue.dequeueAll(t,o);for(const r of n)if(r.type==="request"&&to(r.message)){const s=r.message.id,i=this._requestResolvers.get(s);i?(i(new z(I.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,o){let n=this._options?.defaultTaskPollInterval??1e3;try{const r=await this._taskStore?.getTask(t);r?.pollInterval&&(n=r.pollInterval)}catch{}return new Promise((r,s)=>{if(o.aborted){s(new z(I.InvalidRequest,"Request cancelled"));return}const i=setTimeout(r,n);o.addEventListener("abort",()=>{clearTimeout(i),s(new z(I.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,o){const n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async r=>{if(!t)throw new Error("No request provided");return await n.createTask(r,t.id,{method:t.method,params:t.params},o)},getTask:async r=>{const s=await n.getTask(r,o);if(!s)throw new z(I.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(r,s,i)=>{await n.storeTaskResult(r,s,i,o);const c=await n.getTask(r,o);if(c){const p=De.parse({method:"notifications/tasks/status",params:c});await this.notification(p),ne(c.status)&&this._cleanupTaskProgressHandler(r)}},getTaskResult:r=>n.getTaskResult(r,o),updateTaskStatus:async(r,s,i)=>{const c=await n.getTask(r,o);if(!c)throw new z(I.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(ne(c.status))throw new z(I.InvalidParams,`Cannot update task "${r}" from terminal status "${c.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(r,s,i,o);const p=await n.getTask(r,o);if(p){const h=De.parse({method:"notifications/tasks/status",params:p});await this.notification(h),ne(p.status)&&this._cleanupTaskProgressHandler(r)}},listTasks:r=>n.listTasks(r,o)}}}var eu="2026-01-26",tu="ui/notifications/tool-input-partial";class tn{eventTarget;eventSource;messageListener;constructor(t=window.parent,o){this.eventTarget=t,this.eventSource=o,this.messageListener=n=>{if(o&&n.source!==this.eventSource){console.debug("Ignoring message from unknown source",n);return}let r=ga.safeParse(n.data);r.success?(console.debug("Parsed message",r.data),this.onmessage?.(r.data)):n.data?.jsonrpc!=="2.0"?console.debug("Ignoring non-JSON-RPC message",r.error.message,n):(console.error("Failed to parse message",r.error.message,n),this.onerror?.(Error("Invalid JSON-RPC message received: "+r.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(t,o){t.method!==tu&&console.debug("Sending message",t),this.eventTarget.postMessage(t,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var ou=S([a("light"),a("dark")]).describe("Color theme preference for the host environment."),fe=S([a("inline"),a("fullscreen"),a("pip")]).describe("Display mode for UI presentation."),nu=S([a("--color-background-primary"),a("--color-background-secondary"),a("--color-background-tertiary"),a("--color-background-inverse"),a("--color-background-ghost"),a("--color-background-info"),a("--color-background-danger"),a("--color-background-success"),a("--color-background-warning"),a("--color-background-disabled"),a("--color-text-primary"),a("--color-text-secondary"),a("--color-text-tertiary"),a("--color-text-inverse"),a("--color-text-ghost"),a("--color-text-info"),a("--color-text-danger"),a("--color-text-success"),a("--color-text-warning"),a("--color-text-disabled"),a("--color-border-primary"),a("--color-border-secondary"),a("--color-border-tertiary"),a("--color-border-inverse"),a("--color-border-ghost"),a("--color-border-info"),a("--color-border-danger"),a("--color-border-success"),a("--color-border-warning"),a("--color-border-disabled"),a("--color-ring-primary"),a("--color-ring-secondary"),a("--color-ring-inverse"),a("--color-ring-info"),a("--color-ring-danger"),a("--color-ring-success"),a("--color-ring-warning"),a("--font-sans"),a("--font-mono"),a("--font-weight-normal"),a("--font-weight-medium"),a("--font-weight-semibold"),a("--font-weight-bold"),a("--font-text-xs-size"),a("--font-text-sm-size"),a("--font-text-md-size"),a("--font-text-lg-size"),a("--font-heading-xs-size"),a("--font-heading-sm-size"),a("--font-heading-md-size"),a("--font-heading-lg-size"),a("--font-heading-xl-size"),a("--font-heading-2xl-size"),a("--font-heading-3xl-size"),a("--font-text-xs-line-height"),a("--font-text-sm-line-height"),a("--font-text-md-line-height"),a("--font-text-lg-line-height"),a("--font-heading-xs-line-height"),a("--font-heading-sm-line-height"),a("--font-heading-md-line-height"),a("--font-heading-lg-line-height"),a("--font-heading-xl-line-height"),a("--font-heading-2xl-line-height"),a("--font-heading-3xl-line-height"),a("--border-radius-xs"),a("--border-radius-sm"),a("--border-radius-md"),a("--border-radius-lg"),a("--border-radius-xl"),a("--border-radius-full"),a("--border-width-regular"),a("--shadow-hairline"),a("--shadow-sm"),a("--shadow-md"),a("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),ru=$(nu.describe(`Style variables for theming MCP apps.
|
|
33
33
|
|
|
34
34
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
35
35
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
36
36
|
|
|
37
37
|
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
38
|
-
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),
|
|
38
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),S([u(),Xe()]).describe(`Style variables for theming MCP apps.
|
|
39
39
|
|
|
40
40
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
41
41
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
@@ -47,10 +47,10 @@ Individual style keys are optional - hosts may provide any subset of these value
|
|
|
47
47
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
48
48
|
|
|
49
49
|
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
50
|
-
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);l({method:
|
|
50
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);l({method:a("ui/open-link"),params:l({url:u().describe("URL to open in the host's browser")})});var su=l({isError:E().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),iu=l({isError:E().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),au=l({isError:E().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough();l({method:a("ui/notifications/sandbox-proxy-ready"),params:l({})});var Et=l({connectDomains:_(u()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
|
|
51
51
|
|
|
52
52
|
- Maps to CSP \`connect-src\` directive
|
|
53
|
-
- Empty or omitted → no network connections (secure default)`),resourceDomains:
|
|
53
|
+
- Empty or omitted → no network connections (secure default)`),resourceDomains:_(u()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:_(u()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:_(u()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),Zt=l({camera:l({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:l({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:l({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:l({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")});l({method:a("ui/notifications/size-changed"),params:l({width:x().optional().describe("New width in pixels."),height:x().optional().describe("New height in pixels.")})});var cu=l({method:a("ui/notifications/tool-input"),params:l({arguments:$(u(),P().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),uu=l({method:a("ui/notifications/tool-input-partial"),params:l({arguments:$(u(),P().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),lu=l({method:a("ui/notifications/tool-cancelled"),params:l({reason:u().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),du=l({fonts:u().optional()}),pu=l({variables:ru.optional().describe("CSS variables for theming the app."),css:du.optional().describe("CSS blocks that apps can inject.")}),hu=l({method:a("ui/resource-teardown"),params:l({})});$(u(),P());var ro=l({text:l({}).optional().describe("Host supports text content blocks."),image:l({}).optional().describe("Host supports image content blocks."),audio:l({}).optional().describe("Host supports audio content blocks."),resource:l({}).optional().describe("Host supports resource content blocks."),resourceLink:l({}).optional().describe("Host supports resource link content blocks."),structuredContent:l({}).optional().describe("Host supports structured content.")});l({method:a("ui/notifications/request-teardown"),params:l({}).optional()});var mu=l({experimental:l({}).optional().describe("Experimental features (structure TBD)."),openLinks:l({}).optional().describe("Host supports opening external URLs."),downloadFile:l({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:l({listChanged:E().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:l({listChanged:E().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:l({}).optional().describe("Host accepts log messages."),sandbox:l({permissions:Zt.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:Et.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:ro.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:ro.optional().describe("Host supports receiving content messages (ui/message) from the view.")}),fu=l({experimental:l({}).optional().describe("Experimental features (structure TBD)."),tools:l({listChanged:E().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:_(fe).optional().describe("Display modes the app supports.")});l({method:a("ui/notifications/initialized"),params:l({}).optional()});l({csp:Et.optional().describe("Content Security Policy configuration for UI resources."),permissions:Zt.optional().describe("Sandbox permissions requested by the UI resource."),domain:u().optional().describe(`Dedicated origin for view sandbox.
|
|
54
54
|
|
|
55
55
|
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
56
56
|
|
|
@@ -58,16 +58,16 @@ Useful when views need stable, dedicated origins for OAuth callbacks, CORS polic
|
|
|
58
58
|
- Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
|
|
59
59
|
- URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
|
|
60
60
|
|
|
61
|
-
If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:
|
|
61
|
+
If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:E().optional().describe(`Visual boundary preference - true if view prefers a visible border.
|
|
62
62
|
|
|
63
63
|
Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.
|
|
64
64
|
|
|
65
65
|
- \`true\`: request visible border + background
|
|
66
66
|
- \`false\`: request no visible border + background
|
|
67
|
-
- omitted: host decides border`)});l({method:
|
|
67
|
+
- omitted: host decides border`)});l({method:a("ui/request-display-mode"),params:l({mode:fe.describe("The display mode being requested.")})});var gu=l({mode:fe.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),vu=S([a("model"),a("app")]).describe("Tool visibility scope - who can access the tool.");l({resourceUri:u().optional(),visibility:_(vu).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
68
68
|
- "model": Tool visible to and callable by the agent
|
|
69
|
-
- "app": Tool callable by the app from this server only`)});l({mimeTypes:
|
|
70
|
-
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:u().optional().describe("User's language and region preference in BCP 47 format."),timeZone:u().optional().describe("User's timezone in IANA format."),userAgent:u().optional().describe("Host application identifier."),platform:
|
|
69
|
+
- "app": Tool callable by the app from this server only`)});l({mimeTypes:_(u()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')});l({method:a("ui/download-file"),params:l({contents:_(S([Ko,Qo])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})});l({method:a("ui/message"),params:l({role:a("user").describe('Message role, currently only "user" is supported.'),content:_(Re).describe("Message content blocks (text, image, etc.).")})});l({method:a("ui/notifications/sandbox-resource-ready"),params:l({html:u().describe("HTML content to load into the inner iframe."),sandbox:u().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Et.optional().describe("CSP configuration from resource metadata."),permissions:Zt.optional().describe("Sandbox permissions from resource metadata.")})});var _u=l({method:a("ui/notifications/tool-result"),params:We.describe("Standard MCP tool execution result.")}),on=l({toolInfo:l({id:we.optional().describe("JSON-RPC id of the tools/call request."),tool:Pt.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:ou.optional().describe("Current color theme preference."),styles:pu.optional().describe("Style configuration for theming the app."),displayMode:fe.optional().describe("How the UI is currently displayed."),availableDisplayModes:_(fe).optional().describe("Display modes the host supports."),containerDimensions:S([l({height:x().describe("Fixed container height in pixels.")}),l({maxHeight:S([x(),Xe()]).optional().describe("Maximum container height in pixels.")})]).and(S([l({width:x().describe("Fixed container width in pixels.")}),l({maxWidth:S([x(),Xe()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
70
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:u().optional().describe("User's language and region preference in BCP 47 format."),timeZone:u().optional().describe("User's timezone in IANA format."),userAgent:u().optional().describe("Host application identifier."),platform:S([a("web"),a("desktop"),a("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:l({touch:E().optional().describe("Whether the device supports touch input."),hover:E().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:l({top:x().describe("Top safe area inset in pixels."),right:x().describe("Right safe area inset in pixels."),bottom:x().describe("Bottom safe area inset in pixels."),left:x().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),bu=l({method:a("ui/notifications/host-context-changed"),params:on.describe("Partial context update containing only changed fields.")});l({method:a("ui/update-model-context"),params:l({content:_(Re).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:$(u(),P().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})});l({method:a("ui/initialize"),params:l({appInfo:Be.describe("App identification (name and version)."),appCapabilities:fu.describe("Features and capabilities this app provides."),protocolVersion:u().describe("Protocol version this app supports.")})});var yu=l({protocolVersion:u().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Be.describe("Host application identification and version."),hostCapabilities:mu.describe("Features and capabilities provided by the host."),hostContext:on.describe("Rich context about the host environment.")}).passthrough();function wu(e,t=document.documentElement){for(let[o,n]of Object.entries(e))n!==void 0&&t.style.setProperty(o,n)}function ku(e){if(document.getElementById("__mcp-host-fonts"))return;let t=document.createElement("style");t.id="__mcp-host-fonts",t.textContent=e,document.head.appendChild(t)}class xu extends Xc{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;constructor(t,o={},n={autoResize:!0}){super(n),this._appInfo=t,this._capabilities=o,this.options=n,this.setRequestHandler(Ve,r=>(console.log("Received ping:",r.params),{})),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput(t){this.setNotificationHandler(cu,o=>t(o.params))}set ontoolinputpartial(t){this.setNotificationHandler(uu,o=>t(o.params))}set ontoolresult(t){this.setNotificationHandler(_u,o=>t(o.params))}set ontoolcancelled(t){this.setNotificationHandler(lu,o=>t(o.params))}set onhostcontextchanged(t){this.setNotificationHandler(bu,o=>{this._hostContext={...this._hostContext,...o.params},t(o.params)})}set onteardown(t){this.setRequestHandler(hu,(o,n)=>t(o.params,n))}set oncalltool(t){this.setRequestHandler(Xo,(o,n)=>t(o.params,n))}set onlisttools(t){this.setRequestHandler(Yo,(o,n)=>t(o.params,n))}assertCapabilityForMethod(t){}assertRequestHandlerCapability(t){switch(t){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${t})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${t} registered`)}}assertNotificationCapability(t){}assertTaskCapability(t){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(t){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(t,o){if(typeof t=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${t}"). Did you mean: callServerTool({ name: "${t}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:t},We,o)}async readServerResource(t,o){return await this.request({method:"resources/read",params:t},Go,o)}async listServerResources(t,o){return await this.request({method:"resources/list",params:t},Jo,o)}sendMessage(t,o){return this.request({method:"ui/message",params:t},au,o)}sendLog(t){return this.notification({method:"notifications/message",params:t})}updateModelContext(t,o){return this.request({method:"ui/update-model-context",params:t},ft,o)}openLink(t,o){return this.request({method:"ui/open-link",params:t},su,o)}sendOpenLink=this.openLink;downloadFile(t,o){return this.request({method:"ui/download-file",params:t},iu,o)}requestTeardown(t={}){return this.notification({method:"ui/notifications/request-teardown",params:t})}requestDisplayMode(t,o){return this.request({method:"ui/request-display-mode",params:t},gu,o)}sendSizeChanged(t){return this.notification({method:"ui/notifications/size-changed",params:t})}setupSizeChangedNotifications(){let t=!1,o=0,n=0,r=()=>{t||(t=!0,requestAnimationFrame(()=>{t=!1;let i=document.documentElement,c=i.style.width,p=i.style.height;i.style.width="fit-content",i.style.height="max-content";let h=i.getBoundingClientRect();i.style.width=c,i.style.height=p;let m=window.innerWidth-i.clientWidth,f=Math.ceil(h.width+m),v=Math.ceil(h.height);(f!==o||v!==n)&&(o=f,n=v,this.sendSizeChanged({width:f,height:v}))}))};r();let s=new ResizeObserver(r);return s.observe(document.documentElement),s.observe(document.body),()=>s.disconnect()}async connect(t=new tn(window.parent,window.parent),o){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect(t);try{let n=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:eu}},yu,o);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);this._hostCapabilities=n.hostCapabilities,this._hostInfo=n.hostInfo,this._hostContext=n.hostContext,await this.notification({method:"ui/notifications/initialized"}),this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(n){throw this.close(),n}}}async function Su(e){const t=new xu({name:e.name,version:e.version});return t.ontoolresult=o=>{try{const n=o.structuredContent;if(n&&typeof n=="object"&&n.status==="success")e.onData(n.data);else if(n&&typeof n=="object"&&n.status==="error"){const r=n.message;Ke(r||"Unknown error"),e.onError?.(r||"Unknown error")}else{const r=o.content?.find(s=>s.type==="text");if(r&&"text"in r){const s=JSON.parse(r.text);s.status==="success"?e.onData(s.data):Ke(s.message||"Unknown error")}}}catch(n){const r=n instanceof Error?n.message:String(n);Ke(`Failed to parse result: ${r}`),e.onError?.(r)}},t.onhostcontextchanged=o=>{if(o.styles?.variables&&wu(o.styles.variables),o.styles?.css?.fonts&&ku(o.styles.css.fonts),o.safeAreaInsets){const{top:n,right:r,bottom:s,left:i}=o.safeAreaInsets;document.body.style.padding=`${n}px ${r}px ${s}px ${i}px`}},t.onteardown=async()=>({}),await t.connect(new tn),t}function Ke(e){const t=document.querySelector(".atoms-error");t&&t.remove();const o=document.createElement("div");o.className="atoms-error",o.textContent=e,document.body.prepend(o)}async function Tu(e,t,o){const r=(await e.callServerTool({name:t,arguments:o})).content?.find(s=>s.type==="text");if(r&&"text"in r){const s=JSON.parse(r.text);if(s.status==="success")return s.data;throw new Error(s.message||"Tool call failed")}throw new Error("No text content in tool response")}const nn=document.createElement("style");nn.textContent=`
|
|
71
71
|
#graph-canvas {
|
|
72
72
|
display: block;
|
|
73
73
|
width: 100%;
|
|
@@ -88,6 +88,48 @@ container holding the app. Specify either width or maxWidth, and either height o
|
|
|
88
88
|
font-family: var(--font-code);
|
|
89
89
|
margin-right: 12px;
|
|
90
90
|
}
|
|
91
|
+
.trace-select {
|
|
92
|
+
background: var(--bg-tertiary);
|
|
93
|
+
border: 1px solid var(--border-color);
|
|
94
|
+
border-radius: 0;
|
|
95
|
+
color: var(--text-primary);
|
|
96
|
+
font-family: var(--font-main);
|
|
97
|
+
font-size: 12px;
|
|
98
|
+
padding: 4px 8px;
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
outline: none;
|
|
101
|
+
margin-right: 12px;
|
|
102
|
+
}
|
|
103
|
+
.trace-select:focus { border-color: var(--atoms-purple); }
|
|
104
|
+
.trace-stepper {
|
|
105
|
+
display: inline-flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
gap: 4px;
|
|
108
|
+
margin-right: 12px;
|
|
109
|
+
}
|
|
110
|
+
.trace-stepper-btn {
|
|
111
|
+
background: var(--bg-tertiary);
|
|
112
|
+
border: 1px solid var(--border-color);
|
|
113
|
+
color: var(--text-primary);
|
|
114
|
+
font-size: 14px;
|
|
115
|
+
width: 24px;
|
|
116
|
+
height: 24px;
|
|
117
|
+
display: flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
justify-content: center;
|
|
120
|
+
cursor: pointer;
|
|
121
|
+
padding: 0;
|
|
122
|
+
font-family: var(--font-main);
|
|
123
|
+
}
|
|
124
|
+
.trace-stepper-btn:hover { background: var(--bg-secondary); }
|
|
125
|
+
.trace-stepper-value {
|
|
126
|
+
font-family: var(--font-code);
|
|
127
|
+
font-size: 13px;
|
|
128
|
+
font-weight: 600;
|
|
129
|
+
color: var(--text-primary);
|
|
130
|
+
min-width: 20px;
|
|
131
|
+
text-align: center;
|
|
132
|
+
}
|
|
91
133
|
.tooltip {
|
|
92
134
|
position: absolute;
|
|
93
135
|
background: var(--bg-secondary);
|
|
@@ -134,18 +176,34 @@ container holding the app. Specify either width or maxWidth, and either height o
|
|
|
134
176
|
height: 12px;
|
|
135
177
|
flex-shrink: 0;
|
|
136
178
|
}
|
|
137
|
-
`;document.head.appendChild(
|
|
138
|
-
<div class="tt-id">${
|
|
139
|
-
<div class="tt-title">${
|
|
140
|
-
<div class="tt-meta">${
|
|
141
|
-
`):
|
|
179
|
+
`;document.head.appendChild(nn);const U=document.getElementById("graph-canvas"),de=document.getElementById("tooltip"),Ne=document.getElementById("loading"),rn=document.getElementById("stats");let te=[],qe=[],ge=0,ve=0,Q=1,Ct=!1,sn=0,an=0,ot=null,nt="",rt="",Y=5,ae="downstream";const zu={requirement:"#a855f7","test-case":"#e4e4e7",note:"#a855f780"},so={parent:{dash:[],color:"#888"},child:{dash:[],color:"#888"},verifies:{dash:[6,3],color:"#a855f7"},verified_by:{dash:[6,3],color:"#a855f7"},related:{dash:[2,2],color:"#666"}};function Ru(e){const t=new Map,o=typeof e.root=="object"?e.root.id:e.root,n=typeof e.root=="object"?e.root.title:e.root,r=typeof e.root=="object"?e.root.type:"requirement",s=110,i=36,c=16,p=60,h=60,m=new Map;for(const w of e.items)m.has(w.depth)||m.set(w.depth,[]),m.get(w.depth).push(w);const f=Math.max(0,...Array.from(m.keys()));let v=s;for(const[,w]of m){const j=w.length*(s+c)-c;j>v&&(v=j)}const b=v/2+60;t.set(o,{id:o,title:n,type:r,relationship:"root",depth:0,x:b,y:h+i/2,vx:0,vy:0,isRoot:!0});for(let w=1;w<=f;w++){const j=m.get(w)??[],W=j.length*(s+c)-c,k=b-W/2+s/2,y=h+i/2+w*(i+p);j.forEach((T,K)=>{t.set(T.id,{id:T.id,title:T.title,type:T.type,relationship:T.relationship,depth:T.depth,x:k+K*(s+c),y,vx:0,vy:0,isRoot:!1})})}te=Array.from(t.values()),qe=[];for(const w of e.items)w.depth===1&&qe.push({source:o,target:w.id,type:w.relationship});const R=new Map;R.set(0,[o]);for(const w of e.items)R.has(w.depth)||R.set(w.depth,[]),R.get(w.depth).push(w.id);for(const w of e.items){if(w.depth<=1)continue;const j=R.get(w.depth-1)??[];if(j.length>0){const W=t.get(w.id);if(!W)continue;let k=j[0],y=1/0;for(const T of j){const K=t.get(T);if(!K)continue;const oe=Math.abs(K.x-W.x);oe<y&&(y=oe,k=T)}qe.push({source:k,target:w.id,type:w.relationship})}}}function cn(){if(te.length===0)return;const e=window.devicePixelRatio||1,t=60,o=22;let n=1/0,r=1/0,s=-1/0,i=-1/0;for(const R of te)n=Math.min(n,R.x-t),r=Math.min(r,R.y-o),s=Math.max(s,R.x+t),i=Math.max(i,R.y+o);const c=s-n,p=i-r;if(c===0||p===0)return;const h=U.width/e,m=U.height/e,f=24;Q=Math.min((h-f*2)/c,(m-f*2)/p);const v=(n+s)/2,b=(r+i)/2;ge=h/2-v*Q,ve=m/2-b*Q}function Ie(){const e=U.getContext("2d"),t=window.devicePixelRatio||1;e.clearRect(0,0,U.width,U.height),e.save(),e.scale(t,t),e.translate(ge,ve),e.scale(Q,Q);const o=new Map(te.map(n=>[n.id,n]));for(const n of qe){const r=o.get(n.source),s=o.get(n.target);if(!r||!s)continue;const i=so[n.type]??so.related;e.beginPath(),e.strokeStyle=i.color,e.lineWidth=1,e.setLineDash(i.dash);const c=r.y+18,p=s.y-18,h=(c+p)/2;e.moveTo(r.x,c),e.lineTo(r.x,h),e.lineTo(s.x,h),e.lineTo(s.x,p),e.stroke(),e.setLineDash([]);const m=6;e.beginPath(),e.moveTo(s.x,p),e.lineTo(s.x-m*.5,p-m),e.lineTo(s.x+m*.5,p-m),e.closePath(),e.fillStyle=i.color,e.fill()}for(const n of te){const r=zu[n.type]??"#888",s=100,i=36;if(e.fillStyle="#1a1a1a",e.strokeStyle=r,e.lineWidth=n.isRoot?3:1.5,n.type==="requirement")e.beginPath(),e.rect(n.x-s/2,n.y-i/2,s,i),e.fill(),e.stroke();else if(n.type==="test-case")e.beginPath(),e.rect(n.x-s/2,n.y-i/2,s,i),e.fill(),e.stroke();else{const p=s/2,h=i/2;e.beginPath(),e.moveTo(n.x,n.y-h),e.lineTo(n.x+p,n.y),e.lineTo(n.x,n.y+h),e.lineTo(n.x-p,n.y),e.closePath(),e.fill(),e.stroke()}n.isRoot&&(e.shadowColor="#a855f7",e.shadowBlur=12,e.strokeStyle="#a855f7",e.lineWidth=2,e.stroke(),e.shadowBlur=0),e.fillStyle="#e0e0e0",e.font=`500 11px ${getComputedStyle(document.body).getPropertyValue("--font-main").trim()||"'IBM Plex Sans', sans-serif"}`,e.textAlign="center",e.textBaseline="middle";const c=n.id.length>14?n.id.substring(0,12)+"...":n.id;e.fillText(c,n.x,n.y)}e.restore()}function Nt(){const e=window.devicePixelRatio||1,t=U.getBoundingClientRect();t.width===0||t.height===0||(U.width=t.width*e,U.height=t.height*e,te.length>0&&Ie())}U.addEventListener("mousedown",e=>{Ct=!0,sn=e.clientX-ge,an=e.clientY-ve});U.addEventListener("mousemove",e=>{if(Ct){ge=e.clientX-sn,ve=e.clientY-an,Ie();return}const t=U.getBoundingClientRect(),o=(e.clientX-t.left-ge)/Q,n=(e.clientY-t.top-ve)/Q;let r=null;for(let s=te.length-1;s>=0;s--){const i=te[s];if(Math.abs(o-i.x)<55&&Math.abs(n-i.y)<18){r=i;break}}r?(de.style.display="block",de.style.left=`${e.clientX-t.left+12}px`,de.style.top=`${e.clientY-t.top-10}px`,de.innerHTML=`
|
|
180
|
+
<div class="tt-id">${r.id}</div>
|
|
181
|
+
<div class="tt-title">${r.title}</div>
|
|
182
|
+
<div class="tt-meta">${r.type} · ${r.relationship}${r.isRoot?" (root)":""}</div>
|
|
183
|
+
`):de.style.display="none"});U.addEventListener("mouseup",()=>{Ct=!1});U.addEventListener("wheel",e=>{e.preventDefault(),Q*=e.deltaY>0?.95:1.05,Q=Math.max(.1,Math.min(3,Q)),Ie()},{passive:!1});window.addEventListener("resize",Nt);let io=window.devicePixelRatio||1;window.matchMedia(`(resolution: ${io}dppx)`).addEventListener("change",()=>{io=window.devicePixelRatio||1,Nt()});function Iu(){const e=document.getElementById("toolbar");e.innerHTML=`
|
|
184
|
+
<span class="toolbar-label">Root:</span>
|
|
185
|
+
<span class="toolbar-value" id="root-id"></span>
|
|
186
|
+
<span class="toolbar-label">Direction:</span>
|
|
187
|
+
<select class="trace-select" id="direction-select">
|
|
188
|
+
<option value="downstream"${ae==="downstream"?" selected":""}>Downstream</option>
|
|
189
|
+
<option value="upstream"${ae==="upstream"?" selected":""}>Upstream</option>
|
|
190
|
+
<option value="both"${ae==="both"?" selected":""}>Both</option>
|
|
191
|
+
</select>
|
|
192
|
+
<span class="toolbar-label">Depth:</span>
|
|
193
|
+
<span class="trace-stepper">
|
|
194
|
+
<button class="trace-stepper-btn" id="depth-down">-</button>
|
|
195
|
+
<span class="trace-stepper-value" id="depth-value">${Y}</span>
|
|
196
|
+
<button class="trace-stepper-btn" id="depth-up">+</button>
|
|
197
|
+
</span>
|
|
198
|
+
<button class="trace-stepper-btn" id="fit-btn" title="Fit to view" style="margin-left:8px;padding:2px 10px">⤢</button>
|
|
199
|
+
`,document.getElementById("direction-select").addEventListener("change",t=>{ae=t.target.value,Qe()}),document.getElementById("depth-down").addEventListener("click",()=>{Y>1&&(Y--,document.getElementById("depth-value").textContent=String(Y),Qe())}),document.getElementById("depth-up").addEventListener("click",()=>{Y<10&&(Y++,document.getElementById("depth-value").textContent=String(Y),Qe())}),document.getElementById("fit-btn").addEventListener("click",()=>{cn(),Ie()})}async function Qe(){if(!(!ot||!nt||!rt)){U.style.display="none",Ne.style.display="",Ne.textContent="Reloading...";try{const e=await Tu(ot,"atoms_trace",{project_id:nt,item_id:rt,direction:ae,depth:Y});un(e)}catch(e){Ne.style.display="none",U.style.display="block",rn.textContent=`Error: ${e instanceof Error?e.message:String(e)}`}}}function un(e){Ne.style.display="none",U.style.display="block";const t=typeof e.root=="object"?e.root.id:e.root,o=typeof e.root=="object"?`${e.root.id} — ${e.root.title}`:e.root;rt=t,ae=e.direction,Y=e.depth_limit,rn.textContent=`${e.total_count} items traced from ${t}`,document.getElementById("root-id").textContent=o,Nt(),Ru(e),cn(),Ie()}const qt=document.createElement("div");qt.className="legend";qt.innerHTML=`
|
|
142
200
|
<div class="legend-item"><div class="legend-shape" style="background:#a855f7"></div>Requirement</div>
|
|
143
|
-
<div class="legend-item"><div class="legend-shape" style="background:#
|
|
144
|
-
<div class="legend-item"><div class="legend-shape" style="background
|
|
201
|
+
<div class="legend-item"><div class="legend-shape" style="background:#e4e4e7"></div>Test Case</div>
|
|
202
|
+
<div class="legend-item"><div class="legend-shape" style="background:rgba(168,85,247,0.6);transform:rotate(45deg);width:10px;height:10px"></div>Note</div>
|
|
145
203
|
<div class="legend-item"><svg width="20" height="10"><line x1="0" y1="5" x2="20" y2="5" stroke="#888" stroke-width="1.5"/></svg>Parent/Child</div>
|
|
146
204
|
<div class="legend-item"><svg width="20" height="10"><line x1="0" y1="5" x2="20" y2="5" stroke="#a855f7" stroke-width="1.5" stroke-dasharray="6,3"/></svg>Verifies</div>
|
|
147
|
-
`;document.getElementById("app").appendChild(
|
|
148
|
-
<style rel="stylesheet" crossorigin>@import"https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap";:root{--atoms-purple: #a855f7;--atoms-purple-light: #c084fc;--atoms-purple-hover: #b975f9;--atoms-green: #22c55e;--atoms-green-light: #4ade80;--atoms-red: #ef4444;--atoms-red-light: #f87171;--atoms-amber: #f59e0b;--atoms-blue: #58a6ff;--bg-primary: #0c0c0c;--bg-secondary: #121212;--bg-tertiary: #181818;--text-primary: #fafafa;--text-secondary: #a0a0a0;--text-muted: #606060;--border-color: #252525;--font-main: "IBM Plex Sans", sans-serif;--font-code: "IBM Plex Mono", monospace;color-scheme:dark}*{margin:0;padding:0;box-sizing:border-box}body{font-family:var(--font-main);background:var(--bg-primary);color:var(--text-primary);line-height:1.5;-webkit-font-smoothing:antialiased}.atoms-card{background:var(--bg-secondary);border:1px solid var(--border-color);border-radius:0;padding:16px}.atoms-header{display:flex;align-items:center;gap:10px;padding:12px 16px;border-bottom:1px solid var(--border-color);background:var(--bg-secondary)}.atoms-header .logo{width:20px;height:20px}.atoms-header .title{font-size:14px;font-weight:600;color:var(--text-primary)}.atoms-header .subtitle{font-size:12px;color:var(--text-muted);margin-left:auto}.atoms-btn{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;font-size:12px;font-weight:500;font-family:var(--font-main);border:1px solid var(--border-color);border-radius:0;background:var(--bg-secondary);color:var(--text-primary);cursor:pointer;transition:background .1s ease}.atoms-btn:hover{background:var(--bg-tertiary)}.atoms-btn-primary{background:var(--atoms-purple);color:#fff;border-color:var(--atoms-purple)}.atoms-btn-primary:hover{background:var(--atoms-purple-hover)}.atoms-watermark{position:fixed;bottom:8px;right:12px;display:flex;align-items:center;gap:6px;font-size:10px;color:var(--text-muted);opacity:.5;font-family:var(--font-main);pointer-events:none}.atoms-watermark img{width:14px;height:14px;opacity:.6}.atoms-loading{display:flex;align-items:center;justify-content:center;min-height:200px;color:var(--text-muted);font-size:13px}.atoms-loading:before{content:"";width:16px;height:16px;border:2px solid var(--border-color);border-top-color:var(--atoms-purple);border-radius:50%;margin-right:10px;animation:spin .6s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.atoms-error{padding:16px;background:color-mix(in srgb,var(--atoms-red) 10%,var(--bg-primary));border:1px solid var(--atoms-red);color:var(--text-primary);font-size:13px}.atoms-metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:12px;padding:16px}.atoms-metric{background:var(--bg-secondary);border:1px solid var(--border-color);padding:12px;text-align:center}.atoms-metric .value{font-size:24px;font-weight:700;color:var(--atoms-purple);font-variant-numeric:tabular-nums}.atoms-metric .label{font-size:11px;font-weight:500;color:var(--text-secondary);text-transform:uppercase;letter-spacing:.5px;margin-top:4px}.atoms-toolbar{display:flex;align-items:center;gap:8px;padding:8px 16px;border-bottom:1px solid var(--border-color);background:var(--bg-secondary);flex-wrap:wrap}</style>
|
|
205
|
+
`;document.getElementById("app").appendChild(qt);Su({name:"ATOMS Trace Graph",version:"1.0.0",onData:e=>{const t=e;t.project_id&&(nt=t.project_id),Iu(),un(t)}}).then(e=>{ot=e});</script>
|
|
206
|
+
<style rel="stylesheet" crossorigin>@import"https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap";:root{--atoms-purple: #a855f7;--atoms-purple-light: #c084fc;--atoms-purple-hover: #b975f9;--atoms-green: #22c55e;--atoms-green-light: #4ade80;--atoms-red: #ef4444;--atoms-red-light: #f87171;--atoms-amber: #f59e0b;--atoms-blue: #58a6ff;--tc-color: #e4e4e7;--note-color: rgba(168, 85, 247, .6);--bg-primary: #0c0c0c;--bg-secondary: #121212;--bg-tertiary: #181818;--text-primary: #fafafa;--text-secondary: #a0a0a0;--text-muted: #606060;--border-color: #252525;--font-main: "IBM Plex Sans", sans-serif;--font-code: "IBM Plex Mono", monospace;color-scheme:dark}*{margin:0;padding:0;box-sizing:border-box}body{font-family:var(--font-main);background:var(--bg-primary);color:var(--text-primary);line-height:1.5;-webkit-font-smoothing:antialiased}.atoms-card{background:var(--bg-secondary);border:1px solid var(--border-color);border-radius:0;padding:16px}.atoms-header{display:flex;align-items:center;gap:10px;padding:12px 16px;border-bottom:1px solid var(--border-color);background:var(--bg-secondary)}.atoms-header .logo{width:20px;height:20px}.atoms-header .title{font-size:14px;font-weight:600;color:var(--text-primary)}.atoms-header .subtitle{font-size:12px;color:var(--text-muted);margin-left:auto}.atoms-btn{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;font-size:12px;font-weight:500;font-family:var(--font-main);border:1px solid var(--border-color);border-radius:0;background:var(--bg-secondary);color:var(--text-primary);cursor:pointer;transition:background .1s ease}.atoms-btn:hover{background:var(--bg-tertiary)}.atoms-btn-primary{background:var(--atoms-purple);color:#fff;border-color:var(--atoms-purple)}.atoms-btn-primary:hover{background:var(--atoms-purple-hover)}.atoms-watermark{position:fixed;bottom:8px;right:12px;display:flex;align-items:center;gap:6px;font-size:10px;color:var(--text-muted);opacity:.5;font-family:var(--font-main);pointer-events:none}.atoms-watermark img{width:14px;height:14px;opacity:.6}.atoms-loading{display:flex;align-items:center;justify-content:center;min-height:200px;color:var(--text-muted);font-size:13px}.atoms-loading:before{content:"";width:16px;height:16px;border:2px solid var(--border-color);border-top-color:var(--atoms-purple);border-radius:50%;margin-right:10px;animation:spin .6s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.atoms-error{padding:16px;background:color-mix(in srgb,var(--atoms-red) 10%,var(--bg-primary));border:1px solid var(--atoms-red);color:var(--text-primary);font-size:13px}.atoms-metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:12px;padding:16px}.atoms-metric{background:var(--bg-secondary);border:1px solid var(--border-color);padding:12px;text-align:center}.atoms-metric .value{font-size:24px;font-weight:700;color:var(--atoms-purple);font-variant-numeric:tabular-nums}.atoms-metric .label{font-size:11px;font-weight:500;color:var(--text-secondary);text-transform:uppercase;letter-spacing:.5px;margin-top:4px}.atoms-toolbar{display:flex;align-items:center;gap:8px;padding:8px 16px;border-bottom:1px solid var(--border-color);background:var(--bg-secondary);flex-wrap:wrap}</style>
|
|
149
207
|
</head>
|
|
150
208
|
<body>
|
|
151
209
|
<div id="app">
|
|
@@ -154,14 +212,7 @@ container holding the app. Specify either width or maxWidth, and either height o
|
|
|
154
212
|
<span class="title">Traceability Graph</span>
|
|
155
213
|
<span class="subtitle" id="stats"></span>
|
|
156
214
|
</div>
|
|
157
|
-
<div class="atoms-toolbar">
|
|
158
|
-
<label class="toolbar-label">Root:</label>
|
|
159
|
-
<span class="toolbar-value" id="root-id"></span>
|
|
160
|
-
<label class="toolbar-label">Direction:</label>
|
|
161
|
-
<span class="toolbar-value" id="direction"></span>
|
|
162
|
-
<label class="toolbar-label">Depth:</label>
|
|
163
|
-
<span class="toolbar-value" id="depth"></span>
|
|
164
|
-
</div>
|
|
215
|
+
<div class="atoms-toolbar" id="toolbar"></div>
|
|
165
216
|
<div class="atoms-loading" id="loading">Loading trace graph...</div>
|
|
166
217
|
<canvas id="graph-canvas"></canvas>
|
|
167
218
|
<div id="tooltip" class="tooltip" style="display:none"></div>
|