chain-insights 0.47.1 → 0.48.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apps/claude-view.html +42 -41
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/{graph-schema-znb_9MYq.cjs → graph-schema-CgWgVltN.cjs} +1 -1
- package/dist/{graph-schema-D1orCe5F.mjs → graph-schema-DhVJiVba.mjs} +2 -2
- package/dist/graph-schema-DhVJiVba.mjs.map +1 -0
- package/dist/mcp-proxy.cjs +1 -1
- package/dist/mcp-proxy.mjs +1 -1
- package/docs/mcp-proxy.md +5 -0
- package/package.json +1 -1
- package/dist/graph-schema-D1orCe5F.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- Chain Insights UI
|
|
1
|
+
<!-- Chain Insights UI 15e3514cfafd77a320d33f2a7daf331e31ca307d (npm run build:claude-view); refresh with scripts/refresh-claude-view.mjs, never edit by hand -->
|
|
2
2
|
<!doctype html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
@@ -6,50 +6,50 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
7
7
|
<meta name="color-scheme" content="light dark">
|
|
8
8
|
<title>Chain Insights view</title>
|
|
9
|
-
<script type="module">const Ny=(function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"})(),Oy=function(e,t){return new URL(e,t).href},Rl={},Py=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let u=function(l){return Promise.all(l.map(d=>Promise.resolve(d).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};const s=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),c=a?.nonce||a?.getAttribute("nonce");o=u(n.map(l=>{if(l=Oy(l,r),l in Rl)return;Rl[l]=!0;const d=l.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(r)for(let h=s.length-1;h>=0;h--){const m=s[h];if(m.href===l&&(!d||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${f}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":Ny,d||(p.as="script"),p.crossOrigin="",p.href=l,c&&p.setAttribute("nonce",c),document.head.appendChild(p),d)return new Promise((h,m)=>{p.addEventListener("load",h),p.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${l}`)))})}))}function i(s){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=s,window.dispatchEvent(a),!a.defaultPrevented)throw s}return o.then(s=>{for(const a of s||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})};function My(e){return e}function Ry(e){return e}function Do(){return e=>e}function Ly(e){}function Dy(e){throw new Error("Unexpected value in exhaustive check")}function Zy(e){}function xo(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function ks(e,t="|"){return e.map(n=>Ws(n)).join(t)}function zo(e,t){return typeof t=="bigint"?t.toString():t}class jy{constructor(t){this._getter=t,this._value=void 0}get value(){const t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}}function Yn(e){return new jy(e)}function Bs(e){return e==null}function vt(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Ks(e,t){const n=e/t,r=Math.round(n),o=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<o?0:n-r}const Ll=Symbol("evaluating");function Qd(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ll)return r===void 0&&(r=Ll,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Fy(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Fe(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Zo(e){const t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function at(e){return Zo(e._zod.def)??e._zod.def.shape}function Xd(e,t,n){Object.defineProperty(e,t,{get(){const r=n();return Fe(this,t,r),r},enumerable:!0,configurable:!0})}function ef(e,t,n){t in e?Fe(e,t,n):e[t]=n}function Lt(e,t,n,r){const o=at(t);for(const i of n){const s=Object.getOwnPropertyDescriptor(o,i);s.enumerable&&(s.get?Xd(e,i,()=>{const a=t._zod.def.shape[i];return r?r(a,i):a}):ef(e,i,r?r(s.value,i):s.value))}}function Uy(e,t){for(const n of Reflect.ownKeys(t)){const r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Xd(e,n,()=>t[n]):ef(e,n,r.value))}}function Se(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Vy(e){return Se(e._zod.def)}function qy(e,t){return t?t.reduce((n,r)=>n?.[r],e):e}function Hy(e){const t=Object.keys(e),n=t.map(r=>e[r]);return Promise.all(n).then(r=>{const o={};for(let i=0;i<t.length;i++)o[t[i]]=r[i];return o})}function By(e=10){const t="abcdefghijklmnopqrstuvwxyz";let n="";for(let r=0;r<e;r++)n+=t[Math.floor(Math.random()*t.length)];return n}function De(e){return JSON.stringify(e)}function tf(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Js="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Yt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const nf=Yn(()=>{if(Ee.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function ct(e){if(Yt(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Yt(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Qn(e){return ct(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Ky(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}const Jy=e=>{const t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},To=new Set(["string","number","symbol"]),rf=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ut(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function oe(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function I(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 Wy(e){let t;return new Proxy({},{get(n,r,o){return t??(t=e()),Reflect.get(t,r,o)},set(n,r,o,i){return t??(t=e()),Reflect.set(t,r,o,i)},has(n,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(n,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,o){return t??(t=e()),Reflect.defineProperty(t,r,o)}})}function Ws(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function of(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}const Gs={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]},Ys={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function sf(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i={};return Lt(i,e,jo(e,t)),oe(e,Se(n,{shape:i,checks:[]}))}function jo(e,t){const n=at(e),r=[];for(const o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&r.push(o)}return r}function af(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=new Set(jo(e,t)),s={};return Lt(s,e,Reflect.ownKeys(at(e)).filter(a=>!i.has(a))),oe(e,Se(n,{shape:s,checks:[]}))}function cf(e,t){if(!ct(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const o=at(e);for(const i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return oe(e,Se(e._zod.def,{shape:uf(e,t)}))}function uf(e,t){const n={};return Lt(n,e,Reflect.ownKeys(at(e))),Uy(n,t),n}function lf(e,t){if(!ct(t))throw new Error("Invalid input to safeExtend: expected a plain object");return oe(e,Se(e._zod.def,{shape:uf(e,t)}))}function df(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n={};Lt(n,e,Reflect.ownKeys(at(e))),Lt(n,t,Reflect.ownKeys(at(t)));const r=Se(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return oe(e,r)}function $s(e,t,n,r="partial"){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);const a=n?new Set(jo(t,n)):void 0,c={};return Lt(c,t,Reflect.ownKeys(at(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),oe(t,Se(t._zod.def,{shape:c,checks:[]}))}function ff(e,t,n){const r=n?new Set(jo(t,n)):void 0,o={};return Lt(o,t,Reflect.ownKeys(at(t)),(i,s)=>r&&!r.has(s)?i:new e({type:"nonoptional",innerType:i})),oe(t,Se(t._zod.def,{shape:o}))}function Ae(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function pf(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function qe(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Jt(e){return typeof e=="string"?e:e?.message}function Ss(e,t,n){var r;for(let o=t;o<e.length;o++)(r=e[o]).schema??(r.schema=n)}function Be(e,t,n){var r;const o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);const i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:Jt(e.inst?._zod.def?.error?.(e))??Jt(i?.(e))??Jt(t?.error?.(e))??Jt(n.customError?.(e))??Jt(n.localeError?.(e))??"Invalid input",a={};for(const c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=e[c]);return a.path??(a.path=[]),a.message=s,t?.reportInput&&(a.input=e.input),a}function Fo(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}const Gy=/[\uD800-\uDBFF]/;function Xn(e){const t=e.length;if(!Gy.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320&&(n--,r++);return n}function Uo(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function hf(e){const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";const n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Qt(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}function Yy(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function mf(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function gf(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function Qy(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return mf(t+n)}function Xy(e){return gf(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function e_(e){const t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");const n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=Number.parseInt(t.slice(r,r+2),16);return n}function t_(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}class n_{constructor(...t){}}function yf(e,t){for(const n in t){const r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):r_(e,n,r.value)}}function lt(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Vo(e,t,n){return lt(e,t,n,!1)}function er(e,t){for(const n in e){const r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return lt(this,n,r(this))},set(o){lt(this,n,o)}})}return t}function r_(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:lt(this,t,n.bind(this))},set(r){lt(this,t,r)}})}function o_(e,t){const n=Object.getPrototypeOf(e);return t in n?void 0:n}let us,_t=!1;const i_={configurable:!0,get(){_t=!0}};function U(e,t,n){const r=Object.getPrototypeOf(e._zod);if(t in r&&us!==e._zod){us=void 0;return}us=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,i_);const o=_t;_t=!1;try{const i=n(this);return _t?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),_t=_t||o,i}catch(i){throw delete this[t],_t=_t||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function _f(e,t,n,r){const o=o_(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){const i={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,i),i.value=n(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:i})}})}const Qs="~constantCatch";function Xs(e){const t=()=>e;return t[Qs]=!0,t}const ea=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:Ys,CONSTANT_CATCH:Qs,Class:n_,NUMBER_FORMAT_RANGES:Gs,aborted:Ae,allowsEval:nf,assert:Zy,assertEqual:My,assertIs:Ly,assertNever:Dy,assertNotEqual:Ry,assignProp:Fe,attachSchema:Ss,base64ToUint8Array:mf,base64urlToUint8Array:Qy,cached:Yn,captureStackTrace:Js,cleanEnum:Yy,cleanRegex:vt,clone:oe,cloneDef:Vy,codePointLength:Xn,constantCatch:Xs,createTransparentProxy:Wy,defineLazy:Qd,defineLazyInternal:U,derived:er,esc:De,escapeRegex:ut,explicitlyAborted:pf,extend:cf,finalizeIssue:Be,floatSafeRemainder:Ks,getElementAtPath:qy,getEnumValues:xo,getLengthableOrigin:Uo,getParsedType:Jy,getSizableOrigin:Fo,hexToUint8Array:e_,hide:Vo,installLazyProp:_f,isObject:Yt,isPlainObject:ct,issue:Qt,joinValues:ks,jsonStringifyReplacer:zo,members:yf,merge:df,mergeDefs:Se,normalizeParams:I,nullish:Bs,numKeys:Ky,objectClone:Fy,omit:af,optionalKeys:of,own:lt,parsedType:hf,partial:$s,pick:sf,prefixIssues:qe,primitiveTypes:rf,promiseAllObject:Hy,propertyKeyTypes:To,randomString:By,rawShape:Zo,required:ff,safeExtend:lf,shallowClone:Qn,slugify:tf,stringifyPrimitive:Ws,toZod:Do,uint8ArrayToBase64:gf,uint8ArrayToBase64url:Xy,uint8ArrayToHex:t_,unwrapMessage:Jt},Symbol.toStringTag,{value:"Module"}));var Dl;const ta=Object.freeze({status:"aborted"}),ls={value:void 0,enumerable:!1};let Zl="captureStackTrace"in Error?Error:null;function s_(e){const t=Zl;if(t){const n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return Zl=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function g(e,t,n,r){const o={};function i(f){this.def=f,this.constr=d,this.traits=new Set}i.prototype=o;const s=n,a=s&&new WeakSet;function c(f,p){if(f._zod){if(f._zod.traits.has(e))return}else{ls.value=new i(p);try{Object.defineProperty(f,"_zod",ls)}finally{ls.value=void 0}}if(f._zod.traits.add(e),t(f,p),a){const m=Object.getPrototypeOf(f),y=f._zod.constr.prototype;let $=m;for(;$&&$!==y;)$=Object.getPrototypeOf($);const w=$??m;a.has(w)||(a.add(w),yf(w,s))}const h=d.prototype;for(const m in h)Object.prototype.hasOwnProperty.call(h,m)&&(m in f||(f[m]=h[m].bind(f)))}const u=r?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function d(f){const p=r?.Parent?s_(l):this;c(p,f);const h=p._zod.deferred;if(h){for(const y of h)y();p._zod.deferred=void 0}const m=globalThis.__zod_globalConfig?.postProcessor;return m&&m(p),p}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:f=>r?.Parent&&f instanceof r.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}const na=Symbol("zod_brand");class st extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class qo extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(Dl=globalThis).__zod_globalConfig??(Dl.__zod_globalConfig={});const Ee=globalThis.__zod_globalConfig;function me(e){return e&&Object.assign(Ee,e),Ee}function a_(){const e=this._zod;return e.message??(e.message=JSON.stringify(e.def,zo,2)),e.message}function c_(e){this._zod.message=e}const u_={get:a_,set:c_,enumerable:!0,configurable:!0},ds={value:void 0,enumerable:!1},jl=new WeakSet([Object.prototype,Error.prototype]),bf=(e,t)=>{e.name="$ZodError",ds.value=t,Object.defineProperty(e,"issues",ds),ds.value=void 0,Object.defineProperty(e,"message",u_);const n=Object.getPrototypeOf(e);jl.has(n)||(jl.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){const r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}}))},wf=g("$ZodError",bf),Ue=g("$ZodError",bf,void 0,{Parent:Error});function l_(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Ho(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?l_(n,o.path[0],()=>[]).push(t(o)):r.push(t(o));return{formErrors:r,fieldErrors:n}}function Bo(e,t=n=>n.message){const n={_errors:[]},r=(o,i=[])=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>r({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{const a=[...i,...s.path];if(a.length===0)n._errors.push(t(s));else{let c=n,u=0;for(;u<a.length;){const l=a[u],d=u===a.length-1;if(l==="_errors"){d&&c._errors.push(t(s)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});const f=c[l];d&&f._errors.push(t(s)),c=f,u++}}}};return r(e),n}function ra(e,t=n=>n.message){const n={errors:[]},r=(o,i=[])=>{var s;for(const a of o.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>r({issues:c},[...i,...a.path]));else if(a.code==="invalid_key")r({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")r({issues:a.issues},[...i,...a.path]);else{const c=[...i,...a.path];if(c.length===0){n.errors.push(t(a));continue}let u=n,l=0;for(;l<c.length;){const d=c[l],f=l===c.length-1;typeof d=="string"?(u.properties??(u.properties={}),Object.prototype.hasOwnProperty.call(u.properties,d)||Object.defineProperty(u.properties,d,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),u=u.properties[d]):(u.items??(u.items=[]),(s=u.items)[d]??(s[d]={errors:[]}),u=u.items[d]),f&&u.errors.push(t(a)),l++}}};return r(e),n}function vf(e){const t=[],n=e.map(r=>typeof r=="object"?r.key:r);for(const r of n)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function oa(e){const t=[],n=[...e.issues].sort((r,o)=>(r.path??[]).length-(o.path??[]).length);for(const r of n)t.push(`✖ ${r.message}`),r.path?.length&&t.push(` → at ${vf(r.path)}`);return t.join(`
|
|
10
|
-
`)}function Ko(e,t){return{callee:t?.callee??e,Err:t?.Err}}const tr=e=>{const t=(n,r,o,i)=>{const s=o?{...o,async:!1}:{async:!1},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new st;if(a.issues.length){const c=new(i?.Err??e)(a.issues.map(u=>Be(u,s,me())));throw Js(c,i?.callee??t),c}return a.value};return t},Is=tr(Ue),nr=e=>{const t=async(n,r,o,i)=>{const s=o?{...o,async:!0}:{async:!0};let a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const c=new(i?.Err??e)(a.issues.map(u=>Be(u,s,me())));throw Js(c,i?.callee??t),c}return a.value};return t},xs=nr(Ue),rr=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new st;return i.issues.length?$f(e,i.issues,o):{success:!0,data:i.value}},kf=rr(Ue);function $f(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(o=>Be(o,n,me()))),t=void 0,n=void 0),r},set error(o){r=o,t=void 0,n=void 0}}}const or=e=>async(t,n,r)=>{const o=r?{...r,async:!0}:{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?$f(e,i.issues,o):{success:!0,data:i.value}},d_=or(Ue),f_=Symbol.for("zod.compile.invalid"),p_=Symbol.for("zod.compile.fallback"),Jo=((e,t,n)=>{const r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==f_)return!0;if(r.definite===!0&&n===void 0)return!1}return h_(e,t,n)});function h_(e,t,n){const r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun;let i;if(o?(r[p_]=!0,i=o({value:t,issues:[]},r)):i=e._zod.run({value:t,issues:[]},r),i instanceof Promise)throw new st;return i.issues.length===0}const Wo=async(e,t,n)=>{const r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let o=e._zod.run({value:t,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length===0},ia=e=>{const t=tr(e),n=(r,o,i,s)=>{const a=i?{...i,direction:"backward"}:{direction:"backward"};return t(r,o,a,Ko(n,s))};return n},m_=ia(Ue),sa=e=>{const t=tr(e),n=(r,o,i,s)=>t(r,o,i,Ko(n,s));return n},g_=sa(Ue),aa=e=>{const t=nr(e),n=async(r,o,i,s)=>{const a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(r,o,a,Ko(n,s))};return n},y_=aa(Ue),ca=e=>{const t=nr(e),n=async(r,o,i,s)=>await t(r,o,i,Ko(n,s));return n},__=ca(Ue),ua=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return rr(e)(t,n,o)},b_=ua(Ue),la=e=>(t,n,r)=>rr(e)(t,n,r),w_=la(Ue),da=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return or(e)(t,n,o)},v_=da(Ue),fa=e=>async(t,n,r)=>or(e)(t,n,r),k_=fa(Ue),Sf=/^[cC][0-9a-z]{6,}$/,If=/^[0-9a-z]+$/,xf=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,zf=/^[0-9a-vA-V]{20}$/,Tf=/^[A-Za-z0-9]{27}$/,Ef=/^[a-zA-Z0-9_-]{21}$/;function Cf(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const Af=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,$_=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Nf=/^([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})$/,Xt=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,S_=Xt(4),I_=Xt(6),x_=Xt(7),Of=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,z_=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,T_=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Pf=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,E_=Pf,C_=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,A_="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Mf(){return new RegExp(A_,"u")}const Rf=/^(?:(?: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])$/,Lf=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Df=e=>{const t=ut(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Zf=/^((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])$/,jf=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ff=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Uf=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Vf=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,qf=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,pa=/^https?$/,Hf=/^\+[1-9]\d{6,14}$/,ha=/^\d(?:[ -]?\d){11,18}$/,Bf=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,ma=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,Kf="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function N_(e){return new RegExp(`^${e}$`)}const Jf=N_(Kf);function zs(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}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Wf(e){return new RegExp(`^${zs(e)}$`)}function Gf(e){const t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${zs({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${zs({precision:e.precision})}`:n;return new RegExp(`^${Kf}T(?:${r})$`)}const Yf=/^[\s\S]{0,}$/,Qf=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Xf=/^-?\d+n?$/,ga=/^-?\d+$/,ln=/^-?\d+(?:\.\d+)?$/,ep=/^(?:true|false)$/i,tp=/^null$/i,np=/^undefined$/i,rp=/^[^A-Z]*$/,op=/^[^a-z]*$/,ip=/^[0-9a-fA-F]*$/;function ir(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function sr(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}const O_=/^[0-9a-fA-F]{32}$/,P_=ir(22,"=="),M_=sr(22),R_=/^[0-9a-fA-F]{40}$/,L_=ir(27,"="),D_=sr(27),Z_=/^[0-9a-fA-F]{64}$/,j_=ir(43,"="),F_=sr(43),U_=/^[0-9a-fA-F]{96}$/,V_=ir(64,""),q_=sr(64),H_=/^[0-9a-fA-F]{128}$/,B_=ir(86,"=="),K_=sr(86),Go=Object.freeze(Object.defineProperty({__proto__:null,anyString:Yf,base64:Ff,base64url:Uf,bigint:Xf,boolean:ep,browserEmail:C_,cidrv4:Zf,cidrv6:jf,creditCard:ha,cuid:Sf,cuid2:If,currencyCode:Bf,date:Jf,datetime:Gf,domain:qf,duration:Af,e164:Hf,email:Of,emoji:Mf,extendedDuration:$_,guid:Nf,hex:ip,hostname:Vf,html5Email:z_,httpProtocol:pa,iban:ma,idnEmail:E_,integer:ga,ipv4:Rf,ipv6:Lf,ksuid:Tf,lowercase:rp,mac:Df,md5_base64:P_,md5_base64url:M_,md5_hex:O_,nanoid:Ef,nanoidOfLength:Cf,null:tp,number:ln,rfc5322Email:T_,sha1_base64:L_,sha1_base64url:D_,sha1_hex:R_,sha256_base64:j_,sha256_base64url:F_,sha256_hex:Z_,sha384_base64:V_,sha384_base64url:q_,sha384_hex:U_,sha512_base64:B_,sha512_base64url:K_,sha512_hex:H_,string:Qf,time:Wf,ulid:xf,undefined:np,unicodeEmail:Pf,uppercase:op,uuid:Xt,uuid4:S_,uuid6:I_,uuid7:x_,xid:zf},Symbol.toStringTag,{value:"Module"})),ie=g("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ya=e=>{const t=e.value;return!Bs(t)&&t.size!==void 0},_a=e=>{const t=e.value;return!Bs(t)&&t.length!==void 0},Eo={number:"number",bigint:"bigint",object:"date"},ba=g("$ZodCheckLessThan",(e,t)=>{ie.init(e,t);const n=Eo[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Eo[typeof r.value]??n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),wa=g("$ZodCheckGreaterThan",(e,t)=>{ie.init(e,t);const n=Eo[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Eo[typeof r.value]??n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),sp=g("$ZodCheckMultipleOf",(e,t)=>{ie.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):Ks(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ap=g("$ZodCheckNumberFormat",(e,t)=>{ie.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,i]=Gs[t.format];e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}a<o&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),cp=g("$ZodCheckBigIntFormat",(e,t)=>{ie.init(e,t);const[n,r]=Ys[t.format];e._zod.check=o=>{const i=o.value;i<n&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),i>r&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),up=g("$ZodCheckMaxSize",(e,t)=>{var n;ie.init(e,t),(n=e._zod.def).when??(n.when=ya),e._zod.check=r=>{const o=r.value;o.size<=t.maximum||r.issues.push({origin:Fo(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),lp=g("$ZodCheckMinSize",(e,t)=>{var n;ie.init(e,t),(n=e._zod.def).when??(n.when=ya),e._zod.check=r=>{const o=r.value;o.size>=t.minimum||r.issues.push({origin:Fo(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),dp=g("$ZodCheckSizeEquals",(e,t)=>{var n;ie.init(e,t),(n=e._zod.def).when??(n.when=ya),e._zod.check=r=>{const o=r.value,i=o.size;if(i===t.size)return;const s=i>t.size;r.issues.push({origin:Fo(o),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),fp=g("$ZodCheckMaxLength",(e,t)=>{var n;ie.init(e,t),(n=e._zod.def).when??(n.when=_a),e._zod.check=r=>{const o=r.value,i=o.length;if((typeof o=="string"&&i>t.maximum?Xn(o):i)<=t.maximum)return;const a=Uo(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),pp=g("$ZodCheckMinLength",(e,t)=>{var n;ie.init(e,t),(n=e._zod.def).when??(n.when=_a),e._zod.check=r=>{const o=r.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?Xn(o):i)>=t.minimum)return;const a=Uo(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),hp=g("$ZodCheckLengthEquals",(e,t)=>{var n;ie.init(e,t),(n=e._zod.def).when??(n.when=_a),e._zod.check=r=>{const o=r.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?Xn(o):i;if(s===t.length)return;const a=Uo(o),c=s>t.length;r.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ar=g("$ZodCheckStringFormat",(e,t)=>{var n,r;ie.init(e,t),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),mp=g("$ZodCheckRegex",(e,t)=>{ar.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),gp=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=rp),ar.init(e,t)}),yp=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=op),ar.init(e,t)}),_p=g("$ZodCheckIncludes",(e,t)=>{ie.init(e,t);const n=ut(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),bp=g("$ZodCheckStartsWith",(e,t)=>{ie.init(e,t);const n=new RegExp(`^${ut(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),wp=g("$ZodCheckEndsWith",(e,t)=>{ie.init(e,t);const n=new RegExp(`.*${ut(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});function Co(e,t,n){e.issues.length&&t.issues.push(...qe(n,e.issues))}const vp=g("$ZodCheckProperty",(e,t)=>{ie.init(e,t),e._zod.check=n=>{const r=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(r instanceof Promise)return r.then(o=>Co(o,n,t.property));Co(r,n,t.property)}}),kp=g("$ZodCheckProperties",(e,t)=>{ie.init(e,t),Vo(e,Symbol.iterator,function*(){yield e});let n;e._zod.check=r=>{if(r.value==null){r.issues.push({expected:"object",code:"invalid_type",input:r.value,inst:e});return}n??(n=Reflect.ownKeys(t.shape).map(s=>[s,t.shape[s]]));const o=r.value;let i;for(const[s,a]of n){const c=a._zod.run({value:o[s],issues:[]},{});c instanceof Promise?(i??(i=[]),i.push(c.then(u=>Co(u,r,s)))):Co(c,r,s)}if(i)return Promise.all(i).then(()=>{})}}),$p=g("$ZodCheckMimeType",(e,t)=>{ie.init(e,t);const n=new Set(t.mime);e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:"invalid_value",values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),Sp=g("$ZodCheckOverwrite",(e,t)=>{ie.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class va{constructor(t=[],n={}){this.content=[],this.indent=0,this.args=t,this.closed=n}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
11
|
-
`).filter(
|
|
9
|
+
<script type="module">const jy=(function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"})(),Fy=function(e,t){return new URL(e,t).href},Bl={},Uy=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let u=function(l){return Promise.all(l.map(d=>Promise.resolve(d).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};const i=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),c=a?.nonce||a?.getAttribute("nonce");o=u(n.map(l=>{if(l=Fy(l,r),l in Bl)return;Bl[l]=!0;const d=l.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(r)for(let h=i.length-1;h>=0;h--){const m=i[h];if(m.href===l&&(!d||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${f}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":jy,d||(p.as="script"),p.crossOrigin="",p.href=l,c&&p.setAttribute("nonce",c),document.head.appendChild(p),d)return new Promise((h,m)=>{p.addEventListener("load",h),p.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${l}`)))})}))}function s(i){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i}return o.then(i=>{for(const a of i||[])a.status==="rejected"&&s(a.reason);return t().catch(s)})};function Vy(e){return e}function qy(e){return e}function ns(){return e=>e}function Hy(e){}function By(e){throw new Error("Unexpected value in exhaustive check")}function Ky(e){}function qo(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Ui(e,t="|"){return e.map(n=>ma(n)).join(t)}function Ho(e,t){return typeof t=="bigint"?t.toString():t}class Jy{constructor(t){this._getter=t,this._value=void 0}get value(){const t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}}function ur(e){return new Jy(e)}function fa(e){return e==null}function Ct(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function pa(e,t){const n=e/t,r=Math.round(n),o=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<o?0:n-r}const Kl=Symbol("evaluating");function lf(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Kl)return r===void 0&&(r=Kl,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Wy(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Fe(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function rs(e){const t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function ht(e){return rs(e._zod.def)??e._zod.def.shape}function df(e,t,n){Object.defineProperty(e,t,{get(){const r=n();return Fe(this,t,r),r},enumerable:!0,configurable:!0})}function ff(e,t,n){t in e?Fe(e,t,n):e[t]=n}function Ft(e,t,n,r){const o=ht(t);for(const s of n){const i=Object.getOwnPropertyDescriptor(o,s);i.enumerable&&(i.get?df(e,s,()=>{const a=t._zod.def.shape[s];return r?r(a,s):a}):ff(e,s,r?r(i.value,s):i.value))}}function Gy(e,t){for(const n of Reflect.ownKeys(t)){const r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?df(e,n,()=>t[n]):ff(e,n,r.value))}}function xe(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Yy(e){return xe(e._zod.def)}function Qy(e,t){return t?t.reduce((n,r)=>n?.[r],e):e}function Xy(e){const t=Object.keys(e),n=t.map(r=>e[r]);return Promise.all(n).then(r=>{const o={};for(let s=0;s<t.length;s++)o[t[s]]=r[s];return o})}function e_(e=10){const t="abcdefghijklmnopqrstuvwxyz";let n="";for(let r=0;r<e;r++)n+=t[Math.floor(Math.random()*t.length)];return n}function De(e){return JSON.stringify(e)}function pf(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const ha="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function an(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const hf=ur(()=>{if(Ee.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function mt(e){if(an(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(an(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function lr(e){return mt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function t_(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}const n_=e=>{const t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Bo=new Set(["string","number","symbol"]),mf=new Set(["string","number","bigint","boolean","symbol","undefined"]);function gt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ce(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function I(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 r_(e){let t;return new Proxy({},{get(n,r,o){return t??(t=e()),Reflect.get(t,r,o)},set(n,r,o,s){return t??(t=e()),Reflect.set(t,r,o,s)},has(n,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(n,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,o){return t??(t=e()),Reflect.defineProperty(t,r,o)}})}function ma(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function gf(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}const ga={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]},ya={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function yf(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s={};return Ft(s,e,os(e,t)),ce(e,xe(n,{shape:s,checks:[]}))}function os(e,t){const n=ht(e),r=[];for(const o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&r.push(o)}return r}function _f(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=new Set(os(e,t)),i={};return Ft(i,e,Reflect.ownKeys(ht(e)).filter(a=>!s.has(a))),ce(e,xe(n,{shape:i,checks:[]}))}function bf(e,t){if(!mt(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const o=ht(e);for(const s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ce(e,xe(e._zod.def,{shape:wf(e,t)}))}function wf(e,t){const n={};return Ft(n,e,Reflect.ownKeys(ht(e))),Gy(n,t),n}function vf(e,t){if(!mt(t))throw new Error("Invalid input to safeExtend: expected a plain object");return ce(e,xe(e._zod.def,{shape:wf(e,t)}))}function kf(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n={};Ft(n,e,Reflect.ownKeys(ht(e))),Ft(n,t,Reflect.ownKeys(ht(t)));const r=xe(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ce(e,r)}function Vi(e,t,n,r="partial"){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);const a=n?new Set(os(t,n)):void 0,c={};return Ft(c,t,Reflect.ownKeys(ht(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),ce(t,xe(t._zod.def,{shape:c,checks:[]}))}function $f(e,t,n){const r=n?new Set(os(t,n)):void 0,o={};return Ft(o,t,Reflect.ownKeys(ht(t)),(s,i)=>r&&!r.has(i)?s:new e({type:"nonoptional",innerType:s})),ce(t,xe(t._zod.def,{shape:o}))}function Ne(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Sf(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function He(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function rn(e){return typeof e=="string"?e:e?.message}function qi(e,t,n){var r;for(let o=t;o<e.length;o++)(r=e[o]).schema??(r.schema=n)}function Je(e,t,n){var r;const o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);const s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:rn(e.inst?._zod.def?.error?.(e))??rn(s?.(e))??rn(t?.error?.(e))??rn(n.customError?.(e))??rn(n.localeError?.(e))??"Invalid input",a={};for(const c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=e[c]);return a.path??(a.path=[]),a.message=i,t?.reportInput&&(a.input=e.input),a}function ss(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}const o_=/[\uD800-\uDBFF]/;function dr(e){const t=e.length;if(!o_.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320&&(n--,r++);return n}function is(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function xf(e){const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";const n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function cn(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}function s_(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function If(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function zf(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function i_(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return If(t+n)}function a_(e){return zf(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function c_(e){const t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");const n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=Number.parseInt(t.slice(r,r+2),16);return n}function u_(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}class l_{constructor(...t){}}function Tf(e,t){for(const n in t){const r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):d_(e,n,r.value)}}function yt(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function as(e,t,n){return yt(e,t,n,!1)}function fr(e,t){for(const n in e){const r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return yt(this,n,r(this))},set(o){yt(this,n,o)}})}return t}function d_(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:yt(this,t,n.bind(this))},set(r){yt(this,t,r)}})}function f_(e,t){const n=Object.getPrototypeOf(e);return t in n?void 0:n}let Ti,It=!1;const p_={configurable:!0,get(){It=!0}};function B(e,t,n){const r=Object.getPrototypeOf(e._zod);if(t in r&&Ti!==e._zod){Ti=void 0;return}Ti=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,p_);const o=It;It=!1;try{const s=n(this);return It?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s}),It=It||o,s}catch(s){throw delete this[t],It=It||o,s}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Cf(e,t,n,r){const o=f_(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){const s={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,s),s.value=n(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:s})}})}const _a="~constantCatch";function ba(e){const t=()=>e;return t[_a]=!0,t}const wa=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:ya,CONSTANT_CATCH:_a,Class:l_,NUMBER_FORMAT_RANGES:ga,aborted:Ne,allowsEval:hf,assert:Ky,assertEqual:Vy,assertIs:Hy,assertNever:By,assertNotEqual:qy,assignProp:Fe,attachSchema:qi,base64ToUint8Array:If,base64urlToUint8Array:i_,cached:ur,captureStackTrace:ha,cleanEnum:s_,cleanRegex:Ct,clone:ce,cloneDef:Yy,codePointLength:dr,constantCatch:ba,createTransparentProxy:r_,defineLazy:lf,defineLazyInternal:B,derived:fr,esc:De,escapeRegex:gt,explicitlyAborted:Sf,extend:bf,finalizeIssue:Je,floatSafeRemainder:pa,getElementAtPath:Qy,getEnumValues:qo,getLengthableOrigin:is,getParsedType:n_,getSizableOrigin:ss,hexToUint8Array:c_,hide:as,installLazyProp:Cf,isObject:an,isPlainObject:mt,issue:cn,joinValues:Ui,jsonStringifyReplacer:Ho,members:Tf,merge:kf,mergeDefs:xe,normalizeParams:I,nullish:fa,numKeys:t_,objectClone:Wy,omit:_f,optionalKeys:gf,own:yt,parsedType:xf,partial:Vi,pick:yf,prefixIssues:He,primitiveTypes:mf,promiseAllObject:Xy,propertyKeyTypes:Bo,randomString:e_,rawShape:rs,required:$f,safeExtend:vf,shallowClone:lr,slugify:pf,stringifyPrimitive:ma,toZod:ns,uint8ArrayToBase64:zf,uint8ArrayToBase64url:a_,uint8ArrayToHex:u_,unwrapMessage:rn},Symbol.toStringTag,{value:"Module"}));var Jl;const va=Object.freeze({status:"aborted"}),Ci={value:void 0,enumerable:!1};let Wl="captureStackTrace"in Error?Error:null;function h_(e){const t=Wl;if(t){const n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return Wl=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function y(e,t,n,r){const o={};function s(f){this.def=f,this.constr=d,this.traits=new Set}s.prototype=o;const i=n,a=i&&new WeakSet;function c(f,p){if(f._zod){if(f._zod.traits.has(e))return}else{Ci.value=new s(p);try{Object.defineProperty(f,"_zod",Ci)}finally{Ci.value=void 0}}if(f._zod.traits.add(e),t(f,p),a){const m=Object.getPrototypeOf(f),_=f._zod.constr.prototype;let S=m;for(;S&&S!==_;)S=Object.getPrototypeOf(S);const w=S??m;a.has(w)||(a.add(w),Tf(w,i))}const h=d.prototype;for(const m in h)Object.prototype.hasOwnProperty.call(h,m)&&(m in f||(f[m]=h[m].bind(f)))}const u=r?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function d(f){const p=r?.Parent?h_(l):this;c(p,f);const h=p._zod.deferred;if(h){for(const _ of h)_();p._zod.deferred=void 0}const m=globalThis.__zod_globalConfig?.postProcessor;return m&&m(p),p}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:f=>r?.Parent&&f instanceof r.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}const ka=Symbol("zod_brand");class pt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class cs extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(Jl=globalThis).__zod_globalConfig??(Jl.__zod_globalConfig={});const Ee=globalThis.__zod_globalConfig;function ye(e){return e&&Object.assign(Ee,e),Ee}function m_(){const e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Ho,2)),e.message}function g_(e){this._zod.message=e}const y_={get:m_,set:g_,enumerable:!0,configurable:!0},Ei={value:void 0,enumerable:!1},Gl=new WeakSet([Object.prototype,Error.prototype]),Ef=(e,t)=>{e.name="$ZodError",Ei.value=t,Object.defineProperty(e,"issues",Ei),Ei.value=void 0,Object.defineProperty(e,"message",y_);const n=Object.getPrototypeOf(e);Gl.has(n)||(Gl.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){const r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}}))},Af=y("$ZodError",Ef),Ue=y("$ZodError",Ef,void 0,{Parent:Error});function __(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function us(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?__(n,o.path[0],()=>[]).push(t(o)):r.push(t(o));return{formErrors:r,fieldErrors:n}}function ls(e,t=n=>n.message){const n={_errors:[]},r=(o,s=[])=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>r({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")r({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")r({issues:i.issues},[...s,...i.path]);else{const a=[...s,...i.path];if(a.length===0)n._errors.push(t(i));else{let c=n,u=0;for(;u<a.length;){const l=a[u],d=u===a.length-1;if(l==="_errors"){d&&c._errors.push(t(i)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});const f=c[l];d&&f._errors.push(t(i)),c=f,u++}}}};return r(e),n}function $a(e,t=n=>n.message){const n={errors:[]},r=(o,s=[])=>{var i;for(const a of o.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>r({issues:c},[...s,...a.path]));else if(a.code==="invalid_key")r({issues:a.issues},[...s,...a.path]);else if(a.code==="invalid_element")r({issues:a.issues},[...s,...a.path]);else{const c=[...s,...a.path];if(c.length===0){n.errors.push(t(a));continue}let u=n,l=0;for(;l<c.length;){const d=c[l],f=l===c.length-1;typeof d=="string"?(u.properties??(u.properties={}),Object.prototype.hasOwnProperty.call(u.properties,d)||Object.defineProperty(u.properties,d,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),u=u.properties[d]):(u.items??(u.items=[]),(i=u.items)[d]??(i[d]={errors:[]}),u=u.items[d]),f&&u.errors.push(t(a)),l++}}};return r(e),n}function Nf(e){const t=[],n=e.map(r=>typeof r=="object"?r.key:r);for(const r of n)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function Sa(e){const t=[],n=[...e.issues].sort((r,o)=>(r.path??[]).length-(o.path??[]).length);for(const r of n)t.push(`✖ ${r.message}`),r.path?.length&&t.push(` → at ${Nf(r.path)}`);return t.join(`
|
|
10
|
+
`)}function ds(e,t){return{callee:t?.callee??e,Err:t?.Err}}const pr=e=>{const t=(n,r,o,s)=>{const i=o?{...o,async:!1}:{async:!1},a=n._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new pt;if(a.issues.length){const c=new(s?.Err??e)(a.issues.map(u=>Je(u,i,ye())));throw ha(c,s?.callee??t),c}return a.value};return t},Hi=pr(Ue),hr=e=>{const t=async(n,r,o,s)=>{const i=o?{...o,async:!0}:{async:!0};let a=n._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){const c=new(s?.Err??e)(a.issues.map(u=>Je(u,i,ye())));throw ha(c,s?.callee??t),c}return a.value};return t},Bi=hr(Ue),mr=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new pt;return s.issues.length?Pf(e,s.issues,o):{success:!0,data:s.value}},Of=mr(Ue);function Pf(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(o=>Je(o,n,ye()))),t=void 0,n=void 0),r},set error(o){r=o,t=void 0,n=void 0}}}const gr=e=>async(t,n,r)=>{const o=r?{...r,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?Pf(e,s.issues,o):{success:!0,data:s.value}},b_=gr(Ue),w_=Symbol.for("zod.compile.invalid"),v_=Symbol.for("zod.compile.fallback"),fs=((e,t,n)=>{const r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==w_)return!0;if(r.definite===!0&&n===void 0)return!1}return k_(e,t,n)});function k_(e,t,n){const r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun;let s;if(o?(r[v_]=!0,s=o({value:t,issues:[]},r)):s=e._zod.run({value:t,issues:[]},r),s instanceof Promise)throw new pt;return s.issues.length===0}const ps=async(e,t,n)=>{const r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let o=e._zod.run({value:t,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length===0},xa=e=>{const t=pr(e),n=(r,o,s,i)=>{const a=s?{...s,direction:"backward"}:{direction:"backward"};return t(r,o,a,ds(n,i))};return n},$_=xa(Ue),Ia=e=>{const t=pr(e),n=(r,o,s,i)=>t(r,o,s,ds(n,i));return n},S_=Ia(Ue),za=e=>{const t=hr(e),n=async(r,o,s,i)=>{const a=s?{...s,direction:"backward"}:{direction:"backward"};return await t(r,o,a,ds(n,i))};return n},x_=za(Ue),Ta=e=>{const t=hr(e),n=async(r,o,s,i)=>await t(r,o,s,ds(n,i));return n},I_=Ta(Ue),Ca=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return mr(e)(t,n,o)},z_=Ca(Ue),Ea=e=>(t,n,r)=>mr(e)(t,n,r),T_=Ea(Ue),Aa=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return gr(e)(t,n,o)},C_=Aa(Ue),Na=e=>async(t,n,r)=>gr(e)(t,n,r),E_=Na(Ue),Mf=/^[cC][0-9a-z]{6,}$/,Lf=/^[0-9a-z]+$/,Rf=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Df=/^[0-9a-vA-V]{20}$/,Zf=/^[A-Za-z0-9]{27}$/,jf=/^[a-zA-Z0-9_-]{21}$/;function Ff(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const Uf=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,A_=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Vf=/^([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})$/,un=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,N_=un(4),O_=un(6),P_=un(7),qf=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,M_=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,L_=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Hf=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,R_=Hf,D_=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Z_="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Bf(){return new RegExp(Z_,"u")}const Kf=/^(?:(?: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])$/,Jf=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Wf=e=>{const t=gt(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Gf=/^((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])$/,Yf=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Qf=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Xf=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,ep=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,tp=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,Oa=/^https?$/,np=/^\+[1-9]\d{6,14}$/,Pa=/^\d(?:[ -]?\d){11,18}$/,rp=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,Ma=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,op="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function j_(e){return new RegExp(`^${e}$`)}const sp=j_(op);function Ki(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}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ip(e){return new RegExp(`^${Ki(e)}$`)}function ap(e){const t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${Ki({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${Ki({precision:e.precision})}`:n;return new RegExp(`^${op}T(?:${r})$`)}const cp=/^[\s\S]{0,}$/,up=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},lp=/^-?\d+n?$/,La=/^-?\d+$/,bn=/^-?\d+(?:\.\d+)?$/,dp=/^(?:true|false)$/i,fp=/^null$/i,pp=/^undefined$/i,hp=/^[^A-Z]*$/,mp=/^[^a-z]*$/,gp=/^[0-9a-fA-F]*$/;function yr(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function _r(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}const F_=/^[0-9a-fA-F]{32}$/,U_=yr(22,"=="),V_=_r(22),q_=/^[0-9a-fA-F]{40}$/,H_=yr(27,"="),B_=_r(27),K_=/^[0-9a-fA-F]{64}$/,J_=yr(43,"="),W_=_r(43),G_=/^[0-9a-fA-F]{96}$/,Y_=yr(64,""),Q_=_r(64),X_=/^[0-9a-fA-F]{128}$/,eb=yr(86,"=="),tb=_r(86),hs=Object.freeze(Object.defineProperty({__proto__:null,anyString:cp,base64:Qf,base64url:Xf,bigint:lp,boolean:dp,browserEmail:D_,cidrv4:Gf,cidrv6:Yf,creditCard:Pa,cuid:Mf,cuid2:Lf,currencyCode:rp,date:sp,datetime:ap,domain:tp,duration:Uf,e164:np,email:qf,emoji:Bf,extendedDuration:A_,guid:Vf,hex:gp,hostname:ep,html5Email:M_,httpProtocol:Oa,iban:Ma,idnEmail:R_,integer:La,ipv4:Kf,ipv6:Jf,ksuid:Zf,lowercase:hp,mac:Wf,md5_base64:U_,md5_base64url:V_,md5_hex:F_,nanoid:jf,nanoidOfLength:Ff,null:fp,number:bn,rfc5322Email:L_,sha1_base64:H_,sha1_base64url:B_,sha1_hex:q_,sha256_base64:J_,sha256_base64url:W_,sha256_hex:K_,sha384_base64:Y_,sha384_base64url:Q_,sha384_hex:G_,sha512_base64:eb,sha512_base64url:tb,sha512_hex:X_,string:up,time:ip,ulid:Rf,undefined:pp,unicodeEmail:Hf,uppercase:mp,uuid:un,uuid4:N_,uuid6:O_,uuid7:P_,xid:Df},Symbol.toStringTag,{value:"Module"})),ue=y("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ra=e=>{const t=e.value;return!fa(t)&&t.size!==void 0},Da=e=>{const t=e.value;return!fa(t)&&t.length!==void 0},Ko={number:"number",bigint:"bigint",object:"date"},Za=y("$ZodCheckLessThan",(e,t)=>{ue.init(e,t);const n=Ko[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Ko[typeof r.value]??n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ja=y("$ZodCheckGreaterThan",(e,t)=>{ue.init(e,t);const n=Ko[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Ko[typeof r.value]??n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yp=y("$ZodCheckMultipleOf",(e,t)=>{ue.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):pa(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),_p=y("$ZodCheckNumberFormat",(e,t)=>{ue.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,s]=ga[t.format];e._zod.check=i=>{const a=i.value;if(n){if(!Number.isInteger(a)){i.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,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:r,inclusive:!0,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:r,inclusive:!0,continue:!t.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),bp=y("$ZodCheckBigIntFormat",(e,t)=>{ue.init(e,t);const[n,r]=ya[t.format];e._zod.check=o=>{const s=o.value;s<n&&o.issues.push({origin:"bigint",input:s,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),s>r&&o.issues.push({origin:"bigint",input:s,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),wp=y("$ZodCheckMaxSize",(e,t)=>{var n;ue.init(e,t),(n=e._zod.def).when??(n.when=Ra),e._zod.check=r=>{const o=r.value;o.size<=t.maximum||r.issues.push({origin:ss(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),vp=y("$ZodCheckMinSize",(e,t)=>{var n;ue.init(e,t),(n=e._zod.def).when??(n.when=Ra),e._zod.check=r=>{const o=r.value;o.size>=t.minimum||r.issues.push({origin:ss(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),kp=y("$ZodCheckSizeEquals",(e,t)=>{var n;ue.init(e,t),(n=e._zod.def).when??(n.when=Ra),e._zod.check=r=>{const o=r.value,s=o.size;if(s===t.size)return;const i=s>t.size;r.issues.push({origin:ss(o),...i?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),$p=y("$ZodCheckMaxLength",(e,t)=>{var n;ue.init(e,t),(n=e._zod.def).when??(n.when=Da),e._zod.check=r=>{const o=r.value,s=o.length;if((typeof o=="string"&&s>t.maximum?dr(o):s)<=t.maximum)return;const a=is(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Sp=y("$ZodCheckMinLength",(e,t)=>{var n;ue.init(e,t),(n=e._zod.def).when??(n.when=Da),e._zod.check=r=>{const o=r.value,s=o.length;if((typeof o=="string"&&s>=t.minimum&&s<t.minimum*2?dr(o):s)>=t.minimum)return;const a=is(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),xp=y("$ZodCheckLengthEquals",(e,t)=>{var n;ue.init(e,t),(n=e._zod.def).when??(n.when=Da),e._zod.check=r=>{const o=r.value,s=o.length,i=typeof o=="string"&&s>=t.length&&s<=t.length*2?dr(o):s;if(i===t.length)return;const a=is(o),c=i>t.length;r.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),br=y("$ZodCheckStringFormat",(e,t)=>{var n,r;ue.init(e,t),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ip=y("$ZodCheckRegex",(e,t)=>{br.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),zp=y("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=hp),br.init(e,t)}),Tp=y("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=mp),br.init(e,t)}),Cp=y("$ZodCheckIncludes",(e,t)=>{ue.init(e,t);const n=gt(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Ep=y("$ZodCheckStartsWith",(e,t)=>{ue.init(e,t);const n=new RegExp(`^${gt(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Ap=y("$ZodCheckEndsWith",(e,t)=>{ue.init(e,t);const n=new RegExp(`.*${gt(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});function Jo(e,t,n){e.issues.length&&t.issues.push(...He(n,e.issues))}const Np=y("$ZodCheckProperty",(e,t)=>{ue.init(e,t),e._zod.check=n=>{const r=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(r instanceof Promise)return r.then(o=>Jo(o,n,t.property));Jo(r,n,t.property)}}),Op=y("$ZodCheckProperties",(e,t)=>{ue.init(e,t),as(e,Symbol.iterator,function*(){yield e});let n;e._zod.check=r=>{if(r.value==null){r.issues.push({expected:"object",code:"invalid_type",input:r.value,inst:e});return}n??(n=Reflect.ownKeys(t.shape).map(i=>[i,t.shape[i]]));const o=r.value;let s;for(const[i,a]of n){const c=a._zod.run({value:o[i],issues:[]},{});c instanceof Promise?(s??(s=[]),s.push(c.then(u=>Jo(u,r,i)))):Jo(c,r,i)}if(s)return Promise.all(s).then(()=>{})}}),Pp=y("$ZodCheckMimeType",(e,t)=>{ue.init(e,t);const n=new Set(t.mime);e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:"invalid_value",values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),Mp=y("$ZodCheckOverwrite",(e,t)=>{ue.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Fa{constructor(t=[],n={}){this.content=[],this.indent=0,this.args=t,this.closed=n}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
11
|
+
`).filter(i=>i),o=Math.min(...r.map(i=>i.length-i.trimStart().length)),s=r.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,n=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
12
12
|
${n.join(`
|
|
13
13
|
`)}
|
|
14
|
-
};`)(...Object.values(this.closed))}}const Ip={major:4,minor:6,patch:5},D=g("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ip;const r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(const i of o)for(const s of i._zod.onattach)s(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const i=(a,c,u)=>{if(a.memo)return a;let l=Ae(a),d;for(const f of c){if(f._zod.def.when){if(pf(a)||!f._zod.def.when(a))continue}else if(l)continue;const p=a.issues.length,h=f._zod.check(a);if(h instanceof Promise&&u?.async===!1)throw new st;if(d||h instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await h,a.issues.length!==p&&(Ss(a.issues,p,e),l||(l=Ae(a,p)))});else{if(a.issues.length===p)continue;Ss(a.issues,p,e),l||(l=Ae(a,p))}}return d?d.then(()=>a):a},s=(a,c,u)=>{if(Ae(a))return a.aborted=!0,a;const l=i(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new st;return l.then(d=>e._zod.parse(d,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){const l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return l instanceof Promise?l.then(d=>s(d,a,c)):s(l,a,c)}const u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new st;return u.then(l=>i(l,o,c))}return i(u,o,c)}}},{get"~standard"(){return Vo(this,"~standard",ka(this))},set"~standard"(e){lt(this,"~standard",e)}}),xp=(e,t)=>e.issues.length?{issues:e.issues.map(n=>Be(n,t,me()))}:{value:e.value};async function J_(e,t){const n={async:!0};return xp(await e._zod.run({value:t,issues:[]},n),n)}function ka(e){return{validate:t=>{const n={async:!1};try{const r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return xp(r,n)}catch{}return J_(e,t)},vendor:"zod",version:1}}const cr=g("$ZodString",(e,t)=>{D.init(e,t),e._zod.pattern=t.pattern??Yf,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),ne=g("$ZodStringFormat",(e,t)=>{ar.init(e,t),cr.init(e,t)}),zp=g("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Nf),ne.init(e,t)}),Tp=g("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Xt(r))}else t.pattern??(t.pattern=Xt());ne.init(e,t)}),Ep=g("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Of),ne.init(e,t)}),$a=1,Vn=2;function Sa(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Ia(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?Sa(e)||Vn:Cp(e,t)}function Cp(e,t){if(!t.normalize&&t.protocol?.source===pa.source&&!/^https?:\/\//i.test(e))return $a;try{if(typeof URL<"u"){const n=URL;if(typeof n.parse=="function")return n.parse(e)??Vn}return new URL(e)}catch{return Vn}}const W_=/[\t\n\r]/g;function Ao(e){return e.replace(W_,"")}function xa(e,t){return t.lastIndex=0,t.test(e.hostname)}function za(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}const Ap=g("$ZodURL",(e,t)=>{ne.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=Ia(r,t);if(o===$a){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(o===Vn){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(o===!0){n.value=Ao(r);return}t.hostname&&!xa(o,t.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!za(o,t.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?o.href:Ao(r);return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Np=g("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Mf()),ne.init(e,t)}),Op=g("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?Ef:Cf(t.length)),ne.init(e,t)}),Pp=g("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Sf),ne.init(e,t)}),Mp=g("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=If),ne.init(e,t)}),Rp=g("$ZodULID",(e,t)=>{t.pattern??(t.pattern=xf),ne.init(e,t)}),Lp=g("$ZodXID",(e,t)=>{t.pattern??(t.pattern=zf),ne.init(e,t)}),Dp=g("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Tf),ne.init(e,t)}),Zp=g("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Gf(t)),ne.init(e,t)}),jp=g("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Jf),ne.init(e,t)}),Fp=g("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Wf(t)),ne.init(e,t)}),Up=g("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Af),ne.init(e,t)}),Vp=g("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Rf),ne.init(e,t)}),G_=/^[0-9a-fA-F:.]+$/;function Yo(e){return G_.test(e)?Sa(`http://[${e}]`):!1}const qp=g("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Lf),ne.init(e,t),e._zod.check=n=>{Yo(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),Hp=g("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Df(t.delimiter)),ne.init(e,t)}),Bp=g("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Zf),ne.init(e,t)});function Ta(e){const t=e.split("/");if(t.length!==2)return!1;const[n,r]=t;if(!r)return!1;const o=Number(r);return`${o}`!==r||o<0||o>128?!1:Yo(n)}const Kp=g("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=jf),ne.init(e,t),e._zod.check=n=>{Ta(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function Qo(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Ea=/^[0-9a-zA-Z+/]*={0,2}$/,Jp=g("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ea),ne.init(e,t),e._zod.check=n=>{Qo(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),Xo=/^[A-Za-z0-9_-]*$/;function Ca(e){if(!Xo.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Qo(n)}const Wp=g("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Xo),ne.init(e,t),e._zod.check=n=>{Ca(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Gp=g("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Hf),ne.init(e,t)}),Y_=/[- ]/g;function Q_(e){let t=e.length,n=1,r=0;for(;t;){const o=e.charCodeAt(--t)-48;n^=1,r+=n?[0,2,4,6,8,1,3,5,7,9][o]:o}return r%10===0}function Aa(e){return ha.test(e)?Q_(e.replace(Y_,"")):!1}const Yp=g("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=ha),ne.init(e,t),e._zod.check=n=>{Aa(n.value)||n.issues.push({code:"invalid_format",format:"credit_card",input:n.value,inst:e,continue:!t.abort})}});function X_(e){let t=0;const n=e.length;for(let r=4;r<n;r++){const o=e.charCodeAt(r);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}for(let r=0;r<4;r++){const o=e.charCodeAt(r);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}return t===1}function Na(e){return ma.test(e)?X_(e):!1}const Qp=g("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=ma),ne.init(e,t),e._zod.check=n=>{Na(n.value)||n.issues.push({code:"invalid_format",format:"iban",input:n.value,inst:e,continue:!t.abort})}});function Oa(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const Xp=g("$ZodJWT",(e,t)=>{ne.init(e,t),e._zod.check=n=>{Oa(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),eh=g("$ZodCustomStringFormat",(e,t)=>{ne.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),Pa=g("$ZodNumber",(e,t)=>{D.init(e,t),e._zod.pattern=ln,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),th=g("$ZodNumberFormat",(e,t)=>{ap.init(e,t),Pa.init(e,t)}),Ma=g("$ZodBoolean",(e,t)=>{D.init(e,t),e._zod.pattern=ep,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),Ra=g("$ZodBigInt",(e,t)=>{D.init(e,t),e._zod.pattern=Xf,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),nh=g("$ZodBigIntFormat",(e,t)=>{cp.init(e,t),Ra.init(e,t)}),rh=g("$ZodSymbol",(e,t)=>{D.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;return typeof o=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),n}}),oh=g("$ZodUndefined",(e,t)=>{D.init(e,t),e._zod.pattern=np,e._zod.values=new Set([void 0]),e._zod.parse=(n,r)=>{const o=n.value;return typeof o>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),n}}),ih=g("$ZodNull",(e,t)=>{D.init(e,t),e._zod.pattern=tp,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{const o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),sh=g("$ZodAny",(e,t)=>{D.init(e,t),e._zod.parse=n=>n}),ah=g("$ZodUnknown",(e,t)=>{D.init(e,t),e._zod.parse=n=>n}),ch=g("$ZodNever",(e,t)=>{D.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),uh=g("$ZodVoid",(e,t)=>{D.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;return typeof o>"u"||n.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),n}}),lh=g("$ZodDate",(e,t)=>{D.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}const o=n.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),n}});function Fl(e,t,n){e.issues.length&&t.issues.push(...qe(n,e.issues)),t.value[n]=e.value}const dh=g("$ZodArray",(e,t)=>{D.init(e,t);const n=Ee.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{const i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=n?n.alloc(e,r,Array(i.length),o):Array(i.length);const s=[],a=o?.abortEarly;for(let c=0;c<i.length;c++){const u=i[c],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)s.push(l.then(d=>Fl(d,r,c)));else if(Fl(l,r,c),a&&l.issues.length!==0&&Ae(l))break}return s.length?Promise.all(s).then(()=>r):r}});function No(e,t,n,r,o,i){const s=n in r,a=i==="optional";if(!(!s&&a&&o==="optional")){if(e.issues.length){if(o!==void 0&&a&&!s)return;t.issues.push(...qe(n,e.issues))}if(!s&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?(s||o==="defaulted"&&!a)&&(t.value[n]=void 0):t.value[n]=e.value}}const eb=[];function fh(e){const t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:eb,o=r.length?[...t,...r]:t;for(const s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(s)}": expected a Zod schema`);const i=of(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function ph(e,t,n,r,o,i,s){const a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,d=u.optin,f=u.optout;let p=0;for(const h in t){if(s&&n.issues.length!==p){if(Ae(n,p))break;p=n.issues.length}if(c.has(h))continue;if(h==="__proto__"){l==="never"&&a.push(h);continue}if(l==="never"){a.push(h);continue}const m=u.run({value:t[h],issues:[]},r);m instanceof Promise?e.push(m.then(y=>No(y,n,h,t,d,f))):No(m,n,h,t,d,f)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const hh=g("$ZodObject",(e,t)=>{D.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){const u=()=>{const l={...r};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=r,Object.defineProperty(t,"shape",{get:u})}const o=Yn(()=>fh(t));U(e,"propValues",u=>{const l=u.def.shape,d={};for(const f in l){const p=l[f]._zod;if(p.values){Object.prototype.hasOwnProperty.call(d,f)||Fe(d,f,new Set);for(const h of p.values)d[f].add(h);p.optin!==void 0&&d[f].add(void 0)}}return d});const i=Yt,s=t.catchall;let a;const c=Ee.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=o.value);const d=u.value;if(!i(d))return u.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};const f=[],p=a.shape,h=l?.abortEarly;let m=u.issues.length;for(const y of a.allKeys){if(h&&u.issues.length!==m){if(Ae(u,m))break;m=u.issues.length}if(y==="__proto__")continue;const $=p[y],w=$._zod.optin,S=$._zod.optout,T=$._zod.run({value:d[y],issues:[]},l);T instanceof Promise?f.push(T.then(O=>No(O,u,y,d,w,S))):No(T,u,y,d,w,S)}return s?ph(f,d,u,l,o.value,e,h===!0):f.length?Promise.all(f).then(()=>u):u}}),mh=g("$ZodObjectJIT",(e,t)=>{hh.init(e,t);const n=e._zod.parse,r=Yn(()=>fh(t)),o=Ee.memoizer,i=p=>{const h=r.value,m=h.symbolKeys,y=new va(["payload","ctx"],{shape:p,inst:e,memo:o,syms:m}),$=O=>`shape[${O}]._zod.run({ value: input[${O}], issues: [] }, ctx)`,w=(O,C)=>`
|
|
15
|
-
let ${
|
|
16
|
-
for (let i = 0; i < ${
|
|
17
|
-
const iss = ${
|
|
18
|
-
iss.path = iss.path ? [${
|
|
14
|
+
};`)(...Object.values(this.closed))}}const Lp={major:4,minor:6,patch:5},j=y("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Lp;const r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(const s of o)for(const i of s._zod.onattach)i(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const s=(a,c,u)=>{if(a.memo)return a;let l=Ne(a),d;for(const f of c){if(f._zod.def.when){if(Sf(a)||!f._zod.def.when(a))continue}else if(l)continue;const p=a.issues.length,h=f._zod.check(a);if(h instanceof Promise&&u?.async===!1)throw new pt;if(d||h instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await h,a.issues.length!==p&&(qi(a.issues,p,e),l||(l=Ne(a,p)))});else{if(a.issues.length===p)continue;qi(a.issues,p,e),l||(l=Ne(a,p))}}return d?d.then(()=>a):a},i=(a,c,u)=>{if(Ne(a))return a.aborted=!0,a;const l=s(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new pt;return l.then(d=>e._zod.parse(d,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){const l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return l instanceof Promise?l.then(d=>i(d,a,c)):i(l,a,c)}const u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new pt;return u.then(l=>s(l,o,c))}return s(u,o,c)}}},{get"~standard"(){return as(this,"~standard",Ua(this))},set"~standard"(e){yt(this,"~standard",e)}}),Rp=(e,t)=>e.issues.length?{issues:e.issues.map(n=>Je(n,t,ye()))}:{value:e.value};async function nb(e,t){const n={async:!0};return Rp(await e._zod.run({value:t,issues:[]},n),n)}function Ua(e){return{validate:t=>{const n={async:!1};try{const r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Rp(r,n)}catch{}return nb(e,t)},vendor:"zod",version:1}}const wr=y("$ZodString",(e,t)=>{j.init(e,t),e._zod.pattern=t.pattern??cp,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),re=y("$ZodStringFormat",(e,t)=>{br.init(e,t),wr.init(e,t)}),Dp=y("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Vf),re.init(e,t)}),Zp=y("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=un(r))}else t.pattern??(t.pattern=un());re.init(e,t)}),jp=y("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=qf),re.init(e,t)}),Va=1,er=2;function qa(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Ha(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?qa(e)||er:Fp(e,t)}function Fp(e,t){if(!t.normalize&&t.protocol?.source===Oa.source&&!/^https?:\/\//i.test(e))return Va;try{if(typeof URL<"u"){const n=URL;if(typeof n.parse=="function")return n.parse(e)??er}return new URL(e)}catch{return er}}const rb=/[\t\n\r]/g;function Wo(e){return e.replace(rb,"")}function Ba(e,t){return t.lastIndex=0,t.test(e.hostname)}function Ka(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}const Up=y("$ZodURL",(e,t)=>{re.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=Ha(r,t);if(o===Va){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(o===er){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(o===!0){n.value=Wo(r);return}t.hostname&&!Ba(o,t.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Ka(o,t.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?o.href:Wo(r);return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Vp=y("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Bf()),re.init(e,t)}),qp=y("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?jf:Ff(t.length)),re.init(e,t)}),Hp=y("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Mf),re.init(e,t)}),Bp=y("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Lf),re.init(e,t)}),Kp=y("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Rf),re.init(e,t)}),Jp=y("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Df),re.init(e,t)}),Wp=y("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Zf),re.init(e,t)}),Gp=y("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=ap(t)),re.init(e,t)}),Yp=y("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=sp),re.init(e,t)}),Qp=y("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ip(t)),re.init(e,t)}),Xp=y("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Uf),re.init(e,t)}),eh=y("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Kf),re.init(e,t)}),ob=/^[0-9a-fA-F:.]+$/;function ms(e){return ob.test(e)?qa(`http://[${e}]`):!1}const th=y("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Jf),re.init(e,t),e._zod.check=n=>{ms(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),nh=y("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Wf(t.delimiter)),re.init(e,t)}),rh=y("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Gf),re.init(e,t)});function Ja(e){const t=e.split("/");if(t.length!==2)return!1;const[n,r]=t;if(!r)return!1;const o=Number(r);return`${o}`!==r||o<0||o>128?!1:ms(n)}const oh=y("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Yf),re.init(e,t),e._zod.check=n=>{Ja(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function gs(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Wa=/^[0-9a-zA-Z+/]*={0,2}$/,sh=y("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Wa),re.init(e,t),e._zod.check=n=>{gs(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),ys=/^[A-Za-z0-9_-]*$/;function Ga(e){if(!ys.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return gs(n)}const ih=y("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ys),re.init(e,t),e._zod.check=n=>{Ga(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),ah=y("$ZodE164",(e,t)=>{t.pattern??(t.pattern=np),re.init(e,t)}),sb=/[- ]/g;function ib(e){let t=e.length,n=1,r=0;for(;t;){const o=e.charCodeAt(--t)-48;n^=1,r+=n?[0,2,4,6,8,1,3,5,7,9][o]:o}return r%10===0}function Ya(e){return Pa.test(e)?ib(e.replace(sb,"")):!1}const ch=y("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=Pa),re.init(e,t),e._zod.check=n=>{Ya(n.value)||n.issues.push({code:"invalid_format",format:"credit_card",input:n.value,inst:e,continue:!t.abort})}});function ab(e){let t=0;const n=e.length;for(let r=4;r<n;r++){const o=e.charCodeAt(r);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}for(let r=0;r<4;r++){const o=e.charCodeAt(r);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}return t===1}function Qa(e){return Ma.test(e)?ab(e):!1}const uh=y("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=Ma),re.init(e,t),e._zod.check=n=>{Qa(n.value)||n.issues.push({code:"invalid_format",format:"iban",input:n.value,inst:e,continue:!t.abort})}});function Xa(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const lh=y("$ZodJWT",(e,t)=>{re.init(e,t),e._zod.check=n=>{Xa(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),dh=y("$ZodCustomStringFormat",(e,t)=>{re.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),ec=y("$ZodNumber",(e,t)=>{j.init(e,t),e._zod.pattern=bn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),n}}),fh=y("$ZodNumberFormat",(e,t)=>{_p.init(e,t),ec.init(e,t)}),tc=y("$ZodBoolean",(e,t)=>{j.init(e,t),e._zod.pattern=dp,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),nc=y("$ZodBigInt",(e,t)=>{j.init(e,t),e._zod.pattern=lp,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),ph=y("$ZodBigIntFormat",(e,t)=>{bp.init(e,t),nc.init(e,t)}),hh=y("$ZodSymbol",(e,t)=>{j.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;return typeof o=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),n}}),mh=y("$ZodUndefined",(e,t)=>{j.init(e,t),e._zod.pattern=pp,e._zod.values=new Set([void 0]),e._zod.parse=(n,r)=>{const o=n.value;return typeof o>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),n}}),gh=y("$ZodNull",(e,t)=>{j.init(e,t),e._zod.pattern=fp,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{const o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),yh=y("$ZodAny",(e,t)=>{j.init(e,t),e._zod.parse=n=>n}),_h=y("$ZodUnknown",(e,t)=>{j.init(e,t),e._zod.parse=n=>n}),bh=y("$ZodNever",(e,t)=>{j.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),wh=y("$ZodVoid",(e,t)=>{j.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;return typeof o>"u"||n.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),n}}),vh=y("$ZodDate",(e,t)=>{j.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}const o=n.value,s=o instanceof Date;return s&&!Number.isNaN(o.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:o,...s?{received:"Invalid Date"}:{},inst:e}),n}});function Yl(e,t,n){e.issues.length&&t.issues.push(...He(n,e.issues)),t.value[n]=e.value}const kh=y("$ZodArray",(e,t)=>{j.init(e,t);const n=Ee.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=n?n.alloc(e,r,Array(s.length),o):Array(s.length);const i=[],a=o?.abortEarly;for(let c=0;c<s.length;c++){const u=s[c],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)i.push(l.then(d=>Yl(d,r,c)));else if(Yl(l,r,c),a&&l.issues.length!==0&&Ne(l))break}return i.length?Promise.all(i).then(()=>r):r}});function Go(e,t,n,r,o,s){const i=n in r,a=s==="optional";if(!(!i&&a&&o==="optional")){if(e.issues.length){if(o!==void 0&&a&&!i)return;t.issues.push(...He(n,e.issues))}if(!i&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?(i||o==="defaulted"&&!a)&&(t.value[n]=void 0):t.value[n]=e.value}}const cb=[];function $h(e){const t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:cb,o=r.length?[...t,...r]:t;for(const i of o)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(i)}": expected a Zod schema`);const s=gf(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function Sh(e,t,n,r,o,s,i){const a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,d=u.optin,f=u.optout;let p=0;for(const h in t){if(i&&n.issues.length!==p){if(Ne(n,p))break;p=n.issues.length}if(c.has(h))continue;if(h==="__proto__"){l==="never"&&a.push(h);continue}if(l==="never"){a.push(h);continue}const m=u.run({value:t[h],issues:[]},r);m instanceof Promise?e.push(m.then(_=>Go(_,n,h,t,d,f))):Go(m,n,h,t,d,f)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const xh=y("$ZodObject",(e,t)=>{j.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){const u=()=>{const l={...r};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=r,Object.defineProperty(t,"shape",{get:u})}const o=ur(()=>$h(t));B(e,"propValues",u=>{const l=u.def.shape,d={};for(const f in l){const p=l[f]._zod;if(p.values){Object.prototype.hasOwnProperty.call(d,f)||Fe(d,f,new Set);for(const h of p.values)d[f].add(h);p.optin!==void 0&&d[f].add(void 0)}}return d});const s=an,i=t.catchall;let a;const c=Ee.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=o.value);const d=u.value;if(!s(d))return u.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};const f=[],p=a.shape,h=l?.abortEarly;let m=u.issues.length;for(const _ of a.allKeys){if(h&&u.issues.length!==m){if(Ne(u,m))break;m=u.issues.length}if(_==="__proto__")continue;const S=p[_],w=S._zod.optin,x=S._zod.optout,C=S._zod.run({value:d[_],issues:[]},l);C instanceof Promise?f.push(C.then(R=>Go(R,u,_,d,w,x))):Go(C,u,_,d,w,x)}return i?Sh(f,d,u,l,o.value,e,h===!0):f.length?Promise.all(f).then(()=>u):u}}),Ih=y("$ZodObjectJIT",(e,t)=>{xh.init(e,t);const n=e._zod.parse,r=ur(()=>$h(t)),o=Ee.memoizer,s=p=>{const h=r.value,m=h.symbolKeys,_=new Fa(["payload","ctx"],{shape:p,inst:e,memo:o,syms:m}),S=R=>`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`,w=(R,O)=>`
|
|
15
|
+
let ${R}_ab = false;
|
|
16
|
+
for (let i = 0; i < ${R}.issues.length; i++) {
|
|
17
|
+
const iss = ${R}.issues[i];
|
|
18
|
+
iss.path = iss.path ? [${O}, ...iss.path] : [${O}];
|
|
19
19
|
payload.issues.push(iss);
|
|
20
|
-
if (iss.continue !== true) ${
|
|
20
|
+
if (iss.continue !== true) ${R}_ab = true;
|
|
21
21
|
}
|
|
22
|
-
if (${
|
|
22
|
+
if (${R}_ab && ctx && ctx.abortEarly) {
|
|
23
23
|
payload.value = newResult;
|
|
24
24
|
return payload;
|
|
25
|
-
}`;
|
|
26
|
-
const ${
|
|
27
|
-
if (!${
|
|
28
|
-
if (${
|
|
25
|
+
}`;_.write("const input = payload.value;");const x=Object.create(null);let C=0;for(const R of h.allKeys)x[R]=`key_${C++}`;_.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(const R of h.allKeys){if(R==="__proto__")continue;const O=x[R],F=typeof R=="symbol"?`syms[${m.indexOf(R)}]`:De(R),oe=`${F} in input`,le=p[R],te=le?._zod?.optin,ie=te!==void 0,qe=le?._zod?.optout==="optional";if(_.write(`const ${O} = ${S(F)};`),ie&&qe){const Pe=te==="optional"?`${O}_present`:`${O}.value !== undefined || ${O}_present`;_.write(`
|
|
26
|
+
const ${O}_present = ${oe};
|
|
27
|
+
if (!${O}.issues.length || ${O}_present) {
|
|
28
|
+
if (${O}.issues.length) {${w(O,F)}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
if (${
|
|
32
|
-
newResult[${
|
|
31
|
+
if (${Pe}) {
|
|
32
|
+
newResult[${F}] = ${O}.value;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
`)}else
|
|
37
|
-
if (${
|
|
36
|
+
`)}else ie?(_.write(`
|
|
37
|
+
if (${O}.issues.length) {${w(O,F)}
|
|
38
38
|
}
|
|
39
|
-
`),
|
|
40
|
-
if (${
|
|
41
|
-
newResult[${
|
|
39
|
+
`),te==="defaulted"?_.write(`newResult[${F}] = ${O}.value;`):_.write(`
|
|
40
|
+
if (${O}.value !== undefined || ${oe}) {
|
|
41
|
+
newResult[${F}] = ${O}.value;
|
|
42
42
|
}
|
|
43
|
-
`)):
|
|
44
|
-
const ${
|
|
45
|
-
if (${
|
|
43
|
+
`)):_.write(`
|
|
44
|
+
const ${O}_present = ${oe};
|
|
45
|
+
if (${O}.issues.length) {${w(O,F)}
|
|
46
46
|
}
|
|
47
|
-
if (!${
|
|
47
|
+
if (!${O}_present && !${O}.issues.length) {
|
|
48
48
|
payload.issues.push({
|
|
49
49
|
code: "invalid_type",
|
|
50
50
|
expected: "nonoptional",
|
|
51
51
|
input: undefined,
|
|
52
|
-
path: [${
|
|
52
|
+
path: [${F}]
|
|
53
53
|
});
|
|
54
54
|
if (ctx && ctx.abortEarly) {
|
|
55
55
|
payload.value = newResult;
|
|
@@ -57,23 +57,23 @@ ${n.join(`
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
if (${
|
|
61
|
-
newResult[${
|
|
60
|
+
if (${O}_present) {
|
|
61
|
+
newResult[${F}] = ${O}.value;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
`)}return y.write("payload.value = newResult;"),y.write("return payload;"),y.compile()};let s;const a=Yt,c=!Ee.jitless,l=c&&nf.value,d=t.catchall;let f;e._zod.parse=(p,h)=>{f??(f=r.value);const m=p.value;return a(m)?c&&l&&h?.async===!1&&h.jitless!==!0?(s||(s=i(t.shape)),p=s(p,h),d?ph([],m,p,h,f,e,h?.abortEarly===!0):p):n(p,h):(p.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),p)}});function Ul(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!Ae(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>Be(s,r,me())))}),t)}const ei=g("$ZodUnion",(e,t)=>{D.init(e,t),U(e,"optin",r=>r.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),U(e,"optout",r=>r.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),U(e,"values",r=>{if(r.def.options.every(o=>o._zod.values))return new Set(r.def.options.flatMap(o=>Array.from(o._zod.values)))}),U(e,"pattern",r=>{if(r.def.options.every(o=>o._zod.pattern)){const o=r.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>vt(i.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1;const s=[];for(const a of t.options){const c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}return i?Promise.all(s).then(a=>Ul(a,r,e,o)):Ul(s,r,e,o)}});function Vl(e,t,n,r){const o=[];for(let i=0;i<e.length;i++)e[i].issues.length===0&&o.push(i);return o.length===1?(t.value=e[o[0]].value,t):(o.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>Be(s,r,me())))}):t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1,matches:o}),t)}const gh=g("$ZodXor",(e,t)=>{ei.init(e,t),t.inclusive=!1;const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1;const s=[];for(const a of t.options){const c=a._zod.run({value:r.value,issues:[]},o);c instanceof Promise?(s.push(c),i=!0):s.push(c)}return i?Promise.all(s).then(a=>Vl(a,r,e,o)):Vl(s,r,e,o)}});function La(e,t){const n=e._zod;let r=n.bag.optionsMap;r||(r=yh(n.def),n.bag.optionsMap=r);const o=r.get(t);if(o===null)throw new Error(`Ambiguous discriminator value "${String(t)}"`);return o}function yh(e){const t=new Map;for(const n of e.options){const r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(const o of r)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,n)}return t}const _h=g("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ei.init(e,t);const n=e._zod.parse;U(e,"propValues",o=>{const i={};let s=0;for(const a of o.def.options){const c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);c[o.def.discriminator]?.has(void 0)&&s++;for(const[u,l]of Object.entries(c)){Object.prototype.hasOwnProperty.call(i,u)||Fe(i,u,new Set);for(const d of l)i[u].add(d)}}return!o.def.unionFallback&&s>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{const s=Zo(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});const r=Yn(()=>yh(t));e._zod.parse=(o,i)=>{const s=o.value;if(!Yt(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;const a=s?.[t.discriminator],c=r.value.get(a);return c&&(a!==void 0||i.direction!=="backward")?c._zod.run(o,i):t.unionFallback||i.direction==="backward"?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(u=>r.value.get(u)!==null),input:s,path:[t.discriminator],inst:e}),o)}}),bh=g("$ZodIntersection",(e,t)=>{D.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>ql(n,c,u)):ql(n,i,s)}});function qn(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(ct(e)&&ct(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(const i of r){if(i==="__proto__")continue;const s=qn(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],s=qn(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function ql(e,t,n){const r=new Map;let o;const i=new Map,s=(u,l)=>{let d;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),d=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){const f=String(u.path[0]);i.has(f)||i.set(f,u),d=[f]}else return!1;for(const f of d)r.has(f)||r.set(f,{}),r.get(f)[l]=!0;return!0};for(const u of t.issues)s(u,"l")||e.issues.push(u);for(const u of n.issues)s(u,"r")||e.issues.push(u);const a=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){const u=o?a.filter(l=>o.keys.includes(l)):[];u.length&&e.issues.push({...o,keys:u});for(const l of a)!u.includes(l)&&i.has(l)&&e.issues.push(i.get(l))}const c=qn(t.value,n.value);if(!c.valid){if(Ae(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}const Da=g("$ZodTuple",(e,t)=>{D.init(e,t);const n=t.items,r=Ee.memoizer;r?.attach(e),e._zod.parse=(o,i)=>{const s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=r?r.alloc(e,o,[],i):[];const a=[],c=Hl(n,"optin"),u=Hl(n,"optout");if(!t.rest){if(s.length<c)return o.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),o;s.length>n.length&&o.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:s,inst:e,origin:"array"})}const l=new Array(n.length),d=t.rest?i?.abortEarly:void 0;let f=!1;for(let p=0;p<n.length;p++){const h=n[p]._zod.run({value:s[p],issues:[]},i);h instanceof Promise?a.push(h.then(m=>{l[p]=m})):(l[p]=h,d&&!f&&h.issues.length&&(f=Ae(h)))}if(t.rest&&!f){let p=n.length-1;const h=s.slice(n.length);let m=o.issues.length;for(const y of h){if(d&&o.issues.length!==m){if(Ae(o,m))break;m=o.issues.length}p++;const $=t.rest._zod.run({value:y,issues:[]},i);$ instanceof Promise?a.push($.then(w=>Bl(w,o,p))):Bl($,o,p)}}return a.length?Promise.all(a).then(()=>Kl(l,o,n,s,u)):Kl(l,o,n,s,u)}});function Hl(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function Bl(e,t,n){e.issues.length&&t.issues.push(...qe(n,e.issues)),t.value[n]=e.value}function Kl(e,t,n,r,o){for(let i=0;i<n.length;i++){const s=e[i],a=i<r.length;if(!a&&i>=o&&n[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!a&&i>=o){t.value.length=i;break}t.issues.push(...qe(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=r.length&&(n[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}const wh=g("$ZodRecord",(e,t)=>{D.init(e,t);const n=Ee.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{const i=r.value;if(!ct(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;const s=[],a=t.keyType._zod.values;if(a&&!t.partial){r.value=n?n.alloc(e,r,{},o):{};const c=new Set;for(const l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(c.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;const d=t.keyType._zod.run({value:l,issues:[]},o);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(h=>Be(h,o,me())),input:l,path:[l],inst:e});continue}const f=d.value;if(f==="__proto__")continue;const p=t.valueType._zod.run({value:i[l],issues:[]},o);p instanceof Promise?s.push(p.then(h=>{h.issues.length&&r.issues.push(...qe(l,h.issues)),r.value[f]=h.value})):(p.issues.length&&r.issues.push(...qe(l,p.issues)),r.value[f]=p.value)}let u;for(const l in i)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;r.value[l]=i[l]}else u=u??[],u.push(l);u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}else{r.value=n?n.alloc(e,r,{},o):{};let c;for(const u of Reflect.ownKeys(i)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&ln.test(u)&&l.issues.length){const h=t.keyType._zod.run({value:Number(u),issues:[]},o);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");h.issues.length===0&&(l=h)}if(l.issues.length){t.mode==="loose"?r.value[u]=i[u]:a?(c=c??[],c.push(u)):r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(h=>Be(h,o,me())),input:u,path:[u],inst:e});continue}const f=l.value;if(f==="__proto__")continue;const p=t.valueType._zod.run({value:i[u],issues:[]},o);p instanceof Promise?s.push(p.then(h=>{h.issues.length&&r.issues.push(...qe(u,h.issues)),r.value[f]=h.value})):(p.issues.length&&r.issues.push(...qe(u,p.issues)),r.value[f]=p.value)}c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>r):r}}),vh=g("$ZodMap",(e,t)=>{D.init(e,t);const n=Ee.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{const i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;const s=[];r.value=n?n.alloc(e,r,new Map,o):new Map;const a=o?.abortEarly;let c=r.issues.length;for(const[u,l]of i){if(a&&r.issues.length!==c){if(Ae(r,c))break;c=r.issues.length}const d=t.keyType._zod.run({value:u,issues:[]},o),f=t.valueType._zod.run({value:l,issues:[]},o);d instanceof Promise||f instanceof Promise?s.push(Promise.all([d,f]).then(([p,h])=>{Jl(p,h,r,u,i,e,o)})):Jl(d,f,r,u,i,e,o)}return s.length?Promise.all(s).then(()=>r):r}});function Jl(e,t,n,r,o,i,s){e.issues.length&&(To.has(typeof r)?n.issues.push(...qe(r,e.issues)):n.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(a=>Be(a,s,me()))})),t.issues.length&&(To.has(typeof r)?n.issues.push(...qe(r,t.issues)):n.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:r,issues:t.issues.map(a=>Be(a,s,me()))})),n.value.set(e.value,t.value)}const kh=g("$ZodSet",(e,t)=>{D.init(e,t);const n=Ee.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{const i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;const s=[];r.value=n?n.alloc(e,r,new Set,o):new Set;const a=o?.abortEarly;let c=r.issues.length;for(const u of i){if(a&&r.issues.length!==c){if(Ae(r,c))break;c=r.issues.length}const l=t.valueType._zod.run({value:u,issues:[]},o);l instanceof Promise?s.push(l.then(d=>Wl(d,r))):Wl(l,r)}return s.length?Promise.all(s).then(()=>r):r}});function Wl(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}const $h=g("$ZodEnum",(e,t)=>{D.init(e,t);const n=xo(t.entries),r=new Set(n);e._zod.values=r,U(e,"pattern",o=>{const i=xo(o.def.entries).filter(s=>To.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>ut(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{const s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:n,input:s,inst:e}),o}}),Sh=g("$ZodLiteral",(e,t)=>{D.init(e,t);const n=new Set(t.values);e._zod.values=n,U(e,"pattern",r=>{const o=r.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?ut(i):i?ut(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,o)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),Ih=g("$ZodFile",(e,t)=>{D.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;return o instanceof File||n.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),n}}),xh=g("$ZodTransform",(e,t)=>{D.init(e,t),e._zod.optin="optional",Ee.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new qo(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(n.value=s,n));if(o instanceof Promise)throw new st;return n.value=o,n}});function Gl(e,t){return e.value=t.issues.length?void 0:t.value,e}const Za=g("$ZodOptional",(e,t)=>{D.init(e,t),U(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",U(e,"values",n=>{const r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),U(e,"pattern",n=>{const r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${vt(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;const o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(i=>Gl(n,i)):Gl(n,o)}return t.innerType._zod.run(n,r)}}),zh=g("$ZodExactOptional",(e,t)=>{Za.init(e,t),U(e,"values",n=>n.def.innerType._zod.values),U(e,"pattern",n=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Th=g("$ZodNullable",(e,t)=>{D.init(e,t),U(e,"optin",n=>n.def.innerType._zod.optin),U(e,"optout",n=>n.def.innerType._zod.optout),U(e,"pattern",n=>{const r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${vt(r.source)}|null)$`):void 0}),U(e,"values",n=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Eh=g("$ZodDefault",(e,t)=>{D.init(e,t),e._zod.optin="defaulted",U(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Yl(i,t)):Yl(o,t)}});function Yl(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Ch=g("$ZodPrefault",(e,t)=>{D.init(e,t),e._zod.optin="defaulted",U(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Ah=g("$ZodNonOptional",(e,t)=>{D.init(e,t),U(e,"values",n=>{const r=n.def.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Ql(i,e)):Ql(o,e)}});function Ql(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 Nh=g("$ZodSuccess",(e,t)=>{D.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new qo("ZodSuccess");const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.issues.length===0,n)):(n.value=o.issues.length===0,n)}});function Xl(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>Be(o,r,me()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const Oh=g("$ZodCatch",(e,t)=>{D.init(e,t),U(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),U(e,"optout",n=>n.def.innerType._zod.optout),U(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(i=>Xl(n,i,t,r)):Xl(n,o,t,r)}}),Ph=g("$ZodNaN",(e,t)=>{D.init(e,t),e._zod.parse=(n,r)=>((typeof n.value!="number"||!Number.isNaN(n.value))&&n.issues.push({input:n.value,inst:e,expected:"nan",code:"invalid_type"}),n)}),ja=g("$ZodPipe",(e,t)=>{D.init(e,t),U(e,"values",n=>n.def.in._zod.values),U(e,"optin",n=>n.def.in._zod.optin),U(e,"optout",n=>n.def.out._zod.optout),U(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(s=>co(s,t.in,r)):co(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>co(i,t.out,r)):co(o,t.out,r)}});function co(e,t,n){return e.issues.some(r=>r.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Fa=g("$ZodCodec",(e,t)=>{D.init(e,t),U(e,"values",n=>n.def.in._zod.values),U(e,"optin",n=>n.def.in._zod.optin),U(e,"optout",n=>n.def.out._zod.optout),U(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if((r.direction||"forward")==="forward"){const i=t.in._zod.run(n,r);return i instanceof Promise?i.then(s=>uo(s,t,r)):uo(i,t,r)}else{const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(s=>uo(s,t,r)):uo(i,t,r)}}});function uo(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||"forward")==="forward"){const o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>lo(e,i,t.out,n)):lo(e,o,t.out,n)}else{const o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>lo(e,i,t.in,n)):lo(e,o,t.in,n)}}function lo(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}const Mh=g("$ZodPreprocess",(e,t)=>{ja.init(e,t)}),Rh=g("$ZodReadonly",(e,t)=>{D.init(e,t),U(e,"propValues",n=>n.def.innerType._zod.propValues),U(e,"values",n=>n.def.innerType._zod.values),U(e,"optin",n=>n.def.innerType?._zod?.optin),U(e,"optout",n=>n.def.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(ed):ed(o)}});function ed(e){return e.memo||(e.value=Object.freeze(e.value)),e}function tb(e){const t=e._zod.def;let n=t.pattern,r=!!t.format?.includes("int"),o,i;for(const a of t.checks??[]){const c=a._zod.def;c.pattern&&(n=c.pattern),r||(r=!!c.format?.includes("int"));const u=c.minimum??c.length,l=c.maximum??c.length;u!==void 0&&(o===void 0||u>o)&&(o=u),l!==void 0&&(i===void 0||l<i)&&(i=l)}if(n)return n.source;if(o!==void 0&&i!==void 0&&o>i)return"(?!)";if(o!==void 0||i!==void 0)return Qf({minimum:o,maximum:i}).source;const s=e._zod.pattern;return(r&&s===ln?ga:s)?.source}function Ts(e){const t=e._zod.def,n=e._zod.pattern?.source,r=t.innerType??e._zod.innerType;if(r){const o=r._zod.pattern?.source,i=Ts(r);return n&&o&&i&&i!==o?n.replace(vt(o),()=>vt(i)):n}if(t.options){const o=t.options.map(Ts);if(o.every(Boolean))return`^(${o.map(i=>vt(i)).join("|")})$`}return tb(e)}const Lh=g("$ZodTemplateLiteral",(e,t)=>{D.init(e,t);const n=[];for(const r of t.parts)if(typeof r=="object"&&r!==null){const o=Ts(r);if(!o)throw new Error(`Invalid template literal part, no pattern found: ${[...r._zod.traits].shift()}`);n.push(vt(o))}else if(r===null||rf.has(typeof r))n.push(ut(`${r}`));else throw new Error(`Invalid template literal part: ${r}`);e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(r,o)=>typeof r.value!="string"?(r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}),r):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(r.value)||r.issues.push({input:r.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),r)}),Dh=g("$ZodFunction",(e,t)=>(D.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=n=>{if(typeof n!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...r){const o=e._def.input?Is(e._def.input,r):r,i=Reflect.apply(n,this,o);return e._def.output?Is(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=n=>{if(typeof n!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...r){const o=e._def.input?await xs(e._def.input,r):r,i=await Reflect.apply(n,this,o);return e._def.output?await xs(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(n,r)=>typeof n.value!="function"?(n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n):(e._def.output&&e._def.output._zod.def.type==="promise"?n.value=e.implementAsync(n.value):n.value=e.implement(n.value),n),e.input=(...n)=>{const r=e.constructor;return Array.isArray(n[0])?new r({type:"function",input:new Da({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output}):new r({type:"function",input:n[0],output:e._def.output})},e.output=n=>{const r=e.constructor;return new r({type:"function",input:e._def.input,output:n})},e)),Zh=g("$ZodPromise",(e,t)=>{D.init(e,t),e._zod.parse=(n,r)=>Promise.resolve(n.value).then(o=>t.innerType._zod.run({value:o,issues:[]},r))}),Ua=g("$ZodLazy",(e,t)=>{D.init(e,t),Qd(e._zod,"innerType",()=>{const n=t;return n._cachedInner||(n._cachedInner=t.getter()),n._cachedInner}),U(e,"pattern",n=>n.innerType?._zod?.pattern),U(e,"propValues",n=>n.innerType?._zod?.propValues),U(e,"optin",n=>n.innerType?._zod?.optin??void 0),U(e,"optout",n=>n.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),jh=g("$ZodCustom",(e,t)=>{ie.init(e,t),D.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>td(i,n,r,e));td(o,n,r,e)}});function td(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Qt(o))}}class Fh extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const Es="~memo",nd=[];function Uh(e){return e!==null&&typeof e=="object"}function fs(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}const Vh=new WeakMap,Gt=0,So=1,Zn=2;function jn(e,t,n){const r=Vh.get(e);if(r!==void 0)return r?Zn:Gt;if(t.has(e))return Zn;t.add(e);let o=Gt;const i=l=>{if(o!==Zn&&l?._zod){const d=jn(l,t,n);d>o&&(o=d)}},s=(l,d)=>{let f=Gt;for(const p of Reflect.ownKeys(l)){const h=Object.getOwnPropertyDescriptor(l,p);if(!h.enumerable)continue;const m=h.get?So:h.value?._zod?jn(h.value,t,n):Gt;m>f&&(f=m)}return f},a=l=>{l>o&&(o=l)},c=e._zod.def;switch(c.type){case"object":{const l=Zo(c);a(l?s(l):So),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(const l of c.items)i(l);i(c.rest);break;case"record":case"map":i(c.keyType),i(c.valueType);break;case"set":i(c.valueType);break;case"union":for(const l of c.options)i(l);break;case"intersection":i(c.left),i(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(c.innerType);break;case"pipe":i(c.in),i(c.out);break;case"function":i(c.input),i(c.output);break;case"lazy":{const l=c._cachedInner??(n?e._zod.innerType:void 0);a(l?jn(l,t,!1):So);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const l in c){const d=Object.getOwnPropertyDescriptor(c,l);if(!d||d.get)continue;const f=d.value;if(!(!f||typeof f!="object")){if(f._zod)i(f);else if(Array.isArray(f))for(const p of f)i(p)}}}return t.delete(e),nb(e,o)}function nb(e,t){return t!==So&&Vh.set(e,t===Zn),t}function Va(e){return jn(e,new Set,!0)!==Gt}function rb(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}let fo;const po=[],ob={alloc(e,t,n){const r=fo;if(!r)return n;fo=void 0;const o={value:n,issues:null};return r.set(t.value,o),po.push(o),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const n=e._zod.parse,r=(o,i)=>{if(i.direction!=="backward"&&qa(i,o.value))throw new Fh;return n(o,i)};e._zod.parse=r,e._zod.run===n&&(e._zod.run=r)})},attach(e){var t;let n,r=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const s=e._zod.parse,a=(c,u)=>{if(n===void 0){const $=jn(e,new Set,!1);if($===Gt)return e._zod.parse=s,e._zod.run===a&&(e._zod.run=s),s(c,u);$===Zn||r?n=!0:r=!0}const l=c.value;if(!Uh(l))return s(c,u);let d=u[Es];d||(d={buckets:new WeakMap,backEdges:void 0},u[Es]=d);let f;o===u?f=i:(f=rb(d,e),o=u,i=f);const p=f.get(l);if(p)return c.value=p.value,p.issues?p.issues.length&&c.issues.push(...fs(p.issues)):(c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(p.value)),c;fo=f;const h=po.length,m=s(c,u);fo=void 0;const y=po.length>h?po.pop():void 0;return m instanceof Promise?m.then($=>(y&&(y.issues=$.issues.length?fs($.issues):nd),$)):(y&&(y.issues=m.issues.length?fs(m.issues):nd),m)};e._zod.parse=a,e._zod.run===s&&(e._zod.run=a)})}};function ti(){return ob}function qa(e,t){const n=e[Es]?.backEdges;return n!==void 0&&Uh(t)&&n.has(t)}const Ha=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var rd;const Ba=Symbol("ZodOutput"),Ka=Symbol("ZodInput");class qh{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function ni(){return new qh}(rd=globalThis).__zod_globalRegistry??(rd.__zod_globalRegistry=ni());const Le=globalThis.__zod_globalRegistry,Ce=Symbol.for("zod.compile.invalid"),od=Symbol.for("zod.compile.fallback");class dt extends Error{constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}}class B extends Error{constructor(t,n=!0){super(`z.compile does not support ${t}; this schema must use the runtime parser`),this.name="ZodCompileUnsupportedError",this.islandable=n}}function ib(e,t){try{return oi(e,{assertOnly:!0})}catch{return t}}function Ja(e,t){try{const n=oi(e),r=ri(e,n);return r._zod.bag.validator=ib(e,n),r}catch(n){if(t?.strict)throw n;return e}}function ri(e,t){if(Va(e))throw new B("a schema whose subtree contains a reference cycle");const n=oe(e),r=e._zod.run,o=r.__originalRun??r,i=(s,a)=>{if(a?.async||a?.direction==="backward"||a?.skipChecks||a?.[od]||a&&qa(a,s.value))return o(s,a);const c=t(s.value);return c!==Ce?(s.value=c,s):(a&&(a[od]=!0),o(s,a))};return i.__originalRun=o,n._zod.bag.fallbackRun=o,n._zod.bag.validator=t,n._zod.run=i,r.__originalRun||sb(n,e,t),n}function sb(e,t,n){const r=e,o=t;if(typeof o.safeParse=="function"){const i=o.safeParse;r.safeParse=(s,a)=>{const c=n(s);return c!==Ce?{success:!0,data:c}:i(s,a)}}if(typeof o.parse=="function"){const i=o.parse;r.parse=(s,a)=>{const c=n(s);return c!==Ce?c:i(s,a)}}}function oi(e,t){let n=!0;try{n=Va(e)}catch{}if(n)throw new B("a schema whose subtree contains a reference cycle");const r={constants:new Map,constantCounter:0,varCounter:0,definite:!0},o=new va(["input"]),i=se(o,r,e,"input",!t?.assertOnly);o.write(i===null?"return true;":`return ${i};`);const s=["INVALID",...r.constants.keys()],a=[Ce,...r.constants.values()],c=o.content.join(`
|
|
65
|
-
`),u=t?.debug?
|
|
64
|
+
`)}return _.write("payload.value = newResult;"),_.write("return payload;"),_.compile()};let i;const a=an,c=!Ee.jitless,l=c&&hf.value,d=t.catchall;let f;e._zod.parse=(p,h)=>{f??(f=r.value);const m=p.value;return a(m)?c&&l&&h?.async===!1&&h.jitless!==!0?(i||(i=s(t.shape)),p=i(p,h),d?Sh([],m,p,h,f,e,h?.abortEarly===!0):p):n(p,h):(p.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),p)}});function Ql(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!Ne(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(i=>Je(i,r,ye())))}),t)}const _s=y("$ZodUnion",(e,t)=>{j.init(e,t),B(e,"optin",r=>r.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),B(e,"optout",r=>r.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),B(e,"values",r=>{if(r.def.options.every(o=>o._zod.values))return new Set(r.def.options.flatMap(o=>Array.from(o._zod.values)))}),B(e,"pattern",r=>{if(r.def.options.every(o=>o._zod.pattern)){const o=r.def.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>Ct(s.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let s=!1;const i=[];for(const a of t.options){const c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>Ql(a,r,e,o)):Ql(i,r,e,o)}});function Xl(e,t,n,r){const o=[];for(let s=0;s<e.length;s++)e[s].issues.length===0&&o.push(s);return o.length===1?(t.value=e[o[0]].value,t):(o.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(i=>Je(i,r,ye())))}):t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1,matches:o}),t)}const zh=y("$ZodXor",(e,t)=>{_s.init(e,t),t.inclusive=!1;const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let s=!1;const i=[];for(const a of t.options){const c=a._zod.run({value:r.value,issues:[]},o);c instanceof Promise?(i.push(c),s=!0):i.push(c)}return s?Promise.all(i).then(a=>Xl(a,r,e,o)):Xl(i,r,e,o)}});function rc(e,t){const n=e._zod;let r=n.bag.optionsMap;r||(r=Th(n.def),n.bag.optionsMap=r);const o=r.get(t);if(o===null)throw new Error(`Ambiguous discriminator value "${String(t)}"`);return o}function Th(e){const t=new Map;for(const n of e.options){const r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(const o of r)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,n)}return t}const Ch=y("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,_s.init(e,t);const n=e._zod.parse;B(e,"propValues",o=>{const s={};let i=0;for(const a of o.def.options){const c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);c[o.def.discriminator]?.has(void 0)&&i++;for(const[u,l]of Object.entries(c)){Object.prototype.hasOwnProperty.call(s,u)||Fe(s,u,new Set);for(const d of l)s[u].add(d)}}return!o.def.unionFallback&&i>1&&s[o.def.discriminator]?.delete(void 0),s}),t.options.forEach((o,s)=>{const i=rs(o._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw new Error(`Invalid discriminated union option at index "${s}"`)});const r=ur(()=>Th(t));e._zod.parse=(o,s)=>{const i=o.value;if(!an(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;const a=i?.[t.discriminator],c=r.value.get(a);return c&&(a!==void 0||s.direction!=="backward")?c._zod.run(o,s):t.unionFallback||s.direction==="backward"?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(u=>r.value.get(u)!==null),input:i,path:[t.discriminator],inst:e}),o)}}),Eh=y("$ZodIntersection",(e,t)=>{j.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),i=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>ed(n,c,u)):ed(n,s,i)}});function tr(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(mt(e)&&mt(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(const s of r){if(s==="__proto__")continue;const i=tr(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r],i=tr(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function ed(e,t,n){const r=new Map;let o;const s=new Map,i=(u,l)=>{let d;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),d=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){const f=String(u.path[0]);s.has(f)||s.set(f,u),d=[f]}else return!1;for(const f of d)r.has(f)||r.set(f,{}),r.get(f)[l]=!0;return!0};for(const u of t.issues)i(u,"l")||e.issues.push(u);for(const u of n.issues)i(u,"r")||e.issues.push(u);const a=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){const u=o?a.filter(l=>o.keys.includes(l)):[];u.length&&e.issues.push({...o,keys:u});for(const l of a)!u.includes(l)&&s.has(l)&&e.issues.push(s.get(l))}const c=tr(t.value,n.value);if(!c.valid){if(Ne(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}const oc=y("$ZodTuple",(e,t)=>{j.init(e,t);const n=t.items,r=Ee.memoizer;r?.attach(e),e._zod.parse=(o,s)=>{const i=o.value;if(!Array.isArray(i))return o.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=r?r.alloc(e,o,[],s):[];const a=[],c=td(n,"optin"),u=td(n,"optout");if(!t.rest){if(i.length<c)return o.issues.push({code:"too_small",minimum:c,inclusive:!0,input:i,inst:e,origin:"array"}),o;i.length>n.length&&o.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:i,inst:e,origin:"array"})}const l=new Array(n.length),d=t.rest?s?.abortEarly:void 0;let f=!1;for(let p=0;p<n.length;p++){const h=n[p]._zod.run({value:i[p],issues:[]},s);h instanceof Promise?a.push(h.then(m=>{l[p]=m})):(l[p]=h,d&&!f&&h.issues.length&&(f=Ne(h)))}if(t.rest&&!f){let p=n.length-1;const h=i.slice(n.length);let m=o.issues.length;for(const _ of h){if(d&&o.issues.length!==m){if(Ne(o,m))break;m=o.issues.length}p++;const S=t.rest._zod.run({value:_,issues:[]},s);S instanceof Promise?a.push(S.then(w=>nd(w,o,p))):nd(S,o,p)}}return a.length?Promise.all(a).then(()=>rd(l,o,n,i,u)):rd(l,o,n,i,u)}});function td(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function nd(e,t,n){e.issues.length&&t.issues.push(...He(n,e.issues)),t.value[n]=e.value}function rd(e,t,n,r,o){for(let s=0;s<n.length;s++){const i=e[s],a=s<r.length;if(!a&&s>=o&&n[s]._zod.optin==="optional"){t.value.length=s;break}if(i.issues.length){if(!a&&s>=o){t.value.length=s;break}t.issues.push(...He(s,i.issues))}t.value[s]=i.value}for(let s=t.value.length-1;s>=r.length&&(n[s]._zod.optout==="optional"&&t.value[s]===void 0);s--)t.value.length=s;return t}const Ah=y("$ZodRecord",(e,t)=>{j.init(e,t);const n=Ee.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{const s=r.value;if(!mt(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),r;const i=[],a=t.keyType._zod.values;if(a&&!t.partial){r.value=n?n.alloc(e,r,{},o):{};const c=new Set;for(const l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(c.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;const d=t.keyType._zod.run({value:l,issues:[]},o);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(h=>Je(h,o,ye())),input:l,path:[l],inst:e});continue}const f=d.value;if(f==="__proto__")continue;const p=t.valueType._zod.run({value:s[l],issues:[]},o);p instanceof Promise?i.push(p.then(h=>{h.issues.length&&r.issues.push(...He(l,h.issues)),r.value[f]=h.value})):(p.issues.length&&r.issues.push(...He(l,p.issues)),r.value[f]=p.value)}let u;for(const l in s)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;r.value[l]=s[l]}else u=u??[],u.push(l);u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}else{r.value=n?n.alloc(e,r,{},o):{};let c;for(const u of Reflect.ownKeys(s)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(s,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&bn.test(u)&&l.issues.length){const h=t.keyType._zod.run({value:Number(u),issues:[]},o);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");h.issues.length===0&&(l=h)}if(l.issues.length){t.mode==="loose"?r.value[u]=s[u]:a?(c=c??[],c.push(u)):r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(h=>Je(h,o,ye())),input:u,path:[u],inst:e});continue}const f=l.value;if(f==="__proto__")continue;const p=t.valueType._zod.run({value:s[u],issues:[]},o);p instanceof Promise?i.push(p.then(h=>{h.issues.length&&r.issues.push(...He(u,h.issues)),r.value[f]=h.value})):(p.issues.length&&r.issues.push(...He(u,p.issues)),r.value[f]=p.value)}c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c,continue:!0})}return i.length?Promise.all(i).then(()=>r):r}}),Nh=y("$ZodMap",(e,t)=>{j.init(e,t);const n=Ee.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{const s=r.value;if(!(s instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:s,inst:e}),r;const i=[];r.value=n?n.alloc(e,r,new Map,o):new Map;const a=o?.abortEarly;let c=r.issues.length;for(const[u,l]of s){if(a&&r.issues.length!==c){if(Ne(r,c))break;c=r.issues.length}const d=t.keyType._zod.run({value:u,issues:[]},o),f=t.valueType._zod.run({value:l,issues:[]},o);d instanceof Promise||f instanceof Promise?i.push(Promise.all([d,f]).then(([p,h])=>{od(p,h,r,u,s,e,o)})):od(d,f,r,u,s,e,o)}return i.length?Promise.all(i).then(()=>r):r}});function od(e,t,n,r,o,s,i){e.issues.length&&(Bo.has(typeof r)?n.issues.push(...He(r,e.issues)):n.issues.push({code:"invalid_key",origin:"map",input:o,inst:s,issues:e.issues.map(a=>Je(a,i,ye()))})),t.issues.length&&(Bo.has(typeof r)?n.issues.push(...He(r,t.issues)):n.issues.push({origin:"map",code:"invalid_element",input:o,inst:s,key:r,issues:t.issues.map(a=>Je(a,i,ye()))})),n.value.set(e.value,t.value)}const Oh=y("$ZodSet",(e,t)=>{j.init(e,t);const n=Ee.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{const s=r.value;if(!(s instanceof Set))return r.issues.push({input:s,inst:e,expected:"set",code:"invalid_type"}),r;const i=[];r.value=n?n.alloc(e,r,new Set,o):new Set;const a=o?.abortEarly;let c=r.issues.length;for(const u of s){if(a&&r.issues.length!==c){if(Ne(r,c))break;c=r.issues.length}const l=t.valueType._zod.run({value:u,issues:[]},o);l instanceof Promise?i.push(l.then(d=>sd(d,r))):sd(l,r)}return i.length?Promise.all(i).then(()=>r):r}});function sd(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}const Ph=y("$ZodEnum",(e,t)=>{j.init(e,t);const n=qo(t.entries),r=new Set(n);e._zod.values=r,B(e,"pattern",o=>{const s=qo(o.def.entries).filter(i=>Bo.has(typeof i));return new RegExp(s.length?`^(${s.map(i=>gt(i.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,s)=>{const i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:n,input:i,inst:e}),o}}),Mh=y("$ZodLiteral",(e,t)=>{j.init(e,t);const n=new Set(t.values);e._zod.values=n,B(e,"pattern",r=>{const o=r.def.values;return new RegExp(o.length?`^(${o.map(s=>typeof s=="string"?gt(s):s?gt(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,o)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),Lh=y("$ZodFile",(e,t)=>{j.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;return o instanceof File||n.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),n}}),Rh=y("$ZodTransform",(e,t)=>{j.init(e,t),e._zod.optin="optional",Ee.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new cs(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(n.value=i,n));if(o instanceof Promise)throw new pt;return n.value=o,n}});function id(e,t){return e.value=t.issues.length?void 0:t.value,e}const sc=y("$ZodOptional",(e,t)=>{j.init(e,t),B(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",B(e,"values",n=>{const r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),B(e,"pattern",n=>{const r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Ct(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;const o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(s=>id(n,s)):id(n,o)}return t.innerType._zod.run(n,r)}}),Dh=y("$ZodExactOptional",(e,t)=>{sc.init(e,t),B(e,"values",n=>n.def.innerType._zod.values),B(e,"pattern",n=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Zh=y("$ZodNullable",(e,t)=>{j.init(e,t),B(e,"optin",n=>n.def.innerType._zod.optin),B(e,"optout",n=>n.def.innerType._zod.optout),B(e,"pattern",n=>{const r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Ct(r.source)}|null)$`):void 0}),B(e,"values",n=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),jh=y("$ZodDefault",(e,t)=>{j.init(e,t),e._zod.optin="defaulted",B(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>ad(s,t)):ad(o,t)}});function ad(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Fh=y("$ZodPrefault",(e,t)=>{j.init(e,t),e._zod.optin="defaulted",B(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Uh=y("$ZodNonOptional",(e,t)=>{j.init(e,t),B(e,"values",n=>{const r=n.def.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>cd(s,e)):cd(o,e)}});function cd(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 Vh=y("$ZodSuccess",(e,t)=>{j.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new cs("ZodSuccess");const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>(n.value=s.issues.length===0,n)):(n.value=o.issues.length===0,n)}});function ud(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>Je(o,r,ye()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const qh=y("$ZodCatch",(e,t)=>{j.init(e,t),B(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),B(e,"optout",n=>n.def.innerType._zod.optout),B(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(s=>ud(n,s,t,r)):ud(n,o,t,r)}}),Hh=y("$ZodNaN",(e,t)=>{j.init(e,t),e._zod.parse=(n,r)=>((typeof n.value!="number"||!Number.isNaN(n.value))&&n.issues.push({input:n.value,inst:e,expected:"nan",code:"invalid_type"}),n)}),ic=y("$ZodPipe",(e,t)=>{j.init(e,t),B(e,"values",n=>n.def.in._zod.values),B(e,"optin",n=>n.def.in._zod.optin),B(e,"optout",n=>n.def.out._zod.optout),B(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(i=>To(i,t.in,r)):To(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>To(s,t.out,r)):To(o,t.out,r)}});function To(e,t,n){return e.issues.some(r=>r.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const ac=y("$ZodCodec",(e,t)=>{j.init(e,t),B(e,"values",n=>n.def.in._zod.values),B(e,"optin",n=>n.def.in._zod.optin),B(e,"optout",n=>n.def.out._zod.optout),B(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if((r.direction||"forward")==="forward"){const s=t.in._zod.run(n,r);return s instanceof Promise?s.then(i=>Co(i,t,r)):Co(s,t,r)}else{const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(i=>Co(i,t,r)):Co(s,t,r)}}});function Co(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||"forward")==="forward"){const o=t.transform(e.value,e);return o instanceof Promise?o.then(s=>Eo(e,s,t.out,n)):Eo(e,o,t.out,n)}else{const o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(s=>Eo(e,s,t.in,n)):Eo(e,o,t.in,n)}}function Eo(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}const Bh=y("$ZodPreprocess",(e,t)=>{ic.init(e,t)}),Kh=y("$ZodReadonly",(e,t)=>{j.init(e,t),B(e,"propValues",n=>n.def.innerType._zod.propValues),B(e,"values",n=>n.def.innerType._zod.values),B(e,"optin",n=>n.def.innerType?._zod?.optin),B(e,"optout",n=>n.def.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(ld):ld(o)}});function ld(e){return e.memo||(e.value=Object.freeze(e.value)),e}function ub(e){const t=e._zod.def;let n=t.pattern,r=!!t.format?.includes("int"),o,s;for(const a of t.checks??[]){const c=a._zod.def;c.pattern&&(n=c.pattern),r||(r=!!c.format?.includes("int"));const u=c.minimum??c.length,l=c.maximum??c.length;u!==void 0&&(o===void 0||u>o)&&(o=u),l!==void 0&&(s===void 0||l<s)&&(s=l)}if(n)return n.source;if(o!==void 0&&s!==void 0&&o>s)return"(?!)";if(o!==void 0||s!==void 0)return up({minimum:o,maximum:s}).source;const i=e._zod.pattern;return(r&&i===bn?La:i)?.source}function Ji(e){const t=e._zod.def,n=e._zod.pattern?.source,r=t.innerType??e._zod.innerType;if(r){const o=r._zod.pattern?.source,s=Ji(r);return n&&o&&s&&s!==o?n.replace(Ct(o),()=>Ct(s)):n}if(t.options){const o=t.options.map(Ji);if(o.every(Boolean))return`^(${o.map(s=>Ct(s)).join("|")})$`}return ub(e)}const Jh=y("$ZodTemplateLiteral",(e,t)=>{j.init(e,t);const n=[];for(const r of t.parts)if(typeof r=="object"&&r!==null){const o=Ji(r);if(!o)throw new Error(`Invalid template literal part, no pattern found: ${[...r._zod.traits].shift()}`);n.push(Ct(o))}else if(r===null||mf.has(typeof r))n.push(gt(`${r}`));else throw new Error(`Invalid template literal part: ${r}`);e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(r,o)=>typeof r.value!="string"?(r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}),r):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(r.value)||r.issues.push({input:r.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),r)}),Wh=y("$ZodFunction",(e,t)=>(j.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=n=>{if(typeof n!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...r){const o=e._def.input?Hi(e._def.input,r):r,s=Reflect.apply(n,this,o);return e._def.output?Hi(e._def.output,s):s},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=n=>{if(typeof n!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...r){const o=e._def.input?await Bi(e._def.input,r):r,s=await Reflect.apply(n,this,o);return e._def.output?await Bi(e._def.output,s):s},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(n,r)=>typeof n.value!="function"?(n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n):(e._def.output&&e._def.output._zod.def.type==="promise"?n.value=e.implementAsync(n.value):n.value=e.implement(n.value),n),e.input=(...n)=>{const r=e.constructor;return Array.isArray(n[0])?new r({type:"function",input:new oc({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output}):new r({type:"function",input:n[0],output:e._def.output})},e.output=n=>{const r=e.constructor;return new r({type:"function",input:e._def.input,output:n})},e)),Gh=y("$ZodPromise",(e,t)=>{j.init(e,t),e._zod.parse=(n,r)=>Promise.resolve(n.value).then(o=>t.innerType._zod.run({value:o,issues:[]},r))}),cc=y("$ZodLazy",(e,t)=>{j.init(e,t),lf(e._zod,"innerType",()=>{const n=t;return n._cachedInner||(n._cachedInner=t.getter()),n._cachedInner}),B(e,"pattern",n=>n.innerType?._zod?.pattern),B(e,"propValues",n=>n.innerType?._zod?.propValues),B(e,"optin",n=>n.innerType?._zod?.optin??void 0),B(e,"optout",n=>n.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),Yh=y("$ZodCustom",(e,t)=>{ue.init(e,t),j.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>dd(s,n,r,e));dd(o,n,r,e)}});function dd(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(cn(o))}}class Qh extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const Wi="~memo",fd=[];function Xh(e){return e!==null&&typeof e=="object"}function Ai(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}const em=new WeakMap,sn=0,Vo=1,Gn=2;function Yn(e,t,n){const r=em.get(e);if(r!==void 0)return r?Gn:sn;if(t.has(e))return Gn;t.add(e);let o=sn;const s=l=>{if(o!==Gn&&l?._zod){const d=Yn(l,t,n);d>o&&(o=d)}},i=(l,d)=>{let f=sn;for(const p of Reflect.ownKeys(l)){const h=Object.getOwnPropertyDescriptor(l,p);if(!h.enumerable)continue;const m=h.get?Vo:h.value?._zod?Yn(h.value,t,n):sn;m>f&&(f=m)}return f},a=l=>{l>o&&(o=l)},c=e._zod.def;switch(c.type){case"object":{const l=rs(c);a(l?i(l):Vo),s(c.catchall);break}case"array":s(c.element);break;case"tuple":for(const l of c.items)s(l);s(c.rest);break;case"record":case"map":s(c.keyType),s(c.valueType);break;case"set":s(c.valueType);break;case"union":for(const l of c.options)s(l);break;case"intersection":s(c.left),s(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(c.innerType);break;case"pipe":s(c.in),s(c.out);break;case"function":s(c.input),s(c.output);break;case"lazy":{const l=c._cachedInner??(n?e._zod.innerType:void 0);a(l?Yn(l,t,!1):Vo);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const l in c){const d=Object.getOwnPropertyDescriptor(c,l);if(!d||d.get)continue;const f=d.value;if(!(!f||typeof f!="object")){if(f._zod)s(f);else if(Array.isArray(f))for(const p of f)s(p)}}}return t.delete(e),lb(e,o)}function lb(e,t){return t!==Vo&&em.set(e,t===Gn),t}function uc(e){return Yn(e,new Set,!0)!==sn}function db(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}let Ao;const No=[],fb={alloc(e,t,n){const r=Ao;if(!r)return n;Ao=void 0;const o={value:n,issues:null};return r.set(t.value,o),No.push(o),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const n=e._zod.parse,r=(o,s)=>{if(s.direction!=="backward"&&lc(s,o.value))throw new Qh;return n(o,s)};e._zod.parse=r,e._zod.run===n&&(e._zod.run=r)})},attach(e){var t;let n,r=!1,o,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const i=e._zod.parse,a=(c,u)=>{if(n===void 0){const S=Yn(e,new Set,!1);if(S===sn)return e._zod.parse=i,e._zod.run===a&&(e._zod.run=i),i(c,u);S===Gn||r?n=!0:r=!0}const l=c.value;if(!Xh(l))return i(c,u);let d=u[Wi];d||(d={buckets:new WeakMap,backEdges:void 0},u[Wi]=d);let f;o===u?f=s:(f=db(d,e),o=u,s=f);const p=f.get(l);if(p)return c.value=p.value,p.issues?p.issues.length&&c.issues.push(...Ai(p.issues)):(c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(p.value)),c;Ao=f;const h=No.length,m=i(c,u);Ao=void 0;const _=No.length>h?No.pop():void 0;return m instanceof Promise?m.then(S=>(_&&(_.issues=S.issues.length?Ai(S.issues):fd),S)):(_&&(_.issues=m.issues.length?Ai(m.issues):fd),m)};e._zod.parse=a,e._zod.run===i&&(e._zod.run=a)})}};function bs(){return fb}function lc(e,t){const n=e[Wi]?.backEdges;return n!==void 0&&Xh(t)&&n.has(t)}const dc=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var pd;const fc=Symbol("ZodOutput"),pc=Symbol("ZodInput");class tm{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function ws(){return new tm}(pd=globalThis).__zod_globalRegistry??(pd.__zod_globalRegistry=ws());const Re=globalThis.__zod_globalRegistry,Ae=Symbol.for("zod.compile.invalid"),hd=Symbol.for("zod.compile.fallback");class _t extends Error{constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}}class G extends Error{constructor(t,n=!0){super(`z.compile does not support ${t}; this schema must use the runtime parser`),this.name="ZodCompileUnsupportedError",this.islandable=n}}function pb(e,t){try{return ks(e,{assertOnly:!0})}catch{return t}}function hc(e,t){try{const n=ks(e),r=vs(e,n);return r._zod.bag.validator=pb(e,n),r}catch(n){if(t?.strict)throw n;return e}}function vs(e,t){if(uc(e))throw new G("a schema whose subtree contains a reference cycle");const n=ce(e),r=e._zod.run,o=r.__originalRun??r,s=(i,a)=>{if(a?.async||a?.direction==="backward"||a?.skipChecks||a?.[hd]||a&&lc(a,i.value))return o(i,a);const c=t(i.value);return c!==Ae?(i.value=c,i):(a&&(a[hd]=!0),o(i,a))};return s.__originalRun=o,n._zod.bag.fallbackRun=o,n._zod.bag.validator=t,n._zod.run=s,r.__originalRun||hb(n,e,t),n}function hb(e,t,n){const r=e,o=t;if(typeof o.safeParse=="function"){const s=o.safeParse;r.safeParse=(i,a)=>{const c=n(i);return c!==Ae?{success:!0,data:c}:s(i,a)}}if(typeof o.parse=="function"){const s=o.parse;r.parse=(i,a)=>{const c=n(i);return c!==Ae?c:s(i,a)}}}function ks(e,t){let n=!0;try{n=uc(e)}catch{}if(n)throw new G("a schema whose subtree contains a reference cycle");const r={constants:new Map,constantCounter:0,varCounter:0,definite:!0},o=new Fa(["input"]),s=de(o,r,e,"input",!t?.assertOnly);o.write(s===null?"return true;":`return ${s};`);const i=["INVALID",...r.constants.keys()],a=[Ae,...r.constants.values()],c=o.content.join(`
|
|
65
|
+
`),u=t?.debug?i.length>0?`// Constants: ${i.join(", ")}
|
|
66
66
|
${c}`:c:"",l=Function,d=`return (input) => {
|
|
67
67
|
${c}
|
|
68
|
-
}`;let f;try{f=new l(...s,d)(...a)}catch(p){throw new B(`this schema (generated code failed to evaluate: ${p.message})`)}return t?.debug&&(f.code=u),f.definite=r.definite,f}function R(e,t){for(const[r,o]of e.constants)if(o===t)return r;const n=`c${e.constantCounter++}`;return e.constants.set(n,t),n}function Dt(e,t){return e.definite=!1,R(e,t)}function P(e){return`v${e.varCounter++}`}function ab(e,t){const n=e._zod.run({value:t,issues:[]},{});if(n&&typeof n.then=="function")return Ce;const r=n;return r.issues.length===0?r.value:Ce}function Ie(e,t,n,r,o=!0){const i=e.content.length,s=t.constants.size,a=t.constantCounter,c=t.varCounter;try{return se(e,t,n,r,o)}catch(u){if(!(u instanceof B)||!u.islandable)throw u;if(e.content.length=i,t.constants.size>s){const l=Array.from(t.constants.keys()).slice(s);for(const d of l)t.constants.delete(d)}return t.constantCounter=a,t.varCounter=c,cb(e,t,n,r)}}function cb(e,t,n,r){t.definite=!1;const o=R(t,n),i=R(t,ab),s=P(t);return e.write(`const ${s} = ${i}(${o}, ${r});`),e.write(`if (${s} === INVALID) return INVALID;`),s}const ub=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function lb(e,t,n,r){const o=n._zod.def.checks;if(!o||o.length===0)return r;let i=r;for(const s of o){const a=s._zod.def;if(a.when&&!ub.has(a.check))throw new B('check with a custom "when" condition');switch(a.check){case"greater_than":db(e,t,a,i);break;case"less_than":fb(e,t,a,i);break;case"multiple_of":pb(e,t,a,i);break;case"number_format":Bh(e,a,i);break;case"min_length":{const c=Pt(a.minimum,"min_length"),u=ps(e,t,i,`${i}.length >= ${c} && ${i}.length < ${a.minimum*2}`);e.write(`if (${u} < ${c}) return INVALID;`);break}case"max_length":{const c=Pt(a.maximum,"max_length"),u=ps(e,t,i,`${i}.length > ${c}`);e.write(`if (${u} > ${c}) return INVALID;`);break}case"length_equals":{const c=Pt(a.length,"length_equals"),u=ps(e,t,i,`${i}.length >= ${c} && ${i}.length <= ${a.length*2}`);e.write(`if (${u} !== ${c}) return INVALID;`);break}case"min_size":e.write(`if (${i}.size < ${Pt(a.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${i}.size > ${Pt(a.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${i}.size !== ${Pt(a.size,"size_equals")}) return INVALID;`);break;case"string_format":i=Kh(e,t,a,i);break;case"custom":i=bb(e,t,s,i);break;case"bigint_format":hb(e,a,i);break;case"mime_type":mb(e,t,a,i);break;case"property":yb(e,t,a,i);break;case"properties":gb(e,t,a,i);break;case"overwrite":{const c=P(t);_b(e,t,s,i,c),i=c;break}default:throw new B(`check type ${a.check}`)}}return i}function ps(e,t,n,r){const o=R(t,Xn),i=P(t);return e.write(`const ${i} = typeof ${n} === "string" && ${r} ? ${o}(${n}) : ${n}.length;`),i}function Pt(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new B(`${t} bound of type ${typeof e}`);return`${e}`}function Hh(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new B("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new B("comparison check with Invalid Date bound");return R(e,t)}throw new B(`comparison check bound of type ${typeof t}`)}function db(e,t,n,r){const o=n.inclusive?"<":"<=";e.write(`if (${r} ${o} ${Hh(t,n.value)}) return INVALID;`)}function fb(e,t,n,r){const o=n.inclusive?">":">=";e.write(`if (${r} ${o} ${Hh(t,n.value)}) return INVALID;`)}function pb(e,t,n,r){if(typeof n.value=="bigint"){if(n.value===BigInt(0))throw new B("multiple_of check with a zero divisor");e.write(`if (${r} % ${n.value}n !== 0n) return INVALID;`)}else{const o=R(t,Ks);e.write(`if (${o}(${r}, ${Pt(n.value,"multiple_of")}) !== 0) return INVALID;`)}}function Bh(e,t,n){const r=t.format;switch(r){case"safeint":e.write(`if (!Number.isSafeInteger(${n})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${n}) || ${n} < -2147483648 || ${n} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${n}) || ${n} < 0 || ${n} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${n}) || ${n} < -3.4028234663852886e38 || ${n} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${n})) return INVALID;`);break;default:throw new B(`number format ${r}`)}}function hb(e,t,n){const r=t.format;if(r)switch(r){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break;default:throw new B(`bigint format ${r}`)}}function mb(e,t,n,r){const o=n.mime;if(o&&o.length>0){const i=R(t,new Set(o));e.write(`if (!${i}.has(${r}.type)) return INVALID;`)}}function gb(e,t,n,r){if(n.when)throw new B('check with a custom "when" condition');e.write(`if (${r} == null) return INVALID;`);const o=n.shape;for(const i of Reflect.ownKeys(o)){const s=typeof i=="symbol"?R(t,i):De(i),a=P(t);e.write(`const ${a} = ${r}[${s}];`),Ie(e,t,o[i],a,!1)}}function yb(e,t,n,r){const o=`${r}[${JSON.stringify(n.property)}]`;se(e,t,n.schema,o)}function _b(e,t,n,r,o){const i=n._zod.def.tx;if(!i)throw new B("overwrite check without a transform function");if(Zt(i))throw new dt("z.compile: async overwrite transforms are not supported");const s=R(t,i);e.write(`const ${o} = ${s}(${r});`)}function Cs(){throw new st}function Wa(e){this.issues.push(e)}function bb(e,t,n,r){const o=n._zod.def;if(o.fn){if(Zt(o.fn))throw new dt("z.compile: async .refine() predicates are not supported");const i=Dt(t,o.fn),s=R(t,Cs),a=P(t);return e.write(`const ${a} = ${i}(${r});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`),r}if(n._zod.check){if(Zt(n._zod.check))throw new dt("z.compile: async .superRefine() / check functions are not supported");const i=n._zod.check,a=Dt(t,u=>{const l={value:u,issues:[],addIssue:Wa};return i(l)instanceof Promise&&Cs(),l.issues.length===0?l.value:Ce}),c=P(t);return e.write(`const ${c} = ${a}(${r});`),e.write(`if (${c} === INVALID) return INVALID;`),c}throw new B("custom check without a predicate or check function")}const wb=new Set(["cidrv4","cuid","cuid2","date","datetime","duration","e164","email","emoji","ends_with","guid","includes","ipv4","ksuid","lowercase","mac","nanoid","regex","starts_with","time","ulid","uppercase","uuid","xid"]);function Kh(e,t,n,r,o=!0){const i=n.format;if(i==="base64"){const u=R(t,Qo);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="base64url"){const u=R(t,Ca);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="jwt"){const u=R(t,Oa),l=R(t,n.alg??null);return e.write(`if (!${u}(${r}, ${l})) return INVALID;`),r}if(i==="ipv6"){const u=R(t,Yo);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="cidrv6"){const u=R(t,Ta);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="credit_card"){const u=R(t,Aa);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="iban"){const u=R(t,Na);return e.write(`if (!${u}(${r})) return INVALID;`),r}const s=n;if(i==="url"||i==="httpurl"||s.normalize||s.hostname!==void 0||s.protocol!==void 0){const u=R(t,Ia),l=R(t,n),d=P(t),f=P(t);if(e.write(`const ${d} = ${r}.trim();`),e.write(`const ${f} = ${u}(${d}, ${l});`),e.write(`if (typeof ${f} === "number") return INVALID;`),s.hostname!==void 0){const m=R(t,xa);e.write(`if (!${m}(${f}, ${l}.hostname)) return INVALID;`)}if(s.protocol!==void 0){const m=R(t,za);e.write(`if (!${m}(${f}, ${l}.protocol)) return INVALID;`)}if(!o)return null;const p=P(t),h=s.normalize?`${f}.href`:`${R(t,Ao)}(${d})`;return e.write(`const ${p} = ${h};`),p}const a=n.fn;if(a){if(Zt(a))throw new B(`async string format ${i}`);const u=R(t,a);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(wb.has(i)&&n.pattern){const u=R(t,n.pattern);return e.write(`${u}.lastIndex = 0;`),e.write(`if (!${u}.test(${r})) return INVALID;`),r}const c=n.format;switch(c){case"regex":throw new B("regex format without a pattern");case"lowercase":e.write(`if (${r} !== ${r}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${r} !== ${r}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${r}.includes(${De(n.includes)})) return INVALID;`);break;case"starts_with":{const u=n.prefix;e.write(`if (${r}.slice(0, ${u.length}) !== ${De(u)}) return INVALID;`);break}case"ends_with":{const u=n.suffix;e.write(`if (${r}.slice(-${u.length}) !== ${De(u)}) return INVALID;`);break}default:throw new B(`string format ${c}`)}return r}function se(e,t,n,r,o=!0){const i=n._zod.def,s=i.type;if(i.coerce)throw new B(`coercion (z.coerce.${s}())`);const a=o||!!i.checks?.length;let c;switch(s){case"string":c=vb(e,t,n,r,a);break;case"number":c=kb(e,n,r);break;case"boolean":c=$b(e,r);break;case"bigint":c=Sb(e,n,r);break;case"symbol":c=Ib(e,r);break;case"undefined":c=xb(e,r);break;case"null":c=zb(e,r);break;case"any":case"unknown":c=r;break;case"never":e.write("return INVALID;"),c=r;break;case"void":c=Tb(e,r);break;case"nan":c=Eb(e,r);break;case"date":c=Cb(e,r);break;case"object":c=Ab(e,t,n,r,a);break;case"optional":c=Nb(e,t,n,r,a);break;case"nullable":c=Mb(e,t,n,r,a);break;case"array":c=Rb(e,t,n,r,a);break;case"literal":c=Lb(e,t,n,r);break;case"enum":c=Db(e,t,n,r);break;case"readonly":{const u=sd(e,t,n,r),l=P(t);e.write(`const ${l} = Object.freeze(${u});`),c=l;break}case"success":sd(e,t,n,r),c="true";break;case"default":case"prefault":c=Zb(e,t,n,r);break;case"nonoptional":c=jb(e,t,n,r);break;case"tuple":c=Fb(e,t,n,r);break;case"union":c=Ub(e,t,n,r);break;case"intersection":c=Hb(e,t,n,r);break;case"record":c=Bb(e,t,n,r);break;case"map":c=Jb(e,t,n,r);break;case"set":c=Wb(e,t,n,r);break;case"file":c=Gb(e,r);break;case"template_literal":c=Yb(e,t,n,r);break;case"lazy":c=Qb(e,t,n,r);break;case"pipe":c=Xb(e,t,n,r);break;case"custom":c=ew(e,t,n,r);break;case"transform":c=rw(e,t,n,r);break;case"catch":c=nw(e,t,n,r);break;default:throw new B(`schema type ${s}`)}return c===null?null:lb(e,t,n,c)}function vb(e,t,n,r,o=!0){e.write(`if (typeof ${r} !== "string") return INVALID;`);const i=n._zod.def;return i.format===void 0?r:Kh(e,t,i,r,o)}function kb(e,t,n){e.write(`if (typeof ${n} !== "number" || !Number.isFinite(${n})) return INVALID;`);const r=t._zod.def;return r.check==="number_format"&&r.format&&Bh(e,{format:r.format},n),n}function $b(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function Sb(e,t,n){e.write(`if (typeof ${n} !== "bigint") return INVALID;`);const r=t._zod.def;if(r.format)switch(r.format){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break}return n}function Ib(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function xb(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function zb(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function Tb(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function Eb(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function Cb(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function Ab(e,t,n,r,o=!0){const i=n._zod.def;e.write(`if (typeof ${r} !== "object" || ${r} === null || Array.isArray(${r})) return INVALID;`);const s=i.shape,a=Object.keys(s),c=Object.getOwnPropertySymbols(s),u=c.length?[...a,...c]:a,l=w=>typeof w=="symbol"?R(t,w):De(w),d=w=>typeof w=="symbol"?`[${l(w)}]`:De(w),f=s;if(a.includes("__proto__"))throw new B('object shape key "__proto__"');const p=new Map;for(const w of u){const S=f[w],T=l(w),O=P(t);if(e.write(`const ${O} = ${r}[${T}];`),S._zod.optin!==void 0){const C=P(t);e.write(`let ${C} = (() => {`),e.indented(L=>{const ue=Ie(L,t,S,O);L.write(`return ${ue};`)}),e.write("})();"),S._zod.optout==="optional"?(e.write(`if (${C} === INVALID) {`),e.indented(L=>{L.write(`if (${T} in ${r}) return INVALID;`),L.write(`${C} = undefined;`)}),e.write("}")):e.write(`if (${C} === INVALID) return INVALID;`),p.set(w,C)}else{Pb(S)&&e.write(`if (!(${T} in ${r})) return INVALID;`);const C=Ie(e,t,S,O,o);C!==null&&p.set(w,C)}}const h=i.catchall;let m="none";if(h){const w=h._zod.def.type;if(w==="never"){const S=a.map(T=>`k !== ${De(T)}`).join(" && ")||"true";e.write(`for (const k in ${r}) {`),e.indented(T=>{T.write(`if (${S}) return INVALID;`)}),e.write("}")}else(w==="unknown"||w==="any")&&!h._zod.def.checks?.length?m="passthrough":m="schema"}const y=P(t),$=u.some(w=>id(f[w])||As(f[w]));if(!o){if(m==="schema"){const w=a.length>0?R(t,new Set(a)):null;e.write(`for (const k in ${r}) {`),e.indented(S=>{S.write('if (k === "__proto__") continue;'),w&&S.write(`if (${w}.has(k)) continue;`);const T=P(t);S.write(`const ${T} = ${r}[k];`),Ie(S,t,h,T,!1)}),e.write("}")}return null}if($){e.write(`const ${y} = {};`);for(const w of u){const S=l(w),T=p.get(w);As(f[w])?e.write(`if (${S} in ${r}) ${y}[${S}] = ${T};`):id(f[w])?e.write(`if (${T} !== undefined || ${S} in ${r}) ${y}[${S}] = ${T};`):e.write(`${y}[${S}] = ${T};`)}}else{const w=u.map(S=>`${d(S)}: ${p.get(S)}`).join(", ");e.write(`const ${y} = { ${w} };`)}if(m!=="none"){const w=a.length>0?R(t,new Set(a)):null;e.write(`for (const k in ${r}) {`),e.indented(S=>{if(S.write('if (k === "__proto__") continue;'),w&&S.write(`if (${w}.has(k)) continue;`),m==="passthrough")S.write(`${y}[k] = ${r}[k];`);else{const T=P(t);S.write(`const ${T} = ${r}[k];`);const O=Ie(S,t,h,T);S.write(`${y}[k] = ${O};`)}}),e.write("}")}return y}function Nb(e,t,n,r,o=!0){const i=n._zod.def;if(Ob(n))return se(e,t,i.innerType,r,o);if(i.innerType._zod.optin==="defaulted"){const a=P(t),c=P(t);return e.write(`let ${a};`),e.write(`if (${r} === undefined) {`),e.indented(u=>{u.write(`const ${c} = (() => {`),u.indented(l=>{const d=se(l,t,i.innerType,r);l.write(`return ${d};`)}),u.write("})();"),u.write(`if (${c} !== INVALID) ${a} = ${c};`)}),e.write("} else {"),e.indented(u=>{const l=se(u,t,i.innerType,r);u.write(`${a} = ${l};`)}),e.write("}"),a}const s=o?P(t):null;return s&&e.write(`let ${s};`),e.write(`if (${r} !== undefined) {`),e.indented(a=>{const c=se(a,t,i.innerType,r,o);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function Ob(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function Pb(e){return e._zod.optin===void 0&&Mt(e)}function Mt(e){if(e._zod.def.coerce)return!0;const t=e._zod.def;switch(t.type){case"any":case"unknown":case"undefined":case"void":case"default":case"prefault":case"transform":case"custom":case"lazy":return!0;case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"never":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":return!1;case"nonoptional":return t.innerType?Mt(t.innerType):!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return t.innerType?Mt(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(Mt):!0;case"intersection":return!t.left||!t.right?!0:Mt(t.left)&&Mt(t.right);case"pipe":return t.in?Mt(t.in):!0;default:return!0}}function As(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function id(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&Wt(e)}function Wt(e){const t=e._zod.def;switch(t.type){case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":case"never":case"success":return!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return t.innerType?Wt(t.innerType):!0;case"union":return t.options?t.options.some(Wt):!0;case"intersection":return!t.left||!t.right||Wt(t.left)||Wt(t.right);case"pipe":return t.out?Wt(t.out):!0;default:return!0}}function Mb(e,t,n,r,o=!0){const i=n._zod.def,s=o?P(t):null;return s&&e.write(`let ${s} = null;`),e.write(`if (${r} !== null) {`),e.indented(a=>{const c=se(a,t,i.innerType,r,o);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function Rb(e,t,n,r,o=!0){const i=n._zod.def;e.write(`if (!Array.isArray(${r})) return INVALID;`);const s=o?P(t):null,a=P(t),c=P(t);return s&&e.write(`const ${s} = new Array(${r}.length);`),e.write(`for (let ${a} = 0; ${a} < ${r}.length; ${a}++) {`),e.indented(u=>{u.write(`const ${c} = ${r}[${a}];`);const l=Ie(u,t,i.element,c,o);s&&l!==null&&u.write(`${s}[${a}] = ${l};`)}),e.write("}"),s}function Lb(e,t,n,r){const i=n._zod.def.values;if(i.length!==1){const a=R(t,new Set(i));return e.write(`if (!${a}.has(${r})) return INVALID;`),r}const s=i[0];if(typeof s=="number"&&Number.isNaN(s)){const a=R(t,new Set(i));return e.write(`if (!${a}.has(${r})) return INVALID;`),r}if(typeof s=="string")e.write(`if (${r} !== ${De(s)}) return INVALID;`);else if(typeof s=="number"||typeof s=="boolean")e.write(`if (${r} !== ${s}) return INVALID;`);else if(s===null)e.write(`if (${r} !== null) return INVALID;`);else if(s===void 0)e.write(`if (${r} !== undefined) return INVALID;`);else if(typeof s=="bigint")e.write(`if (${r} !== ${s}n) return INVALID;`);else throw new B(`literal type ${typeof s}`);return r}function Db(e,t,n,r){const o=n._zod.values;if(!o)throw new B("enum schema without enumerated values");const i=R(t,o);return e.write(`if (!${i}.has(${r})) return INVALID;`),r}function sd(e,t,n,r){const o=n._zod.def;return se(e,t,o.innerType,r)}function Zb(e,t,n,r){const o=n._zod.def,s=Object.getOwnPropertyDescriptor(n._zod.def,"defaultValue")?()=>n._zod.def.defaultValue:void 0;if(n._zod.def.type==="prefault"){if(!s)return se(e,t,o.innerType,r);const c=R(t,s),u=P(t);return e.write(`let ${u} = ${r};`),e.write(`if (${r} === undefined) ${u} = ${c}();`),se(e,t,o.innerType,u)}const a=P(t);if(s){const c=R(t,s),u=R(t,Qn);e.write(`let ${a};`),e.write(`if (${r} === undefined) {`),e.indented(l=>{l.write(`${a} = ${u}(${c}());`)}),e.write("} else {"),e.indented(l=>{const d=se(l,t,o.innerType,r);l.write(`${a} = ${d} === undefined ? ${u}(${c}()) : ${d};`)}),e.write("}")}else e.write(`let ${a};`),e.write(`if (${r} !== undefined) {`),e.indented(c=>{const u=se(c,t,o.innerType,r);c.write(`${a} = ${u};`)}),e.write("}");return a}function jb(e,t,n,r){const o=n._zod.def,i=se(e,t,o.innerType,r),s=P(t);return e.write(`const ${s} = ${i};`),e.write(`if (${s} === undefined) return INVALID;`),s}function Fb(e,t,n,r){const o=n._zod.def,i=o.items,s=o.rest;e.write(`if (!Array.isArray(${r})) return INVALID;`);const a=ad(i,"optin"),c=ad(i,"optout");s?e.write(`if (${r}.length < ${a}) return INVALID;`):e.write(`if (${r}.length < ${a} || ${r}.length > ${i.length}) return INVALID;`);const u=P(t);e.write(`const ${u} = [];`);for(let l=0;l<i.length;l++){const d=i[l];if(l>=c)e.write(`if (${u}.length === ${l}) {`),e.indented(f=>{f.write(`if (${l} < ${r}.length) {`),f.indented(p=>{const h=P(t);p.write(`const ${h} = ${r}[${l}];`);const m=Ie(p,t,d,h);p.write(`${u}[${l}] = ${m};`)}),f.write("} else {"),f.indented(p=>{if(As(d)){p.write(`${u}.length = ${l};`);return}const h=P(t),m=P(t);p.write(`const ${h} = undefined;`),p.write(`const ${m} = (() => {`),p.indented(y=>{const $=Ie(y,t,d,h);y.write(`return ${$};`)}),p.write("})();"),p.write(`if (${m} === INVALID || ${m} === undefined) ${u}.length = ${l};`),p.write(`else ${u}[${l}] = ${m};`)}),f.write("}")}),e.write("}");else{const f=P(t);e.write(`const ${f} = ${r}[${l}];`);const p=Ie(e,t,d,f);e.write(`${u}[${l}] = ${p};`)}}if(s){const l=P(t),d=P(t);e.write(`for (let ${l} = ${i.length}; ${l} < ${r}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${d} = ${r}[${l}];`);const p=Ie(f,t,s,d);f.write(`${u}[${l}] = ${p};`)}),e.write("}")}return u}function ad(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function Ub(e,t,n,r){const o=n._zod.def,i=o.options;if(o.discriminator)return Vb(e,t,o,r);if(o.inclusive===!1)throw new B("exclusive unions (z.xor)");if(i.length===0)return e.write("return INVALID;"),r;if(i.length===1)return se(e,t,i[0],r);if(i.every(c=>c._zod.def.type==="literal"&&!c._zod.def.checks?.length)){const c=new Set(i.flatMap(l=>l._zod.def.values)),u=R(t,c);return e.write(`if (!${u}.has(${r})) return INVALID;`),r}const a=P(t);e.write(`let ${a};`);for(let c=0;c<i.length;c++){const u=i[c];c===0?e.write(`${a} = (() => {`):e.write(`if (${a} === INVALID) ${a} = (() => {`),e.indented(l=>{const d=se(l,t,u,r);l.write(`return ${d};`)}),e.write("})();")}return e.write(`if (${a} === INVALID) return INVALID;`),a}function Vb(e,t,n,r){if(n.unionFallback)throw new B("discriminated union with unionFallback");if(n.options.length===0)return e.write("return INVALID;"),r;const o=P(t),i=P(t);e.write(`const ${o} = ${r}?.[${De(n.discriminator)}];`),e.write(`let ${i};`);let s=!0;const a=new Set;for(const c of n.options){const u=c._zod.propValues?.[n.discriminator];if(!u||u.size===0)throw new B("discriminated union option without static discriminator values");for(const f of u){if(a.has(f))throw new B(`duplicate discriminator value ${String(f)}`);a.add(f)}const l=Array.from(u,f=>qb(t,o,f)),d=s?"if":"else if";e.write(`${d} (${l.join(" || ")}) {`),e.indented(f=>{const p=se(f,t,c,r);f.write(`${i} = ${p};`)}),e.write("}"),s=!1}return e.write("else { return INVALID; }"),i}function qb(e,t,n){if(typeof n=="string")return`${t} === ${De(n)}`;if(typeof n=="number")return Number.isNaN(n)?`Number.isNaN(${t})`:`${t} === ${n}`;if(typeof n=="boolean")return`${t} === ${n}`;if(n===null)return`${t} === null`;if(n===void 0)return`${t} === undefined`;if(typeof n=="bigint")return`${t} === ${n}n`;if(typeof n=="symbol"){const r=R(e,n);return`${t} === ${r}`}throw new B(`literal discriminator value ${String(n)}`)}function Hb(e,t,n,r){const o=n._zod.def;t.definite=!1;const i=Ie(e,t,o.left,r),s=Ie(e,t,o.right,r),a=R(t,qn),c=P(t);return e.write(`const ${c} = ${a}(${i}, ${s});`),e.write(`if (!${c}.valid) return INVALID;`),`${c}.data`}function Bb(e,t,n,r){const o=n._zod.def,i=R(t,ct);e.write(`if (!${i}(${r})) return INVALID;`);const s=P(t),a=P(t),c=P(t);e.write(`const ${s} = {};`);const u=o,l=u.partial?void 0:o.keyType._zod.values;if(l){const p=[];for(const m of l){if(!(typeof m=="string"||typeof m=="number"||typeof m=="symbol"))throw new B(`record key value ${String(m)}`);const y=typeof m=="number"?m.toString():m;if(y==="__proto__")throw new B('record key "__proto__"');p.push(y);const $=R(t,m),w=se(e,t,o.keyType,$),S=P(t);e.write(`const ${S} = ${r}[${Kb(t,y)}];`);const T=Ie(e,t,o.valueType,S);e.write(`${s}[${w}] = ${T};`)}const h=R(t,new Set(p));return e.write(`for (const ${a} in ${r}) {`),e.indented(m=>{m.write(`if (${h}.has(${a})) continue;`),u.mode==="loose"?m.write(`if (${a} !== "__proto__") ${s}[${a}] = ${r}[${a}];`):m.write("return INVALID;")}),e.write("}"),s}const d=o.keyType._zod.def;if(!(d.type==="string"&&d.format===void 0&&!d.coerce&&(d.checks?.length??0)===0)){const p=o.mode==="loose",h=oi(o.keyType);h.definite===!1&&(t.definite=!1);const m=R(t,h),y=R(t,ln),$=P(t);return cd(e,t,r,a,w=>{w.write(`let ${$} = ${m}(${a});`),w.write(`if (${$} === INVALID && typeof ${a} === "string" && ${y}.test(${a})) ${$} = ${m}(Number(${a}));`),p?w.write(`if (${$} === INVALID) { ${s}[${a}] = ${r}[${a}]; continue; }`):w.write(`if (${$} === INVALID) return INVALID;`),w.write(`if (${$} === "__proto__") continue;`);const S=P(t);w.write(`const ${S} = ${r}[${a}];`);const T=Ie(w,t,o.valueType,S);w.write(`${s}[${$}] = ${T};`)}),s}return cd(e,t,r,a,p=>{p.write(`const ${c} = ${r}[${a}];`);const h=Ie(p,t,o.valueType,c);p.write(`${s}[${a}] = ${h};`)},"return INVALID;"),s}function cd(e,t,n,r,o,i){const s=R(t,Object.prototype.propertyIsEnumerable),a=P(t),c=P(t),u=P(t);e.write(`const ${a} = Object.getOwnPropertySymbols(${n});`),e.write(`const ${c} = Object.getOwnPropertyNames(${n});`),e.write(`for (let ${u} = 0; ${u} < ${c}.length; ${u}++) {`),e.indented(l=>{l.write(`const ${r} = ${c}[${u}];`),l.write(`if (${r} === "__proto__" || !${s}.call(${n}, ${r})) continue;`),o(l)}),e.write("}"),e.write(`for (let ${u} = 0; ${u} < ${a}.length; ${u}++) {`),e.indented(l=>{l.write(`const ${r} = ${a}[${u}];`),l.write(`if (!${s}.call(${n}, ${r})) continue;`),i?l.write(i):o(l)}),e.write("}")}function Kb(e,t){return typeof t=="string"?De(t):R(e,t)}function Jb(e,t,n,r){const o=n._zod.def;e.write(`if (!(${r} instanceof Map)) return INVALID;`);const i=P(t),s=P(t),a=P(t);return e.write(`const ${i} = new Map();`),e.write(`for (const [${s}, ${a}] of ${r}) {`),e.indented(c=>{const u=se(c,t,o.keyType,s),l=se(c,t,o.valueType,a);c.write(`${i}.set(${u}, ${l});`)}),e.write("}"),i}function Wb(e,t,n,r){const o=n._zod.def;e.write(`if (!(${r} instanceof Set)) return INVALID;`);const i=P(t),s=P(t);return e.write(`const ${i} = new Set();`),e.write(`for (const ${s} of ${r}) {`),e.indented(a=>{const c=se(a,t,o.valueType,s);a.write(`${i}.add(${c});`)}),e.write("}"),i}function Gb(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function Yb(e,t,n,r){e.write(`if (typeof ${r} !== "string") return INVALID;`);const o=n._zod.pattern;if(o){const i=R(t,o);e.write(`${i}.lastIndex = 0;`),e.write(`if (!${i}.test(${r})) return INVALID;`)}return r}function Qb(e,t,n,r){const o=n._zod.def,i=Dt(t,o.getter),s=R(t,{parser:null});e.write(`if (!${s}.parser) {`),e.indented(c=>{c.write(`const inner = ${i}();`),c.write(`${s}.parser = function(input) {`),c.indented(u=>{u.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),u.write("return result.issues.length === 0 ? result.value : INVALID;")}),c.write("};")}),e.write("}");const a=P(t);return e.write(`const ${a} = ${s}.parser(${r});`),e.write(`if (${a} === INVALID) return INVALID;`),a}function Xb(e,t,n,r){const o=n._zod.def,i=se(e,t,o.in,r);if(o.transform){if(Zt(o.transform))throw new dt("z.compile: async transforms in pipes are not supported");const s=o.transform,c=Dt(t,l=>{const d={value:l,issues:[],addIssue:Wa},f=s(l,d);return f instanceof Promise?Ce:d.issues.length===0?f:Ce}),u=P(t);return e.write(`const ${u} = ${c}(${i});`),e.write(`if (${u} === INVALID) return INVALID;`),se(e,t,o.out,u)}else return se(e,t,o.out,i)}function Zt(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function ew(e,t,n,r){const o=n._zod.def;if(o.fn){if(Zt(o.fn))throw new dt("z.compile: async custom predicates are not supported");const i=Dt(t,o.fn),s=R(t,Cs),a=P(t);e.write(`const ${a} = ${i}(${r});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`)}else throw new B("custom schema without a predicate function");return r}function tw(e,t,n){const r=e._zod.run({value:n,issues:[]},{});if(r&&typeof r.then=="function")return Ce;const o=r;return o.issues.length===0?o.value:t()}function nw(e,t,n,r){const o=n._zod.def;if(!o.catchValue[Qs])throw new B("catch with a callback (only a constant catch value compiles)",!1);const i=P(t);e.write(`let ${i} = (() => {`),e.indented(u=>{const l=Ie(u,t,o.innerType,r);u.write(`return ${l};`)}),e.write("})();");const s=R(t,o.innerType),a=Dt(t,o.catchValue),c=R(t,tw);return e.write(`if (${i} === INVALID) {`),e.indented(u=>{u.write(`${i} = ${c}(${s}, ${a}, ${r});`),u.write(`if (${i} === INVALID) return INVALID;`)}),e.write("}"),i}function rw(e,t,n,r){const o=n._zod.def;if(o.transform){if(Zt(o.transform))throw new dt("z.compile: async transforms are not supported");const i=o.transform,a=Dt(t,u=>{const l={value:u,issues:[],addIssue:Wa},d=i(u,l);return d instanceof Promise?Ce:l.issues.length===0?d:Ce}),c=P(t);return e.write(`const ${c} = ${a}(${r});`),e.write(`if (${c} === INVALID) return INVALID;`),c}return r}function ii(e){return e.checks&&(e.checks=[...e.checks]),e}function Jh(e,t){return new e(ii({type:"string",...I(t)}))}function Wh(e,t){return new e(ii({type:"string",coerce:!0,...I(t)}))}function Ga(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...I(t)})}function Ya(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...I(t)})}function Qa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...I(t)})}function Xa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(t)})}function ec(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(t)})}function tc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(t)})}function si(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...I(t)})}function nc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...I(t)})}function rc(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(t)})}function oc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...I(t)})}function ic(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(t)})}function sc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...I(t)})}function ac(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...I(t)})}function cc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(t)})}function uc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(t)})}function lc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(t)})}function Gh(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...I(t)})}function dc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(t)})}function fc(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(t)})}function pc(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...I(t)})}function hc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...I(t)})}function mc(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...I(t)})}function Yh(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...I(t)})}function Qh(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...I(t)})}function gc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...I(t)})}const yc={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function _c(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(t)})}function bc(e,t){return new e({type:"string",format:"date",check:"string_format",...I(t)})}function wc(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...I(t)})}function vc(e,t){return new e({type:"string",format:"duration",check:"string_format",...I(t)})}function Xh(e,t){return new e(ii({type:"number",checks:[],...I(t)}))}function em(e,t){return new e(ii({type:"number",coerce:!0,checks:[],...I(t)}))}function tm(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...I(t)})}function nm(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...I(t)})}function rm(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...I(t)})}function om(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...I(t)})}function im(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...I(t)})}function sm(e,t){return new e({type:"boolean",...I(t)})}function am(e,t){return new e({type:"boolean",coerce:!0,...I(t)})}function cm(e,t){return new e({type:"bigint",...I(t)})}function um(e,t){return new e({type:"bigint",coerce:!0,...I(t)})}function lm(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...I(t)})}function dm(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...I(t)})}function fm(e,t){return new e({type:"symbol",...I(t)})}function pm(e,t){return new e({type:"undefined",...I(t)})}function hm(e,t){return new e({type:"null",...I(t)})}function mm(e){return new e({type:"any"})}function gm(e){return new e({type:"unknown"})}function ym(e,t){return new e({type:"never",...I(t)})}function _m(e,t){return new e({type:"void",...I(t)})}function bm(e,t){return new e({type:"date",...I(t)})}function wm(e,t){return new e({type:"date",coerce:!0,...I(t)})}function vm(e,t){return new e({type:"nan",...I(t)})}function ft(e,t){return new ba({check:"less_than",...I(t),value:e,inclusive:!1})}function Ze(e,t){return new ba({check:"less_than",...I(t),value:e,inclusive:!0})}function pt(e,t){return new wa({check:"greater_than",...I(t),value:e,inclusive:!1})}function je(e,t){return new wa({check:"greater_than",...I(t),value:e,inclusive:!0})}function ai(e){return pt(0,e)}function ci(e){return ft(0,e)}function ui(e){return Ze(0,e)}function li(e){return je(0,e)}function jt(e,t){return new sp({check:"multiple_of",...I(t),value:e})}function qt(e,t){return new up({check:"max_size",...I(t),maximum:e})}function ht(e,t){return new lp({check:"min_size",...I(t),minimum:e})}function dn(e,t){return new dp({check:"size_equals",...I(t),size:e})}function fn(e,t){return new fp({check:"max_length",...I(t),maximum:e})}function St(e,t){return new pp({check:"min_length",...I(t),minimum:e})}function pn(e,t){return new hp({check:"length_equals",...I(t),length:e})}function ur(e,t){return new mp({check:"string_format",format:"regex",...I(t),pattern:e})}function lr(e){return new gp({check:"string_format",format:"lowercase",...I(e)})}function dr(e){return new yp({check:"string_format",format:"uppercase",...I(e)})}function fr(e,t){return new _p({check:"string_format",format:"includes",...I(t),includes:e})}function pr(e,t){return new bp({check:"string_format",format:"starts_with",...I(t),prefix:e})}function hr(e,t){return new wp({check:"string_format",format:"ends_with",...I(t),suffix:e})}function di(e,t,n){return new vp({check:"property",property:e,schema:t,...I(n)})}function mr(e,t){return new kp({check:"properties",shape:e,...I(t)})}function gr(e,t){return new $p({check:"mime_type",mime:e,...I(t)})}function nt(e){return new Sp({check:"overwrite",tx:e})}function yr(e){return nt(t=>t.normalize(e))}function _r(){return nt(e=>e.trim())}function br(){return nt(e=>e.toLowerCase())}function wr(){return nt(e=>e.toUpperCase())}function vr(){return nt(e=>tf(e))}function km(e,t,n){return new e({type:"array",element:t,...I(n)})}function ow(e,t,n){return new e({type:"union",options:t,...I(n)})}function iw(e,t,n){return new e({type:"union",options:t,inclusive:!1,...I(n)})}function sw(e,t,n,r){return new e({type:"union",options:n,discriminator:t,...I(r)})}function aw(e,t,n){return new e({type:"intersection",left:t,right:n})}function cw(e,t,n,r){const o=n instanceof D,i=o?r:n,s=o?n:null;return new e({type:"tuple",items:t,rest:s,...I(i)})}function uw(e,t,n,r){return new e({type:"record",keyType:t,valueType:n,...I(r)})}function lw(e,t,n,r){return new e({type:"map",keyType:t,valueType:n,...I(r)})}function dw(e,t,n){return new e({type:"set",valueType:t,...I(n)})}function fw(e,t,n){const r=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new e({type:"enum",entries:r,...I(n)})}function pw(e,t,n){return new e({type:"enum",entries:t,...I(n)})}function hw(e,t,n){return new e({type:"literal",values:Array.isArray(t)?t:[t],...I(n)})}function $m(e,t){return new e({type:"file",...I(t)})}function mw(e,t){return new e({type:"transform",transform:t})}function gw(e,t){return new e({type:"optional",innerType:t})}function yw(e,t){return new e({type:"nullable",innerType:t})}function _w(e,t,n){return new e({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():Qn(n)}})}function bw(e,t,n){return new e({type:"nonoptional",innerType:t,...I(n)})}function ww(e,t){return new e({type:"success",innerType:t})}function vw(e,t,n){return new e({type:"catch",innerType:t,catchValue:typeof n=="function"?n:Xs(n)})}function kw(e,t,n){return new e({type:"pipe",in:t,out:n})}function $w(e,t){return new e({type:"readonly",innerType:t})}function Sw(e,t,n){return new e({type:"template_literal",parts:t,...I(n)})}function Iw(e,t){return new e({type:"lazy",getter:t})}function xw(e,t){return new e({type:"promise",innerType:t})}function Sm(e,t,n){const r=I(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function Im(e,t,n){return new e({type:"custom",check:"custom",fn:t,...I(n)})}function xm(e,t){const n=zm(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(Qt(o,r.value,n._zod.def));else{const i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push(Qt(i))}},e(r.value,r)),t);return n}function zm(e,t){const n=new ie({check:"custom",...I(t)});return n._zod.check=e,n}function Tm(e){const t=new ie({check:"describe"});return t._zod.onattach=[n=>{const r=Le.get(n)??{};Le.add(n,{...r,description:e})}],t._zod.check=()=>{},t}function Em(e){const t=new ie({check:"meta"});return t._zod.onattach=[n=>{const r=Le.get(n)??{};Le.add(n,{...r,...e})}],t._zod.check=()=>{},t}function Cm(e,t){const n=I(t);let r=n.truthy??["true","1","yes","on","y","enabled"],o=n.falsy??["false","0","no","off","n","disabled"];n.case!=="sensitive"&&(r=r.map(p=>typeof p=="string"?p.toLowerCase():p),o=o.map(p=>typeof p=="string"?p.toLowerCase():p));const i=new Set(r),s=new Set(o),a=e.Codec??Fa,c=e.Boolean??Ma,u=e.String??cr,l=new u({type:"string",error:n.error}),d=new c({type:"boolean",error:n.error}),f=new a({type:"pipe",in:l,out:d,transform:((p,h)=>{let m=p;return n.case!=="sensitive"&&(m=m.toLowerCase()),i.has(m)?!0:s.has(m)?!1:(h.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:h.value,inst:f,continue:!1}),{})}),reverseTransform:((p,h)=>p===!0?r[0]||"true":o[0]||"false"),error:n.error});return f._zod.bag.truthy=r,f._zod.bag.falsy=o,f._zod.bag.case=n.case??"insensitive",f}function hn(e,t,n,r={}){const o=I(r),i={check:"string_format",type:"string",format:t,fn:typeof n=="function"?n:a=>n.test(a),...o};return n instanceof RegExp&&(i.pattern=n),new e(i)}function Fn(e,...t){for(const n of t)for(const r of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,r)&&Fe(e,r,n[r]);return e}function en(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Le,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function ye(e,t,n,r,o){const i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:r.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(n,i),!0}function te(e,t,n={path:[],schemaPath:[]}){var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const l={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{const f=s.schema,p=t.processors[o.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(e,t,f,l)}const d=e._zod.parent;d&&(s.ref||(s.ref=d),te(d,t,l),t.seen.get(d).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Fn(s.schema,c),t.io==="input"&&ze(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function ud(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function tn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;const r=new Map;for(const s of e.seen.entries()){const a=e.metadataRegistry.get(s[0])?.id;if(a){const c=r.get(a);if(c&&c!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,s[0])}}const o=s=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const d=e.external.registry.get(s[0])?.id,f=e.external.uri??(h=>h);if(d)return{ref:f(d)};const p=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=p,{defId:p,ref:`${f("__shared")}#/${a}/${ud(p)}`}}const c="#",u=`${c}/${a}/`;if(s[1]===n&&!s[1].schema.id)return{ref:c};const l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+ud(l)}},i=s=>{if(s[1].schema.$ref)return;const a=s[1],{ref:c,defId:u}=o(s);a.def={...a.schema},u&&(a.defId=u);const l=a.schema;for(const d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(const s of e.seen.entries()){const a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
68
|
+
}`;let f;try{f=new l(...i,d)(...a)}catch(p){throw new G(`this schema (generated code failed to evaluate: ${p.message})`)}return t?.debug&&(f.code=u),f.definite=r.definite,f}function Z(e,t){for(const[r,o]of e.constants)if(o===t)return r;const n=`c${e.constantCounter++}`;return e.constants.set(n,t),n}function Ut(e,t){return e.definite=!1,Z(e,t)}function L(e){return`v${e.varCounter++}`}function mb(e,t){const n=e._zod.run({value:t,issues:[]},{});if(n&&typeof n.then=="function")return Ae;const r=n;return r.issues.length===0?r.value:Ae}function Ie(e,t,n,r,o=!0){const s=e.content.length,i=t.constants.size,a=t.constantCounter,c=t.varCounter;try{return de(e,t,n,r,o)}catch(u){if(!(u instanceof G)||!u.islandable)throw u;if(e.content.length=s,t.constants.size>i){const l=Array.from(t.constants.keys()).slice(i);for(const d of l)t.constants.delete(d)}return t.constantCounter=a,t.varCounter=c,gb(e,t,n,r)}}function gb(e,t,n,r){t.definite=!1;const o=Z(t,n),s=Z(t,mb),i=L(t);return e.write(`const ${i} = ${s}(${o}, ${r});`),e.write(`if (${i} === INVALID) return INVALID;`),i}const yb=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function _b(e,t,n,r){const o=n._zod.def.checks;if(!o||o.length===0)return r;let s=r;for(const i of o){const a=i._zod.def;if(a.when&&!yb.has(a.check))throw new G('check with a custom "when" condition');switch(a.check){case"greater_than":bb(e,t,a,s);break;case"less_than":wb(e,t,a,s);break;case"multiple_of":vb(e,t,a,s);break;case"number_format":rm(e,a,s);break;case"min_length":{const c=Rt(a.minimum,"min_length"),u=Ni(e,t,s,`${s}.length >= ${c} && ${s}.length < ${a.minimum*2}`);e.write(`if (${u} < ${c}) return INVALID;`);break}case"max_length":{const c=Rt(a.maximum,"max_length"),u=Ni(e,t,s,`${s}.length > ${c}`);e.write(`if (${u} > ${c}) return INVALID;`);break}case"length_equals":{const c=Rt(a.length,"length_equals"),u=Ni(e,t,s,`${s}.length >= ${c} && ${s}.length <= ${a.length*2}`);e.write(`if (${u} !== ${c}) return INVALID;`);break}case"min_size":e.write(`if (${s}.size < ${Rt(a.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${s}.size > ${Rt(a.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${s}.size !== ${Rt(a.size,"size_equals")}) return INVALID;`);break;case"string_format":s=om(e,t,a,s);break;case"custom":s=zb(e,t,i,s);break;case"bigint_format":kb(e,a,s);break;case"mime_type":$b(e,t,a,s);break;case"property":xb(e,t,a,s);break;case"properties":Sb(e,t,a,s);break;case"overwrite":{const c=L(t);Ib(e,t,i,s,c),s=c;break}default:throw new G(`check type ${a.check}`)}}return s}function Ni(e,t,n,r){const o=Z(t,dr),s=L(t);return e.write(`const ${s} = typeof ${n} === "string" && ${r} ? ${o}(${n}) : ${n}.length;`),s}function Rt(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new G(`${t} bound of type ${typeof e}`);return`${e}`}function nm(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new G("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new G("comparison check with Invalid Date bound");return Z(e,t)}throw new G(`comparison check bound of type ${typeof t}`)}function bb(e,t,n,r){const o=n.inclusive?"<":"<=";e.write(`if (${r} ${o} ${nm(t,n.value)}) return INVALID;`)}function wb(e,t,n,r){const o=n.inclusive?">":">=";e.write(`if (${r} ${o} ${nm(t,n.value)}) return INVALID;`)}function vb(e,t,n,r){if(typeof n.value=="bigint"){if(n.value===BigInt(0))throw new G("multiple_of check with a zero divisor");e.write(`if (${r} % ${n.value}n !== 0n) return INVALID;`)}else{const o=Z(t,pa);e.write(`if (${o}(${r}, ${Rt(n.value,"multiple_of")}) !== 0) return INVALID;`)}}function rm(e,t,n){const r=t.format;switch(r){case"safeint":e.write(`if (!Number.isSafeInteger(${n})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${n}) || ${n} < -2147483648 || ${n} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${n}) || ${n} < 0 || ${n} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${n}) || ${n} < -3.4028234663852886e38 || ${n} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${n})) return INVALID;`);break;default:throw new G(`number format ${r}`)}}function kb(e,t,n){const r=t.format;if(r)switch(r){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break;default:throw new G(`bigint format ${r}`)}}function $b(e,t,n,r){const o=n.mime;if(o&&o.length>0){const s=Z(t,new Set(o));e.write(`if (!${s}.has(${r}.type)) return INVALID;`)}}function Sb(e,t,n,r){if(n.when)throw new G('check with a custom "when" condition');e.write(`if (${r} == null) return INVALID;`);const o=n.shape;for(const s of Reflect.ownKeys(o)){const i=typeof s=="symbol"?Z(t,s):De(s),a=L(t);e.write(`const ${a} = ${r}[${i}];`),Ie(e,t,o[s],a,!1)}}function xb(e,t,n,r){const o=`${r}[${JSON.stringify(n.property)}]`;de(e,t,n.schema,o)}function Ib(e,t,n,r,o){const s=n._zod.def.tx;if(!s)throw new G("overwrite check without a transform function");if(Vt(s))throw new _t("z.compile: async overwrite transforms are not supported");const i=Z(t,s);e.write(`const ${o} = ${i}(${r});`)}function Gi(){throw new pt}function mc(e){this.issues.push(e)}function zb(e,t,n,r){const o=n._zod.def;if(o.fn){if(Vt(o.fn))throw new _t("z.compile: async .refine() predicates are not supported");const s=Ut(t,o.fn),i=Z(t,Gi),a=L(t);return e.write(`const ${a} = ${s}(${r});`),e.write(`if (${a} instanceof Promise) ${i}();`),e.write(`if (!${a}) return INVALID;`),r}if(n._zod.check){if(Vt(n._zod.check))throw new _t("z.compile: async .superRefine() / check functions are not supported");const s=n._zod.check,a=Ut(t,u=>{const l={value:u,issues:[],addIssue:mc};return s(l)instanceof Promise&&Gi(),l.issues.length===0?l.value:Ae}),c=L(t);return e.write(`const ${c} = ${a}(${r});`),e.write(`if (${c} === INVALID) return INVALID;`),c}throw new G("custom check without a predicate or check function")}const Tb=new Set(["cidrv4","cuid","cuid2","date","datetime","duration","e164","email","emoji","ends_with","guid","includes","ipv4","ksuid","lowercase","mac","nanoid","regex","starts_with","time","ulid","uppercase","uuid","xid"]);function om(e,t,n,r,o=!0){const s=n.format;if(s==="base64"){const u=Z(t,gs);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(s==="base64url"){const u=Z(t,Ga);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(s==="jwt"){const u=Z(t,Xa),l=Z(t,n.alg??null);return e.write(`if (!${u}(${r}, ${l})) return INVALID;`),r}if(s==="ipv6"){const u=Z(t,ms);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(s==="cidrv6"){const u=Z(t,Ja);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(s==="credit_card"){const u=Z(t,Ya);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(s==="iban"){const u=Z(t,Qa);return e.write(`if (!${u}(${r})) return INVALID;`),r}const i=n;if(s==="url"||s==="httpurl"||i.normalize||i.hostname!==void 0||i.protocol!==void 0){const u=Z(t,Ha),l=Z(t,n),d=L(t),f=L(t);if(e.write(`const ${d} = ${r}.trim();`),e.write(`const ${f} = ${u}(${d}, ${l});`),e.write(`if (typeof ${f} === "number") return INVALID;`),i.hostname!==void 0){const m=Z(t,Ba);e.write(`if (!${m}(${f}, ${l}.hostname)) return INVALID;`)}if(i.protocol!==void 0){const m=Z(t,Ka);e.write(`if (!${m}(${f}, ${l}.protocol)) return INVALID;`)}if(!o)return null;const p=L(t),h=i.normalize?`${f}.href`:`${Z(t,Wo)}(${d})`;return e.write(`const ${p} = ${h};`),p}const a=n.fn;if(a){if(Vt(a))throw new G(`async string format ${s}`);const u=Z(t,a);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(Tb.has(s)&&n.pattern){const u=Z(t,n.pattern);return e.write(`${u}.lastIndex = 0;`),e.write(`if (!${u}.test(${r})) return INVALID;`),r}const c=n.format;switch(c){case"regex":throw new G("regex format without a pattern");case"lowercase":e.write(`if (${r} !== ${r}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${r} !== ${r}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${r}.includes(${De(n.includes)})) return INVALID;`);break;case"starts_with":{const u=n.prefix;e.write(`if (${r}.slice(0, ${u.length}) !== ${De(u)}) return INVALID;`);break}case"ends_with":{const u=n.suffix;e.write(`if (${r}.slice(-${u.length}) !== ${De(u)}) return INVALID;`);break}default:throw new G(`string format ${c}`)}return r}function de(e,t,n,r,o=!0){const s=n._zod.def,i=s.type;if(s.coerce)throw new G(`coercion (z.coerce.${i}())`);const a=o||!!s.checks?.length;let c;switch(i){case"string":c=Cb(e,t,n,r,a);break;case"number":c=Eb(e,n,r);break;case"boolean":c=Ab(e,r);break;case"bigint":c=Nb(e,n,r);break;case"symbol":c=Ob(e,r);break;case"undefined":c=Pb(e,r);break;case"null":c=Mb(e,r);break;case"any":case"unknown":c=r;break;case"never":e.write("return INVALID;"),c=r;break;case"void":c=Lb(e,r);break;case"nan":c=Rb(e,r);break;case"date":c=Db(e,r);break;case"object":c=Zb(e,t,n,r,a);break;case"optional":c=jb(e,t,n,r,a);break;case"nullable":c=Vb(e,t,n,r,a);break;case"array":c=qb(e,t,n,r,a);break;case"literal":c=Hb(e,t,n,r);break;case"enum":c=Bb(e,t,n,r);break;case"readonly":{const u=gd(e,t,n,r),l=L(t);e.write(`const ${l} = Object.freeze(${u});`),c=l;break}case"success":gd(e,t,n,r),c="true";break;case"default":case"prefault":c=Kb(e,t,n,r);break;case"nonoptional":c=Jb(e,t,n,r);break;case"tuple":c=Wb(e,t,n,r);break;case"union":c=Gb(e,t,n,r);break;case"intersection":c=Xb(e,t,n,r);break;case"record":c=ew(e,t,n,r);break;case"map":c=nw(e,t,n,r);break;case"set":c=rw(e,t,n,r);break;case"file":c=ow(e,r);break;case"template_literal":c=sw(e,t,n,r);break;case"lazy":c=iw(e,t,n,r);break;case"pipe":c=aw(e,t,n,r);break;case"custom":c=cw(e,t,n,r);break;case"transform":c=dw(e,t,n,r);break;case"catch":c=lw(e,t,n,r);break;default:throw new G(`schema type ${i}`)}return c===null?null:_b(e,t,n,c)}function Cb(e,t,n,r,o=!0){e.write(`if (typeof ${r} !== "string") return INVALID;`);const s=n._zod.def;return s.format===void 0?r:om(e,t,s,r,o)}function Eb(e,t,n){e.write(`if (typeof ${n} !== "number" || !Number.isFinite(${n})) return INVALID;`);const r=t._zod.def;return r.check==="number_format"&&r.format&&rm(e,{format:r.format},n),n}function Ab(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function Nb(e,t,n){e.write(`if (typeof ${n} !== "bigint") return INVALID;`);const r=t._zod.def;if(r.format)switch(r.format){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break}return n}function Ob(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function Pb(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function Mb(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function Lb(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function Rb(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function Db(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function Zb(e,t,n,r,o=!0){const s=n._zod.def;e.write(`if (typeof ${r} !== "object" || ${r} === null || Array.isArray(${r})) return INVALID;`);const i=s.shape,a=Object.keys(i),c=Object.getOwnPropertySymbols(i),u=c.length?[...a,...c]:a,l=w=>typeof w=="symbol"?Z(t,w):De(w),d=w=>typeof w=="symbol"?`[${l(w)}]`:De(w),f=i;if(a.includes("__proto__"))throw new G('object shape key "__proto__"');const p=new Map;for(const w of u){const x=f[w],C=l(w),R=L(t);if(e.write(`const ${R} = ${r}[${C}];`),x._zod.optin!==void 0){const O=L(t);e.write(`let ${O} = (() => {`),e.indented(F=>{const oe=Ie(F,t,x,R);F.write(`return ${oe};`)}),e.write("})();"),x._zod.optout==="optional"?(e.write(`if (${O} === INVALID) {`),e.indented(F=>{F.write(`if (${C} in ${r}) return INVALID;`),F.write(`${O} = undefined;`)}),e.write("}")):e.write(`if (${O} === INVALID) return INVALID;`),p.set(w,O)}else{Ub(x)&&e.write(`if (!(${C} in ${r})) return INVALID;`);const O=Ie(e,t,x,R,o);O!==null&&p.set(w,O)}}const h=s.catchall;let m="none";if(h){const w=h._zod.def.type;if(w==="never"){const x=a.map(C=>`k !== ${De(C)}`).join(" && ")||"true";e.write(`for (const k in ${r}) {`),e.indented(C=>{C.write(`if (${x}) return INVALID;`)}),e.write("}")}else(w==="unknown"||w==="any")&&!h._zod.def.checks?.length?m="passthrough":m="schema"}const _=L(t),S=u.some(w=>md(f[w])||Yi(f[w]));if(!o){if(m==="schema"){const w=a.length>0?Z(t,new Set(a)):null;e.write(`for (const k in ${r}) {`),e.indented(x=>{x.write('if (k === "__proto__") continue;'),w&&x.write(`if (${w}.has(k)) continue;`);const C=L(t);x.write(`const ${C} = ${r}[k];`),Ie(x,t,h,C,!1)}),e.write("}")}return null}if(S){e.write(`const ${_} = {};`);for(const w of u){const x=l(w),C=p.get(w);Yi(f[w])?e.write(`if (${x} in ${r}) ${_}[${x}] = ${C};`):md(f[w])?e.write(`if (${C} !== undefined || ${x} in ${r}) ${_}[${x}] = ${C};`):e.write(`${_}[${x}] = ${C};`)}}else{const w=u.map(x=>`${d(x)}: ${p.get(x)}`).join(", ");e.write(`const ${_} = { ${w} };`)}if(m!=="none"){const w=a.length>0?Z(t,new Set(a)):null;e.write(`for (const k in ${r}) {`),e.indented(x=>{if(x.write('if (k === "__proto__") continue;'),w&&x.write(`if (${w}.has(k)) continue;`),m==="passthrough")x.write(`${_}[k] = ${r}[k];`);else{const C=L(t);x.write(`const ${C} = ${r}[k];`);const R=Ie(x,t,h,C);x.write(`${_}[k] = ${R};`)}}),e.write("}")}return _}function jb(e,t,n,r,o=!0){const s=n._zod.def;if(Fb(n))return de(e,t,s.innerType,r,o);if(s.innerType._zod.optin==="defaulted"){const a=L(t),c=L(t);return e.write(`let ${a};`),e.write(`if (${r} === undefined) {`),e.indented(u=>{u.write(`const ${c} = (() => {`),u.indented(l=>{const d=de(l,t,s.innerType,r);l.write(`return ${d};`)}),u.write("})();"),u.write(`if (${c} !== INVALID) ${a} = ${c};`)}),e.write("} else {"),e.indented(u=>{const l=de(u,t,s.innerType,r);u.write(`${a} = ${l};`)}),e.write("}"),a}const i=o?L(t):null;return i&&e.write(`let ${i};`),e.write(`if (${r} !== undefined) {`),e.indented(a=>{const c=de(a,t,s.innerType,r,o);i&&c!==null&&a.write(`${i} = ${c};`)}),e.write("}"),i}function Fb(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function Ub(e){return e._zod.optin===void 0&&Dt(e)}function Dt(e){if(e._zod.def.coerce)return!0;const t=e._zod.def;switch(t.type){case"any":case"unknown":case"undefined":case"void":case"default":case"prefault":case"transform":case"custom":case"lazy":return!0;case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"never":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":return!1;case"nonoptional":return t.innerType?Dt(t.innerType):!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return t.innerType?Dt(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(Dt):!0;case"intersection":return!t.left||!t.right?!0:Dt(t.left)&&Dt(t.right);case"pipe":return t.in?Dt(t.in):!0;default:return!0}}function Yi(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function md(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&on(e)}function on(e){const t=e._zod.def;switch(t.type){case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":case"never":case"success":return!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return t.innerType?on(t.innerType):!0;case"union":return t.options?t.options.some(on):!0;case"intersection":return!t.left||!t.right||on(t.left)||on(t.right);case"pipe":return t.out?on(t.out):!0;default:return!0}}function Vb(e,t,n,r,o=!0){const s=n._zod.def,i=o?L(t):null;return i&&e.write(`let ${i} = null;`),e.write(`if (${r} !== null) {`),e.indented(a=>{const c=de(a,t,s.innerType,r,o);i&&c!==null&&a.write(`${i} = ${c};`)}),e.write("}"),i}function qb(e,t,n,r,o=!0){const s=n._zod.def;e.write(`if (!Array.isArray(${r})) return INVALID;`);const i=o?L(t):null,a=L(t),c=L(t);return i&&e.write(`const ${i} = new Array(${r}.length);`),e.write(`for (let ${a} = 0; ${a} < ${r}.length; ${a}++) {`),e.indented(u=>{u.write(`const ${c} = ${r}[${a}];`);const l=Ie(u,t,s.element,c,o);i&&l!==null&&u.write(`${i}[${a}] = ${l};`)}),e.write("}"),i}function Hb(e,t,n,r){const s=n._zod.def.values;if(s.length!==1){const a=Z(t,new Set(s));return e.write(`if (!${a}.has(${r})) return INVALID;`),r}const i=s[0];if(typeof i=="number"&&Number.isNaN(i)){const a=Z(t,new Set(s));return e.write(`if (!${a}.has(${r})) return INVALID;`),r}if(typeof i=="string")e.write(`if (${r} !== ${De(i)}) return INVALID;`);else if(typeof i=="number"||typeof i=="boolean")e.write(`if (${r} !== ${i}) return INVALID;`);else if(i===null)e.write(`if (${r} !== null) return INVALID;`);else if(i===void 0)e.write(`if (${r} !== undefined) return INVALID;`);else if(typeof i=="bigint")e.write(`if (${r} !== ${i}n) return INVALID;`);else throw new G(`literal type ${typeof i}`);return r}function Bb(e,t,n,r){const o=n._zod.values;if(!o)throw new G("enum schema without enumerated values");const s=Z(t,o);return e.write(`if (!${s}.has(${r})) return INVALID;`),r}function gd(e,t,n,r){const o=n._zod.def;return de(e,t,o.innerType,r)}function Kb(e,t,n,r){const o=n._zod.def,i=Object.getOwnPropertyDescriptor(n._zod.def,"defaultValue")?()=>n._zod.def.defaultValue:void 0;if(n._zod.def.type==="prefault"){if(!i)return de(e,t,o.innerType,r);const c=Z(t,i),u=L(t);return e.write(`let ${u} = ${r};`),e.write(`if (${r} === undefined) ${u} = ${c}();`),de(e,t,o.innerType,u)}const a=L(t);if(i){const c=Z(t,i),u=Z(t,lr);e.write(`let ${a};`),e.write(`if (${r} === undefined) {`),e.indented(l=>{l.write(`${a} = ${u}(${c}());`)}),e.write("} else {"),e.indented(l=>{const d=de(l,t,o.innerType,r);l.write(`${a} = ${d} === undefined ? ${u}(${c}()) : ${d};`)}),e.write("}")}else e.write(`let ${a};`),e.write(`if (${r} !== undefined) {`),e.indented(c=>{const u=de(c,t,o.innerType,r);c.write(`${a} = ${u};`)}),e.write("}");return a}function Jb(e,t,n,r){const o=n._zod.def,s=de(e,t,o.innerType,r),i=L(t);return e.write(`const ${i} = ${s};`),e.write(`if (${i} === undefined) return INVALID;`),i}function Wb(e,t,n,r){const o=n._zod.def,s=o.items,i=o.rest;e.write(`if (!Array.isArray(${r})) return INVALID;`);const a=yd(s,"optin"),c=yd(s,"optout");i?e.write(`if (${r}.length < ${a}) return INVALID;`):e.write(`if (${r}.length < ${a} || ${r}.length > ${s.length}) return INVALID;`);const u=L(t);e.write(`const ${u} = [];`);for(let l=0;l<s.length;l++){const d=s[l];if(l>=c)e.write(`if (${u}.length === ${l}) {`),e.indented(f=>{f.write(`if (${l} < ${r}.length) {`),f.indented(p=>{const h=L(t);p.write(`const ${h} = ${r}[${l}];`);const m=Ie(p,t,d,h);p.write(`${u}[${l}] = ${m};`)}),f.write("} else {"),f.indented(p=>{if(Yi(d)){p.write(`${u}.length = ${l};`);return}const h=L(t),m=L(t);p.write(`const ${h} = undefined;`),p.write(`const ${m} = (() => {`),p.indented(_=>{const S=Ie(_,t,d,h);_.write(`return ${S};`)}),p.write("})();"),p.write(`if (${m} === INVALID || ${m} === undefined) ${u}.length = ${l};`),p.write(`else ${u}[${l}] = ${m};`)}),f.write("}")}),e.write("}");else{const f=L(t);e.write(`const ${f} = ${r}[${l}];`);const p=Ie(e,t,d,f);e.write(`${u}[${l}] = ${p};`)}}if(i){const l=L(t),d=L(t);e.write(`for (let ${l} = ${s.length}; ${l} < ${r}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${d} = ${r}[${l}];`);const p=Ie(f,t,i,d);f.write(`${u}[${l}] = ${p};`)}),e.write("}")}return u}function yd(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function Gb(e,t,n,r){const o=n._zod.def,s=o.options;if(o.discriminator)return Yb(e,t,o,r);if(o.inclusive===!1)throw new G("exclusive unions (z.xor)");if(s.length===0)return e.write("return INVALID;"),r;if(s.length===1)return de(e,t,s[0],r);if(s.every(c=>c._zod.def.type==="literal"&&!c._zod.def.checks?.length)){const c=new Set(s.flatMap(l=>l._zod.def.values)),u=Z(t,c);return e.write(`if (!${u}.has(${r})) return INVALID;`),r}const a=L(t);e.write(`let ${a};`);for(let c=0;c<s.length;c++){const u=s[c];c===0?e.write(`${a} = (() => {`):e.write(`if (${a} === INVALID) ${a} = (() => {`),e.indented(l=>{const d=de(l,t,u,r);l.write(`return ${d};`)}),e.write("})();")}return e.write(`if (${a} === INVALID) return INVALID;`),a}function Yb(e,t,n,r){if(n.unionFallback)throw new G("discriminated union with unionFallback");if(n.options.length===0)return e.write("return INVALID;"),r;const o=L(t),s=L(t);e.write(`const ${o} = ${r}?.[${De(n.discriminator)}];`),e.write(`let ${s};`);let i=!0;const a=new Set;for(const c of n.options){const u=c._zod.propValues?.[n.discriminator];if(!u||u.size===0)throw new G("discriminated union option without static discriminator values");for(const f of u){if(a.has(f))throw new G(`duplicate discriminator value ${String(f)}`);a.add(f)}const l=Array.from(u,f=>Qb(t,o,f)),d=i?"if":"else if";e.write(`${d} (${l.join(" || ")}) {`),e.indented(f=>{const p=de(f,t,c,r);f.write(`${s} = ${p};`)}),e.write("}"),i=!1}return e.write("else { return INVALID; }"),s}function Qb(e,t,n){if(typeof n=="string")return`${t} === ${De(n)}`;if(typeof n=="number")return Number.isNaN(n)?`Number.isNaN(${t})`:`${t} === ${n}`;if(typeof n=="boolean")return`${t} === ${n}`;if(n===null)return`${t} === null`;if(n===void 0)return`${t} === undefined`;if(typeof n=="bigint")return`${t} === ${n}n`;if(typeof n=="symbol"){const r=Z(e,n);return`${t} === ${r}`}throw new G(`literal discriminator value ${String(n)}`)}function Xb(e,t,n,r){const o=n._zod.def;t.definite=!1;const s=Ie(e,t,o.left,r),i=Ie(e,t,o.right,r),a=Z(t,tr),c=L(t);return e.write(`const ${c} = ${a}(${s}, ${i});`),e.write(`if (!${c}.valid) return INVALID;`),`${c}.data`}function ew(e,t,n,r){const o=n._zod.def,s=Z(t,mt);e.write(`if (!${s}(${r})) return INVALID;`);const i=L(t),a=L(t),c=L(t);e.write(`const ${i} = {};`);const u=o,l=u.partial?void 0:o.keyType._zod.values;if(l){const p=[];for(const m of l){if(!(typeof m=="string"||typeof m=="number"||typeof m=="symbol"))throw new G(`record key value ${String(m)}`);const _=typeof m=="number"?m.toString():m;if(_==="__proto__")throw new G('record key "__proto__"');p.push(_);const S=Z(t,m),w=de(e,t,o.keyType,S),x=L(t);e.write(`const ${x} = ${r}[${tw(t,_)}];`);const C=Ie(e,t,o.valueType,x);e.write(`${i}[${w}] = ${C};`)}const h=Z(t,new Set(p));return e.write(`for (const ${a} in ${r}) {`),e.indented(m=>{m.write(`if (${h}.has(${a})) continue;`),u.mode==="loose"?m.write(`if (${a} !== "__proto__") ${i}[${a}] = ${r}[${a}];`):m.write("return INVALID;")}),e.write("}"),i}const d=o.keyType._zod.def;if(!(d.type==="string"&&d.format===void 0&&!d.coerce&&(d.checks?.length??0)===0)){const p=o.mode==="loose",h=ks(o.keyType);h.definite===!1&&(t.definite=!1);const m=Z(t,h),_=Z(t,bn),S=L(t);return _d(e,t,r,a,w=>{w.write(`let ${S} = ${m}(${a});`),w.write(`if (${S} === INVALID && typeof ${a} === "string" && ${_}.test(${a})) ${S} = ${m}(Number(${a}));`),p?w.write(`if (${S} === INVALID) { ${i}[${a}] = ${r}[${a}]; continue; }`):w.write(`if (${S} === INVALID) return INVALID;`),w.write(`if (${S} === "__proto__") continue;`);const x=L(t);w.write(`const ${x} = ${r}[${a}];`);const C=Ie(w,t,o.valueType,x);w.write(`${i}[${S}] = ${C};`)}),i}return _d(e,t,r,a,p=>{p.write(`const ${c} = ${r}[${a}];`);const h=Ie(p,t,o.valueType,c);p.write(`${i}[${a}] = ${h};`)},"return INVALID;"),i}function _d(e,t,n,r,o,s){const i=Z(t,Object.prototype.propertyIsEnumerable),a=L(t),c=L(t),u=L(t);e.write(`const ${a} = Object.getOwnPropertySymbols(${n});`),e.write(`const ${c} = Object.getOwnPropertyNames(${n});`),e.write(`for (let ${u} = 0; ${u} < ${c}.length; ${u}++) {`),e.indented(l=>{l.write(`const ${r} = ${c}[${u}];`),l.write(`if (${r} === "__proto__" || !${i}.call(${n}, ${r})) continue;`),o(l)}),e.write("}"),e.write(`for (let ${u} = 0; ${u} < ${a}.length; ${u}++) {`),e.indented(l=>{l.write(`const ${r} = ${a}[${u}];`),l.write(`if (!${i}.call(${n}, ${r})) continue;`),s?l.write(s):o(l)}),e.write("}")}function tw(e,t){return typeof t=="string"?De(t):Z(e,t)}function nw(e,t,n,r){const o=n._zod.def;e.write(`if (!(${r} instanceof Map)) return INVALID;`);const s=L(t),i=L(t),a=L(t);return e.write(`const ${s} = new Map();`),e.write(`for (const [${i}, ${a}] of ${r}) {`),e.indented(c=>{const u=de(c,t,o.keyType,i),l=de(c,t,o.valueType,a);c.write(`${s}.set(${u}, ${l});`)}),e.write("}"),s}function rw(e,t,n,r){const o=n._zod.def;e.write(`if (!(${r} instanceof Set)) return INVALID;`);const s=L(t),i=L(t);return e.write(`const ${s} = new Set();`),e.write(`for (const ${i} of ${r}) {`),e.indented(a=>{const c=de(a,t,o.valueType,i);a.write(`${s}.add(${c});`)}),e.write("}"),s}function ow(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function sw(e,t,n,r){e.write(`if (typeof ${r} !== "string") return INVALID;`);const o=n._zod.pattern;if(o){const s=Z(t,o);e.write(`${s}.lastIndex = 0;`),e.write(`if (!${s}.test(${r})) return INVALID;`)}return r}function iw(e,t,n,r){const o=n._zod.def,s=Ut(t,o.getter),i=Z(t,{parser:null});e.write(`if (!${i}.parser) {`),e.indented(c=>{c.write(`const inner = ${s}();`),c.write(`${i}.parser = function(input) {`),c.indented(u=>{u.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),u.write("return result.issues.length === 0 ? result.value : INVALID;")}),c.write("};")}),e.write("}");const a=L(t);return e.write(`const ${a} = ${i}.parser(${r});`),e.write(`if (${a} === INVALID) return INVALID;`),a}function aw(e,t,n,r){const o=n._zod.def,s=de(e,t,o.in,r);if(o.transform){if(Vt(o.transform))throw new _t("z.compile: async transforms in pipes are not supported");const i=o.transform,c=Ut(t,l=>{const d={value:l,issues:[],addIssue:mc},f=i(l,d);return f instanceof Promise?Ae:d.issues.length===0?f:Ae}),u=L(t);return e.write(`const ${u} = ${c}(${s});`),e.write(`if (${u} === INVALID) return INVALID;`),de(e,t,o.out,u)}else return de(e,t,o.out,s)}function Vt(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function cw(e,t,n,r){const o=n._zod.def;if(o.fn){if(Vt(o.fn))throw new _t("z.compile: async custom predicates are not supported");const s=Ut(t,o.fn),i=Z(t,Gi),a=L(t);e.write(`const ${a} = ${s}(${r});`),e.write(`if (${a} instanceof Promise) ${i}();`),e.write(`if (!${a}) return INVALID;`)}else throw new G("custom schema without a predicate function");return r}function uw(e,t,n){const r=e._zod.run({value:n,issues:[]},{});if(r&&typeof r.then=="function")return Ae;const o=r;return o.issues.length===0?o.value:t()}function lw(e,t,n,r){const o=n._zod.def;if(!o.catchValue[_a])throw new G("catch with a callback (only a constant catch value compiles)",!1);const s=L(t);e.write(`let ${s} = (() => {`),e.indented(u=>{const l=Ie(u,t,o.innerType,r);u.write(`return ${l};`)}),e.write("})();");const i=Z(t,o.innerType),a=Ut(t,o.catchValue),c=Z(t,uw);return e.write(`if (${s} === INVALID) {`),e.indented(u=>{u.write(`${s} = ${c}(${i}, ${a}, ${r});`),u.write(`if (${s} === INVALID) return INVALID;`)}),e.write("}"),s}function dw(e,t,n,r){const o=n._zod.def;if(o.transform){if(Vt(o.transform))throw new _t("z.compile: async transforms are not supported");const s=o.transform,a=Ut(t,u=>{const l={value:u,issues:[],addIssue:mc},d=s(u,l);return d instanceof Promise?Ae:l.issues.length===0?d:Ae}),c=L(t);return e.write(`const ${c} = ${a}(${r});`),e.write(`if (${c} === INVALID) return INVALID;`),c}return r}function $s(e){return e.checks&&(e.checks=[...e.checks]),e}function sm(e,t){return new e($s({type:"string",...I(t)}))}function im(e,t){return new e($s({type:"string",coerce:!0,...I(t)}))}function gc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...I(t)})}function yc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...I(t)})}function _c(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...I(t)})}function bc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(t)})}function wc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(t)})}function vc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(t)})}function Ss(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...I(t)})}function kc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...I(t)})}function $c(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(t)})}function Sc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...I(t)})}function xc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(t)})}function Ic(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...I(t)})}function zc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...I(t)})}function Tc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(t)})}function Cc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(t)})}function Ec(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(t)})}function am(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...I(t)})}function Ac(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(t)})}function Nc(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(t)})}function Oc(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...I(t)})}function Pc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...I(t)})}function Mc(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...I(t)})}function cm(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...I(t)})}function um(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...I(t)})}function Lc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...I(t)})}const Rc={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Dc(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(t)})}function Zc(e,t){return new e({type:"string",format:"date",check:"string_format",...I(t)})}function jc(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...I(t)})}function Fc(e,t){return new e({type:"string",format:"duration",check:"string_format",...I(t)})}function lm(e,t){return new e($s({type:"number",checks:[],...I(t)}))}function dm(e,t){return new e($s({type:"number",coerce:!0,checks:[],...I(t)}))}function fm(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...I(t)})}function pm(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...I(t)})}function hm(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...I(t)})}function mm(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...I(t)})}function gm(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...I(t)})}function ym(e,t){return new e({type:"boolean",...I(t)})}function _m(e,t){return new e({type:"boolean",coerce:!0,...I(t)})}function bm(e,t){return new e({type:"bigint",...I(t)})}function wm(e,t){return new e({type:"bigint",coerce:!0,...I(t)})}function vm(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...I(t)})}function km(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...I(t)})}function $m(e,t){return new e({type:"symbol",...I(t)})}function Sm(e,t){return new e({type:"undefined",...I(t)})}function xm(e,t){return new e({type:"null",...I(t)})}function Im(e){return new e({type:"any"})}function zm(e){return new e({type:"unknown"})}function Tm(e,t){return new e({type:"never",...I(t)})}function Cm(e,t){return new e({type:"void",...I(t)})}function Em(e,t){return new e({type:"date",...I(t)})}function Am(e,t){return new e({type:"date",coerce:!0,...I(t)})}function Nm(e,t){return new e({type:"nan",...I(t)})}function bt(e,t){return new Za({check:"less_than",...I(t),value:e,inclusive:!1})}function Ze(e,t){return new Za({check:"less_than",...I(t),value:e,inclusive:!0})}function wt(e,t){return new ja({check:"greater_than",...I(t),value:e,inclusive:!1})}function je(e,t){return new ja({check:"greater_than",...I(t),value:e,inclusive:!0})}function xs(e){return wt(0,e)}function Is(e){return bt(0,e)}function zs(e){return Ze(0,e)}function Ts(e){return je(0,e)}function qt(e,t){return new yp({check:"multiple_of",...I(t),value:e})}function Jt(e,t){return new wp({check:"max_size",...I(t),maximum:e})}function vt(e,t){return new vp({check:"min_size",...I(t),minimum:e})}function wn(e,t){return new kp({check:"size_equals",...I(t),size:e})}function vn(e,t){return new $p({check:"max_length",...I(t),maximum:e})}function Nt(e,t){return new Sp({check:"min_length",...I(t),minimum:e})}function kn(e,t){return new xp({check:"length_equals",...I(t),length:e})}function vr(e,t){return new Ip({check:"string_format",format:"regex",...I(t),pattern:e})}function kr(e){return new zp({check:"string_format",format:"lowercase",...I(e)})}function $r(e){return new Tp({check:"string_format",format:"uppercase",...I(e)})}function Sr(e,t){return new Cp({check:"string_format",format:"includes",...I(t),includes:e})}function xr(e,t){return new Ep({check:"string_format",format:"starts_with",...I(t),prefix:e})}function Ir(e,t){return new Ap({check:"string_format",format:"ends_with",...I(t),suffix:e})}function Cs(e,t,n){return new Np({check:"property",property:e,schema:t,...I(n)})}function zr(e,t){return new Op({check:"properties",shape:e,...I(t)})}function Tr(e,t){return new Pp({check:"mime_type",mime:e,...I(t)})}function at(e){return new Mp({check:"overwrite",tx:e})}function Cr(e){return at(t=>t.normalize(e))}function Er(){return at(e=>e.trim())}function Ar(){return at(e=>e.toLowerCase())}function Nr(){return at(e=>e.toUpperCase())}function Or(){return at(e=>pf(e))}function Om(e,t,n){return new e({type:"array",element:t,...I(n)})}function fw(e,t,n){return new e({type:"union",options:t,...I(n)})}function pw(e,t,n){return new e({type:"union",options:t,inclusive:!1,...I(n)})}function hw(e,t,n,r){return new e({type:"union",options:n,discriminator:t,...I(r)})}function mw(e,t,n){return new e({type:"intersection",left:t,right:n})}function gw(e,t,n,r){const o=n instanceof j,s=o?r:n,i=o?n:null;return new e({type:"tuple",items:t,rest:i,...I(s)})}function yw(e,t,n,r){return new e({type:"record",keyType:t,valueType:n,...I(r)})}function _w(e,t,n,r){return new e({type:"map",keyType:t,valueType:n,...I(r)})}function bw(e,t,n){return new e({type:"set",valueType:t,...I(n)})}function ww(e,t,n){const r=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new e({type:"enum",entries:r,...I(n)})}function vw(e,t,n){return new e({type:"enum",entries:t,...I(n)})}function kw(e,t,n){return new e({type:"literal",values:Array.isArray(t)?t:[t],...I(n)})}function Pm(e,t){return new e({type:"file",...I(t)})}function $w(e,t){return new e({type:"transform",transform:t})}function Sw(e,t){return new e({type:"optional",innerType:t})}function xw(e,t){return new e({type:"nullable",innerType:t})}function Iw(e,t,n){return new e({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():lr(n)}})}function zw(e,t,n){return new e({type:"nonoptional",innerType:t,...I(n)})}function Tw(e,t){return new e({type:"success",innerType:t})}function Cw(e,t,n){return new e({type:"catch",innerType:t,catchValue:typeof n=="function"?n:ba(n)})}function Ew(e,t,n){return new e({type:"pipe",in:t,out:n})}function Aw(e,t){return new e({type:"readonly",innerType:t})}function Nw(e,t,n){return new e({type:"template_literal",parts:t,...I(n)})}function Ow(e,t){return new e({type:"lazy",getter:t})}function Pw(e,t){return new e({type:"promise",innerType:t})}function Mm(e,t,n){const r=I(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function Lm(e,t,n){return new e({type:"custom",check:"custom",fn:t,...I(n)})}function Rm(e,t){const n=Dm(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(cn(o,r.value,n._zod.def));else{const s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=r.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),r.issues.push(cn(s))}},e(r.value,r)),t);return n}function Dm(e,t){const n=new ue({check:"custom",...I(t)});return n._zod.check=e,n}function Zm(e){const t=new ue({check:"describe"});return t._zod.onattach=[n=>{const r=Re.get(n)??{};Re.add(n,{...r,description:e})}],t._zod.check=()=>{},t}function jm(e){const t=new ue({check:"meta"});return t._zod.onattach=[n=>{const r=Re.get(n)??{};Re.add(n,{...r,...e})}],t._zod.check=()=>{},t}function Fm(e,t){const n=I(t);let r=n.truthy??["true","1","yes","on","y","enabled"],o=n.falsy??["false","0","no","off","n","disabled"];n.case!=="sensitive"&&(r=r.map(p=>typeof p=="string"?p.toLowerCase():p),o=o.map(p=>typeof p=="string"?p.toLowerCase():p));const s=new Set(r),i=new Set(o),a=e.Codec??ac,c=e.Boolean??tc,u=e.String??wr,l=new u({type:"string",error:n.error}),d=new c({type:"boolean",error:n.error}),f=new a({type:"pipe",in:l,out:d,transform:((p,h)=>{let m=p;return n.case!=="sensitive"&&(m=m.toLowerCase()),s.has(m)?!0:i.has(m)?!1:(h.issues.push({code:"invalid_value",expected:"stringbool",values:[...s,...i],input:h.value,inst:f,continue:!1}),{})}),reverseTransform:((p,h)=>p===!0?r[0]||"true":o[0]||"false"),error:n.error});return f._zod.bag.truthy=r,f._zod.bag.falsy=o,f._zod.bag.case=n.case??"insensitive",f}function $n(e,t,n,r={}){const o=I(r),s={check:"string_format",type:"string",format:t,fn:typeof n=="function"?n:a=>n.test(a),...o};return n instanceof RegExp&&(s.pattern=n),new e(s)}function Qn(e,...t){for(const n of t)for(const r of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,r)&&Fe(e,r,n[r]);return e}function ln(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Re,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function be(e,t,n,r,o){const s=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:r.path,message:o}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw new Error(o);return Object.assign(n,s),!0}function ne(e,t,n={path:[],schemaPath:[]}){var r;const o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;const a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{const l={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{const f=i.schema,p=t.processors[o.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(e,t,f,l)}const d=e._zod.parent;d&&(i.ref||(i.ref=d),ne(d,t,l),t.seen.get(d).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Qn(i.schema,c),t.io==="input"&&Te(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function bd(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function dn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;const r=new Map;for(const i of e.seen.entries()){const a=e.metadataRegistry.get(i[0])?.id;if(a){const c=r.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,i[0])}}const o=i=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const d=e.external.registry.get(i[0])?.id,f=e.external.uri??(h=>h);if(d)return{ref:f(d)};const p=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=p,{defId:p,ref:`${f("__shared")}#/${a}/${bd(p)}`}}const c="#",u=`${c}/${a}/`;if(i[1]===n&&!i[1].schema.id)return{ref:c};const l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+bd(l)}},s=i=>{if(i[1].schema.$ref)return;const a=i[1],{ref:c,defId:u}=o(i);a.def={...a.schema},u&&(a.defId=u);const l=a.schema;for(const d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(const i of e.seen.entries()){const a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
69
69
|
|
|
70
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const s of e.seen.entries()){const a=s[1];if(t===s[0]){i(s);continue}if(e.external){const u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}a.count>1&&e.reused==="ref"&&i(s)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Am(e){const t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;const n=[];for(const r of t){if(!r||typeof r!="object")return;Am(r);const o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;const i=r.type;for(const s of Array.isArray(i)?i:[i]){if(typeof s!="string")return;n.includes(s)||n.push(s)}}delete e.anyOf,e.type=n.length===1?n[0]:n}const Nm=new Set(["type","properties","required","additionalProperties"]),ld=["oneOf","anyOf"];function dd(e){const t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function Ns(e){const t=[];for(const i of e){if(typeof i!="object"||i.type!=="object")return null;for(const s in i)if(!Nm.has(s))return null;t.push(i)}const n={},r=new Set;for(const i of t){for(const s in i.properties){if(Object.prototype.hasOwnProperty.call(n,s))continue;const a=[];for(const u of t){const l=u.properties?.[s]??dd(u);l!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(l))||a.push(l))}const c=a.length===1?a[0]:Ns(a)??{allOf:a};Fe(n,s,c)}for(const s of i.required??[])r.add(s)}const o={type:"object",properties:n};if(r.size&&(o.required=[...r]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{const i=[];for(const s of t){const a=dd(s);a&&!i.some(c=>JSON.stringify(c)===JSON.stringify(a))&&i.push(a)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}function zw(e){const t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(const o of Nm)if(o in e)return;const n=t.filter(o=>ld.some(i=>Array.isArray(o[i])));let r=null;if(!n.length)r=Ns(t);else{const o=n[0],i=ld.find(c=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;const s=t.filter(c=>c!==o),a=o[i].map(c=>Ns([...s,c]));if(a.some(c=>!c))return;r={[i]:a}}r&&(delete e.allOf,Fn(e,r))}function nn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=a=>{const c=e.seen.get(a);if(c.ref===null)return;const u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){r(d);const p=e.seen.get(d),h=p.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(h)):Fn(u,h),Fn(u,l),a._zod.parent===d)for(const y in u)y==="$ref"||y==="allOf"||y in l||delete u[y];if(h.$ref&&p.def)for(const y in u)y==="$ref"||y==="allOf"||y in p.def&&JSON.stringify(u[y])===JSON.stringify(p.def[y])&&delete u[y]}const f=a._zod.parent;if(f&&f!==d){r(f);const p=e.seen.get(f);if(p?.schema.$ref&&(u.$ref=p.schema.$ref,p.def))for(const h in u)h==="$ref"||h==="allOf"||h in p.def&&JSON.stringify(u[h])===JSON.stringify(p.def[h])&&delete u[h]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(const a of[...e.seen.entries()].reverse())r(a[0]);if(e.target!=="openapi-3.0")for(const a of e.seen.entries())Am(a[1].def??a[1].schema);for(const a of e.deferred)a();if(e.intersections.length){const a=new Map;for(const c of e.seen.values())for(const u of[c.schema,c.def]){const l=u?.allOf;if(!Array.isArray(l))continue;const d=a.get(l);d?d.push(u):a.set(l,[u])}for(const c of e.intersections)for(const u of a.get(c)??[])zw(u)}}const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Fn(o,n.defId?n.schema:n.def??n.schema);const i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;const s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(const a of e.seen.entries()){const c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,Fe(s,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Hn(t,"input",e.processors),output:Hn(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function ze(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return ze(r.element,n);if(r.type==="set")return ze(r.valueType,n);if(r.type==="lazy")return ze(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return ze(r.innerType,n);if(r.type==="intersection")return ze(r.left,n)||ze(r.right,n);if(r.type==="record"||r.type==="map")return ze(r.keyType,n)||ze(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ze(r.in,n)||ze(r.out,n);if(r.type==="object"){for(const o in r.shape)if(ze(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(ze(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(ze(o,n))return!0;return!!(r.rest&&ze(r.rest,n))}return!1}const Om=(e,t={})=>n=>{const r=en({...n,processors:t});return te(e,r),tn(r,e),nn(r,e)},Hn=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r??{},s=en({...o??{},target:i,io:t,processors:n});return te(e,s),tn(s,e),nn(s,e)},rn=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},on=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},fd=(e,t)=>{rn(e,"minimum",t),on(e,"maximum",t)},Pm=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Mm=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Rm=(e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},Lm=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},pd=(e,t)=>rn(e,"minimum",t.minimum),hd=(e,t)=>on(e,"maximum",t.maximum),md=e=>(t,n)=>{Lm(t,n.format);const[r,o]=e[n.format];rn(t,"minimum",r),on(t,"maximum",o)},Tw={greater_than:(e,t)=>rn(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>on(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Pm(e,t.value),number_format:md(Gs),bigint_format:md(Ys),min_length:pd,max_length:hd,length_equals:(e,t)=>fd(e,t.length),min_size:pd,max_size:hd,size_equals:(e,t)=>fd(e,t.size),string_format:(e,t)=>{Lm(e,t.format),t.pattern&&Mm(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Rm(e,t.mime)};function ge(e){const t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(const i of r)Tw[i._zod.def.check]?.(t,i._zod.def);const o=e._zod.bag;o.minimum!==void 0&&rn(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&rn(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&on(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&on(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Pm(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&Rm(t,o.mime);for(const i of o.patterns??[])Mm(t,i);return t}const Ew={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Cw=new Map([[Ea,Ff],[Xo,Uf]]),Dm=e=>Cw.get(e)??e,Zm=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:u,laxFormat:l}=ge(e);if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),a&&(o.format=Ew[a]??a,o.format===""&&delete o.format,(a==="time"||l)&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){const d=[...c].map(Dm);d.length===1?o.pattern=d[0].source:d.length>1&&(o.allOf=[...d.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},jm=(e,t,n,r)=>{const o=n,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=ge(e);o.type=l?"integer":"number";const d=typeof u=="number"&&u>=(i??Number.NEGATIVE_INFINITY),f=typeof c=="number"&&c<=(s??Number.POSITIVE_INFINITY),p=t.target==="draft-04"||t.target==="openapi-3.0";if(d?p?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof i=="number"&&(o.minimum=i),f?p?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof s=="number"&&(o.maximum=s),a){const h=new Set;for(const $ of a)Number.isFinite($)&&$!==0?h.add(Math.abs($)):ye(e,t,o,r,`A multipleOf divisor of ${$} cannot be represented in JSON Schema`);const[m,...y]=h;m!==void 0&&(o.multipleOf=m),y.length&&(o.allOf=[...o.allOf??[],...y.map($=>({multipleOf:$}))])}},Fm=(e,t,n,r)=>{n.type="boolean"},Um=(e,t,n,r)=>{ye(e,t,n,r,"BigInt cannot be represented in JSON Schema")},Vm=(e,t,n,r)=>{ye(e,t,n,r,"Symbols cannot be represented in JSON Schema")},qm=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},Hm=(e,t,n,r)=>{ye(e,t,n,r,"Undefined cannot be represented in JSON Schema")},Bm=(e,t,n,r)=>{ye(e,t,n,r,"Void cannot be represented in JSON Schema")},Km=(e,t,n,r)=>{n.not={}},Jm=(e,t,n,r)=>{},Wm=(e,t,n,r)=>{},Gm=(e,t,n,r)=>{ye(e,t,n,r,"Date cannot be represented in JSON Schema")},Ym=(e,t,n,r)=>{const o=e._zod.def,i=xo(o.entries);if(i.length===0){n.not={};return}i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),n.enum=i},Qm=(e,t,n,r)=>{const o=e._zod.def;if(o.values.length===0){n.not={};return}const i=[];for(const s of o.values)if(s===void 0){if(ye(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(ye(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){const s=i[0];n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[s]:n.const=s}else i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),i.every(s=>typeof s=="boolean")&&(n.type="boolean"),i.every(s=>s===null)&&(n.type="null"),n.enum=i},Xm=(e,t,n,r)=>{ye(e,t,n,r,"NaN cannot be represented in JSON Schema")},eg=(e,t,n,r)=>{const o=n,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},tg=(e,t,n,r)=>{const o=n;o.type="string",o.format="binary",o.contentEncoding="binary";const{minimum:i,maximum:s,mime:a}=ge(e);i!==void 0&&(o.minLength=i),s!==void 0&&(o.maxLength=s),a&&(a.length===0?o.not={}:a.length===1?o.contentMediaType=a[0]:o.anyOf=a.map(c=>({contentMediaType:c})))},ng=(e,t,n,r)=>{n.type="boolean"},rg=(e,t,n,r)=>{ye(e,t,n,r,"Custom types cannot be represented in JSON Schema")},og=(e,t,n,r)=>{ye(e,t,n,r,"Function types cannot be represented in JSON Schema")},ig=(e,t,n,r)=>{ye(e,t,n,r,"Transforms cannot be represented in JSON Schema")},sg=(e,t,n,r)=>{ye(e,t,n,r,"Map cannot be represented in JSON Schema")},ag=(e,t,n,r)=>{ye(e,t,n,r,"Set cannot be represented in JSON Schema")},cg=(e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:s,maximum:a}=ge(e);typeof s=="number"&&(o.minItems=s),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=te(i.element,t,{...r,path:[...r.path,"items"]})};function Bn(e){const t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Bn(t.out):t.type==="catch"?Bn(t.innerType):e._zod.optin}const ug=(e,t,n,r)=>{const o=n,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&ye(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(const u in s)Fe(o.properties,u,te(s[u],t,{...r,path:[...r.path,"properties",u]}));const c=[];for(const u of Object.keys(s)){const l=i.shape[u];(t.io==="input"?Bn(l)===void 0:l._zod.optout===void 0)&&c.push(u)}c.length>0&&(o.required=c),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=te(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},kc=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>te(a,t,{...r,path:[...r.path,i?"oneOf":"anyOf",c]}));i?n.oneOf=s:n.anyOf=s},lg=(e,t,n,r)=>{const o=e._zod.def,i=te(o.left,t,{...r,path:[...r.path,"allOf",0]}),s=te(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];n.allOf=c,t.intersections.push(c)},dg=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="array";const s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((m,y)=>te(m,t,{...r,path:[...r.path,s,y]})),u=i.rest?te(i.rest,t,{...r,path:[...r.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;let l=i.items.length;for(;l>0;){const m=i.items[l-1];if(!(t.io==="input"?Bn(m)!==void 0:m._zod.optout==="optional"))break;l--}const d=i.items.length,f=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=c,f?o.items=!1:u&&(o.items=u),l>0&&(o.minItems=l),f&&(o.maxItems=d)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),l>0&&(o.minItems=l),f&&(o.maxItems=d)):(o.items=c,f?o.additionalItems=!1:u&&(o.additionalItems=u),l>0&&(o.minItems=l),f&&(o.maxItems=d));const{minimum:p,maximum:h}=ge(e);typeof p=="number"&&(o.minItems=p),typeof h=="number"&&(o.maxItems=h)};function Os(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);const h=e.get(t)?.def;if(!h)return t;const m=Os(e,h,n);return m===h?t:m}for(const h of["anyOf","oneOf"]){const m=t[h];if(!Array.isArray(m))continue;const y=m.map($=>Os(e,$,n));y.some(($,w)=>$!==m[w])&&(t={...t,[h]:y})}const r=Array.isArray(t.type)?t.type:[t.type],o=!r.includes("string")&&r.some(h=>h==="number"||h==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some(h=>typeof h=="number"))return t;const{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(h=>typeof h=="number"?String(h):h):typeof p.const=="number"&&(p.const=String(p.const)),o&&(p.type="string",i||(p.pattern=(r.includes("number")?ln:ga).source)),p}const Ps=new WeakMap;function Aw(e){const t=new Map;for(const r of e.seen.values())r.def&&!t.has(r.schema)&&t.set(r.schema,r);const n=new Map;for(const r of Ps.get(e)??[]){const o=e.seen.get(r),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||n.has(i))continue;const s=Os(t,i,new Set);s!==i&&n.set(i,s)}if(n.size)for(const r of e.seen.values())for(const o of[r.schema,r.def]){const i=o&&n.get(o.propertyNames);i&&(o.propertyNames=i)}}const fg=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const s=i.keyType,a=ge(s).patterns;if(i.mode==="loose"&&a&&a.size>0){const l=te(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const d of a)Fe(o.patternProperties,Dm(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=te(i.keyType,t,{...r,path:[...r.path,"propertyNames"]});let l=Ps.get(t);l||(l=[],Ps.set(t,l),t.deferred.push(()=>Aw(t))),l.push(e)}o.additionalProperties=te(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}const c=s._zod.values,u=t.io==="input"&&Bn(i.valueType)!==void 0;if(c&&!i.partial&&!u){const l=[...c].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l.map(String))}},pg=(e,t,n,r)=>{const o=e._zod.def,i=te(o.innerType,t,r),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},hg=(e,t,n,r)=>{const o=e._zod.def;te(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},$c=Symbol();function mg(e,t,n,r,o){let i=!1;const s=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(i=!0,null));return i?(ye(t,n,r,o,"BigInt defaults cannot be represented in JSON Schema"),$c):JSON.parse(s)}const gg=(e,t,n,r)=>{const o=e._zod.def;te(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;const s=mg(o.defaultValue,e,t,n,r);s!==$c&&(n.default=s)},yg=(e,t,n,r)=>{const o=e._zod.def;te(o.innerType,t,r);const i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;const s=mg(o.defaultValue,e,t,n,r);s!==$c&&(n._prefault=s)},_g=(e,t,n,r)=>{const o=e._zod.def;te(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{ye(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=s},bg=(e,t,n,r)=>{const o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;te(s,t,r);const a=t.seen.get(e);a.ref=s},wg=(e,t,n,r)=>{const o=e._zod.def;te(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},vg=(e,t,n,r)=>{const o=e._zod.def;te(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Sc=(e,t,n,r)=>{const o=e._zod.def;te(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},kg=(e,t,n,r)=>{const o=e._zod.innerType;te(o,t,r);const i=t.seen.get(e);i.ref=o},Ms={string:Zm,number:jm,boolean:Fm,bigint:Um,symbol:Vm,null:qm,undefined:Hm,void:Bm,never:Km,any:Jm,unknown:Wm,date:Gm,enum:Ym,literal:Qm,nan:Xm,template_literal:eg,file:tg,success:ng,custom:rg,function:og,transform:ig,map:sg,set:ag,array:cg,object:ug,union:kc,intersection:lg,tuple:dg,record:fg,nullable:pg,nonoptional:hg,default:gg,prefault:yg,catch:_g,pipe:bg,readonly:wg,promise:vg,optional:Sc,lazy:kg};function Ic(e,t){if("_idmap"in e){const r=e,o=en({...t,processors:Ms}),i={};for(const c of r._idmap.entries()){const[u,l]=c;te(l,o)}const s={},a={registry:r,uri:t?.uri,defs:i};o.external=a;for(const c of r._idmap.entries()){const[u,l]=c;tn(o,l),Fe(s,u,nn(o,l))}if(Object.keys(i).length>0){const c=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}const n=en({...t,processors:Ms});return te(e,n),tn(n,e),nn(n,e)}class Nw{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=en({processors:Ms,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return te(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,tn(this.ctx,t);const r=nn(this.ctx,t),{"~standard":o,...i}=r;return i}}const Ow=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),$g=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:sh,$ZodArray:dh,$ZodAsyncError:st,$ZodBase64:Jp,$ZodBase64URL:Wp,$ZodBigInt:Ra,$ZodBigIntFormat:nh,$ZodBoolean:Ma,$ZodCIDRv4:Bp,$ZodCIDRv6:Kp,$ZodCUID:Pp,$ZodCUID2:Mp,$ZodCatch:Oh,$ZodCheck:ie,$ZodCheckBigIntFormat:cp,$ZodCheckEndsWith:wp,$ZodCheckGreaterThan:wa,$ZodCheckIncludes:_p,$ZodCheckLengthEquals:hp,$ZodCheckLessThan:ba,$ZodCheckLowerCase:gp,$ZodCheckMaxLength:fp,$ZodCheckMaxSize:up,$ZodCheckMimeType:$p,$ZodCheckMinLength:pp,$ZodCheckMinSize:lp,$ZodCheckMultipleOf:sp,$ZodCheckNumberFormat:ap,$ZodCheckOverwrite:Sp,$ZodCheckProperties:kp,$ZodCheckProperty:vp,$ZodCheckRegex:mp,$ZodCheckSizeEquals:dp,$ZodCheckStartsWith:bp,$ZodCheckStringFormat:ar,$ZodCheckUpperCase:yp,$ZodCodec:Fa,$ZodCreditCard:Yp,$ZodCustom:jh,$ZodCustomStringFormat:eh,$ZodCyclicError:Fh,$ZodDate:lh,$ZodDefault:Eh,$ZodDiscriminatedUnion:_h,$ZodE164:Gp,$ZodEmail:Ep,$ZodEmoji:Np,$ZodEncodeError:qo,$ZodEnum:$h,$ZodError:wf,$ZodExactOptional:zh,$ZodFile:Ih,$ZodFunction:Dh,$ZodGUID:zp,$ZodIBAN:Qp,$ZodIPv4:Vp,$ZodIPv6:qp,$ZodISODate:jp,$ZodISODateTime:Zp,$ZodISODuration:Up,$ZodISOTime:Fp,$ZodIntersection:bh,$ZodJWT:Xp,$ZodKSUID:Dp,$ZodLazy:Ua,$ZodLiteral:Sh,$ZodMAC:Hp,$ZodMap:vh,$ZodNaN:Ph,$ZodNanoID:Op,$ZodNever:ch,$ZodNonOptional:Ah,$ZodNull:ih,$ZodNullable:Th,$ZodNumber:Pa,$ZodNumberFormat:th,$ZodObject:hh,$ZodObjectJIT:mh,$ZodOptional:Za,$ZodPipe:ja,$ZodPrefault:Ch,$ZodPreprocess:Mh,$ZodPromise:Zh,$ZodReadonly:Rh,$ZodRealError:Ue,$ZodRecord:wh,$ZodRegistry:qh,$ZodSet:kh,$ZodString:cr,$ZodStringFormat:ne,$ZodSuccess:Nh,$ZodSymbol:rh,$ZodTemplateLiteral:Lh,$ZodTransform:xh,$ZodTuple:Da,$ZodType:D,$ZodULID:Rp,$ZodURL:Ap,$ZodUUID:Tp,$ZodUndefined:oh,$ZodUnion:ei,$ZodUnknown:ah,$ZodVoid:uh,$ZodXID:Lp,$ZodXor:gh,$brand:na,$constructor:g,$input:Ka,$output:Ba,Doc:va,INVALID:Ce,JSONSchema:Ow,JSONSchemaGenerator:Nw,NEVER:ta,TimePrecision:yc,URL_BAD_FORMAT:$a,URL_UNPARSEABLE:Vn,ZodCompileAsyncError:dt,ZodCompileUnsupportedError:B,_any:mm,_array:km,_base64:pc,_base64url:hc,_bigint:cm,_boolean:sm,_catch:vw,_check:zm,_cidrv4:dc,_cidrv6:fc,_coercedBigint:um,_coercedBoolean:am,_coercedDate:wm,_coercedNumber:em,_coercedString:Wh,_creditCard:Yh,_cuid:oc,_cuid2:ic,_custom:Sm,_date:bm,_decode:sa,_decodeAsync:ca,_default:_w,_discriminatedUnion:sw,_e164:mc,_email:Ga,_emoji:nc,_encode:ia,_encodeAsync:aa,_endsWith:hr,_enum:fw,_file:$m,_float32:nm,_float64:rm,_gt:pt,_gte:je,_guid:Ya,_iban:Qh,_includes:fr,_int:tm,_int32:om,_int64:lm,_intersection:aw,_ipv4:uc,_ipv6:lc,_isoDate:bc,_isoDateTime:_c,_isoDuration:vc,_isoTime:wc,_jwt:gc,_ksuid:cc,_lazy:Iw,_length:pn,_literal:hw,_lowercase:lr,_lt:ft,_lte:Ze,_mac:Gh,_map:lw,_max:Ze,_maxLength:fn,_maxSize:qt,_mime:gr,_min:je,_minLength:St,_minSize:ht,_multipleOf:jt,_nan:vm,_nanoid:rc,_nativeEnum:pw,_negative:ci,_never:ym,_nonnegative:li,_nonoptional:bw,_nonpositive:ui,_normalize:yr,_null:hm,_nullable:yw,_number:Xh,_optional:gw,_overwrite:nt,_parse:tr,_parseAsync:nr,_pipe:kw,_positive:ai,_promise:xw,_properties:mr,_property:di,_readonly:$w,_record:uw,_refine:Im,_regex:ur,_safeDecode:la,_safeDecodeAsync:fa,_safeEncode:ua,_safeEncodeAsync:da,_safeParse:rr,_safeParseAsync:or,_set:dw,_size:dn,_slugify:vr,_startsWith:pr,_string:Jh,_stringFormat:hn,_stringbool:Cm,_success:ww,_superRefine:xm,_symbol:fm,_templateLiteral:Sw,_toLowerCase:br,_toUpperCase:wr,_transform:mw,_trim:_r,_tuple:cw,_uint32:im,_uint64:dm,_ulid:sc,_undefined:pm,_union:ow,_unknown:gm,_uppercase:dr,_url:si,_uuid:Qa,_uuidv4:Xa,_uuidv6:ec,_uuidv7:tc,_void:_m,_xid:ac,_xor:iw,base64Charset:Ea,base64urlCharset:Xo,canParseURL:Sa,clone:oe,compile:Ja,compileFn:oi,config:me,createStandardJSONSchemaMethod:Hn,createToJSONSchemaMethod:Om,decode:g_,decodeAsync:__,describe:Tm,encode:m_,encodeAsync:y_,extractDefs:tn,finalize:nn,flattenError:Ho,formatError:Bo,getDiscriminatedOption:La,globalConfig:Ee,globalRegistry:Le,handleUnrepresentable:ye,initializeContext:en,isBackEdge:qa,isRecursiveSchema:Va,isValidBase64:Qo,isValidBase64URL:Ca,isValidCIDRv6:Ta,isValidCreditCard:Aa,isValidIBAN:Na,isValidIPv6:Yo,isValidJWT:Oa,locales:Ha,memoizer:ti,mergeValues:qn,meta:Em,parse:Is,parseAsync:xs,parseURLObject:Cp,prettifyError:oa,process:te,processSchema:te,regexes:Go,registry:ni,safeDecode:w_,safeDecodeAsync:k_,safeEncode:b_,safeEncodeAsync:v_,safeParse:kf,safeParseAsync:d_,standardProps:ka,stripTabAndNewline:Ao,toDotPath:vf,toJSONSchema:Ic,toZod:Do,treeifyError:ra,urlHostnameOk:xa,urlProtocolOk:za,util:ea,validate:Jo,validateAsync:Wo,validateURL:Ia,version:Ip,withParser:ri},Symbol.toStringTag,{value:"Module"})),gd=Symbol("z.visit/resolving");function xc(e,t){const n=typeof t=="function"?t:(s,a)=>{const c=t[s._zod.def.type];return c?c(s,a):s},r=new Map;function o(s){const a=r.get(s);if(a===gd)return new Ua({type:"lazy",getter:()=>r.get(s)});if(a!==void 0)return a;r.set(s,gd);const c=i(s),u=n(c,c!==s);return r.set(s,u),u}function i(s){const a=s._zod.def;switch(a.type){case"object":{const u=a.shape,l=Object.keys(u);let d=!1;const f={};for(const h of l){const m=o(u[h]);m!==u[h]&&(d=!0),f[h]=m}let p=a.catchall;return a.catchall&&(p=o(a.catchall),p!==a.catchall&&(d=!0)),d?oe(s,{...a,shape:f,catchall:p}):s}case"array":{const u=o(a.element);return u===a.element?s:oe(s,{...a,element:u})}case"tuple":{const u=a.items;let l=!1;const d=[];for(const p of u){const h=o(p);h!==p&&(l=!0),d.push(h)}let f=a.rest;return a.rest&&(f=o(a.rest),f!==a.rest&&(l=!0)),l?oe(s,{...a,items:d,rest:f}):s}case"record":case"map":{const u=o(a.keyType),l=o(a.valueType);return u===a.keyType&&l===a.valueType?s:oe(s,{...a,keyType:u,valueType:l})}case"set":{const u=o(a.valueType);return u===a.valueType?s:oe(s,{...a,valueType:u})}case"union":{const u=a.options;let l=!1;const d=[];for(const f of u){const p=o(f);p!==f&&(l=!0),d.push(p)}return l?oe(s,{...a,options:d}):s}case"intersection":{const u=o(a.left),l=o(a.right);return u===a.left&&l===a.right?s:oe(s,{...a,left:u,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{const u=o(a.innerType);return u===a.innerType?s:oe(s,{...a,innerType:u})}case"pipe":{const u=o(a.in),l=o(a.out);return u===a.in&&l===a.out?s:oe(s,{...a,in:u,out:l})}case"function":{const u=o(a.input),l=o(a.output);return u===a.input&&l===a.output?s:oe(s,{...a,input:u,output:l})}case"lazy":{const u=a.getter,{_cachedInner:l,...d}=a;return oe(s,{...d,getter:()=>o(u())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return s;default:return s}}return o(e)}function zc(e){return!!e._zod}function Sg(e,t){return zc(e)?kf(e,t):e.safeParse(t)}function Pw(e){if(!e)return;let t;if(zc(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Mw(e){if(zc(e)){const i=e._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}const n=e._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}const r=e.value;if(r!==void 0)return r}const Rw=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}const n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function o(i,s){return i==="number"&&typeof s=="number"&&!Number.isFinite(s)?String(s):r[i]??i}return i=>{switch(i.code){case"invalid_type":{const s=o(i.expected),a=hf(i.input),c=o(a,i.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${Ws(i.values[0])}`:`Invalid option: expected one of ${ks(i.values,"|")}`;case"too_big":{const s=i.exact?"exactly ":i.inclusive?"<=":"<",a=t(i.origin);return a?`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{const s=i.exact?"exactly ":i.inclusive?">=":">",a=t(i.origin);return a?`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${a.unit}`:`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{const s=i;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${n[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${ks(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(a=>`'${a}'`).join(" | ")}`:i.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function Lw(){return{localeError:Rw()}}const Dw=Object.freeze(Object.defineProperty({__proto__:null,endsWith:hr,gt:pt,gte:je,includes:fr,length:pn,lowercase:lr,lt:ft,lte:Ze,maxLength:fn,maxSize:qt,mime:gr,minLength:St,minSize:ht,multipleOf:jt,negative:ci,nonnegative:li,nonpositive:ui,normalize:yr,overwrite:nt,positive:ai,properties:mr,property:di,regex:ur,size:dn,slugify:vr,startsWith:pr,toLowerCase:br,toUpperCase:wr,trim:_r,uppercase:dr},Symbol.toStringTag,{value:"Module"})),yd=new WeakSet([Object.prototype,Error.prototype]);function ho(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){const r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}const Ig=(e,t)=>{wf.init(e,t),e.name="ZodError";const n=Object.getPrototypeOf(e);yd.has(n)||(yd.add(n),ho(n,"format",r=>o=>Bo(r,o)),ho(n,"flatten",r=>o=>Ho(r,o)),ho(n,"addIssue",r=>o=>{r.issues.push(o),r.message=JSON.stringify(r.issues,zo,2)}),ho(n,"addIssues",r=>o=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,zo,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},xg=g("ZodError",Ig),Ne=g("ZodError",Ig,void 0,{Parent:Error}),Tc=tr(Ne),Ec=nr(Ne),Cc=rr(Ne),Ac=or(Ne),Nc=ia(Ne),Oc=sa(Ne),Pc=aa(Ne),Mc=ca(Ne),Rc=ua(Ne),Lc=la(Ne),Dc=da(Ne),Zc=fa(Ne);function Zw(){Ee.localeError||me(Lw())}function Ht(){Ee.memoizer||me({memoizer:ti()})}const j=g("ZodType",(e,t)=>(Zw(),D.init(e,t),e.def=t,e.type=t.type,e),{check(...e){const t=this.def;return this.clone(Se(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return oe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Xi(e,t))},superRefine(e,t){return this.check(es(e,t))},overwrite(e){return this.check(nt(e))},optional(){return re(this)},exactOptional(){return Oi(this)},nullable(){return an(this)},nullish(){return re(an(this))},nonoptional(e){return Zi(this,e)},array(){return M(this)},or(e){return F([this,e])},and(e){return xn(this,e)},transform(e){return Jn(this,Hr(e))},default(e){return Ri(this,e)},prefault(e){return Di(this,e)},catch(e){return Ui(this,e)},pipe(e){return Jn(this,e)},readonly(){return Bi(this)},describe(e){const t=this.clone();return Le.add(t,{description:e}),t},meta(...e){if(e.length===0)return Le.get(this);const t=this.clone();return Le.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Vo(this,"~standard",{...ka(this),jsonSchema:{input:Hn(this,"input"),output:Hn(this,"output")}})},set"~standard"(e){lt(this,"~standard",e)},parse:function e(t,n){return Tc(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Ec(this,t,n,{callee:e})},safeParse(e,t){return Cc(this,e,t)},async safeParseAsync(e,t){return Ac(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){lt(this,"spa",e)},validate(e,t){return Jo(this,e,t)},validateAsync(e,t){return Wo(this,e,t)},encode:function e(t,n){return Nc(this,t,n,{callee:e})},decode:function e(t,n){return Oc(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Pc(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Mc(this,t,n,{callee:e})},safeEncode(e,t){return Rc(this,e,t)},safeDecode(e,t){return Lc(this,e,t)},async safeEncodeAsync(e,t){return Dc(this,e,t)},async safeDecodeAsync(e,t){return Zc(this,e,t)},toJSONSchema(e){return Om(this,{})(e)},get description(){return Le.get(this)?.description},get _def(){return this._zod.def}}),kr=g("_ZodString",(e,t)=>{cr.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zm(e,n,r)},er({format:e=>ge(e).format??null,minLength:e=>ge(e).minimum??null,maxLength:e=>ge(e).maximum??null},{regex(...e){return this.check(ur(...e))},includes(...e){return this.check(fr(...e))},startsWith(...e){return this.check(pr(...e))},endsWith(...e){return this.check(hr(...e))},min(...e){return this.check(St(...e))},max(...e){return this.check(fn(...e))},length(...e){return this.check(pn(...e))},nonempty(...e){return this.check(St(1,...e))},lowercase(e){return this.check(lr(e))},uppercase(e){return this.check(dr(e))},trim(){return this.check(_r())},normalize(...e){return this.check(yr(...e))},toLowerCase(){return this.check(br())},toUpperCase(){return this.check(wr())},slugify(){return this.check(vr())}})),mn=g("ZodString",(e,t)=>{cr.init(e,t),kr.init(e,t)},{email(e){return this.check(Ga($r,e))},url(e){return this.check(si(wn,e))},jwt(e){return this.check(gc(Zr,e))},emoji(e){return this.check(nc(Ir,e))},guid(e){return this.check(Ya(Sr,e))},uuid(e){return this.check(Qa(Ge,e))},uuidv4(e){return this.check(Xa(Ge,e))},uuidv6(e){return this.check(ec(Ge,e))},uuidv7(e){return this.check(tc(Ge,e))},nanoid(e){return this.check(rc(xr,e))},cuid(e){return this.check(oc(zr,e))},cuid2(e){return this.check(ic(Tr,e))},ulid(e){return this.check(sc(Er,e))},base64(e){return this.check(pc(Rr,e))},base64url(e){return this.check(hc(Lr,e))},xid(e){return this.check(ac(Cr,e))},ksuid(e){return this.check(cc(Ar,e))},ipv4(e){return this.check(uc(Nr,e))},ipv6(e){return this.check(lc(Or,e))},cidrv4(e){return this.check(dc(Pr,e))},cidrv6(e){return this.check(fc(Mr,e))},e164(e){return this.check(mc(Dr,e))},datetime(e){return this.check(_c(gn,e))},date(e){return this.check(bc(yn,e))},time(e){return this.check(wc(_n,e))},duration(e){return this.check(vc(bn,e))}});function _(e){return Jh(mn,e)}const ee=g("ZodStringFormat",(e,t)=>{ne.init(e,t),kr.init(e,t)}),gn=g("ZodISODateTime",(e,t)=>{Zp.init(e,t),ee.init(e,t)}),yn=g("ZodISODate",(e,t)=>{jp.init(e,t),ee.init(e,t)}),_n=g("ZodISOTime",(e,t)=>{Fp.init(e,t),ee.init(e,t)}),bn=g("ZodISODuration",(e,t)=>{Up.init(e,t),ee.init(e,t)}),$r=g("ZodEmail",(e,t)=>{Ep.init(e,t),ee.init(e,t)});function jc(e){return Ga($r,e)}const Sr=g("ZodGUID",(e,t)=>{zp.init(e,t),ee.init(e,t)});function Fc(e){return Ya(Sr,e)}const Ge=g("ZodUUID",(e,t)=>{Tp.init(e,t),ee.init(e,t)});function Uc(e){return Qa(Ge,e)}function Vc(e){return Xa(Ge,e)}function qc(e){return ec(Ge,e)}function Hc(e){return tc(Ge,e)}const wn=g("ZodURL",(e,t)=>{Ap.init(e,t),ee.init(e,t)});function Bc(e){return si(wn,e)}function Kc(e){return si(wn,{protocol:pa,hostname:qf,...I(e)})}const Ir=g("ZodEmoji",(e,t)=>{Np.init(e,t),ee.init(e,t)});function Jc(e){return nc(Ir,e)}const xr=g("ZodNanoID",(e,t)=>{Op.init(e,t),ee.init(e,t)});function Wc(e){return rc(xr,e)}const zr=g("ZodCUID",(e,t)=>{Pp.init(e,t),ee.init(e,t)});function Gc(e){return oc(zr,e)}const Tr=g("ZodCUID2",(e,t)=>{Mp.init(e,t),ee.init(e,t)});function Yc(e){return ic(Tr,e)}const Er=g("ZodULID",(e,t)=>{Rp.init(e,t),ee.init(e,t)});function Qc(e){return sc(Er,e)}const Cr=g("ZodXID",(e,t)=>{Lp.init(e,t),ee.init(e,t)});function Xc(e){return ac(Cr,e)}const Ar=g("ZodKSUID",(e,t)=>{Dp.init(e,t),ee.init(e,t)});function eu(e){return cc(Ar,e)}const Nr=g("ZodIPv4",(e,t)=>{Vp.init(e,t),ee.init(e,t)});function tu(e){return uc(Nr,e)}const fi=g("ZodMAC",(e,t)=>{Hp.init(e,t),ee.init(e,t)});function nu(e){return Gh(fi,e)}const Or=g("ZodIPv6",(e,t)=>{qp.init(e,t),ee.init(e,t)});function ru(e){return lc(Or,e)}const Pr=g("ZodCIDRv4",(e,t)=>{Bp.init(e,t),ee.init(e,t)});function ou(e){return dc(Pr,e)}const Mr=g("ZodCIDRv6",(e,t)=>{Kp.init(e,t),ee.init(e,t)});function iu(e){return fc(Mr,e)}const Rr=g("ZodBase64",(e,t)=>{Jp.init(e,t),ee.init(e,t)});function su(e){return pc(Rr,e)}const Lr=g("ZodBase64URL",(e,t)=>{Wp.init(e,t),ee.init(e,t)});function au(e){return hc(Lr,e)}const Dr=g("ZodE164",(e,t)=>{Gp.init(e,t),ee.init(e,t)});function cu(e){return mc(Dr,e)}const pi=g("ZodCreditCard",(e,t)=>{Yp.init(e,t),ee.init(e,t)});function uu(e){return Yh(pi,e)}const hi=g("ZodIBAN",(e,t)=>{Qp.init(e,t),ee.init(e,t)});function lu(e){return Qh(hi,e)}const Zr=g("ZodJWT",(e,t)=>{Xp.init(e,t),ee.init(e,t)});function du(e){return gc(Zr,e)}const It=g("ZodCustomStringFormat",(e,t)=>{eh.init(e,t),ee.init(e,t)});function fu(e,t,n={}){return hn(It,e,t,n)}function pu(e){return hn(It,"hostname",Vf,e)}function hu(e){return hn(It,"hex",ip,e)}function mu(e){return hn(It,"currency_code",Bf,e)}function gu(e,t){const n=t?.enc??"hex",r=`${e}_${n}`,o=Go[r];if(!o)throw new Error(`Unrecognized hash format: ${r}`);return hn(It,r,o,t)}const vn=g("ZodNumber",(e,t)=>{Pa.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jm(e,n,r,o),e.isFinite=!0},er({minValue:e=>{const{minimum:t,exclusiveMinimum:n}=ge(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{const{maximum:t,exclusiveMaximum:n}=ge(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{const{isInt:t,multipleOf:n}=ge(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>ge(e).format??null},{gt(e,t){return this.check(pt(e,t))},gte(e,t){return this.check(je(e,t))},min(e,t){return this.check(je(e,t))},lt(e,t){return this.check(ft(e,t))},lte(e,t){return this.check(Ze(e,t))},max(e,t){return this.check(Ze(e,t))},int(e){return this.check(Kn(e))},safe(e){return this.check(Kn(e))},positive(e){return this.check(pt(0,e))},nonnegative(e){return this.check(je(0,e))},negative(e){return this.check(ft(0,e))},nonpositive(e){return this.check(Ze(0,e))},multipleOf(e,t){return this.check(jt(e,t))},step(e,t){return this.check(jt(e,t))},finite(){return this}}));function Z(e){return Xh(vn,e)}const xt=g("ZodNumberFormat",(e,t)=>{th.init(e,t),vn.init(e,t)});function Kn(e){return tm(xt,e)}function yu(e){return nm(xt,e)}function _u(e){return rm(xt,e)}function bu(e){return om(xt,e)}function wu(e){return im(xt,e)}const kn=g("ZodBoolean",(e,t)=>{Ma.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fm(e,n,r)});function X(e){return sm(kn,e)}const $n=g("ZodBigInt",(e,t)=>{Ra.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Um(e,n,r,o)},er({minValue:e=>ge(e).minimum??null,maxValue:e=>ge(e).maximum??null,format:e=>ge(e).format??null},{gte(e,t){return this.check(je(e,t))},min(e,t){return this.check(je(e,t))},gt(e,t){return this.check(pt(e,t))},lt(e,t){return this.check(ft(e,t))},lte(e,t){return this.check(Ze(e,t))},max(e,t){return this.check(Ze(e,t))},positive(e){return this.check(pt(BigInt(0),e))},negative(e){return this.check(ft(BigInt(0),e))},nonpositive(e){return this.check(Ze(BigInt(0),e))},nonnegative(e){return this.check(je(BigInt(0),e))},multipleOf(e,t){return this.check(jt(e,t))}}));function vu(e){return cm($n,e)}const jr=g("ZodBigIntFormat",(e,t)=>{nh.init(e,t),$n.init(e,t)});function ku(e){return lm(jr,e)}function $u(e){return dm(jr,e)}const mi=g("ZodSymbol",(e,t)=>{rh.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vm(e,n,r,o)});function Su(e){return fm(mi,e)}const gi=g("ZodUndefined",(e,t)=>{oh.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hm(e,n,r,o)});function sn(e){return pm(gi,e)}const yi=g("ZodNull",(e,t)=>{ih.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qm(e,n,r)});function Fr(e){return hm(yi,e)}const _i=g("ZodAny",(e,t)=>{sh.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Jm()});function Ur(){return mm(_i)}const bi=g("ZodUnknown",(e,t)=>{ah.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wm()});function Y(){return gm(bi)}const wi=g("ZodNever",(e,t)=>{ch.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Km(e,n,r)});function Ft(e){return ym(wi,e)}const vi=g("ZodVoid",(e,t)=>{uh.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bm(e,n,r,o)});function Iu(e){return _m(vi,e)}const Vr=g("ZodDate",(e,t)=>{lh.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gm(e,n,r,o),e.min=(n,r)=>e.check(je(n,r)),e.max=(n,r)=>e.check(Ze(n,r))},er({minDate:e=>{const{minimum:t}=ge(e);return t?new Date(t):null},maxDate:e=>{const{maximum:t}=ge(e);return t?new Date(t):null}},{}));function xu(e){return bm(Vr,e)}const ki=g("ZodArray",(e,t)=>{Ht(),dh.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>cg(e,n,r,o),e.element=t.element},{min(e,t){return this.check(St(e,t))},nonempty(e){return this.check(St(1,e))},max(e,t){return this.check(fn(e,t))},length(e,t){return this.check(pn(e,t))},unwrap(){return this.element}});function M(e,t){return km(ki,e,t)}function zu(e){const t=e._zod.def.shape;return we(Object.keys(t))}const Sn=g("ZodObject",(e,t)=>{Ht(),mh.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ug(e,n,r,o),_f(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return we(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Se(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Se(this._zod.def,{catchall:Y()}))},loose(){return this.clone(Se(this._zod.def,{catchall:Y()}))},strict(){return this.clone(Se(this._zod.def,{catchall:Ft()}))},strip(){return this.clone(Se(this._zod.def,{catchall:void 0}))},extend(e){return cf(this,e)},safeExtend(e){return lf(this,e)},merge(e){return df(this,e)},pick(e){return sf(this,e)},omit(e){return af(this,e)},partial(...e){return $s(zn,this,e[0])},exactPartial(...e){return $s(Br,this,e[0],"exactPartial")},required(...e){return ff(Kr,this,e[0])}});function v(e,t){const n={type:"object",shape:e??{},...I(t)};return new Sn(n)}function Tu(e,t){return new Sn({type:"object",shape:e,catchall:Ft(),...I(t)})}function be(e,t){return new Sn({type:"object",shape:e,catchall:Y(),...I(t)})}const In=g("ZodUnion",(e,t)=>{ei.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kc(e,n,r,o),e.options=t.options});function F(e,t){return new In({type:"union",options:e,...I(t)})}const $i=g("ZodXor",(e,t)=>{In.init(e,t),gh.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kc(e,n,r,o),e.options=t.options});function Eu(e,t){return new $i({type:"union",options:e,inclusive:!1,...I(t)})}const Si=g("ZodDiscriminatedUnion",(e,t)=>{In.init(e,t),_h.init(e,t)});function qr(e,t,n){return new Si({type:"union",options:t,discriminator:e,...I(n)})}const Ii=g("ZodIntersection",(e,t)=>{bh.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lg(e,n,r,o)});function xn(e,t){return new Ii({type:"intersection",left:e,right:t})}const xi=g("ZodTuple",(e,t)=>{Ht(),Da.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>dg(e,n,r,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){const e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new zn({type:"optional",innerType:t}))})}});function zi(e,t,n){const r=t instanceof D,o=r?n:t,i=r?t:null;return new xi({type:"tuple",items:e,rest:i,...I(o)})}const Ut=g("ZodRecord",(e,t)=>{Ht(),wh.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fg(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function q(e,t,n){return!t||!t._zod?new Ut({type:"record",keyType:_(),valueType:e,...I(t)}):new Ut({type:"record",keyType:e,valueType:t,...I(n)})}function Cu(e,t,n){return new Ut({type:"record",keyType:e,valueType:t,...I(n),partial:!0})}function Au(e,t,n){return new Ut({type:"record",keyType:e,valueType:t,mode:"loose",...I(n)})}const Ti=g("ZodMap",(e,t)=>{Ht(),vh.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>sg(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(ht(...n)),e.nonempty=n=>e.check(ht(1,n)),e.max=(...n)=>e.check(qt(...n)),e.size=(...n)=>e.check(dn(...n))});function Nu(e,t,n){return new Ti({type:"map",keyType:e,valueType:t,...I(n)})}const Ei=g("ZodSet",(e,t)=>{Ht(),kh.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ag(e,n,r,o),e.min=(...n)=>e.check(ht(...n)),e.nonempty=n=>e.check(ht(1,n)),e.max=(...n)=>e.check(qt(...n)),e.size=(...n)=>e.check(dn(...n))});function Ou(e,t){return new Ei({type:"set",valueType:e,...I(t)})}const Vt=g("ZodEnum",(e,t)=>{$h.init(e,t),j.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Ym(e,r,o),e.enum=t.entries,e.options=[...e._zod.values];const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const s of r)if(n.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Vt({...t,checks:[],...I(o),entries:i})},e.exclude=(r,o)=>{const i={...t.entries};for(const s of r)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Vt({...t,checks:[],...I(o),entries:i})}});function we(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Vt({type:"enum",entries:n,...I(t)})}function Pu(e,t){return new Vt({type:"enum",entries:e,...I(t)})}const Ci=g("ZodLiteral",(e,t)=>{Sh.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qm(e,n,r,o),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 b(e,t){return new Ci({type:"literal",values:Array.isArray(e)?e:[e],...I(t)})}const Ai=g("ZodFile",(e,t)=>{Ih.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tg(e,n,r),e.min=(n,r)=>e.check(ht(n,r)),e.max=(n,r)=>e.check(qt(n,r)),e.mime=(n,r)=>e.check(gr(Array.isArray(n)?n:[n],r))});function Mu(e){return $m(Ai,e)}const Ni=g("ZodTransform",(e,t)=>{Ht(),xh.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ig(e,n,r,o),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new qo(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(Qt(i,n.value,t));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=n.value),s.inst??(s.inst=e),n.issues.push(Qt(s))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Hr(e){return new Ni({type:"transform",transform:e})}const zn=g("ZodOptional",(e,t)=>{Za.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function re(e){return new zn({type:"optional",innerType:e})}const Br=g("ZodExactOptional",(e,t)=>{zh.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Oi(e){return new Br({type:"optional",innerType:e})}const Pi=g("ZodNullable",(e,t)=>{Th.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>pg(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function an(e){return new Pi({type:"nullable",innerType:e})}function Ru(e){return re(an(e))}const Mi=g("ZodDefault",(e,t)=>{Eh.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gg(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ri(e,t){return new Mi({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Qn(t)}})}const Li=g("ZodPrefault",(e,t)=>{Ch.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yg(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Di(e,t){return new Li({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Qn(t)}})}const Kr=g("ZodNonOptional",(e,t)=>{Ah.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>hg(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Zi(e,t){return new Kr({type:"nonoptional",innerType:e,...I(t)})}const ji=g("ZodSuccess",(e,t)=>{Nh.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ng(e,n,r),e.unwrap=()=>e._zod.def.innerType});function Lu(e){return new ji({type:"success",innerType:e})}const Fi=g("ZodCatch",(e,t)=>{Oh.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_g(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ui(e,t){return new Fi({type:"catch",innerType:e,catchValue:typeof t=="function"?t:Xs(t)})}const Vi=g("ZodNaN",(e,t)=>{Ph.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xm(e,n,r,o)});function Du(e){return vm(Vi,e)}const Tn=g("ZodPipe",(e,t)=>{ja.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bg(e,n,r,o),e.in=t.in,e.out=t.out});function Jn(e,t){return new Tn({type:"pipe",in:e,out:t})}const En=g("ZodCodec",(e,t)=>{Tn.init(e,t),Fa.init(e,t)});function Zu(e,t,n){return new En({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function ju(e){const t=e._zod.def;return new En({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}const qi=g("ZodPreprocess",(e,t)=>{Tn.init(e,t),Mh.init(e,t)}),Hi=g("ZodReadonly",(e,t)=>{Rh.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wg(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Bi(e){return new Hi({type:"readonly",innerType:e})}const Ki=g("ZodTemplateLiteral",(e,t)=>{Lh.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>eg(e,n,r)});function Fu(e,t){return new Ki({type:"template_literal",parts:e,...I(t)})}const Ji=g("ZodLazy",(e,t)=>{Ua.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kg(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function Wi(e){return new Ji({type:"lazy",getter:e})}const Gi=g("ZodPromise",(e,t)=>{Zh.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vg(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Uu(e){return new Gi({type:"promise",innerType:e})}const Yi=g("ZodFunction",(e,t)=>{Dh.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>og(e,n,r,o)});function cn(e){return new Yi({type:"function",input:Array.isArray(e?.input)?zi(e?.input):e?.input??M(Y()),output:e?.output??Y()})}const Cn=g("ZodCustom",(e,t)=>{jh.init(e,t),j.init(e,t),e._zod.processJSONSchema=(n,r,o)=>rg(e,n,r,o)});function Vu(e){const t=new ie({check:"custom"});return t._zod.check=e,t}function Qi(e,t){return Sm(Cn,e??(()=>!0),t)}function Xi(e,t={}){return Im(Cn,e,t)}function es(e,t){return xm(e,t)}const qu=Tm,Hu=Em,ts=g("ZodInstanceOf",(e,t)=>{Cn.init(e,t)},{properties(e,t){return this.check(mr(e,t))}});function Bu(e,t={}){const n=new ts({type:"custom",check:"custom",fn:r=>r instanceof e,abort:!0,...I(t)});return n._zod.bag.Class=e,n._zod.check=r=>{r.value instanceof e||r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:n,path:[...n._zod.def.path??[]]})},n}const Ku=(...e)=>Cm({Codec:En,Boolean:kn,String:mn},...e);function Ju(e){const t=Wi(()=>F([_(e),Z(),X(),Fr(),M(t),q(_(),t)]));return t}function Jr(e,t){return new qi({type:"pipe",in:Hr(e),out:t})}const jw=Object.freeze(Object.defineProperty({__proto__:null,ZodAny:_i,ZodArray:ki,ZodBase64:Rr,ZodBase64URL:Lr,ZodBigInt:$n,ZodBigIntFormat:jr,ZodBoolean:kn,ZodCIDRv4:Pr,ZodCIDRv6:Mr,ZodCUID:zr,ZodCUID2:Tr,ZodCatch:Fi,ZodCodec:En,ZodCreditCard:pi,ZodCustom:Cn,ZodCustomStringFormat:It,ZodDate:Vr,ZodDefault:Mi,ZodDiscriminatedUnion:Si,ZodE164:Dr,ZodEmail:$r,ZodEmoji:Ir,ZodEnum:Vt,ZodExactOptional:Br,ZodFile:Ai,ZodFunction:Yi,ZodGUID:Sr,ZodIBAN:hi,ZodIPv4:Nr,ZodIPv6:Or,ZodISODate:yn,ZodISODateTime:gn,ZodISODuration:bn,ZodISOTime:_n,ZodInstanceOf:ts,ZodIntersection:Ii,ZodJWT:Zr,ZodKSUID:Ar,ZodLazy:Ji,ZodLiteral:Ci,ZodMAC:fi,ZodMap:Ti,ZodNaN:Vi,ZodNanoID:xr,ZodNever:wi,ZodNonOptional:Kr,ZodNull:yi,ZodNullable:Pi,ZodNumber:vn,ZodNumberFormat:xt,ZodObject:Sn,ZodOptional:zn,ZodPipe:Tn,ZodPrefault:Li,ZodPreprocess:qi,ZodPromise:Gi,ZodReadonly:Hi,ZodRecord:Ut,ZodSet:Ei,ZodString:mn,ZodStringFormat:ee,ZodSuccess:ji,ZodSymbol:mi,ZodTemplateLiteral:Ki,ZodTransform:Ni,ZodTuple:xi,ZodType:j,ZodULID:Er,ZodURL:wn,ZodUUID:Ge,ZodUndefined:gi,ZodUnion:In,ZodUnknown:bi,ZodVoid:vi,ZodXID:Cr,ZodXor:$i,_ZodString:kr,_default:Ri,_function:cn,any:Ur,array:M,base64:su,base64url:au,bigint:vu,boolean:X,catch:Ui,check:Vu,cidrv4:ou,cidrv6:iu,codec:Zu,creditCard:uu,cuid:Gc,cuid2:Yc,currencyCode:mu,custom:Qi,date:xu,describe:qu,discriminatedUnion:qr,e164:cu,email:jc,emoji:Jc,enum:we,exactOptional:Oi,file:Mu,float32:yu,float64:_u,function:cn,guid:Fc,hash:gu,hex:hu,hostname:pu,httpUrl:Kc,iban:lu,instanceof:Bu,int:Kn,int32:bu,int64:ku,intersection:xn,invertCodec:ju,ipv4:tu,ipv6:ru,json:Ju,jwt:du,keyof:zu,ksuid:eu,lazy:Wi,literal:b,looseObject:be,looseRecord:Au,mac:nu,map:Nu,meta:Hu,nan:Du,nanoid:Wc,nativeEnum:Pu,never:Ft,nonoptional:Zi,null:Fr,nullable:an,nullish:Ru,number:Z,object:v,optional:re,partialRecord:Cu,pipe:Jn,prefault:Di,preprocess:Jr,promise:Uu,readonly:Bi,record:q,refine:Xi,set:Ou,strictObject:Tu,string:_,stringFormat:fu,stringbool:Ku,success:Lu,superRefine:es,symbol:Su,templateLiteral:Fu,transform:Hr,tuple:zi,uint32:wu,uint64:$u,ulid:Qc,undefined:sn,union:F,unknown:Y,url:Bc,uuid:Uc,uuidv4:Vc,uuidv6:qc,uuidv7:Hc,void:Iu,xid:Xc,xor:Eu},Symbol.toStringTag,{value:"Module"})),zg={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function Tg(e){me({customError:e})}function Eg(){return me().customError}var Oo;Oo||(Oo={});function Cg(e){return _c(gn,e)}function Fw(e){return bc(yn,e)}function Uw(e){return wc(_n,e)}function Vw(e){return vc(bn,e)}const Wu=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:yn,ZodISODateTime:gn,ZodISODuration:bn,ZodISOTime:_n,date:Fw,datetime:Cg,duration:Vw,time:Uw},Symbol.toStringTag,{value:"Module"})),E={...jw,...Dw,iso:Wu},qw=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function Hw(e,t){const n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function _d(e,t){return e.map((n,r)=>r<t?n:n.optional())}function Bw(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Kw(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");const n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;const r=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===r){const o=n[1]===void 0?void 0:Bw(n[1]);if(!o||!t.defs[o])throw new Error(`Reference not found: ${e}`);return t.defs[o]}throw new Error(`Reference not found: ${e}`)}function Jw(e,t){return E.transform(r=>r).check(r=>{const o=r.value;if(typeof o!="object"||o===null||Array.isArray(o))return;const i=Object.getOwnPropertyNames(o);if(t.minProperties!==void 0&&i.length<t.minProperties&&r.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:o,inst:e,continue:!0}),t.maxProperties!==void 0&&i.length>t.maxProperties&&r.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:o,inst:e,continue:!0}),t.keySchema)for(const s of i){const a=t.keySchema.safeParse(s);a.success||r.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:s,path:[s],continue:!0})}}).pipe(e)}function Rs(e,t){if(e===null)return"z";const n=typeof e;if(n!=="object"){if(n==="number"&&Number.isNaN(e))return null;const r=String(e);return`${n[0]}${r.length}:${r}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){const i=[];for(const s of e){const a=Rs(s,t);if(a===null)return null;i.push(a)}return`a${i.length}:[${i.join(",")}]`}const r=Object.keys(e).sort(),o=[];for(const i of r){const s=Rs(e[i],t);if(s===null)return null;o.push(`${i.length}:${i}=${s}`)}return`o${o.length}:{${o.join(",")}}`}finally{t.delete(e)}}const Ww=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),Gw=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function Un(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(Un):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,n])=>Ww.has(t)?Un(n):!Gw.has(t)||typeof n!="object"||n===null?!1:Object.values(n).some(Un))}function bd(e){return e===1?"element":"elements"}function Yw(e,t){return E.transform(r=>r).check(r=>{const o=r.value;if(Array.isArray(o)){if(t.uniqueItems===!0){const i=new Map;for(let s=0;s<o.length;s++){const a=Rs(o[s],new Set);if(a===null)continue;const c=i.get(a);if(c===void 0){i.set(a,s);continue}r.issues.push({code:"custom",message:`Array items must be unique: element at index ${s} duplicates the one at index ${c}`,input:o,path:[s],continue:!0})}}if(t.containsSchema){const i=t.minContains??1,s=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY;let a=0;for(const c of o)if(t.containsSchema.safeParse(c).success&&++a>=s)break;a<i&&r.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${bd(i)}; found ${a}`,input:o,continue:!0}),t.maxContains!==void 0&&a>t.maxContains&&r.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${bd(t.maxContains)}`,input:o,continue:!0})}}}).pipe(e)}function wd(e,t){if(e!==!1)return e===void 0||e===!0?E.any():Te(e,t)}const Qw=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Ag(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return E.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){const o=e.$ref;if(t.refs.has(o))return t.refs.get(o);if(t.processing.has(o))return E.lazy(()=>{if(!t.refs.has(o))throw new Error(`Circular reference not resolved: ${o}`);return t.refs.get(o)});t.processing.add(o);const i=Kw(o,t),s=Te(i,t);return t.refs.set(o,s),t.processing.delete(o),s}if(e.enum!==void 0){const o=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&o.length===1&&o[0]===null)return E.null();if(o.length===0)return E.never();if(o.length===1)return E.literal(o[0]);if(o.every(s=>typeof s=="string"))return E.enum(o);const i=o.map(s=>E.literal(s));return i.length<2?i[0]:E.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return E.literal(e.const);const n=e.type;if(Array.isArray(n)){const o=n.map(i=>{const s={...e,type:i};return Ag(s,t)});return o.length===0?E.never():o.length===1?o[0]:E.union(o)}if(!n)return E.any();let r;switch(n){case"string":{let o=E.string();if(e.format){const i=e.format;i==="email"?o=o.check(E.email()):i==="uri"||i==="uri-reference"?o=o.check(E.url()):i==="uuid"||i==="guid"?o=o.check(E.uuid()):i==="date-time"?o=o.check(E.iso.datetime({offset:!0})):i==="date"?o=o.check(E.iso.date()):i==="time"?o=o.check(E.regex(Qw)):i==="duration"?o=o.check(E.iso.duration()):i==="hostname"?o=o.check(E.hostname()):i==="ipv4"?o=o.check(E.ipv4()):i==="ipv6"?o=o.check(E.ipv6()):i==="mac"?o=o.check(E.mac()):i==="cidr"?o=o.check(E.cidrv4()):i==="cidr-v6"?o=o.check(E.cidrv6()):i==="base64"?o=o.check(E.base64()):i==="base64url"?o=o.check(E.base64url()):i==="e164"?o=o.check(E.e164()):i==="credit_card"?o=o.check(E.creditCard()):i==="iban"?o=o.check(E.iban()):i==="jwt"?o=o.check(E.jwt()):i==="emoji"?o=o.check(E.emoji()):i==="nanoid"?o=o.check(E.nanoid()):i==="cuid"?o=o.check(E.cuid()):i==="cuid2"?o=o.check(E.cuid2()):i==="ulid"?o=o.check(E.ulid()):i==="xid"?o=o.check(E.xid()):i==="ksuid"&&(o=o.check(E.ksuid()))}typeof e.minLength=="number"&&(o=o.min(e.minLength)),typeof e.maxLength=="number"&&(o=o.max(e.maxLength)),e.pattern&&(o=o.regex(new RegExp(e.pattern))),r=o;break}case"number":case"integer":{let o=n==="integer"?E.number().int():E.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(o=o.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(o=o.max(e.maximum)),typeof e.exclusiveMinimum=="number"?o=o.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(o=o.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?o=o.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(o=o.lt(e.maximum)),typeof e.multipleOf=="number"&&(o=o.multipleOf(e.multipleOf)),r=o;break}case"boolean":{r=E.boolean();break}case"null":{r=E.null();break}case"object":{const o={},i=e.properties||{},s=new Set(e.required||[]),a=typeof e.additionalProperties=="object"?Te(e.additionalProperties,t):void 0;for(const[d,f]of Object.entries(i)){const p=Te(f,t);Fe(o,d,s.has(d)?p:p.optional())}if(e.patternProperties){const d=e.patternProperties,f=Object.keys(d),p=[];for(const m of f){const y=Te(d[m],t),$=E.string().regex(new RegExp(m));p.push(E.looseRecord($,y))}const h=[];if(Object.keys(o).length>0&&h.push(E.object(o).passthrough()),h.push(...p),h.length===0)r=E.object({}).passthrough();else if(h.length===1)r=h[0];else{let m=E.intersection(h[0],h[1]);for(let y=2;y<h.length;y++)m=E.intersection(m,h[y]);r=m}if(e.additionalProperties===!1){const m=Object.keys(o),y=f.map(w=>new RegExp(w)),$=r;r=r.check(w=>{if(!ct(w.value))return;const S=[];for(const T of Object.keys(w.value))m.includes(T)||y.some(O=>O.test(T))||S.push(T);S.length&&w.issues.push({code:"unrecognized_keys",keys:S,input:w.value,inst:$})})}}else{const d=E.object(o);e.additionalProperties===!1?r=d.strict():a?r=d.catchall(a):r=d.passthrough()}const c=e.propertyNames!==void 0&&e.propertyNames!==!0,u=typeof e.minProperties=="number"?e.minProperties:void 0,l=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(c||u!==void 0||l!==void 0){let d;if(c){const f=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=Te(f,t)}r=Jw(r,{keySchema:d,minProperties:u,maxProperties:l})}break}case"array":{const o=e.prefixItems,i=e.items;if(o&&Array.isArray(o)){const s=typeof e.minItems=="number"?e.minItems:0,a=o.map(d=>Te(d,t)),c=_d(a,s),u=Array.isArray(i)?void 0:wd(i,t),l=E.tuple(c);r=u?l.rest(u):l,typeof e.minItems=="number"&&(r=r.check(E.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(E.maxLength(e.maxItems)))}else if(Array.isArray(i)){const s=typeof e.minItems=="number"?e.minItems:0,a=i.map(d=>Te(d,t)),c=_d(a,s),u=wd(e.additionalItems,t),l=E.tuple(c);r=u?l.rest(u):l,typeof e.minItems=="number"&&(r=r.check(E.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(E.maxLength(e.maxItems)))}else if(i!==void 0){const s=Te(i,t);let a=E.array(s);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),r=a}else r=E.array(E.any());(e.uniqueItems===!0||e.contains!==void 0)&&(r=Yw(r,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?Te(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${n}`)}return r}function Te(e,t){if(typeof e=="boolean")return e?E.any():E.never();let n=Ag(e,t);const r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){const a=e.anyOf.map(u=>Te(u,t)),c=E.union(a);n=r?E.intersection(n,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){const a=e.oneOf.map(u=>Te(u,t)),c=E.xor(a);n=r?E.intersection(n,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=r?n:E.any();else{let a=r?n:Te(e.allOf[0],t);const c=r?0:1;for(let u=c;u<e.allOf.length;u++)a=E.intersection(a,Te(e.allOf[u],t));n=a}e.nullable===!0&&t.version==="openapi-3.0"&&(n=E.nullable(n)),e.readOnly===!0&&(n=E.readonly(n)),e.default!==void 0&&(n=n.default(e.default));const o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(const a of i)a in e&&(o[a]=e[a]);const s=["contentEncoding","contentMediaType","contentSchema"];for(const a of s)a in e&&(o[a]=e[a]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!Un(e.propertyNames)&&(o.propertyNames=e.propertyNames);for(const a of["minProperties","maxProperties"])e[a]!==void 0&&(o[a]=e[a])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!Un(e.contains)&&(o.contains=e.contains);for(const a of["uniqueItems","minContains","maxContains"])e[a]!==void 0&&(o[a]=e[a])}for(const a of Object.keys(e))qw.has(a)||Fe(o,a,e[a]);return Object.keys(o).length>0&&t.registry.add(n,o),e.description&&(n=n.describe(e.description)),n}function Ng(e,t){if(typeof e=="boolean")return e?E.any():E.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}const r=Hw(n,t?.defaultTarget),o=n.$defs||n.definitions||{},i={version:r,defs:o,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??Le};return Te(n,i)}function Og(e){return xc(e,{object:t=>t.partial(),union:t=>{const n=t._zod.def;return n.discriminator===void 0?t:F(n.options)}})}function Xw(e,t){if(!t?.length)return e;const n=e._zod.def;return oe(e,Se(n,{checks:[...n.checks??[],...t]}),{parent:!0})}function Pg(e){return Xw(e.out,e.checks)}function ev(e){return e.in._zod.traits.has("$ZodTransform")?Pg(e):e.in}function Mg(e){return xc(e,{pipe:t=>ev(t._zod.def),default:(t,n)=>n?re(t._zod.def.innerType):t,catch:(t,n)=>n?t._zod.def.innerType:t})}function Rg(e){return xc(e,{pipe:t=>Pg(t._zod.def),prefault:(t,n)=>n?t._zod.def.innerType:t})}function tv(e){return Wh(mn,e)}function nv(e){return em(vn,e)}function rv(e){return am(kn,e)}function ov(e){return um($n,e)}function iv(e){return wm(Vr,e)}const Lg=Object.freeze(Object.defineProperty({__proto__:null,bigint:ov,boolean:rv,date:iv,number:nv,string:tv},Symbol.toStringTag,{value:"Module"})),vd=Object.freeze(Object.defineProperty({__proto__:null,$brand:na,$input:Ka,$output:Ba,INVALID:Ce,NEVER:ta,TimePrecision:yc,ZodAny:_i,ZodArray:ki,ZodBase64:Rr,ZodBase64URL:Lr,ZodBigInt:$n,ZodBigIntFormat:jr,ZodBoolean:kn,ZodCIDRv4:Pr,ZodCIDRv6:Mr,ZodCUID:zr,ZodCUID2:Tr,ZodCatch:Fi,ZodCodec:En,ZodCompileAsyncError:dt,ZodCompileUnsupportedError:B,ZodCreditCard:pi,ZodCustom:Cn,ZodCustomStringFormat:It,ZodDate:Vr,ZodDefault:Mi,ZodDiscriminatedUnion:Si,ZodE164:Dr,ZodEmail:$r,ZodEmoji:Ir,ZodEnum:Vt,ZodError:xg,ZodExactOptional:Br,ZodFile:Ai,get ZodFirstPartyTypeKind(){return Oo},ZodFunction:Yi,ZodGUID:Sr,ZodIBAN:hi,ZodIPv4:Nr,ZodIPv6:Or,ZodISODate:yn,ZodISODateTime:gn,ZodISODuration:bn,ZodISOTime:_n,ZodInstanceOf:ts,ZodIntersection:Ii,ZodIssueCode:zg,ZodJWT:Zr,ZodKSUID:Ar,ZodLazy:Ji,ZodLiteral:Ci,ZodMAC:fi,ZodMap:Ti,ZodNaN:Vi,ZodNanoID:xr,ZodNever:wi,ZodNonOptional:Kr,ZodNull:yi,ZodNullable:Pi,ZodNumber:vn,ZodNumberFormat:xt,ZodObject:Sn,ZodOptional:zn,ZodPipe:Tn,ZodPrefault:Li,ZodPreprocess:qi,ZodPromise:Gi,ZodReadonly:Hi,ZodRealError:Ne,ZodRecord:Ut,ZodSet:Ei,ZodString:mn,ZodStringFormat:ee,ZodSuccess:ji,ZodSymbol:mi,ZodTemplateLiteral:Ki,ZodTransform:Ni,ZodTuple:xi,ZodType:j,ZodULID:Er,ZodURL:wn,ZodUUID:Ge,ZodUndefined:gi,ZodUnion:In,ZodUnknown:bi,ZodVoid:vi,ZodXID:Cr,ZodXor:$i,_ZodString:kr,_default:Ri,_function:cn,any:Ur,array:M,base64:su,base64url:au,bigint:vu,boolean:X,catch:Ui,check:Vu,cidrv4:ou,cidrv6:iu,clone:oe,codec:Zu,coerce:Lg,compile:Ja,config:me,core:$g,creditCard:uu,cuid:Gc,cuid2:Yc,currencyCode:mu,custom:Qi,date:xu,decode:Oc,decodeAsync:Mc,deepPartial:Og,describe:qu,discriminatedUnion:qr,e164:cu,email:jc,emoji:Jc,encode:Nc,encodeAsync:Pc,endsWith:hr,enum:we,exactOptional:Oi,file:Mu,flattenError:Ho,float32:yu,float64:_u,formatError:Bo,fromJSONSchema:Ng,function:cn,getDiscriminatedOption:La,getErrorMap:Eg,globalRegistry:Le,gt:pt,gte:je,guid:Fc,hash:gu,hex:hu,hostname:pu,httpUrl:Kc,iban:lu,includes:fr,input:Mg,instanceof:Bu,int:Kn,int32:bu,int64:ku,intersection:xn,invertCodec:ju,ipv4:tu,ipv6:ru,iso:Wu,json:Ju,jwt:du,keyof:zu,ksuid:eu,lazy:Wi,length:pn,literal:b,locales:Ha,looseObject:be,looseRecord:Au,lowercase:lr,lt:ft,lte:Ze,mac:nu,map:Nu,maxLength:fn,maxSize:qt,memoizer:ti,meta:Hu,mime:gr,minLength:St,minSize:ht,multipleOf:jt,nan:Du,nanoid:Wc,nativeEnum:Pu,negative:ci,never:Ft,nonnegative:li,nonoptional:Zi,nonpositive:ui,normalize:yr,null:Fr,nullable:an,nullish:Ru,number:Z,object:v,optional:re,output:Rg,overwrite:nt,parse:Tc,parseAsync:Ec,partialRecord:Cu,pipe:Jn,positive:ai,prefault:Di,preprocess:Jr,prettifyError:oa,promise:Uu,properties:mr,property:di,readonly:Bi,record:q,refine:Xi,regex:ur,regexes:Go,registry:ni,safeDecode:Lc,safeDecodeAsync:Zc,safeEncode:Rc,safeEncodeAsync:Dc,safeParse:Cc,safeParseAsync:Ac,set:Ou,setErrorMap:Tg,size:dn,slugify:vr,startsWith:pr,strictObject:Tu,string:_,stringFormat:fu,stringbool:Ku,success:Lu,superRefine:es,symbol:Su,templateLiteral:Fu,toJSONSchema:Ic,toLowerCase:br,toUpperCase:wr,toZod:Do,transform:Hr,treeifyError:ra,trim:_r,tuple:zi,uint32:wu,uint64:$u,ulid:Qc,undefined:sn,union:F,unknown:Y,uppercase:dr,url:Bc,util:ea,uuid:Uc,uuidv4:Vc,uuidv6:qc,uuidv7:Hc,validate:Jo,validateAsync:Wo,void:Iu,withParser:ri,xid:Xc,xor:Eu},Symbol.toStringTag,{value:"Module"})),sv=Object.freeze(Object.defineProperty({__proto__:null,$brand:na,$input:Ka,$output:Ba,INVALID:Ce,NEVER:ta,TimePrecision:yc,ZodAny:_i,ZodArray:ki,ZodBase64:Rr,ZodBase64URL:Lr,ZodBigInt:$n,ZodBigIntFormat:jr,ZodBoolean:kn,ZodCIDRv4:Pr,ZodCIDRv6:Mr,ZodCUID:zr,ZodCUID2:Tr,ZodCatch:Fi,ZodCodec:En,ZodCompileAsyncError:dt,ZodCompileUnsupportedError:B,ZodCreditCard:pi,ZodCustom:Cn,ZodCustomStringFormat:It,ZodDate:Vr,ZodDefault:Mi,ZodDiscriminatedUnion:Si,ZodE164:Dr,ZodEmail:$r,ZodEmoji:Ir,ZodEnum:Vt,ZodError:xg,ZodExactOptional:Br,ZodFile:Ai,get ZodFirstPartyTypeKind(){return Oo},ZodFunction:Yi,ZodGUID:Sr,ZodIBAN:hi,ZodIPv4:Nr,ZodIPv6:Or,ZodISODate:yn,ZodISODateTime:gn,ZodISODuration:bn,ZodISOTime:_n,ZodInstanceOf:ts,ZodIntersection:Ii,ZodIssueCode:zg,ZodJWT:Zr,ZodKSUID:Ar,ZodLazy:Ji,ZodLiteral:Ci,ZodMAC:fi,ZodMap:Ti,ZodNaN:Vi,ZodNanoID:xr,ZodNever:wi,ZodNonOptional:Kr,ZodNull:yi,ZodNullable:Pi,ZodNumber:vn,ZodNumberFormat:xt,ZodObject:Sn,ZodOptional:zn,ZodPipe:Tn,ZodPrefault:Li,ZodPreprocess:qi,ZodPromise:Gi,ZodReadonly:Hi,ZodRealError:Ne,ZodRecord:Ut,ZodSet:Ei,ZodString:mn,ZodStringFormat:ee,ZodSuccess:ji,ZodSymbol:mi,ZodTemplateLiteral:Ki,ZodTransform:Ni,ZodTuple:xi,ZodType:j,ZodULID:Er,ZodURL:wn,ZodUUID:Ge,ZodUndefined:gi,ZodUnion:In,ZodUnknown:bi,ZodVoid:vi,ZodXID:Cr,ZodXor:$i,_ZodString:kr,_default:Ri,_function:cn,any:Ur,array:M,base64:su,base64url:au,bigint:vu,boolean:X,catch:Ui,check:Vu,cidrv4:ou,cidrv6:iu,clone:oe,codec:Zu,coerce:Lg,compile:Ja,config:me,core:$g,creditCard:uu,cuid:Gc,cuid2:Yc,currencyCode:mu,custom:Qi,date:xu,decode:Oc,decodeAsync:Mc,deepPartial:Og,default:vd,describe:qu,discriminatedUnion:qr,e164:cu,email:jc,emoji:Jc,encode:Nc,encodeAsync:Pc,endsWith:hr,enum:we,exactOptional:Oi,file:Mu,flattenError:Ho,float32:yu,float64:_u,formatError:Bo,fromJSONSchema:Ng,function:cn,getDiscriminatedOption:La,getErrorMap:Eg,globalRegistry:Le,gt:pt,gte:je,guid:Fc,hash:gu,hex:hu,hostname:pu,httpUrl:Kc,iban:lu,includes:fr,input:Mg,instanceof:Bu,int:Kn,int32:bu,int64:ku,intersection:xn,invertCodec:ju,ipv4:tu,ipv6:ru,iso:Wu,json:Ju,jwt:du,keyof:zu,ksuid:eu,lazy:Wi,length:pn,literal:b,locales:Ha,looseObject:be,looseRecord:Au,lowercase:lr,lt:ft,lte:Ze,mac:nu,map:Nu,maxLength:fn,maxSize:qt,memoizer:ti,meta:Hu,mime:gr,minLength:St,minSize:ht,multipleOf:jt,nan:Du,nanoid:Wc,nativeEnum:Pu,negative:ci,never:Ft,nonnegative:li,nonoptional:Zi,nonpositive:ui,normalize:yr,null:Fr,nullable:an,nullish:Ru,number:Z,object:v,optional:re,output:Rg,overwrite:nt,parse:Tc,parseAsync:Ec,partialRecord:Cu,pipe:Jn,positive:ai,prefault:Di,preprocess:Jr,prettifyError:oa,promise:Uu,properties:mr,property:di,readonly:Bi,record:q,refine:Xi,regex:ur,regexes:Go,registry:ni,safeDecode:Lc,safeDecodeAsync:Zc,safeEncode:Rc,safeEncodeAsync:Dc,safeParse:Cc,safeParseAsync:Ac,set:Ou,setErrorMap:Tg,size:dn,slugify:vr,startsWith:pr,strictObject:Tu,string:_,stringFormat:fu,stringbool:Ku,success:Lu,superRefine:es,symbol:Su,templateLiteral:Fu,toJSONSchema:Ic,toLowerCase:br,toUpperCase:wr,toZod:Do,transform:Hr,treeifyError:ra,trim:_r,tuple:zi,uint32:wu,uint64:$u,ulid:Qc,undefined:sn,union:F,unknown:Y,uppercase:dr,url:Bc,util:ea,uuid:Uc,uuidv4:Vc,uuidv6:qc,uuidv7:Hc,validate:Jo,validateAsync:Wo,void:Iu,withParser:ri,xid:Xc,xor:Eu,z:vd},Symbol.toStringTag,{value:"Module"})),Rt="io.modelcontextprotocol/related-task",ns="2.0",he=Qi(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Dg=F([_(),Z().int()]),Zg=_();be({ttl:Z().optional(),pollInterval:Z().optional()});const av=v({ttl:Z().optional()}),cv=v({taskId:_()}),Gu=be({progressToken:Dg.optional(),[Rt]:cv.optional()}),Ve=v({_meta:Gu.optional()}),Wr=Ve.extend({task:av.optional()}),uv=e=>Wr.safeParse(e).success,ve=v({method:_(),params:Ve.loose().optional()}),Ke=v({_meta:Gu.optional()}),Je=v({method:_(),params:Ke.loose().optional()}),ke=be({_meta:Gu.optional()}),Gr=F([_(),Z().int()]),jg=v({jsonrpc:b(ns),id:Gr,...ve.shape}).strict(),kd=e=>jg.safeParse(e).success,Fg=v({jsonrpc:b(ns),...Je.shape}).strict(),lv=e=>Fg.safeParse(e).success,Yu=v({jsonrpc:b(ns),id:Gr,result:ke}).strict(),mo=e=>Yu.safeParse(e).success;var G;(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"})(G||(G={}));const Qu=v({jsonrpc:b(ns),id:Gr.optional(),error:v({code:Z().int(),message:_(),data:Y().optional()})}).strict(),dv=e=>Qu.safeParse(e).success,fv=F([jg,Fg,Yu,Qu]);F([Yu,Qu]);const Xu=ke.strict(),pv=Ke.extend({requestId:Gr.optional(),reason:_().optional()}),el=Je.extend({method:b("notifications/cancelled"),params:pv}),hv=v({src:_(),mimeType:_().optional(),sizes:M(_()).optional(),theme:we(["light","dark"]).optional()}),Yr=v({icons:M(hv).optional()}),un=v({name:_(),title:_().optional()}),rs=un.extend({...un.shape,...Yr.shape,version:_(),websiteUrl:_().optional(),description:_().optional()}),mv=xn(v({applyDefaults:X().optional()}),q(_(),Y())),gv=Jr(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,xn(v({form:mv.optional(),url:he.optional()}),q(_(),Y()).optional())),yv=be({list:he.optional(),cancel:he.optional(),requests:be({sampling:be({createMessage:he.optional()}).optional(),elicitation:be({create:he.optional()}).optional()}).optional()}),_v=be({list:he.optional(),cancel:he.optional(),requests:be({tools:be({call:he.optional()}).optional()}).optional()}),bv=v({experimental:q(_(),he).optional(),sampling:v({context:he.optional(),tools:he.optional()}).optional(),elicitation:gv.optional(),roots:v({listChanged:X().optional()}).optional(),tasks:yv.optional(),extensions:q(_(),he).optional()}),wv=Ve.extend({protocolVersion:_(),capabilities:bv,clientInfo:rs}),vv=ve.extend({method:b("initialize"),params:wv}),kv=v({experimental:q(_(),he).optional(),logging:he.optional(),completions:he.optional(),prompts:v({listChanged:X().optional()}).optional(),resources:v({subscribe:X().optional(),listChanged:X().optional()}).optional(),tools:v({listChanged:X().optional()}).optional(),tasks:_v.optional(),extensions:q(_(),he).optional()}),$v=ke.extend({protocolVersion:_(),capabilities:kv,serverInfo:rs,instructions:_().optional()}),Sv=Je.extend({method:b("notifications/initialized"),params:Ke.optional()}),os=ve.extend({method:b("ping"),params:Ve.optional()}),Iv=v({progress:Z(),total:re(Z()),message:re(_())}),xv=v({...Ke.shape,...Iv.shape,progressToken:Dg}),tl=Je.extend({method:b("notifications/progress"),params:xv}),zv=Ve.extend({cursor:Zg.optional()}),Qr=ve.extend({params:zv.optional()}),Xr=ke.extend({nextCursor:Zg.optional()}),Tv=we(["working","input_required","completed","failed","cancelled"]),eo=v({taskId:_(),status:Tv,ttl:F([Z(),Fr()]),createdAt:_(),lastUpdatedAt:_(),pollInterval:re(Z()),statusMessage:re(_())}),nl=ke.extend({task:eo}),Ev=Ke.merge(eo),Po=Je.extend({method:b("notifications/tasks/status"),params:Ev}),rl=ve.extend({method:b("tasks/get"),params:Ve.extend({taskId:_()})}),ol=ke.merge(eo),il=ve.extend({method:b("tasks/result"),params:Ve.extend({taskId:_()})});ke.loose();const sl=Qr.extend({method:b("tasks/list")}),al=Xr.extend({tasks:M(eo)}),cl=ve.extend({method:b("tasks/cancel"),params:Ve.extend({taskId:_()})}),Cv=ke.merge(eo),Ug=v({uri:_(),mimeType:re(_()),_meta:q(_(),Y()).optional()}),Vg=Ug.extend({text:_()}),ul=_().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),qg=Ug.extend({blob:ul}),to=we(["user","assistant"]),An=v({audience:M(to).optional(),priority:Z().min(0).max(1).optional(),lastModified:Cg({offset:!0}).optional()}),Hg=v({...un.shape,...Yr.shape,uri:_(),description:re(_()),mimeType:re(_()),size:re(Z()),annotations:An.optional(),_meta:re(be({}))}),Av=v({...un.shape,...Yr.shape,uriTemplate:_(),description:re(_()),mimeType:re(_()),annotations:An.optional(),_meta:re(be({}))}),Nv=Qr.extend({method:b("resources/list")}),Bg=Xr.extend({resources:M(Hg)}),Ov=Qr.extend({method:b("resources/templates/list")}),Pv=Xr.extend({resourceTemplates:M(Av)}),ll=Ve.extend({uri:_()}),Mv=ll,Rv=ve.extend({method:b("resources/read"),params:Mv}),Kg=ke.extend({contents:M(F([Vg,qg]))}),Lv=Je.extend({method:b("notifications/resources/list_changed"),params:Ke.optional()}),Dv=ll,Zv=ve.extend({method:b("resources/subscribe"),params:Dv}),jv=ll,Fv=ve.extend({method:b("resources/unsubscribe"),params:jv}),Uv=Ke.extend({uri:_()}),Vv=Je.extend({method:b("notifications/resources/updated"),params:Uv}),qv=v({name:_(),description:re(_()),required:re(X())}),Hv=v({...un.shape,...Yr.shape,description:re(_()),arguments:re(M(qv)),_meta:re(be({}))}),Bv=Qr.extend({method:b("prompts/list")}),Kv=Xr.extend({prompts:M(Hv)}),Jv=Ve.extend({name:_(),arguments:q(_(),_()).optional()}),Wv=ve.extend({method:b("prompts/get"),params:Jv}),dl=v({type:b("text"),text:_(),annotations:An.optional(),_meta:q(_(),Y()).optional()}),fl=v({type:b("image"),data:ul,mimeType:_(),annotations:An.optional(),_meta:q(_(),Y()).optional()}),pl=v({type:b("audio"),data:ul,mimeType:_(),annotations:An.optional(),_meta:q(_(),Y()).optional()}),Gv=v({type:b("tool_use"),name:_(),id:_(),input:q(_(),Y()),_meta:q(_(),Y()).optional()}),Jg=v({type:b("resource"),resource:F([Vg,qg]),annotations:An.optional(),_meta:q(_(),Y()).optional()}),Wg=Hg.extend({type:b("resource_link")}),no=F([dl,fl,pl,Wg,Jg]),Yv=v({role:to,content:no}),Qv=ke.extend({description:_().optional(),messages:M(Yv)}),Xv=Je.extend({method:b("notifications/prompts/list_changed"),params:Ke.optional()}),ek=v({title:_().optional(),readOnlyHint:X().optional(),destructiveHint:X().optional(),idempotentHint:X().optional(),openWorldHint:X().optional()}),tk=v({taskSupport:we(["required","optional","forbidden"]).optional()}),hl=v({...un.shape,...Yr.shape,description:_().optional(),inputSchema:v({type:b("object"),properties:q(_(),he).optional(),required:M(_()).optional()}).catchall(Y()),outputSchema:v({type:b("object"),properties:q(_(),he).optional(),required:M(_()).optional()}).catchall(Y()).optional(),annotations:ek.optional(),execution:tk.optional(),_meta:q(_(),Y()).optional()}),Gg=Qr.extend({method:b("tools/list")}),nk=Xr.extend({tools:M(hl)}),is=ke.extend({content:M(no).default([]),structuredContent:q(_(),Y()).optional(),isError:X().optional()});is.or(ke.extend({toolResult:Y()}));const rk=Wr.extend({name:_(),arguments:q(_(),Y()).optional()}),Yg=ve.extend({method:b("tools/call"),params:rk}),ok=Je.extend({method:b("notifications/tools/list_changed"),params:Ke.optional()});v({autoRefresh:X().default(!0),debounceMs:Z().int().nonnegative().default(300)});const Qg=we(["debug","info","notice","warning","error","critical","alert","emergency"]),ik=Ve.extend({level:Qg}),sk=ve.extend({method:b("logging/setLevel"),params:ik}),ak=Ke.extend({level:Qg,logger:_().optional(),data:Y()}),ck=Je.extend({method:b("notifications/message"),params:ak}),uk=v({name:_().optional()}),lk=v({hints:M(uk).optional(),costPriority:Z().min(0).max(1).optional(),speedPriority:Z().min(0).max(1).optional(),intelligencePriority:Z().min(0).max(1).optional()}),dk=v({mode:we(["auto","required","none"]).optional()}),fk=v({type:b("tool_result"),toolUseId:_().describe("The unique identifier for the corresponding tool call."),content:M(no).default([]),structuredContent:v({}).loose().optional(),isError:X().optional(),_meta:q(_(),Y()).optional()}),pk=qr("type",[dl,fl,pl]),Mo=qr("type",[dl,fl,pl,Gv,fk]),hk=v({role:to,content:F([Mo,M(Mo)]),_meta:q(_(),Y()).optional()}),mk=Wr.extend({messages:M(hk),modelPreferences:lk.optional(),systemPrompt:_().optional(),includeContext:we(["none","thisServer","allServers"]).optional(),temperature:Z().optional(),maxTokens:Z().int(),stopSequences:M(_()).optional(),metadata:he.optional(),tools:M(hl).optional(),toolChoice:dk.optional()}),gk=ve.extend({method:b("sampling/createMessage"),params:mk}),Xg=ke.extend({model:_(),stopReason:re(we(["endTurn","stopSequence","maxTokens"]).or(_())),role:to,content:pk}),ey=ke.extend({model:_(),stopReason:re(we(["endTurn","stopSequence","maxTokens","toolUse"]).or(_())),role:to,content:F([Mo,M(Mo)])}),yk=v({type:b("boolean"),title:_().optional(),description:_().optional(),default:X().optional()}),_k=v({type:b("string"),title:_().optional(),description:_().optional(),minLength:Z().optional(),maxLength:Z().optional(),format:we(["email","uri","date","date-time"]).optional(),default:_().optional()}),bk=v({type:we(["number","integer"]),title:_().optional(),description:_().optional(),minimum:Z().optional(),maximum:Z().optional(),default:Z().optional()}),wk=v({type:b("string"),title:_().optional(),description:_().optional(),enum:M(_()),default:_().optional()}),vk=v({type:b("string"),title:_().optional(),description:_().optional(),oneOf:M(v({const:_(),title:_()})),default:_().optional()}),kk=v({type:b("string"),title:_().optional(),description:_().optional(),enum:M(_()),enumNames:M(_()).optional(),default:_().optional()}),$k=F([wk,vk]),Sk=v({type:b("array"),title:_().optional(),description:_().optional(),minItems:Z().optional(),maxItems:Z().optional(),items:v({type:b("string"),enum:M(_())}),default:M(_()).optional()}),Ik=v({type:b("array"),title:_().optional(),description:_().optional(),minItems:Z().optional(),maxItems:Z().optional(),items:v({anyOf:M(v({const:_(),title:_()}))}),default:M(_()).optional()}),xk=F([Sk,Ik]),zk=F([kk,$k,xk]),Tk=F([zk,yk,_k,bk]),Ek=Wr.extend({mode:b("form").optional(),message:_(),requestedSchema:v({type:b("object"),properties:q(_(),Tk),required:M(_()).optional()})}),Ck=Wr.extend({mode:b("url"),message:_(),elicitationId:_(),url:_().url()}),Ak=F([Ek,Ck]),Nk=ve.extend({method:b("elicitation/create"),params:Ak}),Ok=Ke.extend({elicitationId:_()}),Pk=Je.extend({method:b("notifications/elicitation/complete"),params:Ok}),Mk=ke.extend({action:we(["accept","decline","cancel"]),content:Jr(e=>e===null?void 0:e,q(_(),F([_(),Z(),X(),M(_())])).optional())}),Rk=v({type:b("ref/resource"),uri:_()}),Lk=v({type:b("ref/prompt"),name:_()}),Dk=Ve.extend({ref:F([Lk,Rk]),argument:v({name:_(),value:_()}),context:v({arguments:q(_(),_()).optional()}).optional()}),Zk=ve.extend({method:b("completion/complete"),params:Dk}),jk=ke.extend({completion:be({values:M(_()).max(100),total:re(Z().int()),hasMore:re(X())})}),Fk=v({uri:_().startsWith("file://"),name:_().optional(),_meta:q(_(),Y()).optional()}),Uk=ve.extend({method:b("roots/list"),params:Ve.optional()}),Vk=ke.extend({roots:M(Fk)}),qk=Je.extend({method:b("notifications/roots/list_changed"),params:Ke.optional()});F([os,vv,Zk,sk,Wv,Bv,Nv,Ov,Rv,Zv,Fv,Yg,Gg,rl,il,sl,cl]);F([el,tl,Sv,qk,Po]);F([Xu,Xg,ey,Mk,Vk,ol,al,nl]);F([os,gk,Nk,Uk,rl,il,sl,cl]);F([el,tl,ck,Vv,Lv,ok,Xv,Po,Pk]);F([Xu,$v,jk,Qv,Kv,Bg,Pv,Kg,is,nk,ol,al,nl]);class H extends Error{constructor(t,n,r){super(`MCP error ${t}: ${n}`),this.code=t,this.data=r,this.name="McpError"}static fromError(t,n,r){if(t===G.UrlElicitationRequired&&r){const o=r;if(o.elicitations)return new Hk(o.elicitations,n)}return new H(t,n,r)}}class Hk extends H{constructor(t,n=`URL elicitation${t.length>1?"s":""} required`){super(G.UrlElicitationRequired,n,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}}function Ot(e){return e==="completed"||e==="failed"||e==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function $d(e){const n=Pw(e)?.method;if(!n)throw new Error("Schema is missing a method literal");const r=Mw(n);if(typeof r!="string")throw new Error("Schema method literal must be a string");return r}function Sd(e,t){const n=Sg(e,t);if(!n.success)throw n.error;return n.data}const Bk=6e4;class Kk{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(el,n=>{this._oncancel(n)}),this.setNotificationHandler(tl,n=>{this._onprogress(n)}),this.setRequestHandler(os,n=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(rl,async(n,r)=>{const o=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!o)throw new H(G.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(il,async(n,r)=>{const o=async()=>{const i=n.params.taskId;if(!await this._taskStore.getTask(i,r.sessionId))throw new H(G.InvalidParams,`Task not found: ${i}`);if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(i,r.sessionId);){if(a.type==="response"||a.type==="error"){const c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{const d=c,f=new H(d.error.code,d.error.message,d.error.data);l(f)}else{const d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:r.requestId})}}const s=await this._taskStore.getTask(i,r.sessionId);if(!s)throw new H(G.InvalidParams,`Task not found: ${i}`);if(!Ot(s.status))return await this._waitForTaskUpdate(i,r.signal,r.sessionId),await o();if(Ot(s.status)){const a=await this._taskStore.getTaskResult(i,r.sessionId);return this._clearTaskQueue(i,r.sessionId),{...a,_meta:{...a._meta,[Rt]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(sl,async(n,r)=>{try{const{tasks:o,nextCursor:i}=await this._taskStore.listTasks(n.params?.cursor,r.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new H(G.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(cl,async(n,r)=>{try{const o=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!o)throw new H(G.InvalidParams,`Task not found: ${n.params.taskId}`);if(Ot(o.status))throw new H(G.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(n.params.taskId,r.sessionId);const i=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!i)throw new H(G.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof H?o:new H(G.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,n,r,o,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,n),startTime:Date.now(),timeout:n,maxTotalTimeout:r,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(t){const n=this._timeoutInfo.get(t);if(!n)return!1;const r=Date.now()-n.startTime;if(n.maxTotalTimeout&&r>=n.maxTotalTimeout)throw this._timeoutInfo.delete(t),H.fromError(G.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:r});return clearTimeout(n.timeoutId),n.timeoutId=setTimeout(n.onTimeout,n.timeout),!0}_cleanupTimeout(t){const n=this._timeoutInfo.get(t);n&&(clearTimeout(n.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 n=this.transport?.onclose;this._transport.onclose=()=>{n?.(),this._onclose()};const r=this.transport?.onerror;this._transport.onerror=i=>{r?.(i),this._onerror(i)};const o=this._transport?.onmessage;this._transport.onmessage=(i,s)=>{o?.(i,s),mo(i)||dv(i)?this._onresponse(i):kd(i)?this._onrequest(i,s):lv(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){const t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(const r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(const r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();const n=H.fromError(G.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(const r of t.values())r(n)}_onerror(t){this.onerror?.(t)}_onnotification(t){const n=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(t)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(t,n){const r=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,i=t.params?._meta?.[Rt]?.taskId,s=o?.sessionId,a=this._taskStore;let c=!0,u;if(i&&a&&this._taskMessageQueue&&s!==void 0&&(c=!1,u=(async()=>{if(!await a.getTask(i,s))throw new H(G.InvalidParams,`Task not found: ${i}`);c=!0})()),r===void 0){const h={jsonrpc:"2.0",id:t.id,error:{code:G.MethodNotFound,message:"Method not found"}};if(i&&u){const m={type:"error",message:h,timestamp:Date.now()};u.then(()=>this._enqueueTaskMessage(i,m,s),()=>o?.send(h)).catch(y=>this._onerror(new Error(`Failed to send an error response: ${y}`)))}else i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:h,timestamp:Date.now()},o?.sessionId).catch(m=>this._onerror(new Error(`Failed to enqueue error response: ${m}`))):o?.send(h).catch(m=>this._onerror(new Error(`Failed to send an error response: ${m}`)));return}const l=new AbortController;this._requestHandlerAbortControllers.set(t.id,l);const d=uv(t.params)?t.params.task:void 0,f=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,p={signal:l.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async h=>{if(l.signal.aborted)return;const m={relatedRequestId:t.id};i&&(m.relatedTask={taskId:i}),await this.notification(h,m)},sendRequest:async(h,m,y)=>{if(l.signal.aborted)throw new H(G.ConnectionClosed,"Request was cancelled");const $={...y,relatedRequestId:t.id};i&&!$.relatedTask&&($.relatedTask={taskId:i});const w=$.relatedTask?.taskId??i;return w&&f&&await f.updateTaskStatus(w,"input_required"),await this.request(h,m,$)},authInfo:n?.authInfo,requestId:t.id,requestInfo:n?.requestInfo,taskId:i,taskStore:f,taskRequestedTtl:d?.ttl,closeSSEStream:n?.closeSSEStream,closeStandaloneSSEStream:n?.closeStandaloneSSEStream};(u??Promise.resolve()).then(()=>{if(u&&l.signal.aborted)throw new H(G.ConnectionClosed,"Request was cancelled");d&&this.assertTaskHandlerCapability(t.method)}).then(()=>r(t,p)).then(async h=>{if(l.signal.aborted)return;const m={result:h,jsonrpc:"2.0",id:t.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:m,timestamp:Date.now()},o?.sessionId):await o?.send(m)},async h=>{if(l.signal.aborted)return;const m={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(h.code)?h.code:G.InternalError,message:h.message??"Internal error",...h.data!==void 0&&{data:h.data}}};i&&this._taskMessageQueue&&c?await this._enqueueTaskMessage(i,{type:"error",message:m,timestamp:Date.now()},o?.sessionId):await o?.send(m)}).catch(h=>this._onerror(new Error(`Failed to send response: ${h}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===l&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){const{progressToken:n,...r}=t.params,o=Number(n),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}const s=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(c);return}i(r)}_onresponse(t){const n=Number(t.id),r=this._requestResolvers.get(n);if(r){if(this._requestResolvers.delete(n),mo(t))r(t);else{const s=new H(t.error.code,t.error.message,t.error.data);r(s)}return}const o=this._responseHandlers.get(n);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(n),this._cleanupTimeout(n);let i=!1;if(mo(t)&&t.result&&typeof t.result=="object"){const s=t.result;if(s.task&&typeof s.task=="object"){const a=s.task;typeof a.taskId=="string"&&(i=!0,this._taskProgressTokens.set(a.taskId,n))}}if(i||this._progressHandlers.delete(n),mo(t))o(t);else{const s=H.fromError(t.error.code,t.error.message,t.error.data);o(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,n,r){const{task:o}=r??{};if(!o){try{yield{type:"result",result:await this.request(t,n,r)}}catch(s){yield{type:"error",error:s instanceof H?s:new H(G.InternalError,String(s))}}return}let i;try{const s=await this.request(t,nl,r);if(s.task)i=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new H(G.InternalError,"Task creation did not return a task");for(;;){const a=await this.getTask({taskId:i},r);if(yield{type:"taskStatus",task:a},Ot(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},n,r)}:a.status==="failed"?yield{type:"error",error:new H(G.InternalError,`Task ${i} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new H(G.InternalError,`Task ${i} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},n,r)};return}const c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),r?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof H?s:new H(G.InternalError,String(s))}}}request(t,n,r){const{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s,task:a,relatedTask:c}=r??{};return new Promise((u,l)=>{const d=w=>{l(w)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(w){d(w);return}r?.signal?.throwIfAborted();const f=this._requestMessageId++,p={...t,jsonrpc:"2.0",id:f};r?.onprogress&&(this._progressHandlers.set(f,r.onprogress),p.params={...t.params,_meta:{...t.params?._meta||{},progressToken:f}}),a&&(p.params={...p.params,task:a}),c&&(p.params={...p.params,_meta:{...p.params?._meta||{},[Rt]:c}});const h=w=>{this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(w)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(T=>this._onerror(new Error(`Failed to send cancellation: ${T}`)));const S=w instanceof H?w:new H(G.RequestTimeout,String(w));l(S)};this._responseHandlers.set(f,w=>{if(!r?.signal?.aborted){if(w instanceof Error)return l(w);try{const S=Sg(n,w.result);S.success?u(S.data):l(S.error)}catch(S){l(S)}}}),r?.signal?.addEventListener("abort",()=>{h(r?.signal?.reason)});const m=r?.timeout??Bk,y=()=>h(H.fromError(G.RequestTimeout,"Request timed out",{timeout:m}));this._setupTimeout(f,m,r?.maxTotalTimeout,y,r?.resetTimeoutOnProgress??!1);const $=c?.taskId;if($){const w=S=>{const T=this._responseHandlers.get(f);T?T(S):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,w),this._enqueueTaskMessage($,{type:"request",message:p,timestamp:Date.now()}).catch(S=>{this._cleanupTimeout(f),l(S)})}else this._transport.send(p,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(w=>{this._cleanupTimeout(f),l(w)})})}async getTask(t,n){return this.request({method:"tasks/get",params:t},ol,n)}async getTaskResult(t,n,r){return this.request({method:"tasks/result",params:t},n,r)}async listTasks(t,n){return this.request({method:"tasks/list",params:t},al,n)}async cancelTask(t,n){return this.request({method:"tasks/cancel",params:t},Cv,n)}async notification(t,n){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);const r=n?.relatedTask?.taskId;if(r){const a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[Rt]:n.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!n?.relatedRequestId&&!n?.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"};n?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Rt]:n.relatedTask}}}),this._transport?.send(a,n).catch(c=>this._onerror(c))});return}let s={...t,jsonrpc:"2.0"};n?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Rt]:n.relatedTask}}}),await this._transport.send(s,n)}setRequestHandler(t,n){const r=$d(t);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(o,i)=>{const s=Sd(t,o);return Promise.resolve(n(s,i))})}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,n){const r=$d(t);this._notificationHandlers.set(r,o=>{const i=Sd(t,o);return Promise.resolve(n(i))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){const n=this._taskProgressTokens.get(t);n!==void 0&&(this._progressHandlers.delete(n),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,n,r){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,n,r??this._transport?.sessionId,o)}async _clearTaskQueue(t,n){if(this._taskMessageQueue){const r=await this._taskMessageQueue.dequeueAll(t,n);for(const o of r)if(o.type==="request"&&kd(o.message)){const i=o.message.id,s=this._requestResolvers.get(i);s?(s(new H(G.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,n,r){let o=this._options?.defaultTaskPollInterval??1e3;try{const i=await this._taskStore?.getTask(t,r);i?.pollInterval&&(o=i.pollInterval)}catch{}return new Promise((i,s)=>{if(n.aborted){s(new H(G.InvalidRequest,"Request cancelled"));return}const a=setTimeout(i,o);n.addEventListener("abort",()=>{clearTimeout(a),s(new H(G.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,n){const r=this._taskStore;if(!r)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await r.createTask(o,t.id,{method:t.method,params:t.params},n)},getTask:async o=>{const i=await r.getTask(o,n);if(!i)throw new H(G.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,s)=>{await r.storeTaskResult(o,i,s,n);const a=await r.getTask(o,n);if(a){const c=Po.parse({method:"notifications/tasks/status",params:a});await this.notification(c),Ot(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>r.getTaskResult(o,n),updateTaskStatus:async(o,i,s)=>{const a=await r.getTask(o,n);if(!a)throw new H(G.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(Ot(a.status))throw new H(G.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(o,i,s,n);const c=await r.getTask(o,n);if(c){const u=Po.parse({method:"notifications/tasks/status",params:c});await this.notification(u),Ot(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>r.listTasks(o,n)}}}function Id(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Jk(e,t){const n={...e};for(const r in t){const o=r,i=t[o];if(i===void 0)continue;const s=n[o];Id(s)&&Id(i)?n[o]={...s,...i}:n[o]=i}return n}(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});class Wk extends Kk{_registeredMethods=new Set;_eventSlots=new Map;onEventDispatch(t,n){}_ensureEventSlot(t){let n=this._eventSlots.get(t);if(!n){let r=this.eventSchemas[t];if(!r)throw Error(`Unknown event: ${String(t)}`);n={listeners:[]},this._eventSlots.set(t,n);let o=r.shape.method.value;this._registeredMethods.add(o);let i=n;super.setNotificationHandler(r,s=>{let a=s.params;this.onEventDispatch(t,a),i.onHandler?.(a);for(let c of[...i.listeners])c(a)})}return n}setEventHandler(t,n){let r=this._ensureEventSlot(t);r.onHandler&&n&&console.warn(`[MCP Apps] on${String(t)} handler replaced. Use addEventListener("${String(t)}", …) to add multiple listeners without replacing.`),r.onHandler=n}getEventHandler(t){return this._eventSlots.get(t)?.onHandler}addEventListener(t,n){this._ensureEventSlot(t).listeners.push(n)}removeEventListener(t,n){let r=this._eventSlots.get(t);if(!r)return;let o=r.listeners.indexOf(n);o!==-1&&r.listeners.splice(o,1)}setRequestHandler=(t,n)=>{this._assertMethodNotRegistered(t,"setRequestHandler"),super.setRequestHandler(t,n)};setNotificationHandler=(t,n)=>{this._assertMethodNotRegistered(t,"setNotificationHandler"),super.setNotificationHandler(t,n)};warnIfRequestHandlerReplaced(t,n,r){n&&r&&console.warn(`[MCP Apps] ${t} handler replaced. Previous handler will no longer be called.`)}replaceRequestHandler=(t,n)=>{let r=t.shape.method.value;this._registeredMethods.add(r),super.setRequestHandler(t,n)};_assertMethodNotRegistered(t,n){let r=t.shape.method.value;if(this._registeredMethods.has(r))throw Error(`Handler for "${r}" already registered (via ${n}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._registeredMethods.add(r)}}var Gk="2026-01-26",Yk="ui/notifications/tool-input-partial";class ty{eventTarget;eventSource;messageListener;constructor(t=window.parent,n){this.eventTarget=t,this.eventSource=n,this.messageListener=r=>{if(n&&r.source!==this.eventSource){console.debug("Ignoring message from unknown source",r);return}let o=fv.safeParse(r.data);o.success?(console.debug("Parsed message",o.data),this.onmessage?.(o.data)):r.data?.jsonrpc!=="2.0"?console.debug("Ignoring non-JSON-RPC message",o.error.message,r):(console.error("Failed to parse message",o.error.message,r),this.onerror?.(Error("Invalid JSON-RPC message received: "+o.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(t,n){t.method!==Yk&&console.debug("Sending message",t),this.eventTarget.postMessage(t,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var Qk=F([b("light"),b("dark")]).describe("Color theme preference for the host environment."),Wn=F([b("inline"),b("fullscreen"),b("pip")]).describe("Display mode for UI presentation."),Xk=F([b("--color-background-primary"),b("--color-background-secondary"),b("--color-background-tertiary"),b("--color-background-inverse"),b("--color-background-ghost"),b("--color-background-info"),b("--color-background-danger"),b("--color-background-success"),b("--color-background-warning"),b("--color-background-disabled"),b("--color-text-primary"),b("--color-text-secondary"),b("--color-text-tertiary"),b("--color-text-inverse"),b("--color-text-ghost"),b("--color-text-info"),b("--color-text-danger"),b("--color-text-success"),b("--color-text-warning"),b("--color-text-disabled"),b("--color-border-primary"),b("--color-border-secondary"),b("--color-border-tertiary"),b("--color-border-inverse"),b("--color-border-ghost"),b("--color-border-info"),b("--color-border-danger"),b("--color-border-success"),b("--color-border-warning"),b("--color-border-disabled"),b("--color-ring-primary"),b("--color-ring-secondary"),b("--color-ring-inverse"),b("--color-ring-info"),b("--color-ring-danger"),b("--color-ring-success"),b("--color-ring-warning"),b("--font-sans"),b("--font-mono"),b("--font-weight-normal"),b("--font-weight-medium"),b("--font-weight-semibold"),b("--font-weight-bold"),b("--font-text-xs-size"),b("--font-text-sm-size"),b("--font-text-md-size"),b("--font-text-lg-size"),b("--font-heading-xs-size"),b("--font-heading-sm-size"),b("--font-heading-md-size"),b("--font-heading-lg-size"),b("--font-heading-xl-size"),b("--font-heading-2xl-size"),b("--font-heading-3xl-size"),b("--font-text-xs-line-height"),b("--font-text-sm-line-height"),b("--font-text-md-line-height"),b("--font-text-lg-line-height"),b("--font-heading-xs-line-height"),b("--font-heading-sm-line-height"),b("--font-heading-md-line-height"),b("--font-heading-lg-line-height"),b("--font-heading-xl-line-height"),b("--font-heading-2xl-line-height"),b("--font-heading-3xl-line-height"),b("--border-radius-xs"),b("--border-radius-sm"),b("--border-radius-md"),b("--border-radius-lg"),b("--border-radius-xl"),b("--border-radius-full"),b("--border-width-regular"),b("--shadow-hairline"),b("--shadow-sm"),b("--shadow-md"),b("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),e$=q(Xk.describe(`Style variables for theming MCP apps.
|
|
70
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const a=i[1];if(t===i[0]){s(i);continue}if(e.external){const u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}a.count>1&&e.reused==="ref"&&s(i)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Um(e){const t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;const n=[];for(const r of t){if(!r||typeof r!="object")return;Um(r);const o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;const s=r.type;for(const i of Array.isArray(s)?s:[s]){if(typeof i!="string")return;n.includes(i)||n.push(i)}}delete e.anyOf,e.type=n.length===1?n[0]:n}const Vm=new Set(["type","properties","required","additionalProperties"]),wd=["oneOf","anyOf"];function vd(e){const t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function Qi(e){const t=[];for(const s of e){if(typeof s!="object"||s.type!=="object")return null;for(const i in s)if(!Vm.has(i))return null;t.push(s)}const n={},r=new Set;for(const s of t){for(const i in s.properties){if(Object.prototype.hasOwnProperty.call(n,i))continue;const a=[];for(const u of t){const l=u.properties?.[i]??vd(u);l!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(l))||a.push(l))}const c=a.length===1?a[0]:Qi(a)??{allOf:a};Fe(n,i,c)}for(const i of s.required??[])r.add(i)}const o={type:"object",properties:n};if(r.size&&(o.required=[...r]),t.every(s=>s.additionalProperties===!1))o.additionalProperties=!1;else{const s=[];for(const i of t){const a=vd(i);a&&!s.some(c=>JSON.stringify(c)===JSON.stringify(a))&&s.push(a)}s.length===1?o.additionalProperties=s[0]:s.length>1&&(o.additionalProperties={allOf:s})}return o}function Mw(e){const t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(const o of Vm)if(o in e)return;const n=t.filter(o=>wd.some(s=>Array.isArray(o[s])));let r=null;if(!n.length)r=Qi(t);else{const o=n[0],s=wd.find(c=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;const i=t.filter(c=>c!==o),a=o[s].map(c=>Qi([...i,c]));if(a.some(c=>!c))return;r={[s]:a}}r&&(delete e.allOf,Qn(e,r))}function fn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=a=>{const c=e.seen.get(a);if(c.ref===null)return;const u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){r(d);const p=e.seen.get(d),h=p.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(h)):Qn(u,h),Qn(u,l),a._zod.parent===d)for(const _ in u)_==="$ref"||_==="allOf"||_ in l||delete u[_];if(h.$ref&&p.def)for(const _ in u)_==="$ref"||_==="allOf"||_ in p.def&&JSON.stringify(u[_])===JSON.stringify(p.def[_])&&delete u[_]}const f=a._zod.parent;if(f&&f!==d){r(f);const p=e.seen.get(f);if(p?.schema.$ref&&(u.$ref=p.schema.$ref,p.def))for(const h in u)h==="$ref"||h==="allOf"||h in p.def&&JSON.stringify(u[h])===JSON.stringify(p.def[h])&&delete u[h]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(const a of[...e.seen.entries()].reverse())r(a[0]);if(e.target!=="openapi-3.0")for(const a of e.seen.entries())Um(a[1].def??a[1].schema);for(const a of e.deferred)a();if(e.intersections.length){const a=new Map;for(const c of e.seen.values())for(const u of[c.schema,c.def]){const l=u?.allOf;if(!Array.isArray(l))continue;const d=a.get(l);d?d.push(u):a.set(l,[u])}for(const c of e.intersections)for(const u of a.get(c)??[])Mw(u)}}const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Qn(o,n.defId?n.schema:n.def??n.schema);const s=e.metadataRegistry.get(t)?.id;s!==void 0&&o.id===s&&delete o.id;const i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(const a of e.seen.entries()){const c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,Fe(i,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:nr(t,"input",e.processors),output:nr(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Te(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Te(r.element,n);if(r.type==="set")return Te(r.valueType,n);if(r.type==="lazy")return Te(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return Te(r.innerType,n);if(r.type==="intersection")return Te(r.left,n)||Te(r.right,n);if(r.type==="record"||r.type==="map")return Te(r.keyType,n)||Te(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Te(r.in,n)||Te(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Te(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Te(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Te(o,n))return!0;return!!(r.rest&&Te(r.rest,n))}return!1}const qm=(e,t={})=>n=>{const r=ln({...n,processors:t});return ne(e,r),dn(r,e),fn(r,e)},nr=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=ln({...o??{},target:s,io:t,processors:n});return ne(e,i),dn(i,e),fn(i,e)},pn=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},hn=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},kd=(e,t)=>{pn(e,"minimum",t),hn(e,"maximum",t)},Hm=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Bm=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Km=(e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},Jm=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},$d=(e,t)=>pn(e,"minimum",t.minimum),Sd=(e,t)=>hn(e,"maximum",t.maximum),xd=e=>(t,n)=>{Jm(t,n.format);const[r,o]=e[n.format];pn(t,"minimum",r),hn(t,"maximum",o)},Lw={greater_than:(e,t)=>pn(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>hn(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Hm(e,t.value),number_format:xd(ga),bigint_format:xd(ya),min_length:$d,max_length:Sd,length_equals:(e,t)=>kd(e,t.length),min_size:$d,max_size:Sd,size_equals:(e,t)=>kd(e,t.size),string_format:(e,t)=>{Jm(e,t.format),t.pattern&&Bm(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Km(e,t.mime)};function _e(e){const t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(const s of r)Lw[s._zod.def.check]?.(t,s._zod.def);const o=e._zod.bag;o.minimum!==void 0&&pn(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&pn(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&hn(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&hn(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Hm(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&Km(t,o.mime);for(const s of o.patterns??[])Bm(t,s);return t}const Rw={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Dw=new Map([[Wa,Qf],[ys,Xf]]),Wm=e=>Dw.get(e)??e,Gm=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u,laxFormat:l}=_e(e);if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=Rw[a]??a,o.format===""&&delete o.format,(a==="time"||l)&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){const d=[...c].map(Wm);d.length===1?o.pattern=d[0].source:d.length>1&&(o.allOf=[...d.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},Ym=(e,t,n,r)=>{const o=n,{minimum:s,maximum:i,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=_e(e);o.type=l?"integer":"number";const d=typeof u=="number"&&u>=(s??Number.NEGATIVE_INFINITY),f=typeof c=="number"&&c<=(i??Number.POSITIVE_INFINITY),p=t.target==="draft-04"||t.target==="openapi-3.0";if(d?p?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof s=="number"&&(o.minimum=s),f?p?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof i=="number"&&(o.maximum=i),a){const h=new Set;for(const S of a)Number.isFinite(S)&&S!==0?h.add(Math.abs(S)):be(e,t,o,r,`A multipleOf divisor of ${S} cannot be represented in JSON Schema`);const[m,..._]=h;m!==void 0&&(o.multipleOf=m),_.length&&(o.allOf=[...o.allOf??[],..._.map(S=>({multipleOf:S}))])}},Qm=(e,t,n,r)=>{n.type="boolean"},Xm=(e,t,n,r)=>{be(e,t,n,r,"BigInt cannot be represented in JSON Schema")},eg=(e,t,n,r)=>{be(e,t,n,r,"Symbols cannot be represented in JSON Schema")},tg=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},ng=(e,t,n,r)=>{be(e,t,n,r,"Undefined cannot be represented in JSON Schema")},rg=(e,t,n,r)=>{be(e,t,n,r,"Void cannot be represented in JSON Schema")},og=(e,t,n,r)=>{n.not={}},sg=(e,t,n,r)=>{},ig=(e,t,n,r)=>{},ag=(e,t,n,r)=>{be(e,t,n,r,"Date cannot be represented in JSON Schema")},cg=(e,t,n,r)=>{const o=e._zod.def,s=qo(o.entries);if(s.length===0){n.not={};return}s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},ug=(e,t,n,r)=>{const o=e._zod.def;if(o.values.length===0){n.not={};return}const s=[];for(const i of o.values)if(i===void 0){if(be(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i=="bigint"){if(be(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){const i=s[0];n.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[i]:n.const=i}else s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),s.every(i=>typeof i=="boolean")&&(n.type="boolean"),s.every(i=>i===null)&&(n.type="null"),n.enum=s},lg=(e,t,n,r)=>{be(e,t,n,r,"NaN cannot be represented in JSON Schema")},dg=(e,t,n,r)=>{const o=n,s=e._zod.pattern;if(!s)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=s.source},fg=(e,t,n,r)=>{const o=n;o.type="string",o.format="binary",o.contentEncoding="binary";const{minimum:s,maximum:i,mime:a}=_e(e);s!==void 0&&(o.minLength=s),i!==void 0&&(o.maxLength=i),a&&(a.length===0?o.not={}:a.length===1?o.contentMediaType=a[0]:o.anyOf=a.map(c=>({contentMediaType:c})))},pg=(e,t,n,r)=>{n.type="boolean"},hg=(e,t,n,r)=>{be(e,t,n,r,"Custom types cannot be represented in JSON Schema")},mg=(e,t,n,r)=>{be(e,t,n,r,"Function types cannot be represented in JSON Schema")},gg=(e,t,n,r)=>{be(e,t,n,r,"Transforms cannot be represented in JSON Schema")},yg=(e,t,n,r)=>{be(e,t,n,r,"Map cannot be represented in JSON Schema")},_g=(e,t,n,r)=>{be(e,t,n,r,"Set cannot be represented in JSON Schema")},bg=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:i,maximum:a}=_e(e);typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=ne(s.element,t,{...r,path:[...r.path,"items"]})};function rr(e){const t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?rr(t.out):t.type==="catch"?rr(t.innerType):e._zod.optin}const wg=(e,t,n,r)=>{const o=n,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&be(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(const u in i)Fe(o.properties,u,ne(i[u],t,{...r,path:[...r.path,"properties",u]}));const c=[];for(const u of Object.keys(i)){const l=s.shape[u];(t.io==="input"?rr(l)===void 0:l._zod.optout===void 0)&&c.push(u)}c.length>0&&(o.required=c),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=ne(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Uc=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>ne(a,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=i:n.anyOf=i},vg=(e,t,n,r)=>{const o=e._zod.def,s=ne(o.left,t,{...r,path:[...r.path,"allOf",0]}),i=ne(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];n.allOf=c,t.intersections.push(c)},kg=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="array";const i=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=s.items.map((m,_)=>ne(m,t,{...r,path:[...r.path,i,_]})),u=s.rest?ne(s.rest,t,{...r,path:[...r.path,a,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;let l=s.items.length;for(;l>0;){const m=s.items[l-1];if(!(t.io==="input"?rr(m)!==void 0:m._zod.optout==="optional"))break;l--}const d=s.items.length,f=!s.rest;t.target==="draft-2020-12"?(o.prefixItems=c,f?o.items=!1:u&&(o.items=u),l>0&&(o.minItems=l),f&&(o.maxItems=d)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),l>0&&(o.minItems=l),f&&(o.maxItems=d)):(o.items=c,f?o.additionalItems=!1:u&&(o.additionalItems=u),l>0&&(o.minItems=l),f&&(o.maxItems=d));const{minimum:p,maximum:h}=_e(e);typeof p=="number"&&(o.minItems=p),typeof h=="number"&&(o.maxItems=h)};function Xi(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);const h=e.get(t)?.def;if(!h)return t;const m=Xi(e,h,n);return m===h?t:m}for(const h of["anyOf","oneOf"]){const m=t[h];if(!Array.isArray(m))continue;const _=m.map(S=>Xi(e,S,n));_.some((S,w)=>S!==m[w])&&(t={...t,[h]:_})}const r=Array.isArray(t.type)?t.type:[t.type],o=!r.includes("string")&&r.some(h=>h==="number"||h==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!s?.some(h=>typeof h=="number"))return t;const{minimum:i,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(h=>typeof h=="number"?String(h):h):typeof p.const=="number"&&(p.const=String(p.const)),o&&(p.type="string",s||(p.pattern=(r.includes("number")?bn:La).source)),p}const ea=new WeakMap;function Zw(e){const t=new Map;for(const r of e.seen.values())r.def&&!t.has(r.schema)&&t.set(r.schema,r);const n=new Map;for(const r of ea.get(e)??[]){const o=e.seen.get(r),s=(o?.def??o?.schema)?.propertyNames;if(!s||s===!0||n.has(s))continue;const i=Xi(t,s,new Set);i!==s&&n.set(s,i)}if(n.size)for(const r of e.seen.values())for(const o of[r.schema,r.def]){const s=o&&n.get(o.propertyNames);s&&(o.propertyNames=s)}}const $g=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object";const i=s.keyType,a=_e(i).patterns;if(s.mode==="loose"&&a&&a.size>0){const l=ne(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const d of a)Fe(o.patternProperties,Wm(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=ne(s.keyType,t,{...r,path:[...r.path,"propertyNames"]});let l=ea.get(t);l||(l=[],ea.set(t,l),t.deferred.push(()=>Zw(t))),l.push(e)}o.additionalProperties=ne(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}const c=i._zod.values,u=t.io==="input"&&rr(s.valueType)!==void 0;if(c&&!s.partial&&!u){const l=[...c].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l.map(String))}},Sg=(e,t,n,r)=>{const o=e._zod.def,s=ne(o.innerType,t,r),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},xg=(e,t,n,r)=>{const o=e._zod.def;ne(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Vc=Symbol();function Ig(e,t,n,r,o){let s=!1;const i=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(s=!0,null));return s?(be(t,n,r,o,"BigInt defaults cannot be represented in JSON Schema"),Vc):JSON.parse(i)}const zg=(e,t,n,r)=>{const o=e._zod.def;ne(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;const i=Ig(o.defaultValue,e,t,n,r);i!==Vc&&(n.default=i)},Tg=(e,t,n,r)=>{const o=e._zod.def;ne(o.innerType,t,r);const s=t.seen.get(e);if(s.ref=o.innerType,t.io!=="input")return;const i=Ig(o.defaultValue,e,t,n,r);i!==Vc&&(n._prefault=i)},Cg=(e,t,n,r)=>{const o=e._zod.def;ne(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{be(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=i},Eg=(e,t,n,r)=>{const o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;ne(i,t,r);const a=t.seen.get(e);a.ref=i},Ag=(e,t,n,r)=>{const o=e._zod.def;ne(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},Ng=(e,t,n,r)=>{const o=e._zod.def;ne(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},qc=(e,t,n,r)=>{const o=e._zod.def;ne(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Og=(e,t,n,r)=>{const o=e._zod.innerType;ne(o,t,r);const s=t.seen.get(e);s.ref=o},ta={string:Gm,number:Ym,boolean:Qm,bigint:Xm,symbol:eg,null:tg,undefined:ng,void:rg,never:og,any:sg,unknown:ig,date:ag,enum:cg,literal:ug,nan:lg,template_literal:dg,file:fg,success:pg,custom:hg,function:mg,transform:gg,map:yg,set:_g,array:bg,object:wg,union:Uc,intersection:vg,tuple:kg,record:$g,nullable:Sg,nonoptional:xg,default:zg,prefault:Tg,catch:Cg,pipe:Eg,readonly:Ag,promise:Ng,optional:qc,lazy:Og};function Hc(e,t){if("_idmap"in e){const r=e,o=ln({...t,processors:ta}),s={};for(const c of r._idmap.entries()){const[u,l]=c;ne(l,o)}const i={},a={registry:r,uri:t?.uri,defs:s};o.external=a;for(const c of r._idmap.entries()){const[u,l]=c;dn(o,l),Fe(i,u,fn(o,l))}if(Object.keys(s).length>0){const c=o.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[c]:s}}return{schemas:i}}const n=ln({...t,processors:ta});return ne(e,n),dn(n,e),fn(n,e)}class jw{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=ln({processors:ta,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return ne(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,dn(this.ctx,t);const r=fn(this.ctx,t),{"~standard":o,...s}=r;return s}}const Fw=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Pg=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:yh,$ZodArray:kh,$ZodAsyncError:pt,$ZodBase64:sh,$ZodBase64URL:ih,$ZodBigInt:nc,$ZodBigIntFormat:ph,$ZodBoolean:tc,$ZodCIDRv4:rh,$ZodCIDRv6:oh,$ZodCUID:Hp,$ZodCUID2:Bp,$ZodCatch:qh,$ZodCheck:ue,$ZodCheckBigIntFormat:bp,$ZodCheckEndsWith:Ap,$ZodCheckGreaterThan:ja,$ZodCheckIncludes:Cp,$ZodCheckLengthEquals:xp,$ZodCheckLessThan:Za,$ZodCheckLowerCase:zp,$ZodCheckMaxLength:$p,$ZodCheckMaxSize:wp,$ZodCheckMimeType:Pp,$ZodCheckMinLength:Sp,$ZodCheckMinSize:vp,$ZodCheckMultipleOf:yp,$ZodCheckNumberFormat:_p,$ZodCheckOverwrite:Mp,$ZodCheckProperties:Op,$ZodCheckProperty:Np,$ZodCheckRegex:Ip,$ZodCheckSizeEquals:kp,$ZodCheckStartsWith:Ep,$ZodCheckStringFormat:br,$ZodCheckUpperCase:Tp,$ZodCodec:ac,$ZodCreditCard:ch,$ZodCustom:Yh,$ZodCustomStringFormat:dh,$ZodCyclicError:Qh,$ZodDate:vh,$ZodDefault:jh,$ZodDiscriminatedUnion:Ch,$ZodE164:ah,$ZodEmail:jp,$ZodEmoji:Vp,$ZodEncodeError:cs,$ZodEnum:Ph,$ZodError:Af,$ZodExactOptional:Dh,$ZodFile:Lh,$ZodFunction:Wh,$ZodGUID:Dp,$ZodIBAN:uh,$ZodIPv4:eh,$ZodIPv6:th,$ZodISODate:Yp,$ZodISODateTime:Gp,$ZodISODuration:Xp,$ZodISOTime:Qp,$ZodIntersection:Eh,$ZodJWT:lh,$ZodKSUID:Wp,$ZodLazy:cc,$ZodLiteral:Mh,$ZodMAC:nh,$ZodMap:Nh,$ZodNaN:Hh,$ZodNanoID:qp,$ZodNever:bh,$ZodNonOptional:Uh,$ZodNull:gh,$ZodNullable:Zh,$ZodNumber:ec,$ZodNumberFormat:fh,$ZodObject:xh,$ZodObjectJIT:Ih,$ZodOptional:sc,$ZodPipe:ic,$ZodPrefault:Fh,$ZodPreprocess:Bh,$ZodPromise:Gh,$ZodReadonly:Kh,$ZodRealError:Ue,$ZodRecord:Ah,$ZodRegistry:tm,$ZodSet:Oh,$ZodString:wr,$ZodStringFormat:re,$ZodSuccess:Vh,$ZodSymbol:hh,$ZodTemplateLiteral:Jh,$ZodTransform:Rh,$ZodTuple:oc,$ZodType:j,$ZodULID:Kp,$ZodURL:Up,$ZodUUID:Zp,$ZodUndefined:mh,$ZodUnion:_s,$ZodUnknown:_h,$ZodVoid:wh,$ZodXID:Jp,$ZodXor:zh,$brand:ka,$constructor:y,$input:pc,$output:fc,Doc:Fa,INVALID:Ae,JSONSchema:Fw,JSONSchemaGenerator:jw,NEVER:va,TimePrecision:Rc,URL_BAD_FORMAT:Va,URL_UNPARSEABLE:er,ZodCompileAsyncError:_t,ZodCompileUnsupportedError:G,_any:Im,_array:Om,_base64:Oc,_base64url:Pc,_bigint:bm,_boolean:ym,_catch:Cw,_check:Dm,_cidrv4:Ac,_cidrv6:Nc,_coercedBigint:wm,_coercedBoolean:_m,_coercedDate:Am,_coercedNumber:dm,_coercedString:im,_creditCard:cm,_cuid:Sc,_cuid2:xc,_custom:Mm,_date:Em,_decode:Ia,_decodeAsync:Ta,_default:Iw,_discriminatedUnion:hw,_e164:Mc,_email:gc,_emoji:kc,_encode:xa,_encodeAsync:za,_endsWith:Ir,_enum:ww,_file:Pm,_float32:pm,_float64:hm,_gt:wt,_gte:je,_guid:yc,_iban:um,_includes:Sr,_int:fm,_int32:mm,_int64:vm,_intersection:mw,_ipv4:Cc,_ipv6:Ec,_isoDate:Zc,_isoDateTime:Dc,_isoDuration:Fc,_isoTime:jc,_jwt:Lc,_ksuid:Tc,_lazy:Ow,_length:kn,_literal:kw,_lowercase:kr,_lt:bt,_lte:Ze,_mac:am,_map:_w,_max:Ze,_maxLength:vn,_maxSize:Jt,_mime:Tr,_min:je,_minLength:Nt,_minSize:vt,_multipleOf:qt,_nan:Nm,_nanoid:$c,_nativeEnum:vw,_negative:Is,_never:Tm,_nonnegative:Ts,_nonoptional:zw,_nonpositive:zs,_normalize:Cr,_null:xm,_nullable:xw,_number:lm,_optional:Sw,_overwrite:at,_parse:pr,_parseAsync:hr,_pipe:Ew,_positive:xs,_promise:Pw,_properties:zr,_property:Cs,_readonly:Aw,_record:yw,_refine:Lm,_regex:vr,_safeDecode:Ea,_safeDecodeAsync:Na,_safeEncode:Ca,_safeEncodeAsync:Aa,_safeParse:mr,_safeParseAsync:gr,_set:bw,_size:wn,_slugify:Or,_startsWith:xr,_string:sm,_stringFormat:$n,_stringbool:Fm,_success:Tw,_superRefine:Rm,_symbol:$m,_templateLiteral:Nw,_toLowerCase:Ar,_toUpperCase:Nr,_transform:$w,_trim:Er,_tuple:gw,_uint32:gm,_uint64:km,_ulid:Ic,_undefined:Sm,_union:fw,_unknown:zm,_uppercase:$r,_url:Ss,_uuid:_c,_uuidv4:bc,_uuidv6:wc,_uuidv7:vc,_void:Cm,_xid:zc,_xor:pw,base64Charset:Wa,base64urlCharset:ys,canParseURL:qa,clone:ce,compile:hc,compileFn:ks,config:ye,createStandardJSONSchemaMethod:nr,createToJSONSchemaMethod:qm,decode:S_,decodeAsync:I_,describe:Zm,encode:$_,encodeAsync:x_,extractDefs:dn,finalize:fn,flattenError:us,formatError:ls,getDiscriminatedOption:rc,globalConfig:Ee,globalRegistry:Re,handleUnrepresentable:be,initializeContext:ln,isBackEdge:lc,isRecursiveSchema:uc,isValidBase64:gs,isValidBase64URL:Ga,isValidCIDRv6:Ja,isValidCreditCard:Ya,isValidIBAN:Qa,isValidIPv6:ms,isValidJWT:Xa,locales:dc,memoizer:bs,mergeValues:tr,meta:jm,parse:Hi,parseAsync:Bi,parseURLObject:Fp,prettifyError:Sa,process:ne,processSchema:ne,regexes:hs,registry:ws,safeDecode:T_,safeDecodeAsync:E_,safeEncode:z_,safeEncodeAsync:C_,safeParse:Of,safeParseAsync:b_,standardProps:Ua,stripTabAndNewline:Wo,toDotPath:Nf,toJSONSchema:Hc,toZod:ns,treeifyError:$a,urlHostnameOk:Ba,urlProtocolOk:Ka,util:wa,validate:fs,validateAsync:ps,validateURL:Ha,version:Lp,withParser:vs},Symbol.toStringTag,{value:"Module"})),Id=Symbol("z.visit/resolving");function Bc(e,t){const n=typeof t=="function"?t:(i,a)=>{const c=t[i._zod.def.type];return c?c(i,a):i},r=new Map;function o(i){const a=r.get(i);if(a===Id)return new cc({type:"lazy",getter:()=>r.get(i)});if(a!==void 0)return a;r.set(i,Id);const c=s(i),u=n(c,c!==i);return r.set(i,u),u}function s(i){const a=i._zod.def;switch(a.type){case"object":{const u=a.shape,l=Object.keys(u);let d=!1;const f={};for(const h of l){const m=o(u[h]);m!==u[h]&&(d=!0),f[h]=m}let p=a.catchall;return a.catchall&&(p=o(a.catchall),p!==a.catchall&&(d=!0)),d?ce(i,{...a,shape:f,catchall:p}):i}case"array":{const u=o(a.element);return u===a.element?i:ce(i,{...a,element:u})}case"tuple":{const u=a.items;let l=!1;const d=[];for(const p of u){const h=o(p);h!==p&&(l=!0),d.push(h)}let f=a.rest;return a.rest&&(f=o(a.rest),f!==a.rest&&(l=!0)),l?ce(i,{...a,items:d,rest:f}):i}case"record":case"map":{const u=o(a.keyType),l=o(a.valueType);return u===a.keyType&&l===a.valueType?i:ce(i,{...a,keyType:u,valueType:l})}case"set":{const u=o(a.valueType);return u===a.valueType?i:ce(i,{...a,valueType:u})}case"union":{const u=a.options;let l=!1;const d=[];for(const f of u){const p=o(f);p!==f&&(l=!0),d.push(p)}return l?ce(i,{...a,options:d}):i}case"intersection":{const u=o(a.left),l=o(a.right);return u===a.left&&l===a.right?i:ce(i,{...a,left:u,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{const u=o(a.innerType);return u===a.innerType?i:ce(i,{...a,innerType:u})}case"pipe":{const u=o(a.in),l=o(a.out);return u===a.in&&l===a.out?i:ce(i,{...a,in:u,out:l})}case"function":{const u=o(a.input),l=o(a.output);return u===a.input&&l===a.output?i:ce(i,{...a,input:u,output:l})}case"lazy":{const u=a.getter,{_cachedInner:l,...d}=a;return ce(i,{...d,getter:()=>o(u())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return i;default:return i}}return o(e)}function Kc(e){return!!e._zod}function Mg(e,t){return Kc(e)?Of(e,t):e.safeParse(t)}function Uw(e){if(!e)return;let t;if(Kc(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Vw(e){if(Kc(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 n=e._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}const r=e.value;if(r!==void 0)return r}const qw=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(s){return e[s]??null}const n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function o(s,i){return s==="number"&&typeof i=="number"&&!Number.isFinite(i)?String(i):r[s]??s}return s=>{switch(s.code){case"invalid_type":{const i=o(s.expected),a=xf(s.input),c=o(a,s.input);return`Invalid input: expected ${i}, received ${c}`}case"invalid_value":return s.values.length===1?`Invalid input: expected ${ma(s.values[0])}`:`Invalid option: expected one of ${Ui(s.values,"|")}`;case"too_big":{const i=s.exact?"exactly ":s.inclusive?"<=":"<",a=t(s.origin);return a?`Too big: expected ${s.origin??"value"} to have ${i}${s.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${s.origin??"value"} to be ${i}${s.maximum.toString()}`}case"too_small":{const i=s.exact?"exactly ":s.inclusive?">=":">",a=t(s.origin);return a?`Too small: expected ${s.origin} to have ${i}${s.minimum.toString()} ${a.unit}`:`Too small: expected ${s.origin} to be ${i}${s.minimum.toString()}`}case"invalid_format":{const i=s;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${n[i.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${Ui(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":return s.options&&Array.isArray(s.options)&&s.options.length>0?`Invalid discriminator value. Expected ${s.options.map(a=>`'${a}'`).join(" | ")}`:s.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function Hw(){return{localeError:qw()}}const Bw=Object.freeze(Object.defineProperty({__proto__:null,endsWith:Ir,gt:wt,gte:je,includes:Sr,length:kn,lowercase:kr,lt:bt,lte:Ze,maxLength:vn,maxSize:Jt,mime:Tr,minLength:Nt,minSize:vt,multipleOf:qt,negative:Is,nonnegative:Ts,nonpositive:zs,normalize:Cr,overwrite:at,positive:xs,properties:zr,property:Cs,regex:vr,size:wn,slugify:Or,startsWith:xr,toLowerCase:Ar,toUpperCase:Nr,trim:Er,uppercase:$r},Symbol.toStringTag,{value:"Module"})),zd=new WeakSet([Object.prototype,Error.prototype]);function Oo(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){const r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}const Lg=(e,t)=>{Af.init(e,t),e.name="ZodError";const n=Object.getPrototypeOf(e);zd.has(n)||(zd.add(n),Oo(n,"format",r=>o=>ls(r,o)),Oo(n,"flatten",r=>o=>us(r,o)),Oo(n,"addIssue",r=>o=>{r.issues.push(o),r.message=JSON.stringify(r.issues,Ho,2)}),Oo(n,"addIssues",r=>o=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,Ho,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},Rg=y("ZodError",Lg),Oe=y("ZodError",Lg,void 0,{Parent:Error}),Jc=pr(Oe),Wc=hr(Oe),Gc=mr(Oe),Yc=gr(Oe),Qc=xa(Oe),Xc=Ia(Oe),eu=za(Oe),tu=Ta(Oe),nu=Ca(Oe),ru=Ea(Oe),ou=Aa(Oe),su=Na(Oe);function Kw(){Ee.localeError||ye(Hw())}function Wt(){Ee.memoizer||ye({memoizer:bs()})}const V=y("ZodType",(e,t)=>(Kw(),j.init(e,t),e.def=t,e.type=t.type,e),{check(...e){const t=this.def;return this.clone(xe(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ce(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(yi(e,t))},superRefine(e,t){return this.check(_i(e,t))},overwrite(e){return this.check(at(e))},optional(){return se(this)},exactOptional(){return Ys(this)},nullable(){return gn(this)},nullish(){return se(gn(this))},nonoptional(e){return ri(this,e)},array(){return D(this)},or(e){return H([this,e])},and(e){return Mn(this,e)},transform(e){return sr(this,ro(e))},default(e){return ei(this,e)},prefault(e){return ni(this,e)},catch(e){return ii(this,e)},pipe(e){return sr(this,e)},readonly(){return li(this)},describe(e){const t=this.clone();return Re.add(t,{description:e}),t},meta(...e){if(e.length===0)return Re.get(this);const t=this.clone();return Re.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return as(this,"~standard",{...Ua(this),jsonSchema:{input:nr(this,"input"),output:nr(this,"output")}})},set"~standard"(e){yt(this,"~standard",e)},parse:function e(t,n){return Jc(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Wc(this,t,n,{callee:e})},safeParse(e,t){return Gc(this,e,t)},async safeParseAsync(e,t){return Yc(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){yt(this,"spa",e)},validate(e,t){return fs(this,e,t)},validateAsync(e,t){return ps(this,e,t)},encode:function e(t,n){return Qc(this,t,n,{callee:e})},decode:function e(t,n){return Xc(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await eu(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await tu(this,t,n,{callee:e})},safeEncode(e,t){return nu(this,e,t)},safeDecode(e,t){return ru(this,e,t)},async safeEncodeAsync(e,t){return ou(this,e,t)},async safeDecodeAsync(e,t){return su(this,e,t)},toJSONSchema(e){return qm(this,{})(e)},get description(){return Re.get(this)?.description},get _def(){return this._zod.def}}),Pr=y("_ZodString",(e,t)=>{wr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gm(e,n,r)},fr({format:e=>_e(e).format??null,minLength:e=>_e(e).minimum??null,maxLength:e=>_e(e).maximum??null},{regex(...e){return this.check(vr(...e))},includes(...e){return this.check(Sr(...e))},startsWith(...e){return this.check(xr(...e))},endsWith(...e){return this.check(Ir(...e))},min(...e){return this.check(Nt(...e))},max(...e){return this.check(vn(...e))},length(...e){return this.check(kn(...e))},nonempty(...e){return this.check(Nt(1,...e))},lowercase(e){return this.check(kr(e))},uppercase(e){return this.check($r(e))},trim(){return this.check(Er())},normalize(...e){return this.check(Cr(...e))},toLowerCase(){return this.check(Ar())},toUpperCase(){return this.check(Nr())},slugify(){return this.check(Or())}})),Sn=y("ZodString",(e,t)=>{wr.init(e,t),Pr.init(e,t)},{email(e){return this.check(gc(Mr,e))},url(e){return this.check(Ss(Cn,e))},jwt(e){return this.check(Lc(Yr,e))},emoji(e){return this.check(kc(Rr,e))},guid(e){return this.check(yc(Lr,e))},uuid(e){return this.check(_c(tt,e))},uuidv4(e){return this.check(bc(tt,e))},uuidv6(e){return this.check(wc(tt,e))},uuidv7(e){return this.check(vc(tt,e))},nanoid(e){return this.check($c(Dr,e))},cuid(e){return this.check(Sc(Zr,e))},cuid2(e){return this.check(xc(jr,e))},ulid(e){return this.check(Ic(Fr,e))},base64(e){return this.check(Oc(Jr,e))},base64url(e){return this.check(Pc(Wr,e))},xid(e){return this.check(zc(Ur,e))},ksuid(e){return this.check(Tc(Vr,e))},ipv4(e){return this.check(Cc(qr,e))},ipv6(e){return this.check(Ec(Hr,e))},cidrv4(e){return this.check(Ac(Br,e))},cidrv6(e){return this.check(Nc(Kr,e))},e164(e){return this.check(Mc(Gr,e))},datetime(e){return this.check(Dc(xn,e))},date(e){return this.check(Zc(In,e))},time(e){return this.check(jc(zn,e))},duration(e){return this.check(Fc(Tn,e))}});function b(e){return sm(Sn,e)}const ee=y("ZodStringFormat",(e,t)=>{re.init(e,t),Pr.init(e,t)}),xn=y("ZodISODateTime",(e,t)=>{Gp.init(e,t),ee.init(e,t)}),In=y("ZodISODate",(e,t)=>{Yp.init(e,t),ee.init(e,t)}),zn=y("ZodISOTime",(e,t)=>{Qp.init(e,t),ee.init(e,t)}),Tn=y("ZodISODuration",(e,t)=>{Xp.init(e,t),ee.init(e,t)}),Mr=y("ZodEmail",(e,t)=>{jp.init(e,t),ee.init(e,t)});function iu(e){return gc(Mr,e)}const Lr=y("ZodGUID",(e,t)=>{Dp.init(e,t),ee.init(e,t)});function au(e){return yc(Lr,e)}const tt=y("ZodUUID",(e,t)=>{Zp.init(e,t),ee.init(e,t)});function cu(e){return _c(tt,e)}function uu(e){return bc(tt,e)}function lu(e){return wc(tt,e)}function du(e){return vc(tt,e)}const Cn=y("ZodURL",(e,t)=>{Up.init(e,t),ee.init(e,t)});function fu(e){return Ss(Cn,e)}function pu(e){return Ss(Cn,{protocol:Oa,hostname:tp,...I(e)})}const Rr=y("ZodEmoji",(e,t)=>{Vp.init(e,t),ee.init(e,t)});function hu(e){return kc(Rr,e)}const Dr=y("ZodNanoID",(e,t)=>{qp.init(e,t),ee.init(e,t)});function mu(e){return $c(Dr,e)}const Zr=y("ZodCUID",(e,t)=>{Hp.init(e,t),ee.init(e,t)});function gu(e){return Sc(Zr,e)}const jr=y("ZodCUID2",(e,t)=>{Bp.init(e,t),ee.init(e,t)});function yu(e){return xc(jr,e)}const Fr=y("ZodULID",(e,t)=>{Kp.init(e,t),ee.init(e,t)});function _u(e){return Ic(Fr,e)}const Ur=y("ZodXID",(e,t)=>{Jp.init(e,t),ee.init(e,t)});function bu(e){return zc(Ur,e)}const Vr=y("ZodKSUID",(e,t)=>{Wp.init(e,t),ee.init(e,t)});function wu(e){return Tc(Vr,e)}const qr=y("ZodIPv4",(e,t)=>{eh.init(e,t),ee.init(e,t)});function vu(e){return Cc(qr,e)}const Es=y("ZodMAC",(e,t)=>{nh.init(e,t),ee.init(e,t)});function ku(e){return am(Es,e)}const Hr=y("ZodIPv6",(e,t)=>{th.init(e,t),ee.init(e,t)});function $u(e){return Ec(Hr,e)}const Br=y("ZodCIDRv4",(e,t)=>{rh.init(e,t),ee.init(e,t)});function Su(e){return Ac(Br,e)}const Kr=y("ZodCIDRv6",(e,t)=>{oh.init(e,t),ee.init(e,t)});function xu(e){return Nc(Kr,e)}const Jr=y("ZodBase64",(e,t)=>{sh.init(e,t),ee.init(e,t)});function Iu(e){return Oc(Jr,e)}const Wr=y("ZodBase64URL",(e,t)=>{ih.init(e,t),ee.init(e,t)});function zu(e){return Pc(Wr,e)}const Gr=y("ZodE164",(e,t)=>{ah.init(e,t),ee.init(e,t)});function Tu(e){return Mc(Gr,e)}const As=y("ZodCreditCard",(e,t)=>{ch.init(e,t),ee.init(e,t)});function Cu(e){return cm(As,e)}const Ns=y("ZodIBAN",(e,t)=>{uh.init(e,t),ee.init(e,t)});function Eu(e){return um(Ns,e)}const Yr=y("ZodJWT",(e,t)=>{lh.init(e,t),ee.init(e,t)});function Au(e){return Lc(Yr,e)}const Ot=y("ZodCustomStringFormat",(e,t)=>{dh.init(e,t),ee.init(e,t)});function Nu(e,t,n={}){return $n(Ot,e,t,n)}function Ou(e){return $n(Ot,"hostname",ep,e)}function Pu(e){return $n(Ot,"hex",gp,e)}function Mu(e){return $n(Ot,"currency_code",rp,e)}function Lu(e,t){const n=t?.enc??"hex",r=`${e}_${n}`,o=hs[r];if(!o)throw new Error(`Unrecognized hash format: ${r}`);return $n(Ot,r,o,t)}const En=y("ZodNumber",(e,t)=>{ec.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ym(e,n,r,o),e.isFinite=!0},fr({minValue:e=>{const{minimum:t,exclusiveMinimum:n}=_e(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{const{maximum:t,exclusiveMaximum:n}=_e(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{const{isInt:t,multipleOf:n}=_e(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>_e(e).format??null},{gt(e,t){return this.check(wt(e,t))},gte(e,t){return this.check(je(e,t))},min(e,t){return this.check(je(e,t))},lt(e,t){return this.check(bt(e,t))},lte(e,t){return this.check(Ze(e,t))},max(e,t){return this.check(Ze(e,t))},int(e){return this.check(or(e))},safe(e){return this.check(or(e))},positive(e){return this.check(wt(0,e))},nonnegative(e){return this.check(je(0,e))},negative(e){return this.check(bt(0,e))},nonpositive(e){return this.check(Ze(0,e))},multipleOf(e,t){return this.check(qt(e,t))},step(e,t){return this.check(qt(e,t))},finite(){return this}}));function U(e){return lm(En,e)}const Pt=y("ZodNumberFormat",(e,t)=>{fh.init(e,t),En.init(e,t)});function or(e){return fm(Pt,e)}function Ru(e){return pm(Pt,e)}function Du(e){return hm(Pt,e)}function Zu(e){return mm(Pt,e)}function ju(e){return gm(Pt,e)}const An=y("ZodBoolean",(e,t)=>{tc.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qm(e,n,r)});function X(e){return ym(An,e)}const Nn=y("ZodBigInt",(e,t)=>{nc.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xm(e,n,r,o)},fr({minValue:e=>_e(e).minimum??null,maxValue:e=>_e(e).maximum??null,format:e=>_e(e).format??null},{gte(e,t){return this.check(je(e,t))},min(e,t){return this.check(je(e,t))},gt(e,t){return this.check(wt(e,t))},lt(e,t){return this.check(bt(e,t))},lte(e,t){return this.check(Ze(e,t))},max(e,t){return this.check(Ze(e,t))},positive(e){return this.check(wt(BigInt(0),e))},negative(e){return this.check(bt(BigInt(0),e))},nonpositive(e){return this.check(Ze(BigInt(0),e))},nonnegative(e){return this.check(je(BigInt(0),e))},multipleOf(e,t){return this.check(qt(e,t))}}));function Fu(e){return bm(Nn,e)}const Qr=y("ZodBigIntFormat",(e,t)=>{ph.init(e,t),Nn.init(e,t)});function Uu(e){return vm(Qr,e)}function Vu(e){return km(Qr,e)}const Os=y("ZodSymbol",(e,t)=>{hh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>eg(e,n,r,o)});function qu(e){return $m(Os,e)}const Ps=y("ZodUndefined",(e,t)=>{mh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ng(e,n,r,o)});function mn(e){return Sm(Ps,e)}const Ms=y("ZodNull",(e,t)=>{gh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tg(e,n,r)});function Xr(e){return xm(Ms,e)}const Ls=y("ZodAny",(e,t)=>{yh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>sg()});function eo(){return Im(Ls)}const Rs=y("ZodUnknown",(e,t)=>{_h.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ig()});function Q(){return zm(Rs)}const Ds=y("ZodNever",(e,t)=>{bh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>og(e,n,r)});function Ht(e){return Tm(Ds,e)}const Zs=y("ZodVoid",(e,t)=>{wh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>rg(e,n,r,o)});function Hu(e){return Cm(Zs,e)}const to=y("ZodDate",(e,t)=>{vh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ag(e,n,r,o),e.min=(n,r)=>e.check(je(n,r)),e.max=(n,r)=>e.check(Ze(n,r))},fr({minDate:e=>{const{minimum:t}=_e(e);return t?new Date(t):null},maxDate:e=>{const{maximum:t}=_e(e);return t?new Date(t):null}},{}));function Bu(e){return Em(to,e)}const js=y("ZodArray",(e,t)=>{Wt(),kh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bg(e,n,r,o),e.element=t.element},{min(e,t){return this.check(Nt(e,t))},nonempty(e){return this.check(Nt(1,e))},max(e,t){return this.check(vn(e,t))},length(e,t){return this.check(kn(e,t))},unwrap(){return this.element}});function D(e,t){return Om(js,e,t)}function Ku(e){const t=e._zod.def.shape;return ve(Object.keys(t))}const On=y("ZodObject",(e,t)=>{Wt(),Ih.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wg(e,n,r,o),Cf(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return ve(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(xe(this._zod.def,{catchall:e}))},passthrough(){return this.clone(xe(this._zod.def,{catchall:Q()}))},loose(){return this.clone(xe(this._zod.def,{catchall:Q()}))},strict(){return this.clone(xe(this._zod.def,{catchall:Ht()}))},strip(){return this.clone(xe(this._zod.def,{catchall:void 0}))},extend(e){return bf(this,e)},safeExtend(e){return vf(this,e)},merge(e){return kf(this,e)},pick(e){return yf(this,e)},omit(e){return _f(this,e)},partial(...e){return Vi(Ln,this,e[0])},exactPartial(...e){return Vi(oo,this,e[0],"exactPartial")},required(...e){return $f(so,this,e[0])}});function k(e,t){const n={type:"object",shape:e??{},...I(t)};return new On(n)}function Ju(e,t){return new On({type:"object",shape:e,catchall:Ht(),...I(t)})}function we(e,t){return new On({type:"object",shape:e,catchall:Q(),...I(t)})}const Pn=y("ZodUnion",(e,t)=>{_s.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Uc(e,n,r,o),e.options=t.options});function H(e,t){return new Pn({type:"union",options:e,...I(t)})}const Fs=y("ZodXor",(e,t)=>{Pn.init(e,t),zh.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Uc(e,n,r,o),e.options=t.options});function Wu(e,t){return new Fs({type:"union",options:e,inclusive:!1,...I(t)})}const Us=y("ZodDiscriminatedUnion",(e,t)=>{Pn.init(e,t),Ch.init(e,t)});function no(e,t,n){return new Us({type:"union",options:t,discriminator:e,...I(n)})}const Vs=y("ZodIntersection",(e,t)=>{Eh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vg(e,n,r,o)});function Mn(e,t){return new Vs({type:"intersection",left:e,right:t})}const qs=y("ZodTuple",(e,t)=>{Wt(),oc.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kg(e,n,r,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){const e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new Ln({type:"optional",innerType:t}))})}});function Hs(e,t,n){const r=t instanceof j,o=r?n:t,s=r?t:null;return new qs({type:"tuple",items:e,rest:s,...I(o)})}const Bt=y("ZodRecord",(e,t)=>{Wt(),Ah.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$g(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function J(e,t,n){return!t||!t._zod?new Bt({type:"record",keyType:b(),valueType:e,...I(t)}):new Bt({type:"record",keyType:e,valueType:t,...I(n)})}function Gu(e,t,n){return new Bt({type:"record",keyType:e,valueType:t,...I(n),partial:!0})}function Yu(e,t,n){return new Bt({type:"record",keyType:e,valueType:t,mode:"loose",...I(n)})}const Bs=y("ZodMap",(e,t)=>{Wt(),Nh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yg(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(vt(...n)),e.nonempty=n=>e.check(vt(1,n)),e.max=(...n)=>e.check(Jt(...n)),e.size=(...n)=>e.check(wn(...n))});function Qu(e,t,n){return new Bs({type:"map",keyType:e,valueType:t,...I(n)})}const Ks=y("ZodSet",(e,t)=>{Wt(),Oh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_g(e,n,r,o),e.min=(...n)=>e.check(vt(...n)),e.nonempty=n=>e.check(vt(1,n)),e.max=(...n)=>e.check(Jt(...n)),e.size=(...n)=>e.check(wn(...n))});function Xu(e,t){return new Ks({type:"set",valueType:e,...I(t)})}const Kt=y("ZodEnum",(e,t)=>{Ph.init(e,t),V.init(e,t),e._zod.processJSONSchema=(r,o,s)=>cg(e,r,o),e.enum=t.entries,e.options=[...e._zod.values];const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const i of r)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Kt({...t,checks:[],...I(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Kt({...t,checks:[],...I(o),entries:s})}});function ve(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Kt({type:"enum",entries:n,...I(t)})}function el(e,t){return new Kt({type:"enum",entries:e,...I(t)})}const Js=y("ZodLiteral",(e,t)=>{Mh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ug(e,n,r,o),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 v(e,t){return new Js({type:"literal",values:Array.isArray(e)?e:[e],...I(t)})}const Ws=y("ZodFile",(e,t)=>{Lh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fg(e,n,r),e.min=(n,r)=>e.check(vt(n,r)),e.max=(n,r)=>e.check(Jt(n,r)),e.mime=(n,r)=>e.check(Tr(Array.isArray(n)?n:[n],r))});function tl(e){return Pm(Ws,e)}const Gs=y("ZodTransform",(e,t)=>{Wt(),Rh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gg(e,n,r,o),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new cs(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(cn(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=n.value),i.inst??(i.inst=e),n.issues.push(cn(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function ro(e){return new Gs({type:"transform",transform:e})}const Ln=y("ZodOptional",(e,t)=>{sc.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function se(e){return new Ln({type:"optional",innerType:e})}const oo=y("ZodExactOptional",(e,t)=>{Dh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ys(e){return new oo({type:"optional",innerType:e})}const Qs=y("ZodNullable",(e,t)=>{Zh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sg(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function gn(e){return new Qs({type:"nullable",innerType:e})}function nl(e){return se(gn(e))}const Xs=y("ZodDefault",(e,t)=>{jh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zg(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ei(e,t){return new Xs({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():lr(t)}})}const ti=y("ZodPrefault",(e,t)=>{Fh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Tg(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ni(e,t){return new ti({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():lr(t)}})}const so=y("ZodNonOptional",(e,t)=>{Uh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xg(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ri(e,t){return new so({type:"nonoptional",innerType:e,...I(t)})}const oi=y("ZodSuccess",(e,t)=>{Vh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>pg(e,n,r),e.unwrap=()=>e._zod.def.innerType});function rl(e){return new oi({type:"success",innerType:e})}const si=y("ZodCatch",(e,t)=>{qh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cg(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ii(e,t){return new si({type:"catch",innerType:e,catchValue:typeof t=="function"?t:ba(t)})}const ai=y("ZodNaN",(e,t)=>{Hh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lg(e,n,r,o)});function ol(e){return Nm(ai,e)}const Rn=y("ZodPipe",(e,t)=>{ic.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Eg(e,n,r,o),e.in=t.in,e.out=t.out});function sr(e,t){return new Rn({type:"pipe",in:e,out:t})}const Dn=y("ZodCodec",(e,t)=>{Rn.init(e,t),ac.init(e,t)});function sl(e,t,n){return new Dn({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function il(e){const t=e._zod.def;return new Dn({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}const ci=y("ZodPreprocess",(e,t)=>{Rn.init(e,t),Bh.init(e,t)}),ui=y("ZodReadonly",(e,t)=>{Kh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ag(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function li(e){return new ui({type:"readonly",innerType:e})}const di=y("ZodTemplateLiteral",(e,t)=>{Jh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>dg(e,n,r)});function al(e,t){return new di({type:"template_literal",parts:e,...I(t)})}const fi=y("ZodLazy",(e,t)=>{cc.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Og(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function pi(e){return new fi({type:"lazy",getter:e})}const hi=y("ZodPromise",(e,t)=>{Gh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ng(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function cl(e){return new hi({type:"promise",innerType:e})}const mi=y("ZodFunction",(e,t)=>{Wh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mg(e,n,r,o)});function yn(e){return new mi({type:"function",input:Array.isArray(e?.input)?Hs(e?.input):e?.input??D(Q()),output:e?.output??Q()})}const Zn=y("ZodCustom",(e,t)=>{Yh.init(e,t),V.init(e,t),e._zod.processJSONSchema=(n,r,o)=>hg(e,n,r,o)});function ul(e){const t=new ue({check:"custom"});return t._zod.check=e,t}function gi(e,t){return Mm(Zn,e??(()=>!0),t)}function yi(e,t={}){return Lm(Zn,e,t)}function _i(e,t){return Rm(e,t)}const ll=Zm,dl=jm,bi=y("ZodInstanceOf",(e,t)=>{Zn.init(e,t)},{properties(e,t){return this.check(zr(e,t))}});function fl(e,t={}){const n=new bi({type:"custom",check:"custom",fn:r=>r instanceof e,abort:!0,...I(t)});return n._zod.bag.Class=e,n._zod.check=r=>{r.value instanceof e||r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:n,path:[...n._zod.def.path??[]]})},n}const pl=(...e)=>Fm({Codec:Dn,Boolean:An,String:Sn},...e);function hl(e){const t=pi(()=>H([b(e),U(),X(),Xr(),D(t),J(b(),t)]));return t}function io(e,t){return new ci({type:"pipe",in:ro(e),out:t})}const Jw=Object.freeze(Object.defineProperty({__proto__:null,ZodAny:Ls,ZodArray:js,ZodBase64:Jr,ZodBase64URL:Wr,ZodBigInt:Nn,ZodBigIntFormat:Qr,ZodBoolean:An,ZodCIDRv4:Br,ZodCIDRv6:Kr,ZodCUID:Zr,ZodCUID2:jr,ZodCatch:si,ZodCodec:Dn,ZodCreditCard:As,ZodCustom:Zn,ZodCustomStringFormat:Ot,ZodDate:to,ZodDefault:Xs,ZodDiscriminatedUnion:Us,ZodE164:Gr,ZodEmail:Mr,ZodEmoji:Rr,ZodEnum:Kt,ZodExactOptional:oo,ZodFile:Ws,ZodFunction:mi,ZodGUID:Lr,ZodIBAN:Ns,ZodIPv4:qr,ZodIPv6:Hr,ZodISODate:In,ZodISODateTime:xn,ZodISODuration:Tn,ZodISOTime:zn,ZodInstanceOf:bi,ZodIntersection:Vs,ZodJWT:Yr,ZodKSUID:Vr,ZodLazy:fi,ZodLiteral:Js,ZodMAC:Es,ZodMap:Bs,ZodNaN:ai,ZodNanoID:Dr,ZodNever:Ds,ZodNonOptional:so,ZodNull:Ms,ZodNullable:Qs,ZodNumber:En,ZodNumberFormat:Pt,ZodObject:On,ZodOptional:Ln,ZodPipe:Rn,ZodPrefault:ti,ZodPreprocess:ci,ZodPromise:hi,ZodReadonly:ui,ZodRecord:Bt,ZodSet:Ks,ZodString:Sn,ZodStringFormat:ee,ZodSuccess:oi,ZodSymbol:Os,ZodTemplateLiteral:di,ZodTransform:Gs,ZodTuple:qs,ZodType:V,ZodULID:Fr,ZodURL:Cn,ZodUUID:tt,ZodUndefined:Ps,ZodUnion:Pn,ZodUnknown:Rs,ZodVoid:Zs,ZodXID:Ur,ZodXor:Fs,_ZodString:Pr,_default:ei,_function:yn,any:eo,array:D,base64:Iu,base64url:zu,bigint:Fu,boolean:X,catch:ii,check:ul,cidrv4:Su,cidrv6:xu,codec:sl,creditCard:Cu,cuid:gu,cuid2:yu,currencyCode:Mu,custom:gi,date:Bu,describe:ll,discriminatedUnion:no,e164:Tu,email:iu,emoji:hu,enum:ve,exactOptional:Ys,file:tl,float32:Ru,float64:Du,function:yn,guid:au,hash:Lu,hex:Pu,hostname:Ou,httpUrl:pu,iban:Eu,instanceof:fl,int:or,int32:Zu,int64:Uu,intersection:Mn,invertCodec:il,ipv4:vu,ipv6:$u,json:hl,jwt:Au,keyof:Ku,ksuid:wu,lazy:pi,literal:v,looseObject:we,looseRecord:Yu,mac:ku,map:Qu,meta:dl,nan:ol,nanoid:mu,nativeEnum:el,never:Ht,nonoptional:ri,null:Xr,nullable:gn,nullish:nl,number:U,object:k,optional:se,partialRecord:Gu,pipe:sr,prefault:ni,preprocess:io,promise:cl,readonly:li,record:J,refine:yi,set:Xu,strictObject:Ju,string:b,stringFormat:Nu,stringbool:pl,success:rl,superRefine:_i,symbol:qu,templateLiteral:al,transform:ro,tuple:Hs,uint32:ju,uint64:Vu,ulid:_u,undefined:mn,union:H,unknown:Q,url:fu,uuid:cu,uuidv4:uu,uuidv6:lu,uuidv7:du,void:Hu,xid:bu,xor:Wu},Symbol.toStringTag,{value:"Module"})),Dg={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function Zg(e){ye({customError:e})}function jg(){return ye().customError}var Yo;Yo||(Yo={});function Fg(e){return Dc(xn,e)}function Ww(e){return Zc(In,e)}function Gw(e){return jc(zn,e)}function Yw(e){return Fc(Tn,e)}const ml=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:In,ZodISODateTime:xn,ZodISODuration:Tn,ZodISOTime:zn,date:Ww,datetime:Fg,duration:Yw,time:Gw},Symbol.toStringTag,{value:"Module"})),A={...Jw,...Bw,iso:ml},Qw=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function Xw(e,t){const n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function Td(e,t){return e.map((n,r)=>r<t?n:n.optional())}function ev(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function tv(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");const n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;const r=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===r){const o=n[1]===void 0?void 0:ev(n[1]);if(!o||!t.defs[o])throw new Error(`Reference not found: ${e}`);return t.defs[o]}throw new Error(`Reference not found: ${e}`)}function nv(e,t){return A.transform(r=>r).check(r=>{const o=r.value;if(typeof o!="object"||o===null||Array.isArray(o))return;const s=Object.getOwnPropertyNames(o);if(t.minProperties!==void 0&&s.length<t.minProperties&&r.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:o,inst:e,continue:!0}),t.maxProperties!==void 0&&s.length>t.maxProperties&&r.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:o,inst:e,continue:!0}),t.keySchema)for(const i of s){const a=t.keySchema.safeParse(i);a.success||r.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:i,path:[i],continue:!0})}}).pipe(e)}function na(e,t){if(e===null)return"z";const n=typeof e;if(n!=="object"){if(n==="number"&&Number.isNaN(e))return null;const r=String(e);return`${n[0]}${r.length}:${r}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){const s=[];for(const i of e){const a=na(i,t);if(a===null)return null;s.push(a)}return`a${s.length}:[${s.join(",")}]`}const r=Object.keys(e).sort(),o=[];for(const s of r){const i=na(e[s],t);if(i===null)return null;o.push(`${s.length}:${s}=${i}`)}return`o${o.length}:{${o.join(",")}}`}finally{t.delete(e)}}const rv=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),ov=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function Xn(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(Xn):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,n])=>rv.has(t)?Xn(n):!ov.has(t)||typeof n!="object"||n===null?!1:Object.values(n).some(Xn))}function Cd(e){return e===1?"element":"elements"}function sv(e,t){return A.transform(r=>r).check(r=>{const o=r.value;if(Array.isArray(o)){if(t.uniqueItems===!0){const s=new Map;for(let i=0;i<o.length;i++){const a=na(o[i],new Set);if(a===null)continue;const c=s.get(a);if(c===void 0){s.set(a,i);continue}r.issues.push({code:"custom",message:`Array items must be unique: element at index ${i} duplicates the one at index ${c}`,input:o,path:[i],continue:!0})}}if(t.containsSchema){const s=t.minContains??1,i=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY;let a=0;for(const c of o)if(t.containsSchema.safeParse(c).success&&++a>=i)break;a<s&&r.issues.push({code:"custom",message:`Array must contain at least ${s} matching ${Cd(s)}; found ${a}`,input:o,continue:!0}),t.maxContains!==void 0&&a>t.maxContains&&r.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${Cd(t.maxContains)}`,input:o,continue:!0})}}}).pipe(e)}function Ed(e,t){if(e!==!1)return e===void 0||e===!0?A.any():Ce(e,t)}const iv=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Ug(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return A.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){const o=e.$ref;if(t.refs.has(o))return t.refs.get(o);if(t.processing.has(o))return A.lazy(()=>{if(!t.refs.has(o))throw new Error(`Circular reference not resolved: ${o}`);return t.refs.get(o)});t.processing.add(o);const s=tv(o,t),i=Ce(s,t);return t.refs.set(o,i),t.processing.delete(o),i}if(e.enum!==void 0){const o=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&o.length===1&&o[0]===null)return A.null();if(o.length===0)return A.never();if(o.length===1)return A.literal(o[0]);if(o.every(i=>typeof i=="string"))return A.enum(o);const s=o.map(i=>A.literal(i));return s.length<2?s[0]:A.union([s[0],s[1],...s.slice(2)])}if(e.const!==void 0)return A.literal(e.const);const n=e.type;if(Array.isArray(n)){const o=n.map(s=>{const i={...e,type:s};return Ug(i,t)});return o.length===0?A.never():o.length===1?o[0]:A.union(o)}if(!n)return A.any();let r;switch(n){case"string":{let o=A.string();if(e.format){const s=e.format;s==="email"?o=o.check(A.email()):s==="uri"||s==="uri-reference"?o=o.check(A.url()):s==="uuid"||s==="guid"?o=o.check(A.uuid()):s==="date-time"?o=o.check(A.iso.datetime({offset:!0})):s==="date"?o=o.check(A.iso.date()):s==="time"?o=o.check(A.regex(iv)):s==="duration"?o=o.check(A.iso.duration()):s==="hostname"?o=o.check(A.hostname()):s==="ipv4"?o=o.check(A.ipv4()):s==="ipv6"?o=o.check(A.ipv6()):s==="mac"?o=o.check(A.mac()):s==="cidr"?o=o.check(A.cidrv4()):s==="cidr-v6"?o=o.check(A.cidrv6()):s==="base64"?o=o.check(A.base64()):s==="base64url"?o=o.check(A.base64url()):s==="e164"?o=o.check(A.e164()):s==="credit_card"?o=o.check(A.creditCard()):s==="iban"?o=o.check(A.iban()):s==="jwt"?o=o.check(A.jwt()):s==="emoji"?o=o.check(A.emoji()):s==="nanoid"?o=o.check(A.nanoid()):s==="cuid"?o=o.check(A.cuid()):s==="cuid2"?o=o.check(A.cuid2()):s==="ulid"?o=o.check(A.ulid()):s==="xid"?o=o.check(A.xid()):s==="ksuid"&&(o=o.check(A.ksuid()))}typeof e.minLength=="number"&&(o=o.min(e.minLength)),typeof e.maxLength=="number"&&(o=o.max(e.maxLength)),e.pattern&&(o=o.regex(new RegExp(e.pattern))),r=o;break}case"number":case"integer":{let o=n==="integer"?A.number().int():A.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(o=o.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(o=o.max(e.maximum)),typeof e.exclusiveMinimum=="number"?o=o.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(o=o.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?o=o.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(o=o.lt(e.maximum)),typeof e.multipleOf=="number"&&(o=o.multipleOf(e.multipleOf)),r=o;break}case"boolean":{r=A.boolean();break}case"null":{r=A.null();break}case"object":{const o={},s=e.properties||{},i=new Set(e.required||[]),a=typeof e.additionalProperties=="object"?Ce(e.additionalProperties,t):void 0;for(const[d,f]of Object.entries(s)){const p=Ce(f,t);Fe(o,d,i.has(d)?p:p.optional())}if(e.patternProperties){const d=e.patternProperties,f=Object.keys(d),p=[];for(const m of f){const _=Ce(d[m],t),S=A.string().regex(new RegExp(m));p.push(A.looseRecord(S,_))}const h=[];if(Object.keys(o).length>0&&h.push(A.object(o).passthrough()),h.push(...p),h.length===0)r=A.object({}).passthrough();else if(h.length===1)r=h[0];else{let m=A.intersection(h[0],h[1]);for(let _=2;_<h.length;_++)m=A.intersection(m,h[_]);r=m}if(e.additionalProperties===!1){const m=Object.keys(o),_=f.map(w=>new RegExp(w)),S=r;r=r.check(w=>{if(!mt(w.value))return;const x=[];for(const C of Object.keys(w.value))m.includes(C)||_.some(R=>R.test(C))||x.push(C);x.length&&w.issues.push({code:"unrecognized_keys",keys:x,input:w.value,inst:S})})}}else{const d=A.object(o);e.additionalProperties===!1?r=d.strict():a?r=d.catchall(a):r=d.passthrough()}const c=e.propertyNames!==void 0&&e.propertyNames!==!0,u=typeof e.minProperties=="number"?e.minProperties:void 0,l=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(c||u!==void 0||l!==void 0){let d;if(c){const f=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=Ce(f,t)}r=nv(r,{keySchema:d,minProperties:u,maxProperties:l})}break}case"array":{const o=e.prefixItems,s=e.items;if(o&&Array.isArray(o)){const i=typeof e.minItems=="number"?e.minItems:0,a=o.map(d=>Ce(d,t)),c=Td(a,i),u=Array.isArray(s)?void 0:Ed(s,t),l=A.tuple(c);r=u?l.rest(u):l,typeof e.minItems=="number"&&(r=r.check(A.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(A.maxLength(e.maxItems)))}else if(Array.isArray(s)){const i=typeof e.minItems=="number"?e.minItems:0,a=s.map(d=>Ce(d,t)),c=Td(a,i),u=Ed(e.additionalItems,t),l=A.tuple(c);r=u?l.rest(u):l,typeof e.minItems=="number"&&(r=r.check(A.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(A.maxLength(e.maxItems)))}else if(s!==void 0){const i=Ce(s,t);let a=A.array(i);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),r=a}else r=A.array(A.any());(e.uniqueItems===!0||e.contains!==void 0)&&(r=sv(r,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?Ce(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${n}`)}return r}function Ce(e,t){if(typeof e=="boolean")return e?A.any():A.never();let n=Ug(e,t);const r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){const a=e.anyOf.map(u=>Ce(u,t)),c=A.union(a);n=r?A.intersection(n,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){const a=e.oneOf.map(u=>Ce(u,t)),c=A.xor(a);n=r?A.intersection(n,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=r?n:A.any();else{let a=r?n:Ce(e.allOf[0],t);const c=r?0:1;for(let u=c;u<e.allOf.length;u++)a=A.intersection(a,Ce(e.allOf[u],t));n=a}e.nullable===!0&&t.version==="openapi-3.0"&&(n=A.nullable(n)),e.readOnly===!0&&(n=A.readonly(n)),e.default!==void 0&&(n=n.default(e.default));const o={},s=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(const a of s)a in e&&(o[a]=e[a]);const i=["contentEncoding","contentMediaType","contentSchema"];for(const a of i)a in e&&(o[a]=e[a]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!Xn(e.propertyNames)&&(o.propertyNames=e.propertyNames);for(const a of["minProperties","maxProperties"])e[a]!==void 0&&(o[a]=e[a])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!Xn(e.contains)&&(o.contains=e.contains);for(const a of["uniqueItems","minContains","maxContains"])e[a]!==void 0&&(o[a]=e[a])}for(const a of Object.keys(e))Qw.has(a)||Fe(o,a,e[a]);return Object.keys(o).length>0&&t.registry.add(n,o),e.description&&(n=n.describe(e.description)),n}function Vg(e,t){if(typeof e=="boolean")return e?A.any():A.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}const r=Xw(n,t?.defaultTarget),o=n.$defs||n.definitions||{},s={version:r,defs:o,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??Re};return Ce(n,s)}function qg(e){return Bc(e,{object:t=>t.partial(),union:t=>{const n=t._zod.def;return n.discriminator===void 0?t:H(n.options)}})}function av(e,t){if(!t?.length)return e;const n=e._zod.def;return ce(e,xe(n,{checks:[...n.checks??[],...t]}),{parent:!0})}function Hg(e){return av(e.out,e.checks)}function cv(e){return e.in._zod.traits.has("$ZodTransform")?Hg(e):e.in}function Bg(e){return Bc(e,{pipe:t=>cv(t._zod.def),default:(t,n)=>n?se(t._zod.def.innerType):t,catch:(t,n)=>n?t._zod.def.innerType:t})}function Kg(e){return Bc(e,{pipe:t=>Hg(t._zod.def),prefault:(t,n)=>n?t._zod.def.innerType:t})}function uv(e){return im(Sn,e)}function lv(e){return dm(En,e)}function dv(e){return _m(An,e)}function fv(e){return wm(Nn,e)}function pv(e){return Am(to,e)}const Jg=Object.freeze(Object.defineProperty({__proto__:null,bigint:fv,boolean:dv,date:pv,number:lv,string:uv},Symbol.toStringTag,{value:"Module"})),Ad=Object.freeze(Object.defineProperty({__proto__:null,$brand:ka,$input:pc,$output:fc,INVALID:Ae,NEVER:va,TimePrecision:Rc,ZodAny:Ls,ZodArray:js,ZodBase64:Jr,ZodBase64URL:Wr,ZodBigInt:Nn,ZodBigIntFormat:Qr,ZodBoolean:An,ZodCIDRv4:Br,ZodCIDRv6:Kr,ZodCUID:Zr,ZodCUID2:jr,ZodCatch:si,ZodCodec:Dn,ZodCompileAsyncError:_t,ZodCompileUnsupportedError:G,ZodCreditCard:As,ZodCustom:Zn,ZodCustomStringFormat:Ot,ZodDate:to,ZodDefault:Xs,ZodDiscriminatedUnion:Us,ZodE164:Gr,ZodEmail:Mr,ZodEmoji:Rr,ZodEnum:Kt,ZodError:Rg,ZodExactOptional:oo,ZodFile:Ws,get ZodFirstPartyTypeKind(){return Yo},ZodFunction:mi,ZodGUID:Lr,ZodIBAN:Ns,ZodIPv4:qr,ZodIPv6:Hr,ZodISODate:In,ZodISODateTime:xn,ZodISODuration:Tn,ZodISOTime:zn,ZodInstanceOf:bi,ZodIntersection:Vs,ZodIssueCode:Dg,ZodJWT:Yr,ZodKSUID:Vr,ZodLazy:fi,ZodLiteral:Js,ZodMAC:Es,ZodMap:Bs,ZodNaN:ai,ZodNanoID:Dr,ZodNever:Ds,ZodNonOptional:so,ZodNull:Ms,ZodNullable:Qs,ZodNumber:En,ZodNumberFormat:Pt,ZodObject:On,ZodOptional:Ln,ZodPipe:Rn,ZodPrefault:ti,ZodPreprocess:ci,ZodPromise:hi,ZodReadonly:ui,ZodRealError:Oe,ZodRecord:Bt,ZodSet:Ks,ZodString:Sn,ZodStringFormat:ee,ZodSuccess:oi,ZodSymbol:Os,ZodTemplateLiteral:di,ZodTransform:Gs,ZodTuple:qs,ZodType:V,ZodULID:Fr,ZodURL:Cn,ZodUUID:tt,ZodUndefined:Ps,ZodUnion:Pn,ZodUnknown:Rs,ZodVoid:Zs,ZodXID:Ur,ZodXor:Fs,_ZodString:Pr,_default:ei,_function:yn,any:eo,array:D,base64:Iu,base64url:zu,bigint:Fu,boolean:X,catch:ii,check:ul,cidrv4:Su,cidrv6:xu,clone:ce,codec:sl,coerce:Jg,compile:hc,config:ye,core:Pg,creditCard:Cu,cuid:gu,cuid2:yu,currencyCode:Mu,custom:gi,date:Bu,decode:Xc,decodeAsync:tu,deepPartial:qg,describe:ll,discriminatedUnion:no,e164:Tu,email:iu,emoji:hu,encode:Qc,encodeAsync:eu,endsWith:Ir,enum:ve,exactOptional:Ys,file:tl,flattenError:us,float32:Ru,float64:Du,formatError:ls,fromJSONSchema:Vg,function:yn,getDiscriminatedOption:rc,getErrorMap:jg,globalRegistry:Re,gt:wt,gte:je,guid:au,hash:Lu,hex:Pu,hostname:Ou,httpUrl:pu,iban:Eu,includes:Sr,input:Bg,instanceof:fl,int:or,int32:Zu,int64:Uu,intersection:Mn,invertCodec:il,ipv4:vu,ipv6:$u,iso:ml,json:hl,jwt:Au,keyof:Ku,ksuid:wu,lazy:pi,length:kn,literal:v,locales:dc,looseObject:we,looseRecord:Yu,lowercase:kr,lt:bt,lte:Ze,mac:ku,map:Qu,maxLength:vn,maxSize:Jt,memoizer:bs,meta:dl,mime:Tr,minLength:Nt,minSize:vt,multipleOf:qt,nan:ol,nanoid:mu,nativeEnum:el,negative:Is,never:Ht,nonnegative:Ts,nonoptional:ri,nonpositive:zs,normalize:Cr,null:Xr,nullable:gn,nullish:nl,number:U,object:k,optional:se,output:Kg,overwrite:at,parse:Jc,parseAsync:Wc,partialRecord:Gu,pipe:sr,positive:xs,prefault:ni,preprocess:io,prettifyError:Sa,promise:cl,properties:zr,property:Cs,readonly:li,record:J,refine:yi,regex:vr,regexes:hs,registry:ws,safeDecode:ru,safeDecodeAsync:su,safeEncode:nu,safeEncodeAsync:ou,safeParse:Gc,safeParseAsync:Yc,set:Xu,setErrorMap:Zg,size:wn,slugify:Or,startsWith:xr,strictObject:Ju,string:b,stringFormat:Nu,stringbool:pl,success:rl,superRefine:_i,symbol:qu,templateLiteral:al,toJSONSchema:Hc,toLowerCase:Ar,toUpperCase:Nr,toZod:ns,transform:ro,treeifyError:$a,trim:Er,tuple:Hs,uint32:ju,uint64:Vu,ulid:_u,undefined:mn,union:H,unknown:Q,uppercase:$r,url:fu,util:wa,uuid:cu,uuidv4:uu,uuidv6:lu,uuidv7:du,validate:fs,validateAsync:ps,void:Hu,withParser:vs,xid:bu,xor:Wu},Symbol.toStringTag,{value:"Module"})),hv=Object.freeze(Object.defineProperty({__proto__:null,$brand:ka,$input:pc,$output:fc,INVALID:Ae,NEVER:va,TimePrecision:Rc,ZodAny:Ls,ZodArray:js,ZodBase64:Jr,ZodBase64URL:Wr,ZodBigInt:Nn,ZodBigIntFormat:Qr,ZodBoolean:An,ZodCIDRv4:Br,ZodCIDRv6:Kr,ZodCUID:Zr,ZodCUID2:jr,ZodCatch:si,ZodCodec:Dn,ZodCompileAsyncError:_t,ZodCompileUnsupportedError:G,ZodCreditCard:As,ZodCustom:Zn,ZodCustomStringFormat:Ot,ZodDate:to,ZodDefault:Xs,ZodDiscriminatedUnion:Us,ZodE164:Gr,ZodEmail:Mr,ZodEmoji:Rr,ZodEnum:Kt,ZodError:Rg,ZodExactOptional:oo,ZodFile:Ws,get ZodFirstPartyTypeKind(){return Yo},ZodFunction:mi,ZodGUID:Lr,ZodIBAN:Ns,ZodIPv4:qr,ZodIPv6:Hr,ZodISODate:In,ZodISODateTime:xn,ZodISODuration:Tn,ZodISOTime:zn,ZodInstanceOf:bi,ZodIntersection:Vs,ZodIssueCode:Dg,ZodJWT:Yr,ZodKSUID:Vr,ZodLazy:fi,ZodLiteral:Js,ZodMAC:Es,ZodMap:Bs,ZodNaN:ai,ZodNanoID:Dr,ZodNever:Ds,ZodNonOptional:so,ZodNull:Ms,ZodNullable:Qs,ZodNumber:En,ZodNumberFormat:Pt,ZodObject:On,ZodOptional:Ln,ZodPipe:Rn,ZodPrefault:ti,ZodPreprocess:ci,ZodPromise:hi,ZodReadonly:ui,ZodRealError:Oe,ZodRecord:Bt,ZodSet:Ks,ZodString:Sn,ZodStringFormat:ee,ZodSuccess:oi,ZodSymbol:Os,ZodTemplateLiteral:di,ZodTransform:Gs,ZodTuple:qs,ZodType:V,ZodULID:Fr,ZodURL:Cn,ZodUUID:tt,ZodUndefined:Ps,ZodUnion:Pn,ZodUnknown:Rs,ZodVoid:Zs,ZodXID:Ur,ZodXor:Fs,_ZodString:Pr,_default:ei,_function:yn,any:eo,array:D,base64:Iu,base64url:zu,bigint:Fu,boolean:X,catch:ii,check:ul,cidrv4:Su,cidrv6:xu,clone:ce,codec:sl,coerce:Jg,compile:hc,config:ye,core:Pg,creditCard:Cu,cuid:gu,cuid2:yu,currencyCode:Mu,custom:gi,date:Bu,decode:Xc,decodeAsync:tu,deepPartial:qg,default:Ad,describe:ll,discriminatedUnion:no,e164:Tu,email:iu,emoji:hu,encode:Qc,encodeAsync:eu,endsWith:Ir,enum:ve,exactOptional:Ys,file:tl,flattenError:us,float32:Ru,float64:Du,formatError:ls,fromJSONSchema:Vg,function:yn,getDiscriminatedOption:rc,getErrorMap:jg,globalRegistry:Re,gt:wt,gte:je,guid:au,hash:Lu,hex:Pu,hostname:Ou,httpUrl:pu,iban:Eu,includes:Sr,input:Bg,instanceof:fl,int:or,int32:Zu,int64:Uu,intersection:Mn,invertCodec:il,ipv4:vu,ipv6:$u,iso:ml,json:hl,jwt:Au,keyof:Ku,ksuid:wu,lazy:pi,length:kn,literal:v,locales:dc,looseObject:we,looseRecord:Yu,lowercase:kr,lt:bt,lte:Ze,mac:ku,map:Qu,maxLength:vn,maxSize:Jt,memoizer:bs,meta:dl,mime:Tr,minLength:Nt,minSize:vt,multipleOf:qt,nan:ol,nanoid:mu,nativeEnum:el,negative:Is,never:Ht,nonnegative:Ts,nonoptional:ri,nonpositive:zs,normalize:Cr,null:Xr,nullable:gn,nullish:nl,number:U,object:k,optional:se,output:Kg,overwrite:at,parse:Jc,parseAsync:Wc,partialRecord:Gu,pipe:sr,positive:xs,prefault:ni,preprocess:io,prettifyError:Sa,promise:cl,properties:zr,property:Cs,readonly:li,record:J,refine:yi,regex:vr,regexes:hs,registry:ws,safeDecode:ru,safeDecodeAsync:su,safeEncode:nu,safeEncodeAsync:ou,safeParse:Gc,safeParseAsync:Yc,set:Xu,setErrorMap:Zg,size:wn,slugify:Or,startsWith:xr,strictObject:Ju,string:b,stringFormat:Nu,stringbool:pl,success:rl,superRefine:_i,symbol:qu,templateLiteral:al,toJSONSchema:Hc,toLowerCase:Ar,toUpperCase:Nr,toZod:ns,transform:ro,treeifyError:$a,trim:Er,tuple:Hs,uint32:ju,uint64:Vu,ulid:_u,undefined:mn,union:H,unknown:Q,uppercase:$r,url:fu,util:wa,uuid:cu,uuidv4:uu,uuidv6:lu,uuidv7:du,validate:fs,validateAsync:ps,void:Hu,withParser:vs,xid:bu,xor:Wu,z:Ad},Symbol.toStringTag,{value:"Module"})),Zt="io.modelcontextprotocol/related-task",wi="2.0",ge=gi(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Wg=H([b(),U().int()]),Gg=b();we({ttl:U().optional(),pollInterval:U().optional()});const mv=k({ttl:U().optional()}),gv=k({taskId:b()}),gl=we({progressToken:Wg.optional(),[Zt]:gv.optional()}),Ve=k({_meta:gl.optional()}),ao=Ve.extend({task:mv.optional()}),yv=e=>ao.safeParse(e).success,ke=k({method:b(),params:Ve.loose().optional()}),We=k({_meta:gl.optional()}),Ge=k({method:b(),params:We.loose().optional()}),$e=we({_meta:gl.optional()}),co=H([b(),U().int()]),Yg=k({jsonrpc:v(wi),id:co,...ke.shape}).strict(),Nd=e=>Yg.safeParse(e).success,Qg=k({jsonrpc:v(wi),...Ge.shape}).strict(),_v=e=>Qg.safeParse(e).success,yl=k({jsonrpc:v(wi),id:co,result:$e}).strict(),Po=e=>yl.safeParse(e).success;var Y;(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"})(Y||(Y={}));const _l=k({jsonrpc:v(wi),id:co.optional(),error:k({code:U().int(),message:b(),data:Q().optional()})}).strict(),bv=e=>_l.safeParse(e).success,wv=H([Yg,Qg,yl,_l]);H([yl,_l]);const bl=$e.strict(),vv=We.extend({requestId:co.optional(),reason:b().optional()}),wl=Ge.extend({method:v("notifications/cancelled"),params:vv}),kv=k({src:b(),mimeType:b().optional(),sizes:D(b()).optional(),theme:ve(["light","dark"]).optional()}),uo=k({icons:D(kv).optional()}),_n=k({name:b(),title:b().optional()}),vi=_n.extend({..._n.shape,...uo.shape,version:b(),websiteUrl:b().optional(),description:b().optional()}),$v=Mn(k({applyDefaults:X().optional()}),J(b(),Q())),Sv=io(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Mn(k({form:$v.optional(),url:ge.optional()}),J(b(),Q()).optional())),xv=we({list:ge.optional(),cancel:ge.optional(),requests:we({sampling:we({createMessage:ge.optional()}).optional(),elicitation:we({create:ge.optional()}).optional()}).optional()}),Iv=we({list:ge.optional(),cancel:ge.optional(),requests:we({tools:we({call:ge.optional()}).optional()}).optional()}),zv=k({experimental:J(b(),ge).optional(),sampling:k({context:ge.optional(),tools:ge.optional()}).optional(),elicitation:Sv.optional(),roots:k({listChanged:X().optional()}).optional(),tasks:xv.optional(),extensions:J(b(),ge).optional()}),Tv=Ve.extend({protocolVersion:b(),capabilities:zv,clientInfo:vi}),Cv=ke.extend({method:v("initialize"),params:Tv}),Ev=k({experimental:J(b(),ge).optional(),logging:ge.optional(),completions:ge.optional(),prompts:k({listChanged:X().optional()}).optional(),resources:k({subscribe:X().optional(),listChanged:X().optional()}).optional(),tools:k({listChanged:X().optional()}).optional(),tasks:Iv.optional(),extensions:J(b(),ge).optional()}),Av=$e.extend({protocolVersion:b(),capabilities:Ev,serverInfo:vi,instructions:b().optional()}),Nv=Ge.extend({method:v("notifications/initialized"),params:We.optional()}),ki=ke.extend({method:v("ping"),params:Ve.optional()}),Ov=k({progress:U(),total:se(U()),message:se(b())}),Pv=k({...We.shape,...Ov.shape,progressToken:Wg}),vl=Ge.extend({method:v("notifications/progress"),params:Pv}),Mv=Ve.extend({cursor:Gg.optional()}),lo=ke.extend({params:Mv.optional()}),fo=$e.extend({nextCursor:Gg.optional()}),Lv=ve(["working","input_required","completed","failed","cancelled"]),po=k({taskId:b(),status:Lv,ttl:H([U(),Xr()]),createdAt:b(),lastUpdatedAt:b(),pollInterval:se(U()),statusMessage:se(b())}),kl=$e.extend({task:po}),Rv=We.merge(po),Qo=Ge.extend({method:v("notifications/tasks/status"),params:Rv}),$l=ke.extend({method:v("tasks/get"),params:Ve.extend({taskId:b()})}),Sl=$e.merge(po),xl=ke.extend({method:v("tasks/result"),params:Ve.extend({taskId:b()})});$e.loose();const Il=lo.extend({method:v("tasks/list")}),zl=fo.extend({tasks:D(po)}),Tl=ke.extend({method:v("tasks/cancel"),params:Ve.extend({taskId:b()})}),Dv=$e.merge(po),Xg=k({uri:b(),mimeType:se(b()),_meta:J(b(),Q()).optional()}),ey=Xg.extend({text:b()}),Cl=b().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),ty=Xg.extend({blob:Cl}),ho=ve(["user","assistant"]),jn=k({audience:D(ho).optional(),priority:U().min(0).max(1).optional(),lastModified:Fg({offset:!0}).optional()}),ny=k({..._n.shape,...uo.shape,uri:b(),description:se(b()),mimeType:se(b()),size:se(U()),annotations:jn.optional(),_meta:se(we({}))}),Zv=k({..._n.shape,...uo.shape,uriTemplate:b(),description:se(b()),mimeType:se(b()),annotations:jn.optional(),_meta:se(we({}))}),jv=lo.extend({method:v("resources/list")}),ry=fo.extend({resources:D(ny)}),Fv=lo.extend({method:v("resources/templates/list")}),Uv=fo.extend({resourceTemplates:D(Zv)}),El=Ve.extend({uri:b()}),Vv=El,qv=ke.extend({method:v("resources/read"),params:Vv}),oy=$e.extend({contents:D(H([ey,ty]))}),Hv=Ge.extend({method:v("notifications/resources/list_changed"),params:We.optional()}),Bv=El,Kv=ke.extend({method:v("resources/subscribe"),params:Bv}),Jv=El,Wv=ke.extend({method:v("resources/unsubscribe"),params:Jv}),Gv=We.extend({uri:b()}),Yv=Ge.extend({method:v("notifications/resources/updated"),params:Gv}),Qv=k({name:b(),description:se(b()),required:se(X())}),Xv=k({..._n.shape,...uo.shape,description:se(b()),arguments:se(D(Qv)),_meta:se(we({}))}),ek=lo.extend({method:v("prompts/list")}),tk=fo.extend({prompts:D(Xv)}),nk=Ve.extend({name:b(),arguments:J(b(),b()).optional()}),rk=ke.extend({method:v("prompts/get"),params:nk}),Al=k({type:v("text"),text:b(),annotations:jn.optional(),_meta:J(b(),Q()).optional()}),Nl=k({type:v("image"),data:Cl,mimeType:b(),annotations:jn.optional(),_meta:J(b(),Q()).optional()}),Ol=k({type:v("audio"),data:Cl,mimeType:b(),annotations:jn.optional(),_meta:J(b(),Q()).optional()}),ok=k({type:v("tool_use"),name:b(),id:b(),input:J(b(),Q()),_meta:J(b(),Q()).optional()}),sy=k({type:v("resource"),resource:H([ey,ty]),annotations:jn.optional(),_meta:J(b(),Q()).optional()}),iy=ny.extend({type:v("resource_link")}),mo=H([Al,Nl,Ol,iy,sy]),sk=k({role:ho,content:mo}),ik=$e.extend({description:b().optional(),messages:D(sk)}),ak=Ge.extend({method:v("notifications/prompts/list_changed"),params:We.optional()}),ck=k({title:b().optional(),readOnlyHint:X().optional(),destructiveHint:X().optional(),idempotentHint:X().optional(),openWorldHint:X().optional()}),uk=k({taskSupport:ve(["required","optional","forbidden"]).optional()}),Pl=k({..._n.shape,...uo.shape,description:b().optional(),inputSchema:k({type:v("object"),properties:J(b(),ge).optional(),required:D(b()).optional()}).catchall(Q()),outputSchema:k({type:v("object"),properties:J(b(),ge).optional(),required:D(b()).optional()}).catchall(Q()).optional(),annotations:ck.optional(),execution:uk.optional(),_meta:J(b(),Q()).optional()}),ay=lo.extend({method:v("tools/list")}),lk=fo.extend({tools:D(Pl)}),$i=$e.extend({content:D(mo).default([]),structuredContent:J(b(),Q()).optional(),isError:X().optional()});$i.or($e.extend({toolResult:Q()}));const dk=ao.extend({name:b(),arguments:J(b(),Q()).optional()}),cy=ke.extend({method:v("tools/call"),params:dk}),fk=Ge.extend({method:v("notifications/tools/list_changed"),params:We.optional()});k({autoRefresh:X().default(!0),debounceMs:U().int().nonnegative().default(300)});const uy=ve(["debug","info","notice","warning","error","critical","alert","emergency"]),pk=Ve.extend({level:uy}),hk=ke.extend({method:v("logging/setLevel"),params:pk}),mk=We.extend({level:uy,logger:b().optional(),data:Q()}),gk=Ge.extend({method:v("notifications/message"),params:mk}),yk=k({name:b().optional()}),_k=k({hints:D(yk).optional(),costPriority:U().min(0).max(1).optional(),speedPriority:U().min(0).max(1).optional(),intelligencePriority:U().min(0).max(1).optional()}),bk=k({mode:ve(["auto","required","none"]).optional()}),wk=k({type:v("tool_result"),toolUseId:b().describe("The unique identifier for the corresponding tool call."),content:D(mo).default([]),structuredContent:k({}).loose().optional(),isError:X().optional(),_meta:J(b(),Q()).optional()}),vk=no("type",[Al,Nl,Ol]),Xo=no("type",[Al,Nl,Ol,ok,wk]),kk=k({role:ho,content:H([Xo,D(Xo)]),_meta:J(b(),Q()).optional()}),$k=ao.extend({messages:D(kk),modelPreferences:_k.optional(),systemPrompt:b().optional(),includeContext:ve(["none","thisServer","allServers"]).optional(),temperature:U().optional(),maxTokens:U().int(),stopSequences:D(b()).optional(),metadata:ge.optional(),tools:D(Pl).optional(),toolChoice:bk.optional()}),Sk=ke.extend({method:v("sampling/createMessage"),params:$k}),ly=$e.extend({model:b(),stopReason:se(ve(["endTurn","stopSequence","maxTokens"]).or(b())),role:ho,content:vk}),dy=$e.extend({model:b(),stopReason:se(ve(["endTurn","stopSequence","maxTokens","toolUse"]).or(b())),role:ho,content:H([Xo,D(Xo)])}),xk=k({type:v("boolean"),title:b().optional(),description:b().optional(),default:X().optional()}),Ik=k({type:v("string"),title:b().optional(),description:b().optional(),minLength:U().optional(),maxLength:U().optional(),format:ve(["email","uri","date","date-time"]).optional(),default:b().optional()}),zk=k({type:ve(["number","integer"]),title:b().optional(),description:b().optional(),minimum:U().optional(),maximum:U().optional(),default:U().optional()}),Tk=k({type:v("string"),title:b().optional(),description:b().optional(),enum:D(b()),default:b().optional()}),Ck=k({type:v("string"),title:b().optional(),description:b().optional(),oneOf:D(k({const:b(),title:b()})),default:b().optional()}),Ek=k({type:v("string"),title:b().optional(),description:b().optional(),enum:D(b()),enumNames:D(b()).optional(),default:b().optional()}),Ak=H([Tk,Ck]),Nk=k({type:v("array"),title:b().optional(),description:b().optional(),minItems:U().optional(),maxItems:U().optional(),items:k({type:v("string"),enum:D(b())}),default:D(b()).optional()}),Ok=k({type:v("array"),title:b().optional(),description:b().optional(),minItems:U().optional(),maxItems:U().optional(),items:k({anyOf:D(k({const:b(),title:b()}))}),default:D(b()).optional()}),Pk=H([Nk,Ok]),Mk=H([Ek,Ak,Pk]),Lk=H([Mk,xk,Ik,zk]),Rk=ao.extend({mode:v("form").optional(),message:b(),requestedSchema:k({type:v("object"),properties:J(b(),Lk),required:D(b()).optional()})}),Dk=ao.extend({mode:v("url"),message:b(),elicitationId:b(),url:b().url()}),Zk=H([Rk,Dk]),jk=ke.extend({method:v("elicitation/create"),params:Zk}),Fk=We.extend({elicitationId:b()}),Uk=Ge.extend({method:v("notifications/elicitation/complete"),params:Fk}),Vk=$e.extend({action:ve(["accept","decline","cancel"]),content:io(e=>e===null?void 0:e,J(b(),H([b(),U(),X(),D(b())])).optional())}),qk=k({type:v("ref/resource"),uri:b()}),Hk=k({type:v("ref/prompt"),name:b()}),Bk=Ve.extend({ref:H([Hk,qk]),argument:k({name:b(),value:b()}),context:k({arguments:J(b(),b()).optional()}).optional()}),Kk=ke.extend({method:v("completion/complete"),params:Bk}),Jk=$e.extend({completion:we({values:D(b()).max(100),total:se(U().int()),hasMore:se(X())})}),Wk=k({uri:b().startsWith("file://"),name:b().optional(),_meta:J(b(),Q()).optional()}),Gk=ke.extend({method:v("roots/list"),params:Ve.optional()}),Yk=$e.extend({roots:D(Wk)}),Qk=Ge.extend({method:v("notifications/roots/list_changed"),params:We.optional()});H([ki,Cv,Kk,hk,rk,ek,jv,Fv,qv,Kv,Wv,cy,ay,$l,xl,Il,Tl]);H([wl,vl,Nv,Qk,Qo]);H([bl,ly,dy,Vk,Yk,Sl,zl,kl]);H([ki,Sk,jk,Gk,$l,xl,Il,Tl]);H([wl,vl,gk,Yv,Hv,fk,ak,Qo,Uk]);H([bl,Av,Jk,ik,tk,ry,Uv,oy,$i,lk,Sl,zl,kl]);class W extends Error{constructor(t,n,r){super(`MCP error ${t}: ${n}`),this.code=t,this.data=r,this.name="McpError"}static fromError(t,n,r){if(t===Y.UrlElicitationRequired&&r){const o=r;if(o.elicitations)return new Xk(o.elicitations,n)}return new W(t,n,r)}}class Xk extends W{constructor(t,n=`URL elicitation${t.length>1?"s":""} required`){super(Y.UrlElicitationRequired,n,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}}function Lt(e){return e==="completed"||e==="failed"||e==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Od(e){const n=Uw(e)?.method;if(!n)throw new Error("Schema is missing a method literal");const r=Vw(n);if(typeof r!="string")throw new Error("Schema method literal must be a string");return r}function Pd(e,t){const n=Mg(e,t);if(!n.success)throw n.error;return n.data}const e$=6e4;class t${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(wl,n=>{this._oncancel(n)}),this.setNotificationHandler(vl,n=>{this._onprogress(n)}),this.setRequestHandler(ki,n=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler($l,async(n,r)=>{const o=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!o)throw new W(Y.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(xl,async(n,r)=>{const o=async()=>{const s=n.params.taskId;if(!await this._taskStore.getTask(s,r.sessionId))throw new W(Y.InvalidParams,`Task not found: ${s}`);if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,r.sessionId);){if(a.type==="response"||a.type==="error"){const c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{const d=c,f=new W(d.error.code,d.error.message,d.error.data);l(f)}else{const d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:r.requestId})}}const i=await this._taskStore.getTask(s,r.sessionId);if(!i)throw new W(Y.InvalidParams,`Task not found: ${s}`);if(!Lt(i.status))return await this._waitForTaskUpdate(s,r.signal,r.sessionId),await o();if(Lt(i.status)){const a=await this._taskStore.getTaskResult(s,r.sessionId);return this._clearTaskQueue(s,r.sessionId),{...a,_meta:{...a._meta,[Zt]:{taskId:s}}}}return await o()};return await o()}),this.setRequestHandler(Il,async(n,r)=>{try{const{tasks:o,nextCursor:s}=await this._taskStore.listTasks(n.params?.cursor,r.sessionId);return{tasks:o,nextCursor:s,_meta:{}}}catch(o){throw new W(Y.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Tl,async(n,r)=>{try{const o=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!o)throw new W(Y.InvalidParams,`Task not found: ${n.params.taskId}`);if(Lt(o.status))throw new W(Y.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(n.params.taskId,r.sessionId);const s=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!s)throw new W(Y.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return{_meta:{},...s}}catch(o){throw o instanceof W?o:new W(Y.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,n,r,o,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,n),startTime:Date.now(),timeout:n,maxTotalTimeout:r,resetTimeoutOnProgress:s,onTimeout:o})}_resetTimeout(t){const n=this._timeoutInfo.get(t);if(!n)return!1;const r=Date.now()-n.startTime;if(n.maxTotalTimeout&&r>=n.maxTotalTimeout)throw this._timeoutInfo.delete(t),W.fromError(Y.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:r});return clearTimeout(n.timeoutId),n.timeoutId=setTimeout(n.onTimeout,n.timeout),!0}_cleanupTimeout(t){const n=this._timeoutInfo.get(t);n&&(clearTimeout(n.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 n=this.transport?.onclose;this._transport.onclose=()=>{n?.(),this._onclose()};const r=this.transport?.onerror;this._transport.onerror=s=>{r?.(s),this._onerror(s)};const o=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{o?.(s,i),Po(s)||bv(s)?this._onresponse(s):Nd(s)?this._onrequest(s,i):_v(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 r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(const r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();const n=W.fromError(Y.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(const r of t.values())r(n)}_onerror(t){this.onerror?.(t)}_onnotification(t){const n=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(t)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(t,n){const r=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,s=t.params?._meta?.[Zt]?.taskId,i=o?.sessionId,a=this._taskStore;let c=!0,u;if(s&&a&&this._taskMessageQueue&&i!==void 0&&(c=!1,u=(async()=>{if(!await a.getTask(s,i))throw new W(Y.InvalidParams,`Task not found: ${s}`);c=!0})()),r===void 0){const h={jsonrpc:"2.0",id:t.id,error:{code:Y.MethodNotFound,message:"Method not found"}};if(s&&u){const m={type:"error",message:h,timestamp:Date.now()};u.then(()=>this._enqueueTaskMessage(s,m,i),()=>o?.send(h)).catch(_=>this._onerror(new Error(`Failed to send an error response: ${_}`)))}else s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:h,timestamp:Date.now()},o?.sessionId).catch(m=>this._onerror(new Error(`Failed to enqueue error response: ${m}`))):o?.send(h).catch(m=>this._onerror(new Error(`Failed to send an error response: ${m}`)));return}const l=new AbortController;this._requestHandlerAbortControllers.set(t.id,l);const d=yv(t.params)?t.params.task:void 0,f=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,p={signal:l.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async h=>{if(l.signal.aborted)return;const m={relatedRequestId:t.id};s&&(m.relatedTask={taskId:s}),await this.notification(h,m)},sendRequest:async(h,m,_)=>{if(l.signal.aborted)throw new W(Y.ConnectionClosed,"Request was cancelled");const S={..._,relatedRequestId:t.id};s&&!S.relatedTask&&(S.relatedTask={taskId:s});const w=S.relatedTask?.taskId??s;return w&&f&&await f.updateTaskStatus(w,"input_required"),await this.request(h,m,S)},authInfo:n?.authInfo,requestId:t.id,requestInfo:n?.requestInfo,taskId:s,taskStore:f,taskRequestedTtl:d?.ttl,closeSSEStream:n?.closeSSEStream,closeStandaloneSSEStream:n?.closeStandaloneSSEStream};(u??Promise.resolve()).then(()=>{if(u&&l.signal.aborted)throw new W(Y.ConnectionClosed,"Request was cancelled");d&&this.assertTaskHandlerCapability(t.method)}).then(()=>r(t,p)).then(async h=>{if(l.signal.aborted)return;const m={result:h,jsonrpc:"2.0",id:t.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:m,timestamp:Date.now()},o?.sessionId):await o?.send(m)},async h=>{if(l.signal.aborted)return;const m={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(h.code)?h.code:Y.InternalError,message:h.message??"Internal error",...h.data!==void 0&&{data:h.data}}};s&&this._taskMessageQueue&&c?await this._enqueueTaskMessage(s,{type:"error",message:m,timestamp:Date.now()},o?.sessionId):await o?.send(m)}).catch(h=>this._onerror(new Error(`Failed to send response: ${h}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===l&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){const{progressToken:n,...r}=t.params,o=Number(n),s=this._progressHandlers.get(o);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}const i=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),i(c);return}s(r)}_onresponse(t){const n=Number(t.id),r=this._requestResolvers.get(n);if(r){if(this._requestResolvers.delete(n),Po(t))r(t);else{const i=new W(t.error.code,t.error.message,t.error.data);r(i)}return}const o=this._responseHandlers.get(n);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(n),this._cleanupTimeout(n);let s=!1;if(Po(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,n))}}if(s||this._progressHandlers.delete(n),Po(t))o(t);else{const i=W.fromError(t.error.code,t.error.message,t.error.data);o(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,n,r){const{task:o}=r??{};if(!o){try{yield{type:"result",result:await this.request(t,n,r)}}catch(i){yield{type:"error",error:i instanceof W?i:new W(Y.InternalError,String(i))}}return}let s;try{const i=await this.request(t,kl,r);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new W(Y.InternalError,"Task creation did not return a task");for(;;){const a=await this.getTask({taskId:s},r);if(yield{type:"taskStatus",task:a},Lt(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},n,r)}:a.status==="failed"?yield{type:"error",error:new W(Y.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new W(Y.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},n,r)};return}const c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),r?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof W?i:new W(Y.InternalError,String(i))}}}request(t,n,r){const{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=r??{};return new Promise((u,l)=>{const d=w=>{l(w)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(w){d(w);return}r?.signal?.throwIfAborted();const f=this._requestMessageId++,p={...t,jsonrpc:"2.0",id:f};r?.onprogress&&(this._progressHandlers.set(f,r.onprogress),p.params={...t.params,_meta:{...t.params?._meta||{},progressToken:f}}),a&&(p.params={...p.params,task:a}),c&&(p.params={...p.params,_meta:{...p.params?._meta||{},[Zt]:c}});const h=w=>{this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(w)}},{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(C=>this._onerror(new Error(`Failed to send cancellation: ${C}`)));const x=w instanceof W?w:new W(Y.RequestTimeout,String(w));l(x)};this._responseHandlers.set(f,w=>{if(!r?.signal?.aborted){if(w instanceof Error)return l(w);try{const x=Mg(n,w.result);x.success?u(x.data):l(x.error)}catch(x){l(x)}}}),r?.signal?.addEventListener("abort",()=>{h(r?.signal?.reason)});const m=r?.timeout??e$,_=()=>h(W.fromError(Y.RequestTimeout,"Request timed out",{timeout:m}));this._setupTimeout(f,m,r?.maxTotalTimeout,_,r?.resetTimeoutOnProgress??!1);const S=c?.taskId;if(S){const w=x=>{const C=this._responseHandlers.get(f);C?C(x):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,w),this._enqueueTaskMessage(S,{type:"request",message:p,timestamp:Date.now()}).catch(x=>{this._cleanupTimeout(f),l(x)})}else this._transport.send(p,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(w=>{this._cleanupTimeout(f),l(w)})})}async getTask(t,n){return this.request({method:"tasks/get",params:t},Sl,n)}async getTaskResult(t,n,r){return this.request({method:"tasks/result",params:t},n,r)}async listTasks(t,n){return this.request({method:"tasks/list",params:t},zl,n)}async cancelTask(t,n){return this.request({method:"tasks/cancel",params:t},Dv,n)}async notification(t,n){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);const r=n?.relatedTask?.taskId;if(r){const a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[Zt]:n.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!n?.relatedRequestId&&!n?.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"};n?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Zt]:n.relatedTask}}}),this._transport?.send(a,n).catch(c=>this._onerror(c))});return}let i={...t,jsonrpc:"2.0"};n?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Zt]:n.relatedTask}}}),await this._transport.send(i,n)}setRequestHandler(t,n){const r=Od(t);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(o,s)=>{const i=Pd(t,o);return Promise.resolve(n(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,n){const r=Od(t);this._notificationHandlers.set(r,o=>{const s=Pd(t,o);return Promise.resolve(n(s))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){const n=this._taskProgressTokens.get(t);n!==void 0&&(this._progressHandlers.delete(n),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,n,r){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,n,r??this._transport?.sessionId,o)}async _clearTaskQueue(t,n){if(this._taskMessageQueue){const r=await this._taskMessageQueue.dequeueAll(t,n);for(const o of r)if(o.type==="request"&&Nd(o.message)){const s=o.message.id,i=this._requestResolvers.get(s);i?(i(new W(Y.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,n,r){let o=this._options?.defaultTaskPollInterval??1e3;try{const s=await this._taskStore?.getTask(t,r);s?.pollInterval&&(o=s.pollInterval)}catch{}return new Promise((s,i)=>{if(n.aborted){i(new W(Y.InvalidRequest,"Request cancelled"));return}const a=setTimeout(s,o);n.addEventListener("abort",()=>{clearTimeout(a),i(new W(Y.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,n){const r=this._taskStore;if(!r)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await r.createTask(o,t.id,{method:t.method,params:t.params},n)},getTask:async o=>{const s=await r.getTask(o,n);if(!s)throw new W(Y.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(o,s,i)=>{await r.storeTaskResult(o,s,i,n);const a=await r.getTask(o,n);if(a){const c=Qo.parse({method:"notifications/tasks/status",params:a});await this.notification(c),Lt(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>r.getTaskResult(o,n),updateTaskStatus:async(o,s,i)=>{const a=await r.getTask(o,n);if(!a)throw new W(Y.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(Lt(a.status))throw new W(Y.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(o,s,i,n);const c=await r.getTask(o,n);if(c){const u=Qo.parse({method:"notifications/tasks/status",params:c});await this.notification(u),Lt(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>r.listTasks(o,n)}}}function Md(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function n$(e,t){const n={...e};for(const r in t){const o=r,s=t[o];if(s===void 0)continue;const i=n[o];Md(i)&&Md(s)?n[o]={...i,...s}:n[o]=s}return n}(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});class r$ extends t${_registeredMethods=new Set;_eventSlots=new Map;onEventDispatch(t,n){}_ensureEventSlot(t){let n=this._eventSlots.get(t);if(!n){let r=this.eventSchemas[t];if(!r)throw Error(`Unknown event: ${String(t)}`);n={listeners:[]},this._eventSlots.set(t,n);let o=r.shape.method.value;this._registeredMethods.add(o);let s=n;super.setNotificationHandler(r,i=>{let a=i.params;this.onEventDispatch(t,a),s.onHandler?.(a);for(let c of[...s.listeners])c(a)})}return n}setEventHandler(t,n){let r=this._ensureEventSlot(t);r.onHandler&&n&&console.warn(`[MCP Apps] on${String(t)} handler replaced. Use addEventListener("${String(t)}", …) to add multiple listeners without replacing.`),r.onHandler=n}getEventHandler(t){return this._eventSlots.get(t)?.onHandler}addEventListener(t,n){this._ensureEventSlot(t).listeners.push(n)}removeEventListener(t,n){let r=this._eventSlots.get(t);if(!r)return;let o=r.listeners.indexOf(n);o!==-1&&r.listeners.splice(o,1)}setRequestHandler=(t,n)=>{this._assertMethodNotRegistered(t,"setRequestHandler"),super.setRequestHandler(t,n)};setNotificationHandler=(t,n)=>{this._assertMethodNotRegistered(t,"setNotificationHandler"),super.setNotificationHandler(t,n)};warnIfRequestHandlerReplaced(t,n,r){n&&r&&console.warn(`[MCP Apps] ${t} handler replaced. Previous handler will no longer be called.`)}replaceRequestHandler=(t,n)=>{let r=t.shape.method.value;this._registeredMethods.add(r),super.setRequestHandler(t,n)};_assertMethodNotRegistered(t,n){let r=t.shape.method.value;if(this._registeredMethods.has(r))throw Error(`Handler for "${r}" already registered (via ${n}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._registeredMethods.add(r)}}var o$="2026-01-26",s$="ui/notifications/tool-input-partial";class fy{eventTarget;eventSource;messageListener;constructor(t=window.parent,n){this.eventTarget=t,this.eventSource=n,this.messageListener=r=>{if(n&&r.source!==this.eventSource){console.debug("Ignoring message from unknown source",r);return}let o=wv.safeParse(r.data);o.success?(console.debug("Parsed message",o.data),this.onmessage?.(o.data)):r.data?.jsonrpc!=="2.0"?console.debug("Ignoring non-JSON-RPC message",o.error.message,r):(console.error("Failed to parse message",o.error.message,r),this.onerror?.(Error("Invalid JSON-RPC message received: "+o.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(t,n){t.method!==s$&&console.debug("Sending message",t),this.eventTarget.postMessage(t,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var i$=H([v("light"),v("dark")]).describe("Color theme preference for the host environment."),ir=H([v("inline"),v("fullscreen"),v("pip")]).describe("Display mode for UI presentation."),a$=H([v("--color-background-primary"),v("--color-background-secondary"),v("--color-background-tertiary"),v("--color-background-inverse"),v("--color-background-ghost"),v("--color-background-info"),v("--color-background-danger"),v("--color-background-success"),v("--color-background-warning"),v("--color-background-disabled"),v("--color-text-primary"),v("--color-text-secondary"),v("--color-text-tertiary"),v("--color-text-inverse"),v("--color-text-ghost"),v("--color-text-info"),v("--color-text-danger"),v("--color-text-success"),v("--color-text-warning"),v("--color-text-disabled"),v("--color-border-primary"),v("--color-border-secondary"),v("--color-border-tertiary"),v("--color-border-inverse"),v("--color-border-ghost"),v("--color-border-info"),v("--color-border-danger"),v("--color-border-success"),v("--color-border-warning"),v("--color-border-disabled"),v("--color-ring-primary"),v("--color-ring-secondary"),v("--color-ring-inverse"),v("--color-ring-info"),v("--color-ring-danger"),v("--color-ring-success"),v("--color-ring-warning"),v("--font-sans"),v("--font-mono"),v("--font-weight-normal"),v("--font-weight-medium"),v("--font-weight-semibold"),v("--font-weight-bold"),v("--font-text-xs-size"),v("--font-text-sm-size"),v("--font-text-md-size"),v("--font-text-lg-size"),v("--font-heading-xs-size"),v("--font-heading-sm-size"),v("--font-heading-md-size"),v("--font-heading-lg-size"),v("--font-heading-xl-size"),v("--font-heading-2xl-size"),v("--font-heading-3xl-size"),v("--font-text-xs-line-height"),v("--font-text-sm-line-height"),v("--font-text-md-line-height"),v("--font-text-lg-line-height"),v("--font-heading-xs-line-height"),v("--font-heading-sm-line-height"),v("--font-heading-md-line-height"),v("--font-heading-lg-line-height"),v("--font-heading-xl-line-height"),v("--font-heading-2xl-line-height"),v("--font-heading-3xl-line-height"),v("--border-radius-xs"),v("--border-radius-sm"),v("--border-radius-md"),v("--border-radius-lg"),v("--border-radius-xl"),v("--border-radius-full"),v("--border-width-regular"),v("--shadow-hairline"),v("--shadow-sm"),v("--shadow-md"),v("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),c$=J(a$.describe(`Style variables for theming MCP apps.
|
|
71
71
|
|
|
72
72
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
73
73
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
74
74
|
|
|
75
75
|
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
76
|
-
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),
|
|
76
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),H([b(),mn()]).describe(`Style variables for theming MCP apps.
|
|
77
77
|
|
|
78
78
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
79
79
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
@@ -85,10 +85,10 @@ Individual style keys are optional - hosts may provide any subset of these value
|
|
|
85
85
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
86
86
|
|
|
87
87
|
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
88
|
-
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);
|
|
88
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);k({method:v("ui/open-link"),params:k({url:b().describe("URL to open in the host's browser")})});var u$=k({isError:X().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),l$=k({isError:X().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),d$=k({isError:X().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough();k({method:v("ui/notifications/sandbox-proxy-ready"),params:k({})});var Ml=k({connectDomains:D(b()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
|
|
89
89
|
|
|
90
90
|
- Maps to CSP \`connect-src\` directive
|
|
91
|
-
- Empty or omitted → no network connections (secure default)`),resourceDomains:
|
|
91
|
+
- Empty or omitted → no network connections (secure default)`),resourceDomains:D(b()).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:D(b()).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:D(b()).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'`)")}),Ll=k({camera:k({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:k({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:k({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:k({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")});k({method:v("ui/notifications/size-changed"),params:k({width:U().optional().describe("New width in pixels."),height:U().optional().describe("New height in pixels.")})});var f$=k({method:v("ui/notifications/tool-input"),params:k({arguments:J(b(),Q().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),p$=k({method:v("ui/notifications/tool-input-partial"),params:k({arguments:J(b(),Q().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),h$=k({method:v("ui/notifications/tool-cancelled"),params:k({reason:b().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),m$=k({fonts:b().optional()}),g$=k({variables:c$.optional().describe("CSS variables for theming the app."),css:m$.optional().describe("CSS blocks that apps can inject.")}),y$=k({method:v("ui/resource-teardown"),params:k({})});J(b(),Q());var Ld=k({text:k({}).optional().describe("Host supports text content blocks."),image:k({}).optional().describe("Host supports image content blocks."),audio:k({}).optional().describe("Host supports audio content blocks."),resource:k({}).optional().describe("Host supports resource content blocks."),resourceLink:k({}).optional().describe("Host supports resource link content blocks."),structuredContent:k({}).optional().describe("Host supports structured content.")});k({method:v("ui/notifications/request-teardown"),params:k({}).optional()});var _$=k({experimental:J(b(),J(b(),eo()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:k({}).optional().describe("Host supports opening external URLs."),downloadFile:k({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:k({listChanged:X().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:k({listChanged:X().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:k({}).optional().describe("Host accepts log messages."),sandbox:k({permissions:Ll.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:Ml.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:Ld.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:Ld.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:k({tools:k({}).optional().describe("Host supports tool use via `tools` and `toolChoice` parameters.")}).optional().describe("Host supports LLM sampling (sampling/createMessage) from the view.\nMirrors the MCP `ClientCapabilities.sampling` shape so hosts can pass it through.")}),b$=k({experimental:J(b(),J(b(),eo()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:k({listChanged:X().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:D(ir).optional().describe("Display modes the app supports.")});k({method:v("ui/notifications/initialized"),params:k({}).optional()});k({csp:Ml.optional().describe("Content Security Policy configuration for UI resources."),permissions:Ll.optional().describe("Sandbox permissions requested by the UI resource."),domain:b().optional().describe(`Dedicated origin for view sandbox.
|
|
92
92
|
|
|
93
93
|
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
94
94
|
|
|
@@ -102,13 +102,14 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
102
102
|
|
|
103
103
|
- \`true\`: request visible border + background
|
|
104
104
|
- \`false\`: request no visible border + background
|
|
105
|
-
- omitted: host decides border`)});
|
|
105
|
+
- omitted: host decides border`)});k({method:v("ui/request-display-mode"),params:k({mode:ir.describe("The display mode being requested.")})});var w$=k({mode:ir.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),v$=H([v("model"),v("app")]).describe("Tool visibility scope - who can access the tool.");k({resourceUri:b().optional(),visibility:D(v$).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
106
106
|
- "model": Tool visible to and callable by the agent
|
|
107
|
-
- "app": Tool callable by the app from this server only`),csp:
|
|
108
|
-
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:_().optional().describe("User's language and region preference in BCP 47 format."),timeZone:_().optional().describe("User's timezone in IANA format."),userAgent:_().optional().describe("Host application identifier."),platform:F([b("web"),b("desktop"),b("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:v({touch:X().optional().describe("Whether the device supports touch input."),hover:X().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:v({top:Z().describe("Top safe area inset in pixels."),right:Z().describe("Right safe area inset in pixels."),bottom:Z().describe("Bottom safe area inset in pixels."),left:Z().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),m$=v({method:b("ui/notifications/host-context-changed"),params:ny.describe("Partial context update containing only changed fields.")});v({method:b("ui/update-model-context"),params:v({content:M(no).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:q(_(),Y().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})});v({method:b("ui/initialize"),params:v({appInfo:rs.describe("App identification (name and version)."),appCapabilities:d$.describe("Features and capabilities this app provides."),protocolVersion:_().describe("Protocol version this app supports.")})});var g$=v({protocolVersion:_().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:rs.describe("Host application identification and version."),hostCapabilities:l$.describe("Features and capabilities provided by the host."),hostContext:ny.describe("Rich context about the host environment.")}).passthrough(),y$={target:"draft-2020-12"};async function zd(e,t){let n=e["~standard"];if(n.jsonSchema)return n.jsonSchema[t](y$);if(n.vendor==="zod"){let{z:r}=await Py(()=>Promise.resolve().then(()=>sv),void 0,import.meta.url);return r.toJSONSchema(e,{io:t})}throw Error(`Schema (vendor: ${n.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function Td(e,t,n=""){let r=await e["~standard"].validate(t);if(r.issues){let o=r.issues.map(i=>{let s=i.path?.map(a=>typeof a=="object"?a.key:a).join(".");return s?`${s}: ${i.message}`:i.message}).join("; ");throw Error(n+o)}return r.value}function _$(e,t=document.documentElement){for(let[n,r]of Object.entries(e))r!==void 0&&t.style.setProperty(n,r)}function b$(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 yl extends Wk{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_assertInitialized(t){if(this._initializedSent)return;let n=`[ext-apps] App.${t}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(n);console.warn(`${n}. This will throw in a future release.`)}eventSchemas={toolinput:o$,toolinputpartial:i$,toolresult:h$,toolcancelled:s$,hostcontextchanged:m$};static ONE_SHOT_EVENTS=new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]);_everHadListener=new Set;_assertHandlerTiming(t){if(!yl.ONE_SHOT_EVENTS.has(t)||this._everHadListener.has(t)||(this._everHadListener.add(t),!this._initializedSent))return;let n=`[ext-apps] "${String(t)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(n);console.warn(n)}setEventHandler(t,n){n&&this._assertHandlerTiming(t),super.setEventHandler(t,n)}addEventListener(t,n){this._assertHandlerTiming(t),super.addEventListener(t,n)}onEventDispatch(t,n){t==="hostcontextchanged"&&(this._hostContext={...this._hostContext,...n})}constructor(t,n={},r={autoResize:!0}){super(r),this._appInfo=t,this._capabilities=n,this.options=r,r.allowUnsafeEval||me({jitless:!0}),this.setRequestHandler(os,o=>(console.log("Received ping:",o.params),{})),this.setEventHandler("hostcontextchanged",void 0)}registerCapabilities(t){if(this.transport)throw Error("Cannot register capabilities after transport is established");this._capabilities=Jk(this._capabilities,t)}registerTool(t,n,r){if(this._registeredTools[t])throw Error(`Tool ${t} is already registered`);let o=this,i=()=>{o._initializedSent&&o._capabilities.tools?.listChanged&&o.sendToolListChanged()},s=n.inputSchema!==void 0,a={title:n.title,description:n.description,inputSchema:n.inputSchema,outputSchema:n.outputSchema,annotations:n.annotations,_meta:n._meta,enabled:!0,enable(){this.enabled=!0,i()},disable(){this.enabled=!1,i()},update(c){Object.assign(this,c),i()},remove(){o._registeredTools[t]===a&&(delete o._registeredTools[t],i())},handler:async(c,u)=>{if(!a.enabled)throw Error(`Tool ${t} is disabled`);let l;if(s){let d=a.inputSchema,f=d?await Td(d,c??{},`Invalid input for tool ${t}: `):c??{};l=await r(f,u)}else l=await r(u);return a.outputSchema&&!l.isError&&(l.structuredContent=await Td(a.outputSchema,l.structuredContent,`Invalid output for tool ${t}: `)),l}};return this._registeredTools[t]=a,!this._capabilities.tools&&!this.transport&&this.registerCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),i(),a}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(t,n)=>{let r=this._registeredTools[t.name];if(!r)throw Error(`Tool ${t.name} not found`);return r.handler(t.arguments,n)},this.onlisttools=async(t,n)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([r,o])=>o.enabled).map(async([r,o])=>{let i={name:r,title:o.title,description:o.description,inputSchema:o.inputSchema?await zd(o.inputSchema,"input"):{type:"object",properties:{}}};return o.outputSchema&&(i.outputSchema=await zd(o.outputSchema,"output")),o.annotations&&(i.annotations=o.annotations),o._meta&&(i._meta=o._meta),i}))}))}async sendToolListChanged(t={}){this._assertInitialized("sendToolListChanged"),await this.notification({method:"notifications/tools/list_changed",params:t})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler("toolinput")}set ontoolinput(t){this.setEventHandler("toolinput",t)}get ontoolinputpartial(){return this.getEventHandler("toolinputpartial")}set ontoolinputpartial(t){this.setEventHandler("toolinputpartial",t)}get ontoolresult(){return this.getEventHandler("toolresult")}set ontoolresult(t){this.setEventHandler("toolresult",t)}get ontoolcancelled(){return this.getEventHandler("toolcancelled")}set ontoolcancelled(t){this.setEventHandler("toolcancelled",t)}get onhostcontextchanged(){return this.getEventHandler("hostcontextchanged")}set onhostcontextchanged(t){this.setEventHandler("hostcontextchanged",t)}_onteardown;get onteardown(){return this._onteardown}set onteardown(t){this.warnIfRequestHandlerReplaced("onteardown",this._onteardown,t),this._onteardown=t,this.replaceRequestHandler(u$,(n,r)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(n.params,r)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(t){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,t),this._oncalltool=t,this.replaceRequestHandler(Yg,(n,r)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(n.params,r)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(t){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,t),this._onlisttools=t,this.replaceRequestHandler(Gg,(n,r)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(n.params,r)})}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${t})`);break}}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,n){if(this._assertInitialized("callServerTool"),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},is,{onprogress:()=>{},resetTimeoutOnProgress:!0,...n})}async readServerResource(t,n){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:t},Kg,n)}async listServerResources(t,n){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:t},Bg,n)}async createSamplingMessage(t,n){this._assertInitialized("createSamplingMessage");let r=t.tools?ey:Xg;return await this.request({method:"sampling/createMessage",params:t},r,n)}sendMessage(t,n){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:t},r$,n)}sendLog(t){return this.notification({method:"notifications/message",params:t})}updateModelContext(t,n){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:t},Xu,n)}openLink(t,n){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:t},t$,n)}sendOpenLink=this.openLink;downloadFile(t,n){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:t},n$,n)}requestTeardown(t={}){return this.notification({method:"ui/notifications/request-teardown",params:t})}requestDisplayMode(t,n){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:t},f$,n)}sendSizeChanged(t){return this.notification({method:"ui/notifications/size-changed",params:t})}setupSizeChangedNotifications(){let t=!1,n=0,r=0,o=()=>{t||(t=!0,requestAnimationFrame(()=>{t=!1;let s=document.documentElement,a=s.style.height;s.style.height="max-content";let c=Math.ceil(s.getBoundingClientRect().height);s.style.height=a;let u=Math.ceil(window.innerWidth);(u!==n||c!==r)&&(n=u,r=c,this.sendSizeChanged({width:u,height:c}))}))};o();let i=new ResizeObserver(o);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(t=new ty(window.parent,window.parent),n){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1,await super.connect(t);try{let r=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:Gk}},g$,n);if(r===void 0)throw Error(`Server sent invalid initialize result: ${r}`);this._hostCapabilities=r.hostCapabilities,this._hostInfo=r.hostInfo,this._hostContext=r.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(r){throw this.close(),r}}}const w$="http://www.w3.org/2000/svg",v$=.45,k$=2.5,$$=5,S$="chain-insights.flows.v1",_l="cia-graph-model",I$=90,bt={rest:.6,related:.95,faded:.07},Ed={checked:24,other:19},Gn=16,x$=[["Sanctioned","Sanctioned"],["Scam","Scam"],["Poisoned","Poisoned"],["OnMoneyTrail","On money trail"],["Mixer","Mixer"],["Bridge","Bridge"],["Exchange","Exchange"],["Victim","Victim"],["Targeted","Targeted"]],ro=["exchange","scam","sanctioned","victim","pool","other"],z$={exchange:"infrastructure",scam:"danger",sanctioned:"danger",victim:"target",pool:"trail",other:"neutral"},ry={exchange:"Exchange",scam:"Scam",sanctioned:"Sanctioned",victim:"Victim",pool:"Pool",other:""};function bl(e){return!!e&&e.schema===S$}function T$(e){return!!e&&e.kind===_l}function fe(e){return String(e??"").trim().toLowerCase()}function E$(e){const t=fe(e);return ro.includes(t)?t:"other"}function yt(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function Ls(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function C$(e){const t=String(e??"").toUpperCase();return t==="IN"||t==="OUT"||t==="MIXED"||t==="CHECKED"?t:"OUT"}function He(e){return T$(e)?e:bl(e)?A$(e):O$(e)}function A$(e){const t=fe(e.center),n=new Map;for(const a of e.nodes??[]){const c=fe(a?.address);c&&!n.has(c)&&n.set(c,a)}const r=[],o=new Set;for(const a of e.edges??[]){const c=fe(a?.from),u=fe(a?.to);if(!n.has(c)||!n.has(u)||c===u)continue;const l=`${c}->${u}`;o.has(l)||(o.add(l),r.push({id:l,from:c,to:u,source:"flows",amount_usd_sum:yt(a.usd),tx_count:yt(a.tx_count),first_seen_timestamp:yt(a.first_seen_ms),last_seen_timestamp:yt(a.last_seen_ms),...typeof a.link_kind=="string"&&a.link_kind?{link_kind:a.link_kind}:{}}))}const i=N$(t,[...n.keys()],r),s=[...n.entries()].map(([a,c])=>{const u=i.get(a)??{direction:"OUT",hop:2};return{id:a,address:a,direction:a===t?"CHECKED":u.direction,hop:a===t?0:u.hop,labels:Ls(c.labels),taxonomy:[],role:E$(c.role),total_in_usd:yt(c.total_in_usd),total_out_usd:yt(c.total_out_usd),degree_in:yt(c.degree_in),degree_out:yt(c.degree_out)}});return{kind:_l,checked_address:t,network:e.network??null,nodes:s,edges:r,truncated:!!e.truncated,cursor:e.cursor??null}}function N$(e,t,n){const r=new Map,o=new Map,i=new Map,s=(d,f,p)=>d.set(f,[...d.get(f)??[],p]);for(const d of n)s(r,d.from,d.to),s(o,d.to,d.from),s(i,d.from,d.to),s(i,d.to,d.from);const a=d=>{const f=new Map([[e,0]]);for(let p=[e];p.length;){const h=[];for(const m of p)for(const y of d.get(m)??[])f.has(y)||(f.set(y,(f.get(m)??0)+1),h.push(y));p=h}return f},c=a(r),u=a(o),l=new Map;for(const d of t){if(d===e)continue;const f=c.get(d),p=u.get(d);if(f==null&&p==null)continue;const h=f!=null&&p!=null?f<p?"OUT":p<f?"IN":"MIXED":f!=null?"OUT":"IN";l.set(d,{direction:h,hop:Math.min(2,Math.min(f??1/0,p??1/0))})}for(let d=!0;d;){d=!1;for(const f of t){if(f===e||l.has(f))continue;const p=(i.get(f)??[]).find(m=>m!==e&&l.has(m));if(p==null)continue;const h=l.get(p);l.set(f,{direction:h.direction==="MIXED"?"OUT":h.direction,hop:2}),d=!0}}return l}function O$(e){const t=(e?.nodes??[]).map(r=>({...r,id:String(r.id??r.address),address:r.address,hop:Number(r.hop)||0,direction:r.address===e.checked_address?"CHECKED":C$(r.direction),labels:Ls(r.labels),taxonomy:Ls(r.taxonomy),role:null})),n=(e?.edges??[]).map(r=>({...r,id:String(r.id??`${r.from}->${r.to}`),amount_usd_sum:r.amount_usd_sum??null,tx_count:r.tx_count??null,first_seen_timestamp:r.first_seen_timestamp??null,last_seen_timestamp:r.last_seen_timestamp??null,source:"risk"}));return{kind:_l,checked_address:e?.checked_address??"",network:null,nodes:t,edges:n,truncated:!1,cursor:null}}function P$(e,t,n){const r=He(t),o=Io(e,n??r.checked_address),i=e.nodes.find(d=>d.id===o),s=new Map(e.nodes.map(d=>[fe(d.address),d])),a=[];for(const d of r.nodes){if(s.has(fe(d.address)))continue;const f=!i||i.direction==="CHECKED"?d.direction==="CHECKED"?"OUT":d.direction:i.direction,p={...d,id:d.id,direction:f,hop:Math.min(2,(i?.hop??0)+1)};a.push(p),s.set(fe(d.address),p)}const c=new Set(e.edges.map(d=>d.id)),u=new Set(e.edges.map(d=>`${fe(d.from)}->${fe(d.to)}`)),l=[...e.edges];for(const d of r.edges){const f=`${fe(d.from)}->${fe(d.to)}`;if(c.has(d.id)||u.has(f)||!s.has(fe(d.from))||!s.has(fe(d.to)))continue;const p=s.get(fe(d.from)).address,h=s.get(fe(d.to)).address;l.push({...d,from:p,to:h}),c.add(d.id),u.add(f)}return{model:{...e,nodes:[...e.nodes,...a],edges:l,truncated:e.truncated||r.truncated},added:a.map(d=>d.id)}}function Io(e,t){if(t==null)return null;const n=fe(t);return e.nodes.find(o=>o.id===t||fe(o.address)===n)?.id??null}function Re(e){return typeof e!="string"||e.length<=12?e:`${e.slice(0,6)}…${e.slice(-4)}`}function wl(e){return String(e??"").trim().replace(/\s+/g," ")}function Ro(e){return wl(e).replaceAll(" ","").toLowerCase()}function kt(e){const t=[...e.taxonomy??[],...e.labels??[]],n=new Set,r=[];for(const o of t){const i=wl(o),s=i.toLowerCase();!i||s==="address"||n.has(s)||(n.add(s),r.push(i))}return r}function go(e,t){const n=new Set(kt(e).map(Ro));return t.some(r=>n.has(Ro(r)))}function M$(e){if(e.role&&ro.includes(e.role))return z$[e.role];if(go(e,["Sanctioned","Scam","Poisoned"]))return"danger";if(go(e,["Victim","Targeted"]))return"target";if(go(e,["OnMoneyTrail","Mixer"]))return"trail";if(go(e,["Exchange","Bridge","token contract"]))return"infrastructure";if(e.risk_score!=null){const t=String(e.risk_level).toLowerCase();if(t==="critical"||t==="high"||t==="medium"||t==="low")return t}return"neutral"}function de(e){return`var(--cia-graph-${e})`}const R$={semantic:{danger:{stroke:de("danger"),fill:de("node")},target:{stroke:de("target"),fill:de("node")},trail:{stroke:de("trail"),fill:de("node")},infrastructure:{stroke:de("infrastructure"),fill:de("node")},neutral:{stroke:de("neutral"),fill:de("node")}},risk:{CRITICAL:{stroke:de("critical"),fill:de("node")},HIGH:{stroke:de("high"),fill:de("node")},MEDIUM:{stroke:de("medium"),fill:de("node")},LOW:{stroke:de("low"),fill:de("node")}}};function L$(e,t=R$){const n=M$(e);return n==="critical"||n==="high"||n==="medium"||n==="low"?t.risk[n.toUpperCase()]??t.semantic.neutral:t.semantic[n]}function D$(e){return e.role&&ro.includes(e.role)?de(`role-${e.role}`):L$(e).stroke}function ss(e){if(e.role&&e.role!=="other"&&ro.includes(e.role))return ry[e.role];const t=kt(e);for(const[r,o]of x$)if(t.some(i=>Ro(i)===Ro(r)))return o;return(Array.isArray(e.labels)?e.labels.map(wl).filter(Boolean).sort((r,o)=>r.localeCompare(o)):[])[0]??""}function Ds(e){return Math.min(k$,Math.max(v$,e))}function oo(e){return[...e.nodes??[]].sort((t,n)=>String(t.id).localeCompare(String(n.id)))}function vl(e,t=oo(e)){return t.find(n=>n.address===e.checked_address)??t[0]}function Cd(e,t){return e.address===t?43:e.hop>=2?25:30}function Zs(e,t){return e.address===t?Ed.checked:Ed.other}function io(e,t,n){const r=e.address===t,o=Zs(e,t),i=ss(e),s=[];return i&&s.push({kind:"role",text:ES(i),y:o+17}),s.push({kind:"address",text:Re(e.address),y:o+(i?33:17)}),n&&s.push({kind:"note",text:n,y:o+(i?48:32)}),{radius:o,ring:r,dot:r?8:5,texts:s}}const Z$={role:{size:13,advance:.68},address:{size:11,advance:.62},note:{size:11,advance:.6}},hs=2;function kl(e){const t=e.radius+(e.ring?7:2),n=[{kind:"circle",box:{x1:-t,y1:-t,x2:t,y2:t}}];for(const r of e.texts){const o=Z$[r.kind],i=[...r.text].length*o.size*o.advance/2+hs;n.push({kind:r.kind,box:{x1:-i,y1:r.y-o.size*.8-hs,x2:i,y2:r.y+o.size*.25+hs}})}return n}function oy(e){return e.length?{x1:Math.min(...e.map(t=>t.x1)),y1:Math.min(...e.map(t=>t.y1)),x2:Math.max(...e.map(t=>t.x2)),y2:Math.max(...e.map(t=>t.y2))}:null}function iy(e){return oy(kl(e).map(t=>t.box))}const $l=(e,t)=>(e instanceof Map?e.get(t):e?.[t])??null;function j$(e,t,n){const r=He(e),o=[];for(const i of r.nodes){const s=t[i.id];if(s)for(const{kind:a,box:c}of kl(io(i,r.checked_address,$l(n,i.id))))o.push({id:i.id,kind:a,x1:s.x+c.x1,y1:s.y+c.y1,x2:s.x+c.x2,y2:s.y+c.y2})}return o}function F$(e,t,n){return oy(j$(e,t,n))}function U$(e,t){return e.x1<t.x2&&t.x1<e.x2&&e.y1<t.y2&&t.y1<e.y2}function V$(e){let t=0;for(const n of String(e))t=(t<<5)-t+n.charCodeAt(0)|0;return Math.abs(t)}function q$(e,t,n){const r=He(e),o={x:t/2,y:n/2},i={},s=oo(r),a=vl(r,s);if(!a)return i;i[a.id]=o;const c=new Map;for(const u of s){if(u.id===a.id)continue;let l=u.direction==="IN"?-1:1;u.direction==="MIXED"&&(l=V$(u.id)%2?-1:1);const d=Math.min(2,Math.max(1,Number(u.hop)||1)),f=`${l}:${d}`;c.has(f)||c.set(f,[]),c.get(f).push(u)}for(const[u,l]of c){const[d,f]=u.split(":"),p=Number(d),h=Number(f),m=o.x+p*(h===1?t*.23:t*.43);Object.assign(i,H$(l,m,o.y,r.checked_address))}return i}function H$(e,t,n,r,o=24){const i=e.map((c,u)=>({node:c,x:t,y:n+(u-(e.length-1)/2)*64})),s=c=>iy(io(c,r)),a=(c,u)=>Math.max(Cd(c,r)+Cd(u,r)+20,s(c).y2-s(u).y1+2);for(let c=0;c<o;c++){for(let d=1;d<i.length;d++){const f=i[d-1],p=i[d];!f||!p||(p.y=Math.max(p.y,f.y+a(f.node,p.node)))}for(let d=i.length-2;d>=0;d--){const f=i[d],p=i[d+1];!f||!p||(f.y=Math.min(f.y,p.y-a(f.node,p.node)))}const u=i[0],l=i[i.length-1];if(u&&l){const d=(u.y+l.y)/2,f=n-d;for(const p of i)p.y+=f}}return Object.fromEntries(i.map(c=>[c.node.id,{x:c.x,y:c.y}]))}function B$(e,t,n){const r=He(e),o={x:t/2,y:n/2},i={},s=oo(r),a=vl(r,s);if(!a)return i;i[a.id]=o;const c=s.filter(u=>u.id!==a.id);return c.forEach((u,l)=>{const d=-Math.PI/2+l*Math.PI*2/Math.max(1,c.length),f=u.hop>=2?Math.min(t,n)*.39:Math.min(t,n)*.27;i[u.id]={x:o.x+Math.cos(d)*f,y:o.y+Math.sin(d)*f}}),i}function K$(e,t,n,r){const o=He(e),i=oo(o).filter(c=>t[c.id]),s=i.find(c=>c.address===o.checked_address);for(let c=0;c<i.length;c++)for(let u=c+1;u<i.length;u++){const l=i[c],d=i[u],f=l&&t[l.id],p=d&&t[d.id];if(!f||!p)continue;const h=p.x-f.x||.1,m=p.y-f.y||.1,y=Math.max(1,Math.hypot(h,m)),$=Math.max(0,88-y)*.012;f.x-=h/y*$,f.y-=m/y*$,p.x+=h/y*$,p.y+=m/y*$}const a=new Map(i.map(c=>[c.address,c]));for(const c of o.edges){const u=a.get(c.from),l=a.get(c.to);if(!u||!l)continue;const d=t[u.id],f=t[l.id];if(!d||!f)continue;const p=f.x-d.x,h=f.y-d.y,m=Math.max(1,Math.hypot(p,h)),y=(m-155)*.003;u!==s&&(d.x+=p/m*y,d.y+=h/m*y),l!==s&&(f.x-=p/m*y,f.y-=h/m*y)}return s&&(t[s.id]={x:n/2,y:r/2}),t}function J$(e,t,n,r=I$){const o=He(e),i=B$(o,t,n);for(let s=0;s<r;s++)K$(o,i,t,n);return i}function yo(e,t,n,r){return t==="tree"?q$(e,n,r):J$(e,n,r)}function W$(e,t,n,r,o={}){const i=He(e),s=t[n],a={...t};if(!s)return a;const c=o.spacing??80,u=o.gap??48,l=Math.max(1,o.perColumn??6),d=i.nodes.find(w=>w.id===n),f=new Map(i.nodes.map(w=>[w.id,w])),p=w=>iy(io(w,i.checked_address,$l(o.notes,w.id))),h=i.nodes.flatMap(w=>{const S=t[w.id];if(!S)return[];const T=p(w);return[{x1:S.x+T.x1,x2:S.x+T.x2}]});let m=h.length?Math.min(...h.map(w=>w.x1)):s.x,y=h.length?Math.max(...h.map(w=>w.x2)):s.x;const $={left:[],right:[]};for(const w of[...r].sort()){const S=f.get(w);if(!S||a[w])continue;const T=i.edges.some(C=>C.from===S.address&&C.to===d?.address),O=i.edges.some(C=>C.to===S.address&&C.from===d?.address);$[T&&!O?"left":"right"].push(S)}for(const w of["left","right"]){const S=$[w];for(let T=0;T<S.length;T+=l){const O=S.slice(T,T+l),C=O.map(p),L=Math.max(...C.map(le=>Math.max(-le.x1,le.x2))),ue=Math.max(c,Math.max(...C.map(le=>le.y2))-Math.min(...C.map(le=>le.y1))+6),Q=w==="left"?m-u-L:y+u+L;O.forEach((le,xe)=>{a[le.id]={x:Q,y:s.y+(xe-(O.length-1)/2)*ue}}),w==="left"?m=Q-L:y=Q+L}}return a}function G$(e,t,n,r=Gn){const o=Math.max(1,e.x2-e.x1),i=Math.max(1,e.y2-e.y1),s=Ds(Math.min((t-r*2)/o,(n-r*2)/i));return{x:t/2-(e.x1+e.x2)/2*s,y:n/2-(e.y1+e.y2)/2*s,scale:s}}function Ad(e,t,n,r=Gn){return Math.min((t-r*2)/Math.max(1,e.x2-e.x1),(n-r*2)/Math.max(1,e.y2-e.y1))}function Y$(e,t,n,r,o=4){const i=t.x-e.x,s=t.y-e.y,a=Math.hypot(i,s),c=n+o,u=r+o;if(!Number.isFinite(a)||a<=0||c+u>=a)return null;const l=i/a,d=s/a;return{x1:e.x+l*c,y1:e.y+d*c,x2:t.x-l*u,y2:t.y-d*u}}function Xe(e){return Math.round(e*100)/100}function ms(e,t,n,r,o){const i=s=>`${Xe(s.x)},${Xe(s.y)}`;return{kind:e,start:t,end:o,controls:[n,r],d:`M${i(t)} C${i(n)} ${i(r)} ${i(o)}`}}function Q$(e,t,n,r,o=4){const i=t.x-e.x,s=t.y-e.y,a=Math.hypot(i,s),c=n+r+o*2;if(!Number.isFinite(a)||a<=c)return null;if(i>=c){const f={x:e.x+n+o,y:e.y},p={x:t.x-r-o,y:t.y},h=p.x-f.x,m=Math.max(h*.45,Math.min(65,h));return ms("forward",f,{x:f.x+m,y:f.y},{x:p.x-m,y:p.y},p)}if(i<=-c){const f={x:e.x,y:e.y-n-o},p={x:t.x,y:t.y-r-o},h=Math.max(100,Math.abs(i)*.2);return ms("backward",f,{x:f.x+85,y:f.y-h},{x:p.x+85,y:p.y-h},p)}if(Math.abs(s)>c){const f=s>0?1:-1,p={x:e.x,y:e.y+f*(n+o)},h={x:t.x,y:t.y-f*(r+o)},m=Math.abs(h.y-p.y),y=Math.max(m*.45,Math.min(40,m));return ms("vertical",p,{x:p.x,y:p.y+f*y},{x:h.x,y:h.y-f*y},h)}const u=Y$(e,t,n,r,o),l={x:u.x1,y:u.y1},d={x:u.x2,y:u.y2};return{kind:"straight",start:l,end:d,controls:null,d:`M${Xe(l.x)},${Xe(l.y)} L${Xe(d.x)},${Xe(d.y)}`}}const X$=6,gs=X$+3,Qe=14,Nd=10,eS=3,Od=6;function tS(e,t,n){const r=He(e),o=[];for(const i of r.nodes){const s=t[i.id];if(s)for(const{kind:a,box:c}of kl(io(i,r.checked_address,$l(n,i.id))))a==="circle"?o.push({id:i.id,kind:"circle",x:s.x,y:s.y,r:c.x2}):o.push({id:i.id,kind:"box",x1:s.x+c.x1,y1:s.y+c.y1,x2:s.x+c.x2,y2:s.y+c.y2})}return o}function nS(e,t){if(t.kind==="circle")return Math.hypot(e.x-t.x,e.y-t.y)-t.r;const n=Math.max(t.x1-e.x,0,e.x-t.x2),r=Math.max(t.y1-e.y,0,e.y-t.y2);return n||r?Math.hypot(n,r):-Math.min(e.x-t.x1,t.x2-e.x,e.y-t.y1,t.y2-e.y)}function rS(e,t){return e.kind==="circle"?{x1:e.x-e.r-t,y1:e.y-e.r-t,x2:e.x+e.r+t,y2:e.y+e.r+t}:{x1:e.x1-t,y1:e.y1-t,x2:e.x2+t,y2:e.y2+t}}function oS(e,t){const n=1-t;return{x:n*n*n*e[0].x+3*n*n*t*e[1].x+3*n*t*t*e[2].x+t*t*t*e[3].x,y:n*n*n*e[0].y+3*n*n*t*e[1].y+3*n*t*t*e[2].y+t*t*t*e[3].y}}function iS(e){return e.controls?[{kind:"C",points:[e.start,e.controls[0],e.controls[1],e.end]}]:[{kind:"L",points:[e.start,e.end]}]}function sy(e){let t=0,n;for(const r of e)n&&(t+=Math.hypot(r.x-n.x,r.y-n.y)),n=r;return t}function sS(e,t){const n=[];for(const r of e){const o=Math.max(1,Math.ceil(sy(r.points)/t));for(let i=0;i<=o;i++){const s=i/o;if(r.kind==="L"){const[a,c]=r.points;n.push({x:a.x+(c.x-a.x)*s,y:a.y+(c.y-a.y)*s})}else n.push(oS(r.points,s))}}return n}function Pd(e,t,n,r){const o=e.flatMap(a=>a.points),i={x1:Math.min(...o.map(a=>a.x)),y1:Math.min(...o.map(a=>a.y)),x2:Math.max(...o.map(a=>a.x)),y2:Math.max(...o.map(a=>a.y))},s=[];if(n.forEach((a,c)=>{a.x1<=i.x2&&i.x1<=a.x2&&a.y1<=i.y2&&i.y1<=a.y2&&s.push(c)}),!s.length)return!0;for(const a of sS(e,eS))for(const c of s){const u=n[c],l=t[c];if(!(!u||!l)&&!(a.x<u.x1||a.x>u.x2||a.y<u.y1||a.y>u.y2)&&nS(a,l)<r)return!1}return!0}function aS(e){const t=e[0],n=e[e.length-1];if(!t||!n)return[];const r=[];for(let s=1;s<e.length;s++)r.push(sy(e.slice(s-1,s+1)));const o=[];let i=t;for(let s=1;s<e.length-1;s++){const a=e[s-1],c=e[s],u=e[s+1],l=r[s-1],d=r[s];if(!a||!c||!u||l===void 0||d===void 0)continue;const f=l/(s-1===0?1:2),p=d/(s===r.length-1?1:2),h=Math.min(Qe,f,p),m={x:(c.x-a.x)/l,y:(c.y-a.y)/l},y={x:(u.x-c.x)/d,y:(u.y-c.y)/d},$={x:c.x-m.x*h,y:c.y-m.y*h},w={x:c.x+y.x*h,y:c.y+y.y*h};o.push({kind:"L",points:[i,$]}),o.push({kind:"C",points:[$,{x:$.x+m.x*h*.55,y:$.y+m.y*h*.55},{x:w.x-y.x*h*.55,y:w.y-y.y*h*.55},w]}),i=w}return o.push({kind:"L",points:[i,n]}),o.filter(s=>s.kind==="C"||Math.hypot(s.points[1].x-s.points[0].x,s.points[1].y-s.points[0].y)>.01)}function cS(e){const t=o=>`${Xe(o.x)},${Xe(o.y)}`,n=e[0];if(!n)return"";let r=`M${t(n.points[0])}`;for(const o of e)r+=o.kind==="L"?` L${t(o.points[1])}`:` C${t(o.points[1])} ${t(o.points[2])} ${t(o.points[3])}`;return r}function Md(e,t,n,r,o){const i=Math.min(e.y,n)-Qe,s=Math.max(e.y,n)+Qe,a=d=>(d-e.x)*t;let c=1/0;for(const d of o)if(d.y1<e.y&&e.y<d.y2){const f=t===1?d.x1:d.x2,p=t===1?d.x2:d.x1;a(p)>0&&(c=Math.min(c,Math.max(0,a(f))))}const u=o.filter(d=>d.y1<s&&i<d.y2).map(d=>[a(t===1?d.x1:d.x2),a(t===1?d.x2:d.x1)]).filter(([,d])=>d>r).sort((d,f)=>d[0]-f[0]);let l=r;for(const[d,f]of[...u,[1/0,1/0]]){if(d>l+1){const p=Math.min(d,c);if(p<=l+1)return null;const h=Number.isFinite(p)&&p-l<80?(l+p)/2:l+40;return e.x+t*h}if(l=Math.max(l,f),l>=c)return null}return null}function uS(e){const t=[];for(const n of e){const r=t[t.length-1];r&&Math.abs(r.x-n.x)<.01&&Math.abs(r.y-n.y)<.01||t.push(n)}return t.filter((n,r)=>{if(r===0||r===t.length-1)return!0;const o=t[r-1],i=t[r+1];return!o||!i?!0:!(Math.abs(o.x-n.x)<.01&&Math.abs(i.x-n.x)<.01||Math.abs(o.y-n.y)<.01&&Math.abs(i.y-n.y)<.01)})}function lS(e,t,n,r,o,i=4){const s=Q$(e,t,n,r,i);if(!s||!o.length)return s;const a=o.map(f=>rS(f,gs));if(Pd(iS(s),o,a,gs))return s;const c=new Set([e.y,t.y]),u=f=>Math.abs(f-e.y)<Od?e.y:Math.abs(f-t.y)<Od?t.y:f;for(const f of a)c.add(u(Math.round(f.y1)-Qe-1)),c.add(u(Math.round(f.y2)+Qe+1));const l=t.x>=e.x?1:-1,d=[[l,l],[l,-l],[-l,l],[-l,-l]];for(const[f,p]of d){const h={x:e.x+f*(n+i),y:e.y},m={x:t.x-p*(r+i),y:t.y},y=[];for(const $ of c){const w=Math.abs($-h.y)<.01?h.x:Md(h,f,$,Qe,a);if(w===null)continue;const S=Math.abs($-m.y)<.01?m.x:Md(m,-p,$,Qe+Nd,a);if(S===null||Math.abs($-m.y)<.01&&(m.x-w)*p<Qe+Nd||Math.abs($-h.y)<.01&&(S-h.x)*f<Qe)continue;const T=uS([h,{x:w,y:h.y},{x:w,y:$},{x:S,y:$},{x:S,y:m.y},m]);if(!dS(T,a))continue;let O=(T.length-2)*Qe,C;for(const L of T)C&&(O+=Math.abs(L.x-C.x)+Math.abs(L.y-C.y)),C=L;y.push({points:T,length:O})}y.sort(($,w)=>{const S=$.points[2]?.y,T=w.points[2]?.y;return $.length-w.length||(S===void 0||T===void 0?0:S-T)});for(const $ of y){const w=aS($.points);if(!Pd(w,o,a,gs))continue;const S=$.points,T=S[0],O=S[S.length-1];if(!T||!O)continue;const C={x1:Math.min(...S.map(L=>L.x)),y1:Math.min(...S.map(L=>L.y)),x2:Math.max(...S.map(L=>L.x)),y2:Math.max(...S.map(L=>L.y))};return{kind:"routed",start:T,end:O,controls:null,d:cS(w),bounds:C}}}return s}function dS(e,t){let n;for(const r of e){if(n){const o={x1:Math.min(n.x,r.x),y1:Math.min(n.y,r.y),x2:Math.max(n.x,r.x),y2:Math.max(n.y,r.y)};for(const i of t)if(U$(o,i))return!1}n=r}return!0}function fS(e,t){if(!t)return bt.rest;const n=fe(t);return fe(e.from)===n||fe(e.to)===n?bt.related:bt.faded}function pS(){return{hit:{stroke:"transparent",width:16},line:{stroke:de("edge"),width:1.6},arrow:{fill:de("edge")}}}function hS(e,t,n){return e!=="gravity"&&e!=="tree"?null:{layout:e,id:t,pointerId:n}}function mS(e,t,n,r){return e!=="node"&&e!=="edge"&&e!=="canvas"||!Number.isFinite(r?.x)||!Number.isFinite(r?.y)?null:{kind:e,id:t??null,pointerId:n,start:{...r},moved:!1}}function gS(e,t,n,r=$$){if(!e||e.pointerId!==t)return e;const o=Math.hypot(n.x-e.start.x,n.y-e.start.y);return{...e,moved:e.moved||o>r}}function yS(e,t,n=!1){return!e||e.pointerId!==t||n||e.moved?null:e.kind==="node"?{type:"select-node",id:e.id}:e.kind==="edge"?{type:"select-edge",id:e.id}:e.kind==="canvas"?{type:"select-checked"}:null}function Rd(e){return e==="Enter"||e===" "}function _S(e,t){return{x:(e.x-t.x)/t.scale,y:(e.y-t.y)/t.scale}}function bS(e,t,n,r,o){return!t||t.pointerId!==n||!Object.hasOwn(e,t.id)?!1:(e[t.id]=_S(r,o),!0)}function wS(e,t){return e?.pointerId===t?null:e}function vS(e,t,n,r){const o=Math.min(t.width/n,t.height/r),i=t.left+(t.width-n*o)/2,s=t.top+(t.height-r*o)/2;return{x:(e.x-i)/o,y:(e.y-s)/o}}function kS(e,t){const n=new Map;let r=null,o=null,i=null;function s(f){if(f===e)return{kind:"canvas",id:null};const p=f;if(p?.closest?.("[data-canvas]"))return{kind:"canvas",id:null};const h=p?.closest?.("[data-node-id]");if(h)return{kind:"node",id:h.dataset.nodeId??null};const m=p?.closest?.("[data-edge-id]");return m?{kind:"edge",id:m.dataset.edgeId??null}:null}function a(f){if(f.pointerType==="mouse"&&f.button!==0)return;const p=s(f.target);if(!p)return;const h=t.point(f);if(n.set(f.pointerId,h),e.setPointerCapture(f.pointerId),p.kind!=="canvas"&&(f.preventDefault(),f.stopPropagation()),n.size===1){r=mS(p.kind,p.id,f.pointerId,{x:f.clientX,y:f.clientY}),o=p.kind==="canvas"?{point:h,transform:{...t.transform()}}:null;return}if(r&&(r={...r,moved:!0}),o=null,n.size===2){const[m,y]=[...n.values()];m&&y&&(i={distance:Math.hypot(y.x-m.x,y.y-m.y),scale:t.transform().scale},t.startPinch())}}function c(f){if(!n.has(f.pointerId))return;const p=t.point(f);if(n.set(f.pointerId,p),i){const[h,m]=[...n.values()];h&&m&&t.pinch(i,[h,m],f);return}if(r?.pointerId===f.pointerId){if(r=gS(r,f.pointerId,{x:f.clientX,y:f.clientY}),!r?.moved)return;if(r.kind==="node"){t.drag(r.id??"",f.pointerId,p,f);return}if(r.kind==="edge")return}o&&t.pan(o,p,f)}function u(f,p=!1){const h=yS(r,f.pointerId,p);h&&t.select(h),r?.pointerId===f.pointerId&&(r=null),t.endDrag(f.pointerId),n.delete(f.pointerId),n.size||(r=null,o=null,i=null),e.hasPointerCapture(f.pointerId)&&e.releasePointerCapture(f.pointerId)}const l=f=>u(f),d=f=>u(f,!0);return e.addEventListener("pointerdown",a,!0),e.addEventListener("pointermove",c),e.addEventListener("pointerup",l),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("pointerdown",a,!0),e.removeEventListener("pointermove",c),e.removeEventListener("pointerup",l),e.removeEventListener("pointercancel",d)}}function $S(e,t,n){let r=!1;function o(i,s=!1){r=i,e.classList.toggle("graph-panel--expanded",i),n.classList.toggle("graph-expanded",i),t.classList.toggle("expand-control--expanded",i),t.setAttribute("aria-expanded",String(i)),t.setAttribute("aria-label",i?"Close expanded graph":"Expand graph"),t.setAttribute("title",i?"Close expanded graph":"Expand graph"),i?(e.setAttribute("role","dialog"),e.setAttribute("aria-modal","true")):(e.removeAttribute("role"),e.removeAttribute("aria-modal"),s&&t.focus())}return{open(){o(!0)},close(i={}){o(!1,i.restoreFocus!==!1)},toggle(){o(!r,r)},isOpen(){return r}}}function ay(e){const t=String(e??"").toLowerCase();return t?t.charAt(0).toUpperCase()+t.slice(1):"Unknown"}function js(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:2}).format(e)}function Fs(e){return e==null?"Unavailable":new Intl.NumberFormat("en-US").format(e)}function wt(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return"Unavailable";const t=new Date(e<1e11?e*1e3:e);return!Number.isFinite(t.getTime())||t.getUTCFullYear()<2009||t.getUTCFullYear()>2100?"Unavailable":new Intl.DateTimeFormat("en-GB",{dateStyle:"medium",timeStyle:"short",timeZone:"UTC"}).format(t)}function cy(e,t=Date.now()){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return"Unavailable";const n=Math.max(0,(t-(e<1e11?e*1e3:e))/1e3),r=[[31536e3,"year"],[2592e3,"month"],[86400,"day"],[3600,"hour"],[60,"minute"]];for(const[o,i]of r){const s=Math.floor(n/o);if(s>=1)return`${s} ${i}${s===1?"":"s"} ago`}return"just now"}function Us(e){if(e.amount_usd_sum==null||e.price_coverage_ratio===0)return"Unavailable";const t=e.price_coverage_ratio;return js(e.amount_usd_sum)+(t!=null&&t>0&&t<1?" (priced portion)":"")}function SS(e){const t=[["Incoming amount (USD)",e.total_in_usd==null?"Unavailable":js(e.total_in_usd)],["Outgoing amount (USD)",e.total_out_usd==null?"Unavailable":js(e.total_out_usd)]];return e.role&&ro.includes(e.role)?[["Role",ry[e.role]||"Other"],...t,["Senders",Fs(e.degree_in)],["Receivers",Fs(e.degree_out)],["Labels",kt(e).join(", ")||"No labels"]]:[["Address risk",e.risk_score==null?"Not scored":`${Math.round(e.risk_score*100)} · ${ay(e.risk_level)}`],["Confidence","Unavailable"],...t,["First activity (UTC)",wt(e.first_activity_timestamp)],["Last activity (UTC)",wt(e.last_activity_timestamp)],["Labels",kt(e).join(", ")||"No labels"]]}function IS(e,t){if(e.source==="flows")return[["From",e.from||"Unavailable"],["To",e.to||"Unavailable"],["Value (USD)",Us(e)],["Transfers",Fs(e.tx_count)],["First seen (UTC)",wt(e.first_seen_timestamp)],["Last seen (UTC)",wt(e.last_seen_timestamp)],["Since last seen",cy(e.last_seen_timestamp,t)],...e.link_kind?[["Link kind",e.link_kind]]:[]];const n=e.price_coverage_ratio;return[["From",e.from||"Unavailable"],["To",e.to||"Unavailable"],["Value (USD)",Us(e)],["Price coverage",n==null?"Unavailable":new Intl.NumberFormat("en-GB",{style:"percent",maximumFractionDigits:1}).format(n)],["Transfers",e.tx_count==null?"Unavailable":String(e.tx_count)],["First seen (UTC)",wt(e.first_seen_timestamp)],["Last seen (UTC)",wt(e.last_seen_timestamp)],["First transaction",e.first_tx_id||"Unavailable"],["Last transaction",e.last_tx_id||"Unavailable"]]}function uy(e){return typeof e!="string"||!/^0x[a-fA-F0-9]{64}$/.test(e)?null:`https://robinhoodchain.blockscout.com/tx/${e.toLowerCase()}`}function Ld(e){const t=ss(e);if(e.role)return`${e.address}. ${t||"Other"}.${kt(e).length?` Labels: ${kt(e).join(", ")}.`:""}`;const n=e.risk_score==null?"Not scored":`${Math.round(e.risk_score*100)} ${ay(e.risk_level)} risk`,r=kt(e).join(", ");return`${e.address}. ${n}.${r?` Labels: ${r}.`:""}`}function Dd(e,t){const n=`${e.from} to ${e.to}. Aggregate value ${Us(e)}. ${e.tx_count??0} ${e.tx_count===1?"transfer":"transfers"}.`;return e.source==="flows"&&e.last_seen_timestamp?`${n} Last seen ${cy(e.last_seen_timestamp,t)}.`:n}function xS(e,t){return He(e).nodes.map(n=>{const r={id:n.address,label:kt(n).join(", ")||ss(n)};n.role&&(r.role=n.role);const o=t?.(n.address);return o&&(r.href=o),r})}let zS=0;function pe(e,t={}){const n=document.createElementNS(w$,e);for(const[r,o]of Object.entries(t))n.setAttribute(r,String(o));return n}function TS(e,t,n){const r=pe("text",{x:0,y:t,"text-anchor":"middle",class:n,"pointer-events":"none"});return r.textContent=e,r}function ES(e,t=22){return e.length>t?`${e.slice(0,t-1)}…`:e}function CS(e,t,n={}){const r=`cia-graph-${++zS}`,o=e.ownerDocument;let i=He(t),s=n.layout??(bl(t)?"tree":"gravity");const a={width:e.clientWidth||n.width||820,height:e.clientHeight||n.height||430};let c=yo(i,s,a.width,a.height);const u=new Map,l=()=>{const k=new Map,x=new Map(i.nodes.map(N=>[N.address,N])),A=tS(i,c,u);for(const N of i.edges){const J=x.get(N.from),W=x.get(N.to),ce=J&&c[J.id],Pe=W&&c[W.id];if(!J||!W||!ce||!Pe){k.set(N.id,null);continue}const it=A.filter(At=>At.id!==J.id&&At.id!==W.id);k.set(N.id,lS(ce,Pe,Zs(J,i.checked_address),Zs(W,i.checked_address),it))}return k},d=()=>{const k=F$(i,c,u);if(!k)return null;for(const x of l().values())x?.bounds&&(k.x1=Math.min(k.x1,x.bounds.x1),k.y1=Math.min(k.y1,x.bounds.y1),k.x2=Math.max(k.x2,x.bounds.x2),k.y2=Math.max(k.y2,x.bounds.y2));return k},f=()=>{const k=d();return k?G$(k,a.width,a.height,Gn):{x:0,y:0,scale:1}};let p=f(),h=null,m=null;const y=n.now??(()=>Date.now());e.classList.add("cia-graph-engine"),e.closest(".cia-graph-surface")||e.classList.add("cia-graph-surface");const $=pe("svg",{class:"cia-graph-svg",viewBox:`0 0 ${a.width} ${a.height}`,role:"group",tabindex:0,"aria-label":n.label??"Money-flow graph. Drag the background or use arrow keys to pan, plus and minus to zoom. Select an address or a link for details."}),w=pe("defs"),S=pe("pattern",{id:`${r}-dots`,width:24,height:24,patternUnits:"userSpaceOnUse"});S.append(pe("circle",{class:"cia-graph-dot",cx:1,cy:1,r:1})),w.append(S);const T=pe("rect",{class:"cia-graph-backdrop",width:"100%",height:"100%","data-canvas":""}),O=pe("rect",{class:"cia-graph-dots",width:"100%",height:"100%",fill:`url(#${r}-dots)`,"data-canvas":""}),C=pe("g",{"data-viewport":""}),L=pe("g",{"data-edges":"",class:"cia-graph-edges"}),ue=pe("g",{"data-nodes":"",class:"cia-graph-nodes"});C.append(L,ue),$.append(w,T,O,C);const Q=o.createElement("div");Q.className="graph-tooltip cia-graph-tooltip",Q.hidden=!0,Q.setAttribute("role","tooltip"),e.append($,Q);const le=new Map,xe=new Map,$e=new Map;function We(k){let x=le.get(k);if(x)return x;x=`${r}-arrow-${le.size}`;const A=pe("marker",{id:x,viewBox:"0 0 10 10",refX:9,refY:5,markerWidth:6,markerHeight:6,orient:"auto-start-reverse",markerUnits:"strokeWidth"}),N=pe("path",{d:"M0 0L10 5L0 10Z",class:"cia-graph-arrowhead"});return N.style.fill=k,A.append(N),w.append(A),le.set(k,x),x}const Nn=()=>new Map(i.nodes.map(k=>[k.address,k])),rt=k=>n.nodeStyle?.(k).stroke??D$(k);function zt(){L.replaceChildren(),ue.replaceChildren(),xe.clear(),$e.clear();const k=Nn();for(const x of i.edges){const A=k.get(x.from);if(!A||!k.get(x.to))continue;const N=rt(A),J=pe("g",{class:"cia-graph-edge graph-edge",tabindex:0,role:"button","aria-label":Dd(x,y())});J.dataset.edgeId=x.id,J.style.setProperty("--edge-tone",N);const W=pS(),ce=pe("path",{class:"cia-graph-edge-hit","stroke-width":W.hit.width,"pointer-events":"stroke"}),Pe=pe("path",{class:"cia-graph-edge-line","stroke-width":W.line.width,"marker-end":`url(#${We(N)})`,"pointer-events":"none"});J.append(ce,Pe),J.addEventListener("keydown",it=>{Rd(it.key)&&(it.preventDefault(),mt(x.id))}),J.addEventListener("pointerenter",it=>zl(it,Dd(x,y()))),J.addEventListener("pointerleave",Tl),L.append(J),$e.set(x.id,{group:J,hit:ce,line:Pe})}for(const x of oo(i))ue.append(On(x));ot(),V()}function On(k){const x=k.address===i.checked_address,A=u.get(k.id),N=io(k,i.checked_address,A),J=N.radius,W=pe("g",{class:"cia-graph-node graph-node",tabindex:0,role:"button","aria-label":Ld(k),"aria-pressed":"false"});W.dataset.nodeId=k.id,x&&(W.dataset.checked=""),W.style.setProperty("--node-tone",rt(k)),x&&W.append(pe("circle",{class:"cia-graph-node-ring",r:J+6})),W.append(pe("circle",{class:"cia-graph-node-body",r:J})),W.append(pe("circle",{class:"cia-graph-node-dot",r:N.dot}));for(const ce of N.texts)W.append(TS(ce.text,ce.y,`cia-graph-node-${ce.kind}`));return A&&(W.dataset.state="refused"),W.addEventListener("keydown",ce=>{Rd(ce.key)&&(ce.preventDefault(),Oe(k.id))}),W.addEventListener("pointerenter",ce=>zl(ce,Ld(k))),W.addEventListener("pointerleave",Tl),xe.set(k.id,W),W}function ot(){C.setAttribute("transform",`translate(${p.x} ${p.y}) scale(${p.scale})`);for(const[x,A]of xe){const N=c[x]??{x:a.width/2,y:a.height/2};A.setAttribute("transform",`translate(${Xe(N.x)} ${Xe(N.y)})`)}const k=l();for(const x of i.edges){const A=$e.get(x.id);if(!A)continue;const N=k.get(x.id)??null;A.group.style.display=N?"":"none",N&&(A.hit.setAttribute("d",N.d),A.line.setAttribute("d",N.d))}}function K(){return h?.kind!=="node"?null:i.nodes.find(k=>k.id===h.id)?.address??null}function V(){const k=K();for(const x of i.edges){const A=$e.get(x.id);if(!A)continue;const N=h?.kind==="edge"&&h.id===x.id,J=h?.kind==="edge"?N?bt.related:bt.faded:fS(x,k),W=J===bt.faded;A.group.setAttribute("opacity",W?String(J):"1"),A.line.setAttribute("stroke-opacity",W?"1":String(J)),A.group.dataset.opacity=String(J),A.group.dataset.state=J===bt.rest?"rest":J===bt.related?"related":"faded",A.group.setAttribute("aria-pressed",String(N))}for(const[x,A]of xe){const N=h?.kind==="node"&&h.id===x;A.classList.toggle("is-selected",N),A.setAttribute("aria-pressed",String(N))}}function _e(){const k=xS(i,n.href),x=h?.kind==="node"?i.nodes.find(N=>N.id===h.id)??null:null,A=h?.kind==="edge"?i.edges.find(N=>N.id===h.id)??null:null;if(x){const N=i.edges.filter(J=>J.from===x.address||J.to===x.address);return{kind:"node",id:x.id,selectedId:x.address,nodes:k,title:"Selected address",identity:x.address,values:SS(x),related:N,node:x,edge:null}}return A?{kind:"edge",id:A.id,selectedId:null,nodes:k,title:"Selected aggregate flow",identity:`${A.from} → ${A.to}`,values:IS(A,y()),related:[A],node:null,edge:A}:{kind:null,id:null,selectedId:null,nodes:k,title:"Nothing selected",identity:"",values:[],related:[],node:null,edge:null}}function ae(){const k=_e();Bt(k),n.onSelect?.(k)}function Bt(k){const x=n.selectionRoot,A=x?.querySelector("[data-selection-title]"),N=x?.querySelector("[data-selection-identity]"),J=x?.querySelector("[data-selection-meta]");!A||!N||!J||(A.textContent=k.title,N.textContent=k.identity,J.replaceChildren(...k.values.map(([W,ce])=>{const Pe=o.createElement("div");Pe.className="meta-item",ce!=="Unavailable"&&(["From","To","First transaction","Last transaction"].includes(W)&&Pe.classList.add("meta-item--identity"),W==="Incoming amount (USD)"&&Pe.classList.add("meta-item--incoming"),W==="Outgoing amount (USD)"&&Pe.classList.add("meta-item--outgoing")),["From","To","First transaction","Last transaction","Labels"].includes(W)&&Pe.classList.add("meta-item--wide");const it=o.createElement("span");it.textContent=W;const At=o.createElement("strong"),Mn=["First transaction","Last transaction"].includes(W)?uy(ce):null;if(Mn&&n.openLink){const gt=n.openLink,Nt=o.createElement("button");Nt.type="button",Nt.className="cia-graph-explorer-link",Nt.dataset.explorer=Mn,Nt.textContent=ce,Nt.setAttribute("aria-label",`${W}: ${ce} (opens the explorer)`),Nt.addEventListener("click",()=>gt(Mn)),At.append(Nt)}else if(Mn){const gt=o.createElement("a");gt.href=Mn,gt.target="_blank",gt.rel="noopener noreferrer",gt.textContent=ce,gt.setAttribute("aria-label",`${W}: ${ce} (opens in new tab)`),At.append(gt)}else At.textContent=ce;return Pe.append(it,At),Pe})))}function Oe(k){h=k?{kind:"node",id:k}:null,V(),ae()}function mt(k){h=k?{kind:"edge",id:k}:null,V(),ae()}function Kt(k){if(k==null)return Oe(null);const x=Io(i,k);if(x)return Oe(x);if(i.edges.some(A=>A.id===k))return mt(k)}function Tt(){p=f(),ot()}function Et(k,x={x:a.width/2,y:a.height/2}){const A=Ds(p.scale*(1+k)),N=A/p.scale;p={x:x.x-(x.x-p.x)*N,y:x.y-(x.y-p.y)*N,scale:A},ot()}function xl(k){s=k,n.controls?.querySelectorAll("[data-layout]").forEach(x=>{x.classList.toggle("active",x.dataset.layout===k),x.setAttribute("aria-pressed",String(x.dataset.layout===k))}),n.onLayoutChange?.(k),c=yo(i,s,a.width,a.height),Tt()}function zl(k,x){Q.textContent=x,Q.hidden=!1;const A=e.getBoundingClientRect();Q.style.left=`${Math.min(A.width-330,Math.max(8,k.clientX-A.left+12))}px`,Q.style.top=`${Math.max(8,k.clientY-A.top+12)}px`}function Tl(){Q.hidden=!0}function El(k){return vS({x:k.clientX,y:k.clientY},$.getBoundingClientRect(),a.width,a.height)}const Ey=kS($,{point:El,transform:()=>p,select(k){k.type==="select-node"?Oe(k.id):k.type==="select-edge"?mt(k.id):Oe(vl(i)?.id??null)},drag(k,x,A){!m&&(m=hS(s,k,x),!m)||bS(c,m,x,A,p)&&ot()},endDrag(k){m=wS(m,k)},pan(k,x){p={x:k.transform.x+x.x-k.point.x,y:k.transform.y+x.y-k.point.y,scale:p.scale},ot()},startPinch(){m=null},pinch(k,[x,A]){const N=Math.hypot(A.x-x.x,A.y-x.y),J=Ds(k.scale*N/Math.max(1,k.distance));Et(J/p.scale-1,{x:(x.x+A.x)/2,y:(x.y+A.y)/2})}}),Cl=k=>{k.preventDefault(),Et(k.deltaY>0?-.12:.12,El(k))},Cy={ArrowLeft:[60,0],ArrowRight:[-60,0],ArrowUp:[0,60],ArrowDown:[0,-60]},Al=k=>{if(k.target!==$)return;const x=Cy[k.key];x?(k.preventDefault(),p={...p,x:p.x+x[0],y:p.y+x[1]},ot()):k.key==="+"||k.key==="="?Et(.18):k.key==="-"?Et(-.18):k.key==="0"&&Tt()};$.addEventListener("wheel",Cl,{passive:!1}),$.addEventListener("keydown",Al);const cs=n.controls?.querySelector("[data-expand]")??null,Ct=n.panel&&cs?$S(n.panel,cs,o.body):null,Ay=()=>{Ct?.toggle(),n.onExpansionChange?.(Ct?.isOpen()??!1),requestAnimationFrame(Tt)},Nl=n.panel??e,Ol=k=>{if(k.key==="Tab"&&Ct?.isOpen()&&n.panel){const x=Array.from(n.panel.querySelectorAll('button,a[href],[tabindex="0"],summary')).filter(J=>J.checkVisibility()),A=x[0],N=x.at(-1);k.shiftKey&&o.activeElement===A?(k.preventDefault(),N?.focus()):!k.shiftKey&&o.activeElement===N&&(k.preventDefault(),A?.focus())}if(k.key==="Escape"){if(Ct?.isOpen()){Ct.close(),n.onExpansionChange?.(!1),requestAnimationFrame(Tt);return}Oe(null)}};Nl.addEventListener("keydown",Ol);const Pl=[],Pn=(k,x)=>{k&&(k.addEventListener("click",x),Pl.push([k,x]))};n.controls?.querySelectorAll("[data-layout]").forEach(k=>Pn(k,()=>xl(k.dataset.layout==="tree"?"tree":"gravity"))),Pn(n.controls?.querySelector("[data-zoom='in']"),()=>Et(.18)),Pn(n.controls?.querySelector("[data-zoom='out']"),()=>Et(-.18)),Pn(n.controls?.querySelector("[data-zoom='fit']"),Tt),Ct&&Pn(cs,Ay);const Ml=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>{const k=e.clientWidth,x=e.clientHeight;!k||!x||k===a.width&&x===a.height||(a.width=k,a.height=x,$.setAttribute("viewBox",`0 0 ${k} ${x}`),Tt())});return Ml?.observe(e),zt(),n.selected&&Kt(n.selected),{update(k){const x=c;i=He(k);const A=yo(i,s,a.width,a.height);c=Object.fromEntries(i.nodes.map(N=>[N.id,x[N.id]??A[N.id]]).filter(([,N])=>N)),h&&!(h.kind==="node"?i.nodes.some(N=>N.id===h.id):i.edges.some(N=>N.id===h.id))&&(h=null),p=f(),zt()},merge(k,x){const A=P$(i,k,x);i=A.model;const N=Io(i,x??He(k).checked_address);return c=N?W$(i,c,N,A.added,{notes:u}):{...c,...yo(i,s,a.width,a.height),...c},A.added.length&&(p=f()),zt(),A.added},setTheme(k){k&&o.documentElement.setAttribute("data-theme",k);for(const x of i.nodes)xe.get(x.id)?.style.setProperty("--node-tone",rt(x))},select:Kt,destroy(){Ml?.disconnect(),Ey(),$.removeEventListener("wheel",Cl),$.removeEventListener("keydown",Al),Nl.removeEventListener("keydown",Ol);for(const[k,x]of Pl)k.removeEventListener("click",x);Ct?.close({restoreFocus:!1}),$.remove(),Q.remove(),e.classList.remove("cia-graph-engine")},fit:Tt,zoom:k=>Et(k),setLayout:xl,markNode(k,x){const A=Io(i,k);A&&(x?u.set(A,x):u.delete(A),zt())},positions:()=>structuredClone(c),model:()=>i,contentBounds:()=>d(),transform:()=>({...p})}}const ly="chain-insights.flows.v1",dy="chain-insights.result.v1",AS=60,Zd=6,NS=3,fy=/^0x[0-9a-fA-F]{40}$/,OS=/^0x[0-9a-fA-F]{64}$/;function PS(e){return typeof e=="string"&&(fy.test(e)||OS.test(e))}function Lo(e){return typeof e=="string"&&fy.test(e)}function Vs(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function py(e){const t=e?.facts?.query?.results;return Array.isArray(t)?t.filter(Vs):[]}function MS(e){const t=e?.facts;return typeof t?.subject?.network=="string"&&t.subject.network?t.subject.network:"robinhood"}function et(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&/^-?\d+(\.\d+)?([eE][-+]?\d+)?$/.test(e.trim())){const t=Number(e);return Number.isFinite(t)?t:null}return null}function Sl(e){return e<1e11?e*1e3:e}const qs=/^\d{4}-\d{2}-\d{2}$/,RS=Date.UTC(2009,0,1),LS=Date.UTC(2100,0,1);function ys(e){return new Date(Sl(e)).toISOString().slice(0,10)}function jd(e){const t=Date.parse(`${e}T00:00:00Z`);return new Date(t-864e5).toISOString().slice(0,10)}function DS(e){return typeof e=="string"&&qs.test(e)&&Number.isFinite(Date.parse(`${e}T00:00:00Z`))}const ZS=new Set(["day","date"]);function Fd(e){return ZS.has(e)||e.endsWith("_timestamp")}function jS(e){const t=[];for(const n of e)for(const r of Object.keys(n))t.includes(r)||t.push(r);return t}function FS(e){return Array.isArray(e)?e.some(Lo):Lo(e)}function US(e){return e.some(t=>Object.values(t).some(FS))}function VS(e){return e.length>0&&e.every(t=>Lo(t.from_address)&&Lo(t.to_address))}function Ud(e){if(typeof e=="string"){const r=e.trim();if(qs.test(r)||/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}/.test(r)){const o=Date.parse(qs.test(r)?`${r}T00:00:00Z`:/(?:Z|[+-]\d{2}:?\d{2})$/.test(r)?r.replace(" ","T"):`${r.replace(" ","T")}Z`);return Number.isFinite(o)?o:null}}const t=et(e);if(t==null)return null;const n=Sl(t);return n>=RS&&n<LS?n:null}function hy(e){if(e.length===0||US(e))return null;const t=jS(e),r=t.filter(Fd).find(c=>e.some(u=>Ud(u[c])!=null));if(!r)return null;const o=t.filter(c=>{if(Fd(c))return!1;const u=e.map(l=>l[c]).filter(l=>l!=null);return u.length>0&&u.every(l=>et(l)!=null)});if(o.length===0)return null;const i=e.map((c,u)=>({time:Ud(c[r]),row:c,index:u})).filter(c=>c.time!=null).sort((c,u)=>c.time-u.time||c.index-u.index),s=o.slice(0,Zd);return new Set(i.filter(c=>s.some(u=>et(c.row[u])!=null)).map(c=>c.time)).size<NS?null:{xColumn:r,times:i.map(c=>c.time),daily:i.every(c=>c.time%864e5===0),series:s.map(c=>({column:c,values:i.map(u=>et(u.row[c]))})),omittedColumns:o.slice(Zd),skippedRows:e.length-i.length}}function qS(e){return VS(e)?"graph":hy(e)?"chart":"table"}const HS=[["sanctioned","sanctioned"],["scam","scam"],["victim","victim"],["pool","pool"],["exchange","exchange"]];function Vd(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.trim()!=="").map(t=>t.trim()):[]}function BS(e,t){if(t)return"exchange";const n=new Set(e.map(r=>r.replace(/\s+/g,"").toLowerCase()));for(const[r,o]of HS)if(n.has(r))return o;return"other"}const qd=(e,t)=>e==null?t:t==null?e:e+t;function KS(e,t="robinhood"){const n=new Map;for(const d of e)for(const f of new Set([String(d.from_address).toLowerCase(),String(d.to_address).toLowerCase()]))n.set(f,(n.get(f)??0)+1);let r="",o=0;for(const[d,f]of n)f>o&&(r=d,o=f);const i=new Map,s=new Map,a=(d,f,p)=>{const h=i.get(d)??{address:d,labels:[],exchange:!1};for(const m of f)h.labels.some(y=>y.toLowerCase()===m.toLowerCase())||h.labels.push(m);h.exchange=h.exchange||p,i.set(d,h)};r&&i.set(r,{address:r,labels:[],exchange:!1});let c=0;for(const d of e){const f=String(d.from_address).toLowerCase(),p=String(d.to_address).toLowerCase(),h=[f,p].filter((S,T,O)=>!i.has(S)&&O.indexOf(S)===T).length;if(i.size+h>AS||(c++,a(f,Vd(d.from_labels),d.from_is_exchange===!0),a(p,Vd(d.to_labels),d.to_is_exchange===!0),f===p))continue;const m=`${f}->${p}`,y=s.get(m)??{from:f,to:p,usd:null,tx:null,first:null,last:null,kinds:[]};y.usd=qd(y.usd,et(d.amount_usd_sum)),y.tx=qd(y.tx,et(d.tx_count));const $=et(d.first_seen_timestamp),w=et(d.last_seen_timestamp);$!=null&&(y.first=y.first==null?$:Math.min(y.first,$)),w!=null&&(y.last=y.last==null?w:Math.max(y.last,w)),typeof d.link_kind=="string"&&d.link_kind&&!y.kinds.includes(d.link_kind)&&y.kinds.push(d.link_kind),s.set(m,y)}const u=[...i.values()].map(d=>({address:d.address,role:BS(d.labels,d.exchange),labels:d.labels})),l=[...s.values()].map(d=>({from:d.from,to:d.to,usd:d.usd,tx_count:d.tx,first_seen_ms:d.first,last_seen_ms:d.last,...d.kinds.length?{link_kind:d.kinds.join(", ")}:{}}));return{view:{schema:ly,network:t,center:r,nodes:u,edges:l,truncated:!1},rowsTotal:e.length,rowsDrawn:c,rowsLeftOut:e.length-c,addresses:i.size}}function JS(e){const t=e?.facts?.queries;return Array.isArray(t)?t.filter(Vs).map((n,r)=>({id:typeof n.id=="string"&&n.id?n.id:`Query ${r+1}`,ok:n.ok!==!1&&n.error==null,error:typeof n.error=="string"&&n.error?n.error:null,rows:Array.isArray(n.results)?n.results.filter(Vs):[],count:typeof n.count=="number"?n.count:null,truncated:n.truncated===!0,elapsedMs:typeof n.elapsed_ms=="number"?n.elapsed_ms:null})):[]}const Hd=200;function so(e){return(e?.content??[]).filter(t=>t?.type==="text"&&typeof t.text=="string").map(t=>t.text).join(`
|
|
109
|
-
`).trim()}function Rn(e){if(typeof e=="string")return e.trim()||null;if(!e||typeof e!="object"||Array.isArray(e))return null;const{code:t,message:n,detail:r,error:o}=e,i=[n,r,o].find(a=>typeof a=="string"&&a.trim()!=="")?.trim()??null,s=typeof t=="string"&&t.trim()?t.trim():null;return i?s&&!i.startsWith(s)?`${s}: ${i}`:i:s}function my(e){if(!e)return null;const t=e.structuredContent,n=Rn(t?.error)??Rn(t?.facts?.error)??Rn(t?.facts?.query?.error);if(!e.isError||n)return n;const r=so(e);if(r.startsWith("{"))try{const o=JSON.parse(r),i=Rn(o?.error)??Rn(o);if(i)return i}catch{}return r||"The tool answered with an error."}const WS=new Set(["usage_status","subscription_status","meta_usage_status","meta_subscription_status"]);function gy(e){if(!e||my(e)!=null)return"text";const t=e.structuredContent;if(t?.schema===ly)return"flows";if(t?.schema===dy){if(t.tool==="graph_query")return qS(py(t));if(t.tool==="graph_query_batch")return Array.isArray(t.facts?.queries)&&t.facts.queries.length>0?"batch":"text";if(typeof t.tool=="string"&&WS.has(t.tool))return"balance"}return"text"}function z(e,t,n={},...r){const o=e.createElement(t);for(const[i,s]of Object.entries(n))s==null||s===!1||(i==="class"?o.className=String(s):i==="text"?o.textContent=String(s):o.setAttribute(i,s===!0?"":String(s)));for(const i of r)i==null||i===!1||o.append(typeof i=="string"?e.createTextNode(i):i);return o}function GS(e,t){const n=z(e,"code",{class:"cv-addr",title:t,"data-full":t,text:Re(t)}),r=z(e,"button",{type:"button",class:"cv-copy","data-copy":t,"aria-label":`Copy ${t}`,title:"Copy the full value",text:"Copy"});return r.addEventListener("click",()=>{YS(e,t,n,r)}),z(e,"span",{class:"cv-addr-cell"},n,r)}async function YS(e,t,n,r){const o=e.defaultView?.navigator?.clipboard;try{if(o?.writeText)return await o.writeText(t),r&&(r.textContent="Copied"),"copied"}catch{}return n.textContent=t,n.classList.add("is-full"),e.getSelection?.()?.selectAllChildren(n),r&&(r.textContent="Selected"),"selected"}function QS(e,t){return/(timestamp|seen|_at|_ms|time)$/i.test(t)&&e>1e9?wt(e):/usd/i.test(t)?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:2}).format(e):new Intl.NumberFormat("en-US",{maximumFractionDigits:4}).format(e)}const XS=160,Bd=2e3;function e0(e,t=XS){const n=e.trim().split(/\r?\n/,1)[0]??"",r=n.search(/[.!?](?=\s|$)/),o=(r<0?n:n.slice(0,r+1)).trim();if(o.length<=t)return o;const i=o.slice(0,t-1),s=i.lastIndexOf(" ");return`${(s>t*.6?i.slice(0,s):i).trimEnd()}…`}function yy(e,t,n){const r=e.ownerDocument,o=n.full!=null&&n.full.length>Bd?`${n.full.slice(0,Bd-1)}…`:n.full,i=o!=null&&o!==t,s=z(r,"section",{class:`cia-graph-surface cv-notice cv-notice-${n.kind}`,"data-view":n.view,"data-notice":n.kind,role:n.kind==="refused"?"alert":"status",title:i?o:null},i?z(r,"details",{class:"cv-notice-more"},z(r,"summary",{class:"cv-notice-line",text:t}),z(r,"p",{class:"cv-notice-full",text:o})):z(r,"p",{class:"cv-notice-line",text:t}));return e.replaceChildren(s),s}function t0(e){const t=e?.facts?.query,n=Array.isArray(t?.results)?t.results.filter(i=>!!i&&typeof i=="object"&&!Array.isArray(i)):[],r=n.slice(0,Hd),o=[];for(const i of r)for(const s of Object.keys(i))o.includes(s)||o.push(s);return{columns:o,rows:r,total:n.length,truncated:n.length>Hd||t?.truncated===!0,elapsedMs:typeof t?.elapsed_ms=="number"?t.elapsed_ms:null}}function n0(e,t,n){return t==null?z(e,"span",{class:"cv-null","aria-label":"empty",text:"—"}):PS(t)?GS(e,t):typeof t=="number"?e.createTextNode(QS(t,n)):typeof t=="boolean"?e.createTextNode(t?"yes":"no"):Array.isArray(t)?e.createTextNode(t.map(r=>typeof r=="string"?r:JSON.stringify(r)).join(", ")):typeof t=="object"?e.createTextNode(JSON.stringify(t)):e.createTextNode(String(t))}function Kd(e,t,n={}){const r=e.ownerDocument,o=t0(t.structuredContent),i=o.rows.length;if(o.total===0)return yy(e,"No rows.",{kind:"empty",view:"table"}),o;const s=`${new Intl.NumberFormat("en-US").format(i)} ${i===1?"row":"rows"}${o.elapsedMs==null?"":` in ${o.elapsedMs} ms`}`,a=z(r,"table",{class:"cv-table"},z(r,"thead",{},z(r,"tr",{},...o.columns.map(c=>z(r,"th",{scope:"col",text:c})))),z(r,"tbody",{},...o.rows.map(c=>z(r,"tr",{},...o.columns.map(u=>z(r,"td",{},n0(r,c[u],u)))))));return e.replaceChildren(z(r,"section",{class:"cv-card cv-table-view","data-view":"table","aria-label":"Graph query result"},z(r,"header",{class:"cv-card-head"},z(r,"strong",{text:"Graph query result"}),z(r,"span",{class:"cv-muted",text:s}),n.toggle??null),o.truncated?z(r,"p",{class:"cv-note",role:"note","data-truncated":"",text:`Truncated: showing the first ${new Intl.NumberFormat("en-US").format(i)} of ${new Intl.NumberFormat("en-US").format(o.total)} rows. Narrow the query to see the rest.`}):null,o.columns.length?z(r,"div",{class:"cv-table-wrap"},a):null)),o}const Ln=(e,t=0)=>typeof e=="number"&&Number.isFinite(e)?e:t,_o=e=>typeof e=="string"&&e?e:null;function r0(e){const t=e?.facts??{};if(typeof t.wallet=="string"&&t.wallet)return{kind:"wallet",wallet:t.wallet,tier:String(t.tier??"anonymous"),allowanceUsd:Ln(t.allowance_usd),consumedUsd:Ln(t.consumed_usd),windowEnd:_o(t.window_end)};const n=t.usage;if(n&&typeof n=="object"){const r="daily_units_limit"in n||"daily_units_used"in n,o=_o(n.access_mode);return{kind:"free",unit:r?"units":"seconds",used:Ln(r?n.daily_units_used:n.daily_seconds_used),limit:Ln(r?n.daily_units_limit:n.daily_seconds_limit),remaining:Ln(r?n.remaining_units:n.remaining_seconds),resetAt:_o(n.reset_at),identifierKind:_o(n.identifier_kind),accessMode:o,noLimit:!r&&o==="public_free"&&n.daily_seconds_limit===0}}return{kind:"unknown"}}const Jd=e=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:2}).format(e),bo=(e,t)=>`${new Intl.NumberFormat("en-US").format(e)} ${t==="units"?e===1?"unit":"units":e===1?"second":"seconds"}`;function _s(e){if(!e)return"No active window";const t=Date.parse(e);return Number.isFinite(t)?`${wt(t)} UTC`:e}function Wd(e,t,n,r){const o=n>0?Math.min(1,t/n):0,i=z(e,"div",{class:"cv-meter",role:"meter","aria-label":r,"aria-valuemin":0,"aria-valuemax":n,"aria-valuenow":Math.min(t,n)},z(e,"span"));return i.firstElementChild.style.width=`${Math.round(o*100)}%`,i}function bs(e,t){return z(e,"dl",{class:"cv-facts"},...t.flatMap(([n,r])=>[z(e,"dt",{text:n}),z(e,"dd",{text:r})]))}function o0(e,t){const n=e.ownerDocument,r=r0(t.structuredContent);let o,i,s;return r.kind==="wallet"?(i="Wallet allowance",s=`${Re(r.wallet)} · ${r.tier==="subscriber"?"Subscriber":"No active subscription"}`,o=[Wd(n,r.consumedUsd,r.allowanceUsd,"Share of today's allowance used"),bs(n,[["Daily allowance",Jd(r.allowanceUsd)],["Used today",Jd(r.consumedUsd)],["Window ends",_s(r.windowEnd)]])]):r.kind==="free"?(i="Free tier",s=`No wallet · counted per ${r.identifierKind==="ip"||!r.identifierKind?"network address":r.identifierKind}`,o=r.noLimit?[z(n,"p",{class:"cv-balance-note","data-no-limit":"",text:"Free access, no daily limit"}),bs(n,[["Daily allowance","No daily limit"],["Used today",bo(r.used,r.unit)],["Window ends",_s(r.resetAt)]])]:[Wd(n,r.used,r.limit,"Share of today's free allowance used"),bs(n,[["Daily allowance",bo(r.limit,r.unit)],["Used today",bo(r.used,r.unit)],["Left today",bo(r.remaining,r.unit)],["Window ends",_s(r.resetAt)]])]):(i="Usage",s="The server sent no allowance figures.",o=[z(n,"p",{class:"cv-muted",text:so(t)||"Nothing to show."})]),e.replaceChildren(z(n,"section",{class:"cv-card cv-balance-view","data-view":"balance","data-balance":r.kind,"aria-label":i},z(n,"header",{class:"cv-card-head"},z(n,"strong",{text:i}),z(n,"span",{class:"cv-muted",text:s})),...o)),r}function as(e,t,n="No drawing for this answer."){const r=e.ownerDocument,o=my(t);if(o!=null){yy(e,e0(o),{kind:"refused",view:"text",full:o});return}const i=so(t);e.replaceChildren(z(r,"section",{class:"cv-card cv-text-view","data-view":"text"},z(r,"p",{text:n}),i?z(r,"p",{class:"cv-muted cv-text-body",text:i.length>600?`${i.slice(0,599)}…`:i}):null))}function _y(e,t="Loading the Chain Insights view"){const n=e.ownerDocument;e.replaceChildren(z(n,"section",{class:"cv-card cv-skeleton","data-view":"loading","aria-busy":"true","aria-label":t},z(n,"span",{class:"cv-sr",text:t}),z(n,"div",{class:"cv-skel-line cv-skel-title"}),z(n,"div",{class:"cv-skel-line cv-skel-sub"}),z(n,"div",{class:"cv-skel-block"})))}const i0="http://www.w3.org/2000/svg",s0=720,a0=6,wo={left:66,right:18,top:6},Gd=18,c0=16,u0=26,l0=170,d0=82,f0=80;function by(e,t){const n=new Date(e).toISOString();return t?n.slice(0,10):`${n.slice(0,10)} ${n.slice(11,16)}`}const p0=new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:2}),wy=new Intl.NumberFormat("en-US",{maximumFractionDigits:6});function Yd(e){return Math.abs(e)<1e3?wy.format(Math.round(e*100)/100):p0.format(e)}function h0(e,t=s0){const n=wo.left,r=t-wo.right,o=r-n,i=e.times[0]??0,s=e.times[e.times.length-1]??i,a=s-i,c=p=>a>0?n+(p-i)/a*o:n+o/2,u=e.series.length===1?l0:d0,l=e.series.map((p,h)=>{const m=wo.top+h*(Gd+u+c0),y=m+Gd,$=y+u,w=p.values.filter(Q=>Q!=null),S=Math.min(0,...w),T=Math.max(...w,S+1e-9),O=Q=>$-(Q-S)/(T-S||1)*u,C=[],L=[];let ue=[];return p.values.forEach((Q,le)=>{if(Q==null){ue.length&&L.push(ue),ue=[];return}const xe={x:c(e.times[le]??i),y:O(Q),time:e.times[le]??i,value:Q};C.push(xe),ue.push(xe)}),ue.length&&L.push(ue),{column:p.column,color:`var(--cia-graph-series-${h%a0+1})`,top:m,plotTop:y,plotBottom:$,min:S,max:T,runs:L,points:C}}),d=(l[l.length-1]?.plotBottom??wo.top)+6,f=[];if(e.times.length){const p=a>0?[[i,"start"],[i+a/2,"middle"],[s,"end"]]:[[i,"middle"]];for(const[h,m]of p)f.push({x:c(h),label:by(h,e.daily),anchor:m})}return{width:t,height:d+u0,plotLeft:n,plotRight:r,lanes:l,ticks:f,axisY:d}}function Me(e,t,n={}){const r=e.createElementNS(i0,t);for(const[o,i]of Object.entries(n))r.setAttribute(o,String(i));return r}const Dn=e=>Math.round(e*10)/10;function m0(e,t,n={}){const r=e.ownerDocument,o=h0(t),i=Me(r,"svg",{class:"cv-chart-svg",viewBox:`0 0 ${o.width} ${o.height}`,role:"img",preserveAspectRatio:"xMidYMid meet","aria-label":`Line chart of ${t.series.map(u=>u.column).join(", ")} by ${t.xColumn}, ${t.times.length} ${t.times.length===1?"point":"points"}`});for(const u of o.lanes){const l=Me(r,"g",{class:"cv-chart-lane","data-series":u.column}),d=Me(r,"rect",{class:"cv-chart-swatch",x:o.plotLeft,y:u.top+4,width:14,height:4,rx:2});d.style.fill=u.color;const f=Me(r,"text",{class:"cv-chart-name",x:o.plotLeft+20,y:u.top+11});f.textContent=u.column,l.append(d,f,Me(r,"line",{class:"cv-chart-grid",x1:o.plotLeft,x2:o.plotRight,y1:u.plotTop,y2:u.plotTop}),Me(r,"line",{class:"cv-chart-base",x1:o.plotLeft,x2:o.plotRight,y1:u.plotBottom,y2:u.plotBottom}));const p=Me(r,"text",{class:"cv-chart-tick",x:o.plotLeft-8,y:u.plotTop+4,"text-anchor":"end"});p.textContent=Yd(u.max);const h=Me(r,"text",{class:"cv-chart-tick",x:o.plotLeft-8,y:u.plotBottom+4,"text-anchor":"end"});h.textContent=Yd(u.min),l.append(p,h);for(const m of u.runs){if(m.length<2)continue;const y=Me(r,"polyline",{class:"cv-chart-line",points:m.map($=>`${Dn($.x)},${Dn($.y)}`).join(" "),fill:"none"});y.style.stroke=u.color,l.append(y)}if(u.points.length<=f0)for(const m of u.points){const y=Me(r,"circle",{class:"cv-chart-dot",cx:Dn(m.x),cy:Dn(m.y),r:3});y.style.fill=u.color;const $=Me(r,"title");$.textContent=`${by(m.time,t.daily)} · ${u.column} ${wy.format(m.value)}`,y.append($),l.append(y)}i.append(l)}const s=Me(r,"g",{class:"cv-chart-axis"});for(const u of o.ticks){const l=Me(r,"text",{class:"cv-chart-tick",x:Dn(u.x),y:o.axisY+14,"text-anchor":u.anchor});l.textContent=u.label,s.append(l)}i.append(s);const a=[t.omittedColumns.length?`${t.omittedColumns.length} more number ${t.omittedColumns.length===1?"column is":"columns are"} only in the table: ${t.omittedColumns.join(", ")}.`:"",t.skippedRows?`${t.skippedRows} ${t.skippedRows===1?"row has":"rows have"} no usable ${t.xColumn} and ${t.skippedRows===1?"is":"are"} only in the table.`:""].filter(Boolean),c=z(r,"section",{class:"cv-chart cia-graph-surface","data-view":"chart","aria-label":`Chart by ${t.xColumn}`},z(r,"header",{class:"cv-flows-head"},z(r,"div",{class:"cv-title"},z(r,"strong",{text:"Chart"}),z(r,"span",{class:"cv-muted",text:`${t.times.length} ${t.times.length===1?"point":"points"} by ${t.xColumn} (UTC) · ${t.series.length} ${t.series.length===1?"line":"lines"}`})),n.toggle??null),a.length?z(r,"p",{class:"cv-note",role:"note","data-chart-note":"",text:a.join(" ")}):null,z(r,"div",{class:"cv-chart-body"},i));return e.replaceChildren(c),{root:c,layout:o}}const g0="chain-insights.transfers.v1",y0="graph_expand",_0="2015-01-01";function b0(e,t,n,r){return{network:e,from:t,to:n,day:r}}function w0(e,t){const n=typeof e.first_seen_timestamp=="number"&&e.first_seen_timestamp>0?ys(e.first_seen_timestamp):null,r=typeof e.last_seen_timestamp=="number"&&e.last_seen_timestamp>0?ys(e.last_seen_timestamp):ys(t);return{first:n,last:n&&r<n?n:r}}function vo(e,t){return e<=(t??_0)}function v0(e){if(!e)return"no answer";const t=so(e);return e.isError?t||"the server refused the read":/query_timeout|topology_busy/.test(t)?t:vy(e.structuredContent)?null:t||"the answer held no transfers"}function vy(e){const t=e;if(!t||t.schema!==g0||!Array.isArray(t.transfers)||typeof t.from!="string"||typeof t.to!="string"||!DS(t.day))return null;const n=[];for(const r of t.transfers){if(!r||typeof r!="object")continue;const o=r;if(typeof o.tx_id!="string")continue;const i=et(o.block_timestamp);n.push({tx_id:o.tx_id,block_timestamp:i,amount:typeof o.amount=="string"?o.amount:typeof o.amount=="number"?String(o.amount):null,asset_symbol:typeof o.asset_symbol=="string"&&o.asset_symbol?o.asset_symbol:null,amount_usd:et(o.amount_usd)})}return{network:typeof t.network=="string"?t.network:null,from:t.from,to:t.to,day:t.day,transfers:n,truncated:t.truncated===!0}}function k0(e){return[...e].sort((t,n)=>(n.block_timestamp??0)-(t.block_timestamp??0)||t.tx_id.localeCompare(n.tx_id))}function $0(e){if(e==null)return"—";const t=e.trim().match(/^(-?)(\d+)(?:\.(\d+))?$/);if(!t)return e;const[,n="",r="0",o=""]=t,i=o.replace(/0+$/,"");return`${n}${r.replace(/\B(?=(\d{3})+(?!\d))/g,",")}${i?`.${i}`:""}`}function S0(e){return e==null?"—":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:e!==0&&Math.abs(e)<.01?6:2}).format(e)}function I0(e){return e==null?"—":`${new Date(Sl(e)).toISOString().slice(11,19)} UTC`}function ws(e){return new Intl.DateTimeFormat("en-GB",{dateStyle:"medium",timeZone:"UTC"}).format(new Date(`${e}T00:00:00Z`))}function x0(e,t){const n=t.now??Date.now,r=z(e,"strong",{"data-link-title":"",text:"Transfers"}),o=z(e,"button",{type:"button",class:"cv-button cv-icon","data-link-close":"","aria-label":"Close the transfers",text:"×"}),i=z(e,"p",{class:"cv-link-pair","data-link-pair":""}),s=z(e,"p",{class:"cv-link-day","data-link-day":""}),a=z(e,"div",{class:"cv-link-body","data-link-body":"",role:"status","aria-live":"polite"}),c=z(e,"button",{type:"button",class:"cv-button","data-link-earlier":"",text:"Earlier day"}),u=z(e,"aside",{class:"cv-linkpanel","data-link-panel":"","aria-label":"Transfers of the selected link",hidden:!0},z(e,"header",{class:"cv-link-head"},r,o),i,s,a,c);let l=null,d=0;function f(){if(!l){u.hidden=!0;return}u.hidden=!1,i.replaceChildren(z(e,"code",{title:l.from,text:Re(l.from)})," → ",z(e,"code",{title:l.to,text:Re(l.to)})),s.textContent=`${ws(l.day)} (UTC)`,c.disabled=l.status==="loading"||vo(l.day,l.firstDay);const $=vo(l.day,l.firstDay)?null:jd(l.day);c.setAttribute("aria-label",$?`Earlier day: show the transfers of ${ws($)}`:"Earlier day: this is the first day the link was seen"),l.status==="loading"?a.replaceChildren(z(e,"p",{class:"cv-muted",text:`Loading the transfers of ${ws(l.day)}…`})):l.status==="error"?a.replaceChildren(z(e,"p",{class:"cv-link-error","data-link-error":"",role:"alert",text:l.error??"The transfers could not be read."})):l.transfers.length===0?a.replaceChildren(z(e,"p",{class:"cv-muted","data-link-empty":"",text:"No transfers between these two addresses on this day."})):(a.replaceChildren(z(e,"ol",{class:"cv-transfers"},...l.transfers.map(w=>z0(e,w,t.host)))),l.truncated&&a.append(z(e,"p",{class:"cv-muted","data-link-truncated":"",text:`${l.transfers.length} transfers shown. This day holds more.`}))),l.status!=="loading"&&vo(l.day,l.firstDay)&&l.firstDay&&a.append(z(e,"p",{class:"cv-muted","data-link-first":"",text:"This is the first day the link was seen."}))}async function p($){const w=++d,S=l;S.day=$,S.status="loading",S.error=null,f(),t.onLayout?.();let T=null;try{T=await t.host.callServerTool({name:y0,arguments:b0(t.network,S.from,S.to,$)})}catch(C){T={isError:!0,content:[{type:"text",text:C instanceof Error?C.message:String(C)}]}}if(w!==d||l!==S)return S;const O=v0(T);if(O)S.status="error",S.transfers=[],S.error=O.length>300?`${O.slice(0,299)}…`:O;else{const C=vy(T.structuredContent);S.status="ready",S.transfers=k0(C.transfers),S.truncated=C.truncated}return f(),t.onLayout?.(),S}const h=()=>y.close(),m=()=>{y.earlier()};o.addEventListener("click",h),c.addEventListener("click",m);const y={element:u,open($){const w=w0($,n());return l={from:$.from,to:$.to,day:w.last,firstDay:w.first,status:"loading",transfers:[],truncated:!1,error:null},p(w.last)},async earlier(){return!l||l.status==="loading"||vo(l.day,l.firstDay)?null:p(jd(l.day))},close(){d++,l=null,f(),t.onLayout?.()},state:()=>l?{...l,transfers:[...l.transfers]}:null,destroy(){d++,o.removeEventListener("click",h),c.removeEventListener("click",m)}};return y}function z0(e,t,n){const r=uy(t.tx_id),o=n.openLink,i=r&&o?z(e,"button",{type:"button",class:"cia-graph-explorer-link","data-explorer":r,"aria-label":`Transaction ${t.tx_id} (opens the explorer)`,title:t.tx_id,text:Re(t.tx_id)}):z(e,"code",{title:t.tx_id,text:Re(t.tx_id)});return r&&o&&i.addEventListener("click",()=>{o.call(n,{url:r}).catch(()=>{})}),z(e,"li",{class:"cv-transfer","data-tx":t.tx_id},z(e,"span",{class:"cv-transfer-time",text:I0(t.block_timestamp)}),z(e,"span",{class:"cv-transfer-amount",text:`${$0(t.amount)}${t.asset_symbol?` ${t.asset_symbol}`:""}`}),z(e,"span",{class:"cv-transfer-usd",text:t.amount_usd==null?"— USD":S0(t.amount_usd)}),i)}const T0="graph_expand",ko="too busy to expand",ky=480,E0=300,vs=.45,C0="Full screen shows the whole graph",A0=[["scam","Scam"],["sanctioned","Sanctioned"],["exchange","Exchange"],["victim","Victim"],["pool","Pool"],["other","Other"]];function N0(e,t,n){return{network:e,address:t,in_offset:n?.in_offset??0,out_offset:n?.out_offset??0}}function O0(e){const t=so(e);return e?e.isError?t||"the server refused the expansion":/query_timeout|topology_busy/.test(t)?t:bl(e.structuredContent)?null:t||"the answer held no money flows":"no answer"}function P0(e,t,n,r=ky,o=E0){if(!e||t<=0)return{height:r,fits:!0};const i=Math.max(1,e.x2-e.x1),s=Math.max(1,e.y2-e.y1),a=Math.max(vs,Math.min(1,(t-Gn*2)/i)),c=Math.ceil(n+s*a+Gn*2),u=Math.min(r,Math.max(o,c));return Ad(e,t,u-n)>=vs?{height:u,fits:!0}:{height:r,fits:Ad(e,t,r-n)>=vs}}function M0(e,t){return`investigator expanded ${e}: ${t} new addresses`}function R0(e,t){const n=e.nodes.find(r=>r.address.toLowerCase()===t.toLowerCase());return n&&ss({role:n.role??null,labels:n.labels??[]})||"Other"}function $y(e,t,n){const r=e.ownerDocument,o=t.network??"robinhood",i=t.center.toLowerCase(),s=new Map(t.cursor?[[i,{cursor:t.cursor,truncated:!!t.truncated}]]:[]),a=new Set,c=new Set;let u=!1,l=!1;const d=n.title??"Money flows",f=z(r,"p",{class:"cv-status",role:"status","aria-live":"polite",text:"Select an address to load its senders and receivers, or a link to list its transfers."}),p=z(r,"ul",{class:"cv-roles","aria-label":"Address roles"}),h=z(r,"div",{class:"cv-canvas","data-graph":""}),m=z(r,"aside",{class:"cv-detail","aria-label":"Selection",hidden:!0},z(r,"strong",{"data-selection-title":""}),z(r,"code",{"data-selection-identity":""}),z(r,"div",{class:"cv-detail-meta","data-selection-meta":""})),y=z(r,"button",{type:"button",class:"cv-button","data-fullscreen":"",hidden:!0,"aria-label":"Open full screen",text:"Full screen"}),$=z(r,"span",{class:"cv-hint","data-fullscreen-hint":"",hidden:!0,text:C0}),w=z(r,"div",{class:"cv-actions"},z(r,"button",{type:"button",class:"cv-button cv-icon","data-zoom":"out","aria-label":"Zoom out",text:"−"}),z(r,"button",{type:"button",class:"cv-button cv-icon","data-zoom":"in","aria-label":"Zoom in",text:"+"}),z(r,"button",{type:"button",class:"cv-button","data-zoom":"fit","aria-label":"Fit the graph",text:"Fit"}),$,y),S=z(r,"span",{class:"cv-muted"}),T=x0(r,{host:n.host,network:o,now:n.now,onLayout:()=>rt()}),O=z(r,"section",{class:"cv-flows cia-graph-surface","data-view":"flows","aria-label":`${d} of ${i}`},z(r,"header",{class:"cv-flows-head"},z(r,"div",{class:"cv-title"},z(r,"strong",{text:d}),S),n.toggle??null,w),p,n.note?z(r,"p",{class:"cv-note",role:"note","data-left-out":"",text:n.note}):null,z(r,"div",{class:"cv-body"},h,T.element),m,f);e.replaceChildren(O);function C(){const K=$e.model(),V=K.truncated?" · more flows than shown":"";S.textContent=`${Re(i)} · ${R0(t,i)} · ${o} · ${K.nodes.length} addresses${V}`;const _e=new Set(K.nodes.map(ae=>ae.role??"other"));p.replaceChildren(...A0.filter(([ae])=>_e.has(ae)).map(([ae,Bt])=>{const Oe=z(r,"i",{"aria-hidden":"true"});return Oe.style.background=`var(--cia-graph-role-${ae})`,z(r,"li",{"data-role":ae},Oe,Bt)}))}const L=K=>{const V=K.target;u=!!V?.closest?.("[data-node-id]"),l=!u&&!!V?.closest?.("[data-edge-id]")},ue=K=>{const V=K.target,_e=K.key==="Enter"||K.key===" ";u=_e&&!!V?.closest?.("[data-node-id]"),l=_e&&!u&&!!V?.closest?.("[data-edge-id]")},Q=()=>{u=!1,l=!1};h.addEventListener("pointerdown",L,!0),h.addEventListener("keydown",ue,!0),h.addEventListener("pointerup",Q),h.addEventListener("pointercancel",Q);function le(K){const V=m.hidden;m.hidden=K.kind==null,V!==m.hidden&&rt();const _e=u&&K.kind==="node"&&K.node,ae=l&&K.kind==="edge"&&K.edge;u=!1,l=!1,_e&&zt(K.node.address),ae&&T.open(K.edge)}const xe=n.height??ky,$e=CS(h,t,{layout:"tree",width:n.width??720,height:xe,now:n.now,controls:w,selectionRoot:m,onSelect:le,openLink:K=>{n.host.openLink?.({url:K}).catch(()=>{f.textContent="The host did not open the link."})},label:`${d} of ${i}: senders on the left, receivers on the right. Select an address to load its next page, or a link to list its transfers.`});C();let We=n.displayMode??"inline",Nn=n.availableDisplayModes??[];function rt(){if(We==="fullscreen"){O.style.removeProperty("height"),$.hidden=!0;return}const K=h.clientWidth||n.width||720,V=Math.max(0,O.offsetHeight-h.offsetHeight)||140,{height:_e,fits:ae}=P0($e.contentBounds(),K,V);O.style.height=`${_e}px`,$.hidden=ae||!Nn.includes("fullscreen"),O.dataset.fits=String(ae),$e.fit()}async function zt(K){const V=K.toLowerCase();if(a.has(V))return f.textContent=`${Re(V)} is ${ko}.`,{added:[],refused:ko};if(c.has(V))return{added:[],refused:null};const _e=s.get(V);if(_e&&!_e.truncated)return f.textContent=`Every recent flow of ${Re(V)} is drawn.`,{added:[],refused:null};c.add(V),f.textContent=`Loading the flows of ${Re(V)}…`;let ae=null;try{ae=await n.host.callServerTool({name:T0,arguments:N0(o,V,_e?.cursor)})}catch(Kt){ae={isError:!0,content:[{type:"text",text:Kt instanceof Error?Kt.message:String(Kt)}]}}finally{c.delete(V)}const Bt=O0(ae);if(Bt)return a.add(V),$e.markNode(V,ko),f.textContent=`${Re(V)} is ${ko}. The drawing is kept.`,{added:[],refused:Bt};const Oe=ae.structuredContent,mt=$e.merge(Oe,V);s.set(V,{cursor:Oe.cursor??null,truncated:!!Oe.truncated}),C(),rt(),f.textContent=`${mt.length} new ${mt.length===1?"address":"addresses"} linked to ${Re(V)}.`;try{await n.host.updateModelContext?.({content:[{type:"text",text:M0(V,mt.length)}]})}catch{}return{added:mt,refused:null}}function On(K,V){K&&(We=K),V&&(Nn=V),O.dataset.displayMode=We,y.hidden=!Nn.includes("fullscreen"),y.textContent=We==="fullscreen"?"Exit full screen":"Full screen",y.setAttribute("aria-label",We==="fullscreen"?"Back to the inline view":"Open full screen"),rt()}On(We);const ot=async()=>{const K=We==="fullscreen"?"inline":"fullscreen";try{const V=await n.host.requestDisplayMode?.({mode:K});On(V?.mode??K)}catch{f.textContent="The host did not change the display mode."}};return y.addEventListener("click",ot),{root:O,graph:$e,expand:zt,linkPanel:T,openLink(K,V){const _e=$e.model().edges.find(ae=>ae.from===K.toLowerCase()&&ae.to===V.toLowerCase());return _e?T.open(_e):Promise.resolve(null)},setTheme(K){$e.setTheme(K)},setDisplayMode:On,refit:rt,destroy(){h.removeEventListener("pointerdown",L,!0),h.removeEventListener("keydown",ue,!0),h.removeEventListener("pointerup",Q),h.removeEventListener("pointercancel",Q),y.removeEventListener("click",ot),T.destroy(),$e.destroy()}}}function Hs(e){return{kind:e,flows:()=>[],setTheme(){},setDisplayMode(){},refit(){},destroy(){}}}function L0(e,t){return{kind:e,flows:()=>{const n=t();return n?[n]:[]},setTheme(n){t()?.setTheme(n)},setDisplayMode(n,r){t()?.setDisplayMode(n,r)},refit(){t()?.refit()},destroy(){t()?.destroy()}}}const Sy=e=>({host:e.host,availableDisplayModes:e.availableDisplayModes,displayMode:e.displayMode,now:e.now,width:e.width,height:e.height});function D0(e,t){if(e<=0)return null;const n=new Intl.NumberFormat("en-US");return`${n.format(e)} of ${n.format(t)} rows ${e===1?"is":"are"} not drawn: a graph holds at most 60 addresses. The table has the rows.`}function Z0(e,t,n){const r=[];let o="picture";const i=s=>{for(const a of s.querySelectorAll("[data-show]"))a.setAttribute("aria-pressed",String(a.dataset.show===o))};return{make(){const s=z(e,"button",{type:"button",class:"cv-toggle-button","data-show":"picture",text:t}),a=z(e,"button",{type:"button",class:"cv-toggle-button","data-show":"table",text:"Table"});s.addEventListener("click",()=>n("picture")),a.addEventListener("click",()=>n("table"));const c=z(e,"div",{class:"cv-toggle",role:"group","aria-label":"Show the rows as"},s,a);return r.push(c),i(c),c},set(s){o=s,r.forEach(i)}}}function Iy(e,t,n){const r=e.ownerDocument,o=gy(t);if(o!=="graph"&&o!=="chart")return o==="table"?Kd(e,t):as(e,t),Hs(o==="table"?"table":"text");const i=t.structuredContent,s=py(i),a=z(r,"div",{class:"cv-face","data-face":"picture"}),c=z(r,"div",{class:"cv-face","data-face":"table",hidden:!0});e.replaceChildren(a,c);const u=Z0(r,o==="graph"?"Graph":"Chart",p=>f(p));let l=null,d=!1;if(o==="graph"){const p=KS(s,MS(i));l=$y(a,p.view,{...Sy(n),title:"Graph",toggle:u.make(),note:D0(p.rowsLeftOut,p.rowsTotal)})}else m0(a,hy(s),{toggle:u.make()});function f(p){a.hidden=p!=="picture",c.hidden=p!=="table",p==="table"&&!d&&(d=!0,Kd(c,t,{toggle:u.make()})),u.set(p),p==="picture"&&l?.refit()}return{kind:o,flows:()=>l?[l]:[],setTheme(p){l?.setTheme(p)},setDisplayMode(p,h){l?.setDisplayMode(p,h)},refit(){a.hidden||l?.refit()},destroy(){l?.destroy()}}}function j0(e,t){if(!e.ok)return{isError:!0,content:[{type:"text",text:e.error??"The query failed."}]};const n=t?.facts?.subject;return{content:[],structuredContent:{schema:dy,tool:"graph_query",facts:{...n?{subject:n}:{},query:{results:e.rows,count:e.count??e.rows.length,truncated:e.truncated,elapsed_ms:e.elapsedMs}}}}}function F0(e,t,n){const r=e.ownerDocument,o=JS(t.structuredContent),i=o.map((h,m)=>z(r,"button",{type:"button",role:"tab",class:"cv-tab",id:`cv-tab-${m}`,"data-tab":h.id,"aria-controls":`cv-panel-${m}`,"aria-selected":"false",tabindex:-1,text:h.ok?h.id:`${h.id} (failed)`})),s=o.map((h,m)=>z(r,"div",{class:"cv-tabpanel",role:"tabpanel",id:`cv-panel-${m}`,"aria-labelledby":`cv-tab-${m}`,hidden:!0})),a=z(r,"div",{class:"cv-tabs",role:"tablist","aria-label":"Queries of the batch"},...i);e.replaceChildren(a,...s);const c=o.map(()=>null);let u=n.displayMode,l=n.availableDisplayModes,d=-1;const f=()=>e.style.setProperty("--cv-tabs-h",`${a.offsetHeight}px`);function p(h){const m=o[h],y=s[h];if(!m||!y)return;d=h,i.forEach((w,S)=>{w.setAttribute("aria-selected",String(S===h)),w.tabIndex=S===h?0:-1}),s.forEach((w,S)=>{w.hidden=S!==h});const $=c[h];if($)$.refit();else{const w=Iy(y,j0(m,t.structuredContent),{...n,displayMode:u,availableDisplayModes:l});c[h]=w,y.dataset.view=w.kind}f()}return i.forEach((h,m)=>{h.addEventListener("click",()=>p(m)),h.addEventListener("keydown",y=>{const $=i.length-1,w=y.key==="ArrowRight"?m===$?0:m+1:y.key==="ArrowLeft"?m===0?$:m-1:y.key==="Home"?0:y.key==="End"?$:null;w!=null&&(y.preventDefault(),p(w),i[w]?.focus())})}),p(0),{kind:"batch",flows:()=>c.flatMap(h=>h?.flows()??[]),setTheme(h){for(const m of c)m?.setTheme(h)},setDisplayMode(h,m){h&&(u=h),m&&(l=m);for(const y of c)y?.setDisplayMode(h,m);f()},refit(){d>=0&&c[d]?.refit()},destroy(){for(const h of c)h?.destroy()}}}function U0(e,t,n){const r=gy(t);if(r==="flows"){const o=$y(e,t.structuredContent,Sy(n));return L0("flows",()=>o)}return r==="graph"||r==="chart"||r==="table"?Iy(e,t,n):r==="batch"?F0(e,t,n):r==="balance"?(o0(e,t),Hs("balance")):(as(e,t),Hs("text"))}function V0(e){return e==="light"||e==="dark"}function q0(e,t=()=>!1){return V0(e?.theme)?e.theme:t()?"dark":"light"}function Il(e,t){const n={...e??{},...t??{}};return(e?.styles||t?.styles)&&(n.styles={...e?.styles??{},...t?.styles??{},variables:{...e?.styles?.variables??{},...t?.styles?.variables??{}}}),n}function xy(e,t,n={}){const r=e.documentElement,o=q0(t,n.prefersDark);r.setAttribute("data-theme",o),r.style.colorScheme=o;const i=t?.styles?.variables;i&&n.applyVariables&&n.applyVariables(i,r);const s=t?.styles?.css?.fonts;return s&&n.applyFonts&&n.applyFonts(s),o}const ao=document.getElementById("view"),zy=()=>typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches;let $t={},$o=xy(document,$t,{prefersDark:zy}),Ye=null;_y(ao);const tt=new yl({name:"chain-insights-view",version:"1.0.0"},{});function Ty(e){const t=$o;$o=xy(document,e,{prefersDark:zy,applyVariables:(n,r)=>_$(n,r),applyFonts:b$}),Ye&&$o!==t&&Ye.setTheme($o),Ye?.setDisplayMode(e.displayMode,e.availableDisplayModes)}function H0(e){Ye?.destroy(),Ye=null;const t=Il(tt.getHostContext(),$t);Ye=U0(ao,e,{host:tt,availableDisplayModes:t.availableDisplayModes,displayMode:t.displayMode}),document.documentElement.dataset.view=Ye.kind}tt.ontoolinput=e=>{const t=typeof e.arguments?.address=="string"?e.arguments.address:null;Ye||_y(ao,t?`Loading the graph of ${t}`:"Loading the Chain Insights view")};tt.ontoolresult=e=>{H0(e)};tt.ontoolcancelled=()=>{Ye||as(ao,null,"The tool call was cancelled. Nothing to draw.")};tt.onhostcontextchanged=e=>{$t=Il($t,e),Ty($t)};tt.onteardown=async()=>(Ye?.destroy(),Ye=null,{});tt.onerror=e=>{console.warn("chain-insights-view:",e)};tt.connect(new ty(window.parent,window.parent)).then(()=>{$t=Il($t,tt.getHostContext()),Ty($t)},e=>{console.warn("chain-insights-view: no host answered",e),as(ao,null,"This view opens inside Claude, next to a Chain Insights tool answer.")});
|
|
107
|
+
- "app": Tool callable by the app from this server only`),csp:Ht().optional(),permissions:Ht().optional()});k({mimeTypes:D(b()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')});k({method:v("ui/download-file"),params:k({contents:D(H([sy,iy])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})});k({method:v("ui/message"),params:k({role:v("user").describe('Message role, currently only "user" is supported.'),content:D(mo).describe("Message content blocks (text, image, etc.).")})});k({method:v("ui/notifications/sandbox-resource-ready"),params:k({html:b().describe("HTML content to load into the inner iframe."),sandbox:b().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Ml.optional().describe("CSP configuration from resource metadata."),permissions:Ll.optional().describe("Sandbox permissions from resource metadata.")})});var k$=k({method:v("ui/notifications/tool-result"),params:$i.describe("Standard MCP tool execution result.")}),py=k({toolInfo:k({id:co.optional().describe("JSON-RPC id of the tools/call request."),tool:Pl.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:i$.optional().describe("Current color theme preference."),styles:g$.optional().describe("Style configuration for theming the app."),displayMode:ir.optional().describe("How the UI is currently displayed."),availableDisplayModes:D(ir).optional().describe("Display modes the host supports."),containerDimensions:H([k({height:U().describe("Fixed container height in pixels.")}),k({maxHeight:H([U(),mn()]).optional().describe("Maximum container height in pixels.")})]).and(H([k({width:U().describe("Fixed container width in pixels.")}),k({maxWidth:H([U(),mn()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
108
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:b().optional().describe("User's language and region preference in BCP 47 format."),timeZone:b().optional().describe("User's timezone in IANA format."),userAgent:b().optional().describe("Host application identifier."),platform:H([v("web"),v("desktop"),v("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:k({touch:X().optional().describe("Whether the device supports touch input."),hover:X().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:k({top:U().describe("Top safe area inset in pixels."),right:U().describe("Right safe area inset in pixels."),bottom:U().describe("Bottom safe area inset in pixels."),left:U().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),$$=k({method:v("ui/notifications/host-context-changed"),params:py.describe("Partial context update containing only changed fields.")});k({method:v("ui/update-model-context"),params:k({content:D(mo).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:J(b(),Q().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})});k({method:v("ui/initialize"),params:k({appInfo:vi.describe("App identification (name and version)."),appCapabilities:b$.describe("Features and capabilities this app provides."),protocolVersion:b().describe("Protocol version this app supports.")})});var S$=k({protocolVersion:b().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:vi.describe("Host application identification and version."),hostCapabilities:_$.describe("Features and capabilities provided by the host."),hostContext:py.describe("Rich context about the host environment.")}).passthrough(),x$={target:"draft-2020-12"};async function Rd(e,t){let n=e["~standard"];if(n.jsonSchema)return n.jsonSchema[t](x$);if(n.vendor==="zod"){let{z:r}=await Uy(()=>Promise.resolve().then(()=>hv),void 0,import.meta.url);return r.toJSONSchema(e,{io:t})}throw Error(`Schema (vendor: ${n.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function Dd(e,t,n=""){let r=await e["~standard"].validate(t);if(r.issues){let o=r.issues.map(s=>{let i=s.path?.map(a=>typeof a=="object"?a.key:a).join(".");return i?`${i}: ${s.message}`:s.message}).join("; ");throw Error(n+o)}return r.value}function I$(e,t=document.documentElement){for(let[n,r]of Object.entries(e))r!==void 0&&t.style.setProperty(n,r)}function z$(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 Rl extends r${_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_assertInitialized(t){if(this._initializedSent)return;let n=`[ext-apps] App.${t}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(n);console.warn(`${n}. This will throw in a future release.`)}eventSchemas={toolinput:f$,toolinputpartial:p$,toolresult:k$,toolcancelled:h$,hostcontextchanged:$$};static ONE_SHOT_EVENTS=new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]);_everHadListener=new Set;_assertHandlerTiming(t){if(!Rl.ONE_SHOT_EVENTS.has(t)||this._everHadListener.has(t)||(this._everHadListener.add(t),!this._initializedSent))return;let n=`[ext-apps] "${String(t)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(n);console.warn(n)}setEventHandler(t,n){n&&this._assertHandlerTiming(t),super.setEventHandler(t,n)}addEventListener(t,n){this._assertHandlerTiming(t),super.addEventListener(t,n)}onEventDispatch(t,n){t==="hostcontextchanged"&&(this._hostContext={...this._hostContext,...n})}constructor(t,n={},r={autoResize:!0}){super(r),this._appInfo=t,this._capabilities=n,this.options=r,r.allowUnsafeEval||ye({jitless:!0}),this.setRequestHandler(ki,o=>(console.log("Received ping:",o.params),{})),this.setEventHandler("hostcontextchanged",void 0)}registerCapabilities(t){if(this.transport)throw Error("Cannot register capabilities after transport is established");this._capabilities=n$(this._capabilities,t)}registerTool(t,n,r){if(this._registeredTools[t])throw Error(`Tool ${t} is already registered`);let o=this,s=()=>{o._initializedSent&&o._capabilities.tools?.listChanged&&o.sendToolListChanged()},i=n.inputSchema!==void 0,a={title:n.title,description:n.description,inputSchema:n.inputSchema,outputSchema:n.outputSchema,annotations:n.annotations,_meta:n._meta,enabled:!0,enable(){this.enabled=!0,s()},disable(){this.enabled=!1,s()},update(c){Object.assign(this,c),s()},remove(){o._registeredTools[t]===a&&(delete o._registeredTools[t],s())},handler:async(c,u)=>{if(!a.enabled)throw Error(`Tool ${t} is disabled`);let l;if(i){let d=a.inputSchema,f=d?await Dd(d,c??{},`Invalid input for tool ${t}: `):c??{};l=await r(f,u)}else l=await r(u);return a.outputSchema&&!l.isError&&(l.structuredContent=await Dd(a.outputSchema,l.structuredContent,`Invalid output for tool ${t}: `)),l}};return this._registeredTools[t]=a,!this._capabilities.tools&&!this.transport&&this.registerCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),s(),a}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(t,n)=>{let r=this._registeredTools[t.name];if(!r)throw Error(`Tool ${t.name} not found`);return r.handler(t.arguments,n)},this.onlisttools=async(t,n)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([r,o])=>o.enabled).map(async([r,o])=>{let s={name:r,title:o.title,description:o.description,inputSchema:o.inputSchema?await Rd(o.inputSchema,"input"):{type:"object",properties:{}}};return o.outputSchema&&(s.outputSchema=await Rd(o.outputSchema,"output")),o.annotations&&(s.annotations=o.annotations),o._meta&&(s._meta=o._meta),s}))}))}async sendToolListChanged(t={}){this._assertInitialized("sendToolListChanged"),await this.notification({method:"notifications/tools/list_changed",params:t})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler("toolinput")}set ontoolinput(t){this.setEventHandler("toolinput",t)}get ontoolinputpartial(){return this.getEventHandler("toolinputpartial")}set ontoolinputpartial(t){this.setEventHandler("toolinputpartial",t)}get ontoolresult(){return this.getEventHandler("toolresult")}set ontoolresult(t){this.setEventHandler("toolresult",t)}get ontoolcancelled(){return this.getEventHandler("toolcancelled")}set ontoolcancelled(t){this.setEventHandler("toolcancelled",t)}get onhostcontextchanged(){return this.getEventHandler("hostcontextchanged")}set onhostcontextchanged(t){this.setEventHandler("hostcontextchanged",t)}_onteardown;get onteardown(){return this._onteardown}set onteardown(t){this.warnIfRequestHandlerReplaced("onteardown",this._onteardown,t),this._onteardown=t,this.replaceRequestHandler(y$,(n,r)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(n.params,r)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(t){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,t),this._oncalltool=t,this.replaceRequestHandler(cy,(n,r)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(n.params,r)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(t){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,t),this._onlisttools=t,this.replaceRequestHandler(ay,(n,r)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(n.params,r)})}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${t})`);break}}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,n){if(this._assertInitialized("callServerTool"),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},$i,{onprogress:()=>{},resetTimeoutOnProgress:!0,...n})}async readServerResource(t,n){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:t},oy,n)}async listServerResources(t,n){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:t},ry,n)}async createSamplingMessage(t,n){this._assertInitialized("createSamplingMessage");let r=t.tools?dy:ly;return await this.request({method:"sampling/createMessage",params:t},r,n)}sendMessage(t,n){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:t},d$,n)}sendLog(t){return this.notification({method:"notifications/message",params:t})}updateModelContext(t,n){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:t},bl,n)}openLink(t,n){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:t},u$,n)}sendOpenLink=this.openLink;downloadFile(t,n){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:t},l$,n)}requestTeardown(t={}){return this.notification({method:"ui/notifications/request-teardown",params:t})}requestDisplayMode(t,n){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:t},w$,n)}sendSizeChanged(t){return this.notification({method:"ui/notifications/size-changed",params:t})}setupSizeChangedNotifications(){let t=!1,n=0,r=0,o=()=>{t||(t=!0,requestAnimationFrame(()=>{t=!1;let i=document.documentElement,a=i.style.height;i.style.height="max-content";let c=Math.ceil(i.getBoundingClientRect().height);i.style.height=a;let u=Math.ceil(window.innerWidth);(u!==n||c!==r)&&(n=u,r=c,this.sendSizeChanged({width:u,height:c}))}))};o();let s=new ResizeObserver(o);return s.observe(document.documentElement),s.observe(document.body),()=>s.disconnect()}async connect(t=new fy(window.parent,window.parent),n){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1,await super.connect(t);try{let r=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:o$}},S$,n);if(r===void 0)throw Error(`Server sent invalid initialize result: ${r}`);this._hostCapabilities=r.hostCapabilities,this._hostInfo=r.hostInfo,this._hostContext=r.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(r){throw this.close(),r}}}const T$="http://www.w3.org/2000/svg",C$=.45,E$=2.5,A$=5,N$="chain-insights.flows.v1",Dl="cia-graph-model",O$=90,zt={rest:.6,related:.95,faded:.07},Zd={checked:24,other:19},ar=16,P$=[["Sanctioned","Sanctioned"],["Scam","Scam"],["Poisoned","Poisoned"],["OnMoneyTrail","On money trail"],["Mixer","Mixer"],["Bridge","Bridge"],["Exchange","Exchange"],["Victim","Victim"],["Targeted","Targeted"]],go=["exchange","scam","sanctioned","victim","pool","other"],M$={exchange:"infrastructure",scam:"danger",sanctioned:"danger",victim:"target",pool:"trail",other:"neutral"},hy={exchange:"Exchange",scam:"Scam",sanctioned:"Sanctioned",victim:"Victim",pool:"Pool",other:""};function Zl(e){return!!e&&e.schema===N$}function L$(e){return!!e&&e.kind===Dl}function pe(e){return String(e??"").trim().toLowerCase()}function R$(e){const t=pe(e);return go.includes(t)?t:"other"}function xt(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function ra(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function D$(e){const t=String(e??"").toUpperCase();return t==="IN"||t==="OUT"||t==="MIXED"||t==="CHECKED"?t:"OUT"}function Ke(e){return L$(e)?e:Zl(e)?Z$(e):F$(e)}function Z$(e){const t=pe(e.center),n=new Map;for(const a of e.nodes??[]){const c=pe(a?.address);c&&!n.has(c)&&n.set(c,a)}const r=[],o=new Set;for(const a of e.edges??[]){const c=pe(a?.from),u=pe(a?.to);if(!n.has(c)||!n.has(u)||c===u)continue;const l=`${c}->${u}`;o.has(l)||(o.add(l),r.push({id:l,from:c,to:u,source:"flows",amount_usd_sum:xt(a.usd),tx_count:xt(a.tx_count),first_seen_timestamp:xt(a.first_seen_ms),last_seen_timestamp:xt(a.last_seen_ms),...typeof a.link_kind=="string"&&a.link_kind?{link_kind:a.link_kind}:{}}))}const s=j$(t,[...n.keys()],r),i=[...n.entries()].map(([a,c])=>{const u=s.get(a)??{direction:"OUT",hop:2};return{id:a,address:a,direction:a===t?"CHECKED":u.direction,hop:a===t?0:u.hop,labels:ra(c.labels),taxonomy:[],role:R$(c.role),total_in_usd:xt(c.total_in_usd),total_out_usd:xt(c.total_out_usd),degree_in:xt(c.degree_in),degree_out:xt(c.degree_out)}});return{kind:Dl,checked_address:t,network:e.network??null,nodes:i,edges:r,truncated:!!e.truncated,cursor:e.cursor??null}}function j$(e,t,n){const r=new Map,o=new Map,s=new Map,i=(d,f,p)=>d.set(f,[...d.get(f)??[],p]);for(const d of n)i(r,d.from,d.to),i(o,d.to,d.from),i(s,d.from,d.to),i(s,d.to,d.from);const a=d=>{const f=new Map([[e,0]]);for(let p=[e];p.length;){const h=[];for(const m of p)for(const _ of d.get(m)??[])f.has(_)||(f.set(_,(f.get(m)??0)+1),h.push(_));p=h}return f},c=a(r),u=a(o),l=new Map;for(const d of t){if(d===e)continue;const f=c.get(d),p=u.get(d);if(f==null&&p==null)continue;const h=f!=null&&p!=null?f<p?"OUT":p<f?"IN":"MIXED":f!=null?"OUT":"IN";l.set(d,{direction:h,hop:Math.min(2,Math.min(f??1/0,p??1/0))})}for(let d=!0;d;){d=!1;for(const f of t){if(f===e||l.has(f))continue;const p=(s.get(f)??[]).find(m=>m!==e&&l.has(m));if(p==null)continue;const h=l.get(p);l.set(f,{direction:h.direction==="MIXED"?"OUT":h.direction,hop:2}),d=!0}}return l}function F$(e){const t=(e?.nodes??[]).map(r=>({...r,id:String(r.id??r.address),address:r.address,hop:Number(r.hop)||0,direction:r.address===e.checked_address?"CHECKED":D$(r.direction),labels:ra(r.labels),taxonomy:ra(r.taxonomy),role:null})),n=(e?.edges??[]).map(r=>({...r,id:String(r.id??`${r.from}->${r.to}`),amount_usd_sum:r.amount_usd_sum??null,tx_count:r.tx_count??null,first_seen_timestamp:r.first_seen_timestamp??null,last_seen_timestamp:r.last_seen_timestamp??null,source:"risk"}));return{kind:Dl,checked_address:e?.checked_address??"",network:null,nodes:t,edges:n,truncated:!1,cursor:null}}function U$(e,t,n){const r=Ke(t),o=Wn(e,n??r.checked_address),s=e.nodes.find(d=>d.id===o),i=new Map(e.nodes.map(d=>[pe(d.address),d])),a=[];for(const d of r.nodes){if(i.has(pe(d.address)))continue;const f=!s||s.direction==="CHECKED"?d.direction==="CHECKED"?"OUT":d.direction:s.direction,p={...d,id:d.id,direction:f,hop:Math.min(2,(s?.hop??0)+1)};a.push(p),i.set(pe(d.address),p)}const c=new Set(e.edges.map(d=>d.id)),u=new Set(e.edges.map(d=>`${pe(d.from)}->${pe(d.to)}`)),l=[...e.edges];for(const d of r.edges){const f=`${pe(d.from)}->${pe(d.to)}`;if(c.has(d.id)||u.has(f)||!i.has(pe(d.from))||!i.has(pe(d.to)))continue;const p=i.get(pe(d.from)).address,h=i.get(pe(d.to)).address;l.push({...d,from:p,to:h}),c.add(d.id),u.add(f)}return{model:{...e,nodes:[...e.nodes,...a],edges:l,truncated:e.truncated||r.truncated},added:a.map(d=>d.id)}}function Wn(e,t){if(t==null)return null;const n=pe(t);return e.nodes.find(o=>o.id===t||pe(o.address)===n)?.id??null}function cr(e){return typeof e!="string"||e.length<=12?e:`${e.slice(0,6)}…${e.slice(-4)}`}function jl(e){return String(e??"").trim().replace(/\s+/g," ")}function es(e){return jl(e).replaceAll(" ","").toLowerCase()}function Et(e){const t=[...e.taxonomy??[],...e.labels??[]],n=new Set,r=[];for(const o of t){const s=jl(o),i=s.toLowerCase();!s||i==="address"||n.has(i)||(n.add(i),r.push(s))}return r}function Mo(e,t){const n=new Set(Et(e).map(es));return t.some(r=>n.has(es(r)))}function V$(e){if(e.role&&go.includes(e.role))return M$[e.role];if(Mo(e,["Sanctioned","Scam","Poisoned"]))return"danger";if(Mo(e,["Victim","Targeted"]))return"target";if(Mo(e,["OnMoneyTrail","Mixer"]))return"trail";if(Mo(e,["Exchange","Bridge","token contract"]))return"infrastructure";if(e.risk_score!=null){const t=String(e.risk_level).toLowerCase();if(t==="critical"||t==="high"||t==="medium"||t==="low")return t}return"neutral"}function fe(e){return`var(--cia-graph-${e})`}const q$={semantic:{danger:{stroke:fe("danger"),fill:fe("node")},target:{stroke:fe("target"),fill:fe("node")},trail:{stroke:fe("trail"),fill:fe("node")},infrastructure:{stroke:fe("infrastructure"),fill:fe("node")},neutral:{stroke:fe("neutral"),fill:fe("node")}},risk:{CRITICAL:{stroke:fe("critical"),fill:fe("node")},HIGH:{stroke:fe("high"),fill:fe("node")},MEDIUM:{stroke:fe("medium"),fill:fe("node")},LOW:{stroke:fe("low"),fill:fe("node")}}};function H$(e,t=q$){const n=V$(e);return n==="critical"||n==="high"||n==="medium"||n==="low"?t.risk[n.toUpperCase()]??t.semantic.neutral:t.semantic[n]}function B$(e){return e.role&&go.includes(e.role)?fe(`role-${e.role}`):H$(e).stroke}function Si(e){if(e.role&&e.role!=="other"&&go.includes(e.role))return hy[e.role];const t=Et(e);for(const[r,o]of P$)if(t.some(s=>es(s)===es(r)))return o;return(Array.isArray(e.labels)?e.labels.map(jl).filter(Boolean).sort((r,o)=>r.localeCompare(o)):[])[0]??""}function oa(e){return Math.min(E$,Math.max(C$,e))}function yo(e){return[...e.nodes??[]].sort((t,n)=>String(t.id).localeCompare(String(n.id)))}function Fl(e,t=yo(e)){return t.find(n=>n.address===e.checked_address)??t[0]}function jd(e,t){return e.address===t?43:e.hop>=2?25:30}function jt(e,t){return e.address===t?Zd.checked:Zd.other}function _o(e,t,n){const r=e.address===t,o=jt(e,t),s=Si(e),i=[];return s&&i.push({kind:"role",text:RS(s),y:o+17}),i.push({kind:"address",text:cr(e.address),y:o+(s?33:17)}),n&&i.push({kind:"note",text:n,y:o+(s?48:32)}),{radius:o,ring:r,dot:r?8:5,texts:i}}const K$={role:{size:13,advance:.68},address:{size:11,advance:.62},note:{size:11,advance:.6}},Oi=2;function Ul(e){const t=e.radius+(e.ring?7:2),n=[{kind:"circle",box:{x1:-t,y1:-t,x2:t,y2:t}}];for(const r of e.texts){const o=K$[r.kind],s=[...r.text].length*o.size*o.advance/2+Oi;n.push({kind:r.kind,box:{x1:-s,y1:r.y-o.size*.8-Oi,x2:s,y2:r.y+o.size*.25+Oi}})}return n}function my(e){return e.length?{x1:Math.min(...e.map(t=>t.x1)),y1:Math.min(...e.map(t=>t.y1)),x2:Math.max(...e.map(t=>t.x2)),y2:Math.max(...e.map(t=>t.y2))}:null}function gy(e){return my(Ul(e).map(t=>t.box))}const Vl=(e,t)=>(e instanceof Map?e.get(t):e?.[t])??null;function J$(e,t,n){const r=Ke(e),o=[];for(const s of r.nodes){const i=t[s.id];if(i)for(const{kind:a,box:c}of Ul(_o(s,r.checked_address,Vl(n,s.id))))o.push({id:s.id,kind:a,x1:i.x+c.x1,y1:i.y+c.y1,x2:i.x+c.x2,y2:i.y+c.y2})}return o}function W$(e,t,n){return my(J$(e,t,n))}function G$(e,t){return e.x1<t.x2&&t.x1<e.x2&&e.y1<t.y2&&t.y1<e.y2}function Y$(e){let t=0;for(const n of String(e))t=(t<<5)-t+n.charCodeAt(0)|0;return Math.abs(t)}function Q$(e,t,n){const r=Ke(e),o={x:t/2,y:n/2},s={},i=yo(r),a=Fl(r,i);if(!a)return s;s[a.id]=o;const c=new Map;for(const u of i){if(u.id===a.id)continue;let l=u.direction==="IN"?-1:1;u.direction==="MIXED"&&(l=Y$(u.id)%2?-1:1);const d=Math.min(2,Math.max(1,Number(u.hop)||1)),f=`${l}:${d}`;c.has(f)||c.set(f,[]),c.get(f).push(u)}for(const[u,l]of c){const[d,f]=u.split(":"),p=Number(d),h=Number(f),m=o.x+p*(h===1?t*.23:t*.43);Object.assign(s,X$(l,m,o.y,r.checked_address))}return s}function X$(e,t,n,r,o=24){const s=e.map((c,u)=>({node:c,x:t,y:n+(u-(e.length-1)/2)*64})),i=c=>gy(_o(c,r)),a=(c,u)=>Math.max(jd(c,r)+jd(u,r)+20,i(c).y2-i(u).y1+2);for(let c=0;c<o;c++){for(let d=1;d<s.length;d++){const f=s[d-1],p=s[d];!f||!p||(p.y=Math.max(p.y,f.y+a(f.node,p.node)))}for(let d=s.length-2;d>=0;d--){const f=s[d],p=s[d+1];!f||!p||(f.y=Math.min(f.y,p.y-a(f.node,p.node)))}const u=s[0],l=s[s.length-1];if(u&&l){const d=(u.y+l.y)/2,f=n-d;for(const p of s)p.y+=f}}return Object.fromEntries(s.map(c=>[c.node.id,{x:c.x,y:c.y}]))}function eS(e,t,n){const r=Ke(e),o={x:t/2,y:n/2},s={},i=yo(r),a=Fl(r,i);if(!a)return s;s[a.id]=o;const c=i.filter(u=>u.id!==a.id);return c.forEach((u,l)=>{const d=-Math.PI/2+l*Math.PI*2/Math.max(1,c.length),f=u.hop>=2?Math.min(t,n)*.39:Math.min(t,n)*.27;s[u.id]={x:o.x+Math.cos(d)*f,y:o.y+Math.sin(d)*f}}),s}function tS(e,t,n,r){const o=Ke(e),s=yo(o).filter(c=>t[c.id]),i=s.find(c=>c.address===o.checked_address);for(let c=0;c<s.length;c++)for(let u=c+1;u<s.length;u++){const l=s[c],d=s[u],f=l&&t[l.id],p=d&&t[d.id];if(!f||!p)continue;const h=p.x-f.x||.1,m=p.y-f.y||.1,_=Math.max(1,Math.hypot(h,m)),S=Math.max(0,88-_)*.012;f.x-=h/_*S,f.y-=m/_*S,p.x+=h/_*S,p.y+=m/_*S}const a=new Map(s.map(c=>[c.address,c]));for(const c of o.edges){const u=a.get(c.from),l=a.get(c.to);if(!u||!l)continue;const d=t[u.id],f=t[l.id];if(!d||!f)continue;const p=f.x-d.x,h=f.y-d.y,m=Math.max(1,Math.hypot(p,h)),_=(m-155)*.003;u!==i&&(d.x+=p/m*_,d.y+=h/m*_),l!==i&&(f.x-=p/m*_,f.y-=h/m*_)}return i&&(t[i.id]={x:n/2,y:r/2}),t}function nS(e,t,n,r=O$){const o=Ke(e),s=eS(o,t,n);for(let i=0;i<r;i++)tS(o,s,t,n);return s}function Lo(e,t,n,r){return t==="tree"?Q$(e,n,r):nS(e,n,r)}function rS(e,t,n,r,o={}){const s=Ke(e),i=t[n],a={...t};if(!i)return a;const c=o.spacing??80,u=o.gap??48,l=Math.max(1,o.perColumn??6),d=s.nodes.find(w=>w.id===n),f=new Map(s.nodes.map(w=>[w.id,w])),p=w=>gy(_o(w,s.checked_address,Vl(o.notes,w.id))),h=s.nodes.flatMap(w=>{const x=t[w.id];if(!x)return[];const C=p(w);return[{x1:x.x+C.x1,x2:x.x+C.x2}]});let m=h.length?Math.min(...h.map(w=>w.x1)):i.x,_=h.length?Math.max(...h.map(w=>w.x2)):i.x;const S={left:[],right:[]};for(const w of[...r].sort()){const x=f.get(w);if(!x||a[w])continue;const C=s.edges.some(O=>O.from===x.address&&O.to===d?.address),R=s.edges.some(O=>O.to===x.address&&O.from===d?.address);S[C&&!R?"left":"right"].push(x)}for(const w of["left","right"]){const x=S[w];for(let C=0;C<x.length;C+=l){const R=x.slice(C,C+l),O=R.map(p),F=Math.max(...O.map(te=>Math.max(-te.x1,te.x2))),oe=Math.max(c,Math.max(...O.map(te=>te.y2))-Math.min(...O.map(te=>te.y1))+6),le=w==="left"?m-u-F:_+u+F;R.forEach((te,ie)=>{a[te.id]={x:le,y:i.y+(ie-(R.length-1)/2)*oe}}),w==="left"?m=le-F:_=le+F}}return a}function oS(e,t,n,r=ar){const o=Math.max(1,e.x2-e.x1),s=Math.max(1,e.y2-e.y1),i=oa(Math.min((t-r*2)/o,(n-r*2)/s));return{x:t/2-(e.x1+e.x2)/2*i,y:n/2-(e.y1+e.y2)/2*i,scale:i}}function Fd(e,t,n,r=ar){return Math.min((t-r*2)/Math.max(1,e.x2-e.x1),(n-r*2)/Math.max(1,e.y2-e.y1))}function sS(e,t,n,r,o=4){const s=t.x-e.x,i=t.y-e.y,a=Math.hypot(s,i),c=n+o,u=r+o;if(!Number.isFinite(a)||a<=0||c+u>=a)return null;const l=s/a,d=i/a;return{x1:e.x+l*c,y1:e.y+d*c,x2:t.x-l*u,y2:t.y-d*u}}function Be(e){return Math.round(e*100)/100}function Pi(e,t,n,r,o){const s=i=>`${Be(i.x)},${Be(i.y)}`;return{kind:e,start:t,end:o,controls:[n,r],d:`M${s(t)} C${s(n)} ${s(r)} ${s(o)}`}}function sa(e,t,n,r,o=4){const s=t.x-e.x,i=t.y-e.y,a=Math.hypot(s,i),c=n+r+o*2;if(!Number.isFinite(a)||a<=c)return null;if(s>=c){const f={x:e.x+n+o,y:e.y},p={x:t.x-r-o,y:t.y},h=p.x-f.x,m=Math.max(h*.45,Math.min(65,h));return Pi("forward",f,{x:f.x+m,y:f.y},{x:p.x-m,y:p.y},p)}if(s<=-c){const f={x:e.x,y:e.y-n-o},p={x:t.x,y:t.y-r-o},h=Math.max(100,Math.abs(s)*.2);return Pi("backward",f,{x:f.x+85,y:f.y-h},{x:p.x+85,y:p.y-h},p)}if(Math.abs(i)>c){const f=i>0?1:-1,p={x:e.x,y:e.y+f*(n+o)},h={x:t.x,y:t.y-f*(r+o)},m=Math.abs(h.y-p.y),_=Math.max(m*.45,Math.min(40,m));return Pi("vertical",p,{x:p.x,y:p.y+f*_},{x:h.x,y:h.y-f*_},h)}const u=sS(e,t,n,r,o),l={x:u.x1,y:u.y1},d={x:u.x2,y:u.y2};return{kind:"straight",start:l,end:d,controls:null,d:`M${Be(l.x)},${Be(l.y)} L${Be(d.x)},${Be(d.y)}`}}const iS=6,Mi=iS+3,ot=14,Ud=10,aS=3,Vd=6;function cS(e,t,n){const r=Ke(e),o=[];for(const s of r.nodes){const i=t[s.id];if(i)for(const{kind:a,box:c}of Ul(_o(s,r.checked_address,Vl(n,s.id))))a==="circle"?o.push({id:s.id,kind:"circle",x:i.x,y:i.y,r:c.x2}):o.push({id:s.id,kind:"box",x1:i.x+c.x1,y1:i.y+c.y1,x2:i.x+c.x2,y2:i.y+c.y2})}return o}function uS(e,t){if(t.kind==="circle")return Math.hypot(e.x-t.x,e.y-t.y)-t.r;const n=Math.max(t.x1-e.x,0,e.x-t.x2),r=Math.max(t.y1-e.y,0,e.y-t.y2);return n||r?Math.hypot(n,r):-Math.min(e.x-t.x1,t.x2-e.x,e.y-t.y1,t.y2-e.y)}function lS(e,t){return e.kind==="circle"?{x1:e.x-e.r-t,y1:e.y-e.r-t,x2:e.x+e.r+t,y2:e.y+e.r+t}:{x1:e.x1-t,y1:e.y1-t,x2:e.x2+t,y2:e.y2+t}}function dS(e,t){const n=1-t;return{x:n*n*n*e[0].x+3*n*n*t*e[1].x+3*n*t*t*e[2].x+t*t*t*e[3].x,y:n*n*n*e[0].y+3*n*n*t*e[1].y+3*n*t*t*e[2].y+t*t*t*e[3].y}}function fS(e){return e.controls?[{kind:"C",points:[e.start,e.controls[0],e.controls[1],e.end]}]:[{kind:"L",points:[e.start,e.end]}]}function yy(e){let t=0,n;for(const r of e)n&&(t+=Math.hypot(r.x-n.x,r.y-n.y)),n=r;return t}function pS(e,t){const n=[];for(const r of e){const o=Math.max(1,Math.ceil(yy(r.points)/t));for(let s=0;s<=o;s++){const i=s/o;if(r.kind==="L"){const[a,c]=r.points;n.push({x:a.x+(c.x-a.x)*i,y:a.y+(c.y-a.y)*i})}else n.push(dS(r.points,i))}}return n}function qd(e,t,n,r){const o=e.flatMap(a=>a.points),s={x1:Math.min(...o.map(a=>a.x)),y1:Math.min(...o.map(a=>a.y)),x2:Math.max(...o.map(a=>a.x)),y2:Math.max(...o.map(a=>a.y))},i=[];if(n.forEach((a,c)=>{a.x1<=s.x2&&s.x1<=a.x2&&a.y1<=s.y2&&s.y1<=a.y2&&i.push(c)}),!i.length)return!0;for(const a of pS(e,aS))for(const c of i){const u=n[c],l=t[c];if(!(!u||!l)&&!(a.x<u.x1||a.x>u.x2||a.y<u.y1||a.y>u.y2)&&uS(a,l)<r)return!1}return!0}function hS(e){const t=e[0],n=e[e.length-1];if(!t||!n)return[];const r=[];for(let i=1;i<e.length;i++)r.push(yy(e.slice(i-1,i+1)));const o=[];let s=t;for(let i=1;i<e.length-1;i++){const a=e[i-1],c=e[i],u=e[i+1],l=r[i-1],d=r[i];if(!a||!c||!u||l===void 0||d===void 0)continue;const f=l/(i-1===0?1:2),p=d/(i===r.length-1?1:2),h=Math.min(ot,f,p),m={x:(c.x-a.x)/l,y:(c.y-a.y)/l},_={x:(u.x-c.x)/d,y:(u.y-c.y)/d},S={x:c.x-m.x*h,y:c.y-m.y*h},w={x:c.x+_.x*h,y:c.y+_.y*h};o.push({kind:"L",points:[s,S]}),o.push({kind:"C",points:[S,{x:S.x+m.x*h*.55,y:S.y+m.y*h*.55},{x:w.x-_.x*h*.55,y:w.y-_.y*h*.55},w]}),s=w}return o.push({kind:"L",points:[s,n]}),o.filter(i=>i.kind==="C"||Math.hypot(i.points[1].x-i.points[0].x,i.points[1].y-i.points[0].y)>.01)}function mS(e){const t=o=>`${Be(o.x)},${Be(o.y)}`,n=e[0];if(!n)return"";let r=`M${t(n.points[0])}`;for(const o of e)r+=o.kind==="L"?` L${t(o.points[1])}`:` C${t(o.points[1])} ${t(o.points[2])} ${t(o.points[3])}`;return r}function Hd(e,t,n,r,o){const s=Math.min(e.y,n)-ot,i=Math.max(e.y,n)+ot,a=d=>(d-e.x)*t;let c=1/0;for(const d of o)if(d.y1<e.y&&e.y<d.y2){const f=t===1?d.x1:d.x2,p=t===1?d.x2:d.x1;a(p)>0&&(c=Math.min(c,Math.max(0,a(f))))}const u=o.filter(d=>d.y1<i&&s<d.y2).map(d=>[a(t===1?d.x1:d.x2),a(t===1?d.x2:d.x1)]).filter(([,d])=>d>r).sort((d,f)=>d[0]-f[0]);let l=r;for(const[d,f]of[...u,[1/0,1/0]]){if(d>l+1){const p=Math.min(d,c);if(p<=l+1)return null;const h=Number.isFinite(p)&&p-l<80?(l+p)/2:l+40;return e.x+t*h}if(l=Math.max(l,f),l>=c)return null}return null}function gS(e){const t=[];for(const n of e){const r=t[t.length-1];r&&Math.abs(r.x-n.x)<.01&&Math.abs(r.y-n.y)<.01||t.push(n)}return t.filter((n,r)=>{if(r===0||r===t.length-1)return!0;const o=t[r-1],s=t[r+1];return!o||!s?!0:!(Math.abs(o.x-n.x)<.01&&Math.abs(s.x-n.x)<.01||Math.abs(o.y-n.y)<.01&&Math.abs(s.y-n.y)<.01)})}const yS=120;function _S(e,t,n,r,o,s=4){const i=sa(e,t,n,r,s);if(!i||!o.length)return i;const a=o.map(f=>lS(f,Mi));if(qd(fS(i),o,a,Mi))return i;const c=new Set([e.y,t.y]),u=f=>Math.abs(f-e.y)<Vd?e.y:Math.abs(f-t.y)<Vd?t.y:f;for(const f of a)c.add(u(Math.round(f.y1)-ot-1)),c.add(u(Math.round(f.y2)+ot+1));const l=t.x>=e.x?1:-1,d=[[l,l],[l,-l],[-l,l],[-l,-l]];for(const[f,p]of d){const h={x:e.x+f*(n+s),y:e.y},m={x:t.x-p*(r+s),y:t.y},_=[];for(const S of c){const w=Math.abs(S-h.y)<.01?h.x:Hd(h,f,S,ot,a);if(w===null)continue;const x=Math.abs(S-m.y)<.01?m.x:Hd(m,-p,S,ot+Ud,a);if(x===null||Math.abs(S-m.y)<.01&&(m.x-w)*p<ot+Ud||Math.abs(S-h.y)<.01&&(x-h.x)*f<ot)continue;const C=gS([h,{x:w,y:h.y},{x:w,y:S},{x,y:S},{x,y:m.y},m]);if(!bS(C,a))continue;let R=(C.length-2)*ot,O;for(const F of C)O&&(R+=Math.abs(F.x-O.x)+Math.abs(F.y-O.y)),O=F;_.push({points:C,length:R})}_.sort((S,w)=>{const x=S.points[2]?.y,C=w.points[2]?.y;return S.length-w.length||(x===void 0||C===void 0?0:x-C)});for(const S of _){const w=hS(S.points);if(!qd(w,o,a,Mi))continue;const x=S.points,C=x[0],R=x[x.length-1];if(!C||!R)continue;const O={x1:Math.min(...x.map(F=>F.x)),y1:Math.min(...x.map(F=>F.y)),x2:Math.max(...x.map(F=>F.x)),y2:Math.max(...x.map(F=>F.y))};return{kind:"routed",start:C,end:R,controls:null,d:mS(w),bounds:O}}}return i}function bS(e,t){let n;for(const r of e){if(n){const o={x1:Math.min(n.x,r.x),y1:Math.min(n.y,r.y),x2:Math.max(n.x,r.x),y2:Math.max(n.y,r.y)};for(const s of t)if(G$(o,s))return!1}n=r}return!0}function wS(e,t){if(!t)return zt.rest;const n=pe(t);return pe(e.from)===n||pe(e.to)===n?zt.related:zt.faded}function vS(){return{hit:{stroke:"transparent",width:16},line:{stroke:fe("edge"),width:1.6},arrow:{fill:fe("edge")}}}function kS(e,t,n){return e!=="gravity"&&e!=="tree"?null:{layout:e,id:t,pointerId:n}}function $S(e,t,n,r){return e!=="node"&&e!=="edge"&&e!=="canvas"||!Number.isFinite(r?.x)||!Number.isFinite(r?.y)?null:{kind:e,id:t??null,pointerId:n,start:{...r},moved:!1}}function SS(e,t,n,r=A$){if(!e||e.pointerId!==t)return e;const o=Math.hypot(n.x-e.start.x,n.y-e.start.y);return{...e,moved:e.moved||o>r}}function xS(e,t,n=!1){return!e||e.pointerId!==t||n||e.moved?null:e.kind==="node"?{type:"select-node",id:e.id}:e.kind==="edge"?{type:"select-edge",id:e.id}:e.kind==="canvas"?{type:"select-checked"}:null}function Bd(e){return e==="Enter"||e===" "}function IS(e,t){return{x:(e.x-t.x)/t.scale,y:(e.y-t.y)/t.scale}}function zS(e,t,n,r,o){return!t||t.pointerId!==n||!Object.hasOwn(e,t.id)?!1:(e[t.id]=IS(r,o),!0)}function TS(e,t){return e?.pointerId===t?null:e}function CS(e,t,n,r){const o=Math.min(t.width/n,t.height/r),s=t.left+(t.width-n*o)/2,i=t.top+(t.height-r*o)/2;return{x:(e.x-s)/o,y:(e.y-i)/o}}function ES(e,t){const n=new Map;let r=null,o=null,s=null;function i(f){if(f===e)return{kind:"canvas",id:null};const p=f;if(p?.closest?.("[data-canvas]"))return{kind:"canvas",id:null};const h=p?.closest?.("[data-node-id]");if(h)return{kind:"node",id:h.dataset.nodeId??null};const m=p?.closest?.("[data-edge-id]");return m?{kind:"edge",id:m.dataset.edgeId??null}:null}function a(f){if(f.pointerType==="mouse"&&f.button!==0)return;const p=i(f.target);if(!p)return;const h=t.point(f);if(n.set(f.pointerId,h),e.setPointerCapture(f.pointerId),p.kind!=="canvas"&&(f.preventDefault(),f.stopPropagation()),n.size===1){r=$S(p.kind,p.id,f.pointerId,{x:f.clientX,y:f.clientY}),o=p.kind==="canvas"?{point:h,transform:{...t.transform()}}:null;return}if(r&&(r={...r,moved:!0}),o=null,n.size===2){const[m,_]=[...n.values()];m&&_&&(s={distance:Math.hypot(_.x-m.x,_.y-m.y),scale:t.transform().scale},t.startPinch())}}function c(f){if(!n.has(f.pointerId))return;const p=t.point(f);if(n.set(f.pointerId,p),s){const[h,m]=[...n.values()];h&&m&&t.pinch(s,[h,m],f);return}if(r?.pointerId===f.pointerId){if(r=SS(r,f.pointerId,{x:f.clientX,y:f.clientY}),!r?.moved)return;if(r.kind==="node"){t.drag(r.id??"",f.pointerId,p,f);return}if(r.kind==="edge")return}o&&t.pan(o,p,f)}function u(f,p=!1){const h=xS(r,f.pointerId,p);h&&t.select(h),r?.pointerId===f.pointerId&&(r=null),t.endDrag(f.pointerId),n.delete(f.pointerId),n.size||(r=null,o=null,s=null),e.hasPointerCapture(f.pointerId)&&e.releasePointerCapture(f.pointerId)}const l=f=>u(f),d=f=>u(f,!0);return e.addEventListener("pointerdown",a,!0),e.addEventListener("pointermove",c),e.addEventListener("pointerup",l),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("pointerdown",a,!0),e.removeEventListener("pointermove",c),e.removeEventListener("pointerup",l),e.removeEventListener("pointercancel",d)}}function AS(e,t,n){let r=!1;function o(s,i=!1){r=s,e.classList.toggle("graph-panel--expanded",s),n.classList.toggle("graph-expanded",s),t.classList.toggle("expand-control--expanded",s),t.setAttribute("aria-expanded",String(s)),t.setAttribute("aria-label",s?"Close expanded graph":"Expand graph"),t.setAttribute("title",s?"Close expanded graph":"Expand graph"),s?(e.setAttribute("role","dialog"),e.setAttribute("aria-modal","true")):(e.removeAttribute("role"),e.removeAttribute("aria-modal"),i&&t.focus())}return{open(){o(!0)},close(s={}){o(!1,s.restoreFocus!==!1)},toggle(){o(!r,r)},isOpen(){return r}}}function _y(e){const t=String(e??"").toLowerCase();return t?t.charAt(0).toUpperCase()+t.slice(1):"Unknown"}function ia(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:2}).format(e)}function aa(e){return e==null?"Unavailable":new Intl.NumberFormat("en-US").format(e)}function Tt(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return"Unavailable";const t=new Date(e<1e11?e*1e3:e);return!Number.isFinite(t.getTime())||t.getUTCFullYear()<2009||t.getUTCFullYear()>2100?"Unavailable":new Intl.DateTimeFormat("en-GB",{dateStyle:"medium",timeStyle:"short",timeZone:"UTC"}).format(t)}function by(e,t=Date.now()){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return"Unavailable";const n=Math.max(0,(t-(e<1e11?e*1e3:e))/1e3),r=[[31536e3,"year"],[2592e3,"month"],[86400,"day"],[3600,"hour"],[60,"minute"]];for(const[o,s]of r){const i=Math.floor(n/o);if(i>=1)return`${i} ${s}${i===1?"":"s"} ago`}return"just now"}function ca(e){if(e.amount_usd_sum==null||e.price_coverage_ratio===0)return"Unavailable";const t=e.price_coverage_ratio;return ia(e.amount_usd_sum)+(t!=null&&t>0&&t<1?" (priced portion)":"")}function NS(e){const t=[["Incoming amount (USD)",e.total_in_usd==null?"Unavailable":ia(e.total_in_usd)],["Outgoing amount (USD)",e.total_out_usd==null?"Unavailable":ia(e.total_out_usd)]];return e.role&&go.includes(e.role)?[["Role",hy[e.role]||"Other"],...t,["Senders",aa(e.degree_in)],["Receivers",aa(e.degree_out)],["Labels",Et(e).join(", ")||"No labels"]]:[["Address risk",e.risk_score==null?"Not scored":`${Math.round(e.risk_score*100)} · ${_y(e.risk_level)}`],["Confidence","Unavailable"],...t,["First activity (UTC)",Tt(e.first_activity_timestamp)],["Last activity (UTC)",Tt(e.last_activity_timestamp)],["Labels",Et(e).join(", ")||"No labels"]]}function OS(e,t){if(e.source==="flows")return[["From",e.from||"Unavailable"],["To",e.to||"Unavailable"],["Value (USD)",ca(e)],["Transfers",aa(e.tx_count)],["First seen (UTC)",Tt(e.first_seen_timestamp)],["Last seen (UTC)",Tt(e.last_seen_timestamp)],["Since last seen",by(e.last_seen_timestamp,t)],...e.link_kind?[["Link kind",e.link_kind]]:[]];const n=e.price_coverage_ratio;return[["From",e.from||"Unavailable"],["To",e.to||"Unavailable"],["Value (USD)",ca(e)],["Price coverage",n==null?"Unavailable":new Intl.NumberFormat("en-GB",{style:"percent",maximumFractionDigits:1}).format(n)],["Transfers",e.tx_count==null?"Unavailable":String(e.tx_count)],["First seen (UTC)",Tt(e.first_seen_timestamp)],["Last seen (UTC)",Tt(e.last_seen_timestamp)],["First transaction",e.first_tx_id||"Unavailable"],["Last transaction",e.last_tx_id||"Unavailable"]]}function wy(e){return typeof e!="string"||!/^0x[a-fA-F0-9]{64}$/.test(e)?null:`https://robinhoodchain.blockscout.com/tx/${e.toLowerCase()}`}function Kd(e){const t=Si(e);if(e.role)return`${e.address}. ${t||"Other"}.${Et(e).length?` Labels: ${Et(e).join(", ")}.`:""}`;const n=e.risk_score==null?"Not scored":`${Math.round(e.risk_score*100)} ${_y(e.risk_level)} risk`,r=Et(e).join(", ");return`${e.address}. ${n}.${r?` Labels: ${r}.`:""}`}function Jd(e,t){const n=`${e.from} to ${e.to}. Aggregate value ${ca(e)}. ${e.tx_count??0} ${e.tx_count===1?"transfer":"transfers"}.`;return e.source==="flows"&&e.last_seen_timestamp?`${n} Last seen ${by(e.last_seen_timestamp,t)}.`:n}function PS(e,t){return Ke(e).nodes.map(n=>{const r={id:n.address,label:Et(n).join(", ")||Si(n)};n.role&&(r.role=n.role);const o=t?.(n.address);return o&&(r.href=o),r})}let MS=0;function me(e,t={}){const n=document.createElementNS(T$,e);for(const[r,o]of Object.entries(t))n.setAttribute(r,String(o));return n}function LS(e,t,n){const r=me("text",{x:0,y:t,"text-anchor":"middle",class:n,"pointer-events":"none"});return r.textContent=e,r}function RS(e,t=22){return e.length>t?`${e.slice(0,t-1)}…`:e}function DS(e,t,n={}){const r=`cia-graph-${++MS}`,o=e.ownerDocument;let s=Ke(t),i=n.layout??(Zl(t)?"tree":"gravity");const a={width:e.clientWidth||n.width||820,height:e.clientHeight||n.height||430};let c=Lo(s,i,a.width,a.height);const u=new Map,l=new Map;let d=null;const f=()=>{if(d)return d;const g=new Map;d=g;const $=s.nodes.length>yS,T=new Map(s.nodes.map(P=>[P.address,P])),E=cS(s,c,u);for(const P of s.edges){const M=T.get(P.from),q=T.get(P.to),he=M&&c[M.id],Se=q&&c[q.id];if(!M||!q||!he||!Se){g.set(P.id,null);continue}if($){g.set(P.id,sa(he,Se,jt(M,s.checked_address),jt(q,s.checked_address)));continue}const ft=E.filter(et=>et.id!==M.id&&et.id!==q.id);g.set(P.id,_S(he,Se,jt(M,s.checked_address),jt(q,s.checked_address),ft))}return g},p=()=>{const g=W$(s,c,u);if(!g)return null;for(const $ of f().values())$?.bounds&&(g.x1=Math.min(g.x1,$.bounds.x1),g.y1=Math.min(g.y1,$.bounds.y1),g.x2=Math.max(g.x2,$.bounds.x2),g.y2=Math.max(g.y2,$.bounds.y2));return g},h=()=>{const g=p();return g?oS(g,a.width,a.height,ar):{x:0,y:0,scale:1}};let m=h(),_=null,S=null;const w=n.now??(()=>Date.now());e.classList.add("cia-graph-engine"),e.closest(".cia-graph-surface")||e.classList.add("cia-graph-surface");const x=me("svg",{class:"cia-graph-svg",viewBox:`0 0 ${a.width} ${a.height}`,role:"group",tabindex:0,"aria-label":n.label??"Money-flow graph. Drag the background or use arrow keys to pan, plus and minus to zoom. Select an address or a link for details."}),C=me("defs"),R=me("pattern",{id:`${r}-dots`,width:24,height:24,patternUnits:"userSpaceOnUse"});R.append(me("circle",{class:"cia-graph-dot",cx:1,cy:1,r:1})),C.append(R);const O=me("rect",{class:"cia-graph-backdrop",width:"100%",height:"100%","data-canvas":""}),F=me("rect",{class:"cia-graph-dots",width:"100%",height:"100%",fill:`url(#${r}-dots)`,"data-canvas":""}),oe=me("g",{"data-viewport":""}),le=me("g",{"data-edges":"",class:"cia-graph-edges"}),te=me("g",{"data-nodes":"",class:"cia-graph-nodes"});oe.append(le,te),x.append(C,O,F,oe);const ie=o.createElement("div");ie.className="graph-tooltip cia-graph-tooltip",ie.hidden=!0,ie.setAttribute("role","tooltip"),e.append(x,ie);const qe=new Map,Pe=new Map,ct=new Map;function vo(g){let $=qe.get(g);if($)return $;$=`${r}-arrow-${qe.size}`;const T=me("marker",{id:$,viewBox:"0 0 10 10",refX:9,refY:5,markerWidth:6,markerHeight:6,orient:"auto-start-reverse",markerUnits:"strokeWidth"}),E=me("path",{d:"M0 0L10 5L0 10Z",class:"cia-graph-arrowhead"});return E.style.fill=g,T.append(E),C.append(T),qe.set(g,$),$}const ko=()=>new Map(s.nodes.map(g=>[g.address,g])),Ye=g=>n.nodeStyle?.(g).stroke??B$(g);function ut(){le.replaceChildren(),te.replaceChildren(),Pe.clear(),ct.clear();const g=ko();for(const $ of s.edges){const T=g.get($.from);if(!T||!g.get($.to))continue;const E=Ye(T),P=me("g",{class:"cia-graph-edge graph-edge",tabindex:0,role:"button","aria-label":Jd($,w())});P.dataset.edgeId=$.id,P.style.setProperty("--edge-tone",E);const M=vS(),q=me("path",{class:"cia-graph-edge-hit","stroke-width":M.hit.width,"pointer-events":"stroke"}),he=me("path",{class:"cia-graph-edge-line","stroke-width":M.line.width,"marker-end":`url(#${vo(E)})`,"pointer-events":"none"});P.append(q,he),P.addEventListener("keydown",Se=>{Bd(Se.key)&&(Se.preventDefault(),Qt($.id))}),P.addEventListener("pointerenter",Se=>Xe(Se,Jd($,w()))),P.addEventListener("pointerleave",Un),le.append(P),ct.set($.id,{group:P,hit:q,line:he})}for(const $ of yo(s))te.append(Ii($));Gt(),dt()}function Ii(g){const $=g.address===s.checked_address,T=u.get(g.id),E=_o(g,s.checked_address,T),P=E.radius,M=me("g",{class:"cia-graph-node graph-node",tabindex:0,role:"button","aria-label":Kd(g),"aria-pressed":"false"});M.dataset.nodeId=g.id,$&&(M.dataset.checked=""),M.style.setProperty("--node-tone",Ye(g)),$&&M.append(me("circle",{class:"cia-graph-node-ring",r:P+6})),M.append(me("circle",{class:"cia-graph-node-body",r:P})),M.append(me("circle",{class:"cia-graph-node-dot",r:E.dot}));for(const q of E.texts)M.append(LS(q.text,q.y,`cia-graph-node-${q.kind}`));T&&(M.dataset.state="refused");for(const q of l.get(g.id)??[])M.setAttribute(`data-flag-${q}`,"");return M.addEventListener("keydown",q=>{Bd(q.key)&&(q.preventDefault(),St(g.id))}),M.addEventListener("pointerenter",q=>Xe(q,Kd(g))),M.addEventListener("pointerleave",Un),Pe.set(g.id,M),M}function kt(){oe.setAttribute("transform",`translate(${m.x} ${m.y}) scale(${m.scale})`)}function Gt(){kt();for(const[$,T]of Pe){const E=c[$]??{x:a.width/2,y:a.height/2};T.setAttribute("transform",`translate(${Be(E.x)} ${Be(E.y)})`)}const g=f();for(const $ of s.edges){const T=ct.get($.id);if(!T)continue;const E=g.get($.id)??null;T.group.style.display=E?"":"none",E&&(T.hit.setAttribute("d",E.d),T.line.setAttribute("d",E.d))}}let $t=!1;function lt(g){$t=!0;const $=c[g],T=Pe.get(g);if(!$||!T)return;T.setAttribute("transform",`translate(${Be($.x)} ${Be($.y)})`);const E=s.nodes.find(M=>M.id===g);if(!E)return;const P=new Map(s.nodes.map(M=>[M.address,M]));for(const M of s.edges){if(M.from!==E.address&&M.to!==E.address)continue;const q=ct.get(M.id),he=P.get(M.from),Se=P.get(M.to),ft=he&&c[he.id],et=Se&&c[Se.id];if(!q||!he||!Se||!ft||!et)continue;const Me=sa(ft,et,jt(he,s.checked_address),jt(Se,s.checked_address));q.group.style.display=Me?"":"none",Me&&(q.hit.setAttribute("d",Me.d),q.line.setAttribute("d",Me.d))}}function $o(){return _?.kind!=="node"?null:s.nodes.find(g=>g.id===_.id)?.address??null}function dt(){const g=$o();for(const $ of s.edges){const T=ct.get($.id);if(!T)continue;const E=_?.kind==="edge"&&_.id===$.id,P=_?.kind==="edge"?E?zt.related:zt.faded:wS($,g),M=P===zt.faded;T.group.setAttribute("opacity",M?String(P):"1"),T.line.setAttribute("stroke-opacity",M?"1":String(P)),T.group.dataset.opacity=String(P),T.group.dataset.state=P===zt.rest?"rest":P===zt.related?"related":"faded",T.group.setAttribute("aria-pressed",String(E))}for(const[$,T]of Pe){const E=_?.kind==="node"&&_.id===$;T.classList.toggle("is-selected",E),T.setAttribute("aria-pressed",String(E))}}function Yt(){const g=PS(s,n.href),$=_?.kind==="node"?s.nodes.find(E=>E.id===_.id)??null:null,T=_?.kind==="edge"?s.edges.find(E=>E.id===_.id)??null:null;if($){const E=s.edges.filter(P=>P.from===$.address||P.to===$.address);return{kind:"node",id:$.id,selectedId:$.address,nodes:g,title:"Selected address",identity:$.address,values:NS($),related:E,node:$,edge:null}}return T?{kind:"edge",id:T.id,selectedId:null,nodes:g,title:"Selected aggregate flow",identity:`${T.from} → ${T.to}`,values:OS(T,w()),related:[T],node:null,edge:T}:{kind:null,id:null,selectedId:null,nodes:g,title:"Nothing selected",identity:"",values:[],related:[],node:null,edge:null}}function So(){const g=Yt();zi(g),n.onSelect?.(g)}function zi(g){const $=n.selectionRoot,T=$?.querySelector("[data-selection-title]"),E=$?.querySelector("[data-selection-identity]"),P=$?.querySelector("[data-selection-meta]");!T||!E||!P||(T.textContent=g.title,E.textContent=g.identity,P.replaceChildren(...g.values.map(([M,q])=>{const he=o.createElement("div");he.className="meta-item",q!=="Unavailable"&&(["From","To","First transaction","Last transaction"].includes(M)&&he.classList.add("meta-item--identity"),M==="Incoming amount (USD)"&&he.classList.add("meta-item--incoming"),M==="Outgoing amount (USD)"&&he.classList.add("meta-item--outgoing")),["From","To","First transaction","Last transaction","Labels"].includes(M)&&he.classList.add("meta-item--wide");const Se=o.createElement("span");Se.textContent=M;const ft=o.createElement("strong"),et=["First transaction","Last transaction"].includes(M)?wy(q):null;if(et&&n.openLink){const Me=n.openLink,Mt=o.createElement("button");Mt.type="button",Mt.className="cia-graph-explorer-link",Mt.dataset.explorer=et,Mt.textContent=q,Mt.setAttribute("aria-label",`${M}: ${q} (opens the explorer)`),Mt.addEventListener("click",()=>Me(et)),ft.append(Mt)}else if(et){const Me=o.createElement("a");Me.href=et,Me.target="_blank",Me.rel="noopener noreferrer",Me.textContent=q,Me.setAttribute("aria-label",`${M}: ${q} (opens in new tab)`),ft.append(Me)}else ft.textContent=q;return he.append(Se,ft),he})))}function St(g){_=g?{kind:"node",id:g}:null,dt(),So()}function Qt(g){_=g?{kind:"edge",id:g}:null,dt(),So()}function ae(g){if(g==null)return St(null);const $=Wn(s,g);if($)return St($);if(s.edges.some(T=>T.id===g))return Qt(g)}function ze(){m=h(),kt()}function Qe(g,$={x:a.width/2,y:a.height/2}){const T=oa(m.scale*(1+g)),E=T/m.scale;m={x:$.x-($.x-m.x)*E,y:$.y-($.y-m.y)*E,scale:T},kt()}function Fn(g){i=g,n.controls?.querySelectorAll("[data-layout]").forEach($=>{$.classList.toggle("active",$.dataset.layout===g),$.setAttribute("aria-pressed",String($.dataset.layout===g))}),n.onLayoutChange?.(g),c=Lo(s,i,a.width,a.height),d=null,ze(),Gt()}function Xe(g,$){ie.textContent=$,ie.hidden=!1;const T=e.getBoundingClientRect();ie.style.left=`${Math.min(T.width-330,Math.max(8,g.clientX-T.left+12))}px`,ie.style.top=`${Math.max(8,g.clientY-T.top+12)}px`}function Un(){ie.hidden=!0}function Xt(g){return CS({x:g.clientX,y:g.clientY},x.getBoundingClientRect(),a.width,a.height)}const xo=ES(x,{point:Xt,transform:()=>m,select(g){g.type==="select-node"?St(g.id):g.type==="select-edge"?Qt(g.id):St(Fl(s)?.id??null)},drag(g,$,T){!S&&(S=kS(i,g,$),!S)||zS(c,S,$,T,m)&<(S.id)},endDrag(g){const $=S?.pointerId===g&&$t;S=TS(S,g),$&&($t=!1,d=null,Gt())},pan(g,$){m={x:g.transform.x+$.x-g.point.x,y:g.transform.y+$.y-g.point.y,scale:m.scale},kt()},startPinch(){S=null},pinch(g,[$,T]){const E=Math.hypot(T.x-$.x,T.y-$.y),P=oa(g.scale*E/Math.max(1,g.distance));Qe(P/m.scale-1,{x:($.x+T.x)/2,y:($.y+T.y)/2})}}),en=g=>{g.preventDefault(),Qe(g.deltaY>0?-.12:.12,Xt(g))},Io={ArrowLeft:[60,0],ArrowRight:[-60,0],ArrowUp:[0,60],ArrowDown:[0,-60]},tn=g=>{if(g.target!==x)return;const $=Io[g.key];$?(g.preventDefault(),m={...m,x:m.x+$[0],y:m.y+$[1]},kt()):g.key==="+"||g.key==="="?Qe(.18):g.key==="-"?Qe(-.18):g.key==="0"&&ze()};x.addEventListener("wheel",en,{passive:!1}),x.addEventListener("keydown",tn);const nn=n.controls?.querySelector("[data-expand]")??null,rt=n.panel&&nn?AS(n.panel,nn,o.body):null,zo=()=>{rt?.toggle(),n.onExpansionChange?.(rt?.isOpen()??!1),requestAnimationFrame(ze)},Vn=n.panel??e,qn=g=>{if(g.key==="Tab"&&rt?.isOpen()&&n.panel){const $=Array.from(n.panel.querySelectorAll('button,a[href],[tabindex="0"],summary')).filter(P=>P.checkVisibility()),T=$[0],E=$.at(-1);g.shiftKey&&o.activeElement===T?(g.preventDefault(),E?.focus()):!g.shiftKey&&o.activeElement===E&&(g.preventDefault(),T?.focus())}if(g.key==="Escape"){if(rt?.isOpen()){rt.close(),n.onExpansionChange?.(!1),requestAnimationFrame(ze);return}St(null)}};Vn.addEventListener("keydown",qn);const Hn=[],N=(g,$)=>{g&&(g.addEventListener("click",$),Hn.push([g,$]))};n.controls?.querySelectorAll("[data-layout]").forEach(g=>N(g,()=>Fn(g.dataset.layout==="tree"?"tree":"gravity"))),N(n.controls?.querySelector("[data-zoom='in']"),()=>Qe(.18)),N(n.controls?.querySelector("[data-zoom='out']"),()=>Qe(-.18)),N(n.controls?.querySelector("[data-zoom='fit']"),ze),rt&&N(nn,zo);const K=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>{const g=e.clientWidth,$=e.clientHeight;!g||!$||g===a.width&&$===a.height||(a.width=g,a.height=$,x.setAttribute("viewBox",`0 0 ${g} ${$}`),ze())});return K?.observe(e),ut(),n.selected&&ae(n.selected),{update(g){const $=c;s=Ke(g);const T=Lo(s,i,a.width,a.height);c=Object.fromEntries(s.nodes.map(E=>[E.id,$[E.id]??T[E.id]]).filter(([,E])=>E)),d=null,_&&!(_.kind==="node"?s.nodes.some(E=>E.id===_.id):s.edges.some(E=>E.id===_.id))&&(_=null),m=h(),ut()},merge(g,$){const T=U$(s,g,$);s=T.model;const E=Wn(s,$??Ke(g).checked_address);return c=E?rS(s,c,E,T.added,{notes:u}):{...c,...Lo(s,i,a.width,a.height),...c},d=null,T.added.length&&(m=h()),ut(),T.added},setTheme(g){g&&o.documentElement.setAttribute("data-theme",g);for(const $ of s.nodes)Pe.get($.id)?.style.setProperty("--node-tone",Ye($))},select:ae,destroy(){K?.disconnect(),xo(),x.removeEventListener("wheel",en),x.removeEventListener("keydown",tn),Vn.removeEventListener("keydown",qn);for(const[g,$]of Hn)g.removeEventListener("click",$);rt?.close({restoreFocus:!1}),x.remove(),ie.remove(),e.classList.remove("cia-graph-engine")},fit:ze,zoom:g=>Qe(g),setLayout:Fn,markNode(g,$){const T=Wn(s,g);T&&($?u.set(T,$):u.delete(T),d=null,ut())},flagNode(g,$,T){const E=Wn(s,g);if(!E)return;const P=l.get(E)??new Set;T?P.add($):P.delete($),P.size?l.set(E,P):l.delete(E);const M=Pe.get(E);M&&M.toggleAttribute(`data-flag-${$}`,T)},positions:()=>structuredClone(c),model:()=>s,contentBounds:()=>p(),transform:()=>({...m})}}const vy="chain-insights.flows.v1",ky="chain-insights.result.v1",ZS=60,Wd=6,jS=3,$y=/^0x[0-9a-fA-F]{40}$/,FS=/^0x[0-9a-fA-F]{64}$/;function US(e){return typeof e=="string"&&($y.test(e)||FS.test(e))}function ts(e){return typeof e=="string"&&$y.test(e)}function ua(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Sy(e){const t=e?.facts?.query?.results;return Array.isArray(t)?t.filter(ua):[]}function VS(e){const t=e?.facts;return typeof t?.subject?.network=="string"&&t.subject.network?t.subject.network:"robinhood"}function st(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&/^-?\d+(\.\d+)?([eE][-+]?\d+)?$/.test(e.trim())){const t=Number(e);return Number.isFinite(t)?t:null}return null}function ql(e){return e<1e11?e*1e3:e}const la=/^\d{4}-\d{2}-\d{2}$/,qS=Date.UTC(2009,0,1),HS=Date.UTC(2100,0,1);function Li(e){return new Date(ql(e)).toISOString().slice(0,10)}function Gd(e){const t=Date.parse(`${e}T00:00:00Z`);return new Date(t-864e5).toISOString().slice(0,10)}function BS(e){return typeof e=="string"&&la.test(e)&&Number.isFinite(Date.parse(`${e}T00:00:00Z`))}const KS=new Set(["day","date"]);function Yd(e){return KS.has(e)||e.endsWith("_timestamp")}function JS(e){const t=[];for(const n of e)for(const r of Object.keys(n))t.includes(r)||t.push(r);return t}function WS(e){return Array.isArray(e)?e.some(ts):ts(e)}function GS(e){return e.some(t=>Object.values(t).some(WS))}function YS(e){return e.length>0&&e.every(t=>ts(t.from_address)&&ts(t.to_address))}function Qd(e){if(typeof e=="string"){const r=e.trim();if(la.test(r)||/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}/.test(r)){const o=Date.parse(la.test(r)?`${r}T00:00:00Z`:/(?:Z|[+-]\d{2}:?\d{2})$/.test(r)?r.replace(" ","T"):`${r.replace(" ","T")}Z`);return Number.isFinite(o)?o:null}}const t=st(e);if(t==null)return null;const n=ql(t);return n>=qS&&n<HS?n:null}function xy(e){if(e.length===0||GS(e))return null;const t=JS(e),r=t.filter(Yd).find(c=>e.some(u=>Qd(u[c])!=null));if(!r)return null;const o=t.filter(c=>{if(Yd(c))return!1;const u=e.map(l=>l[c]).filter(l=>l!=null);return u.length>0&&u.every(l=>st(l)!=null)});if(o.length===0)return null;const s=e.map((c,u)=>({time:Qd(c[r]),row:c,index:u})).filter(c=>c.time!=null).sort((c,u)=>c.time-u.time||c.index-u.index),i=o.slice(0,Wd);return new Set(s.filter(c=>i.some(u=>st(c.row[u])!=null)).map(c=>c.time)).size<jS?null:{xColumn:r,times:s.map(c=>c.time),daily:s.every(c=>c.time%864e5===0),series:i.map(c=>({column:c,values:s.map(u=>st(u.row[c]))})),omittedColumns:o.slice(Wd),skippedRows:e.length-s.length}}function QS(e){return YS(e)?"graph":xy(e)?"chart":"table"}const XS=[["sanctioned","sanctioned"],["scam","scam"],["victim","victim"],["pool","pool"],["exchange","exchange"]];function Xd(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.trim()!=="").map(t=>t.trim()):[]}function ex(e,t){if(t)return"exchange";const n=new Set(e.map(r=>r.replace(/\s+/g,"").toLowerCase()));for(const[r,o]of XS)if(n.has(r))return o;return"other"}const ef=(e,t)=>e==null?t:t==null?e:e+t;function tx(e,t="robinhood"){const n=new Map;for(const d of e)for(const f of new Set([String(d.from_address).toLowerCase(),String(d.to_address).toLowerCase()]))n.set(f,(n.get(f)??0)+1);let r="",o=0;for(const[d,f]of n)f>o&&(r=d,o=f);const s=new Map,i=new Map,a=(d,f,p)=>{const h=s.get(d)??{address:d,labels:[],exchange:!1};for(const m of f)h.labels.some(_=>_.toLowerCase()===m.toLowerCase())||h.labels.push(m);h.exchange=h.exchange||p,s.set(d,h)};r&&s.set(r,{address:r,labels:[],exchange:!1});let c=0;for(const d of e){const f=String(d.from_address).toLowerCase(),p=String(d.to_address).toLowerCase(),h=[f,p].filter((x,C,R)=>!s.has(x)&&R.indexOf(x)===C).length;if(s.size+h>ZS||(c++,a(f,Xd(d.from_labels),d.from_is_exchange===!0),a(p,Xd(d.to_labels),d.to_is_exchange===!0),f===p))continue;const m=`${f}->${p}`,_=i.get(m)??{from:f,to:p,usd:null,tx:null,first:null,last:null,kinds:[]};_.usd=ef(_.usd,st(d.amount_usd_sum)),_.tx=ef(_.tx,st(d.tx_count));const S=st(d.first_seen_timestamp),w=st(d.last_seen_timestamp);S!=null&&(_.first=_.first==null?S:Math.min(_.first,S)),w!=null&&(_.last=_.last==null?w:Math.max(_.last,w)),typeof d.link_kind=="string"&&d.link_kind&&!_.kinds.includes(d.link_kind)&&_.kinds.push(d.link_kind),i.set(m,_)}const u=[...s.values()].map(d=>({address:d.address,role:ex(d.labels,d.exchange),labels:d.labels})),l=[...i.values()].map(d=>({from:d.from,to:d.to,usd:d.usd,tx_count:d.tx,first_seen_ms:d.first,last_seen_ms:d.last,...d.kinds.length?{link_kind:d.kinds.join(", ")}:{}}));return{view:{schema:vy,network:t,center:r,nodes:u,edges:l,truncated:!1},rowsTotal:e.length,rowsDrawn:c,rowsLeftOut:e.length-c,addresses:s.size}}function nx(e){const t=e?.facts?.queries;return Array.isArray(t)?t.filter(ua).map((n,r)=>({id:typeof n.id=="string"&&n.id?n.id:`Query ${r+1}`,ok:n.ok!==!1&&n.error==null,error:typeof n.error=="string"&&n.error?n.error:null,rows:Array.isArray(n.results)?n.results.filter(ua):[],count:typeof n.count=="number"?n.count:null,truncated:n.truncated===!0,elapsedMs:typeof n.elapsed_ms=="number"?n.elapsed_ms:null})):[]}const tf=200;function bo(e){return(e?.content??[]).filter(t=>t?.type==="text"&&typeof t.text=="string").map(t=>t.text).join(`
|
|
109
|
+
`).trim()}function Bn(e){if(typeof e=="string")return e.trim()||null;if(!e||typeof e!="object"||Array.isArray(e))return null;const{code:t,message:n,detail:r,error:o}=e,s=[n,r,o].find(a=>typeof a=="string"&&a.trim()!=="")?.trim()??null,i=typeof t=="string"&&t.trim()?t.trim():null;return s?i&&!s.startsWith(i)?`${i}: ${s}`:s:i}function Iy(e){if(!e)return null;const t=e.structuredContent,n=Bn(t?.error)??Bn(t?.facts?.error)??Bn(t?.facts?.query?.error);if(!e.isError||n)return n;const r=bo(e);if(r.startsWith("{"))try{const o=JSON.parse(r),s=Bn(o?.error)??Bn(o);if(s)return s}catch{}return r||"The tool answered with an error."}const rx=new Set(["usage_status","subscription_status","meta_usage_status","meta_subscription_status"]);function zy(e){if(!e||Iy(e)!=null)return"text";const t=e.structuredContent;if(t?.schema===vy)return"flows";if(t?.schema===ky){if(t.tool==="graph_query")return QS(Sy(t));if(t.tool==="graph_query_batch")return Array.isArray(t.facts?.queries)&&t.facts.queries.length>0?"batch":"text";if(typeof t.tool=="string"&&rx.has(t.tool))return"balance"}return"text"}function z(e,t,n={},...r){const o=e.createElement(t);for(const[s,i]of Object.entries(n))i==null||i===!1||(s==="class"?o.className=String(i):s==="text"?o.textContent=String(i):o.setAttribute(s,i===!0?"":String(i)));for(const s of r)s==null||s===!1||o.append(typeof s=="string"?e.createTextNode(s):s);return o}function ox(e,t){const n=z(e,"code",{class:"cv-addr",title:t,"data-full":t,text:cr(t)}),r=z(e,"button",{type:"button",class:"cv-copy","data-copy":t,"aria-label":`Copy ${t}`,title:"Copy the full value",text:"Copy"});return r.addEventListener("click",()=>{sx(e,t,n,r)}),z(e,"span",{class:"cv-addr-cell"},n,r)}async function sx(e,t,n,r){const o=e.defaultView?.navigator?.clipboard;try{if(o?.writeText)return await o.writeText(t),r&&(r.textContent="Copied"),"copied"}catch{}return n.textContent=t,n.classList.add("is-full"),e.getSelection?.()?.selectAllChildren(n),r&&(r.textContent="Selected"),"selected"}function ix(e,t){return/(timestamp|seen|_at|_ms|time)$/i.test(t)&&e>1e9?Tt(e):/usd/i.test(t)?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:2}).format(e):new Intl.NumberFormat("en-US",{maximumFractionDigits:4}).format(e)}const ax=160,nf=2e3;function cx(e,t=ax){const n=e.trim().split(/\r?\n/,1)[0]??"",r=n.search(/[.!?](?=\s|$)/),o=(r<0?n:n.slice(0,r+1)).trim();if(o.length<=t)return o;const s=o.slice(0,t-1),i=s.lastIndexOf(" ");return`${(i>t*.6?s.slice(0,i):s).trimEnd()}…`}function Ty(e,t,n){const r=e.ownerDocument,o=n.full!=null&&n.full.length>nf?`${n.full.slice(0,nf-1)}…`:n.full,s=o!=null&&o!==t,i=z(r,"section",{class:`cia-graph-surface cv-notice cv-notice-${n.kind}`,"data-view":n.view,"data-notice":n.kind,role:n.kind==="refused"?"alert":"status",title:s?o:null},s?z(r,"details",{class:"cv-notice-more"},z(r,"summary",{class:"cv-notice-line",text:t}),z(r,"p",{class:"cv-notice-full",text:o})):z(r,"p",{class:"cv-notice-line",text:t}));return e.replaceChildren(i),i}function ux(e){const t=e?.facts?.query,n=Array.isArray(t?.results)?t.results.filter(s=>!!s&&typeof s=="object"&&!Array.isArray(s)):[],r=n.slice(0,tf),o=[];for(const s of r)for(const i of Object.keys(s))o.includes(i)||o.push(i);return{columns:o,rows:r,total:n.length,truncated:n.length>tf||t?.truncated===!0,elapsedMs:typeof t?.elapsed_ms=="number"?t.elapsed_ms:null}}function lx(e,t,n){return t==null?z(e,"span",{class:"cv-null","aria-label":"empty",text:"—"}):US(t)?ox(e,t):typeof t=="number"?e.createTextNode(ix(t,n)):typeof t=="boolean"?e.createTextNode(t?"yes":"no"):Array.isArray(t)?e.createTextNode(t.map(r=>typeof r=="string"?r:JSON.stringify(r)).join(", ")):typeof t=="object"?e.createTextNode(JSON.stringify(t)):e.createTextNode(String(t))}function rf(e,t,n={}){const r=e.ownerDocument,o=ux(t.structuredContent),s=o.rows.length;if(o.total===0)return Ty(e,"No rows.",{kind:"empty",view:"table"}),o;const i=`${new Intl.NumberFormat("en-US").format(s)} ${s===1?"row":"rows"}${o.elapsedMs==null?"":` in ${o.elapsedMs} ms`}`,a=z(r,"table",{class:"cv-table"},z(r,"thead",{},z(r,"tr",{},...o.columns.map(c=>z(r,"th",{scope:"col",text:c})))),z(r,"tbody",{},...o.rows.map(c=>z(r,"tr",{},...o.columns.map(u=>z(r,"td",{},lx(r,c[u],u)))))));return e.replaceChildren(z(r,"section",{class:"cv-card cv-table-view","data-view":"table","aria-label":"Graph query result"},z(r,"header",{class:"cv-card-head"},z(r,"strong",{text:"Graph query result"}),z(r,"span",{class:"cv-muted",text:i}),n.toggle??null),o.truncated?z(r,"p",{class:"cv-note",role:"note","data-truncated":"",text:`Truncated: showing the first ${new Intl.NumberFormat("en-US").format(s)} of ${new Intl.NumberFormat("en-US").format(o.total)} rows. Narrow the query to see the rest.`}):null,o.columns.length?z(r,"div",{class:"cv-table-wrap"},a):null)),o}const Kn=(e,t=0)=>typeof e=="number"&&Number.isFinite(e)?e:t,Ro=e=>typeof e=="string"&&e?e:null;function dx(e){const t=e?.facts??{};if(typeof t.wallet=="string"&&t.wallet)return{kind:"wallet",wallet:t.wallet,tier:String(t.tier??"anonymous"),allowanceUsd:Kn(t.allowance_usd),consumedUsd:Kn(t.consumed_usd),windowEnd:Ro(t.window_end)};const n=t.usage;if(n&&typeof n=="object"){const r="daily_units_limit"in n||"daily_units_used"in n,o=Ro(n.access_mode);return{kind:"free",unit:r?"units":"seconds",used:Kn(r?n.daily_units_used:n.daily_seconds_used),limit:Kn(r?n.daily_units_limit:n.daily_seconds_limit),remaining:Kn(r?n.remaining_units:n.remaining_seconds),resetAt:Ro(n.reset_at),identifierKind:Ro(n.identifier_kind),accessMode:o,noLimit:!r&&o==="public_free"&&n.daily_seconds_limit===0}}return{kind:"unknown"}}const of=e=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:2}).format(e),Do=(e,t)=>`${new Intl.NumberFormat("en-US").format(e)} ${t==="units"?e===1?"unit":"units":e===1?"second":"seconds"}`;function Ri(e){if(!e)return"No active window";const t=Date.parse(e);return Number.isFinite(t)?`${Tt(t)} UTC`:e}function sf(e,t,n,r){const o=n>0?Math.min(1,t/n):0,s=z(e,"div",{class:"cv-meter",role:"meter","aria-label":r,"aria-valuemin":0,"aria-valuemax":n,"aria-valuenow":Math.min(t,n)},z(e,"span"));return s.firstElementChild.style.width=`${Math.round(o*100)}%`,s}function Di(e,t){return z(e,"dl",{class:"cv-facts"},...t.flatMap(([n,r])=>[z(e,"dt",{text:n}),z(e,"dd",{text:r})]))}function fx(e,t){const n=e.ownerDocument,r=dx(t.structuredContent);let o,s,i;return r.kind==="wallet"?(s="Wallet allowance",i=`${cr(r.wallet)} · ${r.tier==="subscriber"?"Subscriber":"No active subscription"}`,o=[sf(n,r.consumedUsd,r.allowanceUsd,"Share of today's allowance used"),Di(n,[["Daily allowance",of(r.allowanceUsd)],["Used today",of(r.consumedUsd)],["Window ends",Ri(r.windowEnd)]])]):r.kind==="free"?(s="Free tier",i=`No wallet · counted per ${r.identifierKind==="ip"||!r.identifierKind?"network address":r.identifierKind}`,o=r.noLimit?[z(n,"p",{class:"cv-balance-note","data-no-limit":"",text:"Free access, no daily limit"}),Di(n,[["Daily allowance","No daily limit"],["Used today",Do(r.used,r.unit)],["Window ends",Ri(r.resetAt)]])]:[sf(n,r.used,r.limit,"Share of today's free allowance used"),Di(n,[["Daily allowance",Do(r.limit,r.unit)],["Used today",Do(r.used,r.unit)],["Left today",Do(r.remaining,r.unit)],["Window ends",Ri(r.resetAt)]])]):(s="Usage",i="The server sent no allowance figures.",o=[z(n,"p",{class:"cv-muted",text:bo(t)||"Nothing to show."})]),e.replaceChildren(z(n,"section",{class:"cv-card cv-balance-view","data-view":"balance","data-balance":r.kind,"aria-label":s},z(n,"header",{class:"cv-card-head"},z(n,"strong",{text:s}),z(n,"span",{class:"cv-muted",text:i})),...o)),r}function xi(e,t,n="No drawing for this answer."){const r=e.ownerDocument,o=Iy(t);if(o!=null){Ty(e,cx(o),{kind:"refused",view:"text",full:o});return}const s=bo(t);e.replaceChildren(z(r,"section",{class:"cv-card cv-text-view","data-view":"text"},z(r,"p",{text:n}),s?z(r,"p",{class:"cv-muted cv-text-body",text:s.length>600?`${s.slice(0,599)}…`:s}):null))}function Cy(e,t="Loading the Chain Insights view"){const n=e.ownerDocument;e.replaceChildren(z(n,"section",{class:"cv-card cv-skeleton","data-view":"loading","aria-busy":"true","aria-label":t},z(n,"span",{class:"cv-sr",text:t}),z(n,"div",{class:"cv-skel-line cv-skel-title"}),z(n,"div",{class:"cv-skel-line cv-skel-sub"}),z(n,"div",{class:"cv-skel-block"})))}const px="http://www.w3.org/2000/svg",hx=720,mx=6,Zo={left:66,right:18,top:6},af=18,gx=16,yx=26,_x=170,bx=82,wx=80;function Ey(e,t){const n=new Date(e).toISOString();return t?n.slice(0,10):`${n.slice(0,10)} ${n.slice(11,16)}`}const vx=new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:2}),Ay=new Intl.NumberFormat("en-US",{maximumFractionDigits:6});function cf(e){return Math.abs(e)<1e3?Ay.format(Math.round(e*100)/100):vx.format(e)}function kx(e,t=hx){const n=Zo.left,r=t-Zo.right,o=r-n,s=e.times[0]??0,i=e.times[e.times.length-1]??s,a=i-s,c=p=>a>0?n+(p-s)/a*o:n+o/2,u=e.series.length===1?_x:bx,l=e.series.map((p,h)=>{const m=Zo.top+h*(af+u+gx),_=m+af,S=_+u,w=p.values.filter(le=>le!=null),x=Math.min(0,...w),C=Math.max(...w,x+1e-9),R=le=>S-(le-x)/(C-x||1)*u,O=[],F=[];let oe=[];return p.values.forEach((le,te)=>{if(le==null){oe.length&&F.push(oe),oe=[];return}const ie={x:c(e.times[te]??s),y:R(le),time:e.times[te]??s,value:le};O.push(ie),oe.push(ie)}),oe.length&&F.push(oe),{column:p.column,color:`var(--cia-graph-series-${h%mx+1})`,top:m,plotTop:_,plotBottom:S,min:x,max:C,runs:F,points:O}}),d=(l[l.length-1]?.plotBottom??Zo.top)+6,f=[];if(e.times.length){const p=a>0?[[s,"start"],[s+a/2,"middle"],[i,"end"]]:[[s,"middle"]];for(const[h,m]of p)f.push({x:c(h),label:Ey(h,e.daily),anchor:m})}return{width:t,height:d+yx,plotLeft:n,plotRight:r,lanes:l,ticks:f,axisY:d}}function Le(e,t,n={}){const r=e.createElementNS(px,t);for(const[o,s]of Object.entries(n))r.setAttribute(o,String(s));return r}const Jn=e=>Math.round(e*10)/10;function $x(e,t,n={}){const r=e.ownerDocument,o=kx(t),s=Le(r,"svg",{class:"cv-chart-svg",viewBox:`0 0 ${o.width} ${o.height}`,role:"img",preserveAspectRatio:"xMidYMid meet","aria-label":`Line chart of ${t.series.map(u=>u.column).join(", ")} by ${t.xColumn}, ${t.times.length} ${t.times.length===1?"point":"points"}`});for(const u of o.lanes){const l=Le(r,"g",{class:"cv-chart-lane","data-series":u.column}),d=Le(r,"rect",{class:"cv-chart-swatch",x:o.plotLeft,y:u.top+4,width:14,height:4,rx:2});d.style.fill=u.color;const f=Le(r,"text",{class:"cv-chart-name",x:o.plotLeft+20,y:u.top+11});f.textContent=u.column,l.append(d,f,Le(r,"line",{class:"cv-chart-grid",x1:o.plotLeft,x2:o.plotRight,y1:u.plotTop,y2:u.plotTop}),Le(r,"line",{class:"cv-chart-base",x1:o.plotLeft,x2:o.plotRight,y1:u.plotBottom,y2:u.plotBottom}));const p=Le(r,"text",{class:"cv-chart-tick",x:o.plotLeft-8,y:u.plotTop+4,"text-anchor":"end"});p.textContent=cf(u.max);const h=Le(r,"text",{class:"cv-chart-tick",x:o.plotLeft-8,y:u.plotBottom+4,"text-anchor":"end"});h.textContent=cf(u.min),l.append(p,h);for(const m of u.runs){if(m.length<2)continue;const _=Le(r,"polyline",{class:"cv-chart-line",points:m.map(S=>`${Jn(S.x)},${Jn(S.y)}`).join(" "),fill:"none"});_.style.stroke=u.color,l.append(_)}if(u.points.length<=wx)for(const m of u.points){const _=Le(r,"circle",{class:"cv-chart-dot",cx:Jn(m.x),cy:Jn(m.y),r:3});_.style.fill=u.color;const S=Le(r,"title");S.textContent=`${Ey(m.time,t.daily)} · ${u.column} ${Ay.format(m.value)}`,_.append(S),l.append(_)}s.append(l)}const i=Le(r,"g",{class:"cv-chart-axis"});for(const u of o.ticks){const l=Le(r,"text",{class:"cv-chart-tick",x:Jn(u.x),y:o.axisY+14,"text-anchor":u.anchor});l.textContent=u.label,i.append(l)}s.append(i);const a=[t.omittedColumns.length?`${t.omittedColumns.length} more number ${t.omittedColumns.length===1?"column is":"columns are"} only in the table: ${t.omittedColumns.join(", ")}.`:"",t.skippedRows?`${t.skippedRows} ${t.skippedRows===1?"row has":"rows have"} no usable ${t.xColumn} and ${t.skippedRows===1?"is":"are"} only in the table.`:""].filter(Boolean),c=z(r,"section",{class:"cv-chart cia-graph-surface","data-view":"chart","aria-label":`Chart by ${t.xColumn}`},z(r,"header",{class:"cv-flows-head"},z(r,"div",{class:"cv-title"},z(r,"strong",{text:"Chart"}),z(r,"span",{class:"cv-muted",text:`${t.times.length} ${t.times.length===1?"point":"points"} by ${t.xColumn} (UTC) · ${t.series.length} ${t.series.length===1?"line":"lines"}`})),n.toggle??null),a.length?z(r,"p",{class:"cv-note",role:"note","data-chart-note":"",text:a.join(" ")}):null,z(r,"div",{class:"cv-chart-body"},s));return e.replaceChildren(c),{root:c,layout:o}}const Sx="chain-insights.transfers.v1",xx="graph_expand",Ix="2015-01-01";function zx(e,t,n,r){return{network:e,from:t,to:n,day:r}}function Tx(e,t){const n=typeof e.first_seen_timestamp=="number"&&e.first_seen_timestamp>0?Li(e.first_seen_timestamp):null,r=typeof e.last_seen_timestamp=="number"&&e.last_seen_timestamp>0?Li(e.last_seen_timestamp):Li(t);return{first:n,last:n&&r<n?n:r}}function jo(e,t){return e<=(t??Ix)}function Cx(e){if(!e)return"no answer";const t=bo(e);return e.isError?t||"the server refused the read":/query_timeout|topology_busy/.test(t)?t:Ny(e.structuredContent)?null:t||"the answer held no transfers"}function Ny(e){const t=e;if(!t||t.schema!==Sx||!Array.isArray(t.transfers)||typeof t.from!="string"||typeof t.to!="string"||!BS(t.day))return null;const n=[];for(const r of t.transfers){if(!r||typeof r!="object")continue;const o=r;if(typeof o.tx_id!="string")continue;const s=st(o.block_timestamp);n.push({tx_id:o.tx_id,block_timestamp:s,amount:typeof o.amount=="string"?o.amount:typeof o.amount=="number"?String(o.amount):null,asset_symbol:typeof o.asset_symbol=="string"&&o.asset_symbol?o.asset_symbol:null,amount_usd:st(o.amount_usd)})}return{network:typeof t.network=="string"?t.network:null,from:t.from,to:t.to,day:t.day,transfers:n,truncated:t.truncated===!0}}function Ex(e){return[...e].sort((t,n)=>(n.block_timestamp??0)-(t.block_timestamp??0)||t.tx_id.localeCompare(n.tx_id))}function Ax(e){if(e==null)return"—";const t=e.trim().match(/^(-?)(\d+)(?:\.(\d+))?$/);if(!t)return e;const[,n="",r="0",o=""]=t,s=o.replace(/0+$/,"");return`${n}${r.replace(/\B(?=(\d{3})+(?!\d))/g,",")}${s?`.${s}`:""}`}function Nx(e){return e==null?"—":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:e!==0&&Math.abs(e)<.01?6:2}).format(e)}function Ox(e){return e==null?"—":`${new Date(ql(e)).toISOString().slice(11,19)} UTC`}function Zi(e){return new Intl.DateTimeFormat("en-GB",{dateStyle:"medium",timeZone:"UTC"}).format(new Date(`${e}T00:00:00Z`))}function Px(e,t){const n=t.now??Date.now,r=z(e,"strong",{"data-link-title":"",text:"Transfers"}),o=z(e,"button",{type:"button",class:"cv-button cv-icon","data-link-close":"","aria-label":"Close the transfers",text:"×"}),s=z(e,"p",{class:"cv-link-pair","data-link-pair":""}),i=z(e,"p",{class:"cv-link-day","data-link-day":""}),a=z(e,"div",{class:"cv-link-body","data-link-body":"",role:"status","aria-live":"polite"}),c=z(e,"button",{type:"button",class:"cv-button","data-link-earlier":"",text:"Earlier day"}),u=z(e,"section",{class:"cv-linkpanel cv-linkpanel-embedded","data-link-panel":"","aria-label":"Transfers of the selected link",hidden:!0},z(e,"header",{class:"cv-link-head"},r,null),s,i,a,c);let l=null,d=0;function f(){if(!l){u.hidden=!0;return}u.hidden=!1,s.replaceChildren(z(e,"code",{"data-link-from":"",text:l.from})," → ",z(e,"code",{"data-link-to":"",text:l.to})),i.textContent=`${Zi(l.day)} (UTC)`,c.disabled=l.status==="loading"||jo(l.day,l.firstDay);const S=jo(l.day,l.firstDay)?null:Gd(l.day);c.setAttribute("aria-label",S?`Earlier day: show the transfers of ${Zi(S)}`:"Earlier day: this is the first day the link was seen"),l.status==="loading"?a.replaceChildren(z(e,"p",{class:"cv-muted",text:`Loading the transfers of ${Zi(l.day)}…`})):l.status==="error"?a.replaceChildren(z(e,"p",{class:"cv-link-error","data-link-error":"",role:"alert",text:l.error??"The transfers could not be read."})):l.transfers.length===0?a.replaceChildren(z(e,"p",{class:"cv-muted","data-link-empty":"",text:"No transfers between these two addresses on this day."})):(a.replaceChildren(z(e,"ol",{class:"cv-transfers"},...l.transfers.map(w=>Mx(e,w,t.host)))),l.truncated&&a.append(z(e,"p",{class:"cv-muted","data-link-truncated":"",text:`${l.transfers.length} transfers shown. This day holds more.`}))),l.status!=="loading"&&jo(l.day,l.firstDay)&&l.firstDay&&a.append(z(e,"p",{class:"cv-muted","data-link-first":"",text:"This is the first day the link was seen."}))}async function p(S){const w=++d,x=l;x.day=S,x.status="loading",x.error=null,f(),t.onLayout?.();let C=null;try{C=await t.host.callServerTool({name:xx,arguments:zx(t.network,x.from,x.to,S)})}catch(O){C={isError:!0,content:[{type:"text",text:O instanceof Error?O.message:String(O)}]}}if(w!==d||l!==x)return x;const R=Cx(C);if(R)x.status="error",x.transfers=[],x.error=R.length>300?`${R.slice(0,299)}…`:R;else{const O=Ny(C.structuredContent);x.status="ready",x.transfers=Ex(O.transfers),x.truncated=O.truncated}return f(),t.onLayout?.(),x}const h=()=>_.close(),m=()=>{_.earlier()};o.addEventListener("click",h),c.addEventListener("click",m);const _={element:u,open(S){const w=Tx(S,n());return l={from:S.from,to:S.to,day:w.last,firstDay:w.first,status:"loading",transfers:[],truncated:!1,error:null},p(w.last)},async earlier(){return!l||l.status==="loading"||jo(l.day,l.firstDay)?null:p(Gd(l.day))},close(){d++,l=null,f(),t.onLayout?.()},state:()=>l?{...l,transfers:[...l.transfers]}:null,destroy(){d++,o.removeEventListener("click",h),c.removeEventListener("click",m)}};return _}function Mx(e,t,n){const r=wy(t.tx_id),o=n.openLink,s=r&&o?z(e,"button",{type:"button",class:"cia-graph-explorer-link","data-explorer":r,"aria-label":`Transaction ${t.tx_id} (opens the explorer)`,title:t.tx_id,text:cr(t.tx_id)}):z(e,"code",{title:t.tx_id,text:cr(t.tx_id)});return r&&o&&s.addEventListener("click",()=>{o.call(n,{url:r}).catch(()=>{})}),z(e,"li",{class:"cv-transfer","data-tx":t.tx_id},z(e,"span",{class:"cv-transfer-time",text:Ox(t.block_timestamp)}),z(e,"span",{class:"cv-transfer-amount",text:`${Ax(t.amount)}${t.asset_symbol?` ${t.asset_symbol}`:""}`}),z(e,"span",{class:"cv-transfer-usd",text:t.amount_usd==null?"— USD":Nx(t.amount_usd)}),s)}const Lx="graph_expand",Fo="too busy to expand",Oy=640,Rx=300,ji=.45,Dx="Full screen shows the whole graph",uf=400,Fi="expanded",Zx="Click an address for its details. Double-click it to load its senders and receivers, and again to fold them back. Click a link to list its transfers.",jx=[["scam","Scam"],["sanctioned","Sanctioned"],["exchange","Exchange"],["victim","Victim"],["pool","Pool"],["other","Other"]];function Fx(e,t,n){return{network:e,address:t,in_offset:n?.in_offset??0,out_offset:n?.out_offset??0}}function Ux(e){const t=bo(e);return e?e.isError?t||"the server refused the expansion":/query_timeout|topology_busy/.test(t)?t:Zl(e.structuredContent)?null:t||"the answer held no money flows":"no answer"}function Vx(e,t,n,r=Oy,o=Rx){if(!e||t<=0)return{height:r,fits:!0};const s=Math.max(1,e.x2-e.x1),i=Math.max(1,e.y2-e.y1),a=Math.max(ji,Math.min(1,(t-ar*2)/s)),c=Math.ceil(n+i*a+ar*2),u=Math.min(r,Math.max(o,c));return Fd(e,t,u-n)>=ji?{height:u,fits:!0}:{height:r,fits:Fd(e,t,r-n)>=ji}}function qx(e){return/query_timeout|topology_busy|timed? ?out/i.test(e)}function Hx(e){const t=e.split(`
|
|
110
|
+
`)[0].trim();return t.length>200?`${t.slice(0,199)}…`:t}function Bx(e,t){return`investigator expanded ${e}: ${t} new addresses`}function Kx(e,t){const n=e.nodes.find(r=>r.address.toLowerCase()===t.toLowerCase());return n&&Si({role:n.role??null,labels:n.labels??[]})||"Other"}function Py(e,t,n){const r=e.ownerDocument,o=t.network??"robinhood",s=t.center.toLowerCase(),i=()=>new Map(t.cursor?[[s,{cursor:t.cursor,truncated:!!t.truncated}]]:[]);let a=i();const c=new Set,u=new Set;let l=[];const d=new Set;let f=!1,p=!1,h=null,m=null;const _=n.now??Date.now,S=n.title??"Money flow graph",w=z(r,"p",{class:"cv-status",role:"status","aria-live":"polite",text:Zx}),x=z(r,"ul",{class:"cv-roles","aria-label":"Address roles"}),C=z(r,"div",{class:"cv-canvas","data-graph":""}),R=z(r,"div",{class:"cv-detail","aria-label":"Selection"},z(r,"strong",{"data-selection-title":""}),z(r,"code",{"data-selection-identity":""}),z(r,"div",{class:"cv-detail-meta","data-selection-meta":""})),O=z(r,"strong",{"data-side-title":"",text:"Details"}),F=z(r,"button",{type:"button",class:"cv-button cv-icon","data-side-close":"","aria-label":"Close the details",text:"×"}),oe=z(r,"button",{type:"button",class:"cv-button","data-toggle-expand":"",hidden:!0,text:"Expand"}),le=z(r,"button",{type:"button",class:"cv-button","data-more":"",hidden:!0,text:"More flows"}),te=Px(r,{host:n.host,network:o,now:n.now,embedded:!0,onLayout:()=>Xe()}),ie=z(r,"aside",{class:"cv-side","data-side-panel":"","aria-label":"Details of the selection",hidden:!0},z(r,"header",{class:"cv-side-head"},O,F),R,z(r,"div",{class:"cv-side-actions"},oe,le),te.element),qe=z(r,"button",{type:"button",class:"cv-button","data-fullscreen":"",hidden:!0,"aria-label":"Open full screen",text:"Full screen"}),Pe=z(r,"button",{type:"button",class:"cv-button","data-reset":"","aria-label":"Reset the graph to the first answer",text:"Reset"}),ct=z(r,"span",{class:"cv-hint","data-fullscreen-hint":"",hidden:!0,text:Dx}),vo=z(r,"div",{class:"cv-actions"},z(r,"button",{type:"button",class:"cv-button cv-icon","data-zoom":"out","aria-label":"Zoom out",text:"−"}),z(r,"button",{type:"button",class:"cv-button cv-icon","data-zoom":"in","aria-label":"Zoom in",text:"+"}),z(r,"button",{type:"button",class:"cv-button","data-zoom":"fit","aria-label":"Fit the graph",text:"Fit"}),Pe,ct,qe),ko=z(r,"span",{class:"cv-muted","data-subtitle":""}),Ye=z(r,"section",{class:"cv-flows cia-graph-surface","data-view":"flows","aria-label":`${S} of ${s}`},z(r,"header",{class:"cv-flows-head"},z(r,"div",{class:"cv-title"},z(r,"strong",{text:S}),ko),n.toggle??null,vo),x,n.note?z(r,"p",{class:"cv-note",role:"note","data-left-out":"",text:n.note}):null,z(r,"div",{class:"cv-body"},C,ie),w);e.replaceChildren(Ye);function ut(){const N=ae.model(),K=N.truncated?" · more flows than shown":"";ko.textContent=`${s} · ${Kx(t,s)} · ${o} · ${N.nodes.length} addresses${K}`;const g=new Set(N.nodes.map($=>$.role??"other"));x.replaceChildren(...jx.filter(([$])=>g.has($)).map(([$,T])=>{const E=z(r,"i",{"aria-hidden":"true"});return E.style.background=`var(--cia-graph-role-${$})`,z(r,"li",{"data-role":$},E,T)}))}function Ii(N){return N?ae.model().nodes.find(K=>K.id===N)?.address.toLowerCase()??null:null}const kt=N=>{const K=N.target;f=!!K?.closest?.("[data-node-id]"),p=!f&&!!K?.closest?.("[data-edge-id]")},Gt=N=>{const K=N.target,g=N.key==="Enter"||N.key===" ",$=K?.closest?.("[data-node-id]");if(g&&N.shiftKey&&$){N.preventDefault();const T=Ii($.dataset.nodeId);T&&en(T);return}f=!1,p=g&&!$&&!!K?.closest?.("[data-edge-id]")},$t=()=>{f=!1,p=!1};C.addEventListener("pointerdown",kt,!0),C.addEventListener("keydown",Gt,!0),C.addEventListener("pointerup",$t),C.addEventListener("pointercancel",$t);function lt(){const N=m;if(!N){oe.hidden=!0,le.hidden=!0;return}const K=d.has(N);oe.hidden=!1,oe.disabled=c.has(N)||u.has(N),oe.textContent=c.has(N)?"Too busy to expand":K?"Collapse":"Expand",oe.setAttribute("aria-label",`${oe.textContent} ${N}`),le.hidden=!(K&&a.get(N)?.truncated)}function $o(N){const K=ie.hidden;ie.hidden=N.kind==null,N.kind==="node"&&N.node?(m=N.node.address.toLowerCase(),O.textContent="Address details",te.close()):(m=null,N.kind==="edge"?O.textContent="Link details":te.close()),lt(),K!==ie.hidden&&Xe()}let dt=null;function Yt(){dt&&clearTimeout(dt),dt=null}function So(N){const K=f&&N.kind==="node"&&N.node,g=p&&N.kind==="edge"&&N.edge;if(f=!1,p=!1,Yt(),K){const $=N.node.address.toLowerCase(),T=_();h&&h.address===$&&T-h.at<=uf?(h=null,zo(),en($)):(h={address:$,at:T},dt=setTimeout(()=>{dt=null,$o(N)},uf));return}N.kind!=="node"&&(h=null),$o(N),g&&te.open(N.edge)}const zi=n.height??Oy,St=`${S} of ${s}: senders on the left, receivers on the right. Select an address for its details; double-click it, or press Shift+Enter, to load its senders and receivers, and again to fold them back. Select a link to list its transfers.`;function Qt(){return DS(C,t,{layout:"tree",width:n.width??720,height:zi,now:n.now,controls:vo,selectionRoot:R,onSelect:So,openLink:N=>{n.host.openLink?.({url:N}).catch(()=>{w.textContent="The host did not open the link."})},label:St})}let ae=Qt();ut();let ze=n.displayMode??"inline",Qe=n.availableDisplayModes??[];const Fn=()=>!!n.host.requestDisplayMode&&(Qe.length===0||Qe.includes("fullscreen"));function Xe(){if(ze==="fullscreen"){Ye.style.removeProperty("height"),ct.hidden=!0;return}const N=C.clientWidth||n.width||720,K=Math.max(0,Ye.offsetHeight-C.offsetHeight)||140,{height:g,fits:$}=Vx(ae.contentBounds(),N,K);Ye.style.height=`${g}px`,ct.hidden=$||!Fn(),Ye.dataset.fits=String($),ae.fit()}async function Un(N){try{await n.host.updateModelContext?.({content:[{type:"text",text:N}]})}catch{}}async function Xt(N,K=!1){const g=N.toLowerCase();if(c.has(g))return w.textContent=`${g} is ${Fo}.`,{added:[],refused:Fo};if(u.has(g))return{added:[],refused:null};const $=a.get(g);if($&&!$.truncated)return w.textContent=`Every recent flow of ${g} is drawn.`,{added:[],refused:null};u.add(g),lt(),w.textContent=`Loading the flows of ${g}…`;let T=null;try{T=await n.host.callServerTool({name:Lx,arguments:Fx(o,g,K||$?$?.cursor:null)})}catch(q){T={isError:!0,content:[{type:"text",text:q instanceof Error?q.message:String(q)}]}}finally{u.delete(g)}const E=Ux(T);if(E)return qx(E)?(c.add(g),ae.markNode(g,Fo),w.textContent=`${g} is ${Fo}. The drawing is kept.`):w.textContent=`${g} could not be expanded: ${Hx(E)}. The drawing is kept; try again.`,lt(),{added:[],refused:E};const P=T.structuredContent,M=ae.merge(P,g);return l.push({address:g,page:P}),d.add(g),ae.flagNode(g,Fi,!0),a.set(g,{cursor:P.cursor??null,truncated:!!P.truncated}),ut(),Xe(),lt(),w.textContent=`${M.length} new ${M.length===1?"address":"addresses"} linked to ${g}. Double-click it again to fold them back.`,await Un(Bx(g,M.length)),{added:M,refused:null}}function xo(N){const K=N.toLowerCase();if(!d.has(K))return{removed:0};const g=ae.model().nodes.length;ae.flagNode(K,Fi,!1),d.delete(K),a.delete(K);const $=l.filter(P=>P.address!==K);ae.update(t);const T=[];for(const P of $)ae.model().nodes.some(q=>q.address.toLowerCase()===P.address)?(ae.merge(P.page,P.address),T.push(P)):T.some(q=>q.address===P.address)||(ae.flagNode(P.address,Fi,!1),d.delete(P.address),a.delete(P.address));l=T;const E=Math.max(0,g-ae.model().nodes.length);return m&&!ae.model().nodes.some(P=>P.address.toLowerCase()===m)&&(ie.hidden=!0,m=null),ut(),Xe(),lt(),w.textContent=`Folded ${K} back: ${E} ${E===1?"address":"addresses"} removed.`,Un(`investigator collapsed ${K}: ${E} addresses removed`),{removed:E}}async function en(N){d.has(N)?xo(N):await Xt(N)}function Io(){Yt(),ae.destroy(),l=[],d.clear(),c.clear(),u.clear(),a=i(),h=null,m=null,te.close(),ie.hidden=!0,ae=Qt(),ut(),Xe(),lt(),w.textContent="Back to the first answer."}function tn(N,K){N&&(ze=N),K&&(Qe=K),Ye.dataset.displayMode=ze,qe.hidden=!Fn(),qe.textContent=ze==="fullscreen"?"Exit full screen":"Full screen",qe.setAttribute("aria-label",ze==="fullscreen"?"Back to the inline view":"Open full screen"),Xe()}tn(ze);const nn=async()=>{const N=ze==="fullscreen"?"inline":"fullscreen";try{const K=await n.host.requestDisplayMode?.({mode:N});tn(K?.mode??N)}catch{w.textContent="The host did not change the display mode."}},rt=()=>Io();function zo(){Yt();const N=!ie.hidden;ae.select(null),te.close(),ie.hidden=!0,m=null,lt(),N&&Xe()}const Vn=()=>zo(),qn=()=>{m&&en(m)},Hn=()=>{m&&Xt(m,!0)};return qe.addEventListener("click",nn),Pe.addEventListener("click",rt),F.addEventListener("click",Vn),oe.addEventListener("click",qn),le.addEventListener("click",Hn),{root:Ye,get graph(){return ae},expand:N=>Xt(N),collapse:xo,reset:Io,expanded:()=>[...d],linkPanel:te,openLink(N,K){const g=ae.model().edges.find($=>$.from===N.toLowerCase()&&$.to===K.toLowerCase());return g?(ae.select(g.id),te.open(g)):Promise.resolve(null)},setTheme(N){ae.setTheme(N)},setDisplayMode:tn,refit:Xe,destroy(){Yt(),C.removeEventListener("pointerdown",kt,!0),C.removeEventListener("keydown",Gt,!0),C.removeEventListener("pointerup",$t),C.removeEventListener("pointercancel",$t),qe.removeEventListener("click",nn),Pe.removeEventListener("click",rt),F.removeEventListener("click",Vn),oe.removeEventListener("click",qn),le.removeEventListener("click",Hn),te.destroy(),ae.destroy()}}}function da(e){return{kind:e,flows:()=>[],setTheme(){},setDisplayMode(){},refit(){},destroy(){}}}function Jx(e,t){return{kind:e,flows:()=>{const n=t();return n?[n]:[]},setTheme(n){t()?.setTheme(n)},setDisplayMode(n,r){t()?.setDisplayMode(n,r)},refit(){t()?.refit()},destroy(){t()?.destroy()}}}const My=e=>({host:e.host,availableDisplayModes:e.availableDisplayModes,displayMode:e.displayMode,now:e.now,width:e.width,height:e.height});function Wx(e,t){if(e<=0)return null;const n=new Intl.NumberFormat("en-US");return`${n.format(e)} of ${n.format(t)} rows ${e===1?"is":"are"} not drawn: a graph holds at most 60 addresses. The table has the rows.`}function Gx(e,t,n){const r=[];let o="picture";const s=i=>{for(const a of i.querySelectorAll("[data-show]"))a.setAttribute("aria-pressed",String(a.dataset.show===o))};return{make(){const i=z(e,"button",{type:"button",class:"cv-toggle-button","data-show":"picture",text:t}),a=z(e,"button",{type:"button",class:"cv-toggle-button","data-show":"table",text:"Table"});i.addEventListener("click",()=>n("picture")),a.addEventListener("click",()=>n("table"));const c=z(e,"div",{class:"cv-toggle",role:"group","aria-label":"Show the rows as"},i,a);return r.push(c),s(c),c},set(i){o=i,r.forEach(s)}}}function Ly(e,t,n){const r=e.ownerDocument,o=zy(t);if(o!=="graph"&&o!=="chart")return o==="table"?rf(e,t):xi(e,t),da(o==="table"?"table":"text");const s=t.structuredContent,i=Sy(s),a=z(r,"div",{class:"cv-face","data-face":"picture"}),c=z(r,"div",{class:"cv-face","data-face":"table",hidden:!0});e.replaceChildren(a,c);const u=Gx(r,o==="graph"?"Graph":"Chart",p=>f(p));let l=null,d=!1;if(o==="graph"){const p=tx(i,VS(s));l=Py(a,p.view,{...My(n),title:"Money flow graph",toggle:u.make(),note:Wx(p.rowsLeftOut,p.rowsTotal)})}else $x(a,xy(i),{toggle:u.make()});function f(p){a.hidden=p!=="picture",c.hidden=p!=="table",p==="table"&&!d&&(d=!0,rf(c,t,{toggle:u.make()})),u.set(p),p==="picture"&&l?.refit()}return{kind:o,flows:()=>l?[l]:[],setTheme(p){l?.setTheme(p)},setDisplayMode(p,h){l?.setDisplayMode(p,h)},refit(){a.hidden||l?.refit()},destroy(){l?.destroy()}}}function Yx(e,t){if(!e.ok)return{isError:!0,content:[{type:"text",text:e.error??"The query failed."}]};const n=t?.facts?.subject;return{content:[],structuredContent:{schema:ky,tool:"graph_query",facts:{...n?{subject:n}:{},query:{results:e.rows,count:e.count??e.rows.length,truncated:e.truncated,elapsed_ms:e.elapsedMs}}}}}function Qx(e,t,n){const r=e.ownerDocument,o=nx(t.structuredContent),s=o.map((h,m)=>z(r,"button",{type:"button",role:"tab",class:"cv-tab",id:`cv-tab-${m}`,"data-tab":h.id,"aria-controls":`cv-panel-${m}`,"aria-selected":"false",tabindex:-1,text:h.ok?h.id:`${h.id} (failed)`})),i=o.map((h,m)=>z(r,"div",{class:"cv-tabpanel",role:"tabpanel",id:`cv-panel-${m}`,"aria-labelledby":`cv-tab-${m}`,hidden:!0})),a=z(r,"div",{class:"cv-tabs",role:"tablist","aria-label":"Queries of the batch"},...s);e.replaceChildren(a,...i);const c=o.map(()=>null);let u=n.displayMode,l=n.availableDisplayModes,d=-1;const f=()=>e.style.setProperty("--cv-tabs-h",`${a.offsetHeight}px`);function p(h){const m=o[h],_=i[h];if(!m||!_)return;d=h,s.forEach((w,x)=>{w.setAttribute("aria-selected",String(x===h)),w.tabIndex=x===h?0:-1}),i.forEach((w,x)=>{w.hidden=x!==h});const S=c[h];if(S)S.refit();else{const w=Ly(_,Yx(m,t.structuredContent),{...n,displayMode:u,availableDisplayModes:l});c[h]=w,_.dataset.view=w.kind}f()}return s.forEach((h,m)=>{h.addEventListener("click",()=>p(m)),h.addEventListener("keydown",_=>{const S=s.length-1,w=_.key==="ArrowRight"?m===S?0:m+1:_.key==="ArrowLeft"?m===0?S:m-1:_.key==="Home"?0:_.key==="End"?S:null;w!=null&&(_.preventDefault(),p(w),s[w]?.focus())})}),p(0),{kind:"batch",flows:()=>c.flatMap(h=>h?.flows()??[]),setTheme(h){for(const m of c)m?.setTheme(h)},setDisplayMode(h,m){h&&(u=h),m&&(l=m);for(const _ of c)_?.setDisplayMode(h,m);f()},refit(){d>=0&&c[d]?.refit()},destroy(){for(const h of c)h?.destroy()}}}function Xx(e,t,n){const r=zy(t);if(r==="flows"){const o=Py(e,t.structuredContent,My(n));return Jx("flows",()=>o)}return r==="graph"||r==="chart"||r==="table"?Ly(e,t,n):r==="batch"?Qx(e,t,n):r==="balance"?(fx(e,t),da("balance")):(xi(e,t),da("text"))}function e0(e){return e==="light"||e==="dark"}function t0(e,t=()=>!1){return e0(e?.theme)?e.theme:t()?"dark":"light"}function Hl(e,t){const n={...e??{},...t??{}};return(e?.styles||t?.styles)&&(n.styles={...e?.styles??{},...t?.styles??{},variables:{...e?.styles?.variables??{},...t?.styles?.variables??{}}}),n}function Ry(e,t,n={}){const r=e.documentElement,o=t0(t,n.prefersDark);r.setAttribute("data-theme",o),r.style.colorScheme=o;const s=t?.styles?.variables;s&&n.applyVariables&&n.applyVariables(s,r);const i=t?.styles?.css?.fonts;return i&&n.applyFonts&&n.applyFonts(i),o}const wo=document.getElementById("view"),Dy=()=>typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches;let At={},Uo=Ry(document,At,{prefersDark:Dy}),nt=null;Cy(wo);const it=new Rl({name:"chain-insights-view",version:"1.0.0"},{});function Zy(e){const t=Uo;Uo=Ry(document,e,{prefersDark:Dy,applyVariables:(n,r)=>I$(n,r),applyFonts:z$}),nt&&Uo!==t&&nt.setTheme(Uo),nt?.setDisplayMode(e.displayMode,e.availableDisplayModes)}function n0(e){nt?.destroy(),nt=null;const t=Hl(it.getHostContext(),At);nt=Xx(wo,e,{host:it,availableDisplayModes:t.availableDisplayModes,displayMode:t.displayMode}),document.documentElement.dataset.view=nt.kind}it.ontoolinput=e=>{const t=typeof e.arguments?.address=="string"?e.arguments.address:null;nt||Cy(wo,t?`Loading the graph of ${t}`:"Loading the Chain Insights view")};it.ontoolresult=e=>{n0(e)};it.ontoolcancelled=()=>{nt||xi(wo,null,"The tool call was cancelled. Nothing to draw.")};it.onhostcontextchanged=e=>{At=Hl(At,e),Zy(At)};it.onteardown=async()=>(nt?.destroy(),nt=null,{});it.onerror=e=>{console.warn("chain-insights-view:",e)};it.connect(new fy(window.parent,window.parent)).then(()=>{At=Hl(At,it.getHostContext()),Zy(At)},e=>{console.warn("chain-insights-view: no host answered",e),xi(wo,null,"This view opens inside Claude, next to a Chain Insights tool answer.")});
|
|
110
111
|
</script>
|
|
111
|
-
<style>.cia-graph-surface{--cia-graph-surface:linear-gradient(140deg,#171a20,#0d0f13);--cia-graph-canvas:#101318;--cia-graph-dot:#f2dda621;--cia-graph-text:#e2e8f0;--cia-graph-muted:#adb1ba;--cia-graph-border:#f2dda640;--cia-graph-divider:#ffffff10;--cia-graph-control:#14161a;--cia-graph-hover:#f2dda626;--cia-graph-active:#f2dda6;--cia-graph-active-text:#0b0e13;--cia-graph-node:#14161a;--cia-graph-edge:#f2dda6;--cia-graph-halo:#07090d;--cia-graph-selected:#ffffff;--cia-graph-danger:#d89087;--cia-graph-target:#8bb6b0;--cia-graph-trail:#b49bc4;--cia-graph-infrastructure:#94b58b;--cia-graph-neutral:#f2dda6;--cia-graph-critical:#d89087;--cia-graph-high:#d6a07d;--cia-graph-medium:#b49bc4;--cia-graph-low:#94b58b;--cia-graph-role-exchange:var(--cia-graph-infrastructure);--cia-graph-role-scam:var(--cia-graph-danger);--cia-graph-role-sanctioned:var(--cia-graph-danger);--cia-graph-role-victim:var(--cia-graph-target);--cia-graph-role-pool:var(--cia-graph-trail);--cia-graph-role-other:var(--cia-graph-neutral);--cia-graph-series-1:var(--cia-graph-edge);--cia-graph-series-2:var(--cia-graph-target);--cia-graph-series-3:var(--cia-graph-trail);--cia-graph-series-4:var(--cia-graph-infrastructure);--cia-graph-series-5:var(--cia-graph-danger);--cia-graph-series-6:var(--cia-graph-high);color:var(--cia-graph-text);background:var(--cia-graph-surface);border:1px solid var(--cia-graph-border);border-radius:14px;overflow:hidden}html[data-theme=light] .cia-graph-surface{--cia-graph-surface:#f9f9f9;--cia-graph-canvas:#fff;--cia-graph-dot:#dedede;--cia-graph-text:#242424;--cia-graph-muted:#686868;--cia-graph-border:#dedede;--cia-graph-divider:#e6e6e6;--cia-graph-control:#fff;--cia-graph-hover:#ececec;--cia-graph-active:#4e708a;--cia-graph-active-text:#fff;--cia-graph-node:#fff;--cia-graph-edge:#4e708a;--cia-graph-halo:#fff;--cia-graph-selected:#242424;--cia-graph-danger:#a64d4b;--cia-graph-target:#356e68;--cia-graph-trail:#78538f;--cia-graph-infrastructure:#416c4a;--cia-graph-neutral:#4e708a;--cia-graph-critical:#a64d4b;--cia-graph-high:#a15432;--cia-graph-medium:#78538f;--cia-graph-low:#416c4a}.cia-graph-canvas{background:radial-gradient(circle,var(--cia-graph-dot) 1px,transparent 1px) 0 0/24px 24px,var(--cia-graph-canvas)}.graph-detail{border-top:1px solid var(--cia-graph-divider,#ffffff10);padding:1rem 1.5rem;font-size:.85rem;color:var(--cia-graph-muted,#adb1ba);line-height:1.6}.graph-detail strong{color:var(--cia-graph-text,#f2dda6)}.graph-detail p{margin:0}.graph-detail ul{padding-left:1.25rem;margin-bottom:0}.graph-detail strong,.graph-detail li{overflow-wrap:anywhere}.graph-legend{border-top:1px solid var(--cia-graph-divider,#ffffff10);padding:1rem 1.5rem;font-size:.85rem}.graph-legend summary{cursor:pointer}.graph-legend ul{list-style:none;padding:0}.graph-legend li{display:flex;flex-wrap:wrap;gap:.4rem 1rem;padding:.6rem 0;border-bottom:1px solid var(--cia-graph-divider,#ffffff0a)}.graph-legend button{color:var(--cia-graph-edge,#f2dda6);background:none;border:0;padding:0;text-align:left;cursor:pointer;font:inherit;font-family:ui-monospace,monospace;overflow-wrap:anywhere;max-width:100%}.graph-legend span{color:var(--cia-graph-muted,#adb1ba)}.graph-detail a,.graph-legend a{color:var(--cia-graph-edge,#f2dda6);text-decoration:none;border-bottom:1px solid var(--cia-graph-border,#f2dda659)}.graph-detail a:hover,.graph-legend a:hover{border-bottom-color:var(--cia-graph-edge,#f2dda6)}.graph-legend .graph-legend-link{overflow-wrap:normal;flex:none}.cia-graph-node-body{fill:var(--cia-graph-node,#14161a)}.cia-graph-node-ring{stroke:var(--cia-graph-edge,#f2dda6)}.cia-graph-node-address{fill:var(--cia-graph-muted,#adb1ba)}.cia-graph-edge-underlay{stroke:var(--cia-graph-halo,#07090d)}.cia-graph-edge-direction{stroke:var(--cia-graph-edge,#f2dda6)}.cia-graph-edge-arrow{fill:var(--cia-graph-edge,#f2dda6);stroke:var(--cia-graph-halo,#07090d)}.cia-graph-surface .graph-tooltip{background:var(--cia-graph-control);color:var(--cia-graph-text);border-color:var(--cia-graph-border)}.cia-graph-engine{position:relative;min-height:240px}.cia-graph-svg{display:block;width:100%;height:100%;touch-action:none;font-family:Inter,system-ui,sans-serif;outline:none}.cia-graph-svg:focus-visible{outline:2px solid var(--cia-graph-active);outline-offset:-2px}.cia-graph-backdrop{fill:var(--cia-graph-canvas)}.cia-graph-dot{fill:var(--cia-graph-dot)}.cia-graph-edge{cursor:pointer;outline:none;transition:opacity .15s}.cia-graph-edge-hit{fill:none;stroke:transparent}.cia-graph-edge-line{fill:none;stroke:var(--edge-tone,var(--cia-graph-edge));stroke-linecap:round}.cia-graph-edge:focus-visible .cia-graph-edge-line,.cia-graph-edge[aria-pressed=true] .cia-graph-edge-line{stroke-width:3}.cia-graph-node{cursor:pointer;outline:none}.cia-graph-engine .cia-graph-node-body{fill:var(--cia-graph-node);stroke:var(--node-tone,var(--cia-graph-neutral));stroke-width:2}.cia-graph-engine .cia-graph-node-ring{fill:none;stroke:var(--cia-graph-edge);stroke-width:2}.cia-graph-node-dot{fill:var(--node-tone,var(--cia-graph-neutral))}.cia-graph-node.is-selected .cia-graph-node-body,.cia-graph-node:focus-visible .cia-graph-node-body{stroke:var(--cia-graph-selected);stroke-width:4}.cia-graph-node text{paint-order:stroke;stroke:var(--cia-graph-halo);stroke-width:4px;stroke-linejoin:round}.cia-graph-node-role{fill:var(--node-tone,var(--cia-graph-neutral));font-size:13px;font-weight:600}.cia-graph-engine .cia-graph-node-address{fill:var(--cia-graph-muted);font:400 11px ui-monospace,monospace}.cia-graph-node-note{fill:var(--cia-graph-text);font-size:11px;font-style:italic}.cia-graph-node[data-state=refused] .cia-graph-node-body{stroke-dasharray:4 3}.cia-graph-engine>.graph-tooltip{position:absolute;z-index:2;max-width:320px;padding:.5rem .65rem;border:1px solid;border-radius:6px;font:12px/1.45 Inter,system-ui,sans-serif;overflow-wrap:anywhere;pointer-events:none}:root{color-scheme:light dark}html,body{margin:0;padding:0;background:transparent}html[data-theme=dark]{color-scheme:dark;--cv-text:var(--color-text-primary,#ececec);--cv-muted:var(--color-text-secondary,#b4b4b4);--cv-surface:var(--color-background-secondary,#262624);--cv-raised:var(--color-background-tertiary,#30302e);--cv-border:var(--color-border-primary,#4a4a46);--cv-ring:var(--color-ring-primary,#8fb5ff);--cv-skeleton:#3a3a37}html[data-theme=light]{color-scheme:light;--cv-text:var(--color-text-primary,#1f1f1e);--cv-muted:var(--color-text-secondary,#5c5c58);--cv-surface:var(--color-background-secondary,#f5f4ef);--cv-raised:var(--color-background-tertiary,#ecebe5);--cv-border:var(--color-border-primary,#d6d4cc);--cv-ring:var(--color-ring-primary,#2f5fb8);--cv-skeleton:#e4e2db}body{color:var(--cv-text);font-family:var(--font-sans,system-ui,-apple-system,"Segoe UI",sans-serif);font-size:var(--font-text-sm-size,14px);line-height:var(--font-text-sm-line-height,1.45)}.cv-root{display:block}.cv-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.cv-muted{color:var(--cv-muted)}button:focus-visible{outline:2px solid var(--cv-ring);outline-offset:2px}.cv-card{box-sizing:border-box;border:var(--border-width-regular,1px) solid var(--cv-border);border-radius:var(--border-radius-lg,12px);background:var(--cv-surface);padding:14px 16px;overflow:hidden}.cv-card-head{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 12px;margin-bottom:10px}.cv-card-head strong{font-size:var(--font-text-md-size,15px);font-weight:var(--font-weight-semibold,600)}.cv-note{margin:0 0 10px;padding:6px 10px;border-radius:var(--border-radius-sm,6px);background:var(--color-background-warning,var(--cv-raised));color:var(--color-text-warning,var(--cv-text))}.cv-text-view p{margin:0 0 6px}.cv-text-body{white-space:pre-wrap;overflow-wrap:anywhere}.cia-graph-surface.cv-notice{box-sizing:border-box;margin:0;padding:6px 12px;border-radius:8px;font:400 13px/1.4 var(--font-sans,system-ui,-apple-system,"Segoe UI",sans-serif)}.cia-graph-surface.cv-notice-refused{border-left:3px solid var(--cia-graph-danger)}.cv-notice-empty{color:var(--cia-graph-muted)}.cv-notice p{margin:0}.cv-notice-line{overflow-wrap:anywhere}.cv-notice summary{cursor:pointer}.cv-notice summary:focus-visible{outline:2px solid var(--cia-graph-active);outline-offset:2px}.cv-notice-full{margin:4px 0 0;color:var(--cia-graph-muted);white-space:pre-wrap;overflow-wrap:anywhere}.cv-skeleton{min-height:220px}.cv-skel-line,.cv-skel-block{background:var(--cv-skeleton);border-radius:6px;margin-bottom:10px}.cv-skel-title{width:32%;height:16px}.cv-skel-sub{width:54%;height:12px}.cv-skel-block{height:160px;border-radius:10px}@media(prefers-reduced-motion:no-preference){.cv-skel-line,.cv-skel-block{animation:cv-pulse 1.6s ease-in-out infinite}}@keyframes cv-pulse{50%{opacity:.55}}.cv-table-wrap{overflow-x:auto}.cv-table{width:100%;border-collapse:collapse;font-variant-numeric:tabular-nums}.cv-table th{position:sticky;top:0;text-align:left;font-weight:var(--font-weight-semibold,600);color:var(--cv-muted);background:var(--cv-surface);border-bottom:1px solid var(--cv-border);padding:6px 10px;white-space:nowrap}.cv-table td{padding:5px 10px;border-bottom:1px solid var(--color-border-secondary,var(--cv-border));white-space:nowrap}.cv-table tr:last-child td{border-bottom:0}.cv-null{color:var(--cv-muted)}.cv-addr-cell{display:inline-flex;align-items:center;gap:6px}.cv-addr{font-family:var(--font-mono,ui-monospace,monospace);font-size:.92em}.cv-addr.is-full{-webkit-user-select:all;user-select:all}.cv-copy{font:inherit;font-size:.8em;padding:1px 7px;border:1px solid var(--cv-border);border-radius:var(--border-radius-sm,5px);background:transparent;color:var(--cv-muted);cursor:pointer}.cv-copy:hover{color:var(--cv-text);background:var(--cv-raised)}.cv-meter{height:8px;border-radius:999px;background:var(--cv-raised);overflow:hidden;margin:2px 0 12px}.cv-meter span{display:block;height:100%;background:var(--cv-ring)}.cv-balance-note{margin:2px 0 12px;font-weight:var(--font-weight-semibold,600)}.cv-facts{display:grid;grid-template-columns:max-content 1fr;gap:6px 18px;margin:0}.cv-facts dt{color:var(--cv-muted)}.cv-facts dd{margin:0;font-weight:var(--font-weight-medium,500)}.cv-flows{box-sizing:border-box;display:flex;flex-direction:column;height:480px;max-height:480px;font-family:var(--font-sans,system-ui,sans-serif)}.cv-flows[data-display-mode=fullscreen]{height:calc(100vh - var(--cv-tabs-h,0px));max-height:none;border-radius:0}.cv-flows-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:6px 12px;padding:10px 14px 6px}.cv-title{display:flex;flex-direction:column;min-width:0}.cv-title strong{font-size:15px;font-weight:600}.cv-title .cv-muted,.cv-flows .cv-muted{color:var(--cia-graph-muted);font-size:12px;overflow-wrap:anywhere}.cv-actions{display:flex;gap:6px;align-items:center;flex-wrap:wrap;justify-content:flex-end}.cv-hint{font-size:12px;color:var(--cia-graph-muted);margin-right:2px}.cv-hint[hidden]{display:none}.cv-button{min-height:30px;min-width:30px;padding:0 10px;border:1px solid var(--cia-graph-border);border-radius:6px;background:var(--cia-graph-control);color:var(--cia-graph-text);font:500 12px var(--font-sans,system-ui,sans-serif);cursor:pointer}.cv-button:hover{background:var(--cia-graph-hover)}.cv-button:focus-visible{outline:2px solid var(--cia-graph-active);outline-offset:1px}.cv-icon{padding:0;font-size:16px;line-height:1}.cv-roles{display:flex;flex-wrap:wrap;gap:4px 14px;margin:0;padding:0 14px 6px;list-style:none;font-size:12px;color:var(--cia-graph-muted)}.cv-roles li{display:inline-flex;align-items:center;gap:5px}.cv-roles i{width:9px;height:9px;border-radius:50%}.cv-canvas{position:relative;flex:1;min-height:0;border-top:1px solid var(--cia-graph-divider);border-bottom:1px solid var(--cia-graph-divider)}.cv-canvas.cia-graph-engine{min-height:0}.cv-canvas .cia-graph-svg{font-family:var(--font-sans,Inter,system-ui,sans-serif)}.cv-status{margin:0;padding:6px 14px 8px;font-size:12px;color:var(--cia-graph-muted)}.cv-detail{flex:none;max-height:58px;overflow:auto;padding:6px 14px;border-bottom:1px solid var(--cia-graph-divider);color:var(--cia-graph-text);font-size:12px;display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 12px}.cv-detail[hidden]{display:none}.cv-detail>strong{color:var(--cia-graph-muted);font-weight:500}.cv-detail>code{font:11px var(--font-mono,ui-monospace,monospace);overflow-wrap:anywhere}.cv-detail-meta{display:contents}.cv-detail-meta .meta-item{display:inline-flex;gap:5px;align-items:baseline}.cv-detail-meta .meta-item span{color:var(--cia-graph-muted)}.cv-detail-meta .meta-item strong{color:var(--cia-graph-text);font-weight:600;overflow-wrap:anywhere}.cv-detail-meta .cia-graph-explorer-link{font:inherit;font-weight:600;padding:0;border:0;border-bottom:1px solid var(--cia-graph-border);background:none;color:var(--cia-graph-edge);cursor:pointer;overflow-wrap:anywhere;text-align:left}.cv-detail-meta .cia-graph-explorer-link:hover{border-bottom-color:var(--cia-graph-edge)}.cv-face[hidden],.cv-tabpanel[hidden]{display:none}.cv-toggle{display:inline-flex;flex:none;border:1px solid var(--cia-graph-border,var(--cv-border));border-radius:6px;overflow:hidden}.cv-card-head .cv-toggle{margin-left:auto}.cv-toggle-button{min-height:28px;padding:0 12px;border:0;background:var(--cia-graph-control,var(--cv-raised));color:var(--cia-graph-text,var(--cv-text));font:500 12px var(--font-sans,system-ui,sans-serif);cursor:pointer}.cv-toggle-button+.cv-toggle-button{border-left:1px solid var(--cia-graph-border,var(--cv-border))}.cv-toggle-button:hover{background:var(--cia-graph-hover,var(--cv-border))}.cv-toggle-button[aria-pressed=true]{background:var(--cia-graph-active,var(--cv-text));color:var(--cia-graph-active-text,var(--cv-surface))}.cv-toggle-button:focus-visible{outline:2px solid var(--cia-graph-active,var(--cv-ring));outline-offset:-2px}.cia-graph-surface .cv-note{margin:0 14px 6px;background:var(--cia-graph-control);color:var(--cia-graph-text);border:1px solid var(--cia-graph-border)}.cv-tabs{display:flex;flex-wrap:wrap;gap:4px;margin:0 0 8px}.cv-tab{padding:6px 12px;border:1px solid var(--cv-border);border-radius:var(--border-radius-md,8px);background:transparent;color:var(--cv-muted);font:500 13px var(--font-sans,system-ui,sans-serif);cursor:pointer}.cv-tab:hover{color:var(--cv-text)}.cv-tab[aria-selected=true]{background:var(--cv-raised);color:var(--cv-text);border-color:var(--cv-ring)}.cv-tab:focus-visible{outline:2px solid var(--cv-ring);outline-offset:2px}.cv-chart{box-sizing:border-box;font-family:var(--font-sans,system-ui,sans-serif)}.cv-chart .cv-muted{color:var(--cia-graph-muted);font-size:12px}.cv-chart-body{padding:4px 14px 12px}.cv-chart-svg{display:block;width:100%;height:auto}.cv-chart-name{fill:var(--cia-graph-text);font:600 12px var(--font-sans,Inter,system-ui,sans-serif)}.cv-chart-tick{fill:var(--cia-graph-muted);font:400 11px var(--font-sans,Inter,system-ui,sans-serif)}.cv-chart-grid{stroke:var(--cia-graph-divider);stroke-width:1}.cv-chart-base{stroke:var(--cia-graph-border);stroke-width:1}.cv-chart-line{stroke-width:2;stroke-linejoin:round;stroke-linecap:round}.cv-body{position:relative;display:flex;flex:1;min-height:0;min-width:0}.cv-body>.cv-canvas{flex:1;min-width:0}.cv-linkpanel{display:flex;flex-direction:column;flex:none;box-sizing:border-box;width:min(46%,320px);overflow:hidden;padding:10px 12px;border-top:1px solid var(--cia-graph-divider);border-bottom:1px solid var(--cia-graph-divider);border-left:1px solid var(--cia-graph-divider);font-size:12px;color:var(--cia-graph-text)}.cv-linkpanel[hidden]{display:none}.cv-link-body{flex:1;min-height:0;overflow:auto}.cv-linkpanel>[data-link-earlier]{flex:none;align-self:flex-start;margin-top:8px}.cv-link-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:4px}.cv-link-head strong{font-size:13px}.cv-link-pair{margin:0;color:var(--cia-graph-muted)}.cv-link-pair code{font:11px var(--font-mono,ui-monospace,monospace)}.cv-link-day{margin:4px 0 8px;font-weight:600}.cv-link-body p{margin:0 0 8px}.cv-link-error{color:var(--cia-graph-danger);overflow-wrap:anywhere}.cv-transfers{list-style:none;margin:0 0 8px;padding:0}.cv-transfer{display:grid;grid-template-columns:auto 1fr auto;gap:2px 8px;padding:6px 0;border-bottom:1px solid var(--cia-graph-divider)}.cv-transfer-time{color:var(--cia-graph-muted);font-variant-numeric:tabular-nums}.cv-transfer-amount{font-weight:600;overflow-wrap:anywhere}.cv-transfer-usd{text-align:right;font-variant-numeric:tabular-nums}.cv-transfer>code,.cv-transfer>.cia-graph-explorer-link{grid-column:1/-1;font:11px var(--font-mono,ui-monospace,monospace);color:var(--cia-graph-muted)}.cv-transfer>.cia-graph-explorer-link{padding:0;border:0;border-bottom:1px solid var(--cia-graph-border);background:none;text-align:left;cursor:pointer;justify-self:start;color:var(--cia-graph-edge)}.cv-transfer>.cia-graph-explorer-link:hover{border-bottom-color:var(--cia-graph-edge)}.cv-linkpanel .cv-button:disabled{opacity:.5;cursor:default}@media(max-width:560px){.cv-linkpanel{position:absolute;inset:0;width:auto;border-left:0;background:var(--cia-graph-surface)}}
|
|
112
|
+
<style>.cia-graph-surface{--cia-graph-surface:linear-gradient(140deg,#171a20,#0d0f13);--cia-graph-canvas:#101318;--cia-graph-dot:#f2dda621;--cia-graph-text:#e2e8f0;--cia-graph-muted:#adb1ba;--cia-graph-border:#f2dda640;--cia-graph-divider:#ffffff10;--cia-graph-control:#14161a;--cia-graph-hover:#f2dda626;--cia-graph-active:#f2dda6;--cia-graph-active-text:#0b0e13;--cia-graph-node:#14161a;--cia-graph-edge:#f2dda6;--cia-graph-halo:#07090d;--cia-graph-selected:#ffffff;--cia-graph-expanded:#4da3ff;--cia-graph-danger:#d89087;--cia-graph-target:#8bb6b0;--cia-graph-trail:#b49bc4;--cia-graph-infrastructure:#94b58b;--cia-graph-neutral:#f2dda6;--cia-graph-critical:#d89087;--cia-graph-high:#d6a07d;--cia-graph-medium:#b49bc4;--cia-graph-low:#94b58b;--cia-graph-role-exchange:var(--cia-graph-infrastructure);--cia-graph-role-scam:var(--cia-graph-danger);--cia-graph-role-sanctioned:var(--cia-graph-danger);--cia-graph-role-victim:var(--cia-graph-target);--cia-graph-role-pool:var(--cia-graph-trail);--cia-graph-role-other:var(--cia-graph-neutral);--cia-graph-series-1:var(--cia-graph-edge);--cia-graph-series-2:var(--cia-graph-target);--cia-graph-series-3:var(--cia-graph-trail);--cia-graph-series-4:var(--cia-graph-infrastructure);--cia-graph-series-5:var(--cia-graph-danger);--cia-graph-series-6:var(--cia-graph-high);color:var(--cia-graph-text);background:var(--cia-graph-surface);border:1px solid var(--cia-graph-border);border-radius:14px;overflow:hidden}html[data-theme=light] .cia-graph-surface{--cia-graph-surface:#f9f9f9;--cia-graph-canvas:#fff;--cia-graph-dot:#dedede;--cia-graph-text:#242424;--cia-graph-muted:#686868;--cia-graph-border:#dedede;--cia-graph-divider:#e6e6e6;--cia-graph-control:#fff;--cia-graph-hover:#ececec;--cia-graph-active:#4e708a;--cia-graph-active-text:#fff;--cia-graph-node:#fff;--cia-graph-edge:#4e708a;--cia-graph-halo:#fff;--cia-graph-selected:#242424;--cia-graph-expanded:#0057d9;--cia-graph-danger:#a64d4b;--cia-graph-target:#356e68;--cia-graph-trail:#78538f;--cia-graph-infrastructure:#416c4a;--cia-graph-neutral:#4e708a;--cia-graph-critical:#a64d4b;--cia-graph-high:#a15432;--cia-graph-medium:#78538f;--cia-graph-low:#416c4a}.cia-graph-canvas{background:radial-gradient(circle,var(--cia-graph-dot) 1px,transparent 1px) 0 0/24px 24px,var(--cia-graph-canvas)}.graph-detail{border-top:1px solid var(--cia-graph-divider,#ffffff10);padding:1rem 1.5rem;font-size:.85rem;color:var(--cia-graph-muted,#adb1ba);line-height:1.6}.graph-detail strong{color:var(--cia-graph-text,#f2dda6)}.graph-detail p{margin:0}.graph-detail ul{padding-left:1.25rem;margin-bottom:0}.graph-detail strong,.graph-detail li{overflow-wrap:anywhere}.graph-legend{border-top:1px solid var(--cia-graph-divider,#ffffff10);padding:1rem 1.5rem;font-size:.85rem}.graph-legend summary{cursor:pointer}.graph-legend ul{list-style:none;padding:0}.graph-legend li{display:flex;flex-wrap:wrap;gap:.4rem 1rem;padding:.6rem 0;border-bottom:1px solid var(--cia-graph-divider,#ffffff0a)}.graph-legend button{color:var(--cia-graph-edge,#f2dda6);background:none;border:0;padding:0;text-align:left;cursor:pointer;font:inherit;font-family:ui-monospace,monospace;overflow-wrap:anywhere;max-width:100%}.graph-legend span{color:var(--cia-graph-muted,#adb1ba)}.graph-detail a,.graph-legend a{color:var(--cia-graph-edge,#f2dda6);text-decoration:none;border-bottom:1px solid var(--cia-graph-border,#f2dda659)}.graph-detail a:hover,.graph-legend a:hover{border-bottom-color:var(--cia-graph-edge,#f2dda6)}.graph-legend .graph-legend-link{overflow-wrap:normal;flex:none}.cia-graph-node-body{fill:var(--cia-graph-node,#14161a)}.cia-graph-node-ring{stroke:var(--cia-graph-edge,#f2dda6)}.cia-graph-node-address{fill:var(--cia-graph-muted,#adb1ba)}.cia-graph-edge-underlay{stroke:var(--cia-graph-halo,#07090d)}.cia-graph-edge-direction{stroke:var(--cia-graph-edge,#f2dda6)}.cia-graph-edge-arrow{fill:var(--cia-graph-edge,#f2dda6);stroke:var(--cia-graph-halo,#07090d)}.cia-graph-surface .graph-tooltip{background:var(--cia-graph-control);color:var(--cia-graph-text);border-color:var(--cia-graph-border)}.cia-graph-engine{position:relative;min-height:240px}.cia-graph-svg{display:block;width:100%;height:100%;touch-action:none;font-family:Inter,system-ui,sans-serif;outline:none}.cia-graph-svg:focus-visible{outline:2px solid var(--cia-graph-active);outline-offset:-2px}.cia-graph-backdrop{fill:var(--cia-graph-canvas)}.cia-graph-dot{fill:var(--cia-graph-dot)}.cia-graph-edge{cursor:pointer;outline:none;transition:opacity .15s}.cia-graph-edge-hit{fill:none;stroke:transparent}.cia-graph-edge-line{fill:none;stroke:var(--edge-tone,var(--cia-graph-edge));stroke-linecap:round}.cia-graph-edge:focus-visible .cia-graph-edge-line,.cia-graph-edge[aria-pressed=true] .cia-graph-edge-line{stroke-width:3}.cia-graph-node{cursor:pointer;outline:none}.cia-graph-engine .cia-graph-node-body{fill:var(--cia-graph-node);stroke:var(--node-tone,var(--cia-graph-neutral));stroke-width:2}.cia-graph-engine .cia-graph-node-ring{fill:none;stroke:var(--cia-graph-edge);stroke-width:2}.cia-graph-node-dot{fill:var(--node-tone,var(--cia-graph-neutral))}.cia-graph-node.is-selected .cia-graph-node-body,.cia-graph-node:focus-visible .cia-graph-node-body{stroke:var(--cia-graph-selected);stroke-width:4}.cia-graph-node text{paint-order:stroke;stroke:var(--cia-graph-halo);stroke-width:4px;stroke-linejoin:round}.cia-graph-node-role{fill:var(--node-tone,var(--cia-graph-neutral));font-size:13px;font-weight:600}.cia-graph-engine .cia-graph-node-address{fill:var(--cia-graph-muted);font:400 11px ui-monospace,monospace}.cia-graph-node-note{fill:var(--cia-graph-text);font-size:11px;font-style:italic}.cia-graph-node[data-state=refused] .cia-graph-node-body{stroke-dasharray:4 3}.cia-graph-engine .cia-graph-node[data-flag-expanded] .cia-graph-node-body{stroke:var(--cia-graph-expanded);stroke-width:5}.cia-graph-engine>.graph-tooltip{position:absolute;z-index:2;max-width:320px;padding:.5rem .65rem;border:1px solid;border-radius:6px;font:12px/1.45 Inter,system-ui,sans-serif;overflow-wrap:anywhere;pointer-events:none}:root{color-scheme:light dark}html,body{margin:0;padding:0;background:transparent}html[data-theme=dark]{color-scheme:dark;--cv-text:var(--color-text-primary,#ececec);--cv-muted:var(--color-text-secondary,#b4b4b4);--cv-surface:var(--color-background-secondary,#262624);--cv-raised:var(--color-background-tertiary,#30302e);--cv-border:var(--color-border-primary,#4a4a46);--cv-ring:var(--color-ring-primary,#8fb5ff);--cv-skeleton:#3a3a37}html[data-theme=light]{color-scheme:light;--cv-text:var(--color-text-primary,#1f1f1e);--cv-muted:var(--color-text-secondary,#5c5c58);--cv-surface:var(--color-background-secondary,#f5f4ef);--cv-raised:var(--color-background-tertiary,#ecebe5);--cv-border:var(--color-border-primary,#d6d4cc);--cv-ring:var(--color-ring-primary,#2f5fb8);--cv-skeleton:#e4e2db}body{color:var(--cv-text);font-family:var(--font-sans,system-ui,-apple-system,"Segoe UI",sans-serif);font-size:var(--font-text-sm-size,14px);line-height:var(--font-text-sm-line-height,1.45)}.cv-root{display:block}.cv-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.cv-muted{color:var(--cv-muted)}button:focus-visible{outline:2px solid var(--cv-ring);outline-offset:2px}.cv-card{box-sizing:border-box;border:var(--border-width-regular,1px) solid var(--cv-border);border-radius:var(--border-radius-lg,12px);background:var(--cv-surface);padding:14px 16px;overflow:hidden}.cv-card-head{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 12px;margin-bottom:10px}.cv-card-head strong{font-size:var(--font-text-md-size,15px);font-weight:var(--font-weight-semibold,600)}.cv-note{margin:0 0 10px;padding:6px 10px;border-radius:var(--border-radius-sm,6px);background:var(--color-background-warning,var(--cv-raised));color:var(--color-text-warning,var(--cv-text))}.cv-text-view p{margin:0 0 6px}.cv-text-body{white-space:pre-wrap;overflow-wrap:anywhere}.cia-graph-surface.cv-notice{box-sizing:border-box;margin:0;padding:6px 12px;border-radius:8px;font:400 13px/1.4 var(--font-sans,system-ui,-apple-system,"Segoe UI",sans-serif)}.cia-graph-surface.cv-notice-refused{border-left:3px solid var(--cia-graph-danger)}.cv-notice-empty{color:var(--cia-graph-muted)}.cv-notice p{margin:0}.cv-notice-line{overflow-wrap:anywhere}.cv-notice summary{cursor:pointer}.cv-notice summary:focus-visible{outline:2px solid var(--cia-graph-active);outline-offset:2px}.cv-notice-full{margin:4px 0 0;color:var(--cia-graph-muted);white-space:pre-wrap;overflow-wrap:anywhere}.cv-skeleton{min-height:220px}.cv-skel-line,.cv-skel-block{background:var(--cv-skeleton);border-radius:6px;margin-bottom:10px}.cv-skel-title{width:32%;height:16px}.cv-skel-sub{width:54%;height:12px}.cv-skel-block{height:160px;border-radius:10px}@media(prefers-reduced-motion:no-preference){.cv-skel-line,.cv-skel-block{animation:cv-pulse 1.6s ease-in-out infinite}}@keyframes cv-pulse{50%{opacity:.55}}.cv-table-wrap{overflow-x:auto}.cv-table{width:100%;border-collapse:collapse;font-variant-numeric:tabular-nums}.cv-table th{position:sticky;top:0;text-align:left;font-weight:var(--font-weight-semibold,600);color:var(--cv-muted);background:var(--cv-surface);border-bottom:1px solid var(--cv-border);padding:6px 10px;white-space:nowrap}.cv-table td{padding:5px 10px;border-bottom:1px solid var(--color-border-secondary,var(--cv-border));white-space:nowrap}.cv-table tr:last-child td{border-bottom:0}.cv-null{color:var(--cv-muted)}.cv-addr-cell{display:inline-flex;align-items:center;gap:6px}.cv-addr{font-family:var(--font-mono,ui-monospace,monospace);font-size:.92em}.cv-addr.is-full{-webkit-user-select:all;user-select:all}.cv-copy{font:inherit;font-size:.8em;padding:1px 7px;border:1px solid var(--cv-border);border-radius:var(--border-radius-sm,5px);background:transparent;color:var(--cv-muted);cursor:pointer}.cv-copy:hover{color:var(--cv-text);background:var(--cv-raised)}.cv-meter{height:8px;border-radius:999px;background:var(--cv-raised);overflow:hidden;margin:2px 0 12px}.cv-meter span{display:block;height:100%;background:var(--cv-ring)}.cv-balance-note{margin:2px 0 12px;font-weight:var(--font-weight-semibold,600)}.cv-facts{display:grid;grid-template-columns:max-content 1fr;gap:6px 18px;margin:0}.cv-facts dt{color:var(--cv-muted)}.cv-facts dd{margin:0;font-weight:var(--font-weight-medium,500)}.cv-flows{box-sizing:border-box;display:flex;flex-direction:column;height:640px;max-height:640px;font-family:var(--font-sans,system-ui,sans-serif)}.cv-flows[data-display-mode=fullscreen]{height:calc(100vh - var(--cv-tabs-h,0px));max-height:none;border-radius:0}.cv-flows-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:6px 12px;padding:10px 14px 6px}.cv-title{display:flex;flex-direction:column;min-width:0}.cv-title strong{font-size:15px;font-weight:600}.cv-title .cv-muted,.cv-flows .cv-muted{color:var(--cia-graph-muted);font-size:12px;overflow-wrap:anywhere}.cv-actions{display:flex;gap:6px;align-items:center;flex-wrap:wrap;justify-content:flex-end}.cv-hint{font-size:12px;color:var(--cia-graph-muted);margin-right:2px}.cv-hint[hidden]{display:none}.cv-button{min-height:30px;min-width:30px;padding:0 10px;border:1px solid var(--cia-graph-border);border-radius:6px;background:var(--cia-graph-control);color:var(--cia-graph-text);font:500 12px var(--font-sans,system-ui,sans-serif);cursor:pointer}.cv-button:hover{background:var(--cia-graph-hover)}.cv-button:focus-visible{outline:2px solid var(--cia-graph-active);outline-offset:1px}.cv-icon{padding:0;font-size:16px;line-height:1}.cv-roles{display:flex;flex-wrap:wrap;gap:4px 14px;margin:0;padding:0 14px 6px;list-style:none;font-size:12px;color:var(--cia-graph-muted)}.cv-roles li{display:inline-flex;align-items:center;gap:5px}.cv-roles i{width:9px;height:9px;border-radius:50%}.cv-canvas{position:relative;flex:1;min-height:0;border-top:1px solid var(--cia-graph-divider);border-bottom:1px solid var(--cia-graph-divider)}.cv-canvas.cia-graph-engine{min-height:0}.cv-canvas .cia-graph-svg{font-family:var(--font-sans,Inter,system-ui,sans-serif)}.cv-status{margin:0;padding:6px 14px 8px;font-size:12px;color:var(--cia-graph-muted)}.cv-detail{flex:none;padding:0 0 8px;color:var(--cia-graph-text);font-size:12px;display:flex;flex-direction:column;gap:4px}.cv-detail[hidden]{display:none}.cv-detail>strong{color:var(--cia-graph-muted);font-weight:500}.cv-detail>code{font:11px var(--font-mono,ui-monospace,monospace);overflow-wrap:anywhere;word-break:break-all}.cv-detail-meta{display:flex;flex-direction:column;gap:3px}.cv-detail-meta .meta-item{display:inline-flex;gap:5px;align-items:baseline}.cv-detail-meta .meta-item span{color:var(--cia-graph-muted)}.cv-detail-meta .meta-item strong{color:var(--cia-graph-text);font-weight:600;overflow-wrap:anywhere}.cv-detail-meta .cia-graph-explorer-link{font:inherit;font-weight:600;padding:0;border:0;border-bottom:1px solid var(--cia-graph-border);background:none;color:var(--cia-graph-edge);cursor:pointer;overflow-wrap:anywhere;text-align:left}.cv-detail-meta .cia-graph-explorer-link:hover{border-bottom-color:var(--cia-graph-edge)}.cv-face[hidden],.cv-tabpanel[hidden]{display:none}.cv-toggle{display:inline-flex;flex:none;border:1px solid var(--cia-graph-border,var(--cv-border));border-radius:6px;overflow:hidden}.cv-card-head .cv-toggle{margin-left:auto}.cv-toggle-button{min-height:28px;padding:0 12px;border:0;background:var(--cia-graph-control,var(--cv-raised));color:var(--cia-graph-text,var(--cv-text));font:500 12px var(--font-sans,system-ui,sans-serif);cursor:pointer}.cv-toggle-button+.cv-toggle-button{border-left:1px solid var(--cia-graph-border,var(--cv-border))}.cv-toggle-button:hover{background:var(--cia-graph-hover,var(--cv-border))}.cv-toggle-button[aria-pressed=true]{background:var(--cia-graph-active,var(--cv-text));color:var(--cia-graph-active-text,var(--cv-surface))}.cv-toggle-button:focus-visible{outline:2px solid var(--cia-graph-active,var(--cv-ring));outline-offset:-2px}.cia-graph-surface .cv-note{margin:0 14px 6px;background:var(--cia-graph-control);color:var(--cia-graph-text);border:1px solid var(--cia-graph-border)}.cv-tabs{display:flex;flex-wrap:wrap;gap:4px;margin:0 0 8px}.cv-tab{padding:6px 12px;border:1px solid var(--cv-border);border-radius:var(--border-radius-md,8px);background:transparent;color:var(--cv-muted);font:500 13px var(--font-sans,system-ui,sans-serif);cursor:pointer}.cv-tab:hover{color:var(--cv-text)}.cv-tab[aria-selected=true]{background:var(--cv-raised);color:var(--cv-text);border-color:var(--cv-ring)}.cv-tab:focus-visible{outline:2px solid var(--cv-ring);outline-offset:2px}.cv-chart{box-sizing:border-box;font-family:var(--font-sans,system-ui,sans-serif)}.cv-chart .cv-muted{color:var(--cia-graph-muted);font-size:12px}.cv-chart-body{padding:4px 14px 12px}.cv-chart-svg{display:block;width:100%;height:auto}.cv-chart-name{fill:var(--cia-graph-text);font:600 12px var(--font-sans,Inter,system-ui,sans-serif)}.cv-chart-tick{fill:var(--cia-graph-muted);font:400 11px var(--font-sans,Inter,system-ui,sans-serif)}.cv-chart-grid{stroke:var(--cia-graph-divider);stroke-width:1}.cv-chart-base{stroke:var(--cia-graph-border);stroke-width:1}.cv-chart-line{stroke-width:2;stroke-linejoin:round;stroke-linecap:round}.cv-body{position:relative;display:flex;flex:1;min-height:0;min-width:0}.cv-body>.cv-canvas{flex:1;min-width:0}.cv-linkpanel{display:flex;flex-direction:column;flex:none;box-sizing:border-box;width:min(46%,320px);overflow:hidden;padding:10px 12px;border-top:1px solid var(--cia-graph-divider);border-bottom:1px solid var(--cia-graph-divider);border-left:1px solid var(--cia-graph-divider);font-size:12px;color:var(--cia-graph-text)}.cv-linkpanel[hidden]{display:none}.cv-link-body{flex:1;min-height:0;overflow:auto}.cv-linkpanel>[data-link-earlier]{flex:none;align-self:flex-start;margin-top:8px}.cv-link-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:4px}.cv-link-head strong{font-size:13px}.cv-link-pair{margin:0;color:var(--cia-graph-muted)}.cv-link-pair code{font:11px var(--font-mono,ui-monospace,monospace)}.cv-link-day{margin:4px 0 8px;font-weight:600}.cv-link-body p{margin:0 0 8px}.cv-link-error{color:var(--cia-graph-danger);overflow-wrap:anywhere}.cv-transfers{list-style:none;margin:0 0 8px;padding:0}.cv-transfer{display:grid;grid-template-columns:auto 1fr auto;gap:2px 8px;padding:6px 0;border-bottom:1px solid var(--cia-graph-divider)}.cv-transfer-time{color:var(--cia-graph-muted);font-variant-numeric:tabular-nums}.cv-transfer-amount{font-weight:600;overflow-wrap:anywhere}.cv-transfer-usd{text-align:right;font-variant-numeric:tabular-nums}.cv-transfer>code,.cv-transfer>.cia-graph-explorer-link{grid-column:1/-1;font:11px var(--font-mono,ui-monospace,monospace);color:var(--cia-graph-muted)}.cv-transfer>.cia-graph-explorer-link{padding:0;border:0;border-bottom:1px solid var(--cia-graph-border);background:none;text-align:left;cursor:pointer;justify-self:start;color:var(--cia-graph-edge)}.cv-transfer>.cia-graph-explorer-link:hover{border-bottom-color:var(--cia-graph-edge)}.cv-linkpanel .cv-button:disabled{opacity:.5;cursor:default}@media(max-width:560px){.cv-linkpanel{position:absolute;inset:0;width:auto;border-left:0;background:var(--cia-graph-surface)}}.cv-side{display:flex;flex-direction:column;flex:none;box-sizing:border-box;width:min(46%,340px);overflow:hidden;padding:10px 12px;border-top:1px solid var(--cia-graph-divider);border-bottom:1px solid var(--cia-graph-divider);border-left:1px solid var(--cia-graph-divider);font-size:12px;color:var(--cia-graph-text)}.cv-side[hidden]{display:none}.cv-side-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px}.cv-side-head strong{font-size:13px}.cv-side-actions{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:8px}.cv-side-actions:not(:has(button:not([hidden]))){display:none}.cv-side .cv-button:disabled{opacity:.5;cursor:default}.cv-linkpanel-embedded{flex:1;min-height:0;width:auto;padding:8px 0 0;border:0;border-top:1px solid var(--cia-graph-divider);overflow:hidden}.cv-side>.cv-detail{max-height:40%;overflow:auto}.cv-linkpanel-embedded>[data-link-pair]{display:none}.cv-linkpanel-embedded .cv-link-body{min-height:44px}.cv-side:not(:has(.cv-linkpanel-embedded:not([hidden])))>.cv-detail{max-height:none}.cv-link-pair code{word-break:break-all}@media(max-width:560px){.cv-side{position:absolute;inset:0;width:auto;border-left:0;background:var(--cia-graph-surface)}.cv-side .cv-linkpanel-embedded{position:static;width:auto;border:0;border-top:1px solid var(--cia-graph-divider);background:none}}
|
|
112
113
|
</style>
|
|
113
114
|
</head>
|
|
114
115
|
<body>
|