@cpenned/mcp 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -535,16 +535,133 @@ h2 {
535
535
  font-size: 11px;
536
536
  padding: 3px 6px;
537
537
  }
538
+
539
+ /* Triage replies */
540
+ .reply {
541
+ display: flex;
542
+ gap: 6px;
543
+ margin-top: 6px;
544
+ }
545
+
546
+ .reply input {
547
+ flex: 1;
548
+ min-width: 0;
549
+ font: inherit;
550
+ font-size: 13px;
551
+ color: var(--ob-ink);
552
+ background: var(--ob-sheet);
553
+ border: 1px solid var(--ob-line);
554
+ border-radius: 8px;
555
+ padding: 5px 9px;
556
+ }
557
+
558
+ .reply input:focus-visible {
559
+ outline: 2px solid var(--ob-accent);
560
+ outline-offset: 1px;
561
+ }
562
+
563
+ .answered {
564
+ margin: 4px 0 0;
565
+ font-size: 13px;
566
+ color: var(--ob-accent);
567
+ }
568
+
569
+ /* Single-item cards (person, book, reading, activity) */
570
+ .item-head {
571
+ display: grid;
572
+ gap: 2px;
573
+ }
574
+
575
+ .item .flush {
576
+ margin-left: 0;
577
+ }
578
+
579
+ .sub.line {
580
+ display: block;
581
+ margin: 8px 0 0;
582
+ white-space: normal;
583
+ }
584
+
585
+ .progress {
586
+ height: 6px;
587
+ margin-top: 12px;
588
+ border-radius: 999px;
589
+ background: var(--ob-panel);
590
+ overflow: hidden;
591
+ }
592
+
593
+ .progress span {
594
+ display: block;
595
+ height: 100%;
596
+ border-radius: inherit;
597
+ background: var(--ob-accent);
598
+ }
599
+
600
+ .stats {
601
+ display: grid;
602
+ grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
603
+ gap: 8px;
604
+ margin-top: 12px;
605
+ }
606
+
607
+ .stat {
608
+ display: grid;
609
+ gap: 2px;
610
+ padding: 8px 10px;
611
+ border-radius: 10px;
612
+ background: var(--ob-panel);
613
+ }
614
+
615
+ .stat span {
616
+ font-size: 11px;
617
+ letter-spacing: 0.04em;
618
+ text-transform: uppercase;
619
+ color: var(--ob-muted);
620
+ }
621
+
622
+ .stat strong {
623
+ font-size: 16px;
624
+ font-weight: 600;
625
+ font-variant-numeric: tabular-nums;
626
+ }
627
+
628
+ /* Calendar */
629
+ .calendar h2.today {
630
+ color: var(--ob-accent);
631
+ }
632
+
633
+ .event .dot {
634
+ --dot: var(--ob-accent);
635
+ flex: none;
636
+ width: 8px;
637
+ height: 8px;
638
+ border-radius: 50%;
639
+ background: var(--dot);
640
+ }
641
+
642
+ .event .when {
643
+ flex: none;
644
+ width: 128px;
645
+ font-size: 12px;
646
+ color: var(--ob-muted);
647
+ font-variant-numeric: tabular-nums;
648
+ }
649
+
650
+ @media (max-width: 420px) {
651
+ .event .when {
652
+ width: auto;
653
+ }
654
+ }
538
655
  </style>
539
656
  </head>
540
657
  <body>
541
658
  <main id="root"></main>
542
- <script>"use strict";(()=>{var gg=Object.defineProperty;var bt=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var D=(e,t)=>()=>(e&&(t=e(e=0)),t);var Le=(e,t)=>{for(var r in t)gg(e,r,{get:t[r],enumerable:!0})};var v={};Le(v,{BIGINT_FORMAT_RANGES:()=>Kr,CONSTANT_CATCH:()=>Io,Class:()=>Na,NUMBER_FORMAT_RANGES:()=>Jr,aborted:()=>ge,allowsEval:()=>Da,assert:()=>wg,assertEqual:()=>yg,assertIs:()=>_g,assertNever:()=>$g,assertNotEqual:()=>bg,assignProp:()=>ce,attachSchema:()=>Wr,base64ToUint8Array:()=>Wd,base64urlToUint8Array:()=>Lg,cached:()=>or,captureStackTrace:()=>ko,cleanEnum:()=>Mg,cleanRegex:()=>He,clone:()=>L,cloneDef:()=>vg,codePointLength:()=>wt,constantCatch:()=>Fa,createTransparentProxy:()=>Og,defineLazy:()=>Ea,defineLazyInternal:()=>R,derived:()=>qg,esc:()=>he,escapeRegex:()=>Oe,explicitlyAborted:()=>La,extend:()=>Cg,finalizeIssue:()=>we,floatSafeRemainder:()=>qr,getElementAtPath:()=>kg,getEnumValues:()=>rr,getLengthableOrigin:()=>Qr,getParsedType:()=>Tg,getSizableOrigin:()=>Gr,hexToUint8Array:()=>Vg,hide:()=>Yr,installLazyProp:()=>Kg,isObject:()=>$t,isPlainObject:()=>Te,issue:()=>ar,joinValues:()=>zo,jsonStringifyReplacer:()=>nr,members:()=>Va,merge:()=>Eg,mergeDefs:()=>Ee,normalizeParams:()=>_,nullish:()=>vo,numKeys:()=>Ig,objectClone:()=>xg,omit:()=>Rg,optionalKeys:()=>Ma,own:()=>tt,parsedType:()=>Ua,partial:()=>Zg,pick:()=>Ag,prefixIssues:()=>$e,primitiveTypes:()=>ja,promiseAllObject:()=>Sg,propertyKeyTypes:()=>Br,randomString:()=>Pg,rawShape:()=>ir,required:()=>Dg,safeExtend:()=>Ng,shallowClone:()=>Hr,sizeCaps:()=>sr,slugify:()=>Za,stringifyPrimitive:()=>So,toZod:()=>tr,uint8ArrayToBase64:()=>Gd,uint8ArrayToBase64url:()=>Ug,uint8ArrayToHex:()=>Fg,unwrapMessage:()=>er});function yg(e){return e}function bg(e){return e}function tr(){return e=>e}function _g(e){}function $g(e){throw new Error("Unexpected value in exhaustive check")}function wg(e){}function rr(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function zo(e,t="|"){return e.map(r=>So(r)).join(t)}function nr(e,t){return typeof t=="bigint"?t.toString():t}function or(e){return new Ca(e)}function vo(e){return e==null}function He(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function qr(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}function Ea(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Hd)return n===void 0&&(n=Hd,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function xg(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ce(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ir(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function qe(e){return ir(e._zod.def)??e._zod.def.shape}function Bd(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return ce(this,t,n),n},enumerable:!0,configurable:!0})}function Jd(e,t,r){t in e?ce(e,t,r):e[t]=r}function _t(e,t,r,n){let o=qe(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);s.enumerable&&(s.get?Bd(e,i,()=>{let a=t._zod.def.shape[i];return n?n(a,i):a}):Jd(e,i,n?n(s.value,i):s.value))}}function zg(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?Bd(e,r,()=>t[r]):Jd(e,r,n.value))}}function Ee(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function vg(e){return Ee(e._zod.def)}function kg(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function Sg(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function Pg(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function he(e){return JSON.stringify(e)}function Za(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function $t(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Te(e){if($t(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!($t(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Hr(e){return Te(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Ig(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}function Oe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function L(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function _(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Og(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function So(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Ma(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}function Ag(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return _t(i,e,Po(e,t)),L(e,Ee(r,{shape:i,checks:[]}))}function Po(e,t){let r=qe(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&n.push(o)}return n}function Rg(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Po(e,t)),s={};return _t(s,e,Reflect.ownKeys(qe(e)).filter(a=>!i.has(a))),L(e,Ee(r,{shape:s,checks:[]}))}function Cg(e,t){if(!Te(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=qe(e);for(let 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 L(e,Ee(e._zod.def,{shape:Kd(e,t)}))}function Kd(e,t){let r={};return _t(r,e,Reflect.ownKeys(qe(e))),zg(r,t),r}function Ng(e,t){if(!Te(t))throw new Error("Invalid input to safeExtend: expected a plain object");return L(e,Ee(e._zod.def,{shape:Kd(e,t)}))}function Eg(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};_t(r,e,Reflect.ownKeys(qe(e))),_t(r,t,Reflect.ownKeys(qe(t)));let n=Ee(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return L(e,n)}function Zg(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let a=r?new Set(Po(t,r)):void 0,c={};return _t(c,t,Reflect.ownKeys(qe(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),L(t,Ee(t._zod.def,{shape:c,checks:[]}))}function Dg(e,t,r){let n=r?new Set(Po(t,r)):void 0,o={};return _t(o,t,Reflect.ownKeys(qe(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),L(t,Ee(t._zod.def,{shape:o}))}function ge(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function La(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function $e(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function er(e){return typeof e=="string"?e:e?.message}function sr(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;o>=0&&t.push([o,r])}return t}function Wr(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function we(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(n=e).schema??(n.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:er(e.inst?._zod.def?.error?.(e))??er(i?.(e))??er(t?.error?.(e))??er(r.customError?.(e))??er(r.localeError?.(e))??"Invalid input",a={};for(let 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 Gr(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function wt(e){let t=e.length;if(!jg.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function Qr(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ua(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function ar(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function Mg(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Wd(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function Gd(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Lg(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Wd(t+r)}function Ug(e){return Gd(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Vg(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function Fg(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}function Va(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):Hg(e,r,n.value)}}function tt(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Yr(e,t,r){return tt(e,t,r,!1)}function qg(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return tt(this,r,n(this))},set(o){tt(this,r,o)}})}return t}function Hg(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:tt(this,t,r.bind(this))},set(n){tt(this,t,n)}})}function Bg(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}function R(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Ra!==e._zod){Ra=void 0;return}Ra=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Jg);let o=et;et=!1;try{let i=r(this);return et?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),et=et||o,i}catch(i){throw delete this[t],et=et||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Kg(e,t,r,n){let o=Bg(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}function Fa(e){let t=()=>e;return t[Io]=!0,t}var Ca,Hd,ko,Da,Tg,Br,ja,Jr,Kr,jg,Na,Ra,et,Jg,Io,ee=D(()=>{rt();Ca=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};Hd=Symbol("evaluating");ko="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};Da=or(()=>{if(oe.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});Tg=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Br=new Set(["string","number","symbol"]),ja=new Set(["string","number","bigint","boolean","symbol","undefined"]);Jr={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]},Kr={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};jg=/[\uD800-\uDBFF]/;Na=class{constructor(...t){}};et=!1,Jg={configurable:!0,get(){et=!0}};Io="~constantCatch"});function Wg(e){let t=Yd;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return Yd=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function h(e,t,r,n){let o={};function i(d){this.def=d,this.constr=f,this.traits=new Set}i.prototype=o;let s=r,a=s&&new WeakSet;function c(d,m){if(d._zod){if(d._zod.traits.has(e))return}else{qa.value=new i(m);try{Object.defineProperty(d,"_zod",qa)}finally{qa.value=void 0}}if(d._zod.traits.add(e),t(d,m),a){let b=Object.getPrototypeOf(d),w=d._zod.constr.prototype,S=b;for(;S&&S!==w;)S=Object.getPrototypeOf(S);let $=S??b;a.has($)||(a.add($),Va($,s))}let g=f.prototype;for(let b in g)Object.prototype.hasOwnProperty.call(g,b)&&(b in d||(d[b]=g[b].bind(d)))}let u=n?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function f(d){let m=n?.Parent?Wg(l):this;c(m,d);let g=m._zod.deferred;if(g){for(let w of g)w();m._zod.deferred=void 0}let b=globalThis.__zod_globalConfig?.postProcessor;return b&&b(m),m}return Object.defineProperty(f,"init",{value:c}),Object.defineProperty(f,Symbol.hasInstance,{value:d=>n?.Parent&&d instanceof n.Parent?!0:d?._zod?.traits?.has(e)}),Object.defineProperty(f,"name",{value:e}),f}function Y(e){return e&&Object.assign(oe,e),oe}var Qd,To,qa,Yd,Oo,xe,nt,oe,rt=D(()=>{ee();To=Object.freeze({status:"aborted"}),qa={value:void 0,enumerable:!1},Yd="captureStackTrace"in Error?Error:null;Oo=Symbol("zod_brand"),xe=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},nt=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Qd=globalThis).__zod_globalConfig??(Qd.__zod_globalConfig={});oe=globalThis.__zod_globalConfig});function Gg(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,nr,2)),e.message}function Qg(e){this._zod.message=e}function Xg(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function cr(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?Xg(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function ur(e,t=r=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>n({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)r._errors.push(t(s));else{let c=r,u=0;for(;u<a.length;){let l=a[u],f=u===a.length-1;if(l==="_errors"){f&&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});let d=c[l];f&&d._errors.push(t(s)),c=d,u++}}}};return n(e),r}function Ao(e,t=r=>r.message){let r={errors:[]},n=(o,i=[])=>{var s;for(let a of o.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>n({issues:c},[...i,...a.path]));else if(a.code==="invalid_key")n({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")n({issues:a.issues},[...i,...a.path]);else{let c=[...i,...a.path];if(c.length===0){r.errors.push(t(a));continue}let u=r,l=0;for(;l<c.length;){let f=c[l],d=l===c.length-1;typeof f=="string"?(u.properties??(u.properties={}),Object.prototype.hasOwnProperty.call(u.properties,f)||Object.defineProperty(u.properties,f,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),u=u.properties[f]):(u.items??(u.items=[]),(s=u.items)[f]??(s[f]={errors:[]}),u=u.items[f]),d&&u.errors.push(t(a)),l++}}};return n(e),r}function tm(e){let t=[],r=e.map(n=>typeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?t.push(`[${n}]`):typeof n=="symbol"?t.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?t.push(`[${JSON.stringify(n)}]`):(t.length&&t.push("."),t.push(n));return t.join("")}function Ro(e){let t=[],r=[...e.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)t.push(`\u2716 ${n.message}`),n.path?.length&&t.push(` \u2192 at ${tm(n.path)}`);return t.join(`
543
- `)}var Yg,Ba,Xd,em,Ja,ze,Ka=D(()=>{rt();ee();Yg={get:Gg,set:Qg,enumerable:!0,configurable:!0},Ba={value:void 0,enumerable:!1},Xd=new WeakSet([Object.prototype,Error.prototype]),em=(e,t)=>{e.name="$ZodError",Ba.value=t,Object.defineProperty(e,"issues",Ba),Ba.value=void 0,Object.defineProperty(e,"message",Yg);let r=Object.getPrototypeOf(e);Xd.has(r)||(Xd.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},Ja=h("$ZodError",em),ze=h("$ZodError",em,void 0,{Parent:Error})});function Co(e,t){return{callee:t?.callee??e,Err:t?.Err}}function rm(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>we(o,r,Y()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}function ny(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(n[ry]=!0,i=o({value:t,issues:[]},n)):i=e._zod.run({value:t,issues:[]},n),i instanceof Promise)throw new xe;return i.issues.length===0}var lr,Xr,pr,en,fr,No,dr,Wa,ty,ry,xt,zt,Eo,nm,Zo,om,Do,im,jo,sm,Mo,am,Lo,cm,Uo,um,Vo,lm,Ga=D(()=>{rt();Ka();ee();lr=e=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new xe;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map(u=>we(u,s,Y())));throw ko(c,i?.callee??t),c}return a.value};return t},Xr=lr(ze),pr=e=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},a=r._zod.run({value:n,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(i?.Err??e)(a.issues.map(u=>we(u,s,Y())));throw ko(c,i?.callee??t),c}return a.value};return t},en=pr(ze),fr=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new xe;return i.issues.length?rm(e,i.issues,o):{success:!0,data:i.value}},No=fr(ze);dr=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?rm(e,i.issues,o):{success:!0,data:i.value}},Wa=dr(ze),ty=Symbol.for("zod.compile.invalid"),ry=Symbol.for("zod.compile.fallback"),xt=((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==ty)return!0;if(n.definite===!0&&r===void 0)return!1}return ny(e,t,r)});zt=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length===0},Eo=e=>{let t=lr(e),r=(n,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,a,Co(r,s))};return r},nm=Eo(ze),Zo=e=>{let t=lr(e),r=(n,o,i,s)=>t(n,o,i,Co(r,s));return r},om=Zo(ze),Do=e=>{let t=pr(e),r=async(n,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,a,Co(r,s))};return r},im=Do(ze),jo=e=>{let t=pr(e),r=async(n,o,i,s)=>await t(n,o,i,Co(r,s));return r},sm=jo(ze),Mo=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return fr(e)(t,r,o)},am=Mo(ze),Lo=e=>(t,r,n)=>fr(e)(t,r,n),cm=Lo(ze),Uo=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return dr(e)(t,r,o)},um=Uo(ze),Vo=e=>async(t,r,n)=>dr(e)(t,r,n),lm=Vo(ze)});var Pe={};Le(Pe,{anyString:()=>zc,base64:()=>mc,base64url:()=>hc,bigint:()=>kc,boolean:()=>Sc,browserEmail:()=>py,cidrv4:()=>fc,cidrv6:()=>dc,creditCard:()=>Fo,cuid:()=>Ya,cuid2:()=>Xa,currencyCode:()=>_c,date:()=>$c,datetime:()=>xc,domain:()=>yc,duration:()=>ic,e164:()=>bc,email:()=>ac,emoji:()=>cc,extendedDuration:()=>oy,guid:()=>sc,hex:()=>Ac,hostname:()=>gc,html5Email:()=>cy,httpProtocol:()=>tn,iban:()=>qo,idnEmail:()=>ly,integer:()=>rn,ipv4:()=>uc,ipv6:()=>lc,ksuid:()=>rc,lowercase:()=>Tc,mac:()=>pc,md5_base64:()=>hy,md5_base64url:()=>gy,md5_hex:()=>my,nanoid:()=>nc,nanoidOfLength:()=>oc,null:()=>Pc,number:()=>Be,rfc5322Email:()=>uy,sha1_base64:()=>by,sha1_base64url:()=>_y,sha1_hex:()=>yy,sha256_base64:()=>wy,sha256_base64url:()=>xy,sha256_hex:()=>$y,sha384_base64:()=>vy,sha384_base64url:()=>ky,sha384_hex:()=>zy,sha512_base64:()=>Py,sha512_base64url:()=>Iy,sha512_hex:()=>Sy,string:()=>vc,time:()=>wc,ulid:()=>ec,undefined:()=>Ic,unicodeEmail:()=>pm,uppercase:()=>Oc,uuid:()=>vt,uuid4:()=>iy,uuid6:()=>sy,uuid7:()=>ay,xid:()=>tc});function oc(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}function cc(){return new RegExp(fy,"u")}function dy(e){return new RegExp(`^${e}$`)}function Qa(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function wc(e){return new RegExp(`^${Qa(e)}$`)}function xc(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Qa({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${Qa({precision:e.precision})}`:r;return new RegExp(`^${fm}T(?:${n})$`)}function nn(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function on(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Ya,Xa,ec,tc,rc,nc,ic,oy,sc,vt,iy,sy,ay,ac,cy,uy,pm,ly,py,fy,uc,lc,pc,fc,dc,mc,hc,gc,yc,tn,bc,Fo,_c,qo,fm,$c,zc,vc,kc,rn,Be,Sc,Pc,Ic,Tc,Oc,Ac,my,hy,gy,yy,by,_y,$y,wy,xy,zy,vy,ky,Sy,Py,Iy,kt=D(()=>{ee();Ya=/^[cC][0-9a-z]{6,}$/,Xa=/^[0-9a-z]+$/,ec=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,tc=/^[0-9a-vA-V]{20}$/,rc=/^[A-Za-z0-9]{27}$/,nc=/^[a-zA-Z0-9_-]{21}$/;ic=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,oy=/^[-+]?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)?)??$/,sc=/^([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})$/,vt=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)$/,iy=vt(4),sy=vt(6),ay=vt(7),ac=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,cy=/^[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])?)*$/,uy=/^(([^<>()\[\]\\.,;:\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,}))$/,pm=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,ly=pm,py=/^[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])?)*$/,fy="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";uc=/^(?:(?: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])$/,lc=/^(([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}|:))$/,pc=e=>{let t=Oe(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},fc=/^((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])$/,dc=/^(([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])$/,mc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,hc=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,gc=/^(?=.{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])?)*\.?$/,yc=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,tn=/^https?$/,bc=/^\+[1-9]\d{6,14}$/,Fo=/^\d(?:[ -]?\d){11,18}$/,_c=/^(?: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)$/,qo=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,fm="(?:(?:\\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])))";$c=dy(fm);zc=/^[\s\S]{0,}$/,vc=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},kc=/^-?\d+n?$/,rn=/^-?\d+$/,Be=/^-?\d+(?:\.\d+)?$/,Sc=/^(?:true|false)$/i,Pc=/^null$/i,Ic=/^undefined$/i,Tc=/^[^A-Z]*$/,Oc=/^[^a-z]*$/,Ac=/^[0-9a-fA-F]*$/;my=/^[0-9a-fA-F]{32}$/,hy=nn(22,"=="),gy=on(22),yy=/^[0-9a-fA-F]{40}$/,by=nn(27,"="),_y=on(27),$y=/^[0-9a-fA-F]{64}$/,wy=nn(43,"="),xy=on(43),zy=/^[0-9a-fA-F]{96}$/,vy=nn(64,""),ky=on(64),Sy=/^[0-9a-fA-F]{128}$/,Py=nn(86,"=="),Iy=on(86)});function Bo(e,t,r){e.issues.length&&t.issues.push(...$e(r,e.issues))}var W,Rc,Cc,Ho,Jo,Ko,Nc,Ec,Zc,Dc,jc,Mc,Lc,Uc,Vc,mr,Fc,qc,Hc,Bc,Jc,Kc,Wc,Gc,Qc,Yc,Wo=D(()=>{rt();kt();ee();W=h("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Rc=e=>{let t=e.value;return!vo(t)&&t.size!==void 0},Cc=e=>{let t=e.value;return!vo(t)&&t.length!==void 0},Ho={number:"number",bigint:"bigint",object:"date"},Jo=h("$ZodCheckLessThan",(e,t)=>{W.init(e,t);let r=Ho[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:Ho[typeof n.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ko=h("$ZodCheckGreaterThan",(e,t)=>{W.init(e,t);let r=Ho[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:Ho[typeof n.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Nc=h("$ZodCheckMultipleOf",(e,t)=>{W.init(e,t),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):qr(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Ec=h("$ZodCheckNumberFormat",(e,t)=>{W.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Jr[t.format];e._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,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:n,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:n,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})}}),Zc=h("$ZodCheckBigIntFormat",(e,t)=>{W.init(e,t);let[r,n]=Kr[t.format];e._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),Dc=h("$ZodCheckMaxSize",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=Rc),e._zod.check=n=>{let o=n.value;o.size<=t.maximum||n.issues.push({origin:Gr(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),jc=h("$ZodCheckMinSize",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=Rc),e._zod.check=n=>{let o=n.value;o.size>=t.minimum||n.issues.push({origin:Gr(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Mc=h("$ZodCheckSizeEquals",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=Rc),e._zod.check=n=>{let o=n.value,i=o.size;if(i===t.size)return;let s=i>t.size;n.issues.push({origin:Gr(o),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Lc=h("$ZodCheckMaxLength",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=Cc),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>t.maximum?wt(o):i)<=t.maximum)return;let a=Qr(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Uc=h("$ZodCheckMinLength",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=Cc),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?wt(o):i)>=t.minimum)return;let a=Qr(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Vc=h("$ZodCheckLengthEquals",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=Cc),e._zod.check=n=>{let o=n.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?wt(o):i;if(s===t.length)return;let a=Qr(o),c=s>t.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),mr=h("$ZodCheckStringFormat",(e,t)=>{var r,n;W.init(e,t),t.pattern?(r=e._zod).check??(r.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})}):(n=e._zod).check??(n.check=()=>{})}),Fc=h("$ZodCheckRegex",(e,t)=>{mr.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),qc=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Tc),mr.init(e,t)}),Hc=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Oc),mr.init(e,t)}),Bc=h("$ZodCheckIncludes",(e,t)=>{W.init(e,t);let r=Oe(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=n,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})}}),Jc=h("$ZodCheckStartsWith",(e,t)=>{W.init(e,t);let r=new RegExp(`^${Oe(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Kc=h("$ZodCheckEndsWith",(e,t)=>{W.init(e,t);let r=new RegExp(`.*${Oe(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});Wc=h("$ZodCheckProperty",(e,t)=>{W.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>Bo(o,r,t.property));Bo(n,r,t.property)}}),Gc=h("$ZodCheckProperties",(e,t)=>{W.init(e,t),Yr(e,Symbol.iterator,function*(){yield e});let r;e._zod.check=n=>{if(n.value==null){n.issues.push({expected:"object",code:"invalid_type",input:n.value,inst:e});return}r??(r=Reflect.ownKeys(t.shape).map(s=>[s,t.shape[s]]));let o=n.value,i;for(let[s,a]of r){let c=a._zod.run({value:o[s],issues:[]},{});c instanceof Promise?(i??(i=[]),i.push(c.then(u=>Bo(u,n,s)))):Bo(c,n,s)}if(i)return Promise.all(i).then(()=>{})}}),Qc=h("$ZodCheckMimeType",(e,t)=>{W.init(e,t);let r=new Set(t.mime);e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),Yc=h("$ZodCheckOverwrite",(e,t)=>{W.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}})});var St,Go=D(()=>{St=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}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}let n=t.split(`
659
+ <script>"use strict";(()=>{var _g=Object.defineProperty;var _t=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var D=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ue=(e,t)=>{for(var r in t)_g(e,r,{get:t[r],enumerable:!0})};var v={};Ue(v,{BIGINT_FORMAT_RANGES:()=>Gr,CONSTANT_CATCH:()=>Ao,Class:()=>Da,NUMBER_FORMAT_RANGES:()=>Wr,aborted:()=>ge,allowsEval:()=>La,assert:()=>vg,assertEqual:()=>$g,assertIs:()=>xg,assertNever:()=>zg,assertNotEqual:()=>wg,assignProp:()=>ce,attachSchema:()=>Qr,base64ToUint8Array:()=>Gd,base64urlToUint8Array:()=>Fg,cached:()=>ir,captureStackTrace:()=>Io,cleanEnum:()=>Vg,cleanRegex:()=>He,clone:()=>L,cloneDef:()=>Pg,codePointLength:()=>xt,constantCatch:()=>Ba,createTransparentProxy:()=>Cg,defineLazy:()=>ja,defineLazyInternal:()=>R,derived:()=>Jg,esc:()=>he,escapeRegex:()=>Oe,explicitlyAborted:()=>Fa,extend:()=>Zg,finalizeIssue:()=>we,floatSafeRemainder:()=>Br,getElementAtPath:()=>Ig,getEnumValues:()=>nr,getLengthableOrigin:()=>Xr,getParsedType:()=>Rg,getSizableOrigin:()=>Yr,hexToUint8Array:()=>Hg,hide:()=>en,installLazyProp:()=>Qg,isObject:()=>wt,isPlainObject:()=>Te,issue:()=>cr,joinValues:()=>So,jsonStringifyReplacer:()=>or,members:()=>Ha,merge:()=>jg,mergeDefs:()=>Ze,normalizeParams:()=>_,nullish:()=>Po,numKeys:()=>Ag,objectClone:()=>kg,omit:()=>Eg,optionalKeys:()=>Va,own:()=>rt,parsedType:()=>qa,partial:()=>Mg,pick:()=>Ng,prefixIssues:()=>$e,primitiveTypes:()=>Ua,promiseAllObject:()=>Tg,propertyKeyTypes:()=>Kr,randomString:()=>Og,rawShape:()=>sr,required:()=>Lg,safeExtend:()=>Dg,shallowClone:()=>Jr,sizeCaps:()=>ar,slugify:()=>Ma,stringifyPrimitive:()=>To,toZod:()=>rr,uint8ArrayToBase64:()=>Qd,uint8ArrayToBase64url:()=>qg,uint8ArrayToHex:()=>Bg,unwrapMessage:()=>tr});function $g(e){return e}function wg(e){return e}function rr(){return e=>e}function xg(e){}function zg(e){throw new Error("Unexpected value in exhaustive check")}function vg(e){}function nr(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function So(e,t="|"){return e.map(r=>To(r)).join(t)}function or(e,t){return typeof t=="bigint"?t.toString():t}function ir(e){return new Za(e)}function Po(e){return e==null}function He(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Br(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}function ja(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Bd)return n===void 0&&(n=Bd,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function kg(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ce(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function sr(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function qe(e){return sr(e._zod.def)??e._zod.def.shape}function Jd(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return ce(this,t,n),n},enumerable:!0,configurable:!0})}function Kd(e,t,r){t in e?ce(e,t,r):e[t]=r}function $t(e,t,r,n){let o=qe(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);s.enumerable&&(s.get?Jd(e,i,()=>{let a=t._zod.def.shape[i];return n?n(a,i):a}):Kd(e,i,n?n(s.value,i):s.value))}}function Sg(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?Jd(e,r,()=>t[r]):Kd(e,r,n.value))}}function Ze(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Pg(e){return Ze(e._zod.def)}function Ig(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function Tg(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function Og(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function he(e){return JSON.stringify(e)}function Ma(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function wt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Te(e){if(wt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(wt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Jr(e){return Te(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Ag(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}function Oe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function L(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function _(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Cg(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function To(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Va(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}function Ng(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return $t(i,e,Oo(e,t)),L(e,Ze(r,{shape:i,checks:[]}))}function Oo(e,t){let r=qe(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&n.push(o)}return n}function Eg(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Oo(e,t)),s={};return $t(s,e,Reflect.ownKeys(qe(e)).filter(a=>!i.has(a))),L(e,Ze(r,{shape:s,checks:[]}))}function Zg(e,t){if(!Te(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=qe(e);for(let 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 L(e,Ze(e._zod.def,{shape:Wd(e,t)}))}function Wd(e,t){let r={};return $t(r,e,Reflect.ownKeys(qe(e))),Sg(r,t),r}function Dg(e,t){if(!Te(t))throw new Error("Invalid input to safeExtend: expected a plain object");return L(e,Ze(e._zod.def,{shape:Wd(e,t)}))}function jg(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};$t(r,e,Reflect.ownKeys(qe(e))),$t(r,t,Reflect.ownKeys(qe(t)));let n=Ze(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return L(e,n)}function Mg(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let a=r?new Set(Oo(t,r)):void 0,c={};return $t(c,t,Reflect.ownKeys(qe(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),L(t,Ze(t._zod.def,{shape:c,checks:[]}))}function Lg(e,t,r){let n=r?new Set(Oo(t,r)):void 0,o={};return $t(o,t,Reflect.ownKeys(qe(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),L(t,Ze(t._zod.def,{shape:o}))}function ge(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Fa(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function $e(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function tr(e){return typeof e=="string"?e:e?.message}function ar(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;o>=0&&t.push([o,r])}return t}function Qr(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function we(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(n=e).schema??(n.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:tr(e.inst?._zod.def?.error?.(e))??tr(i?.(e))??tr(t?.error?.(e))??tr(r.customError?.(e))??tr(r.localeError?.(e))??"Invalid input",a={};for(let 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 Yr(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function xt(e){let t=e.length;if(!Ug.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function Xr(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function qa(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function cr(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function Vg(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Gd(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function Qd(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Fg(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Gd(t+r)}function qg(e){return Qd(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Hg(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function Bg(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}function Ha(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):Kg(e,r,n.value)}}function rt(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function en(e,t,r){return rt(e,t,r,!1)}function Jg(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return rt(this,r,n(this))},set(o){rt(this,r,o)}})}return t}function Kg(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:rt(this,t,r.bind(this))},set(n){rt(this,t,n)}})}function Wg(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}function R(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Ea!==e._zod){Ea=void 0;return}Ea=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Gg);let o=tt;tt=!1;try{let i=r(this);return tt?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),tt=tt||o,i}catch(i){throw delete this[t],tt=tt||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Qg(e,t,r,n){let o=Wg(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}function Ba(e){let t=()=>e;return t[Ao]=!0,t}var Za,Bd,Io,La,Rg,Kr,Ua,Wr,Gr,Ug,Da,Ea,tt,Gg,Ao,ee=D(()=>{nt();Za=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};Bd=Symbol("evaluating");Io="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};La=ir(()=>{if(oe.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});Rg=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Kr=new Set(["string","number","symbol"]),Ua=new Set(["string","number","bigint","boolean","symbol","undefined"]);Wr={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]},Gr={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};Ug=/[\uD800-\uDBFF]/;Da=class{constructor(...t){}};tt=!1,Gg={configurable:!0,get(){tt=!0}};Ao="~constantCatch"});function Yg(e){let t=Xd;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return Xd=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function h(e,t,r,n){let o={};function i(d){this.def=d,this.constr=f,this.traits=new Set}i.prototype=o;let s=r,a=s&&new WeakSet;function c(d,m){if(d._zod){if(d._zod.traits.has(e))return}else{Ja.value=new i(m);try{Object.defineProperty(d,"_zod",Ja)}finally{Ja.value=void 0}}if(d._zod.traits.add(e),t(d,m),a){let b=Object.getPrototypeOf(d),w=d._zod.constr.prototype,S=b;for(;S&&S!==w;)S=Object.getPrototypeOf(S);let $=S??b;a.has($)||(a.add($),Ha($,s))}let g=f.prototype;for(let b in g)Object.prototype.hasOwnProperty.call(g,b)&&(b in d||(d[b]=g[b].bind(d)))}let u=n?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function f(d){let m=n?.Parent?Yg(l):this;c(m,d);let g=m._zod.deferred;if(g){for(let w of g)w();m._zod.deferred=void 0}let b=globalThis.__zod_globalConfig?.postProcessor;return b&&b(m),m}return Object.defineProperty(f,"init",{value:c}),Object.defineProperty(f,Symbol.hasInstance,{value:d=>n?.Parent&&d instanceof n.Parent?!0:d?._zod?.traits?.has(e)}),Object.defineProperty(f,"name",{value:e}),f}function Y(e){return e&&Object.assign(oe,e),oe}var Yd,Ro,Ja,Xd,Co,xe,ot,oe,nt=D(()=>{ee();Ro=Object.freeze({status:"aborted"}),Ja={value:void 0,enumerable:!1},Xd="captureStackTrace"in Error?Error:null;Co=Symbol("zod_brand"),xe=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ot=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Yd=globalThis).__zod_globalConfig??(Yd.__zod_globalConfig={});oe=globalThis.__zod_globalConfig});function Xg(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,or,2)),e.message}function ey(e){this._zod.message=e}function ry(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function ur(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?ry(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function lr(e,t=r=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>n({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)r._errors.push(t(s));else{let c=r,u=0;for(;u<a.length;){let l=a[u],f=u===a.length-1;if(l==="_errors"){f&&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});let d=c[l];f&&d._errors.push(t(s)),c=d,u++}}}};return n(e),r}function No(e,t=r=>r.message){let r={errors:[]},n=(o,i=[])=>{var s;for(let a of o.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>n({issues:c},[...i,...a.path]));else if(a.code==="invalid_key")n({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")n({issues:a.issues},[...i,...a.path]);else{let c=[...i,...a.path];if(c.length===0){r.errors.push(t(a));continue}let u=r,l=0;for(;l<c.length;){let f=c[l],d=l===c.length-1;typeof f=="string"?(u.properties??(u.properties={}),Object.prototype.hasOwnProperty.call(u.properties,f)||Object.defineProperty(u.properties,f,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),u=u.properties[f]):(u.items??(u.items=[]),(s=u.items)[f]??(s[f]={errors:[]}),u=u.items[f]),d&&u.errors.push(t(a)),l++}}};return n(e),r}function rm(e){let t=[],r=e.map(n=>typeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?t.push(`[${n}]`):typeof n=="symbol"?t.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?t.push(`[${JSON.stringify(n)}]`):(t.length&&t.push("."),t.push(n));return t.join("")}function Eo(e){let t=[],r=[...e.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)t.push(`\u2716 ${n.message}`),n.path?.length&&t.push(` \u2192 at ${rm(n.path)}`);return t.join(`
660
+ `)}var ty,Wa,em,tm,Ga,ze,Qa=D(()=>{nt();ee();ty={get:Xg,set:ey,enumerable:!0,configurable:!0},Wa={value:void 0,enumerable:!1},em=new WeakSet([Object.prototype,Error.prototype]),tm=(e,t)=>{e.name="$ZodError",Wa.value=t,Object.defineProperty(e,"issues",Wa),Wa.value=void 0,Object.defineProperty(e,"message",ty);let r=Object.getPrototypeOf(e);em.has(r)||(em.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},Ga=h("$ZodError",tm),ze=h("$ZodError",tm,void 0,{Parent:Error})});function Zo(e,t){return{callee:t?.callee??e,Err:t?.Err}}function nm(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>we(o,r,Y()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}function sy(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(n[iy]=!0,i=o({value:t,issues:[]},n)):i=e._zod.run({value:t,issues:[]},n),i instanceof Promise)throw new xe;return i.issues.length===0}var pr,tn,fr,rn,dr,Do,mr,Ya,oy,iy,zt,vt,jo,om,Mo,im,Lo,sm,Uo,am,Vo,cm,Fo,um,qo,lm,Ho,pm,Xa=D(()=>{nt();Qa();ee();pr=e=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new xe;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map(u=>we(u,s,Y())));throw Io(c,i?.callee??t),c}return a.value};return t},tn=pr(ze),fr=e=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},a=r._zod.run({value:n,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(i?.Err??e)(a.issues.map(u=>we(u,s,Y())));throw Io(c,i?.callee??t),c}return a.value};return t},rn=fr(ze),dr=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new xe;return i.issues.length?nm(e,i.issues,o):{success:!0,data:i.value}},Do=dr(ze);mr=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?nm(e,i.issues,o):{success:!0,data:i.value}},Ya=mr(ze),oy=Symbol.for("zod.compile.invalid"),iy=Symbol.for("zod.compile.fallback"),zt=((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==oy)return!0;if(n.definite===!0&&r===void 0)return!1}return sy(e,t,r)});vt=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length===0},jo=e=>{let t=pr(e),r=(n,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,a,Zo(r,s))};return r},om=jo(ze),Mo=e=>{let t=pr(e),r=(n,o,i,s)=>t(n,o,i,Zo(r,s));return r},im=Mo(ze),Lo=e=>{let t=fr(e),r=async(n,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,a,Zo(r,s))};return r},sm=Lo(ze),Uo=e=>{let t=fr(e),r=async(n,o,i,s)=>await t(n,o,i,Zo(r,s));return r},am=Uo(ze),Vo=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return dr(e)(t,r,o)},cm=Vo(ze),Fo=e=>(t,r,n)=>dr(e)(t,r,n),um=Fo(ze),qo=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return mr(e)(t,r,o)},lm=qo(ze),Ho=e=>async(t,r,n)=>mr(e)(t,r,n),pm=Ho(ze)});var Pe={};Ue(Pe,{anyString:()=>Sc,base64:()=>yc,base64url:()=>bc,bigint:()=>Ic,boolean:()=>Tc,browserEmail:()=>my,cidrv4:()=>hc,cidrv6:()=>gc,creditCard:()=>Bo,cuid:()=>tc,cuid2:()=>rc,currencyCode:()=>xc,date:()=>zc,datetime:()=>kc,domain:()=>$c,duration:()=>cc,e164:()=>wc,email:()=>lc,emoji:()=>pc,extendedDuration:()=>ay,guid:()=>uc,hex:()=>Nc,hostname:()=>_c,html5Email:()=>py,httpProtocol:()=>nn,iban:()=>Jo,idnEmail:()=>dy,integer:()=>on,ipv4:()=>fc,ipv6:()=>dc,ksuid:()=>ic,lowercase:()=>Rc,mac:()=>mc,md5_base64:()=>by,md5_base64url:()=>_y,md5_hex:()=>yy,nanoid:()=>sc,nanoidOfLength:()=>ac,null:()=>Oc,number:()=>Be,rfc5322Email:()=>fy,sha1_base64:()=>wy,sha1_base64url:()=>xy,sha1_hex:()=>$y,sha256_base64:()=>vy,sha256_base64url:()=>ky,sha256_hex:()=>zy,sha384_base64:()=>Py,sha384_base64url:()=>Iy,sha384_hex:()=>Sy,sha512_base64:()=>Oy,sha512_base64url:()=>Ay,sha512_hex:()=>Ty,string:()=>Pc,time:()=>vc,ulid:()=>nc,undefined:()=>Ac,unicodeEmail:()=>fm,uppercase:()=>Cc,uuid:()=>kt,uuid4:()=>cy,uuid6:()=>uy,uuid7:()=>ly,xid:()=>oc});function ac(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}function pc(){return new RegExp(hy,"u")}function gy(e){return new RegExp(`^${e}$`)}function ec(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function vc(e){return new RegExp(`^${ec(e)}$`)}function kc(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${ec({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${ec({precision:e.precision})}`:r;return new RegExp(`^${dm}T(?:${n})$`)}function sn(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function an(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var tc,rc,nc,oc,ic,sc,cc,ay,uc,kt,cy,uy,ly,lc,py,fy,fm,dy,my,hy,fc,dc,mc,hc,gc,yc,bc,_c,$c,nn,wc,Bo,xc,Jo,dm,zc,Sc,Pc,Ic,on,Be,Tc,Oc,Ac,Rc,Cc,Nc,yy,by,_y,$y,wy,xy,zy,vy,ky,Sy,Py,Iy,Ty,Oy,Ay,St=D(()=>{ee();tc=/^[cC][0-9a-z]{6,}$/,rc=/^[0-9a-z]+$/,nc=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,oc=/^[0-9a-vA-V]{20}$/,ic=/^[A-Za-z0-9]{27}$/,sc=/^[a-zA-Z0-9_-]{21}$/;cc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ay=/^[-+]?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)?)??$/,uc=/^([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})$/,kt=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)$/,cy=kt(4),uy=kt(6),ly=kt(7),lc=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,py=/^[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])?)*$/,fy=/^(([^<>()\[\]\\.,;:\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,}))$/,fm=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,dy=fm,my=/^[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])?)*$/,hy="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";fc=/^(?:(?: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])$/,dc=/^(([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}|:))$/,mc=e=>{let t=Oe(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},hc=/^((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])$/,gc=/^(([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])$/,yc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,bc=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,_c=/^(?=.{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])?)*\.?$/,$c=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,nn=/^https?$/,wc=/^\+[1-9]\d{6,14}$/,Bo=/^\d(?:[ -]?\d){11,18}$/,xc=/^(?: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)$/,Jo=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,dm="(?:(?:\\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])))";zc=gy(dm);Sc=/^[\s\S]{0,}$/,Pc=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ic=/^-?\d+n?$/,on=/^-?\d+$/,Be=/^-?\d+(?:\.\d+)?$/,Tc=/^(?:true|false)$/i,Oc=/^null$/i,Ac=/^undefined$/i,Rc=/^[^A-Z]*$/,Cc=/^[^a-z]*$/,Nc=/^[0-9a-fA-F]*$/;yy=/^[0-9a-fA-F]{32}$/,by=sn(22,"=="),_y=an(22),$y=/^[0-9a-fA-F]{40}$/,wy=sn(27,"="),xy=an(27),zy=/^[0-9a-fA-F]{64}$/,vy=sn(43,"="),ky=an(43),Sy=/^[0-9a-fA-F]{96}$/,Py=sn(64,""),Iy=an(64),Ty=/^[0-9a-fA-F]{128}$/,Oy=sn(86,"=="),Ay=an(86)});function Wo(e,t,r){e.issues.length&&t.issues.push(...$e(r,e.issues))}var W,Ec,Zc,Ko,Go,Qo,Dc,jc,Mc,Lc,Uc,Vc,Fc,qc,Hc,hr,Bc,Jc,Kc,Wc,Gc,Qc,Yc,Xc,eu,tu,Yo=D(()=>{nt();St();ee();W=h("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Ec=e=>{let t=e.value;return!Po(t)&&t.size!==void 0},Zc=e=>{let t=e.value;return!Po(t)&&t.length!==void 0},Ko={number:"number",bigint:"bigint",object:"date"},Go=h("$ZodCheckLessThan",(e,t)=>{W.init(e,t);let r=Ko[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:Ko[typeof n.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Qo=h("$ZodCheckGreaterThan",(e,t)=>{W.init(e,t);let r=Ko[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:Ko[typeof n.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Dc=h("$ZodCheckMultipleOf",(e,t)=>{W.init(e,t),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):Br(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),jc=h("$ZodCheckNumberFormat",(e,t)=>{W.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Wr[t.format];e._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,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:n,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:n,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})}}),Mc=h("$ZodCheckBigIntFormat",(e,t)=>{W.init(e,t);let[r,n]=Gr[t.format];e._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),Lc=h("$ZodCheckMaxSize",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=Ec),e._zod.check=n=>{let o=n.value;o.size<=t.maximum||n.issues.push({origin:Yr(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Uc=h("$ZodCheckMinSize",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=Ec),e._zod.check=n=>{let o=n.value;o.size>=t.minimum||n.issues.push({origin:Yr(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Vc=h("$ZodCheckSizeEquals",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=Ec),e._zod.check=n=>{let o=n.value,i=o.size;if(i===t.size)return;let s=i>t.size;n.issues.push({origin:Yr(o),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Fc=h("$ZodCheckMaxLength",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=Zc),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>t.maximum?xt(o):i)<=t.maximum)return;let a=Xr(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),qc=h("$ZodCheckMinLength",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=Zc),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?xt(o):i)>=t.minimum)return;let a=Xr(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Hc=h("$ZodCheckLengthEquals",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=Zc),e._zod.check=n=>{let o=n.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?xt(o):i;if(s===t.length)return;let a=Xr(o),c=s>t.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),hr=h("$ZodCheckStringFormat",(e,t)=>{var r,n;W.init(e,t),t.pattern?(r=e._zod).check??(r.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})}):(n=e._zod).check??(n.check=()=>{})}),Bc=h("$ZodCheckRegex",(e,t)=>{hr.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Jc=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Rc),hr.init(e,t)}),Kc=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Cc),hr.init(e,t)}),Wc=h("$ZodCheckIncludes",(e,t)=>{W.init(e,t);let r=Oe(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=n,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})}}),Gc=h("$ZodCheckStartsWith",(e,t)=>{W.init(e,t);let r=new RegExp(`^${Oe(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Qc=h("$ZodCheckEndsWith",(e,t)=>{W.init(e,t);let r=new RegExp(`.*${Oe(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});Yc=h("$ZodCheckProperty",(e,t)=>{W.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>Wo(o,r,t.property));Wo(n,r,t.property)}}),Xc=h("$ZodCheckProperties",(e,t)=>{W.init(e,t),en(e,Symbol.iterator,function*(){yield e});let r;e._zod.check=n=>{if(n.value==null){n.issues.push({expected:"object",code:"invalid_type",input:n.value,inst:e});return}r??(r=Reflect.ownKeys(t.shape).map(s=>[s,t.shape[s]]));let o=n.value,i;for(let[s,a]of r){let c=a._zod.run({value:o[s],issues:[]},{});c instanceof Promise?(i??(i=[]),i.push(c.then(u=>Wo(u,n,s)))):Wo(c,n,s)}if(i)return Promise.all(i).then(()=>{})}}),eu=h("$ZodCheckMimeType",(e,t)=>{W.init(e,t);let r=new Set(t.mime);e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),tu=h("$ZodCheckOverwrite",(e,t)=>{W.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}})});var Pt,Xo=D(()=>{Pt=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}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}let n=t.split(`
544
661
  `).filter(s=>s),o=Math.min(...n.map(s=>s.length-s.trimStart().length)),i=n.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
545
662
  ${r.join(`
546
663
  `)}
547
- };`)(...Object.values(this.closed))}}});var Xc,eu=D(()=>{Xc={major:4,minor:6,patch:7}});async function Ty(e,t){let r={async:!0};return Tm(await e._zod.run({value:t,issues:[]},r),r)}function ti(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Tm(n,r)}catch{}return Ty(e,t)},vendor:"zod",version:1}}function su(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function ri(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?su(e)||sn:Om(e,t)}function Om(e,t){if(!t.normalize&&t.protocol?.source===tn.source&&!/^https?:\/\//i.test(e))return iu;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??sn}return new URL(e)}catch{return sn}}function an(e){return e.replace(Oy,"")}function ni(e,t){return t.lastIndex=0,t.test(e.hostname)}function oi(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}function cn(e){return Ay.test(e)?su(`http://[${e}]`):!1}function ii(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);return`${o}`!==n||o<0||o>128?!1:cn(r)}function un(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function ai(e){if(!ln.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return un(r)}function Cy(e){let t=e.length,r=1,n=0;for(;t;){let o=e.charCodeAt(--t)-48;r^=1,n+=r?[0,2,4,6,8,1,3,5,7,9][o]:o}return n%10===0}function ci(e){return Fo.test(e)?Cy(e.replace(Ry,"")):!1}function Ny(e){let t=0,r=e.length;for(let n=4;n<r;n++){let o=e.charCodeAt(n);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}for(let n=0;n<4;n++){let o=e.charCodeAt(n);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}return t===1}function ui(e){return qo.test(e)?Ny(e):!1}function li(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}function Uu(e,t){let r=sr(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map(i=>i[0])),o=e._zod.parse;e._zod.parse=(i,s)=>{let a=t(i.value);if(a>n&&!s?.skipChecks&&s?.direction!=="backward"){for(let[c,u]of sr(e._zod.def.checks))if(a>c&&u._zod.def.when(i)){let l=i.issues.length;return u._zod.check(i),i.issues[l].continue=!1,Wr(i.issues,l,e),i}}return o(i,s)}}function mm(e,t,r){e.issues.length&&t.issues.push(...$e(r,e.issues)),t.value[r]=e.value}function ei(e,t,r,n,o,i){let s=r in n,a=i==="optional";if(!(!s&&a&&o==="optional")){if(e.issues.length){if(o!==void 0&&a&&!s)return;t.issues.push(...$e(r,e.issues))}if(!s&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(s||o==="defaulted"&&!a)&&(t.value[r]=void 0):t.value[r]=e.value}}function Am(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:jy,o=n.length?[...t,...n]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=Ma(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Rm(e,t,r,n,o,i,s){let a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,f=u.optin,d=u.optout,m=0;for(let g in t){if(s&&r.issues.length!==m){if(ge(r,m))break;m=r.issues.length}if(c.has(g))continue;if(g==="__proto__"){l==="never"&&a.push(g);continue}if(l==="never"){a.push(g);continue}let b=u.run({value:t[g],issues:[]},n);b instanceof Promise?e.push(b.then(w=>ei(w,r,g,t,f,d))):ei(b,r,g,t,f,d)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>r):r}function hm(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!ge(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(s=>we(s,n,Y())))}),t)}function gm(e,t,r,n){let 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:r,errors:e.map(i=>i.issues.map(s=>we(s,n,Y())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1,matches:o}),t)}function di(e,t){let r=e._zod,n=r.bag.optionsMap;n||(n=Nm(r.def),r.bag.optionsMap=n);let o=n.get(t);if(o===null)throw new Error(`Ambiguous discriminator value "${String(t)}"`);return o}function Nm(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}function hr(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(Te(e)&&Te(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let s=hr(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:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=hr(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function ym(e,t,r){let n=new Map,o,i=new Map,s=(u,l)=>{let f;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),f=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let d=String(u.path[0]);i.has(d)||i.set(d,u),f=[d]}else return!1;for(let d of f)n.has(d)||n.set(d,{}),n.get(d)[l]=!0;return!0};for(let u of t.issues)s(u,"l")||e.issues.push(u);for(let u of r.issues)s(u,"r")||e.issues.push(u);let a=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=o?a.filter(l=>o.keys.includes(l)):[];u.length&&e.issues.push({...o,keys:u});for(let l of a)!u.includes(l)&&i.has(l)&&e.issues.push(i.get(l))}let c=hr(t.value,r.value);if(!c.valid){if(ge(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}function bm(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function _m(e,t,r){e.issues.length&&t.issues.push(...$e(r,e.issues)),t.value[r]=e.value}function $m(e,t,r,n,o){for(let i=0;i<r.length;i++){let s=e[i],a=i<n.length;if(!a&&i>=o&&r[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(...$e(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=n.length&&(r[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}function wm(e,t,r,n,o,i,s){e.issues.length&&(Br.has(typeof n)?r.issues.push(...$e(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(a=>we(a,s,Y()))})),t.issues.length&&(Br.has(typeof n)?r.issues.push(...$e(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:t.issues.map(a=>we(a,s,Y()))})),r.value.set(e.value,t.value)}function xm(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}function zm(e,t){return e.value=t.issues.length?void 0:t.value,e}function vm(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function km(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function Sm(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>we(o,n,Y()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}function Qo(e,t,r){return e.issues.some(n=>n.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}function Yo(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>Xo(e,i,t.out,r)):Xo(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>Xo(e,i,t.in,r)):Xo(e,o,t.in,r)}}function Xo(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}function Pm(e){return e.memo||(e.value=Object.freeze(e.value)),e}function My(e){let t=e._zod.def,r=t.pattern,n=!!t.format?.includes("int"),o,i;for(let a of t.checks??[]){let c=a._zod.def;c.pattern&&(r=c.pattern),n||(n=!!c.format?.includes("int"));let 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(r)return r.source;if(o!==void 0&&i!==void 0&&o>i)return"(?!)";if(o!==void 0||i!==void 0)return vc({minimum:o,maximum:i}).source;let s=e._zod.pattern;return(n&&s===Be?rn:s)?.source}function tu(e){let t=e._zod.def,r=e._zod.pattern?.source,n=t.innerType??e._zod.innerType;if(n){let o=n._zod.pattern?.source,i=tu(n);return r&&o&&i&&i!==o?r.replace(He(o),()=>He(i)):r}if(t.options){let o=t.options.map(tu);if(o.every(Boolean))return`^(${o.map(i=>He(i)).join("|")})$`}return My(e)}function Im(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(ar(o))}}var O,Tm,Pt,V,ru,nu,ou,iu,sn,Oy,au,cu,uu,lu,pu,fu,du,mu,hu,gu,yu,bu,_u,Ay,$u,wu,xu,zu,si,vu,ln,ku,Su,Ry,Pu,Iu,Tu,Ou,pi,Au,pn,fi,Ru,Cu,Nu,Eu,Zu,Du,ju,Mu,Lu,Ey,Zy,Dy,Vu,jy,Cm,Fu,fn,qu,Hu,Bu,mi,Ju,Ku,Wu,Gu,Qu,Yu,Xu,hi,el,tl,rl,nl,ol,il,sl,al,gi,dn,cl,ul,ll,pl,fl,mn,dl,gr=D(()=>{Wo();rt();Go();Ga();kt();ee();eu();ee();O=h("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Xc;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,c,u)=>{if(a.memo)return a;let l=ge(a),f;for(let d of c){if(d._zod.def.when){if(La(a)||!d._zod.def.when(a))continue}else if(l)continue;let m=a.issues.length,g=d._zod.check(a);if(g instanceof Promise&&u?.async===!1)throw new xe;if(f||g instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await g,a.issues.length!==m&&(Wr(a.issues,m,e),l||(l=ge(a,m)))});else{if(a.issues.length===m)continue;Wr(a.issues,m,e),l||(l=ge(a,m))}}return f?f.then(()=>a):a},s=(a,c,u)=>{if(ge(a))return a.aborted=!0,a;let l=i(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new xe;return l.then(f=>e._zod.parse(f,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"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return l instanceof Promise?l.then(f=>s(f,a,c)):s(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new xe;return u.then(l=>i(l,o,c))}return i(u,o,c)}}},{get"~standard"(){return Yr(this,"~standard",ti(this))},set"~standard"(e){tt(this,"~standard",e)}}),Tm=(e,t)=>e.issues.length?{issues:e.issues.map(r=>we(r,t,Y()))}:{value:e.value};Pt=h("$ZodString",(e,t)=>{O.init(e,t),e._zod.pattern=t.pattern??zc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),V=h("$ZodStringFormat",(e,t)=>{mr.init(e,t),Pt.init(e,t)}),ru=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=sc),V.init(e,t)}),nu=h("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=vt(n))}else t.pattern??(t.pattern=vt());V.init(e,t)}),ou=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ac),V.init(e,t)}),iu=1,sn=2;Oy=/[\t\n\r]/g;au=h("$ZodURL",(e,t)=>{V.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=ri(n,t);if(o===iu){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===sn){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=an(n);return}t.hostname&&!ni(o,t.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&!oi(o,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?o.href:an(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),cu=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=cc()),V.init(e,t)}),uu=h("$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?nc:oc(t.length)),V.init(e,t)}),lu=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ya),V.init(e,t)}),pu=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Xa),V.init(e,t)}),fu=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ec),V.init(e,t)}),du=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=tc),V.init(e,t)}),mu=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=rc),V.init(e,t)}),hu=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=xc(t)),V.init(e,t)}),gu=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=$c),V.init(e,t)}),yu=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=wc(t)),V.init(e,t)}),bu=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ic),V.init(e,t)}),_u=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=uc),V.init(e,t)}),Ay=/^[0-9a-fA-F:.]+$/;$u=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=lc),V.init(e,t),e._zod.check=r=>{cn(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}),wu=h("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=pc(t.delimiter)),V.init(e,t)}),xu=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=fc),V.init(e,t)});zu=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=dc),V.init(e,t),e._zod.check=r=>{ii(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});si=/^[0-9a-zA-Z+/]*={0,2}$/,vu=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=si),V.init(e,t),e._zod.check=r=>{un(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),ln=/^[A-Za-z0-9_-]*$/;ku=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ln),V.init(e,t),e._zod.check=r=>{ai(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Su=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=bc),V.init(e,t)}),Ry=/[- ]/g;Pu=h("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=Fo),V.init(e,t),e._zod.check=r=>{ci(r.value)||r.issues.push({code:"invalid_format",format:"credit_card",input:r.value,inst:e,continue:!t.abort})}});Iu=h("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=qo),V.init(e,t),e._zod.check=r=>{ui(r.value)||r.issues.push({code:"invalid_format",format:"iban",input:r.value,inst:e,continue:!t.abort})}});Tu=h("$ZodJWT",(e,t)=>{V.init(e,t),e._zod.check=r=>{li(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Ou=h("$ZodCustomStringFormat",(e,t)=>{V.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),pi=h("$ZodNumber",(e,t)=>{O.init(e,t),e._zod.pattern=Be,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),Au=h("$ZodNumberFormat",(e,t)=>{Ec.init(e,t),pi.init(e,t)}),pn=h("$ZodBoolean",(e,t)=>{O.init(e,t),e._zod.pattern=Sc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),fi=h("$ZodBigInt",(e,t)=>{O.init(e,t),e._zod.pattern=kc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),Ru=h("$ZodBigIntFormat",(e,t)=>{Zc.init(e,t),fi.init(e,t)}),Cu=h("$ZodSymbol",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),r}}),Nu=h("$ZodUndefined",(e,t)=>{O.init(e,t),e._zod.pattern=Ic,e._zod.values=new Set([void 0]),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),r}}),Eu=h("$ZodNull",(e,t)=>{O.init(e,t),e._zod.pattern=Pc,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),Zu=h("$ZodAny",(e,t)=>{O.init(e,t),e._zod.parse=r=>r}),Du=h("$ZodUnknown",(e,t)=>{O.init(e,t),e._zod.parse=r=>r}),ju=h("$ZodNever",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Mu=h("$ZodVoid",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),Lu=h("$ZodDate",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),r}});Ey=e=>Array.isArray(e)?e.length:-1,Zy=e=>e instanceof Map?e.size:-1,Dy=e=>e instanceof Set?e.size:-1;Vu=h("$ZodArray",(e,t)=>{O.init(e,t);let r=oe.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],a=o?.abortEarly;for(let c=0;c<i.length;c++){let u=i[c],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)s.push(l.then(f=>mm(f,n,c)));else if(mm(l,n,c),a&&l.issues.length!==0&&ge(l))break}return s.length?Promise.all(s).then(()=>n):n},Uu(e,Ey)});jy=[];Cm=h("$ZodObject",(e,t)=>{O.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=n,Object.defineProperty(t,"shape",{get:u})}let o=or(()=>Am(t));R(e,"propValues",u=>{let l=u.def.shape,f={};for(let d in l){let m=l[d]._zod;if(m.values){Object.prototype.hasOwnProperty.call(f,d)||ce(f,d,new Set);for(let g of m.values)f[d].add(g);m.optin!==void 0&&f[d].add(void 0)}}return f});let i=$t,s=t.catchall,a,c=oe.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=o.value);let f=u.value;if(!i(f))return u.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let d=[],m=a.shape,g=l?.abortEarly,b=u.issues.length;for(let w of a.allKeys){if(g&&u.issues.length!==b){if(ge(u,b))break;b=u.issues.length}if(w==="__proto__")continue;let S=m[w],$=S._zod.optin,P=S._zod.optout,E=S._zod.run({value:f[w],issues:[]},l);E instanceof Promise?d.push(E.then(G=>ei(G,u,w,f,$,P))):ei(E,u,w,f,$,P)}return s?Rm(d,f,u,l,o.value,e,g===!0):d.length?Promise.all(d).then(()=>u):u}}),Fu=h("$ZodObjectJIT",(e,t)=>{Cm.init(e,t);let r=e._zod.parse,n=or(()=>Am(t)),o=oe.memoizer,i=m=>{let g=n.value,b=g.symbolKeys,w=new St(["payload","ctx"],{shape:m,inst:e,memo:o,syms:b}),S=G=>`shape[${G}]._zod.run({ value: input[${G}], issues: [] }, ctx)`,$=(G,Z)=>`
664
+ };`)(...Object.values(this.closed))}}});var ru,nu=D(()=>{ru={major:4,minor:6,patch:7}});async function Ry(e,t){let r={async:!0};return Om(await e._zod.run({value:t,issues:[]},r),r)}function oi(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Om(n,r)}catch{}return Ry(e,t)},vendor:"zod",version:1}}function uu(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function ii(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?uu(e)||cn:Am(e,t)}function Am(e,t){if(!t.normalize&&t.protocol?.source===nn.source&&!/^https?:\/\//i.test(e))return cu;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??cn}return new URL(e)}catch{return cn}}function un(e){return e.replace(Cy,"")}function si(e,t){return t.lastIndex=0,t.test(e.hostname)}function ai(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}function ln(e){return Ny.test(e)?uu(`http://[${e}]`):!1}function ci(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);return`${o}`!==n||o<0||o>128?!1:ln(r)}function pn(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function li(e){if(!fn.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return pn(r)}function Zy(e){let t=e.length,r=1,n=0;for(;t;){let o=e.charCodeAt(--t)-48;r^=1,n+=r?[0,2,4,6,8,1,3,5,7,9][o]:o}return n%10===0}function pi(e){return Bo.test(e)?Zy(e.replace(Ey,"")):!1}function Dy(e){let t=0,r=e.length;for(let n=4;n<r;n++){let o=e.charCodeAt(n);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}for(let n=0;n<4;n++){let o=e.charCodeAt(n);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}return t===1}function fi(e){return Jo.test(e)?Dy(e):!1}function di(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}function qu(e,t){let r=ar(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map(i=>i[0])),o=e._zod.parse;e._zod.parse=(i,s)=>{let a=t(i.value);if(a>n&&!s?.skipChecks&&s?.direction!=="backward"){for(let[c,u]of ar(e._zod.def.checks))if(a>c&&u._zod.def.when(i)){let l=i.issues.length;return u._zod.check(i),i.issues[l].continue=!1,Qr(i.issues,l,e),i}}return o(i,s)}}function hm(e,t,r){e.issues.length&&t.issues.push(...$e(r,e.issues)),t.value[r]=e.value}function ni(e,t,r,n,o,i){let s=r in n,a=i==="optional";if(!(!s&&a&&o==="optional")){if(e.issues.length){if(o!==void 0&&a&&!s)return;t.issues.push(...$e(r,e.issues))}if(!s&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(s||o==="defaulted"&&!a)&&(t.value[r]=void 0):t.value[r]=e.value}}function Rm(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Uy,o=n.length?[...t,...n]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=Va(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Cm(e,t,r,n,o,i,s){let a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,f=u.optin,d=u.optout,m=0;for(let g in t){if(s&&r.issues.length!==m){if(ge(r,m))break;m=r.issues.length}if(c.has(g))continue;if(g==="__proto__"){l==="never"&&a.push(g);continue}if(l==="never"){a.push(g);continue}let b=u.run({value:t[g],issues:[]},n);b instanceof Promise?e.push(b.then(w=>ni(w,r,g,t,f,d))):ni(b,r,g,t,f,d)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>r):r}function gm(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!ge(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(s=>we(s,n,Y())))}),t)}function ym(e,t,r,n){let 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:r,errors:e.map(i=>i.issues.map(s=>we(s,n,Y())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1,matches:o}),t)}function gi(e,t){let r=e._zod,n=r.bag.optionsMap;n||(n=Em(r.def),r.bag.optionsMap=n);let o=n.get(t);if(o===null)throw new Error(`Ambiguous discriminator value "${String(t)}"`);return o}function Em(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}function gr(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(Te(e)&&Te(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let s=gr(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:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=gr(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function bm(e,t,r){let n=new Map,o,i=new Map,s=(u,l)=>{let f;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),f=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let d=String(u.path[0]);i.has(d)||i.set(d,u),f=[d]}else return!1;for(let d of f)n.has(d)||n.set(d,{}),n.get(d)[l]=!0;return!0};for(let u of t.issues)s(u,"l")||e.issues.push(u);for(let u of r.issues)s(u,"r")||e.issues.push(u);let a=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=o?a.filter(l=>o.keys.includes(l)):[];u.length&&e.issues.push({...o,keys:u});for(let l of a)!u.includes(l)&&i.has(l)&&e.issues.push(i.get(l))}let c=gr(t.value,r.value);if(!c.valid){if(ge(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}function _m(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function $m(e,t,r){e.issues.length&&t.issues.push(...$e(r,e.issues)),t.value[r]=e.value}function wm(e,t,r,n,o){for(let i=0;i<r.length;i++){let s=e[i],a=i<n.length;if(!a&&i>=o&&r[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(...$e(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=n.length&&(r[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}function xm(e,t,r,n,o,i,s){e.issues.length&&(Kr.has(typeof n)?r.issues.push(...$e(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(a=>we(a,s,Y()))})),t.issues.length&&(Kr.has(typeof n)?r.issues.push(...$e(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:t.issues.map(a=>we(a,s,Y()))})),r.value.set(e.value,t.value)}function zm(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}function vm(e,t){return e.value=t.issues.length?void 0:t.value,e}function km(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function Sm(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function Pm(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>we(o,n,Y()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}function ei(e,t,r){return e.issues.some(n=>n.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}function ti(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>ri(e,i,t.out,r)):ri(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>ri(e,i,t.in,r)):ri(e,o,t.in,r)}}function ri(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}function Im(e){return e.memo||(e.value=Object.freeze(e.value)),e}function Vy(e){let t=e._zod.def,r=t.pattern,n=!!t.format?.includes("int"),o,i;for(let a of t.checks??[]){let c=a._zod.def;c.pattern&&(r=c.pattern),n||(n=!!c.format?.includes("int"));let 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(r)return r.source;if(o!==void 0&&i!==void 0&&o>i)return"(?!)";if(o!==void 0||i!==void 0)return Pc({minimum:o,maximum:i}).source;let s=e._zod.pattern;return(n&&s===Be?on:s)?.source}function ou(e){let t=e._zod.def,r=e._zod.pattern?.source,n=t.innerType??e._zod.innerType;if(n){let o=n._zod.pattern?.source,i=ou(n);return r&&o&&i&&i!==o?r.replace(He(o),()=>He(i)):r}if(t.options){let o=t.options.map(ou);if(o.every(Boolean))return`^(${o.map(i=>He(i)).join("|")})$`}return Vy(e)}function Tm(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(cr(o))}}var O,Om,It,V,iu,su,au,cu,cn,Cy,lu,pu,fu,du,mu,hu,gu,yu,bu,_u,$u,wu,xu,Ny,zu,vu,ku,Su,ui,Pu,fn,Iu,Tu,Ey,Ou,Au,Ru,Cu,mi,Nu,dn,hi,Eu,Zu,Du,ju,Mu,Lu,Uu,Vu,Fu,jy,My,Ly,Hu,Uy,Nm,Bu,mn,Ju,Ku,Wu,yi,Gu,Qu,Yu,Xu,el,tl,rl,bi,nl,ol,il,sl,al,cl,ul,ll,_i,hn,pl,fl,dl,ml,hl,gn,gl,yr=D(()=>{Yo();nt();Xo();Xa();St();ee();nu();ee();O=h("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ru;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,c,u)=>{if(a.memo)return a;let l=ge(a),f;for(let d of c){if(d._zod.def.when){if(Fa(a)||!d._zod.def.when(a))continue}else if(l)continue;let m=a.issues.length,g=d._zod.check(a);if(g instanceof Promise&&u?.async===!1)throw new xe;if(f||g instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await g,a.issues.length!==m&&(Qr(a.issues,m,e),l||(l=ge(a,m)))});else{if(a.issues.length===m)continue;Qr(a.issues,m,e),l||(l=ge(a,m))}}return f?f.then(()=>a):a},s=(a,c,u)=>{if(ge(a))return a.aborted=!0,a;let l=i(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new xe;return l.then(f=>e._zod.parse(f,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"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return l instanceof Promise?l.then(f=>s(f,a,c)):s(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new xe;return u.then(l=>i(l,o,c))}return i(u,o,c)}}},{get"~standard"(){return en(this,"~standard",oi(this))},set"~standard"(e){rt(this,"~standard",e)}}),Om=(e,t)=>e.issues.length?{issues:e.issues.map(r=>we(r,t,Y()))}:{value:e.value};It=h("$ZodString",(e,t)=>{O.init(e,t),e._zod.pattern=t.pattern??Sc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),V=h("$ZodStringFormat",(e,t)=>{hr.init(e,t),It.init(e,t)}),iu=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=uc),V.init(e,t)}),su=h("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=kt(n))}else t.pattern??(t.pattern=kt());V.init(e,t)}),au=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=lc),V.init(e,t)}),cu=1,cn=2;Cy=/[\t\n\r]/g;lu=h("$ZodURL",(e,t)=>{V.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=ii(n,t);if(o===cu){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===cn){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=un(n);return}t.hostname&&!si(o,t.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&!ai(o,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?o.href:un(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),pu=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=pc()),V.init(e,t)}),fu=h("$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?sc:ac(t.length)),V.init(e,t)}),du=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=tc),V.init(e,t)}),mu=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=rc),V.init(e,t)}),hu=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=nc),V.init(e,t)}),gu=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=oc),V.init(e,t)}),yu=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ic),V.init(e,t)}),bu=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=kc(t)),V.init(e,t)}),_u=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=zc),V.init(e,t)}),$u=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=vc(t)),V.init(e,t)}),wu=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=cc),V.init(e,t)}),xu=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=fc),V.init(e,t)}),Ny=/^[0-9a-fA-F:.]+$/;zu=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=dc),V.init(e,t),e._zod.check=r=>{ln(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}),vu=h("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=mc(t.delimiter)),V.init(e,t)}),ku=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=hc),V.init(e,t)});Su=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=gc),V.init(e,t),e._zod.check=r=>{ci(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});ui=/^[0-9a-zA-Z+/]*={0,2}$/,Pu=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ui),V.init(e,t),e._zod.check=r=>{pn(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),fn=/^[A-Za-z0-9_-]*$/;Iu=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=fn),V.init(e,t),e._zod.check=r=>{li(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Tu=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=wc),V.init(e,t)}),Ey=/[- ]/g;Ou=h("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=Bo),V.init(e,t),e._zod.check=r=>{pi(r.value)||r.issues.push({code:"invalid_format",format:"credit_card",input:r.value,inst:e,continue:!t.abort})}});Au=h("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=Jo),V.init(e,t),e._zod.check=r=>{fi(r.value)||r.issues.push({code:"invalid_format",format:"iban",input:r.value,inst:e,continue:!t.abort})}});Ru=h("$ZodJWT",(e,t)=>{V.init(e,t),e._zod.check=r=>{di(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Cu=h("$ZodCustomStringFormat",(e,t)=>{V.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),mi=h("$ZodNumber",(e,t)=>{O.init(e,t),e._zod.pattern=Be,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),Nu=h("$ZodNumberFormat",(e,t)=>{jc.init(e,t),mi.init(e,t)}),dn=h("$ZodBoolean",(e,t)=>{O.init(e,t),e._zod.pattern=Tc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),hi=h("$ZodBigInt",(e,t)=>{O.init(e,t),e._zod.pattern=Ic,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),Eu=h("$ZodBigIntFormat",(e,t)=>{Mc.init(e,t),hi.init(e,t)}),Zu=h("$ZodSymbol",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),r}}),Du=h("$ZodUndefined",(e,t)=>{O.init(e,t),e._zod.pattern=Ac,e._zod.values=new Set([void 0]),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),r}}),ju=h("$ZodNull",(e,t)=>{O.init(e,t),e._zod.pattern=Oc,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),Mu=h("$ZodAny",(e,t)=>{O.init(e,t),e._zod.parse=r=>r}),Lu=h("$ZodUnknown",(e,t)=>{O.init(e,t),e._zod.parse=r=>r}),Uu=h("$ZodNever",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Vu=h("$ZodVoid",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),Fu=h("$ZodDate",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),r}});jy=e=>Array.isArray(e)?e.length:-1,My=e=>e instanceof Map?e.size:-1,Ly=e=>e instanceof Set?e.size:-1;Hu=h("$ZodArray",(e,t)=>{O.init(e,t);let r=oe.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],a=o?.abortEarly;for(let c=0;c<i.length;c++){let u=i[c],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)s.push(l.then(f=>hm(f,n,c)));else if(hm(l,n,c),a&&l.issues.length!==0&&ge(l))break}return s.length?Promise.all(s).then(()=>n):n},qu(e,jy)});Uy=[];Nm=h("$ZodObject",(e,t)=>{O.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=n,Object.defineProperty(t,"shape",{get:u})}let o=ir(()=>Rm(t));R(e,"propValues",u=>{let l=u.def.shape,f={};for(let d in l){let m=l[d]._zod;if(m.values){Object.prototype.hasOwnProperty.call(f,d)||ce(f,d,new Set);for(let g of m.values)f[d].add(g);m.optin!==void 0&&f[d].add(void 0)}}return f});let i=wt,s=t.catchall,a,c=oe.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=o.value);let f=u.value;if(!i(f))return u.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let d=[],m=a.shape,g=l?.abortEarly,b=u.issues.length;for(let w of a.allKeys){if(g&&u.issues.length!==b){if(ge(u,b))break;b=u.issues.length}if(w==="__proto__")continue;let S=m[w],$=S._zod.optin,P=S._zod.optout,E=S._zod.run({value:f[w],issues:[]},l);E instanceof Promise?d.push(E.then(G=>ni(G,u,w,f,$,P))):ni(E,u,w,f,$,P)}return s?Cm(d,f,u,l,o.value,e,g===!0):d.length?Promise.all(d).then(()=>u):u}}),Bu=h("$ZodObjectJIT",(e,t)=>{Nm.init(e,t);let r=e._zod.parse,n=ir(()=>Rm(t)),o=oe.memoizer,i=m=>{let g=n.value,b=g.symbolKeys,w=new Pt(["payload","ctx"],{shape:m,inst:e,memo:o,syms:b}),S=G=>`shape[${G}]._zod.run({ value: input[${G}], issues: [] }, ctx)`,$=(G,Z)=>`
548
665
  let ${G}_ab = false;
549
666
  for (let i = 0; i < ${G}.issues.length; i++) {
550
667
  const iss = ${G}.issues[i];
@@ -555,26 +672,26 @@ ${r.join(`
555
672
  if (${G}_ab && ctx && ctx.abortEarly) {
556
673
  payload.value = newResult;
557
674
  return payload;
558
- }`;w.write("const input = payload.value;");let P=Object.create(null),E=0;for(let G of g.allKeys)P[G]=`key_${E++}`;w.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let G of g.allKeys){if(G==="__proto__")continue;let Z=P[G],fe=typeof G=="symbol"?`syms[${b.indexOf(G)}]`:he(G),Fr=`${fe} in input`,Fd=m[G],Aa=Fd?._zod?.optin,qd=Aa!==void 0,mg=Fd?._zod?.optout==="optional";if(w.write(`const ${Z} = ${S(fe)};`),qd&&mg){let hg=Aa==="optional"?`${Z}_present`:`${Z}.value !== undefined || ${Z}_present`;w.write(`
559
- const ${Z}_present = ${Fr};
675
+ }`;w.write("const input = payload.value;");let P=Object.create(null),E=0;for(let G of g.allKeys)P[G]=`key_${E++}`;w.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let G of g.allKeys){if(G==="__proto__")continue;let Z=P[G],fe=typeof G=="symbol"?`syms[${b.indexOf(G)}]`:he(G),Hr=`${fe} in input`,qd=m[G],Na=qd?._zod?.optin,Hd=Na!==void 0,yg=qd?._zod?.optout==="optional";if(w.write(`const ${Z} = ${S(fe)};`),Hd&&yg){let bg=Na==="optional"?`${Z}_present`:`${Z}.value !== undefined || ${Z}_present`;w.write(`
676
+ const ${Z}_present = ${Hr};
560
677
  if (!${Z}.issues.length || ${Z}_present) {
561
678
  if (${Z}.issues.length) {${$(Z,fe)}
562
679
  }
563
680
 
564
- if (${hg}) {
681
+ if (${bg}) {
565
682
  newResult[${fe}] = ${Z}.value;
566
683
  }
567
684
  }
568
685
 
569
- `)}else qd?(w.write(`
686
+ `)}else Hd?(w.write(`
570
687
  if (${Z}.issues.length) {${$(Z,fe)}
571
688
  }
572
- `),Aa==="defaulted"?w.write(`newResult[${fe}] = ${Z}.value;`):w.write(`
573
- if (${Z}.value !== undefined || ${Fr}) {
689
+ `),Na==="defaulted"?w.write(`newResult[${fe}] = ${Z}.value;`):w.write(`
690
+ if (${Z}.value !== undefined || ${Hr}) {
574
691
  newResult[${fe}] = ${Z}.value;
575
692
  }
576
693
  `)):w.write(`
577
- const ${Z}_present = ${Fr};
694
+ const ${Z}_present = ${Hr};
578
695
  if (${Z}.issues.length) {${$(Z,fe)}
579
696
  }
580
697
  if (!${Z}_present && !${Z}.issues.length) {
@@ -594,13 +711,13 @@ ${r.join(`
594
711
  newResult[${fe}] = ${Z}.value;
595
712
  }
596
713
 
597
- `)}return w.write("payload.value = newResult;"),w.write("return payload;"),w.compile()},s,a=$t,c=!oe.jitless,l=c&&Da.value,f=t.catchall,d;e._zod.parse=(m,g)=>{d??(d=n.value);let b=m.value;return a(b)?c&&l&&g?.async===!1&&g.jitless!==!0?(s||(s=i(t.shape)),m=s(m,g),f?Rm([],b,m,g,d,e,g?.abortEarly===!0):m):r(m,g):(m.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),m)}});fn=h("$ZodUnion",(e,t)=>{O.init(e,t),R(e,"optin",n=>n.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),R(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),R(e,"values",n=>{if(n.def.options.every(o=>o._zod.values))return new Set(n.def.options.flatMap(o=>Array.from(o._zod.values)))}),R(e,"pattern",n=>{if(n.def.options.every(o=>o._zod.pattern)){let o=n.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>He(i.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:n.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=>hm(a,n,e,o)):hm(s,n,e,o)}});qu=h("$ZodXor",(e,t)=>{fn.init(e,t),t.inclusive=!1;let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},o);c instanceof Promise?(s.push(c),i=!0):s.push(c)}return i?Promise.all(s).then(a=>gm(a,n,e,o)):gm(s,n,e,o)}});Hu=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,fn.init(e,t);let r=e._zod.parse;R(e,"propValues",o=>{let i={},s=0;for(let a of o.def.options){let 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(let[u,l]of Object.entries(c)){Object.prototype.hasOwnProperty.call(i,u)||ce(i,u,new Set);for(let f of l)i[u].add(f)}}return!o.def.unionFallback&&s>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{let s=ir(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let n=or(()=>Nm(t));e._zod.parse=(o,i)=>{let s=o.value;if(!$t(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let a=s?.[t.discriminator],c=n.value.get(a);return c&&(a!==void 0||i.direction!=="backward")?c._zod.run(o,i):t.unionFallback||i.direction==="backward"?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter(u=>n.value.get(u)!==null),input:s,path:[t.discriminator],inst:e}),o)}}),Bu=h("$ZodIntersection",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>ym(r,c,u)):ym(r,i,s)}});mi=h("$ZodTuple",(e,t)=>{O.init(e,t);let r=t.items,n=oe.memoizer;n?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=n?n.alloc(e,o,[],i):[];let a=[],c=bm(r,"optin"),u=bm(r,"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>r.length&&o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:s,inst:e,origin:"array"})}let l=new Array(r.length),f=t.rest?i?.abortEarly:void 0,d=!1;for(let m=0;m<r.length;m++){let g=r[m]._zod.run({value:s[m],issues:[]},i);g instanceof Promise?a.push(g.then(b=>{l[m]=b})):(l[m]=g,f&&!d&&g.issues.length&&(d=ge(g)))}if(t.rest&&!d){let m=r.length-1,g=s.slice(r.length),b=o.issues.length;for(let w of g){if(f&&o.issues.length!==b){if(ge(o,b))break;b=o.issues.length}m++;let S=t.rest._zod.run({value:w,issues:[]},i);S instanceof Promise?a.push(S.then($=>_m($,o,m))):_m(S,o,m)}}return a.length?Promise.all(a).then(()=>$m(l,o,r,s,u)):$m(l,o,r,s,u)}});Ju=h("$ZodRecord",(e,t)=>{O.init(e,t);let r=oe.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Te(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let s=[],a=t.keyType._zod.values;if(a&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let c=new Set;for(let 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;let f=t.keyType._zod.run({value:l,issues:[]},o);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(f.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(g=>we(g,o,Y())),input:l,path:[l],inst:e});continue}let d=f.value;if(d==="__proto__")continue;let m=t.valueType._zod.run({value:i[l],issues:[]},o);m instanceof Promise?s.push(m.then(g=>{g.issues.length&&n.issues.push(...$e(l,g.issues)),n.value[d]=g.value})):(m.issues.length&&n.issues.push(...$e(l,m.issues)),n.value[d]=m.value)}let u;for(let l in i)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=i[l]}else u=u??[],u.push(l);u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let c;for(let 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"&&Be.test(u)&&l.issues.length){let g=t.keyType._zod.run({value:Number(u),issues:[]},o);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(l=g)}if(l.issues.length){t.mode==="loose"?n.value[u]=i[u]:a?(c=c??[],c.push(u)):n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(g=>we(g,o,Y())),input:u,path:[u],inst:e});continue}let d=l.value;if(d==="__proto__")continue;let m=t.valueType._zod.run({value:i[u],issues:[]},o);m instanceof Promise?s.push(m.then(g=>{g.issues.length&&n.issues.push(...$e(u,g.issues)),n.value[d]=g.value})):(m.issues.length&&n.issues.push(...$e(u,m.issues)),n.value[d]=m.value)}c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>n):n}}),Ku=h("$ZodMap",(e,t)=>{O.init(e,t);let r=oe.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!(i instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),n;let s=[];n.value=r?r.alloc(e,n,new Map,o):new Map;let a=o?.abortEarly,c=n.issues.length;for(let[u,l]of i){if(a&&n.issues.length!==c){if(ge(n,c))break;c=n.issues.length}let f=t.keyType._zod.run({value:u,issues:[]},o),d=t.valueType._zod.run({value:l,issues:[]},o);f instanceof Promise||d instanceof Promise?s.push(Promise.all([f,d]).then(([m,g])=>{wm(m,g,n,u,i,e,o)})):wm(f,d,n,u,i,e,o)}return s.length?Promise.all(s).then(()=>n):n},Uu(e,Zy)});Wu=h("$ZodSet",(e,t)=>{O.init(e,t);let r=oe.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!(i instanceof Set))return n.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),n;let s=[];n.value=r?r.alloc(e,n,new Set,o):new Set;let a=o?.abortEarly,c=n.issues.length;for(let u of i){if(a&&n.issues.length!==c){if(ge(n,c))break;c=n.issues.length}let l=t.valueType._zod.run({value:u,issues:[]},o);l instanceof Promise?s.push(l.then(f=>xm(f,n))):xm(l,n)}return s.length?Promise.all(s).then(()=>n):n},Uu(e,Dy)});Gu=h("$ZodEnum",(e,t)=>{O.init(e,t);let r=rr(t.entries),n=new Set(r);e._zod.values=n,R(e,"pattern",o=>{let i=rr(o.def.entries).filter(s=>Br.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>Oe(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),Qu=h("$ZodLiteral",(e,t)=>{O.init(e,t);let r=new Set(t.values);e._zod.values=r,R(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?Oe(i):i?Oe(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),Yu=h("$ZodFile",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),r}}),Xu=h("$ZodTransform",(e,t)=>{O.init(e,t),e._zod.optin="optional",oe.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new nt(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new xe;return r.value=o,r}});hi=h("$ZodOptional",(e,t)=>{O.init(e,t),R(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",R(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),R(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${He(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>zm(r,i)):zm(r,o)}return t.innerType._zod.run(r,n)}}),el=h("$ZodExactOptional",(e,t)=>{hi.init(e,t),R(e,"values",r=>r.def.innerType._zod.values),R(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),tl=h("$ZodNullable",(e,t)=>{O.init(e,t),R(e,"optin",r=>r.def.innerType._zod.optin),R(e,"optout",r=>r.def.innerType._zod.optout),R(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${He(n.source)}|null)$`):void 0}),R(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),rl=h("$ZodDefault",(e,t)=>{O.init(e,t),e._zod.optin="defaulted",R(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>vm(i,t)):vm(o,t)}});nl=h("$ZodPrefault",(e,t)=>{O.init(e,t),e._zod.optin="defaulted",R(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),ol=h("$ZodNonOptional",(e,t)=>{O.init(e,t),R(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>km(i,e)):km(o,e)}});il=h("$ZodSuccess",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new nt("ZodSuccess");let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}});sl=h("$ZodCatch",(e,t)=>{O.init(e,t),R(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),R(e,"optout",r=>r.def.innerType._zod.optout),R(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>Sm(r,i,t,n)):Sm(r,o,t,n)}}),al=h("$ZodNaN",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),gi=h("$ZodPipe",(e,t)=>{O.init(e,t),R(e,"values",r=>r.def.in._zod.values),R(e,"optin",r=>r.def.in._zod.optin),R(e,"optout",r=>r.def.out._zod.optout),R(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(s=>Qo(s,t.in,n)):Qo(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Qo(i,t.out,n)):Qo(o,t.out,n)}});dn=h("$ZodCodec",(e,t)=>{O.init(e,t),R(e,"values",r=>r.def.in._zod.values),R(e,"optin",r=>r.def.in._zod.optin),R(e,"optout",r=>r.def.out._zod.optout),R(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(s=>Yo(s,t,n)):Yo(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(s=>Yo(s,t,n)):Yo(i,t,n)}}});cl=h("$ZodPreprocess",(e,t)=>{gi.init(e,t)}),ul=h("$ZodReadonly",(e,t)=>{O.init(e,t),R(e,"propValues",r=>r.def.innerType._zod.propValues),R(e,"values",r=>r.def.innerType._zod.values),R(e,"optin",r=>r.def.innerType?._zod?.optin),R(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Pm):Pm(o)}});ll=h("$ZodTemplateLiteral",(e,t)=>{O.init(e,t);let r=[];for(let n of t.parts)if(typeof n=="object"&&n!==null){let o=tu(n);if(!o)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);r.push(He(o))}else if(n===null||ja.has(typeof n))r.push(Oe(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),pl=h("$ZodFunction",(e,t)=>(O.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...n){let o=e._def.input?Xr(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?Xr(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...n){let o=e._def.input?await en(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await en(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new mi({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),fl=h("$ZodPromise",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>t.innerType._zod.run({value:o,issues:[]},n))}),mn=h("$ZodLazy",(e,t)=>{O.init(e,t),Ea(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),R(e,"pattern",r=>r.innerType?._zod?.pattern),R(e,"propValues",r=>r.innerType?._zod?.propValues),R(e,"optin",r=>r.innerType?._zod?.optin??void 0),R(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),dl=h("$ZodCustom",(e,t)=>{W.init(e,t),O.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>Im(i,r,n,e));Im(o,r,n,e)}})});function Dm(e){return e!==null&&typeof e=="object"}function ml(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}function gn(e,t,r){let n=jm.get(e);if(n!==void 0)return n?hn:yr;if(t.has(e))return hn;t.add(e);let o=yr,i=l=>{if(o!==hn&&l?._zod){let f=gn(l,t,r);f>o&&(o=f)}},s=(l,f)=>{let d=yr;for(let m of Reflect.ownKeys(l)){let g=Object.getOwnPropertyDescriptor(l,m);if(f&&!g.enumerable)continue;let b=g.get?_i:g.value?._zod?gn(g.value,t,r):yr;b>d&&(d=b)}return d},a=l=>{l>o&&(o=l)},c=e._zod.def,u=c.type;switch(u){case"object":{let l=ir(c);a(l?s(l,!0):_i),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let 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(let 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":{let l=c._cachedInner??(r?e._zod.innerType:void 0);a(l?gn(l,t,!1):_i);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in c){let f=Object.getOwnPropertyDescriptor(c,l);if(!f||f.get)continue;let d=f.value;if(!(!d||typeof d!="object")){if(d._zod)i(d);else if(Array.isArray(d))for(let m of d)i(m)}}}return t.delete(e),Ly(e,o)}function Ly(e,t){return t!==_i&&jm.set(e,t===hn),t}function wi(e){return gn(e,new Set,!0)!==yr}function Uy(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}function br(){return Vy}function xi(e,t){let r=e[hl]?.backEdges;return r!==void 0&&Dm(t)&&r.has(t)}var $i,hl,Zm,jm,yr,_i,hn,yi,bi,Vy,gl=D(()=>{ee();$i=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},hl="~memo",Zm=[];jm=new WeakMap,yr=0,_i=1,hn=2;bi=[],Vy={alloc(e,t,r){let n=yi;if(!n)return r;yi=void 0;let o={value:r,issues:null};return n.set(t.value,o),bi.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,i)=>{if(i.direction!=="backward"&&xi(i,o.value))throw new $i;return r(o,i)};e._zod.parse=n,e._zod.run===r&&(e._zod.run=n)})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,u)=>{if(r===void 0){let S=gn(e,new Set,!1);if(S===yr)return e._zod.parse=s,e._zod.run===a&&(e._zod.run=s),s(c,u);S===hn||n?r=!0:n=!0}let l=c.value;if(!Dm(l))return s(c,u);let f=u[hl];f||(f={buckets:new WeakMap,backEdges:void 0},u[hl]=f);let d;o===u?d=i:(d=Uy(f,e),o=u,i=d);let m=d.get(l);if(m)return c.value=m.value,m.issues?m.issues.length&&c.issues.push(...ml(m.issues)):(c.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(m.value)),c;yi=d;let g=bi.length,b=s(c,u);yi=void 0;let w=bi.length>g?bi.pop():void 0;return b instanceof Promise?b.then(S=>(w&&(w.issues=S.issues.length?ml(S.issues):Zm),S)):(w&&(w.issues=b.issues.length?ml(b.issues):Zm),b)};e._zod.parse=a,e._zod.run===s&&(e._zod.run=a)})}}});function zi(){return{localeError:Fy()}}var Fy,yl=D(()=>{ee();Fy=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,s){return i==="number"&&typeof s=="number"&&!Number.isFinite(s)?String(s):n[i]??i}return i=>{switch(i.code){case"invalid_type":{let s=o(i.expected),a=Ua(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 ${So(i.values[0])}`:`Invalid option: expected one of ${zo(i.values,"|")}`;case"too_big":{let 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":{let 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":{let 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 ${r[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":""}: ${zo(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"}}}});var _r={};Le(_r,{en:()=>zi});var bl=D(()=>{yl()});function yn(){return new vi}var Mm,ki,Si,vi,ie,bn=D(()=>{ki=Symbol("ZodOutput"),Si=Symbol("ZodInput"),vi=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};(Mm=globalThis).__zod_globalRegistry??(Mm.__zod_globalRegistry=yn());ie=globalThis.__zod_globalRegistry});function Hy(e,t){try{return Ii(e,{assertOnly:!0})}catch{return t}}function Pi(e,t){try{let r=Ii(e),n=_n(e,r);return n._zod.bag.validator=Hy(e,r),n}catch(r){if(t?.strict)throw r;return e}}function _n(e,t){if(wi(e))throw new N("a schema whose subtree contains a reference cycle");let r=L(e),n=e._zod.run,o=n.__originalRun??n,i=(s,a)=>{if(a?.async||a?.direction==="backward"||a?.skipChecks||a?.[Lm]||a&&xi(a,s.value))return o(s,a);let c=t(s.value);return c!==me?(s.value=c,s):(a&&(a[Lm]=!0),o(s,a))};return i.__originalRun=o,r._zod.bag.fallbackRun=o,r._zod.bag.validator=t,r._zod.run=i,n.__originalRun||By(r,e,t),r}function By(e,t,r){let n=e,o=t;if(typeof o.safeParse=="function"){let i=o.safeParse;n.safeParse=(s,a)=>{let c=r(s);return c!==me?{success:!0,data:c}:i(s,a)}}if(typeof o.parse=="function"){let i=o.parse;n.parse=(s,a)=>{let c=r(s);return c!==me?c:i(s,a)}}}function Ii(e,t){let r=!0;try{r=wi(e)}catch{}if(r)throw new N("a schema whose subtree contains a reference cycle");let n={constants:new Map,constantCounter:0,varCounter:0,definite:!0},o=new St(["input"]),i=Q(o,n,e,"input",!t?.assertOnly);o.write(i===null?"return true;":`return ${i};`);let s=["INVALID",...n.constants.keys()],a=[me,...n.constants.values()],c=o.content.join(`
714
+ `)}return w.write("payload.value = newResult;"),w.write("return payload;"),w.compile()},s,a=wt,c=!oe.jitless,l=c&&La.value,f=t.catchall,d;e._zod.parse=(m,g)=>{d??(d=n.value);let b=m.value;return a(b)?c&&l&&g?.async===!1&&g.jitless!==!0?(s||(s=i(t.shape)),m=s(m,g),f?Cm([],b,m,g,d,e,g?.abortEarly===!0):m):r(m,g):(m.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),m)}});mn=h("$ZodUnion",(e,t)=>{O.init(e,t),R(e,"optin",n=>n.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),R(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),R(e,"values",n=>{if(n.def.options.every(o=>o._zod.values))return new Set(n.def.options.flatMap(o=>Array.from(o._zod.values)))}),R(e,"pattern",n=>{if(n.def.options.every(o=>o._zod.pattern)){let o=n.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>He(i.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:n.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=>gm(a,n,e,o)):gm(s,n,e,o)}});Ju=h("$ZodXor",(e,t)=>{mn.init(e,t),t.inclusive=!1;let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},o);c instanceof Promise?(s.push(c),i=!0):s.push(c)}return i?Promise.all(s).then(a=>ym(a,n,e,o)):ym(s,n,e,o)}});Ku=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,mn.init(e,t);let r=e._zod.parse;R(e,"propValues",o=>{let i={},s=0;for(let a of o.def.options){let 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(let[u,l]of Object.entries(c)){Object.prototype.hasOwnProperty.call(i,u)||ce(i,u,new Set);for(let f of l)i[u].add(f)}}return!o.def.unionFallback&&s>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{let s=sr(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let n=ir(()=>Em(t));e._zod.parse=(o,i)=>{let s=o.value;if(!wt(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let a=s?.[t.discriminator],c=n.value.get(a);return c&&(a!==void 0||i.direction!=="backward")?c._zod.run(o,i):t.unionFallback||i.direction==="backward"?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter(u=>n.value.get(u)!==null),input:s,path:[t.discriminator],inst:e}),o)}}),Wu=h("$ZodIntersection",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>bm(r,c,u)):bm(r,i,s)}});yi=h("$ZodTuple",(e,t)=>{O.init(e,t);let r=t.items,n=oe.memoizer;n?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=n?n.alloc(e,o,[],i):[];let a=[],c=_m(r,"optin"),u=_m(r,"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>r.length&&o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:s,inst:e,origin:"array"})}let l=new Array(r.length),f=t.rest?i?.abortEarly:void 0,d=!1;for(let m=0;m<r.length;m++){let g=r[m]._zod.run({value:s[m],issues:[]},i);g instanceof Promise?a.push(g.then(b=>{l[m]=b})):(l[m]=g,f&&!d&&g.issues.length&&(d=ge(g)))}if(t.rest&&!d){let m=r.length-1,g=s.slice(r.length),b=o.issues.length;for(let w of g){if(f&&o.issues.length!==b){if(ge(o,b))break;b=o.issues.length}m++;let S=t.rest._zod.run({value:w,issues:[]},i);S instanceof Promise?a.push(S.then($=>$m($,o,m))):$m(S,o,m)}}return a.length?Promise.all(a).then(()=>wm(l,o,r,s,u)):wm(l,o,r,s,u)}});Gu=h("$ZodRecord",(e,t)=>{O.init(e,t);let r=oe.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Te(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let s=[],a=t.keyType._zod.values;if(a&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let c=new Set;for(let 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;let f=t.keyType._zod.run({value:l,issues:[]},o);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(f.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(g=>we(g,o,Y())),input:l,path:[l],inst:e});continue}let d=f.value;if(d==="__proto__")continue;let m=t.valueType._zod.run({value:i[l],issues:[]},o);m instanceof Promise?s.push(m.then(g=>{g.issues.length&&n.issues.push(...$e(l,g.issues)),n.value[d]=g.value})):(m.issues.length&&n.issues.push(...$e(l,m.issues)),n.value[d]=m.value)}let u;for(let l in i)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=i[l]}else u=u??[],u.push(l);u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let c;for(let 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"&&Be.test(u)&&l.issues.length){let g=t.keyType._zod.run({value:Number(u),issues:[]},o);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(l=g)}if(l.issues.length){t.mode==="loose"?n.value[u]=i[u]:a?(c=c??[],c.push(u)):n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(g=>we(g,o,Y())),input:u,path:[u],inst:e});continue}let d=l.value;if(d==="__proto__")continue;let m=t.valueType._zod.run({value:i[u],issues:[]},o);m instanceof Promise?s.push(m.then(g=>{g.issues.length&&n.issues.push(...$e(u,g.issues)),n.value[d]=g.value})):(m.issues.length&&n.issues.push(...$e(u,m.issues)),n.value[d]=m.value)}c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>n):n}}),Qu=h("$ZodMap",(e,t)=>{O.init(e,t);let r=oe.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!(i instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),n;let s=[];n.value=r?r.alloc(e,n,new Map,o):new Map;let a=o?.abortEarly,c=n.issues.length;for(let[u,l]of i){if(a&&n.issues.length!==c){if(ge(n,c))break;c=n.issues.length}let f=t.keyType._zod.run({value:u,issues:[]},o),d=t.valueType._zod.run({value:l,issues:[]},o);f instanceof Promise||d instanceof Promise?s.push(Promise.all([f,d]).then(([m,g])=>{xm(m,g,n,u,i,e,o)})):xm(f,d,n,u,i,e,o)}return s.length?Promise.all(s).then(()=>n):n},qu(e,My)});Yu=h("$ZodSet",(e,t)=>{O.init(e,t);let r=oe.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!(i instanceof Set))return n.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),n;let s=[];n.value=r?r.alloc(e,n,new Set,o):new Set;let a=o?.abortEarly,c=n.issues.length;for(let u of i){if(a&&n.issues.length!==c){if(ge(n,c))break;c=n.issues.length}let l=t.valueType._zod.run({value:u,issues:[]},o);l instanceof Promise?s.push(l.then(f=>zm(f,n))):zm(l,n)}return s.length?Promise.all(s).then(()=>n):n},qu(e,Ly)});Xu=h("$ZodEnum",(e,t)=>{O.init(e,t);let r=nr(t.entries),n=new Set(r);e._zod.values=n,R(e,"pattern",o=>{let i=nr(o.def.entries).filter(s=>Kr.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>Oe(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),el=h("$ZodLiteral",(e,t)=>{O.init(e,t);let r=new Set(t.values);e._zod.values=r,R(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?Oe(i):i?Oe(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),tl=h("$ZodFile",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),r}}),rl=h("$ZodTransform",(e,t)=>{O.init(e,t),e._zod.optin="optional",oe.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ot(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new xe;return r.value=o,r}});bi=h("$ZodOptional",(e,t)=>{O.init(e,t),R(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",R(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),R(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${He(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>vm(r,i)):vm(r,o)}return t.innerType._zod.run(r,n)}}),nl=h("$ZodExactOptional",(e,t)=>{bi.init(e,t),R(e,"values",r=>r.def.innerType._zod.values),R(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),ol=h("$ZodNullable",(e,t)=>{O.init(e,t),R(e,"optin",r=>r.def.innerType._zod.optin),R(e,"optout",r=>r.def.innerType._zod.optout),R(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${He(n.source)}|null)$`):void 0}),R(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),il=h("$ZodDefault",(e,t)=>{O.init(e,t),e._zod.optin="defaulted",R(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>km(i,t)):km(o,t)}});sl=h("$ZodPrefault",(e,t)=>{O.init(e,t),e._zod.optin="defaulted",R(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),al=h("$ZodNonOptional",(e,t)=>{O.init(e,t),R(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Sm(i,e)):Sm(o,e)}});cl=h("$ZodSuccess",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ot("ZodSuccess");let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}});ul=h("$ZodCatch",(e,t)=>{O.init(e,t),R(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),R(e,"optout",r=>r.def.innerType._zod.optout),R(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>Pm(r,i,t,n)):Pm(r,o,t,n)}}),ll=h("$ZodNaN",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),_i=h("$ZodPipe",(e,t)=>{O.init(e,t),R(e,"values",r=>r.def.in._zod.values),R(e,"optin",r=>r.def.in._zod.optin),R(e,"optout",r=>r.def.out._zod.optout),R(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(s=>ei(s,t.in,n)):ei(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>ei(i,t.out,n)):ei(o,t.out,n)}});hn=h("$ZodCodec",(e,t)=>{O.init(e,t),R(e,"values",r=>r.def.in._zod.values),R(e,"optin",r=>r.def.in._zod.optin),R(e,"optout",r=>r.def.out._zod.optout),R(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(s=>ti(s,t,n)):ti(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(s=>ti(s,t,n)):ti(i,t,n)}}});pl=h("$ZodPreprocess",(e,t)=>{_i.init(e,t)}),fl=h("$ZodReadonly",(e,t)=>{O.init(e,t),R(e,"propValues",r=>r.def.innerType._zod.propValues),R(e,"values",r=>r.def.innerType._zod.values),R(e,"optin",r=>r.def.innerType?._zod?.optin),R(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Im):Im(o)}});dl=h("$ZodTemplateLiteral",(e,t)=>{O.init(e,t);let r=[];for(let n of t.parts)if(typeof n=="object"&&n!==null){let o=ou(n);if(!o)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);r.push(He(o))}else if(n===null||Ua.has(typeof n))r.push(Oe(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),ml=h("$ZodFunction",(e,t)=>(O.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...n){let o=e._def.input?tn(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?tn(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...n){let o=e._def.input?await rn(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await rn(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new yi({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),hl=h("$ZodPromise",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>t.innerType._zod.run({value:o,issues:[]},n))}),gn=h("$ZodLazy",(e,t)=>{O.init(e,t),ja(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),R(e,"pattern",r=>r.innerType?._zod?.pattern),R(e,"propValues",r=>r.innerType?._zod?.propValues),R(e,"optin",r=>r.innerType?._zod?.optin??void 0),R(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),gl=h("$ZodCustom",(e,t)=>{W.init(e,t),O.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>Tm(i,r,n,e));Tm(o,r,n,e)}})});function jm(e){return e!==null&&typeof e=="object"}function yl(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}function bn(e,t,r){let n=Mm.get(e);if(n!==void 0)return n?yn:br;if(t.has(e))return yn;t.add(e);let o=br,i=l=>{if(o!==yn&&l?._zod){let f=bn(l,t,r);f>o&&(o=f)}},s=(l,f)=>{let d=br;for(let m of Reflect.ownKeys(l)){let g=Object.getOwnPropertyDescriptor(l,m);if(f&&!g.enumerable)continue;let b=g.get?xi:g.value?._zod?bn(g.value,t,r):br;b>d&&(d=b)}return d},a=l=>{l>o&&(o=l)},c=e._zod.def,u=c.type;switch(u){case"object":{let l=sr(c);a(l?s(l,!0):xi),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let 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(let 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":{let l=c._cachedInner??(r?e._zod.innerType:void 0);a(l?bn(l,t,!1):xi);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in c){let f=Object.getOwnPropertyDescriptor(c,l);if(!f||f.get)continue;let d=f.value;if(!(!d||typeof d!="object")){if(d._zod)i(d);else if(Array.isArray(d))for(let m of d)i(m)}}}return t.delete(e),Fy(e,o)}function Fy(e,t){return t!==xi&&Mm.set(e,t===yn),t}function vi(e){return bn(e,new Set,!0)!==br}function qy(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}function _r(){return Hy}function ki(e,t){let r=e[bl]?.backEdges;return r!==void 0&&jm(t)&&r.has(t)}var zi,bl,Dm,Mm,br,xi,yn,$i,wi,Hy,_l=D(()=>{ee();zi=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},bl="~memo",Dm=[];Mm=new WeakMap,br=0,xi=1,yn=2;wi=[],Hy={alloc(e,t,r){let n=$i;if(!n)return r;$i=void 0;let o={value:r,issues:null};return n.set(t.value,o),wi.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,i)=>{if(i.direction!=="backward"&&ki(i,o.value))throw new zi;return r(o,i)};e._zod.parse=n,e._zod.run===r&&(e._zod.run=n)})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,u)=>{if(r===void 0){let S=bn(e,new Set,!1);if(S===br)return e._zod.parse=s,e._zod.run===a&&(e._zod.run=s),s(c,u);S===yn||n?r=!0:n=!0}let l=c.value;if(!jm(l))return s(c,u);let f=u[bl];f||(f={buckets:new WeakMap,backEdges:void 0},u[bl]=f);let d;o===u?d=i:(d=qy(f,e),o=u,i=d);let m=d.get(l);if(m)return c.value=m.value,m.issues?m.issues.length&&c.issues.push(...yl(m.issues)):(c.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(m.value)),c;$i=d;let g=wi.length,b=s(c,u);$i=void 0;let w=wi.length>g?wi.pop():void 0;return b instanceof Promise?b.then(S=>(w&&(w.issues=S.issues.length?yl(S.issues):Dm),S)):(w&&(w.issues=b.issues.length?yl(b.issues):Dm),b)};e._zod.parse=a,e._zod.run===s&&(e._zod.run=a)})}}});function Si(){return{localeError:By()}}var By,$l=D(()=>{ee();By=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,s){return i==="number"&&typeof s=="number"&&!Number.isFinite(s)?String(s):n[i]??i}return i=>{switch(i.code){case"invalid_type":{let s=o(i.expected),a=qa(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 ${To(i.values[0])}`:`Invalid option: expected one of ${So(i.values,"|")}`;case"too_big":{let 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":{let 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":{let 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 ${r[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":""}: ${So(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"}}}});var $r={};Ue($r,{en:()=>Si});var wl=D(()=>{$l()});function _n(){return new Pi}var Lm,Ii,Ti,Pi,ie,$n=D(()=>{Ii=Symbol("ZodOutput"),Ti=Symbol("ZodInput"),Pi=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};(Lm=globalThis).__zod_globalRegistry??(Lm.__zod_globalRegistry=_n());ie=globalThis.__zod_globalRegistry});function Ky(e,t){try{return Ai(e,{assertOnly:!0})}catch{return t}}function Oi(e,t){try{let r=Ai(e),n=wn(e,r);return n._zod.bag.validator=Ky(e,r),n}catch(r){if(t?.strict)throw r;return e}}function wn(e,t){if(vi(e))throw new N("a schema whose subtree contains a reference cycle");let r=L(e),n=e._zod.run,o=n.__originalRun??n,i=(s,a)=>{if(a?.async||a?.direction==="backward"||a?.skipChecks||a?.[Um]||a&&ki(a,s.value))return o(s,a);let c=t(s.value);return c!==me?(s.value=c,s):(a&&(a[Um]=!0),o(s,a))};return i.__originalRun=o,r._zod.bag.fallbackRun=o,r._zod.bag.validator=t,r._zod.run=i,n.__originalRun||Wy(r,e,t),r}function Wy(e,t,r){let n=e,o=t;if(typeof o.safeParse=="function"){let i=o.safeParse;n.safeParse=(s,a)=>{let c=r(s);return c!==me?{success:!0,data:c}:i(s,a)}}if(typeof o.parse=="function"){let i=o.parse;n.parse=(s,a)=>{let c=r(s);return c!==me?c:i(s,a)}}}function Ai(e,t){let r=!0;try{r=vi(e)}catch{}if(r)throw new N("a schema whose subtree contains a reference cycle");let n={constants:new Map,constantCounter:0,varCounter:0,definite:!0},o=new Pt(["input"]),i=Q(o,n,e,"input",!t?.assertOnly);o.write(i===null?"return true;":`return ${i};`);let s=["INVALID",...n.constants.keys()],a=[me,...n.constants.values()],c=o.content.join(`
598
715
  `),u=t?.debug?s.length>0?`// Constants: ${s.join(", ")}
599
716
  ${c}`:c:"",l=Function,f=`return (input) => {
600
717
  ${c}
601
- }`,d;try{d=new l(...s,f)(...a)}catch(m){throw new N(`this schema (generated code failed to evaluate: ${m.message})`)}return t?.debug&&(d.code=u),d.definite=n.definite,d}function T(e,t){for(let[n,o]of e.constants)if(o===t)return n;let r=`c${e.constantCounter++}`;return e.constants.set(r,t),r}function Tt(e,t){return e.definite=!1,T(e,t)}function I(e){return`v${e.varCounter++}`}function Jy(e,t){let r=e._zod.run({value:t,issues:[]},{});if(r&&typeof r.then=="function")return me;let n=r;return n.issues.length===0?n.value:me}function de(e,t,r,n,o=!0){let i=e.content.length,s=t.constants.size,a=t.constantCounter,c=t.varCounter;try{return Q(e,t,r,n,o)}catch(u){if(!(u instanceof N)||!u.islandable)throw u;if(e.content.length=i,t.constants.size>s){let l=Array.from(t.constants.keys()).slice(s);for(let f of l)t.constants.delete(f)}return t.constantCounter=a,t.varCounter=c,Ky(e,t,r,n)}}function Ky(e,t,r,n){t.definite=!1;let o=T(t,r),i=T(t,Jy),s=I(t);return e.write(`const ${s} = ${i}(${o}, ${n});`),e.write(`if (${s} === INVALID) return INVALID;`),s}function Gy(e,t,r,n){let o=r._zod.def.checks;if(!o||o.length===0)return n;let i=n;for(let s of o){let a=s._zod.def;if(a.when&&!Wy.has(a.check))throw new N('check with a custom "when" condition');switch(a.check){case"greater_than":Qy(e,t,a,i);break;case"less_than":Yy(e,t,a,i);break;case"multiple_of":Xy(e,t,a,i);break;case"number_format":Bm(e,a,i);break;case"min_length":{let c=ot(a.minimum,"min_length"),u=_l(e,t,i,`${i}.length >= ${c} && ${i}.length < ${a.minimum*2}`);e.write(`if (${u} < ${c}) return INVALID;`);break}case"max_length":{let c=ot(a.maximum,"max_length"),u=_l(e,t,i,`${i}.length > ${c}`);e.write(`if (${u} > ${c}) return INVALID;`);break}case"length_equals":{let c=ot(a.length,"length_equals"),u=_l(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 < ${ot(a.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${i}.size > ${ot(a.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${i}.size !== ${ot(a.size,"size_equals")}) return INVALID;`);break;case"string_format":i=Jm(e,t,a,i);break;case"custom":i=ib(e,t,s,i);break;case"bigint_format":eb(e,a,i);break;case"mime_type":tb(e,t,a,i);break;case"property":nb(e,t,a,i);break;case"properties":rb(e,t,a,i);break;case"overwrite":{let c=I(t);ob(e,t,s,i,c),i=c;break}default:throw new N(`check type ${a.check}`)}}return i}function _l(e,t,r,n){let o=T(t,wt),i=I(t);return e.write(`const ${i} = typeof ${r} === "string" && ${n} ? ${o}(${r}) : ${r}.length;`),i}function ot(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new N(`${t} bound of type ${typeof e}`);return`${e}`}function Hm(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new N("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new N("comparison check with Invalid Date bound");return T(e,t)}throw new N(`comparison check bound of type ${typeof t}`)}function Qy(e,t,r,n){let o=r.inclusive?"<":"<=";e.write(`if (${n} ${o} ${Hm(t,r.value)}) return INVALID;`)}function Yy(e,t,r,n){let o=r.inclusive?">":">=";e.write(`if (${n} ${o} ${Hm(t,r.value)}) return INVALID;`)}function Xy(e,t,r,n){if(typeof r.value=="bigint"){if(r.value===BigInt(0))throw new N("multiple_of check with a zero divisor");e.write(`if (${n} % ${r.value}n !== 0n) return INVALID;`)}else{let o=T(t,qr);e.write(`if (${o}(${n}, ${ot(r.value,"multiple_of")}) !== 0) return INVALID;`)}}function Bm(e,t,r){let n=t.format;switch(n){case"safeint":e.write(`if (!Number.isSafeInteger(${r})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${r}) || ${r} < -2147483648 || ${r} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${r}) || ${r} < 0 || ${r} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${r}) || ${r} < -3.4028234663852886e38 || ${r} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${r})) return INVALID;`);break;default:throw new N(`number format ${n}`)}}function eb(e,t,r){let n=t.format;if(n)switch(n){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break;default:throw new N(`bigint format ${n}`)}}function tb(e,t,r,n){let o=r.mime;if(o&&o.length>0){let i=T(t,new Set(o));e.write(`if (!${i}.has(${n}.type)) return INVALID;`)}}function rb(e,t,r,n){if(r.when)throw new N('check with a custom "when" condition');e.write(`if (${n} == null) return INVALID;`);let o=r.shape;for(let i of Reflect.ownKeys(o)){let s=typeof i=="symbol"?T(t,i):he(i),a=I(t);e.write(`const ${a} = ${n}[${s}];`),de(e,t,o[i],a,!1)}}function nb(e,t,r,n){let o=`${n}[${JSON.stringify(r.property)}]`;Q(e,t,r.schema,o)}function ob(e,t,r,n,o){let i=r._zod.def.tx;if(!i)throw new N("overwrite check without a transform function");if(Ot(i))throw new Ae("z.compile: async overwrite transforms are not supported");let s=T(t,i);e.write(`const ${o} = ${s}(${n});`)}function $l(){throw new xe}function xl(e){this.issues.push(e)}function ib(e,t,r,n){let o=r._zod.def;if(o.fn){if(Ot(o.fn))throw new Ae("z.compile: async .refine() predicates are not supported");let i=Tt(t,o.fn),s=T(t,$l),a=I(t);return e.write(`const ${a} = ${i}(${n});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`),n}if(r._zod.check){if(Ot(r._zod.check))throw new Ae("z.compile: async .superRefine() / check functions are not supported");let i=r._zod.check,a=Tt(t,u=>{let l={value:u,issues:[],addIssue:xl};return i(l)instanceof Promise&&$l(),l.issues.length===0?l.value:me}),c=I(t);return e.write(`const ${c} = ${a}(${n});`),e.write(`if (${c} === INVALID) return INVALID;`),c}throw new N("custom check without a predicate or check function")}function Jm(e,t,r,n,o=!0){let i=r.format;if(i==="base64"){let u=T(t,un);return e.write(`if (!${u}(${n})) return INVALID;`),n}if(i==="base64url"){let u=T(t,ai);return e.write(`if (!${u}(${n})) return INVALID;`),n}if(i==="jwt"){let u=T(t,li),l=T(t,r.alg??null);return e.write(`if (!${u}(${n}, ${l})) return INVALID;`),n}if(i==="ipv6"){let u=T(t,cn);return e.write(`if (!${u}(${n})) return INVALID;`),n}if(i==="cidrv6"){let u=T(t,ii);return e.write(`if (!${u}(${n})) return INVALID;`),n}if(i==="credit_card"){let u=T(t,ci);return e.write(`if (!${u}(${n})) return INVALID;`),n}if(i==="iban"){let u=T(t,ui);return e.write(`if (!${u}(${n})) return INVALID;`),n}let s=r;if(i==="url"||i==="httpurl"||s.normalize||s.hostname!==void 0||s.protocol!==void 0){let u=T(t,ri),l=T(t,r),f=I(t),d=I(t);if(e.write(`const ${f} = ${n}.trim();`),e.write(`const ${d} = ${u}(${f}, ${l});`),e.write(`if (typeof ${d} === "number") return INVALID;`),s.hostname!==void 0){let b=T(t,ni);e.write(`if (!${b}(${d}, ${l}.hostname)) return INVALID;`)}if(s.protocol!==void 0){let b=T(t,oi);e.write(`if (!${b}(${d}, ${l}.protocol)) return INVALID;`)}if(!o)return null;let m=I(t),g=s.normalize?`${d}.href`:`${T(t,an)}(${f})`;return e.write(`const ${m} = ${g};`),m}let a=r.fn;if(a){if(Ot(a))throw new N(`async string format ${i}`);let u=T(t,a);return e.write(`if (!${u}(${n})) return INVALID;`),n}if(sb.has(i)&&r.pattern){let u=T(t,r.pattern);return e.write(`${u}.lastIndex = 0;`),e.write(`if (!${u}.test(${n})) return INVALID;`),n}let c=r.format;switch(c){case"regex":throw new N("regex format without a pattern");case"lowercase":e.write(`if (${n} !== ${n}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${n} !== ${n}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${n}.includes(${he(r.includes)})) return INVALID;`);break;case"starts_with":{let u=r.prefix;e.write(`if (${n}.slice(0, ${u.length}) !== ${he(u)}) return INVALID;`);break}case"ends_with":{let u=r.suffix;e.write(`if (${n}.slice(-${u.length}) !== ${he(u)}) return INVALID;`);break}default:throw new N(`string format ${c}`)}return n}function Q(e,t,r,n,o=!0){let i=r._zod.def,s=i.type;if(i.coerce)throw new N(`coercion (z.coerce.${s}())`);let a=o||!!i.checks?.length,c;switch(s){case"string":c=ab(e,t,r,n,a);break;case"number":c=cb(e,r,n);break;case"boolean":c=ub(e,n);break;case"bigint":c=lb(e,r,n);break;case"symbol":c=pb(e,n);break;case"undefined":c=fb(e,n);break;case"null":c=db(e,n);break;case"any":case"unknown":c=n;break;case"never":e.write("return INVALID;"),c=n;break;case"void":c=mb(e,n);break;case"nan":c=hb(e,n);break;case"date":c=gb(e,n);break;case"object":c=yb(e,t,r,n,a);break;case"optional":c=bb(e,t,r,n,a);break;case"nullable":c=wb(e,t,r,n,a);break;case"array":c=xb(e,t,r,n,a);break;case"literal":c=zb(e,t,r,n);break;case"enum":c=vb(e,t,r,n);break;case"readonly":{let u=Vm(e,t,r,n),l=I(t);e.write(`const ${l} = Object.freeze(${u});`),c=l;break}case"success":Vm(e,t,r,n),c="true";break;case"default":case"prefault":c=kb(e,t,r,n);break;case"nonoptional":c=Sb(e,t,r,n);break;case"tuple":c=Pb(e,t,r,n);break;case"union":c=Ib(e,t,r,n);break;case"intersection":c=Ab(e,t,r,n);break;case"record":c=Rb(e,t,r,n);break;case"map":c=Nb(e,t,r,n);break;case"set":c=Eb(e,t,r,n);break;case"file":c=Zb(e,n);break;case"template_literal":c=Db(e,t,r,n);break;case"lazy":c=jb(e,t,r,n);break;case"pipe":c=Mb(e,t,r,n);break;case"custom":c=Lb(e,t,r,n);break;case"transform":c=Fb(e,t,r,n);break;case"catch":c=Vb(e,t,r,n);break;default:throw new N(`schema type ${s}`)}return c===null?null:Gy(e,t,r,c)}function ab(e,t,r,n,o=!0){e.write(`if (typeof ${n} !== "string") return INVALID;`);let i=r._zod.def;return i.format===void 0?n:Jm(e,t,i,n,o)}function cb(e,t,r){e.write(`if (typeof ${r} !== "number" || !Number.isFinite(${r})) return INVALID;`);let n=t._zod.def;return n.check==="number_format"&&n.format&&Bm(e,{format:n.format},r),r}function ub(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function lb(e,t,r){e.write(`if (typeof ${r} !== "bigint") return INVALID;`);let n=t._zod.def;if(n.format)switch(n.format){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break}return r}function pb(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function fb(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function db(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function mb(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function hb(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function gb(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function yb(e,t,r,n,o=!0){let i=r._zod.def;e.write(`if (typeof ${n} !== "object" || ${n} === null || Array.isArray(${n})) return INVALID;`);let s=i.shape,a=Object.keys(s),c=Object.getOwnPropertySymbols(s),u=c.length?[...a,...c]:a,l=$=>typeof $=="symbol"?T(t,$):he($),f=$=>typeof $=="symbol"?`[${l($)}]`:he($),d=s;if(a.includes("__proto__"))throw new N('object shape key "__proto__"');let m=new Map;for(let $ of u){let P=d[$],E=l($),G=I(t);if(e.write(`const ${G} = ${n}[${E}];`),P._zod.optin!==void 0){let Z=I(t);e.write(`let ${Z} = (() => {`),e.indented(fe=>{let Fr=de(fe,t,P,G);fe.write(`return ${Fr};`)}),e.write("})();"),P._zod.optout==="optional"?(e.write(`if (${Z} === INVALID) {`),e.indented(fe=>{fe.write(`if (${E} in ${n}) return INVALID;`),fe.write(`${Z} = undefined;`)}),e.write("}")):e.write(`if (${Z} === INVALID) return INVALID;`),m.set($,Z)}else{$b(P)&&e.write(`if (!(${E} in ${n})) return INVALID;`);let Z=de(e,t,P,G,o);Z!==null&&m.set($,Z)}}let g=i.catchall,b="none";if(g){let $=g._zod.def.type;if($==="never"){let P=a.map(E=>`k !== ${he(E)}`).join(" && ")||"true";e.write(`for (const k in ${n}) {`),e.indented(E=>{E.write(`if (${P}) return INVALID;`)}),e.write("}")}else($==="unknown"||$==="any")&&!g._zod.def.checks?.length?b="passthrough":b="schema"}let w=I(t),S=u.some($=>Um(d[$])||wl(d[$]));if(!o){if(b==="schema"){let $=a.length>0?T(t,new Set(a)):null;e.write(`for (const k in ${n}) {`),e.indented(P=>{P.write('if (k === "__proto__") continue;'),$&&P.write(`if (${$}.has(k)) continue;`);let E=I(t);P.write(`const ${E} = ${n}[k];`),de(P,t,g,E,!1)}),e.write("}")}return null}if(S){e.write(`const ${w} = {};`);for(let $ of u){let P=l($),E=m.get($);wl(d[$])?e.write(`if (${P} in ${n}) ${w}[${P}] = ${E};`):Um(d[$])?e.write(`if (${E} !== undefined || ${P} in ${n}) ${w}[${P}] = ${E};`):e.write(`${w}[${P}] = ${E};`)}}else{let $=u.map(P=>`${f(P)}: ${m.get(P)}`).join(", ");e.write(`const ${w} = { ${$} };`)}if(b!=="none"){let $=a.length>0?T(t,new Set(a)):null;e.write(`for (const k in ${n}) {`),e.indented(P=>{if(P.write('if (k === "__proto__") continue;'),$&&P.write(`if (${$}.has(k)) continue;`),b==="passthrough")P.write(`${w}[k] = ${n}[k];`);else{let E=I(t);P.write(`const ${E} = ${n}[k];`);let G=de(P,t,g,E);P.write(`${w}[k] = ${G};`)}}),e.write("}")}return w}function bb(e,t,r,n,o=!0){let i=r._zod.def;if(_b(r))return Q(e,t,i.innerType,n,o);if(i.innerType._zod.optin==="defaulted"){let a=I(t),c=I(t);return e.write(`let ${a};`),e.write(`if (${n} === undefined) {`),e.indented(u=>{u.write(`const ${c} = (() => {`),u.indented(l=>{let f=Q(l,t,i.innerType,n);l.write(`return ${f};`)}),u.write("})();"),u.write(`if (${c} !== INVALID) ${a} = ${c};`)}),e.write("} else {"),e.indented(u=>{let l=Q(u,t,i.innerType,n);u.write(`${a} = ${l};`)}),e.write("}"),a}let s=o?I(t):null;return s&&e.write(`let ${s};`),e.write(`if (${n} !== undefined) {`),e.indented(a=>{let c=Q(a,t,i.innerType,n,o);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function _b(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function $b(e){return e._zod.optin===void 0&&It(e)}function It(e){if(e._zod.def.coerce)return!0;let 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?It(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?It(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(It):!0;case"intersection":return!t.left||!t.right?!0:It(t.left)&&It(t.right);case"pipe":return t.in?It(t.in):!0;default:return!0}}function wl(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function Um(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&$r(e)}function $r(e){let 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?$r(t.innerType):!0;case"union":return t.options?t.options.some($r):!0;case"intersection":return!t.left||!t.right||$r(t.left)||$r(t.right);case"pipe":return t.out?$r(t.out):!0;default:return!0}}function wb(e,t,r,n,o=!0){let i=r._zod.def,s=o?I(t):null;return s&&e.write(`let ${s} = null;`),e.write(`if (${n} !== null) {`),e.indented(a=>{let c=Q(a,t,i.innerType,n,o);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function zl(e,t,r){for(let[n,o]of sr(t._zod.def.checks))e.write(`if (${r} > ${ot(n,o._zod.def.check)}) return INVALID;`)}function xb(e,t,r,n,o=!0){let i=r._zod.def;e.write(`if (!Array.isArray(${n})) return INVALID;`),zl(e,r,`${n}.length`);let s=o?I(t):null,a=I(t),c=I(t);return s&&e.write(`const ${s} = new Array(${n}.length);`),e.write(`for (let ${a} = 0; ${a} < ${n}.length; ${a}++) {`),e.indented(u=>{u.write(`const ${c} = ${n}[${a}];`);let l=de(u,t,i.element,c,o);s&&l!==null&&u.write(`${s}[${a}] = ${l};`)}),e.write("}"),s}function zb(e,t,r,n){let i=r._zod.def.values;if(i.length!==1){let a=T(t,new Set(i));return e.write(`if (!${a}.has(${n})) return INVALID;`),n}let s=i[0];if(typeof s=="number"&&Number.isNaN(s)){let a=T(t,new Set(i));return e.write(`if (!${a}.has(${n})) return INVALID;`),n}if(typeof s=="string")e.write(`if (${n} !== ${he(s)}) return INVALID;`);else if(typeof s=="number"||typeof s=="boolean")e.write(`if (${n} !== ${s}) return INVALID;`);else if(s===null)e.write(`if (${n} !== null) return INVALID;`);else if(s===void 0)e.write(`if (${n} !== undefined) return INVALID;`);else if(typeof s=="bigint")e.write(`if (${n} !== ${s}n) return INVALID;`);else throw new N(`literal type ${typeof s}`);return n}function vb(e,t,r,n){let o=r._zod.values;if(!o)throw new N("enum schema without enumerated values");let i=T(t,o);return e.write(`if (!${i}.has(${n})) return INVALID;`),n}function Vm(e,t,r,n){let o=r._zod.def;return Q(e,t,o.innerType,n)}function kb(e,t,r,n){let o=r._zod.def,s=Object.getOwnPropertyDescriptor(r._zod.def,"defaultValue")?()=>r._zod.def.defaultValue:void 0;if(r._zod.def.type==="prefault"){if(!s)return Q(e,t,o.innerType,n);let c=T(t,s),u=I(t);return e.write(`let ${u} = ${n};`),e.write(`if (${n} === undefined) ${u} = ${c}();`),Q(e,t,o.innerType,u)}let a=I(t);if(s){let c=T(t,s),u=T(t,Hr);e.write(`let ${a};`),e.write(`if (${n} === undefined) {`),e.indented(l=>{l.write(`${a} = ${u}(${c}());`)}),e.write("} else {"),e.indented(l=>{let f=Q(l,t,o.innerType,n);l.write(`${a} = ${f} === undefined ? ${u}(${c}()) : ${f};`)}),e.write("}")}else e.write(`let ${a};`),e.write(`if (${n} !== undefined) {`),e.indented(c=>{let u=Q(c,t,o.innerType,n);c.write(`${a} = ${u};`)}),e.write("}");return a}function Sb(e,t,r,n){let o=r._zod.def,i=Q(e,t,o.innerType,n),s=I(t);return e.write(`const ${s} = ${i};`),e.write(`if (${s} === undefined) return INVALID;`),s}function Pb(e,t,r,n){let o=r._zod.def,i=o.items,s=o.rest;e.write(`if (!Array.isArray(${n})) return INVALID;`);let a=Fm(i,"optin"),c=Fm(i,"optout");s?e.write(`if (${n}.length < ${a}) return INVALID;`):e.write(`if (${n}.length < ${a} || ${n}.length > ${i.length}) return INVALID;`);let u=I(t);e.write(`const ${u} = [];`);for(let l=0;l<i.length;l++){let f=i[l];if(l>=c)e.write(`if (${u}.length === ${l}) {`),e.indented(d=>{d.write(`if (${l} < ${n}.length) {`),d.indented(m=>{let g=I(t);m.write(`const ${g} = ${n}[${l}];`);let b=de(m,t,f,g);m.write(`${u}[${l}] = ${b};`)}),d.write("} else {"),d.indented(m=>{if(wl(f)){m.write(`${u}.length = ${l};`);return}let g=I(t),b=I(t);m.write(`const ${g} = undefined;`),m.write(`const ${b} = (() => {`),m.indented(w=>{let S=de(w,t,f,g);w.write(`return ${S};`)}),m.write("})();"),m.write(`if (${b} === INVALID || ${b} === undefined) ${u}.length = ${l};`),m.write(`else ${u}[${l}] = ${b};`)}),d.write("}")}),e.write("}");else{let d=I(t);e.write(`const ${d} = ${n}[${l}];`);let m=de(e,t,f,d);e.write(`${u}[${l}] = ${m};`)}}if(s){let l=I(t),f=I(t);e.write(`for (let ${l} = ${i.length}; ${l} < ${n}.length; ${l}++) {`),e.indented(d=>{d.write(`const ${f} = ${n}[${l}];`);let m=de(d,t,s,f);d.write(`${u}[${l}] = ${m};`)}),e.write("}")}return u}function Fm(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function Ib(e,t,r,n){let o=r._zod.def,i=o.options;if(o.discriminator)return Tb(e,t,o,n);if(o.inclusive===!1)throw new N("exclusive unions (z.xor)");if(i.length===0)return e.write("return INVALID;"),n;if(i.length===1)return Q(e,t,i[0],n);if(i.every(c=>c._zod.def.type==="literal"&&!c._zod.def.checks?.length)){let c=new Set(i.flatMap(l=>l._zod.def.values)),u=T(t,c);return e.write(`if (!${u}.has(${n})) return INVALID;`),n}let a=I(t);e.write(`let ${a};`);for(let c=0;c<i.length;c++){let u=i[c];c===0?e.write(`${a} = (() => {`):e.write(`if (${a} === INVALID) ${a} = (() => {`),e.indented(l=>{let f=Q(l,t,u,n);l.write(`return ${f};`)}),e.write("})();")}return e.write(`if (${a} === INVALID) return INVALID;`),a}function Tb(e,t,r,n){if(r.unionFallback)throw new N("discriminated union with unionFallback");if(r.options.length===0)return e.write("return INVALID;"),n;let o=I(t),i=I(t);e.write(`const ${o} = ${n}?.[${he(r.discriminator)}];`),e.write(`let ${i};`);let s=!0,a=new Set;for(let c of r.options){let u=c._zod.propValues?.[r.discriminator];if(!u||u.size===0)throw new N("discriminated union option without static discriminator values");for(let d of u){if(a.has(d))throw new N(`duplicate discriminator value ${String(d)}`);a.add(d)}let l=Array.from(u,d=>Ob(t,o,d)),f=s?"if":"else if";e.write(`${f} (${l.join(" || ")}) {`),e.indented(d=>{let m=Q(d,t,c,n);d.write(`${i} = ${m};`)}),e.write("}"),s=!1}return e.write("else { return INVALID; }"),i}function Ob(e,t,r){if(typeof r=="string")return`${t} === ${he(r)}`;if(typeof r=="number")return Number.isNaN(r)?`Number.isNaN(${t})`:`${t} === ${r}`;if(typeof r=="boolean")return`${t} === ${r}`;if(r===null)return`${t} === null`;if(r===void 0)return`${t} === undefined`;if(typeof r=="bigint")return`${t} === ${r}n`;if(typeof r=="symbol"){let n=T(e,r);return`${t} === ${n}`}throw new N(`literal discriminator value ${String(r)}`)}function Ab(e,t,r,n){let o=r._zod.def;t.definite=!1;let i=de(e,t,o.left,n),s=de(e,t,o.right,n),a=T(t,hr),c=I(t);return e.write(`const ${c} = ${a}(${i}, ${s});`),e.write(`if (!${c}.valid) return INVALID;`),`${c}.data`}function Rb(e,t,r,n){let o=r._zod.def,i=T(t,Te);e.write(`if (!${i}(${n})) return INVALID;`);let s=I(t),a=I(t),c=I(t);e.write(`const ${s} = {};`);let u=o,l=u.partial?void 0:o.keyType._zod.values;if(l){let m=[];for(let b of l){if(!(typeof b=="string"||typeof b=="number"||typeof b=="symbol"))throw new N(`record key value ${String(b)}`);let w=typeof b=="number"?b.toString():b;if(w==="__proto__")throw new N('record key "__proto__"');m.push(w);let S=T(t,b),$=Q(e,t,o.keyType,S),P=I(t);e.write(`const ${P} = ${n}[${Cb(t,w)}];`);let E=de(e,t,o.valueType,P);e.write(`${s}[${$}] = ${E};`)}let g=T(t,new Set(m));return e.write(`for (const ${a} in ${n}) {`),e.indented(b=>{b.write(`if (${g}.has(${a})) continue;`),u.mode==="loose"?b.write(`if (${a} !== "__proto__") ${s}[${a}] = ${n}[${a}];`):b.write("return INVALID;")}),e.write("}"),s}let f=o.keyType._zod.def;if(!(f.type==="string"&&f.format===void 0&&!f.coerce&&(f.checks?.length??0)===0)){let m=o.mode==="loose",g=Ii(o.keyType);g.definite===!1&&(t.definite=!1);let b=T(t,g),w=T(t,Be),S=I(t);return qm(e,t,n,a,$=>{$.write(`let ${S} = ${b}(${a});`),$.write(`if (${S} === INVALID && typeof ${a} === "string" && ${w}.test(${a})) ${S} = ${b}(Number(${a}));`),m?$.write(`if (${S} === INVALID) { ${s}[${a}] = ${n}[${a}]; continue; }`):$.write(`if (${S} === INVALID) return INVALID;`),$.write(`if (${S} === "__proto__") continue;`);let P=I(t);$.write(`const ${P} = ${n}[${a}];`);let E=de($,t,o.valueType,P);$.write(`${s}[${S}] = ${E};`)}),s}return qm(e,t,n,a,m=>{m.write(`const ${c} = ${n}[${a}];`);let g=de(m,t,o.valueType,c);m.write(`${s}[${a}] = ${g};`)},"return INVALID;"),s}function qm(e,t,r,n,o,i){let s=T(t,Object.prototype.propertyIsEnumerable),a=I(t),c=I(t),u=I(t);e.write(`const ${a} = Object.getOwnPropertySymbols(${r});`),e.write(`const ${c} = Object.getOwnPropertyNames(${r});`),e.write(`for (let ${u} = 0; ${u} < ${c}.length; ${u}++) {`),e.indented(l=>{l.write(`const ${n} = ${c}[${u}];`),l.write(`if (${n} === "__proto__" || !${s}.call(${r}, ${n})) continue;`),o(l)}),e.write("}"),e.write(`for (let ${u} = 0; ${u} < ${a}.length; ${u}++) {`),e.indented(l=>{l.write(`const ${n} = ${a}[${u}];`),l.write(`if (!${s}.call(${r}, ${n})) continue;`),i?l.write(i):o(l)}),e.write("}")}function Cb(e,t){return typeof t=="string"?he(t):T(e,t)}function Nb(e,t,r,n){let o=r._zod.def;e.write(`if (!(${n} instanceof Map)) return INVALID;`),zl(e,r,`${n}.size`);let i=I(t),s=I(t),a=I(t);return e.write(`const ${i} = new Map();`),e.write(`for (const [${s}, ${a}] of ${n}) {`),e.indented(c=>{let u=Q(c,t,o.keyType,s),l=Q(c,t,o.valueType,a);c.write(`${i}.set(${u}, ${l});`)}),e.write("}"),i}function Eb(e,t,r,n){let o=r._zod.def;e.write(`if (!(${n} instanceof Set)) return INVALID;`),zl(e,r,`${n}.size`);let i=I(t),s=I(t);return e.write(`const ${i} = new Set();`),e.write(`for (const ${s} of ${n}) {`),e.indented(a=>{let c=Q(a,t,o.valueType,s);a.write(`${i}.add(${c});`)}),e.write("}"),i}function Zb(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function Db(e,t,r,n){e.write(`if (typeof ${n} !== "string") return INVALID;`);let o=r._zod.pattern;if(o){let i=T(t,o);e.write(`${i}.lastIndex = 0;`),e.write(`if (!${i}.test(${n})) return INVALID;`)}return n}function jb(e,t,r,n){let o=r._zod.def,i=Tt(t,o.getter),s=T(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("}");let a=I(t);return e.write(`const ${a} = ${s}.parser(${n});`),e.write(`if (${a} === INVALID) return INVALID;`),a}function Mb(e,t,r,n){let o=r._zod.def,i=Q(e,t,o.in,n);if(o.transform){if(Ot(o.transform))throw new Ae("z.compile: async transforms in pipes are not supported");let s=o.transform,c=Tt(t,l=>{let f={value:l,issues:[],addIssue:xl},d=s(l,f);return d instanceof Promise?me:f.issues.length===0?d:me}),u=I(t);return e.write(`const ${u} = ${c}(${i});`),e.write(`if (${u} === INVALID) return INVALID;`),Q(e,t,o.out,u)}else return Q(e,t,o.out,i)}function Ot(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function Lb(e,t,r,n){let o=r._zod.def;if(o.fn){if(Ot(o.fn))throw new Ae("z.compile: async custom predicates are not supported");let i=Tt(t,o.fn),s=T(t,$l),a=I(t);e.write(`const ${a} = ${i}(${n});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`)}else throw new N("custom schema without a predicate function");return n}function Ub(e,t,r){let n=e._zod.run({value:r,issues:[]},{});if(n&&typeof n.then=="function")return me;let o=n;return o.issues.length===0?o.value:t()}function Vb(e,t,r,n){let o=r._zod.def;if(!o.catchValue[Io])throw new N("catch with a callback (only a constant catch value compiles)",!1);let i=I(t);e.write(`let ${i} = (() => {`),e.indented(u=>{let l=de(u,t,o.innerType,n);u.write(`return ${l};`)}),e.write("})();");let s=T(t,o.innerType),a=Tt(t,o.catchValue),c=T(t,Ub);return e.write(`if (${i} === INVALID) {`),e.indented(u=>{u.write(`${i} = ${c}(${s}, ${a}, ${n});`),u.write(`if (${i} === INVALID) return INVALID;`)}),e.write("}"),i}function Fb(e,t,r,n){let o=r._zod.def;if(o.transform){if(Ot(o.transform))throw new Ae("z.compile: async transforms are not supported");let i=o.transform,a=Tt(t,u=>{let l={value:u,issues:[],addIssue:xl},f=i(u,l);return f instanceof Promise?me:l.issues.length===0?f:me}),c=I(t);return e.write(`const ${c} = ${a}(${n});`),e.write(`if (${c} === INVALID) return INVALID;`),c}return n}var me,Lm,Ae,N,Wy,sb,Km=D(()=>{rt();Go();gl();kt();gr();ee();me=Symbol.for("zod.compile.invalid"),Lm=Symbol.for("zod.compile.fallback"),Ae=class extends Error{constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}},N=class extends Error{constructor(t,r=!0){super(`z.compile does not support ${t}; this schema must use the runtime parser`),this.name="ZodCompileUnsupportedError",this.islandable=r}};Wy=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);sb=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 Ti(e){return e.checks&&(e.checks=[...e.checks]),e}function vl(e,t){return new e(Ti({type:"string",..._(t)}))}function kl(e,t){return new e(Ti({type:"string",coerce:!0,..._(t)}))}function Oi(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}function Ai(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}function Ri(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}function Ci(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}function Ni(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}function Ei(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}function $n(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}function Zi(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}function Di(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}function ji(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}function Mi(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}function Li(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}function Ui(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}function Vi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}function Fi(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}function qi(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}function Sl(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,..._(t)})}function Hi(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}function Bi(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}function Ji(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}function Ki(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}function Wi(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._(t)})}function Pl(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,..._(t)})}function Il(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,..._(t)})}function Gi(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._(t)})}function wn(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}function xn(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}function zn(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}function vn(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}function Tl(e,t){return new e(Ti({type:"number",checks:[],..._(t)}))}function Ol(e,t){return new e(Ti({type:"number",coerce:!0,checks:[],..._(t)}))}function Al(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._(t)})}function Rl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",..._(t)})}function Cl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",..._(t)})}function Nl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",..._(t)})}function El(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",..._(t)})}function Zl(e,t){return new e({type:"boolean",..._(t)})}function Dl(e,t){return new e({type:"boolean",coerce:!0,..._(t)})}function jl(e,t){return new e({type:"bigint",..._(t)})}function Ml(e,t){return new e({type:"bigint",coerce:!0,..._(t)})}function Ll(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",..._(t)})}function Ul(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",..._(t)})}function Vl(e,t){return new e({type:"symbol",..._(t)})}function Fl(e,t){return new e({type:"undefined",..._(t)})}function ql(e,t){return new e({type:"null",..._(t)})}function Hl(e){return new e({type:"any"})}function Bl(e){return new e({type:"unknown"})}function Jl(e,t){return new e({type:"never",..._(t)})}function Kl(e,t){return new e({type:"void",..._(t)})}function Wl(e,t){return new e({type:"date",..._(t)})}function Gl(e,t){return new e({type:"date",coerce:!0,..._(t)})}function Ql(e,t){return new e({type:"nan",..._(t)})}function Ze(e,t){return new Jo({check:"less_than",..._(t),value:e,inclusive:!1})}function ve(e,t){return new Jo({check:"less_than",..._(t),value:e,inclusive:!0})}function De(e,t){return new Ko({check:"greater_than",..._(t),value:e,inclusive:!1})}function ke(e,t){return new Ko({check:"greater_than",..._(t),value:e,inclusive:!0})}function kn(e){return De(0,e)}function Sn(e){return Ze(0,e)}function Pn(e){return ve(0,e)}function In(e){return ke(0,e)}function Je(e,t){return new Nc({check:"multiple_of",..._(t),value:e})}function Ke(e,t){return new Dc({check:"max_size",..._(t),maximum:e})}function je(e,t){return new jc({check:"min_size",..._(t),minimum:e})}function it(e,t){return new Mc({check:"size_equals",..._(t),size:e})}function st(e,t){return new Lc({check:"max_length",..._(t),maximum:e})}function Ue(e,t){return new Uc({check:"min_length",..._(t),minimum:e})}function at(e,t){return new Vc({check:"length_equals",..._(t),length:e})}function At(e,t){return new Fc({check:"string_format",format:"regex",..._(t),pattern:e})}function Rt(e){return new qc({check:"string_format",format:"lowercase",..._(e)})}function Ct(e){return new Hc({check:"string_format",format:"uppercase",..._(e)})}function Nt(e,t){return new Bc({check:"string_format",format:"includes",..._(t),includes:e})}function Et(e,t){return new Jc({check:"string_format",format:"starts_with",..._(t),prefix:e})}function Zt(e,t){return new Kc({check:"string_format",format:"ends_with",..._(t),suffix:e})}function Tn(e,t,r){return new Wc({check:"property",property:e,schema:t,..._(r)})}function Dt(e,t){return new Gc({check:"properties",shape:e,..._(t)})}function jt(e,t){return new Qc({check:"mime_type",mime:e,..._(t)})}function Re(e){return new Yc({check:"overwrite",tx:e})}function Mt(e){return Re(t=>t.normalize(e))}function Lt(){return Re(e=>e.trim())}function Ut(){return Re(e=>e.toLowerCase())}function Vt(){return Re(e=>e.toUpperCase())}function Ft(){return Re(e=>Za(e))}function Yl(e,t,r){return new e({type:"array",element:t,..._(r)})}function qb(e,t,r){return new e({type:"union",options:t,..._(r)})}function Hb(e,t,r){return new e({type:"union",options:t,inclusive:!1,..._(r)})}function Bb(e,t,r,n){return new e({type:"union",options:r,discriminator:t,..._(n)})}function Jb(e,t,r){return new e({type:"intersection",left:t,right:r})}function Kb(e,t,r,n){let o=r instanceof O,i=o?n:r,s=o?r:null;return new e({type:"tuple",items:t,rest:s,..._(i)})}function Wb(e,t,r,n){return new e({type:"record",keyType:t,valueType:r,..._(n)})}function Gb(e,t,r,n){return new e({type:"map",keyType:t,valueType:r,..._(n)})}function Qb(e,t,r){return new e({type:"set",valueType:t,..._(r)})}function Yb(e,t,r){let n=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new e({type:"enum",entries:n,..._(r)})}function Xb(e,t,r){return new e({type:"enum",entries:t,..._(r)})}function e_(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],..._(r)})}function Xl(e,t){return new e({type:"file",..._(t)})}function t_(e,t){return new e({type:"transform",transform:t})}function r_(e,t){return new e({type:"optional",innerType:t})}function n_(e,t){return new e({type:"nullable",innerType:t})}function o_(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():Hr(r)}})}function i_(e,t,r){return new e({type:"nonoptional",innerType:t,..._(r)})}function s_(e,t){return new e({type:"success",innerType:t})}function a_(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:Fa(r)})}function c_(e,t,r){return new e({type:"pipe",in:t,out:r})}function u_(e,t){return new e({type:"readonly",innerType:t})}function l_(e,t,r){return new e({type:"template_literal",parts:t,..._(r)})}function p_(e,t){return new e({type:"lazy",getter:t})}function f_(e,t){return new e({type:"promise",innerType:t})}function ep(e,t,r){let n=_(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function tp(e,t,r){return new e({type:"custom",check:"custom",fn:t,..._(r)})}function rp(e,t){let r=Wm(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(ar(o,n.value,r._zod.def));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=n.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(ar(i))}},e(n.value,n)),t);return r}function Wm(e,t){let r=new W({check:"custom",..._(t)});return r._zod.check=e,r}function np(e){let t=new W({check:"describe"});return t._zod.onattach=[r=>{let n=ie.get(r)??{};ie.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function op(e){let t=new W({check:"meta"});return t._zod.onattach=[r=>{let n=ie.get(r)??{};ie.add(r,{...n,...e})}],t._zod.check=()=>{},t}function ip(e,t){let r=_(t),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));let i=new Set(n),s=new Set(o),a=e.Codec??dn,c=e.Boolean??pn,u=e.String??Pt,l=new u({type:"string",error:r.error}),f=new c({type:"boolean",error:r.error}),d=new a({type:"pipe",in:l,out:f,transform:((m,g)=>{let b=m;return r.case!=="sensitive"&&(b=b.toLowerCase()),i.has(b)?!0:s.has(b)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:g.value,inst:d,continue:!1}),{})}),reverseTransform:((m,g)=>m===!0?n[0]||"true":o[0]||"false"),error:r.error});return d._zod.bag.truthy=n,d._zod.bag.falsy=o,d._zod.bag.case=r.case??"insensitive",d}function qt(e,t,r,n={}){let o=_(n),i={check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:a=>r.test(a),...o};return r instanceof RegExp&&(i.pattern=r),new e(i)}var Qi,Gm=D(()=>{Wo();bn();gr();ee();Qi={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6}});function On(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&ce(e,n,r[n]);return e}function ct(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??ie,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 te(e,t,r,n,o){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(r,i),!0}function F(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let d=s.schema,m=t.processors[o.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,d,l)}let f=e._zod.parent;f&&(s.ref||(s.ref=f),F(f,t,l),t.seen.get(f).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&On(s.schema,c),t.io==="input"&&ye(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function Qm(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function ut(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=n.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.`);n.set(a,s[0])}}let o=s=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,d=e.external.uri??(g=>g);if(f)return{ref:d(f)};let m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=m,{defId:m,ref:`${d("__shared")}#/${a}/${Qm(m)}`}}let c="#",u=`${c}/${a}/`;if(s[1]===r&&!s[1].schema.id)return{ref:c};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+Qm(l)}},i=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:u}=o(s);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let f in l)delete l[f];l.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
718
+ }`,d;try{d=new l(...s,f)(...a)}catch(m){throw new N(`this schema (generated code failed to evaluate: ${m.message})`)}return t?.debug&&(d.code=u),d.definite=n.definite,d}function T(e,t){for(let[n,o]of e.constants)if(o===t)return n;let r=`c${e.constantCounter++}`;return e.constants.set(r,t),r}function Ot(e,t){return e.definite=!1,T(e,t)}function I(e){return`v${e.varCounter++}`}function Gy(e,t){let r=e._zod.run({value:t,issues:[]},{});if(r&&typeof r.then=="function")return me;let n=r;return n.issues.length===0?n.value:me}function de(e,t,r,n,o=!0){let i=e.content.length,s=t.constants.size,a=t.constantCounter,c=t.varCounter;try{return Q(e,t,r,n,o)}catch(u){if(!(u instanceof N)||!u.islandable)throw u;if(e.content.length=i,t.constants.size>s){let l=Array.from(t.constants.keys()).slice(s);for(let f of l)t.constants.delete(f)}return t.constantCounter=a,t.varCounter=c,Qy(e,t,r,n)}}function Qy(e,t,r,n){t.definite=!1;let o=T(t,r),i=T(t,Gy),s=I(t);return e.write(`const ${s} = ${i}(${o}, ${n});`),e.write(`if (${s} === INVALID) return INVALID;`),s}function Xy(e,t,r,n){let o=r._zod.def.checks;if(!o||o.length===0)return n;let i=n;for(let s of o){let a=s._zod.def;if(a.when&&!Yy.has(a.check))throw new N('check with a custom "when" condition');switch(a.check){case"greater_than":eb(e,t,a,i);break;case"less_than":tb(e,t,a,i);break;case"multiple_of":rb(e,t,a,i);break;case"number_format":Jm(e,a,i);break;case"min_length":{let c=it(a.minimum,"min_length"),u=xl(e,t,i,`${i}.length >= ${c} && ${i}.length < ${a.minimum*2}`);e.write(`if (${u} < ${c}) return INVALID;`);break}case"max_length":{let c=it(a.maximum,"max_length"),u=xl(e,t,i,`${i}.length > ${c}`);e.write(`if (${u} > ${c}) return INVALID;`);break}case"length_equals":{let c=it(a.length,"length_equals"),u=xl(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 < ${it(a.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${i}.size > ${it(a.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${i}.size !== ${it(a.size,"size_equals")}) return INVALID;`);break;case"string_format":i=Km(e,t,a,i);break;case"custom":i=cb(e,t,s,i);break;case"bigint_format":nb(e,a,i);break;case"mime_type":ob(e,t,a,i);break;case"property":sb(e,t,a,i);break;case"properties":ib(e,t,a,i);break;case"overwrite":{let c=I(t);ab(e,t,s,i,c),i=c;break}default:throw new N(`check type ${a.check}`)}}return i}function xl(e,t,r,n){let o=T(t,xt),i=I(t);return e.write(`const ${i} = typeof ${r} === "string" && ${n} ? ${o}(${r}) : ${r}.length;`),i}function it(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new N(`${t} bound of type ${typeof e}`);return`${e}`}function Bm(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new N("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new N("comparison check with Invalid Date bound");return T(e,t)}throw new N(`comparison check bound of type ${typeof t}`)}function eb(e,t,r,n){let o=r.inclusive?"<":"<=";e.write(`if (${n} ${o} ${Bm(t,r.value)}) return INVALID;`)}function tb(e,t,r,n){let o=r.inclusive?">":">=";e.write(`if (${n} ${o} ${Bm(t,r.value)}) return INVALID;`)}function rb(e,t,r,n){if(typeof r.value=="bigint"){if(r.value===BigInt(0))throw new N("multiple_of check with a zero divisor");e.write(`if (${n} % ${r.value}n !== 0n) return INVALID;`)}else{let o=T(t,Br);e.write(`if (${o}(${n}, ${it(r.value,"multiple_of")}) !== 0) return INVALID;`)}}function Jm(e,t,r){let n=t.format;switch(n){case"safeint":e.write(`if (!Number.isSafeInteger(${r})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${r}) || ${r} < -2147483648 || ${r} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${r}) || ${r} < 0 || ${r} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${r}) || ${r} < -3.4028234663852886e38 || ${r} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${r})) return INVALID;`);break;default:throw new N(`number format ${n}`)}}function nb(e,t,r){let n=t.format;if(n)switch(n){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break;default:throw new N(`bigint format ${n}`)}}function ob(e,t,r,n){let o=r.mime;if(o&&o.length>0){let i=T(t,new Set(o));e.write(`if (!${i}.has(${n}.type)) return INVALID;`)}}function ib(e,t,r,n){if(r.when)throw new N('check with a custom "when" condition');e.write(`if (${n} == null) return INVALID;`);let o=r.shape;for(let i of Reflect.ownKeys(o)){let s=typeof i=="symbol"?T(t,i):he(i),a=I(t);e.write(`const ${a} = ${n}[${s}];`),de(e,t,o[i],a,!1)}}function sb(e,t,r,n){let o=`${n}[${JSON.stringify(r.property)}]`;Q(e,t,r.schema,o)}function ab(e,t,r,n,o){let i=r._zod.def.tx;if(!i)throw new N("overwrite check without a transform function");if(At(i))throw new Ae("z.compile: async overwrite transforms are not supported");let s=T(t,i);e.write(`const ${o} = ${s}(${n});`)}function zl(){throw new xe}function kl(e){this.issues.push(e)}function cb(e,t,r,n){let o=r._zod.def;if(o.fn){if(At(o.fn))throw new Ae("z.compile: async .refine() predicates are not supported");let i=Ot(t,o.fn),s=T(t,zl),a=I(t);return e.write(`const ${a} = ${i}(${n});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`),n}if(r._zod.check){if(At(r._zod.check))throw new Ae("z.compile: async .superRefine() / check functions are not supported");let i=r._zod.check,a=Ot(t,u=>{let l={value:u,issues:[],addIssue:kl};return i(l)instanceof Promise&&zl(),l.issues.length===0?l.value:me}),c=I(t);return e.write(`const ${c} = ${a}(${n});`),e.write(`if (${c} === INVALID) return INVALID;`),c}throw new N("custom check without a predicate or check function")}function Km(e,t,r,n,o=!0){let i=r.format;if(i==="base64"){let u=T(t,pn);return e.write(`if (!${u}(${n})) return INVALID;`),n}if(i==="base64url"){let u=T(t,li);return e.write(`if (!${u}(${n})) return INVALID;`),n}if(i==="jwt"){let u=T(t,di),l=T(t,r.alg??null);return e.write(`if (!${u}(${n}, ${l})) return INVALID;`),n}if(i==="ipv6"){let u=T(t,ln);return e.write(`if (!${u}(${n})) return INVALID;`),n}if(i==="cidrv6"){let u=T(t,ci);return e.write(`if (!${u}(${n})) return INVALID;`),n}if(i==="credit_card"){let u=T(t,pi);return e.write(`if (!${u}(${n})) return INVALID;`),n}if(i==="iban"){let u=T(t,fi);return e.write(`if (!${u}(${n})) return INVALID;`),n}let s=r;if(i==="url"||i==="httpurl"||s.normalize||s.hostname!==void 0||s.protocol!==void 0){let u=T(t,ii),l=T(t,r),f=I(t),d=I(t);if(e.write(`const ${f} = ${n}.trim();`),e.write(`const ${d} = ${u}(${f}, ${l});`),e.write(`if (typeof ${d} === "number") return INVALID;`),s.hostname!==void 0){let b=T(t,si);e.write(`if (!${b}(${d}, ${l}.hostname)) return INVALID;`)}if(s.protocol!==void 0){let b=T(t,ai);e.write(`if (!${b}(${d}, ${l}.protocol)) return INVALID;`)}if(!o)return null;let m=I(t),g=s.normalize?`${d}.href`:`${T(t,un)}(${f})`;return e.write(`const ${m} = ${g};`),m}let a=r.fn;if(a){if(At(a))throw new N(`async string format ${i}`);let u=T(t,a);return e.write(`if (!${u}(${n})) return INVALID;`),n}if(ub.has(i)&&r.pattern){let u=T(t,r.pattern);return e.write(`${u}.lastIndex = 0;`),e.write(`if (!${u}.test(${n})) return INVALID;`),n}let c=r.format;switch(c){case"regex":throw new N("regex format without a pattern");case"lowercase":e.write(`if (${n} !== ${n}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${n} !== ${n}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${n}.includes(${he(r.includes)})) return INVALID;`);break;case"starts_with":{let u=r.prefix;e.write(`if (${n}.slice(0, ${u.length}) !== ${he(u)}) return INVALID;`);break}case"ends_with":{let u=r.suffix;e.write(`if (${n}.slice(-${u.length}) !== ${he(u)}) return INVALID;`);break}default:throw new N(`string format ${c}`)}return n}function Q(e,t,r,n,o=!0){let i=r._zod.def,s=i.type;if(i.coerce)throw new N(`coercion (z.coerce.${s}())`);let a=o||!!i.checks?.length,c;switch(s){case"string":c=lb(e,t,r,n,a);break;case"number":c=pb(e,r,n);break;case"boolean":c=fb(e,n);break;case"bigint":c=db(e,r,n);break;case"symbol":c=mb(e,n);break;case"undefined":c=hb(e,n);break;case"null":c=gb(e,n);break;case"any":case"unknown":c=n;break;case"never":e.write("return INVALID;"),c=n;break;case"void":c=yb(e,n);break;case"nan":c=bb(e,n);break;case"date":c=_b(e,n);break;case"object":c=$b(e,t,r,n,a);break;case"optional":c=wb(e,t,r,n,a);break;case"nullable":c=vb(e,t,r,n,a);break;case"array":c=kb(e,t,r,n,a);break;case"literal":c=Sb(e,t,r,n);break;case"enum":c=Pb(e,t,r,n);break;case"readonly":{let u=Fm(e,t,r,n),l=I(t);e.write(`const ${l} = Object.freeze(${u});`),c=l;break}case"success":Fm(e,t,r,n),c="true";break;case"default":case"prefault":c=Ib(e,t,r,n);break;case"nonoptional":c=Tb(e,t,r,n);break;case"tuple":c=Ob(e,t,r,n);break;case"union":c=Ab(e,t,r,n);break;case"intersection":c=Nb(e,t,r,n);break;case"record":c=Eb(e,t,r,n);break;case"map":c=Db(e,t,r,n);break;case"set":c=jb(e,t,r,n);break;case"file":c=Mb(e,n);break;case"template_literal":c=Lb(e,t,r,n);break;case"lazy":c=Ub(e,t,r,n);break;case"pipe":c=Vb(e,t,r,n);break;case"custom":c=Fb(e,t,r,n);break;case"transform":c=Bb(e,t,r,n);break;case"catch":c=Hb(e,t,r,n);break;default:throw new N(`schema type ${s}`)}return c===null?null:Xy(e,t,r,c)}function lb(e,t,r,n,o=!0){e.write(`if (typeof ${n} !== "string") return INVALID;`);let i=r._zod.def;return i.format===void 0?n:Km(e,t,i,n,o)}function pb(e,t,r){e.write(`if (typeof ${r} !== "number" || !Number.isFinite(${r})) return INVALID;`);let n=t._zod.def;return n.check==="number_format"&&n.format&&Jm(e,{format:n.format},r),r}function fb(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function db(e,t,r){e.write(`if (typeof ${r} !== "bigint") return INVALID;`);let n=t._zod.def;if(n.format)switch(n.format){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break}return r}function mb(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function hb(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function gb(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function yb(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function bb(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function _b(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function $b(e,t,r,n,o=!0){let i=r._zod.def;e.write(`if (typeof ${n} !== "object" || ${n} === null || Array.isArray(${n})) return INVALID;`);let s=i.shape,a=Object.keys(s),c=Object.getOwnPropertySymbols(s),u=c.length?[...a,...c]:a,l=$=>typeof $=="symbol"?T(t,$):he($),f=$=>typeof $=="symbol"?`[${l($)}]`:he($),d=s;if(a.includes("__proto__"))throw new N('object shape key "__proto__"');let m=new Map;for(let $ of u){let P=d[$],E=l($),G=I(t);if(e.write(`const ${G} = ${n}[${E}];`),P._zod.optin!==void 0){let Z=I(t);e.write(`let ${Z} = (() => {`),e.indented(fe=>{let Hr=de(fe,t,P,G);fe.write(`return ${Hr};`)}),e.write("})();"),P._zod.optout==="optional"?(e.write(`if (${Z} === INVALID) {`),e.indented(fe=>{fe.write(`if (${E} in ${n}) return INVALID;`),fe.write(`${Z} = undefined;`)}),e.write("}")):e.write(`if (${Z} === INVALID) return INVALID;`),m.set($,Z)}else{zb(P)&&e.write(`if (!(${E} in ${n})) return INVALID;`);let Z=de(e,t,P,G,o);Z!==null&&m.set($,Z)}}let g=i.catchall,b="none";if(g){let $=g._zod.def.type;if($==="never"){let P=a.map(E=>`k !== ${he(E)}`).join(" && ")||"true";e.write(`for (const k in ${n}) {`),e.indented(E=>{E.write(`if (${P}) return INVALID;`)}),e.write("}")}else($==="unknown"||$==="any")&&!g._zod.def.checks?.length?b="passthrough":b="schema"}let w=I(t),S=u.some($=>Vm(d[$])||vl(d[$]));if(!o){if(b==="schema"){let $=a.length>0?T(t,new Set(a)):null;e.write(`for (const k in ${n}) {`),e.indented(P=>{P.write('if (k === "__proto__") continue;'),$&&P.write(`if (${$}.has(k)) continue;`);let E=I(t);P.write(`const ${E} = ${n}[k];`),de(P,t,g,E,!1)}),e.write("}")}return null}if(S){e.write(`const ${w} = {};`);for(let $ of u){let P=l($),E=m.get($);vl(d[$])?e.write(`if (${P} in ${n}) ${w}[${P}] = ${E};`):Vm(d[$])?e.write(`if (${E} !== undefined || ${P} in ${n}) ${w}[${P}] = ${E};`):e.write(`${w}[${P}] = ${E};`)}}else{let $=u.map(P=>`${f(P)}: ${m.get(P)}`).join(", ");e.write(`const ${w} = { ${$} };`)}if(b!=="none"){let $=a.length>0?T(t,new Set(a)):null;e.write(`for (const k in ${n}) {`),e.indented(P=>{if(P.write('if (k === "__proto__") continue;'),$&&P.write(`if (${$}.has(k)) continue;`),b==="passthrough")P.write(`${w}[k] = ${n}[k];`);else{let E=I(t);P.write(`const ${E} = ${n}[k];`);let G=de(P,t,g,E);P.write(`${w}[k] = ${G};`)}}),e.write("}")}return w}function wb(e,t,r,n,o=!0){let i=r._zod.def;if(xb(r))return Q(e,t,i.innerType,n,o);if(i.innerType._zod.optin==="defaulted"){let a=I(t),c=I(t);return e.write(`let ${a};`),e.write(`if (${n} === undefined) {`),e.indented(u=>{u.write(`const ${c} = (() => {`),u.indented(l=>{let f=Q(l,t,i.innerType,n);l.write(`return ${f};`)}),u.write("})();"),u.write(`if (${c} !== INVALID) ${a} = ${c};`)}),e.write("} else {"),e.indented(u=>{let l=Q(u,t,i.innerType,n);u.write(`${a} = ${l};`)}),e.write("}"),a}let s=o?I(t):null;return s&&e.write(`let ${s};`),e.write(`if (${n} !== undefined) {`),e.indented(a=>{let c=Q(a,t,i.innerType,n,o);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function xb(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function zb(e){return e._zod.optin===void 0&&Tt(e)}function Tt(e){if(e._zod.def.coerce)return!0;let 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?Tt(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?Tt(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(Tt):!0;case"intersection":return!t.left||!t.right?!0:Tt(t.left)&&Tt(t.right);case"pipe":return t.in?Tt(t.in):!0;default:return!0}}function vl(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function Vm(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&wr(e)}function wr(e){let 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?wr(t.innerType):!0;case"union":return t.options?t.options.some(wr):!0;case"intersection":return!t.left||!t.right||wr(t.left)||wr(t.right);case"pipe":return t.out?wr(t.out):!0;default:return!0}}function vb(e,t,r,n,o=!0){let i=r._zod.def,s=o?I(t):null;return s&&e.write(`let ${s} = null;`),e.write(`if (${n} !== null) {`),e.indented(a=>{let c=Q(a,t,i.innerType,n,o);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function Sl(e,t,r){for(let[n,o]of ar(t._zod.def.checks))e.write(`if (${r} > ${it(n,o._zod.def.check)}) return INVALID;`)}function kb(e,t,r,n,o=!0){let i=r._zod.def;e.write(`if (!Array.isArray(${n})) return INVALID;`),Sl(e,r,`${n}.length`);let s=o?I(t):null,a=I(t),c=I(t);return s&&e.write(`const ${s} = new Array(${n}.length);`),e.write(`for (let ${a} = 0; ${a} < ${n}.length; ${a}++) {`),e.indented(u=>{u.write(`const ${c} = ${n}[${a}];`);let l=de(u,t,i.element,c,o);s&&l!==null&&u.write(`${s}[${a}] = ${l};`)}),e.write("}"),s}function Sb(e,t,r,n){let i=r._zod.def.values;if(i.length!==1){let a=T(t,new Set(i));return e.write(`if (!${a}.has(${n})) return INVALID;`),n}let s=i[0];if(typeof s=="number"&&Number.isNaN(s)){let a=T(t,new Set(i));return e.write(`if (!${a}.has(${n})) return INVALID;`),n}if(typeof s=="string")e.write(`if (${n} !== ${he(s)}) return INVALID;`);else if(typeof s=="number"||typeof s=="boolean")e.write(`if (${n} !== ${s}) return INVALID;`);else if(s===null)e.write(`if (${n} !== null) return INVALID;`);else if(s===void 0)e.write(`if (${n} !== undefined) return INVALID;`);else if(typeof s=="bigint")e.write(`if (${n} !== ${s}n) return INVALID;`);else throw new N(`literal type ${typeof s}`);return n}function Pb(e,t,r,n){let o=r._zod.values;if(!o)throw new N("enum schema without enumerated values");let i=T(t,o);return e.write(`if (!${i}.has(${n})) return INVALID;`),n}function Fm(e,t,r,n){let o=r._zod.def;return Q(e,t,o.innerType,n)}function Ib(e,t,r,n){let o=r._zod.def,s=Object.getOwnPropertyDescriptor(r._zod.def,"defaultValue")?()=>r._zod.def.defaultValue:void 0;if(r._zod.def.type==="prefault"){if(!s)return Q(e,t,o.innerType,n);let c=T(t,s),u=I(t);return e.write(`let ${u} = ${n};`),e.write(`if (${n} === undefined) ${u} = ${c}();`),Q(e,t,o.innerType,u)}let a=I(t);if(s){let c=T(t,s),u=T(t,Jr);e.write(`let ${a};`),e.write(`if (${n} === undefined) {`),e.indented(l=>{l.write(`${a} = ${u}(${c}());`)}),e.write("} else {"),e.indented(l=>{let f=Q(l,t,o.innerType,n);l.write(`${a} = ${f} === undefined ? ${u}(${c}()) : ${f};`)}),e.write("}")}else e.write(`let ${a};`),e.write(`if (${n} !== undefined) {`),e.indented(c=>{let u=Q(c,t,o.innerType,n);c.write(`${a} = ${u};`)}),e.write("}");return a}function Tb(e,t,r,n){let o=r._zod.def,i=Q(e,t,o.innerType,n),s=I(t);return e.write(`const ${s} = ${i};`),e.write(`if (${s} === undefined) return INVALID;`),s}function Ob(e,t,r,n){let o=r._zod.def,i=o.items,s=o.rest;e.write(`if (!Array.isArray(${n})) return INVALID;`);let a=qm(i,"optin"),c=qm(i,"optout");s?e.write(`if (${n}.length < ${a}) return INVALID;`):e.write(`if (${n}.length < ${a} || ${n}.length > ${i.length}) return INVALID;`);let u=I(t);e.write(`const ${u} = [];`);for(let l=0;l<i.length;l++){let f=i[l];if(l>=c)e.write(`if (${u}.length === ${l}) {`),e.indented(d=>{d.write(`if (${l} < ${n}.length) {`),d.indented(m=>{let g=I(t);m.write(`const ${g} = ${n}[${l}];`);let b=de(m,t,f,g);m.write(`${u}[${l}] = ${b};`)}),d.write("} else {"),d.indented(m=>{if(vl(f)){m.write(`${u}.length = ${l};`);return}let g=I(t),b=I(t);m.write(`const ${g} = undefined;`),m.write(`const ${b} = (() => {`),m.indented(w=>{let S=de(w,t,f,g);w.write(`return ${S};`)}),m.write("})();"),m.write(`if (${b} === INVALID || ${b} === undefined) ${u}.length = ${l};`),m.write(`else ${u}[${l}] = ${b};`)}),d.write("}")}),e.write("}");else{let d=I(t);e.write(`const ${d} = ${n}[${l}];`);let m=de(e,t,f,d);e.write(`${u}[${l}] = ${m};`)}}if(s){let l=I(t),f=I(t);e.write(`for (let ${l} = ${i.length}; ${l} < ${n}.length; ${l}++) {`),e.indented(d=>{d.write(`const ${f} = ${n}[${l}];`);let m=de(d,t,s,f);d.write(`${u}[${l}] = ${m};`)}),e.write("}")}return u}function qm(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function Ab(e,t,r,n){let o=r._zod.def,i=o.options;if(o.discriminator)return Rb(e,t,o,n);if(o.inclusive===!1)throw new N("exclusive unions (z.xor)");if(i.length===0)return e.write("return INVALID;"),n;if(i.length===1)return Q(e,t,i[0],n);if(i.every(c=>c._zod.def.type==="literal"&&!c._zod.def.checks?.length)){let c=new Set(i.flatMap(l=>l._zod.def.values)),u=T(t,c);return e.write(`if (!${u}.has(${n})) return INVALID;`),n}let a=I(t);e.write(`let ${a};`);for(let c=0;c<i.length;c++){let u=i[c];c===0?e.write(`${a} = (() => {`):e.write(`if (${a} === INVALID) ${a} = (() => {`),e.indented(l=>{let f=Q(l,t,u,n);l.write(`return ${f};`)}),e.write("})();")}return e.write(`if (${a} === INVALID) return INVALID;`),a}function Rb(e,t,r,n){if(r.unionFallback)throw new N("discriminated union with unionFallback");if(r.options.length===0)return e.write("return INVALID;"),n;let o=I(t),i=I(t);e.write(`const ${o} = ${n}?.[${he(r.discriminator)}];`),e.write(`let ${i};`);let s=!0,a=new Set;for(let c of r.options){let u=c._zod.propValues?.[r.discriminator];if(!u||u.size===0)throw new N("discriminated union option without static discriminator values");for(let d of u){if(a.has(d))throw new N(`duplicate discriminator value ${String(d)}`);a.add(d)}let l=Array.from(u,d=>Cb(t,o,d)),f=s?"if":"else if";e.write(`${f} (${l.join(" || ")}) {`),e.indented(d=>{let m=Q(d,t,c,n);d.write(`${i} = ${m};`)}),e.write("}"),s=!1}return e.write("else { return INVALID; }"),i}function Cb(e,t,r){if(typeof r=="string")return`${t} === ${he(r)}`;if(typeof r=="number")return Number.isNaN(r)?`Number.isNaN(${t})`:`${t} === ${r}`;if(typeof r=="boolean")return`${t} === ${r}`;if(r===null)return`${t} === null`;if(r===void 0)return`${t} === undefined`;if(typeof r=="bigint")return`${t} === ${r}n`;if(typeof r=="symbol"){let n=T(e,r);return`${t} === ${n}`}throw new N(`literal discriminator value ${String(r)}`)}function Nb(e,t,r,n){let o=r._zod.def;t.definite=!1;let i=de(e,t,o.left,n),s=de(e,t,o.right,n),a=T(t,gr),c=I(t);return e.write(`const ${c} = ${a}(${i}, ${s});`),e.write(`if (!${c}.valid) return INVALID;`),`${c}.data`}function Eb(e,t,r,n){let o=r._zod.def,i=T(t,Te);e.write(`if (!${i}(${n})) return INVALID;`);let s=I(t),a=I(t),c=I(t);e.write(`const ${s} = {};`);let u=o,l=u.partial?void 0:o.keyType._zod.values;if(l){let m=[];for(let b of l){if(!(typeof b=="string"||typeof b=="number"||typeof b=="symbol"))throw new N(`record key value ${String(b)}`);let w=typeof b=="number"?b.toString():b;if(w==="__proto__")throw new N('record key "__proto__"');m.push(w);let S=T(t,b),$=Q(e,t,o.keyType,S),P=I(t);e.write(`const ${P} = ${n}[${Zb(t,w)}];`);let E=de(e,t,o.valueType,P);e.write(`${s}[${$}] = ${E};`)}let g=T(t,new Set(m));return e.write(`for (const ${a} in ${n}) {`),e.indented(b=>{b.write(`if (${g}.has(${a})) continue;`),u.mode==="loose"?b.write(`if (${a} !== "__proto__") ${s}[${a}] = ${n}[${a}];`):b.write("return INVALID;")}),e.write("}"),s}let f=o.keyType._zod.def;if(!(f.type==="string"&&f.format===void 0&&!f.coerce&&(f.checks?.length??0)===0)){let m=o.mode==="loose",g=Ai(o.keyType);g.definite===!1&&(t.definite=!1);let b=T(t,g),w=T(t,Be),S=I(t);return Hm(e,t,n,a,$=>{$.write(`let ${S} = ${b}(${a});`),$.write(`if (${S} === INVALID && typeof ${a} === "string" && ${w}.test(${a})) ${S} = ${b}(Number(${a}));`),m?$.write(`if (${S} === INVALID) { ${s}[${a}] = ${n}[${a}]; continue; }`):$.write(`if (${S} === INVALID) return INVALID;`),$.write(`if (${S} === "__proto__") continue;`);let P=I(t);$.write(`const ${P} = ${n}[${a}];`);let E=de($,t,o.valueType,P);$.write(`${s}[${S}] = ${E};`)}),s}return Hm(e,t,n,a,m=>{m.write(`const ${c} = ${n}[${a}];`);let g=de(m,t,o.valueType,c);m.write(`${s}[${a}] = ${g};`)},"return INVALID;"),s}function Hm(e,t,r,n,o,i){let s=T(t,Object.prototype.propertyIsEnumerable),a=I(t),c=I(t),u=I(t);e.write(`const ${a} = Object.getOwnPropertySymbols(${r});`),e.write(`const ${c} = Object.getOwnPropertyNames(${r});`),e.write(`for (let ${u} = 0; ${u} < ${c}.length; ${u}++) {`),e.indented(l=>{l.write(`const ${n} = ${c}[${u}];`),l.write(`if (${n} === "__proto__" || !${s}.call(${r}, ${n})) continue;`),o(l)}),e.write("}"),e.write(`for (let ${u} = 0; ${u} < ${a}.length; ${u}++) {`),e.indented(l=>{l.write(`const ${n} = ${a}[${u}];`),l.write(`if (!${s}.call(${r}, ${n})) continue;`),i?l.write(i):o(l)}),e.write("}")}function Zb(e,t){return typeof t=="string"?he(t):T(e,t)}function Db(e,t,r,n){let o=r._zod.def;e.write(`if (!(${n} instanceof Map)) return INVALID;`),Sl(e,r,`${n}.size`);let i=I(t),s=I(t),a=I(t);return e.write(`const ${i} = new Map();`),e.write(`for (const [${s}, ${a}] of ${n}) {`),e.indented(c=>{let u=Q(c,t,o.keyType,s),l=Q(c,t,o.valueType,a);c.write(`${i}.set(${u}, ${l});`)}),e.write("}"),i}function jb(e,t,r,n){let o=r._zod.def;e.write(`if (!(${n} instanceof Set)) return INVALID;`),Sl(e,r,`${n}.size`);let i=I(t),s=I(t);return e.write(`const ${i} = new Set();`),e.write(`for (const ${s} of ${n}) {`),e.indented(a=>{let c=Q(a,t,o.valueType,s);a.write(`${i}.add(${c});`)}),e.write("}"),i}function Mb(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function Lb(e,t,r,n){e.write(`if (typeof ${n} !== "string") return INVALID;`);let o=r._zod.pattern;if(o){let i=T(t,o);e.write(`${i}.lastIndex = 0;`),e.write(`if (!${i}.test(${n})) return INVALID;`)}return n}function Ub(e,t,r,n){let o=r._zod.def,i=Ot(t,o.getter),s=T(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("}");let a=I(t);return e.write(`const ${a} = ${s}.parser(${n});`),e.write(`if (${a} === INVALID) return INVALID;`),a}function Vb(e,t,r,n){let o=r._zod.def,i=Q(e,t,o.in,n);if(o.transform){if(At(o.transform))throw new Ae("z.compile: async transforms in pipes are not supported");let s=o.transform,c=Ot(t,l=>{let f={value:l,issues:[],addIssue:kl},d=s(l,f);return d instanceof Promise?me:f.issues.length===0?d:me}),u=I(t);return e.write(`const ${u} = ${c}(${i});`),e.write(`if (${u} === INVALID) return INVALID;`),Q(e,t,o.out,u)}else return Q(e,t,o.out,i)}function At(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function Fb(e,t,r,n){let o=r._zod.def;if(o.fn){if(At(o.fn))throw new Ae("z.compile: async custom predicates are not supported");let i=Ot(t,o.fn),s=T(t,zl),a=I(t);e.write(`const ${a} = ${i}(${n});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`)}else throw new N("custom schema without a predicate function");return n}function qb(e,t,r){let n=e._zod.run({value:r,issues:[]},{});if(n&&typeof n.then=="function")return me;let o=n;return o.issues.length===0?o.value:t()}function Hb(e,t,r,n){let o=r._zod.def;if(!o.catchValue[Ao])throw new N("catch with a callback (only a constant catch value compiles)",!1);let i=I(t);e.write(`let ${i} = (() => {`),e.indented(u=>{let l=de(u,t,o.innerType,n);u.write(`return ${l};`)}),e.write("})();");let s=T(t,o.innerType),a=Ot(t,o.catchValue),c=T(t,qb);return e.write(`if (${i} === INVALID) {`),e.indented(u=>{u.write(`${i} = ${c}(${s}, ${a}, ${n});`),u.write(`if (${i} === INVALID) return INVALID;`)}),e.write("}"),i}function Bb(e,t,r,n){let o=r._zod.def;if(o.transform){if(At(o.transform))throw new Ae("z.compile: async transforms are not supported");let i=o.transform,a=Ot(t,u=>{let l={value:u,issues:[],addIssue:kl},f=i(u,l);return f instanceof Promise?me:l.issues.length===0?f:me}),c=I(t);return e.write(`const ${c} = ${a}(${n});`),e.write(`if (${c} === INVALID) return INVALID;`),c}return n}var me,Um,Ae,N,Yy,ub,Wm=D(()=>{nt();Xo();_l();St();yr();ee();me=Symbol.for("zod.compile.invalid"),Um=Symbol.for("zod.compile.fallback"),Ae=class extends Error{constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}},N=class extends Error{constructor(t,r=!0){super(`z.compile does not support ${t}; this schema must use the runtime parser`),this.name="ZodCompileUnsupportedError",this.islandable=r}};Yy=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);ub=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 Ri(e){return e.checks&&(e.checks=[...e.checks]),e}function Pl(e,t){return new e(Ri({type:"string",..._(t)}))}function Il(e,t){return new e(Ri({type:"string",coerce:!0,..._(t)}))}function Ci(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}function Ni(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}function Ei(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}function Zi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}function Di(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}function ji(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}function xn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}function Mi(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}function Li(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}function Ui(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}function Vi(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}function Fi(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}function qi(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}function Hi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}function Bi(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}function Ji(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}function Tl(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,..._(t)})}function Ki(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}function Wi(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}function Gi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}function Qi(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}function Yi(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._(t)})}function Ol(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,..._(t)})}function Al(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,..._(t)})}function Xi(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._(t)})}function zn(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}function vn(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}function kn(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}function Sn(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}function Rl(e,t){return new e(Ri({type:"number",checks:[],..._(t)}))}function Cl(e,t){return new e(Ri({type:"number",coerce:!0,checks:[],..._(t)}))}function Nl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._(t)})}function El(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",..._(t)})}function Zl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",..._(t)})}function Dl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",..._(t)})}function jl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",..._(t)})}function Ml(e,t){return new e({type:"boolean",..._(t)})}function Ll(e,t){return new e({type:"boolean",coerce:!0,..._(t)})}function Ul(e,t){return new e({type:"bigint",..._(t)})}function Vl(e,t){return new e({type:"bigint",coerce:!0,..._(t)})}function Fl(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",..._(t)})}function ql(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",..._(t)})}function Hl(e,t){return new e({type:"symbol",..._(t)})}function Bl(e,t){return new e({type:"undefined",..._(t)})}function Jl(e,t){return new e({type:"null",..._(t)})}function Kl(e){return new e({type:"any"})}function Wl(e){return new e({type:"unknown"})}function Gl(e,t){return new e({type:"never",..._(t)})}function Ql(e,t){return new e({type:"void",..._(t)})}function Yl(e,t){return new e({type:"date",..._(t)})}function Xl(e,t){return new e({type:"date",coerce:!0,..._(t)})}function ep(e,t){return new e({type:"nan",..._(t)})}function De(e,t){return new Go({check:"less_than",..._(t),value:e,inclusive:!1})}function ve(e,t){return new Go({check:"less_than",..._(t),value:e,inclusive:!0})}function je(e,t){return new Qo({check:"greater_than",..._(t),value:e,inclusive:!1})}function ke(e,t){return new Qo({check:"greater_than",..._(t),value:e,inclusive:!0})}function Pn(e){return je(0,e)}function In(e){return De(0,e)}function Tn(e){return ve(0,e)}function On(e){return ke(0,e)}function Je(e,t){return new Dc({check:"multiple_of",..._(t),value:e})}function Ke(e,t){return new Lc({check:"max_size",..._(t),maximum:e})}function Me(e,t){return new Uc({check:"min_size",..._(t),minimum:e})}function st(e,t){return new Vc({check:"size_equals",..._(t),size:e})}function at(e,t){return new Fc({check:"max_length",..._(t),maximum:e})}function Ve(e,t){return new qc({check:"min_length",..._(t),minimum:e})}function ct(e,t){return new Hc({check:"length_equals",..._(t),length:e})}function Rt(e,t){return new Bc({check:"string_format",format:"regex",..._(t),pattern:e})}function Ct(e){return new Jc({check:"string_format",format:"lowercase",..._(e)})}function Nt(e){return new Kc({check:"string_format",format:"uppercase",..._(e)})}function Et(e,t){return new Wc({check:"string_format",format:"includes",..._(t),includes:e})}function Zt(e,t){return new Gc({check:"string_format",format:"starts_with",..._(t),prefix:e})}function Dt(e,t){return new Qc({check:"string_format",format:"ends_with",..._(t),suffix:e})}function An(e,t,r){return new Yc({check:"property",property:e,schema:t,..._(r)})}function jt(e,t){return new Xc({check:"properties",shape:e,..._(t)})}function Mt(e,t){return new eu({check:"mime_type",mime:e,..._(t)})}function Re(e){return new tu({check:"overwrite",tx:e})}function Lt(e){return Re(t=>t.normalize(e))}function Ut(){return Re(e=>e.trim())}function Vt(){return Re(e=>e.toLowerCase())}function Ft(){return Re(e=>e.toUpperCase())}function qt(){return Re(e=>Ma(e))}function tp(e,t,r){return new e({type:"array",element:t,..._(r)})}function Jb(e,t,r){return new e({type:"union",options:t,..._(r)})}function Kb(e,t,r){return new e({type:"union",options:t,inclusive:!1,..._(r)})}function Wb(e,t,r,n){return new e({type:"union",options:r,discriminator:t,..._(n)})}function Gb(e,t,r){return new e({type:"intersection",left:t,right:r})}function Qb(e,t,r,n){let o=r instanceof O,i=o?n:r,s=o?r:null;return new e({type:"tuple",items:t,rest:s,..._(i)})}function Yb(e,t,r,n){return new e({type:"record",keyType:t,valueType:r,..._(n)})}function Xb(e,t,r,n){return new e({type:"map",keyType:t,valueType:r,..._(n)})}function e_(e,t,r){return new e({type:"set",valueType:t,..._(r)})}function t_(e,t,r){let n=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new e({type:"enum",entries:n,..._(r)})}function r_(e,t,r){return new e({type:"enum",entries:t,..._(r)})}function n_(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],..._(r)})}function rp(e,t){return new e({type:"file",..._(t)})}function o_(e,t){return new e({type:"transform",transform:t})}function i_(e,t){return new e({type:"optional",innerType:t})}function s_(e,t){return new e({type:"nullable",innerType:t})}function a_(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():Jr(r)}})}function c_(e,t,r){return new e({type:"nonoptional",innerType:t,..._(r)})}function u_(e,t){return new e({type:"success",innerType:t})}function l_(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:Ba(r)})}function p_(e,t,r){return new e({type:"pipe",in:t,out:r})}function f_(e,t){return new e({type:"readonly",innerType:t})}function d_(e,t,r){return new e({type:"template_literal",parts:t,..._(r)})}function m_(e,t){return new e({type:"lazy",getter:t})}function h_(e,t){return new e({type:"promise",innerType:t})}function np(e,t,r){let n=_(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function op(e,t,r){return new e({type:"custom",check:"custom",fn:t,..._(r)})}function ip(e,t){let r=Gm(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(cr(o,n.value,r._zod.def));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=n.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(cr(i))}},e(n.value,n)),t);return r}function Gm(e,t){let r=new W({check:"custom",..._(t)});return r._zod.check=e,r}function sp(e){let t=new W({check:"describe"});return t._zod.onattach=[r=>{let n=ie.get(r)??{};ie.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function ap(e){let t=new W({check:"meta"});return t._zod.onattach=[r=>{let n=ie.get(r)??{};ie.add(r,{...n,...e})}],t._zod.check=()=>{},t}function cp(e,t){let r=_(t),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));let i=new Set(n),s=new Set(o),a=e.Codec??hn,c=e.Boolean??dn,u=e.String??It,l=new u({type:"string",error:r.error}),f=new c({type:"boolean",error:r.error}),d=new a({type:"pipe",in:l,out:f,transform:((m,g)=>{let b=m;return r.case!=="sensitive"&&(b=b.toLowerCase()),i.has(b)?!0:s.has(b)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:g.value,inst:d,continue:!1}),{})}),reverseTransform:((m,g)=>m===!0?n[0]||"true":o[0]||"false"),error:r.error});return d._zod.bag.truthy=n,d._zod.bag.falsy=o,d._zod.bag.case=r.case??"insensitive",d}function Ht(e,t,r,n={}){let o=_(n),i={check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:a=>r.test(a),...o};return r instanceof RegExp&&(i.pattern=r),new e(i)}var es,Qm=D(()=>{Yo();$n();yr();ee();es={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6}});function Rn(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&ce(e,n,r[n]);return e}function ut(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??ie,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 te(e,t,r,n,o){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(r,i),!0}function F(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let d=s.schema,m=t.processors[o.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,d,l)}let f=e._zod.parent;f&&(s.ref||(s.ref=f),F(f,t,l),t.seen.get(f).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Rn(s.schema,c),t.io==="input"&&ye(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function Ym(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function lt(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=n.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.`);n.set(a,s[0])}}let o=s=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,d=e.external.uri??(g=>g);if(f)return{ref:d(f)};let m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=m,{defId:m,ref:`${d("__shared")}#/${a}/${Ym(m)}`}}let c="#",u=`${c}/${a}/`;if(s[1]===r&&!s[1].schema.id)return{ref:c};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+Ym(l)}},i=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:u}=o(s);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let f in l)delete l[f];l.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
602
719
 
603
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){i(s);continue}if(e.external){let 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 eh(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!="object")return;eh(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!="string")return;r.includes(s)||r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}function Xm(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function sp(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!th.has(s))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let a=[];for(let u of t){let l=u.properties?.[s]??Xm(u);l!=null&&(a.some(f=>JSON.stringify(f)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:sp(a)??{allOf:a};ce(r,s,c)}for(let s of i.required??[])n.add(s)}let o={type:"object",properties:r};if(n.size&&(o.required=[...n]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let a=Xm(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 d_(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of th)if(o in e)return;let r=t.filter(o=>Ym.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=sp(t);else{let o=r[0],i=Ym.find(c=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let s=t.filter(c=>c!==o),a=o[i].map(c=>sp([...s,c]));if(a.some(c=>!c))return;n={[i]:a}}n&&(delete e.allOf,On(e,n))}function lt(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},f=c.ref;if(c.ref=null,f){n(f);let m=e.seen.get(f),g=m.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(g)):On(u,g),On(u,l),a._zod.parent===f)for(let w in u)w==="$ref"||w==="allOf"||w in l||delete u[w];if(g.$ref&&m.def)for(let w in u)w==="$ref"||w==="allOf"||w in m.def&&JSON.stringify(u[w])===JSON.stringify(m.def[w])&&delete u[w]}let d=a._zod.parent;if(d&&d!==f){n(d);let m=e.seen.get(d);if(m?.schema.$ref&&(u.$ref=m.schema.$ref,m.def))for(let g in u)g==="$ref"||g==="allOf"||g in m.def&&JSON.stringify(u[g])===JSON.stringify(m.def[g])&&delete u[g]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())n(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())eh(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let f=a.get(l);f?f.push(u):a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])d_(u)}}let 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){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}On(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,ce(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{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:wr(t,"input",e.processors),output:wr(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function ye(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return ye(n.element,r);if(n.type==="set")return ye(n.valueType,r);if(n.type==="lazy")return ye(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return ye(n.innerType,r);if(n.type==="intersection")return ye(n.left,r)||ye(n.right,r);if(n.type==="record"||n.type==="map")return ye(n.keyType,r)||ye(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ye(n.in,r)||ye(n.out,r);if(n.type==="object"){for(let o in n.shape)if(ye(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(ye(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(ye(o,r))return!0;return!!(n.rest&&ye(n.rest,r))}return!1}var th,Ym,ap,wr,An=D(()=>{bn();ee();th=new Set(["type","properties","required","additionalProperties"]),Ym=["oneOf","anyOf"];ap=(e,t={})=>r=>{let n=ct({...r,processors:t});return F(e,n),ut(n,e),lt(n,e)},wr=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},s=ct({...o??{},target:i,io:t,processors:r});return F(e,s),ut(s,e),lt(s,e)}});function re(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)m_[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&xr(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&xr(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&zr(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&zr(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&sh(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&ch(t,o.mime);for(let i of o.patterns??[])ah(t,i);return t}function Rn(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Rn(t.out):t.type==="catch"?Rn(t.innerType):e._zod.optin}function cp(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let g=e.get(t)?.def;if(!g)return t;let b=cp(e,g,r);return b===g?t:b}for(let g of["anyOf","oneOf"]){let b=t[g];if(!Array.isArray(b))continue;let w=b.map(S=>cp(e,S,r));w.some((S,$)=>S!==b[$])&&(t={...t,[g]:w})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some(g=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some(g=>typeof g=="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:f,id:d,...m}=t;return m.enum?m.enum=m.enum.map(g=>typeof g=="number"?String(g):g):typeof m.const=="number"&&(m.const=String(m.const)),o&&(m.type="string",i||(m.pattern=(n.includes("number")?Be:rn).source)),m}function y_(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let r=new Map;for(let n of up.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=cp(t,i,new Set);s!==i&&r.set(i,s)}if(r.size)for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);i&&(o.propertyNames=i)}}function ph(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(i=!0,null));return i?(te(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),Lp):JSON.parse(s)}function Cn(e,t){if("_idmap"in e){let n=e,o=ct({...t,processors:Yi}),i={};for(let c of n._idmap.entries()){let[u,l]=c;F(l,o)}let s={},a={registry:n,uri:t?.uri,defs:i};o.external=a;for(let c of n._idmap.entries()){let[u,l]=c;ut(o,l),ce(s,u,lt(o,l))}if(Object.keys(i).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let r=ct({...t,processors:Yi});return F(e,r),ut(r,e),lt(r,e)}var xr,zr,rh,sh,ah,ch,uh,nh,oh,ih,m_,h_,g_,lh,lp,pp,fp,dp,mp,hp,gp,yp,bp,_p,$p,wp,xp,zp,vp,kp,Sp,Pp,Ip,Tp,Op,Ap,Rp,Cp,Np,Xi,Ep,Zp,up,Dp,jp,Mp,Lp,Up,Vp,Fp,qp,Hp,Bp,es,Jp,Yi,Nn=D(()=>{kt();gr();An();ee();xr=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},zr=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},rh=(e,t)=>{xr(e,"minimum",t),zr(e,"maximum",t)},sh=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},ah=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},ch=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},uh=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},nh=(e,t)=>xr(e,"minimum",t.minimum),oh=(e,t)=>zr(e,"maximum",t.maximum),ih=e=>(t,r)=>{uh(t,r.format);let[n,o]=e[r.format];xr(t,"minimum",n),zr(t,"maximum",o)},m_={greater_than:(e,t)=>xr(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>zr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>sh(e,t.value),number_format:ih(Jr),bigint_format:ih(Kr),min_length:nh,max_length:oh,length_equals:(e,t)=>rh(e,t.length),min_size:nh,max_size:oh,size_equals:(e,t)=>rh(e,t.size),string_format:(e,t)=>{uh(e,t.format),t.pattern&&ah(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)=>ch(e,t.mime)};h_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},g_=new Map([[si,mc],[ln,hc]]),lh=e=>g_.get(e)??e,lp=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:u,laxFormat:l}=re(e);if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),a&&(o.format=h_[a]??a,o.format===""&&delete o.format,(a==="time"||l)&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let f=[...c].map(lh);f.length===1?o.pattern=f[0].source:f.length>1&&(o.allOf=[...f.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},pp=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=re(e);o.type=l?"integer":"number";let f=typeof u=="number"&&u>=(i??Number.NEGATIVE_INFINITY),d=typeof c=="number"&&c<=(s??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(f?m?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof i=="number"&&(o.minimum=i),d?m?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof s=="number"&&(o.maximum=s),a){let g=new Set;for(let S of a)Number.isFinite(S)&&S!==0?g.add(Math.abs(S)):te(e,t,o,n,`A multipleOf divisor of ${S} cannot be represented in JSON Schema`);let[b,...w]=g;b!==void 0&&(o.multipleOf=b),w.length&&(o.allOf=[...o.allOf??[],...w.map(S=>({multipleOf:S}))])}},fp=(e,t,r,n)=>{r.type="boolean"},dp=(e,t,r,n)=>{te(e,t,r,n,"BigInt cannot be represented in JSON Schema")},mp=(e,t,r,n)=>{te(e,t,r,n,"Symbols cannot be represented in JSON Schema")},hp=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},gp=(e,t,r,n)=>{te(e,t,r,n,"Undefined cannot be represented in JSON Schema")},yp=(e,t,r,n)=>{te(e,t,r,n,"Void cannot be represented in JSON Schema")},bp=(e,t,r,n)=>{r.not={}},_p=(e,t,r,n)=>{},$p=(e,t,r,n)=>{},wp=(e,t,r,n)=>{te(e,t,r,n,"Date cannot be represented in JSON Schema")},xp=(e,t,r,n)=>{let o=e._zod.def,i=rr(o.entries);if(i.length===0){r.not={};return}i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),r.enum=i},zp=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(te(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(te(e,t,r,n,"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){let s=i[0];r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[s]:r.const=s}else i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),i.every(s=>typeof s=="boolean")&&(r.type="boolean"),i.every(s=>s===null)&&(r.type="null"),r.enum=i},vp=(e,t,r,n)=>{te(e,t,r,n,"NaN cannot be represented in JSON Schema")},kp=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Sp=(e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=re(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})))},Pp=(e,t,r,n)=>{r.type="boolean"},Ip=(e,t,r,n)=>{te(e,t,r,n,"Custom types cannot be represented in JSON Schema")},Tp=(e,t,r,n)=>{te(e,t,r,n,"Function types cannot be represented in JSON Schema")},Op=(e,t,r,n)=>{te(e,t,r,n,"Transforms cannot be represented in JSON Schema")},Ap=(e,t,r,n)=>{te(e,t,r,n,"Map cannot be represented in JSON Schema")},Rp=(e,t,r,n)=>{te(e,t,r,n,"Set cannot be represented in JSON Schema")},Cp=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:a}=re(e);typeof s=="number"&&(o.minItems=s),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=F(i.element,t,{...n,path:[...n.path,"items"]})};Np=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&te(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in s)ce(o.properties,u,F(s[u],t,{...n,path:[...n.path,"properties",u]}));let c=[];for(let u of Object.keys(s)){let l=i.shape[u];(t.io==="input"?Rn(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=F(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Xi=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>F(a,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=s:r.anyOf=s},Ep=(e,t,r,n)=>{let o=e._zod.def,i=F(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=F(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=c,t.intersections.push(c)},Zp=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let 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((b,w)=>F(b,t,{...n,path:[...n.path,s,w]})),u=i.rest?F(i.rest,t,{...n,path:[...n.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;for(;l>0;){let b=i.items[l-1];if(!(t.io==="input"?Rn(b)!==void 0:b._zod.optout==="optional"))break;l--}let f=i.items.length,d=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=c,d?o.items=!1:u&&(o.items=u),l>0&&(o.minItems=l),d&&(o.maxItems=f)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),l>0&&(o.minItems=l),d&&(o.maxItems=f)):(o.items=c,d?o.additionalItems=!1:u&&(o.additionalItems=u),l>0&&(o.minItems=l),d&&(o.maxItems=f));let{minimum:m,maximum:g}=re(e);typeof m=="number"&&(o.minItems=m),typeof g=="number"&&(o.maxItems=g)};up=new WeakMap;Dp=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let s=i.keyType,a=re(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let l=F(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let f of a)ce(o.patternProperties,lh(f).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=F(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=up.get(t);l||(l=[],up.set(t,l),t.deferred.push(()=>y_(t))),l.push(e)}o.additionalProperties=F(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let c=s._zod.values,u=t.io==="input"&&Rn(i.valueType)!==void 0;if(c&&!i.partial&&!u){let l=[...c].filter(f=>typeof f=="string"||typeof f=="number");l.length>0&&(o.required=l.map(String))}},jp=(e,t,r,n)=>{let o=e._zod.def,i=F(o.innerType,t,n),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},Mp=(e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Lp=Symbol();Up=(e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=ph(o.defaultValue,e,t,r,n);s!==Lp&&(r.default=s)},Vp=(e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=ph(o.defaultValue,e,t,r,n);s!==Lp&&(r._prefault=s)},Fp=(e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{te(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},qp=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;F(s,t,n);let a=t.seen.get(e);a.ref=s},Hp=(e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Bp=(e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},es=(e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Jp=(e,t,r,n)=>{let o=e._zod.innerType;F(o,t,n);let i=t.seen.get(e);i.ref=o},Yi={string:lp,number:pp,boolean:fp,bigint:dp,symbol:mp,null:hp,undefined:gp,void:yp,never:bp,any:_p,unknown:$p,date:wp,enum:xp,literal:zp,nan:vp,template_literal:kp,file:Sp,success:Pp,custom:Ip,function:Tp,transform:Op,map:Ap,set:Rp,array:Cp,object:Np,union:Xi,intersection:Ep,tuple:Zp,record:Dp,nullable:jp,nonoptional:Mp,default:Up,prefault:Vp,catch:Fp,pipe:qp,readonly:Hp,promise:Bp,optional:es,lazy:Jp}});var ts,fh=D(()=>{Nn();An();ts=class{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 r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=ct({processors:Yi,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return F(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,ut(this.ctx,t);let n=lt(this.ctx,t),{"~standard":o,...i}=n;return i}}});var dh={};var mh=D(()=>{});var Ve={};Le(Ve,{$ZodAny:()=>Zu,$ZodArray:()=>Vu,$ZodAsyncError:()=>xe,$ZodBase64:()=>vu,$ZodBase64URL:()=>ku,$ZodBigInt:()=>fi,$ZodBigIntFormat:()=>Ru,$ZodBoolean:()=>pn,$ZodCIDRv4:()=>xu,$ZodCIDRv6:()=>zu,$ZodCUID:()=>lu,$ZodCUID2:()=>pu,$ZodCatch:()=>sl,$ZodCheck:()=>W,$ZodCheckBigIntFormat:()=>Zc,$ZodCheckEndsWith:()=>Kc,$ZodCheckGreaterThan:()=>Ko,$ZodCheckIncludes:()=>Bc,$ZodCheckLengthEquals:()=>Vc,$ZodCheckLessThan:()=>Jo,$ZodCheckLowerCase:()=>qc,$ZodCheckMaxLength:()=>Lc,$ZodCheckMaxSize:()=>Dc,$ZodCheckMimeType:()=>Qc,$ZodCheckMinLength:()=>Uc,$ZodCheckMinSize:()=>jc,$ZodCheckMultipleOf:()=>Nc,$ZodCheckNumberFormat:()=>Ec,$ZodCheckOverwrite:()=>Yc,$ZodCheckProperties:()=>Gc,$ZodCheckProperty:()=>Wc,$ZodCheckRegex:()=>Fc,$ZodCheckSizeEquals:()=>Mc,$ZodCheckStartsWith:()=>Jc,$ZodCheckStringFormat:()=>mr,$ZodCheckUpperCase:()=>Hc,$ZodCodec:()=>dn,$ZodCreditCard:()=>Pu,$ZodCustom:()=>dl,$ZodCustomStringFormat:()=>Ou,$ZodCyclicError:()=>$i,$ZodDate:()=>Lu,$ZodDefault:()=>rl,$ZodDiscriminatedUnion:()=>Hu,$ZodE164:()=>Su,$ZodEmail:()=>ou,$ZodEmoji:()=>cu,$ZodEncodeError:()=>nt,$ZodEnum:()=>Gu,$ZodError:()=>Ja,$ZodExactOptional:()=>el,$ZodFile:()=>Yu,$ZodFunction:()=>pl,$ZodGUID:()=>ru,$ZodIBAN:()=>Iu,$ZodIPv4:()=>_u,$ZodIPv6:()=>$u,$ZodISODate:()=>gu,$ZodISODateTime:()=>hu,$ZodISODuration:()=>bu,$ZodISOTime:()=>yu,$ZodIntersection:()=>Bu,$ZodJWT:()=>Tu,$ZodKSUID:()=>mu,$ZodLazy:()=>mn,$ZodLiteral:()=>Qu,$ZodMAC:()=>wu,$ZodMap:()=>Ku,$ZodNaN:()=>al,$ZodNanoID:()=>uu,$ZodNever:()=>ju,$ZodNonOptional:()=>ol,$ZodNull:()=>Eu,$ZodNullable:()=>tl,$ZodNumber:()=>pi,$ZodNumberFormat:()=>Au,$ZodObject:()=>Cm,$ZodObjectJIT:()=>Fu,$ZodOptional:()=>hi,$ZodPipe:()=>gi,$ZodPrefault:()=>nl,$ZodPreprocess:()=>cl,$ZodPromise:()=>fl,$ZodReadonly:()=>ul,$ZodRealError:()=>ze,$ZodRecord:()=>Ju,$ZodRegistry:()=>vi,$ZodSet:()=>Wu,$ZodString:()=>Pt,$ZodStringFormat:()=>V,$ZodSuccess:()=>il,$ZodSymbol:()=>Cu,$ZodTemplateLiteral:()=>ll,$ZodTransform:()=>Xu,$ZodTuple:()=>mi,$ZodType:()=>O,$ZodULID:()=>fu,$ZodURL:()=>au,$ZodUUID:()=>nu,$ZodUndefined:()=>Nu,$ZodUnion:()=>fn,$ZodUnknown:()=>Du,$ZodVoid:()=>Mu,$ZodXID:()=>du,$ZodXor:()=>qu,$brand:()=>Oo,$constructor:()=>h,$input:()=>Si,$output:()=>ki,Doc:()=>St,INVALID:()=>me,JSONSchema:()=>dh,JSONSchemaGenerator:()=>ts,NEVER:()=>To,TimePrecision:()=>Qi,URL_BAD_FORMAT:()=>iu,URL_UNPARSEABLE:()=>sn,ZodCompileAsyncError:()=>Ae,ZodCompileUnsupportedError:()=>N,_any:()=>Hl,_array:()=>Yl,_base64:()=>Ji,_base64url:()=>Ki,_bigint:()=>jl,_boolean:()=>Zl,_catch:()=>a_,_check:()=>Wm,_cidrv4:()=>Hi,_cidrv6:()=>Bi,_coercedBigint:()=>Ml,_coercedBoolean:()=>Dl,_coercedDate:()=>Gl,_coercedNumber:()=>Ol,_coercedString:()=>kl,_creditCard:()=>Pl,_cuid:()=>ji,_cuid2:()=>Mi,_custom:()=>ep,_date:()=>Wl,_decode:()=>Zo,_decodeAsync:()=>jo,_default:()=>o_,_discriminatedUnion:()=>Bb,_e164:()=>Wi,_email:()=>Oi,_emoji:()=>Zi,_encode:()=>Eo,_encodeAsync:()=>Do,_endsWith:()=>Zt,_enum:()=>Yb,_file:()=>Xl,_float32:()=>Rl,_float64:()=>Cl,_gt:()=>De,_gte:()=>ke,_guid:()=>Ai,_iban:()=>Il,_includes:()=>Nt,_int:()=>Al,_int32:()=>Nl,_int64:()=>Ll,_intersection:()=>Jb,_ipv4:()=>Fi,_ipv6:()=>qi,_isoDate:()=>xn,_isoDateTime:()=>wn,_isoDuration:()=>vn,_isoTime:()=>zn,_jwt:()=>Gi,_ksuid:()=>Vi,_lazy:()=>p_,_length:()=>at,_literal:()=>e_,_lowercase:()=>Rt,_lt:()=>Ze,_lte:()=>ve,_mac:()=>Sl,_map:()=>Gb,_max:()=>ve,_maxLength:()=>st,_maxSize:()=>Ke,_mime:()=>jt,_min:()=>ke,_minLength:()=>Ue,_minSize:()=>je,_multipleOf:()=>Je,_nan:()=>Ql,_nanoid:()=>Di,_nativeEnum:()=>Xb,_negative:()=>Sn,_never:()=>Jl,_nonnegative:()=>In,_nonoptional:()=>i_,_nonpositive:()=>Pn,_normalize:()=>Mt,_null:()=>ql,_nullable:()=>n_,_number:()=>Tl,_optional:()=>r_,_overwrite:()=>Re,_parse:()=>lr,_parseAsync:()=>pr,_pipe:()=>c_,_positive:()=>kn,_promise:()=>f_,_properties:()=>Dt,_property:()=>Tn,_readonly:()=>u_,_record:()=>Wb,_refine:()=>tp,_regex:()=>At,_safeDecode:()=>Lo,_safeDecodeAsync:()=>Vo,_safeEncode:()=>Mo,_safeEncodeAsync:()=>Uo,_safeParse:()=>fr,_safeParseAsync:()=>dr,_set:()=>Qb,_size:()=>it,_slugify:()=>Ft,_startsWith:()=>Et,_string:()=>vl,_stringFormat:()=>qt,_stringbool:()=>ip,_success:()=>s_,_superRefine:()=>rp,_symbol:()=>Vl,_templateLiteral:()=>l_,_toLowerCase:()=>Ut,_toUpperCase:()=>Vt,_transform:()=>t_,_trim:()=>Lt,_tuple:()=>Kb,_uint32:()=>El,_uint64:()=>Ul,_ulid:()=>Li,_undefined:()=>Fl,_union:()=>qb,_unknown:()=>Bl,_uppercase:()=>Ct,_url:()=>$n,_uuid:()=>Ri,_uuidv4:()=>Ci,_uuidv6:()=>Ni,_uuidv7:()=>Ei,_void:()=>Kl,_xid:()=>Ui,_xor:()=>Hb,base64Charset:()=>si,base64urlCharset:()=>ln,canParseURL:()=>su,clone:()=>L,compile:()=>Pi,compileFn:()=>Ii,config:()=>Y,createStandardJSONSchemaMethod:()=>wr,createToJSONSchemaMethod:()=>ap,decode:()=>om,decodeAsync:()=>sm,describe:()=>np,encode:()=>nm,encodeAsync:()=>im,extractDefs:()=>ut,finalize:()=>lt,flattenError:()=>cr,formatError:()=>ur,getDiscriminatedOption:()=>di,globalConfig:()=>oe,globalRegistry:()=>ie,handleUnrepresentable:()=>te,initializeContext:()=>ct,isBackEdge:()=>xi,isRecursiveSchema:()=>wi,isValidBase64:()=>un,isValidBase64URL:()=>ai,isValidCIDRv6:()=>ii,isValidCreditCard:()=>ci,isValidIBAN:()=>ui,isValidIPv6:()=>cn,isValidJWT:()=>li,locales:()=>_r,memoizer:()=>br,mergeValues:()=>hr,meta:()=>op,parse:()=>Xr,parseAsync:()=>en,parseURLObject:()=>Om,prettifyError:()=>Ro,process:()=>F,processSchema:()=>F,regexes:()=>Pe,registry:()=>yn,safeDecode:()=>cm,safeDecodeAsync:()=>lm,safeEncode:()=>am,safeEncodeAsync:()=>um,safeParse:()=>No,safeParseAsync:()=>Wa,standardProps:()=>ti,stripTabAndNewline:()=>an,toDotPath:()=>tm,toJSONSchema:()=>Cn,toZod:()=>tr,treeifyError:()=>Ao,urlHostnameOk:()=>ni,urlProtocolOk:()=>oi,util:()=>v,validate:()=>xt,validateAsync:()=>zt,validateURL:()=>ri,version:()=>Xc,withParser:()=>_n});var Se=D(()=>{rt();Ga();Ka();gr();gl();Wo();eu();ee();ee();kt();bl();bn();Go();Km();Gm();An();Nn();fh();mh()});function En(e,t){let r=typeof t=="function"?t:(s,a)=>{let c=t[s._zod.def.type];return c?c(s,a):s},n=new Map;function o(s){let a=n.get(s);if(a===hh)return new mn({type:"lazy",getter:()=>n.get(s)});if(a!==void 0)return a;n.set(s,hh);let c=i(s),u=r(c,c!==s);return n.set(s,u),u}function i(s){let a=s._zod.def,c=a.type;switch(c){case"object":{let u=a.shape,l=Object.keys(u),f=!1,d={};for(let g of l){let b=o(u[g]);b!==u[g]&&(f=!0),d[g]=b}let m=a.catchall;return a.catchall&&(m=o(a.catchall),m!==a.catchall&&(f=!0)),f?L(s,{...a,shape:d,catchall:m}):s}case"array":{let u=o(a.element);return u===a.element?s:L(s,{...a,element:u})}case"tuple":{let u=a.items,l=!1,f=[];for(let m of u){let g=o(m);g!==m&&(l=!0),f.push(g)}let d=a.rest;return a.rest&&(d=o(a.rest),d!==a.rest&&(l=!0)),l?L(s,{...a,items:f,rest:d}):s}case"record":case"map":{let u=o(a.keyType),l=o(a.valueType);return u===a.keyType&&l===a.valueType?s:L(s,{...a,keyType:u,valueType:l})}case"set":{let u=o(a.valueType);return u===a.valueType?s:L(s,{...a,valueType:u})}case"union":{let u=a.options,l=!1,f=[];for(let d of u){let m=o(d);m!==d&&(l=!0),f.push(m)}return l?L(s,{...a,options:f}):s}case"intersection":{let u=o(a.left),l=o(a.right);return u===a.left&&l===a.right?s:L(s,{...a,left:u,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let u=o(a.innerType);return u===a.innerType?s:L(s,{...a,innerType:u})}case"pipe":{let u=o(a.in),l=o(a.out);return u===a.in&&l===a.out?s:L(s,{...a,in:u,out:l})}case"function":{let u=o(a.input),l=o(a.output);return u===a.input&&l===a.output?s:L(s,{...a,input:u,output:l})}case"lazy":{let u=a.getter,{_cachedInner:l,...f}=a;return L(s,{...f,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)}var hh,Kp=D(()=>{gr();ee();hh=Symbol("z.visit/resolving")});var os={};Le(os,{endsWith:()=>Zt,gt:()=>De,gte:()=>ke,includes:()=>Nt,length:()=>at,lowercase:()=>Rt,lt:()=>Ze,lte:()=>ve,maxLength:()=>st,maxSize:()=>Ke,mime:()=>jt,minLength:()=>Ue,minSize:()=>je,multipleOf:()=>Je,negative:()=>Sn,nonnegative:()=>In,nonpositive:()=>Pn,normalize:()=>Mt,overwrite:()=>Re,positive:()=>kn,properties:()=>Dt,property:()=>Tn,regex:()=>At,size:()=>it,slugify:()=>Ft,startsWith:()=>Et,toLowerCase:()=>Ut,toUpperCase:()=>Vt,trim:()=>Lt,uppercase:()=>Ct});var is=D(()=>{Se()});function ss(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var bh,_h,$h,be,Wp=D(()=>{Se();Se();ee();bh=new WeakSet([Object.prototype,Error.prototype]);_h=(e,t)=>{Ja.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);bh.has(r)||(bh.add(r),ss(r,"format",n=>o=>ur(n,o)),ss(r,"flatten",n=>o=>cr(n,o)),ss(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,nr,2)}),ss(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,nr,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},$h=h("ZodError",_h),be=h("ZodError",_h,void 0,{Parent:Error})});var as,cs,us,ls,ps,fs,ds,ms,hs,gs,ys,bs,Gp=D(()=>{Se();Wp();Se();as=lr(be),cs=pr(be),us=fr(be),ls=dr(be),ps=Eo(be),fs=Zo(be),ds=Do(be),ms=jo(be),hs=Mo(be),gs=Lo(be),ys=Uo(be),bs=Vo(be)});var Zr={};Le(Zr,{ZodAny:()=>ks,ZodArray:()=>Ts,ZodBase64:()=>Yn,ZodBase64URL:()=>Xn,ZodBigInt:()=>Qt,ZodBigIntFormat:()=>ro,ZodBoolean:()=>Gt,ZodCIDRv4:()=>Gn,ZodCIDRv6:()=>Qn,ZodCUID:()=>Fn,ZodCUID2:()=>qn,ZodCatch:()=>Ks,ZodCodec:()=>Cr,ZodCreditCard:()=>$s,ZodCustom:()=>Nr,ZodCustomStringFormat:()=>pt,ZodDate:()=>Pr,ZodDefault:()=>Vs,ZodDiscriminatedUnion:()=>As,ZodE164:()=>eo,ZodEmail:()=>Mn,ZodEmoji:()=>Un,ZodEnum:()=>Bt,ZodExactOptional:()=>io,ZodFile:()=>js,ZodFunction:()=>oa,ZodGUID:()=>Ln,ZodIBAN:()=>ws,ZodIPv4:()=>Kn,ZodIPv6:()=>Wn,ZodISODate:()=>Ge,ZodISODateTime:()=>We,ZodISODuration:()=>Ye,ZodISOTime:()=>Qe,ZodInstanceOf:()=>aa,ZodIntersection:()=>Rs,ZodJWT:()=>to,ZodKSUID:()=>Jn,ZodLazy:()=>ta,ZodLiteral:()=>Ds,ZodMAC:()=>_s,ZodMap:()=>Es,ZodNaN:()=>Gs,ZodNanoID:()=>Vn,ZodNever:()=>Ps,ZodNonOptional:()=>so,ZodNull:()=>vs,ZodNullable:()=>Us,ZodNumber:()=>Wt,ZodNumberFormat:()=>ft,ZodObject:()=>Ir,ZodOptional:()=>Ar,ZodPipe:()=>Rr,ZodPrefault:()=>qs,ZodPreprocess:()=>Qs,ZodPromise:()=>na,ZodReadonly:()=>Ys,ZodRecord:()=>Ht,ZodSet:()=>Zs,ZodString:()=>Kt,ZodStringFormat:()=>H,ZodSuccess:()=>Js,ZodSymbol:()=>xs,ZodTemplateLiteral:()=>ea,ZodTransform:()=>Ms,ZodTuple:()=>Cs,ZodType:()=>A,ZodULID:()=>Hn,ZodURL:()=>kr,ZodUUID:()=>Me,ZodUndefined:()=>zs,ZodUnion:()=>Tr,ZodUnknown:()=>Ss,ZodVoid:()=>Is,ZodXID:()=>Bn,ZodXor:()=>Os,_ZodString:()=>jn,_default:()=>Fs,_function:()=>nd,any:()=>jf,array:()=>C,base64:()=>bf,base64url:()=>_f,bigint:()=>Cf,boolean:()=>X,catch:()=>Ws,check:()=>od,cidrv4:()=>gf,cidrv6:()=>yf,codec:()=>Xf,creditCard:()=>wf,cuid:()=>cf,cuid2:()=>uf,currencyCode:()=>Pf,custom:()=>ao,date:()=>Lf,describe:()=>id,discriminatedUnion:()=>Or,e164:()=>$f,email:()=>Qp,emoji:()=>sf,enum:()=>ae,exactOptional:()=>Ls,file:()=>Wf,float32:()=>Tf,float64:()=>Of,function:()=>nd,guid:()=>Yp,hash:()=>If,hex:()=>Sf,hostname:()=>kf,httpUrl:()=>of,iban:()=>xf,instanceof:()=>ad,int:()=>Zn,int32:()=>Af,int64:()=>Nf,intersection:()=>Yt,invertCodec:()=>ed,ipv4:()=>df,ipv6:()=>hf,json:()=>ud,jwt:()=>zf,keyof:()=>Uf,ksuid:()=>ff,lazy:()=>ra,literal:()=>k,looseObject:()=>se,looseRecord:()=>Hf,mac:()=>mf,map:()=>Bf,meta:()=>sd,nan:()=>Yf,nanoid:()=>af,nativeEnum:()=>Kf,never:()=>no,nonoptional:()=>Bs,null:()=>Sr,nullable:()=>vr,nullish:()=>Gf,number:()=>j,object:()=>z,optional:()=>q,partialRecord:()=>qf,pipe:()=>Dn,prefault:()=>Hs,preprocess:()=>Er,promise:()=>rd,readonly:()=>Xs,record:()=>B,refine:()=>ia,set:()=>Jf,strictObject:()=>Vf,string:()=>y,stringFormat:()=>vf,stringbool:()=>cd,success:()=>Qf,superRefine:()=>sa,symbol:()=>Zf,templateLiteral:()=>td,transform:()=>oo,tuple:()=>Ns,uint32:()=>Rf,uint64:()=>Ef,ulid:()=>lf,undefined:()=>Df,union:()=>U,unknown:()=>K,url:()=>nf,uuid:()=>Xp,uuidv4:()=>ef,uuidv6:()=>tf,uuidv7:()=>rf,void:()=>Mf,xid:()=>pf,xor:()=>Ff});function $_(){oe.localeError||Y(zi())}function Jt(){oe.memoizer||Y({memoizer:br()})}function y(e){return vl(Kt,e)}function Qp(e){return Oi(Mn,e)}function Yp(e){return Ai(Ln,e)}function Xp(e){return Ri(Me,e)}function ef(e){return Ci(Me,e)}function tf(e){return Ni(Me,e)}function rf(e){return Ei(Me,e)}function nf(e){return $n(kr,e)}function of(e){return $n(kr,{protocol:tn,hostname:yc,...v.normalizeParams(e)})}function sf(e){return Zi(Un,e)}function af(e){return Di(Vn,e)}function cf(e){return ji(Fn,e)}function uf(e){return Mi(qn,e)}function lf(e){return Li(Hn,e)}function pf(e){return Ui(Bn,e)}function ff(e){return Vi(Jn,e)}function df(e){return Fi(Kn,e)}function mf(e){return Sl(_s,e)}function hf(e){return qi(Wn,e)}function gf(e){return Hi(Gn,e)}function yf(e){return Bi(Qn,e)}function bf(e){return Ji(Yn,e)}function _f(e){return Ki(Xn,e)}function $f(e){return Wi(eo,e)}function wf(e){return Pl($s,e)}function xf(e){return Il(ws,e)}function zf(e){return Gi(to,e)}function vf(e,t,r={}){return qt(pt,e,t,r)}function kf(e){return qt(pt,"hostname",gc,e)}function Sf(e){return qt(pt,"hex",Ac,e)}function Pf(e){return qt(pt,"currency_code",_c,e)}function If(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=Pe[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return qt(pt,n,o,t)}function j(e){return Tl(Wt,e)}function Zn(e){return Al(ft,e)}function Tf(e){return Rl(ft,e)}function Of(e){return Cl(ft,e)}function Af(e){return Nl(ft,e)}function Rf(e){return El(ft,e)}function X(e){return Zl(Gt,e)}function Cf(e){return jl(Qt,e)}function Nf(e){return Ll(ro,e)}function Ef(e){return Ul(ro,e)}function Zf(e){return Vl(xs,e)}function Df(e){return Fl(zs,e)}function Sr(e){return ql(vs,e)}function jf(){return Hl(ks)}function K(){return Bl(Ss)}function no(e){return Jl(Ps,e)}function Mf(e){return Kl(Is,e)}function Lf(e){return Wl(Pr,e)}function C(e,t){return Yl(Ts,e,t)}function Uf(e){let t=e._zod.def.shape;return ae(Object.keys(t))}function z(e,t){let r={type:"object",shape:e??{},...v.normalizeParams(t)};return new Ir(r)}function Vf(e,t){return new Ir({type:"object",shape:e,catchall:no(),...v.normalizeParams(t)})}function se(e,t){return new Ir({type:"object",shape:e,catchall:K(),...v.normalizeParams(t)})}function U(e,t){return new Tr({type:"union",options:e,...v.normalizeParams(t)})}function Ff(e,t){return new Os({type:"union",options:e,inclusive:!1,...v.normalizeParams(t)})}function Or(e,t,r){return new As({type:"union",options:t,discriminator:e,...v.normalizeParams(r)})}function Yt(e,t){return new Rs({type:"intersection",left:e,right:t})}function Ns(e,t,r){let n=t instanceof O,o=n?r:t,i=n?t:null;return new Cs({type:"tuple",items:e,rest:i,...v.normalizeParams(o)})}function B(e,t,r){return!t||!t._zod?new Ht({type:"record",keyType:y(),valueType:e,...v.normalizeParams(t)}):new Ht({type:"record",keyType:e,valueType:t,...v.normalizeParams(r)})}function qf(e,t,r){return new Ht({type:"record",keyType:e,valueType:t,...v.normalizeParams(r),partial:!0})}function Hf(e,t,r){return new Ht({type:"record",keyType:e,valueType:t,mode:"loose",...v.normalizeParams(r)})}function Bf(e,t,r){return new Es({type:"map",keyType:e,valueType:t,...v.normalizeParams(r)})}function Jf(e,t){return new Zs({type:"set",valueType:e,...v.normalizeParams(t)})}function ae(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Bt({type:"enum",entries:r,...v.normalizeParams(t)})}function Kf(e,t){return new Bt({type:"enum",entries:e,...v.normalizeParams(t)})}function k(e,t){return new Ds({type:"literal",values:Array.isArray(e)?e:[e],...v.normalizeParams(t)})}function Wf(e){return Xl(js,e)}function oo(e){return new Ms({type:"transform",transform:e})}function q(e){return new Ar({type:"optional",innerType:e})}function Ls(e){return new io({type:"optional",innerType:e})}function vr(e){return new Us({type:"nullable",innerType:e})}function Gf(e){return q(vr(e))}function Fs(e,t){return new Vs({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():v.shallowClone(t)}})}function Hs(e,t){return new qs({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():v.shallowClone(t)}})}function Bs(e,t){return new so({type:"nonoptional",innerType:e,...v.normalizeParams(t)})}function Qf(e){return new Js({type:"success",innerType:e})}function Ws(e,t){return new Ks({type:"catch",innerType:e,catchValue:typeof t=="function"?t:v.constantCatch(t)})}function Yf(e){return Ql(Gs,e)}function Dn(e,t){return new Rr({type:"pipe",in:e,out:t})}function Xf(e,t,r){return new Cr({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function ed(e){let t=e._zod.def;return new Cr({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}function Xs(e){return new Ys({type:"readonly",innerType:e})}function td(e,t){return new ea({type:"template_literal",parts:e,...v.normalizeParams(t)})}function ra(e){return new ta({type:"lazy",getter:e})}function rd(e){return new na({type:"promise",innerType:e})}function nd(e){return new oa({type:"function",input:Array.isArray(e?.input)?Ns(e?.input):e?.input??C(K()),output:e?.output??K()})}function od(e){let t=new W({check:"custom"});return t._zod.check=e,t}function ao(e,t){return ep(Nr,e??(()=>!0),t)}function ia(e,t={}){return tp(Nr,e,t)}function sa(e,t){return rp(e,t)}function ad(e,t={}){let r=new aa({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...v.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}function ud(e){let t=ra(()=>U([y(e),j(),X(),Sr(),C(t),B(y(),t)]));return t}function Er(e,t){return new Qs({type:"pipe",in:oo(e),out:t})}var A,jn,Kt,H,We,Ge,Qe,Ye,Mn,Ln,Me,kr,Un,Vn,Fn,qn,Hn,Bn,Jn,Kn,_s,Wn,Gn,Qn,Yn,Xn,eo,$s,ws,to,pt,Wt,ft,Gt,Qt,ro,xs,zs,vs,ks,Ss,Ps,Is,Pr,Ts,Ir,Tr,Os,As,Rs,Cs,Ht,Es,Zs,Bt,Ds,js,Ms,Ar,io,Us,Vs,qs,so,Js,Ks,Gs,Rr,Cr,Qs,Ys,ea,ta,na,oa,Nr,id,sd,aa,cd,dt=D(()=>{Se();Se();Nn();kt();An();yl();is();Gp();A=h("ZodType",(e,t)=>($_(),O.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(v.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return L(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(ia(e,t))},superRefine(e,t){return this.check(sa(e,t))},overwrite(e){return this.check(Re(e))},optional(){return q(this)},exactOptional(){return Ls(this)},nullable(){return vr(this)},nullish(){return q(vr(this))},nonoptional(e){return Bs(this,e)},array(){return C(this)},or(e){return U([this,e])},and(e){return Yt(this,e)},transform(e){return Dn(this,oo(e))},default(e){return Fs(this,e)},prefault(e){return Hs(this,e)},catch(e){return Ws(this,e)},pipe(e){return Dn(this,e)},readonly(){return Xs(this)},describe(e){let t=this.clone();return ie.add(t,{description:e}),t},meta(...e){if(e.length===0)return ie.get(this);let t=this.clone();return ie.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 v.hide(this,"~standard",{...ti(this),jsonSchema:{input:wr(this,"input"),output:wr(this,"output")}})},set"~standard"(e){v.own(this,"~standard",e)},parse:function e(t,r){return as(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await cs(this,t,r,{callee:e})},safeParse(e,t){return us(this,e,t)},async safeParseAsync(e,t){return ls(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){v.own(this,"spa",e)},validate(e,t){return xt(this,e,t)},validateAsync(e,t){return zt(this,e,t)},encode:function e(t,r){return ps(this,t,r,{callee:e})},decode:function e(t,r){return fs(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await ds(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await ms(this,t,r,{callee:e})},safeEncode(e,t){return hs(this,e,t)},safeDecode(e,t){return gs(this,e,t)},async safeEncodeAsync(e,t){return ys(this,e,t)},async safeDecodeAsync(e,t){return bs(this,e,t)},toJSONSchema(e){return ap(this,{})(e)},get description(){return ie.get(this)?.description},get _def(){return this._zod.def}}),jn=h("_ZodString",(e,t)=>{Pt.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lp(e,r,n,o)},v.derived({format:e=>re(e).format??null,minLength:e=>re(e).minimum??null,maxLength:e=>re(e).maximum??null},{regex(...e){return this.check(At(...e))},includes(...e){return this.check(Nt(...e))},startsWith(...e){return this.check(Et(...e))},endsWith(...e){return this.check(Zt(...e))},min(...e){return this.check(Ue(...e))},max(...e){return this.check(st(...e))},length(...e){return this.check(at(...e))},nonempty(...e){return this.check(Ue(1,...e))},lowercase(e){return this.check(Rt(e))},uppercase(e){return this.check(Ct(e))},trim(){return this.check(Lt())},normalize(...e){return this.check(Mt(...e))},toLowerCase(){return this.check(Ut())},toUpperCase(){return this.check(Vt())},slugify(){return this.check(Ft())}})),Kt=h("ZodString",(e,t)=>{Pt.init(e,t),jn.init(e,t)},{email(e){return this.check(Oi(Mn,e))},url(e){return this.check($n(kr,e))},jwt(e){return this.check(Gi(to,e))},emoji(e){return this.check(Zi(Un,e))},guid(e){return this.check(Ai(Ln,e))},uuid(e){return this.check(Ri(Me,e))},uuidv4(e){return this.check(Ci(Me,e))},uuidv6(e){return this.check(Ni(Me,e))},uuidv7(e){return this.check(Ei(Me,e))},nanoid(e){return this.check(Di(Vn,e))},cuid(e){return this.check(ji(Fn,e))},cuid2(e){return this.check(Mi(qn,e))},ulid(e){return this.check(Li(Hn,e))},base64(e){return this.check(Ji(Yn,e))},base64url(e){return this.check(Ki(Xn,e))},xid(e){return this.check(Ui(Bn,e))},ksuid(e){return this.check(Vi(Jn,e))},ipv4(e){return this.check(Fi(Kn,e))},ipv6(e){return this.check(qi(Wn,e))},cidrv4(e){return this.check(Hi(Gn,e))},cidrv6(e){return this.check(Bi(Qn,e))},e164(e){return this.check(Wi(eo,e))},datetime(e){return this.check(wn(We,e))},date(e){return this.check(xn(Ge,e))},time(e){return this.check(zn(Qe,e))},duration(e){return this.check(vn(Ye,e))}});H=h("ZodStringFormat",(e,t)=>{V.init(e,t),jn.init(e,t)}),We=h("ZodISODateTime",(e,t)=>{hu.init(e,t),H.init(e,t)}),Ge=h("ZodISODate",(e,t)=>{gu.init(e,t),H.init(e,t)}),Qe=h("ZodISOTime",(e,t)=>{yu.init(e,t),H.init(e,t)}),Ye=h("ZodISODuration",(e,t)=>{bu.init(e,t),H.init(e,t)}),Mn=h("ZodEmail",(e,t)=>{ou.init(e,t),H.init(e,t)});Ln=h("ZodGUID",(e,t)=>{ru.init(e,t),H.init(e,t)});Me=h("ZodUUID",(e,t)=>{nu.init(e,t),H.init(e,t)});kr=h("ZodURL",(e,t)=>{au.init(e,t),H.init(e,t)});Un=h("ZodEmoji",(e,t)=>{cu.init(e,t),H.init(e,t)});Vn=h("ZodNanoID",(e,t)=>{uu.init(e,t),H.init(e,t)});Fn=h("ZodCUID",(e,t)=>{lu.init(e,t),H.init(e,t)});qn=h("ZodCUID2",(e,t)=>{pu.init(e,t),H.init(e,t)});Hn=h("ZodULID",(e,t)=>{fu.init(e,t),H.init(e,t)});Bn=h("ZodXID",(e,t)=>{du.init(e,t),H.init(e,t)});Jn=h("ZodKSUID",(e,t)=>{mu.init(e,t),H.init(e,t)});Kn=h("ZodIPv4",(e,t)=>{_u.init(e,t),H.init(e,t)});_s=h("ZodMAC",(e,t)=>{wu.init(e,t),H.init(e,t)});Wn=h("ZodIPv6",(e,t)=>{$u.init(e,t),H.init(e,t)});Gn=h("ZodCIDRv4",(e,t)=>{xu.init(e,t),H.init(e,t)});Qn=h("ZodCIDRv6",(e,t)=>{zu.init(e,t),H.init(e,t)});Yn=h("ZodBase64",(e,t)=>{vu.init(e,t),H.init(e,t)});Xn=h("ZodBase64URL",(e,t)=>{ku.init(e,t),H.init(e,t)});eo=h("ZodE164",(e,t)=>{Su.init(e,t),H.init(e,t)});$s=h("ZodCreditCard",(e,t)=>{Pu.init(e,t),H.init(e,t)});ws=h("ZodIBAN",(e,t)=>{Iu.init(e,t),H.init(e,t)});to=h("ZodJWT",(e,t)=>{Tu.init(e,t),H.init(e,t)});pt=h("ZodCustomStringFormat",(e,t)=>{Ou.init(e,t),H.init(e,t)});Wt=h("ZodNumber",(e,t)=>{pi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pp(e,r,n,o),e.isFinite=!0},v.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=re(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=re(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=re(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>re(e).format??null},{gt(e,t){return this.check(De(e,t))},gte(e,t){return this.check(ke(e,t))},min(e,t){return this.check(ke(e,t))},lt(e,t){return this.check(Ze(e,t))},lte(e,t){return this.check(ve(e,t))},max(e,t){return this.check(ve(e,t))},int(e){return this.check(Zn(e))},safe(e){return this.check(Zn(e))},positive(e){return this.check(De(0,e))},nonnegative(e){return this.check(ke(0,e))},negative(e){return this.check(Ze(0,e))},nonpositive(e){return this.check(ve(0,e))},multipleOf(e,t){return this.check(Je(e,t))},step(e,t){return this.check(Je(e,t))},finite(){return this}}));ft=h("ZodNumberFormat",(e,t)=>{Au.init(e,t),Wt.init(e,t)});Gt=h("ZodBoolean",(e,t)=>{pn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fp(e,r,n,o)});Qt=h("ZodBigInt",(e,t)=>{fi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dp(e,r,n,o)},v.derived({minValue:e=>re(e).minimum??null,maxValue:e=>re(e).maximum??null,format:e=>re(e).format??null},{gte(e,t){return this.check(ke(e,t))},min(e,t){return this.check(ke(e,t))},gt(e,t){return this.check(De(e,t))},lt(e,t){return this.check(Ze(e,t))},lte(e,t){return this.check(ve(e,t))},max(e,t){return this.check(ve(e,t))},positive(e){return this.check(De(BigInt(0),e))},negative(e){return this.check(Ze(BigInt(0),e))},nonpositive(e){return this.check(ve(BigInt(0),e))},nonnegative(e){return this.check(ke(BigInt(0),e))},multipleOf(e,t){return this.check(Je(e,t))}}));ro=h("ZodBigIntFormat",(e,t)=>{Ru.init(e,t),Qt.init(e,t)});xs=h("ZodSymbol",(e,t)=>{Cu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mp(e,r,n,o)});zs=h("ZodUndefined",(e,t)=>{Nu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gp(e,r,n,o)});vs=h("ZodNull",(e,t)=>{Eu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hp(e,r,n,o)});ks=h("ZodAny",(e,t)=>{Zu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_p(e,r,n,o)});Ss=h("ZodUnknown",(e,t)=>{Du.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$p(e,r,n,o)});Ps=h("ZodNever",(e,t)=>{ju.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bp(e,r,n,o)});Is=h("ZodVoid",(e,t)=>{Mu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yp(e,r,n,o)});Pr=h("ZodDate",(e,t)=>{Lu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wp(e,r,n,o),e.min=(r,n)=>e.check(ke(r,n)),e.max=(r,n)=>e.check(ve(r,n))},v.derived({minDate:e=>{let{minimum:t}=re(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=re(e);return t?new Date(t):null}},{}));Ts=h("ZodArray",(e,t)=>{Jt(),Vu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cp(e,r,n,o),e.element=t.element},{min(e,t){return this.check(Ue(e,t))},nonempty(e){return this.check(Ue(1,e))},max(e,t){return this.check(st(e,t))},length(e,t){return this.check(at(e,t))},unwrap(){return this.element}});Ir=h("ZodObject",(e,t)=>{Jt(),Fu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Np(e,r,n,o),v.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return ae(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(v.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(v.mergeDefs(this._zod.def,{catchall:K()}))},loose(){return this.clone(v.mergeDefs(this._zod.def,{catchall:K()}))},strict(){return this.clone(v.mergeDefs(this._zod.def,{catchall:no()}))},strip(){return this.clone(v.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return v.extend(this,e)},safeExtend(e){return v.safeExtend(this,e)},merge(e){return v.merge(this,e)},pick(e){return v.pick(this,e)},omit(e){return v.omit(this,e)},partial(...e){return v.partial(Ar,this,e[0])},exactPartial(...e){return v.partial(io,this,e[0],"exactPartial")},required(...e){return v.required(so,this,e[0])}});Tr=h("ZodUnion",(e,t)=>{fn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xi(e,r,n,o),e.options=t.options});Os=h("ZodXor",(e,t)=>{Tr.init(e,t),qu.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xi(e,r,n,o),e.options=t.options});As=h("ZodDiscriminatedUnion",(e,t)=>{Tr.init(e,t),Hu.init(e,t)});Rs=h("ZodIntersection",(e,t)=>{Bu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ep(e,r,n,o)});Cs=h("ZodTuple",(e,t)=>{Jt(),mi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zp(e,r,n,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let 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 Ar({type:"optional",innerType:t}))})}});Ht=h("ZodRecord",(e,t)=>{Jt(),Ju.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dp(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});Es=h("ZodMap",(e,t)=>{Jt(),Ku.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ap(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(je(...r)),e.nonempty=r=>e.check(je(1,r)),e.max=(...r)=>e.check(Ke(...r)),e.size=(...r)=>e.check(it(...r))});Zs=h("ZodSet",(e,t)=>{Jt(),Wu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rp(e,r,n,o),e.min=(...r)=>e.check(je(...r)),e.nonempty=r=>e.check(je(1,r)),e.max=(...r)=>e.check(Ke(...r)),e.size=(...r)=>e.check(it(...r))});Bt=h("ZodEnum",(e,t)=>{Gu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(n,o,i)=>xp(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Bt({...t,checks:[],...v.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Bt({...t,checks:[],...v.normalizeParams(o),entries:i})}});Ds=h("ZodLiteral",(e,t)=>{Qu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zp(e,r,n,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]}})});js=h("ZodFile",(e,t)=>{Yu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sp(e,r,n,o),e.min=(r,n)=>e.check(je(r,n)),e.max=(r,n)=>e.check(Ke(r,n)),e.mime=(r,n)=>e.check(jt(Array.isArray(r)?r:[r],n))});Ms=h("ZodTransform",(e,t)=>{Jt(),Xu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Op(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new nt(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(v.issue(i,r.value,t));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=r.value),s.inst??(s.inst=e),r.issues.push(v.issue(s))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});Ar=h("ZodOptional",(e,t)=>{hi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>es(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});io=h("ZodExactOptional",(e,t)=>{el.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>es(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});Us=h("ZodNullable",(e,t)=>{tl.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});Vs=h("ZodDefault",(e,t)=>{rl.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Up(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});qs=h("ZodPrefault",(e,t)=>{nl.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});so=h("ZodNonOptional",(e,t)=>{ol.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});Js=h("ZodSuccess",(e,t)=>{il.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});Ks=h("ZodCatch",(e,t)=>{sl.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});Gs=h("ZodNaN",(e,t)=>{al.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vp(e,r,n,o)});Rr=h("ZodPipe",(e,t)=>{gi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qp(e,r,n,o),e.in=t.in,e.out=t.out});Cr=h("ZodCodec",(e,t)=>{Rr.init(e,t),dn.init(e,t)});Qs=h("ZodPreprocess",(e,t)=>{Rr.init(e,t),cl.init(e,t)}),Ys=h("ZodReadonly",(e,t)=>{ul.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});ea=h("ZodTemplateLiteral",(e,t)=>{ll.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kp(e,r,n,o)});ta=h("ZodLazy",(e,t)=>{mn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jp(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});na=h("ZodPromise",(e,t)=>{fl.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});oa=h("ZodFunction",(e,t)=>{pl.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Tp(e,r,n,o)});Nr=h("ZodCustom",(e,t)=>{dl.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ip(e,r,n,o)});id=np,sd=op,aa=h("ZodInstanceOf",(e,t)=>{Nr.init(e,t)},{properties(e,t){return this.check(Dt(e,t))}});cd=(...e)=>ip({Codec:Cr,Boolean:Gt,String:Kt},...e)});function xh(e){Y({customError:e})}function zh(){return Y().customError}var wh,ca,vh=D(()=>{Se();wh={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"};ca||(ca={})});var mt={};Le(mt,{ZodISODate:()=>Ge,ZodISODateTime:()=>We,ZodISODuration:()=>Ye,ZodISOTime:()=>Qe,date:()=>x_,datetime:()=>w_,duration:()=>v_,time:()=>z_});function w_(e){return wn(We,e)}function x_(e){return xn(Ge,e)}function z_(e){return zn(Qe,e)}function v_(e){return vn(Ye,e)}var ua=D(()=>{Se();dt();dt()});function S_(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function kh(e,t){return e.map((r,n)=>n<t?r:r.optional())}function P_(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function I_(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let n=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===n){let o=r[1]===void 0?void 0:P_(r[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 T_(e,t){return x.transform(n=>n).check(n=>{let o=n.value;if(typeof o!="object"||o===null||Array.isArray(o))return;let i=Object.getOwnPropertyNames(o);if(t.minProperties!==void 0&&i.length<t.minProperties&&n.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&&n.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(let s of i){let a=t.keySchema.safeParse(s);a.success||n.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:s,path:[s],continue:!0})}}).pipe(e)}function ld(e,t){if(e===null)return"z";let r=typeof e;if(r!=="object"){if(r==="number"&&Number.isNaN(e))return null;let n=String(e);return`${r[0]}${n.length}:${n}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let i=[];for(let s of e){let a=ld(s,t);if(a===null)return null;i.push(a)}return`a${i.length}:[${i.join(",")}]`}let n=Object.keys(e).sort(),o=[];for(let i of n){let s=ld(e[i],t);if(s===null)return null;o.push(`${i.length}:${i}=${s}`)}return`o${o.length}:{${o.join(",")}}`}finally{t.delete(e)}}function co(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(co):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,r])=>O_.has(t)?co(r):!A_.has(t)||typeof r!="object"||r===null?!1:Object.values(r).some(co))}function Sh(e){return e===1?"element":"elements"}function R_(e,t){return x.transform(n=>n).check(n=>{let o=n.value;if(Array.isArray(o)){if(t.uniqueItems===!0){let i=new Map;for(let s=0;s<o.length;s++){let a=ld(o[s],new Set);if(a===null)continue;let c=i.get(a);if(c===void 0){i.set(a,s);continue}n.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){let i=t.minContains??1,s=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let c of o)if(t.containsSchema.safeParse(c).success&&++a>=s)break;a<i&&n.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${Sh(i)}; found ${a}`,input:o,continue:!0}),t.maxContains!==void 0&&a>t.maxContains&&n.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${Sh(t.maxContains)}`,input:o,continue:!0})}}}).pipe(e)}function Ph(e,t){if(e!==!1)return e===void 0||e===!0?x.any():_e(e,t)}function Ih(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return x.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){let o=e.$ref;if(t.refs.has(o))return t.refs.get(o);if(t.processing.has(o))return x.lazy(()=>{if(!t.refs.has(o))throw new Error(`Circular reference not resolved: ${o}`);return t.refs.get(o)});t.processing.add(o);let i=I_(o,t),s=_e(i,t);return t.refs.set(o,s),t.processing.delete(o),s}if(e.enum!==void 0){let o=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&o.length===1&&o[0]===null)return x.null();if(o.length===0)return x.never();if(o.length===1)return x.literal(o[0]);if(o.every(s=>typeof s=="string"))return x.enum(o);let i=o.map(s=>x.literal(s));return i.length<2?i[0]:x.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return x.literal(e.const);let r=e.type;if(Array.isArray(r)){let o=r.map(i=>{let s={...e,type:i};return Ih(s,t)});return o.length===0?x.never():o.length===1?o[0]:x.union(o)}if(!r)return x.any();let n;switch(r){case"string":{let o=x.string();if(e.format){let i=e.format;i==="email"?o=o.check(x.email()):i==="uri"||i==="uri-reference"?o=o.check(x.url()):i==="uuid"||i==="guid"?o=o.check(x.uuid()):i==="date-time"?o=o.check(x.iso.datetime({offset:!0})):i==="date"?o=o.check(x.iso.date()):i==="time"?o=o.check(x.regex(C_)):i==="duration"?o=o.check(x.iso.duration()):i==="hostname"?o=o.check(x.hostname()):i==="ipv4"?o=o.check(x.ipv4()):i==="ipv6"?o=o.check(x.ipv6()):i==="mac"?o=o.check(x.mac()):i==="cidr"?o=o.check(x.cidrv4()):i==="cidr-v6"?o=o.check(x.cidrv6()):i==="base64"?o=o.check(x.base64()):i==="base64url"?o=o.check(x.base64url()):i==="e164"?o=o.check(x.e164()):i==="credit_card"?o=o.check(x.creditCard()):i==="iban"?o=o.check(x.iban()):i==="jwt"?o=o.check(x.jwt()):i==="emoji"?o=o.check(x.emoji()):i==="nanoid"?o=o.check(x.nanoid()):i==="cuid"?o=o.check(x.cuid()):i==="cuid2"?o=o.check(x.cuid2()):i==="ulid"?o=o.check(x.ulid()):i==="xid"?o=o.check(x.xid()):i==="ksuid"&&(o=o.check(x.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))),n=o;break}case"number":case"integer":{let o=r==="integer"?x.number().int():x.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)),n=o;break}case"boolean":{n=x.boolean();break}case"null":{n=x.null();break}case"object":{let o={},i=e.properties||{},s=new Set(e.required||[]),a=typeof e.additionalProperties=="object"?_e(e.additionalProperties,t):void 0;for(let[f,d]of Object.entries(i)){let m=_e(d,t);ce(o,f,s.has(f)?m:m.optional())}if(e.patternProperties){let f=e.patternProperties,d=Object.keys(f),m=[];for(let b of d){let w=_e(f[b],t),S=x.string().regex(new RegExp(b));m.push(x.looseRecord(S,w))}let g=[];if(Object.keys(o).length>0&&g.push(x.object(o).passthrough()),g.push(...m),g.length===0)n=x.object({}).passthrough();else if(g.length===1)n=g[0];else{let b=x.intersection(g[0],g[1]);for(let w=2;w<g.length;w++)b=x.intersection(b,g[w]);n=b}if(e.additionalProperties===!1){let b=Object.keys(o),w=d.map($=>new RegExp($)),S=n;n=n.check($=>{if(!Te($.value))return;let P=[];for(let E of Object.keys($.value))b.includes(E)||w.some(G=>G.test(E))||P.push(E);P.length&&$.issues.push({code:"unrecognized_keys",keys:P,input:$.value,inst:S})})}}else{let f=x.object(o);e.additionalProperties===!1?n=f.strict():a?n=f.catchall(a):n=f.passthrough()}let 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 f;if(c){let d=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;f=_e(d,t)}n=T_(n,{keySchema:f,minProperties:u,maxProperties:l})}break}case"array":{let o=e.prefixItems,i=e.items;if(o&&Array.isArray(o)){let s=typeof e.minItems=="number"?e.minItems:0,a=o.map(f=>_e(f,t)),c=kh(a,s),u=Array.isArray(i)?void 0:Ph(i,t),l=x.tuple(c);n=u?l.rest(u):l,typeof e.minItems=="number"&&(n=n.check(x.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(x.maxLength(e.maxItems)))}else if(Array.isArray(i)){let s=typeof e.minItems=="number"?e.minItems:0,a=i.map(f=>_e(f,t)),c=kh(a,s),u=Ph(e.additionalItems,t),l=x.tuple(c);n=u?l.rest(u):l,typeof e.minItems=="number"&&(n=n.check(x.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(x.maxLength(e.maxItems)))}else if(i!==void 0){let s=_e(i,t),a=x.array(s);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),n=a}else n=x.array(x.any());(e.uniqueItems===!0||e.contains!==void 0)&&(n=R_(n,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?_e(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: ${r}`)}return n}function _e(e,t){if(typeof e=="boolean")return e?x.any():x.never();let r=Ih(e,t),n=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(u=>_e(u,t)),c=x.union(a);r=n?x.intersection(r,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(u=>_e(u,t)),c=x.xor(a);r=n?x.intersection(r,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=n?r:x.any();else{let a=n?r:_e(e.allOf[0],t),c=n?0:1;for(let u=c;u<e.allOf.length;u++)a=x.intersection(a,_e(e.allOf[u],t));r=a}e.nullable===!0&&t.version==="openapi-3.0"&&(r=x.nullable(r)),e.readOnly===!0&&(r=x.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)a in e&&(o[a]=e[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in e&&(o[a]=e[a]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!co(e.propertyNames)&&(o.propertyNames=e.propertyNames);for(let a of["minProperties","maxProperties"])e[a]!==void 0&&(o[a]=e[a])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!co(e.contains)&&(o.contains=e.contains);for(let a of["uniqueItems","minContains","maxContains"])e[a]!==void 0&&(o[a]=e[a])}for(let a of Object.keys(e))k_.has(a)||ce(o,a,e[a]);return Object.keys(o).length>0&&t.registry.add(r,o),e.description&&(r=r.describe(e.description)),r}function pd(e,t){if(typeof e=="boolean")return e?x.any():x.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let n=S_(r,t?.defaultTarget),o=r.$defs||r.definitions||{},i={version:n,defs:o,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??ie};return _e(r,i)}var x,k_,O_,A_,C_,Th=D(()=>{bn();ee();is();ua();dt();x={...Zr,...os,iso:mt},k_=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"]);O_=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),A_=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);C_=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/});function fd(e){return En(e,{object:t=>t.partial(),union:t=>{let r=t._zod.def;return r.discriminator===void 0?t:U(r.options)}})}var Oh=D(()=>{Kp();dt()});function N_(e,t){if(!t?.length)return e;let r=e._zod.def;return L(e,Ee(r,{checks:[...r.checks??[],...t]}),{parent:!0})}function Ah(e){return N_(e.out,e.checks)}function E_(e){return e.in._zod.traits.has("$ZodTransform")?Ah(e):e.in}function dd(e){return En(e,{pipe:t=>E_(t._zod.def),default:(t,r)=>r?q(t._zod.def.innerType):t,catch:(t,r)=>r?t._zod.def.innerType:t})}function md(e){return En(e,{pipe:t=>Ah(t._zod.def),prefault:(t,r)=>r?t._zod.def.innerType:t})}var Rh=D(()=>{ee();Kp();dt()});var la={};Le(la,{bigint:()=>M_,boolean:()=>j_,date:()=>L_,number:()=>D_,string:()=>Z_});function Z_(e){return kl(Kt,e)}function D_(e){return Ol(Wt,e)}function j_(e){return Dl(Gt,e)}function M_(e){return Ml(Qt,e)}function L_(e){return Gl(Pr,e)}var Ch=D(()=>{Se();dt()});var p={};Le(p,{$brand:()=>Oo,$input:()=>Si,$output:()=>ki,INVALID:()=>me,NEVER:()=>To,TimePrecision:()=>Qi,ZodAny:()=>ks,ZodArray:()=>Ts,ZodBase64:()=>Yn,ZodBase64URL:()=>Xn,ZodBigInt:()=>Qt,ZodBigIntFormat:()=>ro,ZodBoolean:()=>Gt,ZodCIDRv4:()=>Gn,ZodCIDRv6:()=>Qn,ZodCUID:()=>Fn,ZodCUID2:()=>qn,ZodCatch:()=>Ks,ZodCodec:()=>Cr,ZodCompileAsyncError:()=>Ae,ZodCompileUnsupportedError:()=>N,ZodCreditCard:()=>$s,ZodCustom:()=>Nr,ZodCustomStringFormat:()=>pt,ZodDate:()=>Pr,ZodDefault:()=>Vs,ZodDiscriminatedUnion:()=>As,ZodE164:()=>eo,ZodEmail:()=>Mn,ZodEmoji:()=>Un,ZodEnum:()=>Bt,ZodError:()=>$h,ZodExactOptional:()=>io,ZodFile:()=>js,ZodFirstPartyTypeKind:()=>ca,ZodFunction:()=>oa,ZodGUID:()=>Ln,ZodIBAN:()=>ws,ZodIPv4:()=>Kn,ZodIPv6:()=>Wn,ZodISODate:()=>Ge,ZodISODateTime:()=>We,ZodISODuration:()=>Ye,ZodISOTime:()=>Qe,ZodInstanceOf:()=>aa,ZodIntersection:()=>Rs,ZodIssueCode:()=>wh,ZodJWT:()=>to,ZodKSUID:()=>Jn,ZodLazy:()=>ta,ZodLiteral:()=>Ds,ZodMAC:()=>_s,ZodMap:()=>Es,ZodNaN:()=>Gs,ZodNanoID:()=>Vn,ZodNever:()=>Ps,ZodNonOptional:()=>so,ZodNull:()=>vs,ZodNullable:()=>Us,ZodNumber:()=>Wt,ZodNumberFormat:()=>ft,ZodObject:()=>Ir,ZodOptional:()=>Ar,ZodPipe:()=>Rr,ZodPrefault:()=>qs,ZodPreprocess:()=>Qs,ZodPromise:()=>na,ZodReadonly:()=>Ys,ZodRealError:()=>be,ZodRecord:()=>Ht,ZodSet:()=>Zs,ZodString:()=>Kt,ZodStringFormat:()=>H,ZodSuccess:()=>Js,ZodSymbol:()=>xs,ZodTemplateLiteral:()=>ea,ZodTransform:()=>Ms,ZodTuple:()=>Cs,ZodType:()=>A,ZodULID:()=>Hn,ZodURL:()=>kr,ZodUUID:()=>Me,ZodUndefined:()=>zs,ZodUnion:()=>Tr,ZodUnknown:()=>Ss,ZodVoid:()=>Is,ZodXID:()=>Bn,ZodXor:()=>Os,_ZodString:()=>jn,_default:()=>Fs,_function:()=>nd,any:()=>jf,array:()=>C,base64:()=>bf,base64url:()=>_f,bigint:()=>Cf,boolean:()=>X,catch:()=>Ws,check:()=>od,cidrv4:()=>gf,cidrv6:()=>yf,clone:()=>L,codec:()=>Xf,coerce:()=>la,compile:()=>Pi,config:()=>Y,core:()=>Ve,creditCard:()=>wf,cuid:()=>cf,cuid2:()=>uf,currencyCode:()=>Pf,custom:()=>ao,date:()=>Lf,decode:()=>fs,decodeAsync:()=>ms,deepPartial:()=>fd,describe:()=>id,discriminatedUnion:()=>Or,e164:()=>$f,email:()=>Qp,emoji:()=>sf,encode:()=>ps,encodeAsync:()=>ds,endsWith:()=>Zt,enum:()=>ae,exactOptional:()=>Ls,file:()=>Wf,flattenError:()=>cr,float32:()=>Tf,float64:()=>Of,formatError:()=>ur,fromJSONSchema:()=>pd,function:()=>nd,getDiscriminatedOption:()=>di,getErrorMap:()=>zh,globalRegistry:()=>ie,gt:()=>De,gte:()=>ke,guid:()=>Yp,hash:()=>If,hex:()=>Sf,hostname:()=>kf,httpUrl:()=>of,iban:()=>xf,includes:()=>Nt,input:()=>dd,instanceof:()=>ad,int:()=>Zn,int32:()=>Af,int64:()=>Nf,intersection:()=>Yt,invertCodec:()=>ed,ipv4:()=>df,ipv6:()=>hf,iso:()=>mt,json:()=>ud,jwt:()=>zf,keyof:()=>Uf,ksuid:()=>ff,lazy:()=>ra,length:()=>at,literal:()=>k,locales:()=>_r,looseObject:()=>se,looseRecord:()=>Hf,lowercase:()=>Rt,lt:()=>Ze,lte:()=>ve,mac:()=>mf,map:()=>Bf,maxLength:()=>st,maxSize:()=>Ke,memoizer:()=>br,meta:()=>sd,mime:()=>jt,minLength:()=>Ue,minSize:()=>je,multipleOf:()=>Je,nan:()=>Yf,nanoid:()=>af,nativeEnum:()=>Kf,negative:()=>Sn,never:()=>no,nonnegative:()=>In,nonoptional:()=>Bs,nonpositive:()=>Pn,normalize:()=>Mt,null:()=>Sr,nullable:()=>vr,nullish:()=>Gf,number:()=>j,object:()=>z,optional:()=>q,output:()=>md,overwrite:()=>Re,parse:()=>as,parseAsync:()=>cs,partialRecord:()=>qf,pipe:()=>Dn,positive:()=>kn,prefault:()=>Hs,preprocess:()=>Er,prettifyError:()=>Ro,promise:()=>rd,properties:()=>Dt,property:()=>Tn,readonly:()=>Xs,record:()=>B,refine:()=>ia,regex:()=>At,regexes:()=>Pe,registry:()=>yn,safeDecode:()=>gs,safeDecodeAsync:()=>bs,safeEncode:()=>hs,safeEncodeAsync:()=>ys,safeParse:()=>us,safeParseAsync:()=>ls,set:()=>Jf,setErrorMap:()=>xh,size:()=>it,slugify:()=>Ft,startsWith:()=>Et,strictObject:()=>Vf,string:()=>y,stringFormat:()=>vf,stringbool:()=>cd,success:()=>Qf,superRefine:()=>sa,symbol:()=>Zf,templateLiteral:()=>td,toJSONSchema:()=>Cn,toLowerCase:()=>Ut,toUpperCase:()=>Vt,toZod:()=>tr,transform:()=>oo,treeifyError:()=>Ao,trim:()=>Lt,tuple:()=>Ns,uint32:()=>Rf,uint64:()=>Ef,ulid:()=>lf,undefined:()=>Df,union:()=>U,unknown:()=>K,uppercase:()=>Ct,url:()=>nf,util:()=>v,uuid:()=>Xp,uuidv4:()=>ef,uuidv6:()=>tf,uuidv7:()=>rf,validate:()=>xt,validateAsync:()=>zt,void:()=>Mf,withParser:()=>_n,xid:()=>pf,xor:()=>Ff});var pa=D(()=>{Se();dt();is();Wp();Gp();vh();Se();Nn();Th();Oh();Rh();bl();ua();ua();Ch()});var Nh=D(()=>{pa();pa()});var hd={};Le(hd,{$brand:()=>Oo,$input:()=>Si,$output:()=>ki,INVALID:()=>me,NEVER:()=>To,TimePrecision:()=>Qi,ZodAny:()=>ks,ZodArray:()=>Ts,ZodBase64:()=>Yn,ZodBase64URL:()=>Xn,ZodBigInt:()=>Qt,ZodBigIntFormat:()=>ro,ZodBoolean:()=>Gt,ZodCIDRv4:()=>Gn,ZodCIDRv6:()=>Qn,ZodCUID:()=>Fn,ZodCUID2:()=>qn,ZodCatch:()=>Ks,ZodCodec:()=>Cr,ZodCompileAsyncError:()=>Ae,ZodCompileUnsupportedError:()=>N,ZodCreditCard:()=>$s,ZodCustom:()=>Nr,ZodCustomStringFormat:()=>pt,ZodDate:()=>Pr,ZodDefault:()=>Vs,ZodDiscriminatedUnion:()=>As,ZodE164:()=>eo,ZodEmail:()=>Mn,ZodEmoji:()=>Un,ZodEnum:()=>Bt,ZodError:()=>$h,ZodExactOptional:()=>io,ZodFile:()=>js,ZodFirstPartyTypeKind:()=>ca,ZodFunction:()=>oa,ZodGUID:()=>Ln,ZodIBAN:()=>ws,ZodIPv4:()=>Kn,ZodIPv6:()=>Wn,ZodISODate:()=>Ge,ZodISODateTime:()=>We,ZodISODuration:()=>Ye,ZodISOTime:()=>Qe,ZodInstanceOf:()=>aa,ZodIntersection:()=>Rs,ZodIssueCode:()=>wh,ZodJWT:()=>to,ZodKSUID:()=>Jn,ZodLazy:()=>ta,ZodLiteral:()=>Ds,ZodMAC:()=>_s,ZodMap:()=>Es,ZodNaN:()=>Gs,ZodNanoID:()=>Vn,ZodNever:()=>Ps,ZodNonOptional:()=>so,ZodNull:()=>vs,ZodNullable:()=>Us,ZodNumber:()=>Wt,ZodNumberFormat:()=>ft,ZodObject:()=>Ir,ZodOptional:()=>Ar,ZodPipe:()=>Rr,ZodPrefault:()=>qs,ZodPreprocess:()=>Qs,ZodPromise:()=>na,ZodReadonly:()=>Ys,ZodRealError:()=>be,ZodRecord:()=>Ht,ZodSet:()=>Zs,ZodString:()=>Kt,ZodStringFormat:()=>H,ZodSuccess:()=>Js,ZodSymbol:()=>xs,ZodTemplateLiteral:()=>ea,ZodTransform:()=>Ms,ZodTuple:()=>Cs,ZodType:()=>A,ZodULID:()=>Hn,ZodURL:()=>kr,ZodUUID:()=>Me,ZodUndefined:()=>zs,ZodUnion:()=>Tr,ZodUnknown:()=>Ss,ZodVoid:()=>Is,ZodXID:()=>Bn,ZodXor:()=>Os,_ZodString:()=>jn,_default:()=>Fs,_function:()=>nd,any:()=>jf,array:()=>C,base64:()=>bf,base64url:()=>_f,bigint:()=>Cf,boolean:()=>X,catch:()=>Ws,check:()=>od,cidrv4:()=>gf,cidrv6:()=>yf,clone:()=>L,codec:()=>Xf,coerce:()=>la,compile:()=>Pi,config:()=>Y,core:()=>Ve,creditCard:()=>wf,cuid:()=>cf,cuid2:()=>uf,currencyCode:()=>Pf,custom:()=>ao,date:()=>Lf,decode:()=>fs,decodeAsync:()=>ms,deepPartial:()=>fd,default:()=>p,describe:()=>id,discriminatedUnion:()=>Or,e164:()=>$f,email:()=>Qp,emoji:()=>sf,encode:()=>ps,encodeAsync:()=>ds,endsWith:()=>Zt,enum:()=>ae,exactOptional:()=>Ls,file:()=>Wf,flattenError:()=>cr,float32:()=>Tf,float64:()=>Of,formatError:()=>ur,fromJSONSchema:()=>pd,function:()=>nd,getDiscriminatedOption:()=>di,getErrorMap:()=>zh,globalRegistry:()=>ie,gt:()=>De,gte:()=>ke,guid:()=>Yp,hash:()=>If,hex:()=>Sf,hostname:()=>kf,httpUrl:()=>of,iban:()=>xf,includes:()=>Nt,input:()=>dd,instanceof:()=>ad,int:()=>Zn,int32:()=>Af,int64:()=>Nf,intersection:()=>Yt,invertCodec:()=>ed,ipv4:()=>df,ipv6:()=>hf,iso:()=>mt,json:()=>ud,jwt:()=>zf,keyof:()=>Uf,ksuid:()=>ff,lazy:()=>ra,length:()=>at,literal:()=>k,locales:()=>_r,looseObject:()=>se,looseRecord:()=>Hf,lowercase:()=>Rt,lt:()=>Ze,lte:()=>ve,mac:()=>mf,map:()=>Bf,maxLength:()=>st,maxSize:()=>Ke,memoizer:()=>br,meta:()=>sd,mime:()=>jt,minLength:()=>Ue,minSize:()=>je,multipleOf:()=>Je,nan:()=>Yf,nanoid:()=>af,nativeEnum:()=>Kf,negative:()=>Sn,never:()=>no,nonnegative:()=>In,nonoptional:()=>Bs,nonpositive:()=>Pn,normalize:()=>Mt,null:()=>Sr,nullable:()=>vr,nullish:()=>Gf,number:()=>j,object:()=>z,optional:()=>q,output:()=>md,overwrite:()=>Re,parse:()=>as,parseAsync:()=>cs,partialRecord:()=>qf,pipe:()=>Dn,positive:()=>kn,prefault:()=>Hs,preprocess:()=>Er,prettifyError:()=>Ro,promise:()=>rd,properties:()=>Dt,property:()=>Tn,readonly:()=>Xs,record:()=>B,refine:()=>ia,regex:()=>At,regexes:()=>Pe,registry:()=>yn,safeDecode:()=>gs,safeDecodeAsync:()=>bs,safeEncode:()=>hs,safeEncodeAsync:()=>ys,safeParse:()=>us,safeParseAsync:()=>ls,set:()=>Jf,setErrorMap:()=>xh,size:()=>it,slugify:()=>Ft,startsWith:()=>Et,strictObject:()=>Vf,string:()=>y,stringFormat:()=>vf,stringbool:()=>cd,success:()=>Qf,superRefine:()=>sa,symbol:()=>Zf,templateLiteral:()=>td,toJSONSchema:()=>Cn,toLowerCase:()=>Ut,toUpperCase:()=>Vt,toZod:()=>tr,transform:()=>oo,treeifyError:()=>Ao,trim:()=>Lt,tuple:()=>Ns,uint32:()=>Rf,uint64:()=>Ef,ulid:()=>lf,undefined:()=>Df,union:()=>U,unknown:()=>K,uppercase:()=>Ct,url:()=>nf,util:()=>v,uuid:()=>Xp,uuidv4:()=>ef,uuidv6:()=>tf,uuidv7:()=>rf,validate:()=>xt,validateAsync:()=>zt,void:()=>Mf,withParser:()=>_n,xid:()=>pf,xor:()=>Ff,z:()=>p});var uo=D(()=>{pa();Nh()});Se();function rs(e){return!!e._zod}function ns(e,t){return rs(e)?No(e,t):e.safeParse(t)}function gh(e){if(!e)return;let t;if(rs(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function yh(e){if(rs(e)){let 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]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=e.value;if(n!==void 0)return n}uo();var ht="io.modelcontextprotocol/related-task",da="2.0",ne=ao(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Eh=U([y(),j().int()]),Zh=y(),Tz=se({ttl:j().optional(),pollInterval:j().optional()}),U_=z({ttl:j().optional()}),V_=z({taskId:y()}),yd=se({progressToken:Eh.optional(),[ht]:V_.optional()}),Ie=z({_meta:yd.optional()}),lo=Ie.extend({task:U_.optional()}),Dh=e=>lo.safeParse(e).success,ue=z({method:y(),params:Ie.loose().optional()}),Ce=z({_meta:yd.optional()}),Ne=z({method:y(),params:Ce.loose().optional()}),le=se({_meta:yd.optional()}),jr=U([y(),j().int()]),jh=z({jsonrpc:k(da),id:jr,...ue.shape}).strict(),bd=e=>jh.safeParse(e).success,Mh=z({jsonrpc:k(da),...Ne.shape}).strict(),Lh=e=>Mh.safeParse(e).success,_d=z({jsonrpc:k(da),id:jr,result:le}).strict(),po=e=>_d.safeParse(e).success;var J;(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"})(J||(J={}));var $d=z({jsonrpc:k(da),id:jr.optional(),error:z({code:j().int(),message:y(),data:K().optional()})}).strict();var Uh=e=>$d.safeParse(e).success;var Vh=U([jh,Mh,_d,$d]),Oz=U([_d,$d]),ma=le.strict(),F_=Ce.extend({requestId:jr.optional(),reason:y().optional()}),ha=Ne.extend({method:k("notifications/cancelled"),params:F_}),q_=z({src:y(),mimeType:y().optional(),sizes:C(y()).optional(),theme:ae(["light","dark"]).optional()}),fo=z({icons:C(q_).optional()}),Dr=z({name:y(),title:y().optional()}),mo=Dr.extend({...Dr.shape,...fo.shape,version:y(),websiteUrl:y().optional(),description:y().optional()}),H_=Yt(z({applyDefaults:X().optional()}),B(y(),K())),B_=Er(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Yt(z({form:H_.optional(),url:ne.optional()}),B(y(),K()).optional())),J_=se({list:ne.optional(),cancel:ne.optional(),requests:se({sampling:se({createMessage:ne.optional()}).optional(),elicitation:se({create:ne.optional()}).optional()}).optional()}),K_=se({list:ne.optional(),cancel:ne.optional(),requests:se({tools:se({call:ne.optional()}).optional()}).optional()}),W_=z({experimental:B(y(),ne).optional(),sampling:z({context:ne.optional(),tools:ne.optional()}).optional(),elicitation:B_.optional(),roots:z({listChanged:X().optional()}).optional(),tasks:J_.optional(),extensions:B(y(),ne).optional()}),G_=Ie.extend({protocolVersion:y(),capabilities:W_,clientInfo:mo}),Q_=ue.extend({method:k("initialize"),params:G_});var Y_=z({experimental:B(y(),ne).optional(),logging:ne.optional(),completions:ne.optional(),prompts:z({listChanged:X().optional()}).optional(),resources:z({subscribe:X().optional(),listChanged:X().optional()}).optional(),tools:z({listChanged:X().optional()}).optional(),tasks:K_.optional(),extensions:B(y(),ne).optional()}),X_=le.extend({protocolVersion:y(),capabilities:Y_,serverInfo:mo,instructions:y().optional()}),e$=Ne.extend({method:k("notifications/initialized"),params:Ce.optional()});var Mr=ue.extend({method:k("ping"),params:Ie.optional()}),t$=z({progress:j(),total:q(j()),message:q(y())}),r$=z({...Ce.shape,...t$.shape,progressToken:Eh}),ga=Ne.extend({method:k("notifications/progress"),params:r$}),n$=Ie.extend({cursor:Zh.optional()}),ho=ue.extend({params:n$.optional()}),go=le.extend({nextCursor:Zh.optional()}),o$=ae(["working","input_required","completed","failed","cancelled"]),yo=z({taskId:y(),status:o$,ttl:U([j(),Sr()]),createdAt:y(),lastUpdatedAt:y(),pollInterval:q(j()),statusMessage:q(y())}),ya=le.extend({task:yo}),i$=Ce.merge(yo),bo=Ne.extend({method:k("notifications/tasks/status"),params:i$}),ba=ue.extend({method:k("tasks/get"),params:Ie.extend({taskId:y()})}),_a=le.merge(yo),$a=ue.extend({method:k("tasks/result"),params:Ie.extend({taskId:y()})}),Az=le.loose(),wa=ho.extend({method:k("tasks/list")}),xa=go.extend({tasks:C(yo)}),za=ue.extend({method:k("tasks/cancel"),params:Ie.extend({taskId:y()})}),Fh=le.merge(yo),qh=z({uri:y(),mimeType:q(y()),_meta:B(y(),K()).optional()}),Hh=qh.extend({text:y()}),wd=y().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Bh=qh.extend({blob:wd}),_o=ae(["user","assistant"]),Lr=z({audience:C(_o).optional(),priority:j().min(0).max(1).optional(),lastModified:mt.datetime({offset:!0}).optional()}),Jh=z({...Dr.shape,...fo.shape,uri:y(),description:q(y()),mimeType:q(y()),size:q(j()),annotations:Lr.optional(),_meta:q(se({}))}),s$=z({...Dr.shape,...fo.shape,uriTemplate:y(),description:q(y()),mimeType:q(y()),annotations:Lr.optional(),_meta:q(se({}))}),a$=ho.extend({method:k("resources/list")}),xd=go.extend({resources:C(Jh)}),c$=ho.extend({method:k("resources/templates/list")}),u$=go.extend({resourceTemplates:C(s$)}),zd=Ie.extend({uri:y()}),l$=zd,p$=ue.extend({method:k("resources/read"),params:l$}),vd=le.extend({contents:C(U([Hh,Bh]))}),f$=Ne.extend({method:k("notifications/resources/list_changed"),params:Ce.optional()}),d$=zd,m$=ue.extend({method:k("resources/subscribe"),params:d$}),h$=zd,g$=ue.extend({method:k("resources/unsubscribe"),params:h$}),y$=Ce.extend({uri:y()}),b$=Ne.extend({method:k("notifications/resources/updated"),params:y$}),_$=z({name:y(),description:q(y()),required:q(X())}),$$=z({...Dr.shape,...fo.shape,description:q(y()),arguments:q(C(_$)),_meta:q(se({}))}),w$=ho.extend({method:k("prompts/list")}),x$=go.extend({prompts:C($$)}),z$=Ie.extend({name:y(),arguments:B(y(),y()).optional()}),v$=ue.extend({method:k("prompts/get"),params:z$}),kd=z({type:k("text"),text:y(),annotations:Lr.optional(),_meta:B(y(),K()).optional()}),Sd=z({type:k("image"),data:wd,mimeType:y(),annotations:Lr.optional(),_meta:B(y(),K()).optional()}),Pd=z({type:k("audio"),data:wd,mimeType:y(),annotations:Lr.optional(),_meta:B(y(),K()).optional()}),k$=z({type:k("tool_use"),name:y(),id:y(),input:B(y(),K()),_meta:B(y(),K()).optional()}),Id=z({type:k("resource"),resource:U([Hh,Bh]),annotations:Lr.optional(),_meta:B(y(),K()).optional()}),Td=Jh.extend({type:k("resource_link")}),Ur=U([kd,Sd,Pd,Td,Id]),S$=z({role:_o,content:Ur}),P$=le.extend({description:y().optional(),messages:C(S$)}),I$=Ne.extend({method:k("notifications/prompts/list_changed"),params:Ce.optional()}),T$=z({title:y().optional(),readOnlyHint:X().optional(),destructiveHint:X().optional(),idempotentHint:X().optional(),openWorldHint:X().optional()}),O$=z({taskSupport:ae(["required","optional","forbidden"]).optional()}),va=z({...Dr.shape,...fo.shape,description:y().optional(),inputSchema:z({type:k("object"),properties:B(y(),ne).optional(),required:C(y()).optional()}).catchall(K()),outputSchema:z({type:k("object"),properties:B(y(),ne).optional(),required:C(y()).optional()}).catchall(K()).optional(),annotations:T$.optional(),execution:O$.optional(),_meta:B(y(),K()).optional()}),Od=ho.extend({method:k("tools/list")}),A$=go.extend({tools:C(va)}),Vr=le.extend({content:C(Ur).default([]),structuredContent:B(y(),K()).optional(),isError:X().optional()}),Rz=Vr.or(le.extend({toolResult:K()})),R$=lo.extend({name:y(),arguments:B(y(),K()).optional()}),Ad=ue.extend({method:k("tools/call"),params:R$}),C$=Ne.extend({method:k("notifications/tools/list_changed"),params:Ce.optional()}),Cz=z({autoRefresh:X().default(!0),debounceMs:j().int().nonnegative().default(300)}),Kh=ae(["debug","info","notice","warning","error","critical","alert","emergency"]),N$=Ie.extend({level:Kh}),E$=ue.extend({method:k("logging/setLevel"),params:N$}),Z$=Ce.extend({level:Kh,logger:y().optional(),data:K()}),D$=Ne.extend({method:k("notifications/message"),params:Z$}),j$=z({name:y().optional()}),M$=z({hints:C(j$).optional(),costPriority:j().min(0).max(1).optional(),speedPriority:j().min(0).max(1).optional(),intelligencePriority:j().min(0).max(1).optional()}),L$=z({mode:ae(["auto","required","none"]).optional()}),U$=z({type:k("tool_result"),toolUseId:y().describe("The unique identifier for the corresponding tool call."),content:C(Ur).default([]),structuredContent:z({}).loose().optional(),isError:X().optional(),_meta:B(y(),K()).optional()}),V$=Or("type",[kd,Sd,Pd]),fa=Or("type",[kd,Sd,Pd,k$,U$]),F$=z({role:_o,content:U([fa,C(fa)]),_meta:B(y(),K()).optional()}),q$=lo.extend({messages:C(F$),modelPreferences:M$.optional(),systemPrompt:y().optional(),includeContext:ae(["none","thisServer","allServers"]).optional(),temperature:j().optional(),maxTokens:j().int(),stopSequences:C(y()).optional(),metadata:ne.optional(),tools:C(va).optional(),toolChoice:L$.optional()}),H$=ue.extend({method:k("sampling/createMessage"),params:q$}),Rd=le.extend({model:y(),stopReason:q(ae(["endTurn","stopSequence","maxTokens"]).or(y())),role:_o,content:V$}),Cd=le.extend({model:y(),stopReason:q(ae(["endTurn","stopSequence","maxTokens","toolUse"]).or(y())),role:_o,content:U([fa,C(fa)])}),B$=z({type:k("boolean"),title:y().optional(),description:y().optional(),default:X().optional()}),J$=z({type:k("string"),title:y().optional(),description:y().optional(),minLength:j().optional(),maxLength:j().optional(),format:ae(["email","uri","date","date-time"]).optional(),default:y().optional()}),K$=z({type:ae(["number","integer"]),title:y().optional(),description:y().optional(),minimum:j().optional(),maximum:j().optional(),default:j().optional()}),W$=z({type:k("string"),title:y().optional(),description:y().optional(),enum:C(y()),default:y().optional()}),G$=z({type:k("string"),title:y().optional(),description:y().optional(),oneOf:C(z({const:y(),title:y()})),default:y().optional()}),Q$=z({type:k("string"),title:y().optional(),description:y().optional(),enum:C(y()),enumNames:C(y()).optional(),default:y().optional()}),Y$=U([W$,G$]),X$=z({type:k("array"),title:y().optional(),description:y().optional(),minItems:j().optional(),maxItems:j().optional(),items:z({type:k("string"),enum:C(y())}),default:C(y()).optional()}),ew=z({type:k("array"),title:y().optional(),description:y().optional(),minItems:j().optional(),maxItems:j().optional(),items:z({anyOf:C(z({const:y(),title:y()}))}),default:C(y()).optional()}),tw=U([X$,ew]),rw=U([Q$,Y$,tw]),nw=U([rw,B$,J$,K$]),ow=lo.extend({mode:k("form").optional(),message:y(),requestedSchema:z({type:k("object"),properties:B(y(),nw),required:C(y()).optional()})}),iw=lo.extend({mode:k("url"),message:y(),elicitationId:y(),url:y().url()}),sw=U([ow,iw]),aw=ue.extend({method:k("elicitation/create"),params:sw}),cw=Ce.extend({elicitationId:y()}),uw=Ne.extend({method:k("notifications/elicitation/complete"),params:cw}),lw=le.extend({action:ae(["accept","decline","cancel"]),content:Er(e=>e===null?void 0:e,B(y(),U([y(),j(),X(),C(y())])).optional())}),pw=z({type:k("ref/resource"),uri:y()});var fw=z({type:k("ref/prompt"),name:y()}),dw=Ie.extend({ref:U([fw,pw]),argument:z({name:y(),value:y()}),context:z({arguments:B(y(),y()).optional()}).optional()}),mw=ue.extend({method:k("completion/complete"),params:dw});var hw=le.extend({completion:se({values:C(y()).max(100),total:q(j().int()),hasMore:q(X())})}),gw=z({uri:y().startsWith("file://"),name:y().optional(),_meta:B(y(),K()).optional()}),yw=ue.extend({method:k("roots/list"),params:Ie.optional()}),bw=le.extend({roots:C(gw)}),_w=Ne.extend({method:k("notifications/roots/list_changed"),params:Ce.optional()}),Nz=U([Mr,Q_,mw,E$,v$,w$,a$,c$,p$,m$,g$,Ad,Od,ba,$a,wa,za]),Ez=U([ha,ga,e$,_w,bo]),Zz=U([ma,Rd,Cd,lw,bw,_a,xa,ya]),Dz=U([Mr,H$,aw,yw,ba,$a,wa,za]),jz=U([ha,ga,D$,b$,f$,C$,I$,bo,uw]),Mz=U([ma,X_,hw,P$,x$,xd,u$,vd,Vr,A$,_a,xa,ya]),M=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===J.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new gd(o.elicitations,r)}return new e(t,r,n)}},gd=class extends M{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(J.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function gt(e){return e==="completed"||e==="failed"||e==="cancelled"}var $w=Symbol("Let zodToJsonSchema decide on which parser to use");var bv=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Nd(e){let r=gh(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=yh(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Ed(e,t){let r=ns(e,t);if(!r.success)throw r.error;return r.data}var Sw=6e4,ka=class{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(ha,r=>{this._oncancel(r)}),this.setNotificationHandler(ga,r=>{this._onprogress(r)}),this.setRequestHandler(Mr,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ba,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new M(J.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler($a,async(r,n)=>{let o=async()=>{let i=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(i,n.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let f=c,d=new M(f.error.code,f.error.message,f.error.data);l(d)}else{let f=a.type==="response"?"Response":"Error";this._onerror(new Error(`${f} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}let s=await this._taskStore.getTask(i,n.sessionId);if(!s)throw new M(J.InvalidParams,`Task not found: ${i}`);if(!gt(s.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(gt(s.status)){let a=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...a,_meta:{...a._meta,[ht]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(wa,async(r,n)=>{try{let{tasks:o,nextCursor:i}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new M(J.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(za,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new M(J.InvalidParams,`Task not found: ${r.params.taskId}`);if(gt(o.status))throw new M(J.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new M(J.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof M?o:new M(J.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,r,n,o,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),M.fromError(J.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.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;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=i=>{n?.(i),this._onerror(i)};let o=this._transport?.onmessage;this._transport.onmessage=(i,s)=>{o?.(i,s),po(i)||Uh(i)?this._onresponse(i):bd(i)?this._onrequest(i,s):Lh(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=M.fromError(J.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,i=t.params?._meta?.[ht]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:J.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(f=>this._onerror(new Error(`Failed to enqueue error response: ${f}`))):o?.send(l).catch(f=>this._onerror(new Error(`Failed to send an error response: ${f}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(t.id,s);let a=Dh(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,u={signal:s.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(s.signal.aborted)return;let f={relatedRequestId:t.id};i&&(f.relatedTask={taskId:i}),await this.notification(l,f)},sendRequest:async(l,f,d)=>{if(s.signal.aborted)throw new M(J.ConnectionClosed,"Request was cancelled");let m={...d,relatedRequestId:t.id};i&&!m.relatedTask&&(m.relatedTask={taskId:i});let g=m.relatedTask?.taskId??i;return g&&c&&await c.updateTaskStatus(g,"input_required"),await this.request(l,f,m)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(s.signal.aborted)return;let f={result:l,jsonrpc:"2.0",id:t.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:f,timestamp:Date.now()},o?.sessionId):await o?.send(f)},async l=>{if(s.signal.aborted)return;let f={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:J.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:f,timestamp:Date.now()},o?.sessionId):await o?.send(f)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===s&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let 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(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),po(t))n(t);else{let s=new M(t.error.code,t.error.message,t.error.data);n(s)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if(po(t)&&t.result&&typeof t.result=="object"){let s=t.result;if(s.task&&typeof s.task=="object"){let a=s.task;typeof a.taskId=="string"&&(i=!0,this._taskProgressTokens.set(a.taskId,r))}}if(i||this._progressHandlers.delete(r),po(t))o(t);else{let s=M.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,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(t,r,n)}}catch(s){yield{type:"error",error:s instanceof M?s:new M(J.InternalError,String(s))}}return}let i;try{let s=await this.request(t,ya,n);if(s.task)i=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new M(J.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:a},gt(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:a.status==="failed"?yield{type:"error",error:new M(J.InternalError,`Task ${i} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new M(J.InternalError,`Task ${i} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof M?s:new M(J.InternalError,String(s))}}}request(t,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{let f=$=>{l($)};if(!this._transport){f(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch($){f($);return}n?.signal?.throwIfAborted();let d=this._requestMessageId++,m={...t,jsonrpc:"2.0",id:d};n?.onprogress&&(this._progressHandlers.set(d,n.onprogress),m.params={...t.params,_meta:{...t.params?._meta||{},progressToken:d}}),a&&(m.params={...m.params,task:a}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[ht]:c}});let g=$=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String($)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(E=>this._onerror(new Error(`Failed to send cancellation: ${E}`)));let P=$ instanceof M?$:new M(J.RequestTimeout,String($));l(P)};this._responseHandlers.set(d,$=>{if(!n?.signal?.aborted){if($ instanceof Error)return l($);try{let P=ns(r,$.result);P.success?u(P.data):l(P.error)}catch(P){l(P)}}}),n?.signal?.addEventListener("abort",()=>{g(n?.signal?.reason)});let b=n?.timeout??Sw,w=()=>g(M.fromError(J.RequestTimeout,"Request timed out",{timeout:b}));this._setupTimeout(d,b,n?.maxTotalTimeout,w,n?.resetTimeoutOnProgress??!1);let S=c?.taskId;if(S){let $=P=>{let E=this._responseHandlers.get(d);E?E(P):this._onerror(new Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,$),this._enqueueTaskMessage(S,{type:"request",message:m,timestamp:Date.now()}).catch(P=>{this._cleanupTimeout(d),l(P)})}else this._transport.send(m,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch($=>{this._cleanupTimeout(d),l($)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},_a,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},xa,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},Fh,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[ht]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.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"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[ht]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[ht]:r.relatedTask}}}),await this._transport.send(s,r)}setRequestHandler(t,r){let n=Nd(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let s=Ed(t,o);return Promise.resolve(r(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,r){let n=Nd(t);this._notificationHandlers.set(n,o=>{let i=Ed(t,o);return Promise.resolve(r(i))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,o)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let o of n)if(o.type==="request"&&bd(o.message)){let i=o.message.id,s=this._requestResolvers.get(i);s?(s(new M(J.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,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(t);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,i)=>{if(r.aborted){i(new M(J.InvalidRequest,"Request cancelled"));return}let s=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(s),i(new M(J.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await n.createTask(o,t.id,{method:t.method,params:t.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new M(J.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,s)=>{await n.storeTaskResult(o,i,s,r);let a=await n.getTask(o,r);if(a){let c=bo.parse({method:"notifications/tasks/status",params:a});await this.notification(c),gt(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,s)=>{let a=await n.getTask(o,r);if(!a)throw new M(J.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(gt(a.status))throw new M(J.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,s,r);let c=await n.getTask(o,r);if(c){let u=bo.parse({method:"notifications/tasks/status",params:c});await this.notification(u),gt(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function Wh(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Gh(e,t){let r={...e};for(let n in t){let o=n,i=t[o];if(i===void 0)continue;let s=r[o];Wh(s)&&Wh(i)?r[o]={...s,...i}:r[o]=i}return r}uo();uo();var gP=(e=>typeof bt<"u"?bt:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof bt<"u"?bt:t)[r]}):e)(function(e){if(typeof bt<"u")return bt.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),Zd=class extends ka{_registeredMethods=new Set;_eventSlots=new Map;onEventDispatch(t,r){}_ensureEventSlot(t){let r=this._eventSlots.get(t);if(!r){let n=this.eventSchemas[t];if(!n)throw Error(`Unknown event: ${String(t)}`);r={listeners:[]},this._eventSlots.set(t,r);let o=n.shape.method.value;this._registeredMethods.add(o);let i=r;super.setNotificationHandler(n,s=>{let a=s.params;this.onEventDispatch(t,a),i.onHandler?.(a);for(let c of[...i.listeners])c(a)})}return r}setEventHandler(t,r){let n=this._ensureEventSlot(t);n.onHandler&&r&&console.warn(`[MCP Apps] on${String(t)} handler replaced. Use addEventListener("${String(t)}", \u2026) to add multiple listeners without replacing.`),n.onHandler=r}getEventHandler(t){return this._eventSlots.get(t)?.onHandler}addEventListener(t,r){this._ensureEventSlot(t).listeners.push(r)}removeEventListener(t,r){let n=this._eventSlots.get(t);if(!n)return;let o=n.listeners.indexOf(r);o!==-1&&n.listeners.splice(o,1)}setRequestHandler=(t,r)=>{this._assertMethodNotRegistered(t,"setRequestHandler"),super.setRequestHandler(t,r)};setNotificationHandler=(t,r)=>{this._assertMethodNotRegistered(t,"setNotificationHandler"),super.setNotificationHandler(t,r)};warnIfRequestHandlerReplaced(t,r,n){r&&n&&console.warn(`[MCP Apps] ${t} handler replaced. Previous handler will no longer be called.`)}replaceRequestHandler=(t,r)=>{let n=t.shape.method.value;this._registeredMethods.add(n),super.setRequestHandler(t,r)};_assertMethodNotRegistered(t,r){let n=t.shape.method.value;if(this._registeredMethods.has(n))throw Error(`Handler for "${n}" already registered (via ${r}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._registeredMethods.add(n)}},Pw="2026-01-26";var Iw="ui/notifications/tool-input-partial";var Dd=class{eventTarget;eventSource;messageListener;constructor(t=window.parent,r){this.eventTarget=t,this.eventSource=r,this.messageListener=n=>{if(r&&n.source!==this.eventSource){console.debug("Ignoring message from unknown source",n);return}let o=Vh.safeParse(n.data);o.success?(console.debug("Parsed message",o.data),this.onmessage?.(o.data)):n.data?.jsonrpc!=="2.0"?console.debug("Ignoring non-JSON-RPC message",o.error.message,n):(console.error("Failed to parse message",o.error.message,n),this.onerror?.(Error("Invalid JSON-RPC message received: "+o.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(t,r){t.method!==Iw&&console.debug("Sending message",t),this.eventTarget.postMessage(t,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion},Tw=p.union([p.literal("light"),p.literal("dark")]).describe("Color theme preference for the host environment."),wo=p.union([p.literal("inline"),p.literal("fullscreen"),p.literal("pip")]).describe("Display mode for UI presentation."),Ow=p.union([p.literal("--color-background-primary"),p.literal("--color-background-secondary"),p.literal("--color-background-tertiary"),p.literal("--color-background-inverse"),p.literal("--color-background-ghost"),p.literal("--color-background-info"),p.literal("--color-background-danger"),p.literal("--color-background-success"),p.literal("--color-background-warning"),p.literal("--color-background-disabled"),p.literal("--color-text-primary"),p.literal("--color-text-secondary"),p.literal("--color-text-tertiary"),p.literal("--color-text-inverse"),p.literal("--color-text-ghost"),p.literal("--color-text-info"),p.literal("--color-text-danger"),p.literal("--color-text-success"),p.literal("--color-text-warning"),p.literal("--color-text-disabled"),p.literal("--color-border-primary"),p.literal("--color-border-secondary"),p.literal("--color-border-tertiary"),p.literal("--color-border-inverse"),p.literal("--color-border-ghost"),p.literal("--color-border-info"),p.literal("--color-border-danger"),p.literal("--color-border-success"),p.literal("--color-border-warning"),p.literal("--color-border-disabled"),p.literal("--color-ring-primary"),p.literal("--color-ring-secondary"),p.literal("--color-ring-inverse"),p.literal("--color-ring-info"),p.literal("--color-ring-danger"),p.literal("--color-ring-success"),p.literal("--color-ring-warning"),p.literal("--font-sans"),p.literal("--font-mono"),p.literal("--font-weight-normal"),p.literal("--font-weight-medium"),p.literal("--font-weight-semibold"),p.literal("--font-weight-bold"),p.literal("--font-text-xs-size"),p.literal("--font-text-sm-size"),p.literal("--font-text-md-size"),p.literal("--font-text-lg-size"),p.literal("--font-heading-xs-size"),p.literal("--font-heading-sm-size"),p.literal("--font-heading-md-size"),p.literal("--font-heading-lg-size"),p.literal("--font-heading-xl-size"),p.literal("--font-heading-2xl-size"),p.literal("--font-heading-3xl-size"),p.literal("--font-text-xs-line-height"),p.literal("--font-text-sm-line-height"),p.literal("--font-text-md-line-height"),p.literal("--font-text-lg-line-height"),p.literal("--font-heading-xs-line-height"),p.literal("--font-heading-sm-line-height"),p.literal("--font-heading-md-line-height"),p.literal("--font-heading-lg-line-height"),p.literal("--font-heading-xl-line-height"),p.literal("--font-heading-2xl-line-height"),p.literal("--font-heading-3xl-line-height"),p.literal("--border-radius-xs"),p.literal("--border-radius-sm"),p.literal("--border-radius-md"),p.literal("--border-radius-lg"),p.literal("--border-radius-xl"),p.literal("--border-radius-full"),p.literal("--border-width-regular"),p.literal("--shadow-hairline"),p.literal("--shadow-sm"),p.literal("--shadow-md"),p.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),Aw=p.record(Ow.describe(`Style variables for theming MCP apps.
720
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){i(s);continue}if(e.external){let 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 th(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!="object")return;th(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!="string")return;r.includes(s)||r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}function eh(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function up(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!rh.has(s))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let a=[];for(let u of t){let l=u.properties?.[s]??eh(u);l!=null&&(a.some(f=>JSON.stringify(f)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:up(a)??{allOf:a};ce(r,s,c)}for(let s of i.required??[])n.add(s)}let o={type:"object",properties:r};if(n.size&&(o.required=[...n]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let a=eh(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 g_(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of rh)if(o in e)return;let r=t.filter(o=>Xm.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=up(t);else{let o=r[0],i=Xm.find(c=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let s=t.filter(c=>c!==o),a=o[i].map(c=>up([...s,c]));if(a.some(c=>!c))return;n={[i]:a}}n&&(delete e.allOf,Rn(e,n))}function pt(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},f=c.ref;if(c.ref=null,f){n(f);let m=e.seen.get(f),g=m.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(g)):Rn(u,g),Rn(u,l),a._zod.parent===f)for(let w in u)w==="$ref"||w==="allOf"||w in l||delete u[w];if(g.$ref&&m.def)for(let w in u)w==="$ref"||w==="allOf"||w in m.def&&JSON.stringify(u[w])===JSON.stringify(m.def[w])&&delete u[w]}let d=a._zod.parent;if(d&&d!==f){n(d);let m=e.seen.get(d);if(m?.schema.$ref&&(u.$ref=m.schema.$ref,m.def))for(let g in u)g==="$ref"||g==="allOf"||g in m.def&&JSON.stringify(u[g])===JSON.stringify(m.def[g])&&delete u[g]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())n(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())th(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let f=a.get(l);f?f.push(u):a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])g_(u)}}let 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){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Rn(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,ce(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{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:xr(t,"input",e.processors),output:xr(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function ye(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return ye(n.element,r);if(n.type==="set")return ye(n.valueType,r);if(n.type==="lazy")return ye(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return ye(n.innerType,r);if(n.type==="intersection")return ye(n.left,r)||ye(n.right,r);if(n.type==="record"||n.type==="map")return ye(n.keyType,r)||ye(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ye(n.in,r)||ye(n.out,r);if(n.type==="object"){for(let o in n.shape)if(ye(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(ye(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(ye(o,r))return!0;return!!(n.rest&&ye(n.rest,r))}return!1}var rh,Xm,lp,xr,Cn=D(()=>{$n();ee();rh=new Set(["type","properties","required","additionalProperties"]),Xm=["oneOf","anyOf"];lp=(e,t={})=>r=>{let n=ut({...r,processors:t});return F(e,n),lt(n,e),pt(n,e)},xr=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},s=ut({...o??{},target:i,io:t,processors:r});return F(e,s),lt(s,e),pt(s,e)}});function re(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)y_[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&zr(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&zr(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&vr(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&vr(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&ah(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&uh(t,o.mime);for(let i of o.patterns??[])ch(t,i);return t}function Nn(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Nn(t.out):t.type==="catch"?Nn(t.innerType):e._zod.optin}function pp(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let g=e.get(t)?.def;if(!g)return t;let b=pp(e,g,r);return b===g?t:b}for(let g of["anyOf","oneOf"]){let b=t[g];if(!Array.isArray(b))continue;let w=b.map(S=>pp(e,S,r));w.some((S,$)=>S!==b[$])&&(t={...t,[g]:w})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some(g=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some(g=>typeof g=="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:f,id:d,...m}=t;return m.enum?m.enum=m.enum.map(g=>typeof g=="number"?String(g):g):typeof m.const=="number"&&(m.const=String(m.const)),o&&(m.type="string",i||(m.pattern=(n.includes("number")?Be:on).source)),m}function $_(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let r=new Map;for(let n of fp.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=pp(t,i,new Set);s!==i&&r.set(i,s)}if(r.size)for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);i&&(o.propertyNames=i)}}function fh(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(i=!0,null));return i?(te(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),Fp):JSON.parse(s)}function En(e,t){if("_idmap"in e){let n=e,o=ut({...t,processors:ts}),i={};for(let c of n._idmap.entries()){let[u,l]=c;F(l,o)}let s={},a={registry:n,uri:t?.uri,defs:i};o.external=a;for(let c of n._idmap.entries()){let[u,l]=c;lt(o,l),ce(s,u,pt(o,l))}if(Object.keys(i).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let r=ut({...t,processors:ts});return F(e,r),lt(r,e),pt(r,e)}var zr,vr,nh,ah,ch,uh,lh,oh,ih,sh,y_,b_,__,ph,dp,mp,hp,gp,yp,bp,_p,$p,wp,xp,zp,vp,kp,Sp,Pp,Ip,Tp,Op,Ap,Rp,Cp,Np,Ep,Zp,Dp,rs,jp,Mp,fp,Lp,Up,Vp,Fp,qp,Hp,Bp,Jp,Kp,Wp,ns,Gp,ts,Zn=D(()=>{St();yr();Cn();ee();zr=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},vr=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},nh=(e,t)=>{zr(e,"minimum",t),vr(e,"maximum",t)},ah=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},ch=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},uh=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},lh=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},oh=(e,t)=>zr(e,"minimum",t.minimum),ih=(e,t)=>vr(e,"maximum",t.maximum),sh=e=>(t,r)=>{lh(t,r.format);let[n,o]=e[r.format];zr(t,"minimum",n),vr(t,"maximum",o)},y_={greater_than:(e,t)=>zr(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>vr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>ah(e,t.value),number_format:sh(Wr),bigint_format:sh(Gr),min_length:oh,max_length:ih,length_equals:(e,t)=>nh(e,t.length),min_size:oh,max_size:ih,size_equals:(e,t)=>nh(e,t.size),string_format:(e,t)=>{lh(e,t.format),t.pattern&&ch(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)=>uh(e,t.mime)};b_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},__=new Map([[ui,yc],[fn,bc]]),ph=e=>__.get(e)??e,dp=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:u,laxFormat:l}=re(e);if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),a&&(o.format=b_[a]??a,o.format===""&&delete o.format,(a==="time"||l)&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let f=[...c].map(ph);f.length===1?o.pattern=f[0].source:f.length>1&&(o.allOf=[...f.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},mp=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=re(e);o.type=l?"integer":"number";let f=typeof u=="number"&&u>=(i??Number.NEGATIVE_INFINITY),d=typeof c=="number"&&c<=(s??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(f?m?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof i=="number"&&(o.minimum=i),d?m?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof s=="number"&&(o.maximum=s),a){let g=new Set;for(let S of a)Number.isFinite(S)&&S!==0?g.add(Math.abs(S)):te(e,t,o,n,`A multipleOf divisor of ${S} cannot be represented in JSON Schema`);let[b,...w]=g;b!==void 0&&(o.multipleOf=b),w.length&&(o.allOf=[...o.allOf??[],...w.map(S=>({multipleOf:S}))])}},hp=(e,t,r,n)=>{r.type="boolean"},gp=(e,t,r,n)=>{te(e,t,r,n,"BigInt cannot be represented in JSON Schema")},yp=(e,t,r,n)=>{te(e,t,r,n,"Symbols cannot be represented in JSON Schema")},bp=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},_p=(e,t,r,n)=>{te(e,t,r,n,"Undefined cannot be represented in JSON Schema")},$p=(e,t,r,n)=>{te(e,t,r,n,"Void cannot be represented in JSON Schema")},wp=(e,t,r,n)=>{r.not={}},xp=(e,t,r,n)=>{},zp=(e,t,r,n)=>{},vp=(e,t,r,n)=>{te(e,t,r,n,"Date cannot be represented in JSON Schema")},kp=(e,t,r,n)=>{let o=e._zod.def,i=nr(o.entries);if(i.length===0){r.not={};return}i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),r.enum=i},Sp=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(te(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(te(e,t,r,n,"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){let s=i[0];r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[s]:r.const=s}else i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),i.every(s=>typeof s=="boolean")&&(r.type="boolean"),i.every(s=>s===null)&&(r.type="null"),r.enum=i},Pp=(e,t,r,n)=>{te(e,t,r,n,"NaN cannot be represented in JSON Schema")},Ip=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Tp=(e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=re(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})))},Op=(e,t,r,n)=>{r.type="boolean"},Ap=(e,t,r,n)=>{te(e,t,r,n,"Custom types cannot be represented in JSON Schema")},Rp=(e,t,r,n)=>{te(e,t,r,n,"Function types cannot be represented in JSON Schema")},Cp=(e,t,r,n)=>{te(e,t,r,n,"Transforms cannot be represented in JSON Schema")},Np=(e,t,r,n)=>{te(e,t,r,n,"Map cannot be represented in JSON Schema")},Ep=(e,t,r,n)=>{te(e,t,r,n,"Set cannot be represented in JSON Schema")},Zp=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:a}=re(e);typeof s=="number"&&(o.minItems=s),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=F(i.element,t,{...n,path:[...n.path,"items"]})};Dp=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&te(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in s)ce(o.properties,u,F(s[u],t,{...n,path:[...n.path,"properties",u]}));let c=[];for(let u of Object.keys(s)){let l=i.shape[u];(t.io==="input"?Nn(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=F(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},rs=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>F(a,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=s:r.anyOf=s},jp=(e,t,r,n)=>{let o=e._zod.def,i=F(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=F(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=c,t.intersections.push(c)},Mp=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let 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((b,w)=>F(b,t,{...n,path:[...n.path,s,w]})),u=i.rest?F(i.rest,t,{...n,path:[...n.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;for(;l>0;){let b=i.items[l-1];if(!(t.io==="input"?Nn(b)!==void 0:b._zod.optout==="optional"))break;l--}let f=i.items.length,d=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=c,d?o.items=!1:u&&(o.items=u),l>0&&(o.minItems=l),d&&(o.maxItems=f)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),l>0&&(o.minItems=l),d&&(o.maxItems=f)):(o.items=c,d?o.additionalItems=!1:u&&(o.additionalItems=u),l>0&&(o.minItems=l),d&&(o.maxItems=f));let{minimum:m,maximum:g}=re(e);typeof m=="number"&&(o.minItems=m),typeof g=="number"&&(o.maxItems=g)};fp=new WeakMap;Lp=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let s=i.keyType,a=re(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let l=F(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let f of a)ce(o.patternProperties,ph(f).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=F(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=fp.get(t);l||(l=[],fp.set(t,l),t.deferred.push(()=>$_(t))),l.push(e)}o.additionalProperties=F(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let c=s._zod.values,u=t.io==="input"&&Nn(i.valueType)!==void 0;if(c&&!i.partial&&!u){let l=[...c].filter(f=>typeof f=="string"||typeof f=="number");l.length>0&&(o.required=l.map(String))}},Up=(e,t,r,n)=>{let o=e._zod.def,i=F(o.innerType,t,n),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},Vp=(e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Fp=Symbol();qp=(e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=fh(o.defaultValue,e,t,r,n);s!==Fp&&(r.default=s)},Hp=(e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=fh(o.defaultValue,e,t,r,n);s!==Fp&&(r._prefault=s)},Bp=(e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{te(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},Jp=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;F(s,t,n);let a=t.seen.get(e);a.ref=s},Kp=(e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Wp=(e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},ns=(e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Gp=(e,t,r,n)=>{let o=e._zod.innerType;F(o,t,n);let i=t.seen.get(e);i.ref=o},ts={string:dp,number:mp,boolean:hp,bigint:gp,symbol:yp,null:bp,undefined:_p,void:$p,never:wp,any:xp,unknown:zp,date:vp,enum:kp,literal:Sp,nan:Pp,template_literal:Ip,file:Tp,success:Op,custom:Ap,function:Rp,transform:Cp,map:Np,set:Ep,array:Zp,object:Dp,union:rs,intersection:jp,tuple:Mp,record:Lp,nullable:Up,nonoptional:Vp,default:qp,prefault:Hp,catch:Bp,pipe:Jp,readonly:Kp,promise:Wp,optional:ns,lazy:Gp}});var os,dh=D(()=>{Zn();Cn();os=class{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 r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=ut({processors:ts,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return F(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,lt(this.ctx,t);let n=pt(this.ctx,t),{"~standard":o,...i}=n;return i}}});var mh={};var hh=D(()=>{});var Fe={};Ue(Fe,{$ZodAny:()=>Mu,$ZodArray:()=>Hu,$ZodAsyncError:()=>xe,$ZodBase64:()=>Pu,$ZodBase64URL:()=>Iu,$ZodBigInt:()=>hi,$ZodBigIntFormat:()=>Eu,$ZodBoolean:()=>dn,$ZodCIDRv4:()=>ku,$ZodCIDRv6:()=>Su,$ZodCUID:()=>du,$ZodCUID2:()=>mu,$ZodCatch:()=>ul,$ZodCheck:()=>W,$ZodCheckBigIntFormat:()=>Mc,$ZodCheckEndsWith:()=>Qc,$ZodCheckGreaterThan:()=>Qo,$ZodCheckIncludes:()=>Wc,$ZodCheckLengthEquals:()=>Hc,$ZodCheckLessThan:()=>Go,$ZodCheckLowerCase:()=>Jc,$ZodCheckMaxLength:()=>Fc,$ZodCheckMaxSize:()=>Lc,$ZodCheckMimeType:()=>eu,$ZodCheckMinLength:()=>qc,$ZodCheckMinSize:()=>Uc,$ZodCheckMultipleOf:()=>Dc,$ZodCheckNumberFormat:()=>jc,$ZodCheckOverwrite:()=>tu,$ZodCheckProperties:()=>Xc,$ZodCheckProperty:()=>Yc,$ZodCheckRegex:()=>Bc,$ZodCheckSizeEquals:()=>Vc,$ZodCheckStartsWith:()=>Gc,$ZodCheckStringFormat:()=>hr,$ZodCheckUpperCase:()=>Kc,$ZodCodec:()=>hn,$ZodCreditCard:()=>Ou,$ZodCustom:()=>gl,$ZodCustomStringFormat:()=>Cu,$ZodCyclicError:()=>zi,$ZodDate:()=>Fu,$ZodDefault:()=>il,$ZodDiscriminatedUnion:()=>Ku,$ZodE164:()=>Tu,$ZodEmail:()=>au,$ZodEmoji:()=>pu,$ZodEncodeError:()=>ot,$ZodEnum:()=>Xu,$ZodError:()=>Ga,$ZodExactOptional:()=>nl,$ZodFile:()=>tl,$ZodFunction:()=>ml,$ZodGUID:()=>iu,$ZodIBAN:()=>Au,$ZodIPv4:()=>xu,$ZodIPv6:()=>zu,$ZodISODate:()=>_u,$ZodISODateTime:()=>bu,$ZodISODuration:()=>wu,$ZodISOTime:()=>$u,$ZodIntersection:()=>Wu,$ZodJWT:()=>Ru,$ZodKSUID:()=>yu,$ZodLazy:()=>gn,$ZodLiteral:()=>el,$ZodMAC:()=>vu,$ZodMap:()=>Qu,$ZodNaN:()=>ll,$ZodNanoID:()=>fu,$ZodNever:()=>Uu,$ZodNonOptional:()=>al,$ZodNull:()=>ju,$ZodNullable:()=>ol,$ZodNumber:()=>mi,$ZodNumberFormat:()=>Nu,$ZodObject:()=>Nm,$ZodObjectJIT:()=>Bu,$ZodOptional:()=>bi,$ZodPipe:()=>_i,$ZodPrefault:()=>sl,$ZodPreprocess:()=>pl,$ZodPromise:()=>hl,$ZodReadonly:()=>fl,$ZodRealError:()=>ze,$ZodRecord:()=>Gu,$ZodRegistry:()=>Pi,$ZodSet:()=>Yu,$ZodString:()=>It,$ZodStringFormat:()=>V,$ZodSuccess:()=>cl,$ZodSymbol:()=>Zu,$ZodTemplateLiteral:()=>dl,$ZodTransform:()=>rl,$ZodTuple:()=>yi,$ZodType:()=>O,$ZodULID:()=>hu,$ZodURL:()=>lu,$ZodUUID:()=>su,$ZodUndefined:()=>Du,$ZodUnion:()=>mn,$ZodUnknown:()=>Lu,$ZodVoid:()=>Vu,$ZodXID:()=>gu,$ZodXor:()=>Ju,$brand:()=>Co,$constructor:()=>h,$input:()=>Ti,$output:()=>Ii,Doc:()=>Pt,INVALID:()=>me,JSONSchema:()=>mh,JSONSchemaGenerator:()=>os,NEVER:()=>Ro,TimePrecision:()=>es,URL_BAD_FORMAT:()=>cu,URL_UNPARSEABLE:()=>cn,ZodCompileAsyncError:()=>Ae,ZodCompileUnsupportedError:()=>N,_any:()=>Kl,_array:()=>tp,_base64:()=>Gi,_base64url:()=>Qi,_bigint:()=>Ul,_boolean:()=>Ml,_catch:()=>l_,_check:()=>Gm,_cidrv4:()=>Ki,_cidrv6:()=>Wi,_coercedBigint:()=>Vl,_coercedBoolean:()=>Ll,_coercedDate:()=>Xl,_coercedNumber:()=>Cl,_coercedString:()=>Il,_creditCard:()=>Ol,_cuid:()=>Ui,_cuid2:()=>Vi,_custom:()=>np,_date:()=>Yl,_decode:()=>Mo,_decodeAsync:()=>Uo,_default:()=>a_,_discriminatedUnion:()=>Wb,_e164:()=>Yi,_email:()=>Ci,_emoji:()=>Mi,_encode:()=>jo,_encodeAsync:()=>Lo,_endsWith:()=>Dt,_enum:()=>t_,_file:()=>rp,_float32:()=>El,_float64:()=>Zl,_gt:()=>je,_gte:()=>ke,_guid:()=>Ni,_iban:()=>Al,_includes:()=>Et,_int:()=>Nl,_int32:()=>Dl,_int64:()=>Fl,_intersection:()=>Gb,_ipv4:()=>Bi,_ipv6:()=>Ji,_isoDate:()=>vn,_isoDateTime:()=>zn,_isoDuration:()=>Sn,_isoTime:()=>kn,_jwt:()=>Xi,_ksuid:()=>Hi,_lazy:()=>m_,_length:()=>ct,_literal:()=>n_,_lowercase:()=>Ct,_lt:()=>De,_lte:()=>ve,_mac:()=>Tl,_map:()=>Xb,_max:()=>ve,_maxLength:()=>at,_maxSize:()=>Ke,_mime:()=>Mt,_min:()=>ke,_minLength:()=>Ve,_minSize:()=>Me,_multipleOf:()=>Je,_nan:()=>ep,_nanoid:()=>Li,_nativeEnum:()=>r_,_negative:()=>In,_never:()=>Gl,_nonnegative:()=>On,_nonoptional:()=>c_,_nonpositive:()=>Tn,_normalize:()=>Lt,_null:()=>Jl,_nullable:()=>s_,_number:()=>Rl,_optional:()=>i_,_overwrite:()=>Re,_parse:()=>pr,_parseAsync:()=>fr,_pipe:()=>p_,_positive:()=>Pn,_promise:()=>h_,_properties:()=>jt,_property:()=>An,_readonly:()=>f_,_record:()=>Yb,_refine:()=>op,_regex:()=>Rt,_safeDecode:()=>Fo,_safeDecodeAsync:()=>Ho,_safeEncode:()=>Vo,_safeEncodeAsync:()=>qo,_safeParse:()=>dr,_safeParseAsync:()=>mr,_set:()=>e_,_size:()=>st,_slugify:()=>qt,_startsWith:()=>Zt,_string:()=>Pl,_stringFormat:()=>Ht,_stringbool:()=>cp,_success:()=>u_,_superRefine:()=>ip,_symbol:()=>Hl,_templateLiteral:()=>d_,_toLowerCase:()=>Vt,_toUpperCase:()=>Ft,_transform:()=>o_,_trim:()=>Ut,_tuple:()=>Qb,_uint32:()=>jl,_uint64:()=>ql,_ulid:()=>Fi,_undefined:()=>Bl,_union:()=>Jb,_unknown:()=>Wl,_uppercase:()=>Nt,_url:()=>xn,_uuid:()=>Ei,_uuidv4:()=>Zi,_uuidv6:()=>Di,_uuidv7:()=>ji,_void:()=>Ql,_xid:()=>qi,_xor:()=>Kb,base64Charset:()=>ui,base64urlCharset:()=>fn,canParseURL:()=>uu,clone:()=>L,compile:()=>Oi,compileFn:()=>Ai,config:()=>Y,createStandardJSONSchemaMethod:()=>xr,createToJSONSchemaMethod:()=>lp,decode:()=>im,decodeAsync:()=>am,describe:()=>sp,encode:()=>om,encodeAsync:()=>sm,extractDefs:()=>lt,finalize:()=>pt,flattenError:()=>ur,formatError:()=>lr,getDiscriminatedOption:()=>gi,globalConfig:()=>oe,globalRegistry:()=>ie,handleUnrepresentable:()=>te,initializeContext:()=>ut,isBackEdge:()=>ki,isRecursiveSchema:()=>vi,isValidBase64:()=>pn,isValidBase64URL:()=>li,isValidCIDRv6:()=>ci,isValidCreditCard:()=>pi,isValidIBAN:()=>fi,isValidIPv6:()=>ln,isValidJWT:()=>di,locales:()=>$r,memoizer:()=>_r,mergeValues:()=>gr,meta:()=>ap,parse:()=>tn,parseAsync:()=>rn,parseURLObject:()=>Am,prettifyError:()=>Eo,process:()=>F,processSchema:()=>F,regexes:()=>Pe,registry:()=>_n,safeDecode:()=>um,safeDecodeAsync:()=>pm,safeEncode:()=>cm,safeEncodeAsync:()=>lm,safeParse:()=>Do,safeParseAsync:()=>Ya,standardProps:()=>oi,stripTabAndNewline:()=>un,toDotPath:()=>rm,toJSONSchema:()=>En,toZod:()=>rr,treeifyError:()=>No,urlHostnameOk:()=>si,urlProtocolOk:()=>ai,util:()=>v,validate:()=>zt,validateAsync:()=>vt,validateURL:()=>ii,version:()=>ru,withParser:()=>wn});var Se=D(()=>{nt();Xa();Qa();yr();_l();Yo();nu();ee();ee();St();wl();$n();Xo();Wm();Qm();Cn();Zn();dh();hh()});function Dn(e,t){let r=typeof t=="function"?t:(s,a)=>{let c=t[s._zod.def.type];return c?c(s,a):s},n=new Map;function o(s){let a=n.get(s);if(a===gh)return new gn({type:"lazy",getter:()=>n.get(s)});if(a!==void 0)return a;n.set(s,gh);let c=i(s),u=r(c,c!==s);return n.set(s,u),u}function i(s){let a=s._zod.def,c=a.type;switch(c){case"object":{let u=a.shape,l=Object.keys(u),f=!1,d={};for(let g of l){let b=o(u[g]);b!==u[g]&&(f=!0),d[g]=b}let m=a.catchall;return a.catchall&&(m=o(a.catchall),m!==a.catchall&&(f=!0)),f?L(s,{...a,shape:d,catchall:m}):s}case"array":{let u=o(a.element);return u===a.element?s:L(s,{...a,element:u})}case"tuple":{let u=a.items,l=!1,f=[];for(let m of u){let g=o(m);g!==m&&(l=!0),f.push(g)}let d=a.rest;return a.rest&&(d=o(a.rest),d!==a.rest&&(l=!0)),l?L(s,{...a,items:f,rest:d}):s}case"record":case"map":{let u=o(a.keyType),l=o(a.valueType);return u===a.keyType&&l===a.valueType?s:L(s,{...a,keyType:u,valueType:l})}case"set":{let u=o(a.valueType);return u===a.valueType?s:L(s,{...a,valueType:u})}case"union":{let u=a.options,l=!1,f=[];for(let d of u){let m=o(d);m!==d&&(l=!0),f.push(m)}return l?L(s,{...a,options:f}):s}case"intersection":{let u=o(a.left),l=o(a.right);return u===a.left&&l===a.right?s:L(s,{...a,left:u,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let u=o(a.innerType);return u===a.innerType?s:L(s,{...a,innerType:u})}case"pipe":{let u=o(a.in),l=o(a.out);return u===a.in&&l===a.out?s:L(s,{...a,in:u,out:l})}case"function":{let u=o(a.input),l=o(a.output);return u===a.input&&l===a.output?s:L(s,{...a,input:u,output:l})}case"lazy":{let u=a.getter,{_cachedInner:l,...f}=a;return L(s,{...f,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)}var gh,Qp=D(()=>{yr();ee();gh=Symbol("z.visit/resolving")});var as={};Ue(as,{endsWith:()=>Dt,gt:()=>je,gte:()=>ke,includes:()=>Et,length:()=>ct,lowercase:()=>Ct,lt:()=>De,lte:()=>ve,maxLength:()=>at,maxSize:()=>Ke,mime:()=>Mt,minLength:()=>Ve,minSize:()=>Me,multipleOf:()=>Je,negative:()=>In,nonnegative:()=>On,nonpositive:()=>Tn,normalize:()=>Lt,overwrite:()=>Re,positive:()=>Pn,properties:()=>jt,property:()=>An,regex:()=>Rt,size:()=>st,slugify:()=>qt,startsWith:()=>Zt,toLowerCase:()=>Vt,toUpperCase:()=>Ft,trim:()=>Ut,uppercase:()=>Nt});var cs=D(()=>{Se()});function us(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var _h,$h,wh,be,Yp=D(()=>{Se();Se();ee();_h=new WeakSet([Object.prototype,Error.prototype]);$h=(e,t)=>{Ga.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);_h.has(r)||(_h.add(r),us(r,"format",n=>o=>lr(n,o)),us(r,"flatten",n=>o=>ur(n,o)),us(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,or,2)}),us(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,or,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},wh=h("ZodError",$h),be=h("ZodError",$h,void 0,{Parent:Error})});var ls,ps,fs,ds,ms,hs,gs,ys,bs,_s,$s,ws,Xp=D(()=>{Se();Yp();Se();ls=pr(be),ps=fr(be),fs=dr(be),ds=mr(be),ms=jo(be),hs=Mo(be),gs=Lo(be),ys=Uo(be),bs=Vo(be),_s=Fo(be),$s=qo(be),ws=Ho(be)});var Dr={};Ue(Dr,{ZodAny:()=>Is,ZodArray:()=>Rs,ZodBase64:()=>eo,ZodBase64URL:()=>to,ZodBigInt:()=>Yt,ZodBigIntFormat:()=>oo,ZodBoolean:()=>Qt,ZodCIDRv4:()=>Yn,ZodCIDRv6:()=>Xn,ZodCUID:()=>Hn,ZodCUID2:()=>Bn,ZodCatch:()=>Qs,ZodCodec:()=>Nr,ZodCreditCard:()=>zs,ZodCustom:()=>Er,ZodCustomStringFormat:()=>ft,ZodDate:()=>Ir,ZodDefault:()=>Hs,ZodDiscriminatedUnion:()=>Ns,ZodE164:()=>ro,ZodEmail:()=>Un,ZodEmoji:()=>Fn,ZodEnum:()=>Jt,ZodExactOptional:()=>ao,ZodFile:()=>Us,ZodFunction:()=>aa,ZodGUID:()=>Vn,ZodIBAN:()=>vs,ZodIPv4:()=>Gn,ZodIPv6:()=>Qn,ZodISODate:()=>Ge,ZodISODateTime:()=>We,ZodISODuration:()=>Ye,ZodISOTime:()=>Qe,ZodInstanceOf:()=>la,ZodIntersection:()=>Es,ZodJWT:()=>no,ZodKSUID:()=>Wn,ZodLazy:()=>oa,ZodLiteral:()=>Ls,ZodMAC:()=>xs,ZodMap:()=>js,ZodNaN:()=>Xs,ZodNanoID:()=>qn,ZodNever:()=>Os,ZodNonOptional:()=>co,ZodNull:()=>Ps,ZodNullable:()=>qs,ZodNumber:()=>Gt,ZodNumberFormat:()=>dt,ZodObject:()=>Tr,ZodOptional:()=>Rr,ZodPipe:()=>Cr,ZodPrefault:()=>Js,ZodPreprocess:()=>ea,ZodPromise:()=>sa,ZodReadonly:()=>ta,ZodRecord:()=>Bt,ZodSet:()=>Ms,ZodString:()=>Wt,ZodStringFormat:()=>H,ZodSuccess:()=>Gs,ZodSymbol:()=>ks,ZodTemplateLiteral:()=>na,ZodTransform:()=>Vs,ZodTuple:()=>Zs,ZodType:()=>A,ZodULID:()=>Jn,ZodURL:()=>Sr,ZodUUID:()=>Le,ZodUndefined:()=>Ss,ZodUnion:()=>Or,ZodUnknown:()=>Ts,ZodVoid:()=>As,ZodXID:()=>Kn,ZodXor:()=>Cs,_ZodString:()=>Ln,_default:()=>Bs,_function:()=>sd,any:()=>Uf,array:()=>C,base64:()=>wf,base64url:()=>xf,bigint:()=>Zf,boolean:()=>X,catch:()=>Ys,check:()=>ad,cidrv4:()=>_f,cidrv6:()=>$f,codec:()=>rd,creditCard:()=>vf,cuid:()=>pf,cuid2:()=>ff,currencyCode:()=>Of,custom:()=>uo,date:()=>Ff,describe:()=>cd,discriminatedUnion:()=>Ar,e164:()=>zf,email:()=>ef,emoji:()=>uf,enum:()=>ae,exactOptional:()=>Fs,file:()=>Yf,float32:()=>Rf,float64:()=>Cf,function:()=>sd,guid:()=>tf,hash:()=>Af,hex:()=>Tf,hostname:()=>If,httpUrl:()=>cf,iban:()=>kf,instanceof:()=>ld,int:()=>jn,int32:()=>Nf,int64:()=>Df,intersection:()=>Xt,invertCodec:()=>nd,ipv4:()=>gf,ipv6:()=>bf,json:()=>fd,jwt:()=>Sf,keyof:()=>qf,ksuid:()=>hf,lazy:()=>ia,literal:()=>k,looseObject:()=>se,looseRecord:()=>Kf,mac:()=>yf,map:()=>Wf,meta:()=>ud,nan:()=>td,nanoid:()=>lf,nativeEnum:()=>Qf,never:()=>io,nonoptional:()=>Ws,null:()=>Pr,nullable:()=>kr,nullish:()=>Xf,number:()=>j,object:()=>z,optional:()=>q,partialRecord:()=>Jf,pipe:()=>Mn,prefault:()=>Ks,preprocess:()=>Zr,promise:()=>id,readonly:()=>ra,record:()=>B,refine:()=>ca,set:()=>Gf,strictObject:()=>Hf,string:()=>y,stringFormat:()=>Pf,stringbool:()=>pd,success:()=>ed,superRefine:()=>ua,symbol:()=>Mf,templateLiteral:()=>od,transform:()=>so,tuple:()=>Ds,uint32:()=>Ef,uint64:()=>jf,ulid:()=>df,undefined:()=>Lf,union:()=>U,unknown:()=>K,url:()=>af,uuid:()=>rf,uuidv4:()=>nf,uuidv6:()=>of,uuidv7:()=>sf,void:()=>Vf,xid:()=>mf,xor:()=>Bf});function z_(){oe.localeError||Y(Si())}function Kt(){oe.memoizer||Y({memoizer:_r()})}function y(e){return Pl(Wt,e)}function ef(e){return Ci(Un,e)}function tf(e){return Ni(Vn,e)}function rf(e){return Ei(Le,e)}function nf(e){return Zi(Le,e)}function of(e){return Di(Le,e)}function sf(e){return ji(Le,e)}function af(e){return xn(Sr,e)}function cf(e){return xn(Sr,{protocol:nn,hostname:$c,...v.normalizeParams(e)})}function uf(e){return Mi(Fn,e)}function lf(e){return Li(qn,e)}function pf(e){return Ui(Hn,e)}function ff(e){return Vi(Bn,e)}function df(e){return Fi(Jn,e)}function mf(e){return qi(Kn,e)}function hf(e){return Hi(Wn,e)}function gf(e){return Bi(Gn,e)}function yf(e){return Tl(xs,e)}function bf(e){return Ji(Qn,e)}function _f(e){return Ki(Yn,e)}function $f(e){return Wi(Xn,e)}function wf(e){return Gi(eo,e)}function xf(e){return Qi(to,e)}function zf(e){return Yi(ro,e)}function vf(e){return Ol(zs,e)}function kf(e){return Al(vs,e)}function Sf(e){return Xi(no,e)}function Pf(e,t,r={}){return Ht(ft,e,t,r)}function If(e){return Ht(ft,"hostname",_c,e)}function Tf(e){return Ht(ft,"hex",Nc,e)}function Of(e){return Ht(ft,"currency_code",xc,e)}function Af(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=Pe[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return Ht(ft,n,o,t)}function j(e){return Rl(Gt,e)}function jn(e){return Nl(dt,e)}function Rf(e){return El(dt,e)}function Cf(e){return Zl(dt,e)}function Nf(e){return Dl(dt,e)}function Ef(e){return jl(dt,e)}function X(e){return Ml(Qt,e)}function Zf(e){return Ul(Yt,e)}function Df(e){return Fl(oo,e)}function jf(e){return ql(oo,e)}function Mf(e){return Hl(ks,e)}function Lf(e){return Bl(Ss,e)}function Pr(e){return Jl(Ps,e)}function Uf(){return Kl(Is)}function K(){return Wl(Ts)}function io(e){return Gl(Os,e)}function Vf(e){return Ql(As,e)}function Ff(e){return Yl(Ir,e)}function C(e,t){return tp(Rs,e,t)}function qf(e){let t=e._zod.def.shape;return ae(Object.keys(t))}function z(e,t){let r={type:"object",shape:e??{},...v.normalizeParams(t)};return new Tr(r)}function Hf(e,t){return new Tr({type:"object",shape:e,catchall:io(),...v.normalizeParams(t)})}function se(e,t){return new Tr({type:"object",shape:e,catchall:K(),...v.normalizeParams(t)})}function U(e,t){return new Or({type:"union",options:e,...v.normalizeParams(t)})}function Bf(e,t){return new Cs({type:"union",options:e,inclusive:!1,...v.normalizeParams(t)})}function Ar(e,t,r){return new Ns({type:"union",options:t,discriminator:e,...v.normalizeParams(r)})}function Xt(e,t){return new Es({type:"intersection",left:e,right:t})}function Ds(e,t,r){let n=t instanceof O,o=n?r:t,i=n?t:null;return new Zs({type:"tuple",items:e,rest:i,...v.normalizeParams(o)})}function B(e,t,r){return!t||!t._zod?new Bt({type:"record",keyType:y(),valueType:e,...v.normalizeParams(t)}):new Bt({type:"record",keyType:e,valueType:t,...v.normalizeParams(r)})}function Jf(e,t,r){return new Bt({type:"record",keyType:e,valueType:t,...v.normalizeParams(r),partial:!0})}function Kf(e,t,r){return new Bt({type:"record",keyType:e,valueType:t,mode:"loose",...v.normalizeParams(r)})}function Wf(e,t,r){return new js({type:"map",keyType:e,valueType:t,...v.normalizeParams(r)})}function Gf(e,t){return new Ms({type:"set",valueType:e,...v.normalizeParams(t)})}function ae(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Jt({type:"enum",entries:r,...v.normalizeParams(t)})}function Qf(e,t){return new Jt({type:"enum",entries:e,...v.normalizeParams(t)})}function k(e,t){return new Ls({type:"literal",values:Array.isArray(e)?e:[e],...v.normalizeParams(t)})}function Yf(e){return rp(Us,e)}function so(e){return new Vs({type:"transform",transform:e})}function q(e){return new Rr({type:"optional",innerType:e})}function Fs(e){return new ao({type:"optional",innerType:e})}function kr(e){return new qs({type:"nullable",innerType:e})}function Xf(e){return q(kr(e))}function Bs(e,t){return new Hs({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():v.shallowClone(t)}})}function Ks(e,t){return new Js({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():v.shallowClone(t)}})}function Ws(e,t){return new co({type:"nonoptional",innerType:e,...v.normalizeParams(t)})}function ed(e){return new Gs({type:"success",innerType:e})}function Ys(e,t){return new Qs({type:"catch",innerType:e,catchValue:typeof t=="function"?t:v.constantCatch(t)})}function td(e){return ep(Xs,e)}function Mn(e,t){return new Cr({type:"pipe",in:e,out:t})}function rd(e,t,r){return new Nr({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function nd(e){let t=e._zod.def;return new Nr({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}function ra(e){return new ta({type:"readonly",innerType:e})}function od(e,t){return new na({type:"template_literal",parts:e,...v.normalizeParams(t)})}function ia(e){return new oa({type:"lazy",getter:e})}function id(e){return new sa({type:"promise",innerType:e})}function sd(e){return new aa({type:"function",input:Array.isArray(e?.input)?Ds(e?.input):e?.input??C(K()),output:e?.output??K()})}function ad(e){let t=new W({check:"custom"});return t._zod.check=e,t}function uo(e,t){return np(Er,e??(()=>!0),t)}function ca(e,t={}){return op(Er,e,t)}function ua(e,t){return ip(e,t)}function ld(e,t={}){let r=new la({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...v.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}function fd(e){let t=ia(()=>U([y(e),j(),X(),Pr(),C(t),B(y(),t)]));return t}function Zr(e,t){return new ea({type:"pipe",in:so(e),out:t})}var A,Ln,Wt,H,We,Ge,Qe,Ye,Un,Vn,Le,Sr,Fn,qn,Hn,Bn,Jn,Kn,Wn,Gn,xs,Qn,Yn,Xn,eo,to,ro,zs,vs,no,ft,Gt,dt,Qt,Yt,oo,ks,Ss,Ps,Is,Ts,Os,As,Ir,Rs,Tr,Or,Cs,Ns,Es,Zs,Bt,js,Ms,Jt,Ls,Us,Vs,Rr,ao,qs,Hs,Js,co,Gs,Qs,Xs,Cr,Nr,ea,ta,na,oa,sa,aa,Er,cd,ud,la,pd,mt=D(()=>{Se();Se();Zn();St();Cn();$l();cs();Xp();A=h("ZodType",(e,t)=>(z_(),O.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(v.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return L(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(ca(e,t))},superRefine(e,t){return this.check(ua(e,t))},overwrite(e){return this.check(Re(e))},optional(){return q(this)},exactOptional(){return Fs(this)},nullable(){return kr(this)},nullish(){return q(kr(this))},nonoptional(e){return Ws(this,e)},array(){return C(this)},or(e){return U([this,e])},and(e){return Xt(this,e)},transform(e){return Mn(this,so(e))},default(e){return Bs(this,e)},prefault(e){return Ks(this,e)},catch(e){return Ys(this,e)},pipe(e){return Mn(this,e)},readonly(){return ra(this)},describe(e){let t=this.clone();return ie.add(t,{description:e}),t},meta(...e){if(e.length===0)return ie.get(this);let t=this.clone();return ie.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 v.hide(this,"~standard",{...oi(this),jsonSchema:{input:xr(this,"input"),output:xr(this,"output")}})},set"~standard"(e){v.own(this,"~standard",e)},parse:function e(t,r){return ls(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await ps(this,t,r,{callee:e})},safeParse(e,t){return fs(this,e,t)},async safeParseAsync(e,t){return ds(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){v.own(this,"spa",e)},validate(e,t){return zt(this,e,t)},validateAsync(e,t){return vt(this,e,t)},encode:function e(t,r){return ms(this,t,r,{callee:e})},decode:function e(t,r){return hs(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await gs(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await ys(this,t,r,{callee:e})},safeEncode(e,t){return bs(this,e,t)},safeDecode(e,t){return _s(this,e,t)},async safeEncodeAsync(e,t){return $s(this,e,t)},async safeDecodeAsync(e,t){return ws(this,e,t)},toJSONSchema(e){return lp(this,{})(e)},get description(){return ie.get(this)?.description},get _def(){return this._zod.def}}),Ln=h("_ZodString",(e,t)=>{It.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dp(e,r,n,o)},v.derived({format:e=>re(e).format??null,minLength:e=>re(e).minimum??null,maxLength:e=>re(e).maximum??null},{regex(...e){return this.check(Rt(...e))},includes(...e){return this.check(Et(...e))},startsWith(...e){return this.check(Zt(...e))},endsWith(...e){return this.check(Dt(...e))},min(...e){return this.check(Ve(...e))},max(...e){return this.check(at(...e))},length(...e){return this.check(ct(...e))},nonempty(...e){return this.check(Ve(1,...e))},lowercase(e){return this.check(Ct(e))},uppercase(e){return this.check(Nt(e))},trim(){return this.check(Ut())},normalize(...e){return this.check(Lt(...e))},toLowerCase(){return this.check(Vt())},toUpperCase(){return this.check(Ft())},slugify(){return this.check(qt())}})),Wt=h("ZodString",(e,t)=>{It.init(e,t),Ln.init(e,t)},{email(e){return this.check(Ci(Un,e))},url(e){return this.check(xn(Sr,e))},jwt(e){return this.check(Xi(no,e))},emoji(e){return this.check(Mi(Fn,e))},guid(e){return this.check(Ni(Vn,e))},uuid(e){return this.check(Ei(Le,e))},uuidv4(e){return this.check(Zi(Le,e))},uuidv6(e){return this.check(Di(Le,e))},uuidv7(e){return this.check(ji(Le,e))},nanoid(e){return this.check(Li(qn,e))},cuid(e){return this.check(Ui(Hn,e))},cuid2(e){return this.check(Vi(Bn,e))},ulid(e){return this.check(Fi(Jn,e))},base64(e){return this.check(Gi(eo,e))},base64url(e){return this.check(Qi(to,e))},xid(e){return this.check(qi(Kn,e))},ksuid(e){return this.check(Hi(Wn,e))},ipv4(e){return this.check(Bi(Gn,e))},ipv6(e){return this.check(Ji(Qn,e))},cidrv4(e){return this.check(Ki(Yn,e))},cidrv6(e){return this.check(Wi(Xn,e))},e164(e){return this.check(Yi(ro,e))},datetime(e){return this.check(zn(We,e))},date(e){return this.check(vn(Ge,e))},time(e){return this.check(kn(Qe,e))},duration(e){return this.check(Sn(Ye,e))}});H=h("ZodStringFormat",(e,t)=>{V.init(e,t),Ln.init(e,t)}),We=h("ZodISODateTime",(e,t)=>{bu.init(e,t),H.init(e,t)}),Ge=h("ZodISODate",(e,t)=>{_u.init(e,t),H.init(e,t)}),Qe=h("ZodISOTime",(e,t)=>{$u.init(e,t),H.init(e,t)}),Ye=h("ZodISODuration",(e,t)=>{wu.init(e,t),H.init(e,t)}),Un=h("ZodEmail",(e,t)=>{au.init(e,t),H.init(e,t)});Vn=h("ZodGUID",(e,t)=>{iu.init(e,t),H.init(e,t)});Le=h("ZodUUID",(e,t)=>{su.init(e,t),H.init(e,t)});Sr=h("ZodURL",(e,t)=>{lu.init(e,t),H.init(e,t)});Fn=h("ZodEmoji",(e,t)=>{pu.init(e,t),H.init(e,t)});qn=h("ZodNanoID",(e,t)=>{fu.init(e,t),H.init(e,t)});Hn=h("ZodCUID",(e,t)=>{du.init(e,t),H.init(e,t)});Bn=h("ZodCUID2",(e,t)=>{mu.init(e,t),H.init(e,t)});Jn=h("ZodULID",(e,t)=>{hu.init(e,t),H.init(e,t)});Kn=h("ZodXID",(e,t)=>{gu.init(e,t),H.init(e,t)});Wn=h("ZodKSUID",(e,t)=>{yu.init(e,t),H.init(e,t)});Gn=h("ZodIPv4",(e,t)=>{xu.init(e,t),H.init(e,t)});xs=h("ZodMAC",(e,t)=>{vu.init(e,t),H.init(e,t)});Qn=h("ZodIPv6",(e,t)=>{zu.init(e,t),H.init(e,t)});Yn=h("ZodCIDRv4",(e,t)=>{ku.init(e,t),H.init(e,t)});Xn=h("ZodCIDRv6",(e,t)=>{Su.init(e,t),H.init(e,t)});eo=h("ZodBase64",(e,t)=>{Pu.init(e,t),H.init(e,t)});to=h("ZodBase64URL",(e,t)=>{Iu.init(e,t),H.init(e,t)});ro=h("ZodE164",(e,t)=>{Tu.init(e,t),H.init(e,t)});zs=h("ZodCreditCard",(e,t)=>{Ou.init(e,t),H.init(e,t)});vs=h("ZodIBAN",(e,t)=>{Au.init(e,t),H.init(e,t)});no=h("ZodJWT",(e,t)=>{Ru.init(e,t),H.init(e,t)});ft=h("ZodCustomStringFormat",(e,t)=>{Cu.init(e,t),H.init(e,t)});Gt=h("ZodNumber",(e,t)=>{mi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mp(e,r,n,o),e.isFinite=!0},v.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=re(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=re(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=re(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>re(e).format??null},{gt(e,t){return this.check(je(e,t))},gte(e,t){return this.check(ke(e,t))},min(e,t){return this.check(ke(e,t))},lt(e,t){return this.check(De(e,t))},lte(e,t){return this.check(ve(e,t))},max(e,t){return this.check(ve(e,t))},int(e){return this.check(jn(e))},safe(e){return this.check(jn(e))},positive(e){return this.check(je(0,e))},nonnegative(e){return this.check(ke(0,e))},negative(e){return this.check(De(0,e))},nonpositive(e){return this.check(ve(0,e))},multipleOf(e,t){return this.check(Je(e,t))},step(e,t){return this.check(Je(e,t))},finite(){return this}}));dt=h("ZodNumberFormat",(e,t)=>{Nu.init(e,t),Gt.init(e,t)});Qt=h("ZodBoolean",(e,t)=>{dn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hp(e,r,n,o)});Yt=h("ZodBigInt",(e,t)=>{hi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gp(e,r,n,o)},v.derived({minValue:e=>re(e).minimum??null,maxValue:e=>re(e).maximum??null,format:e=>re(e).format??null},{gte(e,t){return this.check(ke(e,t))},min(e,t){return this.check(ke(e,t))},gt(e,t){return this.check(je(e,t))},lt(e,t){return this.check(De(e,t))},lte(e,t){return this.check(ve(e,t))},max(e,t){return this.check(ve(e,t))},positive(e){return this.check(je(BigInt(0),e))},negative(e){return this.check(De(BigInt(0),e))},nonpositive(e){return this.check(ve(BigInt(0),e))},nonnegative(e){return this.check(ke(BigInt(0),e))},multipleOf(e,t){return this.check(Je(e,t))}}));oo=h("ZodBigIntFormat",(e,t)=>{Eu.init(e,t),Yt.init(e,t)});ks=h("ZodSymbol",(e,t)=>{Zu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yp(e,r,n,o)});Ss=h("ZodUndefined",(e,t)=>{Du.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_p(e,r,n,o)});Ps=h("ZodNull",(e,t)=>{ju.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bp(e,r,n,o)});Is=h("ZodAny",(e,t)=>{Mu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xp(e,r,n,o)});Ts=h("ZodUnknown",(e,t)=>{Lu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zp(e,r,n,o)});Os=h("ZodNever",(e,t)=>{Uu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wp(e,r,n,o)});As=h("ZodVoid",(e,t)=>{Vu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$p(e,r,n,o)});Ir=h("ZodDate",(e,t)=>{Fu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vp(e,r,n,o),e.min=(r,n)=>e.check(ke(r,n)),e.max=(r,n)=>e.check(ve(r,n))},v.derived({minDate:e=>{let{minimum:t}=re(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=re(e);return t?new Date(t):null}},{}));Rs=h("ZodArray",(e,t)=>{Kt(),Hu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zp(e,r,n,o),e.element=t.element},{min(e,t){return this.check(Ve(e,t))},nonempty(e){return this.check(Ve(1,e))},max(e,t){return this.check(at(e,t))},length(e,t){return this.check(ct(e,t))},unwrap(){return this.element}});Tr=h("ZodObject",(e,t)=>{Kt(),Bu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dp(e,r,n,o),v.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return ae(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(v.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(v.mergeDefs(this._zod.def,{catchall:K()}))},loose(){return this.clone(v.mergeDefs(this._zod.def,{catchall:K()}))},strict(){return this.clone(v.mergeDefs(this._zod.def,{catchall:io()}))},strip(){return this.clone(v.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return v.extend(this,e)},safeExtend(e){return v.safeExtend(this,e)},merge(e){return v.merge(this,e)},pick(e){return v.pick(this,e)},omit(e){return v.omit(this,e)},partial(...e){return v.partial(Rr,this,e[0])},exactPartial(...e){return v.partial(ao,this,e[0],"exactPartial")},required(...e){return v.required(co,this,e[0])}});Or=h("ZodUnion",(e,t)=>{mn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rs(e,r,n,o),e.options=t.options});Cs=h("ZodXor",(e,t)=>{Or.init(e,t),Ju.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rs(e,r,n,o),e.options=t.options});Ns=h("ZodDiscriminatedUnion",(e,t)=>{Or.init(e,t),Ku.init(e,t)});Es=h("ZodIntersection",(e,t)=>{Wu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jp(e,r,n,o)});Zs=h("ZodTuple",(e,t)=>{Kt(),yi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mp(e,r,n,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let 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 Rr({type:"optional",innerType:t}))})}});Bt=h("ZodRecord",(e,t)=>{Kt(),Gu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lp(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});js=h("ZodMap",(e,t)=>{Kt(),Qu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Np(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Me(...r)),e.nonempty=r=>e.check(Me(1,r)),e.max=(...r)=>e.check(Ke(...r)),e.size=(...r)=>e.check(st(...r))});Ms=h("ZodSet",(e,t)=>{Kt(),Yu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ep(e,r,n,o),e.min=(...r)=>e.check(Me(...r)),e.nonempty=r=>e.check(Me(1,r)),e.max=(...r)=>e.check(Ke(...r)),e.size=(...r)=>e.check(st(...r))});Jt=h("ZodEnum",(e,t)=>{Xu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(n,o,i)=>kp(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Jt({...t,checks:[],...v.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Jt({...t,checks:[],...v.normalizeParams(o),entries:i})}});Ls=h("ZodLiteral",(e,t)=>{el.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sp(e,r,n,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]}})});Us=h("ZodFile",(e,t)=>{tl.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Tp(e,r,n,o),e.min=(r,n)=>e.check(Me(r,n)),e.max=(r,n)=>e.check(Ke(r,n)),e.mime=(r,n)=>e.check(Mt(Array.isArray(r)?r:[r],n))});Vs=h("ZodTransform",(e,t)=>{Kt(),rl.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cp(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ot(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(v.issue(i,r.value,t));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=r.value),s.inst??(s.inst=e),r.issues.push(v.issue(s))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});Rr=h("ZodOptional",(e,t)=>{bi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ns(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});ao=h("ZodExactOptional",(e,t)=>{nl.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ns(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});qs=h("ZodNullable",(e,t)=>{ol.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Up(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});Hs=h("ZodDefault",(e,t)=>{il.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});Js=h("ZodPrefault",(e,t)=>{sl.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});co=h("ZodNonOptional",(e,t)=>{al.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});Gs=h("ZodSuccess",(e,t)=>{cl.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Op(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});Qs=h("ZodCatch",(e,t)=>{ul.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});Xs=h("ZodNaN",(e,t)=>{ll.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pp(e,r,n,o)});Cr=h("ZodPipe",(e,t)=>{_i.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jp(e,r,n,o),e.in=t.in,e.out=t.out});Nr=h("ZodCodec",(e,t)=>{Cr.init(e,t),hn.init(e,t)});ea=h("ZodPreprocess",(e,t)=>{Cr.init(e,t),pl.init(e,t)}),ta=h("ZodReadonly",(e,t)=>{fl.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});na=h("ZodTemplateLiteral",(e,t)=>{dl.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ip(e,r,n,o)});oa=h("ZodLazy",(e,t)=>{gn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gp(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});sa=h("ZodPromise",(e,t)=>{hl.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});aa=h("ZodFunction",(e,t)=>{ml.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rp(e,r,n,o)});Er=h("ZodCustom",(e,t)=>{gl.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ap(e,r,n,o)});cd=sp,ud=ap,la=h("ZodInstanceOf",(e,t)=>{Er.init(e,t)},{properties(e,t){return this.check(jt(e,t))}});pd=(...e)=>cp({Codec:Nr,Boolean:Qt,String:Wt},...e)});function zh(e){Y({customError:e})}function vh(){return Y().customError}var xh,pa,kh=D(()=>{Se();xh={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"};pa||(pa={})});var ht={};Ue(ht,{ZodISODate:()=>Ge,ZodISODateTime:()=>We,ZodISODuration:()=>Ye,ZodISOTime:()=>Qe,date:()=>k_,datetime:()=>v_,duration:()=>P_,time:()=>S_});function v_(e){return zn(We,e)}function k_(e){return vn(Ge,e)}function S_(e){return kn(Qe,e)}function P_(e){return Sn(Ye,e)}var fa=D(()=>{Se();mt();mt()});function T_(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function Sh(e,t){return e.map((r,n)=>n<t?r:r.optional())}function O_(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function A_(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let n=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===n){let o=r[1]===void 0?void 0:O_(r[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 R_(e,t){return x.transform(n=>n).check(n=>{let o=n.value;if(typeof o!="object"||o===null||Array.isArray(o))return;let i=Object.getOwnPropertyNames(o);if(t.minProperties!==void 0&&i.length<t.minProperties&&n.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&&n.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(let s of i){let a=t.keySchema.safeParse(s);a.success||n.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:s,path:[s],continue:!0})}}).pipe(e)}function dd(e,t){if(e===null)return"z";let r=typeof e;if(r!=="object"){if(r==="number"&&Number.isNaN(e))return null;let n=String(e);return`${r[0]}${n.length}:${n}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let i=[];for(let s of e){let a=dd(s,t);if(a===null)return null;i.push(a)}return`a${i.length}:[${i.join(",")}]`}let n=Object.keys(e).sort(),o=[];for(let i of n){let s=dd(e[i],t);if(s===null)return null;o.push(`${i.length}:${i}=${s}`)}return`o${o.length}:{${o.join(",")}}`}finally{t.delete(e)}}function lo(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(lo):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,r])=>C_.has(t)?lo(r):!N_.has(t)||typeof r!="object"||r===null?!1:Object.values(r).some(lo))}function Ph(e){return e===1?"element":"elements"}function E_(e,t){return x.transform(n=>n).check(n=>{let o=n.value;if(Array.isArray(o)){if(t.uniqueItems===!0){let i=new Map;for(let s=0;s<o.length;s++){let a=dd(o[s],new Set);if(a===null)continue;let c=i.get(a);if(c===void 0){i.set(a,s);continue}n.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){let i=t.minContains??1,s=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let c of o)if(t.containsSchema.safeParse(c).success&&++a>=s)break;a<i&&n.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${Ph(i)}; found ${a}`,input:o,continue:!0}),t.maxContains!==void 0&&a>t.maxContains&&n.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${Ph(t.maxContains)}`,input:o,continue:!0})}}}).pipe(e)}function Ih(e,t){if(e!==!1)return e===void 0||e===!0?x.any():_e(e,t)}function Th(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return x.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){let o=e.$ref;if(t.refs.has(o))return t.refs.get(o);if(t.processing.has(o))return x.lazy(()=>{if(!t.refs.has(o))throw new Error(`Circular reference not resolved: ${o}`);return t.refs.get(o)});t.processing.add(o);let i=A_(o,t),s=_e(i,t);return t.refs.set(o,s),t.processing.delete(o),s}if(e.enum!==void 0){let o=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&o.length===1&&o[0]===null)return x.null();if(o.length===0)return x.never();if(o.length===1)return x.literal(o[0]);if(o.every(s=>typeof s=="string"))return x.enum(o);let i=o.map(s=>x.literal(s));return i.length<2?i[0]:x.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return x.literal(e.const);let r=e.type;if(Array.isArray(r)){let o=r.map(i=>{let s={...e,type:i};return Th(s,t)});return o.length===0?x.never():o.length===1?o[0]:x.union(o)}if(!r)return x.any();let n;switch(r){case"string":{let o=x.string();if(e.format){let i=e.format;i==="email"?o=o.check(x.email()):i==="uri"||i==="uri-reference"?o=o.check(x.url()):i==="uuid"||i==="guid"?o=o.check(x.uuid()):i==="date-time"?o=o.check(x.iso.datetime({offset:!0})):i==="date"?o=o.check(x.iso.date()):i==="time"?o=o.check(x.regex(Z_)):i==="duration"?o=o.check(x.iso.duration()):i==="hostname"?o=o.check(x.hostname()):i==="ipv4"?o=o.check(x.ipv4()):i==="ipv6"?o=o.check(x.ipv6()):i==="mac"?o=o.check(x.mac()):i==="cidr"?o=o.check(x.cidrv4()):i==="cidr-v6"?o=o.check(x.cidrv6()):i==="base64"?o=o.check(x.base64()):i==="base64url"?o=o.check(x.base64url()):i==="e164"?o=o.check(x.e164()):i==="credit_card"?o=o.check(x.creditCard()):i==="iban"?o=o.check(x.iban()):i==="jwt"?o=o.check(x.jwt()):i==="emoji"?o=o.check(x.emoji()):i==="nanoid"?o=o.check(x.nanoid()):i==="cuid"?o=o.check(x.cuid()):i==="cuid2"?o=o.check(x.cuid2()):i==="ulid"?o=o.check(x.ulid()):i==="xid"?o=o.check(x.xid()):i==="ksuid"&&(o=o.check(x.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))),n=o;break}case"number":case"integer":{let o=r==="integer"?x.number().int():x.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)),n=o;break}case"boolean":{n=x.boolean();break}case"null":{n=x.null();break}case"object":{let o={},i=e.properties||{},s=new Set(e.required||[]),a=typeof e.additionalProperties=="object"?_e(e.additionalProperties,t):void 0;for(let[f,d]of Object.entries(i)){let m=_e(d,t);ce(o,f,s.has(f)?m:m.optional())}if(e.patternProperties){let f=e.patternProperties,d=Object.keys(f),m=[];for(let b of d){let w=_e(f[b],t),S=x.string().regex(new RegExp(b));m.push(x.looseRecord(S,w))}let g=[];if(Object.keys(o).length>0&&g.push(x.object(o).passthrough()),g.push(...m),g.length===0)n=x.object({}).passthrough();else if(g.length===1)n=g[0];else{let b=x.intersection(g[0],g[1]);for(let w=2;w<g.length;w++)b=x.intersection(b,g[w]);n=b}if(e.additionalProperties===!1){let b=Object.keys(o),w=d.map($=>new RegExp($)),S=n;n=n.check($=>{if(!Te($.value))return;let P=[];for(let E of Object.keys($.value))b.includes(E)||w.some(G=>G.test(E))||P.push(E);P.length&&$.issues.push({code:"unrecognized_keys",keys:P,input:$.value,inst:S})})}}else{let f=x.object(o);e.additionalProperties===!1?n=f.strict():a?n=f.catchall(a):n=f.passthrough()}let 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 f;if(c){let d=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;f=_e(d,t)}n=R_(n,{keySchema:f,minProperties:u,maxProperties:l})}break}case"array":{let o=e.prefixItems,i=e.items;if(o&&Array.isArray(o)){let s=typeof e.minItems=="number"?e.minItems:0,a=o.map(f=>_e(f,t)),c=Sh(a,s),u=Array.isArray(i)?void 0:Ih(i,t),l=x.tuple(c);n=u?l.rest(u):l,typeof e.minItems=="number"&&(n=n.check(x.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(x.maxLength(e.maxItems)))}else if(Array.isArray(i)){let s=typeof e.minItems=="number"?e.minItems:0,a=i.map(f=>_e(f,t)),c=Sh(a,s),u=Ih(e.additionalItems,t),l=x.tuple(c);n=u?l.rest(u):l,typeof e.minItems=="number"&&(n=n.check(x.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(x.maxLength(e.maxItems)))}else if(i!==void 0){let s=_e(i,t),a=x.array(s);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),n=a}else n=x.array(x.any());(e.uniqueItems===!0||e.contains!==void 0)&&(n=E_(n,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?_e(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: ${r}`)}return n}function _e(e,t){if(typeof e=="boolean")return e?x.any():x.never();let r=Th(e,t),n=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(u=>_e(u,t)),c=x.union(a);r=n?x.intersection(r,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(u=>_e(u,t)),c=x.xor(a);r=n?x.intersection(r,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=n?r:x.any();else{let a=n?r:_e(e.allOf[0],t),c=n?0:1;for(let u=c;u<e.allOf.length;u++)a=x.intersection(a,_e(e.allOf[u],t));r=a}e.nullable===!0&&t.version==="openapi-3.0"&&(r=x.nullable(r)),e.readOnly===!0&&(r=x.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)a in e&&(o[a]=e[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in e&&(o[a]=e[a]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!lo(e.propertyNames)&&(o.propertyNames=e.propertyNames);for(let a of["minProperties","maxProperties"])e[a]!==void 0&&(o[a]=e[a])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!lo(e.contains)&&(o.contains=e.contains);for(let a of["uniqueItems","minContains","maxContains"])e[a]!==void 0&&(o[a]=e[a])}for(let a of Object.keys(e))I_.has(a)||ce(o,a,e[a]);return Object.keys(o).length>0&&t.registry.add(r,o),e.description&&(r=r.describe(e.description)),r}function md(e,t){if(typeof e=="boolean")return e?x.any():x.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let n=T_(r,t?.defaultTarget),o=r.$defs||r.definitions||{},i={version:n,defs:o,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??ie};return _e(r,i)}var x,I_,C_,N_,Z_,Oh=D(()=>{$n();ee();cs();fa();mt();x={...Dr,...as,iso:ht},I_=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"]);C_=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),N_=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);Z_=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/});function hd(e){return Dn(e,{object:t=>t.partial(),union:t=>{let r=t._zod.def;return r.discriminator===void 0?t:U(r.options)}})}var Ah=D(()=>{Qp();mt()});function D_(e,t){if(!t?.length)return e;let r=e._zod.def;return L(e,Ze(r,{checks:[...r.checks??[],...t]}),{parent:!0})}function Rh(e){return D_(e.out,e.checks)}function j_(e){return e.in._zod.traits.has("$ZodTransform")?Rh(e):e.in}function gd(e){return Dn(e,{pipe:t=>j_(t._zod.def),default:(t,r)=>r?q(t._zod.def.innerType):t,catch:(t,r)=>r?t._zod.def.innerType:t})}function yd(e){return Dn(e,{pipe:t=>Rh(t._zod.def),prefault:(t,r)=>r?t._zod.def.innerType:t})}var Ch=D(()=>{ee();Qp();mt()});var da={};Ue(da,{bigint:()=>V_,boolean:()=>U_,date:()=>F_,number:()=>L_,string:()=>M_});function M_(e){return Il(Wt,e)}function L_(e){return Cl(Gt,e)}function U_(e){return Ll(Qt,e)}function V_(e){return Vl(Yt,e)}function F_(e){return Xl(Ir,e)}var Nh=D(()=>{Se();mt()});var p={};Ue(p,{$brand:()=>Co,$input:()=>Ti,$output:()=>Ii,INVALID:()=>me,NEVER:()=>Ro,TimePrecision:()=>es,ZodAny:()=>Is,ZodArray:()=>Rs,ZodBase64:()=>eo,ZodBase64URL:()=>to,ZodBigInt:()=>Yt,ZodBigIntFormat:()=>oo,ZodBoolean:()=>Qt,ZodCIDRv4:()=>Yn,ZodCIDRv6:()=>Xn,ZodCUID:()=>Hn,ZodCUID2:()=>Bn,ZodCatch:()=>Qs,ZodCodec:()=>Nr,ZodCompileAsyncError:()=>Ae,ZodCompileUnsupportedError:()=>N,ZodCreditCard:()=>zs,ZodCustom:()=>Er,ZodCustomStringFormat:()=>ft,ZodDate:()=>Ir,ZodDefault:()=>Hs,ZodDiscriminatedUnion:()=>Ns,ZodE164:()=>ro,ZodEmail:()=>Un,ZodEmoji:()=>Fn,ZodEnum:()=>Jt,ZodError:()=>wh,ZodExactOptional:()=>ao,ZodFile:()=>Us,ZodFirstPartyTypeKind:()=>pa,ZodFunction:()=>aa,ZodGUID:()=>Vn,ZodIBAN:()=>vs,ZodIPv4:()=>Gn,ZodIPv6:()=>Qn,ZodISODate:()=>Ge,ZodISODateTime:()=>We,ZodISODuration:()=>Ye,ZodISOTime:()=>Qe,ZodInstanceOf:()=>la,ZodIntersection:()=>Es,ZodIssueCode:()=>xh,ZodJWT:()=>no,ZodKSUID:()=>Wn,ZodLazy:()=>oa,ZodLiteral:()=>Ls,ZodMAC:()=>xs,ZodMap:()=>js,ZodNaN:()=>Xs,ZodNanoID:()=>qn,ZodNever:()=>Os,ZodNonOptional:()=>co,ZodNull:()=>Ps,ZodNullable:()=>qs,ZodNumber:()=>Gt,ZodNumberFormat:()=>dt,ZodObject:()=>Tr,ZodOptional:()=>Rr,ZodPipe:()=>Cr,ZodPrefault:()=>Js,ZodPreprocess:()=>ea,ZodPromise:()=>sa,ZodReadonly:()=>ta,ZodRealError:()=>be,ZodRecord:()=>Bt,ZodSet:()=>Ms,ZodString:()=>Wt,ZodStringFormat:()=>H,ZodSuccess:()=>Gs,ZodSymbol:()=>ks,ZodTemplateLiteral:()=>na,ZodTransform:()=>Vs,ZodTuple:()=>Zs,ZodType:()=>A,ZodULID:()=>Jn,ZodURL:()=>Sr,ZodUUID:()=>Le,ZodUndefined:()=>Ss,ZodUnion:()=>Or,ZodUnknown:()=>Ts,ZodVoid:()=>As,ZodXID:()=>Kn,ZodXor:()=>Cs,_ZodString:()=>Ln,_default:()=>Bs,_function:()=>sd,any:()=>Uf,array:()=>C,base64:()=>wf,base64url:()=>xf,bigint:()=>Zf,boolean:()=>X,catch:()=>Ys,check:()=>ad,cidrv4:()=>_f,cidrv6:()=>$f,clone:()=>L,codec:()=>rd,coerce:()=>da,compile:()=>Oi,config:()=>Y,core:()=>Fe,creditCard:()=>vf,cuid:()=>pf,cuid2:()=>ff,currencyCode:()=>Of,custom:()=>uo,date:()=>Ff,decode:()=>hs,decodeAsync:()=>ys,deepPartial:()=>hd,describe:()=>cd,discriminatedUnion:()=>Ar,e164:()=>zf,email:()=>ef,emoji:()=>uf,encode:()=>ms,encodeAsync:()=>gs,endsWith:()=>Dt,enum:()=>ae,exactOptional:()=>Fs,file:()=>Yf,flattenError:()=>ur,float32:()=>Rf,float64:()=>Cf,formatError:()=>lr,fromJSONSchema:()=>md,function:()=>sd,getDiscriminatedOption:()=>gi,getErrorMap:()=>vh,globalRegistry:()=>ie,gt:()=>je,gte:()=>ke,guid:()=>tf,hash:()=>Af,hex:()=>Tf,hostname:()=>If,httpUrl:()=>cf,iban:()=>kf,includes:()=>Et,input:()=>gd,instanceof:()=>ld,int:()=>jn,int32:()=>Nf,int64:()=>Df,intersection:()=>Xt,invertCodec:()=>nd,ipv4:()=>gf,ipv6:()=>bf,iso:()=>ht,json:()=>fd,jwt:()=>Sf,keyof:()=>qf,ksuid:()=>hf,lazy:()=>ia,length:()=>ct,literal:()=>k,locales:()=>$r,looseObject:()=>se,looseRecord:()=>Kf,lowercase:()=>Ct,lt:()=>De,lte:()=>ve,mac:()=>yf,map:()=>Wf,maxLength:()=>at,maxSize:()=>Ke,memoizer:()=>_r,meta:()=>ud,mime:()=>Mt,minLength:()=>Ve,minSize:()=>Me,multipleOf:()=>Je,nan:()=>td,nanoid:()=>lf,nativeEnum:()=>Qf,negative:()=>In,never:()=>io,nonnegative:()=>On,nonoptional:()=>Ws,nonpositive:()=>Tn,normalize:()=>Lt,null:()=>Pr,nullable:()=>kr,nullish:()=>Xf,number:()=>j,object:()=>z,optional:()=>q,output:()=>yd,overwrite:()=>Re,parse:()=>ls,parseAsync:()=>ps,partialRecord:()=>Jf,pipe:()=>Mn,positive:()=>Pn,prefault:()=>Ks,preprocess:()=>Zr,prettifyError:()=>Eo,promise:()=>id,properties:()=>jt,property:()=>An,readonly:()=>ra,record:()=>B,refine:()=>ca,regex:()=>Rt,regexes:()=>Pe,registry:()=>_n,safeDecode:()=>_s,safeDecodeAsync:()=>ws,safeEncode:()=>bs,safeEncodeAsync:()=>$s,safeParse:()=>fs,safeParseAsync:()=>ds,set:()=>Gf,setErrorMap:()=>zh,size:()=>st,slugify:()=>qt,startsWith:()=>Zt,strictObject:()=>Hf,string:()=>y,stringFormat:()=>Pf,stringbool:()=>pd,success:()=>ed,superRefine:()=>ua,symbol:()=>Mf,templateLiteral:()=>od,toJSONSchema:()=>En,toLowerCase:()=>Vt,toUpperCase:()=>Ft,toZod:()=>rr,transform:()=>so,treeifyError:()=>No,trim:()=>Ut,tuple:()=>Ds,uint32:()=>Ef,uint64:()=>jf,ulid:()=>df,undefined:()=>Lf,union:()=>U,unknown:()=>K,uppercase:()=>Nt,url:()=>af,util:()=>v,uuid:()=>rf,uuidv4:()=>nf,uuidv6:()=>of,uuidv7:()=>sf,validate:()=>zt,validateAsync:()=>vt,void:()=>Vf,withParser:()=>wn,xid:()=>mf,xor:()=>Bf});var ma=D(()=>{Se();mt();cs();Yp();Xp();kh();Se();Zn();Oh();Ah();Ch();wl();fa();fa();Nh()});var Eh=D(()=>{ma();ma()});var bd={};Ue(bd,{$brand:()=>Co,$input:()=>Ti,$output:()=>Ii,INVALID:()=>me,NEVER:()=>Ro,TimePrecision:()=>es,ZodAny:()=>Is,ZodArray:()=>Rs,ZodBase64:()=>eo,ZodBase64URL:()=>to,ZodBigInt:()=>Yt,ZodBigIntFormat:()=>oo,ZodBoolean:()=>Qt,ZodCIDRv4:()=>Yn,ZodCIDRv6:()=>Xn,ZodCUID:()=>Hn,ZodCUID2:()=>Bn,ZodCatch:()=>Qs,ZodCodec:()=>Nr,ZodCompileAsyncError:()=>Ae,ZodCompileUnsupportedError:()=>N,ZodCreditCard:()=>zs,ZodCustom:()=>Er,ZodCustomStringFormat:()=>ft,ZodDate:()=>Ir,ZodDefault:()=>Hs,ZodDiscriminatedUnion:()=>Ns,ZodE164:()=>ro,ZodEmail:()=>Un,ZodEmoji:()=>Fn,ZodEnum:()=>Jt,ZodError:()=>wh,ZodExactOptional:()=>ao,ZodFile:()=>Us,ZodFirstPartyTypeKind:()=>pa,ZodFunction:()=>aa,ZodGUID:()=>Vn,ZodIBAN:()=>vs,ZodIPv4:()=>Gn,ZodIPv6:()=>Qn,ZodISODate:()=>Ge,ZodISODateTime:()=>We,ZodISODuration:()=>Ye,ZodISOTime:()=>Qe,ZodInstanceOf:()=>la,ZodIntersection:()=>Es,ZodIssueCode:()=>xh,ZodJWT:()=>no,ZodKSUID:()=>Wn,ZodLazy:()=>oa,ZodLiteral:()=>Ls,ZodMAC:()=>xs,ZodMap:()=>js,ZodNaN:()=>Xs,ZodNanoID:()=>qn,ZodNever:()=>Os,ZodNonOptional:()=>co,ZodNull:()=>Ps,ZodNullable:()=>qs,ZodNumber:()=>Gt,ZodNumberFormat:()=>dt,ZodObject:()=>Tr,ZodOptional:()=>Rr,ZodPipe:()=>Cr,ZodPrefault:()=>Js,ZodPreprocess:()=>ea,ZodPromise:()=>sa,ZodReadonly:()=>ta,ZodRealError:()=>be,ZodRecord:()=>Bt,ZodSet:()=>Ms,ZodString:()=>Wt,ZodStringFormat:()=>H,ZodSuccess:()=>Gs,ZodSymbol:()=>ks,ZodTemplateLiteral:()=>na,ZodTransform:()=>Vs,ZodTuple:()=>Zs,ZodType:()=>A,ZodULID:()=>Jn,ZodURL:()=>Sr,ZodUUID:()=>Le,ZodUndefined:()=>Ss,ZodUnion:()=>Or,ZodUnknown:()=>Ts,ZodVoid:()=>As,ZodXID:()=>Kn,ZodXor:()=>Cs,_ZodString:()=>Ln,_default:()=>Bs,_function:()=>sd,any:()=>Uf,array:()=>C,base64:()=>wf,base64url:()=>xf,bigint:()=>Zf,boolean:()=>X,catch:()=>Ys,check:()=>ad,cidrv4:()=>_f,cidrv6:()=>$f,clone:()=>L,codec:()=>rd,coerce:()=>da,compile:()=>Oi,config:()=>Y,core:()=>Fe,creditCard:()=>vf,cuid:()=>pf,cuid2:()=>ff,currencyCode:()=>Of,custom:()=>uo,date:()=>Ff,decode:()=>hs,decodeAsync:()=>ys,deepPartial:()=>hd,default:()=>p,describe:()=>cd,discriminatedUnion:()=>Ar,e164:()=>zf,email:()=>ef,emoji:()=>uf,encode:()=>ms,encodeAsync:()=>gs,endsWith:()=>Dt,enum:()=>ae,exactOptional:()=>Fs,file:()=>Yf,flattenError:()=>ur,float32:()=>Rf,float64:()=>Cf,formatError:()=>lr,fromJSONSchema:()=>md,function:()=>sd,getDiscriminatedOption:()=>gi,getErrorMap:()=>vh,globalRegistry:()=>ie,gt:()=>je,gte:()=>ke,guid:()=>tf,hash:()=>Af,hex:()=>Tf,hostname:()=>If,httpUrl:()=>cf,iban:()=>kf,includes:()=>Et,input:()=>gd,instanceof:()=>ld,int:()=>jn,int32:()=>Nf,int64:()=>Df,intersection:()=>Xt,invertCodec:()=>nd,ipv4:()=>gf,ipv6:()=>bf,iso:()=>ht,json:()=>fd,jwt:()=>Sf,keyof:()=>qf,ksuid:()=>hf,lazy:()=>ia,length:()=>ct,literal:()=>k,locales:()=>$r,looseObject:()=>se,looseRecord:()=>Kf,lowercase:()=>Ct,lt:()=>De,lte:()=>ve,mac:()=>yf,map:()=>Wf,maxLength:()=>at,maxSize:()=>Ke,memoizer:()=>_r,meta:()=>ud,mime:()=>Mt,minLength:()=>Ve,minSize:()=>Me,multipleOf:()=>Je,nan:()=>td,nanoid:()=>lf,nativeEnum:()=>Qf,negative:()=>In,never:()=>io,nonnegative:()=>On,nonoptional:()=>Ws,nonpositive:()=>Tn,normalize:()=>Lt,null:()=>Pr,nullable:()=>kr,nullish:()=>Xf,number:()=>j,object:()=>z,optional:()=>q,output:()=>yd,overwrite:()=>Re,parse:()=>ls,parseAsync:()=>ps,partialRecord:()=>Jf,pipe:()=>Mn,positive:()=>Pn,prefault:()=>Ks,preprocess:()=>Zr,prettifyError:()=>Eo,promise:()=>id,properties:()=>jt,property:()=>An,readonly:()=>ra,record:()=>B,refine:()=>ca,regex:()=>Rt,regexes:()=>Pe,registry:()=>_n,safeDecode:()=>_s,safeDecodeAsync:()=>ws,safeEncode:()=>bs,safeEncodeAsync:()=>$s,safeParse:()=>fs,safeParseAsync:()=>ds,set:()=>Gf,setErrorMap:()=>zh,size:()=>st,slugify:()=>qt,startsWith:()=>Zt,strictObject:()=>Hf,string:()=>y,stringFormat:()=>Pf,stringbool:()=>pd,success:()=>ed,superRefine:()=>ua,symbol:()=>Mf,templateLiteral:()=>od,toJSONSchema:()=>En,toLowerCase:()=>Vt,toUpperCase:()=>Ft,toZod:()=>rr,transform:()=>so,treeifyError:()=>No,trim:()=>Ut,tuple:()=>Ds,uint32:()=>Ef,uint64:()=>jf,ulid:()=>df,undefined:()=>Lf,union:()=>U,unknown:()=>K,uppercase:()=>Nt,url:()=>af,util:()=>v,uuid:()=>rf,uuidv4:()=>nf,uuidv6:()=>of,uuidv7:()=>sf,validate:()=>zt,validateAsync:()=>vt,void:()=>Vf,withParser:()=>wn,xid:()=>mf,xor:()=>Bf,z:()=>p});var po=D(()=>{ma();Eh()});Se();function is(e){return!!e._zod}function ss(e,t){return is(e)?Do(e,t):e.safeParse(t)}function yh(e){if(!e)return;let t;if(is(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function bh(e){if(is(e)){let 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]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=e.value;if(n!==void 0)return n}po();var gt="io.modelcontextprotocol/related-task",ga="2.0",ne=uo(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Zh=U([y(),j().int()]),Dh=y(),Az=se({ttl:j().optional(),pollInterval:j().optional()}),q_=z({ttl:j().optional()}),H_=z({taskId:y()}),$d=se({progressToken:Zh.optional(),[gt]:H_.optional()}),Ie=z({_meta:$d.optional()}),fo=Ie.extend({task:q_.optional()}),jh=e=>fo.safeParse(e).success,ue=z({method:y(),params:Ie.loose().optional()}),Ce=z({_meta:$d.optional()}),Ne=z({method:y(),params:Ce.loose().optional()}),le=se({_meta:$d.optional()}),Mr=U([y(),j().int()]),Mh=z({jsonrpc:k(ga),id:Mr,...ue.shape}).strict(),wd=e=>Mh.safeParse(e).success,Lh=z({jsonrpc:k(ga),...Ne.shape}).strict(),Uh=e=>Lh.safeParse(e).success,xd=z({jsonrpc:k(ga),id:Mr,result:le}).strict(),mo=e=>xd.safeParse(e).success;var J;(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"})(J||(J={}));var zd=z({jsonrpc:k(ga),id:Mr.optional(),error:z({code:j().int(),message:y(),data:K().optional()})}).strict();var Vh=e=>zd.safeParse(e).success;var Fh=U([Mh,Lh,xd,zd]),Rz=U([xd,zd]),ya=le.strict(),B_=Ce.extend({requestId:Mr.optional(),reason:y().optional()}),ba=Ne.extend({method:k("notifications/cancelled"),params:B_}),J_=z({src:y(),mimeType:y().optional(),sizes:C(y()).optional(),theme:ae(["light","dark"]).optional()}),ho=z({icons:C(J_).optional()}),jr=z({name:y(),title:y().optional()}),go=jr.extend({...jr.shape,...ho.shape,version:y(),websiteUrl:y().optional(),description:y().optional()}),K_=Xt(z({applyDefaults:X().optional()}),B(y(),K())),W_=Zr(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Xt(z({form:K_.optional(),url:ne.optional()}),B(y(),K()).optional())),G_=se({list:ne.optional(),cancel:ne.optional(),requests:se({sampling:se({createMessage:ne.optional()}).optional(),elicitation:se({create:ne.optional()}).optional()}).optional()}),Q_=se({list:ne.optional(),cancel:ne.optional(),requests:se({tools:se({call:ne.optional()}).optional()}).optional()}),Y_=z({experimental:B(y(),ne).optional(),sampling:z({context:ne.optional(),tools:ne.optional()}).optional(),elicitation:W_.optional(),roots:z({listChanged:X().optional()}).optional(),tasks:G_.optional(),extensions:B(y(),ne).optional()}),X_=Ie.extend({protocolVersion:y(),capabilities:Y_,clientInfo:go}),e$=ue.extend({method:k("initialize"),params:X_});var t$=z({experimental:B(y(),ne).optional(),logging:ne.optional(),completions:ne.optional(),prompts:z({listChanged:X().optional()}).optional(),resources:z({subscribe:X().optional(),listChanged:X().optional()}).optional(),tools:z({listChanged:X().optional()}).optional(),tasks:Q_.optional(),extensions:B(y(),ne).optional()}),r$=le.extend({protocolVersion:y(),capabilities:t$,serverInfo:go,instructions:y().optional()}),n$=Ne.extend({method:k("notifications/initialized"),params:Ce.optional()});var Lr=ue.extend({method:k("ping"),params:Ie.optional()}),o$=z({progress:j(),total:q(j()),message:q(y())}),i$=z({...Ce.shape,...o$.shape,progressToken:Zh}),_a=Ne.extend({method:k("notifications/progress"),params:i$}),s$=Ie.extend({cursor:Dh.optional()}),yo=ue.extend({params:s$.optional()}),bo=le.extend({nextCursor:Dh.optional()}),a$=ae(["working","input_required","completed","failed","cancelled"]),_o=z({taskId:y(),status:a$,ttl:U([j(),Pr()]),createdAt:y(),lastUpdatedAt:y(),pollInterval:q(j()),statusMessage:q(y())}),$a=le.extend({task:_o}),c$=Ce.merge(_o),$o=Ne.extend({method:k("notifications/tasks/status"),params:c$}),wa=ue.extend({method:k("tasks/get"),params:Ie.extend({taskId:y()})}),xa=le.merge(_o),za=ue.extend({method:k("tasks/result"),params:Ie.extend({taskId:y()})}),Cz=le.loose(),va=yo.extend({method:k("tasks/list")}),ka=bo.extend({tasks:C(_o)}),Sa=ue.extend({method:k("tasks/cancel"),params:Ie.extend({taskId:y()})}),qh=le.merge(_o),Hh=z({uri:y(),mimeType:q(y()),_meta:B(y(),K()).optional()}),Bh=Hh.extend({text:y()}),vd=y().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Jh=Hh.extend({blob:vd}),wo=ae(["user","assistant"]),Ur=z({audience:C(wo).optional(),priority:j().min(0).max(1).optional(),lastModified:ht.datetime({offset:!0}).optional()}),Kh=z({...jr.shape,...ho.shape,uri:y(),description:q(y()),mimeType:q(y()),size:q(j()),annotations:Ur.optional(),_meta:q(se({}))}),u$=z({...jr.shape,...ho.shape,uriTemplate:y(),description:q(y()),mimeType:q(y()),annotations:Ur.optional(),_meta:q(se({}))}),l$=yo.extend({method:k("resources/list")}),kd=bo.extend({resources:C(Kh)}),p$=yo.extend({method:k("resources/templates/list")}),f$=bo.extend({resourceTemplates:C(u$)}),Sd=Ie.extend({uri:y()}),d$=Sd,m$=ue.extend({method:k("resources/read"),params:d$}),Pd=le.extend({contents:C(U([Bh,Jh]))}),h$=Ne.extend({method:k("notifications/resources/list_changed"),params:Ce.optional()}),g$=Sd,y$=ue.extend({method:k("resources/subscribe"),params:g$}),b$=Sd,_$=ue.extend({method:k("resources/unsubscribe"),params:b$}),$$=Ce.extend({uri:y()}),w$=Ne.extend({method:k("notifications/resources/updated"),params:$$}),x$=z({name:y(),description:q(y()),required:q(X())}),z$=z({...jr.shape,...ho.shape,description:q(y()),arguments:q(C(x$)),_meta:q(se({}))}),v$=yo.extend({method:k("prompts/list")}),k$=bo.extend({prompts:C(z$)}),S$=Ie.extend({name:y(),arguments:B(y(),y()).optional()}),P$=ue.extend({method:k("prompts/get"),params:S$}),Id=z({type:k("text"),text:y(),annotations:Ur.optional(),_meta:B(y(),K()).optional()}),Td=z({type:k("image"),data:vd,mimeType:y(),annotations:Ur.optional(),_meta:B(y(),K()).optional()}),Od=z({type:k("audio"),data:vd,mimeType:y(),annotations:Ur.optional(),_meta:B(y(),K()).optional()}),I$=z({type:k("tool_use"),name:y(),id:y(),input:B(y(),K()),_meta:B(y(),K()).optional()}),Ad=z({type:k("resource"),resource:U([Bh,Jh]),annotations:Ur.optional(),_meta:B(y(),K()).optional()}),Rd=Kh.extend({type:k("resource_link")}),Vr=U([Id,Td,Od,Rd,Ad]),T$=z({role:wo,content:Vr}),O$=le.extend({description:y().optional(),messages:C(T$)}),A$=Ne.extend({method:k("notifications/prompts/list_changed"),params:Ce.optional()}),R$=z({title:y().optional(),readOnlyHint:X().optional(),destructiveHint:X().optional(),idempotentHint:X().optional(),openWorldHint:X().optional()}),C$=z({taskSupport:ae(["required","optional","forbidden"]).optional()}),Pa=z({...jr.shape,...ho.shape,description:y().optional(),inputSchema:z({type:k("object"),properties:B(y(),ne).optional(),required:C(y()).optional()}).catchall(K()),outputSchema:z({type:k("object"),properties:B(y(),ne).optional(),required:C(y()).optional()}).catchall(K()).optional(),annotations:R$.optional(),execution:C$.optional(),_meta:B(y(),K()).optional()}),Cd=yo.extend({method:k("tools/list")}),N$=bo.extend({tools:C(Pa)}),Fr=le.extend({content:C(Vr).default([]),structuredContent:B(y(),K()).optional(),isError:X().optional()}),Nz=Fr.or(le.extend({toolResult:K()})),E$=fo.extend({name:y(),arguments:B(y(),K()).optional()}),Nd=ue.extend({method:k("tools/call"),params:E$}),Z$=Ne.extend({method:k("notifications/tools/list_changed"),params:Ce.optional()}),Ez=z({autoRefresh:X().default(!0),debounceMs:j().int().nonnegative().default(300)}),Wh=ae(["debug","info","notice","warning","error","critical","alert","emergency"]),D$=Ie.extend({level:Wh}),j$=ue.extend({method:k("logging/setLevel"),params:D$}),M$=Ce.extend({level:Wh,logger:y().optional(),data:K()}),L$=Ne.extend({method:k("notifications/message"),params:M$}),U$=z({name:y().optional()}),V$=z({hints:C(U$).optional(),costPriority:j().min(0).max(1).optional(),speedPriority:j().min(0).max(1).optional(),intelligencePriority:j().min(0).max(1).optional()}),F$=z({mode:ae(["auto","required","none"]).optional()}),q$=z({type:k("tool_result"),toolUseId:y().describe("The unique identifier for the corresponding tool call."),content:C(Vr).default([]),structuredContent:z({}).loose().optional(),isError:X().optional(),_meta:B(y(),K()).optional()}),H$=Ar("type",[Id,Td,Od]),ha=Ar("type",[Id,Td,Od,I$,q$]),B$=z({role:wo,content:U([ha,C(ha)]),_meta:B(y(),K()).optional()}),J$=fo.extend({messages:C(B$),modelPreferences:V$.optional(),systemPrompt:y().optional(),includeContext:ae(["none","thisServer","allServers"]).optional(),temperature:j().optional(),maxTokens:j().int(),stopSequences:C(y()).optional(),metadata:ne.optional(),tools:C(Pa).optional(),toolChoice:F$.optional()}),K$=ue.extend({method:k("sampling/createMessage"),params:J$}),Ed=le.extend({model:y(),stopReason:q(ae(["endTurn","stopSequence","maxTokens"]).or(y())),role:wo,content:H$}),Zd=le.extend({model:y(),stopReason:q(ae(["endTurn","stopSequence","maxTokens","toolUse"]).or(y())),role:wo,content:U([ha,C(ha)])}),W$=z({type:k("boolean"),title:y().optional(),description:y().optional(),default:X().optional()}),G$=z({type:k("string"),title:y().optional(),description:y().optional(),minLength:j().optional(),maxLength:j().optional(),format:ae(["email","uri","date","date-time"]).optional(),default:y().optional()}),Q$=z({type:ae(["number","integer"]),title:y().optional(),description:y().optional(),minimum:j().optional(),maximum:j().optional(),default:j().optional()}),Y$=z({type:k("string"),title:y().optional(),description:y().optional(),enum:C(y()),default:y().optional()}),X$=z({type:k("string"),title:y().optional(),description:y().optional(),oneOf:C(z({const:y(),title:y()})),default:y().optional()}),ew=z({type:k("string"),title:y().optional(),description:y().optional(),enum:C(y()),enumNames:C(y()).optional(),default:y().optional()}),tw=U([Y$,X$]),rw=z({type:k("array"),title:y().optional(),description:y().optional(),minItems:j().optional(),maxItems:j().optional(),items:z({type:k("string"),enum:C(y())}),default:C(y()).optional()}),nw=z({type:k("array"),title:y().optional(),description:y().optional(),minItems:j().optional(),maxItems:j().optional(),items:z({anyOf:C(z({const:y(),title:y()}))}),default:C(y()).optional()}),ow=U([rw,nw]),iw=U([ew,tw,ow]),sw=U([iw,W$,G$,Q$]),aw=fo.extend({mode:k("form").optional(),message:y(),requestedSchema:z({type:k("object"),properties:B(y(),sw),required:C(y()).optional()})}),cw=fo.extend({mode:k("url"),message:y(),elicitationId:y(),url:y().url()}),uw=U([aw,cw]),lw=ue.extend({method:k("elicitation/create"),params:uw}),pw=Ce.extend({elicitationId:y()}),fw=Ne.extend({method:k("notifications/elicitation/complete"),params:pw}),dw=le.extend({action:ae(["accept","decline","cancel"]),content:Zr(e=>e===null?void 0:e,B(y(),U([y(),j(),X(),C(y())])).optional())}),mw=z({type:k("ref/resource"),uri:y()});var hw=z({type:k("ref/prompt"),name:y()}),gw=Ie.extend({ref:U([hw,mw]),argument:z({name:y(),value:y()}),context:z({arguments:B(y(),y()).optional()}).optional()}),yw=ue.extend({method:k("completion/complete"),params:gw});var bw=le.extend({completion:se({values:C(y()).max(100),total:q(j().int()),hasMore:q(X())})}),_w=z({uri:y().startsWith("file://"),name:y().optional(),_meta:B(y(),K()).optional()}),$w=ue.extend({method:k("roots/list"),params:Ie.optional()}),ww=le.extend({roots:C(_w)}),xw=Ne.extend({method:k("notifications/roots/list_changed"),params:Ce.optional()}),Zz=U([Lr,e$,yw,j$,P$,v$,l$,p$,m$,y$,_$,Nd,Cd,wa,za,va,Sa]),Dz=U([ba,_a,n$,xw,$o]),jz=U([ya,Ed,Zd,dw,ww,xa,ka,$a]),Mz=U([Lr,K$,lw,$w,wa,za,va,Sa]),Lz=U([ba,_a,L$,w$,h$,Z$,A$,$o,fw]),Uz=U([ya,r$,bw,O$,k$,kd,f$,Pd,Fr,N$,xa,ka,$a]),M=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===J.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new _d(o.elicitations,r)}return new e(t,r,n)}},_d=class extends M{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(J.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function yt(e){return e==="completed"||e==="failed"||e==="cancelled"}var zw=Symbol("Let zodToJsonSchema decide on which parser to use");var $v=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Dd(e){let r=yh(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=bh(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function jd(e,t){let r=ss(e,t);if(!r.success)throw r.error;return r.data}var Tw=6e4,Ia=class{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(ba,r=>{this._oncancel(r)}),this.setNotificationHandler(_a,r=>{this._onprogress(r)}),this.setRequestHandler(Lr,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(wa,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new M(J.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(za,async(r,n)=>{let o=async()=>{let i=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(i,n.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let f=c,d=new M(f.error.code,f.error.message,f.error.data);l(d)}else{let f=a.type==="response"?"Response":"Error";this._onerror(new Error(`${f} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}let s=await this._taskStore.getTask(i,n.sessionId);if(!s)throw new M(J.InvalidParams,`Task not found: ${i}`);if(!yt(s.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(yt(s.status)){let a=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...a,_meta:{...a._meta,[gt]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(va,async(r,n)=>{try{let{tasks:o,nextCursor:i}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new M(J.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Sa,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new M(J.InvalidParams,`Task not found: ${r.params.taskId}`);if(yt(o.status))throw new M(J.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new M(J.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof M?o:new M(J.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,r,n,o,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),M.fromError(J.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.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;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=i=>{n?.(i),this._onerror(i)};let o=this._transport?.onmessage;this._transport.onmessage=(i,s)=>{o?.(i,s),mo(i)||Vh(i)?this._onresponse(i):wd(i)?this._onrequest(i,s):Uh(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=M.fromError(J.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,i=t.params?._meta?.[gt]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:J.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(f=>this._onerror(new Error(`Failed to enqueue error response: ${f}`))):o?.send(l).catch(f=>this._onerror(new Error(`Failed to send an error response: ${f}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(t.id,s);let a=jh(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,u={signal:s.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(s.signal.aborted)return;let f={relatedRequestId:t.id};i&&(f.relatedTask={taskId:i}),await this.notification(l,f)},sendRequest:async(l,f,d)=>{if(s.signal.aborted)throw new M(J.ConnectionClosed,"Request was cancelled");let m={...d,relatedRequestId:t.id};i&&!m.relatedTask&&(m.relatedTask={taskId:i});let g=m.relatedTask?.taskId??i;return g&&c&&await c.updateTaskStatus(g,"input_required"),await this.request(l,f,m)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(s.signal.aborted)return;let f={result:l,jsonrpc:"2.0",id:t.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:f,timestamp:Date.now()},o?.sessionId):await o?.send(f)},async l=>{if(s.signal.aborted)return;let f={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:J.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:f,timestamp:Date.now()},o?.sessionId):await o?.send(f)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===s&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let 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(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),mo(t))n(t);else{let s=new M(t.error.code,t.error.message,t.error.data);n(s)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if(mo(t)&&t.result&&typeof t.result=="object"){let s=t.result;if(s.task&&typeof s.task=="object"){let a=s.task;typeof a.taskId=="string"&&(i=!0,this._taskProgressTokens.set(a.taskId,r))}}if(i||this._progressHandlers.delete(r),mo(t))o(t);else{let s=M.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,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(t,r,n)}}catch(s){yield{type:"error",error:s instanceof M?s:new M(J.InternalError,String(s))}}return}let i;try{let s=await this.request(t,$a,n);if(s.task)i=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new M(J.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:a},yt(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:a.status==="failed"?yield{type:"error",error:new M(J.InternalError,`Task ${i} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new M(J.InternalError,`Task ${i} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof M?s:new M(J.InternalError,String(s))}}}request(t,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{let f=$=>{l($)};if(!this._transport){f(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch($){f($);return}n?.signal?.throwIfAborted();let d=this._requestMessageId++,m={...t,jsonrpc:"2.0",id:d};n?.onprogress&&(this._progressHandlers.set(d,n.onprogress),m.params={...t.params,_meta:{...t.params?._meta||{},progressToken:d}}),a&&(m.params={...m.params,task:a}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[gt]:c}});let g=$=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String($)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(E=>this._onerror(new Error(`Failed to send cancellation: ${E}`)));let P=$ instanceof M?$:new M(J.RequestTimeout,String($));l(P)};this._responseHandlers.set(d,$=>{if(!n?.signal?.aborted){if($ instanceof Error)return l($);try{let P=ss(r,$.result);P.success?u(P.data):l(P.error)}catch(P){l(P)}}}),n?.signal?.addEventListener("abort",()=>{g(n?.signal?.reason)});let b=n?.timeout??Tw,w=()=>g(M.fromError(J.RequestTimeout,"Request timed out",{timeout:b}));this._setupTimeout(d,b,n?.maxTotalTimeout,w,n?.resetTimeoutOnProgress??!1);let S=c?.taskId;if(S){let $=P=>{let E=this._responseHandlers.get(d);E?E(P):this._onerror(new Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,$),this._enqueueTaskMessage(S,{type:"request",message:m,timestamp:Date.now()}).catch(P=>{this._cleanupTimeout(d),l(P)})}else this._transport.send(m,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch($=>{this._cleanupTimeout(d),l($)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},xa,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},ka,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},qh,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[gt]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.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"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[gt]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[gt]:r.relatedTask}}}),await this._transport.send(s,r)}setRequestHandler(t,r){let n=Dd(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let s=jd(t,o);return Promise.resolve(r(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,r){let n=Dd(t);this._notificationHandlers.set(n,o=>{let i=jd(t,o);return Promise.resolve(r(i))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,o)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let o of n)if(o.type==="request"&&wd(o.message)){let i=o.message.id,s=this._requestResolvers.get(i);s?(s(new M(J.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,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(t);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,i)=>{if(r.aborted){i(new M(J.InvalidRequest,"Request cancelled"));return}let s=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(s),i(new M(J.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await n.createTask(o,t.id,{method:t.method,params:t.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new M(J.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,s)=>{await n.storeTaskResult(o,i,s,r);let a=await n.getTask(o,r);if(a){let c=$o.parse({method:"notifications/tasks/status",params:a});await this.notification(c),yt(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,s)=>{let a=await n.getTask(o,r);if(!a)throw new M(J.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(yt(a.status))throw new M(J.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,s,r);let c=await n.getTask(o,r);if(c){let u=$o.parse({method:"notifications/tasks/status",params:c});await this.notification(u),yt(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function Gh(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Qh(e,t){let r={...e};for(let n in t){let o=n,i=t[o];if(i===void 0)continue;let s=r[o];Gh(s)&&Gh(i)?r[o]={...s,...i}:r[o]=i}return r}po();po();var bP=(e=>typeof _t<"u"?_t:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof _t<"u"?_t:t)[r]}):e)(function(e){if(typeof _t<"u")return _t.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),Md=class extends Ia{_registeredMethods=new Set;_eventSlots=new Map;onEventDispatch(t,r){}_ensureEventSlot(t){let r=this._eventSlots.get(t);if(!r){let n=this.eventSchemas[t];if(!n)throw Error(`Unknown event: ${String(t)}`);r={listeners:[]},this._eventSlots.set(t,r);let o=n.shape.method.value;this._registeredMethods.add(o);let i=r;super.setNotificationHandler(n,s=>{let a=s.params;this.onEventDispatch(t,a),i.onHandler?.(a);for(let c of[...i.listeners])c(a)})}return r}setEventHandler(t,r){let n=this._ensureEventSlot(t);n.onHandler&&r&&console.warn(`[MCP Apps] on${String(t)} handler replaced. Use addEventListener("${String(t)}", \u2026) to add multiple listeners without replacing.`),n.onHandler=r}getEventHandler(t){return this._eventSlots.get(t)?.onHandler}addEventListener(t,r){this._ensureEventSlot(t).listeners.push(r)}removeEventListener(t,r){let n=this._eventSlots.get(t);if(!n)return;let o=n.listeners.indexOf(r);o!==-1&&n.listeners.splice(o,1)}setRequestHandler=(t,r)=>{this._assertMethodNotRegistered(t,"setRequestHandler"),super.setRequestHandler(t,r)};setNotificationHandler=(t,r)=>{this._assertMethodNotRegistered(t,"setNotificationHandler"),super.setNotificationHandler(t,r)};warnIfRequestHandlerReplaced(t,r,n){r&&n&&console.warn(`[MCP Apps] ${t} handler replaced. Previous handler will no longer be called.`)}replaceRequestHandler=(t,r)=>{let n=t.shape.method.value;this._registeredMethods.add(n),super.setRequestHandler(t,r)};_assertMethodNotRegistered(t,r){let n=t.shape.method.value;if(this._registeredMethods.has(n))throw Error(`Handler for "${n}" already registered (via ${r}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._registeredMethods.add(n)}},Ow="2026-01-26";var Aw="ui/notifications/tool-input-partial";var Ld=class{eventTarget;eventSource;messageListener;constructor(t=window.parent,r){this.eventTarget=t,this.eventSource=r,this.messageListener=n=>{if(r&&n.source!==this.eventSource){console.debug("Ignoring message from unknown source",n);return}let o=Fh.safeParse(n.data);o.success?(console.debug("Parsed message",o.data),this.onmessage?.(o.data)):n.data?.jsonrpc!=="2.0"?console.debug("Ignoring non-JSON-RPC message",o.error.message,n):(console.error("Failed to parse message",o.error.message,n),this.onerror?.(Error("Invalid JSON-RPC message received: "+o.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(t,r){t.method!==Aw&&console.debug("Sending message",t),this.eventTarget.postMessage(t,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion},Rw=p.union([p.literal("light"),p.literal("dark")]).describe("Color theme preference for the host environment."),zo=p.union([p.literal("inline"),p.literal("fullscreen"),p.literal("pip")]).describe("Display mode for UI presentation."),Cw=p.union([p.literal("--color-background-primary"),p.literal("--color-background-secondary"),p.literal("--color-background-tertiary"),p.literal("--color-background-inverse"),p.literal("--color-background-ghost"),p.literal("--color-background-info"),p.literal("--color-background-danger"),p.literal("--color-background-success"),p.literal("--color-background-warning"),p.literal("--color-background-disabled"),p.literal("--color-text-primary"),p.literal("--color-text-secondary"),p.literal("--color-text-tertiary"),p.literal("--color-text-inverse"),p.literal("--color-text-ghost"),p.literal("--color-text-info"),p.literal("--color-text-danger"),p.literal("--color-text-success"),p.literal("--color-text-warning"),p.literal("--color-text-disabled"),p.literal("--color-border-primary"),p.literal("--color-border-secondary"),p.literal("--color-border-tertiary"),p.literal("--color-border-inverse"),p.literal("--color-border-ghost"),p.literal("--color-border-info"),p.literal("--color-border-danger"),p.literal("--color-border-success"),p.literal("--color-border-warning"),p.literal("--color-border-disabled"),p.literal("--color-ring-primary"),p.literal("--color-ring-secondary"),p.literal("--color-ring-inverse"),p.literal("--color-ring-info"),p.literal("--color-ring-danger"),p.literal("--color-ring-success"),p.literal("--color-ring-warning"),p.literal("--font-sans"),p.literal("--font-mono"),p.literal("--font-weight-normal"),p.literal("--font-weight-medium"),p.literal("--font-weight-semibold"),p.literal("--font-weight-bold"),p.literal("--font-text-xs-size"),p.literal("--font-text-sm-size"),p.literal("--font-text-md-size"),p.literal("--font-text-lg-size"),p.literal("--font-heading-xs-size"),p.literal("--font-heading-sm-size"),p.literal("--font-heading-md-size"),p.literal("--font-heading-lg-size"),p.literal("--font-heading-xl-size"),p.literal("--font-heading-2xl-size"),p.literal("--font-heading-3xl-size"),p.literal("--font-text-xs-line-height"),p.literal("--font-text-sm-line-height"),p.literal("--font-text-md-line-height"),p.literal("--font-text-lg-line-height"),p.literal("--font-heading-xs-line-height"),p.literal("--font-heading-sm-line-height"),p.literal("--font-heading-md-line-height"),p.literal("--font-heading-lg-line-height"),p.literal("--font-heading-xl-line-height"),p.literal("--font-heading-2xl-line-height"),p.literal("--font-heading-3xl-line-height"),p.literal("--border-radius-xs"),p.literal("--border-radius-sm"),p.literal("--border-radius-md"),p.literal("--border-radius-lg"),p.literal("--border-radius-xl"),p.literal("--border-radius-full"),p.literal("--border-width-regular"),p.literal("--shadow-hairline"),p.literal("--shadow-sm"),p.literal("--shadow-md"),p.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),Nw=p.record(Cw.describe(`Style variables for theming MCP apps.
604
721
 
605
722
  Individual style keys are optional - hosts may provide any subset of these values.
606
723
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
@@ -618,10 +735,10 @@ Individual style keys are optional - hosts may provide any subset of these value
618
735
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
619
736
 
620
737
  Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
621
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),zP=p.object({method:p.literal("ui/open-link"),params:p.object({url:p.string().describe("URL to open in the host's browser")})}),Rw=p.object({isError:p.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),Cw=p.object({isError:p.boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),Nw=p.object({isError:p.boolean().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),vP=p.object({method:p.literal("ui/notifications/sandbox-proxy-ready"),params:p.object({})}),jd=p.object({connectDomains:p.array(p.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
738
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),kP=p.object({method:p.literal("ui/open-link"),params:p.object({url:p.string().describe("URL to open in the host's browser")})}),Ew=p.object({isError:p.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),Zw=p.object({isError:p.boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),Dw=p.object({isError:p.boolean().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),SP=p.object({method:p.literal("ui/notifications/sandbox-proxy-ready"),params:p.object({})}),Ud=p.object({connectDomains:p.array(p.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
622
739
 
623
740
  - Maps to CSP \`connect-src\` directive
624
- - Empty or omitted \u2192 no network connections (secure default)`),resourceDomains:p.array(p.string()).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 \u2192 no network resources (secure default)"),frameDomains:p.array(p.string()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted \u2192 no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:p.array(p.string()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted \u2192 only same origin allowed (`base-uri 'self'`)")}),Md=p.object({camera:p.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:p.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:p.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:p.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),kP=p.object({method:p.literal("ui/notifications/size-changed"),params:p.object({width:p.number().optional().describe("New width in pixels."),height:p.number().optional().describe("New height in pixels.")})}),Ew=p.object({method:p.literal("ui/notifications/tool-input"),params:p.object({arguments:p.record(p.string(),p.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),Zw=p.object({method:p.literal("ui/notifications/tool-input-partial"),params:p.object({arguments:p.record(p.string(),p.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),Dw=p.object({method:p.literal("ui/notifications/tool-cancelled"),params:p.object({reason:p.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),jw=p.object({fonts:p.string().optional()}),Mw=p.object({variables:Aw.optional().describe("CSS variables for theming the app."),css:jw.optional().describe("CSS blocks that apps can inject.")}),Lw=p.object({method:p.literal("ui/resource-teardown"),params:p.object({})}),SP=p.record(p.string(),p.unknown()),Qh=p.object({text:p.object({}).optional().describe("Host supports text content blocks."),image:p.object({}).optional().describe("Host supports image content blocks."),audio:p.object({}).optional().describe("Host supports audio content blocks."),resource:p.object({}).optional().describe("Host supports resource content blocks."),resourceLink:p.object({}).optional().describe("Host supports resource link content blocks."),structuredContent:p.object({}).optional().describe("Host supports structured content.")}),PP=p.object({method:p.literal("ui/notifications/request-teardown"),params:p.object({}).optional()}),Uw=p.object({experimental:p.record(p.string(),p.record(p.string(),p.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:p.object({}).optional().describe("Host supports opening external URLs."),downloadFile:p.object({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:p.object({listChanged:p.boolean().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:p.object({listChanged:p.boolean().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:p.object({}).optional().describe("Host accepts log messages."),sandbox:p.object({permissions:Md.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:jd.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:Qh.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:Qh.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:p.object({tools:p.object({}).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.")}),Vw=p.object({experimental:p.record(p.string(),p.record(p.string(),p.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:p.object({listChanged:p.boolean().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:p.array(wo).optional().describe("Display modes the app supports.")}),IP=p.object({method:p.literal("ui/notifications/initialized"),params:p.object({}).optional()}),TP=p.object({csp:jd.optional().describe("Content Security Policy configuration for UI resources."),permissions:Md.optional().describe("Sandbox permissions requested by the UI resource."),domain:p.string().optional().describe(`Dedicated origin for view sandbox.
741
+ - Empty or omitted \u2192 no network connections (secure default)`),resourceDomains:p.array(p.string()).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 \u2192 no network resources (secure default)"),frameDomains:p.array(p.string()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted \u2192 no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:p.array(p.string()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted \u2192 only same origin allowed (`base-uri 'self'`)")}),Vd=p.object({camera:p.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:p.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:p.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:p.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),PP=p.object({method:p.literal("ui/notifications/size-changed"),params:p.object({width:p.number().optional().describe("New width in pixels."),height:p.number().optional().describe("New height in pixels.")})}),jw=p.object({method:p.literal("ui/notifications/tool-input"),params:p.object({arguments:p.record(p.string(),p.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),Mw=p.object({method:p.literal("ui/notifications/tool-input-partial"),params:p.object({arguments:p.record(p.string(),p.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),Lw=p.object({method:p.literal("ui/notifications/tool-cancelled"),params:p.object({reason:p.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),Uw=p.object({fonts:p.string().optional()}),Vw=p.object({variables:Nw.optional().describe("CSS variables for theming the app."),css:Uw.optional().describe("CSS blocks that apps can inject.")}),Fw=p.object({method:p.literal("ui/resource-teardown"),params:p.object({})}),IP=p.record(p.string(),p.unknown()),Yh=p.object({text:p.object({}).optional().describe("Host supports text content blocks."),image:p.object({}).optional().describe("Host supports image content blocks."),audio:p.object({}).optional().describe("Host supports audio content blocks."),resource:p.object({}).optional().describe("Host supports resource content blocks."),resourceLink:p.object({}).optional().describe("Host supports resource link content blocks."),structuredContent:p.object({}).optional().describe("Host supports structured content.")}),TP=p.object({method:p.literal("ui/notifications/request-teardown"),params:p.object({}).optional()}),qw=p.object({experimental:p.record(p.string(),p.record(p.string(),p.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:p.object({}).optional().describe("Host supports opening external URLs."),downloadFile:p.object({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:p.object({listChanged:p.boolean().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:p.object({listChanged:p.boolean().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:p.object({}).optional().describe("Host accepts log messages."),sandbox:p.object({permissions:Vd.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:Ud.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:Yh.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:Yh.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:p.object({tools:p.object({}).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.")}),Hw=p.object({experimental:p.record(p.string(),p.record(p.string(),p.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:p.object({listChanged:p.boolean().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:p.array(zo).optional().describe("Display modes the app supports.")}),OP=p.object({method:p.literal("ui/notifications/initialized"),params:p.object({}).optional()}),AP=p.object({csp:Ud.optional().describe("Content Security Policy configuration for UI resources."),permissions:Vd.optional().describe("Sandbox permissions requested by the UI resource."),domain:p.string().optional().describe(`Dedicated origin for view sandbox.
625
742
 
626
743
  Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
627
744
 
@@ -635,20 +752,23 @@ Boolean requesting whether a visible border and background is provided by the ho
635
752
 
636
753
  - \`true\`: request visible border + background
637
754
  - \`false\`: request no visible border + background
638
- - omitted: host decides border`)}),OP=p.object({method:p.literal("ui/request-display-mode"),params:p.object({mode:wo.describe("The display mode being requested.")})}),Fw=p.object({mode:wo.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),qw=p.union([p.literal("model"),p.literal("app")]).describe("Tool visibility scope - who can access the tool."),AP=p.object({resourceUri:p.string().optional(),visibility:p.array(qw).optional().describe(`Who can access this tool. Default: ["model", "app"]
755
+ - omitted: host decides border`)}),RP=p.object({method:p.literal("ui/request-display-mode"),params:p.object({mode:zo.describe("The display mode being requested.")})}),Bw=p.object({mode:zo.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),Jw=p.union([p.literal("model"),p.literal("app")]).describe("Tool visibility scope - who can access the tool."),CP=p.object({resourceUri:p.string().optional(),visibility:p.array(Jw).optional().describe(`Who can access this tool. Default: ["model", "app"]
639
756
  - "model": Tool visible to and callable by the agent
640
- - "app": Tool callable by the app from this server only`),csp:p.never().optional(),permissions:p.never().optional()}),RP=p.object({mimeTypes:p.array(p.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),CP=p.object({method:p.literal("ui/download-file"),params:p.object({contents:p.array(p.union([Id,Td])).describe("Resource contents to download \u2014 embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),NP=p.object({method:p.literal("ui/message"),params:p.object({role:p.literal("user").describe('Message role, currently only "user" is supported.'),content:p.array(Ur).describe("Message content blocks (text, image, etc.).")})}),EP=p.object({method:p.literal("ui/notifications/sandbox-resource-ready"),params:p.object({html:p.string().describe("HTML content to load into the inner iframe."),sandbox:p.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:jd.optional().describe("CSP configuration from resource metadata."),permissions:Md.optional().describe("Sandbox permissions from resource metadata.")})}),Hw=p.object({method:p.literal("ui/notifications/tool-result"),params:Vr.describe("Standard MCP tool execution result.")}),eg=p.object({toolInfo:p.object({id:jr.optional().describe("JSON-RPC id of the tools/call request."),tool:va.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:Tw.optional().describe("Current color theme preference."),styles:Mw.optional().describe("Style configuration for theming the app."),displayMode:wo.optional().describe("How the UI is currently displayed."),availableDisplayModes:p.array(wo).optional().describe("Display modes the host supports."),containerDimensions:p.union([p.object({height:p.number().describe("Fixed container height in pixels.")}),p.object({maxHeight:p.union([p.number(),p.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(p.union([p.object({width:p.number().describe("Fixed container width in pixels.")}),p.object({maxWidth:p.union([p.number(),p.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
641
- container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:p.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:p.string().optional().describe("User's timezone in IANA format."),userAgent:p.string().optional().describe("Host application identifier."),platform:p.union([p.literal("web"),p.literal("desktop"),p.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:p.object({touch:p.boolean().optional().describe("Whether the device supports touch input."),hover:p.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:p.object({top:p.number().describe("Top safe area inset in pixels."),right:p.number().describe("Right safe area inset in pixels."),bottom:p.number().describe("Bottom safe area inset in pixels."),left:p.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),Bw=p.object({method:p.literal("ui/notifications/host-context-changed"),params:eg.describe("Partial context update containing only changed fields.")}),ZP=p.object({method:p.literal("ui/update-model-context"),params:p.object({content:p.array(Ur).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:p.record(p.string(),p.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),DP=p.object({method:p.literal("ui/initialize"),params:p.object({appInfo:mo.describe("App identification (name and version)."),appCapabilities:Vw.describe("Features and capabilities this app provides."),protocolVersion:p.string().describe("Protocol version this app supports.")})}),Jw=p.object({protocolVersion:p.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:mo.describe("Host application identification and version."),hostCapabilities:Uw.describe("Features and capabilities provided by the host."),hostContext:eg.describe("Rich context about the host environment.")}).passthrough(),Kw={target:"draft-2020-12"};async function Yh(e,t){let r=e["~standard"];if(r.jsonSchema)return r.jsonSchema[t](Kw);if(r.vendor==="zod"){let{z:n}=await Promise.resolve().then(()=>(uo(),hd));return n.toJSONSchema(e,{io:t})}throw Error(`Schema (vendor: ${r.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 Xh(e,t,r=""){let n=await e["~standard"].validate(t);if(n.issues){let o=n.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(r+o)}return n.value}function tg(e){let t=document.documentElement;t.setAttribute("data-theme",e),t.style.colorScheme=e}function rg(e,t=document.documentElement){for(let[r,n]of Object.entries(e))n!==void 0&&t.style.setProperty(r,n)}function ng(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)}var Sa=class e extends Zd{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_assertInitialized(t){if(this._initializedSent)return;let r=`[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(r);console.warn(`${r}. This will throw in a future release.`)}eventSchemas={toolinput:Ew,toolinputpartial:Zw,toolresult:Hw,toolcancelled:Dw,hostcontextchanged:Bw};static ONE_SHOT_EVENTS=new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]);_everHadListener=new Set;_assertHandlerTiming(t){if(!e.ONE_SHOT_EVENTS.has(t)||this._everHadListener.has(t)||(this._everHadListener.add(t),!this._initializedSent))return;let r=`[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(r);console.warn(r)}setEventHandler(t,r){r&&this._assertHandlerTiming(t),super.setEventHandler(t,r)}addEventListener(t,r){this._assertHandlerTiming(t),super.addEventListener(t,r)}onEventDispatch(t,r){t==="hostcontextchanged"&&(this._hostContext={...this._hostContext,...r})}constructor(t,r={},n={autoResize:!0}){super(n),this._appInfo=t,this._capabilities=r,this.options=n,n.allowUnsafeEval||p.config({jitless:!0}),this.setRequestHandler(Mr,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=Gh(this._capabilities,t)}registerTool(t,r,n){if(this._registeredTools[t])throw Error(`Tool ${t} is already registered`);let o=this,i=()=>{o._initializedSent&&o._capabilities.tools?.listChanged&&o.sendToolListChanged()},s=r.inputSchema!==void 0,a={title:r.title,description:r.description,inputSchema:r.inputSchema,outputSchema:r.outputSchema,annotations:r.annotations,_meta:r._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 f=a.inputSchema,d=f?await Xh(f,c??{},`Invalid input for tool ${t}: `):c??{};l=await n(d,u)}else l=await n(u);return a.outputSchema&&!l.isError&&(l.structuredContent=await Xh(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,r)=>{let n=this._registeredTools[t.name];if(!n)throw Error(`Tool ${t.name} not found`);return n.handler(t.arguments,r)},this.onlisttools=async(t,r)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([n,o])=>o.enabled).map(async([n,o])=>{let i={name:n,title:o.title,description:o.description,inputSchema:o.inputSchema?await Yh(o.inputSchema,"input"):{type:"object",properties:{}}};return o.outputSchema&&(i.outputSchema=await Yh(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(Lw,(r,n)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(r.params,n)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(t){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,t),this._oncalltool=t,this.replaceRequestHandler(Ad,(r,n)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(r.params,n)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(t){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,t),this._onlisttools=t,this.replaceRequestHandler(Od,(r,n)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(r.params,n)})}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,r){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},Vr,{onprogress:()=>{},resetTimeoutOnProgress:!0,...r})}async readServerResource(t,r){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:t},vd,r)}async listServerResources(t,r){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:t},xd,r)}async createSamplingMessage(t,r){this._assertInitialized("createSamplingMessage");let n=t.tools?Cd:Rd;return await this.request({method:"sampling/createMessage",params:t},n,r)}sendMessage(t,r){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:t},Nw,r)}sendLog(t){return this.notification({method:"notifications/message",params:t})}updateModelContext(t,r){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:t},ma,r)}openLink(t,r){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:t},Rw,r)}sendOpenLink=this.openLink;downloadFile(t,r){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:t},Cw,r)}requestTeardown(t={}){return this.notification({method:"ui/notifications/request-teardown",params:t})}requestDisplayMode(t,r){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:t},Fw,r)}sendSizeChanged(t){return this.notification({method:"ui/notifications/size-changed",params:t})}setupSizeChangedNotifications(){let t=!1,r=0,n=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!==r||c!==n)&&(r=u,n=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 Dd(window.parent,window.parent),r){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1,await super.connect(t);try{let n=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:Pw}},Jw,r);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);this._hostCapabilities=n.hostCapabilities,this._hostInfo=n.hostInfo,this._hostContext=n.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(n){throw this.close(),n}}};function Pa(e){let t=e.content?.map(r=>r.type==="text"?r.text:"").join("");if(e.isError)throw new Error(t||"The tool call failed.");return e.structuredContent?e.structuredContent:JSON.parse(t||"null")}function og(e){e&&(e.theme&&tg(e.theme),e.styles?.variables&&rg(e.styles.variables),e.styles?.css?.fonts&&ng(e.styles.css.fonts))}function ig(e,t){let r=new Sa({name:`open-brain-${e}`,version:"1.0.0"});return r.ontoolinput=n=>t.onInput?.(n.arguments??{}),r.ontoolresult=n=>t.onResult(n),r.onhostcontextchanged=n=>og(n),r.connect().then(()=>og(r.getHostContext())).catch(n=>console.error("Open Brain card failed to connect",n)),{async callTool(n,o){return Pa(await r.callServerTool({name:n,arguments:o}))},async open(n,o){let i=await Pa(await r.callServerTool({name:"open_item",arguments:{kind:n,id:o}}));i.opened||await r.openLink({url:i.url})},tellModel(n){r.updateModelContext({content:[{type:"text",text:n}]}).catch(()=>{})}}}function Ia(e){return e instanceof Error?e.message:String(e)}function sg(e,t,r,n){e.addEventListener("click",o=>{let i=o.target.closest("[data-action]");if(!i||i.hasAttribute("disabled"))return;let s=i.dataset.action??"";if(s==="open"){let{kind:a,id:c}=i.dataset;a&&c&&t.open(a,c).catch(u=>r(Ia(u)));return}n(s,i)})}function ag(e,t,r){let n=document.createElement("p");n.className=r?"card error":"card loading",n.setAttribute("role",r?"alert":"status"),n.textContent=r??t,e.replaceChildren(n)}function cg(){let e=document.getElementById("root");if(!e)throw new Error("Missing #root");return e}function Fe(e){return String(e??"").replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t])}function ug(e,t,r,n){return`<button class="${n} open-link" data-action="open" data-kind="${e}" data-id="${Fe(t)}">${Fe(r||"(untitled)")}</button>`}function Ta(e,t=""){return`<span class="chip${t?` ${t}`:""}">${Fe(e)}</span>`}var lg={task:"delete_task",habit:"archive_habit",reading:"delete_reading_item",book:"delete_book"},Ww={task:"Task",habit:"Habit",reading:"Reading",book:"Book"};function pg(e){let t=(r,n)=>(n??[]).map(o=>({kind:r,id:o.id,title:o.title}));return[...t("task",e.created),...t("habit",e.habits?.created),...t("reading",e.readingItems?.created),...t("book",e.books?.created)]}function Gw(e){let t=[e,e.habits,e.readingItems,e.books];return{clarifications:t.flatMap(r=>r?.clarifications??[]),errors:t.flatMap(r=>r?.errors??[]),updated:e.readingItems?.updated??[]}}var Qw={task:"task",habit:"habit",reading:"reading",book:"book"};function fg({rows:e,result:t,busy:r,error:n}){let{clarifications:o,errors:i,updated:s}=Gw(t),a=e.filter(g=>!g.undone).length,c=r?" disabled":"",u=e.map((g,b)=>{let w=g.undone?`<span class="row-title">${Fe(g.title)}</span>`:ug(Qw[g.kind],g.id,g.title,"row-title"),S=g.undone?Ta("Undone"):`<button class="link" data-action="undo" data-index="${b}"${c}>Undo</button>`;return`<li class="row${g.undone?" undone":""}"><span class="kind">${Ww[g.kind]}</span>${w}<span class="row-meta">${S}</span></li>`}).join(""),l=s.map(g=>`<li class="row"><span class="kind">Reading</span><span class="row-title">${Fe(g.title)}</span><span class="row-meta">${Ta(`Marked ${g.status??"updated"}`)}</span></li>`).join(""),f=o.map(g=>`<li class="question"><strong>${Fe(g.title)}</strong><span>${Fe(g.question)}</span></li>`).join(""),d=i.map(g=>`<li class="row failed"><span class="row-title">${Fe(g.title)}</span><span class="row-meta">${Ta(g.error,"danger")}</span></li>`).join("");return`<section class="card triage">
757
+ - "app": Tool callable by the app from this server only`),csp:p.never().optional(),permissions:p.never().optional()}),NP=p.object({mimeTypes:p.array(p.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),EP=p.object({method:p.literal("ui/download-file"),params:p.object({contents:p.array(p.union([Ad,Rd])).describe("Resource contents to download \u2014 embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),ZP=p.object({method:p.literal("ui/message"),params:p.object({role:p.literal("user").describe('Message role, currently only "user" is supported.'),content:p.array(Vr).describe("Message content blocks (text, image, etc.).")})}),DP=p.object({method:p.literal("ui/notifications/sandbox-resource-ready"),params:p.object({html:p.string().describe("HTML content to load into the inner iframe."),sandbox:p.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Ud.optional().describe("CSP configuration from resource metadata."),permissions:Vd.optional().describe("Sandbox permissions from resource metadata.")})}),Kw=p.object({method:p.literal("ui/notifications/tool-result"),params:Fr.describe("Standard MCP tool execution result.")}),tg=p.object({toolInfo:p.object({id:Mr.optional().describe("JSON-RPC id of the tools/call request."),tool:Pa.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:Rw.optional().describe("Current color theme preference."),styles:Vw.optional().describe("Style configuration for theming the app."),displayMode:zo.optional().describe("How the UI is currently displayed."),availableDisplayModes:p.array(zo).optional().describe("Display modes the host supports."),containerDimensions:p.union([p.object({height:p.number().describe("Fixed container height in pixels.")}),p.object({maxHeight:p.union([p.number(),p.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(p.union([p.object({width:p.number().describe("Fixed container width in pixels.")}),p.object({maxWidth:p.union([p.number(),p.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
758
+ container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:p.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:p.string().optional().describe("User's timezone in IANA format."),userAgent:p.string().optional().describe("Host application identifier."),platform:p.union([p.literal("web"),p.literal("desktop"),p.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:p.object({touch:p.boolean().optional().describe("Whether the device supports touch input."),hover:p.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:p.object({top:p.number().describe("Top safe area inset in pixels."),right:p.number().describe("Right safe area inset in pixels."),bottom:p.number().describe("Bottom safe area inset in pixels."),left:p.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),Ww=p.object({method:p.literal("ui/notifications/host-context-changed"),params:tg.describe("Partial context update containing only changed fields.")}),jP=p.object({method:p.literal("ui/update-model-context"),params:p.object({content:p.array(Vr).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:p.record(p.string(),p.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),MP=p.object({method:p.literal("ui/initialize"),params:p.object({appInfo:go.describe("App identification (name and version)."),appCapabilities:Hw.describe("Features and capabilities this app provides."),protocolVersion:p.string().describe("Protocol version this app supports.")})}),Gw=p.object({protocolVersion:p.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:go.describe("Host application identification and version."),hostCapabilities:qw.describe("Features and capabilities provided by the host."),hostContext:tg.describe("Rich context about the host environment.")}).passthrough(),Qw={target:"draft-2020-12"};async function Xh(e,t){let r=e["~standard"];if(r.jsonSchema)return r.jsonSchema[t](Qw);if(r.vendor==="zod"){let{z:n}=await Promise.resolve().then(()=>(po(),bd));return n.toJSONSchema(e,{io:t})}throw Error(`Schema (vendor: ${r.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 eg(e,t,r=""){let n=await e["~standard"].validate(t);if(n.issues){let o=n.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(r+o)}return n.value}function rg(e){let t=document.documentElement;t.setAttribute("data-theme",e),t.style.colorScheme=e}function ng(e,t=document.documentElement){for(let[r,n]of Object.entries(e))n!==void 0&&t.style.setProperty(r,n)}function og(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)}var Ta=class e extends Md{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_assertInitialized(t){if(this._initializedSent)return;let r=`[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(r);console.warn(`${r}. This will throw in a future release.`)}eventSchemas={toolinput:jw,toolinputpartial:Mw,toolresult:Kw,toolcancelled:Lw,hostcontextchanged:Ww};static ONE_SHOT_EVENTS=new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]);_everHadListener=new Set;_assertHandlerTiming(t){if(!e.ONE_SHOT_EVENTS.has(t)||this._everHadListener.has(t)||(this._everHadListener.add(t),!this._initializedSent))return;let r=`[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(r);console.warn(r)}setEventHandler(t,r){r&&this._assertHandlerTiming(t),super.setEventHandler(t,r)}addEventListener(t,r){this._assertHandlerTiming(t),super.addEventListener(t,r)}onEventDispatch(t,r){t==="hostcontextchanged"&&(this._hostContext={...this._hostContext,...r})}constructor(t,r={},n={autoResize:!0}){super(n),this._appInfo=t,this._capabilities=r,this.options=n,n.allowUnsafeEval||p.config({jitless:!0}),this.setRequestHandler(Lr,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=Qh(this._capabilities,t)}registerTool(t,r,n){if(this._registeredTools[t])throw Error(`Tool ${t} is already registered`);let o=this,i=()=>{o._initializedSent&&o._capabilities.tools?.listChanged&&o.sendToolListChanged()},s=r.inputSchema!==void 0,a={title:r.title,description:r.description,inputSchema:r.inputSchema,outputSchema:r.outputSchema,annotations:r.annotations,_meta:r._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 f=a.inputSchema,d=f?await eg(f,c??{},`Invalid input for tool ${t}: `):c??{};l=await n(d,u)}else l=await n(u);return a.outputSchema&&!l.isError&&(l.structuredContent=await eg(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,r)=>{let n=this._registeredTools[t.name];if(!n)throw Error(`Tool ${t.name} not found`);return n.handler(t.arguments,r)},this.onlisttools=async(t,r)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([n,o])=>o.enabled).map(async([n,o])=>{let i={name:n,title:o.title,description:o.description,inputSchema:o.inputSchema?await Xh(o.inputSchema,"input"):{type:"object",properties:{}}};return o.outputSchema&&(i.outputSchema=await Xh(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(Fw,(r,n)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(r.params,n)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(t){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,t),this._oncalltool=t,this.replaceRequestHandler(Nd,(r,n)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(r.params,n)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(t){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,t),this._onlisttools=t,this.replaceRequestHandler(Cd,(r,n)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(r.params,n)})}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,r){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},Fr,{onprogress:()=>{},resetTimeoutOnProgress:!0,...r})}async readServerResource(t,r){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:t},Pd,r)}async listServerResources(t,r){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:t},kd,r)}async createSamplingMessage(t,r){this._assertInitialized("createSamplingMessage");let n=t.tools?Zd:Ed;return await this.request({method:"sampling/createMessage",params:t},n,r)}sendMessage(t,r){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:t},Dw,r)}sendLog(t){return this.notification({method:"notifications/message",params:t})}updateModelContext(t,r){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:t},ya,r)}openLink(t,r){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:t},Ew,r)}sendOpenLink=this.openLink;downloadFile(t,r){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:t},Zw,r)}requestTeardown(t={}){return this.notification({method:"ui/notifications/request-teardown",params:t})}requestDisplayMode(t,r){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:t},Bw,r)}sendSizeChanged(t){return this.notification({method:"ui/notifications/size-changed",params:t})}setupSizeChangedNotifications(){let t=!1,r=0,n=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!==r||c!==n)&&(r=u,n=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 Ld(window.parent,window.parent),r){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1,await super.connect(t);try{let n=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:Ow}},Gw,r);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);this._hostCapabilities=n.hostCapabilities,this._hostInfo=n.hostInfo,this._hostContext=n.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(n){throw this.close(),n}}};function Oa(e){let t=e.content?.map(r=>r.type==="text"?r.text:"").join("");if(e.isError)throw new Error(t||"The tool call failed.");return e.structuredContent?e.structuredContent:JSON.parse(t||"null")}function ig(e){e&&(e.theme&&rg(e.theme),e.styles?.variables&&ng(e.styles.variables),e.styles?.css?.fonts&&og(e.styles.css.fonts))}function sg(e,t){let r=new Ta({name:`open-brain-${e}`,version:"1.0.0"});return r.ontoolinput=n=>t.onInput?.(n.arguments??{}),r.ontoolresult=n=>t.onResult(n),r.onhostcontextchanged=n=>ig(n),r.connect().then(()=>ig(r.getHostContext())).catch(n=>console.error("Open Brain card failed to connect",n)),{async callTool(n,o){return Oa(await r.callServerTool({name:n,arguments:o}))},async open(n,o){let i=await Oa(await r.callServerTool({name:"open_item",arguments:{kind:n,id:o}}));i.opened||await r.openLink({url:i.url})},async openUrl(n){if(!/^https?:\/\//i.test(n))throw new Error("Only web links can be opened.");await r.openLink({url:n})},async sendMessage(n){if((await r.sendMessage({role:"user",content:[{type:"text",text:n}]}))?.isError)throw new Error("The chat didn't accept the message.")},tellModel(n){r.updateModelContext({content:[{type:"text",text:n}]}).catch(()=>{})}}}function vo(e){return e instanceof Error?e.message:String(e)}function ag(e,t,r,n){e.addEventListener("click",o=>{let i=o.target.closest("[data-action]");if(!i||i.hasAttribute("disabled"))return;let s=i.dataset.action??"";if(s==="open"){let{kind:a,id:c}=i.dataset;a&&c&&t.open(a,c).catch(u=>r(vo(u)));return}n(s,i)})}function cg(e,t,r){let n=document.createElement("p");n.className=r?"card error":"card loading",n.setAttribute("role",r?"alert":"status"),n.textContent=r??t,e.replaceChildren(n)}function ug(){let e=document.getElementById("root");if(!e)throw new Error("Missing #root");return e}function Ee(e){return String(e??"").replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t])}function lg(e,t,r,n){return`<button class="${n} open-link" data-action="open" data-kind="${e}" data-id="${Ee(t)}">${Ee(r||"(untitled)")}</button>`}function Aa(e,t=""){return`<span class="chip${t?` ${t}`:""}">${Ee(e)}</span>`}var pg={task:"delete_task",habit:"archive_habit",reading:"delete_reading_item",book:"delete_book"},Yw={task:"Task",habit:"Habit",reading:"Reading",book:"Book"};function fg(e){let t=(r,n)=>(n??[]).map(o=>({kind:r,id:o.id,title:o.title}));return[...t("task",e.created),...t("habit",e.habits?.created),...t("reading",e.readingItems?.created),...t("book",e.books?.created)]}function Fd(e){let t=[e,e.habits,e.readingItems,e.books];return{clarifications:t.flatMap(r=>r?.clarifications??[]),errors:t.flatMap(r=>r?.errors??[]),updated:e.readingItems?.updated??[]}}function dg(e,t){return`Re "${e.title}" (${e.question}): ${t.trim()}`}var Xw={task:"task",habit:"habit",reading:"reading",book:"book"};function mg({rows:e,result:t,answers:r,busy:n,error:o}){let{clarifications:i,errors:s,updated:a}=Fd(t),c=e.filter(b=>!b.undone).length,u=n?" disabled":"",l=e.map((b,w)=>{let S=b.undone?`<span class="row-title">${Ee(b.title)}</span>`:lg(Xw[b.kind],b.id,b.title,"row-title"),$=b.undone?Aa("Undone"):`<button class="link" data-action="undo" data-index="${w}"${u}>Undo</button>`;return`<li class="row${b.undone?" undone":""}"><span class="kind">${Yw[b.kind]}</span>${S}<span class="row-meta">${$}</span></li>`}).join(""),f=a.map(b=>`<li class="row"><span class="kind">Reading</span><span class="row-title">${Ee(b.title)}</span><span class="row-meta">${Aa(`Marked ${b.status??"updated"}`)}</span></li>`).join(""),d=i.map((b,w)=>{let S=r?.get(w),$=S?`<p class="answered">You answered: ${Ee(S)}</p>`:`<form class="reply" data-index="${w}">
759
+ <input name="answer" aria-label="Answer for ${Ee(b.title)}" placeholder="Your answer" autocomplete="off"${u} />
760
+ <button type="submit" class="primary"${u}>Send</button>
761
+ </form>`;return`<li class="question"><strong>${Ee(b.title)}</strong><span>${Ee(b.question)}</span>${$}</li>`}).join(""),m=s.map(b=>`<li class="row failed"><span class="row-title">${Ee(b.title)}</span><span class="row-meta">${Aa(b.error,"danger")}</span></li>`).join("");return`<section class="card triage">
642
762
  <header class="agenda-head">
643
763
  <h1>${e.length?`Captured ${e.length} item${e.length===1?"":"s"}`:"Nothing captured yet"}</h1>
644
- ${o.length?`<span class="count warn">${o.length} to clarify</span>`:""}
645
- ${a>1?`<button data-action="undo-all"${c}>Undo all</button>`:""}
764
+ ${i.length?`<span class="count warn">${i.length} to clarify</span>`:""}
765
+ ${c>1?`<button data-action="undo-all"${u}>Undo all</button>`:""}
646
766
  </header>
647
- ${e.length||s.length?`<ul class="rows">${u}${l}</ul>`:""}
648
- ${f?`<h2>Needs an answer</h2><ul class="questions">${f}</ul><p class="more">Answer in the chat to file them.</p>`:""}
649
- ${d?`<h2>Couldn't save</h2><ul class="rows">${d}</ul>`:""}
650
- ${n?`<p class="error" role="alert">${Fe(n)}</p>`:""}
651
- </section>`}var Ld=cg(),Oa,yt=[],Ud=!1,Xt;function xo(){if(!Oa){ag(Ld,"Triaging\u2026",Xt);return}Ld.innerHTML=fg({rows:yt,result:Oa,busy:Ud,error:Xt})}var Vd=ig("triage",{onResult(e){try{Oa=Pa(e),yt=pg(Oa),Xt=void 0}catch(t){Xt=Ia(t)}xo()}});async function dg(e){let t=e.filter(n=>yt[n]&&!yt[n].undone);if(!t.length)return;Ud=!0,Xt=void 0,xo();let r=[];try{for(let n of t){let o=yt[n];await Vd.callTool(lg[o.kind],{id:o.id}),yt=yt.map((i,s)=>s===n?{...i,undone:!0}:i),r.push(`${o.kind} "${o.title}" (${o.id})`)}}catch(n){Xt=Ia(n)}finally{Ud=!1,xo(),r.length&&Vd.tellModel(`From the triage card, the user undid ${r.length} captured item(s): ${r.join(", ")}.`)}}function Yw(e){Xt=e,xo()}sg(Ld,Vd,Yw,(e,t)=>{e==="undo"&&dg([Number(t.dataset.index)]),e==="undo-all"&&dg(yt.map((r,n)=>n))});xo();})();
767
+ ${e.length||a.length?`<ul class="rows">${l}${f}</ul>`:""}
768
+ ${d?`<h2>Needs an answer</h2><ul class="questions">${d}</ul><p class="more">Answers go to the chat so they can be filed.</p>`:""}
769
+ ${m?`<h2>Couldn't save</h2><ul class="rows">${m}</ul>`:""}
770
+ ${o?`<p class="error" role="alert">${Ee(o)}</p>`:""}
771
+ </section>`}var Ra=ug(),qr,bt=[],gg=new Map,ko=!1,et;function er(){if(!qr){cg(Ra,"Triaging\u2026",et);return}Ra.innerHTML=mg({rows:bt,result:qr,answers:gg,busy:ko,error:et})}var Ca=sg("triage",{onResult(e){try{qr=Oa(e),bt=fg(qr),et=void 0}catch(t){et=vo(t)}er()}});async function hg(e){let t=e.filter(n=>bt[n]&&!bt[n].undone);if(!t.length)return;ko=!0,et=void 0,er();let r=[];try{for(let n of t){let o=bt[n];await Ca.callTool(pg[o.kind],{id:o.id}),bt=bt.map((i,s)=>s===n?{...i,undone:!0}:i),r.push(`${o.kind} "${o.title}" (${o.id})`)}}catch(n){et=vo(n)}finally{ko=!1,er(),r.length&&Ca.tellModel(`From the triage card, the user undid ${r.length} captured item(s): ${r.join(", ")}.`)}}function ex(e){et=e,er()}Ra.addEventListener("submit",async e=>{e.preventDefault();let t=e.target,r=Number(t.dataset.index),o=t.elements.namedItem("answer")?.value.trim(),i=qr?Fd(qr).clarifications[r]:void 0;if(!(!o||!i)){ko=!0,et=void 0,er();try{await Ca.sendMessage(dg(i,o)),gg.set(r,o)}catch(s){et=vo(s)}finally{ko=!1,er()}}});ag(Ra,Ca,ex,(e,t)=>{e==="undo"&&hg([Number(t.dataset.index)]),e==="undo-all"&&hg(bt.map((r,n)=>n))});er();})();
652
772
  </script>
653
773
  </body>
654
774
  </html>