@atoms-tech/atoms-mcp 0.40.1 → 0.58.10
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 +32 -16
- package/dist/apps/src/apps/browse/browse-app.html +36 -36
- package/dist/apps/src/apps/coverage/coverage-app.html +18 -18
- package/dist/apps/src/apps/editor/editor-app.html +85 -30
- package/dist/apps/src/apps/import/import-app.html +18 -12
- package/dist/apps/src/apps/mermaid/mermaid-app.html +161 -161
- package/dist/apps/src/apps/summary/summary-app.html +21 -21
- package/dist/apps/src/apps/trace/trace-app.html +17 -17
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -5
|
@@ -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 Editor</title>
|
|
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(u,p){var m;Object.defineProperty(u,"_zod",{value:u._zod??{},enumerable:!1}),(m=u._zod).traits??(m.traits=new Set),u._zod.traits.add(e),t(u,p);for(const g in i.prototype)g in u||Object.defineProperty(u,g,{value:i.prototype[g].bind(u)});u._zod.constr=i,u._zod.def=p}const r=o?.Parent??Object;class s extends r{}Object.defineProperty(s,"name",{value:e});function i(u){var p;const m=o?.Parent?new s:this;n(m,u),(p=m._zod).deferred??(p.deferred=[]);for(const g of m._zod.deferred)g();return m}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:u=>o?.Parent&&u instanceof o.Parent?!0:u?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class le extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const Kt={};function J(e){return Kt}function Jo(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 Ko(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 Qo(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 E(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 Me(e,t,o){Object.defineProperty(e,t,{value:o,writable:!0,enumerable:!0,configurable:!0})}function ae(e){return JSON.stringify(e)}const Qt=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Re(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Go=Ye(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Ee(e){if(Re(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const o=t.prototype;return!(Re(o)===!1||Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")===!1)}const Yo=new Set(["string","number","symbol"]);function me(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ee(e,t,o){const n=new e._zod.constr(t??e._zod.def);return(!t||o?.parent)&&(n._zod.parent=e),n}function f(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 Xo(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const en={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 tn(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 ee(e,{...e._zod.def,shape:o,checks:[]})}function on(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 ee(e,{...e._zod.def,shape:o,checks:[]})}function nn(e,t){if(!Ee(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 Me(this,"shape",n),n},checks:[]};return ee(e,o)}function rn(e,t){return ee(e,{...e._zod.def,get shape(){const o={...e._zod.def.shape,...t._zod.def.shape};return Me(this,"shape",o),o},catchall:t._zod.def.catchall,checks:[]})}function sn(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 ee(t,{...t._zod.def,shape:r,checks:[]})}function an(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 ee(t,{...t._zod.def,shape:r,checks:[]})}function ce(e,t=0){for(let o=t;o<e.issues.length;o++)if(e.issues[o]?.continue!==!0)return!0;return!1}function X(e,t){return t.map(o=>{var n;return(n=o).path??(n.path=[]),o.path.unshift(e),o})}function xe(e){return typeof e=="string"?e:e?.message}function K(e,t,o){const n={...e,path:e.path??[]};if(!e.message){const r=xe(e.inst?._zod.def?.error?.(e))??xe(t?.error?.(e))??xe(o.customError?.(e))??xe(o.localeError?.(e))??"Invalid input";n.message=r}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 de(...e){const[t,o,n]=e;return typeof t=="string"?{message:t,code:"custom",input:o,inst:n}:{...t}}const Gt=(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,Ko,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Yt=d("$ZodError",Gt),Xt=d("$ZodError",Gt,{Parent:Error});function cn(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 un(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(u=>r({issues:u}));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 u=n,p=0;for(;p<i.path.length;){const m=i.path[p];p===i.path.length-1?(u[m]=u[m]||{_errors:[]},u[m]._errors.push(o(i))):u[m]=u[m]||{_errors:[]},u=u[m],p++}}};return r(e),n}const ln=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 le;if(i.issues.length){const u=new(r?.Err??e)(i.issues.map(p=>K(p,s,J())));throw Qt(u,r?.callee),u}return i.value},dn=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 u=new(r?.Err??e)(i.issues.map(p=>K(p,s,J())));throw Qt(u,r?.callee),u}return i.value},eo=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 le;return s.issues.length?{success:!1,error:new(e??Yt)(s.issues.map(i=>K(i,r,J())))}:{success:!0,data:s.value}},to=eo(Xt),oo=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=>K(i,r,J())))}:{success:!0,data:s.value}},pn=oo(Xt),mn=/^[cC][^\s-]{8,}$/,hn=/^[0-9a-z]+$/,fn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,gn=/^[0-9a-vA-V]{20}$/,vn=/^[A-Za-z0-9]{27}$/,_n=/^[a-zA-Z0-9_-]{21}$/,bn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,kn=/^([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})$/,It=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)$/,yn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,wn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Sn(){return new RegExp(wn,"u")}const xn=/^(?:(?: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])$/,Tn=/^(([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])$/,$n=/^(([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])$/,In=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,no=/^[A-Za-z0-9_-]*$/,Rn=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,En=/^\+(?:[0-9]){6,14}[0-9]$/,ro="(?:(?:\\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])))",Zn=new RegExp(`^${ro}$`);function so(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 Pn(e){return new RegExp(`^${so(e)}$`)}function Cn(e){const t=so({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(`^${ro}T(?:${n})$`)}const Nn=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},qn=/^\d+$/,Mn=/^-?\d+(?:\.\d+)?/i,An=/true|false/i,On=/null/i,Ln=/undefined/i,Dn=/^[^A-Z]*$/,Un=/^[^a-z]*$/,U=d("$ZodCheck",(e,t)=>{var o;e._zod??(e._zod={}),e._zod.def=t,(o=e._zod).onattach??(o.onattach=[])}),io={number:"number",bigint:"bigint",object:"date"},ao=d("$ZodCheckLessThan",(e,t)=>{U.init(e,t);const o=io[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})}}),co=d("$ZodCheckGreaterThan",(e,t)=>{U.init(e,t);const o=io[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})}}),jn=d("$ZodCheckMultipleOf",(e,t)=>{U.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):Qo(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})}}),Hn=d("$ZodCheckNumberFormat",(e,t)=>{U.init(e,t),t.format=t.format||"float64";const o=t.format?.includes("int"),n=o?"int":"number",[r,s]=en[t.format];e._zod.onattach.push(i=>{const u=i._zod.bag;u.format=t.format,u.minimum=r,u.maximum=s,o&&(u.pattern=qn)}),e._zod.check=i=>{const u=i.value;if(o){if(!Number.isInteger(u)){i.issues.push({expected:n,format:t.format,code:"invalid_type",input:u,inst:e});return}if(!Number.isSafeInteger(u)){u>0?i.issues.push({input:u,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:u,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}}u<r&&i.issues.push({origin:"number",input:u,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),u>s&&i.issues.push({origin:"number",input:u,code:"too_big",maximum:s,inst:e})}}),Fn=d("$ZodCheckMaxLength",(e,t)=>{var o;U.init(e,t),(o=e._zod.def).when??(o.when=n=>{const r=n.value;return!Xe(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=tt(r);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Bn=d("$ZodCheckMinLength",(e,t)=>{var o;U.init(e,t),(o=e._zod.def).when??(o.when=n=>{const r=n.value;return!Xe(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=tt(r);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Vn=d("$ZodCheckLengthEquals",(e,t)=>{var o;U.init(e,t),(o=e._zod.def).when??(o.when=n=>{const r=n.value;return!Xe(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=tt(r),u=s>t.length;n.issues.push({origin:i,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ae=d("$ZodCheckStringFormat",(e,t)=>{var o,n;U.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=()=>{})}),Wn=d("$ZodCheckRegex",(e,t)=>{Ae.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})}}),Jn=d("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Dn),Ae.init(e,t)}),Kn=d("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Un),Ae.init(e,t)}),Qn=d("$ZodCheckIncludes",(e,t)=>{U.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(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})}}),Gn=d("$ZodCheckStartsWith",(e,t)=>{U.init(e,t);const o=new RegExp(`^${me(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})}}),Yn=d("$ZodCheckEndsWith",(e,t)=>{U.init(e,t);const o=new RegExp(`.*${me(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})}}),Xn=d("$ZodCheckOverwrite",(e,t)=>{U.init(e,t),e._zod.check=o=>{o.value=t.tx(o.value)}});class er{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(`
|
|
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 p(e,t,o){function n(a,d){var m;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(m=a._zod).traits??(m.traits=new Set),a._zod.traits.add(e),t(a,d);for(const g in i.prototype)g in a||Object.defineProperty(a,g,{value:i.prototype[g].bind(a)});a._zod.constr=i,a._zod.def=d}const r=o?.Parent??Object;class s extends r{}Object.defineProperty(s,"name",{value:e});function i(a){var d;const m=o?.Parent?new s:this;n(m,a),(d=m._zod).deferred??(d.deferred=[]);for(const g of m._zod.deferred)g();return m}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 he extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const ao={};function X(e){return ao}function un(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 ln(e,t){return typeof t=="bigint"?t.toString():t}function it(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function at(e){return e==null}function ct(e){const t=e.startsWith("^")?1:0,o=e.endsWith("$")?e.length-1:e.length;return e.slice(t,o)}function dn(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 E(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 He(e,t,o){Object.defineProperty(e,t,{value:o,writable:!0,enumerable:!0,configurable:!0})}function pe(e){return JSON.stringify(e)}const co=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Ne(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const pn=it(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function qe(e){if(Ne(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const o=t.prototype;return!(Ne(o)===!1||Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")===!1)}const mn=new Set(["string","number","symbol"]);function _e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ae(e,t,o){const n=new e._zod.constr(t??e._zod.def);return(!t||o?.parent)&&(n._zod.parent=e),n}function v(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 hn(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const fn={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 gn(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 ae(e,{...e._zod.def,shape:o,checks:[]})}function vn(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 ae(e,{...e._zod.def,shape:o,checks:[]})}function _n(e,t){if(!qe(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 He(this,"shape",n),n},checks:[]};return ae(e,o)}function bn(e,t){return ae(e,{...e._zod.def,get shape(){const o={...e._zod.def.shape,...t._zod.def.shape};return He(this,"shape",o),o},catchall:t._zod.def.catchall,checks:[]})}function yn(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 ae(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 ae(t,{...t._zod.def,shape:r,checks:[]})}function me(e,t=0){for(let o=t;o<e.issues.length;o++)if(e.issues[o]?.continue!==!0)return!0;return!1}function re(e,t){return t.map(o=>{var n;return(n=o).path??(n.path=[]),o.path.unshift(e),o})}function Re(e){return typeof e=="string"?e:e?.message}function ee(e,t,o){const n={...e,path:e.path??[]};if(!e.message){const r=Re(e.inst?._zod.def?.error?.(e))??Re(t?.error?.(e))??Re(o.customError?.(e))??Re(o.localeError?.(e))??"Invalid input";n.message=r}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function ut(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function fe(...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,ln,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},lo=p("$ZodError",uo),po=p("$ZodError",uo,{Parent:Error});function wn(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 xn(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(a=>r({issues:a}));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 a=n,d=0;for(;d<i.path.length;){const m=i.path[d];d===i.path.length-1?(a[m]=a[m]||{_errors:[]},a[m]._errors.push(o(i))):a[m]=a[m]||{_errors:[]},a=a[m],d++}}};return r(e),n}const Sn=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 a=new(r?.Err??e)(i.issues.map(d=>ee(d,s,X())));throw co(a,r?.callee),a}return i.value},Tn=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 a=new(r?.Err??e)(i.issues.map(d=>ee(d,s,X())));throw co(a,r?.callee),a}return i.value},mo=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}},ho=mo(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}},zn=fo(po),$n=/^[cC][^\s-]{8,}$/,In=/^[0-9a-z]+$/,Rn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,En=/^[0-9a-vA-V]{20}$/,Cn=/^[A-Za-z0-9]{27}$/,Pn=/^[a-zA-Z0-9_-]{21}$/,Zn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Nn=/^([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})$/,Mt=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)$/,qn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,An="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Mn(){return new RegExp(An,"u")}const On=/^(?:(?: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])$/,Dn=/^(([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})$/,Ln=/^((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])$/,Un=/^(([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])$/,jn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,go=/^[A-Za-z0-9_-]*$/,Hn=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,Fn=/^\+(?:[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])))",Bn=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 Vn(e){return new RegExp(`^${_o(e)}$`)}function Wn(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 Jn=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Kn=/^\d+$/,Qn=/^-?\d+(?:\.\d+)?/i,Gn=/true|false/i,Yn=/null/i,Xn=/undefined/i,er=/^[^A-Z]*$/,tr=/^[^a-z]*$/,H=p("$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=p("$ZodCheckLessThan",(e,t)=>{H.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})}}),ko=p("$ZodCheckGreaterThan",(e,t)=>{H.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})}}),or=p("$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):dn(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})}}),nr=p("$ZodCheckNumberFormat",(e,t)=>{H.init(e,t),t.format=t.format||"float64";const o=t.format?.includes("int"),n=o?"int":"number",[r,s]=fn[t.format];e._zod.onattach.push(i=>{const a=i._zod.bag;a.format=t.format,a.minimum=r,a.maximum=s,o&&(a.pattern=Kn)}),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<r&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:e})}}),rr=p("$ZodCheckMaxLength",(e,t)=>{var o;H.init(e,t),(o=e._zod.def).when??(o.when=n=>{const r=n.value;return!at(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=ut(r);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),sr=p("$ZodCheckMinLength",(e,t)=>{var o;H.init(e,t),(o=e._zod.def).when??(o.when=n=>{const r=n.value;return!at(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=ut(r);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ir=p("$ZodCheckLengthEquals",(e,t)=>{var o;H.init(e,t),(o=e._zod.def).when??(o.when=n=>{const r=n.value;return!at(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=ut(r),a=s>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})}}),Fe=p("$ZodCheckStringFormat",(e,t)=>{var o,n;H.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=()=>{})}),ar=p("$ZodCheckRegex",(e,t)=>{Fe.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})}}),cr=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=er),Fe.init(e,t)}),ur=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=tr),Fe.init(e,t)}),lr=p("$ZodCheckIncludes",(e,t)=>{H.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})}}),dr=p("$ZodCheckStartsWith",(e,t)=>{H.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})}}),pr=p("$ZodCheckEndsWith",(e,t)=>{H.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=p("$ZodCheckOverwrite",(e,t)=>{H.init(e,t),e._zod.check=o=>{o.value=t.tx(o.value)}});class hr{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
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
|
|
9
|
+
`))}}const fr={major:4,minor:0,patch:0},R=p("$ZodType",(e,t)=>{var o;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=fr;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,a)=>{let d=me(s),m;for(const g of i){if(g._zod.def.when){if(!g._zod.def.when(s))continue}else if(d)continue;const f=s.issues.length,h=g._zod.check(s);if(h instanceof Promise&&a?.async===!1)throw new he;if(m||h instanceof Promise)m=(m??Promise.resolve()).then(async()=>{await h,s.issues.length!==f&&(d||(d=me(s,f)))});else{if(s.issues.length===f)continue;d||(d=me(s,f))}}return m?m.then(()=>s):s};e._zod.run=(s,i)=>{const a=e._zod.parse(s,i);if(a instanceof Promise){if(i.async===!1)throw new he;return a.then(d=>r(d,n,i))}return r(a,n,i)}}e["~standard"]={validate:r=>{try{const s=ho(e,r);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return zn(e,r).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),lt=p("$ZodString",(e,t)=>{R.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Jn(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}}),P=p("$ZodStringFormat",(e,t)=>{Fe.init(e,t),lt.init(e,t)}),gr=p("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Nn),P.init(e,t)}),vr=p("$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=Mt(n))}else t.pattern??(t.pattern=Mt());P.init(e,t)}),_r=p("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=qn),P.init(e,t)}),br=p("$ZodURL",(e,t)=>{P.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:Hn.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})}}}),yr=p("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Mn()),P.init(e,t)}),kr=p("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Pn),P.init(e,t)}),wr=p("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=$n),P.init(e,t)}),xr=p("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=In),P.init(e,t)}),Sr=p("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Rn),P.init(e,t)}),Tr=p("$ZodXID",(e,t)=>{t.pattern??(t.pattern=En),P.init(e,t)}),zr=p("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Cn),P.init(e,t)}),$r=p("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Wn(t)),P.init(e,t)}),Ir=p("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Bn),P.init(e,t)}),Rr=p("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Vn(t)),P.init(e,t)}),Er=p("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Zn),P.init(e,t)}),Cr=p("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=On),P.init(e,t),e._zod.onattach.push(o=>{const n=o._zod.bag;n.format="ipv4"})}),Pr=p("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Dn),P.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})}}}),Zr=p("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ln),P.init(e,t)}),Nr=p("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Un),P.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 wo(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const qr=p("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=jn),P.init(e,t),e._zod.onattach.push(o=>{o._zod.bag.contentEncoding="base64"}),e._zod.check=o=>{wo(o.value)||o.issues.push({code:"invalid_format",format:"base64",input:o.value,inst:e,continue:!t.abort})}});function Ar(e){if(!go.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),o=t.padEnd(Math.ceil(t.length/4)*4,"=");return wo(o)}const Mr=p("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=go),P.init(e,t),e._zod.onattach.push(o=>{o._zod.bag.contentEncoding="base64url"}),e._zod.check=o=>{Ar(o.value)||o.issues.push({code:"invalid_format",format:"base64url",input:o.value,inst:e,continue:!t.abort})}}),Or=p("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Fn),P.init(e,t)});function Dr(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 Lr=p("$ZodJWT",(e,t)=>{P.init(e,t),e._zod.check=o=>{Dr(o.value,t.alg)||o.issues.push({code:"invalid_format",format:"jwt",input:o.value,inst:e,continue:!t.abort})}}),xo=p("$ZodNumber",(e,t)=>{R.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}}),Ur=p("$ZodNumber",(e,t)=>{nr.init(e,t),xo.init(e,t)}),jr=p("$ZodBoolean",(e,t)=>{R.init(e,t),e._zod.pattern=Gn,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}}),Hr=p("$ZodUndefined",(e,t)=>{R.init(e,t),e._zod.pattern=Xn,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}}),Fr=p("$ZodNull",(e,t)=>{R.init(e,t),e._zod.pattern=Yn,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}}),Br=p("$ZodUnknown",(e,t)=>{R.init(e,t),e._zod.parse=o=>o}),Vr=p("$ZodNever",(e,t)=>{R.init(e,t),e._zod.parse=(o,n)=>(o.issues.push({expected:"never",code:"invalid_type",input:o.value,inst:e}),o)});function Ot(e,t,o){e.issues.length&&t.issues.push(...re(o,e.issues)),t.value[o]=e.value}const Wr=p("$ZodArray",(e,t)=>{R.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 a=r[i],d=t.element._zod.run({value:a,issues:[]},n);d instanceof Promise?s.push(d.then(m=>Ot(m,o,i))):Ot(d,o,i)}return s.length?Promise.all(s).then(()=>o):o}});function Ee(e,t,o){e.issues.length&&t.issues.push(...re(o,e.issues)),t.value[o]=e.value}function Dt(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(...re(o,e.issues)):e.value===void 0?o in n&&(t.value[o]=void 0):t.value[o]=e.value}const Jr=p("$ZodObject",(e,t)=>{R.init(e,t);const o=it(()=>{const f=Object.keys(t.shape);for(const _ of f)if(!(t.shape[_]instanceof R))throw new Error(`Invalid element at key "${_}": expected a Zod schema`);const h=hn(t.shape);return{shape:t.shape,keys:f,keySet:new Set(f),numKeys:f.length,optionalKeys:new Set(h)}});E(e._zod,"propValues",()=>{const f=t.shape,h={};for(const _ in f){const A=f[_]._zod;if(A.values){h[_]??(h[_]=new Set);for(const L of A.values)h[_].add(L)}}return h});const n=f=>{const h=new hr(["shape","payload","ctx"]),_=o.value,A=x=>{const w=pe(x);return`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`};h.write("const input = payload.value;");const L=Object.create(null);let G=0;for(const x of _.keys)L[x]=`key_${G++}`;h.write("const newResult = {}");for(const x of _.keys)if(_.optionalKeys.has(x)){const w=L[x];h.write(`const ${w} = ${A(x)};`);const C=pe(x);h.write(`
|
|
10
10
|
if (${w}.issues.length) {
|
|
11
|
-
if (input[${
|
|
12
|
-
if (${
|
|
13
|
-
newResult[${
|
|
11
|
+
if (input[${C}] === undefined) {
|
|
12
|
+
if (${C} in input) {
|
|
13
|
+
newResult[${C}] = undefined;
|
|
14
14
|
}
|
|
15
15
|
} else {
|
|
16
16
|
payload.issues = payload.issues.concat(
|
|
17
17
|
${w}.issues.map((iss) => ({
|
|
18
18
|
...iss,
|
|
19
|
-
path: iss.path ? [${
|
|
19
|
+
path: iss.path ? [${C}, ...iss.path] : [${C}],
|
|
20
20
|
}))
|
|
21
21
|
);
|
|
22
22
|
}
|
|
23
23
|
} else if (${w}.value === undefined) {
|
|
24
|
-
if (${
|
|
24
|
+
if (${C} in input) newResult[${C}] = undefined;
|
|
25
25
|
} else {
|
|
26
|
-
newResult[${
|
|
26
|
+
newResult[${C}] = ${w}.value;
|
|
27
27
|
}
|
|
28
|
-
`)}else{const w=
|
|
28
|
+
`)}else{const w=L[x];h.write(`const ${w} = ${A(x)};`),h.write(`
|
|
29
29
|
if (${w}.issues.length) payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
|
|
30
30
|
...iss,
|
|
31
|
-
path: iss.path ? [${
|
|
32
|
-
})));`),v.write(`newResult[${ae(S)}] = ${w}.value`)}v.write("payload.value = newResult;"),v.write("return payload;");const Q=v.compile();return(S,w)=>Q(h,S,w)};let r;const s=Re,i=!Kt.jitless,p=i&&Go.value,m=t.catchall;let g;e._zod.parse=(h,v)=>{g??(g=o.value);const k=h.value;if(!s(k))return h.issues.push({expected:"object",code:"invalid_type",input:k,inst:e}),h;const M=[];if(i&&p&&v?.async===!1&&v.jitless!==!0)r||(r=n(t.shape)),h=r(h,v);else{h.value={};const w=g.shape;for(const Z of g.keys){const ie=w[Z],Se=ie._zod.run({value:k[Z],issues:[]},v),zt=ie._zod.optin==="optional"&&ie._zod.optout==="optional";Se instanceof Promise?M.push(Se.then($t=>zt?Et($t,h,Z,k):Te($t,h,Z))):zt?Et(Se,h,Z,k):Te(Se,h,Z)}}if(!m)return M.length?Promise.all(M).then(()=>h):h;const F=[],se=g.keySet,Q=m._zod,S=Q.def.type;for(const w of Object.keys(k)){if(se.has(w))continue;if(S==="never"){F.push(w);continue}const Z=Q.run({value:k[w],issues:[]},v);Z instanceof Promise?M.push(Z.then(ie=>Te(ie,h,w))):Te(Z,h,w)}return F.length&&h.issues.push({code:"unrecognized_keys",keys:F,input:k,inst:e}),M.length?Promise.all(M).then(()=>h):h}});function Zt(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=>K(s,n,J())))}),t}const po=d("$ZodUnion",(e,t)=>{R.init(e,t),E(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),E(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),E(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),E(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 r=!1;const s=[];for(const i of t.options){const u=i._zod.run({value:o.value,issues:[]},n);if(u instanceof Promise)s.push(u),r=!0;else{if(u.issues.length===0)return u;s.push(u)}}return r?Promise.all(s).then(i=>Zt(i,o,e,n)):Zt(s,o,e,n)}}),qr=d("$ZodDiscriminatedUnion",(e,t)=>{po.init(e,t);const o=e._zod.parse;E(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[u,p]of Object.entries(i)){r[u]||(r[u]=new Set);for(const m of p)r[u].add(m)}}return r});const n=Ye(()=>{const r=t.options,s=new Map;for(const i of r){const u=i._zod.propValues[t.discriminator];if(!u||u.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const p of u){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(!Re(i))return r.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),r;const u=n.value.get(i?.[t.discriminator]);return u?u._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)}}),Mr=d("$ZodIntersection",(e,t)=>{R.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,m])=>Pt(o,p,m)):Pt(o,s,i)}});function We(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(Ee(e)&&Ee(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=We(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=We(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 Pt(e,t,o){if(t.issues.length&&e.issues.push(...t.issues),o.issues.length&&e.issues.push(...o.issues),ce(e))return e;const n=We(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 Ar=d("$ZodRecord",(e,t)=>{R.init(e,t),e._zod.parse=(o,n)=>{const r=o.value;if(!Ee(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 m=t.valueType._zod.run({value:r[p],issues:[]},n);m instanceof Promise?s.push(m.then(g=>{g.issues.length&&o.issues.push(...X(p,g.issues)),o.value[p]=g.value})):(m.issues.length&&o.issues.push(...X(p,m.issues)),o.value[p]=m.value)}let u;for(const p in r)i.has(p)||(u=u??[],u.push(p));u&&u.length>0&&o.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:u})}else{o.value={};for(const i of Reflect.ownKeys(r)){if(i==="__proto__")continue;const u=t.keyType._zod.run({value:i,issues:[]},n);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){o.issues.push({origin:"record",code:"invalid_key",issues:u.issues.map(m=>K(m,n,J())),input:i,path:[i],inst:e}),o.value[u.value]=u.value;continue}const p=t.valueType._zod.run({value:r[i],issues:[]},n);p instanceof Promise?s.push(p.then(m=>{m.issues.length&&o.issues.push(...X(i,m.issues)),o.value[u.value]=m.value})):(p.issues.length&&o.issues.push(...X(i,p.issues)),o.value[u.value]=p.value)}}return s.length?Promise.all(s).then(()=>o):o}}),Or=d("$ZodEnum",(e,t)=>{R.init(e,t);const o=Jo(t.entries);e._zod.values=new Set(o),e._zod.pattern=new RegExp(`^(${o.filter(n=>Yo.has(typeof n)).map(n=>typeof n=="string"?me(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}}),Lr=d("$ZodLiteral",(e,t)=>{R.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 r=o.value;return e._zod.values.has(r)||o.issues.push({code:"invalid_value",values:t.values,input:r,inst:e}),o}}),Dr=d("$ZodTransform",(e,t)=>{R.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 le;return o.value=r,o}}),Ur=d("$ZodOptional",(e,t)=>{R.init(e,t),e._zod.optin="optional",e._zod.optout="optional",E(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),E(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)}),jr=d("$ZodNullable",(e,t)=>{R.init(e,t),E(e._zod,"optin",()=>t.innerType._zod.optin),E(e._zod,"optout",()=>t.innerType._zod.optout),E(e._zod,"pattern",()=>{const o=t.innerType._zod.pattern;return o?new RegExp(`^(${et(o.source)}|null)$`):void 0}),E(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)}),Hr=d("$ZodDefault",(e,t)=>{R.init(e,t),e._zod.optin="optional",E(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=>Ct(s,t)):Ct(r,t)}});function Ct(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Fr=d("$ZodPrefault",(e,t)=>{R.init(e,t),e._zod.optin="optional",E(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))}),Br=d("$ZodNonOptional",(e,t)=>{R.init(e,t),E(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=>Nt(s,e)):Nt(r,e)}});function Nt(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 Vr=d("$ZodCatch",(e,t)=>{R.init(e,t),e._zod.optin="optional",E(e._zod,"optout",()=>t.innerType._zod.optout),E(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=>K(i,n,J()))},input:o.value}),o.issues=[]),o)):(o.value=r.value,r.issues.length&&(o.value=t.catchValue({...o,error:{issues:r.issues.map(s=>K(s,n,J()))},input:o.value}),o.issues=[]),o)}}),Wr=d("$ZodPipe",(e,t)=>{R.init(e,t),E(e._zod,"values",()=>t.in._zod.values),E(e._zod,"optin",()=>t.in._zod.optin),E(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=>qt(s,t,n)):qt(r,t,n)}});function qt(e,t,o){return ce(e)?e:t.out._zod.run({value:e.value,issues:e.issues},o)}const Jr=d("$ZodReadonly",(e,t)=>{R.init(e,t),E(e._zod,"propValues",()=>t.innerType._zod.propValues),E(e._zod,"values",()=>t.innerType._zod.values),E(e._zod,"optin",()=>t.innerType._zod.optin),E(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(Mt):Mt(r)}});function Mt(e){return e.value=Object.freeze(e.value),e}const Kr=d("$ZodCustom",(e,t)=>{U.init(e,t),R.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=>At(s,o,n,e));At(r,o,n,e)}});function At(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(de(r))}}class Qr{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 Gr(){return new Qr}const ze=Gr();function Yr(e,t){return new e({type:"string",...f(t)})}function Xr(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...f(t)})}function Ot(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...f(t)})}function es(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...f(t)})}function ts(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...f(t)})}function os(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...f(t)})}function ns(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...f(t)})}function rs(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...f(t)})}function ss(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...f(t)})}function is(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...f(t)})}function as(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...f(t)})}function cs(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...f(t)})}function us(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...f(t)})}function ls(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...f(t)})}function ds(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...f(t)})}function ps(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...f(t)})}function ms(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...f(t)})}function hs(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...f(t)})}function fs(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...f(t)})}function gs(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...f(t)})}function vs(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...f(t)})}function _s(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...f(t)})}function bs(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...f(t)})}function ks(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...f(t)})}function ys(e,t){return new e({type:"string",format:"date",check:"string_format",...f(t)})}function ws(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...f(t)})}function Ss(e,t){return new e({type:"string",format:"duration",check:"string_format",...f(t)})}function xs(e,t){return new e({type:"number",checks:[],...f(t)})}function Ts(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...f(t)})}function zs(e,t){return new e({type:"boolean",...f(t)})}function $s(e,t){return new e({type:"undefined",...f(t)})}function Is(e,t){return new e({type:"null",...f(t)})}function Rs(e){return new e({type:"unknown"})}function Es(e,t){return new e({type:"never",...f(t)})}function Lt(e,t){return new ao({check:"less_than",...f(t),value:e,inclusive:!1})}function He(e,t){return new ao({check:"less_than",...f(t),value:e,inclusive:!0})}function Dt(e,t){return new co({check:"greater_than",...f(t),value:e,inclusive:!1})}function Fe(e,t){return new co({check:"greater_than",...f(t),value:e,inclusive:!0})}function Ut(e,t){return new jn({check:"multiple_of",...f(t),value:e})}function mo(e,t){return new Fn({check:"max_length",...f(t),maximum:e})}function Ze(e,t){return new Bn({check:"min_length",...f(t),minimum:e})}function ho(e,t){return new Vn({check:"length_equals",...f(t),length:e})}function Zs(e,t){return new Wn({check:"string_format",format:"regex",...f(t),pattern:e})}function Ps(e){return new Jn({check:"string_format",format:"lowercase",...f(e)})}function Cs(e){return new Kn({check:"string_format",format:"uppercase",...f(e)})}function Ns(e,t){return new Qn({check:"string_format",format:"includes",...f(t),includes:e})}function qs(e,t){return new Gn({check:"string_format",format:"starts_with",...f(t),prefix:e})}function Ms(e,t){return new Yn({check:"string_format",format:"ends_with",...f(t),suffix:e})}function he(e){return new Xn({check:"overwrite",tx:e})}function As(e){return he(t=>t.normalize(e))}function Os(){return he(e=>e.trim())}function Ls(){return he(e=>e.toLowerCase())}function Ds(){return he(e=>e.toUpperCase())}function Us(e,t,o){return new e({type:"array",element:t,...f(o)})}function js(e,t,o){const n=f(o);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function Hs(e,t,o){return new e({type:"custom",check:"custom",fn:t,...f(o)})}function nt(e){return!!e._zod}function fo(e,t){return nt(e)?to(e,t):e.safeParse(t)}function Fs(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 Bs(e){if(nt(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 Vs=d("ZodISODateTime",(e,t)=>{mr.init(e,t),N.init(e,t)});function go(e){return ks(Vs,e)}const Ws=d("ZodISODate",(e,t)=>{hr.init(e,t),N.init(e,t)});function Js(e){return ys(Ws,e)}const Ks=d("ZodISOTime",(e,t)=>{fr.init(e,t),N.init(e,t)});function Qs(e){return ws(Ks,e)}const Gs=d("ZodISODuration",(e,t)=>{gr.init(e,t),N.init(e,t)});function Ys(e){return Ss(Gs,e)}const Xs=(e,t)=>{Yt.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:o=>un(e,o)},flatten:{value:o=>cn(e,o)},addIssue:{value:o=>e.issues.push(o)},addIssues:{value:o=>e.issues.push(...o)},isEmpty:{get(){return e.issues.length===0}}})},Oe=d("ZodError",Xs,{Parent:Error}),ei=ln(Oe),ti=dn(Oe),oi=eo(Oe),ni=oo(Oe),C=d("ZodType",(e,t)=>(R.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)=>ee(e,o,n),e.brand=()=>e,e.register=((o,n)=>(o.add(e,n),e)),e.parse=(o,n)=>ei(e,o,n,{callee:e.parse}),e.safeParse=(o,n)=>oi(e,o,n),e.parseAsync=async(o,n)=>ti(e,o,n,{callee:e.parseAsync}),e.safeParseAsync=async(o,n)=>ni(e,o,n),e.spa=e.safeParseAsync,e.refine=(o,n)=>e.check(Ji(o,n)),e.superRefine=o=>e.check(Ki(o)),e.overwrite=o=>e.check(he(o)),e.optional=()=>q(e),e.nullable=()=>Ft(e),e.nullish=()=>q(Ft(e)),e.nonoptional=o=>Di(e,o),e.array=()=>_(e),e.or=o=>y([e,o]),e.and=o=>rt(e,o),e.transform=o=>Qe(e,So(o)),e.default=o=>Ai(e,o),e.prefault=o=>Li(e,o),e.catch=o=>ji(e,o),e.pipe=o=>Qe(e,o),e.readonly=()=>Bi(e),e.describe=o=>{const n=e.clone();return ze.add(n,{description:o}),n},Object.defineProperty(e,"description",{get(){return ze.get(e)?.description},configurable:!0}),e.meta=(...o)=>{if(o.length===0)return ze.get(e);const n=e.clone();return ze.add(n,o[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),vo=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(Zs(...n)),e.includes=(...n)=>e.check(Ns(...n)),e.startsWith=(...n)=>e.check(qs(...n)),e.endsWith=(...n)=>e.check(Ms(...n)),e.min=(...n)=>e.check(Ze(...n)),e.max=(...n)=>e.check(mo(...n)),e.length=(...n)=>e.check(ho(...n)),e.nonempty=(...n)=>e.check(Ze(1,...n)),e.lowercase=n=>e.check(Ps(n)),e.uppercase=n=>e.check(Cs(n)),e.trim=()=>e.check(Os()),e.normalize=(...n)=>e.check(As(...n)),e.toLowerCase=()=>e.check(Ls()),e.toUpperCase=()=>e.check(Ds())}),ri=d("ZodString",(e,t)=>{ot.init(e,t),vo.init(e,t),e.email=o=>e.check(Xr(si,o)),e.url=o=>e.check(rs(ii,o)),e.jwt=o=>e.check(bs(yi,o)),e.emoji=o=>e.check(ss(ai,o)),e.guid=o=>e.check(Ot(jt,o)),e.uuid=o=>e.check(es($e,o)),e.uuidv4=o=>e.check(ts($e,o)),e.uuidv6=o=>e.check(os($e,o)),e.uuidv7=o=>e.check(ns($e,o)),e.nanoid=o=>e.check(is(ci,o)),e.guid=o=>e.check(Ot(jt,o)),e.cuid=o=>e.check(as(ui,o)),e.cuid2=o=>e.check(cs(li,o)),e.ulid=o=>e.check(us(di,o)),e.base64=o=>e.check(gs(_i,o)),e.base64url=o=>e.check(vs(bi,o)),e.xid=o=>e.check(ls(pi,o)),e.ksuid=o=>e.check(ds(mi,o)),e.ipv4=o=>e.check(ps(hi,o)),e.ipv6=o=>e.check(ms(fi,o)),e.cidrv4=o=>e.check(hs(gi,o)),e.cidrv6=o=>e.check(fs(vi,o)),e.e164=o=>e.check(_s(ki,o)),e.datetime=o=>e.check(go(o)),e.date=o=>e.check(Js(o)),e.time=o=>e.check(Qs(o)),e.duration=o=>e.check(Ys(o))});function c(e){return Yr(ri,e)}const N=d("ZodStringFormat",(e,t)=>{P.init(e,t),vo.init(e,t)}),si=d("ZodEmail",(e,t)=>{rr.init(e,t),N.init(e,t)}),jt=d("ZodGUID",(e,t)=>{or.init(e,t),N.init(e,t)}),$e=d("ZodUUID",(e,t)=>{nr.init(e,t),N.init(e,t)}),ii=d("ZodURL",(e,t)=>{sr.init(e,t),N.init(e,t)}),ai=d("ZodEmoji",(e,t)=>{ir.init(e,t),N.init(e,t)}),ci=d("ZodNanoID",(e,t)=>{ar.init(e,t),N.init(e,t)}),ui=d("ZodCUID",(e,t)=>{cr.init(e,t),N.init(e,t)}),li=d("ZodCUID2",(e,t)=>{ur.init(e,t),N.init(e,t)}),di=d("ZodULID",(e,t)=>{lr.init(e,t),N.init(e,t)}),pi=d("ZodXID",(e,t)=>{dr.init(e,t),N.init(e,t)}),mi=d("ZodKSUID",(e,t)=>{pr.init(e,t),N.init(e,t)}),hi=d("ZodIPv4",(e,t)=>{vr.init(e,t),N.init(e,t)}),fi=d("ZodIPv6",(e,t)=>{_r.init(e,t),N.init(e,t)}),gi=d("ZodCIDRv4",(e,t)=>{br.init(e,t),N.init(e,t)}),vi=d("ZodCIDRv6",(e,t)=>{kr.init(e,t),N.init(e,t)}),_i=d("ZodBase64",(e,t)=>{yr.init(e,t),N.init(e,t)}),bi=d("ZodBase64URL",(e,t)=>{Sr.init(e,t),N.init(e,t)}),ki=d("ZodE164",(e,t)=>{xr.init(e,t),N.init(e,t)}),yi=d("ZodJWT",(e,t)=>{zr.init(e,t),N.init(e,t)}),_o=d("ZodNumber",(e,t)=>{lo.init(e,t),C.init(e,t),e.gt=(n,r)=>e.check(Dt(n,r)),e.gte=(n,r)=>e.check(Fe(n,r)),e.min=(n,r)=>e.check(Fe(n,r)),e.lt=(n,r)=>e.check(Lt(n,r)),e.lte=(n,r)=>e.check(He(n,r)),e.max=(n,r)=>e.check(He(n,r)),e.int=n=>e.check(Ht(n)),e.safe=n=>e.check(Ht(n)),e.positive=n=>e.check(Dt(0,n)),e.nonnegative=n=>e.check(Fe(0,n)),e.negative=n=>e.check(Lt(0,n)),e.nonpositive=n=>e.check(He(0,n)),e.multipleOf=(n,r)=>e.check(Ut(n,r)),e.step=(n,r)=>e.check(Ut(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 b(e){return xs(_o,e)}const wi=d("ZodNumberFormat",(e,t)=>{$r.init(e,t),_o.init(e,t)});function Ht(e){return Ts(wi,e)}const Si=d("ZodBoolean",(e,t)=>{Ir.init(e,t),C.init(e,t)});function I(e){return zs(Si,e)}const xi=d("ZodUndefined",(e,t)=>{Rr.init(e,t),C.init(e,t)});function Je(e){return $s(xi,e)}const Ti=d("ZodNull",(e,t)=>{Er.init(e,t),C.init(e,t)});function bo(e){return Is(Ti,e)}const zi=d("ZodUnknown",(e,t)=>{Zr.init(e,t),C.init(e,t)});function $(){return Rs(zi)}const $i=d("ZodNever",(e,t)=>{Pr.init(e,t),C.init(e,t)});function Ii(e){return Es($i,e)}const Ri=d("ZodArray",(e,t)=>{Cr.init(e,t),C.init(e,t),e.element=t.element,e.min=(o,n)=>e.check(Ze(o,n)),e.nonempty=o=>e.check(Ze(1,o)),e.max=(o,n)=>e.check(mo(o,n)),e.length=(o,n)=>e.check(ho(o,n)),e.unwrap=()=>e.element});function _(e,t){return Us(Ri,e,t)}const ko=d("ZodObject",(e,t)=>{Nr.init(e,t),C.init(e,t),E(e,"shape",()=>t.shape),e.keyof=()=>j(Object.keys(e._zod.def.shape)),e.catchall=o=>e.clone({...e._zod.def,catchall:o}),e.passthrough=()=>e.clone({...e._zod.def,catchall:$()}),e.loose=()=>e.clone({...e._zod.def,catchall:$()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ii()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=o=>nn(e,o),e.merge=o=>rn(e,o),e.pick=o=>tn(e,o),e.omit=o=>on(e,o),e.partial=(...o)=>sn(xo,e,o[0]),e.required=(...o)=>an(To,e,o[0])});function l(e,t){const o={type:"object",get shape(){return Me(this,"shape",{...e}),this.shape},...f(t)};return new ko(o)}function D(e,t){return new ko({type:"object",get shape(){return Me(this,"shape",{...e}),this.shape},catchall:$(),...f(t)})}const yo=d("ZodUnion",(e,t)=>{po.init(e,t),C.init(e,t),e.options=t.options});function y(e,t){return new yo({type:"union",options:e,...f(t)})}const Ei=d("ZodDiscriminatedUnion",(e,t)=>{yo.init(e,t),qr.init(e,t)});function wo(e,t,o){return new Ei({type:"union",options:t,discriminator:e,...f(o)})}const Zi=d("ZodIntersection",(e,t)=>{Mr.init(e,t),C.init(e,t)});function rt(e,t){return new Zi({type:"intersection",left:e,right:t})}const Pi=d("ZodRecord",(e,t)=>{Ar.init(e,t),C.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function z(e,t,o){return new Pi({type:"record",keyType:e,valueType:t,...f(o)})}const Ke=d("ZodEnum",(e,t)=>{Or.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,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 Ke({...t,checks:[],...f(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 Ke({...t,checks:[],...f(r),entries:s})}});function j(e,t){const o=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Ke({type:"enum",entries:o,...f(t)})}const Ci=d("ZodLiteral",(e,t)=>{Lr.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 a(e,t){return new Ci({type:"literal",values:Array.isArray(e)?e:[e],...f(t)})}const Ni=d("ZodTransform",(e,t)=>{Dr.init(e,t),C.init(e,t),e._zod.parse=(o,n)=>{o.addIssue=s=>{if(typeof s=="string")o.issues.push(de(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(de(i))}};const r=t.transform(o.value,o);return r instanceof Promise?r.then(s=>(o.value=s,o)):(o.value=r,o)}});function So(e){return new Ni({type:"transform",transform:e})}const xo=d("ZodOptional",(e,t)=>{Ur.init(e,t),C.init(e,t),e.unwrap=()=>e._zod.def.innerType});function q(e){return new xo({type:"optional",innerType:e})}const qi=d("ZodNullable",(e,t)=>{jr.init(e,t),C.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Ft(e){return new qi({type:"nullable",innerType:e})}const Mi=d("ZodDefault",(e,t)=>{Hr.init(e,t),C.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ai(e,t){return new Mi({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const Oi=d("ZodPrefault",(e,t)=>{Fr.init(e,t),C.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Li(e,t){return new Oi({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const To=d("ZodNonOptional",(e,t)=>{Br.init(e,t),C.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Di(e,t){return new To({type:"nonoptional",innerType:e,...f(t)})}const Ui=d("ZodCatch",(e,t)=>{Vr.init(e,t),C.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ji(e,t){return new Ui({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Hi=d("ZodPipe",(e,t)=>{Wr.init(e,t),C.init(e,t),e.in=t.in,e.out=t.out});function Qe(e,t){return new Hi({type:"pipe",in:e,out:t})}const Fi=d("ZodReadonly",(e,t)=>{Jr.init(e,t),C.init(e,t)});function Bi(e){return new Fi({type:"readonly",innerType:e})}const zo=d("ZodCustom",(e,t)=>{Kr.init(e,t),C.init(e,t)});function Vi(e){const t=new U({check:"custom"});return t._zod.check=e,t}function Wi(e,t){return js(zo,e??(()=>!0),t)}function Ji(e,t={}){return Hs(zo,e,t)}function Ki(e){const t=Vi(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(de(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(de(r))}},e(o.value,o)));return t}function $o(e,t){return Qe(So(e),t)}const Y="io.modelcontextprotocol/related-task",Le="2.0",A=Wi(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Io=y([c(),b().int()]),Ro=c();D({ttl:y([b(),bo()]).optional(),pollInterval:b().optional()});const Qi=l({ttl:b().optional()}),Gi=l({taskId:c()}),st=D({progressToken:Io.optional(),[Y]:Gi.optional()}),H=l({_meta:st.optional()}),fe=H.extend({task:Qi.optional()}),Yi=e=>fe.safeParse(e).success,O=l({method:c(),params:H.loose().optional()}),B=l({_meta:st.optional()}),V=l({method:c(),params:B.loose().optional()}),L=D({_meta:st.optional()}),ge=y([c(),b().int()]),Eo=l({jsonrpc:a(Le),id:ge,...O.shape}).strict(),Bt=e=>Eo.safeParse(e).success,Zo=l({jsonrpc:a(Le),...V.shape}).strict(),Xi=e=>Zo.safeParse(e).success,it=l({jsonrpc:a(Le),id:ge,result:L}).strict(),Ie=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:a(Le),id:ge.optional(),error:l({code:b().int(),message:c(),data:$().optional()})}).strict(),ea=e=>at.safeParse(e).success,ta=y([Eo,Zo,it,at]);y([it,at]);const ct=L.strict(),oa=B.extend({requestId:ge.optional(),reason:c().optional()}),ut=V.extend({method:a("notifications/cancelled"),params:oa}),na=l({src:c(),mimeType:c().optional(),sizes:_(c()).optional(),theme:j(["light","dark"]).optional()}),ve=l({icons:_(na).optional()}),ne=l({name:c(),title:c().optional()}),De=ne.extend({...ne.shape,...ve.shape,version:c(),websiteUrl:c().optional(),description:c().optional()}),ra=rt(l({applyDefaults:I().optional()}),z(c(),$())),sa=$o(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,rt(l({form:ra.optional(),url:A.optional()}),z(c(),$()).optional())),ia=D({list:A.optional(),cancel:A.optional(),requests:D({sampling:D({createMessage:A.optional()}).optional(),elicitation:D({create:A.optional()}).optional()}).optional()}),aa=D({list:A.optional(),cancel:A.optional(),requests:D({tools:D({call:A.optional()}).optional()}).optional()}),ca=l({experimental:z(c(),A).optional(),sampling:l({context:A.optional(),tools:A.optional()}).optional(),elicitation:sa.optional(),roots:l({listChanged:I().optional()}).optional(),tasks:ia.optional()}),ua=H.extend({protocolVersion:c(),capabilities:ca,clientInfo:De}),la=O.extend({method:a("initialize"),params:ua}),da=l({experimental:z(c(),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:aa.optional()}),pa=L.extend({protocolVersion:c(),capabilities:da,serverInfo:De,instructions:c().optional()}),ma=V.extend({method:a("notifications/initialized"),params:B.optional()}),Ue=O.extend({method:a("ping"),params:H.optional()}),ha=l({progress:b(),total:q(b()),message:q(c())}),fa=l({...B.shape,...ha.shape,progressToken:Io}),lt=V.extend({method:a("notifications/progress"),params:fa}),ga=H.extend({cursor:Ro.optional()}),_e=O.extend({params:ga.optional()}),be=L.extend({nextCursor:Ro.optional()}),va=j(["working","input_required","completed","failed","cancelled"]),ke=l({taskId:c(),status:va,ttl:y([b(),bo()]),createdAt:c(),lastUpdatedAt:c(),pollInterval:q(b()),statusMessage:q(c())}),dt=L.extend({task:ke}),_a=B.merge(ke),Pe=V.extend({method:a("notifications/tasks/status"),params:_a}),pt=O.extend({method:a("tasks/get"),params:H.extend({taskId:c()})}),mt=L.merge(ke),ht=O.extend({method:a("tasks/result"),params:H.extend({taskId:c()})});L.loose();const ft=_e.extend({method:a("tasks/list")}),gt=be.extend({tasks:_(ke)}),vt=O.extend({method:a("tasks/cancel"),params:H.extend({taskId:c()})}),ba=L.merge(ke),Po=l({uri:c(),mimeType:q(c()),_meta:z(c(),$()).optional()}),Co=Po.extend({text:c()}),_t=c().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),No=Po.extend({blob:_t}),ye=j(["user","assistant"]),re=l({audience:_(ye).optional(),priority:b().min(0).max(1).optional(),lastModified:go({offset:!0}).optional()}),qo=l({...ne.shape,...ve.shape,uri:c(),description:q(c()),mimeType:q(c()),annotations:re.optional(),_meta:q(D({}))}),ka=l({...ne.shape,...ve.shape,uriTemplate:c(),description:q(c()),mimeType:q(c()),annotations:re.optional(),_meta:q(D({}))}),ya=_e.extend({method:a("resources/list")}),Mo=be.extend({resources:_(qo)}),wa=_e.extend({method:a("resources/templates/list")}),Sa=be.extend({resourceTemplates:_(ka)}),bt=H.extend({uri:c()}),xa=bt,Ta=O.extend({method:a("resources/read"),params:xa}),Ao=L.extend({contents:_(y([Co,No]))}),za=V.extend({method:a("notifications/resources/list_changed"),params:B.optional()}),$a=bt,Ia=O.extend({method:a("resources/subscribe"),params:$a}),Ra=bt,Ea=O.extend({method:a("resources/unsubscribe"),params:Ra}),Za=B.extend({uri:c()}),Pa=V.extend({method:a("notifications/resources/updated"),params:Za}),Ca=l({name:c(),description:q(c()),required:q(I())}),Na=l({...ne.shape,...ve.shape,description:q(c()),arguments:q(_(Ca)),_meta:q(D({}))}),qa=_e.extend({method:a("prompts/list")}),Ma=be.extend({prompts:_(Na)}),Aa=H.extend({name:c(),arguments:z(c(),c()).optional()}),Oa=O.extend({method:a("prompts/get"),params:Aa}),kt=l({type:a("text"),text:c(),annotations:re.optional(),_meta:z(c(),$()).optional()}),yt=l({type:a("image"),data:_t,mimeType:c(),annotations:re.optional(),_meta:z(c(),$()).optional()}),wt=l({type:a("audio"),data:_t,mimeType:c(),annotations:re.optional(),_meta:z(c(),$()).optional()}),La=l({type:a("tool_use"),name:c(),id:c(),input:z(c(),$()),_meta:z(c(),$()).optional()}),Oo=l({type:a("resource"),resource:y([Co,No]),annotations:re.optional(),_meta:z(c(),$()).optional()}),Lo=qo.extend({type:a("resource_link")}),we=y([kt,yt,wt,Lo,Oo]),Da=l({role:ye,content:we}),Ua=L.extend({description:c().optional(),messages:_(Da)}),ja=V.extend({method:a("notifications/prompts/list_changed"),params:B.optional()}),Ha=l({title:c().optional(),readOnlyHint:I().optional(),destructiveHint:I().optional(),idempotentHint:I().optional(),openWorldHint:I().optional()}),Fa=l({taskSupport:j(["required","optional","forbidden"]).optional()}),St=l({...ne.shape,...ve.shape,description:c().optional(),inputSchema:l({type:a("object"),properties:z(c(),A).optional(),required:_(c()).optional()}).catchall($()),outputSchema:l({type:a("object"),properties:z(c(),A).optional(),required:_(c()).optional()}).catchall($()).optional(),annotations:Ha.optional(),execution:Fa.optional(),_meta:z(c(),$()).optional()}),Do=_e.extend({method:a("tools/list")}),Ba=be.extend({tools:_(St)}),je=L.extend({content:_(we).default([]),structuredContent:z(c(),$()).optional(),isError:I().optional()});je.or(L.extend({toolResult:$()}));const Va=fe.extend({name:c(),arguments:z(c(),$()).optional()}),Uo=O.extend({method:a("tools/call"),params:Va}),Wa=V.extend({method:a("notifications/tools/list_changed"),params:B.optional()});l({autoRefresh:I().default(!0),debounceMs:b().int().nonnegative().default(300)});const jo=j(["debug","info","notice","warning","error","critical","alert","emergency"]),Ja=H.extend({level:jo}),Ka=O.extend({method:a("logging/setLevel"),params:Ja}),Qa=B.extend({level:jo,logger:c().optional(),data:$()}),Ga=V.extend({method:a("notifications/message"),params:Qa}),Ya=l({name:c().optional()}),Xa=l({hints:_(Ya).optional(),costPriority:b().min(0).max(1).optional(),speedPriority:b().min(0).max(1).optional(),intelligencePriority:b().min(0).max(1).optional()}),ec=l({mode:j(["auto","required","none"]).optional()}),tc=l({type:a("tool_result"),toolUseId:c().describe("The unique identifier for the corresponding tool call."),content:_(we).default([]),structuredContent:l({}).loose().optional(),isError:I().optional(),_meta:z(c(),$()).optional()}),oc=wo("type",[kt,yt,wt]),Ce=wo("type",[kt,yt,wt,La,tc]),nc=l({role:ye,content:y([Ce,_(Ce)]),_meta:z(c(),$()).optional()}),rc=fe.extend({messages:_(nc),modelPreferences:Xa.optional(),systemPrompt:c().optional(),includeContext:j(["none","thisServer","allServers"]).optional(),temperature:b().optional(),maxTokens:b().int(),stopSequences:_(c()).optional(),metadata:A.optional(),tools:_(St).optional(),toolChoice:ec.optional()}),sc=O.extend({method:a("sampling/createMessage"),params:rc}),ic=L.extend({model:c(),stopReason:q(j(["endTurn","stopSequence","maxTokens"]).or(c())),role:ye,content:oc}),ac=L.extend({model:c(),stopReason:q(j(["endTurn","stopSequence","maxTokens","toolUse"]).or(c())),role:ye,content:y([Ce,_(Ce)])}),cc=l({type:a("boolean"),title:c().optional(),description:c().optional(),default:I().optional()}),uc=l({type:a("string"),title:c().optional(),description:c().optional(),minLength:b().optional(),maxLength:b().optional(),format:j(["email","uri","date","date-time"]).optional(),default:c().optional()}),lc=l({type:j(["number","integer"]),title:c().optional(),description:c().optional(),minimum:b().optional(),maximum:b().optional(),default:b().optional()}),dc=l({type:a("string"),title:c().optional(),description:c().optional(),enum:_(c()),default:c().optional()}),pc=l({type:a("string"),title:c().optional(),description:c().optional(),oneOf:_(l({const:c(),title:c()})),default:c().optional()}),mc=l({type:a("string"),title:c().optional(),description:c().optional(),enum:_(c()),enumNames:_(c()).optional(),default:c().optional()}),hc=y([dc,pc]),fc=l({type:a("array"),title:c().optional(),description:c().optional(),minItems:b().optional(),maxItems:b().optional(),items:l({type:a("string"),enum:_(c())}),default:_(c()).optional()}),gc=l({type:a("array"),title:c().optional(),description:c().optional(),minItems:b().optional(),maxItems:b().optional(),items:l({anyOf:_(l({const:c(),title:c()}))}),default:_(c()).optional()}),vc=y([fc,gc]),_c=y([mc,hc,vc]),bc=y([_c,cc,uc,lc]),kc=fe.extend({mode:a("form").optional(),message:c(),requestedSchema:l({type:a("object"),properties:z(c(),bc),required:_(c()).optional()})}),yc=fe.extend({mode:a("url"),message:c(),elicitationId:c(),url:c().url()}),wc=y([kc,yc]),Sc=O.extend({method:a("elicitation/create"),params:wc}),xc=B.extend({elicitationId:c()}),Tc=V.extend({method:a("notifications/elicitation/complete"),params:xc}),zc=L.extend({action:j(["accept","decline","cancel"]),content:$o(e=>e===null?void 0:e,z(c(),y([c(),b(),I(),_(c())])).optional())}),$c=l({type:a("ref/resource"),uri:c()}),Ic=l({type:a("ref/prompt"),name:c()}),Rc=H.extend({ref:y([Ic,$c]),argument:l({name:c(),value:c()}),context:l({arguments:z(c(),c()).optional()}).optional()}),Ec=O.extend({method:a("completion/complete"),params:Rc}),Zc=L.extend({completion:D({values:_(c()).max(100),total:q(b().int()),hasMore:q(I())})}),Pc=l({uri:c().startsWith("file://"),name:c().optional(),_meta:z(c(),$()).optional()}),Cc=O.extend({method:a("roots/list"),params:H.optional()}),Nc=L.extend({roots:_(Pc)}),qc=V.extend({method:a("notifications/roots/list_changed"),params:B.optional()});y([Ue,la,Ec,Ka,Oa,qa,ya,wa,Ta,Ia,Ea,Uo,Do,pt,ht,ft,vt]);y([ut,lt,ma,qc,Pe]);y([ct,ic,ac,zc,Nc,mt,gt,dt]);y([Ue,sc,Sc,Cc,pt,ht,ft,vt]);y([ut,lt,Ga,Pa,za,Wa,ja,Pe,Tc]);y([ct,pa,Zc,Ua,Ma,Mo,Sa,Ao,je,Ba,mt,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 r=n;if(r.elicitations)return new Mc(r.elicitations,o)}return new x(t,o,n)}}class Mc 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 G(e){return e==="completed"||e==="failed"||e==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Vt(e){const o=Fs(e)?.method;if(!o)throw new Error("Schema is missing a method literal");const n=Bs(o);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Wt(e,t){const o=fo(e,t);if(!o.success)throw o.error;return o.data}const Ac=6e4;class Oc{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(Ue,o=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(pt,async(o,n)=>{const r=await this._taskStore.getTask(o.params.taskId,n.sessionId);if(!r)throw new x(T.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(ht,async(o,n)=>{const r=async()=>{const s=o.params.taskId;if(this._taskMessageQueue){let u;for(;u=await this._taskMessageQueue.dequeue(s,n.sessionId);){if(u.type==="response"||u.type==="error"){const p=u.message,m=p.id,g=this._requestResolvers.get(m);if(g)if(this._requestResolvers.delete(m),u.type==="response")g(p);else{const h=p,v=new x(h.error.code,h.error.message,h.error.data);g(v)}else{const h=u.type==="response"?"Response":"Error";this._onerror(new Error(`${h} handler missing for request ${m}`))}continue}await this._transport?.send(u.message,{relatedRequestId:n.requestId})}}const i=await this._taskStore.getTask(s,n.sessionId);if(!i)throw new x(T.InvalidParams,`Task not found: ${s}`);if(!G(i.status))return await this._waitForTaskUpdate(s,n.signal),await r();if(G(i.status)){const u=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s),{...u,_meta:{...u._meta,[Y]:{taskId:s}}}}return await r()};return await r()}),this.setRequestHandler(ft,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 x(T.InvalidParams,`Failed to list tasks: ${r instanceof Error?r.message:String(r)}`)}}),this.setRequestHandler(vt,async(o,n)=>{try{const r=await this._taskStore.getTask(o.params.taskId,n.sessionId);if(!r)throw new x(T.InvalidParams,`Task not found: ${o.params.taskId}`);if(G(r.status))throw new x(T.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 x(T.InvalidParams,`Task not found after cancellation: ${o.params.taskId}`);return{_meta:{},...s}}catch(r){throw r instanceof x?r:new x(T.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),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=s=>{n?.(s),this._onerror(s)};const r=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{r?.(s,i),Ie(s)||ea(s)?this._onresponse(s):Bt(s)?this._onrequest(s,i):Xi(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=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,r=this._transport,s=t.params?._meta?.[Y]?.taskId;if(n===void 0){const g={jsonrpc:"2.0",id:t.id,error:{code:T.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:g,timestamp:Date.now()},r?.sessionId).catch(h=>this._onerror(new Error(`Failed to enqueue error response: ${h}`))):r?.send(g).catch(h=>this._onerror(new Error(`Failed to send an error response: ${h}`)));return}const i=new AbortController;this._requestHandlerAbortControllers.set(t.id,i);const u=Yi(t.params)?t.params.task:void 0,p=this._taskStore?this.requestTaskStore(t,r?.sessionId):void 0,m={signal:i.signal,sessionId:r?.sessionId,_meta:t.params?._meta,sendNotification:async g=>{if(i.signal.aborted)return;const h={relatedRequestId:t.id};s&&(h.relatedTask={taskId:s}),await this.notification(g,h)},sendRequest:async(g,h,v)=>{if(i.signal.aborted)throw new x(T.ConnectionClosed,"Request was cancelled");const k={...v,relatedRequestId:t.id};s&&!k.relatedTask&&(k.relatedTask={taskId:s});const M=k.relatedTask?.taskId??s;return M&&p&&await p.updateTaskStatus(M,"input_required"),await this.request(g,h,k)},authInfo:o?.authInfo,requestId:t.id,requestInfo:o?.requestInfo,taskId:s,taskStore:p,taskRequestedTtl:u?.ttl,closeSSEStream:o?.closeSSEStream,closeStandaloneSSEStream:o?.closeStandaloneSSEStream};Promise.resolve().then(()=>{u&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,m)).then(async g=>{if(i.signal.aborted)return;const h={result:g,jsonrpc:"2.0",id:t.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:h,timestamp:Date.now()},r?.sessionId):await r?.send(h)},async g=>{if(i.signal.aborted)return;const h={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(g.code)?g.code:T.InternalError,message:g.message??"Internal error",...g.data!==void 0&&{data:g.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:h,timestamp:Date.now()},r?.sessionId):await r?.send(h)}).catch(g=>this._onerror(new Error(`Failed to send response: ${g}`))).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),u=this._timeoutInfo.get(r);if(u&&i&&u.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),Ie(t))n(t);else{const i=new x(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(Ie(t)&&t.result&&typeof t.result=="object"){const i=t.result;if(i.task&&typeof i.task=="object"){const u=i.task;typeof u.taskId=="string"&&(s=!0,this._taskProgressTokens.set(u.taskId,o))}}if(s||this._progressHandlers.delete(o),Ie(t))r(t);else{const i=x.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 x?i:new x(T.InternalError,String(i))}}return}let s;try{const i=await this.request(t,dt,n);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new x(T.InternalError,"Task creation did not return a task");for(;;){const u=await this.getTask({taskId:s},n);if(yield{type:"taskStatus",task:u},G(u.status)){u.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},o,n)}:u.status==="failed"?yield{type:"error",error:new x(T.InternalError,`Task ${s} failed`)}:u.status==="cancelled"&&(yield{type:"error",error:new x(T.InternalError,`Task ${s} was cancelled`)});return}if(u.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},o,n)};return}const p=u.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(m=>setTimeout(m,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:r,resumptionToken:s,onresumptiontoken:i,task:u,relatedTask:p}=n??{};return new Promise((m,g)=>{const h=S=>{g(S)};if(!this._transport){h(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),u&&this.assertTaskCapability(t.method)}catch(S){h(S);return}n?.signal?.throwIfAborted();const v=this._requestMessageId++,k={...t,jsonrpc:"2.0",id:v};n?.onprogress&&(this._progressHandlers.set(v,n.onprogress),k.params={...t.params,_meta:{...t.params?._meta||{},progressToken:v}}),u&&(k.params={...k.params,task:u}),p&&(k.params={...k.params,_meta:{...k.params?._meta||{},[Y]:p}});const M=S=>{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(S)}},{relatedRequestId:r,resumptionToken:s,onresumptiontoken:i}).catch(Z=>this._onerror(new Error(`Failed to send cancellation: ${Z}`)));const w=S instanceof x?S:new x(T.RequestTimeout,String(S));g(w)};this._responseHandlers.set(v,S=>{if(!n?.signal?.aborted){if(S instanceof Error)return g(S);try{const w=fo(o,S.result);w.success?m(w.data):g(w.error)}catch(w){g(w)}}}),n?.signal?.addEventListener("abort",()=>{M(n?.signal?.reason)});const F=n?.timeout??Ac,se=()=>M(x.fromError(T.RequestTimeout,"Request timed out",{timeout:F}));this._setupTimeout(v,F,n?.maxTotalTimeout,se,n?.resetTimeoutOnProgress??!1);const Q=p?.taskId;if(Q){const S=w=>{const Z=this._responseHandlers.get(v);Z?Z(w):this._onerror(new Error(`Response handler missing for side-channeled request ${v}`))};this._requestResolvers.set(v,S),this._enqueueTaskMessage(Q,{type:"request",message:k,timestamp:Date.now()}).catch(w=>{this._cleanupTimeout(v),g(w)})}else this._transport.send(k,{relatedRequestId:r,resumptionToken:s,onresumptiontoken:i}).catch(S=>{this._cleanupTimeout(v),g(S)})})}async getTask(t,o){return this.request({method:"tasks/get",params:t},mt,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},ba,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 u={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[Y]:o.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:u,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 u={...t,jsonrpc:"2.0"};o?.relatedTask&&(u={...u,params:{...u.params,_meta:{...u.params?._meta||{},[Y]:o.relatedTask}}}),this._transport?.send(u,o).catch(p=>this._onerror(p))});return}let i={...t,jsonrpc:"2.0"};o?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Y]:o.relatedTask}}}),await this._transport.send(i,o)}setRequestHandler(t,o){const n=Vt(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(r,s)=>{const i=Wt(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=Vt(t);this._notificationHandlers.set(n,r=>{const s=Wt(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"&&Bt(r.message)){const s=r.message.id,i=this._requestResolvers.get(s);i?(i(new x(T.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 x(T.InvalidRequest,"Request cancelled"));return}const i=setTimeout(r,n);o.addEventListener("abort",()=>{clearTimeout(i),s(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 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 x(T.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(r,s,i)=>{await n.storeTaskResult(r,s,i,o);const u=await n.getTask(r,o);if(u){const p=Pe.parse({method:"notifications/tasks/status",params:u});await this.notification(p),G(u.status)&&this._cleanupTaskProgressHandler(r)}},getTaskResult:r=>n.getTaskResult(r,o),updateTaskStatus:async(r,s,i)=>{const u=await n.getTask(r,o);if(!u)throw new x(T.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(G(u.status))throw new x(T.InvalidParams,`Cannot update task "${r}" from terminal status "${u.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 m=Pe.parse({method:"notifications/tasks/status",params:p});await this.notification(m),G(p.status)&&this._cleanupTaskProgressHandler(r)}},listTasks:r=>n.listTasks(r,o)}}}var Lc="2026-01-26",Dc="ui/notifications/tool-input-partial";class Ho{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=ta.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!==Dc&&console.debug("Sending message",t),this.eventTarget.postMessage(t,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var Uc=y([a("light"),a("dark")]).describe("Color theme preference for the host environment."),pe=y([a("inline"),a("fullscreen"),a("pip")]).describe("Display mode for UI presentation."),jc=y([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."),Hc=z(jc.describe(`Style variables for theming MCP apps.
|
|
31
|
+
path: iss.path ? [${pe(x)}, ...iss.path] : [${pe(x)}]
|
|
32
|
+
})));`),h.write(`newResult[${pe(x)}] = ${w}.value`)}h.write("payload.value = newResult;"),h.write("return payload;");const te=h.compile();return(x,w)=>te(f,x,w)};let r;const s=Ne,i=!ao.jitless,d=i&&pn.value,m=t.catchall;let g;e._zod.parse=(f,h)=>{g??(g=o.value);const _=f.value;if(!s(_))return f.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),f;const A=[];if(i&&d&&h?.async===!1&&h.jitless!==!0)r||(r=n(t.shape)),f=r(f,h);else{f.value={};const w=g.shape;for(const C of g.keys){const de=w[C],Ie=de._zod.run({value:_[C],issues:[]},h),qt=de._zod.optin==="optional"&&de._zod.optout==="optional";Ie instanceof Promise?A.push(Ie.then(At=>qt?Dt(At,f,C,_):Ee(At,f,C))):qt?Dt(Ie,f,C,_):Ee(Ie,f,C)}}if(!m)return A.length?Promise.all(A).then(()=>f):f;const L=[],G=g.keySet,te=m._zod,x=te.def.type;for(const w of Object.keys(_)){if(G.has(w))continue;if(x==="never"){L.push(w);continue}const C=te.run({value:_[w],issues:[]},h);C instanceof Promise?A.push(C.then(de=>Ee(de,f,w))):Ee(C,f,w)}return L.length&&f.issues.push({code:"unrecognized_keys",keys:L,input:_,inst:e}),A.length?Promise.all(A).then(()=>f):f}});function Lt(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=p("$ZodUnion",(e,t)=>{R.init(e,t),E(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),E(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),E(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),E(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=>ct(n.source)).join("|")})$`)}}),e._zod.parse=(o,n)=>{let r=!1;const s=[];for(const i of t.options){const a=i._zod.run({value:o.value,issues:[]},n);if(a instanceof Promise)s.push(a),r=!0;else{if(a.issues.length===0)return a;s.push(a)}}return r?Promise.all(s).then(i=>Lt(i,o,e,n)):Lt(s,o,e,n)}}),Kr=p("$ZodDiscriminatedUnion",(e,t)=>{So.init(e,t);const o=e._zod.parse;E(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[a,d]of Object.entries(i)){r[a]||(r[a]=new Set);for(const m of d)r[a].add(m)}}return r});const n=it(()=>{const r=t.options,s=new Map;for(const i of r){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 d of a){if(s.has(d))throw new Error(`Duplicate discriminator value "${String(d)}"`);s.set(d,i)}}return s});e._zod.parse=(r,s)=>{const i=r.value;if(!Ne(i))return r.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),r;const a=n.value.get(i?.[t.discriminator]);return a?a._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=p("$ZodIntersection",(e,t)=>{R.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(([d,m])=>Ut(o,d,m)):Ut(o,s,i)}});function tt(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(qe(e)&&qe(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=tt(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=tt(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 Ut(e,t,o){if(t.issues.length&&e.issues.push(...t.issues),o.issues.length&&e.issues.push(...o.issues),me(e))return e;const n=tt(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 Gr=p("$ZodRecord",(e,t)=>{R.init(e,t),e._zod.parse=(o,n)=>{const r=o.value;if(!qe(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 d of i)if(typeof d=="string"||typeof d=="number"||typeof d=="symbol"){const m=t.valueType._zod.run({value:r[d],issues:[]},n);m instanceof Promise?s.push(m.then(g=>{g.issues.length&&o.issues.push(...re(d,g.issues)),o.value[d]=g.value})):(m.issues.length&&o.issues.push(...re(d,m.issues)),o.value[d]=m.value)}let a;for(const d in r)i.has(d)||(a=a??[],a.push(d));a&&a.length>0&&o.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:a})}else{o.value={};for(const i of Reflect.ownKeys(r)){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(m=>ee(m,n,X())),input:i,path:[i],inst:e}),o.value[a.value]=a.value;continue}const d=t.valueType._zod.run({value:r[i],issues:[]},n);d instanceof Promise?s.push(d.then(m=>{m.issues.length&&o.issues.push(...re(i,m.issues)),o.value[a.value]=m.value})):(d.issues.length&&o.issues.push(...re(i,d.issues)),o.value[a.value]=d.value)}}return s.length?Promise.all(s).then(()=>o):o}}),Yr=p("$ZodEnum",(e,t)=>{R.init(e,t);const o=un(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}}),Xr=p("$ZodLiteral",(e,t)=>{R.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}}),es=p("$ZodTransform",(e,t)=>{R.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}}),ts=p("$ZodOptional",(e,t)=>{R.init(e,t),e._zod.optin="optional",e._zod.optout="optional",E(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),E(e._zod,"pattern",()=>{const o=t.innerType._zod.pattern;return o?new RegExp(`^(${ct(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)}),os=p("$ZodNullable",(e,t)=>{R.init(e,t),E(e._zod,"optin",()=>t.innerType._zod.optin),E(e._zod,"optout",()=>t.innerType._zod.optout),E(e._zod,"pattern",()=>{const o=t.innerType._zod.pattern;return o?new RegExp(`^(${ct(o.source)}|null)$`):void 0}),E(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)}),ns=p("$ZodDefault",(e,t)=>{R.init(e,t),e._zod.optin="optional",E(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=>jt(s,t)):jt(r,t)}});function jt(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const rs=p("$ZodPrefault",(e,t)=>{R.init(e,t),e._zod.optin="optional",E(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))}),ss=p("$ZodNonOptional",(e,t)=>{R.init(e,t),E(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=>Ht(s,e)):Ht(r,e)}});function Ht(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 is=p("$ZodCatch",(e,t)=>{R.init(e,t),e._zod.optin="optional",E(e._zod,"optout",()=>t.innerType._zod.optout),E(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)}}),as=p("$ZodPipe",(e,t)=>{R.init(e,t),E(e._zod,"values",()=>t.in._zod.values),E(e._zod,"optin",()=>t.in._zod.optin),E(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=>Ft(s,t,n)):Ft(r,t,n)}});function Ft(e,t,o){return me(e)?e:t.out._zod.run({value:e.value,issues:e.issues},o)}const cs=p("$ZodReadonly",(e,t)=>{R.init(e,t),E(e._zod,"propValues",()=>t.innerType._zod.propValues),E(e._zod,"values",()=>t.innerType._zod.values),E(e._zod,"optin",()=>t.innerType._zod.optin),E(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(Bt):Bt(r)}});function Bt(e){return e.value=Object.freeze(e.value),e}const us=p("$ZodCustom",(e,t)=>{H.init(e,t),R.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=>Vt(s,o,n,e));Vt(r,o,n,e)}});function Vt(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(fe(r))}}class ls{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 ds(){return new ls}const Ce=ds();function ps(e,t){return new e({type:"string",...v(t)})}function ms(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...v(t)})}function Wt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...v(t)})}function hs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...v(t)})}function fs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...v(t)})}function gs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...v(t)})}function vs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...v(t)})}function _s(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...v(t)})}function bs(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...v(t)})}function ys(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...v(t)})}function ks(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...v(t)})}function ws(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...v(t)})}function xs(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...v(t)})}function Ss(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...v(t)})}function Ts(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...v(t)})}function zs(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...v(t)})}function $s(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...v(t)})}function Is(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...v(t)})}function Rs(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...v(t)})}function Es(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...v(t)})}function Cs(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...v(t)})}function Ps(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...v(t)})}function Zs(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...v(t)})}function Ns(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...v(t)})}function qs(e,t){return new e({type:"string",format:"date",check:"string_format",...v(t)})}function As(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...v(t)})}function Ms(e,t){return new e({type:"string",format:"duration",check:"string_format",...v(t)})}function Os(e,t){return new e({type:"number",checks:[],...v(t)})}function Ds(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...v(t)})}function Ls(e,t){return new e({type:"boolean",...v(t)})}function Us(e,t){return new e({type:"undefined",...v(t)})}function js(e,t){return new e({type:"null",...v(t)})}function Hs(e){return new e({type:"unknown"})}function Fs(e,t){return new e({type:"never",...v(t)})}function Jt(e,t){return new yo({check:"less_than",...v(t),value:e,inclusive:!1})}function Ge(e,t){return new yo({check:"less_than",...v(t),value:e,inclusive:!0})}function Kt(e,t){return new ko({check:"greater_than",...v(t),value:e,inclusive:!1})}function Ye(e,t){return new ko({check:"greater_than",...v(t),value:e,inclusive:!0})}function Qt(e,t){return new or({check:"multiple_of",...v(t),value:e})}function To(e,t){return new rr({check:"max_length",...v(t),maximum:e})}function Ae(e,t){return new sr({check:"min_length",...v(t),minimum:e})}function zo(e,t){return new ir({check:"length_equals",...v(t),length:e})}function Bs(e,t){return new ar({check:"string_format",format:"regex",...v(t),pattern:e})}function Vs(e){return new cr({check:"string_format",format:"lowercase",...v(e)})}function Ws(e){return new ur({check:"string_format",format:"uppercase",...v(e)})}function Js(e,t){return new lr({check:"string_format",format:"includes",...v(t),includes:e})}function Ks(e,t){return new dr({check:"string_format",format:"starts_with",...v(t),prefix:e})}function Qs(e,t){return new pr({check:"string_format",format:"ends_with",...v(t),suffix:e})}function be(e){return new mr({check:"overwrite",tx:e})}function Gs(e){return be(t=>t.normalize(e))}function Ys(){return be(e=>e.trim())}function Xs(){return be(e=>e.toLowerCase())}function ei(){return be(e=>e.toUpperCase())}function ti(e,t,o){return new e({type:"array",element:t,...v(o)})}function oi(e,t,o){const n=v(o);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function ni(e,t,o){return new e({type:"custom",check:"custom",fn:t,...v(o)})}function dt(e){return!!e._zod}function $o(e,t){return dt(e)?ho(e,t):e.safeParse(t)}function ri(e){if(!e)return;let t;if(dt(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function si(e){if(dt(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 ii=p("ZodISODateTime",(e,t)=>{$r.init(e,t),N.init(e,t)});function Io(e){return Ns(ii,e)}const ai=p("ZodISODate",(e,t)=>{Ir.init(e,t),N.init(e,t)});function ci(e){return qs(ai,e)}const ui=p("ZodISOTime",(e,t)=>{Rr.init(e,t),N.init(e,t)});function li(e){return As(ui,e)}const di=p("ZodISODuration",(e,t)=>{Er.init(e,t),N.init(e,t)});function pi(e){return Ms(di,e)}const mi=(e,t)=>{lo.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:o=>xn(e,o)},flatten:{value:o=>wn(e,o)},addIssue:{value:o=>e.issues.push(o)},addIssues:{value:o=>e.issues.push(...o)},isEmpty:{get(){return e.issues.length===0}}})},Be=p("ZodError",mi,{Parent:Error}),hi=Sn(Be),fi=Tn(Be),gi=mo(Be),vi=fo(Be),Z=p("ZodType",(e,t)=>(R.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)=>ae(e,o,n),e.brand=()=>e,e.register=((o,n)=>(o.add(e,n),e)),e.parse=(o,n)=>hi(e,o,n,{callee:e.parse}),e.safeParse=(o,n)=>gi(e,o,n),e.parseAsync=async(o,n)=>fi(e,o,n,{callee:e.parseAsync}),e.safeParseAsync=async(o,n)=>vi(e,o,n),e.spa=e.safeParseAsync,e.refine=(o,n)=>e.check(ca(o,n)),e.superRefine=o=>e.check(ua(o)),e.overwrite=o=>e.check(be(o)),e.optional=()=>q(e),e.nullable=()=>Xt(e),e.nullish=()=>q(Xt(e)),e.nonoptional=o=>ea(e,o),e.array=()=>b(e),e.or=o=>k([e,o]),e.and=o=>pt(e,o),e.transform=o=>rt(e,qo(o)),e.default=o=>Gi(e,o),e.prefault=o=>Xi(e,o),e.catch=o=>oa(e,o),e.pipe=o=>rt(e,o),e.readonly=()=>sa(e),e.describe=o=>{const n=e.clone();return Ce.add(n,{description:o}),n},Object.defineProperty(e,"description",{get(){return Ce.get(e)?.description},configurable:!0}),e.meta=(...o)=>{if(o.length===0)return Ce.get(e);const n=e.clone();return Ce.add(n,o[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Ro=p("_ZodString",(e,t)=>{lt.init(e,t),Z.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(Bs(...n)),e.includes=(...n)=>e.check(Js(...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(Vs(n)),e.uppercase=n=>e.check(Ws(n)),e.trim=()=>e.check(Ys()),e.normalize=(...n)=>e.check(Gs(...n)),e.toLowerCase=()=>e.check(Xs()),e.toUpperCase=()=>e.check(ei())}),_i=p("ZodString",(e,t)=>{lt.init(e,t),Ro.init(e,t),e.email=o=>e.check(ms(bi,o)),e.url=o=>e.check(_s(yi,o)),e.jwt=o=>e.check(Zs(qi,o)),e.emoji=o=>e.check(bs(ki,o)),e.guid=o=>e.check(Wt(Gt,o)),e.uuid=o=>e.check(hs(Pe,o)),e.uuidv4=o=>e.check(fs(Pe,o)),e.uuidv6=o=>e.check(gs(Pe,o)),e.uuidv7=o=>e.check(vs(Pe,o)),e.nanoid=o=>e.check(ys(wi,o)),e.guid=o=>e.check(Wt(Gt,o)),e.cuid=o=>e.check(ks(xi,o)),e.cuid2=o=>e.check(ws(Si,o)),e.ulid=o=>e.check(xs(Ti,o)),e.base64=o=>e.check(Es(Pi,o)),e.base64url=o=>e.check(Cs(Zi,o)),e.xid=o=>e.check(Ss(zi,o)),e.ksuid=o=>e.check(Ts($i,o)),e.ipv4=o=>e.check(zs(Ii,o)),e.ipv6=o=>e.check($s(Ri,o)),e.cidrv4=o=>e.check(Is(Ei,o)),e.cidrv6=o=>e.check(Rs(Ci,o)),e.e164=o=>e.check(Ps(Ni,o)),e.datetime=o=>e.check(Io(o)),e.date=o=>e.check(ci(o)),e.time=o=>e.check(li(o)),e.duration=o=>e.check(pi(o))});function u(e){return ps(_i,e)}const N=p("ZodStringFormat",(e,t)=>{P.init(e,t),Ro.init(e,t)}),bi=p("ZodEmail",(e,t)=>{_r.init(e,t),N.init(e,t)}),Gt=p("ZodGUID",(e,t)=>{gr.init(e,t),N.init(e,t)}),Pe=p("ZodUUID",(e,t)=>{vr.init(e,t),N.init(e,t)}),yi=p("ZodURL",(e,t)=>{br.init(e,t),N.init(e,t)}),ki=p("ZodEmoji",(e,t)=>{yr.init(e,t),N.init(e,t)}),wi=p("ZodNanoID",(e,t)=>{kr.init(e,t),N.init(e,t)}),xi=p("ZodCUID",(e,t)=>{wr.init(e,t),N.init(e,t)}),Si=p("ZodCUID2",(e,t)=>{xr.init(e,t),N.init(e,t)}),Ti=p("ZodULID",(e,t)=>{Sr.init(e,t),N.init(e,t)}),zi=p("ZodXID",(e,t)=>{Tr.init(e,t),N.init(e,t)}),$i=p("ZodKSUID",(e,t)=>{zr.init(e,t),N.init(e,t)}),Ii=p("ZodIPv4",(e,t)=>{Cr.init(e,t),N.init(e,t)}),Ri=p("ZodIPv6",(e,t)=>{Pr.init(e,t),N.init(e,t)}),Ei=p("ZodCIDRv4",(e,t)=>{Zr.init(e,t),N.init(e,t)}),Ci=p("ZodCIDRv6",(e,t)=>{Nr.init(e,t),N.init(e,t)}),Pi=p("ZodBase64",(e,t)=>{qr.init(e,t),N.init(e,t)}),Zi=p("ZodBase64URL",(e,t)=>{Mr.init(e,t),N.init(e,t)}),Ni=p("ZodE164",(e,t)=>{Or.init(e,t),N.init(e,t)}),qi=p("ZodJWT",(e,t)=>{Lr.init(e,t),N.init(e,t)}),Eo=p("ZodNumber",(e,t)=>{xo.init(e,t),Z.init(e,t),e.gt=(n,r)=>e.check(Kt(n,r)),e.gte=(n,r)=>e.check(Ye(n,r)),e.min=(n,r)=>e.check(Ye(n,r)),e.lt=(n,r)=>e.check(Jt(n,r)),e.lte=(n,r)=>e.check(Ge(n,r)),e.max=(n,r)=>e.check(Ge(n,r)),e.int=n=>e.check(Yt(n)),e.safe=n=>e.check(Yt(n)),e.positive=n=>e.check(Kt(0,n)),e.nonnegative=n=>e.check(Ye(0,n)),e.negative=n=>e.check(Jt(0,n)),e.nonpositive=n=>e.check(Ge(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 y(e){return Os(Eo,e)}const Ai=p("ZodNumberFormat",(e,t)=>{Ur.init(e,t),Eo.init(e,t)});function Yt(e){return Ds(Ai,e)}const Mi=p("ZodBoolean",(e,t)=>{jr.init(e,t),Z.init(e,t)});function I(e){return Ls(Mi,e)}const Oi=p("ZodUndefined",(e,t)=>{Hr.init(e,t),Z.init(e,t)});function ot(e){return Us(Oi,e)}const Di=p("ZodNull",(e,t)=>{Fr.init(e,t),Z.init(e,t)});function Co(e){return js(Di,e)}const Li=p("ZodUnknown",(e,t)=>{Br.init(e,t),Z.init(e,t)});function $(){return Hs(Li)}const Ui=p("ZodNever",(e,t)=>{Vr.init(e,t),Z.init(e,t)});function ji(e){return Fs(Ui,e)}const Hi=p("ZodArray",(e,t)=>{Wr.init(e,t),Z.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 b(e,t){return ti(Hi,e,t)}const Po=p("ZodObject",(e,t)=>{Jr.init(e,t),Z.init(e,t),E(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:$()}),e.loose=()=>e.clone({...e._zod.def,catchall:$()}),e.strict=()=>e.clone({...e._zod.def,catchall:ji()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=o=>_n(e,o),e.merge=o=>bn(e,o),e.pick=o=>gn(e,o),e.omit=o=>vn(e,o),e.partial=(...o)=>yn(Ao,e,o[0]),e.required=(...o)=>kn(Mo,e,o[0])});function l(e,t){const o={type:"object",get shape(){return He(this,"shape",{...e}),this.shape},...v(t)};return new Po(o)}function j(e,t){return new Po({type:"object",get shape(){return He(this,"shape",{...e}),this.shape},catchall:$(),...v(t)})}const Zo=p("ZodUnion",(e,t)=>{So.init(e,t),Z.init(e,t),e.options=t.options});function k(e,t){return new Zo({type:"union",options:e,...v(t)})}const Fi=p("ZodDiscriminatedUnion",(e,t)=>{Zo.init(e,t),Kr.init(e,t)});function No(e,t,o){return new Fi({type:"union",options:t,discriminator:e,...v(o)})}const Bi=p("ZodIntersection",(e,t)=>{Qr.init(e,t),Z.init(e,t)});function pt(e,t){return new Bi({type:"intersection",left:e,right:t})}const Vi=p("ZodRecord",(e,t)=>{Gr.init(e,t),Z.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function z(e,t,o){return new Vi({type:"record",keyType:e,valueType:t,...v(o)})}const nt=p("ZodEnum",(e,t)=>{Yr.init(e,t),Z.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 nt({...t,checks:[],...v(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 nt({...t,checks:[],...v(r),entries:s})}});function F(e,t){const o=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new nt({type:"enum",entries:o,...v(t)})}const Wi=p("ZodLiteral",(e,t)=>{Xr.init(e,t),Z.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 Wi({type:"literal",values:Array.isArray(e)?e:[e],...v(t)})}const Ji=p("ZodTransform",(e,t)=>{es.init(e,t),Z.init(e,t),e._zod.parse=(o,n)=>{o.addIssue=s=>{if(typeof s=="string")o.issues.push(fe(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(fe(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 Ji({type:"transform",transform:e})}const Ao=p("ZodOptional",(e,t)=>{ts.init(e,t),Z.init(e,t),e.unwrap=()=>e._zod.def.innerType});function q(e){return new Ao({type:"optional",innerType:e})}const Ki=p("ZodNullable",(e,t)=>{os.init(e,t),Z.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Xt(e){return new Ki({type:"nullable",innerType:e})}const Qi=p("ZodDefault",(e,t)=>{ns.init(e,t),Z.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Gi(e,t){return new Qi({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const Yi=p("ZodPrefault",(e,t)=>{rs.init(e,t),Z.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Xi(e,t){return new Yi({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const Mo=p("ZodNonOptional",(e,t)=>{ss.init(e,t),Z.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ea(e,t){return new Mo({type:"nonoptional",innerType:e,...v(t)})}const ta=p("ZodCatch",(e,t)=>{is.init(e,t),Z.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function oa(e,t){return new ta({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const na=p("ZodPipe",(e,t)=>{as.init(e,t),Z.init(e,t),e.in=t.in,e.out=t.out});function rt(e,t){return new na({type:"pipe",in:e,out:t})}const ra=p("ZodReadonly",(e,t)=>{cs.init(e,t),Z.init(e,t)});function sa(e){return new ra({type:"readonly",innerType:e})}const Oo=p("ZodCustom",(e,t)=>{us.init(e,t),Z.init(e,t)});function ia(e){const t=new H({check:"custom"});return t._zod.check=e,t}function aa(e,t){return oi(Oo,e??(()=>!0),t)}function ca(e,t={}){return ni(Oo,e,t)}function ua(e){const t=ia(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(fe(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(fe(r))}},e(o.value,o)));return t}function Do(e,t){return rt(qo(e),t)}const ne="io.modelcontextprotocol/related-task",Ve="2.0",M=aa(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Lo=k([u(),y().int()]),Uo=u();j({ttl:k([y(),Co()]).optional(),pollInterval:y().optional()});const la=l({ttl:y().optional()}),da=l({taskId:u()}),mt=j({progressToken:Lo.optional(),[ne]:da.optional()}),B=l({_meta:mt.optional()}),ye=B.extend({task:la.optional()}),pa=e=>ye.safeParse(e).success,O=l({method:u(),params:B.loose().optional()}),W=l({_meta:mt.optional()}),J=l({method:u(),params:W.loose().optional()}),D=j({_meta:mt.optional()}),ke=k([u(),y().int()]),jo=l({jsonrpc:c(Ve),id:ke,...O.shape}).strict(),eo=e=>jo.safeParse(e).success,Ho=l({jsonrpc:c(Ve),...J.shape}).strict(),ma=e=>Ho.safeParse(e).success,ht=l({jsonrpc:c(Ve),id:ke,result:D}).strict(),Ze=e=>ht.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 ft=l({jsonrpc:c(Ve),id:ke.optional(),error:l({code:y().int(),message:u(),data:$().optional()})}).strict(),ha=e=>ft.safeParse(e).success,fa=k([jo,Ho,ht,ft]);k([ht,ft]);const gt=D.strict(),ga=W.extend({requestId:ke.optional(),reason:u().optional()}),vt=J.extend({method:c("notifications/cancelled"),params:ga}),va=l({src:u(),mimeType:u().optional(),sizes:b(u()).optional(),theme:F(["light","dark"]).optional()}),we=l({icons:b(va).optional()}),ce=l({name:u(),title:u().optional()}),We=ce.extend({...ce.shape,...we.shape,version:u(),websiteUrl:u().optional(),description:u().optional()}),_a=pt(l({applyDefaults:I().optional()}),z(u(),$())),ba=Do(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,pt(l({form:_a.optional(),url:M.optional()}),z(u(),$()).optional())),ya=j({list:M.optional(),cancel:M.optional(),requests:j({sampling:j({createMessage:M.optional()}).optional(),elicitation:j({create:M.optional()}).optional()}).optional()}),ka=j({list:M.optional(),cancel:M.optional(),requests:j({tools:j({call:M.optional()}).optional()}).optional()}),wa=l({experimental:z(u(),M).optional(),sampling:l({context:M.optional(),tools:M.optional()}).optional(),elicitation:ba.optional(),roots:l({listChanged:I().optional()}).optional(),tasks:ya.optional()}),xa=B.extend({protocolVersion:u(),capabilities:wa,clientInfo:We}),Sa=O.extend({method:c("initialize"),params:xa}),Ta=l({experimental:z(u(),M).optional(),logging:M.optional(),completions:M.optional(),prompts:l({listChanged:I().optional()}).optional(),resources:l({subscribe:I().optional(),listChanged:I().optional()}).optional(),tools:l({listChanged:I().optional()}).optional(),tasks:ka.optional()}),za=D.extend({protocolVersion:u(),capabilities:Ta,serverInfo:We,instructions:u().optional()}),$a=J.extend({method:c("notifications/initialized"),params:W.optional()}),Je=O.extend({method:c("ping"),params:B.optional()}),Ia=l({progress:y(),total:q(y()),message:q(u())}),Ra=l({...W.shape,...Ia.shape,progressToken:Lo}),_t=J.extend({method:c("notifications/progress"),params:Ra}),Ea=B.extend({cursor:Uo.optional()}),xe=O.extend({params:Ea.optional()}),Se=D.extend({nextCursor:Uo.optional()}),Ca=F(["working","input_required","completed","failed","cancelled"]),Te=l({taskId:u(),status:Ca,ttl:k([y(),Co()]),createdAt:u(),lastUpdatedAt:u(),pollInterval:q(y()),statusMessage:q(u())}),bt=D.extend({task:Te}),Pa=W.merge(Te),Me=J.extend({method:c("notifications/tasks/status"),params:Pa}),yt=O.extend({method:c("tasks/get"),params:B.extend({taskId:u()})}),kt=D.merge(Te),wt=O.extend({method:c("tasks/result"),params:B.extend({taskId:u()})});D.loose();const xt=xe.extend({method:c("tasks/list")}),St=Se.extend({tasks:b(Te)}),Tt=O.extend({method:c("tasks/cancel"),params:B.extend({taskId:u()})}),Za=D.merge(Te),Fo=l({uri:u(),mimeType:q(u()),_meta:z(u(),$()).optional()}),Bo=Fo.extend({text:u()}),zt=u().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Vo=Fo.extend({blob:zt}),ze=F(["user","assistant"]),le=l({audience:b(ze).optional(),priority:y().min(0).max(1).optional(),lastModified:Io({offset:!0}).optional()}),Wo=l({...ce.shape,...we.shape,uri:u(),description:q(u()),mimeType:q(u()),annotations:le.optional(),_meta:q(j({}))}),Na=l({...ce.shape,...we.shape,uriTemplate:u(),description:q(u()),mimeType:q(u()),annotations:le.optional(),_meta:q(j({}))}),qa=xe.extend({method:c("resources/list")}),Jo=Se.extend({resources:b(Wo)}),Aa=xe.extend({method:c("resources/templates/list")}),Ma=Se.extend({resourceTemplates:b(Na)}),$t=B.extend({uri:u()}),Oa=$t,Da=O.extend({method:c("resources/read"),params:Oa}),Ko=D.extend({contents:b(k([Bo,Vo]))}),La=J.extend({method:c("notifications/resources/list_changed"),params:W.optional()}),Ua=$t,ja=O.extend({method:c("resources/subscribe"),params:Ua}),Ha=$t,Fa=O.extend({method:c("resources/unsubscribe"),params:Ha}),Ba=W.extend({uri:u()}),Va=J.extend({method:c("notifications/resources/updated"),params:Ba}),Wa=l({name:u(),description:q(u()),required:q(I())}),Ja=l({...ce.shape,...we.shape,description:q(u()),arguments:q(b(Wa)),_meta:q(j({}))}),Ka=xe.extend({method:c("prompts/list")}),Qa=Se.extend({prompts:b(Ja)}),Ga=B.extend({name:u(),arguments:z(u(),u()).optional()}),Ya=O.extend({method:c("prompts/get"),params:Ga}),It=l({type:c("text"),text:u(),annotations:le.optional(),_meta:z(u(),$()).optional()}),Rt=l({type:c("image"),data:zt,mimeType:u(),annotations:le.optional(),_meta:z(u(),$()).optional()}),Et=l({type:c("audio"),data:zt,mimeType:u(),annotations:le.optional(),_meta:z(u(),$()).optional()}),Xa=l({type:c("tool_use"),name:u(),id:u(),input:z(u(),$()),_meta:z(u(),$()).optional()}),Qo=l({type:c("resource"),resource:k([Bo,Vo]),annotations:le.optional(),_meta:z(u(),$()).optional()}),Go=Wo.extend({type:c("resource_link")}),$e=k([It,Rt,Et,Go,Qo]),ec=l({role:ze,content:$e}),tc=D.extend({description:u().optional(),messages:b(ec)}),oc=J.extend({method:c("notifications/prompts/list_changed"),params:W.optional()}),nc=l({title:u().optional(),readOnlyHint:I().optional(),destructiveHint:I().optional(),idempotentHint:I().optional(),openWorldHint:I().optional()}),rc=l({taskSupport:F(["required","optional","forbidden"]).optional()}),Ct=l({...ce.shape,...we.shape,description:u().optional(),inputSchema:l({type:c("object"),properties:z(u(),M).optional(),required:b(u()).optional()}).catchall($()),outputSchema:l({type:c("object"),properties:z(u(),M).optional(),required:b(u()).optional()}).catchall($()).optional(),annotations:nc.optional(),execution:rc.optional(),_meta:z(u(),$()).optional()}),Yo=xe.extend({method:c("tools/list")}),sc=Se.extend({tools:b(Ct)}),Ke=D.extend({content:b($e).default([]),structuredContent:z(u(),$()).optional(),isError:I().optional()});Ke.or(D.extend({toolResult:$()}));const ic=ye.extend({name:u(),arguments:z(u(),$()).optional()}),Xo=O.extend({method:c("tools/call"),params:ic}),ac=J.extend({method:c("notifications/tools/list_changed"),params:W.optional()});l({autoRefresh:I().default(!0),debounceMs:y().int().nonnegative().default(300)});const en=F(["debug","info","notice","warning","error","critical","alert","emergency"]),cc=B.extend({level:en}),uc=O.extend({method:c("logging/setLevel"),params:cc}),lc=W.extend({level:en,logger:u().optional(),data:$()}),dc=J.extend({method:c("notifications/message"),params:lc}),pc=l({name:u().optional()}),mc=l({hints:b(pc).optional(),costPriority:y().min(0).max(1).optional(),speedPriority:y().min(0).max(1).optional(),intelligencePriority:y().min(0).max(1).optional()}),hc=l({mode:F(["auto","required","none"]).optional()}),fc=l({type:c("tool_result"),toolUseId:u().describe("The unique identifier for the corresponding tool call."),content:b($e).default([]),structuredContent:l({}).loose().optional(),isError:I().optional(),_meta:z(u(),$()).optional()}),gc=No("type",[It,Rt,Et]),Oe=No("type",[It,Rt,Et,Xa,fc]),vc=l({role:ze,content:k([Oe,b(Oe)]),_meta:z(u(),$()).optional()}),_c=ye.extend({messages:b(vc),modelPreferences:mc.optional(),systemPrompt:u().optional(),includeContext:F(["none","thisServer","allServers"]).optional(),temperature:y().optional(),maxTokens:y().int(),stopSequences:b(u()).optional(),metadata:M.optional(),tools:b(Ct).optional(),toolChoice:hc.optional()}),bc=O.extend({method:c("sampling/createMessage"),params:_c}),yc=D.extend({model:u(),stopReason:q(F(["endTurn","stopSequence","maxTokens"]).or(u())),role:ze,content:gc}),kc=D.extend({model:u(),stopReason:q(F(["endTurn","stopSequence","maxTokens","toolUse"]).or(u())),role:ze,content:k([Oe,b(Oe)])}),wc=l({type:c("boolean"),title:u().optional(),description:u().optional(),default:I().optional()}),xc=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()}),Sc=l({type:F(["number","integer"]),title:u().optional(),description:u().optional(),minimum:y().optional(),maximum:y().optional(),default:y().optional()}),Tc=l({type:c("string"),title:u().optional(),description:u().optional(),enum:b(u()),default:u().optional()}),zc=l({type:c("string"),title:u().optional(),description:u().optional(),oneOf:b(l({const:u(),title:u()})),default:u().optional()}),$c=l({type:c("string"),title:u().optional(),description:u().optional(),enum:b(u()),enumNames:b(u()).optional(),default:u().optional()}),Ic=k([Tc,zc]),Rc=l({type:c("array"),title:u().optional(),description:u().optional(),minItems:y().optional(),maxItems:y().optional(),items:l({type:c("string"),enum:b(u())}),default:b(u()).optional()}),Ec=l({type:c("array"),title:u().optional(),description:u().optional(),minItems:y().optional(),maxItems:y().optional(),items:l({anyOf:b(l({const:u(),title:u()}))}),default:b(u()).optional()}),Cc=k([Rc,Ec]),Pc=k([$c,Ic,Cc]),Zc=k([Pc,wc,xc,Sc]),Nc=ye.extend({mode:c("form").optional(),message:u(),requestedSchema:l({type:c("object"),properties:z(u(),Zc),required:b(u()).optional()})}),qc=ye.extend({mode:c("url"),message:u(),elicitationId:u(),url:u().url()}),Ac=k([Nc,qc]),Mc=O.extend({method:c("elicitation/create"),params:Ac}),Oc=W.extend({elicitationId:u()}),Dc=J.extend({method:c("notifications/elicitation/complete"),params:Oc}),Lc=D.extend({action:F(["accept","decline","cancel"]),content:Do(e=>e===null?void 0:e,z(u(),k([u(),y(),I(),b(u())])).optional())}),Uc=l({type:c("ref/resource"),uri:u()}),jc=l({type:c("ref/prompt"),name:u()}),Hc=B.extend({ref:k([jc,Uc]),argument:l({name:u(),value:u()}),context:l({arguments:z(u(),u()).optional()}).optional()}),Fc=O.extend({method:c("completion/complete"),params:Hc}),Bc=D.extend({completion:j({values:b(u()).max(100),total:q(y().int()),hasMore:q(I())})}),Vc=l({uri:u().startsWith("file://"),name:u().optional(),_meta:z(u(),$()).optional()}),Wc=O.extend({method:c("roots/list"),params:B.optional()}),Jc=D.extend({roots:b(Vc)}),Kc=J.extend({method:c("notifications/roots/list_changed"),params:W.optional()});k([Je,Sa,Fc,uc,Ya,Ka,qa,Aa,Da,ja,Fa,Xo,Yo,yt,wt,xt,Tt]);k([vt,_t,$a,Kc,Me]);k([gt,yc,kc,Lc,Jc,kt,St,bt]);k([Je,bc,Mc,Wc,yt,wt,xt,Tt]);k([vt,_t,dc,Va,La,ac,oc,Me,Dc]);k([gt,za,Bc,tc,Qa,Jo,Ma,Ko,Ke,sc,kt,St,bt]);class S 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 r=n;if(r.elicitations)return new Qc(r.elicitations,o)}return new S(t,o,n)}}class Qc extends S{constructor(t,o=`URL elicitation${t.length>1?"s":""} required`){super(T.UrlElicitationRequired,o,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}}function oe(e){return e==="completed"||e==="failed"||e==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function to(e){const o=ri(e)?.method;if(!o)throw new Error("Schema is missing a method literal");const n=si(o);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function oo(e,t){const o=$o(e,t);if(!o.success)throw o.error;return o.data}const Gc=6e4;class Yc{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(vt,o=>{this._oncancel(o)}),this.setNotificationHandler(_t,o=>{this._onprogress(o)}),this.setRequestHandler(Je,o=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(yt,async(o,n)=>{const r=await this._taskStore.getTask(o.params.taskId,n.sessionId);if(!r)throw new S(T.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 a;for(;a=await this._taskMessageQueue.dequeue(s,n.sessionId);){if(a.type==="response"||a.type==="error"){const d=a.message,m=d.id,g=this._requestResolvers.get(m);if(g)if(this._requestResolvers.delete(m),a.type==="response")g(d);else{const f=d,h=new S(f.error.code,f.error.message,f.error.data);g(h)}else{const f=a.type==="response"?"Response":"Error";this._onerror(new Error(`${f} handler missing for request ${m}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}const i=await this._taskStore.getTask(s,n.sessionId);if(!i)throw new S(T.InvalidParams,`Task not found: ${s}`);if(!oe(i.status))return await this._waitForTaskUpdate(s,n.signal),await r();if(oe(i.status)){const a=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[ne]:{taskId:s}}}}return await r()};return await r()}),this.setRequestHandler(xt,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 S(T.InvalidParams,`Failed to list tasks: ${r instanceof Error?r.message:String(r)}`)}}),this.setRequestHandler(Tt,async(o,n)=>{try{const r=await this._taskStore.getTask(o.params.taskId,n.sessionId);if(!r)throw new S(T.InvalidParams,`Task not found: ${o.params.taskId}`);if(oe(r.status))throw new S(T.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 S(T.InvalidParams,`Task not found after cancellation: ${o.params.taskId}`);return{_meta:{},...s}}catch(r){throw r instanceof S?r:new S(T.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),S.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=s=>{n?.(s),this._onerror(s)};const r=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{r?.(s,i),Ze(s)||ha(s)?this._onresponse(s):eo(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=S.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,r=this._transport,s=t.params?._meta?.[ne]?.taskId;if(n===void 0){const g={jsonrpc:"2.0",id:t.id,error:{code:T.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:g,timestamp:Date.now()},r?.sessionId).catch(f=>this._onerror(new Error(`Failed to enqueue error response: ${f}`))):r?.send(g).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 a=pa(t.params)?t.params.task:void 0,d=this._taskStore?this.requestTaskStore(t,r?.sessionId):void 0,m={signal:i.signal,sessionId:r?.sessionId,_meta:t.params?._meta,sendNotification:async g=>{if(i.signal.aborted)return;const f={relatedRequestId:t.id};s&&(f.relatedTask={taskId:s}),await this.notification(g,f)},sendRequest:async(g,f,h)=>{if(i.signal.aborted)throw new S(T.ConnectionClosed,"Request was cancelled");const _={...h,relatedRequestId:t.id};s&&!_.relatedTask&&(_.relatedTask={taskId:s});const A=_.relatedTask?.taskId??s;return A&&d&&await d.updateTaskStatus(A,"input_required"),await this.request(g,f,_)},authInfo:o?.authInfo,requestId:t.id,requestInfo:o?.requestInfo,taskId:s,taskStore:d,taskRequestedTtl:a?.ttl,closeSSEStream:o?.closeSSEStream,closeStandaloneSSEStream:o?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,m)).then(async g=>{if(i.signal.aborted)return;const f={result:g,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 g=>{if(i.signal.aborted)return;const f={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(g.code)?g.code:T.InternalError,message:g.message??"Internal error",...g.data!==void 0&&{data:g.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:f,timestamp:Date.now()},r?.sessionId):await r?.send(f)}).catch(g=>this._onerror(new Error(`Failed to send response: ${g}`))).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),a=this._timeoutInfo.get(r);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(d){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),i(d);return}s(n)}_onresponse(t){const o=Number(t.id),n=this._requestResolvers.get(o);if(n){if(this._requestResolvers.delete(o),Ze(t))n(t);else{const i=new S(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(Ze(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"&&(s=!0,this._taskProgressTokens.set(a.taskId,o))}}if(s||this._progressHandlers.delete(o),Ze(t))r(t);else{const i=S.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 S?i:new S(T.InternalError,String(i))}}return}let s;try{const i=await this.request(t,bt,n);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new S(T.InternalError,"Task creation did not return a task");for(;;){const a=await this.getTask({taskId:s},n);if(yield{type:"taskStatus",task:a},oe(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},o,n)}:a.status==="failed"?yield{type:"error",error:new S(T.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new S(T.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},o,n)};return}const d=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(m=>setTimeout(m,d)),n?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof S?i:new S(T.InternalError,String(i))}}}request(t,o,n){const{relatedRequestId:r,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:d}=n??{};return new Promise((m,g)=>{const f=x=>{g(x)};if(!this._transport){f(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(x){f(x);return}n?.signal?.throwIfAborted();const h=this._requestMessageId++,_={...t,jsonrpc:"2.0",id:h};n?.onprogress&&(this._progressHandlers.set(h,n.onprogress),_.params={...t.params,_meta:{...t.params?._meta||{},progressToken:h}}),a&&(_.params={..._.params,task:a}),d&&(_.params={..._.params,_meta:{..._.params?._meta||{},[ne]:d}});const A=x=>{this._responseHandlers.delete(h),this._progressHandlers.delete(h),this._cleanupTimeout(h),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:h,reason:String(x)}},{relatedRequestId:r,resumptionToken:s,onresumptiontoken:i}).catch(C=>this._onerror(new Error(`Failed to send cancellation: ${C}`)));const w=x instanceof S?x:new S(T.RequestTimeout,String(x));g(w)};this._responseHandlers.set(h,x=>{if(!n?.signal?.aborted){if(x instanceof Error)return g(x);try{const w=$o(o,x.result);w.success?m(w.data):g(w.error)}catch(w){g(w)}}}),n?.signal?.addEventListener("abort",()=>{A(n?.signal?.reason)});const L=n?.timeout??Gc,G=()=>A(S.fromError(T.RequestTimeout,"Request timed out",{timeout:L}));this._setupTimeout(h,L,n?.maxTotalTimeout,G,n?.resetTimeoutOnProgress??!1);const te=d?.taskId;if(te){const x=w=>{const C=this._responseHandlers.get(h);C?C(w):this._onerror(new Error(`Response handler missing for side-channeled request ${h}`))};this._requestResolvers.set(h,x),this._enqueueTaskMessage(te,{type:"request",message:_,timestamp:Date.now()}).catch(w=>{this._cleanupTimeout(h),g(w)})}else this._transport.send(_,{relatedRequestId:r,resumptionToken:s,onresumptiontoken:i}).catch(x=>{this._cleanupTimeout(h),g(x)})})}async getTask(t,o){return this.request({method:"tasks/get",params:t},kt,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},St,o)}async cancelTask(t,o){return this.request({method:"tasks/cancel",params:t},Za,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||{},[ne]: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||{},[ne]:o.relatedTask}}}),this._transport?.send(a,o).catch(d=>this._onerror(d))});return}let i={...t,jsonrpc:"2.0"};o?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[ne]:o.relatedTask}}}),await this._transport.send(i,o)}setRequestHandler(t,o){const n=to(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(r,s)=>{const i=oo(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=to(t);this._notificationHandlers.set(n,r=>{const s=oo(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"&&eo(r.message)){const s=r.message.id,i=this._requestResolvers.get(s);i?(i(new S(T.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 S(T.InvalidRequest,"Request cancelled"));return}const i=setTimeout(r,n);o.addEventListener("abort",()=>{clearTimeout(i),s(new S(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 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 S(T.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(r,s,i)=>{await n.storeTaskResult(r,s,i,o);const a=await n.getTask(r,o);if(a){const d=Me.parse({method:"notifications/tasks/status",params:a});await this.notification(d),oe(a.status)&&this._cleanupTaskProgressHandler(r)}},getTaskResult:r=>n.getTaskResult(r,o),updateTaskStatus:async(r,s,i)=>{const a=await n.getTask(r,o);if(!a)throw new S(T.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(oe(a.status))throw new S(T.InvalidParams,`Cannot update task "${r}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(r,s,i,o);const d=await n.getTask(r,o);if(d){const m=Me.parse({method:"notifications/tasks/status",params:d});await this.notification(m),oe(d.status)&&this._cleanupTaskProgressHandler(r)}},listTasks:r=>n.listTasks(r,o)}}}var Xc="2026-01-26",eu="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=fa.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!==eu&&console.debug("Sending message",t),this.eventTarget.postMessage(t,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var tu=k([c("light"),c("dark")]).describe("Color theme preference for the host environment."),ge=k([c("inline"),c("fullscreen"),c("pip")]).describe("Display mode for UI presentation."),ou=k([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."),nu=z(ou.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.`),k([u(),ot()]).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:c("ui/open-link"),params:l({url:u().describe("URL to open in the host's browser")})});var ru=l({isError:I().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),su=l({isError:I().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),iu=l({isError:I().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough();l({method:c("ui/notifications/sandbox-proxy-ready"),params:l({})});var Pt=l({connectDomains:b(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:b(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:b(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:b(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:c("ui/notifications/size-changed"),params:l({width:y().optional().describe("New width in pixels."),height:y().optional().describe("New height in pixels.")})});var au=l({method:c("ui/notifications/tool-input"),params:l({arguments:z(u(),$().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),cu=l({method:c("ui/notifications/tool-input-partial"),params:l({arguments:z(u(),$().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),uu=l({method:c("ui/notifications/tool-cancelled"),params:l({reason:u().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),lu=l({fonts:u().optional()}),du=l({variables:nu.optional().describe("CSS variables for theming the app."),css:lu.optional().describe("CSS blocks that apps can inject.")}),pu=l({method:c("ui/resource-teardown"),params:l({})});z(u(),$());var no=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:c("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:I().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:l({listChanged:I().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:Pt.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:no.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:no.optional().describe("Host supports receiving content messages (ui/message) from the view.")}),hu=l({experimental:l({}).optional().describe("Experimental features (structure TBD)."),tools:l({listChanged:I().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:b(ge).optional().describe("Display modes the app supports.")});l({method:c("ui/notifications/initialized"),params:l({}).optional()});l({csp:Pt.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
|
|
|
@@ -64,10 +64,10 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
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:c("ui/request-display-mode"),params:l({mode:ge.describe("The display mode being requested.")})});var fu=l({mode:ge.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),gu=k([c("model"),c("app")]).describe("Tool visibility scope - who can access the tool.");l({resourceUri:u().optional(),visibility:b(gu).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:
|
|
69
|
+
- "app": Tool callable by the app from this server only`)});l({mimeTypes:b(u()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')});l({method:c("ui/download-file"),params:l({contents:b(k([Qo,Go])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})});l({method:c("ui/message"),params:l({role:c("user").describe('Message role, currently only "user" is supported.'),content:b($e).describe("Message content blocks (text, image, etc.).")})});l({method:c("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:Pt.optional().describe("CSP configuration from resource metadata."),permissions:Zt.optional().describe("Sandbox permissions from resource metadata.")})});var vu=l({method:c("ui/notifications/tool-result"),params:Ke.describe("Standard MCP tool execution result.")}),on=l({toolInfo:l({id:ke.optional().describe("JSON-RPC id of the tools/call request."),tool:Ct.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:tu.optional().describe("Current color theme preference."),styles:du.optional().describe("Style configuration for theming the app."),displayMode:ge.optional().describe("How the UI is currently displayed."),availableDisplayModes:b(ge).optional().describe("Display modes the host supports."),containerDimensions:k([l({height:y().describe("Fixed container height in pixels.")}),l({maxHeight:k([y(),ot()]).optional().describe("Maximum container height in pixels.")})]).and(k([l({width:y().describe("Fixed container width in pixels.")}),l({maxWidth:k([y(),ot()]).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:k([c("web"),c("desktop"),c("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:l({touch:I().optional().describe("Whether the device supports touch input."),hover:I().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:l({top:y().describe("Top safe area inset in pixels."),right:y().describe("Right safe area inset in pixels."),bottom:y().describe("Bottom safe area inset in pixels."),left:y().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),_u=l({method:c("ui/notifications/host-context-changed"),params:on.describe("Partial context update containing only changed fields.")});l({method:c("ui/update-model-context"),params:l({content:b($e).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:z(u(),$().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})});l({method:c("ui/initialize"),params:l({appInfo:We.describe("App identification (name and version)."),appCapabilities:hu.describe("Features and capabilities this app provides."),protocolVersion:u().describe("Protocol version this app supports.")})});var bu=l({protocolVersion:u().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:We.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 yu(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 wu extends Yc{_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(Je,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(au,o=>t(o.params))}set ontoolinputpartial(t){this.setNotificationHandler(cu,o=>t(o.params))}set ontoolresult(t){this.setNotificationHandler(vu,o=>t(o.params))}set ontoolcancelled(t){this.setNotificationHandler(uu,o=>t(o.params))}set onhostcontextchanged(t){this.setNotificationHandler(_u,o=>{this._hostContext={...this._hostContext,...o.params},t(o.params)})}set onteardown(t){this.setRequestHandler(pu,(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},Ke,o)}async readServerResource(t,o){return await this.request({method:"resources/read",params:t},Ko,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},iu,o)}sendLog(t){return this.notification({method:"notifications/message",params:t})}updateModelContext(t,o){return this.request({method:"ui/update-model-context",params:t},gt,o)}openLink(t,o){return this.request({method:"ui/open-link",params:t},ru,o)}sendOpenLink=this.openLink;downloadFile(t,o){return this.request({method:"ui/download-file",params:t},su,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},fu,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,a=i.style.width,d=i.style.height;i.style.width="fit-content",i.style.height="max-content";let m=i.getBoundingClientRect();i.style.width=a,i.style.height=d;let g=window.innerWidth-i.clientWidth,f=Math.ceil(m.width+g),h=Math.ceil(m.height);(f!==o||h!==n)&&(o=f,n=h,this.sendSizeChanged({width:f,height:h}))}))};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:Xc}},bu,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}}}class st extends Error{structured;constructor(t,o){super(t),this.name="ToolCallError",this.structured=o}}async function xu(e){const t=new wu({name:e.name,version:e.version});return t.ontoolresult=o=>{try{const n=o.structuredContent;if(n&&typeof n=="object"&&n.status==="success")ro(e,n.data,n.meta,o);else if(n&&typeof n=="object"&&n.status==="error"){const r=n.message;Xe(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"?ro(e,s.data,s.meta,o):Xe(s.message||"Unknown error")}}}catch(n){const r=n instanceof Error?n.message:String(n);Xe(`Failed to parse result: ${r}`),e.onError?.(r)}},t.ontoolinput=o=>e.onInput?.(o.arguments??{}),t.onhostcontextchanged=o=>{if(o.styles?.variables&&yu(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 ro(e,t,o,n){const r=n._meta;r===void 0?e.onData(t,o):e.onData(t,o,r)}function Xe(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 Su(e,t,o){const n=await e.callServerTool({name:t,arguments:o}),r=n._meta,s=d=>r===void 0?d:{...d,resultMeta:r},i=n.structuredContent;if(i&&typeof i=="object"&&"status"in i){if(i.status==="success")return s({data:i.data,meta:i.meta});throw new st(i.message||"Tool call failed",i)}const a=n.content?.find(d=>d.type==="text");if(a&&"text"in a){const d=JSON.parse(a.text);if(d.status==="success")return s({data:d.data,meta:d.meta});throw new st(d.message||"Tool call failed",d)}throw new Error("No structured or text content in tool response")}const Tu={"&":"&","<":"<",">":">",'"':""","'":"'"};function V(e){return e==null?"":String(e).replace(/[&<>"']/g,t=>Tu[t])}const so=["title","summary","body","domains","level"],nn={title:"Title",summary:"Summary",body:"Body",domains:"Domains",level:"Level"};let Nt=null,rn="",Qe="",U=null,et=Promise.resolve(),se=0,K=null,ie=null,De=[],ve={},Le=null;const Q={},zu={requirement:"#a855f7","test-case":"#e4e4e7",note:"#a855f780"},$u={requirement:"REQ","test-case":"TC",note:"NOTE",table:"TABLE"},sn=document.createElement("style");sn.textContent=`
|
|
71
71
|
.editor-card {
|
|
72
72
|
padding: 16px;
|
|
73
73
|
}
|
|
@@ -258,37 +258,90 @@ container holding the app. Specify either width or maxWidth, and either height o
|
|
|
258
258
|
opacity: 1;
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
+
/* State panel under a field (REQ-MCA-056 to 060): purple accent border, square corners, no fill */
|
|
262
|
+
.editor-panel {
|
|
263
|
+
margin-top: 6px;
|
|
264
|
+
padding: 8px 10px;
|
|
265
|
+
border: 1px solid var(--atoms-purple);
|
|
266
|
+
border-radius: 0;
|
|
267
|
+
font-size: 12px;
|
|
268
|
+
color: var(--text-primary);
|
|
269
|
+
}
|
|
270
|
+
.editor-panel-label {
|
|
271
|
+
font-size: 10px;
|
|
272
|
+
font-weight: 600;
|
|
273
|
+
text-transform: uppercase;
|
|
274
|
+
letter-spacing: 0.5px;
|
|
275
|
+
color: var(--text-muted);
|
|
276
|
+
margin-top: 8px;
|
|
277
|
+
margin-bottom: 4px;
|
|
278
|
+
}
|
|
279
|
+
.editor-panel-theirs {
|
|
280
|
+
margin: 0;
|
|
281
|
+
padding: 6px 8px;
|
|
282
|
+
background: var(--bg-tertiary);
|
|
283
|
+
border: 1px solid var(--border-color);
|
|
284
|
+
border-radius: 0;
|
|
285
|
+
font-family: var(--font-main);
|
|
286
|
+
font-size: 12px;
|
|
287
|
+
white-space: pre-wrap;
|
|
288
|
+
color: var(--text-secondary);
|
|
289
|
+
}
|
|
290
|
+
.editor-panel-actions {
|
|
291
|
+
display: flex;
|
|
292
|
+
gap: 8px;
|
|
293
|
+
margin-top: 8px;
|
|
294
|
+
}
|
|
295
|
+
.editor-panel-btn {
|
|
296
|
+
background: var(--bg-tertiary);
|
|
297
|
+
border: 1px solid var(--border-color);
|
|
298
|
+
border-radius: 0;
|
|
299
|
+
color: var(--text-primary);
|
|
300
|
+
font-family: var(--font-main);
|
|
301
|
+
font-size: 12px;
|
|
302
|
+
padding: 4px 10px;
|
|
303
|
+
cursor: pointer;
|
|
304
|
+
}
|
|
305
|
+
.editor-panel-btn:hover,
|
|
306
|
+
.editor-panel-btn:focus {
|
|
307
|
+
border-color: var(--atoms-purple);
|
|
308
|
+
outline: none;
|
|
309
|
+
}
|
|
310
|
+
|
|
261
311
|
/* Section divider */
|
|
262
312
|
.editor-divider {
|
|
263
313
|
border: none;
|
|
264
314
|
border-top: 1px solid var(--border-color);
|
|
265
315
|
margin: 16px 0;
|
|
266
316
|
}
|
|
267
|
-
`;document.head.appendChild(
|
|
317
|
+
`;document.head.appendChild(sn);function Iu(e,t){document.getElementById("loading").style.display="none";const o=document.getElementById("editor");if(o.style.display="block",!e||!e.item||typeof e.item!="object"){document.getElementById("header-title").textContent="Result",o.innerHTML=`
|
|
268
318
|
<div class="editor-card">
|
|
269
|
-
<pre style="font-size:12px;white-space:pre-wrap;color:var(--text-secondary);margin:0">${
|
|
319
|
+
<pre style="font-size:12px;white-space:pre-wrap;color:var(--text-secondary);margin:0">${V(JSON.stringify(e??{},null,2))}</pre>
|
|
270
320
|
</div>
|
|
271
|
-
`;return}
|
|
321
|
+
`;return}if(rn=e.project_id,Qe=e.item.id,U={...e.item},ve={},typeof e.base_token=="string"&&e.base_token)for(const h of so)ve[h]=e.base_token;const n=t?.widget_proof;Le=typeof n=="string"&&n?n:null;for(const h of so)delete Q[h];const r=e.mode==="created"?"Created":"Updated",s=zu[e.item.type]??"#606060",i=`color-mix(in srgb, ${s} 20%, transparent)`;document.getElementById("header-title").textContent=`${e.item.id}: ${r}`,o.innerHTML=`
|
|
272
322
|
<div class="editor-card">
|
|
273
323
|
<div class="editor-item-header">
|
|
274
|
-
<span class="editor-item-id" style="color:${
|
|
275
|
-
<span class="editor-type-badge" style="background:${
|
|
276
|
-
<span class="editor-mode-badge">${
|
|
324
|
+
<span class="editor-item-id" style="color:${s}">${V(e.item.id)}</span>
|
|
325
|
+
<span class="editor-type-badge" style="background:${i};color:${s}">${V($u[e.item.type]??e.item.type)}</span>
|
|
326
|
+
<span class="editor-mode-badge">${r}</span>
|
|
277
327
|
</div>
|
|
278
328
|
|
|
279
329
|
<div class="editor-field">
|
|
280
330
|
<div class="editor-label">Title</div>
|
|
281
|
-
<input class="editor-input" id="f-title" value="${
|
|
331
|
+
<input class="editor-input" id="f-title" value="${V(e.item.title)}" placeholder="Item title..." />
|
|
332
|
+
<div id="p-title"></div>
|
|
282
333
|
</div>
|
|
283
334
|
|
|
284
335
|
<div class="editor-field">
|
|
285
336
|
<div class="editor-label">Summary <span style="color:var(--text-muted);font-weight:400;text-transform:none">(optional)</span></div>
|
|
286
|
-
<input class="editor-input" id="f-summary" value="${
|
|
337
|
+
<input class="editor-input" id="f-summary" value="${V(e.item.summary??"")}" placeholder="Brief description for search/AI..." />
|
|
338
|
+
<div id="p-summary"></div>
|
|
287
339
|
</div>
|
|
288
340
|
|
|
289
341
|
<div class="editor-field">
|
|
290
342
|
<div class="editor-label">${e.item.type==="test-case"?"Test Procedure":"Body"}</div>
|
|
291
|
-
<textarea class="editor-textarea" id="f-body" placeholder="${e.item.type==="requirement"?"The system shall...":"Description..."}">${
|
|
343
|
+
<textarea class="editor-textarea" id="f-body" placeholder="${e.item.type==="requirement"?"The system shall...":"Description..."}">${V(e.item.body??"")}</textarea>
|
|
344
|
+
<div id="p-body"></div>
|
|
292
345
|
</div>
|
|
293
346
|
|
|
294
347
|
<hr class="editor-divider" />
|
|
@@ -296,24 +349,26 @@ container holding the app. Specify either width or maxWidth, and either height o
|
|
|
296
349
|
<div class="editor-field">
|
|
297
350
|
<div class="editor-label">Domains</div>
|
|
298
351
|
<div class="editor-chips" id="domain-chips"></div>
|
|
352
|
+
<div id="p-domains"></div>
|
|
299
353
|
</div>
|
|
300
354
|
|
|
301
355
|
<div class="editor-field">
|
|
302
356
|
<div class="editor-label">Level</div>
|
|
303
357
|
<select class="editor-select" id="f-level">
|
|
304
358
|
<option value="">Select level</option>
|
|
305
|
-
${e.filters.levels.map(
|
|
359
|
+
${e.filters.levels.map(h=>`<option value="${V(h)}"${e.item.level===h?" selected":""}>${V(h)}</option>`).join("")}
|
|
306
360
|
</select>
|
|
361
|
+
<div id="p-level"></div>
|
|
307
362
|
</div>
|
|
308
363
|
|
|
309
364
|
<div id="save-indicator" style="padding:8px 0;font-size:11px;color:var(--text-muted);min-height:20px"></div>
|
|
310
365
|
</div>
|
|
311
|
-
`,
|
|
366
|
+
`,ie=null,K=null,De=e.filters.domains,ue(e.item.domains,e.filters.domains);const a=document.getElementById("f-title"),d=document.getElementById("f-summary"),m=document.getElementById("f-body"),g=document.getElementById("f-level"),f=(h,_)=>Q[h]!==void 0&&Q[h].yours===_;a.addEventListener("blur",()=>{a.value.trim()&&a.value!==U?.title&&!f("title",a.value.trim())&&Y("title",a.value.trim())}),d.addEventListener("blur",()=>{d.value!==(U?.summary??"")&&!f("summary",d.value)&&Y("summary",d.value)}),m.addEventListener("blur",()=>{m.value!==(U?.body??"")&&!f("body",m.value)&&Y("body",m.value)}),g.addEventListener("change",()=>{g.value!==(U?.level??"")&&!f("level",g.value)&&Y("level",g.value)})}let Ue=!1;function ue(e,t){const o=document.getElementById("domain-chips"),n=t.filter(s=>!e.includes(s));o.innerHTML=e.map(s=>`<span class="editor-chip">${V(s)}<span class="editor-chip-remove" data-domain="${V(s)}">×</span></span>`).join("")+(n.length>0?'<span class="editor-chip-add" id="add-domain-btn">+ Add</span>':""),o.querySelectorAll(".editor-chip-remove").forEach(s=>{s.addEventListener("click",()=>{const i=s.dataset.domain,a=(ie??e).filter(d=>d!==i);ie=a,Y("domains",a)})});const r=document.getElementById("add-domain-btn");r&&r.addEventListener("click",()=>{Ue||(Ue=!0,Ru(r,e,t))})}function Ru(e,t,o){const n=o.filter(d=>!t.includes(d)),r=document.createElement("div");r.className="editor-domain-picker",r.style.display="inline-block",r.innerHTML=`
|
|
312
367
|
<div class="editor-domain-dropdown">
|
|
313
368
|
<input class="editor-domain-search" placeholder="Search domains..." autofocus />
|
|
314
|
-
<div id="domain-options">${n.map(
|
|
369
|
+
<div id="domain-options">${n.map(d=>`<div class="editor-domain-option" data-domain="${V(d)}">${V(d)}</div>`).join("")}</div>
|
|
315
370
|
</div>
|
|
316
|
-
`,e.replaceWith(r);const s=r.querySelector(".editor-domain-search"),i=r.querySelector("#domain-options");setTimeout(()=>s.focus(),10),s.addEventListener("input",()=>{const
|
|
371
|
+
`,e.replaceWith(r);const s=r.querySelector(".editor-domain-search"),i=r.querySelector("#domain-options");setTimeout(()=>s.focus(),10),s.addEventListener("input",()=>{const d=s.value.toLowerCase();i.querySelectorAll(".editor-domain-option").forEach(m=>{m.style.display=m.dataset.domain.toLowerCase().includes(d)?"":"none"})}),i.addEventListener("click",d=>{const m=d.target.closest(".editor-domain-option");if(!m)return;const g=m.dataset.domain,f=ie??t,h=f.includes(g)?f:[...f,g];ie=h,Ue=!1,ue(t,o),Y("domains",h)});const a=d=>{r.contains(d.target)||(Ue=!1,ue(t,o),document.removeEventListener("click",a))};setTimeout(()=>document.addEventListener("click",a),50)}function Y(e,t,o={}){return Nt?(se+=1,Eu(e),et=et.then(()=>Pu(e,t,o)),et):Promise.resolve()}function Eu(e){const t=document.getElementById("save-indicator");t&&se>0&&(K===null&&(t.textContent=se>1?`Saving ${se} changes...`:`Saving ${e}...`),t.style.color="var(--text-secondary)")}function Cu(e,t,o){const n={project_id:rn,item_id:Qe};n[e]=t;const r=o.applyMine?.token??ve[e];return r&&(n.base_token=r,o.applyMine&&(n.intent="apply_mine"),Le&&(n.widget_proof=Le)),n}async function Pu(e,t,o){const n=e,r=document.getElementById("save-indicator"),s=o.args??Cu(n,t,o);try{const{data:i,resultMeta:a}=await Su(Nt,"atoms_update_item",s),d=a?.widget_proof;typeof d=="string"&&d&&(Le=d);const m=i??{};if(delete Q[n],je(n),m.outcome==="captured_as_change"){const h=m.change??{},_=typeof h.sg_number=="number"?`SG-${h.sg_number}`:String(h.id??"a suggestion"),A=typeof m.id=="string"?m.id:Qe;io(n,`Saved as suggestion ${_}. ${A} is approved, so its approver accepts the change.`,{yours:t,args:s}),r&&K===null&&(r.textContent="");return}const g=Zu(m,n,t);if(typeof m.base_token=="string"&&m.base_token&&(ve[n]=m.base_token),U&&(n==="domains"?U.domains=g:U[n]=g),n!=="domains"){const h=an(n);h&&h.value===t&&g!==t&&typeof g=="string"&&(h.value=g)}n==="domains"&&se===1&&ue(g,De);const f=Array.isArray(m.replaced)?m.replaced:[];if(f.length>0){const h=f.map(_=>_.name||"Someone").join(" and ");io(n,`Saved. This replaced ${h}'s change to ${nn[n]}. They are told.`,{yours:t,args:s}),r&&K===null&&(r.textContent="");return}if(r&&K===null&&se===1){r.textContent=`${n} saved`,r.style.color="var(--text-primary)";const h=r.textContent;setTimeout(()=>{r.textContent===h&&(r.textContent="")},2e3)}}catch(i){const a=i instanceof st?qu(i.structured,n):null,d=a?Mu(n,a,t,s,i):null;n==="domains"&&(ie=null,U&&ue(U.domains,De)),d?(Q[n]=d.panel,je(n),r&&(d.indicator!==null&&(K=d.indicator),r.textContent=d.indicator??K??"",r.style.color="var(--text-primary)")):(K=`Failed to save ${n}: ${i instanceof Error?i.message:String(i)}`,r&&(r.textContent=K,r.style.color="var(--text-primary)"))}finally{se-=1}}function an(e){const t=e==="level"?"f-level":`f-${e}`;return document.getElementById(t)}function Zu(e,t,o){const n=e.item;return n&&t in n&&n[t]!==void 0?n[t]:t in e&&e[t]!==void 0?e[t]:o}function Nu(e){return!e||e.length===0?null:e.length===1&&(e[0]==="title"||e[0]==="summary"||e[0]==="body")?e[0]:e[0]==="tags"&&e[1]==="domains"?"domains":e[0]==="tags"&&e[1]==="level"?"level":null}function qu(e,t){const o=e;return!o||o.code!=="not_all_applied"||!Array.isArray(o.not_applied)?null:o.not_applied.find(n=>Nu(n.path??null)===t)??null}function Au(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?"":`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function cn(e){return typeof e=="string"?e:Array.isArray(e)?e.map(String).join(", "):e==null?"":JSON.stringify(e)}function Mu(e,t,o,n,r){const s=nn[e],i=t.item_id||Qe,a=t.status??"",d=t.reason??"",m={yours:o,args:n,entryToken:t.base_token},g=a==="skipped_typing"||a==="skipped"&&d==="typing",f=a==="locked"||a==="skipped"&&d==="locked",h=a==="deleted"||a==="skipped"&&d==="deleted";if(a==="conflict"){const _=typeof n.base_token=="string";if(d==="bad_token"||d==="no_base"&&!_)return{panel:{...m,hasTheirs:!0,theirs:t.theirs_value,buttons:[],text:`${s} could not be checked against this card. Close the card and open ${i} again. Your text is kept below.`},indicator:t.message||r.message};if(d==="no_base")return{panel:{...m,hasTheirs:!0,theirs:t.theirs_value,buttons:["Apply mine","Drop"],text:`${s} could not be checked against this card. Your text is kept below.`},indicator:null};const L=t.changed_by?.name||"Someone",G=Au(t.changed_at);return{panel:{...m,hasTheirs:!0,theirs:t.theirs_value,buttons:["Apply mine","Drop"],text:`${L} changed ${s}${G?` at ${G}`:""} after this card was shown. Your text is kept below.`},indicator:null}}if(g){const _=t.typing?.name||"Someone";return{panel:{...m,hasTheirs:!1,buttons:["Try again"],text:`${_} is typing in ${s}. Your text is kept here.`},indicator:null}}if(f){const _=t.locked_by?.name;return{panel:{...m,hasTheirs:!1,buttons:[],text:`${i} is ${_?`locked to ${_}`:"locked for everyone"}. Your text is kept here.`},indicator:null}}return h?{panel:{...m,hasTheirs:!1,buttons:[],text:`${i} is in the Trash or was deleted. Your text is kept here.`},indicator:null}:null}function io(e,t,o){Q[e]={text:t,hasTheirs:!1,buttons:[],yours:void 0,args:o.args},je(e)}function je(e){const t=document.getElementById(`p-${e}`);if(!t)return;t.replaceChildren();const o=Q[e];if(!o)return;const n=document.createElement("div");n.className="editor-panel",n.dataset.field=e,n.setAttribute("role","status");const r=document.createElement("div");if(r.className="editor-panel-text",r.textContent=o.text,n.appendChild(r),o.hasTheirs){const s=document.createElement("div");s.className="editor-panel-label",s.textContent="Saved now";const i=document.createElement("pre");i.className="editor-panel-theirs",i.textContent=cn(o.theirs),n.append(s,i)}if(o.buttons.length>0){const s=document.createElement("div");s.className="editor-panel-actions";for(const i of o.buttons){const a=document.createElement("button");a.type="button",a.className="editor-panel-btn",a.textContent=i,a.addEventListener("click",()=>Ou(e,i)),s.appendChild(a)}n.appendChild(s)}t.appendChild(n)}function Ou(e,t){const o=Q[e];if(!o)return;if(t==="Try again"){Y(e,o.yours,{args:o.args});return}if(t==="Apply mine"){Y(e,o.yours,{applyMine:{token:o.entryToken}});return}if(o.entryToken&&(ve[e]=o.entryToken),delete Q[e],je(e),e==="domains"){const s=Array.isArray(o.theirs)?o.theirs:[];ie=null,U&&(U.domains=s),ue(s,De);return}const n=typeof o.theirs=="string"?o.theirs:cn(o.theirs),r=an(e);r&&(r.value=n),U&&(U[e]=n)}xu({name:"ATOMS Editor",version:"1.0.0",onData:(e,t,o)=>{Iu(e,o)}}).then(e=>{Nt=e});</script>
|
|
317
372
|
<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>
|
|
318
373
|
</head>
|
|
319
374
|
<body>
|